zigbee-herdsman 6.0.1 → 6.0.3

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.
Files changed (260) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/adapter/ezsp/driver/uart.js +1 -1
  3. package/dist/adapter/ezsp/driver/uart.js.map +1 -1
  4. package/dist/adapter/z-stack/adapter/zStackAdapter.js +4 -4
  5. package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
  6. package/dist/adapter/zigate/adapter/zigateAdapter.js +4 -4
  7. package/dist/adapter/zigate/adapter/zigateAdapter.js.map +1 -1
  8. package/dist/controller/model/device.d.ts.map +1 -1
  9. package/dist/controller/model/device.js +1 -0
  10. package/dist/controller/model/device.js.map +1 -1
  11. package/package.json +14 -6
  12. package/.github/ISSUE_TEMPLATE/config.yml +0 -5
  13. package/.github/dependabot.yml +0 -22
  14. package/.github/workflows/ci.yml +0 -64
  15. package/.github/workflows/release-please.yml +0 -18
  16. package/.github/workflows/stale.yml +0 -20
  17. package/.github/workflows/typedoc.yaml +0 -47
  18. package/.release-please-manifest.json +0 -3
  19. package/.vscode/extensions.json +0 -3
  20. package/.vscode/settings.json +0 -11
  21. package/biome.json +0 -98
  22. package/examples/join-and-log.js +0 -24
  23. package/release-please-config.json +0 -9
  24. package/src/adapter/adapter.ts +0 -189
  25. package/src/adapter/adapterDiscovery.ts +0 -666
  26. package/src/adapter/const.ts +0 -12
  27. package/src/adapter/deconz/adapter/deconzAdapter.ts +0 -877
  28. package/src/adapter/deconz/driver/constants.ts +0 -246
  29. package/src/adapter/deconz/driver/driver.ts +0 -1540
  30. package/src/adapter/deconz/driver/frame.ts +0 -11
  31. package/src/adapter/deconz/driver/frameParser.ts +0 -753
  32. package/src/adapter/deconz/driver/parser.ts +0 -45
  33. package/src/adapter/deconz/driver/writer.ts +0 -22
  34. package/src/adapter/deconz/types.d.ts +0 -13
  35. package/src/adapter/ember/adapter/emberAdapter.ts +0 -2265
  36. package/src/adapter/ember/adapter/endpoints.ts +0 -86
  37. package/src/adapter/ember/adapter/oneWaitress.ts +0 -324
  38. package/src/adapter/ember/adapter/tokensManager.ts +0 -782
  39. package/src/adapter/ember/consts.ts +0 -178
  40. package/src/adapter/ember/enums.ts +0 -1746
  41. package/src/adapter/ember/ezsp/buffalo.ts +0 -1392
  42. package/src/adapter/ember/ezsp/consts.ts +0 -148
  43. package/src/adapter/ember/ezsp/enums.ts +0 -1114
  44. package/src/adapter/ember/ezsp/ezsp.ts +0 -9061
  45. package/src/adapter/ember/ezspError.ts +0 -10
  46. package/src/adapter/ember/types.ts +0 -866
  47. package/src/adapter/ember/uart/ash.ts +0 -1960
  48. package/src/adapter/ember/uart/consts.ts +0 -109
  49. package/src/adapter/ember/uart/enums.ts +0 -192
  50. package/src/adapter/ember/uart/parser.ts +0 -48
  51. package/src/adapter/ember/uart/queues.ts +0 -247
  52. package/src/adapter/ember/uart/writer.ts +0 -53
  53. package/src/adapter/ember/utils/initters.ts +0 -58
  54. package/src/adapter/ember/utils/math.ts +0 -73
  55. package/src/adapter/events.ts +0 -21
  56. package/src/adapter/ezsp/adapter/backup.ts +0 -109
  57. package/src/adapter/ezsp/adapter/ezspAdapter.ts +0 -614
  58. package/src/adapter/ezsp/driver/commands.ts +0 -2497
  59. package/src/adapter/ezsp/driver/consts.ts +0 -11
  60. package/src/adapter/ezsp/driver/driver.ts +0 -1002
  61. package/src/adapter/ezsp/driver/ezsp.ts +0 -802
  62. package/src/adapter/ezsp/driver/frame.ts +0 -101
  63. package/src/adapter/ezsp/driver/index.ts +0 -4
  64. package/src/adapter/ezsp/driver/multicast.ts +0 -78
  65. package/src/adapter/ezsp/driver/parser.ts +0 -81
  66. package/src/adapter/ezsp/driver/types/basic.ts +0 -201
  67. package/src/adapter/ezsp/driver/types/index.ts +0 -239
  68. package/src/adapter/ezsp/driver/types/named.ts +0 -2330
  69. package/src/adapter/ezsp/driver/types/struct.ts +0 -844
  70. package/src/adapter/ezsp/driver/uart.ts +0 -460
  71. package/src/adapter/ezsp/driver/utils/crc16ccitt.ts +0 -44
  72. package/src/adapter/ezsp/driver/utils/index.ts +0 -32
  73. package/src/adapter/ezsp/driver/writer.ts +0 -64
  74. package/src/adapter/index.ts +0 -3
  75. package/src/adapter/serialPort.ts +0 -58
  76. package/src/adapter/socketPortUtils.ts +0 -16
  77. package/src/adapter/tstype.ts +0 -78
  78. package/src/adapter/z-stack/adapter/adapter-backup.ts +0 -519
  79. package/src/adapter/z-stack/adapter/adapter-nv-memory.ts +0 -457
  80. package/src/adapter/z-stack/adapter/endpoints.ts +0 -57
  81. package/src/adapter/z-stack/adapter/manager.ts +0 -543
  82. package/src/adapter/z-stack/adapter/tstype.ts +0 -6
  83. package/src/adapter/z-stack/adapter/zStackAdapter.ts +0 -1190
  84. package/src/adapter/z-stack/constants/af.ts +0 -27
  85. package/src/adapter/z-stack/constants/common.ts +0 -285
  86. package/src/adapter/z-stack/constants/dbg.ts +0 -23
  87. package/src/adapter/z-stack/constants/index.ts +0 -11
  88. package/src/adapter/z-stack/constants/mac.ts +0 -128
  89. package/src/adapter/z-stack/constants/sapi.ts +0 -25
  90. package/src/adapter/z-stack/constants/sys.ts +0 -72
  91. package/src/adapter/z-stack/constants/util.ts +0 -82
  92. package/src/adapter/z-stack/constants/utils.ts +0 -14
  93. package/src/adapter/z-stack/constants/zdo.ts +0 -103
  94. package/src/adapter/z-stack/models/startup-options.ts +0 -13
  95. package/src/adapter/z-stack/structs/entries/address-manager-entry.ts +0 -44
  96. package/src/adapter/z-stack/structs/entries/address-manager-table.ts +0 -19
  97. package/src/adapter/z-stack/structs/entries/aps-link-key-data-entry.ts +0 -12
  98. package/src/adapter/z-stack/structs/entries/aps-link-key-data-table.ts +0 -21
  99. package/src/adapter/z-stack/structs/entries/aps-tc-link-key-entry.ts +0 -19
  100. package/src/adapter/z-stack/structs/entries/aps-tc-link-key-table.ts +0 -21
  101. package/src/adapter/z-stack/structs/entries/channel-list.ts +0 -8
  102. package/src/adapter/z-stack/structs/entries/has-configured.ts +0 -16
  103. package/src/adapter/z-stack/structs/entries/index.ts +0 -16
  104. package/src/adapter/z-stack/structs/entries/nib.ts +0 -66
  105. package/src/adapter/z-stack/structs/entries/nwk-key-descriptor.ts +0 -15
  106. package/src/adapter/z-stack/structs/entries/nwk-key.ts +0 -13
  107. package/src/adapter/z-stack/structs/entries/nwk-pan-id.ts +0 -8
  108. package/src/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.ts +0 -20
  109. package/src/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.ts +0 -19
  110. package/src/adapter/z-stack/structs/entries/security-manager-entry.ts +0 -33
  111. package/src/adapter/z-stack/structs/entries/security-manager-table.ts +0 -22
  112. package/src/adapter/z-stack/structs/index.ts +0 -4
  113. package/src/adapter/z-stack/structs/serializable-memory-object.ts +0 -14
  114. package/src/adapter/z-stack/structs/struct.ts +0 -367
  115. package/src/adapter/z-stack/structs/table.ts +0 -198
  116. package/src/adapter/z-stack/unpi/constants.ts +0 -33
  117. package/src/adapter/z-stack/unpi/frame.ts +0 -62
  118. package/src/adapter/z-stack/unpi/index.ts +0 -4
  119. package/src/adapter/z-stack/unpi/parser.ts +0 -56
  120. package/src/adapter/z-stack/unpi/writer.ts +0 -21
  121. package/src/adapter/z-stack/utils/channel-list.ts +0 -40
  122. package/src/adapter/z-stack/utils/index.ts +0 -2
  123. package/src/adapter/z-stack/utils/network-options.ts +0 -26
  124. package/src/adapter/z-stack/znp/buffaloZnp.ts +0 -175
  125. package/src/adapter/z-stack/znp/definition.ts +0 -2713
  126. package/src/adapter/z-stack/znp/index.ts +0 -2
  127. package/src/adapter/z-stack/znp/parameterType.ts +0 -22
  128. package/src/adapter/z-stack/znp/tstype.ts +0 -44
  129. package/src/adapter/z-stack/znp/utils.ts +0 -10
  130. package/src/adapter/z-stack/znp/znp.ts +0 -342
  131. package/src/adapter/z-stack/znp/zpiObject.ts +0 -148
  132. package/src/adapter/zboss/adapter/zbossAdapter.ts +0 -526
  133. package/src/adapter/zboss/commands.ts +0 -1184
  134. package/src/adapter/zboss/consts.ts +0 -9
  135. package/src/adapter/zboss/driver.ts +0 -422
  136. package/src/adapter/zboss/enums.ts +0 -360
  137. package/src/adapter/zboss/frame.ts +0 -227
  138. package/src/adapter/zboss/reader.ts +0 -65
  139. package/src/adapter/zboss/types.ts +0 -0
  140. package/src/adapter/zboss/uart.ts +0 -428
  141. package/src/adapter/zboss/utils.ts +0 -58
  142. package/src/adapter/zboss/writer.ts +0 -49
  143. package/src/adapter/zigate/adapter/patchZdoBuffaloBE.ts +0 -27
  144. package/src/adapter/zigate/adapter/zigateAdapter.ts +0 -618
  145. package/src/adapter/zigate/driver/LICENSE +0 -17
  146. package/src/adapter/zigate/driver/buffaloZiGate.ts +0 -212
  147. package/src/adapter/zigate/driver/commandType.ts +0 -418
  148. package/src/adapter/zigate/driver/constants.ts +0 -150
  149. package/src/adapter/zigate/driver/frame.ts +0 -197
  150. package/src/adapter/zigate/driver/messageType.ts +0 -287
  151. package/src/adapter/zigate/driver/parameterType.ts +0 -32
  152. package/src/adapter/zigate/driver/ziGateObject.ts +0 -146
  153. package/src/adapter/zigate/driver/zigate.ts +0 -423
  154. package/src/adapter/zoh/adapter/utils.ts +0 -27
  155. package/src/adapter/zoh/adapter/zohAdapter.ts +0 -838
  156. package/src/buffalo/buffalo.ts +0 -342
  157. package/src/buffalo/index.ts +0 -1
  158. package/src/controller/controller.ts +0 -1022
  159. package/src/controller/database.ts +0 -124
  160. package/src/controller/events.ts +0 -52
  161. package/src/controller/greenPower.ts +0 -603
  162. package/src/controller/helpers/index.ts +0 -1
  163. package/src/controller/helpers/installCodes.ts +0 -107
  164. package/src/controller/helpers/request.ts +0 -96
  165. package/src/controller/helpers/requestQueue.ts +0 -125
  166. package/src/controller/helpers/zclFrameConverter.ts +0 -47
  167. package/src/controller/helpers/zclTransactionSequenceNumber.ts +0 -19
  168. package/src/controller/index.ts +0 -6
  169. package/src/controller/model/device.ts +0 -1248
  170. package/src/controller/model/endpoint.ts +0 -1105
  171. package/src/controller/model/entity.ts +0 -23
  172. package/src/controller/model/group.ts +0 -424
  173. package/src/controller/model/index.ts +0 -5
  174. package/src/controller/model/zigbeeEntity.ts +0 -30
  175. package/src/controller/touchlink.ts +0 -189
  176. package/src/controller/tstype.ts +0 -274
  177. package/src/index.ts +0 -12
  178. package/src/models/backup-storage-legacy.ts +0 -48
  179. package/src/models/backup-storage-unified.ts +0 -47
  180. package/src/models/backup.ts +0 -37
  181. package/src/models/index.ts +0 -5
  182. package/src/models/network-options.ts +0 -11
  183. package/src/utils/backup.ts +0 -152
  184. package/src/utils/index.ts +0 -5
  185. package/src/utils/logger.ts +0 -20
  186. package/src/utils/patchBigIntSerialization.ts +0 -8
  187. package/src/utils/queue.ts +0 -76
  188. package/src/utils/types.d.ts +0 -3
  189. package/src/utils/utils.ts +0 -19
  190. package/src/utils/wait.ts +0 -5
  191. package/src/utils/waitress.ts +0 -96
  192. package/src/zspec/consts.ts +0 -84
  193. package/src/zspec/enums.ts +0 -22
  194. package/src/zspec/index.ts +0 -3
  195. package/src/zspec/tstypes.ts +0 -18
  196. package/src/zspec/utils.ts +0 -247
  197. package/src/zspec/zcl/buffaloZcl.ts +0 -1220
  198. package/src/zspec/zcl/definition/cluster.ts +0 -5915
  199. package/src/zspec/zcl/definition/clusters-typegen.ts +0 -588
  200. package/src/zspec/zcl/definition/clusters-types.ts +0 -7331
  201. package/src/zspec/zcl/definition/consts.ts +0 -24
  202. package/src/zspec/zcl/definition/enums.ts +0 -203
  203. package/src/zspec/zcl/definition/foundation.ts +0 -329
  204. package/src/zspec/zcl/definition/manufacturerCode.ts +0 -729
  205. package/src/zspec/zcl/definition/status.ts +0 -69
  206. package/src/zspec/zcl/definition/tstype.ts +0 -377
  207. package/src/zspec/zcl/index.ts +0 -11
  208. package/src/zspec/zcl/utils.ts +0 -321
  209. package/src/zspec/zcl/zclFrame.ts +0 -356
  210. package/src/zspec/zcl/zclHeader.ts +0 -102
  211. package/src/zspec/zcl/zclStatusError.ts +0 -10
  212. package/src/zspec/zdo/buffaloZdo.ts +0 -2336
  213. package/src/zspec/zdo/definition/clusters.ts +0 -722
  214. package/src/zspec/zdo/definition/consts.ts +0 -16
  215. package/src/zspec/zdo/definition/enums.ts +0 -99
  216. package/src/zspec/zdo/definition/status.ts +0 -105
  217. package/src/zspec/zdo/definition/tstypes.ts +0 -1062
  218. package/src/zspec/zdo/index.ts +0 -7
  219. package/src/zspec/zdo/utils.ts +0 -76
  220. package/src/zspec/zdo/zdoStatusError.ts +0 -10
  221. package/test/adapter/adapter.test.ts +0 -1062
  222. package/test/adapter/ember/ash.test.ts +0 -337
  223. package/test/adapter/ember/consts.ts +0 -131
  224. package/test/adapter/ember/emberAdapter.test.ts +0 -3449
  225. package/test/adapter/ember/ezsp.test.ts +0 -385
  226. package/test/adapter/ember/ezspBuffalo.test.ts +0 -93
  227. package/test/adapter/ember/ezspError.test.ts +0 -12
  228. package/test/adapter/ember/math.test.ts +0 -206
  229. package/test/adapter/ezsp/frame.test.ts +0 -30
  230. package/test/adapter/ezsp/uart.test.ts +0 -181
  231. package/test/adapter/z-stack/adapter.test.ts +0 -3984
  232. package/test/adapter/z-stack/constants.test.ts +0 -33
  233. package/test/adapter/z-stack/structs.test.ts +0 -115
  234. package/test/adapter/z-stack/unpi.test.ts +0 -213
  235. package/test/adapter/z-stack/znp.test.ts +0 -1284
  236. package/test/adapter/zboss/fixZdoResponse.test.ts +0 -179
  237. package/test/adapter/zigate/patchZdoBuffaloBE.test.ts +0 -81
  238. package/test/adapter/zigate/zdo.test.ts +0 -187
  239. package/test/adapter/zoh/utils.test.ts +0 -36
  240. package/test/adapter/zoh/zohAdapter.test.ts +0 -1307
  241. package/test/buffalo.test.ts +0 -431
  242. package/test/controller.bench.ts +0 -193
  243. package/test/controller.test.ts +0 -8702
  244. package/test/greenpower.test.ts +0 -1408
  245. package/test/mockAdapters.ts +0 -65
  246. package/test/mockDevices.ts +0 -598
  247. package/test/requests.bench.ts +0 -206
  248. package/test/testUtils.ts +0 -20
  249. package/test/tsconfig.json +0 -9
  250. package/test/utils/math.ts +0 -19
  251. package/test/utils.test.ts +0 -279
  252. package/test/vitest.config.mts +0 -27
  253. package/test/zcl.test.ts +0 -2831
  254. package/test/zspec/utils.test.ts +0 -68
  255. package/test/zspec/zcl/buffalo.test.ts +0 -1374
  256. package/test/zspec/zcl/frame.test.ts +0 -960
  257. package/test/zspec/zcl/utils.test.ts +0 -273
  258. package/test/zspec/zdo/buffalo.test.ts +0 -1850
  259. package/test/zspec/zdo/utils.test.ts +0 -241
  260. package/tsconfig.json +0 -24
