Skip to main content

relay_rssi_code

Function relay_rssi_code 

Source
pub fn relay_rssi_code(rssi_dbm: i16) -> u16
Expand description

The coded signal strength a relay reports, TS011-1.0.1 sections 9.1 and 10.7: -15 - code dBm, clamped to what seven bits carry.

§Arguments

  • rssi_dbm - the strength in dBm.

§Returns

The code, 0 for -15 dBm or stronger and 127 for -142 dBm or weaker.

§Examples

use pamoja_lorawan::mac::relay_rssi_code;

assert_eq!(relay_rssi_code(-15), 0);
assert_eq!(relay_rssi_code(-100), 85);
assert_eq!(relay_rssi_code(-160), 127, "clamped to the weakest");
assert_eq!(relay_rssi_code(0), 0, "clamped to the strongest");