zigbee-herdsman 3.5.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +2 -4
- package/.github/workflows/stale.yml +1 -1
- package/.release-please-manifest.json +1 -1
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +11 -0
- package/CHANGELOG.md +17 -0
- package/biome.json +89 -0
- package/dist/adapter/adapter.d.ts +11 -11
- package/dist/adapter/adapter.d.ts.map +1 -1
- package/dist/adapter/adapter.js +14 -14
- package/dist/adapter/adapterDiscovery.d.ts +6 -6
- package/dist/adapter/adapterDiscovery.d.ts.map +1 -1
- package/dist/adapter/adapterDiscovery.js +139 -141
- package/dist/adapter/adapterDiscovery.js.map +1 -1
- package/dist/adapter/const.d.ts +1 -1
- package/dist/adapter/const.js +2 -2
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts +16 -16
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts.map +1 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.js +95 -100
- package/dist/adapter/deconz/adapter/deconzAdapter.js.map +1 -1
- package/dist/adapter/deconz/driver/constants.d.ts +5 -5
- package/dist/adapter/deconz/driver/constants.d.ts.map +1 -1
- package/dist/adapter/deconz/driver/driver.d.ts +9 -9
- package/dist/adapter/deconz/driver/driver.d.ts.map +1 -1
- package/dist/adapter/deconz/driver/driver.js +112 -106
- package/dist/adapter/deconz/driver/driver.js.map +1 -1
- package/dist/adapter/deconz/driver/frame.d.ts +1 -1
- package/dist/adapter/deconz/driver/frame.d.ts.map +1 -1
- package/dist/adapter/deconz/driver/frame.js +1 -2
- package/dist/adapter/deconz/driver/frame.js.map +1 -1
- package/dist/adapter/deconz/driver/frameParser.d.ts +1 -1
- package/dist/adapter/deconz/driver/frameParser.d.ts.map +1 -1
- package/dist/adapter/deconz/driver/frameParser.js +66 -70
- package/dist/adapter/deconz/driver/frameParser.js.map +1 -1
- package/dist/adapter/deconz/driver/parser.d.ts +1 -1
- package/dist/adapter/deconz/driver/parser.d.ts.map +1 -1
- package/dist/adapter/deconz/driver/parser.js +2 -2
- package/dist/adapter/deconz/driver/parser.js.map +1 -1
- package/dist/adapter/deconz/driver/writer.d.ts +2 -2
- package/dist/adapter/deconz/driver/writer.d.ts.map +1 -1
- package/dist/adapter/deconz/driver/writer.js +1 -1
- package/dist/adapter/ember/adapter/emberAdapter.d.ts +19 -19
- package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/emberAdapter.js +117 -97
- package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -1
- package/dist/adapter/ember/adapter/endpoints.d.ts +1 -1
- package/dist/adapter/ember/adapter/endpoints.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/oneWaitress.d.ts +5 -5
- package/dist/adapter/ember/adapter/oneWaitress.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/oneWaitress.js +2 -2
- package/dist/adapter/ember/adapter/oneWaitress.js.map +1 -1
- package/dist/adapter/ember/adapter/tokensManager.d.ts +3 -3
- package/dist/adapter/ember/adapter/tokensManager.d.ts.map +1 -1
- package/dist/adapter/ember/adapter/tokensManager.js +20 -23
- package/dist/adapter/ember/adapter/tokensManager.js.map +1 -1
- package/dist/adapter/ember/enums.d.ts +4 -4
- package/dist/adapter/ember/enums.d.ts.map +1 -1
- package/dist/adapter/ember/enums.js +4 -6
- package/dist/adapter/ember/enums.js.map +1 -1
- package/dist/adapter/ember/ezsp/buffalo.d.ts +4 -4
- package/dist/adapter/ember/ezsp/buffalo.d.ts.map +1 -1
- package/dist/adapter/ember/ezsp/buffalo.js +30 -32
- package/dist/adapter/ember/ezsp/buffalo.js.map +1 -1
- package/dist/adapter/ember/ezsp/ezsp.d.ts +46 -46
- package/dist/adapter/ember/ezsp/ezsp.d.ts.map +1 -1
- package/dist/adapter/ember/ezsp/ezsp.js +85 -111
- package/dist/adapter/ember/ezsp/ezsp.js.map +1 -1
- package/dist/adapter/ember/ezspError.d.ts +1 -1
- package/dist/adapter/ember/types.d.ts +14 -14
- package/dist/adapter/ember/types.d.ts.map +1 -1
- package/dist/adapter/ember/uart/ash.d.ts +5 -5
- package/dist/adapter/ember/uart/ash.d.ts.map +1 -1
- package/dist/adapter/ember/uart/ash.js +80 -71
- package/dist/adapter/ember/uart/ash.js.map +1 -1
- package/dist/adapter/ember/uart/parser.d.ts +2 -2
- package/dist/adapter/ember/uart/parser.d.ts.map +1 -1
- package/dist/adapter/ember/uart/parser.js +2 -1
- package/dist/adapter/ember/uart/parser.js.map +1 -1
- package/dist/adapter/ember/uart/queues.js +27 -29
- package/dist/adapter/ember/uart/queues.js.map +1 -1
- package/dist/adapter/ember/uart/writer.d.ts +1 -1
- package/dist/adapter/ember/uart/writer.d.ts.map +1 -1
- package/dist/adapter/ember/uart/writer.js +3 -5
- package/dist/adapter/ember/uart/writer.js.map +1 -1
- package/dist/adapter/ember/utils/initters.d.ts +2 -2
- package/dist/adapter/ember/utils/initters.d.ts.map +1 -1
- package/dist/adapter/ember/utils/initters.js +1 -1
- package/dist/adapter/ember/utils/math.js +1 -1
- package/dist/adapter/events.d.ts +1 -1
- package/dist/adapter/events.d.ts.map +1 -1
- package/dist/adapter/ezsp/adapter/backup.d.ts +3 -3
- package/dist/adapter/ezsp/adapter/backup.d.ts.map +1 -1
- package/dist/adapter/ezsp/adapter/backup.js +8 -10
- package/dist/adapter/ezsp/adapter/backup.js.map +1 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts +12 -12
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.js +45 -44
- package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
- package/dist/adapter/ezsp/driver/driver.d.ts +12 -12
- package/dist/adapter/ezsp/driver/driver.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/driver.js +148 -141
- package/dist/adapter/ezsp/driver/driver.js.map +1 -1
- package/dist/adapter/ezsp/driver/ezsp.d.ts +7 -7
- package/dist/adapter/ezsp/driver/ezsp.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/ezsp.js +61 -59
- package/dist/adapter/ezsp/driver/ezsp.js.map +1 -1
- package/dist/adapter/ezsp/driver/frame.js +2 -2
- package/dist/adapter/ezsp/driver/index.d.ts +2 -2
- package/dist/adapter/ezsp/driver/multicast.d.ts +8 -5
- package/dist/adapter/ezsp/driver/multicast.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/multicast.js +9 -9
- package/dist/adapter/ezsp/driver/multicast.js.map +1 -1
- package/dist/adapter/ezsp/driver/parser.d.ts +1 -1
- package/dist/adapter/ezsp/driver/parser.js +3 -3
- package/dist/adapter/ezsp/driver/types/basic.d.ts +5 -5
- package/dist/adapter/ezsp/driver/types/basic.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/types/basic.js +12 -33
- package/dist/adapter/ezsp/driver/types/basic.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/index.d.ts +3 -3
- package/dist/adapter/ezsp/driver/types/index.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/types/index.js +8 -9
- package/dist/adapter/ezsp/driver/types/index.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/named.d.ts +2 -2
- package/dist/adapter/ezsp/driver/types/named.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/types/named.js +8 -11
- package/dist/adapter/ezsp/driver/types/named.js.map +1 -1
- package/dist/adapter/ezsp/driver/types/struct.d.ts +2 -2
- package/dist/adapter/ezsp/driver/types/struct.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/types/struct.js +207 -214
- package/dist/adapter/ezsp/driver/types/struct.js.map +1 -1
- package/dist/adapter/ezsp/driver/uart.d.ts +2 -2
- package/dist/adapter/ezsp/driver/uart.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/uart.js +48 -37
- package/dist/adapter/ezsp/driver/uart.js.map +1 -1
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.d.ts +3 -3
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.js +16 -34
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.js.map +1 -1
- package/dist/adapter/ezsp/driver/utils/index.d.ts +4 -4
- package/dist/adapter/ezsp/driver/utils/index.d.ts.map +1 -1
- package/dist/adapter/ezsp/driver/utils/index.js +4 -4
- package/dist/adapter/ezsp/driver/utils/index.js.map +1 -1
- package/dist/adapter/ezsp/driver/writer.d.ts +1 -1
- package/dist/adapter/ezsp/driver/writer.js +2 -2
- package/dist/adapter/index.d.ts +3 -3
- package/dist/adapter/serialPort.d.ts +3 -3
- package/dist/adapter/serialPort.d.ts.map +1 -1
- package/dist/adapter/serialPort.js +1 -0
- package/dist/adapter/serialPort.js.map +1 -1
- package/dist/adapter/socketPortUtils.js +3 -3
- package/dist/adapter/tstype.d.ts +6 -6
- package/dist/adapter/z-stack/adapter/adapter-backup.d.ts +4 -4
- package/dist/adapter/z-stack/adapter/adapter-backup.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/adapter-backup.js +106 -119
- package/dist/adapter/z-stack/adapter/adapter-backup.js.map +1 -1
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.d.ts +10 -10
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.js +23 -24
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.js.map +1 -1
- package/dist/adapter/z-stack/adapter/manager.d.ts +6 -6
- package/dist/adapter/z-stack/adapter/manager.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/manager.js +115 -127
- package/dist/adapter/z-stack/adapter/manager.js.map +1 -1
- package/dist/adapter/z-stack/adapter/tstype.d.ts +3 -3
- package/dist/adapter/z-stack/adapter/tstype.js +3 -3
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts +10 -10
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts.map +1 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.js +125 -137
- package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
- package/dist/adapter/z-stack/constants/common.d.ts.map +1 -1
- package/dist/adapter/z-stack/constants/common.js +0 -3
- package/dist/adapter/z-stack/constants/common.js.map +1 -1
- package/dist/adapter/z-stack/constants/index.d.ts +10 -10
- package/dist/adapter/z-stack/constants/index.d.ts.map +1 -1
- package/dist/adapter/z-stack/constants/index.js +2 -2
- package/dist/adapter/z-stack/constants/index.js.map +1 -1
- package/dist/adapter/z-stack/constants/utils.d.ts +1 -1
- package/dist/adapter/z-stack/constants/utils.js +2 -2
- package/dist/adapter/z-stack/constants/utils.js.map +1 -1
- package/dist/adapter/z-stack/models/startup-options.d.ts +2 -2
- package/dist/adapter/z-stack/models/startup-options.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.js +4 -5
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/address-manager-table.d.ts +2 -2
- package/dist/adapter/z-stack/structs/entries/address-manager-table.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/address-manager-table.js +3 -4
- package/dist/adapter/z-stack/structs/entries/address-manager-table.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.js +1 -2
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.d.ts +2 -2
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.js +3 -4
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.js +6 -7
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.d.ts +2 -2
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.js +3 -4
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/channel-list.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/channel-list.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/channel-list.js +1 -2
- package/dist/adapter/z-stack/structs/entries/channel-list.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/has-configured.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/has-configured.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/has-configured.js +2 -3
- package/dist/adapter/z-stack/structs/entries/has-configured.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/index.d.ts +16 -16
- package/dist/adapter/z-stack/structs/entries/nib.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/nib.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nib.js +49 -50
- package/dist/adapter/z-stack/structs/entries/nib.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.js +1 -2
- package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-key.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-key.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-key.js +1 -2
- package/dist/adapter/z-stack/structs/entries/nwk-key.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-pan-id.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-pan-id.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-pan-id.js +1 -2
- package/dist/adapter/z-stack/structs/entries/nwk-pan-id.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.js +3 -4
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.d.ts +2 -2
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.js +3 -4
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.d.ts +1 -1
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.js +4 -5
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.js.map +1 -1
- package/dist/adapter/z-stack/structs/entries/security-manager-table.d.ts +2 -2
- package/dist/adapter/z-stack/structs/entries/security-manager-table.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/entries/security-manager-table.js +3 -4
- package/dist/adapter/z-stack/structs/entries/security-manager-table.js.map +1 -1
- package/dist/adapter/z-stack/structs/index.d.ts +4 -4
- package/dist/adapter/z-stack/structs/serializable-memory-object.d.ts +2 -2
- package/dist/adapter/z-stack/structs/serializable-memory-object.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/struct.d.ts +8 -8
- package/dist/adapter/z-stack/structs/struct.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/struct.js +42 -43
- package/dist/adapter/z-stack/structs/struct.js.map +1 -1
- package/dist/adapter/z-stack/structs/table.d.ts +3 -3
- package/dist/adapter/z-stack/structs/table.d.ts.map +1 -1
- package/dist/adapter/z-stack/structs/table.js +10 -10
- package/dist/adapter/z-stack/structs/table.js.map +1 -1
- package/dist/adapter/z-stack/unpi/frame.d.ts +1 -1
- package/dist/adapter/z-stack/unpi/frame.d.ts.map +1 -1
- package/dist/adapter/z-stack/unpi/frame.js +2 -4
- package/dist/adapter/z-stack/unpi/frame.js.map +1 -1
- package/dist/adapter/z-stack/unpi/index.d.ts +4 -4
- package/dist/adapter/z-stack/unpi/parser.d.ts +1 -1
- package/dist/adapter/z-stack/unpi/parser.js +3 -3
- package/dist/adapter/z-stack/unpi/parser.js.map +1 -1
- package/dist/adapter/z-stack/unpi/writer.d.ts +2 -2
- package/dist/adapter/z-stack/unpi/writer.d.ts.map +1 -1
- package/dist/adapter/z-stack/unpi/writer.js +1 -1
- package/dist/adapter/z-stack/utils/index.d.ts +2 -2
- package/dist/adapter/z-stack/utils/network-options.d.ts +1 -1
- package/dist/adapter/z-stack/utils/network-options.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/buffaloZnp.d.ts +3 -3
- package/dist/adapter/z-stack/znp/buffaloZnp.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/buffaloZnp.js +34 -20
- package/dist/adapter/z-stack/znp/buffaloZnp.js.map +1 -1
- package/dist/adapter/z-stack/znp/definition.d.ts +2 -2
- package/dist/adapter/z-stack/znp/definition.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/definition.js +1111 -1111
- package/dist/adapter/z-stack/znp/index.d.ts +2 -2
- package/dist/adapter/z-stack/znp/tstype.d.ts +7 -7
- package/dist/adapter/z-stack/znp/tstype.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/utils.d.ts +1 -1
- package/dist/adapter/z-stack/znp/utils.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/utils.js +2 -2
- package/dist/adapter/z-stack/znp/znp.d.ts +7 -7
- package/dist/adapter/z-stack/znp/znp.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/znp.js +46 -45
- package/dist/adapter/z-stack/znp/znp.js.map +1 -1
- package/dist/adapter/z-stack/znp/zpiObject.d.ts +8 -8
- package/dist/adapter/z-stack/znp/zpiObject.d.ts.map +1 -1
- package/dist/adapter/z-stack/znp/zpiObject.js +6 -6
- package/dist/adapter/z-stack/znp/zpiObject.js.map +1 -1
- package/dist/adapter/zboss/adapter/zbossAdapter.d.ts +11 -11
- package/dist/adapter/zboss/adapter/zbossAdapter.d.ts.map +1 -1
- package/dist/adapter/zboss/adapter/zbossAdapter.js +37 -36
- package/dist/adapter/zboss/adapter/zbossAdapter.js.map +1 -1
- package/dist/adapter/zboss/commands.d.ts +4 -6
- package/dist/adapter/zboss/commands.d.ts.map +1 -1
- package/dist/adapter/zboss/commands.js +321 -287
- package/dist/adapter/zboss/commands.js.map +1 -1
- package/dist/adapter/zboss/driver.d.ts +9 -9
- package/dist/adapter/zboss/driver.d.ts.map +1 -1
- package/dist/adapter/zboss/driver.js +25 -25
- package/dist/adapter/zboss/driver.js.map +1 -1
- package/dist/adapter/zboss/frame.d.ts +9 -9
- package/dist/adapter/zboss/frame.d.ts.map +1 -1
- package/dist/adapter/zboss/frame.js +15 -15
- package/dist/adapter/zboss/frame.js.map +1 -1
- package/dist/adapter/zboss/reader.d.ts +2 -2
- package/dist/adapter/zboss/reader.d.ts.map +1 -1
- package/dist/adapter/zboss/reader.js +6 -5
- package/dist/adapter/zboss/reader.js.map +1 -1
- package/dist/adapter/zboss/uart.d.ts +3 -3
- package/dist/adapter/zboss/uart.d.ts.map +1 -1
- package/dist/adapter/zboss/uart.js +36 -36
- package/dist/adapter/zboss/uart.js.map +1 -1
- package/dist/adapter/zboss/writer.d.ts +1 -1
- package/dist/adapter/zboss/writer.d.ts.map +1 -1
- package/dist/adapter/zboss/writer.js +3 -5
- package/dist/adapter/zboss/writer.js.map +1 -1
- package/dist/adapter/zigate/adapter/patchZdoBuffaloBE.js +2 -2
- package/dist/adapter/zigate/adapter/patchZdoBuffaloBE.js.map +1 -1
- package/dist/adapter/zigate/adapter/zigateAdapter.d.ts +14 -14
- package/dist/adapter/zigate/adapter/zigateAdapter.d.ts.map +1 -1
- package/dist/adapter/zigate/adapter/zigateAdapter.js +52 -53
- package/dist/adapter/zigate/adapter/zigateAdapter.js.map +1 -1
- package/dist/adapter/zigate/driver/buffaloZiGate.d.ts +6 -6
- package/dist/adapter/zigate/driver/buffaloZiGate.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/buffaloZiGate.js +41 -23
- package/dist/adapter/zigate/driver/buffaloZiGate.js.map +1 -1
- package/dist/adapter/zigate/driver/commandType.d.ts +2 -2
- package/dist/adapter/zigate/driver/commandType.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/commandType.js +37 -37
- package/dist/adapter/zigate/driver/commandType.js.map +1 -1
- package/dist/adapter/zigate/driver/constants.d.ts +27 -200
- package/dist/adapter/zigate/driver/constants.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/constants.js +40 -236
- package/dist/adapter/zigate/driver/constants.js.map +1 -1
- package/dist/adapter/zigate/driver/frame.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/frame.js +4 -3
- package/dist/adapter/zigate/driver/frame.js.map +1 -1
- package/dist/adapter/zigate/driver/messageType.d.ts +1 -1
- package/dist/adapter/zigate/driver/messageType.js +76 -76
- package/dist/adapter/zigate/driver/ziGateObject.d.ts +3 -3
- package/dist/adapter/zigate/driver/ziGateObject.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/ziGateObject.js +7 -6
- package/dist/adapter/zigate/driver/ziGateObject.js.map +1 -1
- package/dist/adapter/zigate/driver/zigate.d.ts +8 -8
- package/dist/adapter/zigate/driver/zigate.d.ts.map +1 -1
- package/dist/adapter/zigate/driver/zigate.js +59 -54
- package/dist/adapter/zigate/driver/zigate.js.map +1 -1
- package/dist/adapter/zoh/adapter/utils.js +1 -1
- package/dist/adapter/zoh/adapter/zohAdapter.d.ts +13 -13
- package/dist/adapter/zoh/adapter/zohAdapter.d.ts.map +1 -1
- package/dist/adapter/zoh/adapter/zohAdapter.js +101 -67
- package/dist/adapter/zoh/adapter/zohAdapter.js.map +1 -1
- package/dist/buffalo/buffalo.d.ts +2 -2
- package/dist/buffalo/buffalo.js +4 -4
- package/dist/buffalo/buffalo.js.map +1 -1
- package/dist/buffalo/index.d.ts +1 -1
- package/dist/controller/controller.d.ts +7 -7
- package/dist/controller/controller.d.ts.map +1 -1
- package/dist/controller/controller.js +94 -98
- package/dist/controller/controller.js.map +1 -1
- package/dist/controller/database.d.ts +1 -1
- package/dist/controller/database.d.ts.map +1 -1
- package/dist/controller/database.js +9 -9
- package/dist/controller/database.js.map +1 -1
- package/dist/controller/events.d.ts +6 -6
- package/dist/controller/events.d.ts.map +1 -1
- package/dist/controller/greenPower.d.ts +21 -21
- package/dist/controller/greenPower.d.ts.map +1 -1
- package/dist/controller/greenPower.js +41 -41
- package/dist/controller/greenPower.js.map +1 -1
- package/dist/controller/helpers/index.d.ts +1 -1
- package/dist/controller/helpers/request.d.ts +2 -2
- package/dist/controller/helpers/request.d.ts.map +1 -1
- package/dist/controller/helpers/request.js +31 -27
- package/dist/controller/helpers/request.js.map +1 -1
- package/dist/controller/helpers/requestQueue.d.ts +3 -3
- package/dist/controller/helpers/requestQueue.d.ts.map +1 -1
- package/dist/controller/helpers/requestQueue.js +20 -20
- package/dist/controller/helpers/requestQueue.js.map +1 -1
- package/dist/controller/helpers/zclFrameConverter.d.ts +2 -2
- package/dist/controller/helpers/zclFrameConverter.d.ts.map +1 -1
- package/dist/controller/helpers/zclFrameConverter.js +1 -1
- package/dist/controller/helpers/zclFrameConverter.js.map +1 -1
- package/dist/controller/helpers/zclTransactionSequenceNumber.d.ts +6 -4
- package/dist/controller/helpers/zclTransactionSequenceNumber.d.ts.map +1 -1
- package/dist/controller/helpers/zclTransactionSequenceNumber.js +6 -5
- package/dist/controller/helpers/zclTransactionSequenceNumber.js.map +1 -1
- package/dist/controller/index.d.ts +1 -1
- package/dist/controller/model/device.d.ts +23 -19
- package/dist/controller/model/device.d.ts.map +1 -1
- package/dist/controller/model/device.js +153 -128
- package/dist/controller/model/device.js.map +1 -1
- package/dist/controller/model/endpoint.d.ts +11 -11
- package/dist/controller/model/endpoint.d.ts.map +1 -1
- package/dist/controller/model/endpoint.js +84 -67
- package/dist/controller/model/endpoint.js.map +1 -1
- package/dist/controller/model/entity.d.ts +3 -3
- package/dist/controller/model/entity.d.ts.map +1 -1
- package/dist/controller/model/group.d.ts +4 -4
- package/dist/controller/model/group.d.ts.map +1 -1
- package/dist/controller/model/group.js +21 -9
- package/dist/controller/model/group.js.map +1 -1
- package/dist/controller/model/index.d.ts +4 -4
- package/dist/controller/touchlink.d.ts +1 -1
- package/dist/controller/touchlink.d.ts.map +1 -1
- package/dist/controller/touchlink.js +11 -11
- package/dist/controller/tstype.d.ts +3 -3
- package/dist/index.d.ts +10 -10
- package/dist/models/backup-storage-legacy.d.ts +14 -16
- package/dist/models/backup-storage-legacy.d.ts.map +1 -1
- package/dist/models/backup-storage-unified.d.ts +1 -1
- package/dist/models/backup.d.ts +2 -2
- package/dist/models/backup.d.ts.map +1 -1
- package/dist/models/index.d.ts +4 -4
- package/dist/utils/backup.d.ts +1 -1
- package/dist/utils/backup.d.ts.map +1 -1
- package/dist/utils/backup.js +26 -26
- package/dist/utils/backup.js.map +1 -1
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/logger.js +3 -3
- package/dist/utils/patchBigIntSerialization.js +1 -1
- package/dist/utils/patchBigIntSerialization.js.map +1 -1
- package/dist/utils/queue.d.ts.map +1 -1
- package/dist/utils/queue.js +1 -0
- package/dist/utils/queue.js.map +1 -1
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +5 -4
- package/dist/utils/utils.js.map +1 -1
- package/dist/utils/waitress.d.ts +1 -1
- package/dist/utils/waitress.js +3 -3
- package/dist/zspec/consts.d.ts +1 -1
- package/dist/zspec/consts.d.ts.map +1 -1
- package/dist/zspec/consts.js +1 -1
- package/dist/zspec/index.d.ts +3 -3
- package/dist/zspec/tstypes.d.ts +1 -1
- package/dist/zspec/utils.d.ts +4 -4
- package/dist/zspec/utils.d.ts.map +1 -1
- package/dist/zspec/utils.js +9 -13
- package/dist/zspec/utils.js.map +1 -1
- package/dist/zspec/zcl/buffaloZcl.d.ts +3 -3
- package/dist/zspec/zcl/buffaloZcl.d.ts.map +1 -1
- package/dist/zspec/zcl/buffaloZcl.js +127 -84
- package/dist/zspec/zcl/buffaloZcl.js.map +1 -1
- package/dist/zspec/zcl/definition/cluster.d.ts +1 -1
- package/dist/zspec/zcl/definition/cluster.d.ts.map +1 -1
- package/dist/zspec/zcl/definition/cluster.js +894 -893
- package/dist/zspec/zcl/definition/cluster.js.map +1 -1
- package/dist/zspec/zcl/definition/consts.js +7 -7
- package/dist/zspec/zcl/definition/foundation.d.ts +3 -3
- package/dist/zspec/zcl/definition/foundation.d.ts.map +1 -1
- package/dist/zspec/zcl/definition/foundation.js +88 -89
- package/dist/zspec/zcl/definition/foundation.js.map +1 -1
- package/dist/zspec/zcl/definition/manufacturerCode.d.ts +1 -1
- package/dist/zspec/zcl/definition/manufacturerCode.js +1 -1
- package/dist/zspec/zcl/definition/manufacturerCode.js.map +1 -1
- package/dist/zspec/zcl/definition/status.d.ts +3 -3
- package/dist/zspec/zcl/definition/status.js +3 -3
- package/dist/zspec/zcl/definition/tstype.d.ts +3 -3
- package/dist/zspec/zcl/definition/tstype.d.ts.map +1 -1
- package/dist/zspec/zcl/index.d.ts +10 -10
- package/dist/zspec/zcl/utils.d.ts +3 -3
- package/dist/zspec/zcl/utils.d.ts.map +1 -1
- package/dist/zspec/zcl/utils.js +18 -21
- package/dist/zspec/zcl/utils.js.map +1 -1
- package/dist/zspec/zcl/zclFrame.d.ts +7 -7
- package/dist/zspec/zcl/zclFrame.d.ts.map +1 -1
- package/dist/zspec/zcl/zclFrame.js +38 -41
- package/dist/zspec/zcl/zclFrame.js.map +1 -1
- package/dist/zspec/zcl/zclHeader.d.ts +2 -2
- package/dist/zspec/zcl/zclHeader.d.ts.map +1 -1
- package/dist/zspec/zcl/zclHeader.js +3 -3
- package/dist/zspec/zcl/zclStatusError.d.ts +1 -1
- package/dist/zspec/zdo/buffaloZdo.d.ts +7 -7
- package/dist/zspec/zdo/buffaloZdo.d.ts.map +1 -1
- package/dist/zspec/zdo/buffaloZdo.js +4 -4
- package/dist/zspec/zdo/buffaloZdo.js.map +1 -1
- package/dist/zspec/zdo/definition/status.d.ts +1 -1
- package/dist/zspec/zdo/definition/status.js +1 -1
- package/dist/zspec/zdo/definition/tstypes.d.ts +48 -48
- package/dist/zspec/zdo/definition/tstypes.d.ts.map +1 -1
- package/dist/zspec/zdo/index.d.ts +7 -7
- package/dist/zspec/zdo/utils.d.ts +2 -2
- package/dist/zspec/zdo/utils.d.ts.map +1 -1
- package/dist/zspec/zdo/utils.js +1 -1
- package/dist/zspec/zdo/utils.js.map +1 -1
- package/dist/zspec/zdo/zdoStatusError.d.ts +1 -1
- package/examples/join-and-log.js +5 -5
- package/package.json +4 -11
- package/src/adapter/adapter.ts +189 -0
- package/src/adapter/adapterDiscovery.ts +653 -0
- package/src/adapter/const.ts +12 -0
- package/src/adapter/deconz/adapter/deconzAdapter.ts +768 -0
- package/src/adapter/deconz/driver/constants.ts +180 -0
- package/src/adapter/deconz/driver/driver.ts +900 -0
- package/src/adapter/deconz/driver/frame.ts +11 -0
- package/src/adapter/deconz/driver/frameParser.ts +557 -0
- package/src/adapter/deconz/driver/parser.ts +45 -0
- package/src/adapter/deconz/driver/writer.ts +22 -0
- package/src/adapter/deconz/types.d.ts +13 -0
- package/src/adapter/ember/adapter/emberAdapter.ts +2266 -0
- package/src/adapter/ember/adapter/endpoints.ts +86 -0
- package/src/adapter/ember/adapter/oneWaitress.ts +322 -0
- package/src/adapter/ember/adapter/tokensManager.ts +782 -0
- package/src/adapter/ember/consts.ts +178 -0
- package/src/adapter/ember/enums.ts +2123 -0
- package/src/adapter/ember/ezsp/buffalo.ts +1397 -0
- package/src/adapter/ember/ezsp/consts.ts +148 -0
- package/src/adapter/ember/ezsp/enums.ts +1087 -0
- package/src/adapter/ember/ezsp/ezsp.ts +8985 -0
- package/src/adapter/ember/ezspError.ts +10 -0
- package/src/adapter/ember/types.ts +866 -0
- package/src/adapter/ember/uart/ash.ts +1969 -0
- package/src/adapter/ember/uart/consts.ts +109 -0
- package/src/adapter/ember/uart/enums.ts +192 -0
- package/src/adapter/ember/uart/parser.ts +48 -0
- package/src/adapter/ember/uart/queues.ts +247 -0
- package/src/adapter/ember/uart/writer.ts +53 -0
- package/src/adapter/ember/utils/initters.ts +58 -0
- package/src/adapter/ember/utils/math.ts +73 -0
- package/src/adapter/events.ts +21 -0
- package/src/adapter/ezsp/adapter/backup.ts +109 -0
- package/src/adapter/ezsp/adapter/ezspAdapter.ts +614 -0
- package/src/adapter/ezsp/driver/commands.ts +2497 -0
- package/src/adapter/ezsp/driver/consts.ts +11 -0
- package/src/adapter/ezsp/driver/driver.ts +1002 -0
- package/src/adapter/ezsp/driver/ezsp.ts +802 -0
- package/src/adapter/ezsp/driver/frame.ts +101 -0
- package/src/adapter/ezsp/driver/index.ts +4 -0
- package/src/adapter/ezsp/driver/multicast.ts +78 -0
- package/src/adapter/ezsp/driver/parser.ts +81 -0
- package/src/adapter/ezsp/driver/types/basic.ts +201 -0
- package/src/adapter/ezsp/driver/types/index.ts +239 -0
- package/src/adapter/ezsp/driver/types/named.ts +2330 -0
- package/src/adapter/ezsp/driver/types/struct.ts +844 -0
- package/src/adapter/ezsp/driver/uart.ts +460 -0
- package/src/adapter/ezsp/driver/utils/crc16ccitt.ts +44 -0
- package/src/adapter/ezsp/driver/utils/index.ts +32 -0
- package/src/adapter/ezsp/driver/writer.ts +64 -0
- package/src/adapter/index.ts +3 -0
- package/src/adapter/serialPort.ts +58 -0
- package/src/adapter/socketPortUtils.ts +16 -0
- package/src/adapter/tstype.ts +78 -0
- package/src/adapter/z-stack/adapter/adapter-backup.ts +519 -0
- package/src/adapter/z-stack/adapter/adapter-nv-memory.ts +457 -0
- package/src/adapter/z-stack/adapter/endpoints.ts +57 -0
- package/src/adapter/z-stack/adapter/manager.ts +543 -0
- package/src/adapter/z-stack/adapter/tstype.ts +6 -0
- package/src/adapter/z-stack/adapter/zStackAdapter.ts +1190 -0
- package/src/adapter/z-stack/constants/af.ts +27 -0
- package/src/adapter/z-stack/constants/common.ts +285 -0
- package/src/adapter/z-stack/constants/dbg.ts +23 -0
- package/src/adapter/z-stack/constants/index.ts +11 -0
- package/src/adapter/z-stack/constants/mac.ts +128 -0
- package/src/adapter/z-stack/constants/sapi.ts +25 -0
- package/src/adapter/z-stack/constants/sys.ts +72 -0
- package/src/adapter/z-stack/constants/util.ts +82 -0
- package/src/adapter/z-stack/constants/utils.ts +14 -0
- package/src/adapter/z-stack/constants/zdo.ts +103 -0
- package/src/adapter/z-stack/models/startup-options.ts +13 -0
- package/src/adapter/z-stack/structs/entries/address-manager-entry.ts +44 -0
- package/src/adapter/z-stack/structs/entries/address-manager-table.ts +19 -0
- package/src/adapter/z-stack/structs/entries/aps-link-key-data-entry.ts +12 -0
- package/src/adapter/z-stack/structs/entries/aps-link-key-data-table.ts +21 -0
- package/src/adapter/z-stack/structs/entries/aps-tc-link-key-entry.ts +19 -0
- package/src/adapter/z-stack/structs/entries/aps-tc-link-key-table.ts +21 -0
- package/src/adapter/z-stack/structs/entries/channel-list.ts +8 -0
- package/src/adapter/z-stack/structs/entries/has-configured.ts +16 -0
- package/src/adapter/z-stack/structs/entries/index.ts +16 -0
- package/src/adapter/z-stack/structs/entries/nib.ts +66 -0
- package/src/adapter/z-stack/structs/entries/nwk-key-descriptor.ts +15 -0
- package/src/adapter/z-stack/structs/entries/nwk-key.ts +13 -0
- package/src/adapter/z-stack/structs/entries/nwk-pan-id.ts +8 -0
- package/src/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.ts +20 -0
- package/src/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.ts +19 -0
- package/src/adapter/z-stack/structs/entries/security-manager-entry.ts +33 -0
- package/src/adapter/z-stack/structs/entries/security-manager-table.ts +22 -0
- package/src/adapter/z-stack/structs/index.ts +4 -0
- package/src/adapter/z-stack/structs/serializable-memory-object.ts +14 -0
- package/src/adapter/z-stack/structs/struct.ts +367 -0
- package/src/adapter/z-stack/structs/table.ts +198 -0
- package/src/adapter/z-stack/unpi/constants.ts +33 -0
- package/src/adapter/z-stack/unpi/frame.ts +62 -0
- package/src/adapter/z-stack/unpi/index.ts +4 -0
- package/src/adapter/z-stack/unpi/parser.ts +56 -0
- package/src/adapter/z-stack/unpi/writer.ts +21 -0
- package/src/adapter/z-stack/utils/channel-list.ts +40 -0
- package/src/adapter/z-stack/utils/index.ts +2 -0
- package/src/adapter/z-stack/utils/network-options.ts +26 -0
- package/src/adapter/z-stack/znp/buffaloZnp.ts +175 -0
- package/src/adapter/z-stack/znp/definition.ts +2713 -0
- package/src/adapter/z-stack/znp/index.ts +2 -0
- package/src/adapter/z-stack/znp/parameterType.ts +22 -0
- package/src/adapter/z-stack/znp/tstype.ts +44 -0
- package/src/adapter/z-stack/znp/utils.ts +10 -0
- package/src/adapter/z-stack/znp/znp.ts +342 -0
- package/src/adapter/z-stack/znp/zpiObject.ts +148 -0
- package/src/adapter/zboss/adapter/zbossAdapter.ts +527 -0
- package/src/adapter/zboss/commands.ts +1184 -0
- package/src/adapter/zboss/consts.ts +9 -0
- package/src/adapter/zboss/driver.ts +423 -0
- package/src/adapter/zboss/enums.ts +360 -0
- package/src/adapter/zboss/frame.ts +227 -0
- package/src/adapter/zboss/reader.ts +65 -0
- package/src/adapter/zboss/types.ts +0 -0
- package/src/adapter/zboss/uart.ts +428 -0
- package/src/adapter/zboss/utils.ts +58 -0
- package/src/adapter/zboss/writer.ts +49 -0
- package/src/adapter/zigate/adapter/patchZdoBuffaloBE.ts +27 -0
- package/src/adapter/zigate/adapter/zigateAdapter.ts +618 -0
- package/src/adapter/zigate/driver/LICENSE +17 -0
- package/src/adapter/zigate/driver/buffaloZiGate.ts +212 -0
- package/src/adapter/zigate/driver/commandType.ts +418 -0
- package/src/adapter/zigate/driver/constants.ts +150 -0
- package/src/adapter/zigate/driver/frame.ts +197 -0
- package/src/adapter/zigate/driver/messageType.ts +287 -0
- package/src/adapter/zigate/driver/parameterType.ts +32 -0
- package/src/adapter/zigate/driver/ziGateObject.ts +146 -0
- package/src/adapter/zigate/driver/zigate.ts +426 -0
- package/src/adapter/zoh/adapter/utils.ts +27 -0
- package/src/adapter/zoh/adapter/zohAdapter.ts +837 -0
- package/src/buffalo/buffalo.ts +335 -0
- package/src/buffalo/index.ts +1 -0
- package/src/controller/controller.ts +1048 -0
- package/src/controller/database.ts +124 -0
- package/src/controller/events.ts +51 -0
- package/src/controller/greenPower.ts +603 -0
- package/src/controller/helpers/index.ts +1 -0
- package/src/controller/helpers/request.ts +94 -0
- package/src/controller/helpers/requestQueue.ts +125 -0
- package/src/controller/helpers/zclFrameConverter.ts +51 -0
- package/src/controller/helpers/zclTransactionSequenceNumber.ts +19 -0
- package/src/controller/index.ts +6 -0
- package/src/controller/model/device.ts +1320 -0
- package/src/controller/model/endpoint.ts +1040 -0
- package/src/controller/model/entity.ts +23 -0
- package/src/controller/model/group.ts +333 -0
- package/src/controller/model/index.ts +4 -0
- package/src/controller/touchlink.ts +189 -0
- package/src/controller/tstype.ts +39 -0
- package/src/index.ts +12 -0
- package/src/models/backup-storage-legacy.ts +48 -0
- package/src/models/backup-storage-unified.ts +47 -0
- package/src/models/backup.ts +37 -0
- package/src/models/index.ts +5 -0
- package/src/models/network-options.ts +11 -0
- package/src/utils/backup.ts +152 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/logger.ts +20 -0
- package/src/utils/patchBigIntSerialization.ts +8 -0
- package/src/utils/queue.ts +76 -0
- package/src/utils/types.d.ts +3 -0
- package/src/utils/utils.ts +20 -0
- package/src/utils/wait.ts +5 -0
- package/src/utils/waitress.ts +95 -0
- package/src/zspec/consts.ts +84 -0
- package/src/zspec/enums.ts +22 -0
- package/src/zspec/index.ts +3 -0
- package/src/zspec/tstypes.ts +18 -0
- package/src/zspec/utils.ts +308 -0
- package/src/zspec/zcl/buffaloZcl.ts +1133 -0
- package/src/zspec/zcl/definition/cluster.ts +5398 -0
- package/src/zspec/zcl/definition/consts.ts +24 -0
- package/src/zspec/zcl/definition/enums.ts +194 -0
- package/src/zspec/zcl/definition/foundation.ts +301 -0
- package/src/zspec/zcl/definition/manufacturerCode.ts +729 -0
- package/src/zspec/zcl/definition/status.ts +69 -0
- package/src/zspec/zcl/definition/tstype.ts +236 -0
- package/src/zspec/zcl/index.ts +10 -0
- package/src/zspec/zcl/utils.ts +342 -0
- package/src/zspec/zcl/zclFrame.ts +336 -0
- package/src/zspec/zcl/zclHeader.ts +102 -0
- package/src/zspec/zcl/zclStatusError.ts +10 -0
- package/src/zspec/zdo/buffaloZdo.ts +2345 -0
- package/src/zspec/zdo/definition/clusters.ts +722 -0
- package/src/zspec/zdo/definition/consts.ts +16 -0
- package/src/zspec/zdo/definition/enums.ts +99 -0
- package/src/zspec/zdo/definition/status.ts +105 -0
- package/src/zspec/zdo/definition/tstypes.ts +1062 -0
- package/src/zspec/zdo/index.ts +7 -0
- package/src/zspec/zdo/utils.ts +76 -0
- package/src/zspec/zdo/zdoStatusError.ts +10 -0
- package/test/adapter/adapter.test.ts +1062 -0
- package/test/adapter/ember/ash.test.ts +337 -0
- package/test/adapter/ember/consts.ts +131 -0
- package/test/adapter/ember/emberAdapter.test.ts +3449 -0
- package/test/adapter/ember/ezsp.test.ts +386 -0
- package/test/adapter/ember/ezspBuffalo.test.ts +92 -0
- package/test/adapter/ember/ezspError.test.ts +11 -0
- package/test/adapter/ember/math.test.ts +205 -0
- package/test/adapter/ezsp/frame.test.ts +29 -0
- package/test/adapter/ezsp/uart.test.ts +180 -0
- package/test/adapter/z-stack/adapter.test.ts +3985 -0
- package/test/adapter/z-stack/constants.test.ts +32 -0
- package/test/adapter/z-stack/structs.test.ts +114 -0
- package/test/adapter/z-stack/unpi.test.ts +212 -0
- package/test/adapter/z-stack/znp.test.ts +1284 -0
- package/test/adapter/zboss/fixZdoResponse.test.ts +178 -0
- package/test/adapter/zigate/patchZdoBuffaloBE.test.ts +80 -0
- package/test/adapter/zigate/zdo.test.ts +187 -0
- package/test/adapter/zoh/utils.test.ts +35 -0
- package/test/adapter/zoh/zohAdapter.test.ts +1306 -0
- package/test/buffalo.test.ts +430 -0
- package/test/controller.test.ts +10005 -0
- package/test/greenpower.test.ts +1421 -0
- package/test/mockAdapters.ts +65 -0
- package/test/mockDevices.ts +472 -0
- package/test/testUtils.ts +20 -0
- package/test/tsconfig.json +10 -0
- package/test/utils/math.ts +19 -0
- package/test/utils.test.ts +227 -0
- package/test/vitest.config.mts +25 -0
- package/test/zcl.test.ts +2832 -0
- package/test/zspec/utils.test.ts +131 -0
- package/test/zspec/zcl/buffalo.test.ts +1231 -0
- package/test/zspec/zcl/frame.test.ts +925 -0
- package/test/zspec/zcl/utils.test.ts +280 -0
- package/test/zspec/zdo/buffalo.test.ts +1849 -0
- package/test/zspec/zdo/utils.test.ts +240 -0
- package/.prettierignore +0 -2
- package/.prettierrc +0 -26
- package/eslint.config.mjs +0 -32
|
@@ -0,0 +1,1397 @@
|
|
|
1
|
+
/* v8 ignore start */
|
|
2
|
+
|
|
3
|
+
import Buffalo from "../../../buffalo/buffalo";
|
|
4
|
+
import {GP_SINK_LIST_ENTRIES} from "../consts";
|
|
5
|
+
import {EmberGpApplicationId, EmberGpSinkType, EzspStatus, SLStatus} from "../enums";
|
|
6
|
+
import type {
|
|
7
|
+
Ember802154RadioPriorities,
|
|
8
|
+
EmberAesMmoHashContext,
|
|
9
|
+
EmberApsFrame,
|
|
10
|
+
EmberBeaconClassificationParams,
|
|
11
|
+
EmberBeaconData,
|
|
12
|
+
EmberBeaconIterator,
|
|
13
|
+
EmberBindingTableEntry,
|
|
14
|
+
EmberCertificate283k1Data,
|
|
15
|
+
EmberCertificateData,
|
|
16
|
+
EmberChildData,
|
|
17
|
+
EmberCurrentSecurityState,
|
|
18
|
+
EmberDutyCycleLimits,
|
|
19
|
+
EmberEndpointDescription,
|
|
20
|
+
EmberGpAddress,
|
|
21
|
+
EmberGpProxyTableEntry,
|
|
22
|
+
EmberGpSinkListEntry,
|
|
23
|
+
EmberGpSinkTableEntry,
|
|
24
|
+
EmberInitialSecurityState,
|
|
25
|
+
EmberKeyData,
|
|
26
|
+
EmberMessageDigest,
|
|
27
|
+
EmberMultiPhyRadioParameters,
|
|
28
|
+
EmberMulticastTableEntry,
|
|
29
|
+
EmberMultiprotocolPriorities,
|
|
30
|
+
EmberNeighborTableEntry,
|
|
31
|
+
EmberNetworkInitStruct,
|
|
32
|
+
EmberNetworkParameters,
|
|
33
|
+
EmberPerDeviceDutyCycle,
|
|
34
|
+
EmberPrivateKey283k1Data,
|
|
35
|
+
EmberPrivateKeyData,
|
|
36
|
+
EmberPublicKey283k1Data,
|
|
37
|
+
EmberPublicKeyData,
|
|
38
|
+
EmberRouteTableEntry,
|
|
39
|
+
EmberRxPacketInfo,
|
|
40
|
+
EmberSignature283k1Data,
|
|
41
|
+
EmberSignatureData,
|
|
42
|
+
EmberSmacData,
|
|
43
|
+
EmberTokTypeStackZllData,
|
|
44
|
+
EmberTokTypeStackZllSecurity,
|
|
45
|
+
EmberTokenData,
|
|
46
|
+
EmberTokenInfo,
|
|
47
|
+
EmberZigbeeNetwork,
|
|
48
|
+
EmberZllAddressAssignment,
|
|
49
|
+
EmberZllDeviceInfoRecord,
|
|
50
|
+
EmberZllInitialSecurityState,
|
|
51
|
+
EmberZllNetwork,
|
|
52
|
+
EmberZllSecurityAlgorithmData,
|
|
53
|
+
SecManAPSKeyMetadata,
|
|
54
|
+
SecManContext,
|
|
55
|
+
SecManKey,
|
|
56
|
+
SecManNetworkKeyInfo,
|
|
57
|
+
} from "../types";
|
|
58
|
+
import {highByte} from "../utils/math";
|
|
59
|
+
import {
|
|
60
|
+
EMBER_AES_HASH_BLOCK_SIZE,
|
|
61
|
+
EMBER_CERTIFICATE_283K1_SIZE,
|
|
62
|
+
EMBER_CERTIFICATE_SIZE,
|
|
63
|
+
EMBER_ENCRYPTION_KEY_SIZE,
|
|
64
|
+
EMBER_PRIVATE_KEY_283K1_SIZE,
|
|
65
|
+
EMBER_PRIVATE_KEY_SIZE,
|
|
66
|
+
EMBER_PUBLIC_KEY_283K1_SIZE,
|
|
67
|
+
EMBER_PUBLIC_KEY_SIZE,
|
|
68
|
+
EMBER_SIGNATURE_283K1_SIZE,
|
|
69
|
+
EMBER_SIGNATURE_SIZE,
|
|
70
|
+
EMBER_SMAC_SIZE,
|
|
71
|
+
EXTENDED_PAN_ID_SIZE,
|
|
72
|
+
EZSP_EXTENDED_FRAME_CONTROL_HB_INDEX,
|
|
73
|
+
EZSP_EXTENDED_FRAME_CONTROL_LB_INDEX,
|
|
74
|
+
EZSP_EXTENDED_FRAME_CONTROL_RESERVED_MASK,
|
|
75
|
+
EZSP_EXTENDED_FRAME_FORMAT_VERSION,
|
|
76
|
+
EZSP_EXTENDED_FRAME_FORMAT_VERSION_MASK,
|
|
77
|
+
EZSP_EXTENDED_FRAME_ID_HB_INDEX,
|
|
78
|
+
EZSP_EXTENDED_FRAME_ID_LB_INDEX,
|
|
79
|
+
EZSP_EXTENDED_PARAMETERS_INDEX,
|
|
80
|
+
EZSP_FRAME_CONTROL_INDEX,
|
|
81
|
+
EZSP_FRAME_ID_INDEX,
|
|
82
|
+
EZSP_PARAMETERS_INDEX,
|
|
83
|
+
} from "./consts";
|
|
84
|
+
import type {EzspFrameID} from "./enums";
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Handle EmberStatus deprecation in v14+ for previous versions
|
|
88
|
+
*/
|
|
89
|
+
const EMBER_TO_SL_STATUS_MAP: ReadonlyMap<number, SLStatus> = new Map([
|
|
90
|
+
[0x02 /*BAD_ARGUMENT*/, SLStatus.INVALID_PARAMETER],
|
|
91
|
+
[0x18 /*NO_BUFFERS*/, SLStatus.ALLOCATION_FAILED],
|
|
92
|
+
[0x19 /*PACKET_HANDOFF_DROP_PACKET*/, SLStatus.ZIGBEE_PACKET_HANDOFF_DROPPED],
|
|
93
|
+
[0x66 /*DELIVERY_FAILED*/, SLStatus.ZIGBEE_DELIVERY_FAILED],
|
|
94
|
+
[0x70 /*INVALID_CALL*/, SLStatus.INVALID_STATE],
|
|
95
|
+
[0x72 /*MAX_MESSAGE_LIMIT_REACHED*/, SLStatus.ZIGBEE_MAX_MESSAGE_LIMIT_REACHED],
|
|
96
|
+
[0x74 /*MESSAGE_TOO_LONG*/, SLStatus.MESSAGE_TOO_LONG],
|
|
97
|
+
[0x75 /*BINDING_IS_ACTIVE*/, SLStatus.ZIGBEE_BINDING_IS_ACTIVE],
|
|
98
|
+
[0x76 /*ADDRESS_TABLE_ENTRY_IS_ACTIVE*/, SLStatus.ZIGBEE_ADDRESS_TABLE_ENTRY_IS_ACTIVE],
|
|
99
|
+
[0x90 /*NETWORK_UP*/, SLStatus.NETWORK_UP],
|
|
100
|
+
[0x91 /*NETWORK_DOWN*/, SLStatus.NETWORK_DOWN],
|
|
101
|
+
[0x93 /*NOT_JOINED*/, SLStatus.NOT_JOINED],
|
|
102
|
+
[0x95 /*INVALID_SECURITY_LEVEL*/, SLStatus.ZIGBEE_INVALID_SECURITY_LEVEL],
|
|
103
|
+
[0x96 /*MOVE_FAILED*/, SLStatus.ZIGBEE_MOVE_FAILED],
|
|
104
|
+
[0x99 /*NODE_ID_CHANGED*/, SLStatus.ZIGBEE_NODE_ID_CHANGED],
|
|
105
|
+
[0x9a /*PAN_ID_CHANGED*/, SLStatus.ZIGBEE_PAN_ID_CHANGED],
|
|
106
|
+
[0x9b /*CHANNEL_CHANGED*/, SLStatus.ZIGBEE_CHANNEL_CHANGED],
|
|
107
|
+
[0x9c /*NETWORK_OPENED*/, SLStatus.ZIGBEE_NETWORK_OPENED],
|
|
108
|
+
[0x9d /*NETWORK_CLOSED*/, SLStatus.ZIGBEE_NETWORK_CLOSED],
|
|
109
|
+
[0xa1 /*NETWORK_BUSY*/, SLStatus.BUSY],
|
|
110
|
+
[0xa4 /*BINDING_HAS_CHANGED*/, SLStatus.ZIGBEE_BINDING_HAS_CHANGED],
|
|
111
|
+
[0xa5 /*INSUFFICIENT_RANDOM_DATA*/, SLStatus.ZIGBEE_INSUFFICIENT_RANDOM_DATA],
|
|
112
|
+
[0xa6 /*APS_ENCRYPTION_ERROR*/, SLStatus.ZIGBEE_APS_ENCRYPTION_ERROR],
|
|
113
|
+
[0xa9 /*SOURCE_ROUTE_FAILURE*/, SLStatus.ZIGBEE_SOURCE_ROUTE_FAILURE],
|
|
114
|
+
[0xa8 /*SECURITY_STATE_NOT_SET*/, SLStatus.ZIGBEE_SECURITY_STATE_NOT_SET],
|
|
115
|
+
[0xaa /*MANY_TO_ONE_ROUTE_FAILURE*/, SLStatus.ZIGBEE_MANY_TO_ONE_ROUTE_FAILURE],
|
|
116
|
+
[0xac /*RECEIVED_KEY_IN_THE_CLEAR*/, SLStatus.ZIGBEE_RECEIVED_KEY_IN_THE_CLEAR],
|
|
117
|
+
[0xad /*NO_NETWORK_KEY_RECEIVED*/, SLStatus.ZIGBEE_NO_NETWORK_KEY_RECEIVED],
|
|
118
|
+
[0xae /*NO_LINK_KEY_RECEIVED*/, SLStatus.ZIGBEE_NO_LINK_KEY_RECEIVED],
|
|
119
|
+
[0xaf /*PRECONFIGURED_KEY_REQUIRED*/, SLStatus.ZIGBEE_PRECONFIGURED_KEY_REQUIRED],
|
|
120
|
+
[0xb0 /*STACK_AND_HARDWARE_MISMATCH*/, SLStatus.ZIGBEE_STACK_AND_HARDWARE_MISMATCH],
|
|
121
|
+
[0xb5 /*LIBRARY_NOT_PRESENT*/, SLStatus.NOT_AVAILABLE],
|
|
122
|
+
[0xb8 /*TOO_SOON_FOR_SWITCH_KEY*/, SLStatus.ZIGBEE_TOO_SOON_FOR_SWITCH_KEY],
|
|
123
|
+
[0xb9 /*SIGNATURE_VERIFY_FAILURE*/, SLStatus.ZIGBEE_SIGNATURE_VERIFY_FAILURE],
|
|
124
|
+
[0xbb /*KEY_NOT_AUTHORIZED*/, SLStatus.ZIGBEE_KEY_NOT_AUTHORIZED],
|
|
125
|
+
[0xbc /*TRUST_CENTER_EUI_HAS_CHANGED*/, SLStatus.ZIGBEE_TRUST_CENTER_SWAP_EUI_HAS_CHANGED],
|
|
126
|
+
[0xbe /*IEEE_ADDRESS_DISCOVERY_IN_PROGRESS*/, SLStatus.ZIGBEE_IEEE_ADDRESS_DISCOVERY_IN_PROGRESS],
|
|
127
|
+
[0xbf /*TRUST_CENTER_SWAPPED_OUT_EUI_HAS_NOT_CHANGED*/, SLStatus.ZIGBEE_TRUST_CENTER_SWAP_EUI_HAS_NOT_CHANGED],
|
|
128
|
+
]);
|
|
129
|
+
|
|
130
|
+
export class EzspBuffalo extends Buffalo {
|
|
131
|
+
public getBufferLength(): number {
|
|
132
|
+
return this.buffer.length;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Set the position of the internal position tracker. */
|
|
136
|
+
public setPosition(position: number): void {
|
|
137
|
+
this.position = position;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Set the byte at given position without affecting the internal position tracker.
|
|
142
|
+
* @param position
|
|
143
|
+
* @param value
|
|
144
|
+
*/
|
|
145
|
+
public setCommandByte(position: number, value: number): void {
|
|
146
|
+
this.buffer.writeUInt8(value, position);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Get the byte at given position without affecting the internal position tracker.
|
|
151
|
+
* @param position
|
|
152
|
+
* @returns
|
|
153
|
+
*/
|
|
154
|
+
public getCommandByte(position: number): number {
|
|
155
|
+
return this.buffer.readUInt8(position);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Get the byte at given position without affecting the internal position tracker.
|
|
160
|
+
* @param position
|
|
161
|
+
* @returns
|
|
162
|
+
*/
|
|
163
|
+
public getResponseByte(position: number): number {
|
|
164
|
+
return this.buffer.readUInt8(position);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
public getExtFrameControl(): number {
|
|
168
|
+
return (this.getResponseByte(EZSP_EXTENDED_FRAME_CONTROL_HB_INDEX) << 8) | this.getResponseByte(EZSP_EXTENDED_FRAME_CONTROL_LB_INDEX);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
public getExtFrameId(): EzspFrameID {
|
|
172
|
+
return (this.getResponseByte(EZSP_EXTENDED_FRAME_ID_HB_INDEX) << 8) | this.getResponseByte(EZSP_EXTENDED_FRAME_ID_LB_INDEX);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
public getFrameId(): EzspFrameID {
|
|
176
|
+
if (
|
|
177
|
+
(this.getResponseByte(EZSP_EXTENDED_FRAME_CONTROL_HB_INDEX) & EZSP_EXTENDED_FRAME_FORMAT_VERSION_MASK) ===
|
|
178
|
+
EZSP_EXTENDED_FRAME_FORMAT_VERSION
|
|
179
|
+
) {
|
|
180
|
+
return this.getExtFrameId();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return this.getResponseByte(EZSP_FRAME_ID_INDEX) as EzspFrameID;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Get the frame control, ID and params index according to format version.
|
|
188
|
+
* Throws if frame control is unsupported (using reserved).
|
|
189
|
+
* @returns Anything but SUCCESS should stop further processing.
|
|
190
|
+
*/
|
|
191
|
+
public getResponseMetadata(): [status: EzspStatus, frameControl: number, frameId: EzspFrameID, parametersIndex: number] {
|
|
192
|
+
let status: EzspStatus = EzspStatus.SUCCESS;
|
|
193
|
+
let frameControl: number;
|
|
194
|
+
let frameId: EzspFrameID;
|
|
195
|
+
let parametersIndex: number;
|
|
196
|
+
|
|
197
|
+
if (
|
|
198
|
+
(this.getResponseByte(EZSP_EXTENDED_FRAME_CONTROL_HB_INDEX) & EZSP_EXTENDED_FRAME_FORMAT_VERSION_MASK) ===
|
|
199
|
+
EZSP_EXTENDED_FRAME_FORMAT_VERSION
|
|
200
|
+
) {
|
|
201
|
+
// use extended ezsp frame format
|
|
202
|
+
frameControl = this.getExtFrameControl();
|
|
203
|
+
frameId = this.getExtFrameId();
|
|
204
|
+
parametersIndex = EZSP_EXTENDED_PARAMETERS_INDEX;
|
|
205
|
+
|
|
206
|
+
if (highByte(frameControl) & EZSP_EXTENDED_FRAME_CONTROL_RESERVED_MASK) {
|
|
207
|
+
// reject if unsupported frame
|
|
208
|
+
status = EzspStatus.ERROR_UNSUPPORTED_CONTROL;
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
// use legacy ezsp frame format
|
|
212
|
+
frameControl = this.getResponseByte(EZSP_FRAME_CONTROL_INDEX);
|
|
213
|
+
frameId = this.getResponseByte(EZSP_FRAME_ID_INDEX) as EzspFrameID;
|
|
214
|
+
parametersIndex = EZSP_PARAMETERS_INDEX;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return [status, frameControl, frameId, parametersIndex];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Get a copy of the rest of the buffer (from current position to end).
|
|
222
|
+
* WARNING: Make sure the length is appropriate, if alloc'ed longer, it will return everything until the end.
|
|
223
|
+
* @returns
|
|
224
|
+
*/
|
|
225
|
+
public readRest(): Buffer {
|
|
226
|
+
return Buffer.from(this.buffer.subarray(this.position));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* This is mostly used for payload/encryption stuff.
|
|
231
|
+
* Copies the buffer to avoid memory referencing issues since Ezsp has a single buffer allocated.
|
|
232
|
+
* @param length
|
|
233
|
+
* @returns
|
|
234
|
+
*/
|
|
235
|
+
protected readBufferCopy(length: number): Buffer {
|
|
236
|
+
return Buffer.from(this.readBuffer(length));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Write a uint8_t for payload length, followed by payload buffer (copied at post-length position).
|
|
241
|
+
*
|
|
242
|
+
* WARNING: `payload` must have a valid length (as in, not a Buffer allocated to longer length).
|
|
243
|
+
* Should be passed with getWritten() in most cases.
|
|
244
|
+
* @param payload
|
|
245
|
+
*/
|
|
246
|
+
public writePayload(payload: Buffer): void {
|
|
247
|
+
this.writeUInt8(payload.length);
|
|
248
|
+
|
|
249
|
+
this.position += payload.copy(this.buffer, this.position);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Read a uint8_t for payload length, followed by payload buffer (using post-length position).
|
|
254
|
+
* @returns
|
|
255
|
+
*/
|
|
256
|
+
public readPayload(): Buffer {
|
|
257
|
+
const messageLength = this.readUInt8();
|
|
258
|
+
|
|
259
|
+
return this.readBufferCopy(messageLength);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
public writeEmberNetworkParameters(value: EmberNetworkParameters): void {
|
|
263
|
+
this.writeListUInt8(value.extendedPanId);
|
|
264
|
+
this.writeUInt16(value.panId);
|
|
265
|
+
this.writeUInt8(value.radioTxPower);
|
|
266
|
+
this.writeUInt8(value.radioChannel);
|
|
267
|
+
this.writeUInt8(value.joinMethod);
|
|
268
|
+
this.writeUInt16(value.nwkManagerId);
|
|
269
|
+
this.writeUInt8(value.nwkUpdateId);
|
|
270
|
+
this.writeUInt32(value.channels);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
public readEmberNetworkParameters(): EmberNetworkParameters {
|
|
274
|
+
const extendedPanId = this.readListUInt8(EXTENDED_PAN_ID_SIZE);
|
|
275
|
+
const panId = this.readUInt16();
|
|
276
|
+
const radioTxPower = this.readUInt8();
|
|
277
|
+
const radioChannel = this.readUInt8();
|
|
278
|
+
const joinMethod = this.readUInt8();
|
|
279
|
+
const nwkManagerId = this.readUInt16();
|
|
280
|
+
const nwkUpdateId = this.readUInt8();
|
|
281
|
+
const channels = this.readUInt32();
|
|
282
|
+
|
|
283
|
+
return {
|
|
284
|
+
extendedPanId,
|
|
285
|
+
panId,
|
|
286
|
+
radioTxPower,
|
|
287
|
+
radioChannel,
|
|
288
|
+
joinMethod,
|
|
289
|
+
nwkManagerId,
|
|
290
|
+
nwkUpdateId,
|
|
291
|
+
channels,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
public writeEmberMultiPhyRadioParameters(value: EmberMultiPhyRadioParameters): void {
|
|
296
|
+
this.writeUInt8(value.radioTxPower);
|
|
297
|
+
this.writeUInt8(value.radioPage);
|
|
298
|
+
this.writeUInt8(value.radioChannel);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
public readEmberMultiPhyRadioParameters(): EmberMultiPhyRadioParameters {
|
|
302
|
+
const radioTxPower = this.readUInt8();
|
|
303
|
+
const radioPage = this.readUInt8();
|
|
304
|
+
const radioChannel = this.readUInt8();
|
|
305
|
+
|
|
306
|
+
return {radioTxPower, radioPage, radioChannel};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
public writeEmberApsFrame(value: EmberApsFrame): void {
|
|
310
|
+
this.writeUInt16(value.profileId);
|
|
311
|
+
this.writeUInt16(value.clusterId);
|
|
312
|
+
this.writeUInt8(value.sourceEndpoint);
|
|
313
|
+
this.writeUInt8(value.destinationEndpoint);
|
|
314
|
+
this.writeUInt16(value.options);
|
|
315
|
+
this.writeUInt16(value.groupId);
|
|
316
|
+
this.writeUInt8(value.sequence);
|
|
317
|
+
// this.writeUInt8(value.radius);// XXX: not in gecko_sdk, appended with separate param
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
public readEmberApsFrame(): EmberApsFrame {
|
|
321
|
+
const profileId = this.readUInt16();
|
|
322
|
+
const clusterId = this.readUInt16();
|
|
323
|
+
const sourceEndpoint = this.readUInt8();
|
|
324
|
+
const destinationEndpoint = this.readUInt8();
|
|
325
|
+
const options = this.readUInt16();
|
|
326
|
+
const groupId = this.readUInt16();
|
|
327
|
+
const sequence = this.readUInt8();
|
|
328
|
+
// const radius = this.readUInt8();// XXX: not in gecko_sdk, appended with separate param
|
|
329
|
+
|
|
330
|
+
return {
|
|
331
|
+
profileId,
|
|
332
|
+
clusterId,
|
|
333
|
+
sourceEndpoint,
|
|
334
|
+
destinationEndpoint,
|
|
335
|
+
options,
|
|
336
|
+
groupId,
|
|
337
|
+
sequence,
|
|
338
|
+
// radius,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
public writeEmberBindingTableEntry(value: EmberBindingTableEntry): void {
|
|
343
|
+
this.writeUInt8(value.type);
|
|
344
|
+
this.writeUInt8(value.local);
|
|
345
|
+
this.writeUInt16(value.clusterId);
|
|
346
|
+
this.writeUInt8(value.remote);
|
|
347
|
+
this.writeIeeeAddr(value.identifier);
|
|
348
|
+
this.writeUInt8(value.networkIndex);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
public readEmberBindingTableEntry(): EmberBindingTableEntry {
|
|
352
|
+
const type = this.readUInt8();
|
|
353
|
+
const local = this.readUInt8();
|
|
354
|
+
const clusterId = this.readUInt16();
|
|
355
|
+
const remote = this.readUInt8();
|
|
356
|
+
const identifier = this.readIeeeAddr();
|
|
357
|
+
const networkIndex = this.readUInt8();
|
|
358
|
+
|
|
359
|
+
return {
|
|
360
|
+
type,
|
|
361
|
+
local,
|
|
362
|
+
clusterId,
|
|
363
|
+
remote,
|
|
364
|
+
identifier,
|
|
365
|
+
networkIndex,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
public writeEmberMulticastTableEntry(value: EmberMulticastTableEntry): void {
|
|
370
|
+
this.writeUInt16(value.multicastId);
|
|
371
|
+
this.writeUInt8(value.endpoint);
|
|
372
|
+
this.writeUInt8(value.networkIndex);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
public readEmberMulticastTableEntry(): EmberMulticastTableEntry {
|
|
376
|
+
const multicastId = this.readUInt16();
|
|
377
|
+
const endpoint = this.readUInt8();
|
|
378
|
+
// XXX: not in gecko_sdk? as workaround check length for now since used at end in just one place
|
|
379
|
+
const networkIndex = this.isMore() ? this.readUInt8() : 0x00;
|
|
380
|
+
|
|
381
|
+
return {multicastId, endpoint, networkIndex};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
public writeEmberBeaconClassificationParams(value: EmberBeaconClassificationParams): void {
|
|
385
|
+
this.writeUInt8(value.minRssiForReceivingPkts);
|
|
386
|
+
this.writeUInt16(value.beaconClassificationMask);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
public readEmberBeaconClassificationParams(): EmberBeaconClassificationParams {
|
|
390
|
+
const minRssiForReceivingPkts = this.readUInt8(); // Int8...
|
|
391
|
+
const beaconClassificationMask = this.readUInt16();
|
|
392
|
+
|
|
393
|
+
return {minRssiForReceivingPkts, beaconClassificationMask};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
public writeEmberNeighborTableEntry(value: EmberNeighborTableEntry): void {
|
|
397
|
+
this.writeUInt16(value.shortId);
|
|
398
|
+
this.writeUInt8(value.averageLqi);
|
|
399
|
+
this.writeUInt8(value.inCost);
|
|
400
|
+
this.writeUInt8(value.outCost);
|
|
401
|
+
this.writeUInt8(value.age);
|
|
402
|
+
this.writeIeeeAddr(value.longId);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
public readEmberNeighborTableEntry(): EmberNeighborTableEntry {
|
|
406
|
+
const shortId = this.readUInt16();
|
|
407
|
+
const averageLqi = this.readUInt8();
|
|
408
|
+
const inCost = this.readUInt8();
|
|
409
|
+
const outCost = this.readUInt8();
|
|
410
|
+
const age = this.readUInt8();
|
|
411
|
+
const longId = this.readIeeeAddr();
|
|
412
|
+
|
|
413
|
+
return {
|
|
414
|
+
shortId,
|
|
415
|
+
averageLqi,
|
|
416
|
+
inCost,
|
|
417
|
+
outCost,
|
|
418
|
+
age,
|
|
419
|
+
longId,
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
public writeEmberRouteTableEntry(value: EmberRouteTableEntry): void {
|
|
424
|
+
this.writeUInt16(value.destination);
|
|
425
|
+
this.writeUInt16(value.nextHop);
|
|
426
|
+
this.writeUInt8(value.status);
|
|
427
|
+
this.writeUInt8(value.age);
|
|
428
|
+
this.writeUInt8(value.concentratorType);
|
|
429
|
+
this.writeUInt8(value.routeRecordState);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
public readEmberRouteTableEntry(): EmberRouteTableEntry {
|
|
433
|
+
const destination = this.readUInt16();
|
|
434
|
+
const nextHop = this.readUInt16();
|
|
435
|
+
const status = this.readUInt8();
|
|
436
|
+
const age = this.readUInt8();
|
|
437
|
+
const concentratorType = this.readUInt8();
|
|
438
|
+
const routeRecordState = this.readUInt8();
|
|
439
|
+
|
|
440
|
+
return {
|
|
441
|
+
destination,
|
|
442
|
+
nextHop,
|
|
443
|
+
status,
|
|
444
|
+
age,
|
|
445
|
+
concentratorType,
|
|
446
|
+
routeRecordState,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
public writeEmberKeyData(value: EmberKeyData): void {
|
|
451
|
+
this.writeBuffer(value.contents, EMBER_ENCRYPTION_KEY_SIZE);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
public readEmberKeyData(): EmberKeyData {
|
|
455
|
+
const contents = this.readBufferCopy(EMBER_ENCRYPTION_KEY_SIZE);
|
|
456
|
+
|
|
457
|
+
return {contents};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
public writeSecManKey(value: SecManKey): void {
|
|
461
|
+
this.writeEmberKeyData(value);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
public readSecManKey(): SecManKey {
|
|
465
|
+
return this.readEmberKeyData();
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
public writeSecManContext(value: SecManContext): void {
|
|
469
|
+
this.writeUInt8(value.coreKeyType);
|
|
470
|
+
this.writeUInt8(value.keyIndex);
|
|
471
|
+
this.writeUInt16(value.derivedType);
|
|
472
|
+
this.writeIeeeAddr(value.eui64);
|
|
473
|
+
this.writeUInt8(value.multiNetworkIndex);
|
|
474
|
+
this.writeUInt8(value.flags);
|
|
475
|
+
this.writeUInt32(value.psaKeyAlgPermission);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
public readSecManContext(): SecManContext {
|
|
479
|
+
const coreKeyType = this.readUInt8();
|
|
480
|
+
const keyIndex = this.readUInt8();
|
|
481
|
+
const derivedType = this.readUInt16();
|
|
482
|
+
const eui64 = this.readIeeeAddr();
|
|
483
|
+
const multiNetworkIndex = this.readUInt8();
|
|
484
|
+
const flags = this.readUInt8();
|
|
485
|
+
const psaKeyAlgPermission = this.readUInt32();
|
|
486
|
+
|
|
487
|
+
return {
|
|
488
|
+
coreKeyType,
|
|
489
|
+
keyIndex,
|
|
490
|
+
derivedType,
|
|
491
|
+
eui64,
|
|
492
|
+
multiNetworkIndex,
|
|
493
|
+
flags,
|
|
494
|
+
psaKeyAlgPermission,
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
public writeSecManNetworkKeyInfo(value: SecManNetworkKeyInfo): void {
|
|
499
|
+
this.writeUInt8(value.networkKeySet ? 1 : 0);
|
|
500
|
+
this.writeUInt8(value.alternateNetworkKeySet ? 1 : 0);
|
|
501
|
+
this.writeUInt8(value.networkKeySequenceNumber);
|
|
502
|
+
this.writeUInt8(value.altNetworkKeySequenceNumber);
|
|
503
|
+
this.writeUInt32(value.networkKeyFrameCounter);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
public readSecManNetworkKeyInfo(): SecManNetworkKeyInfo {
|
|
507
|
+
const networkKeySet = this.readUInt8() !== 0;
|
|
508
|
+
const alternateNetworkKeySet = this.readUInt8() !== 0;
|
|
509
|
+
const networkKeySequenceNumber = this.readUInt8();
|
|
510
|
+
const altNetworkKeySequenceNumber = this.readUInt8();
|
|
511
|
+
const networkKeyFrameCounter = this.readUInt32();
|
|
512
|
+
|
|
513
|
+
return {
|
|
514
|
+
networkKeySet: networkKeySet,
|
|
515
|
+
alternateNetworkKeySet: alternateNetworkKeySet,
|
|
516
|
+
networkKeySequenceNumber: networkKeySequenceNumber,
|
|
517
|
+
altNetworkKeySequenceNumber: altNetworkKeySequenceNumber,
|
|
518
|
+
networkKeyFrameCounter: networkKeyFrameCounter,
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
public writeSecManAPSKeyMetadata(value: SecManAPSKeyMetadata): void {
|
|
523
|
+
this.writeUInt16(value.bitmask);
|
|
524
|
+
this.writeUInt32(value.outgoingFrameCounter);
|
|
525
|
+
this.writeUInt32(value.incomingFrameCounter);
|
|
526
|
+
this.writeUInt16(value.ttlInSeconds);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
public readSecManAPSKeyMetadata(): SecManAPSKeyMetadata {
|
|
530
|
+
const bitmask = this.readUInt16();
|
|
531
|
+
const outgoingFrameCounter = this.readUInt32();
|
|
532
|
+
const incomingFrameCounter = this.readUInt32();
|
|
533
|
+
const ttlInSeconds = this.readUInt16();
|
|
534
|
+
|
|
535
|
+
return {
|
|
536
|
+
bitmask,
|
|
537
|
+
outgoingFrameCounter,
|
|
538
|
+
incomingFrameCounter,
|
|
539
|
+
ttlInSeconds,
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
public writeEmberInitialSecurityState(value: EmberInitialSecurityState): void {
|
|
544
|
+
this.writeUInt16(value.bitmask);
|
|
545
|
+
this.writeEmberKeyData(value.preconfiguredKey);
|
|
546
|
+
this.writeEmberKeyData(value.networkKey);
|
|
547
|
+
this.writeUInt8(value.networkKeySequenceNumber);
|
|
548
|
+
this.writeIeeeAddr(value.preconfiguredTrustCenterEui64);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
public readEmberInitialSecurityState(): EmberInitialSecurityState {
|
|
552
|
+
const bitmask = this.readUInt16();
|
|
553
|
+
const preconfiguredKey = this.readEmberKeyData();
|
|
554
|
+
const networkKey = this.readEmberKeyData();
|
|
555
|
+
const networkKeySequenceNumber = this.readUInt8();
|
|
556
|
+
const preconfiguredTrustCenterEui64 = this.readIeeeAddr();
|
|
557
|
+
|
|
558
|
+
return {
|
|
559
|
+
bitmask,
|
|
560
|
+
preconfiguredKey,
|
|
561
|
+
networkKey,
|
|
562
|
+
networkKeySequenceNumber,
|
|
563
|
+
preconfiguredTrustCenterEui64,
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
public writeEmberCurrentSecurityState(value: EmberCurrentSecurityState): void {
|
|
568
|
+
this.writeUInt16(value.bitmask);
|
|
569
|
+
this.writeIeeeAddr(value.trustCenterLongAddress);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
public readEmberCurrentSecurityState(): EmberCurrentSecurityState {
|
|
573
|
+
const bitmask = this.readUInt16();
|
|
574
|
+
const trustCenterLongAddress = this.readIeeeAddr();
|
|
575
|
+
|
|
576
|
+
return {bitmask, trustCenterLongAddress};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
public writeEmberChildData(value: EmberChildData): void {
|
|
580
|
+
this.writeIeeeAddr(value.eui64);
|
|
581
|
+
this.writeUInt8(value.type);
|
|
582
|
+
this.writeUInt16(value.id);
|
|
583
|
+
this.writeUInt8(value.phy);
|
|
584
|
+
this.writeUInt8(value.power);
|
|
585
|
+
this.writeUInt8(value.timeout);
|
|
586
|
+
this.writeUInt32(value.remainingTimeout);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
public readEmberChildData(): EmberChildData {
|
|
590
|
+
const eui64 = this.readIeeeAddr();
|
|
591
|
+
const type = this.readUInt8();
|
|
592
|
+
const id = this.readUInt16();
|
|
593
|
+
const phy = this.readUInt8();
|
|
594
|
+
const power = this.readUInt8();
|
|
595
|
+
const timeout = this.readUInt8();
|
|
596
|
+
const remainingTimeout = this.readUInt32();
|
|
597
|
+
|
|
598
|
+
return {
|
|
599
|
+
eui64,
|
|
600
|
+
type,
|
|
601
|
+
id,
|
|
602
|
+
phy,
|
|
603
|
+
power,
|
|
604
|
+
timeout,
|
|
605
|
+
remainingTimeout,
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
public readEmberZigbeeNetwork(): EmberZigbeeNetwork {
|
|
610
|
+
const channel = this.readUInt8();
|
|
611
|
+
const panId = this.readUInt16();
|
|
612
|
+
const extendedPanId = this.readListUInt8(EXTENDED_PAN_ID_SIZE);
|
|
613
|
+
const allowingJoin = this.readUInt8() !== 0;
|
|
614
|
+
const stackProfile = this.readUInt8();
|
|
615
|
+
const nwkUpdateId = this.readUInt8();
|
|
616
|
+
|
|
617
|
+
return {
|
|
618
|
+
channel,
|
|
619
|
+
panId,
|
|
620
|
+
extendedPanId,
|
|
621
|
+
allowingJoin,
|
|
622
|
+
stackProfile,
|
|
623
|
+
nwkUpdateId,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
public writeEmberZigbeeNetwork(value: EmberZigbeeNetwork): void {
|
|
628
|
+
this.writeUInt8(value.channel);
|
|
629
|
+
this.writeUInt16(value.panId);
|
|
630
|
+
this.writeListUInt8(value.extendedPanId);
|
|
631
|
+
this.writeUInt8(value.allowingJoin ? 1 : 0);
|
|
632
|
+
this.writeUInt8(value.stackProfile);
|
|
633
|
+
this.writeUInt8(value.nwkUpdateId);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
public writeEmberCertificateData(value: EmberCertificateData): void {
|
|
637
|
+
this.writeBuffer(value.contents, EMBER_CERTIFICATE_SIZE);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
public readEmberCertificateData(): EmberCertificateData {
|
|
641
|
+
const contents = this.readBufferCopy(EMBER_CERTIFICATE_SIZE);
|
|
642
|
+
|
|
643
|
+
return {contents};
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
public writeEmberPublicKeyData(value: EmberPublicKeyData): void {
|
|
647
|
+
this.writeBuffer(value.contents, EMBER_PUBLIC_KEY_SIZE);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
public readEmberPublicKeyData(): EmberPublicKeyData {
|
|
651
|
+
const contents = this.readBufferCopy(EMBER_PUBLIC_KEY_SIZE);
|
|
652
|
+
|
|
653
|
+
return {contents};
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
public writeEmberPrivateKeyData(value: EmberPrivateKeyData): void {
|
|
657
|
+
this.writeBuffer(value.contents, EMBER_PRIVATE_KEY_SIZE);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
public readEmberPrivateKeyData(): EmberPrivateKeyData {
|
|
661
|
+
const contents = this.readBufferCopy(EMBER_PRIVATE_KEY_SIZE);
|
|
662
|
+
|
|
663
|
+
return {contents};
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
public writeEmberSmacData(value: EmberSmacData): void {
|
|
667
|
+
this.writeBuffer(value.contents, EMBER_SMAC_SIZE);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
public readEmberSmacData(): EmberSmacData {
|
|
671
|
+
const contents = this.readBufferCopy(EMBER_SMAC_SIZE);
|
|
672
|
+
|
|
673
|
+
return {contents};
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
public writeEmberSignatureData(value: EmberSignatureData): void {
|
|
677
|
+
this.writeBuffer(value.contents, EMBER_SIGNATURE_SIZE);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
public readEmberSignatureData(): EmberSignatureData {
|
|
681
|
+
const contents = this.readBufferCopy(EMBER_SIGNATURE_SIZE);
|
|
682
|
+
|
|
683
|
+
return {contents};
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
public writeEmberCertificate283k1Data(value: EmberCertificate283k1Data): void {
|
|
687
|
+
this.writeBuffer(value.contents, EMBER_CERTIFICATE_283K1_SIZE);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
public readEmberCertificate283k1Data(): EmberCertificate283k1Data {
|
|
691
|
+
const contents = this.readBufferCopy(EMBER_CERTIFICATE_283K1_SIZE);
|
|
692
|
+
|
|
693
|
+
return {contents};
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
public writeEmberPublicKey283k1Data(value: EmberPublicKey283k1Data): void {
|
|
697
|
+
this.writeBuffer(value.contents, EMBER_PUBLIC_KEY_283K1_SIZE);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
public readEmberPublicKey283k1Data(): EmberPublicKey283k1Data {
|
|
701
|
+
const contents = this.readBufferCopy(EMBER_PUBLIC_KEY_283K1_SIZE);
|
|
702
|
+
|
|
703
|
+
return {contents};
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
public writeEmberPrivateKey283k1Data(value: EmberPrivateKey283k1Data): void {
|
|
707
|
+
this.writeBuffer(value.contents, EMBER_PRIVATE_KEY_283K1_SIZE);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
public readEmberPrivateKey283k1Data(): EmberPrivateKey283k1Data {
|
|
711
|
+
const contents = this.readBufferCopy(EMBER_PRIVATE_KEY_283K1_SIZE);
|
|
712
|
+
|
|
713
|
+
return {contents};
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
public writeEmberSignature283k1Data(value: EmberSignature283k1Data): void {
|
|
717
|
+
this.writeBuffer(value.contents, EMBER_SIGNATURE_283K1_SIZE);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
public readEmberSignature283k1Data(): EmberSignature283k1Data {
|
|
721
|
+
const contents = this.readBufferCopy(EMBER_SIGNATURE_283K1_SIZE);
|
|
722
|
+
|
|
723
|
+
return {contents};
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
public writeEmberAesMmoHashContext(context: EmberAesMmoHashContext): void {
|
|
727
|
+
this.writeBuffer(context.result, EMBER_AES_HASH_BLOCK_SIZE);
|
|
728
|
+
this.writeUInt32(context.length);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
public readEmberAesMmoHashContext(): EmberAesMmoHashContext {
|
|
732
|
+
const result = this.readBufferCopy(EMBER_AES_HASH_BLOCK_SIZE);
|
|
733
|
+
const length = this.readUInt32();
|
|
734
|
+
|
|
735
|
+
return {result, length};
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
public writeEmberMessageDigest(value: EmberMessageDigest): void {
|
|
739
|
+
this.writeBuffer(value.contents, EMBER_AES_HASH_BLOCK_SIZE);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
public readEmberMessageDigest(): EmberMessageDigest {
|
|
743
|
+
const contents = this.readBufferCopy(EMBER_AES_HASH_BLOCK_SIZE);
|
|
744
|
+
|
|
745
|
+
return {contents};
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
public writeEmberNetworkInitStruct(networkInitStruct: EmberNetworkInitStruct): void {
|
|
749
|
+
this.writeUInt16(networkInitStruct.bitmask);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
public readEmberNetworkInitStruct(): EmberNetworkInitStruct {
|
|
753
|
+
const bitmask = this.readUInt16();
|
|
754
|
+
|
|
755
|
+
return {bitmask};
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
public writeEmberZllNetwork(network: EmberZllNetwork): void {
|
|
759
|
+
this.writeEmberZigbeeNetwork(network.zigbeeNetwork);
|
|
760
|
+
this.writeEmberZllSecurityAlgorithmData(network.securityAlgorithm);
|
|
761
|
+
this.writeIeeeAddr(network.eui64);
|
|
762
|
+
this.writeUInt16(network.nodeId);
|
|
763
|
+
this.writeUInt16(network.state);
|
|
764
|
+
this.writeUInt8(network.nodeType);
|
|
765
|
+
this.writeUInt8(network.numberSubDevices);
|
|
766
|
+
this.writeUInt8(network.totalGroupIdentifiers);
|
|
767
|
+
this.writeUInt8(network.rssiCorrection);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
public readEmberZllNetwork(): EmberZllNetwork {
|
|
771
|
+
const zigbeeNetwork = this.readEmberZigbeeNetwork();
|
|
772
|
+
const securityAlgorithm = this.readEmberZllSecurityAlgorithmData();
|
|
773
|
+
const eui64 = this.readIeeeAddr();
|
|
774
|
+
const nodeId = this.readUInt16();
|
|
775
|
+
const state = this.readUInt16();
|
|
776
|
+
const nodeType = this.readUInt8();
|
|
777
|
+
const numberSubDevices = this.readUInt8();
|
|
778
|
+
const totalGroupIdentifiers = this.readUInt8();
|
|
779
|
+
const rssiCorrection = this.readUInt8();
|
|
780
|
+
|
|
781
|
+
return {
|
|
782
|
+
zigbeeNetwork,
|
|
783
|
+
securityAlgorithm,
|
|
784
|
+
eui64,
|
|
785
|
+
nodeId,
|
|
786
|
+
state,
|
|
787
|
+
nodeType,
|
|
788
|
+
numberSubDevices,
|
|
789
|
+
totalGroupIdentifiers,
|
|
790
|
+
rssiCorrection,
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
public writeEmberZllSecurityAlgorithmData(data: EmberZllSecurityAlgorithmData): void {
|
|
795
|
+
this.writeUInt32(data.transactionId);
|
|
796
|
+
this.writeUInt32(data.responseId);
|
|
797
|
+
this.writeUInt16(data.bitmask);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
public readEmberZllSecurityAlgorithmData(): EmberZllSecurityAlgorithmData {
|
|
801
|
+
const transactionId = this.readUInt32();
|
|
802
|
+
const responseId = this.readUInt32();
|
|
803
|
+
const bitmask = this.readUInt16();
|
|
804
|
+
|
|
805
|
+
return {transactionId, responseId, bitmask};
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
public writeEmberZllInitialSecurityState(state: EmberZllInitialSecurityState): void {
|
|
809
|
+
this.writeUInt32(state.bitmask);
|
|
810
|
+
this.writeUInt8(state.keyIndex);
|
|
811
|
+
this.writeEmberKeyData(state.encryptionKey);
|
|
812
|
+
this.writeEmberKeyData(state.preconfiguredKey);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
public writeEmberTokTypeStackZllData(data: EmberTokTypeStackZllData): void {
|
|
816
|
+
this.writeUInt32(data.bitmask);
|
|
817
|
+
this.writeUInt16(data.freeNodeIdMin);
|
|
818
|
+
this.writeUInt16(data.freeNodeIdMax);
|
|
819
|
+
this.writeUInt16(data.myGroupIdMin);
|
|
820
|
+
this.writeUInt16(data.freeGroupIdMin);
|
|
821
|
+
this.writeUInt16(data.freeGroupIdMax);
|
|
822
|
+
this.writeUInt8(data.rssiCorrection);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
public readEmberTokTypeStackZllData(): EmberTokTypeStackZllData {
|
|
826
|
+
const bitmask = this.readUInt32();
|
|
827
|
+
const freeNodeIdMin = this.readUInt16();
|
|
828
|
+
const freeNodeIdMax = this.readUInt16();
|
|
829
|
+
const myGroupIdMin = this.readUInt16();
|
|
830
|
+
const freeGroupIdMin = this.readUInt16();
|
|
831
|
+
const freeGroupIdMax = this.readUInt16();
|
|
832
|
+
const rssiCorrection = this.readUInt8();
|
|
833
|
+
|
|
834
|
+
return {
|
|
835
|
+
bitmask,
|
|
836
|
+
freeNodeIdMin,
|
|
837
|
+
freeNodeIdMax,
|
|
838
|
+
myGroupIdMin,
|
|
839
|
+
freeGroupIdMin,
|
|
840
|
+
freeGroupIdMax,
|
|
841
|
+
rssiCorrection,
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
public writeEmberTokTypeStackZllSecurity(security: EmberTokTypeStackZllSecurity): void {
|
|
846
|
+
this.writeUInt32(security.bitmask);
|
|
847
|
+
this.writeUInt8(security.keyIndex);
|
|
848
|
+
this.writeBuffer(security.encryptionKey, EMBER_ENCRYPTION_KEY_SIZE);
|
|
849
|
+
this.writeBuffer(security.preconfiguredKey, EMBER_ENCRYPTION_KEY_SIZE);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
public readEmberTokTypeStackZllSecurity(): EmberTokTypeStackZllSecurity {
|
|
853
|
+
const bitmask = this.readUInt32();
|
|
854
|
+
const keyIndex = this.readUInt8();
|
|
855
|
+
const encryptionKey = this.readBufferCopy(EMBER_ENCRYPTION_KEY_SIZE);
|
|
856
|
+
const preconfiguredKey = this.readBufferCopy(EMBER_ENCRYPTION_KEY_SIZE);
|
|
857
|
+
|
|
858
|
+
return {
|
|
859
|
+
bitmask,
|
|
860
|
+
keyIndex,
|
|
861
|
+
encryptionKey,
|
|
862
|
+
preconfiguredKey,
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
public writeEmberGpAddress(value: EmberGpAddress): void {
|
|
867
|
+
this.writeUInt8(value.applicationId);
|
|
868
|
+
|
|
869
|
+
if (value.applicationId === EmberGpApplicationId.SOURCE_ID) {
|
|
870
|
+
this.writeUInt32(value.sourceId);
|
|
871
|
+
this.writeUInt32(value.sourceId); // filler
|
|
872
|
+
} else if (value.applicationId === EmberGpApplicationId.IEEE_ADDRESS) {
|
|
873
|
+
this.writeIeeeAddr(value.gpdIeeeAddress);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
this.writeUInt8(value.endpoint);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
public readEmberGpAddress(): EmberGpAddress {
|
|
880
|
+
const applicationId = this.readUInt8();
|
|
881
|
+
|
|
882
|
+
if (applicationId === EmberGpApplicationId.SOURCE_ID) {
|
|
883
|
+
const sourceId = this.readUInt32();
|
|
884
|
+
this.readUInt32(); // filler
|
|
885
|
+
const endpoint = this.readUInt8();
|
|
886
|
+
|
|
887
|
+
return {applicationId, sourceId, endpoint};
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
if (applicationId === EmberGpApplicationId.IEEE_ADDRESS) {
|
|
891
|
+
const gpdIeeeAddress = this.readIeeeAddr();
|
|
892
|
+
const endpoint = this.readUInt8();
|
|
893
|
+
|
|
894
|
+
return {applicationId, gpdIeeeAddress, endpoint};
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
throw new Error(`Invalid GP applicationId ${applicationId}.`);
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
public readEmberGpSinkList(): EmberGpSinkListEntry[] {
|
|
901
|
+
const list: EmberGpSinkListEntry[] = [];
|
|
902
|
+
|
|
903
|
+
for (let i = 0; i < GP_SINK_LIST_ENTRIES; i++) {
|
|
904
|
+
const type: EmberGpSinkType = this.readUInt8();
|
|
905
|
+
|
|
906
|
+
switch (type) {
|
|
907
|
+
case EmberGpSinkType.D_GROUPCAST:
|
|
908
|
+
case EmberGpSinkType.GROUPCAST: {
|
|
909
|
+
const alias = this.readUInt16();
|
|
910
|
+
const groupID = this.readUInt16();
|
|
911
|
+
|
|
912
|
+
// fillers
|
|
913
|
+
this.readUInt16();
|
|
914
|
+
this.readUInt16();
|
|
915
|
+
this.readUInt16();
|
|
916
|
+
|
|
917
|
+
list.push({
|
|
918
|
+
type,
|
|
919
|
+
groupcast: {
|
|
920
|
+
alias,
|
|
921
|
+
groupID,
|
|
922
|
+
},
|
|
923
|
+
});
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
// case EmberGpSinkType.FULL_UNICAST:
|
|
927
|
+
// case EmberGpSinkType.LW_UNICAST:
|
|
928
|
+
// case EmberGpSinkType.UNUSED:
|
|
929
|
+
default: {
|
|
930
|
+
const sinkNodeId = this.readUInt16();
|
|
931
|
+
const sinkEUI = this.readIeeeAddr();
|
|
932
|
+
|
|
933
|
+
list.push({
|
|
934
|
+
type,
|
|
935
|
+
unicast: {
|
|
936
|
+
sinkNodeId,
|
|
937
|
+
sinkEUI,
|
|
938
|
+
},
|
|
939
|
+
});
|
|
940
|
+
break;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
return list;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
public writeEmberGpSinkList(value: EmberGpSinkListEntry[]): void {
|
|
949
|
+
for (let i = 0; i < GP_SINK_LIST_ENTRIES; i++) {
|
|
950
|
+
const entry = value[i];
|
|
951
|
+
|
|
952
|
+
this.writeUInt8(entry.type);
|
|
953
|
+
|
|
954
|
+
switch (entry.type) {
|
|
955
|
+
case EmberGpSinkType.D_GROUPCAST:
|
|
956
|
+
case EmberGpSinkType.GROUPCAST: {
|
|
957
|
+
this.writeUInt16(entry.groupcast.alias);
|
|
958
|
+
this.writeUInt16(entry.groupcast.groupID);
|
|
959
|
+
//fillers
|
|
960
|
+
this.writeUInt16(entry.groupcast.alias);
|
|
961
|
+
this.writeUInt16(entry.groupcast.groupID);
|
|
962
|
+
this.writeUInt16(entry.groupcast.alias);
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
// case EmberGpSinkType.FULL_UNICAST:
|
|
967
|
+
// case EmberGpSinkType.LW_UNICAST:
|
|
968
|
+
// case EmberGpSinkType.UNUSED:
|
|
969
|
+
default: {
|
|
970
|
+
this.writeUInt16(entry.unicast.sinkNodeId);
|
|
971
|
+
this.writeIeeeAddr(entry.unicast.sinkEUI);
|
|
972
|
+
|
|
973
|
+
break;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
public readEmberGpProxyTableEntry(): EmberGpProxyTableEntry {
|
|
980
|
+
const status = this.readUInt8();
|
|
981
|
+
const options = this.readUInt32();
|
|
982
|
+
const gpd = this.readEmberGpAddress();
|
|
983
|
+
const assignedAlias = this.readUInt16();
|
|
984
|
+
const securityOptions = this.readUInt8();
|
|
985
|
+
const gpdSecurityFrameCounter = this.readUInt32();
|
|
986
|
+
const gpdKey = this.readEmberKeyData();
|
|
987
|
+
const sinkList = this.readEmberGpSinkList();
|
|
988
|
+
const groupcastRadius = this.readUInt8();
|
|
989
|
+
const searchCounter = this.readUInt8();
|
|
990
|
+
|
|
991
|
+
return {
|
|
992
|
+
status,
|
|
993
|
+
options,
|
|
994
|
+
gpd,
|
|
995
|
+
assignedAlias,
|
|
996
|
+
securityOptions,
|
|
997
|
+
gpdSecurityFrameCounter,
|
|
998
|
+
gpdKey,
|
|
999
|
+
sinkList,
|
|
1000
|
+
groupcastRadius,
|
|
1001
|
+
searchCounter,
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
public writeEmberGpProxyTableEntry(value: EmberGpProxyTableEntry): void {
|
|
1006
|
+
this.writeUInt8(value.status);
|
|
1007
|
+
this.writeUInt32(value.options);
|
|
1008
|
+
this.writeEmberGpAddress(value.gpd);
|
|
1009
|
+
this.writeUInt16(value.assignedAlias);
|
|
1010
|
+
this.writeUInt8(value.securityOptions);
|
|
1011
|
+
this.writeUInt32(value.gpdSecurityFrameCounter);
|
|
1012
|
+
this.writeEmberKeyData(value.gpdKey);
|
|
1013
|
+
this.writeEmberGpSinkList(value.sinkList);
|
|
1014
|
+
this.writeUInt8(value.groupcastRadius);
|
|
1015
|
+
this.writeUInt8(value.searchCounter);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
public readEmberGpSinkTableEntry(): EmberGpSinkTableEntry {
|
|
1019
|
+
const status = this.readUInt8();
|
|
1020
|
+
const options = this.readUInt16();
|
|
1021
|
+
const gpd = this.readEmberGpAddress();
|
|
1022
|
+
const deviceId = this.readUInt8();
|
|
1023
|
+
const sinkList = this.readEmberGpSinkList();
|
|
1024
|
+
const assignedAlias = this.readUInt16();
|
|
1025
|
+
const groupcastRadius = this.readUInt8();
|
|
1026
|
+
const securityOptions = this.readUInt8();
|
|
1027
|
+
const gpdSecurityFrameCounter = this.readUInt32();
|
|
1028
|
+
const gpdKey = this.readEmberKeyData();
|
|
1029
|
+
|
|
1030
|
+
return {
|
|
1031
|
+
status,
|
|
1032
|
+
options,
|
|
1033
|
+
gpd,
|
|
1034
|
+
deviceId,
|
|
1035
|
+
sinkList,
|
|
1036
|
+
assignedAlias,
|
|
1037
|
+
groupcastRadius,
|
|
1038
|
+
securityOptions,
|
|
1039
|
+
gpdSecurityFrameCounter,
|
|
1040
|
+
gpdKey,
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
public writeEmberGpSinkTableEntry(value: EmberGpSinkTableEntry): void {
|
|
1045
|
+
this.writeUInt8(value.status);
|
|
1046
|
+
this.writeUInt16(value.options);
|
|
1047
|
+
this.writeEmberGpAddress(value.gpd);
|
|
1048
|
+
this.writeUInt8(value.deviceId);
|
|
1049
|
+
this.writeEmberGpSinkList(value.sinkList);
|
|
1050
|
+
this.writeUInt16(value.assignedAlias);
|
|
1051
|
+
this.writeUInt8(value.groupcastRadius);
|
|
1052
|
+
this.writeUInt8(value.securityOptions);
|
|
1053
|
+
this.writeUInt32(value.gpdSecurityFrameCounter);
|
|
1054
|
+
this.writeEmberKeyData(value.gpdKey);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
public writeEmberDutyCycleLimits(limits: EmberDutyCycleLimits): void {
|
|
1058
|
+
this.writeUInt16(limits.limitThresh);
|
|
1059
|
+
this.writeUInt16(limits.critThresh);
|
|
1060
|
+
this.writeUInt16(limits.suspLimit);
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
public readEmberDutyCycleLimits(): EmberDutyCycleLimits {
|
|
1064
|
+
const limitThresh = this.readUInt16();
|
|
1065
|
+
const critThresh = this.readUInt16();
|
|
1066
|
+
const suspLimit = this.readUInt16();
|
|
1067
|
+
|
|
1068
|
+
return {
|
|
1069
|
+
limitThresh,
|
|
1070
|
+
critThresh,
|
|
1071
|
+
suspLimit,
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
public writeEmberPerDeviceDutyCycle(maxDevices: number, arrayOfDeviceDutyCycles: EmberPerDeviceDutyCycle[]): void {
|
|
1076
|
+
this.writeUInt16(maxDevices);
|
|
1077
|
+
|
|
1078
|
+
for (let i = 0; i < maxDevices; i++) {
|
|
1079
|
+
this.writeUInt16(arrayOfDeviceDutyCycles[i].nodeId);
|
|
1080
|
+
this.writeUInt16(arrayOfDeviceDutyCycles[i].dutyCycleConsumed);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
public readEmberPerDeviceDutyCycle(): EmberPerDeviceDutyCycle[] {
|
|
1085
|
+
const maxDevices = this.readUInt8();
|
|
1086
|
+
const arrayOfDeviceDutyCycles: EmberPerDeviceDutyCycle[] = [];
|
|
1087
|
+
|
|
1088
|
+
for (let i = 0; i < maxDevices; i++) {
|
|
1089
|
+
const nodeId = this.readUInt16();
|
|
1090
|
+
const dutyCycleConsumed = this.readUInt16();
|
|
1091
|
+
|
|
1092
|
+
arrayOfDeviceDutyCycles.push({nodeId, dutyCycleConsumed});
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
return arrayOfDeviceDutyCycles;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
public readEmberZllDeviceInfoRecord(): EmberZllDeviceInfoRecord {
|
|
1099
|
+
const ieeeAddress = this.readIeeeAddr();
|
|
1100
|
+
const endpointId = this.readUInt8();
|
|
1101
|
+
const profileId = this.readUInt16();
|
|
1102
|
+
const deviceId = this.readUInt16();
|
|
1103
|
+
const version = this.readUInt8();
|
|
1104
|
+
const groupIdCount = this.readUInt8();
|
|
1105
|
+
|
|
1106
|
+
return {
|
|
1107
|
+
ieeeAddress,
|
|
1108
|
+
endpointId,
|
|
1109
|
+
profileId,
|
|
1110
|
+
deviceId,
|
|
1111
|
+
version,
|
|
1112
|
+
groupIdCount,
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
public readEmberZllInitialSecurityState(): EmberZllInitialSecurityState {
|
|
1117
|
+
const bitmask = this.readUInt32();
|
|
1118
|
+
const keyIndex = this.readUInt8();
|
|
1119
|
+
const encryptionKey = this.readEmberKeyData();
|
|
1120
|
+
const preconfiguredKey = this.readEmberKeyData();
|
|
1121
|
+
|
|
1122
|
+
return {
|
|
1123
|
+
bitmask,
|
|
1124
|
+
keyIndex,
|
|
1125
|
+
encryptionKey,
|
|
1126
|
+
preconfiguredKey,
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
public readEmberZllAddressAssignment(): EmberZllAddressAssignment {
|
|
1131
|
+
const nodeId = this.readUInt16();
|
|
1132
|
+
const freeNodeIdMin = this.readUInt16();
|
|
1133
|
+
const freeNodeIdMax = this.readUInt16();
|
|
1134
|
+
const groupIdMin = this.readUInt16();
|
|
1135
|
+
const groupIdMax = this.readUInt16();
|
|
1136
|
+
const freeGroupIdMin = this.readUInt16();
|
|
1137
|
+
const freeGroupIdMax = this.readUInt16();
|
|
1138
|
+
|
|
1139
|
+
return {
|
|
1140
|
+
nodeId,
|
|
1141
|
+
freeNodeIdMin,
|
|
1142
|
+
freeNodeIdMax,
|
|
1143
|
+
groupIdMin,
|
|
1144
|
+
groupIdMax,
|
|
1145
|
+
freeGroupIdMin,
|
|
1146
|
+
freeGroupIdMax,
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
public writeEmberBeaconIterator(value: EmberBeaconIterator): void {
|
|
1151
|
+
this.writeUInt8(value.beacon.channel);
|
|
1152
|
+
this.writeUInt8(value.beacon.lqi);
|
|
1153
|
+
this.writeUInt8(value.beacon.rssi);
|
|
1154
|
+
this.writeUInt8(value.beacon.depth);
|
|
1155
|
+
this.writeUInt8(value.beacon.nwkUpdateId);
|
|
1156
|
+
this.writeUInt8(value.beacon.power);
|
|
1157
|
+
this.writeUInt8(value.beacon.parentPriority);
|
|
1158
|
+
this.writeUInt8(value.beacon.enhanced ? 1 : 0);
|
|
1159
|
+
this.writeUInt8(value.beacon.permitJoin ? 1 : 0);
|
|
1160
|
+
this.writeUInt8(value.beacon.hasCapacity ? 1 : 0);
|
|
1161
|
+
this.writeUInt16(value.beacon.panId);
|
|
1162
|
+
this.writeUInt16(value.beacon.sender);
|
|
1163
|
+
this.writeListUInt8(value.beacon.extendedPanId);
|
|
1164
|
+
this.writeUInt8(value.index);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
public readEmberBeaconIterator(): EmberBeaconIterator {
|
|
1168
|
+
const channel = this.readUInt8();
|
|
1169
|
+
const lqi = this.readUInt8();
|
|
1170
|
+
const rssi = this.readUInt8();
|
|
1171
|
+
const depth = this.readUInt8();
|
|
1172
|
+
const nwkUpdateId = this.readUInt8();
|
|
1173
|
+
const power = this.readUInt8();
|
|
1174
|
+
const parentPriority = this.readUInt8();
|
|
1175
|
+
const enhanced = this.readUInt8() !== 0;
|
|
1176
|
+
const permitJoin = this.readUInt8() !== 0;
|
|
1177
|
+
const hasCapacity = this.readUInt8() !== 0;
|
|
1178
|
+
const panId = this.readUInt16();
|
|
1179
|
+
const sender = this.readUInt16();
|
|
1180
|
+
const extendedPanId = this.readListUInt8(EXTENDED_PAN_ID_SIZE);
|
|
1181
|
+
const index = this.readUInt8();
|
|
1182
|
+
|
|
1183
|
+
return {
|
|
1184
|
+
beacon: {
|
|
1185
|
+
channel,
|
|
1186
|
+
lqi,
|
|
1187
|
+
rssi,
|
|
1188
|
+
depth,
|
|
1189
|
+
nwkUpdateId,
|
|
1190
|
+
power,
|
|
1191
|
+
parentPriority,
|
|
1192
|
+
enhanced,
|
|
1193
|
+
permitJoin,
|
|
1194
|
+
hasCapacity,
|
|
1195
|
+
panId,
|
|
1196
|
+
sender,
|
|
1197
|
+
extendedPanId,
|
|
1198
|
+
supportedKeyNegotiationMethods: 0,
|
|
1199
|
+
extendedBeacon: false,
|
|
1200
|
+
tcConnectivity: true,
|
|
1201
|
+
longUptime: true,
|
|
1202
|
+
preferParent: true,
|
|
1203
|
+
macDataPollKeepalive: true,
|
|
1204
|
+
endDeviceKeepalive: true,
|
|
1205
|
+
},
|
|
1206
|
+
index,
|
|
1207
|
+
};
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
public writeEmberBeaconData(value: EmberBeaconData): void {
|
|
1211
|
+
this.writeUInt8(value.channel);
|
|
1212
|
+
this.writeUInt8(value.lqi);
|
|
1213
|
+
this.writeUInt8(value.rssi);
|
|
1214
|
+
this.writeUInt8(value.depth);
|
|
1215
|
+
this.writeUInt8(value.nwkUpdateId);
|
|
1216
|
+
this.writeUInt8(value.power);
|
|
1217
|
+
this.writeUInt8(value.parentPriority);
|
|
1218
|
+
this.writeUInt8(value.enhanced ? 1 : 0);
|
|
1219
|
+
this.writeUInt8(value.permitJoin ? 1 : 0);
|
|
1220
|
+
this.writeUInt8(value.hasCapacity ? 1 : 0);
|
|
1221
|
+
this.writeUInt16(value.panId);
|
|
1222
|
+
this.writeUInt16(value.sender);
|
|
1223
|
+
this.writeListUInt8(value.extendedPanId);
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
public readEmberBeaconData(): EmberBeaconData {
|
|
1227
|
+
const channel = this.readUInt8();
|
|
1228
|
+
const lqi = this.readUInt8();
|
|
1229
|
+
const rssi = this.readUInt8();
|
|
1230
|
+
const depth = this.readUInt8();
|
|
1231
|
+
const nwkUpdateId = this.readUInt8();
|
|
1232
|
+
const power = this.readUInt8();
|
|
1233
|
+
const parentPriority = this.readUInt8();
|
|
1234
|
+
const enhanced = this.readUInt8() !== 0;
|
|
1235
|
+
const permitJoin = this.readUInt8() !== 0;
|
|
1236
|
+
const hasCapacity = this.readUInt8() !== 0;
|
|
1237
|
+
const panId = this.readUInt16();
|
|
1238
|
+
const sender = this.readUInt16();
|
|
1239
|
+
const extendedPanId = this.readListUInt8(EXTENDED_PAN_ID_SIZE);
|
|
1240
|
+
|
|
1241
|
+
return {
|
|
1242
|
+
channel,
|
|
1243
|
+
lqi,
|
|
1244
|
+
rssi,
|
|
1245
|
+
depth,
|
|
1246
|
+
nwkUpdateId,
|
|
1247
|
+
power,
|
|
1248
|
+
parentPriority,
|
|
1249
|
+
enhanced,
|
|
1250
|
+
permitJoin,
|
|
1251
|
+
hasCapacity,
|
|
1252
|
+
panId,
|
|
1253
|
+
sender,
|
|
1254
|
+
extendedPanId,
|
|
1255
|
+
supportedKeyNegotiationMethods: 0,
|
|
1256
|
+
extendedBeacon: false,
|
|
1257
|
+
tcConnectivity: true,
|
|
1258
|
+
longUptime: true,
|
|
1259
|
+
preferParent: true,
|
|
1260
|
+
macDataPollKeepalive: true,
|
|
1261
|
+
endDeviceKeepalive: true,
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
public writeEmberTokenData(tokenData: EmberTokenData): void {
|
|
1266
|
+
this.writeUInt32(tokenData.size);
|
|
1267
|
+
this.writeBuffer(tokenData.data, tokenData.size);
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
public readEmberTokenData(): EmberTokenData {
|
|
1271
|
+
const size = this.readUInt32();
|
|
1272
|
+
const data = this.readBufferCopy(size);
|
|
1273
|
+
|
|
1274
|
+
return {size, data};
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
public readEmberTokenInfo(): EmberTokenInfo {
|
|
1278
|
+
const nvm3Key = this.readUInt32();
|
|
1279
|
+
const isCnt = this.readUInt8() !== 0;
|
|
1280
|
+
const isIdx = this.readUInt8() !== 0;
|
|
1281
|
+
const size = this.readUInt8();
|
|
1282
|
+
const arraySize = this.readUInt8();
|
|
1283
|
+
|
|
1284
|
+
return {
|
|
1285
|
+
nvm3Key,
|
|
1286
|
+
isCnt,
|
|
1287
|
+
isIdx,
|
|
1288
|
+
size,
|
|
1289
|
+
arraySize,
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
public writeEmberTokenInfo(tokenInfo: EmberTokenInfo): void {
|
|
1294
|
+
this.writeUInt32(tokenInfo.nvm3Key);
|
|
1295
|
+
this.writeUInt8(tokenInfo.isCnt ? 1 : 0);
|
|
1296
|
+
this.writeUInt8(tokenInfo.isIdx ? 1 : 0);
|
|
1297
|
+
this.writeUInt8(tokenInfo.size);
|
|
1298
|
+
this.writeUInt8(tokenInfo.arraySize);
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* EZSP switched to using SLStatus for command returns from version 14.
|
|
1303
|
+
* @param version EZSP protocol version in use
|
|
1304
|
+
* @param mapFromEmber If true, map from EmberStatus, otherwise map from EzspStatus
|
|
1305
|
+
* @returns EzspStatus, EmberStatus or SLStatus as SLStatus
|
|
1306
|
+
*/
|
|
1307
|
+
public readStatus(version: number, mapFromEmber = true): SLStatus {
|
|
1308
|
+
if (version < 0x0e) {
|
|
1309
|
+
const status = this.readUInt8();
|
|
1310
|
+
|
|
1311
|
+
// skip lookup if SUCCESS (always zero)
|
|
1312
|
+
if (status === SLStatus.OK) {
|
|
1313
|
+
return status;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
if (mapFromEmber) {
|
|
1317
|
+
// use mapped value, or pass as-is if none found
|
|
1318
|
+
return EMBER_TO_SL_STATUS_MAP.get(status) ?? status;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
// EzspStatus mapping to SLStatus is always same code
|
|
1322
|
+
return SLStatus.ZIGBEE_EZSP_ERROR;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
return this.readUInt32();
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
public readEmberEndpointDescription(): EmberEndpointDescription {
|
|
1329
|
+
const profileId = this.readUInt16();
|
|
1330
|
+
const deviceId = this.readUInt16();
|
|
1331
|
+
const deviceVersion = this.readUInt8();
|
|
1332
|
+
const inputClusterCount = this.readUInt8();
|
|
1333
|
+
const outputClusterCount = this.readUInt8();
|
|
1334
|
+
|
|
1335
|
+
return {
|
|
1336
|
+
profileId,
|
|
1337
|
+
deviceId,
|
|
1338
|
+
deviceVersion,
|
|
1339
|
+
inputClusterCount,
|
|
1340
|
+
outputClusterCount,
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
/** @deprecated removed in EZSP v16 in favor of @see readEmber802154RadioPriorities */
|
|
1345
|
+
public readEmberMultiprotocolPriorities(): EmberMultiprotocolPriorities {
|
|
1346
|
+
const backgroundRx = this.readUInt8();
|
|
1347
|
+
const tx = this.readUInt8();
|
|
1348
|
+
const activeRx = this.readUInt8();
|
|
1349
|
+
|
|
1350
|
+
return {backgroundRx, tx, activeRx};
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
/** @deprecated removed in EZSP v16 in favor of @see writeEmber802154RadioPriorities */
|
|
1354
|
+
public writeEmberMultiprotocolPriorities(priorities: EmberMultiprotocolPriorities): void {
|
|
1355
|
+
this.writeUInt8(priorities.backgroundRx);
|
|
1356
|
+
this.writeUInt8(priorities.tx);
|
|
1357
|
+
this.writeUInt8(priorities.activeRx);
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
public readEmber802154RadioPriorities(): Ember802154RadioPriorities {
|
|
1361
|
+
const backgroundRx = this.readUInt8();
|
|
1362
|
+
const minTxPriority = this.readUInt8();
|
|
1363
|
+
const txStep = this.readUInt8();
|
|
1364
|
+
const maxTxPriority = this.readUInt8();
|
|
1365
|
+
const activeRx = this.readUInt8();
|
|
1366
|
+
|
|
1367
|
+
return {backgroundRx, minTxPriority, txStep, maxTxPriority, activeRx};
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
public writeEmber802154RadioPriorities(priorities: Ember802154RadioPriorities): void {
|
|
1371
|
+
this.writeUInt8(priorities.backgroundRx);
|
|
1372
|
+
this.writeUInt8(priorities.minTxPriority);
|
|
1373
|
+
this.writeUInt8(priorities.txStep);
|
|
1374
|
+
this.writeUInt8(priorities.maxTxPriority);
|
|
1375
|
+
this.writeUInt8(priorities.activeRx);
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
public readEmberRxPacketInfo(): EmberRxPacketInfo {
|
|
1379
|
+
const senderShortId = this.readUInt16();
|
|
1380
|
+
const senderLongId = this.readIeeeAddr();
|
|
1381
|
+
const bindingIndex = this.readUInt8();
|
|
1382
|
+
const addressIndex = this.readUInt8();
|
|
1383
|
+
const lastHopLqi = this.readUInt8();
|
|
1384
|
+
const lastHopRssi = this.readInt8(); // SDK: (int8_t)fetchInt8u();
|
|
1385
|
+
const lastHopTimestamp = this.readUInt32();
|
|
1386
|
+
|
|
1387
|
+
return {
|
|
1388
|
+
senderShortId,
|
|
1389
|
+
senderLongId,
|
|
1390
|
+
bindingIndex,
|
|
1391
|
+
addressIndex,
|
|
1392
|
+
lastHopLqi,
|
|
1393
|
+
lastHopRssi,
|
|
1394
|
+
lastHopTimestamp,
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
}
|