pub struct StateSync {
pub cad_to_rx: CadToRx,
pub forward: Forward,
pub relay_data_rate: u8,
pub xtal_accuracy: XtalAccuracy,
pub cad_periodicity: CadPeriodicity,
pub t_offset_ms: u16,
}Expand description
What a relay tells an end device about itself in a WOR ACK, TS011-1.0.1 table 14.
Fields§
§cad_to_rx: CadToRxHow long the relay takes from detecting activity to receiving.
forward: ForwardWhether it will forward the uplink.
relay_data_rate: u8The data rate the relay forwards at, which bounds the device’s payload.
xtal_accuracy: XtalAccuracyHow accurate its crystal is.
cad_periodicity: CadPeriodicityHow often it scans.
t_offset_ms: u16The milliseconds from the start of the scan that heard the frame to the end of the frame’s preamble, eleven bits wide.
Implementations§
Source§impl StateSync
impl StateSync
Sourcepub const MAX_T_OFFSET_MS: u16 = 0x07ff
pub const MAX_T_OFFSET_MS: u16 = 0x07ff
The largest offset the eleven-bit field holds, in milliseconds.
Sourcepub fn to_bits(&self) -> Result<u32, LorawanError>
pub fn to_bits(&self) -> Result<u32, LorawanError>
Packs the state into the 24 bits a WOR ACK carries.
§Returns
The bits: CadToRx 23:22, Forward 21:20, RelayDataRate 19:16, XTALAccuracy 15:14, CADPeriodicity 13:11 and TOffset 10:0.
§Errors
Returns LorawanError::MalformedFrame for a data rate past 15 or an offset past
MAX_T_OFFSET_MS.
Sourcepub fn from_bits(bits: u32) -> Result<StateSync, LorawanError>
pub fn from_bits(bits: u32) -> Result<StateSync, LorawanError>
Unpacks the 24 bits a WOR ACK carries.
§Arguments
bits- the state; bits past the 24th are ignored.
§Returns
The state.
§Errors
Returns LorawanError::MalformedFrame for a reserved scan periodicity.