@willieee802/zigbee-herdsman 0.18.2 → 0.18.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 (327) hide show
  1. package/dist/adapter/adapter.d.ts +61 -61
  2. package/dist/adapter/adapter.d.ts.map +1 -1
  3. package/dist/adapter/adapter.js +146 -146
  4. package/dist/adapter/deconz/adapter/deconzAdapter.d.ts +68 -68
  5. package/dist/adapter/deconz/adapter/deconzAdapter.js +1060 -1060
  6. package/dist/adapter/deconz/adapter/index.d.ts +2 -2
  7. package/dist/adapter/deconz/adapter/index.js +10 -10
  8. package/dist/adapter/deconz/driver/constants.d.ts +104 -104
  9. package/dist/adapter/deconz/driver/constants.js +55 -55
  10. package/dist/adapter/deconz/driver/driver.d.ts +81 -81
  11. package/dist/adapter/deconz/driver/driver.js +732 -732
  12. package/dist/adapter/deconz/driver/frame.d.ts +6 -6
  13. package/dist/adapter/deconz/driver/frame.js +13 -13
  14. package/dist/adapter/deconz/driver/frameParser.d.ts +2 -2
  15. package/dist/adapter/deconz/driver/frameParser.js +443 -443
  16. package/dist/adapter/deconz/driver/parser.d.ts +12 -12
  17. package/dist/adapter/deconz/driver/parser.js +61 -61
  18. package/dist/adapter/deconz/driver/writer.d.ts +8 -8
  19. package/dist/adapter/deconz/driver/writer.js +44 -44
  20. package/dist/adapter/events.d.ts +47 -47
  21. package/dist/adapter/events.js +14 -14
  22. package/dist/adapter/ezsp/adapter/backup.d.ts +9 -9
  23. package/dist/adapter/ezsp/adapter/backup.js +53 -53
  24. package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts +59 -59
  25. package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
  26. package/dist/adapter/ezsp/adapter/ezspAdapter.js +603 -585
  27. package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
  28. package/dist/adapter/ezsp/adapter/index.d.ts +2 -2
  29. package/dist/adapter/ezsp/adapter/index.js +10 -10
  30. package/dist/adapter/ezsp/driver/commands.d.ts +36 -36
  31. package/dist/adapter/ezsp/driver/commands.js +2359 -2359
  32. package/dist/adapter/ezsp/driver/consts.d.ts +10 -10
  33. package/dist/adapter/ezsp/driver/consts.js +13 -13
  34. package/dist/adapter/ezsp/driver/driver.d.ts +103 -103
  35. package/dist/adapter/ezsp/driver/driver.js +639 -639
  36. package/dist/adapter/ezsp/driver/ezsp.d.ts +96 -96
  37. package/dist/adapter/ezsp/driver/ezsp.js +586 -586
  38. package/dist/adapter/ezsp/driver/index.d.ts +3 -3
  39. package/dist/adapter/ezsp/driver/index.js +8 -8
  40. package/dist/adapter/ezsp/driver/multicast.d.ts +12 -12
  41. package/dist/adapter/ezsp/driver/multicast.js +74 -74
  42. package/dist/adapter/ezsp/driver/parser.d.ts +12 -12
  43. package/dist/adapter/ezsp/driver/parser.js +111 -111
  44. package/dist/adapter/ezsp/driver/types/basic.d.ts +62 -62
  45. package/dist/adapter/ezsp/driver/types/basic.js +208 -208
  46. package/dist/adapter/ezsp/driver/types/basic.js.map +1 -1
  47. package/dist/adapter/ezsp/driver/types/index.d.ts +9 -9
  48. package/dist/adapter/ezsp/driver/types/index.js +133 -133
  49. package/dist/adapter/ezsp/driver/types/named.d.ts +697 -697
  50. package/dist/adapter/ezsp/driver/types/named.js +1726 -1726
  51. package/dist/adapter/ezsp/driver/types/named.js.map +1 -1
  52. package/dist/adapter/ezsp/driver/types/struct.d.ts +251 -251
  53. package/dist/adapter/ezsp/driver/types/struct.js +708 -708
  54. package/dist/adapter/ezsp/driver/types/struct.js.map +1 -1
  55. package/dist/adapter/ezsp/driver/uart.d.ts +44 -44
  56. package/dist/adapter/ezsp/driver/uart.js +368 -368
  57. package/dist/adapter/ezsp/driver/utils/crc16ccitt.d.ts +2 -2
  58. package/dist/adapter/ezsp/driver/utils/crc16ccitt.js +55 -55
  59. package/dist/adapter/ezsp/driver/utils/index.d.ts +18 -18
  60. package/dist/adapter/ezsp/driver/utils/index.js +67 -67
  61. package/dist/adapter/ezsp/driver/writer.d.ts +13 -13
  62. package/dist/adapter/ezsp/driver/writer.js +88 -88
  63. package/dist/adapter/index.d.ts +4 -4
  64. package/dist/adapter/index.js +35 -35
  65. package/dist/adapter/serialPort.d.ts +8 -8
  66. package/dist/adapter/serialPort.js +22 -22
  67. package/dist/adapter/serialPort.js.map +1 -1
  68. package/dist/adapter/serialPortUtils.d.ts +12 -12
  69. package/dist/adapter/serialPortUtils.js +18 -18
  70. package/dist/adapter/socketPortUtils.d.ts +10 -10
  71. package/dist/adapter/socketPortUtils.js +16 -16
  72. package/dist/adapter/tstype.d.ts +85 -85
  73. package/dist/adapter/tstype.js +2 -2
  74. package/dist/adapter/z-stack/adapter/adapter-backup.d.ts +62 -62
  75. package/dist/adapter/z-stack/adapter/adapter-backup.d.ts.map +1 -1
  76. package/dist/adapter/z-stack/adapter/adapter-backup.js +460 -441
  77. package/dist/adapter/z-stack/adapter/adapter-backup.js.map +1 -1
  78. package/dist/adapter/z-stack/adapter/adapter-nv-memory.d.ts +150 -150
  79. package/dist/adapter/z-stack/adapter/adapter-nv-memory.js +258 -258
  80. package/dist/adapter/z-stack/adapter/endpoints.d.ts +11 -11
  81. package/dist/adapter/z-stack/adapter/endpoints.js +73 -73
  82. package/dist/adapter/z-stack/adapter/index.d.ts +2 -2
  83. package/dist/adapter/z-stack/adapter/index.js +8 -8
  84. package/dist/adapter/z-stack/adapter/manager.d.ts +86 -86
  85. package/dist/adapter/z-stack/adapter/manager.js +476 -476
  86. package/dist/adapter/z-stack/adapter/tstype.d.ts +6 -6
  87. package/dist/adapter/z-stack/adapter/tstype.js +10 -10
  88. package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts +81 -81
  89. package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts.map +1 -1
  90. package/dist/adapter/z-stack/adapter/zStackAdapter.js +868 -868
  91. package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
  92. package/dist/adapter/z-stack/constants/af.d.ts +23 -23
  93. package/dist/adapter/z-stack/constants/af.js +27 -27
  94. package/dist/adapter/z-stack/constants/common.d.ts +278 -278
  95. package/dist/adapter/z-stack/constants/common.js +289 -289
  96. package/dist/adapter/z-stack/constants/dbg.d.ts +22 -22
  97. package/dist/adapter/z-stack/constants/dbg.js +24 -24
  98. package/dist/adapter/z-stack/constants/index.d.ts +10 -10
  99. package/dist/adapter/z-stack/constants/index.js +47 -47
  100. package/dist/adapter/z-stack/constants/mac.d.ts +127 -127
  101. package/dist/adapter/z-stack/constants/mac.js +129 -129
  102. package/dist/adapter/z-stack/constants/sapi.d.ts +24 -24
  103. package/dist/adapter/z-stack/constants/sapi.js +26 -26
  104. package/dist/adapter/z-stack/constants/sys.d.ts +71 -71
  105. package/dist/adapter/z-stack/constants/sys.js +73 -73
  106. package/dist/adapter/z-stack/constants/util.d.ts +81 -81
  107. package/dist/adapter/z-stack/constants/util.js +83 -83
  108. package/dist/adapter/z-stack/constants/utils.d.ts +4 -4
  109. package/dist/adapter/z-stack/constants/utils.js +14 -14
  110. package/dist/adapter/z-stack/constants/zdo.d.ts +102 -102
  111. package/dist/adapter/z-stack/constants/zdo.js +104 -104
  112. package/dist/adapter/z-stack/models/index.d.ts +1 -1
  113. package/dist/adapter/z-stack/models/index.js +17 -17
  114. package/dist/adapter/z-stack/models/startup-options.d.ts +12 -12
  115. package/dist/adapter/z-stack/models/startup-options.js +2 -2
  116. package/dist/adapter/z-stack/structs/entries/address-manager-entry.d.ts +23 -23
  117. package/dist/adapter/z-stack/structs/entries/address-manager-entry.js +45 -45
  118. package/dist/adapter/z-stack/structs/entries/address-manager-table.d.ts +10 -10
  119. package/dist/adapter/z-stack/structs/entries/address-manager-table.js +22 -22
  120. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.d.ts +10 -10
  121. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.js +21 -21
  122. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.d.ts +10 -10
  123. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.js +23 -23
  124. package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.d.ts +10 -10
  125. package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.js +24 -24
  126. package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.d.ts +10 -10
  127. package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.js +23 -23
  128. package/dist/adapter/z-stack/structs/entries/channel-list.d.ts +8 -8
  129. package/dist/adapter/z-stack/structs/entries/channel-list.js +15 -15
  130. package/dist/adapter/z-stack/structs/entries/has-configured.d.ts +8 -8
  131. package/dist/adapter/z-stack/structs/entries/has-configured.js +16 -16
  132. package/dist/adapter/z-stack/structs/entries/index.d.ts +16 -16
  133. package/dist/adapter/z-stack/structs/entries/index.js +32 -32
  134. package/dist/adapter/z-stack/structs/entries/nib.d.ts +10 -10
  135. package/dist/adapter/z-stack/structs/entries/nib.js +68 -68
  136. package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.d.ts +10 -10
  137. package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.js +18 -18
  138. package/dist/adapter/z-stack/structs/entries/nwk-key.d.ts +8 -8
  139. package/dist/adapter/z-stack/structs/entries/nwk-key.js +15 -15
  140. package/dist/adapter/z-stack/structs/entries/nwk-pan-id.d.ts +8 -8
  141. package/dist/adapter/z-stack/structs/entries/nwk-pan-id.js +15 -15
  142. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.d.ts +13 -13
  143. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.js +23 -23
  144. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.d.ts +10 -10
  145. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.js +22 -22
  146. package/dist/adapter/z-stack/structs/entries/security-manager-entry.d.ts +20 -20
  147. package/dist/adapter/z-stack/structs/entries/security-manager-entry.js +36 -36
  148. package/dist/adapter/z-stack/structs/entries/security-manager-table.d.ts +10 -10
  149. package/dist/adapter/z-stack/structs/entries/security-manager-table.js +24 -24
  150. package/dist/adapter/z-stack/structs/index.d.ts +4 -4
  151. package/dist/adapter/z-stack/structs/index.js +20 -20
  152. package/dist/adapter/z-stack/structs/serializable-memory-object.d.ts +13 -13
  153. package/dist/adapter/z-stack/structs/serializable-memory-object.js +2 -2
  154. package/dist/adapter/z-stack/structs/struct.d.ts +99 -99
  155. package/dist/adapter/z-stack/structs/struct.js +295 -295
  156. package/dist/adapter/z-stack/structs/table.d.ts +94 -94
  157. package/dist/adapter/z-stack/structs/table.js +161 -161
  158. package/dist/adapter/z-stack/unpi/constants.d.ts +28 -28
  159. package/dist/adapter/z-stack/unpi/constants.js +41 -41
  160. package/dist/adapter/z-stack/unpi/frame.d.ts +16 -16
  161. package/dist/adapter/z-stack/unpi/frame.js +48 -48
  162. package/dist/adapter/z-stack/unpi/index.d.ts +5 -5
  163. package/dist/adapter/z-stack/unpi/index.js +37 -37
  164. package/dist/adapter/z-stack/unpi/parser.d.ts +10 -10
  165. package/dist/adapter/z-stack/unpi/parser.js +74 -74
  166. package/dist/adapter/z-stack/unpi/writer.d.ts +10 -10
  167. package/dist/adapter/z-stack/unpi/writer.js +44 -44
  168. package/dist/adapter/z-stack/utils/channel-list.d.ts +20 -20
  169. package/dist/adapter/z-stack/utils/channel-list.js +40 -40
  170. package/dist/adapter/z-stack/utils/index.d.ts +2 -2
  171. package/dist/adapter/z-stack/utils/index.js +18 -18
  172. package/dist/adapter/z-stack/utils/network-options.d.ts +8 -8
  173. package/dist/adapter/z-stack/utils/network-options.js +22 -22
  174. package/dist/adapter/z-stack/znp/buffaloZnp.d.ts +11 -11
  175. package/dist/adapter/z-stack/znp/buffaloZnp.js +113 -113
  176. package/dist/adapter/z-stack/znp/definition.d.ts +5 -5
  177. package/dist/adapter/z-stack/znp/definition.js +3050 -3050
  178. package/dist/adapter/z-stack/znp/index.d.ts +3 -3
  179. package/dist/adapter/z-stack/znp/index.js +10 -10
  180. package/dist/adapter/z-stack/znp/parameterType.d.ts +22 -22
  181. package/dist/adapter/z-stack/znp/parameterType.js +25 -25
  182. package/dist/adapter/z-stack/znp/tstype.d.ts +21 -21
  183. package/dist/adapter/z-stack/znp/tstype.js +2 -2
  184. package/dist/adapter/z-stack/znp/znp.d.ts +43 -43
  185. package/dist/adapter/z-stack/znp/znp.js +325 -325
  186. package/dist/adapter/z-stack/znp/zpiObject.d.ts +19 -19
  187. package/dist/adapter/z-stack/znp/zpiObject.js +96 -96
  188. package/dist/adapter/zigate/adapter/index.d.ts +2 -2
  189. package/dist/adapter/zigate/adapter/index.js +10 -10
  190. package/dist/adapter/zigate/adapter/zigateAdapter.d.ts +69 -69
  191. package/dist/adapter/zigate/adapter/zigateAdapter.js +678 -678
  192. package/dist/adapter/zigate/debug.d.ts +7 -7
  193. package/dist/adapter/zigate/debug.js +22 -22
  194. package/dist/adapter/zigate/driver/buffaloZiGate.d.ts +18 -18
  195. package/dist/adapter/zigate/driver/buffaloZiGate.js +139 -139
  196. package/dist/adapter/zigate/driver/commandType.d.ts +41 -41
  197. package/dist/adapter/zigate/driver/commandType.js +385 -385
  198. package/dist/adapter/zigate/driver/constants.d.ts +276 -276
  199. package/dist/adapter/zigate/driver/constants.js +371 -371
  200. package/dist/adapter/zigate/driver/frame.d.ts +26 -26
  201. package/dist/adapter/zigate/driver/frame.js +172 -172
  202. package/dist/adapter/zigate/driver/frame.js.map +1 -1
  203. package/dist/adapter/zigate/driver/messageType.d.ts +11 -11
  204. package/dist/adapter/zigate/driver/messageType.js +278 -278
  205. package/dist/adapter/zigate/driver/parameterType.d.ts +20 -20
  206. package/dist/adapter/zigate/driver/parameterType.js +23 -23
  207. package/dist/adapter/zigate/driver/ziGateObject.d.ts +23 -23
  208. package/dist/adapter/zigate/driver/ziGateObject.js +106 -106
  209. package/dist/adapter/zigate/driver/zigate.d.ts +49 -49
  210. package/dist/adapter/zigate/driver/zigate.js +303 -303
  211. package/dist/buffalo/buffalo.d.ts +50 -50
  212. package/dist/buffalo/buffalo.js +322 -322
  213. package/dist/buffalo/index.d.ts +3 -3
  214. package/dist/buffalo/index.js +33 -33
  215. package/dist/buffalo/tstype.d.ts +8 -8
  216. package/dist/buffalo/tstype.js +2 -2
  217. package/dist/controller/controller.d.ts +113 -110
  218. package/dist/controller/controller.d.ts.map +1 -1
  219. package/dist/controller/controller.js +619 -607
  220. package/dist/controller/controller.js.map +1 -1
  221. package/dist/controller/database.d.ts +18 -18
  222. package/dist/controller/database.js +93 -93
  223. package/dist/controller/events.d.ts +58 -55
  224. package/dist/controller/events.d.ts.map +1 -1
  225. package/dist/controller/events.js +101 -101
  226. package/dist/controller/events.js.map +1 -1
  227. package/dist/controller/greenPower.d.ts +12 -12
  228. package/dist/controller/greenPower.js +220 -220
  229. package/dist/controller/helpers/index.d.ts +2 -2
  230. package/dist/controller/helpers/index.js +28 -28
  231. package/dist/controller/helpers/request.d.ts +22 -22
  232. package/dist/controller/helpers/request.js +71 -71
  233. package/dist/controller/helpers/zclFrameConverter.d.ts +7 -7
  234. package/dist/controller/helpers/zclFrameConverter.js +31 -31
  235. package/dist/controller/helpers/zclTransactionSequenceNumber.d.ts +5 -5
  236. package/dist/controller/helpers/zclTransactionSequenceNumber.js +13 -13
  237. package/dist/controller/index.d.ts +5 -5
  238. package/dist/controller/index.js +8 -8
  239. package/dist/controller/logger-stub.d.ts +6 -6
  240. package/dist/controller/logger-stub.js +2 -2
  241. package/dist/controller/model/device.d.ts +133 -132
  242. package/dist/controller/model/device.d.ts.map +1 -1
  243. package/dist/controller/model/device.js +717 -708
  244. package/dist/controller/model/device.js.map +1 -1
  245. package/dist/controller/model/endpoint.d.ts +131 -131
  246. package/dist/controller/model/endpoint.d.ts.map +1 -1
  247. package/dist/controller/model/endpoint.js +816 -817
  248. package/dist/controller/model/endpoint.js.map +1 -1
  249. package/dist/controller/model/entity.d.ts +14 -14
  250. package/dist/controller/model/entity.js +26 -26
  251. package/dist/controller/model/group.d.ts +38 -38
  252. package/dist/controller/model/group.js +221 -221
  253. package/dist/controller/model/index.d.ts +5 -5
  254. package/dist/controller/model/index.js +14 -14
  255. package/dist/controller/touchlink.d.ts +19 -19
  256. package/dist/controller/touchlink.js +157 -157
  257. package/dist/controller/tstype.d.ts +21 -21
  258. package/dist/controller/tstype.js +9 -9
  259. package/dist/index.d.ts +3 -3
  260. package/dist/index.js +33 -33
  261. package/dist/models/backup-storage-legacy.d.ts +26 -26
  262. package/dist/models/backup-storage-legacy.js +2 -2
  263. package/dist/models/backup-storage-unified.d.ts +49 -49
  264. package/dist/models/backup-storage-unified.js +2 -2
  265. package/dist/models/backup.d.ts +37 -37
  266. package/dist/models/backup.js +2 -2
  267. package/dist/models/index.d.ts +4 -4
  268. package/dist/models/index.js +20 -20
  269. package/dist/models/network-options.d.ts +12 -12
  270. package/dist/models/network-options.js +2 -2
  271. package/dist/utils/assertString.d.ts +2 -2
  272. package/dist/utils/assertString.js +8 -8
  273. package/dist/utils/backup.d.ts +20 -20
  274. package/dist/utils/backup.js +187 -187
  275. package/dist/utils/equalsPartial.d.ts +2 -2
  276. package/dist/utils/equalsPartial.js +11 -11
  277. package/dist/utils/index.d.ts +9 -9
  278. package/dist/utils/index.js +45 -45
  279. package/dist/utils/isNumberArray.d.ts +2 -2
  280. package/dist/utils/isNumberArray.js +6 -6
  281. package/dist/utils/queue.d.ts +11 -11
  282. package/dist/utils/queue.js +50 -50
  283. package/dist/utils/realpathSync.d.ts +2 -2
  284. package/dist/utils/realpathSync.js +12 -12
  285. package/dist/utils/wait.d.ts +2 -2
  286. package/dist/utils/wait.js +8 -8
  287. package/dist/utils/waitress.d.ts +21 -21
  288. package/dist/utils/waitress.js +61 -61
  289. package/dist/zcl/buffaloZcl.d.ts +41 -41
  290. package/dist/zcl/buffaloZcl.js +591 -591
  291. package/dist/zcl/definition/buffaloZclDataType.d.ts +17 -17
  292. package/dist/zcl/definition/buffaloZclDataType.js +20 -20
  293. package/dist/zcl/definition/cluster.d.ts +29 -29
  294. package/dist/zcl/definition/cluster.js +5335 -5335
  295. package/dist/zcl/definition/dataType.d.ts +59 -59
  296. package/dist/zcl/definition/dataType.js +64 -64
  297. package/dist/zcl/definition/direction.d.ts +5 -5
  298. package/dist/zcl/definition/direction.js +8 -8
  299. package/dist/zcl/definition/endpointDeviceType.d.ts +4 -4
  300. package/dist/zcl/definition/endpointDeviceType.js +15 -15
  301. package/dist/zcl/definition/foundation.d.ts +11 -11
  302. package/dist/zcl/definition/foundation.js +167 -167
  303. package/dist/zcl/definition/frameControl.d.ts +10 -10
  304. package/dist/zcl/definition/frameControl.js +2 -2
  305. package/dist/zcl/definition/frameType.d.ts +5 -5
  306. package/dist/zcl/definition/frameType.js +8 -8
  307. package/dist/zcl/definition/index.d.ts +13 -13
  308. package/dist/zcl/definition/index.js +51 -51
  309. package/dist/zcl/definition/manufacturerCode.d.ts +1074 -1074
  310. package/dist/zcl/definition/manufacturerCode.js +1079 -1079
  311. package/dist/zcl/definition/powerSource.d.ts +4 -4
  312. package/dist/zcl/definition/powerSource.js +12 -12
  313. package/dist/zcl/definition/status.d.ts +38 -38
  314. package/dist/zcl/definition/status.js +41 -41
  315. package/dist/zcl/definition/tstype.d.ts +16 -16
  316. package/dist/zcl/definition/tstype.js +2 -2
  317. package/dist/zcl/index.d.ts +15 -15
  318. package/dist/zcl/index.js +55 -55
  319. package/dist/zcl/tstype.d.ts +56 -56
  320. package/dist/zcl/tstype.js +10 -10
  321. package/dist/zcl/utils.d.ts +6 -6
  322. package/dist/zcl/utils.js +165 -165
  323. package/dist/zcl/zclFrame.d.ts +45 -45
  324. package/dist/zcl/zclFrame.js +347 -347
  325. package/dist/zcl/zclStatusError.d.ts +5 -5
  326. package/dist/zcl/zclStatusError.js +13 -13
  327. package/package.json +1 -1
