pub struct Txpk {
pub immediate: bool,
pub timestamp_us: Option<u32>,
pub gps_millis: Option<u64>,
pub frequency_hz: u32,
pub rf_chain: u8,
pub power_dbm: i8,
pub modulation: Modulation,
pub frequency_deviation_hz: Option<u32>,
pub invert_polarity: bool,
pub preamble_symbols: Option<u16>,
pub without_crc: bool,
pub payload: Vec<u8>,
}Expand description
A packet the server asks the gateway to transmit.
§Examples
use pamoja_gateway::udp::Txpk;
use pamoja_lora::LinkSettings;
let downlink = Txpk::at(3_512_348_611, 868_500_000, LinkSettings::new(9, 125_000), b"ok".to_vec())
.with_power_dbm(27)
.with_inverted_polarity(true);
assert!(downlink.to_json().contains("\"ipol\":true"));Fields§
§immediate: boolWhether to transmit at once, which ignores the timestamps.
timestamp_us: Option<u32>The concentrator timestamp to transmit at, in microseconds.
gps_millis: Option<u64>The GPS time to transmit at, in milliseconds since 6 January 1980.
frequency_hz: u32The carrier to transmit on, in hertz.
rf_chain: u8The radio chain to transmit from.
power_dbm: i8The power to transmit at, in dBm.
modulation: ModulationHow to modulate it.
frequency_deviation_hz: Option<u32>The FSK frequency deviation in hertz.
invert_polarity: boolWhether to invert the LoRa polarity, which a LoRaWAN downlink does.
preamble_symbols: Option<u16>How long a preamble to send, in symbols.
without_crc: boolWhether to leave the physical CRC off, which LoRaWAN downlinks do.
payload: Vec<u8>The packet itself.
Implementations§
Source§impl Txpk
impl Txpk
Sourcepub fn at(
timestamp_us: u32,
frequency_hz: u32,
link: LinkSettings,
payload: Vec<u8>,
) -> Txpk
pub fn at( timestamp_us: u32, frequency_hz: u32, link: LinkSettings, payload: Vec<u8>, ) -> Txpk
Describes a LoRa packet to transmit at a concentrator timestamp, which is how a LoRaWAN receive window is hit.
§Arguments
timestamp_us- the concentrator counter value to transmit at.frequency_hz- the carrier.link- the spreading factor, bandwidth, and coding rate.payload- the packet.
§Returns
The request.
Sourcepub fn with_power_dbm(self, dbm: i8) -> Txpk
pub fn with_power_dbm(self, dbm: i8) -> Txpk
Sourcepub fn with_inverted_polarity(self, inverted: bool) -> Txpk
pub fn with_inverted_polarity(self, inverted: bool) -> Txpk
Sourcepub fn without_crc(self) -> Txpk
pub fn without_crc(self) -> Txpk
Sourcepub fn from_json(body: &[u8]) -> Result<Txpk, ProtocolError>
pub fn from_json(body: &[u8]) -> Result<Txpk, ProtocolError>
Reads the payload of a PULL_RESP.
§Arguments
body- the bytes after the header.
§Returns
The request it carries.
§Errors
Returns ProtocolError::Payload when the body is not a JSON object with a txpk
the protocol describes.