Skip to main content

unsynchronized_preamble_symbols

Function unsynchronized_preamble_symbols 

Source
pub fn unsynchronized_preamble_symbols(
    cad_periodicity: CadPeriodicity,
    symbol_us: u64,
    cad_to_rx: CadToRx,
) -> u16
Expand description

The preamble length of an end device that does not know when the relay scans, TS011-1.0.1 section 5.2.

floor(CADPeriodicity / TSYMB) + 1 + 6 + CadToRx. An end device that has never heard from the relay assumes a second between scans and eight symbols to receive.

§Arguments

  • cad_periodicity - how often the relay scans.
  • symbol_us - the symbol time of the WOR frame’s data rate, in microseconds.
  • cad_to_rx - how long the relay takes to start receiving.

§Returns

The preamble length in symbols, capped at what a radio’s sixteen-bit preamble register holds.

§Examples

use pamoja_lorawan::relay::{unsynchronized_preamble_symbols, CadPeriodicity, CadToRx};

// TS011-1.0.1 appendix 1: SF10 at 125 kHz, 8.192 ms a symbol, a relay scanning every
// 500 ms and taking 4 symbols to receive.
assert_eq!(
    unsynchronized_preamble_symbols(CadPeriodicity::Ms500, 8_192, CadToRx::Symbols4),
    72
);