Skip to main content

relay_second_channel

Function relay_second_channel 

Source
pub fn relay_second_channel(
    second_channel_index: u8,
    data_rate: u8,
    ack_offset: u8,
    frequency_hz: u32,
) -> Option<RelayChannel>
Expand description

The second channel a relay configuration describes, where it names one.

§Arguments

  • second_channel_index - the coded index, 1 for a second channel.
  • data_rate - its data rate.
  • ack_offset - the coded acknowledgment offset.
  • frequency_hz - its frequency.

§Returns

The channel, with the acknowledgment frequency worked out, or None when the index or offset is not one TS011-1.0.1 defines.

§Examples

use pamoja_lora::region::RelayChannel;
use pamoja_lorawan::mac::relay_second_channel;

assert_eq!(
    relay_second_channel(1, 3, 1, 868_100_000),
    Some(RelayChannel::new(868_100_000, 868_300_000, 3)),
    "offset 1 is 200 kHz"
);
assert_eq!(relay_second_channel(0, 3, 1, 868_100_000), None, "no second channel");
assert_eq!(relay_second_channel(1, 3, 6, 868_100_000), None, "offset 6 is reserved");