-
Notifications
You must be signed in to change notification settings - Fork 356
fix: deCONZ: ZGP implementation #1441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The old ZGP frame parser used some magic numbers which often shoot over the actual received buffer. In the new adapter implementation frames are exposed with their actual size, which as side effect caused the frame parser to have invalid negative offsets. The new implementation is a port from deCONZ code without fixed magic numbers. Tested with a old Hue Tap and Friends of Hue switch. Note that the old implementation likely didn't support "joining" without ZGP proxies since the any frame length >= 30 was treated as commissioning command, which the controller rejected. Issue: Koenkk/zigbee2mqtt#27888
Refactored ZGP parsing getting rid of switch() and magic numbers. Also reviewed against specification and tested again with Hue Tap and Friends of Hue switches.
|
@Nerivec thanks a lot for the review 👍 The updated PR hopefully addresses all comments expect the initial buffer copy which I'd like to address in another PR to get rid of |
Koenkk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Please move out of draft once this is ready for merge
Nerivec
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Note: enum != const enum (only the latter is inlined at compile time) https://www.typescriptlang.org/docs/handbook/enums.html#const-enums
Good to know, guess there are quite a few places where this can be applied in future PRs. |
The old ZGP frame parser used some magic numbers which often shoot over the actual received buffer. In the new adapter implementation frames are exposed with their actual size, which as side effect caused the frame parser to have invalid negative offsets.
The new implementation is a port from deCONZ code without fixed magic numbers.
Tested with a old Hue Tap and Friends of Hue switch.
Note that the old implementation likely didn't support "joining" without ZGP proxies since any frame length >= 30 was treated as commissioning command (0x04), which the controller rejected.
Issue: Koenkk/zigbee2mqtt#27888