(downlink_id: u32, dev: device::Device)
| 288 | } |
| 289 | |
| 290 | async fn _handle_schedule_next_queue_item(downlink_id: u32, dev: device::Device) -> Result<()> { |
| 291 | trace!("Handle schedule next-queue item flow"); |
| 292 | |
| 293 | let (dev, app, ten, dp) = get_all_device_data(dev.dev_eui).await?; |
| 294 | let (rc, rn) = { |
| 295 | let ds = dev.get_device_session()?; |
| 296 | ( |
| 297 | region::get(&ds.region_config_id)?, |
| 298 | config::get_region_network(&ds.region_config_id)?, |
| 299 | ) |
| 300 | }; |
| 301 | |
| 302 | let mut ctx = Data { |
| 303 | relay_context: None, |
| 304 | uplink_frame_set: None, |
| 305 | tenant: ten, |
| 306 | application: app, |
| 307 | device_profile: dp, |
| 308 | device: dev, |
| 309 | network_conf: rn, |
| 310 | region_conf: rc, |
| 311 | must_send: false, |
| 312 | must_ack: false, |
| 313 | mac_commands: vec![], |
| 314 | downlink_gateway: None, |
| 315 | downlink_frame: gw::DownlinkFrame { |
| 316 | downlink_id, |
| 317 | ..Default::default() |
| 318 | }, |
| 319 | downlink_frame_items: vec![], |
| 320 | immediately: false, |
| 321 | device_queue_item: None, |
| 322 | more_device_queue_items: false, |
| 323 | }; |
| 324 | |
| 325 | ctx.select_downlink_gateway(false)?; |
| 326 | if ctx._is_class_c() { |
| 327 | ctx.class_c_update_scheduler_run_after().await?; |
| 328 | ctx.check_for_first_uplink()?; |
| 329 | ctx.set_immediately()?; |
| 330 | ctx.set_tx_info_for_rx2()?; |
| 331 | } |
| 332 | if ctx._is_class_b() { |
| 333 | ctx.set_tx_info_for_class_b_and_update_scheduler_run_after() |
| 334 | .await?; |
| 335 | } |
| 336 | if ctx._is_class_a() { |
| 337 | return Err(anyhow!("Invalid device-class")); |
| 338 | } |
| 339 | ctx.get_next_device_queue_item(false).await?; |
| 340 | if ctx._something_to_send() { |
| 341 | ctx.set_phy_payloads()?; |
| 342 | ctx.update_device_queue_item().await?; |
| 343 | ctx.save_downlink_frame().await?; |
| 344 | ctx.send_downlink_frame().await?; |
| 345 | } |
| 346 | |
| 347 | Ok(()) |
nothing calls this directly
no test coverage detected