Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions crates/ziggurat-driver/src/zigbee_stack/aps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ impl<P: RadioPhy, R: Runtime> ZigbeeStack<P, R> {
Ok((nwk_frame, ack_data))
}

/// How long to wait for a device's APS ack: longer for a sleepy child, which only
/// sees (and acks) the frame after polling.
fn aps_ack_timeout(&self, destination: Nwk) -> Duration {
if self.sleepy_child_eui64(destination).is_some() {
/// How long to wait for a device's APS ack: longer for a sleepy destination, which
/// only sees (and acks) the frame after polling.
fn aps_ack_timeout(&self, destination: Nwk, sleepy_destination: bool) -> Duration {
if sleepy_destination || self.sleepy_child_eui64(destination).is_some() {
self.tunables.aps_ack_timeout_indirect()
} else {
self.tunables.aps_ack_timeout()
Expand All @@ -321,6 +321,7 @@ impl<P: RadioPhy, R: Runtime> ZigbeeStack<P, R> {
aps_seq: u8,
data: Vec<u8>,
aps_security: Option<Eui64>,
sleepy_destination: bool,
priority: TxPriority,
request_id: RequestId,
) -> Result<(), ZigbeeStackError> {
Expand All @@ -341,7 +342,7 @@ impl<P: RadioPhy, R: Runtime> ZigbeeStack<P, R> {
// An APS-ack send is confirmed by the end-to-end ack: register it (with the
// deadline the timeout reactor uses) before enqueueing so a fast reply is caught.
if let Some(ack_data) = &ack_data {
let deadline = self.core_now() + self.aps_ack_timeout(destination);
let deadline = self.core_now() + self.aps_ack_timeout(destination, sleepy_destination);
self.state.pending_aps_acks.lock().insert(
ack_data.clone(),
PendingApsAck {
Expand Down
1 change: 1 addition & 0 deletions crates/ziggurat-protocol/src/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ pub fn send_aps<P: RadioPhy, R: Runtime>(
payload.aps_seq,
payload.asdu,
aps_security,
payload.flags.sleepy_destination,
TxPriority::from_host(payload.priority as i8),
StackRequestId::from(request_id),
)
Expand Down
5 changes: 4 additions & 1 deletion crates/ziggurat-protocol/src/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,10 @@ pub struct SendApsFlags {
pub aps_ack: bool,
pub aps_encryption: bool,
pub delivery_mode: ApsDeliveryMode,
pub reserved: u3,
/// The destination is a sleepy device. It only sees frames by polling its parent,
/// so the APS ack wait must cover a poll cycle.
pub sleepy_destination: bool,
pub reserved: u2,
}

#[abstract_bits]
Expand Down