@willieee802/zigbee-herdsman 0.48.3 → 0.49.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/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/copilot-instructions.md +689 -0
- package/.github/dependabot.yml +22 -0
- package/.github/prompts/copilot-instructions-blueprint-generator.prompt.md +294 -0
- package/.github/prompts/create-agentsmd.prompt.md +249 -0
- package/.github/prompts/create-specification.prompt.md +127 -0
- package/.github/prompts/review-and-refactor.prompt.md +15 -0
- package/.github/prompts/update-specification.prompt.md +127 -0
- package/.github/workflows/ci.yml +70 -0
- package/.github/workflows/release-please.yml +18 -0
- package/.github/workflows/stale.yml +20 -0
- package/.github/workflows/typedoc.yaml +47 -0
- package/.release-please-manifest.json +2 -2
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +11 -0
- package/AGENTS.md +441 -0
- package/CHANGELOG.md +1245 -0
- package/README.md +1 -1
- package/biome.json +103 -0
- package/examples/join-and-log.js +18 -18
- package/package.json +83 -70
- package/release-please-config.json +8 -8
- package/scripts/check-clusters-changes.ts +328 -0
- package/scripts/clusters-changes.log +584 -0
- package/scripts/clusters-typegen.ts +608 -0
- package/scripts/utils.ts +88 -0
- package/scripts/zap-update-clusters-report.json +303 -0
- package/scripts/zap-update-clusters.ts +1520 -0
- package/scripts/zap-update-types.ts +707 -0
- package/scripts/zap-xml-clusters-overrides-data.ts +52 -0
- package/scripts/zap-xml-clusters-overrides.ts +400 -0
- package/scripts/zap-xml-types.ts +146 -0
- package/src/adapter/adapter.ts +210 -0
- package/src/adapter/adapterDiscovery.ts +736 -0
- package/src/adapter/const.ts +12 -0
- package/src/adapter/deconz/adapter/deconzAdapter.ts +888 -0
- package/src/adapter/deconz/driver/constants.ts +246 -0
- package/src/adapter/deconz/driver/driver.ts +1528 -0
- package/src/adapter/deconz/driver/frame.ts +11 -0
- package/src/adapter/deconz/driver/frameParser.ts +766 -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 +2262 -0
- package/src/adapter/ember/adapter/endpoints.ts +86 -0
- package/src/adapter/ember/adapter/oneWaitress.ts +324 -0
- package/src/adapter/ember/adapter/tokensManager.ts +780 -0
- package/src/adapter/ember/consts.ts +178 -0
- package/src/adapter/ember/enums.ts +1746 -0
- package/src/adapter/ember/ezsp/buffalo.ts +1392 -0
- package/src/adapter/ember/ezsp/consts.ts +148 -0
- package/src/adapter/ember/ezsp/enums.ts +1114 -0
- package/src/adapter/ember/ezsp/ezsp.ts +9073 -0
- package/src/adapter/ember/ezspError.ts +10 -0
- package/src/adapter/ember/types.ts +866 -0
- package/src/adapter/ember/uart/ash.ts +1933 -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 +42 -0
- package/src/adapter/ember/uart/queues.ts +247 -0
- package/src/adapter/ember/uart/writer.ts +50 -0
- package/src/adapter/ember/utils/initters.ts +58 -0
- package/src/adapter/ember/utils/math.ts +71 -0
- package/src/adapter/events.ts +21 -0
- package/src/adapter/ezsp/adapter/backup.ts +100 -0
- package/src/adapter/ezsp/adapter/ezspAdapter.ts +632 -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/tstype.ts +57 -0
- package/src/adapter/utils.ts +41 -0
- package/src/adapter/z-stack/adapter/adapter-backup.ts +509 -0
- package/src/adapter/z-stack/adapter/adapter-nv-memory.ts +457 -0
- package/src/adapter/z-stack/adapter/endpoints.ts +60 -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 +1350 -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 +67 -0
- package/src/adapter/z-stack/unpi/writer.ts +37 -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 +345 -0
- package/src/adapter/z-stack/znp/zpiObject.ts +148 -0
- package/src/adapter/zboss/adapter/zbossAdapter.ts +535 -0
- package/src/adapter/zboss/commands.ts +1184 -0
- package/src/adapter/zboss/consts.ts +9 -0
- package/src/adapter/zboss/driver.ts +422 -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 +25 -0
- package/src/adapter/zigate/adapter/zigateAdapter.ts +633 -0
- package/src/adapter/zigate/driver/LICENSE +17 -0
- package/src/adapter/zigate/driver/buffaloZiGate.ts +210 -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 +422 -0
- package/src/adapter/zoh/adapter/utils.ts +27 -0
- package/src/adapter/zoh/adapter/zohAdapter.ts +931 -0
- package/src/buffalo/buffalo.ts +336 -0
- package/src/buffalo/index.ts +1 -0
- package/src/controller/controller.ts +1159 -0
- package/src/controller/database.ts +148 -0
- package/src/controller/events.ts +52 -0
- package/src/controller/greenPower.ts +613 -0
- package/src/controller/helpers/index.ts +1 -0
- package/src/controller/helpers/installCodes.ts +107 -0
- package/src/controller/helpers/ota.ts +575 -0
- package/src/controller/helpers/request.ts +96 -0
- package/src/controller/helpers/requestQueue.ts +126 -0
- package/src/controller/helpers/zclFrameConverter.ts +64 -0
- package/src/controller/helpers/zclTransactionSequenceNumber.ts +15 -0
- package/src/controller/index.ts +6 -0
- package/src/controller/model/device.ts +1791 -0
- package/src/controller/model/endpoint.ts +1235 -0
- package/src/controller/model/entity.ts +43 -0
- package/src/controller/model/group.ts +446 -0
- package/src/controller/model/index.ts +5 -0
- package/src/controller/model/konnextConfig.ts +6 -0
- package/src/controller/model/zigbeeEntity.ts +30 -0
- package/src/controller/touchlink.ts +195 -0
- package/src/controller/tstype.ts +374 -0
- package/src/index.ts +14 -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/aes.ts +218 -0
- package/src/utils/async-mutex.ts +31 -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 +79 -0
- package/src/utils/timeService.ts +139 -0
- package/src/utils/utils.ts +19 -0
- package/src/utils/wait.ts +5 -0
- package/src/utils/waitress.ts +96 -0
- package/src/zspec/consts.ts +89 -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 +247 -0
- package/src/zspec/zcl/buffaloZcl.ts +1073 -0
- package/src/zspec/zcl/definition/cluster.ts +7845 -0
- package/src/zspec/zcl/definition/clusters-types.ts +8577 -0
- package/src/zspec/zcl/definition/consts.ts +24 -0
- package/src/zspec/zcl/definition/datatypes.ts +2454 -0
- package/src/zspec/zcl/definition/enums.ts +224 -0
- package/src/zspec/zcl/definition/foundation.ts +342 -0
- package/src/zspec/zcl/definition/manufacturerCode.ts +730 -0
- package/src/zspec/zcl/definition/status.ts +69 -0
- package/src/zspec/zcl/definition/tstype.ts +446 -0
- package/src/zspec/zcl/index.ts +11 -0
- package/src/zspec/zcl/utils.ts +521 -0
- package/src/zspec/zcl/zclFrame.ts +383 -0
- package/src/zspec/zcl/zclHeader.ts +102 -0
- package/src/zspec/zcl/zclStatusError.ts +10 -0
- package/src/zspec/zdo/buffaloZdo.ts +2336 -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 +1276 -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 +3447 -0
- package/test/adapter/ember/ezsp.test.ts +389 -0
- package/test/adapter/ember/ezspBuffalo.test.ts +93 -0
- package/test/adapter/ember/ezspError.test.ts +12 -0
- package/test/adapter/ember/math.test.ts +190 -0
- package/test/adapter/ezsp/frame.test.ts +30 -0
- package/test/adapter/ezsp/uart.test.ts +181 -0
- package/test/adapter/z-stack/adapter.test.ts +4260 -0
- package/test/adapter/z-stack/constants.test.ts +33 -0
- package/test/adapter/z-stack/structs.test.ts +115 -0
- package/test/adapter/z-stack/unpi.test.ts +213 -0
- package/test/adapter/z-stack/znp.test.ts +1288 -0
- package/test/adapter/zboss/fixZdoResponse.test.ts +179 -0
- package/test/adapter/zigate/patchZdoBuffaloBE.test.ts +81 -0
- package/test/adapter/zigate/zdo.test.ts +187 -0
- package/test/adapter/zoh/utils.test.ts +36 -0
- package/test/adapter/zoh/zohAdapter.test.ts +1451 -0
- package/test/benchOptions.ts +14 -0
- package/test/buffalo.test.ts +431 -0
- package/test/controller.bench.ts +215 -0
- package/test/controller.test.ts +10030 -0
- package/test/data/integrity-code-1166-012B-24031511-upgradeMe-RB 249 T.zigbee +0 -0
- package/test/data/manuf-tags-tradfri-cv-cct-unified_release_prod_v587757105_33e34452-9267-4665-bc5a-844c8f61f063.ota +0 -0
- package/test/data/padded-tretakt_smart_plug_soc-0x1100-2.4.25-prod.ota.ota.signed +0 -0
- package/test/data/telink-aes-A60_RGBW_T-0x00B6-0x03483712-MF_DIS.OTA +0 -0
- package/test/data/zbminir2_v1.0.8.ota +0 -0
- package/test/device-ota.test.ts +3332 -0
- package/test/greenpower.test.ts +1409 -0
- package/test/mockAdapters.ts +95 -0
- package/test/mockDevices.ts +623 -0
- package/test/requests.bench.ts +321 -0
- package/test/testUtils.ts +20 -0
- package/test/timeService.test.ts +214 -0
- package/test/tsconfig.json +9 -0
- package/test/utils/math.ts +19 -0
- package/test/utils.test.ts +352 -0
- package/test/vitest.config.mts +28 -0
- package/test/vitest.ts +9 -0
- package/test/zcl.test.ts +2858 -0
- package/test/zspec/utils.test.ts +68 -0
- package/test/zspec/zcl/buffalo.test.ts +1316 -0
- package/test/zspec/zcl/frame.test.ts +1056 -0
- package/test/zspec/zcl/utils.test.ts +650 -0
- package/test/zspec/zdo/buffalo.test.ts +1850 -0
- package/test/zspec/zdo/utils.test.ts +241 -0
- package/tsconfig.json +8 -10
- package/.babelrc.js +0 -6
- package/.eslintignore +0 -3
- package/dist/adapter/adapter.d.ts +0 -64
- package/dist/adapter/adapter.d.ts.map +0 -1
- package/dist/adapter/adapter.js +0 -157
- package/dist/adapter/adapter.js.map +0 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts +0 -71
- package/dist/adapter/deconz/adapter/deconzAdapter.d.ts.map +0 -1
- package/dist/adapter/deconz/adapter/deconzAdapter.js +0 -1072
- package/dist/adapter/deconz/adapter/deconzAdapter.js.map +0 -1
- package/dist/adapter/deconz/adapter/index.d.ts +0 -3
- package/dist/adapter/deconz/adapter/index.d.ts.map +0 -1
- package/dist/adapter/deconz/adapter/index.js +0 -11
- package/dist/adapter/deconz/adapter/index.js.map +0 -1
- package/dist/adapter/deconz/driver/constants.d.ts +0 -105
- package/dist/adapter/deconz/driver/constants.d.ts.map +0 -1
- package/dist/adapter/deconz/driver/constants.js +0 -56
- package/dist/adapter/deconz/driver/constants.js.map +0 -1
- package/dist/adapter/deconz/driver/driver.d.ts +0 -82
- package/dist/adapter/deconz/driver/driver.d.ts.map +0 -1
- package/dist/adapter/deconz/driver/driver.js +0 -751
- package/dist/adapter/deconz/driver/driver.js.map +0 -1
- package/dist/adapter/deconz/driver/frame.d.ts +0 -7
- package/dist/adapter/deconz/driver/frame.d.ts.map +0 -1
- package/dist/adapter/deconz/driver/frame.js +0 -14
- package/dist/adapter/deconz/driver/frame.js.map +0 -1
- package/dist/adapter/deconz/driver/frameParser.d.ts +0 -3
- package/dist/adapter/deconz/driver/frameParser.d.ts.map +0 -1
- package/dist/adapter/deconz/driver/frameParser.js +0 -444
- package/dist/adapter/deconz/driver/frameParser.js.map +0 -1
- package/dist/adapter/deconz/driver/parser.d.ts +0 -13
- package/dist/adapter/deconz/driver/parser.d.ts.map +0 -1
- package/dist/adapter/deconz/driver/parser.js +0 -64
- package/dist/adapter/deconz/driver/parser.js.map +0 -1
- package/dist/adapter/deconz/driver/writer.d.ts +0 -9
- package/dist/adapter/deconz/driver/writer.d.ts.map +0 -1
- package/dist/adapter/deconz/driver/writer.js +0 -45
- package/dist/adapter/deconz/driver/writer.js.map +0 -1
- package/dist/adapter/ember/adapter/emberAdapter.d.ts +0 -806
- package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +0 -1
- package/dist/adapter/ember/adapter/emberAdapter.js +0 -2942
- package/dist/adapter/ember/adapter/emberAdapter.js.map +0 -1
- package/dist/adapter/ember/adapter/endpoints.d.ts +0 -27
- package/dist/adapter/ember/adapter/endpoints.d.ts.map +0 -1
- package/dist/adapter/ember/adapter/endpoints.js +0 -68
- package/dist/adapter/ember/adapter/endpoints.js.map +0 -1
- package/dist/adapter/ember/adapter/index.d.ts +0 -3
- package/dist/adapter/ember/adapter/index.d.ts.map +0 -1
- package/dist/adapter/ember/adapter/index.js +0 -6
- package/dist/adapter/ember/adapter/index.js.map +0 -1
- package/dist/adapter/ember/adapter/oneWaitress.d.ts +0 -108
- package/dist/adapter/ember/adapter/oneWaitress.d.ts.map +0 -1
- package/dist/adapter/ember/adapter/oneWaitress.js +0 -241
- package/dist/adapter/ember/adapter/oneWaitress.js.map +0 -1
- package/dist/adapter/ember/adapter/requestQueue.d.ts +0 -57
- package/dist/adapter/ember/adapter/requestQueue.d.ts.map +0 -1
- package/dist/adapter/ember/adapter/requestQueue.js +0 -139
- package/dist/adapter/ember/adapter/requestQueue.js.map +0 -1
- package/dist/adapter/ember/adapter/tokensManager.d.ts +0 -69
- package/dist/adapter/ember/adapter/tokensManager.d.ts.map +0 -1
- package/dist/adapter/ember/adapter/tokensManager.js +0 -688
- package/dist/adapter/ember/adapter/tokensManager.js.map +0 -1
- package/dist/adapter/ember/consts.d.ts +0 -191
- package/dist/adapter/ember/consts.d.ts.map +0 -1
- package/dist/adapter/ember/consts.js +0 -246
- package/dist/adapter/ember/consts.js.map +0 -1
- package/dist/adapter/ember/enums.d.ts +0 -2172
- package/dist/adapter/ember/enums.d.ts.map +0 -1
- package/dist/adapter/ember/enums.js +0 -2375
- package/dist/adapter/ember/enums.js.map +0 -1
- package/dist/adapter/ember/ezsp/buffalo.d.ts +0 -156
- package/dist/adapter/ember/ezsp/buffalo.d.ts.map +0 -1
- package/dist/adapter/ember/ezsp/buffalo.js +0 -1033
- package/dist/adapter/ember/ezsp/buffalo.js.map +0 -1
- package/dist/adapter/ember/ezsp/consts.d.ts +0 -116
- package/dist/adapter/ember/ezsp/consts.d.ts.map +0 -1
- package/dist/adapter/ember/ezsp/consts.js +0 -128
- package/dist/adapter/ember/ezsp/consts.js.map +0 -1
- package/dist/adapter/ember/ezsp/enums.d.ts +0 -879
- package/dist/adapter/ember/ezsp/enums.d.ts.map +0 -1
- package/dist/adapter/ember/ezsp/enums.js +0 -948
- package/dist/adapter/ember/ezsp/enums.js.map +0 -1
- package/dist/adapter/ember/ezsp/ezsp.d.ts +0 -2662
- package/dist/adapter/ember/ezsp/ezsp.d.ts.map +0 -1
- package/dist/adapter/ember/ezsp/ezsp.js +0 -6454
- package/dist/adapter/ember/ezsp/ezsp.js.map +0 -1
- package/dist/adapter/ember/types.d.ts +0 -733
- package/dist/adapter/ember/types.d.ts.map +0 -1
- package/dist/adapter/ember/types.js +0 -3
- package/dist/adapter/ember/types.js.map +0 -1
- package/dist/adapter/ember/uart/ash.d.ts +0 -464
- package/dist/adapter/ember/uart/ash.d.ts.map +0 -1
- package/dist/adapter/ember/uart/ash.js +0 -1633
- package/dist/adapter/ember/uart/ash.js.map +0 -1
- package/dist/adapter/ember/uart/consts.d.ts +0 -91
- package/dist/adapter/ember/uart/consts.d.ts.map +0 -1
- package/dist/adapter/ember/uart/consts.js +0 -100
- package/dist/adapter/ember/uart/consts.js.map +0 -1
- package/dist/adapter/ember/uart/enums.d.ts +0 -191
- package/dist/adapter/ember/uart/enums.d.ts.map +0 -1
- package/dist/adapter/ember/uart/enums.js +0 -197
- package/dist/adapter/ember/uart/enums.js.map +0 -1
- package/dist/adapter/ember/uart/parser.d.ts +0 -10
- package/dist/adapter/ember/uart/parser.d.ts.map +0 -1
- package/dist/adapter/ember/uart/parser.js +0 -37
- package/dist/adapter/ember/uart/parser.js.map +0 -1
- package/dist/adapter/ember/uart/queues.d.ts +0 -85
- package/dist/adapter/ember/uart/queues.d.ts.map +0 -1
- package/dist/adapter/ember/uart/queues.js +0 -214
- package/dist/adapter/ember/uart/queues.js.map +0 -1
- package/dist/adapter/ember/uart/writer.d.ts +0 -15
- package/dist/adapter/ember/uart/writer.d.ts.map +0 -1
- package/dist/adapter/ember/uart/writer.js +0 -46
- package/dist/adapter/ember/uart/writer.js.map +0 -1
- package/dist/adapter/ember/utils/initters.d.ts +0 -20
- package/dist/adapter/ember/utils/initters.d.ts.map +0 -1
- package/dist/adapter/ember/utils/initters.js +0 -58
- package/dist/adapter/ember/utils/initters.js.map +0 -1
- package/dist/adapter/ember/utils/math.d.ts +0 -51
- package/dist/adapter/ember/utils/math.d.ts.map +0 -1
- package/dist/adapter/ember/utils/math.js +0 -102
- package/dist/adapter/ember/utils/math.js.map +0 -1
- package/dist/adapter/ember/zdo.d.ts +0 -925
- package/dist/adapter/ember/zdo.d.ts.map +0 -1
- package/dist/adapter/ember/zdo.js +0 -723
- package/dist/adapter/ember/zdo.js.map +0 -1
- package/dist/adapter/events.d.ts +0 -42
- package/dist/adapter/events.d.ts.map +0 -1
- package/dist/adapter/events.js +0 -13
- package/dist/adapter/events.js.map +0 -1
- package/dist/adapter/ezsp/adapter/backup.d.ts +0 -13
- package/dist/adapter/ezsp/adapter/backup.d.ts.map +0 -1
- package/dist/adapter/ezsp/adapter/backup.js +0 -101
- package/dist/adapter/ezsp/adapter/backup.js.map +0 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts +0 -65
- package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +0 -1
- package/dist/adapter/ezsp/adapter/ezspAdapter.js +0 -634
- package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +0 -1
- package/dist/adapter/ezsp/adapter/index.d.ts +0 -3
- package/dist/adapter/ezsp/adapter/index.d.ts.map +0 -1
- package/dist/adapter/ezsp/adapter/index.js +0 -11
- package/dist/adapter/ezsp/adapter/index.js.map +0 -1
- package/dist/adapter/ezsp/driver/commands.d.ts +0 -37
- package/dist/adapter/ezsp/driver/commands.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/commands.js +0 -2387
- package/dist/adapter/ezsp/driver/commands.js.map +0 -1
- package/dist/adapter/ezsp/driver/consts.d.ts +0 -11
- package/dist/adapter/ezsp/driver/consts.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/consts.js +0 -14
- package/dist/adapter/ezsp/driver/consts.js.map +0 -1
- package/dist/adapter/ezsp/driver/driver.d.ts +0 -109
- package/dist/adapter/ezsp/driver/driver.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/driver.js +0 -796
- package/dist/adapter/ezsp/driver/driver.js.map +0 -1
- package/dist/adapter/ezsp/driver/ezsp.d.ts +0 -106
- package/dist/adapter/ezsp/driver/ezsp.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/ezsp.js +0 -664
- package/dist/adapter/ezsp/driver/ezsp.js.map +0 -1
- package/dist/adapter/ezsp/driver/frame.d.ts +0 -40
- package/dist/adapter/ezsp/driver/frame.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/frame.js +0 -101
- package/dist/adapter/ezsp/driver/frame.js.map +0 -1
- package/dist/adapter/ezsp/driver/index.d.ts +0 -4
- package/dist/adapter/ezsp/driver/index.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/index.js +0 -9
- package/dist/adapter/ezsp/driver/index.js.map +0 -1
- package/dist/adapter/ezsp/driver/multicast.d.ts +0 -13
- package/dist/adapter/ezsp/driver/multicast.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/multicast.js +0 -74
- package/dist/adapter/ezsp/driver/multicast.js.map +0 -1
- package/dist/adapter/ezsp/driver/parser.d.ts +0 -12
- package/dist/adapter/ezsp/driver/parser.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/parser.js +0 -105
- package/dist/adapter/ezsp/driver/parser.js.map +0 -1
- package/dist/adapter/ezsp/driver/types/basic.d.ts +0 -63
- package/dist/adapter/ezsp/driver/types/basic.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/types/basic.js +0 -209
- package/dist/adapter/ezsp/driver/types/basic.js.map +0 -1
- package/dist/adapter/ezsp/driver/types/index.d.ts +0 -10
- package/dist/adapter/ezsp/driver/types/index.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/types/index.js +0 -139
- package/dist/adapter/ezsp/driver/types/index.js.map +0 -1
- package/dist/adapter/ezsp/driver/types/named.d.ts +0 -1288
- package/dist/adapter/ezsp/driver/types/named.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/types/named.js +0 -2330
- package/dist/adapter/ezsp/driver/types/named.js.map +0 -1
- package/dist/adapter/ezsp/driver/types/struct.d.ts +0 -271
- package/dist/adapter/ezsp/driver/types/struct.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/types/struct.js +0 -804
- package/dist/adapter/ezsp/driver/types/struct.js.map +0 -1
- package/dist/adapter/ezsp/driver/uart.d.ts +0 -49
- package/dist/adapter/ezsp/driver/uart.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/uart.js +0 -383
- package/dist/adapter/ezsp/driver/uart.js.map +0 -1
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.d.ts +0 -3
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.js +0 -56
- package/dist/adapter/ezsp/driver/utils/crc16ccitt.js.map +0 -1
- package/dist/adapter/ezsp/driver/utils/index.d.ts +0 -20
- package/dist/adapter/ezsp/driver/utils/index.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/utils/index.js +0 -73
- package/dist/adapter/ezsp/driver/utils/index.js.map +0 -1
- package/dist/adapter/ezsp/driver/writer.d.ts +0 -14
- package/dist/adapter/ezsp/driver/writer.d.ts.map +0 -1
- package/dist/adapter/ezsp/driver/writer.js +0 -83
- package/dist/adapter/ezsp/driver/writer.js.map +0 -1
- package/dist/adapter/index.d.ts +0 -5
- package/dist/adapter/index.d.ts.map +0 -1
- package/dist/adapter/index.js +0 -36
- package/dist/adapter/index.js.map +0 -1
- package/dist/adapter/serialPort.d.ts +0 -14
- package/dist/adapter/serialPort.d.ts.map +0 -1
- package/dist/adapter/serialPort.js +0 -47
- package/dist/adapter/serialPort.js.map +0 -1
- package/dist/adapter/serialPortUtils.d.ts +0 -13
- package/dist/adapter/serialPortUtils.d.ts.map +0 -1
- package/dist/adapter/serialPortUtils.js +0 -19
- package/dist/adapter/serialPortUtils.js.map +0 -1
- package/dist/adapter/socketPortUtils.d.ts +0 -11
- package/dist/adapter/socketPortUtils.d.ts.map +0 -1
- package/dist/adapter/socketPortUtils.js +0 -17
- package/dist/adapter/socketPortUtils.js.map +0 -1
- package/dist/adapter/tstype.d.ts +0 -86
- package/dist/adapter/tstype.d.ts.map +0 -1
- package/dist/adapter/tstype.js +0 -3
- package/dist/adapter/tstype.js.map +0 -1
- package/dist/adapter/z-stack/adapter/adapter-backup.d.ts +0 -62
- package/dist/adapter/z-stack/adapter/adapter-backup.d.ts.map +0 -1
- package/dist/adapter/z-stack/adapter/adapter-backup.js +0 -459
- package/dist/adapter/z-stack/adapter/adapter-backup.js.map +0 -1
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.d.ts +0 -151
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.d.ts.map +0 -1
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.js +0 -259
- package/dist/adapter/z-stack/adapter/adapter-nv-memory.js.map +0 -1
- package/dist/adapter/z-stack/adapter/endpoints.d.ts +0 -12
- package/dist/adapter/z-stack/adapter/endpoints.d.ts.map +0 -1
- package/dist/adapter/z-stack/adapter/endpoints.js +0 -74
- package/dist/adapter/z-stack/adapter/endpoints.js.map +0 -1
- package/dist/adapter/z-stack/adapter/index.d.ts +0 -3
- package/dist/adapter/z-stack/adapter/index.d.ts.map +0 -1
- package/dist/adapter/z-stack/adapter/index.js +0 -9
- package/dist/adapter/z-stack/adapter/index.js.map +0 -1
- package/dist/adapter/z-stack/adapter/manager.d.ts +0 -84
- package/dist/adapter/z-stack/adapter/manager.d.ts.map +0 -1
- package/dist/adapter/z-stack/adapter/manager.js +0 -474
- package/dist/adapter/z-stack/adapter/manager.js.map +0 -1
- package/dist/adapter/z-stack/adapter/tstype.d.ts +0 -7
- package/dist/adapter/z-stack/adapter/tstype.d.ts.map +0 -1
- package/dist/adapter/z-stack/adapter/tstype.js +0 -10
- package/dist/adapter/z-stack/adapter/tstype.js.map +0 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts +0 -86
- package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts.map +0 -1
- package/dist/adapter/z-stack/adapter/zStackAdapter.js +0 -912
- package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +0 -1
- package/dist/adapter/z-stack/constants/af.d.ts +0 -24
- package/dist/adapter/z-stack/constants/af.d.ts.map +0 -1
- package/dist/adapter/z-stack/constants/af.js +0 -28
- package/dist/adapter/z-stack/constants/af.js.map +0 -1
- package/dist/adapter/z-stack/constants/common.d.ts +0 -279
- package/dist/adapter/z-stack/constants/common.d.ts.map +0 -1
- package/dist/adapter/z-stack/constants/common.js +0 -293
- package/dist/adapter/z-stack/constants/common.js.map +0 -1
- package/dist/adapter/z-stack/constants/dbg.d.ts +0 -23
- package/dist/adapter/z-stack/constants/dbg.d.ts.map +0 -1
- package/dist/adapter/z-stack/constants/dbg.js +0 -25
- package/dist/adapter/z-stack/constants/dbg.js.map +0 -1
- package/dist/adapter/z-stack/constants/index.d.ts +0 -11
- package/dist/adapter/z-stack/constants/index.d.ts.map +0 -1
- package/dist/adapter/z-stack/constants/index.js +0 -48
- package/dist/adapter/z-stack/constants/index.js.map +0 -1
- package/dist/adapter/z-stack/constants/mac.d.ts +0 -128
- package/dist/adapter/z-stack/constants/mac.d.ts.map +0 -1
- package/dist/adapter/z-stack/constants/mac.js +0 -130
- package/dist/adapter/z-stack/constants/mac.js.map +0 -1
- package/dist/adapter/z-stack/constants/sapi.d.ts +0 -25
- package/dist/adapter/z-stack/constants/sapi.d.ts.map +0 -1
- package/dist/adapter/z-stack/constants/sapi.js +0 -27
- package/dist/adapter/z-stack/constants/sapi.js.map +0 -1
- package/dist/adapter/z-stack/constants/sys.d.ts +0 -72
- package/dist/adapter/z-stack/constants/sys.d.ts.map +0 -1
- package/dist/adapter/z-stack/constants/sys.js +0 -74
- package/dist/adapter/z-stack/constants/sys.js.map +0 -1
- package/dist/adapter/z-stack/constants/util.d.ts +0 -82
- package/dist/adapter/z-stack/constants/util.d.ts.map +0 -1
- package/dist/adapter/z-stack/constants/util.js +0 -84
- package/dist/adapter/z-stack/constants/util.js.map +0 -1
- package/dist/adapter/z-stack/constants/utils.d.ts +0 -5
- package/dist/adapter/z-stack/constants/utils.d.ts.map +0 -1
- package/dist/adapter/z-stack/constants/utils.js +0 -15
- package/dist/adapter/z-stack/constants/utils.js.map +0 -1
- package/dist/adapter/z-stack/constants/zdo.d.ts +0 -103
- package/dist/adapter/z-stack/constants/zdo.d.ts.map +0 -1
- package/dist/adapter/z-stack/constants/zdo.js +0 -105
- package/dist/adapter/z-stack/constants/zdo.js.map +0 -1
- package/dist/adapter/z-stack/models/index.d.ts +0 -2
- package/dist/adapter/z-stack/models/index.d.ts.map +0 -1
- package/dist/adapter/z-stack/models/index.js +0 -18
- package/dist/adapter/z-stack/models/index.js.map +0 -1
- package/dist/adapter/z-stack/models/startup-options.d.ts +0 -13
- package/dist/adapter/z-stack/models/startup-options.d.ts.map +0 -1
- package/dist/adapter/z-stack/models/startup-options.js +0 -3
- package/dist/adapter/z-stack/models/startup-options.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.d.ts +0 -24
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.js +0 -46
- package/dist/adapter/z-stack/structs/entries/address-manager-entry.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/address-manager-table.d.ts +0 -11
- package/dist/adapter/z-stack/structs/entries/address-manager-table.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/address-manager-table.js +0 -23
- package/dist/adapter/z-stack/structs/entries/address-manager-table.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.d.ts +0 -11
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.js +0 -22
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.d.ts +0 -11
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.js +0 -24
- package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.d.ts +0 -11
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.js +0 -25
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.d.ts +0 -11
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.js +0 -24
- package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/channel-list.d.ts +0 -9
- package/dist/adapter/z-stack/structs/entries/channel-list.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/channel-list.js +0 -16
- package/dist/adapter/z-stack/structs/entries/channel-list.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/has-configured.d.ts +0 -9
- package/dist/adapter/z-stack/structs/entries/has-configured.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/has-configured.js +0 -17
- package/dist/adapter/z-stack/structs/entries/has-configured.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/index.d.ts +0 -17
- package/dist/adapter/z-stack/structs/entries/index.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/index.js +0 -33
- package/dist/adapter/z-stack/structs/entries/index.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nib.d.ts +0 -11
- package/dist/adapter/z-stack/structs/entries/nib.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nib.js +0 -69
- package/dist/adapter/z-stack/structs/entries/nib.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.d.ts +0 -11
- package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.js +0 -19
- package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nwk-key.d.ts +0 -9
- package/dist/adapter/z-stack/structs/entries/nwk-key.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nwk-key.js +0 -16
- package/dist/adapter/z-stack/structs/entries/nwk-key.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nwk-pan-id.d.ts +0 -9
- package/dist/adapter/z-stack/structs/entries/nwk-pan-id.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nwk-pan-id.js +0 -16
- package/dist/adapter/z-stack/structs/entries/nwk-pan-id.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.d.ts +0 -14
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.js +0 -24
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.d.ts +0 -11
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.js +0 -23
- package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.d.ts +0 -21
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.js +0 -37
- package/dist/adapter/z-stack/structs/entries/security-manager-entry.js.map +0 -1
- package/dist/adapter/z-stack/structs/entries/security-manager-table.d.ts +0 -11
- package/dist/adapter/z-stack/structs/entries/security-manager-table.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/entries/security-manager-table.js +0 -25
- package/dist/adapter/z-stack/structs/entries/security-manager-table.js.map +0 -1
- package/dist/adapter/z-stack/structs/index.d.ts +0 -5
- package/dist/adapter/z-stack/structs/index.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/index.js +0 -21
- package/dist/adapter/z-stack/structs/index.js.map +0 -1
- package/dist/adapter/z-stack/structs/serializable-memory-object.d.ts +0 -14
- package/dist/adapter/z-stack/structs/serializable-memory-object.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/serializable-memory-object.js +0 -3
- package/dist/adapter/z-stack/structs/serializable-memory-object.js.map +0 -1
- package/dist/adapter/z-stack/structs/struct.d.ts +0 -100
- package/dist/adapter/z-stack/structs/struct.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/struct.js +0 -297
- package/dist/adapter/z-stack/structs/struct.js.map +0 -1
- package/dist/adapter/z-stack/structs/table.d.ts +0 -95
- package/dist/adapter/z-stack/structs/table.d.ts.map +0 -1
- package/dist/adapter/z-stack/structs/table.js +0 -164
- package/dist/adapter/z-stack/structs/table.js.map +0 -1
- package/dist/adapter/z-stack/unpi/constants.d.ts +0 -29
- package/dist/adapter/z-stack/unpi/constants.d.ts.map +0 -1
- package/dist/adapter/z-stack/unpi/constants.js +0 -40
- package/dist/adapter/z-stack/unpi/constants.js.map +0 -1
- package/dist/adapter/z-stack/unpi/frame.d.ts +0 -17
- package/dist/adapter/z-stack/unpi/frame.d.ts.map +0 -1
- package/dist/adapter/z-stack/unpi/frame.js +0 -55
- package/dist/adapter/z-stack/unpi/frame.js.map +0 -1
- package/dist/adapter/z-stack/unpi/index.d.ts +0 -6
- package/dist/adapter/z-stack/unpi/index.d.ts.map +0 -1
- package/dist/adapter/z-stack/unpi/index.js +0 -38
- package/dist/adapter/z-stack/unpi/index.js.map +0 -1
- package/dist/adapter/z-stack/unpi/parser.d.ts +0 -13
- package/dist/adapter/z-stack/unpi/parser.d.ts.map +0 -1
- package/dist/adapter/z-stack/unpi/parser.js +0 -86
- package/dist/adapter/z-stack/unpi/parser.js.map +0 -1
- package/dist/adapter/z-stack/unpi/writer.d.ts +0 -12
- package/dist/adapter/z-stack/unpi/writer.d.ts.map +0 -1
- package/dist/adapter/z-stack/unpi/writer.js +0 -55
- package/dist/adapter/z-stack/unpi/writer.js.map +0 -1
- package/dist/adapter/z-stack/utils/channel-list.d.ts +0 -21
- package/dist/adapter/z-stack/utils/channel-list.d.ts.map +0 -1
- package/dist/adapter/z-stack/utils/channel-list.js +0 -41
- package/dist/adapter/z-stack/utils/channel-list.js.map +0 -1
- package/dist/adapter/z-stack/utils/index.d.ts +0 -3
- package/dist/adapter/z-stack/utils/index.d.ts.map +0 -1
- package/dist/adapter/z-stack/utils/index.js +0 -19
- package/dist/adapter/z-stack/utils/index.js.map +0 -1
- package/dist/adapter/z-stack/utils/network-options.d.ts +0 -9
- package/dist/adapter/z-stack/utils/network-options.d.ts.map +0 -1
- package/dist/adapter/z-stack/utils/network-options.js +0 -23
- package/dist/adapter/z-stack/utils/network-options.js.map +0 -1
- package/dist/adapter/z-stack/znp/buffaloZnp.d.ts +0 -14
- package/dist/adapter/z-stack/znp/buffaloZnp.d.ts.map +0 -1
- package/dist/adapter/z-stack/znp/buffaloZnp.js +0 -243
- package/dist/adapter/z-stack/znp/buffaloZnp.js.map +0 -1
- package/dist/adapter/z-stack/znp/definition.d.ts +0 -6
- package/dist/adapter/z-stack/znp/definition.d.ts.map +0 -1
- package/dist/adapter/z-stack/znp/definition.js +0 -3052
- package/dist/adapter/z-stack/znp/definition.js.map +0 -1
- package/dist/adapter/z-stack/znp/index.d.ts +0 -4
- package/dist/adapter/z-stack/znp/index.d.ts.map +0 -1
- package/dist/adapter/z-stack/znp/index.js +0 -11
- package/dist/adapter/z-stack/znp/index.js.map +0 -1
- package/dist/adapter/z-stack/znp/parameterType.d.ts +0 -23
- package/dist/adapter/z-stack/znp/parameterType.d.ts.map +0 -1
- package/dist/adapter/z-stack/znp/parameterType.js +0 -26
- package/dist/adapter/z-stack/znp/parameterType.js.map +0 -1
- package/dist/adapter/z-stack/znp/tstype.d.ts +0 -23
- package/dist/adapter/z-stack/znp/tstype.d.ts.map +0 -1
- package/dist/adapter/z-stack/znp/tstype.js +0 -3
- package/dist/adapter/z-stack/znp/tstype.js.map +0 -1
- package/dist/adapter/z-stack/znp/znp.d.ts +0 -47
- package/dist/adapter/z-stack/znp/znp.d.ts.map +0 -1
- package/dist/adapter/z-stack/znp/znp.js +0 -322
- package/dist/adapter/z-stack/znp/znp.js.map +0 -1
- package/dist/adapter/z-stack/znp/zpiObject.d.ts +0 -20
- package/dist/adapter/z-stack/znp/zpiObject.d.ts.map +0 -1
- package/dist/adapter/z-stack/znp/zpiObject.js +0 -103
- package/dist/adapter/z-stack/znp/zpiObject.js.map +0 -1
- package/dist/adapter/zigate/adapter/index.d.ts +0 -3
- package/dist/adapter/zigate/adapter/index.d.ts.map +0 -1
- package/dist/adapter/zigate/adapter/index.js +0 -11
- package/dist/adapter/zigate/adapter/index.js.map +0 -1
- package/dist/adapter/zigate/adapter/zigateAdapter.d.ts +0 -72
- package/dist/adapter/zigate/adapter/zigateAdapter.d.ts.map +0 -1
- package/dist/adapter/zigate/adapter/zigateAdapter.js +0 -681
- package/dist/adapter/zigate/adapter/zigateAdapter.js.map +0 -1
- package/dist/adapter/zigate/driver/buffaloZiGate.d.ts +0 -18
- package/dist/adapter/zigate/driver/buffaloZiGate.d.ts.map +0 -1
- package/dist/adapter/zigate/driver/buffaloZiGate.js +0 -190
- package/dist/adapter/zigate/driver/buffaloZiGate.js.map +0 -1
- package/dist/adapter/zigate/driver/commandType.d.ts +0 -43
- package/dist/adapter/zigate/driver/commandType.d.ts.map +0 -1
- package/dist/adapter/zigate/driver/commandType.js +0 -390
- package/dist/adapter/zigate/driver/commandType.js.map +0 -1
- package/dist/adapter/zigate/driver/constants.d.ts +0 -277
- package/dist/adapter/zigate/driver/constants.d.ts.map +0 -1
- package/dist/adapter/zigate/driver/constants.js +0 -372
- package/dist/adapter/zigate/driver/constants.js.map +0 -1
- package/dist/adapter/zigate/driver/frame.d.ts +0 -27
- package/dist/adapter/zigate/driver/frame.d.ts.map +0 -1
- package/dist/adapter/zigate/driver/frame.js +0 -173
- package/dist/adapter/zigate/driver/frame.js.map +0 -1
- package/dist/adapter/zigate/driver/messageType.d.ts +0 -13
- package/dist/adapter/zigate/driver/messageType.d.ts.map +0 -1
- package/dist/adapter/zigate/driver/messageType.js +0 -284
- package/dist/adapter/zigate/driver/messageType.js.map +0 -1
- package/dist/adapter/zigate/driver/parameterType.d.ts +0 -28
- package/dist/adapter/zigate/driver/parameterType.d.ts.map +0 -1
- package/dist/adapter/zigate/driver/parameterType.js +0 -33
- package/dist/adapter/zigate/driver/parameterType.js.map +0 -1
- package/dist/adapter/zigate/driver/ziGateObject.d.ts +0 -24
- package/dist/adapter/zigate/driver/ziGateObject.d.ts.map +0 -1
- package/dist/adapter/zigate/driver/ziGateObject.js +0 -111
- package/dist/adapter/zigate/driver/ziGateObject.js.map +0 -1
- package/dist/adapter/zigate/driver/zigate.d.ts +0 -50
- package/dist/adapter/zigate/driver/zigate.d.ts.map +0 -1
- package/dist/adapter/zigate/driver/zigate.js +0 -289
- package/dist/adapter/zigate/driver/zigate.js.map +0 -1
- package/dist/buffalo/buffalo.d.ts +0 -55
- package/dist/buffalo/buffalo.d.ts.map +0 -1
- package/dist/buffalo/buffalo.js +0 -230
- package/dist/buffalo/buffalo.js.map +0 -1
- package/dist/buffalo/index.d.ts +0 -3
- package/dist/buffalo/index.d.ts.map +0 -1
- package/dist/buffalo/index.js +0 -9
- package/dist/buffalo/index.js.map +0 -1
- package/dist/controller/controller.d.ts +0 -119
- package/dist/controller/controller.d.ts.map +0 -1
- package/dist/controller/controller.js +0 -700
- package/dist/controller/controller.js.map +0 -1
- package/dist/controller/database.d.ts +0 -20
- package/dist/controller/database.d.ts.map +0 -1
- package/dist/controller/database.js +0 -94
- package/dist/controller/database.js.map +0 -1
- package/dist/controller/events.d.ts +0 -59
- package/dist/controller/events.d.ts.map +0 -1
- package/dist/controller/events.js +0 -113
- package/dist/controller/events.js.map +0 -1
- package/dist/controller/greenPower.d.ts +0 -14
- package/dist/controller/greenPower.d.ts.map +0 -1
- package/dist/controller/greenPower.js +0 -216
- package/dist/controller/greenPower.js.map +0 -1
- package/dist/controller/helpers/index.d.ts +0 -3
- package/dist/controller/helpers/index.d.ts.map +0 -1
- package/dist/controller/helpers/index.js +0 -29
- package/dist/controller/helpers/index.js.map +0 -1
- package/dist/controller/helpers/request.d.ts +0 -22
- package/dist/controller/helpers/request.d.ts.map +0 -1
- package/dist/controller/helpers/request.js +0 -78
- package/dist/controller/helpers/request.js.map +0 -1
- package/dist/controller/helpers/requestQueue.d.ts +0 -13
- package/dist/controller/helpers/requestQueue.d.ts.map +0 -1
- package/dist/controller/helpers/requestQueue.js +0 -106
- package/dist/controller/helpers/requestQueue.js.map +0 -1
- package/dist/controller/helpers/zclFrameConverter.d.ts +0 -9
- package/dist/controller/helpers/zclFrameConverter.d.ts.map +0 -1
- package/dist/controller/helpers/zclFrameConverter.js +0 -70
- package/dist/controller/helpers/zclFrameConverter.js.map +0 -1
- package/dist/controller/helpers/zclTransactionSequenceNumber.d.ts +0 -6
- package/dist/controller/helpers/zclTransactionSequenceNumber.d.ts.map +0 -1
- package/dist/controller/helpers/zclTransactionSequenceNumber.js +0 -14
- package/dist/controller/helpers/zclTransactionSequenceNumber.js.map +0 -1
- package/dist/controller/index.d.ts +0 -6
- package/dist/controller/index.d.ts.map +0 -1
- package/dist/controller/index.js +0 -9
- package/dist/controller/index.js.map +0 -1
- package/dist/controller/model/device.d.ts +0 -140
- package/dist/controller/model/device.d.ts.map +0 -1
- package/dist/controller/model/device.js +0 -746
- package/dist/controller/model/device.js.map +0 -1
- package/dist/controller/model/endpoint.d.ts +0 -134
- package/dist/controller/model/endpoint.d.ts.map +0 -1
- package/dist/controller/model/endpoint.js +0 -667
- package/dist/controller/model/endpoint.js.map +0 -1
- package/dist/controller/model/entity.d.ts +0 -15
- package/dist/controller/model/entity.d.ts.map +0 -1
- package/dist/controller/model/entity.js +0 -27
- package/dist/controller/model/entity.js.map +0 -1
- package/dist/controller/model/group.d.ts +0 -39
- package/dist/controller/model/group.d.ts.map +0 -1
- package/dist/controller/model/group.js +0 -226
- package/dist/controller/model/group.js.map +0 -1
- package/dist/controller/model/index.d.ts +0 -6
- package/dist/controller/model/index.d.ts.map +0 -1
- package/dist/controller/model/index.js +0 -15
- package/dist/controller/model/index.js.map +0 -1
- package/dist/controller/model/konnextConfig.d.ts +0 -7
- package/dist/controller/model/konnextConfig.d.ts.map +0 -1
- package/dist/controller/model/konnextConfig.js +0 -3
- package/dist/controller/model/konnextConfig.js.map +0 -1
- package/dist/controller/touchlink.d.ts +0 -20
- package/dist/controller/touchlink.d.ts.map +0 -1
- package/dist/controller/touchlink.js +0 -157
- package/dist/controller/touchlink.js.map +0 -1
- package/dist/controller/tstype.d.ts +0 -21
- package/dist/controller/tstype.d.ts.map +0 -1
- package/dist/controller/tstype.js +0 -9
- package/dist/controller/tstype.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -37
- package/dist/index.js.map +0 -1
- package/dist/models/backup-storage-legacy.d.ts +0 -27
- package/dist/models/backup-storage-legacy.d.ts.map +0 -1
- package/dist/models/backup-storage-legacy.js +0 -3
- package/dist/models/backup-storage-legacy.js.map +0 -1
- package/dist/models/backup-storage-unified.d.ts +0 -50
- package/dist/models/backup-storage-unified.d.ts.map +0 -1
- package/dist/models/backup-storage-unified.js +0 -3
- package/dist/models/backup-storage-unified.js.map +0 -1
- package/dist/models/backup.d.ts +0 -38
- package/dist/models/backup.d.ts.map +0 -1
- package/dist/models/backup.js +0 -3
- package/dist/models/backup.js.map +0 -1
- package/dist/models/index.d.ts +0 -5
- package/dist/models/index.d.ts.map +0 -1
- package/dist/models/index.js +0 -21
- package/dist/models/index.js.map +0 -1
- package/dist/models/network-options.d.ts +0 -13
- package/dist/models/network-options.d.ts.map +0 -1
- package/dist/models/network-options.js +0 -3
- package/dist/models/network-options.js.map +0 -1
- package/dist/utils/aes.d.ts +0 -40
- package/dist/utils/aes.d.ts.map +0 -1
- package/dist/utils/aes.js +0 -198
- package/dist/utils/aes.js.map +0 -1
- package/dist/utils/assertString.d.ts +0 -3
- package/dist/utils/assertString.d.ts.map +0 -1
- package/dist/utils/assertString.js +0 -9
- package/dist/utils/assertString.js.map +0 -1
- package/dist/utils/backup.d.ts +0 -21
- package/dist/utils/backup.d.ts.map +0 -1
- package/dist/utils/backup.js +0 -190
- package/dist/utils/backup.js.map +0 -1
- package/dist/utils/equalsPartial.d.ts +0 -3
- package/dist/utils/equalsPartial.d.ts.map +0 -1
- package/dist/utils/equalsPartial.js +0 -12
- package/dist/utils/equalsPartial.js.map +0 -1
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -46
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/isNumberArray.d.ts +0 -3
- package/dist/utils/isNumberArray.d.ts.map +0 -1
- package/dist/utils/isNumberArray.js +0 -7
- package/dist/utils/isNumberArray.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -9
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -14
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/queue.d.ts +0 -12
- package/dist/utils/queue.d.ts.map +0 -1
- package/dist/utils/queue.js +0 -62
- package/dist/utils/queue.js.map +0 -1
- package/dist/utils/realpathSync.d.ts +0 -3
- package/dist/utils/realpathSync.d.ts.map +0 -1
- package/dist/utils/realpathSync.js +0 -13
- package/dist/utils/realpathSync.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -3
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js +0 -9
- package/dist/utils/wait.js.map +0 -1
- package/dist/utils/waitress.d.ts +0 -22
- package/dist/utils/waitress.d.ts.map +0 -1
- package/dist/utils/waitress.js +0 -69
- package/dist/utils/waitress.js.map +0 -1
- package/dist/zspec/consts.d.ts +0 -60
- package/dist/zspec/consts.d.ts.map +0 -1
- package/dist/zspec/consts.js +0 -64
- package/dist/zspec/consts.js.map +0 -1
- package/dist/zspec/enums.d.ts +0 -19
- package/dist/zspec/enums.d.ts.map +0 -1
- package/dist/zspec/enums.js +0 -28
- package/dist/zspec/enums.js.map +0 -1
- package/dist/zspec/index.d.ts +0 -4
- package/dist/zspec/index.d.ts.map +0 -1
- package/dist/zspec/index.js +0 -43
- package/dist/zspec/index.js.map +0 -1
- package/dist/zspec/tstypes.d.ts +0 -19
- package/dist/zspec/tstypes.d.ts.map +0 -1
- package/dist/zspec/tstypes.js +0 -3
- package/dist/zspec/tstypes.js.map +0 -1
- package/dist/zspec/utils.d.ts +0 -14
- package/dist/zspec/utils.d.ts.map +0 -1
- package/dist/zspec/utils.js +0 -29
- package/dist/zspec/utils.js.map +0 -1
- package/dist/zspec/zcl/buffaloZcl.d.ts +0 -55
- package/dist/zspec/zcl/buffaloZcl.d.ts.map +0 -1
- package/dist/zspec/zcl/buffaloZcl.js +0 -929
- package/dist/zspec/zcl/buffaloZcl.js.map +0 -1
- package/dist/zspec/zcl/definition/cluster.d.ts +0 -3
- package/dist/zspec/zcl/definition/cluster.d.ts.map +0 -1
- package/dist/zspec/zcl/definition/cluster.js +0 -5500
- package/dist/zspec/zcl/definition/cluster.js.map +0 -1
- package/dist/zspec/zcl/definition/consts.d.ts +0 -9
- package/dist/zspec/zcl/definition/consts.d.ts.map +0 -1
- package/dist/zspec/zcl/definition/consts.js +0 -27
- package/dist/zspec/zcl/definition/consts.js.map +0 -1
- package/dist/zspec/zcl/definition/enums.d.ts +0 -177
- package/dist/zspec/zcl/definition/enums.d.ts.map +0 -1
- package/dist/zspec/zcl/definition/enums.js +0 -187
- package/dist/zspec/zcl/definition/enums.js.map +0 -1
- package/dist/zspec/zcl/definition/foundation.d.ts +0 -11
- package/dist/zspec/zcl/definition/foundation.d.ts.map +0 -1
- package/dist/zspec/zcl/definition/foundation.js +0 -241
- package/dist/zspec/zcl/definition/foundation.js.map +0 -1
- package/dist/zspec/zcl/definition/manufacturerCode.d.ts +0 -727
- package/dist/zspec/zcl/definition/manufacturerCode.d.ts.map +0 -1
- package/dist/zspec/zcl/definition/manufacturerCode.js +0 -733
- package/dist/zspec/zcl/definition/manufacturerCode.js.map +0 -1
- package/dist/zspec/zcl/definition/status.d.ts +0 -69
- package/dist/zspec/zcl/definition/status.d.ts.map +0 -1
- package/dist/zspec/zcl/definition/status.js +0 -74
- package/dist/zspec/zcl/definition/status.js.map +0 -1
- package/dist/zspec/zcl/definition/tstype.d.ts +0 -114
- package/dist/zspec/zcl/definition/tstype.d.ts.map +0 -1
- package/dist/zspec/zcl/definition/tstype.js +0 -4
- package/dist/zspec/zcl/definition/tstype.js.map +0 -1
- package/dist/zspec/zcl/index.d.ts +0 -11
- package/dist/zspec/zcl/index.d.ts.map +0 -1
- package/dist/zspec/zcl/index.js +0 -47
- package/dist/zspec/zcl/index.js.map +0 -1
- package/dist/zspec/zcl/utils.d.ts +0 -7
- package/dist/zspec/zcl/utils.d.ts.map +0 -1
- package/dist/zspec/zcl/utils.js +0 -234
- package/dist/zspec/zcl/utils.js.map +0 -1
- package/dist/zspec/zcl/zclFrame.d.ts +0 -36
- package/dist/zspec/zcl/zclFrame.d.ts.map +0 -1
- package/dist/zspec/zcl/zclFrame.js +0 -304
- package/dist/zspec/zcl/zclFrame.js.map +0 -1
- package/dist/zspec/zcl/zclHeader.d.ts +0 -17
- package/dist/zspec/zcl/zclHeader.d.ts.map +0 -1
- package/dist/zspec/zcl/zclHeader.js +0 -88
- package/dist/zspec/zcl/zclHeader.js.map +0 -1
- package/dist/zspec/zcl/zclStatusError.d.ts +0 -6
- package/dist/zspec/zcl/zclStatusError.d.ts.map +0 -1
- package/dist/zspec/zcl/zclStatusError.js +0 -13
- package/dist/zspec/zcl/zclStatusError.js.map +0 -1
- package/dist/zspec/zdo/buffaloZdo.d.ts +0 -438
- package/dist/zspec/zdo/buffaloZdo.d.ts.map +0 -1
- package/dist/zspec/zdo/buffaloZdo.js +0 -1892
- package/dist/zspec/zdo/buffaloZdo.js.map +0 -1
- package/dist/zspec/zdo/definition/clusters.d.ts +0 -624
- package/dist/zspec/zdo/definition/clusters.d.ts.map +0 -1
- package/dist/zspec/zdo/definition/clusters.js +0 -687
- package/dist/zspec/zdo/definition/clusters.js.map +0 -1
- package/dist/zspec/zdo/definition/consts.d.ts +0 -13
- package/dist/zspec/zdo/definition/consts.d.ts.map +0 -1
- package/dist/zspec/zdo/definition/consts.js +0 -16
- package/dist/zspec/zdo/definition/consts.js.map +0 -1
- package/dist/zspec/zdo/definition/enums.d.ts +0 -75
- package/dist/zspec/zdo/definition/enums.d.ts.map +0 -1
- package/dist/zspec/zdo/definition/enums.js +0 -97
- package/dist/zspec/zdo/definition/enums.js.map +0 -1
- package/dist/zspec/zdo/definition/status.d.ts +0 -99
- package/dist/zspec/zdo/definition/status.d.ts.map +0 -1
- package/dist/zspec/zdo/definition/status.js +0 -109
- package/dist/zspec/zdo/definition/status.js.map +0 -1
- package/dist/zspec/zdo/definition/tstypes.d.ts +0 -787
- package/dist/zspec/zdo/definition/tstypes.d.ts.map +0 -1
- package/dist/zspec/zdo/definition/tstypes.js +0 -3
- package/dist/zspec/zdo/definition/tstypes.js.map +0 -1
- package/dist/zspec/zdo/index.d.ts +0 -7
- package/dist/zspec/zdo/index.d.ts.map +0 -1
- package/dist/zspec/zdo/index.js +0 -39
- package/dist/zspec/zdo/index.js.map +0 -1
- package/dist/zspec/zdo/utils.d.ts +0 -25
- package/dist/zspec/zdo/utils.d.ts.map +0 -1
- package/dist/zspec/zdo/utils.js +0 -75
- package/dist/zspec/zdo/utils.js.map +0 -1
- package/dist/zspec/zdo/zdoStatusError.d.ts +0 -6
- package/dist/zspec/zdo/zdoStatusError.d.ts.map +0 -1
- package/dist/zspec/zdo/zdoStatusError.js +0 -13
- package/dist/zspec/zdo/zdoStatusError.js.map +0 -1
- package/typedoc-tsconfig.json +0 -44
|
@@ -0,0 +1,2336 @@
|
|
|
1
|
+
import Buffalo from "../../buffalo/buffalo";
|
|
2
|
+
import {logger} from "../../utils/logger";
|
|
3
|
+
import {DEFAULT_ENCRYPTION_KEY_SIZE, EUI64_SIZE, EXTENDED_PAN_ID_SIZE, PAN_ID_SIZE} from "../consts";
|
|
4
|
+
import type {ClusterId, Eui64, NodeId, ProfileId} from "../tstypes";
|
|
5
|
+
import * as ZSpecUtils from "../utils";
|
|
6
|
+
import {ClusterId as ZdoClusterId} from "./definition/clusters";
|
|
7
|
+
import {CHALLENGE_VALUE_SIZE, CURVE_PUBLIC_POINT_SIZE, MULTICAST_BINDING, UNICAST_BINDING, ZDO_MESSAGE_OVERHEAD} from "./definition/consts";
|
|
8
|
+
import {GlobalTLV, type LeaveRequestFlags, RoutingTableStatus} from "./definition/enums";
|
|
9
|
+
import {Status} from "./definition/status";
|
|
10
|
+
import type {
|
|
11
|
+
ActiveEndpointsResponse,
|
|
12
|
+
APSFrameCounterChallengeTLV,
|
|
13
|
+
APSFrameCounterResponseTLV,
|
|
14
|
+
AuthenticationTokenIdTLV,
|
|
15
|
+
BeaconAppendixEncapsulationGlobalTLV,
|
|
16
|
+
BeaconSurveyConfigurationTLV,
|
|
17
|
+
BeaconSurveyResultsTLV,
|
|
18
|
+
BindingTableEntry,
|
|
19
|
+
BindingTableResponse,
|
|
20
|
+
ChallengeResponse,
|
|
21
|
+
ClearAllBindingsReqEUI64TLV,
|
|
22
|
+
ConfigurationParametersGlobalTLV,
|
|
23
|
+
Curve25519PublicPointTLV,
|
|
24
|
+
DeviceAuthenticationLevelTLV,
|
|
25
|
+
DeviceCapabilityExtensionGlobalTLV,
|
|
26
|
+
DeviceEUI64ListTLV,
|
|
27
|
+
FragmentationParametersGlobalTLV,
|
|
28
|
+
GetAuthenticationLevelResponse,
|
|
29
|
+
GetConfigurationResponse,
|
|
30
|
+
IEEEAddressResponse,
|
|
31
|
+
JoinerEncapsulationGlobalTLV,
|
|
32
|
+
LocalTLVReader,
|
|
33
|
+
LQITableEntry,
|
|
34
|
+
LQITableResponse,
|
|
35
|
+
ManufacturerSpecificGlobalTLV,
|
|
36
|
+
MatchDescriptorsResponse,
|
|
37
|
+
NetworkAddressResponse,
|
|
38
|
+
NextChannelChangeGlobalTLV,
|
|
39
|
+
NextPanIdChangeGlobalTLV,
|
|
40
|
+
NodeDescriptorResponse,
|
|
41
|
+
NwkBeaconSurveyResponse,
|
|
42
|
+
NwkEnhancedUpdateResponse,
|
|
43
|
+
NwkIEEEJoiningListResponse,
|
|
44
|
+
NwkUnsolicitedEnhancedUpdateResponse,
|
|
45
|
+
NwkUpdateResponse,
|
|
46
|
+
PanIdConflictReportGlobalTLV,
|
|
47
|
+
ParentAnnounceResponse,
|
|
48
|
+
PotentialParentsTLV,
|
|
49
|
+
PowerDescriptorResponse,
|
|
50
|
+
ProcessingStatusTLV,
|
|
51
|
+
RequestMap,
|
|
52
|
+
ResponseMap,
|
|
53
|
+
RetrieveAuthenticationTokenResponse,
|
|
54
|
+
RouterInformationGlobalTLV,
|
|
55
|
+
RoutingTableEntry,
|
|
56
|
+
RoutingTableResponse,
|
|
57
|
+
SelectedKeyNegotiationMethodTLV,
|
|
58
|
+
ServerMask,
|
|
59
|
+
SetConfigurationResponse,
|
|
60
|
+
SimpleDescriptorResponse,
|
|
61
|
+
StartKeyNegotiationResponse,
|
|
62
|
+
SupportedKeyNegotiationMethodsGlobalTLV,
|
|
63
|
+
SymmetricPassphraseGlobalTLV,
|
|
64
|
+
SystemServerDiscoveryResponse,
|
|
65
|
+
TargetIEEEAddressTLV,
|
|
66
|
+
Tlv,
|
|
67
|
+
ValidResponseMap,
|
|
68
|
+
} from "./definition/tstypes";
|
|
69
|
+
import * as Utils from "./utils";
|
|
70
|
+
import {ZdoStatusError} from "./zdoStatusError";
|
|
71
|
+
|
|
72
|
+
const NS = "zh:zdo:buffalo";
|
|
73
|
+
|
|
74
|
+
const MAX_BUFFER_SIZE = 255;
|
|
75
|
+
|
|
76
|
+
export class BuffaloZdo extends Buffalo {
|
|
77
|
+
/**
|
|
78
|
+
* Set the byte at given position without affecting the internal position tracker.
|
|
79
|
+
* TODO: move to base `Buffalo` class
|
|
80
|
+
* @param position
|
|
81
|
+
* @param value
|
|
82
|
+
*/
|
|
83
|
+
public setByte(position: number, value: number): void {
|
|
84
|
+
this.buffer.writeUInt8(value, position);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Get the byte at given position without affecting the internal position tracker.
|
|
89
|
+
* TODO: move to base `Buffalo` class
|
|
90
|
+
* @param position
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
public getByte(position: number): number {
|
|
94
|
+
return this.buffer.readUInt8(position);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Check if internal buffer has enough bytes to satisfy: (current position + given count).
|
|
99
|
+
* TODO: move to base `Buffalo` class
|
|
100
|
+
* @param count
|
|
101
|
+
* @returns True if has given more bytes
|
|
102
|
+
*/
|
|
103
|
+
public isMoreBy(count: number): boolean {
|
|
104
|
+
return this.position + count <= this.buffer.length;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//-- GLOBAL TLVS
|
|
108
|
+
|
|
109
|
+
private writeManufacturerSpecificGlobalTLV(tlv: ManufacturerSpecificGlobalTLV): void {
|
|
110
|
+
this.writeUInt16(tlv.zigbeeManufacturerId);
|
|
111
|
+
this.writeBuffer(tlv.additionalData, tlv.additionalData.length);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private readManufacturerSpecificGlobalTLV(length: number): ManufacturerSpecificGlobalTLV {
|
|
115
|
+
logger.debug(`readManufacturerSpecificGlobalTLV with length=${length}`, NS);
|
|
116
|
+
if (length < 2) {
|
|
117
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least 2.`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const zigbeeManufacturerId = this.readUInt16();
|
|
121
|
+
const additionalData = this.readBuffer(length - 2);
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
zigbeeManufacturerId,
|
|
125
|
+
additionalData,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private writeSupportedKeyNegotiationMethodsGlobalTLV(tlv: SupportedKeyNegotiationMethodsGlobalTLV): void {
|
|
130
|
+
this.writeUInt8(tlv.keyNegotiationProtocolsBitmask);
|
|
131
|
+
this.writeUInt8(tlv.preSharedSecretsBitmask);
|
|
132
|
+
|
|
133
|
+
if (tlv.sourceDeviceEui64) {
|
|
134
|
+
this.writeIeeeAddr(tlv.sourceDeviceEui64);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private readSupportedKeyNegotiationMethodsGlobalTLV(length: number): SupportedKeyNegotiationMethodsGlobalTLV {
|
|
139
|
+
logger.debug(`readSupportedKeyNegotiationMethodsGlobalTLV with length=${length}`, NS);
|
|
140
|
+
if (length < 2) {
|
|
141
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least 2.`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const keyNegotiationProtocolsBitmask = this.readUInt8();
|
|
145
|
+
const preSharedSecretsBitmask = this.readUInt8();
|
|
146
|
+
let sourceDeviceEui64: SupportedKeyNegotiationMethodsGlobalTLV["sourceDeviceEui64"];
|
|
147
|
+
|
|
148
|
+
if (length >= 2 + EUI64_SIZE) {
|
|
149
|
+
sourceDeviceEui64 = this.readIeeeAddr();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
keyNegotiationProtocolsBitmask,
|
|
154
|
+
preSharedSecretsBitmask,
|
|
155
|
+
sourceDeviceEui64,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private writePanIdConflictReportGlobalTLV(tlv: PanIdConflictReportGlobalTLV): void {
|
|
160
|
+
this.writeUInt16(tlv.nwkPanIdConflictCount);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private readPanIdConflictReportGlobalTLV(length: number): PanIdConflictReportGlobalTLV {
|
|
164
|
+
logger.debug(`readPanIdConflictReportGlobalTLV with length=${length}`, NS);
|
|
165
|
+
if (length < 2) {
|
|
166
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least 2.`);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const nwkPanIdConflictCount = this.readUInt16();
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
nwkPanIdConflictCount,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private writeNextPanIdChangeGlobalTLV(tlv: NextPanIdChangeGlobalTLV): void {
|
|
177
|
+
this.writeUInt16(tlv.panId);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private readNextPanIdChangeGlobalTLV(length: number): NextPanIdChangeGlobalTLV {
|
|
181
|
+
logger.debug(`readNextPanIdChangeGlobalTLV with length=${length}`, NS);
|
|
182
|
+
if (length < PAN_ID_SIZE) {
|
|
183
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least ${PAN_ID_SIZE}.`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const panId = this.readUInt16();
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
panId,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private writeNextChannelChangeGlobalTLV(tlv: NextChannelChangeGlobalTLV): void {
|
|
194
|
+
this.writeUInt32(tlv.channel);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
private readNextChannelChangeGlobalTLV(length: number): NextChannelChangeGlobalTLV {
|
|
198
|
+
logger.debug(`readNextChannelChangeGlobalTLV with length=${length}`, NS);
|
|
199
|
+
if (length < 4) {
|
|
200
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least 4.`);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const channel = this.readUInt32();
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
channel,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private writeSymmetricPassphraseGlobalTLV(tlv: SymmetricPassphraseGlobalTLV): void {
|
|
211
|
+
this.writeBuffer(tlv.passphrase, DEFAULT_ENCRYPTION_KEY_SIZE);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
private readSymmetricPassphraseGlobalTLV(length: number): SymmetricPassphraseGlobalTLV {
|
|
215
|
+
logger.debug(`readSymmetricPassphraseGlobalTLV with length=${length}`, NS);
|
|
216
|
+
if (length < DEFAULT_ENCRYPTION_KEY_SIZE) {
|
|
217
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least ${DEFAULT_ENCRYPTION_KEY_SIZE}.`);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const passphrase = this.readBuffer(DEFAULT_ENCRYPTION_KEY_SIZE);
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
passphrase,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
private writeRouterInformationGlobalTLV(tlv: RouterInformationGlobalTLV): void {
|
|
228
|
+
this.writeUInt16(tlv.bitmask);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
private readRouterInformationGlobalTLV(length: number): RouterInformationGlobalTLV {
|
|
232
|
+
logger.debug(`readRouterInformationGlobalTLV with length=${length}`, NS);
|
|
233
|
+
if (length < 2) {
|
|
234
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least 2.`);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const bitmask = this.readUInt16();
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
bitmask,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
private writeFragmentationParametersGlobalTLV(tlv: FragmentationParametersGlobalTLV): void {
|
|
245
|
+
this.writeUInt16(tlv.nwkAddress);
|
|
246
|
+
|
|
247
|
+
if (tlv.fragmentationOptions !== undefined) {
|
|
248
|
+
this.writeUInt8(tlv.fragmentationOptions);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (tlv.maxIncomingTransferUnit !== undefined) {
|
|
252
|
+
this.writeUInt16(tlv.maxIncomingTransferUnit);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
private readFragmentationParametersGlobalTLV(length: number): FragmentationParametersGlobalTLV {
|
|
257
|
+
logger.debug(`readFragmentationParametersGlobalTLV with length=${length}`, NS);
|
|
258
|
+
if (length < 2) {
|
|
259
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least 2.`);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const nwkAddress = this.readUInt16();
|
|
263
|
+
let fragmentationOptions: FragmentationParametersGlobalTLV["fragmentationOptions"];
|
|
264
|
+
let maxIncomingTransferUnit: FragmentationParametersGlobalTLV["maxIncomingTransferUnit"];
|
|
265
|
+
|
|
266
|
+
if (length >= 3) {
|
|
267
|
+
fragmentationOptions = this.readUInt8();
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (length >= 5) {
|
|
271
|
+
maxIncomingTransferUnit = this.readUInt16();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return {
|
|
275
|
+
nwkAddress,
|
|
276
|
+
fragmentationOptions,
|
|
277
|
+
maxIncomingTransferUnit,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
private writeJoinerEncapsulationGlobalTLV(encapsulationTLV: JoinerEncapsulationGlobalTLV): void {
|
|
282
|
+
this.writeGlobalTLVs(encapsulationTLV.additionalTLVs);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
private readJoinerEncapsulationGlobalTLV(length: number): JoinerEncapsulationGlobalTLV {
|
|
286
|
+
logger.debug(`readJoinerEncapsulationGlobalTLV with length=${length}`, NS);
|
|
287
|
+
// at least the length of tagId+length for first encapsulated tlv, doesn't make sense otherwise
|
|
288
|
+
if (length < 2) {
|
|
289
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least 2.`);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const encapsulationBuffalo = new BuffaloZdo(this.readBuffer(length));
|
|
293
|
+
const additionalTLVs = encapsulationBuffalo.readTLVs(undefined, true);
|
|
294
|
+
|
|
295
|
+
return {
|
|
296
|
+
additionalTLVs,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
private writeBeaconAppendixEncapsulationGlobalTLV(encapsulationTLV: BeaconAppendixEncapsulationGlobalTLV): void {
|
|
301
|
+
this.writeGlobalTLVs(encapsulationTLV.additionalTLVs);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
private readBeaconAppendixEncapsulationGlobalTLV(length: number): BeaconAppendixEncapsulationGlobalTLV {
|
|
305
|
+
logger.debug(`readBeaconAppendixEncapsulationGlobalTLV with length=${length}`, NS);
|
|
306
|
+
// at least the length of tagId+length for first encapsulated tlv, doesn't make sense otherwise
|
|
307
|
+
if (length < 2) {
|
|
308
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least 2.`);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const encapsulationBuffalo = new BuffaloZdo(this.readBuffer(length));
|
|
312
|
+
// Global: SupportedKeyNegotiationMethodsGlobalTLV
|
|
313
|
+
// Global: FragmentationParametersGlobalTLV
|
|
314
|
+
const additionalTLVs = encapsulationBuffalo.readTLVs(undefined, true);
|
|
315
|
+
|
|
316
|
+
return {
|
|
317
|
+
additionalTLVs,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
private writeConfigurationParametersGlobalTLV(configurationParameters: ConfigurationParametersGlobalTLV): void {
|
|
322
|
+
this.writeUInt16(configurationParameters.configurationParameters);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
private readConfigurationParametersGlobalTLV(length: number): ConfigurationParametersGlobalTLV {
|
|
326
|
+
logger.debug(`readConfigurationParametersGlobalTLV with length=${length}`, NS);
|
|
327
|
+
if (length < 2) {
|
|
328
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least 2.`);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const configurationParameters = this.readUInt16();
|
|
332
|
+
|
|
333
|
+
return {
|
|
334
|
+
configurationParameters,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
private writeDeviceCapabilityExtensionGlobalTLV(tlv: DeviceCapabilityExtensionGlobalTLV): void {
|
|
339
|
+
this.writeBuffer(tlv.data, tlv.data.length);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
private readDeviceCapabilityExtensionGlobalTLV(length: number): DeviceCapabilityExtensionGlobalTLV {
|
|
343
|
+
logger.debug(`readDeviceCapabilityExtensionGlobalTLV with length=${length}`, NS);
|
|
344
|
+
const data = this.readBuffer(length);
|
|
345
|
+
|
|
346
|
+
return {
|
|
347
|
+
data,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
public writeGlobalTLV(tlv: Tlv): void {
|
|
352
|
+
this.writeUInt8(tlv.tagId);
|
|
353
|
+
this.writeUInt8(tlv.length - 1); // remove offset (spec quirk...)
|
|
354
|
+
|
|
355
|
+
switch (tlv.tagId) {
|
|
356
|
+
case GlobalTLV.MANUFACTURER_SPECIFIC: {
|
|
357
|
+
this.writeManufacturerSpecificGlobalTLV(tlv.tlv as ManufacturerSpecificGlobalTLV);
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
case GlobalTLV.SUPPORTED_KEY_NEGOTIATION_METHODS: {
|
|
361
|
+
this.writeSupportedKeyNegotiationMethodsGlobalTLV(tlv.tlv as SupportedKeyNegotiationMethodsGlobalTLV);
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
case GlobalTLV.PAN_ID_CONFLICT_REPORT: {
|
|
365
|
+
this.writePanIdConflictReportGlobalTLV(tlv.tlv as PanIdConflictReportGlobalTLV);
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
case GlobalTLV.NEXT_PAN_ID_CHANGE: {
|
|
369
|
+
this.writeNextPanIdChangeGlobalTLV(tlv.tlv as NextPanIdChangeGlobalTLV);
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
case GlobalTLV.NEXT_CHANNEL_CHANGE: {
|
|
373
|
+
this.writeNextChannelChangeGlobalTLV(tlv.tlv as NextChannelChangeGlobalTLV);
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
case GlobalTLV.SYMMETRIC_PASSPHRASE: {
|
|
377
|
+
this.writeSymmetricPassphraseGlobalTLV(tlv.tlv as SymmetricPassphraseGlobalTLV);
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
case GlobalTLV.ROUTER_INFORMATION: {
|
|
381
|
+
this.writeRouterInformationGlobalTLV(tlv.tlv as RouterInformationGlobalTLV);
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
case GlobalTLV.FRAGMENTATION_PARAMETERS: {
|
|
385
|
+
this.writeFragmentationParametersGlobalTLV(tlv.tlv as FragmentationParametersGlobalTLV);
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
case GlobalTLV.JOINER_ENCAPSULATION: {
|
|
389
|
+
this.writeJoinerEncapsulationGlobalTLV(tlv.tlv as JoinerEncapsulationGlobalTLV);
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
case GlobalTLV.BEACON_APPENDIX_ENCAPSULATION: {
|
|
393
|
+
this.writeBeaconAppendixEncapsulationGlobalTLV(tlv.tlv as BeaconAppendixEncapsulationGlobalTLV);
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
case GlobalTLV.CONFIGURATION_PARAMETERS: {
|
|
397
|
+
this.writeConfigurationParametersGlobalTLV(tlv.tlv as ConfigurationParametersGlobalTLV);
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
case GlobalTLV.DEVICE_CAPABILITY_EXTENSION: {
|
|
401
|
+
this.writeDeviceCapabilityExtensionGlobalTLV(tlv.tlv as DeviceCapabilityExtensionGlobalTLV);
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
default: {
|
|
405
|
+
throw new ZdoStatusError(Status.NOT_SUPPORTED);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
public readGlobalTLV(tagId: number, length: number): Tlv["tlv"] | undefined {
|
|
411
|
+
switch (tagId) {
|
|
412
|
+
case GlobalTLV.MANUFACTURER_SPECIFIC: {
|
|
413
|
+
return this.readManufacturerSpecificGlobalTLV(length);
|
|
414
|
+
}
|
|
415
|
+
case GlobalTLV.SUPPORTED_KEY_NEGOTIATION_METHODS: {
|
|
416
|
+
return this.readSupportedKeyNegotiationMethodsGlobalTLV(length);
|
|
417
|
+
}
|
|
418
|
+
case GlobalTLV.PAN_ID_CONFLICT_REPORT: {
|
|
419
|
+
return this.readPanIdConflictReportGlobalTLV(length);
|
|
420
|
+
}
|
|
421
|
+
case GlobalTLV.NEXT_PAN_ID_CHANGE: {
|
|
422
|
+
return this.readNextPanIdChangeGlobalTLV(length);
|
|
423
|
+
}
|
|
424
|
+
case GlobalTLV.NEXT_CHANNEL_CHANGE: {
|
|
425
|
+
return this.readNextChannelChangeGlobalTLV(length);
|
|
426
|
+
}
|
|
427
|
+
case GlobalTLV.SYMMETRIC_PASSPHRASE: {
|
|
428
|
+
return this.readSymmetricPassphraseGlobalTLV(length);
|
|
429
|
+
}
|
|
430
|
+
case GlobalTLV.ROUTER_INFORMATION: {
|
|
431
|
+
return this.readRouterInformationGlobalTLV(length);
|
|
432
|
+
}
|
|
433
|
+
case GlobalTLV.FRAGMENTATION_PARAMETERS: {
|
|
434
|
+
return this.readFragmentationParametersGlobalTLV(length);
|
|
435
|
+
}
|
|
436
|
+
case GlobalTLV.JOINER_ENCAPSULATION: {
|
|
437
|
+
return this.readJoinerEncapsulationGlobalTLV(length);
|
|
438
|
+
}
|
|
439
|
+
case GlobalTLV.BEACON_APPENDIX_ENCAPSULATION: {
|
|
440
|
+
return this.readBeaconAppendixEncapsulationGlobalTLV(length);
|
|
441
|
+
}
|
|
442
|
+
case GlobalTLV.CONFIGURATION_PARAMETERS: {
|
|
443
|
+
return this.readConfigurationParametersGlobalTLV(length);
|
|
444
|
+
}
|
|
445
|
+
case GlobalTLV.DEVICE_CAPABILITY_EXTENSION: {
|
|
446
|
+
return this.readDeviceCapabilityExtensionGlobalTLV(length);
|
|
447
|
+
}
|
|
448
|
+
default: {
|
|
449
|
+
// validation: unknown tag shall be ignored
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
public writeGlobalTLVs(tlvs: Tlv[]): void {
|
|
456
|
+
for (const tlv of tlvs) {
|
|
457
|
+
this.writeGlobalTLV(tlv);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
//-- LOCAL TLVS
|
|
462
|
+
|
|
463
|
+
// write only
|
|
464
|
+
// private readBeaconSurveyConfigurationTLV(length: number): BeaconSurveyConfigurationTLV {
|
|
465
|
+
// logger.debug(`readBeaconSurveyConfigurationTLV with length=${length}`, NS);
|
|
466
|
+
// const count = this.readUInt8();
|
|
467
|
+
|
|
468
|
+
// if (length !== (1 + (count * 4) + 1)) {
|
|
469
|
+
// throw new Error(`Malformed TLV. Invalid length '${length}', expected ${(1 + (count * 4) + 1)}.`);
|
|
470
|
+
// }
|
|
471
|
+
|
|
472
|
+
// const scanChannelList = this.readListUInt32(count);
|
|
473
|
+
// const configurationBitmask = this.readUInt8();
|
|
474
|
+
|
|
475
|
+
// return {
|
|
476
|
+
// scanChannelList,
|
|
477
|
+
// configurationBitmask,
|
|
478
|
+
// };
|
|
479
|
+
// }
|
|
480
|
+
|
|
481
|
+
private readCurve25519PublicPointTLV(length: number): Curve25519PublicPointTLV {
|
|
482
|
+
logger.debug(`readCurve25519PublicPointTLV with length=${length}`, NS);
|
|
483
|
+
if (length !== EUI64_SIZE + CURVE_PUBLIC_POINT_SIZE) {
|
|
484
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected ${EUI64_SIZE + CURVE_PUBLIC_POINT_SIZE}.`);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const eui64 = this.readIeeeAddr();
|
|
488
|
+
const publicPoint = this.readBuffer(CURVE_PUBLIC_POINT_SIZE);
|
|
489
|
+
|
|
490
|
+
return {
|
|
491
|
+
eui64,
|
|
492
|
+
publicPoint,
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// write only
|
|
497
|
+
// private readTargetIEEEAddressTLV(length: number): TargetIEEEAddressTLV {
|
|
498
|
+
// logger.debug(`readTargetIEEEAddressTLV with length=${length}`, NS);
|
|
499
|
+
// if (length !== EUI64_SIZE) {
|
|
500
|
+
// throw new Error(`Malformed TLV. Invalid length '${length}', expected ${EUI64_SIZE}.`);
|
|
501
|
+
// }
|
|
502
|
+
|
|
503
|
+
// const ieee = this.readIeeeAddr();
|
|
504
|
+
|
|
505
|
+
// return {
|
|
506
|
+
// ieee,
|
|
507
|
+
// };
|
|
508
|
+
// }
|
|
509
|
+
|
|
510
|
+
// write only
|
|
511
|
+
// private readSelectedKeyNegotiationMethodTLV(length: number): SelectedKeyNegotiationMethodTLV {
|
|
512
|
+
// logger.debug(`readSelectedKeyNegotiationMethodTLV with length=${length}`, NS);
|
|
513
|
+
// if (length !== 10) {
|
|
514
|
+
// throw new Error(`Malformed TLV. Invalid length '${length}', expected 10.`);
|
|
515
|
+
// }
|
|
516
|
+
|
|
517
|
+
// const protocol = this.readUInt8();
|
|
518
|
+
// const presharedSecret = this.readUInt8();
|
|
519
|
+
// const sendingDeviceEui64 = this.readIeeeAddr();
|
|
520
|
+
|
|
521
|
+
// return {
|
|
522
|
+
// protocol,
|
|
523
|
+
// presharedSecret,
|
|
524
|
+
// sendingDeviceEui64,
|
|
525
|
+
// };
|
|
526
|
+
// }
|
|
527
|
+
|
|
528
|
+
// write only
|
|
529
|
+
// private readDeviceEUI64ListTLV(length: number): DeviceEUI64ListTLV {
|
|
530
|
+
// logger.debug(`readDeviceEUI64ListTLV with length=${length}`, NS);
|
|
531
|
+
// const count = this.readUInt8();
|
|
532
|
+
|
|
533
|
+
// if (length !== (1 + (count * EUI64_SIZE))) {
|
|
534
|
+
// throw new Error(`Malformed TLV. Invalid length '${length}', expected ${(1 + (count * EUI64_SIZE))}.`);
|
|
535
|
+
// }
|
|
536
|
+
|
|
537
|
+
// const eui64List: DeviceEUI64ListTLV['eui64List'] = [];
|
|
538
|
+
|
|
539
|
+
// for (let i = 0; i < count; i++) {
|
|
540
|
+
// const eui64 = this.readIeeeAddr();
|
|
541
|
+
|
|
542
|
+
// eui64List.push(eui64);
|
|
543
|
+
// }
|
|
544
|
+
|
|
545
|
+
// return {
|
|
546
|
+
// eui64List,
|
|
547
|
+
// };
|
|
548
|
+
// }
|
|
549
|
+
|
|
550
|
+
private readAPSFrameCounterResponseTLV(length: number): APSFrameCounterResponseTLV {
|
|
551
|
+
logger.debug(`readAPSFrameCounterResponseTLV with length=${length}`, NS);
|
|
552
|
+
if (length !== 32) {
|
|
553
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected 32.`);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const responderEui64 = this.readIeeeAddr();
|
|
557
|
+
const receivedChallengeValue = this.readBuffer(CHALLENGE_VALUE_SIZE);
|
|
558
|
+
const apsFrameCounter = this.readUInt32();
|
|
559
|
+
const challengeSecurityFrameCounter = this.readUInt32();
|
|
560
|
+
const mic = this.readBuffer(8);
|
|
561
|
+
|
|
562
|
+
return {
|
|
563
|
+
responderEui64,
|
|
564
|
+
receivedChallengeValue,
|
|
565
|
+
apsFrameCounter,
|
|
566
|
+
challengeSecurityFrameCounter,
|
|
567
|
+
mic,
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
private readBeaconSurveyResultsTLV(length: number): BeaconSurveyResultsTLV {
|
|
572
|
+
logger.debug(`readBeaconSurveyResultsTLV with length=${length}`, NS);
|
|
573
|
+
if (length !== 4) {
|
|
574
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected 4.`);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
const totalBeaconsReceived = this.readUInt8();
|
|
578
|
+
const onNetworkBeacons = this.readUInt8();
|
|
579
|
+
const potentialParentBeacons = this.readUInt8();
|
|
580
|
+
const otherNetworkBeacons = this.readUInt8();
|
|
581
|
+
|
|
582
|
+
return {
|
|
583
|
+
totalBeaconsReceived,
|
|
584
|
+
onNetworkBeacons,
|
|
585
|
+
potentialParentBeacons,
|
|
586
|
+
otherNetworkBeacons,
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
private readPotentialParentsTLV(length: number): PotentialParentsTLV {
|
|
591
|
+
logger.debug(`readPotentialParentsTLV with length=${length}`, NS);
|
|
592
|
+
if (length < 4) {
|
|
593
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected at least 4.`);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
const currentParentNwkAddress = this.readUInt16();
|
|
597
|
+
const currentParentLQA = this.readUInt8();
|
|
598
|
+
// [0x00 - 0x05]
|
|
599
|
+
const entryCount = this.readUInt8();
|
|
600
|
+
|
|
601
|
+
if (length !== 4 + entryCount * 3) {
|
|
602
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected ${4 + entryCount * 3}.`);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
const potentialParents: PotentialParentsTLV["potentialParents"] = [];
|
|
606
|
+
|
|
607
|
+
for (let i = 0; i < entryCount; i++) {
|
|
608
|
+
const nwkAddress = this.readUInt16();
|
|
609
|
+
const lqa = this.readUInt8();
|
|
610
|
+
|
|
611
|
+
potentialParents.push({
|
|
612
|
+
nwkAddress,
|
|
613
|
+
lqa,
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
return {
|
|
618
|
+
currentParentNwkAddress,
|
|
619
|
+
currentParentLQA,
|
|
620
|
+
entryCount,
|
|
621
|
+
potentialParents,
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
private readDeviceAuthenticationLevelTLV(length: number): DeviceAuthenticationLevelTLV {
|
|
626
|
+
logger.debug(`readDeviceAuthenticationLevelTLV with length=${length}`, NS);
|
|
627
|
+
if (length !== 10) {
|
|
628
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected 10.`);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
const remoteNodeIeee = this.readIeeeAddr();
|
|
632
|
+
const initialJoinMethod = this.readUInt8();
|
|
633
|
+
const activeLinkKeyType = this.readUInt8();
|
|
634
|
+
|
|
635
|
+
return {
|
|
636
|
+
remoteNodeIeee,
|
|
637
|
+
initialJoinMethod,
|
|
638
|
+
activeLinkKeyType,
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
private readProcessingStatusTLV(length: number): ProcessingStatusTLV {
|
|
643
|
+
logger.debug(`readProcessingStatusTLV with length=${length}`, NS);
|
|
644
|
+
const count = this.readUInt8();
|
|
645
|
+
|
|
646
|
+
if (length !== 1 + count * 2) {
|
|
647
|
+
throw new Error(`Malformed TLV. Invalid length '${length}', expected ${1 + count * 2}.`);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
const tlvs: ProcessingStatusTLV["tlvs"] = [];
|
|
651
|
+
|
|
652
|
+
for (let i = 0; i < count; i++) {
|
|
653
|
+
const tagId = this.readUInt8();
|
|
654
|
+
const processingStatus = this.readUInt8();
|
|
655
|
+
|
|
656
|
+
tlvs.push({
|
|
657
|
+
tagId,
|
|
658
|
+
processingStatus,
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
return {
|
|
663
|
+
count,
|
|
664
|
+
tlvs,
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* ANNEX I ZIGBEE TLV DEFINITIONS AND FORMAT
|
|
670
|
+
*
|
|
671
|
+
* Unknown tags => TLV ignored
|
|
672
|
+
* Duplicate tags => reject message except for MANUFACTURER_SPECIFIC_GLOBAL_TLV
|
|
673
|
+
* Malformed TLVs => reject message
|
|
674
|
+
*
|
|
675
|
+
* @param localTLVReaders Mapping of tagID to local TLV reader function
|
|
676
|
+
* @param encapsulated Default false. If true, this is reading inside an encapsuled TLV (excludes further encapsulation)
|
|
677
|
+
* @returns
|
|
678
|
+
*/
|
|
679
|
+
public readTLVs(localTLVReaders?: Map<number, LocalTLVReader>, encapsulated = false): Tlv[] {
|
|
680
|
+
const tlvs: Tlv[] = [];
|
|
681
|
+
|
|
682
|
+
while (this.isMore()) {
|
|
683
|
+
const tagId = this.readUInt8();
|
|
684
|
+
|
|
685
|
+
// validation: cannot have duplicate tagId, except MANUFACTURER_SPECIFIC_GLOBAL_TLV
|
|
686
|
+
if (tagId !== GlobalTLV.MANUFACTURER_SPECIFIC && tlvs.findIndex((tlv) => tlv.tagId === tagId) !== -1) {
|
|
687
|
+
throw new Error(`Duplicate tag. Cannot have more than one of tagId=${tagId}.`);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// validation: encapsulation TLV cannot contain another encapsulation TLV, outer considered malformed, reject message
|
|
691
|
+
if (encapsulated && (tagId === GlobalTLV.BEACON_APPENDIX_ENCAPSULATION || tagId === GlobalTLV.JOINER_ENCAPSULATION)) {
|
|
692
|
+
throw new Error(`Invalid nested encapsulation for tagId=${tagId}.`);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
const length = this.readUInt8() + 1; // add offset (spec quirk...)
|
|
696
|
+
|
|
697
|
+
// validation: invalid if not at least ${length} bytes to read
|
|
698
|
+
if (!this.isMoreBy(length)) {
|
|
699
|
+
throw new Error(`Malformed TLV. Invalid data length for tagId=${tagId}, expected ${length}.`);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
const nextTLVStart = this.getPosition() + length;
|
|
703
|
+
// undefined == unknown tag
|
|
704
|
+
let tlv: Tlv["tlv"] | undefined;
|
|
705
|
+
|
|
706
|
+
if (tagId < GlobalTLV.MANUFACTURER_SPECIFIC) {
|
|
707
|
+
if (localTLVReaders) {
|
|
708
|
+
const localTLVReader = localTLVReaders.get(tagId);
|
|
709
|
+
|
|
710
|
+
if (localTLVReader) {
|
|
711
|
+
tlv = localTLVReader.call(this, length);
|
|
712
|
+
/* v8 ignore start */
|
|
713
|
+
} else {
|
|
714
|
+
logger.debug(`Local TLV found tagId=${tagId} but no reader given for it. Ignoring it.`, NS);
|
|
715
|
+
}
|
|
716
|
+
/* v8 ignore stop */
|
|
717
|
+
/* v8 ignore start */
|
|
718
|
+
} else {
|
|
719
|
+
logger.debug(`Local TLV found tagId=${tagId} but no reader available. Ignoring it.`, NS);
|
|
720
|
+
}
|
|
721
|
+
/* v8 ignore stop */
|
|
722
|
+
} else {
|
|
723
|
+
tlv = this.readGlobalTLV(tagId, length);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// validation: unknown tag shall be ignored
|
|
727
|
+
if (tlv) {
|
|
728
|
+
tlvs.push({
|
|
729
|
+
tagId,
|
|
730
|
+
length,
|
|
731
|
+
tlv,
|
|
732
|
+
});
|
|
733
|
+
} else {
|
|
734
|
+
logger.debug(`Unknown TLV tagId=${tagId}. Ignoring it.`, NS);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
// ensure we're at the right position as dictated by the tlv length field, and not the tlv reader (should be the same if proper)
|
|
738
|
+
this.setPosition(nextTLVStart);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
return tlvs;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
//-- REQUESTS
|
|
745
|
+
|
|
746
|
+
public static buildRequest<K extends keyof RequestMap>(hasZdoMessageOverhead: boolean, clusterId: K, ...args: RequestMap[K]): Buffer {
|
|
747
|
+
const buffalo = new BuffaloZdo(Buffer.alloc(MAX_BUFFER_SIZE), hasZdoMessageOverhead ? ZDO_MESSAGE_OVERHEAD : 0);
|
|
748
|
+
|
|
749
|
+
switch (clusterId) {
|
|
750
|
+
case ZdoClusterId.NETWORK_ADDRESS_REQUEST: {
|
|
751
|
+
return buffalo.buildNetworkAddressRequest(...(args as RequestMap[ZdoClusterId.NETWORK_ADDRESS_REQUEST]));
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
case ZdoClusterId.IEEE_ADDRESS_REQUEST: {
|
|
755
|
+
return buffalo.buildIeeeAddressRequest(...(args as RequestMap[ZdoClusterId.IEEE_ADDRESS_REQUEST]));
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
case ZdoClusterId.NODE_DESCRIPTOR_REQUEST: {
|
|
759
|
+
return buffalo.buildNodeDescriptorRequest(...(args as RequestMap[ZdoClusterId.NODE_DESCRIPTOR_REQUEST]));
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
case ZdoClusterId.POWER_DESCRIPTOR_REQUEST: {
|
|
763
|
+
return buffalo.buildPowerDescriptorRequest(...(args as RequestMap[ZdoClusterId.POWER_DESCRIPTOR_REQUEST]));
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
case ZdoClusterId.SIMPLE_DESCRIPTOR_REQUEST: {
|
|
767
|
+
return buffalo.buildSimpleDescriptorRequest(...(args as RequestMap[ZdoClusterId.SIMPLE_DESCRIPTOR_REQUEST]));
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
case ZdoClusterId.ACTIVE_ENDPOINTS_REQUEST: {
|
|
771
|
+
return buffalo.buildActiveEndpointsRequest(...(args as RequestMap[ZdoClusterId.ACTIVE_ENDPOINTS_REQUEST]));
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
case ZdoClusterId.MATCH_DESCRIPTORS_REQUEST: {
|
|
775
|
+
return buffalo.buildMatchDescriptorRequest(...(args as RequestMap[ZdoClusterId.MATCH_DESCRIPTORS_REQUEST]));
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
case ZdoClusterId.SYSTEM_SERVER_DISCOVERY_REQUEST: {
|
|
779
|
+
return buffalo.buildSystemServiceDiscoveryRequest(...(args as RequestMap[ZdoClusterId.SYSTEM_SERVER_DISCOVERY_REQUEST]));
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
case ZdoClusterId.PARENT_ANNOUNCE: {
|
|
783
|
+
return buffalo.buildParentAnnounce(...(args as RequestMap[ZdoClusterId.PARENT_ANNOUNCE]));
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
case ZdoClusterId.BIND_REQUEST: {
|
|
787
|
+
return buffalo.buildBindRequest(...(args as RequestMap[ZdoClusterId.BIND_REQUEST]));
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
case ZdoClusterId.UNBIND_REQUEST: {
|
|
791
|
+
return buffalo.buildUnbindRequest(...(args as RequestMap[ZdoClusterId.UNBIND_REQUEST]));
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
case ZdoClusterId.CLEAR_ALL_BINDINGS_REQUEST: {
|
|
795
|
+
return buffalo.buildClearAllBindingsRequest(...(args as RequestMap[ZdoClusterId.CLEAR_ALL_BINDINGS_REQUEST]));
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
case ZdoClusterId.LQI_TABLE_REQUEST: {
|
|
799
|
+
return buffalo.buildLqiTableRequest(...(args as RequestMap[ZdoClusterId.LQI_TABLE_REQUEST]));
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
case ZdoClusterId.ROUTING_TABLE_REQUEST: {
|
|
803
|
+
return buffalo.buildRoutingTableRequest(...(args as RequestMap[ZdoClusterId.ROUTING_TABLE_REQUEST]));
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
case ZdoClusterId.BINDING_TABLE_REQUEST: {
|
|
807
|
+
return buffalo.buildBindingTableRequest(...(args as RequestMap[ZdoClusterId.BINDING_TABLE_REQUEST]));
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
case ZdoClusterId.LEAVE_REQUEST: {
|
|
811
|
+
return buffalo.buildLeaveRequest(...(args as RequestMap[ZdoClusterId.LEAVE_REQUEST]));
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
case ZdoClusterId.PERMIT_JOINING_REQUEST: {
|
|
815
|
+
return buffalo.buildPermitJoining(...(args as RequestMap[ZdoClusterId.PERMIT_JOINING_REQUEST]));
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
case ZdoClusterId.NWK_UPDATE_REQUEST: {
|
|
819
|
+
return buffalo.buildNwkUpdateRequest(...(args as RequestMap[ZdoClusterId.NWK_UPDATE_REQUEST]));
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
case ZdoClusterId.NWK_ENHANCED_UPDATE_REQUEST: {
|
|
823
|
+
return buffalo.buildNwkEnhancedUpdateRequest(...(args as RequestMap[ZdoClusterId.NWK_ENHANCED_UPDATE_REQUEST]));
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
case ZdoClusterId.NWK_IEEE_JOINING_LIST_REQUEST: {
|
|
827
|
+
return buffalo.buildNwkIEEEJoiningListRequest(...(args as RequestMap[ZdoClusterId.NWK_IEEE_JOINING_LIST_REQUEST]));
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
case ZdoClusterId.NWK_BEACON_SURVEY_REQUEST: {
|
|
831
|
+
return buffalo.buildNwkBeaconSurveyRequest(...(args as RequestMap[ZdoClusterId.NWK_BEACON_SURVEY_REQUEST]));
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
case ZdoClusterId.START_KEY_NEGOTIATION_REQUEST: {
|
|
835
|
+
return buffalo.buildStartKeyNegotiationRequest(...(args as RequestMap[ZdoClusterId.START_KEY_NEGOTIATION_REQUEST]));
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
case ZdoClusterId.RETRIEVE_AUTHENTICATION_TOKEN_REQUEST: {
|
|
839
|
+
return buffalo.buildRetrieveAuthenticationTokenRequest(...(args as RequestMap[ZdoClusterId.RETRIEVE_AUTHENTICATION_TOKEN_REQUEST]));
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
case ZdoClusterId.GET_AUTHENTICATION_LEVEL_REQUEST: {
|
|
843
|
+
return buffalo.buildGetAuthenticationLevelRequest(...(args as RequestMap[ZdoClusterId.GET_AUTHENTICATION_LEVEL_REQUEST]));
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
case ZdoClusterId.SET_CONFIGURATION_REQUEST: {
|
|
847
|
+
return buffalo.buildSetConfigurationRequest(...(args as RequestMap[ZdoClusterId.SET_CONFIGURATION_REQUEST]));
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
case ZdoClusterId.GET_CONFIGURATION_REQUEST: {
|
|
851
|
+
return buffalo.buildGetConfigurationRequest(...(args as RequestMap[ZdoClusterId.GET_CONFIGURATION_REQUEST]));
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
case ZdoClusterId.START_KEY_UPDATE_REQUEST: {
|
|
855
|
+
return buffalo.buildStartKeyUpdateRequest(...(args as RequestMap[ZdoClusterId.START_KEY_UPDATE_REQUEST]));
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
case ZdoClusterId.DECOMMISSION_REQUEST: {
|
|
859
|
+
return buffalo.buildDecommissionRequest(...(args as RequestMap[ZdoClusterId.DECOMMISSION_REQUEST]));
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
case ZdoClusterId.CHALLENGE_REQUEST: {
|
|
863
|
+
return buffalo.buildChallengeRequest(...(args as RequestMap[ZdoClusterId.CHALLENGE_REQUEST]));
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
default: {
|
|
867
|
+
throw new Error(`Unsupported request building for cluster ID '${clusterId}'.`);
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* @see ClusterId.NETWORK_ADDRESS_REQUEST
|
|
874
|
+
* @param target IEEE address for the request
|
|
875
|
+
* @param reportKids True to request that the target list their children in the response. [request type = 0x01]
|
|
876
|
+
* @param childStartIndex The index of the first child to list in the response. Ignored if reportKids is false.
|
|
877
|
+
*/
|
|
878
|
+
private buildNetworkAddressRequest(target: Eui64, reportKids: boolean, childStartIndex: number): Buffer {
|
|
879
|
+
this.writeIeeeAddr(target);
|
|
880
|
+
this.writeUInt8(reportKids ? 1 : 0);
|
|
881
|
+
this.writeUInt8(childStartIndex);
|
|
882
|
+
|
|
883
|
+
return this.getWritten();
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* @see ClusterId.IEEE_ADDRESS_REQUEST
|
|
888
|
+
* Can be sent to target, or to another node that will send to target.
|
|
889
|
+
* @param target NWK address for the request
|
|
890
|
+
* @param reportKids True to request that the target list their children in the response. [request type = 0x01]
|
|
891
|
+
* @param childStartIndex The index of the first child to list in the response. Ignored if reportKids is false.
|
|
892
|
+
*/
|
|
893
|
+
private buildIeeeAddressRequest(target: NodeId, reportKids: boolean, childStartIndex: number): Buffer {
|
|
894
|
+
this.writeUInt16(target);
|
|
895
|
+
this.writeUInt8(reportKids ? 1 : 0);
|
|
896
|
+
this.writeUInt8(childStartIndex);
|
|
897
|
+
|
|
898
|
+
return this.getWritten();
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* @see ClusterId.NODE_DESCRIPTOR_REQUEST
|
|
903
|
+
* @param target NWK address for the request
|
|
904
|
+
*/
|
|
905
|
+
private buildNodeDescriptorRequest(target: NodeId, fragmentationParameters?: FragmentationParametersGlobalTLV): Buffer {
|
|
906
|
+
this.writeUInt16(target);
|
|
907
|
+
|
|
908
|
+
if (fragmentationParameters) {
|
|
909
|
+
let length = 2;
|
|
910
|
+
|
|
911
|
+
if (fragmentationParameters.fragmentationOptions) {
|
|
912
|
+
length += 1;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
if (fragmentationParameters.maxIncomingTransferUnit) {
|
|
916
|
+
length += 2;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
this.writeGlobalTLV({tagId: GlobalTLV.FRAGMENTATION_PARAMETERS, length, tlv: fragmentationParameters});
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
return this.getWritten();
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* @see ClusterId.POWER_DESCRIPTOR_REQUEST
|
|
927
|
+
* @param target NWK address for the request
|
|
928
|
+
*/
|
|
929
|
+
private buildPowerDescriptorRequest(target: NodeId): Buffer {
|
|
930
|
+
this.writeUInt16(target);
|
|
931
|
+
|
|
932
|
+
return this.getWritten();
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* @see ClusterId.SIMPLE_DESCRIPTOR_REQUEST
|
|
937
|
+
* @param target NWK address for the request
|
|
938
|
+
* @param targetEndpoint The endpoint on the destination
|
|
939
|
+
*/
|
|
940
|
+
private buildSimpleDescriptorRequest(target: NodeId, targetEndpoint: number): Buffer {
|
|
941
|
+
this.writeUInt16(target);
|
|
942
|
+
this.writeUInt8(targetEndpoint);
|
|
943
|
+
|
|
944
|
+
return this.getWritten();
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* @see ClusterId.ACTIVE_ENDPOINTS_REQUEST
|
|
949
|
+
* @param target NWK address for the request
|
|
950
|
+
*/
|
|
951
|
+
private buildActiveEndpointsRequest(target: NodeId): Buffer {
|
|
952
|
+
this.writeUInt16(target);
|
|
953
|
+
|
|
954
|
+
return this.getWritten();
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* @see ClusterId.MATCH_DESCRIPTORS_REQUEST
|
|
959
|
+
* @param target NWK address for the request
|
|
960
|
+
* @param profileId Profile ID to be matched at the destination
|
|
961
|
+
* @param inClusterList List of Input ClusterIDs to be used for matching
|
|
962
|
+
* @param outClusterList List of Output ClusterIDs to be used for matching
|
|
963
|
+
*/
|
|
964
|
+
private buildMatchDescriptorRequest(target: NodeId, profileId: ProfileId, inClusterList: ClusterId[], outClusterList: ClusterId[]): Buffer {
|
|
965
|
+
this.writeUInt16(target);
|
|
966
|
+
this.writeUInt16(profileId);
|
|
967
|
+
this.writeUInt8(inClusterList.length);
|
|
968
|
+
this.writeListUInt16(inClusterList);
|
|
969
|
+
this.writeUInt8(outClusterList.length);
|
|
970
|
+
this.writeListUInt16(outClusterList);
|
|
971
|
+
|
|
972
|
+
return this.getWritten();
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* @see ClusterId.SYSTEM_SERVER_DISCOVERY_REQUEST
|
|
977
|
+
* @param serverMask See Table 2-34 for bit assignments.
|
|
978
|
+
*/
|
|
979
|
+
private buildSystemServiceDiscoveryRequest(serverMask: ServerMask): Buffer {
|
|
980
|
+
this.writeUInt16(Utils.createServerMask(serverMask));
|
|
981
|
+
|
|
982
|
+
return this.getWritten();
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* @see ClusterId.PARENT_ANNOUNCE
|
|
987
|
+
* @param children The IEEE addresses of the children bound to the parent.
|
|
988
|
+
*/
|
|
989
|
+
private buildParentAnnounce(children: Eui64[]): Buffer {
|
|
990
|
+
this.writeUInt8(children.length);
|
|
991
|
+
|
|
992
|
+
for (const child of children) {
|
|
993
|
+
this.writeIeeeAddr(child);
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
return this.getWritten();
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* @see ClusterId.BIND_REQUEST
|
|
1001
|
+
*
|
|
1002
|
+
* @param source The IEEE address for the source.
|
|
1003
|
+
* @param sourceEndpoint The source endpoint for the binding entry.
|
|
1004
|
+
* @param clusterId The identifier of the cluster on the source device that is bound to the destination.
|
|
1005
|
+
* @param type The addressing mode for the destination address used in this command, either ::UNICAST_BINDING, ::MULTICAST_BINDING.
|
|
1006
|
+
* @param destination The destination address for the binding entry. IEEE for ::UNICAST_BINDING.
|
|
1007
|
+
* @param groupAddress The destination address for the binding entry. Group ID for ::MULTICAST_BINDING.
|
|
1008
|
+
* @param destinationEndpoint The destination endpoint for the binding entry. Only if ::UNICAST_BINDING.
|
|
1009
|
+
*/
|
|
1010
|
+
private buildBindRequest(
|
|
1011
|
+
source: Eui64,
|
|
1012
|
+
sourceEndpoint: number,
|
|
1013
|
+
clusterId: ClusterId,
|
|
1014
|
+
type: number,
|
|
1015
|
+
destination: Eui64,
|
|
1016
|
+
groupAddress: number,
|
|
1017
|
+
destinationEndpoint: number,
|
|
1018
|
+
): Buffer {
|
|
1019
|
+
this.writeIeeeAddr(source);
|
|
1020
|
+
this.writeUInt8(sourceEndpoint);
|
|
1021
|
+
this.writeUInt16(clusterId);
|
|
1022
|
+
this.writeUInt8(type);
|
|
1023
|
+
|
|
1024
|
+
switch (type) {
|
|
1025
|
+
case UNICAST_BINDING: {
|
|
1026
|
+
this.writeIeeeAddr(destination);
|
|
1027
|
+
this.writeUInt8(destinationEndpoint);
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
1030
|
+
case MULTICAST_BINDING: {
|
|
1031
|
+
this.writeUInt16(groupAddress);
|
|
1032
|
+
break;
|
|
1033
|
+
}
|
|
1034
|
+
default:
|
|
1035
|
+
throw new ZdoStatusError(Status.NOT_SUPPORTED);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
return this.getWritten();
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* @see ClusterId.UNBIND_REQUEST
|
|
1043
|
+
*
|
|
1044
|
+
* @param source The IEEE address for the source.
|
|
1045
|
+
* @param sourceEndpoint The source endpoint for the binding entry.
|
|
1046
|
+
* @param clusterId The identifier of the cluster on the source device that is bound to the destination.
|
|
1047
|
+
* @param type The addressing mode for the destination address used in this command, either ::UNICAST_BINDING, ::MULTICAST_BINDING.
|
|
1048
|
+
* @param destination The destination address for the binding entry. IEEE for ::UNICAST_BINDING.
|
|
1049
|
+
* @param groupAddress The destination address for the binding entry. Group ID for ::MULTICAST_BINDING.
|
|
1050
|
+
* @param destinationEndpoint The destination endpoint for the binding entry. Only if ::UNICAST_BINDING.
|
|
1051
|
+
*/
|
|
1052
|
+
private buildUnbindRequest(
|
|
1053
|
+
source: Eui64,
|
|
1054
|
+
sourceEndpoint: number,
|
|
1055
|
+
clusterId: ClusterId,
|
|
1056
|
+
type: number,
|
|
1057
|
+
destination: Eui64,
|
|
1058
|
+
groupAddress: number,
|
|
1059
|
+
destinationEndpoint: number,
|
|
1060
|
+
): Buffer {
|
|
1061
|
+
this.writeIeeeAddr(source);
|
|
1062
|
+
this.writeUInt8(sourceEndpoint);
|
|
1063
|
+
this.writeUInt16(clusterId);
|
|
1064
|
+
this.writeUInt8(type);
|
|
1065
|
+
|
|
1066
|
+
switch (type) {
|
|
1067
|
+
case UNICAST_BINDING: {
|
|
1068
|
+
this.writeIeeeAddr(destination);
|
|
1069
|
+
this.writeUInt8(destinationEndpoint);
|
|
1070
|
+
break;
|
|
1071
|
+
}
|
|
1072
|
+
case MULTICAST_BINDING: {
|
|
1073
|
+
this.writeUInt16(groupAddress);
|
|
1074
|
+
break;
|
|
1075
|
+
}
|
|
1076
|
+
default:
|
|
1077
|
+
throw new ZdoStatusError(Status.NOT_SUPPORTED);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
return this.getWritten();
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* @see ClusterId.CLEAR_ALL_BINDINGS_REQUEST
|
|
1085
|
+
*/
|
|
1086
|
+
private buildClearAllBindingsRequest(tlv: ClearAllBindingsReqEUI64TLV): Buffer {
|
|
1087
|
+
// ClearAllBindingsReqEUI64TLV: Local: ID: 0x00
|
|
1088
|
+
this.writeUInt8(0x00);
|
|
1089
|
+
this.writeUInt8(tlv.eui64List.length * EUI64_SIZE + 1 - 1);
|
|
1090
|
+
this.writeUInt8(tlv.eui64List.length);
|
|
1091
|
+
|
|
1092
|
+
for (const entry of tlv.eui64List) {
|
|
1093
|
+
this.writeIeeeAddr(entry);
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
return this.getWritten();
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* @see ClusterId.LQI_TABLE_REQUEST
|
|
1101
|
+
* @param startIndex Starting Index for the requested elements of the Neighbor Table.
|
|
1102
|
+
*/
|
|
1103
|
+
private buildLqiTableRequest(startIndex: number): Buffer {
|
|
1104
|
+
this.writeUInt8(startIndex);
|
|
1105
|
+
|
|
1106
|
+
return this.getWritten();
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* @see ClusterId.ROUTING_TABLE_REQUEST
|
|
1111
|
+
* @param startIndex Starting Index for the requested elements of the Neighbor Table.
|
|
1112
|
+
*/
|
|
1113
|
+
private buildRoutingTableRequest(startIndex: number): Buffer {
|
|
1114
|
+
this.writeUInt8(startIndex);
|
|
1115
|
+
|
|
1116
|
+
return this.getWritten();
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* @see ClusterId.BINDING_TABLE_REQUEST
|
|
1121
|
+
* @param startIndex Starting Index for the requested elements of the Neighbor Table.
|
|
1122
|
+
*/
|
|
1123
|
+
private buildBindingTableRequest(startIndex: number): Buffer {
|
|
1124
|
+
this.writeUInt8(startIndex);
|
|
1125
|
+
|
|
1126
|
+
return this.getWritten();
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* @see ClusterId.LEAVE_REQUEST
|
|
1131
|
+
* @param deviceAddress All zeros if the target is to remove itself from the network or
|
|
1132
|
+
* the EUI64 of a child of the target device to remove that child.
|
|
1133
|
+
* @param leaveRequestFlags A bitmask of leave options. Include ::AND_REJOIN if the target is to rejoin the network immediately after leaving.
|
|
1134
|
+
*/
|
|
1135
|
+
private buildLeaveRequest(deviceAddress: Eui64, leaveRequestFlags: LeaveRequestFlags): Buffer {
|
|
1136
|
+
this.writeIeeeAddr(deviceAddress);
|
|
1137
|
+
this.writeUInt8(leaveRequestFlags);
|
|
1138
|
+
|
|
1139
|
+
return this.getWritten();
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* @see ClusterId.PERMIT_JOINING_REQUEST
|
|
1144
|
+
* @param duration A value of 0x00 disables joining. A value of 0xFF enables joining. Any other value enables joining for that number of seconds.
|
|
1145
|
+
* @param authentication Controls Trust Center authentication behavior.
|
|
1146
|
+
* This field SHALL always have a value of 1, indicating a request to change the Trust Center policy.
|
|
1147
|
+
* If a frame is received with a value of 0, it shall be treated as having a value of 1.
|
|
1148
|
+
*/
|
|
1149
|
+
private buildPermitJoining(duration: number, authentication: number, tlvs: Tlv[]): Buffer {
|
|
1150
|
+
this.writeUInt8(duration);
|
|
1151
|
+
this.writeUInt8(authentication);
|
|
1152
|
+
// BeaconAppendixEncapsulationGlobalTLV
|
|
1153
|
+
// - SupportedKeyNegotiationMethodsGlobalTLV
|
|
1154
|
+
// - FragmentationParametersGlobalTLV
|
|
1155
|
+
this.writeGlobalTLVs(tlvs);
|
|
1156
|
+
|
|
1157
|
+
return this.getWritten();
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
/**
|
|
1161
|
+
* @see ClusterId.NWK_UPDATE_REQUEST
|
|
1162
|
+
* @param channels See Table 3-7 for details on the 32-bit field structure..
|
|
1163
|
+
* @param duration A value used to calculate the length of time to spend scanning each channel.
|
|
1164
|
+
* The time spent scanning each channel is (aBaseSuperframeDuration * (2n + 1)) symbols, where n is the value of the duration parameter.
|
|
1165
|
+
* If has a value of 0xfe this is a request for channel change.
|
|
1166
|
+
* If has a value of 0xff this is a request to change the apsChannelMaskList and nwkManagerAddr attributes.
|
|
1167
|
+
* @param count This field represents the number of energy scans to be conducted and reported.
|
|
1168
|
+
* This field SHALL be present only if the duration is within the range of 0x00 to 0x05.
|
|
1169
|
+
* @param nwkUpdateId The value of the nwkUpdateId contained in this request.
|
|
1170
|
+
* This value is set by the Network Channel Manager prior to sending the message.
|
|
1171
|
+
* This field SHALL only be present if the duration is 0xfe or 0xff.
|
|
1172
|
+
* If the ScanDuration is 0xff, then the value in the nwkUpdateID SHALL be ignored.
|
|
1173
|
+
* @param nwkManagerAddr This field SHALL be present only if the duration is set to 0xff, and, where present,
|
|
1174
|
+
* indicates the NWK address for the device with the Network Manager bit set in its Node Descriptor.
|
|
1175
|
+
*/
|
|
1176
|
+
private buildNwkUpdateRequest(
|
|
1177
|
+
channels: number[],
|
|
1178
|
+
duration: number,
|
|
1179
|
+
count: number | undefined,
|
|
1180
|
+
nwkUpdateId: number | undefined,
|
|
1181
|
+
nwkManagerAddr: number | undefined,
|
|
1182
|
+
): Buffer {
|
|
1183
|
+
this.writeUInt32(ZSpecUtils.channelsToUInt32Mask(channels));
|
|
1184
|
+
this.writeUInt8(duration);
|
|
1185
|
+
|
|
1186
|
+
if (count !== undefined && duration >= 0x00 && duration <= 0x05) {
|
|
1187
|
+
this.writeUInt8(count);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
// TODO: What does "This value is set by the Network Channel Manager prior to sending the message." mean exactly??
|
|
1191
|
+
// (isn't used/mentioned in EmberZNet, confirmed working if not set at all for channel change)
|
|
1192
|
+
// for now, allow to bypass with undefined, otherwise should throw if undefined and duration passes below conditions (see NwkEnhancedUpdateRequest)
|
|
1193
|
+
if (nwkUpdateId !== undefined && (duration === 0xfe || duration === 0xff)) {
|
|
1194
|
+
this.writeUInt8(nwkUpdateId);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
if (nwkManagerAddr !== undefined && duration === 0xff) {
|
|
1198
|
+
this.writeUInt16(nwkManagerAddr);
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
return this.getWritten();
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
// /**
|
|
1205
|
+
// * Shortcut for @see BuffaloZdo.buildNwkUpdateRequest
|
|
1206
|
+
// */
|
|
1207
|
+
// private buildScanChannelsRequest(scanChannels: number[], duration: number, count: number): Buffer {
|
|
1208
|
+
// return this.buildNwkUpdateRequest(scanChannels, duration, count, undefined, undefined);
|
|
1209
|
+
// }
|
|
1210
|
+
|
|
1211
|
+
// /**
|
|
1212
|
+
// * Shortcut for @see BuffaloZdo.buildNwkUpdateRequest
|
|
1213
|
+
// */
|
|
1214
|
+
// private buildChannelChangeRequest(channel: number, nwkUpdateId: number | undefined): Buffer {
|
|
1215
|
+
// return this.buildNwkUpdateRequest([channel], 0xfe, undefined, nwkUpdateId, undefined);
|
|
1216
|
+
// }
|
|
1217
|
+
|
|
1218
|
+
// /**
|
|
1219
|
+
// * Shortcut for @see BuffaloZdo.buildNwkUpdateRequest
|
|
1220
|
+
// */
|
|
1221
|
+
// private buildSetActiveChannelsAndNwkManagerIdRequest(channels: number[], nwkUpdateId: number | undefined, nwkManagerAddr: NodeId): Buffer {
|
|
1222
|
+
// return this.buildNwkUpdateRequest(channels, 0xff, undefined, nwkUpdateId, nwkManagerAddr);
|
|
1223
|
+
// }
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* @see ClusterId.NWK_ENHANCED_UPDATE_REQUEST
|
|
1227
|
+
* @param channelPages The set of channels (32-bit bitmap) for each channel page.
|
|
1228
|
+
* The five most significant bits (b27,..., b31) represent the binary encoded Channel Page.
|
|
1229
|
+
* The 27 least significant bits (b0, b1,... b26) indicate which channels are to be scanned
|
|
1230
|
+
* (1 = scan, 0 = do not scan) for each of the 27 valid channels
|
|
1231
|
+
* If duration is in the range 0x00 to 0x05, SHALL be restricted to a single page.
|
|
1232
|
+
* @param duration A value used to calculate the length of time to spend scanning each channel.
|
|
1233
|
+
* The time spent scanning each channel is (aBaseSuperframeDuration * (2n + 1)) symbols, where n is the value of the duration parameter.
|
|
1234
|
+
* If has a value of 0xfe this is a request for channel change.
|
|
1235
|
+
* If has a value of 0xff this is a request to change the apsChannelMaskList and nwkManagerAddr attributes.
|
|
1236
|
+
* @param count This field represents the number of energy scans to be conducted and reported.
|
|
1237
|
+
* This field SHALL be present only if the duration is within the range of 0x00 to 0x05.
|
|
1238
|
+
* @param nwkUpdateId The value of the nwkUpdateId contained in this request.
|
|
1239
|
+
* This value is set by the Network Channel Manager prior to sending the message.
|
|
1240
|
+
* This field SHALL only be present if the duration is 0xfe or 0xff.
|
|
1241
|
+
* If the ScanDuration is 0xff, then the value in the nwkUpdateID SHALL be ignored.
|
|
1242
|
+
* @param nwkManagerAddr This field SHALL be present only if the duration is set to 0xff, and, where present,
|
|
1243
|
+
* indicates the NWK address for the device with the Network Manager bit set in its Node Descriptor.
|
|
1244
|
+
* @param configurationBitmask Defined in defined in section 2.4.3.3.12.
|
|
1245
|
+
* The configurationBitmask must be added to the end of the list of parameters.
|
|
1246
|
+
* This octet may or may not be present.
|
|
1247
|
+
* If not present then assumption should be that it is enhanced active scan.
|
|
1248
|
+
* Bit 0: This bit determines whether to do an Active Scan or Enhanced Active Scan.
|
|
1249
|
+
* When the bit is set to 1 it indicates an Enhanced Active Scan.
|
|
1250
|
+
* And in case of Enhanced Active scan EBR shall be sent with EPID filter instead of PJOIN filter.
|
|
1251
|
+
* Bit 1-7: Reserved
|
|
1252
|
+
*/
|
|
1253
|
+
private buildNwkEnhancedUpdateRequest(
|
|
1254
|
+
channelPages: number[],
|
|
1255
|
+
duration: number,
|
|
1256
|
+
count: number | undefined,
|
|
1257
|
+
nwkUpdateId: number | undefined,
|
|
1258
|
+
nwkManagerAddr: NodeId | undefined,
|
|
1259
|
+
configurationBitmask: number | undefined,
|
|
1260
|
+
): Buffer {
|
|
1261
|
+
this.writeUInt8(channelPages.length);
|
|
1262
|
+
|
|
1263
|
+
for (const channelPage of channelPages) {
|
|
1264
|
+
this.writeUInt32(channelPage);
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
this.writeUInt8(duration);
|
|
1268
|
+
|
|
1269
|
+
if (count !== undefined && duration >= 0x00 && duration <= 0x05) {
|
|
1270
|
+
this.writeUInt8(count);
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
if (nwkUpdateId !== undefined && (duration === 0xfe || duration === 0xff)) {
|
|
1274
|
+
this.writeUInt8(nwkUpdateId);
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
if (nwkManagerAddr !== undefined && duration === 0xff) {
|
|
1278
|
+
this.writeUInt16(nwkManagerAddr);
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
if (configurationBitmask !== undefined) {
|
|
1282
|
+
this.writeUInt8(configurationBitmask);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
return this.getWritten();
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
// /**
|
|
1289
|
+
// * Shortcut for @see BuffaloZdo.buildNwkEnhancedUpdateRequest
|
|
1290
|
+
// */
|
|
1291
|
+
// private buildEnhancedScanChannelsRequest(channelPages: number[], duration: number, count: number, configurationBitmask: number | undefined): Buffer {
|
|
1292
|
+
// return this.buildNwkEnhancedUpdateRequest(channelPages, duration, count, undefined, undefined, configurationBitmask);
|
|
1293
|
+
// }
|
|
1294
|
+
|
|
1295
|
+
// /**
|
|
1296
|
+
// * Shortcut for @see BuffaloZdo.buildNwkEnhancedUpdateRequest
|
|
1297
|
+
// */
|
|
1298
|
+
// private buildEnhancedChannelChangeRequest(channelPage: number, nwkUpdateId: number | undefined, configurationBitmask: number | undefined): Buffer {
|
|
1299
|
+
// return this.buildNwkEnhancedUpdateRequest([channelPage], 0xfe, undefined, nwkUpdateId, undefined, configurationBitmask);
|
|
1300
|
+
// }
|
|
1301
|
+
|
|
1302
|
+
// /**
|
|
1303
|
+
// * Shortcut for @see BuffaloZdo.buildNwkEnhancedUpdateRequest
|
|
1304
|
+
// */
|
|
1305
|
+
// private buildEnhancedSetActiveChannelsAndNwkManagerIdRequest(
|
|
1306
|
+
// channelPages: number[],
|
|
1307
|
+
// nwkUpdateId: number | undefined,
|
|
1308
|
+
// nwkManagerAddr: NodeId,
|
|
1309
|
+
// configurationBitmask: number | undefined,
|
|
1310
|
+
// ): Buffer {
|
|
1311
|
+
// return this.buildNwkEnhancedUpdateRequest(channelPages, 0xff, undefined, nwkUpdateId, nwkManagerAddr, configurationBitmask);
|
|
1312
|
+
// }
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* @see ClusterId.NWK_IEEE_JOINING_LIST_REQUEST
|
|
1316
|
+
* @param startIndex The starting index into the receiving device’s nwkIeeeJoiningList that SHALL be sent back.
|
|
1317
|
+
*/
|
|
1318
|
+
private buildNwkIEEEJoiningListRequest(startIndex: number): Buffer {
|
|
1319
|
+
this.writeUInt8(startIndex);
|
|
1320
|
+
|
|
1321
|
+
return this.getWritten();
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
/**
|
|
1325
|
+
* @see ClusterId.NWK_BEACON_SURVEY_REQUEST
|
|
1326
|
+
*/
|
|
1327
|
+
private buildNwkBeaconSurveyRequest(tlv: BeaconSurveyConfigurationTLV): Buffer {
|
|
1328
|
+
// BeaconSurveyConfigurationTLV: Local: ID: 0x00
|
|
1329
|
+
this.writeUInt8(0x00);
|
|
1330
|
+
this.writeUInt8(2 + tlv.scanChannelList.length * 4 - 1);
|
|
1331
|
+
this.writeUInt8(tlv.scanChannelList.length);
|
|
1332
|
+
this.writeListUInt32(tlv.scanChannelList);
|
|
1333
|
+
this.writeUInt8(tlv.configurationBitmask);
|
|
1334
|
+
|
|
1335
|
+
return this.getWritten();
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* @see ClusterId.START_KEY_NEGOTIATION_REQUEST
|
|
1340
|
+
*/
|
|
1341
|
+
private buildStartKeyNegotiationRequest(tlv: Curve25519PublicPointTLV): Buffer {
|
|
1342
|
+
// Curve25519PublicPointTLV: Local: ID: 0x00
|
|
1343
|
+
this.writeUInt8(0x00);
|
|
1344
|
+
this.writeUInt8(EUI64_SIZE + CURVE_PUBLIC_POINT_SIZE - 1);
|
|
1345
|
+
this.writeIeeeAddr(tlv.eui64);
|
|
1346
|
+
this.writeBuffer(tlv.publicPoint, CURVE_PUBLIC_POINT_SIZE);
|
|
1347
|
+
|
|
1348
|
+
return this.getWritten();
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* @see ClusterId.RETRIEVE_AUTHENTICATION_TOKEN_REQUEST
|
|
1353
|
+
*/
|
|
1354
|
+
private buildRetrieveAuthenticationTokenRequest(tlv: AuthenticationTokenIdTLV): Buffer {
|
|
1355
|
+
// AuthenticationTokenIdTLV: Local: ID: 0x00
|
|
1356
|
+
this.writeUInt8(0x00);
|
|
1357
|
+
this.writeUInt8(1 - 1);
|
|
1358
|
+
this.writeUInt8(tlv.tlvTypeTagId);
|
|
1359
|
+
|
|
1360
|
+
return this.getWritten();
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* @see ClusterId.GET_AUTHENTICATION_LEVEL_REQUEST
|
|
1365
|
+
*/
|
|
1366
|
+
private buildGetAuthenticationLevelRequest(tlv: TargetIEEEAddressTLV): Buffer {
|
|
1367
|
+
// TargetIEEEAddressTLV: Local: ID: 0x00
|
|
1368
|
+
this.writeUInt8(0x00);
|
|
1369
|
+
this.writeUInt8(EUI64_SIZE - 1);
|
|
1370
|
+
this.writeIeeeAddr(tlv.ieee);
|
|
1371
|
+
|
|
1372
|
+
return this.getWritten();
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* @see ClusterId.SET_CONFIGURATION_REQUEST
|
|
1377
|
+
*/
|
|
1378
|
+
private buildSetConfigurationRequest(
|
|
1379
|
+
nextPanIdChange: NextPanIdChangeGlobalTLV,
|
|
1380
|
+
nextChannelChange: NextChannelChangeGlobalTLV,
|
|
1381
|
+
configurationParameters: ConfigurationParametersGlobalTLV,
|
|
1382
|
+
): Buffer {
|
|
1383
|
+
this.writeGlobalTLV({tagId: GlobalTLV.NEXT_PAN_ID_CHANGE, length: PAN_ID_SIZE, tlv: nextPanIdChange});
|
|
1384
|
+
this.writeGlobalTLV({tagId: GlobalTLV.NEXT_CHANNEL_CHANGE, length: 4, tlv: nextChannelChange});
|
|
1385
|
+
this.writeGlobalTLV({tagId: GlobalTLV.CONFIGURATION_PARAMETERS, length: 2, tlv: configurationParameters});
|
|
1386
|
+
|
|
1387
|
+
return this.getWritten();
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* @see ClusterId.GET_CONFIGURATION_REQUEST
|
|
1392
|
+
* @param tlvIds The IDs of each TLV that are being requested.
|
|
1393
|
+
* Maximum number dependent on the underlying maximum size of the message as allowed by fragmentation.
|
|
1394
|
+
*/
|
|
1395
|
+
private buildGetConfigurationRequest(tlvIds: number[]): Buffer {
|
|
1396
|
+
this.writeUInt8(tlvIds.length);
|
|
1397
|
+
|
|
1398
|
+
for (const tlvId of tlvIds) {
|
|
1399
|
+
this.writeUInt8(tlvId);
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
return this.getWritten();
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* @see ClusterId.START_KEY_UPDATE_REQUEST
|
|
1407
|
+
*/
|
|
1408
|
+
private buildStartKeyUpdateRequest(
|
|
1409
|
+
selectedKeyNegotiationMethod: SelectedKeyNegotiationMethodTLV,
|
|
1410
|
+
fragmentationParameters: FragmentationParametersGlobalTLV,
|
|
1411
|
+
): Buffer {
|
|
1412
|
+
// SelectedKeyNegotiationMethodTLV: Local: ID: 0x00
|
|
1413
|
+
this.writeUInt8(0x00);
|
|
1414
|
+
this.writeUInt8(EUI64_SIZE + 2 - 1);
|
|
1415
|
+
this.writeUInt8(selectedKeyNegotiationMethod.protocol);
|
|
1416
|
+
this.writeUInt8(selectedKeyNegotiationMethod.presharedSecret);
|
|
1417
|
+
this.writeIeeeAddr(selectedKeyNegotiationMethod.sendingDeviceEui64);
|
|
1418
|
+
|
|
1419
|
+
{
|
|
1420
|
+
let length = 2;
|
|
1421
|
+
|
|
1422
|
+
if (fragmentationParameters.fragmentationOptions) {
|
|
1423
|
+
length += 1;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
if (fragmentationParameters.maxIncomingTransferUnit) {
|
|
1427
|
+
length += 2;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
this.writeGlobalTLV({tagId: GlobalTLV.FRAGMENTATION_PARAMETERS, length, tlv: fragmentationParameters});
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
return this.getWritten();
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
/**
|
|
1437
|
+
* @see ClusterId.DECOMMISSION_REQUEST
|
|
1438
|
+
*/
|
|
1439
|
+
private buildDecommissionRequest(tlv: DeviceEUI64ListTLV): Buffer {
|
|
1440
|
+
// DeviceEUI64ListTLV: Local: ID: 0x00
|
|
1441
|
+
this.writeUInt8(0x00);
|
|
1442
|
+
this.writeUInt8(tlv.eui64List.length * EUI64_SIZE + 1 - 1);
|
|
1443
|
+
this.writeUInt8(tlv.eui64List.length);
|
|
1444
|
+
|
|
1445
|
+
for (const eui64 of tlv.eui64List) {
|
|
1446
|
+
this.writeIeeeAddr(eui64);
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
return this.getWritten();
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
/**
|
|
1453
|
+
* @see ClusterId.CHALLENGE_REQUEST
|
|
1454
|
+
*/
|
|
1455
|
+
private buildChallengeRequest(tlv: APSFrameCounterChallengeTLV): Buffer {
|
|
1456
|
+
// APSFrameCounterChallengeTLV: Local: ID: 0x00
|
|
1457
|
+
this.writeUInt8(0x00);
|
|
1458
|
+
this.writeUInt8(EUI64_SIZE + CHALLENGE_VALUE_SIZE - 1);
|
|
1459
|
+
this.writeIeeeAddr(tlv.senderEui64);
|
|
1460
|
+
this.writeBuffer(tlv.challengeValue, CHALLENGE_VALUE_SIZE);
|
|
1461
|
+
|
|
1462
|
+
return this.getWritten();
|
|
1463
|
+
}
|
|
1464
|
+
//-- RESPONSES
|
|
1465
|
+
|
|
1466
|
+
public static checkStatus<K extends keyof ValidResponseMap>(result: ResponseMap[number]): result is ValidResponseMap[K] {
|
|
1467
|
+
return result[0] === Status.SUCCESS;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
public static readResponse<K extends number>(
|
|
1471
|
+
hasZdoMessageOverhead: boolean,
|
|
1472
|
+
clusterId: K extends keyof ResponseMap ? keyof ResponseMap : K,
|
|
1473
|
+
buffer: Buffer,
|
|
1474
|
+
): ResponseMap[K] {
|
|
1475
|
+
const buffalo = new BuffaloZdo(buffer, hasZdoMessageOverhead ? ZDO_MESSAGE_OVERHEAD : 0); // set pos to skip `transaction sequence number`
|
|
1476
|
+
|
|
1477
|
+
switch (clusterId) {
|
|
1478
|
+
case ZdoClusterId.NETWORK_ADDRESS_RESPONSE: {
|
|
1479
|
+
return buffalo.readNetworkAddressResponse() as ResponseMap[K];
|
|
1480
|
+
}
|
|
1481
|
+
case ZdoClusterId.IEEE_ADDRESS_RESPONSE: {
|
|
1482
|
+
return buffalo.readIEEEAddressResponse() as ResponseMap[K];
|
|
1483
|
+
}
|
|
1484
|
+
case ZdoClusterId.NODE_DESCRIPTOR_RESPONSE: {
|
|
1485
|
+
return buffalo.readNodeDescriptorResponse() as ResponseMap[K];
|
|
1486
|
+
}
|
|
1487
|
+
case ZdoClusterId.POWER_DESCRIPTOR_RESPONSE: {
|
|
1488
|
+
return buffalo.readPowerDescriptorResponse() as ResponseMap[K];
|
|
1489
|
+
}
|
|
1490
|
+
case ZdoClusterId.SIMPLE_DESCRIPTOR_RESPONSE: {
|
|
1491
|
+
return buffalo.readSimpleDescriptorResponse() as ResponseMap[K];
|
|
1492
|
+
}
|
|
1493
|
+
case ZdoClusterId.ACTIVE_ENDPOINTS_RESPONSE: {
|
|
1494
|
+
return buffalo.readActiveEndpointsResponse() as ResponseMap[K];
|
|
1495
|
+
}
|
|
1496
|
+
case ZdoClusterId.MATCH_DESCRIPTORS_RESPONSE: {
|
|
1497
|
+
return buffalo.readMatchDescriptorsResponse() as ResponseMap[K];
|
|
1498
|
+
}
|
|
1499
|
+
case ZdoClusterId.END_DEVICE_ANNOUNCE: {
|
|
1500
|
+
return buffalo.readEndDeviceAnnounce() as ResponseMap[K];
|
|
1501
|
+
}
|
|
1502
|
+
case ZdoClusterId.SYSTEM_SERVER_DISCOVERY_RESPONSE: {
|
|
1503
|
+
return buffalo.readSystemServerDiscoveryResponse() as ResponseMap[K];
|
|
1504
|
+
}
|
|
1505
|
+
case ZdoClusterId.PARENT_ANNOUNCE_RESPONSE: {
|
|
1506
|
+
return buffalo.readParentAnnounceResponse() as ResponseMap[K];
|
|
1507
|
+
}
|
|
1508
|
+
case ZdoClusterId.BIND_RESPONSE: {
|
|
1509
|
+
return buffalo.readBindResponse() as ResponseMap[K];
|
|
1510
|
+
}
|
|
1511
|
+
case ZdoClusterId.UNBIND_RESPONSE: {
|
|
1512
|
+
return buffalo.readUnbindResponse() as ResponseMap[K];
|
|
1513
|
+
}
|
|
1514
|
+
case ZdoClusterId.CLEAR_ALL_BINDINGS_RESPONSE: {
|
|
1515
|
+
return buffalo.readClearAllBindingsResponse() as ResponseMap[K];
|
|
1516
|
+
}
|
|
1517
|
+
case ZdoClusterId.LQI_TABLE_RESPONSE: {
|
|
1518
|
+
return buffalo.readLQITableResponse() as ResponseMap[K];
|
|
1519
|
+
}
|
|
1520
|
+
case ZdoClusterId.ROUTING_TABLE_RESPONSE: {
|
|
1521
|
+
return buffalo.readRoutingTableResponse() as ResponseMap[K];
|
|
1522
|
+
}
|
|
1523
|
+
case ZdoClusterId.BINDING_TABLE_RESPONSE: {
|
|
1524
|
+
return buffalo.readBindingTableResponse() as ResponseMap[K];
|
|
1525
|
+
}
|
|
1526
|
+
case ZdoClusterId.LEAVE_RESPONSE: {
|
|
1527
|
+
return buffalo.readLeaveResponse() as ResponseMap[K];
|
|
1528
|
+
}
|
|
1529
|
+
case ZdoClusterId.PERMIT_JOINING_RESPONSE: {
|
|
1530
|
+
return buffalo.readPermitJoiningResponse() as ResponseMap[K];
|
|
1531
|
+
}
|
|
1532
|
+
case ZdoClusterId.NWK_UPDATE_RESPONSE: {
|
|
1533
|
+
return buffalo.readNwkUpdateResponse() as ResponseMap[K];
|
|
1534
|
+
}
|
|
1535
|
+
case ZdoClusterId.NWK_ENHANCED_UPDATE_RESPONSE: {
|
|
1536
|
+
return buffalo.readNwkEnhancedUpdateResponse() as ResponseMap[K];
|
|
1537
|
+
}
|
|
1538
|
+
case ZdoClusterId.NWK_IEEE_JOINING_LIST_RESPONSE: {
|
|
1539
|
+
return buffalo.readNwkIEEEJoiningListResponse() as ResponseMap[K];
|
|
1540
|
+
}
|
|
1541
|
+
case ZdoClusterId.NWK_UNSOLICITED_ENHANCED_UPDATE_RESPONSE: {
|
|
1542
|
+
return buffalo.readNwkUnsolicitedEnhancedUpdateResponse() as ResponseMap[K];
|
|
1543
|
+
}
|
|
1544
|
+
case ZdoClusterId.NWK_BEACON_SURVEY_RESPONSE: {
|
|
1545
|
+
return buffalo.readNwkBeaconSurveyResponse() as ResponseMap[K];
|
|
1546
|
+
}
|
|
1547
|
+
case ZdoClusterId.START_KEY_NEGOTIATION_RESPONSE: {
|
|
1548
|
+
return buffalo.readStartKeyNegotiationResponse() as ResponseMap[K];
|
|
1549
|
+
}
|
|
1550
|
+
case ZdoClusterId.RETRIEVE_AUTHENTICATION_TOKEN_RESPONSE: {
|
|
1551
|
+
return buffalo.readRetrieveAuthenticationTokenResponse() as ResponseMap[K];
|
|
1552
|
+
}
|
|
1553
|
+
case ZdoClusterId.GET_AUTHENTICATION_LEVEL_RESPONSE: {
|
|
1554
|
+
return buffalo.readGetAuthenticationLevelResponse() as ResponseMap[K];
|
|
1555
|
+
}
|
|
1556
|
+
case ZdoClusterId.SET_CONFIGURATION_RESPONSE: {
|
|
1557
|
+
return buffalo.readSetConfigurationResponse() as ResponseMap[K];
|
|
1558
|
+
}
|
|
1559
|
+
case ZdoClusterId.GET_CONFIGURATION_RESPONSE: {
|
|
1560
|
+
return buffalo.readGetConfigurationResponse() as ResponseMap[K];
|
|
1561
|
+
}
|
|
1562
|
+
case ZdoClusterId.START_KEY_UPDATE_RESPONSE: {
|
|
1563
|
+
return buffalo.readStartKeyUpdateResponse() as ResponseMap[K];
|
|
1564
|
+
}
|
|
1565
|
+
case ZdoClusterId.DECOMMISSION_RESPONSE: {
|
|
1566
|
+
return buffalo.readDecommissionResponse() as ResponseMap[K];
|
|
1567
|
+
}
|
|
1568
|
+
case ZdoClusterId.CHALLENGE_RESPONSE: {
|
|
1569
|
+
return buffalo.readChallengeResponse() as ResponseMap[K];
|
|
1570
|
+
}
|
|
1571
|
+
default: {
|
|
1572
|
+
throw new Error(`Unsupported response reading for cluster ID '${clusterId}'.`);
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* @see ClusterId.NETWORK_ADDRESS_RESPONSE
|
|
1579
|
+
*/
|
|
1580
|
+
public readNetworkAddressResponse(): ResponseMap[ZdoClusterId.NETWORK_ADDRESS_RESPONSE] {
|
|
1581
|
+
// INV_REQUESTTYPE or DEVICE_NOT_FOUND
|
|
1582
|
+
const status: Status = this.readUInt8();
|
|
1583
|
+
let result: NetworkAddressResponse | undefined;
|
|
1584
|
+
|
|
1585
|
+
if (status === Status.SUCCESS) {
|
|
1586
|
+
const eui64 = this.readIeeeAddr();
|
|
1587
|
+
const nwkAddress = this.readUInt16();
|
|
1588
|
+
let assocDevCount = 0;
|
|
1589
|
+
let startIndex = 0;
|
|
1590
|
+
let assocDevList: number[] = [];
|
|
1591
|
+
|
|
1592
|
+
if (this.isMore()) {
|
|
1593
|
+
assocDevCount = this.readUInt8();
|
|
1594
|
+
startIndex = this.readUInt8();
|
|
1595
|
+
|
|
1596
|
+
assocDevList = this.readListUInt16(assocDevCount);
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
result = {
|
|
1600
|
+
eui64,
|
|
1601
|
+
nwkAddress,
|
|
1602
|
+
startIndex,
|
|
1603
|
+
assocDevList,
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
return [status, result];
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* @see ClusterId.IEEE_ADDRESS_RESPONSE
|
|
1612
|
+
*/
|
|
1613
|
+
public readIEEEAddressResponse(): ResponseMap[ZdoClusterId.IEEE_ADDRESS_RESPONSE] {
|
|
1614
|
+
// INV_REQUESTTYPE or DEVICE_NOT_FOUND
|
|
1615
|
+
const status: Status = this.readUInt8();
|
|
1616
|
+
let result: IEEEAddressResponse | undefined;
|
|
1617
|
+
|
|
1618
|
+
if (status === Status.SUCCESS) {
|
|
1619
|
+
const eui64 = this.readIeeeAddr();
|
|
1620
|
+
const nwkAddress = this.readUInt16();
|
|
1621
|
+
let assocDevCount = 0;
|
|
1622
|
+
let startIndex = 0;
|
|
1623
|
+
let assocDevList: number[] = [];
|
|
1624
|
+
|
|
1625
|
+
if (this.isMore()) {
|
|
1626
|
+
assocDevCount = this.readUInt8();
|
|
1627
|
+
startIndex = this.readUInt8();
|
|
1628
|
+
assocDevList = this.readListUInt16(assocDevCount);
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
result = {
|
|
1632
|
+
eui64,
|
|
1633
|
+
nwkAddress,
|
|
1634
|
+
startIndex,
|
|
1635
|
+
assocDevList,
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
return [status, result];
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* @see ClusterId.NODE_DESCRIPTOR_RESPONSE
|
|
1644
|
+
*/
|
|
1645
|
+
public readNodeDescriptorResponse(): ResponseMap[ZdoClusterId.NODE_DESCRIPTOR_RESPONSE] {
|
|
1646
|
+
// DEVICE_NOT_FOUND, INV_REQUESTTYPE, or NO_DESCRIPTOR
|
|
1647
|
+
const status: Status = this.readUInt8();
|
|
1648
|
+
let result: NodeDescriptorResponse | undefined;
|
|
1649
|
+
|
|
1650
|
+
if (status === Status.SUCCESS) {
|
|
1651
|
+
const nwkAddress = this.readUInt16();
|
|
1652
|
+
// in bits: [logical type: 3] [deprecated: 1] [deprecated: 1] [fragmentation supported (R23): 1] [reserved/unused: 2]
|
|
1653
|
+
const nodeDescByte1 = this.readUInt8();
|
|
1654
|
+
// in bits: [aps flags: 3] [frequency band: 5]
|
|
1655
|
+
const nodeDescByte2 = this.readUInt8();
|
|
1656
|
+
const macCapFlags = Utils.getMacCapFlags(this.readUInt8());
|
|
1657
|
+
const manufacturerCode = this.readUInt16();
|
|
1658
|
+
const maxBufSize = this.readUInt8();
|
|
1659
|
+
const maxIncTxSize = this.readUInt16();
|
|
1660
|
+
const serverMask = Utils.getServerMask(this.readUInt16());
|
|
1661
|
+
const maxOutTxSize = this.readUInt16();
|
|
1662
|
+
const deprecated1 = this.readUInt8();
|
|
1663
|
+
// Global: FragmentationParametersGlobalTLV
|
|
1664
|
+
const tlvs: Tlv[] = this.readTLVs();
|
|
1665
|
+
|
|
1666
|
+
result = {
|
|
1667
|
+
nwkAddress,
|
|
1668
|
+
logicalType: nodeDescByte1 & 0x07,
|
|
1669
|
+
fragmentationSupported: serverMask.stackComplianceRevision >= 23 ? (nodeDescByte1 & 0x20) >> 5 === 1 : undefined,
|
|
1670
|
+
apsFlags: nodeDescByte2 & 0x07,
|
|
1671
|
+
frequencyBand: (nodeDescByte2 & 0xf8) >> 3,
|
|
1672
|
+
capabilities: macCapFlags,
|
|
1673
|
+
manufacturerCode,
|
|
1674
|
+
maxBufSize,
|
|
1675
|
+
maxIncTxSize,
|
|
1676
|
+
serverMask,
|
|
1677
|
+
maxOutTxSize,
|
|
1678
|
+
deprecated1,
|
|
1679
|
+
tlvs,
|
|
1680
|
+
};
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
return [status, result];
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* @see ClusterId.POWER_DESCRIPTOR_RESPONSE
|
|
1688
|
+
*/
|
|
1689
|
+
public readPowerDescriptorResponse(): ResponseMap[ZdoClusterId.POWER_DESCRIPTOR_RESPONSE] {
|
|
1690
|
+
// DEVICE_NOT_FOUND, INV_REQUESTTYPE, or NO_DESCRIPTOR
|
|
1691
|
+
const status: Status = this.readUInt8();
|
|
1692
|
+
let result: PowerDescriptorResponse | undefined;
|
|
1693
|
+
|
|
1694
|
+
if (status === Status.SUCCESS) {
|
|
1695
|
+
const nwkAddress = this.readUInt16();
|
|
1696
|
+
const byte1 = this.readUInt8();
|
|
1697
|
+
const byte2 = this.readUInt8();
|
|
1698
|
+
|
|
1699
|
+
result = {
|
|
1700
|
+
nwkAddress,
|
|
1701
|
+
currentPowerMode: byte1 & 0xf,
|
|
1702
|
+
availPowerSources: (byte1 >> 4) & 0xf,
|
|
1703
|
+
currentPowerSource: byte2 & 0xf,
|
|
1704
|
+
currentPowerSourceLevel: (byte2 >> 4) & 0xf,
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
return [status, result];
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
/**
|
|
1712
|
+
* @see ClusterId.SIMPLE_DESCRIPTOR_RESPONSE
|
|
1713
|
+
*/
|
|
1714
|
+
public readSimpleDescriptorResponse(): ResponseMap[ZdoClusterId.SIMPLE_DESCRIPTOR_RESPONSE] {
|
|
1715
|
+
// INVALID_EP, NOT_ACTIVE, DEVICE_NOT_FOUND, INV_REQUESTTYPE or NO_DESCRIPTOR
|
|
1716
|
+
const status: Status = this.readUInt8();
|
|
1717
|
+
let result: SimpleDescriptorResponse | undefined;
|
|
1718
|
+
|
|
1719
|
+
if (status === Status.SUCCESS) {
|
|
1720
|
+
const nwkAddress = this.readUInt16();
|
|
1721
|
+
// Length in bytes of the Simple Descriptor to follow. [0x00-0xff]
|
|
1722
|
+
const length = this.readUInt8();
|
|
1723
|
+
const endpoint = this.readUInt8();
|
|
1724
|
+
const profileId = this.readUInt16();
|
|
1725
|
+
const deviceId = this.readUInt16();
|
|
1726
|
+
const deviceVersion = this.readUInt8();
|
|
1727
|
+
const inClusterCount = this.readUInt8();
|
|
1728
|
+
const inClusterList = this.readListUInt16(inClusterCount); // empty if inClusterCount==0
|
|
1729
|
+
const outClusterCount = this.readUInt8();
|
|
1730
|
+
const outClusterList = this.readListUInt16(outClusterCount); // empty if outClusterCount==0
|
|
1731
|
+
|
|
1732
|
+
result = {
|
|
1733
|
+
nwkAddress,
|
|
1734
|
+
length,
|
|
1735
|
+
endpoint,
|
|
1736
|
+
profileId,
|
|
1737
|
+
deviceId,
|
|
1738
|
+
deviceVersion,
|
|
1739
|
+
inClusterList,
|
|
1740
|
+
outClusterList,
|
|
1741
|
+
};
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
return [status, result];
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
/**
|
|
1748
|
+
* @see ClusterId.ACTIVE_ENDPOINTS_RESPONSE
|
|
1749
|
+
*/
|
|
1750
|
+
public readActiveEndpointsResponse(): ResponseMap[ZdoClusterId.ACTIVE_ENDPOINTS_RESPONSE] {
|
|
1751
|
+
// DEVICE_NOT_FOUND, INV_REQUESTTYPE, or NO_DESCRIPTOR
|
|
1752
|
+
const status: Status = this.readUInt8();
|
|
1753
|
+
let result: ActiveEndpointsResponse | undefined;
|
|
1754
|
+
|
|
1755
|
+
if (status === Status.SUCCESS) {
|
|
1756
|
+
const nwkAddress = this.readUInt16();
|
|
1757
|
+
const endpointCount = this.readUInt8();
|
|
1758
|
+
const endpointList = this.readListUInt8(endpointCount);
|
|
1759
|
+
|
|
1760
|
+
result = {
|
|
1761
|
+
nwkAddress,
|
|
1762
|
+
endpointList,
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
return [status, result];
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* @see ClusterId.MATCH_DESCRIPTORS_RESPONSE
|
|
1771
|
+
*/
|
|
1772
|
+
public readMatchDescriptorsResponse(): ResponseMap[ZdoClusterId.MATCH_DESCRIPTORS_RESPONSE] {
|
|
1773
|
+
// DEVICE_NOT_FOUND, INV_REQUESTTYPE, or NO_DESCRIPTOR
|
|
1774
|
+
const status: Status = this.readUInt8();
|
|
1775
|
+
let result: MatchDescriptorsResponse | undefined;
|
|
1776
|
+
|
|
1777
|
+
if (status === Status.SUCCESS) {
|
|
1778
|
+
const nwkAddress = this.readUInt16();
|
|
1779
|
+
const endpointCount = this.readUInt8();
|
|
1780
|
+
const endpointList = this.readListUInt8(endpointCount);
|
|
1781
|
+
|
|
1782
|
+
result = {
|
|
1783
|
+
nwkAddress,
|
|
1784
|
+
endpointList,
|
|
1785
|
+
};
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
return [status, result];
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
/**
|
|
1792
|
+
* @see ClusterId.END_DEVICE_ANNOUNCE
|
|
1793
|
+
*/
|
|
1794
|
+
public readEndDeviceAnnounce(): ResponseMap[ZdoClusterId.END_DEVICE_ANNOUNCE] {
|
|
1795
|
+
const nwkAddress = this.readUInt16();
|
|
1796
|
+
const eui64 = this.readIeeeAddr();
|
|
1797
|
+
/** @see MACCapabilityFlags */
|
|
1798
|
+
const capabilities = this.readUInt8();
|
|
1799
|
+
|
|
1800
|
+
return [Status.SUCCESS, {nwkAddress, eui64, capabilities: Utils.getMacCapFlags(capabilities)}];
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
/**
|
|
1804
|
+
* @see ClusterId.SYSTEM_SERVER_DISCOVERY_RESPONSE
|
|
1805
|
+
*/
|
|
1806
|
+
public readSystemServerDiscoveryResponse(): ResponseMap[ZdoClusterId.SYSTEM_SERVER_DISCOVERY_RESPONSE] {
|
|
1807
|
+
// never expected !== SUCCESS
|
|
1808
|
+
const status: Status = this.readUInt8();
|
|
1809
|
+
let result: SystemServerDiscoveryResponse | undefined;
|
|
1810
|
+
|
|
1811
|
+
if (status === Status.SUCCESS) {
|
|
1812
|
+
const serverMask = Utils.getServerMask(this.readUInt16());
|
|
1813
|
+
|
|
1814
|
+
result = {
|
|
1815
|
+
serverMask,
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
return [status, result];
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
/**
|
|
1823
|
+
* @see ClusterId.PARENT_ANNOUNCE_RESPONSE
|
|
1824
|
+
*/
|
|
1825
|
+
public readParentAnnounceResponse(): ResponseMap[ZdoClusterId.PARENT_ANNOUNCE_RESPONSE] {
|
|
1826
|
+
// NOT_SUPPORTED
|
|
1827
|
+
const status: Status = this.readUInt8();
|
|
1828
|
+
let result: ParentAnnounceResponse | undefined;
|
|
1829
|
+
|
|
1830
|
+
if (status === Status.SUCCESS) {
|
|
1831
|
+
const numberOfChildren = this.readUInt8();
|
|
1832
|
+
const children: Eui64[] = [];
|
|
1833
|
+
|
|
1834
|
+
for (let i = 0; i < numberOfChildren; i++) {
|
|
1835
|
+
const childEui64 = this.readIeeeAddr();
|
|
1836
|
+
|
|
1837
|
+
children.push(childEui64);
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
result = {children};
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
return [status, result];
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
/**
|
|
1847
|
+
* @see ClusterId.BIND_RESPONSE
|
|
1848
|
+
* @returns No response payload, throws if not success
|
|
1849
|
+
*/
|
|
1850
|
+
public readBindResponse(): ResponseMap[ZdoClusterId.BIND_RESPONSE] {
|
|
1851
|
+
// NOT_SUPPORTED, INVALID_EP, TABLE_FULL, or NOT_AUTHORIZED
|
|
1852
|
+
const status: Status = this.readUInt8();
|
|
1853
|
+
|
|
1854
|
+
return [status, undefined];
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
/**
|
|
1858
|
+
* @see ClusterId.UNBIND_RESPONSE
|
|
1859
|
+
* @returns No response payload, throws if not success
|
|
1860
|
+
*/
|
|
1861
|
+
public readUnbindResponse(): ResponseMap[ZdoClusterId.UNBIND_RESPONSE] {
|
|
1862
|
+
// NOT_SUPPORTED, INVALID_EP, NO_ENTRY or NOT_AUTHORIZED
|
|
1863
|
+
const status: Status = this.readUInt8();
|
|
1864
|
+
|
|
1865
|
+
return [status, undefined];
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* @see ClusterId.CLEAR_ALL_BINDINGS_RESPONSE
|
|
1870
|
+
* @returns No response payload, throws if not success
|
|
1871
|
+
*/
|
|
1872
|
+
public readClearAllBindingsResponse(): ResponseMap[ZdoClusterId.CLEAR_ALL_BINDINGS_RESPONSE] {
|
|
1873
|
+
// NOT_SUPPORTED, NOT_AUTHORIZED, INV_REQUESTTYPE, or NO_MATCH.
|
|
1874
|
+
const status: Status = this.readUInt8();
|
|
1875
|
+
|
|
1876
|
+
return [status, undefined];
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
/**
|
|
1880
|
+
* @see ClusterId.LQI_TABLE_RESPONSE
|
|
1881
|
+
*/
|
|
1882
|
+
public readLQITableResponse(): ResponseMap[ZdoClusterId.LQI_TABLE_RESPONSE] {
|
|
1883
|
+
// NOT_SUPPORTED or any status code returned from the NLME-GET.confirm primitive.
|
|
1884
|
+
const status: Status = this.readUInt8();
|
|
1885
|
+
let result: LQITableResponse | undefined;
|
|
1886
|
+
|
|
1887
|
+
if (status === Status.SUCCESS) {
|
|
1888
|
+
const neighborTableEntries = this.readUInt8();
|
|
1889
|
+
const startIndex = this.readUInt8();
|
|
1890
|
+
// [0x00-0x02]
|
|
1891
|
+
const entryCount = this.readUInt8();
|
|
1892
|
+
const entryList: LQITableEntry[] = [];
|
|
1893
|
+
|
|
1894
|
+
for (let i = 0; i < entryCount; i++) {
|
|
1895
|
+
const extendedPanId = this.readListUInt8(EXTENDED_PAN_ID_SIZE);
|
|
1896
|
+
const eui64 = this.readIeeeAddr();
|
|
1897
|
+
const nwkAddress = this.readUInt16();
|
|
1898
|
+
const deviceTypeByte = this.readUInt8();
|
|
1899
|
+
const permitJoiningByte = this.readUInt8();
|
|
1900
|
+
const depth = this.readUInt8();
|
|
1901
|
+
const lqi = this.readUInt8();
|
|
1902
|
+
|
|
1903
|
+
entryList.push({
|
|
1904
|
+
extendedPanId,
|
|
1905
|
+
eui64,
|
|
1906
|
+
nwkAddress,
|
|
1907
|
+
deviceType: deviceTypeByte & 0x03,
|
|
1908
|
+
rxOnWhenIdle: (deviceTypeByte & 0x0c) >> 2,
|
|
1909
|
+
relationship: (deviceTypeByte & 0x70) >> 4,
|
|
1910
|
+
reserved1: (deviceTypeByte & 0x10) >> 7,
|
|
1911
|
+
permitJoining: permitJoiningByte & 0x03,
|
|
1912
|
+
reserved2: (permitJoiningByte & 0xfc) >> 2,
|
|
1913
|
+
depth,
|
|
1914
|
+
lqi,
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
result = {
|
|
1919
|
+
neighborTableEntries,
|
|
1920
|
+
startIndex,
|
|
1921
|
+
entryList,
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
return [status, result];
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
/**
|
|
1929
|
+
* @see ClusterId.ROUTING_TABLE_RESPONSE
|
|
1930
|
+
*/
|
|
1931
|
+
public readRoutingTableResponse(): ResponseMap[ZdoClusterId.ROUTING_TABLE_RESPONSE] {
|
|
1932
|
+
// NOT_SUPPORTED or any status code returned from the NLMEGET.confirm primitive.
|
|
1933
|
+
const status: Status = this.readUInt8();
|
|
1934
|
+
let result: RoutingTableResponse | undefined;
|
|
1935
|
+
|
|
1936
|
+
if (status === Status.SUCCESS) {
|
|
1937
|
+
const routingTableEntries = this.readUInt8();
|
|
1938
|
+
const startIndex = this.readUInt8();
|
|
1939
|
+
// [0x00-0xFF]
|
|
1940
|
+
const entryCount = this.readUInt8();
|
|
1941
|
+
const entryList: RoutingTableEntry[] = [];
|
|
1942
|
+
|
|
1943
|
+
for (let i = 0; i < entryCount; i++) {
|
|
1944
|
+
const destinationAddress = this.readUInt16();
|
|
1945
|
+
const statusByte = this.readUInt8();
|
|
1946
|
+
const nextHopAddress = this.readUInt16();
|
|
1947
|
+
|
|
1948
|
+
entryList.push({
|
|
1949
|
+
destinationAddress,
|
|
1950
|
+
status: RoutingTableStatus[statusByte & 0x07] as keyof typeof RoutingTableStatus,
|
|
1951
|
+
memoryConstrained: (statusByte & 0x08) >> 3,
|
|
1952
|
+
manyToOne: (statusByte & 0x10) >> 4,
|
|
1953
|
+
routeRecordRequired: (statusByte & 0x20) >> 5,
|
|
1954
|
+
reserved1: (statusByte & 0xc0) >> 6,
|
|
1955
|
+
nextHopAddress,
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
result = {
|
|
1960
|
+
routingTableEntries,
|
|
1961
|
+
startIndex,
|
|
1962
|
+
entryList,
|
|
1963
|
+
};
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
return [status, result];
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* @see ClusterId.BINDING_TABLE_RESPONSE
|
|
1971
|
+
*/
|
|
1972
|
+
public readBindingTableResponse(): ResponseMap[ZdoClusterId.BINDING_TABLE_RESPONSE] {
|
|
1973
|
+
// NOT_SUPPORTED or any status code returned from the APSMEGET.confirm primitive.
|
|
1974
|
+
const status: Status = this.readUInt8();
|
|
1975
|
+
let result: BindingTableResponse | undefined;
|
|
1976
|
+
|
|
1977
|
+
if (status === Status.SUCCESS) {
|
|
1978
|
+
const bindingTableEntries = this.readUInt8();
|
|
1979
|
+
const startIndex = this.readUInt8();
|
|
1980
|
+
// [0x00-0xFF]
|
|
1981
|
+
const entryCount = this.readUInt8();
|
|
1982
|
+
const entryList: BindingTableEntry[] = [];
|
|
1983
|
+
|
|
1984
|
+
for (let i = 0; i < entryCount; i++) {
|
|
1985
|
+
const sourceEui64 = this.readIeeeAddr();
|
|
1986
|
+
const sourceEndpoint = this.readUInt8();
|
|
1987
|
+
const clusterId = this.readUInt16();
|
|
1988
|
+
const destAddrMode = this.readUInt8();
|
|
1989
|
+
const dest = destAddrMode === 0x01 ? this.readUInt16() : destAddrMode === 0x03 ? this.readIeeeAddr() : undefined;
|
|
1990
|
+
const destEndpoint = destAddrMode === 0x03 ? this.readUInt8() : undefined;
|
|
1991
|
+
|
|
1992
|
+
if (dest === undefined) {
|
|
1993
|
+
// not supported (using reserved value)
|
|
1994
|
+
continue;
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
entryList.push({
|
|
1998
|
+
sourceEui64,
|
|
1999
|
+
sourceEndpoint,
|
|
2000
|
+
clusterId,
|
|
2001
|
+
destAddrMode,
|
|
2002
|
+
dest,
|
|
2003
|
+
destEndpoint,
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
result = {
|
|
2008
|
+
bindingTableEntries,
|
|
2009
|
+
startIndex,
|
|
2010
|
+
entryList,
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
return [status, result];
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
/**
|
|
2018
|
+
* @see ClusterId.LEAVE_RESPONSE
|
|
2019
|
+
* @returns No response payload, throws if not success
|
|
2020
|
+
*/
|
|
2021
|
+
public readLeaveResponse(): ResponseMap[ZdoClusterId.LEAVE_RESPONSE] {
|
|
2022
|
+
// NOT_SUPPORTED, NOT_AUTHORIZED or any status code returned from the NLMELEAVE.confirm primitive.
|
|
2023
|
+
const status: Status = this.readUInt8();
|
|
2024
|
+
|
|
2025
|
+
return [status, undefined];
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
/**
|
|
2029
|
+
* @see ClusterId.PERMIT_JOINING_RESPONSE
|
|
2030
|
+
* @returns No response payload, throws if not success
|
|
2031
|
+
*/
|
|
2032
|
+
public readPermitJoiningResponse(): ResponseMap[ZdoClusterId.PERMIT_JOINING_RESPONSE] {
|
|
2033
|
+
// INV_REQUESTTYPE, NOT_AUTHORIZED, or any status code returned from the NLME-PERMIT-JOINING.confirm primitive.
|
|
2034
|
+
const status: Status = this.readUInt8();
|
|
2035
|
+
|
|
2036
|
+
return [status, undefined];
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
/**
|
|
2040
|
+
* @see ClusterId.NWK_UPDATE_RESPONSE
|
|
2041
|
+
*/
|
|
2042
|
+
public readNwkUpdateResponse(): ResponseMap[ZdoClusterId.NWK_UPDATE_RESPONSE] {
|
|
2043
|
+
// INV_REQUESTTYPE, NOT_SUPPORTED, or any status values returned from the MLME-SCAN.confirm primitive
|
|
2044
|
+
const status: Status = this.readUInt8();
|
|
2045
|
+
let result: NwkUpdateResponse | undefined;
|
|
2046
|
+
|
|
2047
|
+
if (status === Status.SUCCESS) {
|
|
2048
|
+
const scannedChannels = this.readUInt32();
|
|
2049
|
+
const totalTransmissions = this.readUInt16();
|
|
2050
|
+
const totalFailures = this.readUInt16();
|
|
2051
|
+
// [0x00-0xFF]
|
|
2052
|
+
const entryCount = this.readUInt8();
|
|
2053
|
+
const entryList = this.readListUInt8(entryCount);
|
|
2054
|
+
|
|
2055
|
+
result = {
|
|
2056
|
+
scannedChannels,
|
|
2057
|
+
totalTransmissions,
|
|
2058
|
+
totalFailures,
|
|
2059
|
+
entryList,
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
return [status, result];
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
/**
|
|
2067
|
+
* @see ClusterId.NWK_ENHANCED_UPDATE_RESPONSE
|
|
2068
|
+
*/
|
|
2069
|
+
public readNwkEnhancedUpdateResponse(): ResponseMap[ZdoClusterId.NWK_ENHANCED_UPDATE_RESPONSE] {
|
|
2070
|
+
// INV_REQUESTTYPE, NOT_SUPPORTED, or any status values returned from the MLME-SCAN.confirm primitive.
|
|
2071
|
+
const status: Status = this.readUInt8();
|
|
2072
|
+
let result: NwkEnhancedUpdateResponse | undefined;
|
|
2073
|
+
|
|
2074
|
+
if (status === Status.SUCCESS) {
|
|
2075
|
+
const scannedChannels = this.readUInt32();
|
|
2076
|
+
const totalTransmissions = this.readUInt16();
|
|
2077
|
+
const totalFailures = this.readUInt16();
|
|
2078
|
+
// [0x00-0xFF]
|
|
2079
|
+
const entryCount = this.readUInt8();
|
|
2080
|
+
const entryList = this.readListUInt8(entryCount);
|
|
2081
|
+
|
|
2082
|
+
result = {
|
|
2083
|
+
scannedChannels,
|
|
2084
|
+
totalTransmissions,
|
|
2085
|
+
totalFailures,
|
|
2086
|
+
entryList,
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
return [status, result];
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
/**
|
|
2094
|
+
* @see ClusterId.NWK_IEEE_JOINING_LIST_REPONSE
|
|
2095
|
+
*/
|
|
2096
|
+
public readNwkIEEEJoiningListResponse(): ResponseMap[ZdoClusterId.NWK_IEEE_JOINING_LIST_RESPONSE] {
|
|
2097
|
+
// INV_REQUESTTYPE, or NOT_SUPPORTED
|
|
2098
|
+
const status: Status = this.readUInt8();
|
|
2099
|
+
let result: NwkIEEEJoiningListResponse | undefined;
|
|
2100
|
+
|
|
2101
|
+
if (status === Status.SUCCESS) {
|
|
2102
|
+
const updateId = this.readUInt8();
|
|
2103
|
+
const joiningPolicy = this.readUInt8();
|
|
2104
|
+
// [0x00-0xFF]
|
|
2105
|
+
const entryListTotal = this.readUInt8();
|
|
2106
|
+
let startIndex: number | undefined;
|
|
2107
|
+
let entryList: Eui64[] | undefined;
|
|
2108
|
+
|
|
2109
|
+
if (entryListTotal > 0) {
|
|
2110
|
+
startIndex = this.readUInt8();
|
|
2111
|
+
const entryCount = this.readUInt8();
|
|
2112
|
+
entryList = [];
|
|
2113
|
+
|
|
2114
|
+
for (let i = 0; i < entryCount; i++) {
|
|
2115
|
+
const ieee = this.readIeeeAddr();
|
|
2116
|
+
|
|
2117
|
+
entryList.push(ieee);
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
result = {
|
|
2122
|
+
updateId,
|
|
2123
|
+
joiningPolicy,
|
|
2124
|
+
entryListTotal,
|
|
2125
|
+
startIndex,
|
|
2126
|
+
entryList,
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
return [status, result];
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
/**
|
|
2134
|
+
* @see ClusterId.NWK_UNSOLICITED_ENHANCED_UPDATE_RESPONSE
|
|
2135
|
+
*/
|
|
2136
|
+
public readNwkUnsolicitedEnhancedUpdateResponse(): ResponseMap[ZdoClusterId.NWK_UNSOLICITED_ENHANCED_UPDATE_RESPONSE] {
|
|
2137
|
+
// ??
|
|
2138
|
+
const status: Status = this.readUInt8();
|
|
2139
|
+
let result: NwkUnsolicitedEnhancedUpdateResponse | undefined;
|
|
2140
|
+
|
|
2141
|
+
if (status === Status.SUCCESS) {
|
|
2142
|
+
const channelInUse = this.readUInt32();
|
|
2143
|
+
const macTxUCastTotal = this.readUInt16();
|
|
2144
|
+
const macTxUCastFailures = this.readUInt16();
|
|
2145
|
+
const macTxUCastRetries = this.readUInt16();
|
|
2146
|
+
const timePeriod = this.readUInt8();
|
|
2147
|
+
|
|
2148
|
+
result = {
|
|
2149
|
+
channelInUse,
|
|
2150
|
+
macTxUCastTotal,
|
|
2151
|
+
macTxUCastFailures,
|
|
2152
|
+
macTxUCastRetries,
|
|
2153
|
+
timePeriod,
|
|
2154
|
+
};
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
return [status, result];
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
/**
|
|
2161
|
+
* @see ClusterId.NWK_BEACON_SURVEY_RESPONSE
|
|
2162
|
+
*/
|
|
2163
|
+
public readNwkBeaconSurveyResponse(): ResponseMap[ZdoClusterId.NWK_BEACON_SURVEY_RESPONSE] {
|
|
2164
|
+
// INV_REQUESTTYPE, or NOT_SUPPORTED
|
|
2165
|
+
const status: Status = this.readUInt8();
|
|
2166
|
+
let result: NwkBeaconSurveyResponse | undefined;
|
|
2167
|
+
|
|
2168
|
+
if (status === Status.SUCCESS) {
|
|
2169
|
+
const localTLVs = new Map<number, LocalTLVReader>([
|
|
2170
|
+
// Local: ID: 0x01: BeaconSurveyResultsTLV
|
|
2171
|
+
[0x01, this.readBeaconSurveyResultsTLV],
|
|
2172
|
+
// Local: ID: 0x02: PotentialParentsTLV
|
|
2173
|
+
[0x02, this.readPotentialParentsTLV],
|
|
2174
|
+
]);
|
|
2175
|
+
const tlvs: Tlv[] = this.readTLVs(localTLVs);
|
|
2176
|
+
|
|
2177
|
+
result = {
|
|
2178
|
+
tlvs,
|
|
2179
|
+
};
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2182
|
+
return [status, result];
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* @see ClusterId.START_KEY_NEGOTIATION_RESPONSE
|
|
2187
|
+
*/
|
|
2188
|
+
public readStartKeyNegotiationResponse(): ResponseMap[ZdoClusterId.START_KEY_NEGOTIATION_RESPONSE] {
|
|
2189
|
+
// INVALID_TLV, MISSING_TLV, TEMPORARY_FAILURE, NOT_AUTHORIZED
|
|
2190
|
+
const status: Status = this.readUInt8();
|
|
2191
|
+
let result: StartKeyNegotiationResponse | undefined;
|
|
2192
|
+
|
|
2193
|
+
if (status === Status.SUCCESS) {
|
|
2194
|
+
const localTLVs = new Map<number, LocalTLVReader>([
|
|
2195
|
+
// Local: ID: 0x00: Curve25519PublicPointTLV
|
|
2196
|
+
[0x00, this.readCurve25519PublicPointTLV],
|
|
2197
|
+
]);
|
|
2198
|
+
const tlvs: Tlv[] = this.readTLVs(localTLVs);
|
|
2199
|
+
|
|
2200
|
+
result = {
|
|
2201
|
+
tlvs,
|
|
2202
|
+
};
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
return [status, result];
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
/**
|
|
2209
|
+
* @see ClusterId.RETRIEVE_AUTHENTICATION_TOKEN_RESPONSE
|
|
2210
|
+
*/
|
|
2211
|
+
public readRetrieveAuthenticationTokenResponse(): ResponseMap[ZdoClusterId.RETRIEVE_AUTHENTICATION_TOKEN_RESPONSE] {
|
|
2212
|
+
const status: Status = this.readUInt8();
|
|
2213
|
+
let result: RetrieveAuthenticationTokenResponse | undefined;
|
|
2214
|
+
|
|
2215
|
+
if (status === Status.SUCCESS) {
|
|
2216
|
+
// no local TLV
|
|
2217
|
+
const tlvs: Tlv[] = this.readTLVs();
|
|
2218
|
+
|
|
2219
|
+
result = {
|
|
2220
|
+
tlvs,
|
|
2221
|
+
};
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
return [status, result];
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
/**
|
|
2228
|
+
* @see ClusterId.GET_AUTHENTICATION_LEVEL_RESPONSE
|
|
2229
|
+
*/
|
|
2230
|
+
public readGetAuthenticationLevelResponse(): ResponseMap[ZdoClusterId.GET_AUTHENTICATION_LEVEL_RESPONSE] {
|
|
2231
|
+
// NOT_SUPPORTED, INV_REQUESTTYPE, MISSING_TLV, and NOT_AUTHORIZED
|
|
2232
|
+
const status: Status = this.readUInt8();
|
|
2233
|
+
let result: GetAuthenticationLevelResponse | undefined;
|
|
2234
|
+
|
|
2235
|
+
if (status === Status.SUCCESS) {
|
|
2236
|
+
const localTLVs = new Map<number, LocalTLVReader>([
|
|
2237
|
+
// Local: ID: 0x00: DeviceAuthenticationLevelTLV
|
|
2238
|
+
[0x00, this.readDeviceAuthenticationLevelTLV],
|
|
2239
|
+
]);
|
|
2240
|
+
const tlvs: Tlv[] = this.readTLVs(localTLVs);
|
|
2241
|
+
|
|
2242
|
+
result = {
|
|
2243
|
+
tlvs,
|
|
2244
|
+
};
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
return [status, result];
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
/**
|
|
2251
|
+
* @see ClusterId.SET_CONFIGURATION_RESPONSE
|
|
2252
|
+
*/
|
|
2253
|
+
public readSetConfigurationResponse(): ResponseMap[ZdoClusterId.SET_CONFIGURATION_RESPONSE] {
|
|
2254
|
+
// INV_REQUESTTYPE, or NOT_SUPPORTED
|
|
2255
|
+
const status: Status = this.readUInt8();
|
|
2256
|
+
let result: SetConfigurationResponse | undefined;
|
|
2257
|
+
|
|
2258
|
+
if (status === Status.SUCCESS) {
|
|
2259
|
+
const localTLVs = new Map<number, LocalTLVReader>([
|
|
2260
|
+
// Local: ID: 0x00: ProcessingStatusTLV
|
|
2261
|
+
[0x00, this.readProcessingStatusTLV],
|
|
2262
|
+
]);
|
|
2263
|
+
const tlvs: Tlv[] = this.readTLVs(localTLVs);
|
|
2264
|
+
|
|
2265
|
+
result = {
|
|
2266
|
+
tlvs,
|
|
2267
|
+
};
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
return [status, result];
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
/**
|
|
2274
|
+
* @see ClusterId.GET_CONFIGURATION_RESPONSE
|
|
2275
|
+
*/
|
|
2276
|
+
public readGetConfigurationResponse(): ResponseMap[ZdoClusterId.GET_CONFIGURATION_RESPONSE] {
|
|
2277
|
+
// INV_REQUESTTYPE, or NOT_SUPPORTED
|
|
2278
|
+
const status: Status = this.readUInt8();
|
|
2279
|
+
let result: GetConfigurationResponse | undefined;
|
|
2280
|
+
|
|
2281
|
+
if (status === Status.SUCCESS) {
|
|
2282
|
+
// Global: IDs: x, y, z
|
|
2283
|
+
const tlvs: Tlv[] = this.readTLVs();
|
|
2284
|
+
|
|
2285
|
+
result = {
|
|
2286
|
+
tlvs,
|
|
2287
|
+
};
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
return [status, result];
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
/**
|
|
2294
|
+
* @see ClusterId.START_KEY_UPDATE_RESPONSE
|
|
2295
|
+
* @returns No response payload, throws if not success
|
|
2296
|
+
*/
|
|
2297
|
+
public readStartKeyUpdateResponse(): ResponseMap[ZdoClusterId.START_KEY_UPDATE_RESPONSE] {
|
|
2298
|
+
// INV_REQUESTTYPE, NOT_AUTHORIZED or NOT_SUPPORTED
|
|
2299
|
+
const status: Status = this.readUInt8();
|
|
2300
|
+
|
|
2301
|
+
return [status, undefined];
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
/**
|
|
2305
|
+
* @see ClusterId.DECOMMISSION_RESPONSE
|
|
2306
|
+
* @returns No response payload, throws if not success
|
|
2307
|
+
*/
|
|
2308
|
+
public readDecommissionResponse(): ResponseMap[ZdoClusterId.DECOMMISSION_RESPONSE] {
|
|
2309
|
+
// INV_REQUESTTYPE, NOT_AUTHORIZED or NOT_SUPPORTED
|
|
2310
|
+
const status: Status = this.readUInt8();
|
|
2311
|
+
|
|
2312
|
+
return [status, undefined];
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
/**
|
|
2316
|
+
* @see ClusterId.CHALLENGE_RESPONSE
|
|
2317
|
+
*/
|
|
2318
|
+
public readChallengeResponse(): ResponseMap[ZdoClusterId.CHALLENGE_RESPONSE] {
|
|
2319
|
+
const status: Status = this.readUInt8();
|
|
2320
|
+
let result: ChallengeResponse | undefined;
|
|
2321
|
+
|
|
2322
|
+
if (status === Status.SUCCESS) {
|
|
2323
|
+
const localTLVs = new Map<number, LocalTLVReader>([
|
|
2324
|
+
// Local: ID: 0x00: APSFrameCounterResponseTLV
|
|
2325
|
+
[0x00, this.readAPSFrameCounterResponseTLV],
|
|
2326
|
+
]);
|
|
2327
|
+
const tlvs: Tlv[] = this.readTLVs(localTLVs);
|
|
2328
|
+
|
|
2329
|
+
result = {
|
|
2330
|
+
tlvs,
|
|
2331
|
+
};
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
return [status, result];
|
|
2335
|
+
}
|
|
2336
|
+
}
|