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

Method _handle

chirpstack/src/downlink/tx_ack.rs:48–133  ·  view source on GitHub ↗
(tx_ack: gw::DownlinkTxAck)

Source from the content-addressed store, hash-verified

46 }
47
48 async fn _handle(tx_ack: gw::DownlinkTxAck) -> Result<()> {
49 if tx_ack.items.is_empty() {
50 return Err(anyhow!("Zero items in tx ack"));
51 }
52
53 let mut ctx = TxAck {
54 downlink_tx_ack_status: {
55 let mut status = gw::TxAckStatus::default();
56 for item in &tx_ack.items {
57 status = item.status();
58 if item.status() == gw::TxAckStatus::Ok {
59 break;
60 }
61 }
62 status
63 },
64 downlink_id: tx_ack.downlink_id,
65 downlink_tx_ack: tx_ack,
66 downlink_frame: None,
67 downlink_frame_item: None,
68 phy_payload: None,
69 phy_payload_relayed: None,
70 tenant: None,
71 tenant_relayed: None,
72 application: None,
73 application_relayed: None,
74 device_profile: None,
75 device_profile_relayed: None,
76 device: None,
77 device_relayed: None,
78 device_queue_item: None,
79 };
80
81 ctx.get_downlink_frame().await?;
82 ctx.decode_phy_payload()?;
83
84 if ctx.is_relay_payload() {
85 return ctx._handle_relayed().await;
86 }
87
88 if ctx.is_error() {
89 if ctx.is_application_payload() || ctx.is_mac_only_downlink() {
90 ctx.get_device_data().await?;
91 ctx.log_tx_ack_error().await?;
92 }
93
94 if ctx.is_multicast_downlink() {
95 ctx.delete_multicast_group_queue_item().await?;
96 }
97 } else {
98 if ctx.is_application_payload() || ctx.is_mac_only_downlink() {
99 ctx.get_device_data().await?;
100
101 if ctx.is_application_payload() {
102 ctx.get_device_queue_item().await?;
103 if ctx.is_unconfirmed_downlink() {
104 ctx.delete_device_queue_item().await?;
105 }

Callers

nothing calls this directly

Calls 15

statusMethod · 0.80
get_downlink_frameMethod · 0.80
decode_phy_payloadMethod · 0.80
is_relay_payloadMethod · 0.80
is_errorMethod · 0.80
is_mac_only_downlinkMethod · 0.80
log_tx_ack_errorMethod · 0.80
is_multicast_downlinkMethod · 0.80
get_device_queue_itemMethod · 0.80

Tested by

no test coverage detected