(&self)
| 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"); |
no test coverage detected