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

Method _prefer_rx2_dr

chirpstack/src/downlink/join.rs:607–630  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

605 }
606
607 fn _prefer_rx2_dr(&self) -> Result<bool> {
608 let ds = self.device.get_device_session()?;
609
610 // The device has not yet been updated to the network-server RX2 parameters
611 // (using mac-commands). Do not prefer RX2 over RX1 in this case.
612 if ds.rx2_frequency != self.network_conf.rx2_frequency
613 || ds.rx2_dr != self.network_conf.rx2_dr as u32
614 || ds.rx1_dr_offset != self.network_conf.rx1_dr_offset as u32
615 || ds.rx1_delay != self.network_conf.rx1_delay as u32
616 {
617 return Ok(false);
618 }
619
620 // get rx1 data-rate
621 let dr_rx1 = self
622 .region_conf
623 .get_rx1_data_rate_index(self.uplink_frame_set.dr, ds.rx1_dr_offset as usize)?;
624
625 if dr_rx1 < self.network_conf.rx2_prefer_on_rx1_dr_lt {
626 return Ok(true);
627 }
628
629 Ok(false)
630 }
631
632 fn _prefer_rx2_link_budget(&self) -> Result<bool> {
633 let ds = self.device.get_device_session()?;

Callers 2

set_tx_infoMethod · 0.45
set_tx_info_relayedMethod · 0.45

Calls 2

get_device_sessionMethod · 0.80

Tested by

no test coverage detected