(&mut self)
| 1405 | } |
| 1406 | |
| 1407 | fn _request_device_status(&mut self) -> Result<()> { |
| 1408 | trace!("Requesting device-status"); |
| 1409 | |
| 1410 | if self.device_profile.device_status_req_interval == 0 { |
| 1411 | return Ok(()); |
| 1412 | } |
| 1413 | |
| 1414 | let ds = self.device.get_device_session_mut()?; |
| 1415 | |
| 1416 | match &ds.last_device_status_request { |
| 1417 | None => { |
| 1418 | self.mac_commands.push(lrwn::MACCommandSet::new(vec![ |
| 1419 | lrwn::MACCommand::DevStatusReq, |
| 1420 | ])); |
| 1421 | |
| 1422 | ds.last_device_status_request = Some(Utc::now().into()); |
| 1423 | } |
| 1424 | Some(ts) => { |
| 1425 | let ts: DateTime<Utc> = (*ts).try_into().map_err(anyhow::Error::msg)?; |
| 1426 | let req_interval = Duration::from_secs(60 * 60 * 24) |
| 1427 | / self.device_profile.device_status_req_interval as u32; |
| 1428 | |
| 1429 | let cur_interval: Duration = (Utc::now() - ts).to_std()?; |
| 1430 | |
| 1431 | if cur_interval >= req_interval { |
| 1432 | self.mac_commands.push(lrwn::MACCommandSet::new(vec![ |
| 1433 | lrwn::MACCommand::DevStatusReq, |
| 1434 | ])); |
| 1435 | |
| 1436 | ds.last_device_status_request = Some(Utc::now().into()); |
| 1437 | } |
| 1438 | } |
| 1439 | } |
| 1440 | |
| 1441 | Ok(()) |
| 1442 | } |
| 1443 | |
| 1444 | async fn _request_rejoin_param_setup(&mut self) -> Result<()> { |
| 1445 | trace!("Requesting rejoin param setup"); |
no test coverage detected