NPLUtils

Struct NPLUtils 

Source
pub struct NPLUtils { /* private fields */ }
Expand description

NPL decoder class

Implementations§

Source§

impl NPLUtils

Source

pub fn new() -> Self

Source

pub fn get_first_minute(&self) -> bool

Return if this is the first minute that is decoded.

Source

pub fn get_new_minute(&self) -> bool

Return if a new minute has arrived.

Source

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()

Source

pub fn get_new_second(&self) -> bool

Return if a new second has arrived.

Source

pub fn get_second(&self) -> u8

Get the second counter.

Source

pub fn get_current_bit_a(&self) -> Option<bool>

Get the value of the current A bit.

Source

pub fn get_current_bit_b(&self) -> Option<bool>

Get the value of the current B bit.

Source

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
Source

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
Source

pub fn get_radio_datetime(&self) -> RadioDateTimeUtils

Get a copy of the date/time structure.

Source

pub fn get_parity_1(&self) -> Option<bool>

Get the year parity bit, Some(true) means OK.

Source

pub fn get_parity_2(&self) -> Option<bool>

Get the month/day parity bit, Some(true) means OK.

Source

pub fn get_parity_3(&self) -> Option<bool>

Get the weekday parity bit, Some(true) means OK.

Source

pub fn get_parity_4(&self) -> Option<bool>

Get the hour/minute parity bit, Some(true) means OK.

Source

pub fn get_dut1(&self) -> Option<i8>

Get the value of DUT1 (UT1 - UTC) in deci-seconds.

Source

pub fn get_spike_limit(&self) -> u32

Return the current spike limit in microseconds.

Source

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.
Source

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
Source

pub fn get_minute_length(&self) -> u8

Determine the length of this minute in seconds.

Source

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
Source

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().

Source

pub fn decode_time(&mut self)

Decode the time broadcast during the last minute.

This method must be called before increase_second()

Trait Implementations§

Source§

impl Default for NPLUtils

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.