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

Function get_pending

chirpstack/src/storage/mac_command.rs:14–36  ·  view source on GitHub ↗
(
    ds: &mut internal::DeviceSession,
    cid: lrwn::CID,
)

Source from the content-addressed store, hash-verified

12}
13
14pub async fn get_pending(
15 ds: &mut internal::DeviceSession,
16 cid: lrwn::CID,
17) -> Result<Option<lrwn::MACCommandSet>> {
18 let b = ds
19 .mac_command_pending
20 .remove(&cid.to_u8().into())
21 .unwrap_or_default();
22
23 let out = if !b.is_empty() {
24 let mut mac = lrwn::MACCommandSet::from_slice(&b);
25
26 // Per definition, the uplink flag is set to false as this function is intended to retrieve
27 // pending mac-commands that were previously sent to the device.
28 mac.decode_from_raw(false)?;
29
30 Some(mac)
31 } else {
32 None
33 };
34
35 Ok(out)
36}

Callers 1

handle_uplinkFunction · 0.85

Calls 3

decode_from_rawMethod · 0.80
intoMethod · 0.45
to_u8Method · 0.45

Tested by

no test coverage detected