MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / save_downlink_frame

Method save_downlink_frame

chirpstack/src/downlink/data.rs:992–1020  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

990 }
991
992 async fn save_downlink_frame(&self) -> Result<()> {
993 trace!("Saving downlink frame");
994 let ds = self.device.get_device_session()?;
995
996 downlink_frame::save(&internal::DownlinkFrame {
997 downlink_id: self.downlink_frame.downlink_id,
998 dev_eui: self.device.dev_eui.to_be_bytes().to_vec(),
999 device_queue_item_id: match &self.device_queue_item {
1000 Some(qi) => qi.id.as_bytes().to_vec(),
1001 None => vec![],
1002 },
1003 encrypted_fopts: ds.mac_version().to_string().starts_with("1.1"),
1004 nwk_s_enc_key: ds.nwk_s_enc_key.clone(),
1005 downlink_frame: Some(self.downlink_frame.clone()),
1006 n_f_cnt_down: ds.n_f_cnt_down,
1007 a_f_cnt_down: match &self.device_queue_item {
1008 Some(v) => match v.is_encrypted {
1009 true => v.f_cnt_down.unwrap_or_default() as u32,
1010 false => ds.get_a_f_cnt_down(),
1011 },
1012 None => ds.get_a_f_cnt_down(),
1013 },
1014 ..Default::default()
1015 })
1016 .await
1017 .context("Save downlink frame")?;
1018
1019 Ok(())
1020 }
1021
1022 async fn save_downlink_frame_relayed(&self) -> Result<()> {
1023 trace!("Saving ForwardDownlinkReq frame");

Callers 2

_handle_responseMethod · 0.45

Calls 6

get_device_sessionMethod · 0.80
to_stringMethod · 0.80
get_a_f_cnt_downMethod · 0.80
saveFunction · 0.50
to_vecMethod · 0.45
to_be_bytesMethod · 0.45

Tested by

no test coverage detected