pub struct NPLUtils { /* private fields */ }Expand description
NPL decoder class
Implementations§
Source§impl NPLUtils
impl NPLUtils
pub fn new() -> Self
Sourcepub fn get_first_minute(&self) -> bool
pub fn get_first_minute(&self) -> bool
Return if this is the first minute that is decoded.
Sourcepub fn get_new_minute(&self) -> bool
pub fn get_new_minute(&self) -> bool
Return if a new minute has arrived.
Sourcepub fn force_new_minute(&mut self)
pub fn force_new_minute(&mut self)
Force the arrival of a new minute.
This could be useful when reading from a log file.
This method must be called before increase_second()
Sourcepub fn get_new_second(&self) -> bool
pub fn get_new_second(&self) -> bool
Return if a new second has arrived.
Sourcepub fn get_second(&self) -> u8
pub fn get_second(&self) -> u8
Get the second counter.
Sourcepub fn get_current_bit_a(&self) -> Option<bool>
pub fn get_current_bit_a(&self) -> Option<bool>
Get the value of the current A bit.
Sourcepub fn get_current_bit_b(&self) -> Option<bool>
pub fn get_current_bit_b(&self) -> Option<bool>
Get the value of the current B bit.
Sourcepub fn set_current_bit_a(&mut self, value: Option<bool>)
pub fn set_current_bit_a(&mut self, value: Option<bool>)
Set the value of the current A bit and clear the flag indicating arrival of a new minute.
This could be useful when reading from a log file.
This method must be called before increase_second().
§Arguments
value- the value to set the current bit to
Sourcepub fn set_current_bit_b(&mut self, value: Option<bool>)
pub fn set_current_bit_b(&mut self, value: Option<bool>)
Set the value of the current B bit and clear the flag indicating arrival of a new minute.
This could be useful when reading from a log file.
This method must be called before increase_second().
§Arguments
value- the value to set the current bit to
Sourcepub fn get_radio_datetime(&self) -> RadioDateTimeUtils
pub fn get_radio_datetime(&self) -> RadioDateTimeUtils
Get a copy of the date/time structure.
Sourcepub fn get_parity_1(&self) -> Option<bool>
pub fn get_parity_1(&self) -> Option<bool>
Get the year parity bit, Some(true) means OK.
Sourcepub fn get_parity_2(&self) -> Option<bool>
pub fn get_parity_2(&self) -> Option<bool>
Get the month/day parity bit, Some(true) means OK.
Sourcepub fn get_parity_3(&self) -> Option<bool>
pub fn get_parity_3(&self) -> Option<bool>
Get the weekday parity bit, Some(true) means OK.
Sourcepub fn get_parity_4(&self) -> Option<bool>
pub fn get_parity_4(&self) -> Option<bool>
Get the hour/minute parity bit, Some(true) means OK.
Sourcepub fn get_spike_limit(&self) -> u32
pub fn get_spike_limit(&self) -> u32
Return the current spike limit in microseconds.
Sourcepub fn set_spike_limit(&mut self, value: u32)
pub fn set_spike_limit(&mut self, value: u32)
Set the new spike limit in microseconds, [0(off)..ACTIVE_0_LIMIT)
§Arguments
value- the value to set the spike limit to.
Sourcepub fn handle_new_edge(&mut self, is_low_edge: bool, t: u32)
pub fn handle_new_edge(&mut self, is_low_edge: bool, t: u32)
Determine the bit value if a new edge is received. indicates reception errors, and checks if a new minute has started.
This function can deal with spikes, which are arbitrarily set to spike_limit microseconds.
This method must be called before increase_second().
§Arguments
is_low_edge- indicates that the edge has gone from high to low (as opposed to low-to-high).t- time stamp of the received edge, in microseconds
Sourcepub fn get_minute_length(&self) -> u8
pub fn get_minute_length(&self) -> u8
Determine the length of this minute in seconds.
Sourcepub fn end_of_minute_marker_present(&self, look_ahead: bool) -> bool
pub fn end_of_minute_marker_present(&self, look_ahead: bool) -> bool
Return if the end-of-minute marker (0111_1110) is present at the end of the A bits.
This method must be called before increase_second()
§Arguments
look_ahead- look ahead one second to check for a positive leap second
Sourcepub fn increase_second(&mut self)
pub fn increase_second(&mut self)
Increase or reset second and clear first_minute when appropriate.
This method must be called after decode_time(), handle_new_edge(),
set_current_bit_a(), set_current_bit_b(), end_of_minute_marker_present()
and force_new_minute().
Sourcepub fn decode_time(&mut self)
pub fn decode_time(&mut self)
Decode the time broadcast during the last minute.
This method must be called before increase_second()