Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new return type breaks the embedded dispatcher, and ACK handling can incorrectly time out sleepy-child sends and counter-preserving retries.
3 open issues
What changed in this PR
This PR exposes the APS sequence number assigned to unicast sends and lets hosts reuse it for retries, supporting duplicate rejection as discussed in issue #64.
Changes:
- Adds
SendUnicastResultand aforce_aps_seqflag to the control protocol. - Passes optional counter overrides through the bridge and stack, returning the selected counter to the server.
- Revises sleepy-destination ACK timeout calculation and removes the separate indirect timeout setting.
| File | Description |
|---|---|
crates/ziggurat-zigbee/src/constants.rs |
Removes the separate indirect ACK timeout setting. |
crates/ziggurat-server/src/main.rs |
Returns the selected APS sequence number for unicast requests. |
crates/ziggurat-protocol/src/wire.rs |
Defines counter overrides and the unicast result payload. |
crates/ziggurat-protocol/src/bridge.rs |
Connects protocol counter selection and results to the stack. |
crates/ziggurat-driver/src/zigbee_stack/aps.rs |
Supports counter reuse and revises sleepy-device timeouts. |
crates/ziggurat-driver/src/zigbee_stack.rs |
Introduces the ApsCounter type alias. |
Review effort: Balanced
| 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() | ||
| if sleepy_destination && self.sleepy_child_eui64(destination).is_none() { |
| ) -> Result<(SendHandle, ApsCounter), EnqueueError> { | ||
| let asdu = FrameBytes::from_slice(&data).map_err(|_| EnqueueError::PayloadTooLong)?; | ||
| let aps_seq = self.next_aps_counter(); | ||
| let aps_seq = aps_counter.unwrap_or_else(|| self.next_aps_counter()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


See #64 for more info.
This introduces
SendUnicastResult, which returns the APS sequence number picked by Ziggurat for the unicast send. This allows zigpy to control retries by flipping theforce_aps_seqbit and passing back this same APS sequence number.