pub struct Rxpk {
pub received_at: Option<String>,
pub gps_millis: Option<u64>,
pub timestamp_us: Option<u32>,
pub frequency_hz: u32,
pub channel: u8,
pub rf_chain: u8,
pub crc: CrcStatus,
pub modulation: Modulation,
pub rssi_dbm: Decibels,
pub snr_db: Option<Decibels>,
pub payload: Vec<u8>,
}Expand description
A packet the gateway heard, with the metadata the protocol carries beside it.
§Examples
use pamoja_gateway::udp::Rxpk;
use pamoja_lora::LinkSettings;
let heard = Rxpk::new(868_100_000, LinkSettings::new(7, 125_000), b"hello".to_vec())
.with_rssi_dbm(-35)
.with_snr_db(5.1);
assert!(heard.to_json().contains("\"datr\":\"SF7BW125\""));
assert!(heard.to_json().contains("\"freq\":868.1"));Fields§
§received_at: Option<String>When the packet arrived, as time::compact writes it.
gps_millis: Option<u64>When it arrived on the GPS clock, in milliseconds since 6 January 1980.
timestamp_us: Option<u32>The concentrator’s own timestamp of the end of reception, in microseconds.
frequency_hz: u32The carrier the packet arrived on, in hertz.
channel: u8The concentrator channel it arrived on.
rf_chain: u8The radio chain it arrived on.
crc: CrcStatusWhat the CRC said.
modulation: ModulationHow it was modulated.
rssi_dbm: DecibelsThe received signal strength, to the decibel.
snr_db: Option<Decibels>The signal-to-noise ratio, to a tenth of a decibel, for a LoRa packet.
payload: Vec<u8>The packet itself.
Implementations§
Source§impl Rxpk
impl Rxpk
Sourcepub fn with_rssi_dbm(self, dbm: i32) -> Rxpk
pub fn with_rssi_dbm(self, dbm: i32) -> Rxpk
Sourcepub fn with_snr_db(self, db: f64) -> Rxpk
pub fn with_snr_db(self, db: f64) -> Rxpk
Sourcepub fn with_timestamp_us(self, micros: u32) -> Rxpk
pub fn with_timestamp_us(self, micros: u32) -> Rxpk
Sourcepub fn with_received_at(self, micros_since_epoch: u64) -> Rxpk
pub fn with_received_at(self, micros_since_epoch: u64) -> Rxpk
Sourcepub fn on_channel(self, channel: u8, rf_chain: u8) -> Rxpk
pub fn on_channel(self, channel: u8, rf_chain: u8) -> Rxpk
Trait Implementations§
impl StructuralPartialEq for Rxpk
Auto Trait Implementations§
impl Freeze for Rxpk
impl RefUnwindSafe for Rxpk
impl Send for Rxpk
impl Sync for Rxpk
impl Unpin for Rxpk
impl UnsafeUnpin for Rxpk
impl UnwindSafe for Rxpk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more