(&mut self)
| 638 | } |
| 639 | |
| 640 | async fn set_uplink_data_rate(&mut self) -> Result<()> { |
| 641 | trace!("Set uplink data-rate and reset tx-power on change"); |
| 642 | let device = self.device.as_mut().unwrap(); |
| 643 | |
| 644 | self.device_changeset.last_seen_at = Some(Some(Utc::now())); |
| 645 | if device.dr.is_none() || self.uplink_frame_set.dr as i16 != device.dr.unwrap_or_default() { |
| 646 | self.device_changeset.dr = Some(Some(self.uplink_frame_set.dr.into())); |
| 647 | } |
| 648 | |
| 649 | let ds = device.get_device_session_mut()?; |
| 650 | // The node changed its data-rate. Possibly the node did also reset its |
| 651 | // tx-power to max power. Because of this, we need to reset the tx-power |
| 652 | // and the uplink history at the network-server side too. |
| 653 | if ds.dr != self.uplink_frame_set.dr as u32 { |
| 654 | ds.tx_power_index = 0; |
| 655 | ds.uplink_adr_history = Vec::new(); |
| 656 | } |
| 657 | ds.dr = self.uplink_frame_set.dr as u32; |
| 658 | |
| 659 | Ok(()) |
| 660 | } |
| 661 | |
| 662 | async fn set_uplink_data_rate_relayed(&mut self) -> Result<()> { |
| 663 | trace!("Set relayed uplink data-rate and reset tx-power on change"); |
no test coverage detected