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

Method select_downlink_gateway

chirpstack/src/downlink/data.rs:350–373  ·  view source on GitHub ↗
(&mut self, class_a: bool)

Source from the content-addressed store, hash-verified

348 }
349
350 fn select_downlink_gateway(&mut self, class_a: bool) -> Result<()> {
351 trace!("Selecting downlink gateway");
352
353 // Not needed when roaming.
354 if self._is_roaming() {
355 self.downlink_gateway = Some(Default::default());
356 return Ok(());
357 }
358
359 let ds = self.device.get_device_session()?;
360
361 let gw_down = helpers::select_downlink_gateway(
362 Some(self.tenant.id.into()),
363 &ds.region_config_id,
364 self.network_conf.gateway_prefer_min_margin,
365 &ds.gateway_rx_info_history,
366 class_a,
367 )?;
368
369 self.downlink_frame.gateway_id = hex::encode(&gw_down.gateway_id);
370 self.downlink_gateway = Some(gw_down);
371
372 Ok(())
373 }
374
375 fn set_tx_info(&mut self) -> Result<()> {
376 let mut prefer_rx2_over_rx1 = self._prefer_rx2_dr()?;

Callers 3

_handle_responseMethod · 0.45

Calls 5

select_downlink_gatewayFunction · 0.85
get_device_sessionMethod · 0.80
encodeFunction · 0.50
_is_roamingMethod · 0.45
intoMethod · 0.45

Tested by

no test coverage detected