Koenkk / zigbee-herdsman

A Node.js Zigbee library
MIT License
454 stars 278 forks source link

fix: Move `ZclFrame.fromBuffer()` out of adapter code #1011

Closed Koenkk closed 3 weeks ago

Koenkk commented 1 month ago

Move the ZclFrame.fromBuffer() out of adapter code to prepare for custom cluster definitions as discussed in https://github.com/Koenkk/zigbee-herdsman/pull/971

Nerivec commented 1 month ago

A few more suggestions...

    /** Returns the amount of bytes used by this header */
    get length(): number {
        return 3 + (this.manufacturerCode === null ? 0 : 2);
    }

    get isGlobal(): boolean {
        return this.frameControl.frameType === FrameType.GLOBAL;
    }

    get isSpecific(): boolean {
        return this.frameControl.frameType === FrameType.SPECIFIC;
    }
Koenkk commented 3 weeks ago

All done! Let me know if this is OK now.