(&mut self)
| 966 | } |
| 967 | |
| 968 | async fn update_device_queue_item(&mut self) -> Result<()> { |
| 969 | trace!("Updating device queue-item"); |
| 970 | let ds = self.device.get_device_session()?; |
| 971 | |
| 972 | if let Some(qi) = &mut self.device_queue_item { |
| 973 | // Note that the is_pending is set to true after a tx acknowledgement. If it would be |
| 974 | // set to true at this point, the queue-item would be removed in the following Class-A |
| 975 | // case: |
| 976 | // * is_pending is set to true |
| 977 | // * gateway sends negative tx ack (downlink is not transmitted) |
| 978 | // * get_next_device_queue_item is called on next downlink |
| 979 | // * as is_pending was already set to true, a negative ack event is sent |
| 980 | // and item is popped from the queue |
| 981 | |
| 982 | // Do not update the frame-counter in case the queue-item is encrypted. |
| 983 | if !qi.is_encrypted { |
| 984 | qi.f_cnt_down = Some(ds.get_a_f_cnt_down() as i64); |
| 985 | *qi = device_queue::update_item(qi.clone()).await?; |
| 986 | } |
| 987 | } |
| 988 | |
| 989 | Ok(()) |
| 990 | } |
| 991 | |
| 992 | async fn save_downlink_frame(&self) -> Result<()> { |
| 993 | trace!("Saving downlink frame"); |
no test coverage detected