Struct lrwn::PhyPayload
source · pub struct PhyPayload {
pub mhdr: MHDR,
pub payload: Payload,
pub mic: Option<[u8; 4]>,
}
Expand description
PhyPayload represents the LoRaWAN PHY payload.
Join-request example:
use std::str::FromStr;
use lrwn::*;
let app_key = AES128Key::from_str("0102030405060708090a0b0c0d0e0f10").unwrap();
let mut phy = PhyPayload {
mhdr: MHDR {
m_type: MType::JoinRequest,
major: Major::LoRaWANR1,
},
payload: Payload::JoinRequest(JoinRequestPayload {
join_eui: EUI64::from_str("0101010101010101").unwrap(),
dev_eui: EUI64::from_str("0202020202020202").unwrap(),
dev_nonce: 771,
}),
mic: None,
};
phy.set_join_request_mic(&app_key).unwrap();
assert_eq!([0x9, 0xb9, 0x7b, 0x32], phy.mic.unwrap());
let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x09, 0xb9, 0x7b, 0x32], bytes);
let phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(phy, phy_decoded);
assert_eq!(true, phy_decoded.validate_join_request_mic(&app_key).unwrap());
LoRaWAN 1.0.x Join-accept example:
use std::str::FromStr;
use lrwn::*;
let app_key = AES128Key::from_str("0102030405060708090a0b0c0d0e0f10").unwrap();
let join_eui = EUI64::from_str("0807060504030201").unwrap();
let dev_nonce = 258;
let mut phy = PhyPayload {
mhdr: MHDR {
m_type: MType::JoinAccept,
major: Major::LoRaWANR1,
},
payload: Payload::JoinAccept(JoinAcceptPayload {
join_nonce: 65793,
home_netid: NetID::from_str("020202").unwrap(),
devaddr: DevAddr::from_str("01020304").unwrap(),
dl_settings: DLSettings {
opt_neg: false,
rx2_dr: 0,
rx1_dr_offset: 0,
},
cflist: None,
rx_delay: 0,
}),
mic: None,
};
phy.set_join_accept_mic(JoinType::Join, &join_eui, dev_nonce, &app_key).unwrap();
assert_eq!([0x34, 0x49, 0xf2, 0x12], phy.mic.unwrap());
phy.encrypt_join_accept_payload(&app_key).unwrap();
let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0x20, 0x23, 0xcf, 0x33, 0x54, 0x89, 0xaa, 0xe3, 0x18, 0x3c, 0x0b, 0xe0, 0xba, 0xa8, 0xde, 0xe5, 0xf3], bytes);
let mut phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
phy_decoded.decrypt_join_accept_payload(&app_key).unwrap();
assert_eq!(true, phy_decoded.validate_join_accept_mic(JoinType::Join, &join_eui, dev_nonce, &app_key).unwrap());
assert_eq!(PhyPayload {
mhdr: MHDR {
m_type: MType::JoinAccept,
major: Major::LoRaWANR1,
},
payload: Payload::JoinAccept(JoinAcceptPayload {
join_nonce: 65793,
home_netid: NetID::from_str("020202").unwrap(),
devaddr: DevAddr::from_str("01020304").unwrap(),
dl_settings: DLSettings {
opt_neg: false,
rx2_dr: 0,
rx1_dr_offset: 0,
},
cflist: None,
rx_delay: 0,
}),
mic: Some([0x34, 0x49, 0xf2, 0x12]),
}, phy_decoded);
LoRaWAN 1.1.x Join-accept example:
use std::str::FromStr;
use lrwn::*;
let app_key = AES128Key::from_str("0102030405060708090a0b0c0d0e0f10").unwrap();
let join_eui = EUI64::from_str("0807060504030201").unwrap();
let dev_nonce = 258;
let mut phy = PhyPayload {
mhdr: MHDR {
m_type: MType::JoinAccept,
major: Major::LoRaWANR1,
},
payload: Payload::JoinAccept(JoinAcceptPayload {
join_nonce: 65793,
home_netid: NetID::from_str("020202").unwrap(),
devaddr: DevAddr::from_str("01020304").unwrap(),
dl_settings: DLSettings {
opt_neg: true, // Note that opt_neg is set to true!
rx2_dr: 0,
rx1_dr_offset: 0,
},
cflist: None,
rx_delay: 0,
}),
mic: None,
};
phy.set_join_accept_mic(JoinType::Join, &join_eui, dev_nonce, &app_key).unwrap();
assert_eq!([0x93, 0xff, 0x9a, 0x3a], phy.mic.unwrap());
phy.encrypt_join_accept_payload(&app_key).unwrap();
let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0x20, 0x7a, 0xbe, 0xea, 0x06, 0xb0, 0x29, 0x20, 0xf1, 0x1c, 0x02, 0xd0, 0x34, 0x8f, 0xcf, 0x18, 0x15], bytes);
let mut phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
phy_decoded.decrypt_join_accept_payload(&app_key).unwrap();
assert_eq!(true, phy_decoded.validate_join_accept_mic(JoinType::Join, &join_eui, dev_nonce, &app_key).unwrap());
assert_eq!(PhyPayload {
mhdr: MHDR {
m_type: MType::JoinAccept,
major: Major::LoRaWANR1,
},
payload: Payload::JoinAccept(JoinAcceptPayload {
join_nonce: 65793,
home_netid: NetID::from_str("020202").unwrap(),
devaddr: DevAddr::from_str("01020304").unwrap(),
dl_settings: DLSettings {
opt_neg: true,
rx2_dr: 0,
rx1_dr_offset: 0,
},
cflist: None,
rx_delay: 0,
}),
mic: Some([0x93, 0xff, 0x9a, 0x3a]),
}, phy_decoded);
LoRaWAN 1.0.x confirmed uplink example:
use std::str::FromStr;
use lrwn::*;
let nwk_s_key = AES128Key::from_str("0102030405060708090a0b0c0d0e0f10").unwrap();
let app_s_key = AES128Key::from_str("100f0e0d0c0b0a090807060504030201").unwrap();
let mut phy = PhyPayload {
mhdr: MHDR {
m_type: MType::ConfirmedDataUp,
major: Major::LoRaWANR1,
},
payload: Payload::MACPayload(MACPayload{
fhdr: FHDR{
devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
f_ctrl: FCtrl::default(),
f_cnt: 0,
f_opts: MACCommandSet::new(vec![
MACCommand::DevStatusAns(DevStatusAnsPayload{
battery: 115,
margin: 7,
}),
]),
},
f_port: Some(10),
frm_payload: Some(FRMPayload::Raw(vec![0x01, 0x02, 0x03, 0x04])),
}),
mic: None,
};
phy.encrypt_frm_payload(&app_s_key).unwrap();
phy.set_uplink_data_mic(MACVersion::LoRaWAN1_0, 0, 0, 0, &nwk_s_key, &nwk_s_key);
let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0x80, 0x04, 0x03, 0x02, 0x01, 0x03, 0x00, 0x00, 0x06, 0x73, 0x07, 0x0a, 0xe2, 0x64, 0xd4, 0xf7, 0xe1, 0x17, 0xd2, 0xc0], bytes);
let mut phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(true, phy_decoded.validate_uplink_data_mic(MACVersion::LoRaWAN1_0, 0, 0, 0, &nwk_s_key, &nwk_s_key).unwrap());
phy_decoded.decrypt_frm_payload(&app_s_key).unwrap();
if let Payload::MACPayload(pl) = &phy_decoded.payload {
if let FRMPayload::Raw(b) = &pl.frm_payload.as_ref().unwrap() {
assert_eq!(&vec![0x01, 0x02, 0x03, 0x04], b);
} else {
panic!("No FrmPayload!");
}
} else {
panic!("No MacPayload!");
}
LoRaWAN 1.1.x downlink with encrypted f_opts example:
use std::str::FromStr;
use lrwn::*;
let s_nwk_s_int_key = AES128Key::from_str("01010101010101010101010101010100").unwrap();
let nwk_s_enc_key = AES128Key::from_str("01010101010101010101010101010200").unwrap();
let app_s_key = AES128Key::from_str("100f0e0d0c0b0a090807060504030201").unwrap();
let mut phy = PhyPayload {
mhdr: MHDR{
m_type: MType::UnconfirmedDataDown,
major: Major::LoRaWANR1,
},
payload: Payload::MACPayload(MACPayload{
fhdr: FHDR{
devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
f_ctrl: FCtrl::default(),
f_cnt: 0,
f_opts: MACCommandSet::new(vec![
MACCommand::LinkCheckAns(LinkCheckAnsPayload{
margin: 7,
gw_cnt: 1,
}),
]),
},
f_port: Some(1),
frm_payload: Some(FRMPayload::Raw(vec![0x01, 0x02, 0x03, 0x04])),
}),
mic: None,
};
phy.encrypt_f_opts(&nwk_s_enc_key).unwrap();
phy.encrypt_frm_payload(&app_s_key).unwrap();
phy.set_downlink_data_mic(MACVersion::LoRaWAN1_1, 0, &s_nwk_s_int_key).unwrap();
let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0x60, 0x04, 0x03, 0x02, 0x01, 0x03, 0x00, 0x00, 0x22, 0xac, 0x0a, 0x01, 0xf0, 0xb4, 0x68, 0xdd, 0xaa, 0x5e, 0xd1, 0x3a], bytes);
let mut phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(true, phy_decoded.validate_downlink_data_mic(MACVersion::LoRaWAN1_1, 0, &s_nwk_s_int_key).unwrap());
phy_decoded.decrypt_f_opts(&nwk_s_enc_key).unwrap();
phy_decoded.decrypt_frm_payload(&app_s_key).unwrap();
if let Payload::MACPayload(pl) = &phy_decoded.payload {
assert_eq!(MACCommandSet::new(vec![
MACCommand::LinkCheckAns(LinkCheckAnsPayload{
margin: 7,
gw_cnt: 1,
}),
]), pl.fhdr.f_opts);
if let FRMPayload::Raw(b) = &pl.frm_payload.as_ref().unwrap() {
assert_eq!(&vec![0x01, 0x02, 0x03, 0x04], b);
} else {
panic!("No FrmPayload!");
}
} else {
panic!("No MacPayload");
}
Proprietary example:
use std::str::FromStr;
use lrwn::*;
let phy = PhyPayload {
mhdr: MHDR {
m_type: MType::Proprietary,
major: Major::LoRaWANR1,
},
payload: Payload::Raw(vec![0x01, 0x02, 0x03]),
mic: None,
};
let bytes = phy.to_vec().unwrap();
assert_eq!(vec![0xe0, 0x01, 0x02, 0x03], bytes);
let phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(phy, phy_decoded);
LoRaWAN 1.0.x Relay ForwardUplinkReq example:
use std::str::FromStr;
use lrwn::*;
// Payload from the end-device.
let ed_app_key = AES128Key::from_str("01020304050607080102030405060708").unwrap();
let mut ed_phy = PhyPayload {
mhdr: MHDR {
m_type: MType::JoinRequest,
major: Major::LoRaWANR1,
},
payload: Payload::JoinRequest(JoinRequestPayload {
join_eui: EUI64::from_str("0101010101010101").unwrap(),
dev_eui: EUI64::from_str("0202020202020202").unwrap(),
dev_nonce: 771,
}),
mic: None,
};
ed_phy.set_join_request_mic(&ed_app_key).unwrap();
// Relay ForwardUplinkReq (which will forward the end-device payload).
let relay_nwk_s_key = AES128Key::from_str("08070605040302010807060504030201").unwrap();
let mut relay_phy = PhyPayload {
mhdr: MHDR {
m_type: MType::UnconfirmedDataUp,
major: Major::LoRaWANR1,
},
payload: Payload::MACPayload(MACPayload {
fhdr: FHDR {
devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
f_cnt: 10,
..Default::default()
},
f_port: Some(226),
frm_payload: Some(FRMPayload::ForwardUplinkReq(ForwardUplinkReq {
metadata: UplinkMetadata {
dr: 5,
snr: 7,
rssi: -80,
wor_channel: 1,
},
frequency: 868100000,
payload: Box::new(ed_phy.clone()),
})),
}),
mic: None,
};
relay_phy.encrypt_frm_payload(&relay_nwk_s_key).unwrap();
relay_phy.set_uplink_data_mic(MACVersion::LoRaWAN1_0, 0, 0, 0, &relay_nwk_s_key, &relay_nwk_s_key);
let bytes = relay_phy.to_vec().unwrap();
assert_eq!(vec![0x40, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0a, 0x00, 0xe2, 0x2f, 0x68, 0xf4, 0xa5, 0x0a, 0xdf, 0xfb, 0x64, 0xef, 0x37, 0x91, 0x0f, 0x14, 0x6a, 0x6c, 0x2b, 0xda, 0x4f, 0x7e, 0x2d, 0xb9, 0x6a, 0xc8, 0x99, 0xa8, 0xa4, 0x72, 0x7d, 0x0a, 0xbd, 0xc9, 0xae, 0x51], bytes);
let mut relay_phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(relay_phy, relay_phy_decoded);
relay_phy_decoded.decrypt_frm_payload(&relay_nwk_s_key).unwrap();
assert_eq!(PhyPayload{
mhdr: MHDR {
m_type: MType::UnconfirmedDataUp,
major: Major::LoRaWANR1,
},
payload: Payload::MACPayload(MACPayload {
fhdr: FHDR {
devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
f_cnt: 10,
..Default::default()
},
f_port: Some(226),
frm_payload: Some(FRMPayload::ForwardUplinkReq(ForwardUplinkReq {
metadata: UplinkMetadata {
dr: 5,
snr: 7,
rssi: -80,
wor_channel: 1,
},
frequency: 868100000,
payload: Box::new(ed_phy),
})),
}),
mic: Some([0xbd, 0xc9, 0xae, 0x51]),
}, relay_phy_decoded);
LoRaWAN 1.0.x Relay ForwardDownlinkReq example:
use std::str::FromStr;
use lrwn::*;
// Payload for the end-device.
let ed_app_key = AES128Key::from_str("0102030405060708090a0b0c0d0e0f10").unwrap();
let ed_join_eui = EUI64::from_str("0807060504030201").unwrap();
let ed_dev_nonce = 258;
let mut ed_phy = PhyPayload {
mhdr: MHDR {
m_type: MType::JoinAccept,
major: Major::LoRaWANR1,
},
payload: Payload::JoinAccept(JoinAcceptPayload {
join_nonce: 65793,
home_netid: NetID::from_str("020202").unwrap(),
devaddr: DevAddr::from_str("01020304").unwrap(),
dl_settings: DLSettings {
opt_neg: false,
rx2_dr: 0,
rx1_dr_offset: 0,
},
cflist: None,
rx_delay: 0,
}),
mic: None,
};
ed_phy.set_join_accept_mic(JoinType::Join, &ed_join_eui, ed_dev_nonce, &ed_app_key).unwrap();
ed_phy.encrypt_join_accept_payload(&ed_app_key).unwrap();
// Payload for the Relay containing the ForwardDownlinkReq.
let relay_nwk_s_key = AES128Key::from_str("08070605040302010807060504030201").unwrap();
let mut relay_phy = PhyPayload {
mhdr: MHDR {
m_type: MType::UnconfirmedDataDown,
major: Major::LoRaWANR1,
},
payload: Payload::MACPayload(MACPayload {
fhdr: FHDR {
devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
f_cnt: 10,
..Default::default()
},
f_port: Some(226),
frm_payload: Some(FRMPayload::ForwardDownlinkReq(ForwardDownlinkReq {
payload: Box::new(ed_phy.clone()),
})),
}),
mic: None,
};
relay_phy.encrypt_frm_payload(&relay_nwk_s_key).unwrap();
relay_phy.set_downlink_data_mic(MACVersion::LoRaWAN1_0, 0, &relay_nwk_s_key).unwrap();
let bytes = relay_phy.to_vec().unwrap();
assert_eq!(vec![0x60, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0a, 0x00, 0xe2, 0xc9, 0x60, 0x41, 0x64, 0xc9, 0x7d, 0x76, 0xf9, 0xea, 0x8e, 0x1a, 0x79, 0x2b, 0xa0, 0x87, 0x9b, 0x85, 0x24, 0x3e, 0x5a, 0xf5], bytes);
let mut relay_phy_decoded = PhyPayload::from_slice(&bytes).unwrap();
assert_eq!(relay_phy, relay_phy_decoded);
relay_phy_decoded.decrypt_frm_payload(&relay_nwk_s_key).unwrap();
assert_eq!(PhyPayload {
mhdr: MHDR {
m_type: MType::UnconfirmedDataDown,
major: Major::LoRaWANR1,
},
payload: Payload::MACPayload(MACPayload {
fhdr: FHDR {
devaddr: DevAddr::from_be_bytes([0x01, 0x02, 0x03, 0x04]),
f_cnt: 10,
..Default::default()
},
f_port: Some(226),
frm_payload: Some(FRMPayload::ForwardDownlinkReq(ForwardDownlinkReq {
payload: Box::new(ed_phy),
})),
}),
mic: Some([0x24, 0x3e, 0x5a, 0xf5]),
}, relay_phy_decoded);
Fields§
§mhdr: MHDR
§payload: Payload
§mic: Option<[u8; 4]>
This field is not used in case of the proprietary message-type.
Implementations§
source§impl PhyPayload
impl PhyPayload
pub fn to_vec(&self) -> Result<Vec<u8>>
pub fn from_slice(b: &[u8]) -> Result<Self>
sourcepub fn set_uplink_data_mic(
&mut self,
mac_version: MACVersion,
conf_f_cnt: u32,
tx_dr: u8,
tx_ch: u8,
f_nwk_s_int_key: &AES128Key,
s_nwk_s_int_key: &AES128Key,
) -> Result<()>
pub fn set_uplink_data_mic( &mut self, mac_version: MACVersion, conf_f_cnt: u32, tx_dr: u8, tx_ch: u8, f_nwk_s_int_key: &AES128Key, s_nwk_s_int_key: &AES128Key, ) -> Result<()>
Calculate and set the MIC field for uplink data frames. The conf_f_cnt, tx_dr, tx_ch and s_nwk_s_int_key are only required for LoRaWAN 1.1 and can be left blank for LoRaWAN 1.0.
sourcepub fn validate_uplink_data_mic(
&self,
mac_version: MACVersion,
conf_f_cnt: u32,
tx_dr: u8,
tx_ch: u8,
f_nwk_s_int_key: &AES128Key,
s_nwk_s_int_key: &AES128Key,
) -> Result<bool>
pub fn validate_uplink_data_mic( &self, mac_version: MACVersion, conf_f_cnt: u32, tx_dr: u8, tx_ch: u8, f_nwk_s_int_key: &AES128Key, s_nwk_s_int_key: &AES128Key, ) -> Result<bool>
Validate the MIC of an uplink data frame. In order to validate the MIC, the f_cnt value must be first set to the full 32 bit frame-counter value, as only the 16 lsb are transmitted over the air. The conf_f_cnt, tx_dr, tx_ch and s_nwk_s_int_key are only required for LoRaWAN 1.1 and can be left blank for LoRaWAN 1.0.
sourcepub fn set_downlink_data_mic(
&mut self,
mac_version: MACVersion,
conf_f_cnt: u32,
s_nwk_s_int_key: &AES128Key,
) -> Result<()>
pub fn set_downlink_data_mic( &mut self, mac_version: MACVersion, conf_f_cnt: u32, s_nwk_s_int_key: &AES128Key, ) -> Result<()>
Set the MIC for downlink data frames. The conf_f_cnt is only required for LoRaWAN 1.1 and can be left blank for LoRaWAN 1.0.
pub fn validate_downlink_data_mic( &mut self, mac_version: MACVersion, conf_f_cnt: u32, s_nwk_s_int_key: &AES128Key, ) -> Result<bool>
sourcepub fn validate_uplink_data_micf(
&self,
f_nwk_s_int_key: &AES128Key,
) -> Result<bool>
pub fn validate_uplink_data_micf( &self, f_nwk_s_int_key: &AES128Key, ) -> Result<bool>
Validate the cmacF part of the uplink data MIC (LoRaWAN 1.1 only). In order to validate the MIC, the f_cnt value must be first set to the full 32 bit frame-counter value, as only the 16 lsb are transmitted over the air.
sourcepub fn set_join_request_mic(&mut self, key: &AES128Key) -> Result<()>
pub fn set_join_request_mic(&mut self, key: &AES128Key) -> Result<()>
Set the join-request MIC.
sourcepub fn validate_join_request_mic(&self, key: &AES128Key) -> Result<bool>
pub fn validate_join_request_mic(&self, key: &AES128Key) -> Result<bool>
Validate the join-request MIC.
sourcepub fn set_join_accept_mic(
&mut self,
join_req_type: JoinType,
join_eui: &EUI64,
dev_nonce: u16,
key: &AES128Key,
) -> Result<()>
pub fn set_join_accept_mic( &mut self, join_req_type: JoinType, join_eui: &EUI64, dev_nonce: u16, key: &AES128Key, ) -> Result<()>
Set the the downlink join-accept MIC.
sourcepub fn validate_join_accept_mic(
&self,
join_req_type: JoinType,
join_eui: &EUI64,
dev_nonce: u16,
key: &AES128Key,
) -> Result<bool>
pub fn validate_join_accept_mic( &self, join_req_type: JoinType, join_eui: &EUI64, dev_nonce: u16, key: &AES128Key, ) -> Result<bool>
Validate the downlink join-accept MIC.
sourcepub fn encrypt_join_accept_payload(&mut self, key: &AES128Key) -> Result<()>
pub fn encrypt_join_accept_payload(&mut self, key: &AES128Key) -> Result<()>
Encrypt the join-accept payload with the given key. Note that the encryption must be performed after setting the MIC, since the MIC is part of the encrypted payload. For encrypting a join-request response, use the nwk_key, for rejoin-request 0, 1 and 3 response, use the js_enc_key.
sourcepub fn decrypt_join_accept_payload(&mut self, key: &AES128Key) -> Result<()>
pub fn decrypt_join_accept_payload(&mut self, key: &AES128Key) -> Result<()>
Decrypt the join-accept payload with the given key. Note that the decryption must be performed before validating the MIC, since the MIC is part of the encrypted payload. For decrypting a join-request response, use the nwk_key, for rejoin-request 0, 1 and 3 response, use the js_enc_key.
sourcepub fn encrypt_f_opts(&mut self, nwk_s_enc_key: &AES128Key) -> Result<()>
pub fn encrypt_f_opts(&mut self, nwk_s_enc_key: &AES128Key) -> Result<()>
Encrypt the f_opts with the given key.
sourcepub fn decrypt_f_opts(&mut self, nwk_s_enc_key: &AES128Key) -> Result<()>
pub fn decrypt_f_opts(&mut self, nwk_s_enc_key: &AES128Key) -> Result<()>
Decrypt the f_opts with the given key. This automatically calls decode_f_opts_to_mac_commands.
sourcepub fn decode_f_opts_to_mac_commands(&mut self) -> Result<()>
pub fn decode_f_opts_to_mac_commands(&mut self) -> Result<()>
Decode f_opts to mac-commands.
sourcepub fn decode_frm_payload(&mut self) -> Result<()>
pub fn decode_frm_payload(&mut self) -> Result<()>
Decode frm_payload payload.
This will decode as follow based on f_port: 0: MACCommandSet 226: ForwardDownlinkReq / ForwardDownlinkReq
For other f_port values, it will not try to decode the payload. Note that this requires a decrypted frm_payload.
sourcepub fn encrypt_frm_payload(&mut self, key: &AES128Key) -> Result<()>
pub fn encrypt_frm_payload(&mut self, key: &AES128Key) -> Result<()>
Encrypt the frm_payload with the given key.
sourcepub fn decrypt_frm_payload(&mut self, key: &AES128Key) -> Result<()>
pub fn decrypt_frm_payload(&mut self, key: &AES128Key) -> Result<()>
Decrypt the frm_payload with the given key.
This will automatically call decode_frm_payload.
Trait Implementations§
source§impl Clone for PhyPayload
impl Clone for PhyPayload
source§fn clone(&self) -> PhyPayload
fn clone(&self) -> PhyPayload
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PhyPayload
impl Debug for PhyPayload
source§impl PartialEq for PhyPayload
impl PartialEq for PhyPayload
source§impl Serialize for PhyPayload
impl Serialize for PhyPayload
impl Eq for PhyPayload
impl StructuralPartialEq for PhyPayload
Auto Trait Implementations§
impl Freeze for PhyPayload
impl RefUnwindSafe for PhyPayload
impl Send for PhyPayload
impl Sync for PhyPayload
impl Unpin for PhyPayload
impl UnwindSafe for PhyPayload
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self
to an expression for Diesel’s query builder. Read more