pub struct NPLUtils { /* private fields */ }Expand description
NPL decoder class
Implementations
sourceimpl 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 minute year bit, Some(true) means OK.
sourcepub fn get_parity_2(&self) -> Option<bool>
pub fn get_parity_2(&self) -> Option<bool>
Get the hour month/day 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 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 bits.
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(), 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()