@@ -1,259 +1,259 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdapterNvMemory = void 0;
4
- /* eslint-disable max-len */
5
- const common_1 = require("../constants/common");
6
- const constants_1 = require("../unpi/constants");
7
- /**
8
- * Adapter non-volatile memory instrumentation. This class provides interface to interact
9
- * with ZNP adapter's NV memory. Provided functionality covers basic operations from reading,
10
- * writing and deleting keys to extended table manipulation.
11
- */
12
- class AdapterNvMemory {
13
- constructor(znp) {
14
- this.memoryAlignment = null;
15
- this.znp = znp;
16
- }
17
- /**
18
- * Initialize NV memory driver by examining target and determining memory alignment.
19
- */
20
- async init() {
21
- /* use `ZCD_NV_NWKKEY` to determine if target platform uses memory alignment (length 21 = unaligned, length 24 = aligned) */
22
- const rawNwkKey = await this.readItem(common_1.NvItemsIds.NWKKEY);
23
- this.memoryAlignment = rawNwkKey.length === 21 ? "unaligned" : "aligned";
24
- }
25
- async readItem(id, offset = 0, useStruct) {
26
- var _a, _b, _c;
27
- if (useStruct) {
28
- this.checkMemoryAlignmentSetup();
29
- }
30
- const lengthResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvLength", { id }));
31
- if (!((_a = lengthResponse === null || lengthResponse === void 0 ? void 0 : lengthResponse.payload) === null || _a === void 0 ? void 0 : _a.length) || ((_b = lengthResponse === null || lengthResponse === void 0 ? void 0 : lengthResponse.payload) === null || _b === void 0 ? void 0 : _b.length) === 0) {
32
- return null;
33
- }
34
- const length = lengthResponse.payload.length;
35
- const buffer = Buffer.alloc(length);
36
- while (offset < length) {
37
- const readResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvReadExt", { id, offset }));
38
- /* istanbul ignore next */
39
- if (!readResponse) {
40
- return null;
41
- }
42
- /* istanbul ignore next */
43
- if (((_c = readResponse.payload) === null || _c === void 0 ? void 0 : _c.status) !== 0) {
44
- throw new Error(`Received non-success status while reading NV (id=${id}, offset=${offset}, status=${readResponse.payload.status})`);
45
- }
46
- buffer.set(readResponse.payload.value, offset);
47
- offset += readResponse.payload.value.length;
48
- }
49
- if (useStruct) {
50
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
- return useStruct(buffer, this.memoryAlignment);
52
- }
53
- return buffer;
54
- }
55
- /**
56
- * Writes data to adapter NV memory. Method fails if write fails.
57
- *
58
- * @param id NV item identifier.
59
- * @param data Data to be written.
60
- * @param offset Offset within NV item to write the data.
61
- * @param autoInit Whether NV item should be automatically initialized if not present.
62
- */
63
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
- async writeItem(id, data, offset = 0, autoInit = true) {
65
- this.checkMemoryAlignmentSetup();
66
- const buffer = Buffer.isBuffer(data) ? data : data.serialize(this.memoryAlignment);
67
- const lengthResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvLength", { id }));
68
- const exists = lengthResponse.payload.length && lengthResponse.payload.length > 0;
69
- /* istanbul ignore next */
70
- if (!exists) {
71
- const initLength = buffer.length > 240 ? 240 : buffer.length;
72
- if (!autoInit) {
73
- throw new Error(`Cannot write NV memory item which does not exist (id=${id})`);
74
- }
75
- const initResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvItemInit", { id, len: buffer.length, initlen: initLength, initvalue: buffer.slice(0, initLength) }, undefined, null, [common_1.ZnpCommandStatus.SUCCESS, common_1.ZnpCommandStatus.NV_ITEM_INITIALIZED]));
76
- if (initResponse.payload.status !== 0x09) {
77
- throw new Error(`Failed to initialize NV memory item (id=${id}, name=${common_1.NvItemsIds[id]}, len=${buffer.length}, status=${initResponse.payload.status})`);
78
- }
79
- }
80
- let remaining = buffer.length;
81
- while (remaining > 0) {
82
- /* istanbul ignore next */
83
- const writeLength = remaining > 240 ? 240 : remaining;
84
- const dataOffset = buffer.length - remaining;
85
- const writeData = buffer.slice(dataOffset, dataOffset + writeLength);
86
- const writeResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvWriteExt", { id, offset: dataOffset, len: writeLength, value: writeData }));
87
- /* istanbul ignore next */
88
- if (writeResponse.payload.status !== 0) {
89
- throw new Error(`Received non-success status while writing NV (id=${id}, offset=${offset}, status=${writeResponse.payload.status})`);
90
- }
91
- remaining -= writeLength;
92
- }
93
- }
94
- /**
95
- * Determines whether NV item is different from provided data and updates if necessary.
96
- *
97
- * @param id NV item identifier.
98
- * @param data Desired NV item value.
99
- * @param autoInit Whether NV item should be automatically initialized if not present.
100
- */
101
- async updateItem(id, data, autoInit = true) {
102
- this.checkMemoryAlignmentSetup();
103
- const current = await this.readItem(id);
104
- if (!current || !current.equals(data)) {
105
- await this.writeItem(id, data, 0, autoInit);
106
- }
107
- }
108
- /**
109
- * Deletes an NV memory item.
110
- *
111
- * @param id NV item identifier.
112
- */
113
- async deleteItem(id) {
114
- this.checkMemoryAlignmentSetup();
115
- const lengthResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvLength", { id }));
116
- const exists = lengthResponse.payload.length && lengthResponse.payload.length > 0;
117
- /* istanbul ignore next */
118
- if (exists) {
119
- const deleteResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvDelete", { id, len: lengthResponse.payload.length }));
120
- if (!deleteResponse || ![common_1.ZnpCommandStatus.SUCCESS, common_1.ZnpCommandStatus.NV_ITEM_INITIALIZED].includes(deleteResponse.payload.status)) {
121
- /* istanbul ignore next */
122
- throw new Error(`Received non-success status while deleting NV (id=${id}, status=${deleteResponse.payload.status})`);
123
- }
124
- }
125
- }
126
- async readExtendedTableEntry(sysId, id, subId, offset, useStruct) {
127
- this.checkMemoryAlignmentSetup();
128
- const lengthResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "nvLength", { sysid: sysId, itemid: id, subid: subId }));
129
- const exists = lengthResponse.payload.len && lengthResponse.payload.len > 0;
130
- if (exists) {
131
- const readResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "nvRead", { sysid: sysId, itemid: id, subid: subId, offset: offset || 0, len: lengthResponse.payload.len }));
132
- /* istanbul ignore next */
133
- if (readResponse.payload.status !== 0) {
134
- throw new Error(`Received non-success status while reading NV extended table entry (sysId=${sysId}, id=${id}, subId=${subId}, offset=${offset}, status=${readResponse.payload.status})`);
135
- }
136
- /* istanbul ignore next */
137
- if (useStruct) {
138
- return useStruct(readResponse.payload.value);
139
- }
140
- else {
141
- return readResponse.payload.value;
142
- }
143
- }
144
- return null;
145
- }
146
- /**
147
- * Writes extended table entry (user by Z-Stack 3.x+). NV tables within newer Z-Stack releases include 16-bit `subId`
148
- * identifying table tnreis.
149
- *
150
- * @param sysId SimpleLink system identifier.
151
- * @param id NV item identifier.
152
- * @param subId Entry index.
153
- * @param data Data to write to the table.
154
- * @param offset Offset to write at.
155
- * @param autoInit Whether non-existent entry should be automatically initialized.
156
- */
157
- async writeExtendedTableEntry(sysId, id, subId, data, offset, autoInit = true) {
158
- this.checkMemoryAlignmentSetup();
159
- const lengthResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "nvLength", { sysid: sysId, itemid: id, subid: subId }));
160
- const exists = lengthResponse.payload.len && lengthResponse.payload.len > 0;
161
- /* istanbul ignore if */
162
- if (!exists) {
163
- if (!autoInit) {
164
- throw new Error(`Cannot write NV memory extended table item which does not exist (sudId=${sysId}, id=${id}, subId=${subId})`);
165
- }
166
- const createResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "nvCreate", { sysid: sysId, itemid: id, subid: subId, len: data.length }));
167
- if (!createResponse || createResponse.payload.status !== common_1.ZnpCommandStatus.SUCCESS) {
168
- /* istanbul ignore next */
169
- throw new Error(`Failed to crate NV memory extended table item with status (sudId=${sysId}, id=${id}, subId=${subId})`);
170
- }
171
- }
172
- const writeResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "nvWrite", { sysid: sysId, itemid: id, subid: subId, offset: offset || 0, len: data.length, value: data }));
173
- /* istanbul ignore next */
174
- if (writeResponse.payload.status !== 0) {
175
- throw new Error(`Received non-success status while writing NV extended table idem (sudId=${sysId}, id=${id}, subId=${subId}, offset=${offset}, status=${writeResponse.payload.status})`);
176
- }
177
- }
178
- async readTable(mode, p1, p2, p3, p4) {
179
- const sysId = mode === "legacy" ? undefined : p1;
180
- const id = (mode === "legacy" ? p1 : p2);
181
- const maxLength = (mode === "legacy" ? p2 : p3);
182
- const useTable = (mode === "legacy" ? p3 : p4);
183
- const rawEntries = [];
184
- let entryOffset = 0;
185
- let rawEntry = null;
186
- if (mode === "legacy") {
187
- do {
188
- rawEntry = await this.readItem(id + (entryOffset++));
189
- if (rawEntry) {
190
- rawEntries.push(rawEntry);
191
- }
192
- } while (rawEntry !== null && entryOffset < maxLength);
193
- }
194
- else {
195
- /* istanbul ignore next */
196
- do {
197
- rawEntry = await this.readExtendedTableEntry(sysId, id, entryOffset++);
198
- if (rawEntry) {
199
- rawEntries.push(rawEntry);
200
- }
201
- } while (rawEntry !== null && (!maxLength || entryOffset < maxLength));
202
- }
203
- /* istanbul ignore next */
204
- return useTable ? useTable(rawEntries) : rawEntries;
205
- }
206
- async writeTable(mode, p1, p2, p3) {
207
- this.checkMemoryAlignmentSetup();
208
- const sysId = mode === "legacy" ? undefined : p1;
209
- const id = (mode === "legacy" ? p1 : p2);
210
- const table = (mode === "legacy" ? p2 : p3);
211
- if (mode === "legacy") {
212
- for (const [index, entry] of table.entries.entries()) {
213
- await this.writeItem(id + index, entry.serialize(this.memoryAlignment));
214
- }
215
- }
216
- else {
217
- for (const [index, entry] of table.entries.entries()) {
218
- await this.writeExtendedTableEntry(sysId, id, index, entry.serialize(this.memoryAlignment));
219
- }
220
- }
221
- }
222
- /**
223
- * Internal function to prevent occasional ZNP request failures.
224
- *
225
- * *Some timeouts were present when working with SimpleLink Z-Stack 3.x.0+.*
226
- *
227
- * @param fn Function to retry.
228
- * @param retries Maximum number of retries.
229
- */
230
- async retry(fn, retries = 3) {
231
- let i = 0;
232
- while (i < retries) {
233
- try {
234
- const result = await fn();
235
- return result;
236
- }
237
- catch (error) {
238
- /* istanbul ignore next */
239
- if (i >= retries) {
240
- /* istanbul ignore next */
241
- throw error;
242
- }
243
- }
244
- /* istanbul ignore next */
245
- i++;
246
- }
247
- }
248
- /**
249
- * Internal function used by NV manipulation methods to check for correct driver initialization.
250
- */
251
- checkMemoryAlignmentSetup() {
252
- /* istanbul ignore next */
253
- if (this.memoryAlignment === null) {
254
- throw new Error("adapter memory alignment unknown - has nv memory driver been initialized?");
255
- }
256
- }
257
- }
258
- exports.AdapterNvMemory = AdapterNvMemory;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdapterNvMemory = void 0;
4
+ /* eslint-disable max-len */
5
+ const common_1 = require("../constants/common");
6
+ const constants_1 = require("../unpi/constants");
7
+ /**
8
+ * Adapter non-volatile memory instrumentation. This class provides interface to interact
9
+ * with ZNP adapter's NV memory. Provided functionality covers basic operations from reading,
10
+ * writing and deleting keys to extended table manipulation.
11
+ */
12
+ class AdapterNvMemory {
13
+ constructor(znp) {
14
+ this.memoryAlignment = null;
15
+ this.znp = znp;
16
+ }
17
+ /**
18
+ * Initialize NV memory driver by examining target and determining memory alignment.
19
+ */
20
+ async init() {
21
+ /* use `ZCD_NV_NWKKEY` to determine if target platform uses memory alignment (length 21 = unaligned, length 24 = aligned) */
22
+ const rawNwkKey = await this.readItem(common_1.NvItemsIds.NWKKEY);
23
+ this.memoryAlignment = rawNwkKey.length === 21 ? "unaligned" : "aligned";
24
+ }
25
+ async readItem(id, offset = 0, useStruct) {
26
+ var _a, _b, _c;
27
+ if (useStruct) {
28
+ this.checkMemoryAlignmentSetup();
29
+ }
30
+ const lengthResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvLength", { id }));
31
+ if (!((_a = lengthResponse === null || lengthResponse === void 0 ? void 0 : lengthResponse.payload) === null || _a === void 0 ? void 0 : _a.length) || ((_b = lengthResponse === null || lengthResponse === void 0 ? void 0 : lengthResponse.payload) === null || _b === void 0 ? void 0 : _b.length) === 0) {
32
+ return null;
33
+ }
34
+ const length = lengthResponse.payload.length;
35
+ const buffer = Buffer.alloc(length);
36
+ while (offset < length) {
37
+ const readResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvReadExt", { id, offset }));
38
+ /* istanbul ignore next */
39
+ if (!readResponse) {
40
+ return null;
41
+ }
42
+ /* istanbul ignore next */
43
+ if (((_c = readResponse.payload) === null || _c === void 0 ? void 0 : _c.status) !== 0) {
44
+ throw new Error(`Received non-success status while reading NV (id=${id}, offset=${offset}, status=${readResponse.payload.status})`);
45
+ }
46
+ buffer.set(readResponse.payload.value, offset);
47
+ offset += readResponse.payload.value.length;
48
+ }
49
+ if (useStruct) {
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ return useStruct(buffer, this.memoryAlignment);
52
+ }
53
+ return buffer;
54
+ }
55
+ /**
56
+ * Writes data to adapter NV memory. Method fails if write fails.
57
+ *
58
+ * @param id NV item identifier.
59
+ * @param data Data to be written.
60
+ * @param offset Offset within NV item to write the data.
61
+ * @param autoInit Whether NV item should be automatically initialized if not present.
62
+ */
63
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
+ async writeItem(id, data, offset = 0, autoInit = true) {
65
+ this.checkMemoryAlignmentSetup();
66
+ const buffer = Buffer.isBuffer(data) ? data : data.serialize(this.memoryAlignment);
67
+ const lengthResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvLength", { id }));
68
+ const exists = lengthResponse.payload.length && lengthResponse.payload.length > 0;
69
+ /* istanbul ignore next */
70
+ if (!exists) {
71
+ const initLength = buffer.length > 240 ? 240 : buffer.length;
72
+ if (!autoInit) {
73
+ throw new Error(`Cannot write NV memory item which does not exist (id=${id})`);
74
+ }
75
+ const initResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvItemInit", { id, len: buffer.length, initlen: initLength, initvalue: buffer.slice(0, initLength) }, undefined, null, [common_1.ZnpCommandStatus.SUCCESS, common_1.ZnpCommandStatus.NV_ITEM_INITIALIZED]));
76
+ if (initResponse.payload.status !== 0x09) {
77
+ throw new Error(`Failed to initialize NV memory item (id=${id}, name=${common_1.NvItemsIds[id]}, len=${buffer.length}, status=${initResponse.payload.status})`);
78
+ }
79
+ }
80
+ let remaining = buffer.length;
81
+ while (remaining > 0) {
82
+ /* istanbul ignore next */
83
+ const writeLength = remaining > 240 ? 240 : remaining;
84
+ const dataOffset = buffer.length - remaining;
85
+ const writeData = buffer.slice(dataOffset, dataOffset + writeLength);
86
+ const writeResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvWriteExt", { id, offset: dataOffset, len: writeLength, value: writeData }));
87
+ /* istanbul ignore next */
88
+ if (writeResponse.payload.status !== 0) {
89
+ throw new Error(`Received non-success status while writing NV (id=${id}, offset=${offset}, status=${writeResponse.payload.status})`);
90
+ }
91
+ remaining -= writeLength;
92
+ }
93
+ }
94
+ /**
95
+ * Determines whether NV item is different from provided data and updates if necessary.
96
+ *
97
+ * @param id NV item identifier.
98
+ * @param data Desired NV item value.
99
+ * @param autoInit Whether NV item should be automatically initialized if not present.
100
+ */
101
+ async updateItem(id, data, autoInit = true) {
102
+ this.checkMemoryAlignmentSetup();
103
+ const current = await this.readItem(id);
104
+ if (!current || !current.equals(data)) {
105
+ await this.writeItem(id, data, 0, autoInit);
106
+ }
107
+ }
108
+ /**
109
+ * Deletes an NV memory item.
110
+ *
111
+ * @param id NV item identifier.
112
+ */
113
+ async deleteItem(id) {
114
+ this.checkMemoryAlignmentSetup();
115
+ const lengthResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvLength", { id }));
116
+ const exists = lengthResponse.payload.length && lengthResponse.payload.length > 0;
117
+ /* istanbul ignore next */
118
+ if (exists) {
119
+ const deleteResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "osalNvDelete", { id, len: lengthResponse.payload.length }));
120
+ if (!deleteResponse || ![common_1.ZnpCommandStatus.SUCCESS, common_1.ZnpCommandStatus.NV_ITEM_INITIALIZED].includes(deleteResponse.payload.status)) {
121
+ /* istanbul ignore next */
122
+ throw new Error(`Received non-success status while deleting NV (id=${id}, status=${deleteResponse.payload.status})`);
123
+ }
124
+ }
125
+ }
126
+ async readExtendedTableEntry(sysId, id, subId, offset, useStruct) {
127
+ this.checkMemoryAlignmentSetup();
128
+ const lengthResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "nvLength", { sysid: sysId, itemid: id, subid: subId }));
129
+ const exists = lengthResponse.payload.len && lengthResponse.payload.len > 0;
130
+ if (exists) {
131
+ const readResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "nvRead", { sysid: sysId, itemid: id, subid: subId, offset: offset || 0, len: lengthResponse.payload.len }));
132
+ /* istanbul ignore next */
133
+ if (readResponse.payload.status !== 0) {
134
+ throw new Error(`Received non-success status while reading NV extended table entry (sysId=${sysId}, id=${id}, subId=${subId}, offset=${offset}, status=${readResponse.payload.status})`);
135
+ }
136
+ /* istanbul ignore next */
137
+ if (useStruct) {
138
+ return useStruct(readResponse.payload.value);
139
+ }
140
+ else {
141
+ return readResponse.payload.value;
142
+ }
143
+ }
144
+ return null;
145
+ }
146
+ /**
147
+ * Writes extended table entry (user by Z-Stack 3.x+). NV tables within newer Z-Stack releases include 16-bit `subId`
148
+ * identifying table tnreis.
149
+ *
150
+ * @param sysId SimpleLink system identifier.
151
+ * @param id NV item identifier.
152
+ * @param subId Entry index.
153
+ * @param data Data to write to the table.
154
+ * @param offset Offset to write at.
155
+ * @param autoInit Whether non-existent entry should be automatically initialized.
156
+ */
157
+ async writeExtendedTableEntry(sysId, id, subId, data, offset, autoInit = true) {
158
+ this.checkMemoryAlignmentSetup();
159
+ const lengthResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "nvLength", { sysid: sysId, itemid: id, subid: subId }));
160
+ const exists = lengthResponse.payload.len && lengthResponse.payload.len > 0;
161
+ /* istanbul ignore if */
162
+ if (!exists) {
163
+ if (!autoInit) {
164
+ throw new Error(`Cannot write NV memory extended table item which does not exist (sudId=${sysId}, id=${id}, subId=${subId})`);
165
+ }
166
+ const createResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "nvCreate", { sysid: sysId, itemid: id, subid: subId, len: data.length }));
167
+ if (!createResponse || createResponse.payload.status !== common_1.ZnpCommandStatus.SUCCESS) {
168
+ /* istanbul ignore next */
169
+ throw new Error(`Failed to crate NV memory extended table item with status (sudId=${sysId}, id=${id}, subId=${subId})`);
170
+ }
171
+ }
172
+ const writeResponse = await this.retry(() => this.znp.request(constants_1.Subsystem.SYS, "nvWrite", { sysid: sysId, itemid: id, subid: subId, offset: offset || 0, len: data.length, value: data }));
173
+ /* istanbul ignore next */
174
+ if (writeResponse.payload.status !== 0) {
175
+ throw new Error(`Received non-success status while writing NV extended table idem (sudId=${sysId}, id=${id}, subId=${subId}, offset=${offset}, status=${writeResponse.payload.status})`);
176
+ }
177
+ }
178
+ async readTable(mode, p1, p2, p3, p4) {
179
+ const sysId = mode === "legacy" ? undefined : p1;
180
+ const id = (mode === "legacy" ? p1 : p2);
181
+ const maxLength = (mode === "legacy" ? p2 : p3);
182
+ const useTable = (mode === "legacy" ? p3 : p4);
183
+ const rawEntries = [];
184
+ let entryOffset = 0;
185
+ let rawEntry = null;
186
+ if (mode === "legacy") {
187
+ do {
188
+ rawEntry = await this.readItem(id + (entryOffset++));
189
+ if (rawEntry) {
190
+ rawEntries.push(rawEntry);
191
+ }
192
+ } while (rawEntry !== null && entryOffset < maxLength);
193
+ }
194
+ else {
195
+ /* istanbul ignore next */
196
+ do {
197
+ rawEntry = await this.readExtendedTableEntry(sysId, id, entryOffset++);
198
+ if (rawEntry) {
199
+ rawEntries.push(rawEntry);
200
+ }
201
+ } while (rawEntry !== null && (!maxLength || entryOffset < maxLength));
202
+ }
203
+ /* istanbul ignore next */
204
+ return useTable ? useTable(rawEntries) : rawEntries;
205
+ }
206
+ async writeTable(mode, p1, p2, p3) {
207
+ this.checkMemoryAlignmentSetup();
208
+ const sysId = mode === "legacy" ? undefined : p1;
209
+ const id = (mode === "legacy" ? p1 : p2);
210
+ const table = (mode === "legacy" ? p2 : p3);
211
+ if (mode === "legacy") {
212
+ for (const [index, entry] of table.entries.entries()) {
213
+ await this.writeItem(id + index, entry.serialize(this.memoryAlignment));
214
+ }
215
+ }
216
+ else {
217
+ for (const [index, entry] of table.entries.entries()) {
218
+ await this.writeExtendedTableEntry(sysId, id, index, entry.serialize(this.memoryAlignment));
219
+ }
220
+ }
221
+ }
222
+ /**
223
+ * Internal function to prevent occasional ZNP request failures.
224
+ *
225
+ * *Some timeouts were present when working with SimpleLink Z-Stack 3.x.0+.*
226
+ *
227
+ * @param fn Function to retry.
228
+ * @param retries Maximum number of retries.
229
+ */
230
+ async retry(fn, retries = 3) {
231
+ let i = 0;
232
+ while (i < retries) {
233
+ try {
234
+ const result = await fn();
235
+ return result;
236
+ }
237
+ catch (error) {
238
+ /* istanbul ignore next */
239
+ if (i >= retries) {
240
+ /* istanbul ignore next */
241
+ throw error;
242
+ }
243
+ }
244
+ /* istanbul ignore next */
245
+ i++;
246
+ }
247
+ }
248
+ /**
249
+ * Internal function used by NV manipulation methods to check for correct driver initialization.
250
+ */
251
+ checkMemoryAlignmentSetup() {
252
+ /* istanbul ignore next */
253
+ if (this.memoryAlignment === null) {
254
+ throw new Error("adapter memory alignment unknown - has nv memory driver been initialized?");
255
+ }
256
+ }
257
+ }
258
+ exports.AdapterNvMemory = AdapterNvMemory;
259
259
  //# sourceMappingURL=adapter-nv-memory.js.map
@@ -1,12 +1,12 @@
1
- export declare const Endpoints: {
2
- endpoint: number;
3
- appprofid: number;
4
- appdeviceid: number;
5
- appdevver: number;
6
- appnuminclusters: number;
7
- appinclusterlist: number[];
8
- appnumoutclusters: number;
9
- appoutclusterlist: number[];
10
- latencyreq: number;
11
- }[];
1
+ export declare const Endpoints: {
2
+ endpoint: number;
3
+ appprofid: number;
4
+ appdeviceid: number;
5
+ appdevver: number;
6
+ appnuminclusters: number;
7
+ appinclusterlist: number[];
8
+ appnumoutclusters: number;
9
+ appoutclusterlist: number[];
10
+ latencyreq: number;
11
+ }[];
12
12
  //# sourceMappingURL=endpoints.d.ts.map