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

Method update_device_queue_item

chirpstack/src/downlink/data.rs:968–990  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

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");

Callers 2

_handle_responseMethod · 0.80

Calls 3

update_itemFunction · 0.85
get_device_sessionMethod · 0.80
get_a_f_cnt_downMethod · 0.80

Tested by

no test coverage detected