zwave-js / node-zwave-js

Z-Wave driver written entirely in JavaScript/TypeScript
https://zwave-js.github.io/node-zwave-js/
MIT License
742 stars 594 forks source link

Discard duplicate segments in segmented ConfigurationCCNameReports #3368

Open AlCalzone opened 2 years ago

Ikcelaks commented 2 years ago

I imagine this bug also lurks in AssociationCCReport or any other CCs that deal with segmented reports (except TransportServiceCCSubsequentSegment, which merges very differently).

I think the proper solution is to add a new member in CommandClass like: public addPartialTo(session: CommandClass[]): CommandClass[]

It could default to the current session.push(this); but be overridden in the specific CC implementations to drop duplicate partials or do other error checking.

I've created a minimal test suite for ConfigurationCC for this bug and could make a PR if you'd like.

AlCalzone commented 2 years ago

Sounds good!

Ikcelaks commented 2 years ago

3401 should is just a start. It should be expanded to fix the underlying issues with how partial CC sessions are handled.