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

Method _handle_response_relayed

chirpstack/src/downlink/data.rs:225–288  ·  view source on GitHub ↗
(
        downlink_id: u32,
        relay_ctx: RelayContext,
        ufs: UplinkFrameSet,
        tenant: tenant::Tenant,
        application: application::Application,
        device_profile: device_

Source from the content-addressed store, hash-verified

223
224 #[allow(clippy::too_many_arguments)]
225 async fn _handle_response_relayed(
226 downlink_id: u32,
227 relay_ctx: RelayContext,
228 ufs: UplinkFrameSet,
229 tenant: tenant::Tenant,
230 application: application::Application,
231 device_profile: device_profile::DeviceProfile,
232 device: device::Device,
233 must_send: bool,
234 must_ack: bool,
235 mac_commands: Vec<lrwn::MACCommandSet>,
236 ) -> Result<()> {
237 trace!("Downlink relayed response flow");
238
239 let (network_conf, region_conf) = {
240 let ds = device.get_device_session()?;
241 (
242 config::get_region_network(&ds.region_config_id)
243 .context("Get network config for region")?,
244 region::get(&ds.region_config_id).context("Get region config for region")?,
245 )
246 };
247
248 let mut ctx = Data {
249 relay_context: Some(relay_ctx),
250 uplink_frame_set: Some(ufs),
251 tenant,
252 application,
253 device_profile,
254 device,
255 network_conf,
256 region_conf,
257 must_send,
258 must_ack,
259 mac_commands,
260 downlink_gateway: None,
261 downlink_frame: gw::DownlinkFrame {
262 downlink_id,
263 ..Default::default()
264 },
265 downlink_frame_items: Vec::new(),
266 immediately: false,
267 device_queue_item: None,
268 more_device_queue_items: false,
269 };
270
271 ctx.select_downlink_gateway(true)?;
272 ctx.set_tx_info_relayed()?;
273 ctx.get_next_device_queue_item(true).await?;
274 ctx.set_mac_commands().await?;
275 if ctx._something_to_send() {
276 ctx.set_phy_payloads()?;
277 ctx.wrap_phy_payloads_in_forward_downlink_req()?;
278 ctx.save_downlink_frame_relayed().await?;
279 ctx.update_device().await?;
280 ctx.send_downlink_frame().await?;
281 } else if ctx._must_respond_to_relay() {
282 ctx.set_phy_payloads_relay()?;

Callers

nothing calls this directly

Calls 15

get_region_networkFunction · 0.85
get_device_sessionMethod · 0.80
set_mac_commandsMethod · 0.80
_something_to_sendMethod · 0.80
set_phy_payloadsMethod · 0.80
getFunction · 0.50
set_tx_info_relayedMethod · 0.45

Tested by

no test coverage detected