@@ -1,103 +0,0 @@
1
- const ZDO = {
2
- status: {
3
- SUCCESS: 0,
4
- INVALID_REQTYPE: 128,
5
- DEVICE_NOT_FOUND: 129,
6
- INVALID_EP: 130,
7
- NOT_ACTIVE: 131,
8
- NOT_SUPPORTED: 132,
9
- TIMEOUT: 133,
10
- NO_MATCH: 134,
11
- NO_ENTRY: 136,
12
- NO_DESCRIPTOR: 137,
13
- INSUFFICIENT_SPACE: 138,
14
- NOT_PERMITTED: 139,
15
- TABLE_FULL: 140,
16
- NOT_AUTHORIZED: 141,
17
- BINDING_TABLE_FULL: 142,
18
- },
19
- initDev: {
20
- RESTORED_NETWORK_STATE: 0,
21
- NEW_NETWORK_STATE: 1,
22
- LEAVE_NOT_STARTED: 2,
23
- },
24
- serverCapability: {
25
- NOT_SUPPORTED: 0,
26
- PRIM_TRUST_CENTER: 1,
27
- BKUP_TRUST_CENTER: 2,
28
- PRIM_BIND_TABLE: 4,
29
- BKUP_BIND_TABLE: 8,
30
- PRIM_DISC_TABLE: 16,
31
- BKUP_DISC_TABLE: 32,
32
- NETWORK_MANAGER: 64,
33
- },
34
- appDevVer: {
35
- VER_100: 0,
36
- RESERVE01: 1,
37
- RESERVE02: 2,
38
- RESERVE03: 3,
39
- RESERVE04: 4,
40
- RESERVE05: 5,
41
- RESERVE06: 6,
42
- RESERVE07: 7,
43
- RESERVE08: 8,
44
- RESERVE09: 9,
45
- RESERVE10: 10,
46
- RESERVE11: 11,
47
- RESERVE12: 12,
48
- RESERVE13: 13,
49
- RESERVE14: 14,
50
- RESERVE15: 15,
51
- },
52
- stackProfileId: {
53
- NETWORK_SPECIFIC: 0,
54
- HOME_CONTROLS: 1,
55
- ZIGBEEPRO_PROFILE: 2,
56
- GENERIC_STAR: 3,
57
- GENERIC_TREE: 4,
58
- },
59
- deviceLogicalType: {
60
- COORDINATOR: 0,
61
- ROUTER: 1,
62
- ENDDEVICE: 2,
63
- COMPLEX_DESC_AVAIL: 4,
64
- USER_DESC_AVAIL: 8,
65
- RESERVED1: 16,
66
- RESERVED2: 32,
67
- RESERVED3: 64,
68
- RESERVED4: 128,
69
- },
70
- addrReqType: {
71
- SINGLE: 0,
72
- EXTENDED: 1,
73
- },
74
- leaveAndRemoveChild: {
75
- NONE: 0,
76
- LEAVE_REMOVE_CHILDREN: 1,
77
- },
78
- leaveIndRequest: {
79
- INDICATION: 0,
80
- REQUEST: 1,
81
- },
82
- leaveIndRemove: {
83
- NONE: 0,
84
- REMOVE_CHILDREN: 1,
85
- },
86
- leaveIndRejoin: {
87
- NONE: 0,
88
- REJOIN: 1,
89
- },
90
- descCapability: {
91
- EXT_LIST_NOT_SUPPORTED: 0,
92
- EXT_ACTIVE_EP_LIST_AVAIL: 1,
93
- EXT_SIMPLE_DESC_LIST_AVAIL: 2,
94
- RESERVED1: 4,
95
- RESERVED2: 8,
96
- RESERVED3: 16,
97
- RESERVED4: 32,
98
- RESERVED5: 64,
99
- RESERVED6: 128,
100
- },
101
- };
102
-
103
- export default ZDO;
@@ -1,13 +0,0 @@
1
- import type {TsType} from "../../";
2
- import type {ZnpVersion} from "../adapter/tstype";
3
-
4
- /**
5
- * Startup options structure is used by `zStackAdapter` to pass configuration to adapter manager.
6
- */
7
- export interface StartupOptions {
8
- version: ZnpVersion;
9
- networkOptions: TsType.NetworkOptions;
10
- greenPowerGroup: number;
11
- backupPath: string;
12
- adapterOptions: TsType.AdapterOptions;
13
- }
@@ -1,44 +0,0 @@
1
- import {Struct} from "../struct";
2
-
3
- /**
4
- * Address manager entry flags present in `user` field.
5
- *
6
- * *Definition from Z-Stack 3.0.2 `ADdrMgr.h`*
7
- */
8
- export enum AddressManagerUser {
9
- /* ADDRMGR_USER_DEFAULT */
10
- Default = 0x00,
11
-
12
- /* ADDRMGR_USER_ASSOC */
13
- Assoc = 0x01,
14
-
15
- /* ADDRMGR_USER_SECURITY */
16
- Security = 0x02,
17
-
18
- /* ADDRMGR_USER_BINDING */
19
- Binding = 0x04,
20
-
21
- /* ADDRMGR_USER_PRIVATE1 */
22
- Private1 = 0x08,
23
- }
24
-
25
- const emptyAddress1 = Buffer.alloc(8, 0x00);
26
- const emptyAddress2 = Buffer.alloc(8, 0xff);
27
-
28
- /**
29
- * Creates an address manager entry.
30
- *
31
- * *Definition from Z-Stack 3.0.2 `AddrMgr.h`*
32
- * *The `uint16` index field is not physically present.*
33
- *
34
- * @param data Data to initialize structure with.
35
- */
36
- export const addressManagerEntry = (data?: Buffer) => {
37
- return Struct.new()
38
- .member("uint8", "user")
39
- .member("uint16", "nwkAddr")
40
- .member("uint8array-reversed", "extAddr", 8)
41
- .method("isSet", Boolean.prototype, (e) => e.user !== 0x00 && !e.extAddr.equals(emptyAddress1) && !e.extAddr.equals(emptyAddress2))
42
- .padding(0xff)
43
- .build(data);
44
- };
@@ -1,19 +0,0 @@
1
- import assert from "node:assert";
2
-
3
- import type {StructMemoryAlignment} from "../struct";
4
- import {Table} from "../table";
5
- import {addressManagerEntry} from "./address-manager-entry";
6
-
7
- /**
8
- * Creates an address manager inline table present within Z-Stack NV memory.
9
- *
10
- * @param data Data to initialize table with.
11
- * @param alignment Memory alignment of initialization data.
12
- */
13
- export const addressManagerTable = (dataOrCapacity?: Buffer | Buffer[] | number, alignment: StructMemoryAlignment = "unaligned") => {
14
- const table = Table.new<ReturnType<typeof addressManagerEntry>>()
15
- .struct(addressManagerEntry)
16
- .occupancy((e) => e.isSet() as boolean);
17
- assert(dataOrCapacity !== undefined, "dataOrCapacity cannot be undefined");
18
- return typeof dataOrCapacity === "number" ? table.build(dataOrCapacity) : table.build(dataOrCapacity, alignment);
19
- };
@@ -1,12 +0,0 @@
1
- import {Struct} from "../struct";
2
-
3
- /**
4
- * Creates a APS Link Key Data Entry.
5
- *
6
- * *Definition from Z-Stack 3.0.2 `APSMEDE.h`*
7
- *
8
- * @param data Data to initialize structure with.
9
- */
10
- export const apsLinkKeyDataEntry = (data?: Buffer) => {
11
- return Struct.new().member("uint8array", "key", 16).member("uint32", "txFrmCntr").member("uint32", "rxFrmCntr").build(data);
12
- };
@@ -1,21 +0,0 @@
1
- import assert from "node:assert";
2
-
3
- import type {StructMemoryAlignment} from "../struct";
4
- import {Table} from "../table";
5
- import {apsLinkKeyDataEntry} from "./aps-link-key-data-entry";
6
-
7
- const emptyKey = Buffer.alloc(16, 0x00);
8
-
9
- /**
10
- * Creates an APS link key data table.
11
- *
12
- * @param data Data to initialize table with.
13
- * @param alignment Memory alignment of initialization data.
14
- */
15
- export const apsLinkKeyDataTable = (dataOrCapacity?: Buffer | Buffer[] | number, alignment: StructMemoryAlignment = "unaligned") => {
16
- const table = Table.new<ReturnType<typeof apsLinkKeyDataEntry>>()
17
- .struct(apsLinkKeyDataEntry)
18
- .occupancy((e) => !e.key.equals(emptyKey));
19
- assert(dataOrCapacity !== undefined, "dataOrCapacity cannot be undefined");
20
- return typeof dataOrCapacity === "number" ? table.build(dataOrCapacity) : table.build(dataOrCapacity, alignment);
21
- };
@@ -1,19 +0,0 @@
1
- import {Struct} from "../struct";
2
-
3
- /**
4
- * Creates a APS ME Trust Center Link Key NV Entry struct.
5
- *
6
- * *Definition from Z-Stack 3.0.2 `APSMEDE.h`*
7
- *
8
- * @param data Data to initialize structure with.
9
- */
10
- export const apsTcLinkKeyEntry = (data?: Buffer) => {
11
- return Struct.new()
12
- .member("uint32", "txFrmCntr")
13
- .member("uint32", "rxFrmCntr")
14
- .member("uint8array-reversed", "extAddr", 8)
15
- .member("uint8", "keyAttributes")
16
- .member("uint8", "keyType")
17
- .member("uint8", "SeedShift_IcIndex")
18
- .build(data);
19
- };
@@ -1,21 +0,0 @@
1
- import assert from "node:assert";
2
-
3
- import type {StructMemoryAlignment} from "../struct";
4
- import {Table} from "../table";
5
- import {apsTcLinkKeyEntry} from "./aps-tc-link-key-entry";
6
-
7
- const emptyAddress = Buffer.alloc(8, 0x00);
8
-
9
- /**
10
- * Creates an APS trust center link key data table.
11
- *
12
- * @param data Data to initialize table with.
13
- * @param alignment Memory alignment of initialization data.
14
- */
15
- export const apsTcLinkKeyTable = (dataOrCapacity?: Buffer | Buffer[] | number, alignment: StructMemoryAlignment = "unaligned") => {
16
- const table = Table.new<ReturnType<typeof apsTcLinkKeyEntry>>()
17
- .struct(apsTcLinkKeyEntry)
18
- .occupancy((e) => !e.extAddr.equals(emptyAddress));
19
- assert(dataOrCapacity !== undefined, "dataOrCapacity cannot be undefined");
20
- return typeof dataOrCapacity === "number" ? table.build(dataOrCapacity) : table.build(dataOrCapacity, alignment);
21
- };
@@ -1,8 +0,0 @@
1
- import {Struct} from "../struct";
2
-
3
- /**
4
- * Creates a channel list struct.
5
- *
6
- * @param data Data to initialize structure with.
7
- */
8
- export const channelList = (data?: Buffer) => Struct.new().member("uint32", "channelList").build(data);
@@ -1,16 +0,0 @@
1
- import assert from "node:assert";
2
-
3
- import {Struct} from "../struct";
4
-
5
- /**
6
- * Creates a zigbee-herdsman `hasConfigured` struct.
7
- *
8
- * @param data Data to initialize structure with.
9
- */
10
- export const hasConfigured = (data?: Buffer | Buffer[]) => {
11
- assert(!Array.isArray(data));
12
- return Struct.new()
13
- .member("uint8", "hasConfigured")
14
- .method("isConfigured", Boolean.prototype, (struct) => struct.hasConfigured === 0x55)
15
- .build(data);
16
- };
@@ -1,16 +0,0 @@
1
- export * from "./address-manager-entry";
2
- export * from "./address-manager-table";
3
- export * from "./aps-link-key-data-entry";
4
- export * from "./aps-link-key-data-table";
5
- export * from "./aps-tc-link-key-entry";
6
- export * from "./aps-tc-link-key-table";
7
- export * from "./channel-list";
8
- export * from "./has-configured";
9
- export * from "./nib";
10
- export * from "./nwk-key";
11
- export * from "./nwk-key-descriptor";
12
- export * from "./nwk-pan-id";
13
- export * from "./nwk-sec-material-descriptor-entry";
14
- export * from "./nwk-sec-material-descriptor-table";
15
- export * from "./security-manager-entry";
16
- export * from "./security-manager-table";
@@ -1,66 +0,0 @@
1
- import assert from "node:assert";
2
-
3
- import {Struct} from "../struct";
4
- import {nwkKeyDescriptor} from "./nwk-key-descriptor";
5
-
6
- /**
7
- * Creates a NIB (Network Information Base) struct.
8
- *
9
- * *Definition from Z-Stack 3.0.2 `nwk.h`*
10
- *
11
- * @param data Data to initialize structure with.
12
- */
13
- export const nib = (data?: Buffer | Buffer[]) => {
14
- assert(!Array.isArray(data));
15
- return Struct.new()
16
- .member("uint8", "SequenceNum")
17
- .member("uint8", "PassiveAckTimeout")
18
- .member("uint8", "MaxBroadcastRetries")
19
- .member("uint8", "MaxChildren")
20
- .member("uint8", "MaxDepth")
21
- .member("uint8", "MaxRouters")
22
- .member("uint8", "dummyNeighborTable")
23
- .member("uint8", "BroadcastDeliveryTime")
24
- .member("uint8", "ReportConstantCost")
25
- .member("uint8", "RouteDiscRetries")
26
- .member("uint8", "dummyRoutingTable")
27
- .member("uint8", "SecureAllFrames")
28
- .member("uint8", "SecurityLevel")
29
- .member("uint8", "SymLink")
30
- .member("uint8", "CapabilityFlags")
31
- .member("uint16", "TransactionPersistenceTime")
32
- .member("uint8", "nwkProtocolVersion")
33
- .member("uint8", "RouteDiscoveryTime")
34
- .member("uint8", "RouteExpiryTime")
35
- .member("uint16", "nwkDevAddress")
36
- .member("uint8", "nwkLogicalChannel")
37
- .member("uint16", "nwkCoordAddress")
38
- .member("uint8array-reversed", "nwkCoordExtAddress", 8)
39
- .member("uint16", "nwkPanId")
40
- .member("uint8", "nwkState")
41
- .member("uint32", "channelList")
42
- .member("uint8", "beaconOrder")
43
- .member("uint8", "superFrameOrder")
44
- .member("uint8", "scanDuration")
45
- .member("uint8", "battLifeExt")
46
- .member("uint32", "allocatedRouterAddresses")
47
- .member("uint32", "allocatedEndDeviceAddresses")
48
- .member("uint8", "nodeDepth")
49
- .member("uint8array-reversed", "extendedPANID", 8)
50
- .member("uint8", "nwkKeyLoaded")
51
- .member("struct", "spare1", nwkKeyDescriptor)
52
- .member("struct", "spare2", nwkKeyDescriptor)
53
- .member("uint8", "spare3")
54
- .member("uint8", "spare4")
55
- .member("uint8", "nwkLinkStatusPeriod")
56
- .member("uint8", "nwkRouterAgeLimit")
57
- .member("uint8", "nwkUseMultiCast")
58
- .member("uint8", "nwkIsConcentrator")
59
- .member("uint8", "nwkConcentratorDiscoveryTime")
60
- .member("uint8", "nwkConcentratorRadius")
61
- .member("uint8", "nwkAllFresh")
62
- .member("uint16", "nwkManagerAddr")
63
- .member("uint16", "nwkTotalTransmissions")
64
- .member("uint8", "nwkUpdateId")
65
- .build(data);
66
- };
@@ -1,15 +0,0 @@
1
- import assert from "node:assert";
2
-
3
- import {Struct} from "../struct";
4
-
5
- /**
6
- * Creates a Security Service Provider (SSP) Network Descriptor struct.
7
- *
8
- * *Definition from Z-Stack 3.0.2 `ssp.h`*
9
- *
10
- * @param data Data to initialize structure with.
11
- */
12
- export const nwkKeyDescriptor = (data?: Buffer | Buffer[]) => {
13
- assert(!Array.isArray(data));
14
- return Struct.new().member("uint8", "keySeqNum").member("uint8array", "key", 16).build(data);
15
- };
@@ -1,13 +0,0 @@
1
- import assert from "node:assert";
2
-
3
- import {Struct} from "../struct";
4
-
5
- /**
6
- * Creates a network key struct.
7
- *
8
- * @param data Data to initialize structure with.
9
- */
10
- export const nwkKey = (data?: Buffer | Buffer[]) => {
11
- assert(!Array.isArray(data));
12
- return Struct.new().member("uint8array", "key", 16).build(data);
13
- };
@@ -1,8 +0,0 @@
1
- import {Struct} from "../struct";
2
-
3
- /**
4
- * Creates a network PAN ID struct.
5
- *
6
- * @param data Data to initialize structure with.
7
- */
8
- export const nwkPanId = (data?: Buffer) => Struct.new().member("uint16", "panId").build(data);
@@ -1,20 +0,0 @@
1
- import {Struct} from "../struct";
2
-
3
- const emptyExtendedPanId = Buffer.alloc(8, 0x00);
4
-
5
- /**
6
- * Create a ZigBee Device Security Manager Security Material struct. This structure stores a frame counter
7
- * associated with a particular Extended PAN ID used by device. Used in NV in table format:
8
- * - `ZCD_NV_EX_NWK_SEC_MATERIAL_TABLE` - extended table (SimpleLink Z-Stack 3.x.0)
9
- * - `ZCD_NV_LEGACY_NWK_SEC_MATERIAL_TABLE_START` through `ZCD_NV_LEGACY_NWK_SEC_MATERIAL_TABLE_END` (Z-Stack 3.0.x)
10
- *
11
- * *Definition from Z-Stack 3.0.2 `ZDSecMgr.h`*
12
- *
13
- * @param data Data to initialize structure with.
14
- */
15
- export const nwkSecMaterialDescriptorEntry = (data?: Buffer) =>
16
- Struct.new()
17
- .member("uint32", "FrameCounter")
18
- .member("uint8array-reversed", "extendedPanID", 8)
19
- .method("isSet", Boolean.prototype, (struct) => !struct.extendedPanID.equals(emptyExtendedPanId))
20
- .build(data);
@@ -1,19 +0,0 @@
1
- import assert from "node:assert";
2
-
3
- import type {StructMemoryAlignment} from "../struct";
4
- import {Table} from "../table";
5
- import {nwkSecMaterialDescriptorEntry} from "./nwk-sec-material-descriptor-entry";
6
-
7
- /**
8
- * Creates a network security material table.
9
- *
10
- * @param data Data to initialize table with.
11
- * @param alignment Memory alignment of initialization data.
12
- */
13
- export const nwkSecMaterialDescriptorTable = (dataOrCapacity?: Buffer | Buffer[] | number, alignment: StructMemoryAlignment = "unaligned") => {
14
- const table = Table.new<ReturnType<typeof nwkSecMaterialDescriptorEntry>>()
15
- .struct(nwkSecMaterialDescriptorEntry)
16
- .occupancy((e) => e.isSet() as boolean);
17
- assert(dataOrCapacity !== undefined, "dataOrCapacity cannot be undefined");
18
- return typeof dataOrCapacity === "number" ? table.build(dataOrCapacity) : table.build(dataOrCapacity, alignment);
19
- };
@@ -1,33 +0,0 @@
1
- import {Struct} from "../struct";
2
-
3
- /**
4
- * Security manager authentication options.
5
- *
6
- * *Definition from Z-Stack 3.0.2 `ZDSecMgr.h.h`*
7
- */
8
- export enum SecurityManagerAuthenticationOption {
9
- /* ZDSecMgr_Not_Authenticated */
10
- Default = 0x00,
11
-
12
- /* ZDSecMgr_Authenticated_CBCK */
13
- AuthenticatedCBCK = 0x01,
14
-
15
- /* ZDSecMgr_Authenticated_EA */
16
- AuthenticatedEA = 0x02,
17
- }
18
-
19
- /**
20
- * Creates a security manager entry.
21
- *
22
- * *Definition from Z-Stack 3.0.2 `ZDSecMgr.c`*
23
- *
24
- * @param data Data to initialize structure with.
25
- */
26
- export const securityManagerEntry = (data?: Buffer) => {
27
- return Struct.new()
28
- .member("uint16", "ami")
29
- .member("uint16", "keyNvId")
30
- .member("uint8", "authenticationOption")
31
- .default(Buffer.from("feff000000", "hex"))
32
- .build(data);
33
- };
@@ -1,22 +0,0 @@
1
- import assert from "node:assert";
2
-
3
- import type {StructMemoryAlignment} from "../struct";
4
- import {Table} from "../table";
5
- import {SecurityManagerAuthenticationOption, securityManagerEntry} from "./security-manager-entry";
6
-
7
- /**
8
- * Creates a security manager inline table present within Z-Stack NV memory.
9
- *
10
- * @param data Data to initialize table with.
11
- * @param alignment Memory alignment of initialization data.
12
- */
13
- export const securityManagerTable = (dataOrCapacity?: Buffer | Buffer[] | number, alignment: StructMemoryAlignment = "unaligned") => {
14
- const table = Table.new<ReturnType<typeof securityManagerEntry>>()
15
- .struct(securityManagerEntry)
16
- .occupancy(
17
- (e) => ![0xfffe, 0xffff].includes(e.ami) && !(e.ami === 0x0000 && e.authenticationOption === SecurityManagerAuthenticationOption.Default),
18
- )
19
- .inlineHeader();
20
- assert(dataOrCapacity !== undefined, "dataOrCapacity cannot be undefined");
21
- return typeof dataOrCapacity === "number" ? table.build(dataOrCapacity) : table.build(dataOrCapacity, alignment);
22
- };
@@ -1,4 +0,0 @@
1
- export * from "./entries";
2
- export * from "./serializable-memory-object";
3
- export * from "./struct";
4
- export * from "./table";
@@ -1,14 +0,0 @@
1
- import type {StructMemoryAlignment} from "./struct";
2
-
3
- /**
4
- * Interface for serializable items to be written to NV. Objects implementing this interface
5
- * are structs and tables.
6
- */
7
- export interface SerializableMemoryObject {
8
- serialize(alignment?: StructMemoryAlignment): Buffer;
9
- }
10
-
11
- /**
12
- * Signature for factory returning a memory struct or a table.
13
- */
14
- export type MemoryObjectFactory<T> = (data?: Buffer | Buffer[], alignment?: StructMemoryAlignment) => T;