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

Method _handle_response

chirpstack/src/downlink/data.rs:155–222  ·  view source on GitHub ↗
(
        downlink_id: u32,
        ufs: UplinkFrameSet,
        tenant: tenant::Tenant,
        application: application::Application,
        device_profile: device_profile::DeviceProfile,
        d

Source from the content-addressed store, hash-verified

153
154 #[allow(clippy::too_many_arguments)]
155 async fn _handle_response(
156 downlink_id: u32,
157 ufs: UplinkFrameSet,
158 tenant: tenant::Tenant,
159 application: application::Application,
160 device_profile: device_profile::DeviceProfile,
161 device: device::Device,
162 must_send: bool,
163 must_ack: bool,
164 mac_commands: Vec<lrwn::MACCommandSet>,
165 ) -> Result<()> {
166 trace!("Downlink response flow");
167
168 let (network_conf, region_conf) = {
169 let ds = device.get_device_session()?;
170
171 (
172 config::get_region_network(&ds.region_config_id)
173 .context("Get network config for region")?,
174 region::get(&ds.region_config_id).context("Get region config for region")?,
175 )
176 };
177
178 let mut ctx = Data {
179 relay_context: None,
180 uplink_frame_set: Some(ufs),
181 tenant,
182 application,
183 device_profile,
184 device,
185 network_conf,
186 region_conf,
187 must_send,
188 must_ack,
189 mac_commands,
190 downlink_gateway: None,
191 downlink_frame: gw::DownlinkFrame {
192 downlink_id,
193 ..Default::default()
194 },
195 downlink_frame_items: Vec::new(),
196 immediately: false,
197 device_queue_item: None,
198 more_device_queue_items: false,
199 };
200
201 ctx.select_downlink_gateway(true)?;
202 ctx.set_tx_info()?;
203 ctx.get_next_device_queue_item(true).await?;
204 ctx.set_mac_commands().await?;
205
206 if ctx._something_to_send() {
207 ctx.set_phy_payloads()?;
208 ctx.update_device_queue_item().await?;
209 ctx.save_downlink_frame().await?;
210 // Some mac-commands set their state (e.g. last requested) to the
211 // device-session.
212 ctx.update_device().await?;

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_infoMethod · 0.45

Tested by

no test coverage detected