zigbee-herdsman 0.51.0 → 0.53.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.
Files changed (499) hide show
  1. package/.github/workflows/ci.yml +4 -2
  2. package/.prettierrc +9 -0
  3. package/.release-please-manifest.json +1 -1
  4. package/CHANGELOG.md +25 -0
  5. package/dist/adapter/adapter.d.ts +4 -4
  6. package/dist/adapter/adapter.d.ts.map +1 -1
  7. package/dist/adapter/adapter.js +8 -13
  8. package/dist/adapter/adapter.js.map +1 -1
  9. package/dist/adapter/deconz/adapter/deconzAdapter.d.ts +1 -1
  10. package/dist/adapter/deconz/adapter/deconzAdapter.d.ts.map +1 -1
  11. package/dist/adapter/deconz/adapter/deconzAdapter.js +249 -155
  12. package/dist/adapter/deconz/adapter/deconzAdapter.js.map +1 -1
  13. package/dist/adapter/deconz/adapter/index.d.ts +1 -1
  14. package/dist/adapter/deconz/adapter/index.d.ts.map +1 -1
  15. package/dist/adapter/deconz/adapter/index.js.map +1 -1
  16. package/dist/adapter/deconz/driver/constants.d.ts +1 -1
  17. package/dist/adapter/deconz/driver/constants.d.ts.map +1 -1
  18. package/dist/adapter/deconz/driver/constants.js +7 -7
  19. package/dist/adapter/deconz/driver/constants.js.map +1 -1
  20. package/dist/adapter/deconz/driver/driver.d.ts.map +1 -1
  21. package/dist/adapter/deconz/driver/driver.js +92 -60
  22. package/dist/adapter/deconz/driver/driver.js.map +1 -1
  23. package/dist/adapter/deconz/driver/frameParser.d.ts.map +1 -1
  24. package/dist/adapter/deconz/driver/frameParser.js +55 -46
  25. package/dist/adapter/deconz/driver/frameParser.js.map +1 -1
  26. package/dist/adapter/deconz/driver/parser.js +1 -1
  27. package/dist/adapter/ember/adapter/emberAdapter.d.ts +5 -5
  28. package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -1
  29. package/dist/adapter/ember/adapter/emberAdapter.js +803 -955
  30. package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -1
  31. package/dist/adapter/ember/adapter/endpoints.d.ts.map +1 -1
  32. package/dist/adapter/ember/adapter/endpoints.js +4 -2
  33. package/dist/adapter/ember/adapter/endpoints.js.map +1 -1
  34. package/dist/adapter/ember/adapter/oneWaitress.d.ts +2 -2
  35. package/dist/adapter/ember/adapter/oneWaitress.d.ts.map +1 -1
  36. package/dist/adapter/ember/adapter/oneWaitress.js +16 -16
  37. package/dist/adapter/ember/adapter/oneWaitress.js.map +1 -1
  38. package/dist/adapter/ember/adapter/tokensManager.d.ts +3 -3
  39. package/dist/adapter/ember/adapter/tokensManager.d.ts.map +1 -1
  40. package/dist/adapter/ember/adapter/tokensManager.js +86 -85
  41. package/dist/adapter/ember/adapter/tokensManager.js.map +1 -1
  42. package/dist/adapter/ember/consts.d.ts.map +1 -1
  43. package/dist/adapter/ember/consts.js +27 -27
  44. package/dist/adapter/ember/consts.js.map +1 -1
  45. package/dist/adapter/ember/enums.d.ts +2 -2
  46. package/dist/adapter/ember/enums.d.ts.map +1 -1
  47. package/dist/adapter/ember/enums.js +8 -50
  48. package/dist/adapter/ember/enums.js.map +1 -1
  49. package/dist/adapter/ember/ezsp/buffalo.d.ts +4 -4
  50. package/dist/adapter/ember/ezsp/buffalo.d.ts.map +1 -1
  51. package/dist/adapter/ember/ezsp/buffalo.js +35 -34
  52. package/dist/adapter/ember/ezsp/buffalo.js.map +1 -1
  53. package/dist/adapter/ember/ezsp/consts.d.ts.map +1 -1
  54. package/dist/adapter/ember/ezsp/consts.js +4 -4
  55. package/dist/adapter/ember/ezsp/consts.js.map +1 -1
  56. package/dist/adapter/ember/ezsp/enums.d.ts.map +1 -1
  57. package/dist/adapter/ember/ezsp/enums.js +0 -2
  58. package/dist/adapter/ember/ezsp/enums.js.map +1 -1
  59. package/dist/adapter/ember/ezsp/ezsp.d.ts +23 -20
  60. package/dist/adapter/ember/ezsp/ezsp.d.ts.map +1 -1
  61. package/dist/adapter/ember/ezsp/ezsp.js +1146 -1141
  62. package/dist/adapter/ember/ezsp/ezsp.js.map +1 -1
  63. package/dist/adapter/ember/ezspError.d.ts +1 -1
  64. package/dist/adapter/ember/ezspError.d.ts.map +1 -1
  65. package/dist/adapter/ember/ezspError.js.map +1 -1
  66. package/dist/adapter/ember/types.d.ts +2 -1
  67. package/dist/adapter/ember/types.d.ts.map +1 -1
  68. package/dist/adapter/ember/uart/ash.d.ts +5 -5
  69. package/dist/adapter/ember/uart/ash.d.ts.map +1 -1
  70. package/dist/adapter/ember/uart/ash.js +66 -65
  71. package/dist/adapter/ember/uart/ash.js.map +1 -1
  72. package/dist/adapter/ember/uart/consts.d.ts.map +1 -1
  73. package/dist/adapter/ember/uart/consts.js +9 -9
  74. package/dist/adapter/ember/uart/consts.js.map +1 -1
  75. package/dist/adapter/ember/uart/enums.d.ts.map +1 -1
  76. package/dist/adapter/ember/uart/parser.d.ts +1 -1
  77. package/dist/adapter/ember/uart/parser.d.ts.map +1 -1
  78. package/dist/adapter/ember/uart/parser.js +1 -1
  79. package/dist/adapter/ember/uart/parser.js.map +1 -1
  80. package/dist/adapter/ember/uart/queues.d.ts.map +1 -1
  81. package/dist/adapter/ember/uart/queues.js +1 -1
  82. package/dist/adapter/ember/uart/queues.js.map +1 -1
  83. package/dist/adapter/ember/uart/writer.d.ts +1 -1
  84. package/dist/adapter/ember/uart/writer.d.ts.map +1 -1
  85. package/dist/adapter/ember/uart/writer.js +2 -3
  86. package/dist/adapter/ember/uart/writer.js.map +1 -1
  87. package/dist/adapter/ember/utils/initters.d.ts +2 -2
  88. package/dist/adapter/ember/utils/initters.d.ts.map +1 -1
  89. package/dist/adapter/ember/utils/initters.js +1 -0
  90. package/dist/adapter/ember/utils/initters.js.map +1 -1
  91. package/dist/adapter/ember/utils/math.d.ts.map +1 -1
  92. package/dist/adapter/ember/utils/math.js +11 -11
  93. package/dist/adapter/ember/utils/math.js.map +1 -1
  94. package/dist/adapter/events.d.ts +1 -1
  95. package/dist/adapter/events.d.ts.map +1 -1
  96. package/dist/adapter/ezsp/adapter/backup.d.ts +1 -1
  97. package/dist/adapter/ezsp/adapter/backup.d.ts.map +1 -1
  98. package/dist/adapter/ezsp/adapter/backup.js +11 -10
  99. package/dist/adapter/ezsp/adapter/backup.js.map +1 -1
  100. package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts +4 -4
  101. package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
  102. package/dist/adapter/ezsp/adapter/ezspAdapter.js +74 -41
  103. package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
  104. package/dist/adapter/ezsp/adapter/index.d.ts +1 -1
  105. package/dist/adapter/ezsp/adapter/index.d.ts.map +1 -1
  106. package/dist/adapter/ezsp/adapter/index.js.map +1 -1
  107. package/dist/adapter/ezsp/driver/commands.d.ts.map +1 -1
  108. package/dist/adapter/ezsp/driver/commands.js +452 -452
  109. package/dist/adapter/ezsp/driver/commands.js.map +1 -1
  110. package/dist/adapter/ezsp/driver/consts.js +4 -4
  111. package/dist/adapter/ezsp/driver/consts.js.map +1 -1
  112. package/dist/adapter/ezsp/driver/driver.d.ts +5 -5
  113. package/dist/adapter/ezsp/driver/driver.d.ts.map +1 -1
  114. package/dist/adapter/ezsp/driver/driver.js +82 -82
  115. package/dist/adapter/ezsp/driver/driver.js.map +1 -1
  116. package/dist/adapter/ezsp/driver/ezsp.d.ts +3 -3
  117. package/dist/adapter/ezsp/driver/ezsp.d.ts.map +1 -1
  118. package/dist/adapter/ezsp/driver/ezsp.js +58 -58
  119. package/dist/adapter/ezsp/driver/ezsp.js.map +1 -1
  120. package/dist/adapter/ezsp/driver/frame.js +9 -9
  121. package/dist/adapter/ezsp/driver/frame.js.map +1 -1
  122. package/dist/adapter/ezsp/driver/index.d.ts +1 -1
  123. package/dist/adapter/ezsp/driver/index.d.ts.map +1 -1
  124. package/dist/adapter/ezsp/driver/index.js +2 -2
  125. package/dist/adapter/ezsp/driver/index.js.map +1 -1
  126. package/dist/adapter/ezsp/driver/multicast.d.ts.map +1 -1
  127. package/dist/adapter/ezsp/driver/multicast.js +1 -1
  128. package/dist/adapter/ezsp/driver/multicast.js.map +1 -1
  129. package/dist/adapter/ezsp/driver/parser.d.ts.map +1 -1
  130. package/dist/adapter/ezsp/driver/parser.js +1 -1
  131. package/dist/adapter/ezsp/driver/parser.js.map +1 -1
  132. package/dist/adapter/ezsp/driver/types/basic.d.ts.map +1 -1
  133. package/dist/adapter/ezsp/driver/types/basic.js +5 -5
  134. package/dist/adapter/ezsp/driver/types/basic.js.map +1 -1
  135. package/dist/adapter/ezsp/driver/types/index.d.ts.map +1 -1
  136. package/dist/adapter/ezsp/driver/types/index.js.map +1 -1
  137. package/dist/adapter/ezsp/driver/types/named.d.ts.map +1 -1
  138. package/dist/adapter/ezsp/driver/types/named.js +236 -234
  139. package/dist/adapter/ezsp/driver/types/named.js.map +1 -1
  140. package/dist/adapter/ezsp/driver/types/struct.d.ts.map +1 -1
  141. package/dist/adapter/ezsp/driver/types/struct.js +5 -3
  142. package/dist/adapter/ezsp/driver/types/struct.js.map +1 -1
  143. package/dist/adapter/ezsp/driver/uart.d.ts.map +1 -1
  144. package/dist/adapter/ezsp/driver/uart.js +8 -8
  145. package/dist/adapter/ezsp/driver/uart.js.map +1 -1
  146. package/dist/adapter/ezsp/driver/utils/index.d.ts +1 -1
  147. package/dist/adapter/ezsp/driver/utils/index.d.ts.map +1 -1
  148. package/dist/adapter/ezsp/driver/utils/index.js +12 -11
  149. package/dist/adapter/ezsp/driver/utils/index.js.map +1 -1
  150. package/dist/adapter/ezsp/driver/writer.d.ts.map +1 -1
  151. package/dist/adapter/ezsp/driver/writer.js +6 -7
  152. package/dist/adapter/ezsp/driver/writer.js.map +1 -1
  153. package/dist/adapter/index.d.ts +2 -2
  154. package/dist/adapter/index.d.ts.map +1 -1
  155. package/dist/adapter/index.js +2 -2
  156. package/dist/adapter/index.js.map +1 -1
  157. package/dist/adapter/serialPort.d.ts +1 -1
  158. package/dist/adapter/serialPort.d.ts.map +1 -1
  159. package/dist/adapter/serialPort.js +1 -1
  160. package/dist/adapter/serialPort.js.map +1 -1
  161. package/dist/adapter/serialPortUtils.js +1 -1
  162. package/dist/adapter/serialPortUtils.js.map +1 -1
  163. package/dist/adapter/socketPortUtils.js +3 -3
  164. package/dist/adapter/tstype.d.ts +1 -1
  165. package/dist/adapter/tstype.d.ts.map +1 -1
  166. package/dist/adapter/z-stack/adapter/adapter-backup.d.ts +3 -3
  167. package/dist/adapter/z-stack/adapter/adapter-backup.d.ts.map +1 -1
  168. package/dist/adapter/z-stack/adapter/adapter-backup.js +101 -86
  169. package/dist/adapter/z-stack/adapter/adapter-backup.js.map +1 -1
  170. package/dist/adapter/z-stack/adapter/adapter-nv-memory.d.ts +10 -10
  171. package/dist/adapter/z-stack/adapter/adapter-nv-memory.d.ts.map +1 -1
  172. package/dist/adapter/z-stack/adapter/adapter-nv-memory.js +30 -24
  173. package/dist/adapter/z-stack/adapter/adapter-nv-memory.js.map +1 -1
  174. package/dist/adapter/z-stack/adapter/endpoints.d.ts.map +1 -1
  175. package/dist/adapter/z-stack/adapter/endpoints.js +4 -4
  176. package/dist/adapter/z-stack/adapter/endpoints.js.map +1 -1
  177. package/dist/adapter/z-stack/adapter/index.d.ts +1 -1
  178. package/dist/adapter/z-stack/adapter/index.d.ts.map +1 -1
  179. package/dist/adapter/z-stack/adapter/index.js.map +1 -1
  180. package/dist/adapter/z-stack/adapter/manager.d.ts +5 -5
  181. package/dist/adapter/z-stack/adapter/manager.d.ts.map +1 -1
  182. package/dist/adapter/z-stack/adapter/manager.js +90 -81
  183. package/dist/adapter/z-stack/adapter/manager.js.map +1 -1
  184. package/dist/adapter/z-stack/adapter/tstype.d.ts +1 -1
  185. package/dist/adapter/z-stack/adapter/tstype.d.ts.map +1 -1
  186. package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts +5 -5
  187. package/dist/adapter/z-stack/adapter/zStackAdapter.d.ts.map +1 -1
  188. package/dist/adapter/z-stack/adapter/zStackAdapter.js +72 -57
  189. package/dist/adapter/z-stack/adapter/zStackAdapter.js.map +1 -1
  190. package/dist/adapter/z-stack/constants/af.js +5 -5
  191. package/dist/adapter/z-stack/constants/af.js.map +1 -1
  192. package/dist/adapter/z-stack/constants/dbg.js +2 -2
  193. package/dist/adapter/z-stack/constants/index.d.ts +2 -2
  194. package/dist/adapter/z-stack/constants/index.d.ts.map +1 -1
  195. package/dist/adapter/z-stack/constants/index.js +2 -2
  196. package/dist/adapter/z-stack/constants/index.js.map +1 -1
  197. package/dist/adapter/z-stack/constants/mac.js +11 -11
  198. package/dist/adapter/z-stack/constants/sapi.js +4 -4
  199. package/dist/adapter/z-stack/constants/sys.js +11 -11
  200. package/dist/adapter/z-stack/constants/util.js +11 -11
  201. package/dist/adapter/z-stack/constants/utils.d.ts.map +1 -1
  202. package/dist/adapter/z-stack/constants/utils.js +3 -3
  203. package/dist/adapter/z-stack/constants/utils.js.map +1 -1
  204. package/dist/adapter/z-stack/constants/zdo.js +13 -13
  205. package/dist/adapter/z-stack/models/index.d.ts +1 -1
  206. package/dist/adapter/z-stack/models/startup-options.d.ts +2 -2
  207. package/dist/adapter/z-stack/structs/entries/address-manager-entry.d.ts +1 -1
  208. package/dist/adapter/z-stack/structs/entries/address-manager-entry.js +4 -4
  209. package/dist/adapter/z-stack/structs/entries/address-manager-entry.js.map +1 -1
  210. package/dist/adapter/z-stack/structs/entries/address-manager-table.d.ts +2 -2
  211. package/dist/adapter/z-stack/structs/entries/address-manager-table.d.ts.map +1 -1
  212. package/dist/adapter/z-stack/structs/entries/address-manager-table.js +4 -7
  213. package/dist/adapter/z-stack/structs/entries/address-manager-table.js.map +1 -1
  214. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.d.ts +1 -1
  215. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.d.ts.map +1 -1
  216. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.js +1 -5
  217. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-entry.js.map +1 -1
  218. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.d.ts +2 -2
  219. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.d.ts.map +1 -1
  220. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.js +3 -6
  221. package/dist/adapter/z-stack/structs/entries/aps-link-key-data-table.js.map +1 -1
  222. package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.d.ts +1 -1
  223. package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-entry.js +6 -6
  224. package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.d.ts +2 -2
  225. package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.d.ts.map +1 -1
  226. package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.js +3 -6
  227. package/dist/adapter/z-stack/structs/entries/aps-tc-link-key-table.js.map +1 -1
  228. package/dist/adapter/z-stack/structs/entries/channel-list.d.ts +1 -1
  229. package/dist/adapter/z-stack/structs/entries/channel-list.d.ts.map +1 -1
  230. package/dist/adapter/z-stack/structs/entries/channel-list.js +1 -3
  231. package/dist/adapter/z-stack/structs/entries/channel-list.js.map +1 -1
  232. package/dist/adapter/z-stack/structs/entries/has-configured.d.ts +1 -1
  233. package/dist/adapter/z-stack/structs/entries/has-configured.d.ts.map +1 -1
  234. package/dist/adapter/z-stack/structs/entries/has-configured.js +2 -2
  235. package/dist/adapter/z-stack/structs/entries/has-configured.js.map +1 -1
  236. package/dist/adapter/z-stack/structs/entries/index.d.ts +16 -16
  237. package/dist/adapter/z-stack/structs/entries/nib.d.ts +1 -1
  238. package/dist/adapter/z-stack/structs/entries/nib.d.ts.map +1 -1
  239. package/dist/adapter/z-stack/structs/entries/nib.js +50 -50
  240. package/dist/adapter/z-stack/structs/entries/nib.js.map +1 -1
  241. package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.d.ts +1 -1
  242. package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.d.ts.map +1 -1
  243. package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.js +1 -4
  244. package/dist/adapter/z-stack/structs/entries/nwk-key-descriptor.js.map +1 -1
  245. package/dist/adapter/z-stack/structs/entries/nwk-key.d.ts +1 -1
  246. package/dist/adapter/z-stack/structs/entries/nwk-key.d.ts.map +1 -1
  247. package/dist/adapter/z-stack/structs/entries/nwk-key.js +1 -3
  248. package/dist/adapter/z-stack/structs/entries/nwk-key.js.map +1 -1
  249. package/dist/adapter/z-stack/structs/entries/nwk-pan-id.d.ts +1 -1
  250. package/dist/adapter/z-stack/structs/entries/nwk-pan-id.d.ts.map +1 -1
  251. package/dist/adapter/z-stack/structs/entries/nwk-pan-id.js +1 -3
  252. package/dist/adapter/z-stack/structs/entries/nwk-pan-id.js.map +1 -1
  253. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.d.ts +1 -1
  254. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.d.ts.map +1 -1
  255. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.js +3 -3
  256. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-entry.js.map +1 -1
  257. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.d.ts +2 -2
  258. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.d.ts.map +1 -1
  259. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.js +3 -6
  260. package/dist/adapter/z-stack/structs/entries/nwk-sec-material-descriptor-table.js.map +1 -1
  261. package/dist/adapter/z-stack/structs/entries/security-manager-entry.d.ts +1 -1
  262. package/dist/adapter/z-stack/structs/entries/security-manager-entry.js +4 -4
  263. package/dist/adapter/z-stack/structs/entries/security-manager-table.d.ts +2 -2
  264. package/dist/adapter/z-stack/structs/entries/security-manager-table.d.ts.map +1 -1
  265. package/dist/adapter/z-stack/structs/entries/security-manager-table.js +3 -7
  266. package/dist/adapter/z-stack/structs/entries/security-manager-table.js.map +1 -1
  267. package/dist/adapter/z-stack/structs/index.d.ts +4 -4
  268. package/dist/adapter/z-stack/structs/serializable-memory-object.d.ts +1 -1
  269. package/dist/adapter/z-stack/structs/struct.d.ts +6 -6
  270. package/dist/adapter/z-stack/structs/struct.d.ts.map +1 -1
  271. package/dist/adapter/z-stack/structs/struct.js +53 -52
  272. package/dist/adapter/z-stack/structs/struct.js.map +1 -1
  273. package/dist/adapter/z-stack/structs/table.d.ts +3 -3
  274. package/dist/adapter/z-stack/structs/table.d.ts.map +1 -1
  275. package/dist/adapter/z-stack/structs/table.js +16 -16
  276. package/dist/adapter/z-stack/structs/table.js.map +1 -1
  277. package/dist/adapter/z-stack/unpi/constants.d.ts +1 -1
  278. package/dist/adapter/z-stack/unpi/constants.d.ts.map +1 -1
  279. package/dist/adapter/z-stack/unpi/constants.js +1 -1
  280. package/dist/adapter/z-stack/unpi/constants.js.map +1 -1
  281. package/dist/adapter/z-stack/unpi/frame.d.ts.map +1 -1
  282. package/dist/adapter/z-stack/unpi/frame.js +5 -6
  283. package/dist/adapter/z-stack/unpi/frame.js.map +1 -1
  284. package/dist/adapter/z-stack/unpi/index.d.ts +4 -4
  285. package/dist/adapter/z-stack/unpi/index.d.ts.map +1 -1
  286. package/dist/adapter/z-stack/unpi/index.js +6 -6
  287. package/dist/adapter/z-stack/unpi/index.js.map +1 -1
  288. package/dist/adapter/z-stack/unpi/parser.d.ts.map +1 -1
  289. package/dist/adapter/z-stack/unpi/parser.js +1 -1
  290. package/dist/adapter/z-stack/unpi/parser.js.map +1 -1
  291. package/dist/adapter/z-stack/unpi/writer.d.ts.map +1 -1
  292. package/dist/adapter/z-stack/unpi/writer.js.map +1 -1
  293. package/dist/adapter/z-stack/utils/channel-list.d.ts.map +1 -1
  294. package/dist/adapter/z-stack/utils/channel-list.js +5 -2
  295. package/dist/adapter/z-stack/utils/channel-list.js.map +1 -1
  296. package/dist/adapter/z-stack/utils/index.d.ts +2 -2
  297. package/dist/adapter/z-stack/utils/network-options.d.ts +1 -1
  298. package/dist/adapter/z-stack/utils/network-options.d.ts.map +1 -1
  299. package/dist/adapter/z-stack/utils/network-options.js +1 -1
  300. package/dist/adapter/z-stack/utils/network-options.js.map +1 -1
  301. package/dist/adapter/z-stack/znp/buffaloZnp.d.ts.map +1 -1
  302. package/dist/adapter/z-stack/znp/buffaloZnp.js +8 -8
  303. package/dist/adapter/z-stack/znp/buffaloZnp.js.map +1 -1
  304. package/dist/adapter/z-stack/znp/definition.d.ts.map +1 -1
  305. package/dist/adapter/z-stack/znp/definition.js +200 -592
  306. package/dist/adapter/z-stack/znp/definition.js.map +1 -1
  307. package/dist/adapter/z-stack/znp/index.d.ts +1 -1
  308. package/dist/adapter/z-stack/znp/index.d.ts.map +1 -1
  309. package/dist/adapter/z-stack/znp/index.js.map +1 -1
  310. package/dist/adapter/z-stack/znp/parameterType.d.ts.map +1 -1
  311. package/dist/adapter/z-stack/znp/parameterType.js.map +1 -1
  312. package/dist/adapter/z-stack/znp/tstype.d.ts.map +1 -1
  313. package/dist/adapter/z-stack/znp/znp.d.ts +3 -3
  314. package/dist/adapter/z-stack/znp/znp.d.ts.map +1 -1
  315. package/dist/adapter/z-stack/znp/znp.js +12 -15
  316. package/dist/adapter/z-stack/znp/znp.js.map +1 -1
  317. package/dist/adapter/z-stack/znp/zpiObject.d.ts +1 -1
  318. package/dist/adapter/z-stack/znp/zpiObject.d.ts.map +1 -1
  319. package/dist/adapter/z-stack/znp/zpiObject.js +17 -9
  320. package/dist/adapter/z-stack/znp/zpiObject.js.map +1 -1
  321. package/dist/adapter/zigate/adapter/index.d.ts.map +1 -1
  322. package/dist/adapter/zigate/adapter/index.js.map +1 -1
  323. package/dist/adapter/zigate/adapter/zigateAdapter.d.ts +1 -1
  324. package/dist/adapter/zigate/adapter/zigateAdapter.d.ts.map +1 -1
  325. package/dist/adapter/zigate/adapter/zigateAdapter.js +88 -92
  326. package/dist/adapter/zigate/adapter/zigateAdapter.js.map +1 -1
  327. package/dist/adapter/zigate/driver/buffaloZiGate.js.map +1 -1
  328. package/dist/adapter/zigate/driver/commandType.d.ts +2 -2
  329. package/dist/adapter/zigate/driver/commandType.d.ts.map +1 -1
  330. package/dist/adapter/zigate/driver/commandType.js +72 -80
  331. package/dist/adapter/zigate/driver/commandType.js.map +1 -1
  332. package/dist/adapter/zigate/driver/constants.d.ts +9 -9
  333. package/dist/adapter/zigate/driver/constants.d.ts.map +1 -1
  334. package/dist/adapter/zigate/driver/constants.js +11 -65
  335. package/dist/adapter/zigate/driver/constants.js.map +1 -1
  336. package/dist/adapter/zigate/driver/frame.d.ts.map +1 -1
  337. package/dist/adapter/zigate/driver/frame.js +3 -15
  338. package/dist/adapter/zigate/driver/frame.js.map +1 -1
  339. package/dist/adapter/zigate/driver/messageType.d.ts +1 -1
  340. package/dist/adapter/zigate/driver/messageType.d.ts.map +1 -1
  341. package/dist/adapter/zigate/driver/messageType.js +29 -30
  342. package/dist/adapter/zigate/driver/messageType.js.map +1 -1
  343. package/dist/adapter/zigate/driver/parameterType.d.ts.map +1 -1
  344. package/dist/adapter/zigate/driver/parameterType.js.map +1 -1
  345. package/dist/adapter/zigate/driver/ziGateObject.d.ts +2 -2
  346. package/dist/adapter/zigate/driver/ziGateObject.d.ts.map +1 -1
  347. package/dist/adapter/zigate/driver/ziGateObject.js +11 -5
  348. package/dist/adapter/zigate/driver/ziGateObject.js.map +1 -1
  349. package/dist/adapter/zigate/driver/zigate.d.ts +5 -5
  350. package/dist/adapter/zigate/driver/zigate.d.ts.map +1 -1
  351. package/dist/adapter/zigate/driver/zigate.js +12 -12
  352. package/dist/adapter/zigate/driver/zigate.js.map +1 -1
  353. package/dist/buffalo/buffalo.d.ts +1 -1
  354. package/dist/buffalo/buffalo.d.ts.map +1 -1
  355. package/dist/buffalo/buffalo.js +1 -1
  356. package/dist/buffalo/buffalo.js.map +1 -1
  357. package/dist/controller/controller.d.ts.map +1 -1
  358. package/dist/controller/controller.js +34 -33
  359. package/dist/controller/controller.js.map +1 -1
  360. package/dist/controller/database.d.ts.map +1 -1
  361. package/dist/controller/database.js +6 -2
  362. package/dist/controller/database.js.map +1 -1
  363. package/dist/controller/events.d.ts +3 -3
  364. package/dist/controller/events.d.ts.map +1 -1
  365. package/dist/controller/greenPower.d.ts +1 -1
  366. package/dist/controller/greenPower.d.ts.map +1 -1
  367. package/dist/controller/greenPower.js +15 -17
  368. package/dist/controller/greenPower.js.map +1 -1
  369. package/dist/controller/helpers/index.d.ts +1 -1
  370. package/dist/controller/helpers/index.d.ts.map +1 -1
  371. package/dist/controller/helpers/index.js.map +1 -1
  372. package/dist/controller/helpers/request.d.ts +1 -1
  373. package/dist/controller/helpers/request.d.ts.map +1 -1
  374. package/dist/controller/helpers/request.js +7 -10
  375. package/dist/controller/helpers/request.js.map +1 -1
  376. package/dist/controller/helpers/requestQueue.d.ts.map +1 -1
  377. package/dist/controller/helpers/requestQueue.js +2 -3
  378. package/dist/controller/helpers/requestQueue.js.map +1 -1
  379. package/dist/controller/helpers/zclFrameConverter.d.ts +1 -1
  380. package/dist/controller/helpers/zclFrameConverter.d.ts.map +1 -1
  381. package/dist/controller/helpers/zclFrameConverter.js.map +1 -1
  382. package/dist/controller/index.d.ts +1 -1
  383. package/dist/controller/index.d.ts.map +1 -1
  384. package/dist/controller/index.js.map +1 -1
  385. package/dist/controller/model/device.d.ts +3 -3
  386. package/dist/controller/model/device.d.ts.map +1 -1
  387. package/dist/controller/model/device.js +247 -94
  388. package/dist/controller/model/device.js.map +1 -1
  389. package/dist/controller/model/endpoint.d.ts +4 -4
  390. package/dist/controller/model/endpoint.d.ts.map +1 -1
  391. package/dist/controller/model/endpoint.js +45 -31
  392. package/dist/controller/model/endpoint.js.map +1 -1
  393. package/dist/controller/model/entity.d.ts +2 -2
  394. package/dist/controller/model/entity.d.ts.map +1 -1
  395. package/dist/controller/model/entity.js.map +1 -1
  396. package/dist/controller/model/group.d.ts +2 -2
  397. package/dist/controller/model/group.d.ts.map +1 -1
  398. package/dist/controller/model/group.js +8 -6
  399. package/dist/controller/model/group.js.map +1 -1
  400. package/dist/controller/model/index.d.ts +1 -1
  401. package/dist/controller/model/index.d.ts.map +1 -1
  402. package/dist/controller/model/index.js.map +1 -1
  403. package/dist/controller/touchlink.d.ts.map +1 -1
  404. package/dist/controller/touchlink.js +2 -2
  405. package/dist/controller/touchlink.js.map +1 -1
  406. package/dist/controller/tstype.d.ts.map +1 -1
  407. package/dist/controller/tstype.js +0 -1
  408. package/dist/controller/tstype.js.map +1 -1
  409. package/dist/models/backup-storage-legacy.d.ts +4 -4
  410. package/dist/models/backup-storage-legacy.d.ts.map +1 -1
  411. package/dist/models/backup-storage-unified.d.ts +1 -1
  412. package/dist/models/backup.d.ts +2 -2
  413. package/dist/models/index.d.ts +4 -4
  414. package/dist/utils/backup.d.ts +1 -1
  415. package/dist/utils/backup.d.ts.map +1 -1
  416. package/dist/utils/backup.js +71 -58
  417. package/dist/utils/backup.js.map +1 -1
  418. package/dist/utils/index.d.ts +6 -6
  419. package/dist/utils/index.d.ts.map +1 -1
  420. package/dist/utils/index.js +10 -10
  421. package/dist/utils/index.js.map +1 -1
  422. package/dist/utils/isNumberArray.js +1 -1
  423. package/dist/utils/isNumberArray.js.map +1 -1
  424. package/dist/utils/queue.js +1 -1
  425. package/dist/utils/queue.js.map +1 -1
  426. package/dist/utils/waitress.d.ts.map +1 -1
  427. package/dist/utils/waitress.js +2 -2
  428. package/dist/utils/waitress.js.map +1 -1
  429. package/dist/zspec/consts.d.ts +1 -1
  430. package/dist/zspec/consts.d.ts.map +1 -1
  431. package/dist/zspec/consts.js +16 -16
  432. package/dist/zspec/consts.js.map +1 -1
  433. package/dist/zspec/enums.js +0 -1
  434. package/dist/zspec/enums.js.map +1 -1
  435. package/dist/zspec/utils.d.ts.map +1 -1
  436. package/dist/zspec/utils.js +5 -3
  437. package/dist/zspec/utils.js.map +1 -1
  438. package/dist/zspec/zcl/buffaloZcl.d.ts +2 -2
  439. package/dist/zspec/zcl/buffaloZcl.d.ts.map +1 -1
  440. package/dist/zspec/zcl/buffaloZcl.js +44 -51
  441. package/dist/zspec/zcl/buffaloZcl.js.map +1 -1
  442. package/dist/zspec/zcl/definition/cluster.d.ts.map +1 -1
  443. package/dist/zspec/zcl/definition/cluster.js +284 -380
  444. package/dist/zspec/zcl/definition/cluster.js.map +1 -1
  445. package/dist/zspec/zcl/definition/consts.js +10 -10
  446. package/dist/zspec/zcl/definition/consts.js.map +1 -1
  447. package/dist/zspec/zcl/definition/enums.d.ts.map +1 -1
  448. package/dist/zspec/zcl/definition/enums.js.map +1 -1
  449. package/dist/zspec/zcl/definition/foundation.d.ts +1 -1
  450. package/dist/zspec/zcl/definition/foundation.d.ts.map +1 -1
  451. package/dist/zspec/zcl/definition/foundation.js +51 -22
  452. package/dist/zspec/zcl/definition/foundation.js.map +1 -1
  453. package/dist/zspec/zcl/definition/manufacturerCode.js +0 -1
  454. package/dist/zspec/zcl/definition/manufacturerCode.js.map +1 -1
  455. package/dist/zspec/zcl/definition/status.d.ts.map +1 -1
  456. package/dist/zspec/zcl/definition/tstype.d.ts +1 -1
  457. package/dist/zspec/zcl/definition/tstype.d.ts.map +1 -1
  458. package/dist/zspec/zcl/definition/tstype.js +0 -1
  459. package/dist/zspec/zcl/definition/tstype.js.map +1 -1
  460. package/dist/zspec/zcl/utils.d.ts.map +1 -1
  461. package/dist/zspec/zcl/utils.js +59 -19
  462. package/dist/zspec/zcl/utils.js.map +1 -1
  463. package/dist/zspec/zcl/zclFrame.d.ts +1 -1
  464. package/dist/zspec/zcl/zclFrame.d.ts.map +1 -1
  465. package/dist/zspec/zcl/zclFrame.js +14 -15
  466. package/dist/zspec/zcl/zclFrame.js.map +1 -1
  467. package/dist/zspec/zcl/zclHeader.d.ts +1 -1
  468. package/dist/zspec/zcl/zclHeader.d.ts.map +1 -1
  469. package/dist/zspec/zcl/zclHeader.js +7 -7
  470. package/dist/zspec/zcl/zclHeader.js.map +1 -1
  471. package/dist/zspec/zcl/zclStatusError.d.ts.map +1 -1
  472. package/dist/zspec/zcl/zclStatusError.js.map +1 -1
  473. package/dist/zspec/zdo/buffaloZdo.d.ts +3 -3
  474. package/dist/zspec/zdo/buffaloZdo.d.ts.map +1 -1
  475. package/dist/zspec/zdo/buffaloZdo.js +92 -92
  476. package/dist/zspec/zdo/buffaloZdo.js.map +1 -1
  477. package/dist/zspec/zdo/definition/clusters.d.ts.map +1 -1
  478. package/dist/zspec/zdo/definition/clusters.js +0 -1
  479. package/dist/zspec/zdo/definition/clusters.js.map +1 -1
  480. package/dist/zspec/zdo/definition/consts.d.ts.map +1 -1
  481. package/dist/zspec/zdo/definition/consts.js.map +1 -1
  482. package/dist/zspec/zdo/definition/enums.d.ts.map +1 -1
  483. package/dist/zspec/zdo/definition/enums.js +0 -5
  484. package/dist/zspec/zdo/definition/enums.js.map +1 -1
  485. package/dist/zspec/zdo/definition/status.d.ts.map +1 -1
  486. package/dist/zspec/zdo/definition/status.js +0 -1
  487. package/dist/zspec/zdo/definition/status.js.map +1 -1
  488. package/dist/zspec/zdo/definition/tstypes.d.ts +2 -2
  489. package/dist/zspec/zdo/definition/tstypes.d.ts.map +1 -1
  490. package/dist/zspec/zdo/utils.d.ts.map +1 -1
  491. package/dist/zspec/zdo/utils.js +14 -14
  492. package/dist/zspec/zdo/utils.js.map +1 -1
  493. package/dist/zspec/zdo/zdoStatusError.d.ts.map +1 -1
  494. package/dist/zspec/zdo/zdoStatusError.js.map +1 -1
  495. package/package.json +6 -1
  496. package/dist/adapter/ember/adapter/requestQueue.d.ts +0 -67
  497. package/dist/adapter/ember/adapter/requestQueue.d.ts.map +0 -1
  498. package/dist/adapter/ember/adapter/requestQueue.js +0 -159
  499. package/dist/adapter/ember/adapter/requestQueue.js.map +0 -1
@@ -29,20 +29,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.Ezsp = exports.EzspEvents = void 0;
30
30
  /* istanbul ignore file */
31
31
  const events_1 = __importDefault(require("events"));
32
- const cluster_1 = require("../../../zspec/zcl/definition/cluster");
32
+ const utils_1 = require("../../../utils");
33
+ const logger_1 = require("../../../utils/logger");
33
34
  const ZSpec = __importStar(require("../../../zspec"));
35
+ const cluster_1 = require("../../../zspec/zcl/definition/cluster");
34
36
  const Zdo = __importStar(require("../../../zspec/zdo"));
35
- const math_1 = require("../utils/math");
36
- const enums_1 = require("../enums");
37
- const consts_1 = require("./consts");
38
- const enums_2 = require("./enums");
39
- const ash_1 = require("../uart/ash");
40
- const buffalo_1 = require("./buffalo");
41
- const consts_2 = require("../consts");
42
37
  const endpoints_1 = require("../adapter/endpoints");
43
- const logger_1 = require("../../../utils/logger");
38
+ const consts_1 = require("../consts");
39
+ const enums_1 = require("../enums");
44
40
  const ezspError_1 = require("../ezspError");
41
+ const ash_1 = require("../uart/ash");
45
42
  const initters_1 = require("../utils/initters");
43
+ const math_1 = require("../utils/math");
44
+ const buffalo_1 = require("./buffalo");
45
+ const consts_2 = require("./consts");
46
+ const enums_2 = require("./enums");
46
47
  const NS = 'zh:ember:ezsp';
47
48
  /** no multi-network atm, so just use const */
48
49
  const DEFAULT_NETWORK_INDEX = endpoints_1.FIXED_ENDPOINTS[0].networkIndex;
@@ -63,7 +64,7 @@ const ZA_MAX_HOPS = 12;
63
64
  * The mask applied to generated message tags used by the framework when sending messages via EZSP.
64
65
  * Customers who call ezspSend functions directly must use message tags outside this mask.
65
66
  */
66
- const MESSAGE_TAG_MASK = 0x7F;
67
+ const MESSAGE_TAG_MASK = 0x7f;
67
68
  var EzspEvents;
68
69
  (function (EzspEvents) {
69
70
  //-- An error was detected that requires resetting the NCP.
@@ -95,7 +96,6 @@ var EzspEvents;
95
96
  */
96
97
  class Ezsp extends events_1.default {
97
98
  version;
98
- tickInterval;
99
99
  ash;
100
100
  buffalo;
101
101
  /** The contents of the current EZSP frame. CAREFUL using this guy, it's pre-allocated. */
@@ -108,22 +108,22 @@ class Ezsp extends events_1.default {
108
108
  /** The total Length of the incoming frame */
109
109
  callbackFrameLength;
110
110
  initialVersionSent;
111
- /** True if a command is in the process of being sent. */
112
- sendingCommand;
113
111
  /** EZSP frame sequence number. Used in EZSP_SEQUENCE_INDEX byte. */
114
112
  frameSequence;
115
113
  /** Sequence used for EZSP send() tagging. static uint8_t */
116
114
  sendSequence;
115
+ queue;
117
116
  /** Awaiting response resolve/timer struct. Null if not waiting for response. */
118
117
  responseWaiter;
119
118
  /** Counter for Queue Full errors */
120
119
  counterErrQueueFull;
121
120
  constructor(options) {
122
121
  super();
123
- this.frameContents = Buffer.alloc(consts_1.EZSP_MAX_FRAME_LENGTH);
122
+ this.frameContents = Buffer.alloc(consts_2.EZSP_MAX_FRAME_LENGTH);
124
123
  this.buffalo = new buffalo_1.EzspBuffalo(this.frameContents);
125
- this.callbackFrameContents = Buffer.alloc(consts_1.EZSP_MAX_FRAME_LENGTH);
124
+ this.callbackFrameContents = Buffer.alloc(consts_2.EZSP_MAX_FRAME_LENGTH);
126
125
  this.callbackBuffalo = new buffalo_1.EzspBuffalo(this.callbackFrameContents);
126
+ this.queue = new utils_1.Queue(1);
127
127
  this.ash = new ash_1.UartAsh(options);
128
128
  }
129
129
  /**
@@ -135,25 +135,23 @@ class Ezsp extends events_1.default {
135
135
  return this.ash.rxQueue.length;
136
136
  }
137
137
  /**
138
- * Create a string representation of the last frame in storage (sent or received).
138
+ * Create a string representation of the last received frame in storage.
139
139
  */
140
140
  get frameToString() {
141
141
  const id = this.buffalo.getFrameId();
142
- return `[FRAME: ID=${id}:"${enums_2.EzspFrameID[id]}" Seq=${this.frameContents[consts_1.EZSP_SEQUENCE_INDEX]} Len=${this.frameLength}]`;
142
+ return `[FRAME: ID=${id}:"${enums_2.EzspFrameID[id]}" Seq=${this.frameContents[consts_2.EZSP_SEQUENCE_INDEX]} Len=${this.frameLength}]`;
143
143
  }
144
144
  /**
145
- * Create a string representation of the last callback frame in storage (received only).
145
+ * Create a string representation of the last received callback frame in storage.
146
146
  */
147
147
  get callbackFrameToString() {
148
148
  const id = this.callbackBuffalo.getFrameId();
149
- return `[CBFRAME: ID=${id}:"${enums_2.EzspFrameID[id]}" Seq=${this.callbackFrameContents[consts_1.EZSP_SEQUENCE_INDEX]} Len=${this.callbackFrameLength}]`;
149
+ return `[CBFRAME: ID=${id}:"${enums_2.EzspFrameID[id]}" Seq=${this.callbackFrameContents[consts_2.EZSP_SEQUENCE_INDEX]} Len=${this.callbackFrameLength}]`;
150
150
  }
151
151
  initVariables() {
152
- if (this.responseWaiter != null) {
153
- clearTimeout(this.responseWaiter.timer);
154
- }
155
152
  this.ash.removeAllListeners(ash_1.AshEvents.FATAL_ERROR);
156
153
  this.ash.removeAllListeners(ash_1.AshEvents.FRAME);
154
+ this.queue.clear();
157
155
  this.frameContents.fill(0);
158
156
  this.frameLength = 0;
159
157
  this.buffalo.setPosition(0);
@@ -161,10 +159,8 @@ class Ezsp extends events_1.default {
161
159
  this.callbackFrameLength = 0;
162
160
  this.callbackBuffalo.setPosition(0);
163
161
  this.initialVersionSent = false;
164
- this.sendingCommand = false;
165
162
  this.frameSequence = -1; // start at 0
166
163
  this.sendSequence = 0; // start at 1
167
- this.responseWaiter = null;
168
164
  this.counterErrQueueFull = 0;
169
165
  }
170
166
  async start() {
@@ -233,7 +229,7 @@ class Ezsp extends events_1.default {
233
229
  }
234
230
  this.ash.rxQueue.removeEntry(buffer);
235
231
  // logger.debug(`<<<< ${buffer.data.subarray(0, buffer.len).toString('hex')}`, NS);
236
- if (buffer.data[consts_1.EZSP_FRAME_CONTROL_INDEX] & consts_1.EZSP_FRAME_CONTROL_ASYNCH_CB) {
232
+ if (buffer.data[consts_2.EZSP_FRAME_CONTROL_INDEX] & consts_2.EZSP_FRAME_CONTROL_ASYNCH_CB) {
237
233
  // take only what len tells us is actual content
238
234
  buffer.data.copy(this.callbackFrameContents, 0, 0, buffer.len);
239
235
  this.callbackFrameLength = buffer.len;
@@ -289,31 +285,30 @@ class Ezsp extends events_1.default {
289
285
  // resetting under these conditions does not solve the problem as the problem is external to the NCP.
290
286
  // Throttling the additional traffic and staggering things might make it better instead.
291
287
  // For all other errors, we reset the NCP
292
- if ((status !== enums_1.EzspStatus.ERROR_SECURITY_PARAMETERS_INVALID) && (status !== enums_1.EzspStatus.ERROR_OVERFLOW)
293
- && (status !== enums_1.EzspStatus.ERROR_QUEUE_FULL) && (status !== enums_1.EzspStatus.ERROR_WRONG_DIRECTION)) {
288
+ if (status !== enums_1.EzspStatus.ERROR_SECURITY_PARAMETERS_INVALID &&
289
+ status !== enums_1.EzspStatus.ERROR_OVERFLOW &&
290
+ status !== enums_1.EzspStatus.ERROR_QUEUE_FULL &&
291
+ status !== enums_1.EzspStatus.ERROR_WRONG_DIRECTION) {
294
292
  this.emit(EzspEvents.NCP_NEEDS_RESET_AND_INIT, status);
295
293
  }
296
294
  }
297
295
  nextFrameSequence() {
298
- return (this.frameSequence = ((++this.frameSequence) & 0xFF));
296
+ return (this.frameSequence = ++this.frameSequence & 0xff);
299
297
  }
300
298
  startCommand(command) {
301
- if (this.sendingCommand) {
302
- logger_1.logger.error(`[SEND COMMAND] Cannot send second one before processing response from first one.`, NS);
303
- throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_CALL);
304
- }
305
- this.sendingCommand = true;
299
+ const sendBuffalo = new buffalo_1.EzspBuffalo(Buffer.alloc(consts_2.EZSP_MAX_FRAME_LENGTH));
306
300
  // Send initial EZSP_VERSION command with old packet format for old Hosts/NCPs
307
301
  if (command === enums_2.EzspFrameID.VERSION && !this.initialVersionSent) {
308
- this.buffalo.setPosition(consts_1.EZSP_PARAMETERS_INDEX);
309
- this.buffalo.setCommandByte(consts_1.EZSP_FRAME_ID_INDEX, (0, math_1.lowByte)(command));
302
+ sendBuffalo.setPosition(consts_2.EZSP_PARAMETERS_INDEX);
303
+ sendBuffalo.setCommandByte(consts_2.EZSP_FRAME_ID_INDEX, (0, math_1.lowByte)(command));
310
304
  }
311
305
  else {
312
306
  // convert to extended frame format
313
- this.buffalo.setPosition(consts_1.EZSP_EXTENDED_PARAMETERS_INDEX);
314
- this.buffalo.setCommandByte(consts_1.EZSP_EXTENDED_FRAME_ID_LB_INDEX, (0, math_1.lowByte)(command));
315
- this.buffalo.setCommandByte(consts_1.EZSP_EXTENDED_FRAME_ID_HB_INDEX, (0, math_1.highByte)(command));
307
+ sendBuffalo.setPosition(consts_2.EZSP_EXTENDED_PARAMETERS_INDEX);
308
+ sendBuffalo.setCommandByte(consts_2.EZSP_EXTENDED_FRAME_ID_LB_INDEX, (0, math_1.lowByte)(command));
309
+ sendBuffalo.setCommandByte(consts_2.EZSP_EXTENDED_FRAME_ID_HB_INDEX, (0, math_1.highByte)(command));
316
310
  }
311
+ return sendBuffalo;
317
312
  }
318
313
  /**
319
314
  * Sends the current EZSP command frame. Returns EZSP_SUCCESS if the command was sent successfully.
@@ -331,7 +326,7 @@ class Ezsp extends events_1.default {
331
326
  * - EzspStatus.DATA_FRAME_TOO_LONG
332
327
  * - EzspStatus.NOT_CONNECTED
333
328
  *
334
- * if ezsp.sendCommand times out, this will be EzspStatus.ASH_ACK_TIMEOUT (XXX: for now)
329
+ * if ezsp.sendCommand times out, this will be EzspStatus.ASH_ERROR_TIMEOUTS
335
330
  *
336
331
  * if ezsp.sendCommand resolves, this will be whatever ezsp.responseReceived returns:
337
332
  * - EzspStatus.NO_RX_DATA (should not happen if command was sent (since we subscribe to frame event to trigger function))
@@ -341,55 +336,63 @@ class Ezsp extends events_1.default {
341
336
  * - EzspStatus.ERROR_TRUNCATED
342
337
  * - EzspStatus.SUCCESS
343
338
  */
344
- async sendCommand() {
339
+ async sendCommand(sendBuffalo) {
345
340
  if (!this.checkConnection()) {
346
341
  logger_1.logger.debug(`[SEND COMMAND] NOT CONNECTED`, NS);
347
342
  return enums_1.EzspStatus.NOT_CONNECTED;
348
343
  }
349
- this.buffalo.setCommandByte(consts_1.EZSP_SEQUENCE_INDEX, this.nextFrameSequence());
344
+ const sequence = this.nextFrameSequence();
345
+ sendBuffalo.setCommandByte(consts_2.EZSP_SEQUENCE_INDEX, sequence);
350
346
  // we always set the network index in the ezsp frame control.
351
- this.buffalo.setCommandByte(consts_1.EZSP_EXTENDED_FRAME_CONTROL_LB_INDEX, (consts_1.EZSP_FRAME_CONTROL_COMMAND | (DEFAULT_SLEEP_MODE & consts_1.EZSP_FRAME_CONTROL_SLEEP_MODE_MASK)
352
- | ((DEFAULT_NETWORK_INDEX << consts_1.EZSP_FRAME_CONTROL_NETWORK_INDEX_OFFSET) & consts_1.EZSP_FRAME_CONTROL_NETWORK_INDEX_MASK)));
347
+ sendBuffalo.setCommandByte(consts_2.EZSP_EXTENDED_FRAME_CONTROL_LB_INDEX, consts_2.EZSP_FRAME_CONTROL_COMMAND |
348
+ (DEFAULT_SLEEP_MODE & consts_2.EZSP_FRAME_CONTROL_SLEEP_MODE_MASK) |
349
+ ((DEFAULT_NETWORK_INDEX << consts_2.EZSP_FRAME_CONTROL_NETWORK_INDEX_OFFSET) & consts_2.EZSP_FRAME_CONTROL_NETWORK_INDEX_MASK));
353
350
  // Send initial EZSP_VERSION command with old packet format for old Hosts/NCPs
354
- if (!this.initialVersionSent && (this.buffalo.getCommandByte(consts_1.EZSP_FRAME_ID_INDEX) === enums_2.EzspFrameID.VERSION)) {
351
+ if (!this.initialVersionSent && sendBuffalo.getCommandByte(consts_2.EZSP_FRAME_ID_INDEX) === enums_2.EzspFrameID.VERSION) {
355
352
  this.initialVersionSent = true;
356
353
  }
357
354
  else {
358
- this.buffalo.setCommandByte(consts_1.EZSP_EXTENDED_FRAME_CONTROL_HB_INDEX, consts_1.EZSP_EXTENDED_FRAME_FORMAT_VERSION);
355
+ sendBuffalo.setCommandByte(consts_2.EZSP_EXTENDED_FRAME_CONTROL_HB_INDEX, consts_2.EZSP_EXTENDED_FRAME_FORMAT_VERSION);
359
356
  }
360
357
  // might have tried to write more than allocated EZSP_MAX_FRAME_LENGTH for frameContents
361
358
  // use write index to detect broken frames cases (inc'ed every time a byte is supposed to have been written)
362
359
  // since index is always inc'ed on setCommandByte, this should always end at 202 max
363
- const length = this.buffalo.getPosition();
364
- if (length > consts_1.EZSP_MAX_FRAME_LENGTH) {
360
+ const length = sendBuffalo.getPosition();
361
+ if (length > consts_2.EZSP_MAX_FRAME_LENGTH) {
365
362
  // this.ezspErrorHandler(EzspStatus.ERROR_COMMAND_TOO_LONG);// XXX: this forces a NCP reset??
366
363
  return enums_1.EzspStatus.ERROR_COMMAND_TOO_LONG;
367
364
  }
368
- this.frameLength = length;
369
- let status;
370
- logger_1.logger.debug(`===> ${this.frameToString}`, NS);
371
- try {
372
- status = await new Promise((resolve, reject) => {
373
- const sendStatus = (this.ash.send(this.frameLength, this.frameContents));
374
- if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
375
- return reject(new ezspError_1.EzspError(sendStatus));
365
+ return this.queue.execute(async () => {
366
+ let status = enums_1.EzspStatus.ASH_ERROR_TIMEOUTS; // will be overwritten below as necessary
367
+ const frameId = sendBuffalo.getFrameId();
368
+ const frameString = `[FRAME: ID=${frameId}:"${enums_2.EzspFrameID[frameId]}" Seq=${sequence} Len=${length}]`;
369
+ logger_1.logger.debug(`===> ${frameString}`, NS);
370
+ try {
371
+ status = await new Promise((resolve, reject) => {
372
+ const sendStatus = this.ash.send(length, sendBuffalo.getBuffer());
373
+ if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
374
+ reject(new ezspError_1.EzspError(sendStatus));
375
+ return;
376
+ }
377
+ this.responseWaiter = {
378
+ timer: setTimeout(() => reject(new ezspError_1.EzspError(enums_1.EzspStatus.ASH_ERROR_TIMEOUTS)), this.ash.responseTimeout),
379
+ resolve,
380
+ };
381
+ });
382
+ if (status !== enums_1.EzspStatus.SUCCESS) {
383
+ throw new ezspError_1.EzspError(status);
376
384
  }
377
- this.responseWaiter = {
378
- timer: setTimeout(() => reject(new ezspError_1.EzspError(enums_1.EzspStatus.ASH_ERROR_TIMEOUTS)), this.ash.responseTimeout),
379
- resolve,
380
- };
381
- });
382
- if (status !== enums_1.EzspStatus.SUCCESS) {
383
- throw new ezspError_1.EzspError(status);
384
385
  }
385
- }
386
- catch (error) {
387
- this.responseWaiter = null;
388
- logger_1.logger.debug(`=x=> ${this.frameToString} ${error}`, NS);
389
- this.ezspErrorHandler(status);
390
- }
391
- this.sendingCommand = false;
392
- return status;
386
+ catch (error) {
387
+ this.responseWaiter = null;
388
+ logger_1.logger.debug(`=x=> ${frameString} ${error}`, NS);
389
+ if (error instanceof ezspError_1.EzspError) {
390
+ status = error.code;
391
+ this.ezspErrorHandler(status);
392
+ }
393
+ }
394
+ return status;
395
+ });
393
396
  }
394
397
  /**
395
398
  * Sets the stage for parsing if valid (indexes buffalo to params index).
@@ -403,16 +406,16 @@ class Ezsp extends events_1.default {
403
406
  if (frameId === enums_2.EzspFrameID.INVALID_COMMAND) {
404
407
  status = buffalo.getResponseByte(parametersIndex);
405
408
  }
406
- if ((frameControl & consts_1.EZSP_FRAME_CONTROL_DIRECTION_MASK) !== consts_1.EZSP_FRAME_CONTROL_RESPONSE) {
409
+ if ((frameControl & consts_2.EZSP_FRAME_CONTROL_DIRECTION_MASK) !== consts_2.EZSP_FRAME_CONTROL_RESPONSE) {
407
410
  status = enums_1.EzspStatus.ERROR_WRONG_DIRECTION;
408
411
  }
409
- if ((frameControl & consts_1.EZSP_FRAME_CONTROL_TRUNCATED_MASK) === consts_1.EZSP_FRAME_CONTROL_TRUNCATED) {
412
+ if ((frameControl & consts_2.EZSP_FRAME_CONTROL_TRUNCATED_MASK) === consts_2.EZSP_FRAME_CONTROL_TRUNCATED) {
410
413
  status = enums_1.EzspStatus.ERROR_TRUNCATED;
411
414
  }
412
- if ((frameControl & consts_1.EZSP_FRAME_CONTROL_OVERFLOW_MASK) === consts_1.EZSP_FRAME_CONTROL_OVERFLOW) {
415
+ if ((frameControl & consts_2.EZSP_FRAME_CONTROL_OVERFLOW_MASK) === consts_2.EZSP_FRAME_CONTROL_OVERFLOW) {
413
416
  status = enums_1.EzspStatus.ERROR_OVERFLOW;
414
417
  }
415
- if ((frameControl & consts_1.EZSP_FRAME_CONTROL_PENDING_CB_MASK) === consts_1.EZSP_FRAME_CONTROL_PENDING_CB) {
418
+ if ((frameControl & consts_2.EZSP_FRAME_CONTROL_PENDING_CB_MASK) === consts_2.EZSP_FRAME_CONTROL_PENDING_CB) {
416
419
  this.ash.ncpHasCallbacks = true;
417
420
  }
418
421
  else {
@@ -428,7 +431,7 @@ class Ezsp extends events_1.default {
428
431
  // The system can still communicate but buffers are running critically low.
429
432
  // This is almost always due to network congestion and goes away when the network becomes quieter.
430
433
  if (status === enums_1.EzspStatus.ERROR_OVERFLOW) {
431
- return enums_1.EzspStatus.SUCCESS;
434
+ status = enums_1.EzspStatus.SUCCESS;
432
435
  }
433
436
  return status;
434
437
  }
@@ -523,7 +526,7 @@ class Ezsp extends events_1.default {
523
526
  break;
524
527
  }
525
528
  case enums_2.EzspFrameID.MESSAGE_SENT_HANDLER: {
526
- if (this.version < 0x0E) {
529
+ if (this.version < 0x0e) {
527
530
  const type = this.callbackBuffalo.readUInt8();
528
531
  const indexOrDestination = this.callbackBuffalo.readUInt16();
529
532
  const apsFrame = this.callbackBuffalo.readEmberApsFrame();
@@ -557,7 +560,7 @@ class Ezsp extends events_1.default {
557
560
  break;
558
561
  }
559
562
  case enums_2.EzspFrameID.INCOMING_MESSAGE_HANDLER: {
560
- if (this.version < 0x0E) {
563
+ if (this.version < 0x0e) {
561
564
  const type = this.callbackBuffalo.readUInt8();
562
565
  const apsFrame = this.callbackBuffalo.readEmberApsFrame();
563
566
  const lastHopLqi = this.callbackBuffalo.readUInt8();
@@ -572,7 +575,7 @@ class Ezsp extends events_1.default {
572
575
  addressIndex,
573
576
  lastHopLqi,
574
577
  lastHopRssi,
575
- lastHopTimestamp: 0
578
+ lastHopTimestamp: 0,
576
579
  };
577
580
  const messageContents = this.callbackBuffalo.readPayload();
578
581
  this.ezspIncomingMessageHandler(type, apsFrame, packetInfo, messageContents);
@@ -621,7 +624,7 @@ class Ezsp extends events_1.default {
621
624
  break;
622
625
  }
623
626
  case enums_2.EzspFrameID.MAC_PASSTHROUGH_MESSAGE_HANDLER: {
624
- if (this.version < 0x0E) {
627
+ if (this.version < 0x0e) {
625
628
  const messageType = this.callbackBuffalo.readUInt8();
626
629
  const lastHopLqi = this.callbackBuffalo.readUInt8();
627
630
  const lastHopRssi = this.callbackBuffalo.readInt8();
@@ -629,10 +632,10 @@ class Ezsp extends events_1.default {
629
632
  senderShortId: ZSpec.NULL_NODE_ID,
630
633
  senderLongId: ZSpec.BLANK_EUI64,
631
634
  bindingIndex: ZSpec.NULL_BINDING,
632
- addressIndex: 0xFF,
635
+ addressIndex: 0xff,
633
636
  lastHopLqi,
634
637
  lastHopRssi,
635
- lastHopTimestamp: 0
638
+ lastHopTimestamp: 0,
636
639
  };
637
640
  const messageContents = this.callbackBuffalo.readPayload();
638
641
  this.ezspMacPassthroughMessageHandler(messageType, packetInfo, messageContents);
@@ -646,7 +649,7 @@ class Ezsp extends events_1.default {
646
649
  break;
647
650
  }
648
651
  case enums_2.EzspFrameID.MAC_FILTER_MATCH_MESSAGE_HANDLER: {
649
- if (this.version < 0x0E) {
652
+ if (this.version < 0x0e) {
650
653
  const filterIndexMatch = this.callbackBuffalo.readUInt8();
651
654
  const legacyPassthroughType = this.callbackBuffalo.readUInt8();
652
655
  const lastHopLqi = this.callbackBuffalo.readUInt8();
@@ -655,10 +658,10 @@ class Ezsp extends events_1.default {
655
658
  senderShortId: ZSpec.NULL_NODE_ID,
656
659
  senderLongId: ZSpec.BLANK_EUI64,
657
660
  bindingIndex: ZSpec.NULL_BINDING,
658
- addressIndex: 0xFF,
661
+ addressIndex: 0xff,
659
662
  lastHopLqi,
660
663
  lastHopRssi,
661
- lastHopTimestamp: 0
664
+ lastHopTimestamp: 0,
662
665
  };
663
666
  const messageContents = this.callbackBuffalo.readPayload();
664
667
  this.ezspMacFilterMatchMessageHandler(filterIndexMatch, legacyPassthroughType, packetInfo, messageContents);
@@ -673,7 +676,7 @@ class Ezsp extends events_1.default {
673
676
  break;
674
677
  }
675
678
  case enums_2.EzspFrameID.RAW_TRANSMIT_COMPLETE_HANDLER: {
676
- if (this.version < 0x0E) {
679
+ if (this.version < 0x0e) {
677
680
  const status = this.callbackBuffalo.readStatus(this.version);
678
681
  this.ezspRawTransmitCompleteHandler(Buffer.alloc(0), status);
679
682
  }
@@ -744,13 +747,12 @@ class Ezsp extends events_1.default {
744
747
  case enums_2.EzspFrameID.MFGLIB_RX_HANDLER: {
745
748
  const linkQuality = this.callbackBuffalo.readUInt8();
746
749
  const rssi = this.callbackBuffalo.readInt8();
747
- const packetLength = this.callbackBuffalo.readUInt8();
748
- const packetContents = this.callbackBuffalo.readListUInt8(packetLength);
749
- this.ezspMfglibRxHandler(linkQuality, rssi, packetLength, packetContents);
750
+ const packetContents = this.callbackBuffalo.readPayload();
751
+ this.ezspMfglibRxHandler(linkQuality, rssi, packetContents);
750
752
  break;
751
753
  }
752
754
  case enums_2.EzspFrameID.INCOMING_BOOTLOAD_MESSAGE_HANDLER: {
753
- if (this.version < 0x0E) {
755
+ if (this.version < 0x0e) {
754
756
  const longId = this.callbackBuffalo.readIeeeAddr();
755
757
  const lastHopLqi = this.callbackBuffalo.readUInt8();
756
758
  const lastHopRssi = this.callbackBuffalo.readInt8();
@@ -758,7 +760,7 @@ class Ezsp extends events_1.default {
758
760
  senderShortId: ZSpec.NULL_NODE_ID,
759
761
  senderLongId: ZSpec.BLANK_EUI64,
760
762
  bindingIndex: ZSpec.NULL_BINDING,
761
- addressIndex: 0xFF,
763
+ addressIndex: 0xff,
762
764
  lastHopLqi,
763
765
  lastHopRssi,
764
766
  lastHopTimestamp: 0,
@@ -787,7 +789,7 @@ class Ezsp extends events_1.default {
787
789
  break;
788
790
  }
789
791
  case enums_2.EzspFrameID.ZLL_NETWORK_FOUND_HANDLER: {
790
- if (this.version < 0x0E) {
792
+ if (this.version < 0x0e) {
791
793
  const networkInfo = this.callbackBuffalo.readEmberZllNetwork();
792
794
  const isDeviceInfoNull = this.callbackBuffalo.readUInt8() !== 0;
793
795
  const deviceInfo = this.callbackBuffalo.readEmberZllDeviceInfoRecord();
@@ -797,7 +799,7 @@ class Ezsp extends events_1.default {
797
799
  senderShortId: ZSpec.NULL_NODE_ID,
798
800
  senderLongId: ZSpec.BLANK_EUI64,
799
801
  bindingIndex: ZSpec.NULL_BINDING,
800
- addressIndex: 0xFF,
802
+ addressIndex: 0xff,
801
803
  lastHopLqi,
802
804
  lastHopRssi,
803
805
  lastHopTimestamp: 0,
@@ -819,7 +821,7 @@ class Ezsp extends events_1.default {
819
821
  break;
820
822
  }
821
823
  case enums_2.EzspFrameID.ZLL_ADDRESS_ASSIGNMENT_HANDLER: {
822
- if (this.version < 0x0E) {
824
+ if (this.version < 0x0e) {
823
825
  const addressInfo = this.callbackBuffalo.readEmberZllAddressAssignment();
824
826
  const lastHopLqi = this.callbackBuffalo.readUInt8();
825
827
  const lastHopRssi = this.callbackBuffalo.readInt8();
@@ -827,7 +829,7 @@ class Ezsp extends events_1.default {
827
829
  senderShortId: ZSpec.NULL_NODE_ID,
828
830
  senderLongId: ZSpec.BLANK_EUI64,
829
831
  bindingIndex: ZSpec.NULL_BINDING,
830
- addressIndex: 0xFF,
832
+ addressIndex: 0xff,
831
833
  lastHopLqi,
832
834
  lastHopRssi,
833
835
  lastHopTimestamp: 0,
@@ -878,7 +880,7 @@ class Ezsp extends events_1.default {
878
880
  * @returns uint8_t
879
881
  */
880
882
  nextSendSequence() {
881
- return (this.sendSequence = ((++this.sendSequence) & MESSAGE_TAG_MASK));
883
+ return (this.sendSequence = ++this.sendSequence & MESSAGE_TAG_MASK);
882
884
  }
883
885
  /**
884
886
  * Calls ezspSend${x} based on type and takes care of tagging message.
@@ -891,11 +893,11 @@ class Ezsp extends events_1.default {
891
893
  * Unused for multicast types.
892
894
  * This must be one of the three ZigBee broadcast addresses for broadcast.
893
895
  * @param apsFrame [IN/OUT] EmberApsFrame * The APS frame which is to be added to the message.
896
+ * Sequence set in OUT as returned by ezspSend${x} command
894
897
  * @param message uint8_t * Content of the message.
895
898
  * @param alias The alias source address
896
899
  * @param sequence uint8_t The alias sequence number
897
900
  * @returns Result of the ezspSend${x} call or EmberStatus.INVALID_PARAMETER if type not supported.
898
- * @returns apsSequence as returned by ezspSend${x} command
899
901
  * @returns messageTag Tag used for ezspSend${x} command
900
902
  */
901
903
  async send(type, indexOrDestination, apsFrame, message, alias, sequence) {
@@ -908,30 +910,32 @@ class Ezsp extends events_1.default {
908
910
  case enums_1.EmberOutgoingMessageType.VIA_BINDING:
909
911
  case enums_1.EmberOutgoingMessageType.VIA_ADDRESS_TABLE:
910
912
  case enums_1.EmberOutgoingMessageType.DIRECT: {
911
- [status, apsSequence] = (await this.ezspSendUnicast(type, indexOrDestination, apsFrame, messageTag, message));
913
+ [status, apsSequence] = await this.ezspSendUnicast(type, indexOrDestination, apsFrame, messageTag, message);
912
914
  break;
913
915
  }
914
916
  case enums_1.EmberOutgoingMessageType.MULTICAST:
915
917
  case enums_1.EmberOutgoingMessageType.MULTICAST_WITH_ALIAS: {
916
918
  if (type === enums_1.EmberOutgoingMessageType.MULTICAST_WITH_ALIAS ||
917
- (apsFrame.sourceEndpoint === ZSpec.GP_ENDPOINT && apsFrame.destinationEndpoint === ZSpec.GP_ENDPOINT &&
918
- (apsFrame.options & enums_1.EmberApsOption.USE_ALIAS_SEQUENCE_NUMBER))) {
919
+ (apsFrame.sourceEndpoint === ZSpec.GP_ENDPOINT &&
920
+ apsFrame.destinationEndpoint === ZSpec.GP_ENDPOINT &&
921
+ apsFrame.options & enums_1.EmberApsOption.USE_ALIAS_SEQUENCE_NUMBER)) {
919
922
  nwkRadius = apsFrame.radius;
920
923
  nwkAlias = alias;
921
924
  }
922
- [status, apsSequence] = (await this.ezspSendMulticast(apsFrame, nwkRadius, 0, // broadcast addr
923
- nwkAlias, sequence, messageTag, message));
925
+ [status, apsSequence] = await this.ezspSendMulticast(apsFrame, nwkRadius, 0, // broadcast addr
926
+ nwkAlias, sequence, messageTag, message);
924
927
  break;
925
928
  }
926
929
  case enums_1.EmberOutgoingMessageType.BROADCAST:
927
930
  case enums_1.EmberOutgoingMessageType.BROADCAST_WITH_ALIAS: {
928
931
  if (type == enums_1.EmberOutgoingMessageType.BROADCAST_WITH_ALIAS ||
929
- (apsFrame.sourceEndpoint == ZSpec.GP_ENDPOINT && apsFrame.destinationEndpoint == ZSpec.GP_ENDPOINT &&
930
- (apsFrame.options & enums_1.EmberApsOption.USE_ALIAS_SEQUENCE_NUMBER))) {
932
+ (apsFrame.sourceEndpoint == ZSpec.GP_ENDPOINT &&
933
+ apsFrame.destinationEndpoint == ZSpec.GP_ENDPOINT &&
934
+ apsFrame.options & enums_1.EmberApsOption.USE_ALIAS_SEQUENCE_NUMBER)) {
931
935
  nwkRadius = apsFrame.radius;
932
936
  nwkAlias = alias;
933
937
  }
934
- [status, apsSequence] = (await this.ezspSendBroadcast(nwkAlias, indexOrDestination, sequence, apsFrame, nwkRadius, messageTag, message));
938
+ [status, apsSequence] = await this.ezspSendBroadcast(nwkAlias, indexOrDestination, sequence, apsFrame, nwkRadius, messageTag, message);
935
939
  break;
936
940
  }
937
941
  default:
@@ -949,18 +953,21 @@ class Ezsp extends events_1.default {
949
953
  * @returns EmberVersion*, null if status not SUCCESS.
950
954
  */
951
955
  async ezspGetVersionStruct() {
952
- const [status, outValueLength, outValue] = (await this.ezspGetValue(enums_2.EzspValueId.VERSION_INFO, 7)); // sizeof(EmberVersion)
956
+ const [status, outValueLength, outValue] = await this.ezspGetValue(enums_2.EzspValueId.VERSION_INFO, 7); // sizeof(EmberVersion)
953
957
  if (outValueLength !== 7) {
954
958
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_VALUE);
955
959
  }
956
- return [status, {
957
- build: outValue[0] + ((outValue[1]) << 8),
960
+ return [
961
+ status,
962
+ {
963
+ build: outValue[0] + (outValue[1] << 8),
958
964
  major: outValue[2],
959
965
  minor: outValue[3],
960
966
  patch: outValue[4],
961
967
  special: outValue[5],
962
968
  type: outValue[6],
963
- }];
969
+ },
970
+ ];
964
971
  }
965
972
  /**
966
973
  * Function for manipulating the endpoints flags on the NCP.
@@ -980,7 +987,7 @@ class Ezsp extends events_1.default {
980
987
  * @returns flags
981
988
  */
982
989
  async ezspGetEndpointFlags(endpoint) {
983
- const [status, outValLen, outVal] = (await this.ezspGetExtendedValue(enums_2.EzspExtendedValueId.ENDPOINT_FLAGS, endpoint, 2));
990
+ const [status, outValLen, outVal] = await this.ezspGetExtendedValue(enums_2.EzspExtendedValueId.ENDPOINT_FLAGS, endpoint, 2);
984
991
  if (outValLen < 2) {
985
992
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_VALUE);
986
993
  }
@@ -995,7 +1002,7 @@ class Ezsp extends events_1.default {
995
1002
  * @returns overhead uint8_t
996
1003
  */
997
1004
  async ezspGetSourceRouteOverhead(destination) {
998
- const [status, outValLen, outVal] = (await this.ezspGetExtendedValue(enums_2.EzspExtendedValueId.GET_SOURCE_ROUTE_OVERHEAD, destination, 1));
1005
+ const [status, outValLen, outVal] = await this.ezspGetExtendedValue(enums_2.EzspExtendedValueId.GET_SOURCE_ROUTE_OVERHEAD, destination, 1);
999
1006
  if (outValLen < 1) {
1000
1007
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_VALUE);
1001
1008
  }
@@ -1008,7 +1015,7 @@ class Ezsp extends events_1.default {
1008
1015
  * @returns nodeId NodeId*
1009
1016
  */
1010
1017
  async ezspGetLastLeaveReason() {
1011
- const [status, outValLen, outVal] = (await this.ezspGetExtendedValue(enums_2.EzspExtendedValueId.LAST_LEAVE_REASON, 0, 3));
1018
+ const [status, outValLen, outVal] = await this.ezspGetExtendedValue(enums_2.EzspExtendedValueId.LAST_LEAVE_REASON, 0, 3);
1012
1019
  if (outValLen < 3) {
1013
1020
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_VALUE);
1014
1021
  }
@@ -1020,7 +1027,7 @@ class Ezsp extends events_1.default {
1020
1027
  * @returns reason
1021
1028
  */
1022
1029
  async ezspGetLastRejoinReason() {
1023
- const [status, outValLen, outVal] = (await this.ezspGetValue(enums_2.EzspValueId.LAST_REJOIN_REASON, 1));
1030
+ const [status, outValLen, outVal] = await this.ezspGetValue(enums_2.EzspValueId.LAST_REJOIN_REASON, 1);
1024
1031
  if (outValLen < 1) {
1025
1032
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_VALUE);
1026
1033
  }
@@ -1039,7 +1046,7 @@ class Ezsp extends events_1.default {
1039
1046
  * @returns
1040
1047
  */
1041
1048
  async ezspGetExtendedSecurityBitmask() {
1042
- const [status, outValLen, outVal] = (await this.ezspGetValue(enums_2.EzspValueId.EXTENDED_SECURITY_BITMASK, 2));
1049
+ const [status, outValLen, outVal] = await this.ezspGetValue(enums_2.EzspValueId.EXTENDED_SECURITY_BITMASK, 2);
1043
1050
  if (outValLen < 2) {
1044
1051
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_VALUE);
1045
1052
  }
@@ -1077,9 +1084,9 @@ class Ezsp extends events_1.default {
1077
1084
  * @returns uint16_t * The version number of the stack.
1078
1085
  */
1079
1086
  async ezspVersion(desiredProtocolVersion) {
1080
- this.startCommand(enums_2.EzspFrameID.VERSION);
1081
- this.buffalo.writeUInt8(desiredProtocolVersion);
1082
- const sendStatus = await this.sendCommand();
1087
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.VERSION);
1088
+ sendBuffalo.writeUInt8(desiredProtocolVersion);
1089
+ const sendStatus = await this.sendCommand(sendBuffalo);
1083
1090
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1084
1091
  throw new ezspError_1.EzspError(sendStatus);
1085
1092
  }
@@ -1098,9 +1105,9 @@ class Ezsp extends events_1.default {
1098
1105
  * @returns uint16_t * The configuration value.
1099
1106
  */
1100
1107
  async ezspGetConfigurationValue(configId) {
1101
- this.startCommand(enums_2.EzspFrameID.GET_CONFIGURATION_VALUE);
1102
- this.buffalo.writeUInt8(configId);
1103
- const sendStatus = await this.sendCommand();
1108
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_CONFIGURATION_VALUE);
1109
+ sendBuffalo.writeUInt8(configId);
1110
+ const sendStatus = await this.sendCommand(sendBuffalo);
1104
1111
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1105
1112
  throw new ezspError_1.EzspError(sendStatus);
1106
1113
  }
@@ -1124,10 +1131,10 @@ class Ezsp extends events_1.default {
1124
1131
  * if configuration values can no longer be modified.
1125
1132
  */
1126
1133
  async ezspSetConfigurationValue(configId, value) {
1127
- this.startCommand(enums_2.EzspFrameID.SET_CONFIGURATION_VALUE);
1128
- this.buffalo.writeUInt8(configId);
1129
- this.buffalo.writeUInt16(value);
1130
- const sendStatus = await this.sendCommand();
1134
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_CONFIGURATION_VALUE);
1135
+ sendBuffalo.writeUInt8(configId);
1136
+ sendBuffalo.writeUInt16(value);
1137
+ const sendStatus = await this.sendCommand(sendBuffalo);
1131
1138
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1132
1139
  throw new ezspError_1.EzspError(sendStatus);
1133
1140
  }
@@ -1147,13 +1154,13 @@ class Ezsp extends events_1.default {
1147
1154
  * @returns uint8_t * Attribute data.
1148
1155
  */
1149
1156
  async ezspReadAttribute(endpoint, cluster, attributeId, mask, manufacturerCode, readLength) {
1150
- this.startCommand(enums_2.EzspFrameID.READ_ATTRIBUTE);
1151
- this.buffalo.writeUInt8(endpoint);
1152
- this.buffalo.writeUInt16(cluster);
1153
- this.buffalo.writeUInt16(attributeId);
1154
- this.buffalo.writeUInt8(mask);
1155
- this.buffalo.writeUInt16(manufacturerCode);
1156
- const sendStatus = await this.sendCommand();
1157
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.READ_ATTRIBUTE);
1158
+ sendBuffalo.writeUInt8(endpoint);
1159
+ sendBuffalo.writeUInt16(cluster);
1160
+ sendBuffalo.writeUInt16(attributeId);
1161
+ sendBuffalo.writeUInt8(mask);
1162
+ sendBuffalo.writeUInt16(manufacturerCode);
1163
+ const sendStatus = await this.sendCommand(sendBuffalo);
1157
1164
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1158
1165
  throw new ezspError_1.EzspError(sendStatus);
1159
1166
  }
@@ -1181,17 +1188,17 @@ class Ezsp extends events_1.default {
1181
1188
  * @returns An sl_zigbee_af_status_t value indicating success or the reason for failure.
1182
1189
  */
1183
1190
  async ezspWriteAttribute(endpoint, cluster, attributeId, mask, manufacturerCode, overrideReadOnlyAndDataType, justTest, dataType, data) {
1184
- this.startCommand(enums_2.EzspFrameID.WRITE_ATTRIBUTE);
1185
- this.buffalo.writeUInt8(endpoint);
1186
- this.buffalo.writeUInt16(cluster);
1187
- this.buffalo.writeUInt16(attributeId);
1188
- this.buffalo.writeUInt8(mask);
1189
- this.buffalo.writeUInt16(manufacturerCode);
1190
- this.buffalo.writeUInt8(overrideReadOnlyAndDataType ? 1 : 0);
1191
- this.buffalo.writeUInt8(justTest ? 1 : 0);
1192
- this.buffalo.writeUInt8(dataType);
1193
- this.buffalo.writePayload(data);
1194
- const sendStatus = await this.sendCommand();
1191
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.WRITE_ATTRIBUTE);
1192
+ sendBuffalo.writeUInt8(endpoint);
1193
+ sendBuffalo.writeUInt16(cluster);
1194
+ sendBuffalo.writeUInt16(attributeId);
1195
+ sendBuffalo.writeUInt8(mask);
1196
+ sendBuffalo.writeUInt16(manufacturerCode);
1197
+ sendBuffalo.writeUInt8(overrideReadOnlyAndDataType ? 1 : 0);
1198
+ sendBuffalo.writeUInt8(justTest ? 1 : 0);
1199
+ sendBuffalo.writeUInt8(dataType);
1200
+ sendBuffalo.writePayload(data);
1201
+ const sendStatus = await this.sendCommand(sendBuffalo);
1195
1202
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1196
1203
  throw new ezspError_1.EzspError(sendStatus);
1197
1204
  }
@@ -1216,16 +1223,16 @@ class Ezsp extends events_1.default {
1216
1223
  * if endpoints can no longer be added.
1217
1224
  */
1218
1225
  async ezspAddEndpoint(endpoint, profileId, deviceId, deviceVersion, inputClusterList, outputClusterList) {
1219
- this.startCommand(enums_2.EzspFrameID.ADD_ENDPOINT);
1220
- this.buffalo.writeUInt8(endpoint);
1221
- this.buffalo.writeUInt16(profileId);
1222
- this.buffalo.writeUInt16(deviceId);
1223
- this.buffalo.writeUInt8(deviceVersion);
1224
- this.buffalo.writeUInt8(inputClusterList.length);
1225
- this.buffalo.writeUInt8(outputClusterList.length);
1226
- this.buffalo.writeListUInt16(inputClusterList);
1227
- this.buffalo.writeListUInt16(outputClusterList);
1228
- const sendStatus = await this.sendCommand();
1226
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ADD_ENDPOINT);
1227
+ sendBuffalo.writeUInt8(endpoint);
1228
+ sendBuffalo.writeUInt16(profileId);
1229
+ sendBuffalo.writeUInt16(deviceId);
1230
+ sendBuffalo.writeUInt8(deviceVersion);
1231
+ sendBuffalo.writeUInt8(inputClusterList.length);
1232
+ sendBuffalo.writeUInt8(outputClusterList.length);
1233
+ sendBuffalo.writeListUInt16(inputClusterList);
1234
+ sendBuffalo.writeListUInt16(outputClusterList);
1235
+ const sendStatus = await this.sendCommand(sendBuffalo);
1229
1236
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1230
1237
  throw new ezspError_1.EzspError(sendStatus);
1231
1238
  }
@@ -1242,10 +1249,10 @@ class Ezsp extends events_1.default {
1242
1249
  * - SLStatus.ZIGBEE_EZSP_ERROR if the NCP does not recognize policyId.
1243
1250
  */
1244
1251
  async ezspSetPolicy(policyId, decisionId) {
1245
- this.startCommand(enums_2.EzspFrameID.SET_POLICY);
1246
- this.buffalo.writeUInt8(policyId);
1247
- this.buffalo.writeUInt8(decisionId);
1248
- const sendStatus = await this.sendCommand();
1252
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_POLICY);
1253
+ sendBuffalo.writeUInt8(policyId);
1254
+ sendBuffalo.writeUInt8(decisionId);
1255
+ const sendStatus = await this.sendCommand(sendBuffalo);
1249
1256
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1250
1257
  throw new ezspError_1.EzspError(sendStatus);
1251
1258
  }
@@ -1261,9 +1268,9 @@ class Ezsp extends events_1.default {
1261
1268
  * @returns EzspDecisionId * The current decision for the specified policy.
1262
1269
  */
1263
1270
  async ezspGetPolicy(policyId) {
1264
- this.startCommand(enums_2.EzspFrameID.GET_POLICY);
1265
- this.buffalo.writeUInt8(policyId);
1266
- const sendStatus = await this.sendCommand();
1271
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_POLICY);
1272
+ sendBuffalo.writeUInt8(policyId);
1273
+ const sendStatus = await this.sendCommand(sendBuffalo);
1267
1274
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1268
1275
  throw new ezspError_1.EzspError(sendStatus);
1269
1276
  }
@@ -1277,9 +1284,9 @@ class Ezsp extends events_1.default {
1277
1284
  * @returns true if the request was successfully handed to the stack, false otherwise
1278
1285
  */
1279
1286
  async ezspSendPanIdUpdate(newPan) {
1280
- this.startCommand(enums_2.EzspFrameID.SEND_PAN_ID_UPDATE);
1281
- this.buffalo.writeUInt16(newPan);
1282
- const sendStatus = await this.sendCommand();
1287
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_PAN_ID_UPDATE);
1288
+ sendBuffalo.writeUInt16(newPan);
1289
+ const sendStatus = await this.sendCommand(sendBuffalo);
1283
1290
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1284
1291
  throw new ezspError_1.EzspError(sendStatus);
1285
1292
  }
@@ -1299,9 +1306,9 @@ class Ezsp extends events_1.default {
1299
1306
  * @returns uint8_t * The value.
1300
1307
  */
1301
1308
  async ezspGetValue(valueId, valueLength) {
1302
- this.startCommand(enums_2.EzspFrameID.GET_VALUE);
1303
- this.buffalo.writeUInt8(valueId);
1304
- const sendStatus = await this.sendCommand();
1309
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_VALUE);
1310
+ sendBuffalo.writeUInt8(valueId);
1311
+ const sendStatus = await this.sendCommand(sendBuffalo);
1305
1312
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1306
1313
  throw new ezspError_1.EzspError(sendStatus);
1307
1314
  }
@@ -1329,10 +1336,10 @@ class Ezsp extends events_1.default {
1329
1336
  * @returns uint8_t * The value.
1330
1337
  */
1331
1338
  async ezspGetExtendedValue(valueId, characteristics, valueLength) {
1332
- this.startCommand(enums_2.EzspFrameID.GET_EXTENDED_VALUE);
1333
- this.buffalo.writeUInt8(valueId);
1334
- this.buffalo.writeUInt32(characteristics);
1335
- const sendStatus = await this.sendCommand();
1339
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_EXTENDED_VALUE);
1340
+ sendBuffalo.writeUInt8(valueId);
1341
+ sendBuffalo.writeUInt32(characteristics);
1342
+ const sendStatus = await this.sendCommand(sendBuffalo);
1336
1343
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1337
1344
  throw new ezspError_1.EzspError(sendStatus);
1338
1345
  }
@@ -1358,11 +1365,11 @@ class Ezsp extends events_1.default {
1358
1365
  * if the value could not be modified.
1359
1366
  */
1360
1367
  async ezspSetValue(valueId, valueLength, value) {
1361
- this.startCommand(enums_2.EzspFrameID.SET_VALUE);
1362
- this.buffalo.writeUInt8(valueId);
1363
- this.buffalo.writeUInt8(valueLength);
1364
- this.buffalo.writeListUInt8(value);
1365
- const sendStatus = await this.sendCommand();
1368
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_VALUE);
1369
+ sendBuffalo.writeUInt8(valueId);
1370
+ sendBuffalo.writeUInt8(valueLength);
1371
+ sendBuffalo.writeListUInt8(value);
1372
+ const sendStatus = await this.sendCommand(sendBuffalo);
1366
1373
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1367
1374
  throw new ezspError_1.EzspError(sendStatus);
1368
1375
  }
@@ -1377,10 +1384,10 @@ class Ezsp extends events_1.default {
1377
1384
  * @returns An SLStatus value indicating success or the reason for failure.
1378
1385
  */
1379
1386
  async ezspSetPassiveAckConfig(config, minAcksNeeded) {
1380
- this.startCommand(enums_2.EzspFrameID.SET_PASSIVE_ACK_CONFIG);
1381
- this.buffalo.writeUInt8(config);
1382
- this.buffalo.writeUInt8(minAcksNeeded);
1383
- const sendStatus = await this.sendCommand();
1387
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_PASSIVE_ACK_CONFIG);
1388
+ sendBuffalo.writeUInt8(config);
1389
+ sendBuffalo.writeUInt8(minAcksNeeded);
1390
+ const sendStatus = await this.sendCommand(sendBuffalo);
1384
1391
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1385
1392
  throw new ezspError_1.EzspError(sendStatus);
1386
1393
  }
@@ -1393,12 +1400,12 @@ class Ezsp extends events_1.default {
1393
1400
  * @param panId uint16_t PAN ID to be accepted in a network update.
1394
1401
  */
1395
1402
  async ezspSetPendingNetworkUpdatePanId(panId) {
1396
- if (this.version < 0x0E) {
1403
+ if (this.version < 0x0e) {
1397
1404
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1398
1405
  }
1399
- this.startCommand(enums_2.EzspFrameID.SET_PENDING_NETWORK_UPDATE_PAN_ID);
1400
- this.buffalo.writeUInt16(panId);
1401
- const sendStatus = await this.sendCommand();
1406
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_PENDING_NETWORK_UPDATE_PAN_ID);
1407
+ sendBuffalo.writeUInt16(panId);
1408
+ const sendStatus = await this.sendCommand(sendBuffalo);
1402
1409
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1403
1410
  throw new ezspError_1.EzspError(sendStatus);
1404
1411
  }
@@ -1409,12 +1416,12 @@ class Ezsp extends events_1.default {
1409
1416
  * @returns uint8_t Endpoint number at the index.
1410
1417
  */
1411
1418
  async ezspGetEndpoint(index) {
1412
- if (this.version < 0x0E) {
1419
+ if (this.version < 0x0e) {
1413
1420
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1414
1421
  }
1415
- this.startCommand(enums_2.EzspFrameID.GET_ENDPOINT);
1416
- this.buffalo.writeUInt8(index);
1417
- const sendStatus = await this.sendCommand();
1422
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_ENDPOINT);
1423
+ sendBuffalo.writeUInt8(index);
1424
+ const sendStatus = await this.sendCommand(sendBuffalo);
1418
1425
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1419
1426
  throw new ezspError_1.EzspError(sendStatus);
1420
1427
  }
@@ -1426,11 +1433,11 @@ class Ezsp extends events_1.default {
1426
1433
  * @returns uint8_t Number of configured endpoints.
1427
1434
  */
1428
1435
  async ezspGetEndpointCount() {
1429
- if (this.version < 0x0E) {
1436
+ if (this.version < 0x0e) {
1430
1437
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1431
1438
  }
1432
- this.startCommand(enums_2.EzspFrameID.GET_ENDPOINT_COUNT);
1433
- const sendStatus = await this.sendCommand();
1439
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_ENDPOINT_COUNT);
1440
+ const sendStatus = await this.sendCommand(sendBuffalo);
1434
1441
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1435
1442
  throw new ezspError_1.EzspError(sendStatus);
1436
1443
  }
@@ -1443,12 +1450,12 @@ class Ezsp extends events_1.default {
1443
1450
  * @returns Description of this endpoint.
1444
1451
  */
1445
1452
  async ezspGetEndpointDescription(endpoint) {
1446
- if (this.version < 0x0E) {
1453
+ if (this.version < 0x0e) {
1447
1454
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1448
1455
  }
1449
- this.startCommand(enums_2.EzspFrameID.GET_ENDPOINT_DESCRIPTION);
1450
- this.buffalo.writeUInt8(endpoint);
1451
- const sendStatus = await this.sendCommand();
1456
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_ENDPOINT_DESCRIPTION);
1457
+ sendBuffalo.writeUInt8(endpoint);
1458
+ const sendStatus = await this.sendCommand(sendBuffalo);
1452
1459
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1453
1460
  throw new ezspError_1.EzspError(sendStatus);
1454
1461
  }
@@ -1463,14 +1470,14 @@ class Ezsp extends events_1.default {
1463
1470
  * @returns ID of the requested cluster.
1464
1471
  */
1465
1472
  async ezspGetEndpointCluster(endpoint, listId, listIndex) {
1466
- if (this.version < 0x0E) {
1473
+ if (this.version < 0x0e) {
1467
1474
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1468
1475
  }
1469
- this.startCommand(enums_2.EzspFrameID.GET_ENDPOINT_CLUSTER);
1470
- this.buffalo.writeUInt8(endpoint);
1471
- this.buffalo.writeUInt8(listId);
1472
- this.buffalo.writeUInt8(listIndex);
1473
- const sendStatus = await this.sendCommand();
1476
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_ENDPOINT_CLUSTER);
1477
+ sendBuffalo.writeUInt8(endpoint);
1478
+ sendBuffalo.writeUInt8(listId);
1479
+ sendBuffalo.writeUInt8(listIndex);
1480
+ const sendStatus = await this.sendCommand(sendBuffalo);
1474
1481
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1475
1482
  throw new ezspError_1.EzspError(sendStatus);
1476
1483
  }
@@ -1484,8 +1491,8 @@ class Ezsp extends events_1.default {
1484
1491
  * A command which does nothing. The Host can use this to set the sleep mode or to check the status of the NCP.
1485
1492
  */
1486
1493
  async ezspNop() {
1487
- this.startCommand(enums_2.EzspFrameID.NOP);
1488
- const sendStatus = await this.sendCommand();
1494
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.NOP);
1495
+ const sendStatus = await this.sendCommand(sendBuffalo);
1489
1496
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1490
1497
  throw new ezspError_1.EzspError(sendStatus);
1491
1498
  }
@@ -1497,9 +1504,9 @@ class Ezsp extends events_1.default {
1497
1504
  * @returns uint8_t * The echo of the data.
1498
1505
  */
1499
1506
  async ezspEcho(data) {
1500
- this.startCommand(enums_2.EzspFrameID.ECHO);
1501
- this.buffalo.writePayload(data);
1502
- const sendStatus = await this.sendCommand();
1507
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ECHO);
1508
+ sendBuffalo.writePayload(data);
1509
+ const sendStatus = await this.sendCommand(sendBuffalo);
1503
1510
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1504
1511
  throw new ezspError_1.EzspError(sendStatus);
1505
1512
  }
@@ -1513,8 +1520,8 @@ class Ezsp extends events_1.default {
1513
1520
  * Allows the NCP to respond with a pending callback.
1514
1521
  */
1515
1522
  async ezspCallback() {
1516
- this.startCommand(enums_2.EzspFrameID.CALLBACK);
1517
- const sendStatus = await this.sendCommand();
1523
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CALLBACK);
1524
+ const sendStatus = await this.sendCommand(sendBuffalo);
1518
1525
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1519
1526
  throw new ezspError_1.EzspError(sendStatus);
1520
1527
  }
@@ -1534,10 +1541,10 @@ class Ezsp extends events_1.default {
1534
1541
  * @returns An SLStatus value indicating success or the reason for failure.
1535
1542
  */
1536
1543
  async ezspSetToken(tokenId, tokenData) {
1537
- this.startCommand(enums_2.EzspFrameID.SET_TOKEN);
1538
- this.buffalo.writeUInt8(tokenId);
1539
- this.buffalo.writeListUInt8(tokenData);
1540
- const sendStatus = await this.sendCommand();
1544
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_TOKEN);
1545
+ sendBuffalo.writeUInt8(tokenId);
1546
+ sendBuffalo.writeListUInt8(tokenData);
1547
+ const sendStatus = await this.sendCommand(sendBuffalo);
1541
1548
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1542
1549
  throw new ezspError_1.EzspError(sendStatus);
1543
1550
  }
@@ -1551,9 +1558,9 @@ class Ezsp extends events_1.default {
1551
1558
  * @returns uint8_t * The contents of the token.
1552
1559
  */
1553
1560
  async ezspGetToken(tokenId) {
1554
- this.startCommand(enums_2.EzspFrameID.GET_TOKEN);
1555
- this.buffalo.writeUInt8(tokenId);
1556
- const sendStatus = await this.sendCommand();
1561
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_TOKEN);
1562
+ sendBuffalo.writeUInt8(tokenId);
1563
+ const sendStatus = await this.sendCommand(sendBuffalo);
1557
1564
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1558
1565
  throw new ezspError_1.EzspError(sendStatus);
1559
1566
  }
@@ -1569,9 +1576,9 @@ class Ezsp extends events_1.default {
1569
1576
  * @returns uint8_t * The manufacturing token data.
1570
1577
  */
1571
1578
  async ezspGetMfgToken(tokenId) {
1572
- this.startCommand(enums_2.EzspFrameID.GET_MFG_TOKEN);
1573
- this.buffalo.writeUInt8(tokenId);
1574
- const sendStatus = await this.sendCommand();
1579
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_MFG_TOKEN);
1580
+ sendBuffalo.writeUInt8(tokenId);
1581
+ const sendStatus = await this.sendCommand(sendBuffalo);
1575
1582
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1576
1583
  throw new ezspError_1.EzspError(sendStatus);
1577
1584
  }
@@ -1628,10 +1635,10 @@ class Ezsp extends events_1.default {
1628
1635
  * @returns An SLStatus value indicating success or the reason for failure.
1629
1636
  */
1630
1637
  async ezspSetMfgToken(tokenId, tokenData) {
1631
- this.startCommand(enums_2.EzspFrameID.SET_MFG_TOKEN);
1632
- this.buffalo.writeUInt8(tokenId);
1633
- this.buffalo.writePayload(tokenData);
1634
- const sendStatus = await this.sendCommand();
1638
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_MFG_TOKEN);
1639
+ sendBuffalo.writeUInt8(tokenId);
1640
+ sendBuffalo.writePayload(tokenData);
1641
+ const sendStatus = await this.sendCommand(sendBuffalo);
1635
1642
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1636
1643
  throw new ezspError_1.EzspError(sendStatus);
1637
1644
  }
@@ -1652,8 +1659,8 @@ class Ezsp extends events_1.default {
1652
1659
  * @returns uint16_t * A pseudorandom number.
1653
1660
  */
1654
1661
  async ezspGetRandomNumber() {
1655
- this.startCommand(enums_2.EzspFrameID.GET_RANDOM_NUMBER);
1656
- const sendStatus = await this.sendCommand();
1662
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_RANDOM_NUMBER);
1663
+ const sendStatus = await this.sendCommand(sendBuffalo);
1657
1664
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1658
1665
  throw new ezspError_1.EzspError(sendStatus);
1659
1666
  }
@@ -1673,12 +1680,12 @@ class Ezsp extends events_1.default {
1673
1680
  * @returns An SLStatus value indicating success or the reason for failure.
1674
1681
  */
1675
1682
  async ezspSetTimer(timerId, time, units, repeat) {
1676
- this.startCommand(enums_2.EzspFrameID.SET_TIMER);
1677
- this.buffalo.writeUInt8(timerId);
1678
- this.buffalo.writeUInt16(time);
1679
- this.buffalo.writeUInt8(units);
1680
- this.buffalo.writeUInt8(repeat ? 1 : 0);
1681
- const sendStatus = await this.sendCommand();
1683
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_TIMER);
1684
+ sendBuffalo.writeUInt8(timerId);
1685
+ sendBuffalo.writeUInt16(time);
1686
+ sendBuffalo.writeUInt8(units);
1687
+ sendBuffalo.writeUInt8(repeat ? 1 : 0);
1688
+ const sendStatus = await this.sendCommand(sendBuffalo);
1682
1689
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1683
1690
  throw new ezspError_1.EzspError(sendStatus);
1684
1691
  }
@@ -1695,9 +1702,9 @@ class Ezsp extends events_1.default {
1695
1702
  * @returns bool * True if a timerHandler callback will be generated repeatedly. False if only a single timerHandler callback will be generated.
1696
1703
  */
1697
1704
  async ezspGetTimer(timerId) {
1698
- this.startCommand(enums_2.EzspFrameID.GET_TIMER);
1699
- this.buffalo.writeUInt8(timerId);
1700
- const sendStatus = await this.sendCommand();
1705
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_TIMER);
1706
+ sendBuffalo.writeUInt8(timerId);
1707
+ const sendStatus = await this.sendCommand(sendBuffalo);
1701
1708
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1702
1709
  throw new ezspError_1.EzspError(sendStatus);
1703
1710
  }
@@ -1721,10 +1728,10 @@ class Ezsp extends events_1.default {
1721
1728
  * @returns An SLStatus value indicating success or the reason for failure.
1722
1729
  */
1723
1730
  async ezspDebugWrite(binaryMessage, messageContents) {
1724
- this.startCommand(enums_2.EzspFrameID.DEBUG_WRITE);
1725
- this.buffalo.writeUInt8(binaryMessage ? 1 : 0);
1726
- this.buffalo.writePayload(messageContents);
1727
- const sendStatus = await this.sendCommand();
1731
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.DEBUG_WRITE);
1732
+ sendBuffalo.writeUInt8(binaryMessage ? 1 : 0);
1733
+ sendBuffalo.writePayload(messageContents);
1734
+ const sendStatus = await this.sendCommand(sendBuffalo);
1728
1735
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1729
1736
  throw new ezspError_1.EzspError(sendStatus);
1730
1737
  }
@@ -1736,8 +1743,8 @@ class Ezsp extends events_1.default {
1736
1743
  * @returns uint16_t * A list of all counter values ordered according to the EmberCounterType enumeration.
1737
1744
  */
1738
1745
  async ezspReadAndClearCounters() {
1739
- this.startCommand(enums_2.EzspFrameID.READ_AND_CLEAR_COUNTERS);
1740
- const sendStatus = await this.sendCommand();
1746
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.READ_AND_CLEAR_COUNTERS);
1747
+ const sendStatus = await this.sendCommand(sendBuffalo);
1741
1748
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1742
1749
  throw new ezspError_1.EzspError(sendStatus);
1743
1750
  }
@@ -1749,8 +1756,8 @@ class Ezsp extends events_1.default {
1749
1756
  * @returns uint16_t * A list of all counter values ordered according to the EmberCounterType enumeration.
1750
1757
  */
1751
1758
  async ezspReadCounters() {
1752
- this.startCommand(enums_2.EzspFrameID.READ_COUNTERS);
1753
- const sendStatus = await this.sendCommand();
1759
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.READ_COUNTERS);
1760
+ const sendStatus = await this.sendCommand(sendBuffalo);
1754
1761
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1755
1762
  throw new ezspError_1.EzspError(sendStatus);
1756
1763
  }
@@ -1771,9 +1778,9 @@ class Ezsp extends events_1.default {
1771
1778
  * @param delay uint16_t Data will not be read from the host for this many milliseconds.
1772
1779
  */
1773
1780
  async ezspDelayTest(delay) {
1774
- this.startCommand(enums_2.EzspFrameID.DELAY_TEST);
1775
- this.buffalo.writeUInt16(delay);
1776
- const sendStatus = await this.sendCommand();
1781
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.DELAY_TEST);
1782
+ sendBuffalo.writeUInt16(delay);
1783
+ const sendStatus = await this.sendCommand(sendBuffalo);
1777
1784
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1778
1785
  throw new ezspError_1.EzspError(sendStatus);
1779
1786
  }
@@ -1784,9 +1791,9 @@ class Ezsp extends events_1.default {
1784
1791
  * @returns The status of the library being queried.
1785
1792
  */
1786
1793
  async ezspGetLibraryStatus(libraryId) {
1787
- this.startCommand(enums_2.EzspFrameID.GET_LIBRARY_STATUS);
1788
- this.buffalo.writeUInt8(libraryId);
1789
- const sendStatus = await this.sendCommand();
1794
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_LIBRARY_STATUS);
1795
+ sendBuffalo.writeUInt8(libraryId);
1796
+ const sendStatus = await this.sendCommand(sendBuffalo);
1790
1797
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1791
1798
  throw new ezspError_1.EzspError(sendStatus);
1792
1799
  }
@@ -1804,8 +1811,8 @@ class Ezsp extends events_1.default {
1804
1811
  * @returns versionNumber uint16_t * The version number of the XNCP application.
1805
1812
  */
1806
1813
  async ezspGetXncpInfo() {
1807
- this.startCommand(enums_2.EzspFrameID.GET_XNCP_INFO);
1808
- const sendStatus = await this.sendCommand();
1814
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_XNCP_INFO);
1815
+ const sendStatus = await this.sendCommand(sendBuffalo);
1809
1816
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1810
1817
  throw new ezspError_1.EzspError(sendStatus);
1811
1818
  }
@@ -1825,9 +1832,9 @@ class Ezsp extends events_1.default {
1825
1832
  * @returns uint8_t *The response.
1826
1833
  */
1827
1834
  async ezspCustomFrame(payload, replyLength) {
1828
- this.startCommand(enums_2.EzspFrameID.CUSTOM_FRAME);
1829
- this.buffalo.writePayload(payload);
1830
- const sendStatus = await this.sendCommand();
1835
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CUSTOM_FRAME);
1836
+ sendBuffalo.writePayload(payload);
1837
+ const sendStatus = await this.sendCommand(sendBuffalo);
1831
1838
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1832
1839
  throw new ezspError_1.EzspError(sendStatus);
1833
1840
  }
@@ -1851,8 +1858,8 @@ class Ezsp extends events_1.default {
1851
1858
  * @returns The 64-bit ID.
1852
1859
  */
1853
1860
  async ezspGetEui64() {
1854
- this.startCommand(enums_2.EzspFrameID.GET_EUI64);
1855
- const sendStatus = await this.sendCommand();
1861
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_EUI64);
1862
+ const sendStatus = await this.sendCommand(sendBuffalo);
1856
1863
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1857
1864
  throw new ezspError_1.EzspError(sendStatus);
1858
1865
  }
@@ -1864,8 +1871,8 @@ class Ezsp extends events_1.default {
1864
1871
  * @returns The 16-bit ID.
1865
1872
  */
1866
1873
  async ezspGetNodeId() {
1867
- this.startCommand(enums_2.EzspFrameID.GET_NODE_ID);
1868
- const sendStatus = await this.sendCommand();
1874
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_NODE_ID);
1875
+ const sendStatus = await this.sendCommand(sendBuffalo);
1869
1876
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1870
1877
  throw new ezspError_1.EzspError(sendStatus);
1871
1878
  }
@@ -1877,8 +1884,8 @@ class Ezsp extends events_1.default {
1877
1884
  * @returns uint8_t Value indicate how many phy interfaces present.
1878
1885
  */
1879
1886
  async ezspGetPhyInterfaceCount() {
1880
- this.startCommand(enums_2.EzspFrameID.GET_PHY_INTERFACE_COUNT);
1881
- const sendStatus = await this.sendCommand();
1887
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_PHY_INTERFACE_COUNT);
1888
+ const sendStatus = await this.sendCommand(sendBuffalo);
1882
1889
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1883
1890
  throw new ezspError_1.EzspError(sendStatus);
1884
1891
  }
@@ -1890,8 +1897,8 @@ class Ezsp extends events_1.default {
1890
1897
  * @returns Value indicates the used entropy source.
1891
1898
  */
1892
1899
  async ezspGetTrueRandomEntropySource() {
1893
- this.startCommand(enums_2.EzspFrameID.GET_TRUE_RANDOM_ENTROPY_SOURCE);
1894
- const sendStatus = await this.sendCommand();
1900
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_TRUE_RANDOM_ENTROPY_SOURCE);
1901
+ const sendStatus = await this.sendCommand(sendBuffalo);
1895
1902
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1896
1903
  throw new ezspError_1.EzspError(sendStatus);
1897
1904
  }
@@ -1905,12 +1912,12 @@ class Ezsp extends events_1.default {
1905
1912
  * @returns An SLStatus value indicating success or the reason for failure.
1906
1913
  */
1907
1914
  async ezspSetupDelayedJoin(networkKeyTimeoutS) {
1908
- if (this.version < 0x0E) {
1915
+ if (this.version < 0x0e) {
1909
1916
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1910
1917
  }
1911
- this.startCommand(enums_2.EzspFrameID.SETUP_DELAYED_JOIN);
1912
- this.buffalo.writeUInt8(networkKeyTimeoutS);
1913
- const sendStatus = await this.sendCommand();
1918
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SETUP_DELAYED_JOIN);
1919
+ sendBuffalo.writeUInt8(networkKeyTimeoutS);
1920
+ const sendStatus = await this.sendCommand(sendBuffalo);
1914
1921
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1915
1922
  throw new ezspError_1.EzspError(sendStatus);
1916
1923
  }
@@ -1922,11 +1929,11 @@ class Ezsp extends events_1.default {
1922
1929
  * @returns The current priorities.
1923
1930
  */
1924
1931
  async ezspRadioGetSchedulerPriorities() {
1925
- if (this.version < 0x0E) {
1932
+ if (this.version < 0x0e) {
1926
1933
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1927
1934
  }
1928
- this.startCommand(enums_2.EzspFrameID.RADIO_GET_SCHEDULER_PRIORITIES);
1929
- const sendStatus = await this.sendCommand();
1935
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.RADIO_GET_SCHEDULER_PRIORITIES);
1936
+ const sendStatus = await this.sendCommand(sendBuffalo);
1930
1937
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1931
1938
  throw new ezspError_1.EzspError(sendStatus);
1932
1939
  }
@@ -1938,12 +1945,12 @@ class Ezsp extends events_1.default {
1938
1945
  * @param priorities The current priorities.
1939
1946
  */
1940
1947
  async ezspRadioSetSchedulerPriorities(priorities) {
1941
- if (this.version < 0x0E) {
1948
+ if (this.version < 0x0e) {
1942
1949
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1943
1950
  }
1944
- this.startCommand(enums_2.EzspFrameID.RADIO_SET_SCHEDULER_PRIORITIES);
1945
- this.buffalo.writeEmberMultiprotocolPriorities(priorities);
1946
- const sendStatus = await this.sendCommand();
1951
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.RADIO_SET_SCHEDULER_PRIORITIES);
1952
+ sendBuffalo.writeEmberMultiprotocolPriorities(priorities);
1953
+ const sendStatus = await this.sendCommand(sendBuffalo);
1947
1954
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1948
1955
  throw new ezspError_1.EzspError(sendStatus);
1949
1956
  }
@@ -1953,11 +1960,11 @@ class Ezsp extends events_1.default {
1953
1960
  * @returns Value of the current slip time.
1954
1961
  */
1955
1962
  async ezspRadioGetSchedulerSliptime() {
1956
- if (this.version < 0x0E) {
1963
+ if (this.version < 0x0e) {
1957
1964
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1958
1965
  }
1959
- this.startCommand(enums_2.EzspFrameID.RADIO_GET_SCHEDULER_SLIPTIME);
1960
- const sendStatus = await this.sendCommand();
1966
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.RADIO_GET_SCHEDULER_SLIPTIME);
1967
+ const sendStatus = await this.sendCommand(sendBuffalo);
1961
1968
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1962
1969
  throw new ezspError_1.EzspError(sendStatus);
1963
1970
  }
@@ -1969,12 +1976,12 @@ class Ezsp extends events_1.default {
1969
1976
  * @param slipTime Value of the current slip time.
1970
1977
  */
1971
1978
  async ezspRadioSetSchedulerSliptime(slipTime) {
1972
- if (this.version < 0x0E) {
1979
+ if (this.version < 0x0e) {
1973
1980
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1974
1981
  }
1975
- this.startCommand(enums_2.EzspFrameID.RADIO_SET_SCHEDULER_SLIPTIME);
1976
- this.buffalo.writeUInt32(slipTime);
1977
- const sendStatus = await this.sendCommand();
1982
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.RADIO_SET_SCHEDULER_SLIPTIME);
1983
+ sendBuffalo.writeUInt32(slipTime);
1984
+ const sendStatus = await this.sendCommand(sendBuffalo);
1978
1985
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1979
1986
  throw new ezspError_1.EzspError(sendStatus);
1980
1987
  }
@@ -1985,12 +1992,12 @@ class Ezsp extends events_1.default {
1985
1992
  * @returns Whether this counter requires a PHY index when operating on a dual-PHY system.
1986
1993
  */
1987
1994
  async ezspCounterRequiresPhyIndex(counter) {
1988
- if (this.version < 0x0E) {
1995
+ if (this.version < 0x0e) {
1989
1996
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
1990
1997
  }
1991
- this.startCommand(enums_2.EzspFrameID.COUNTER_REQUIRES_PHY_INDEX);
1992
- this.buffalo.writeUInt8(counter);
1993
- const sendStatus = await this.sendCommand();
1998
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.COUNTER_REQUIRES_PHY_INDEX);
1999
+ sendBuffalo.writeUInt8(counter);
2000
+ const sendStatus = await this.sendCommand(sendBuffalo);
1994
2001
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
1995
2002
  throw new ezspError_1.EzspError(sendStatus);
1996
2003
  }
@@ -2003,12 +2010,12 @@ class Ezsp extends events_1.default {
2003
2010
  * @returns Whether this counter requires the destination node ID.
2004
2011
  */
2005
2012
  async ezspCounterRequiresDestinationNodeId(counter) {
2006
- if (this.version < 0x0E) {
2013
+ if (this.version < 0x0e) {
2007
2014
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2008
2015
  }
2009
- this.startCommand(enums_2.EzspFrameID.COUNTER_REQUIRES_DESTINATION_NODE_ID);
2010
- this.buffalo.writeUInt8(counter);
2011
- const sendStatus = await this.sendCommand();
2016
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.COUNTER_REQUIRES_DESTINATION_NODE_ID);
2017
+ sendBuffalo.writeUInt8(counter);
2018
+ const sendStatus = await this.sendCommand(sendBuffalo);
2012
2019
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2013
2020
  throw new ezspError_1.EzspError(sendStatus);
2014
2021
  }
@@ -2024,9 +2031,9 @@ class Ezsp extends events_1.default {
2024
2031
  * @param code uint16_t The manufacturer code for the local node.
2025
2032
  */
2026
2033
  async ezspSetManufacturerCode(code) {
2027
- this.startCommand(enums_2.EzspFrameID.SET_MANUFACTURER_CODE);
2028
- this.buffalo.writeUInt16(code);
2029
- const sendStatus = await this.sendCommand();
2034
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_MANUFACTURER_CODE);
2035
+ sendBuffalo.writeUInt16(code);
2036
+ const sendStatus = await this.sendCommand(sendBuffalo);
2030
2037
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2031
2038
  throw new ezspError_1.EzspError(sendStatus);
2032
2039
  }
@@ -2037,11 +2044,11 @@ class Ezsp extends events_1.default {
2037
2044
  * @returns The manufacturer code for the local node.
2038
2045
  */
2039
2046
  async ezspGetManufacturerCode() {
2040
- if (this.version < 0x0E) {
2047
+ if (this.version < 0x0e) {
2041
2048
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2042
2049
  }
2043
- this.startCommand(enums_2.EzspFrameID.GET_MANUFACTURER_CODE);
2044
- const sendStatus = await this.sendCommand();
2050
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_MANUFACTURER_CODE);
2051
+ const sendStatus = await this.sendCommand(sendBuffalo);
2045
2052
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2046
2053
  throw new ezspError_1.EzspError(sendStatus);
2047
2054
  }
@@ -2056,13 +2063,13 @@ class Ezsp extends events_1.default {
2056
2063
  * @returns An SLStatus value indicating success or the reason for failure. Always `OK` in v13-.
2057
2064
  */
2058
2065
  async ezspSetPowerDescriptor(descriptor) {
2059
- this.startCommand(enums_2.EzspFrameID.SET_POWER_DESCRIPTOR);
2060
- this.buffalo.writeUInt16(descriptor);
2061
- const sendStatus = await this.sendCommand();
2066
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_POWER_DESCRIPTOR);
2067
+ sendBuffalo.writeUInt16(descriptor);
2068
+ const sendStatus = await this.sendCommand(sendBuffalo);
2062
2069
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2063
2070
  throw new ezspError_1.EzspError(sendStatus);
2064
2071
  }
2065
- if (this.version < 0x0E) {
2072
+ if (this.version < 0x0e) {
2066
2073
  return enums_1.SLStatus.OK;
2067
2074
  }
2068
2075
  else {
@@ -2082,9 +2089,9 @@ class Ezsp extends events_1.default {
2082
2089
  * - or the reason for failure.
2083
2090
  */
2084
2091
  async ezspNetworkInit(networkInitStruct) {
2085
- this.startCommand(enums_2.EzspFrameID.NETWORK_INIT);
2086
- this.buffalo.writeEmberNetworkInitStruct(networkInitStruct);
2087
- const sendStatus = await this.sendCommand();
2092
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.NETWORK_INIT);
2093
+ sendBuffalo.writeEmberNetworkInitStruct(networkInitStruct);
2094
+ const sendStatus = await this.sendCommand(sendBuffalo);
2088
2095
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2089
2096
  throw new ezspError_1.EzspError(sendStatus);
2090
2097
  }
@@ -2097,8 +2104,8 @@ class Ezsp extends events_1.default {
2097
2104
  * @returns An EmberNetworkStatus value indicating the current join status.
2098
2105
  */
2099
2106
  async ezspNetworkState() {
2100
- this.startCommand(enums_2.EzspFrameID.NETWORK_STATE);
2101
- const sendStatus = await this.sendCommand();
2107
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.NETWORK_STATE);
2108
+ const sendStatus = await this.sendCommand(sendBuffalo);
2102
2109
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2103
2110
  throw new ezspError_1.EzspError(sendStatus);
2104
2111
  }
@@ -2138,11 +2145,11 @@ class Ezsp extends events_1.default {
2138
2145
  * - SLStatus.INVALID_CHANNEL_MASK, our channel mask did not specify any valid channels.
2139
2146
  */
2140
2147
  async ezspStartScan(scanType, channelMask, duration) {
2141
- this.startCommand(enums_2.EzspFrameID.START_SCAN);
2142
- this.buffalo.writeUInt8(scanType);
2143
- this.buffalo.writeUInt32(channelMask);
2144
- this.buffalo.writeUInt8(duration);
2145
- const sendStatus = await this.sendCommand();
2148
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.START_SCAN);
2149
+ sendBuffalo.writeUInt8(scanType);
2150
+ sendBuffalo.writeUInt32(channelMask);
2151
+ sendBuffalo.writeUInt8(duration);
2152
+ const sendStatus = await this.sendCommand(sendBuffalo);
2146
2153
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2147
2154
  throw new ezspError_1.EzspError(sendStatus);
2148
2155
  }
@@ -2169,8 +2176,8 @@ class Ezsp extends events_1.default {
2169
2176
  * @param lastHopRssi int8_t The energy level (in units of dBm) observed during the reception.
2170
2177
  */
2171
2178
  ezspNetworkFoundHandler(networkFound, lastHopLqi, lastHopRssi) {
2172
- logger_1.logger.debug(`ezspNetworkFoundHandler(): callback called with: [networkFound=${JSON.stringify(networkFound)}], `
2173
- + `[lastHopLqi=${lastHopLqi}], [lastHopRssi=${lastHopRssi}]`, NS);
2179
+ logger_1.logger.debug(`ezspNetworkFoundHandler(): callback called with: [networkFound=${JSON.stringify(networkFound)}], ` +
2180
+ `[lastHopLqi=${lastHopLqi}], [lastHopRssi=${lastHopRssi}]`, NS);
2174
2181
  }
2175
2182
  /**
2176
2183
  * Callback
@@ -2198,10 +2205,10 @@ class Ezsp extends events_1.default {
2198
2205
  * @returns The error condition that occurred during the scan. Value will be SLStatus.OK if there are no errors.
2199
2206
  */
2200
2207
  async ezspFindUnusedPanId(channelMask, duration) {
2201
- this.startCommand(enums_2.EzspFrameID.FIND_UNUSED_PAN_ID);
2202
- this.buffalo.writeUInt32(channelMask);
2203
- this.buffalo.writeUInt8(duration);
2204
- const sendStatus = await this.sendCommand();
2208
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.FIND_UNUSED_PAN_ID);
2209
+ sendBuffalo.writeUInt32(channelMask);
2210
+ sendBuffalo.writeUInt8(duration);
2211
+ const sendStatus = await this.sendCommand(sendBuffalo);
2205
2212
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2206
2213
  throw new ezspError_1.EzspError(sendStatus);
2207
2214
  }
@@ -2213,8 +2220,8 @@ class Ezsp extends events_1.default {
2213
2220
  * @returns An SLStatus value indicating success or the reason for failure.
2214
2221
  */
2215
2222
  async ezspStopScan() {
2216
- this.startCommand(enums_2.EzspFrameID.STOP_SCAN);
2217
- const sendStatus = await this.sendCommand();
2223
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.STOP_SCAN);
2224
+ const sendStatus = await this.sendCommand(sendBuffalo);
2218
2225
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2219
2226
  throw new ezspError_1.EzspError(sendStatus);
2220
2227
  }
@@ -2227,9 +2234,9 @@ class Ezsp extends events_1.default {
2227
2234
  * @returns An SLStatus value indicating success or the reason for failure.
2228
2235
  */
2229
2236
  async ezspFormNetwork(parameters) {
2230
- this.startCommand(enums_2.EzspFrameID.FORM_NETWORK);
2231
- this.buffalo.writeEmberNetworkParameters(parameters);
2232
- const sendStatus = await this.sendCommand();
2237
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.FORM_NETWORK);
2238
+ sendBuffalo.writeEmberNetworkParameters(parameters);
2239
+ const sendStatus = await this.sendCommand(sendBuffalo);
2233
2240
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2234
2241
  throw new ezspError_1.EzspError(sendStatus);
2235
2242
  }
@@ -2247,10 +2254,10 @@ class Ezsp extends events_1.default {
2247
2254
  * @returns An SLStatus value indicating success or the reason for failure.
2248
2255
  */
2249
2256
  async ezspJoinNetwork(nodeType, parameters) {
2250
- this.startCommand(enums_2.EzspFrameID.JOIN_NETWORK);
2251
- this.buffalo.writeUInt8(nodeType);
2252
- this.buffalo.writeEmberNetworkParameters(parameters);
2253
- const sendStatus = await this.sendCommand();
2257
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.JOIN_NETWORK);
2258
+ sendBuffalo.writeUInt8(nodeType);
2259
+ sendBuffalo.writeEmberNetworkParameters(parameters);
2260
+ const sendStatus = await this.sendCommand(sendBuffalo);
2254
2261
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2255
2262
  throw new ezspError_1.EzspError(sendStatus);
2256
2263
  }
@@ -2275,12 +2282,12 @@ class Ezsp extends events_1.default {
2275
2282
  * @returns An SLStatus value indicating success or the reason for failure.
2276
2283
  */
2277
2284
  async ezspJoinNetworkDirectly(localNodeType, beacon, radioTxPower, clearBeaconsAfterNetworkUp) {
2278
- this.startCommand(enums_2.EzspFrameID.JOIN_NETWORK_DIRECTLY);
2279
- this.buffalo.writeUInt8(localNodeType);
2280
- this.buffalo.writeEmberBeaconData(beacon);
2281
- this.buffalo.writeInt8(radioTxPower);
2282
- this.buffalo.writeUInt8(clearBeaconsAfterNetworkUp ? 1 : 0);
2283
- const sendStatus = await this.sendCommand();
2285
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.JOIN_NETWORK_DIRECTLY);
2286
+ sendBuffalo.writeUInt8(localNodeType);
2287
+ sendBuffalo.writeEmberBeaconData(beacon);
2288
+ sendBuffalo.writeInt8(radioTxPower);
2289
+ sendBuffalo.writeUInt8(clearBeaconsAfterNetworkUp ? 1 : 0);
2290
+ const sendStatus = await this.sendCommand(sendBuffalo);
2284
2291
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2285
2292
  throw new ezspError_1.EzspError(sendStatus);
2286
2293
  }
@@ -2295,11 +2302,11 @@ class Ezsp extends events_1.default {
2295
2302
  * @returns An SLStatus value indicating success or the reason for failure.
2296
2303
  */
2297
2304
  async ezspLeaveNetwork(options = enums_1.EmberLeaveNetworkOption.WITH_NO_OPTION) {
2298
- this.startCommand(enums_2.EzspFrameID.LEAVE_NETWORK);
2299
- if (this.version >= 0x0E) {
2300
- this.buffalo.writeUInt8(options);
2305
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.LEAVE_NETWORK);
2306
+ if (this.version >= 0x0e) {
2307
+ sendBuffalo.writeUInt8(options);
2301
2308
  }
2302
- const sendStatus = await this.sendCommand();
2309
+ const sendStatus = await this.sendCommand(sendBuffalo);
2303
2310
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2304
2311
  throw new ezspError_1.EzspError(sendStatus);
2305
2312
  }
@@ -2329,15 +2336,15 @@ class Ezsp extends events_1.default {
2329
2336
  * This value could be set to 0 or SL_ZIGBEE_DEVICE_TYPE_UNCHANGED if not needed.
2330
2337
  * @returns An SLStatus value indicating success or the reason for failure.
2331
2338
  */
2332
- async ezspFindAndRejoinNetwork(haveCurrentNetworkKey, channelMask, reason = 0xFF, nodeType = 0) {
2333
- this.startCommand(enums_2.EzspFrameID.FIND_AND_REJOIN_NETWORK);
2334
- this.buffalo.writeUInt8(haveCurrentNetworkKey ? 1 : 0);
2335
- this.buffalo.writeUInt32(channelMask);
2336
- if (this.version >= 0x0E) {
2337
- this.buffalo.writeUInt8(reason);
2338
- this.buffalo.writeUInt8(nodeType);
2339
+ async ezspFindAndRejoinNetwork(haveCurrentNetworkKey, channelMask, reason = 0xff, nodeType = 0) {
2340
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.FIND_AND_REJOIN_NETWORK);
2341
+ sendBuffalo.writeUInt8(haveCurrentNetworkKey ? 1 : 0);
2342
+ sendBuffalo.writeUInt32(channelMask);
2343
+ if (this.version >= 0x0e) {
2344
+ sendBuffalo.writeUInt8(reason);
2345
+ sendBuffalo.writeUInt8(nodeType);
2339
2346
  }
2340
- const sendStatus = await this.sendCommand();
2347
+ const sendStatus = await this.sendCommand(sendBuffalo);
2341
2348
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2342
2349
  throw new ezspError_1.EzspError(sendStatus);
2343
2350
  }
@@ -2352,9 +2359,9 @@ class Ezsp extends events_1.default {
2352
2359
  * @returns An SLStatus value indicating success or the reason for failure.
2353
2360
  */
2354
2361
  async ezspPermitJoining(duration) {
2355
- this.startCommand(enums_2.EzspFrameID.PERMIT_JOINING);
2356
- this.buffalo.writeUInt8(duration);
2357
- const sendStatus = await this.sendCommand();
2362
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.PERMIT_JOINING);
2363
+ sendBuffalo.writeUInt8(duration);
2364
+ const sendStatus = await this.sendCommand(sendBuffalo);
2358
2365
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2359
2366
  throw new ezspError_1.EzspError(sendStatus);
2360
2367
  }
@@ -2371,8 +2378,8 @@ class Ezsp extends events_1.default {
2371
2378
  * @param childType The node type of the child.
2372
2379
  */
2373
2380
  ezspChildJoinHandler(index, joining, childId, childEui64, childType) {
2374
- logger_1.logger.debug(`ezspChildJoinHandler(): callback called with: [index=${index}], [joining=${joining}], `
2375
- + `[childId=${childId}], [childEui64=${childEui64}], [childType=${childType}]`, NS);
2381
+ logger_1.logger.debug(`ezspChildJoinHandler(): callback called with: [index=${index}], [joining=${joining}], ` +
2382
+ `[childId=${childId}], [childEui64=${childEui64}], [childType=${childType}]`, NS);
2376
2383
  }
2377
2384
  /**
2378
2385
  * Sends a ZDO energy scan request. This request may only be sent by the current
@@ -2387,12 +2394,12 @@ class Ezsp extends events_1.default {
2387
2394
  * @returns An SLStatus value indicating success or the reason for failure.
2388
2395
  */
2389
2396
  async ezspEnergyScanRequest(target, scanChannels, scanDuration, scanCount) {
2390
- this.startCommand(enums_2.EzspFrameID.ENERGY_SCAN_REQUEST);
2391
- this.buffalo.writeUInt16(target);
2392
- this.buffalo.writeUInt32(scanChannels);
2393
- this.buffalo.writeUInt8(scanDuration);
2394
- this.buffalo.writeUInt16(scanCount);
2395
- const sendStatus = await this.sendCommand();
2397
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ENERGY_SCAN_REQUEST);
2398
+ sendBuffalo.writeUInt16(target);
2399
+ sendBuffalo.writeUInt32(scanChannels);
2400
+ sendBuffalo.writeUInt8(scanDuration);
2401
+ sendBuffalo.writeUInt16(scanCount);
2402
+ const sendStatus = await this.sendCommand(sendBuffalo);
2396
2403
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2397
2404
  throw new ezspError_1.EzspError(sendStatus);
2398
2405
  }
@@ -2406,8 +2413,8 @@ class Ezsp extends events_1.default {
2406
2413
  * @returns EmberNetworkParameters * The current network parameters.
2407
2414
  */
2408
2415
  async ezspGetNetworkParameters() {
2409
- this.startCommand(enums_2.EzspFrameID.GET_NETWORK_PARAMETERS);
2410
- const sendStatus = await this.sendCommand();
2416
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_NETWORK_PARAMETERS);
2417
+ const sendStatus = await this.sendCommand(sendBuffalo);
2411
2418
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2412
2419
  throw new ezspError_1.EzspError(sendStatus);
2413
2420
  }
@@ -2423,9 +2430,9 @@ class Ezsp extends events_1.default {
2423
2430
  * @returns EmberMultiPhyRadioParameters * The current radio parameters based on provided phy index.
2424
2431
  */
2425
2432
  async ezspGetRadioParameters(phyIndex) {
2426
- this.startCommand(enums_2.EzspFrameID.GET_RADIO_PARAMETERS);
2427
- this.buffalo.writeUInt8(phyIndex);
2428
- const sendStatus = await this.sendCommand();
2433
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_RADIO_PARAMETERS);
2434
+ sendBuffalo.writeUInt8(phyIndex);
2435
+ const sendStatus = await this.sendCommand(sendBuffalo);
2429
2436
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2430
2437
  throw new ezspError_1.EzspError(sendStatus);
2431
2438
  }
@@ -2442,8 +2449,8 @@ class Ezsp extends events_1.default {
2442
2449
  * (coordinators and nodes that are not joined to a network).
2443
2450
  */
2444
2451
  async ezspGetParentChildParameters() {
2445
- this.startCommand(enums_2.EzspFrameID.GET_PARENT_CHILD_PARAMETERS);
2446
- const sendStatus = await this.sendCommand();
2452
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_PARENT_CHILD_PARAMETERS);
2453
+ const sendStatus = await this.sendCommand(sendBuffalo);
2447
2454
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2448
2455
  throw new ezspError_1.EzspError(sendStatus);
2449
2456
  }
@@ -2457,11 +2464,11 @@ class Ezsp extends events_1.default {
2457
2464
  * @returns The number of router children.
2458
2465
  */
2459
2466
  async ezspRouterChildCount() {
2460
- if (this.version < 0x0E) {
2467
+ if (this.version < 0x0e) {
2461
2468
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2462
2469
  }
2463
- this.startCommand(enums_2.EzspFrameID.ROUTER_CHILD_COUNT);
2464
- const sendStatus = await this.sendCommand();
2470
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ROUTER_CHILD_COUNT);
2471
+ const sendStatus = await this.sendCommand(sendBuffalo);
2465
2472
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2466
2473
  throw new ezspError_1.EzspError(sendStatus);
2467
2474
  }
@@ -2474,11 +2481,11 @@ class Ezsp extends events_1.default {
2474
2481
  * @returns The maximum number of children.
2475
2482
  */
2476
2483
  async ezspMaxChildCount() {
2477
- if (this.version < 0x0E) {
2484
+ if (this.version < 0x0e) {
2478
2485
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2479
2486
  }
2480
- this.startCommand(enums_2.EzspFrameID.MAX_CHILD_COUNT);
2481
- const sendStatus = await this.sendCommand();
2487
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MAX_CHILD_COUNT);
2488
+ const sendStatus = await this.sendCommand(sendBuffalo);
2482
2489
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2483
2490
  throw new ezspError_1.EzspError(sendStatus);
2484
2491
  }
@@ -2491,11 +2498,11 @@ class Ezsp extends events_1.default {
2491
2498
  * @returns The maximum number of router children.
2492
2499
  */
2493
2500
  async ezspMaxRouterChildCount() {
2494
- if (this.version < 0x0E) {
2501
+ if (this.version < 0x0e) {
2495
2502
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2496
2503
  }
2497
- this.startCommand(enums_2.EzspFrameID.MAX_ROUTER_CHILD_COUNT);
2498
- const sendStatus = await this.sendCommand();
2504
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MAX_ROUTER_CHILD_COUNT);
2505
+ const sendStatus = await this.sendCommand(sendBuffalo);
2499
2506
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2500
2507
  throw new ezspError_1.EzspError(sendStatus);
2501
2508
  }
@@ -2507,11 +2514,11 @@ class Ezsp extends events_1.default {
2507
2514
  * @returns
2508
2515
  */
2509
2516
  async ezspGetParentIncomingNwkFrameCounter() {
2510
- if (this.version < 0x0E) {
2517
+ if (this.version < 0x0e) {
2511
2518
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2512
2519
  }
2513
- this.startCommand(enums_2.EzspFrameID.GET_PARENT_INCOMING_NWK_FRAME_COUNTER);
2514
- const sendStatus = await this.sendCommand();
2520
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_PARENT_INCOMING_NWK_FRAME_COUNTER);
2521
+ const sendStatus = await this.sendCommand(sendBuffalo);
2515
2522
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2516
2523
  throw new ezspError_1.EzspError(sendStatus);
2517
2524
  }
@@ -2524,12 +2531,12 @@ class Ezsp extends events_1.default {
2524
2531
  * @returns
2525
2532
  */
2526
2533
  async ezspSetParentIncomingNwkFrameCounter(value) {
2527
- if (this.version < 0x0E) {
2534
+ if (this.version < 0x0e) {
2528
2535
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2529
2536
  }
2530
- this.startCommand(enums_2.EzspFrameID.SET_PARENT_INCOMING_NWK_FRAME_COUNTER);
2531
- this.buffalo.writeUInt32(value);
2532
- const sendStatus = await this.sendCommand();
2537
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_PARENT_INCOMING_NWK_FRAME_COUNTER);
2538
+ sendBuffalo.writeUInt32(value);
2539
+ const sendStatus = await this.sendCommand(sendBuffalo);
2533
2540
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2534
2541
  throw new ezspError_1.EzspError(sendStatus);
2535
2542
  }
@@ -2547,11 +2554,11 @@ class Ezsp extends events_1.default {
2547
2554
  * @returns A bitmask of the stack's active tasks.
2548
2555
  */
2549
2556
  async ezspCurrentStackTasks() {
2550
- if (this.version < 0x0E) {
2557
+ if (this.version < 0x0e) {
2551
2558
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2552
2559
  }
2553
- this.startCommand(enums_2.EzspFrameID.CURRENT_STACK_TASKS);
2554
- const sendStatus = await this.sendCommand();
2560
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CURRENT_STACK_TASKS);
2561
+ const sendStatus = await this.sendCommand(sendBuffalo);
2555
2562
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2556
2563
  throw new ezspError_1.EzspError(sendStatus);
2557
2564
  }
@@ -2566,11 +2573,11 @@ class Ezsp extends events_1.default {
2566
2573
  * @returns True if the application may sleep but the stack may be expecting incoming messages.
2567
2574
  */
2568
2575
  async ezspOkToNap() {
2569
- if (this.version < 0x0E) {
2576
+ if (this.version < 0x0e) {
2570
2577
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2571
2578
  }
2572
- this.startCommand(enums_2.EzspFrameID.OK_TO_NAP);
2573
- const sendStatus = await this.sendCommand();
2579
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.OK_TO_NAP);
2580
+ const sendStatus = await this.sendCommand(sendBuffalo);
2574
2581
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2575
2582
  throw new ezspError_1.EzspError(sendStatus);
2576
2583
  }
@@ -2582,11 +2589,11 @@ class Ezsp extends events_1.default {
2582
2589
  * @returns True if the parent token has been set.
2583
2590
  */
2584
2591
  async ezspParentTokenSet() {
2585
- if (this.version < 0x0E) {
2592
+ if (this.version < 0x0e) {
2586
2593
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2587
2594
  }
2588
- this.startCommand(enums_2.EzspFrameID.PARENT_TOKEN_SET);
2589
- const sendStatus = await this.sendCommand();
2595
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.PARENT_TOKEN_SET);
2596
+ const sendStatus = await this.sendCommand(sendBuffalo);
2590
2597
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2591
2598
  throw new ezspError_1.EzspError(sendStatus);
2592
2599
  }
@@ -2600,11 +2607,11 @@ class Ezsp extends events_1.default {
2600
2607
  * @returns True if the application may sleep for as long as it wishes.
2601
2608
  */
2602
2609
  async ezspOkToHibernate() {
2603
- if (this.version < 0x0E) {
2610
+ if (this.version < 0x0e) {
2604
2611
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2605
2612
  }
2606
- this.startCommand(enums_2.EzspFrameID.OK_TO_HIBERNATE);
2607
- const sendStatus = await this.sendCommand();
2613
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.OK_TO_HIBERNATE);
2614
+ const sendStatus = await this.sendCommand(sendBuffalo);
2608
2615
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2609
2616
  throw new ezspError_1.EzspError(sendStatus);
2610
2617
  }
@@ -2616,11 +2623,11 @@ class Ezsp extends events_1.default {
2616
2623
  * @returns True if the device may poll less frequently.
2617
2624
  */
2618
2625
  async ezspOkToLongPoll() {
2619
- if (this.version < 0x0E) {
2626
+ if (this.version < 0x0e) {
2620
2627
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2621
2628
  }
2622
- this.startCommand(enums_2.EzspFrameID.OK_TO_LONG_POLL);
2623
- const sendStatus = await this.sendCommand();
2629
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.OK_TO_LONG_POLL);
2630
+ const sendStatus = await this.sendCommand(sendBuffalo);
2624
2631
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2625
2632
  throw new ezspError_1.EzspError(sendStatus);
2626
2633
  }
@@ -2631,11 +2638,11 @@ class Ezsp extends events_1.default {
2631
2638
  * Calling this function will render all other stack functions except ezspStackPowerUp() non-functional until the radio is powered back on.
2632
2639
  */
2633
2640
  async ezspStackPowerDown() {
2634
- if (this.version < 0x0E) {
2641
+ if (this.version < 0x0e) {
2635
2642
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2636
2643
  }
2637
- this.startCommand(enums_2.EzspFrameID.STACK_POWER_DOWN);
2638
- const sendStatus = await this.sendCommand();
2644
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.STACK_POWER_DOWN);
2645
+ const sendStatus = await this.sendCommand(sendBuffalo);
2639
2646
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2640
2647
  throw new ezspError_1.EzspError(sendStatus);
2641
2648
  }
@@ -2645,11 +2652,11 @@ class Ezsp extends events_1.default {
2645
2652
  * For non-sleepy devices, also turns the radio on and leaves it in RX mode.
2646
2653
  */
2647
2654
  async ezspStackPowerUp() {
2648
- if (this.version < 0x0E) {
2655
+ if (this.version < 0x0e) {
2649
2656
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2650
2657
  }
2651
- this.startCommand(enums_2.EzspFrameID.STACK_POWER_UP);
2652
- const sendStatus = await this.sendCommand();
2658
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.STACK_POWER_UP);
2659
+ const sendStatus = await this.sendCommand(sendBuffalo);
2653
2660
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2654
2661
  throw new ezspError_1.EzspError(sendStatus);
2655
2662
  }
@@ -2663,9 +2670,9 @@ class Ezsp extends events_1.default {
2663
2670
  * @returns EmberChildData * The data of the child.
2664
2671
  */
2665
2672
  async ezspGetChildData(index) {
2666
- this.startCommand(enums_2.EzspFrameID.GET_CHILD_DATA);
2667
- this.buffalo.writeUInt8(index);
2668
- const sendStatus = await this.sendCommand();
2673
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_CHILD_DATA);
2674
+ sendBuffalo.writeUInt8(index);
2675
+ const sendStatus = await this.sendCommand(sendBuffalo);
2669
2676
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2670
2677
  throw new ezspError_1.EzspError(sendStatus);
2671
2678
  }
@@ -2682,10 +2689,10 @@ class Ezsp extends events_1.default {
2682
2689
  * - SLStatus.INVALID_INDEX if provided index is out of range.
2683
2690
  */
2684
2691
  async ezspSetChildData(index, childData) {
2685
- this.startCommand(enums_2.EzspFrameID.SET_CHILD_DATA);
2686
- this.buffalo.writeUInt8(index);
2687
- this.buffalo.writeEmberChildData(childData);
2688
- const sendStatus = await this.sendCommand();
2692
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_CHILD_DATA);
2693
+ sendBuffalo.writeUInt8(index);
2694
+ sendBuffalo.writeEmberChildData(childData);
2695
+ const sendStatus = await this.sendCommand(sendBuffalo);
2689
2696
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2690
2697
  throw new ezspError_1.EzspError(sendStatus);
2691
2698
  }
@@ -2698,9 +2705,9 @@ class Ezsp extends events_1.default {
2698
2705
  * @returns The node ID of the child or EMBER_NULL_NODE_ID if there isn't a child at the childIndex specified
2699
2706
  */
2700
2707
  async ezspChildId(childIndex) {
2701
- this.startCommand(enums_2.EzspFrameID.CHILD_ID);
2702
- this.buffalo.writeUInt8(childIndex);
2703
- const sendStatus = await this.sendCommand();
2708
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CHILD_ID);
2709
+ sendBuffalo.writeUInt8(childIndex);
2710
+ const sendStatus = await this.sendCommand(sendBuffalo);
2704
2711
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2705
2712
  throw new ezspError_1.EzspError(sendStatus);
2706
2713
  }
@@ -2715,12 +2722,12 @@ class Ezsp extends events_1.default {
2715
2722
  * while forming/joining a network if there isn't a child at the childIndex specified
2716
2723
  */
2717
2724
  async ezspChilPower(childIndex) {
2718
- if (this.version < 0x0E) {
2725
+ if (this.version < 0x0e) {
2719
2726
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2720
2727
  }
2721
- this.startCommand(enums_2.EzspFrameID.CHILD_POWER);
2722
- this.buffalo.writeUInt8(childIndex);
2723
- const sendStatus = await this.sendCommand();
2728
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CHILD_POWER);
2729
+ sendBuffalo.writeUInt8(childIndex);
2730
+ const sendStatus = await this.sendCommand(sendBuffalo);
2724
2731
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2725
2732
  throw new ezspError_1.EzspError(sendStatus);
2726
2733
  }
@@ -2733,13 +2740,13 @@ class Ezsp extends events_1.default {
2733
2740
  * @param newPower int8_t
2734
2741
  */
2735
2742
  async ezspSetChildPower(childIndex, newPower) {
2736
- if (this.version < 0x0E) {
2743
+ if (this.version < 0x0e) {
2737
2744
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
2738
2745
  }
2739
- this.startCommand(enums_2.EzspFrameID.SET_CHILD_POWER);
2740
- this.buffalo.writeUInt8(childIndex);
2741
- this.buffalo.writeInt8(newPower);
2742
- const sendStatus = await this.sendCommand();
2746
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_CHILD_POWER);
2747
+ sendBuffalo.writeUInt8(childIndex);
2748
+ sendBuffalo.writeInt8(newPower);
2749
+ const sendStatus = await this.sendCommand(sendBuffalo);
2743
2750
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2744
2751
  throw new ezspError_1.EzspError(sendStatus);
2745
2752
  }
@@ -2750,9 +2757,9 @@ class Ezsp extends events_1.default {
2750
2757
  * @returns uint8_t The child index or 0xFF if the node ID doesn't belong to a child
2751
2758
  */
2752
2759
  async ezspChildIndex(childId) {
2753
- this.startCommand(enums_2.EzspFrameID.CHILD_INDEX);
2754
- this.buffalo.writeUInt16(childId);
2755
- const sendStatus = await this.sendCommand();
2760
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CHILD_INDEX);
2761
+ sendBuffalo.writeUInt16(childId);
2762
+ const sendStatus = await this.sendCommand(sendBuffalo);
2756
2763
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2757
2764
  throw new ezspError_1.EzspError(sendStatus);
2758
2765
  }
@@ -2764,8 +2771,8 @@ class Ezsp extends events_1.default {
2764
2771
  * @returns uint8_t Total size of source route table.
2765
2772
  */
2766
2773
  async ezspGetSourceRouteTableTotalSize() {
2767
- this.startCommand(enums_2.EzspFrameID.GET_SOURCE_ROUTE_TABLE_TOTAL_SIZE);
2768
- const sendStatus = await this.sendCommand();
2774
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_SOURCE_ROUTE_TABLE_TOTAL_SIZE);
2775
+ const sendStatus = await this.sendCommand(sendBuffalo);
2769
2776
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2770
2777
  throw new ezspError_1.EzspError(sendStatus);
2771
2778
  }
@@ -2777,8 +2784,8 @@ class Ezsp extends events_1.default {
2777
2784
  * @returns uint8_t The number of filled entries in source route table.
2778
2785
  */
2779
2786
  async ezspGetSourceRouteTableFilledSize() {
2780
- this.startCommand(enums_2.EzspFrameID.GET_SOURCE_ROUTE_TABLE_FILLED_SIZE);
2781
- const sendStatus = await this.sendCommand();
2787
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_SOURCE_ROUTE_TABLE_FILLED_SIZE);
2788
+ const sendStatus = await this.sendCommand(sendBuffalo);
2782
2789
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2783
2790
  throw new ezspError_1.EzspError(sendStatus);
2784
2791
  }
@@ -2796,9 +2803,9 @@ class Ezsp extends events_1.default {
2796
2803
  * @returns uint8_t * The closer node index for this source route table entry
2797
2804
  */
2798
2805
  async ezspGetSourceRouteTableEntry(index) {
2799
- this.startCommand(enums_2.EzspFrameID.GET_SOURCE_ROUTE_TABLE_ENTRY);
2800
- this.buffalo.writeUInt8(index);
2801
- const sendStatus = await this.sendCommand();
2806
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_SOURCE_ROUTE_TABLE_ENTRY);
2807
+ sendBuffalo.writeUInt8(index);
2808
+ const sendStatus = await this.sendCommand(sendBuffalo);
2802
2809
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2803
2810
  throw new ezspError_1.EzspError(sendStatus);
2804
2811
  }
@@ -2818,9 +2825,9 @@ class Ezsp extends events_1.default {
2818
2825
  * @returns EmberNeighborTableEntry * The contents of the neighbor table entry.
2819
2826
  */
2820
2827
  async ezspGetNeighbor(index) {
2821
- this.startCommand(enums_2.EzspFrameID.GET_NEIGHBOR);
2822
- this.buffalo.writeUInt8(index);
2823
- const sendStatus = await this.sendCommand();
2828
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_NEIGHBOR);
2829
+ sendBuffalo.writeUInt8(index);
2830
+ const sendStatus = await this.sendCommand(sendBuffalo);
2824
2831
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2825
2832
  throw new ezspError_1.EzspError(sendStatus);
2826
2833
  }
@@ -2840,9 +2847,9 @@ class Ezsp extends events_1.default {
2840
2847
  * @returns uint32_t * Return the frame counter of the node from the neighbor or child table
2841
2848
  */
2842
2849
  async ezspGetNeighborFrameCounter(eui64) {
2843
- this.startCommand(enums_2.EzspFrameID.GET_NEIGHBOR_FRAME_COUNTER);
2844
- this.buffalo.writeIeeeAddr(eui64);
2845
- const sendStatus = await this.sendCommand();
2850
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_NEIGHBOR_FRAME_COUNTER);
2851
+ sendBuffalo.writeIeeeAddr(eui64);
2852
+ const sendStatus = await this.sendCommand(sendBuffalo);
2846
2853
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2847
2854
  throw new ezspError_1.EzspError(sendStatus);
2848
2855
  }
@@ -2859,10 +2866,10 @@ class Ezsp extends events_1.default {
2859
2866
  * - SLStatus.OK otherwise
2860
2867
  */
2861
2868
  async ezspSetNeighborFrameCounter(eui64, frameCounter) {
2862
- this.startCommand(enums_2.EzspFrameID.SET_NEIGHBOR_FRAME_COUNTER);
2863
- this.buffalo.writeIeeeAddr(eui64);
2864
- this.buffalo.writeUInt32(frameCounter);
2865
- const sendStatus = await this.sendCommand();
2869
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_NEIGHBOR_FRAME_COUNTER);
2870
+ sendBuffalo.writeIeeeAddr(eui64);
2871
+ sendBuffalo.writeUInt32(frameCounter);
2872
+ const sendStatus = await this.sendCommand(sendBuffalo);
2866
2873
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2867
2874
  throw new ezspError_1.EzspError(sendStatus);
2868
2875
  }
@@ -2876,9 +2883,9 @@ class Ezsp extends events_1.default {
2876
2883
  * @returns An SLStatus value indicating success or the reason for failure.
2877
2884
  */
2878
2885
  async ezspSetRoutingShortcutThreshold(costThresh) {
2879
- this.startCommand(enums_2.EzspFrameID.SET_ROUTING_SHORTCUT_THRESHOLD);
2880
- this.buffalo.writeUInt8(costThresh);
2881
- const sendStatus = await this.sendCommand();
2886
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_ROUTING_SHORTCUT_THRESHOLD);
2887
+ sendBuffalo.writeUInt8(costThresh);
2888
+ const sendStatus = await this.sendCommand(sendBuffalo);
2882
2889
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2883
2890
  throw new ezspError_1.EzspError(sendStatus);
2884
2891
  }
@@ -2891,8 +2898,8 @@ class Ezsp extends events_1.default {
2891
2898
  * @returns uint8_t The routing shortcut threshold
2892
2899
  */
2893
2900
  async ezspGetRoutingShortcutThreshold() {
2894
- this.startCommand(enums_2.EzspFrameID.GET_ROUTING_SHORTCUT_THRESHOLD);
2895
- const sendStatus = await this.sendCommand();
2901
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_ROUTING_SHORTCUT_THRESHOLD);
2902
+ const sendStatus = await this.sendCommand(sendBuffalo);
2896
2903
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2897
2904
  throw new ezspError_1.EzspError(sendStatus);
2898
2905
  }
@@ -2904,8 +2911,8 @@ class Ezsp extends events_1.default {
2904
2911
  * @returns uint8_t The number of active entries in the neighbor table.
2905
2912
  */
2906
2913
  async ezspNeighborCount() {
2907
- this.startCommand(enums_2.EzspFrameID.NEIGHBOR_COUNT);
2908
- const sendStatus = await this.sendCommand();
2914
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.NEIGHBOR_COUNT);
2915
+ const sendStatus = await this.sendCommand(sendBuffalo);
2909
2916
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2910
2917
  throw new ezspError_1.EzspError(sendStatus);
2911
2918
  }
@@ -2922,9 +2929,9 @@ class Ezsp extends events_1.default {
2922
2929
  * @returns EmberRouteTableEntry * The contents of the route table entry.
2923
2930
  */
2924
2931
  async ezspGetRouteTableEntry(index) {
2925
- this.startCommand(enums_2.EzspFrameID.GET_ROUTE_TABLE_ENTRY);
2926
- this.buffalo.writeUInt8(index);
2927
- const sendStatus = await this.sendCommand();
2932
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_ROUTE_TABLE_ENTRY);
2933
+ sendBuffalo.writeUInt8(index);
2934
+ const sendStatus = await this.sendCommand(sendBuffalo);
2928
2935
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2929
2936
  throw new ezspError_1.EzspError(sendStatus);
2930
2937
  }
@@ -2944,9 +2951,9 @@ class Ezsp extends events_1.default {
2944
2951
  * @returns An SLStatus value indicating the success or failure of the command.
2945
2952
  */
2946
2953
  async ezspSetRadioPower(power) {
2947
- this.startCommand(enums_2.EzspFrameID.SET_RADIO_POWER);
2948
- this.buffalo.writeInt8(power);
2949
- const sendStatus = await this.sendCommand();
2954
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_RADIO_POWER);
2955
+ sendBuffalo.writeInt8(power);
2956
+ const sendStatus = await this.sendCommand(sendBuffalo);
2950
2957
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2951
2958
  throw new ezspError_1.EzspError(sendStatus);
2952
2959
  }
@@ -2962,9 +2969,9 @@ class Ezsp extends events_1.default {
2962
2969
  * @returns An SLStatus value indicating the success or failure of the command.
2963
2970
  */
2964
2971
  async ezspSetRadioChannel(channel) {
2965
- this.startCommand(enums_2.EzspFrameID.SET_RADIO_CHANNEL);
2966
- this.buffalo.writeUInt8(channel);
2967
- const sendStatus = await this.sendCommand();
2972
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_RADIO_CHANNEL);
2973
+ sendBuffalo.writeUInt8(channel);
2974
+ const sendStatus = await this.sendCommand(sendBuffalo);
2968
2975
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2969
2976
  throw new ezspError_1.EzspError(sendStatus);
2970
2977
  }
@@ -2976,8 +2983,8 @@ class Ezsp extends events_1.default {
2976
2983
  * @returns uint8_t Current radio channel.
2977
2984
  */
2978
2985
  async ezspGetRadioChannel() {
2979
- this.startCommand(enums_2.EzspFrameID.GET_RADIO_CHANNEL);
2980
- const sendStatus = await this.sendCommand();
2986
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_RADIO_CHANNEL);
2987
+ const sendStatus = await this.sendCommand(sendBuffalo);
2981
2988
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2982
2989
  throw new ezspError_1.EzspError(sendStatus);
2983
2990
  }
@@ -2990,9 +2997,9 @@ class Ezsp extends events_1.default {
2990
2997
  * @returns An SLStatus value indicating the success or failure of the command.
2991
2998
  */
2992
2999
  async ezspSetRadioIeee802154CcaMode(ccaMode) {
2993
- this.startCommand(enums_2.EzspFrameID.SET_RADIO_IEEE802154_CCA_MODE);
2994
- this.buffalo.writeUInt8(ccaMode);
2995
- const sendStatus = await this.sendCommand();
3000
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_RADIO_IEEE802154_CCA_MODE);
3001
+ sendBuffalo.writeUInt8(ccaMode);
3002
+ const sendStatus = await this.sendCommand(sendBuffalo);
2996
3003
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
2997
3004
  throw new ezspError_1.EzspError(sendStatus);
2998
3005
  }
@@ -3017,15 +3024,15 @@ class Ezsp extends events_1.default {
3017
3024
  * @returns An SLStatus value indicating success or the reason for failure.
3018
3025
  */
3019
3026
  async ezspSetConcentrator(on, concentratorType, minTime, maxTime, routeErrorThreshold, deliveryFailureThreshold, maxHops) {
3020
- this.startCommand(enums_2.EzspFrameID.SET_CONCENTRATOR);
3021
- this.buffalo.writeUInt8(on ? 1 : 0);
3022
- this.buffalo.writeUInt16(concentratorType);
3023
- this.buffalo.writeUInt16(minTime);
3024
- this.buffalo.writeUInt16(maxTime);
3025
- this.buffalo.writeUInt8(routeErrorThreshold);
3026
- this.buffalo.writeUInt8(deliveryFailureThreshold);
3027
- this.buffalo.writeUInt8(maxHops);
3028
- const sendStatus = await this.sendCommand();
3027
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_CONCENTRATOR);
3028
+ sendBuffalo.writeUInt8(on ? 1 : 0);
3029
+ sendBuffalo.writeUInt16(concentratorType);
3030
+ sendBuffalo.writeUInt16(minTime);
3031
+ sendBuffalo.writeUInt16(maxTime);
3032
+ sendBuffalo.writeUInt8(routeErrorThreshold);
3033
+ sendBuffalo.writeUInt8(deliveryFailureThreshold);
3034
+ sendBuffalo.writeUInt8(maxHops);
3035
+ const sendStatus = await this.sendCommand(sendBuffalo);
3029
3036
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3030
3037
  throw new ezspError_1.EzspError(sendStatus);
3031
3038
  }
@@ -3038,11 +3045,11 @@ class Ezsp extends events_1.default {
3038
3045
  * has been stopped by a call to ::ezspConcentratorStopDiscovery().
3039
3046
  */
3040
3047
  async ezspConcentratorStartDiscovery() {
3041
- if (this.version < 0x0E) {
3048
+ if (this.version < 0x0e) {
3042
3049
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3043
3050
  }
3044
- this.startCommand(enums_2.EzspFrameID.CONCENTRATOR_START_DISCOVERY);
3045
- const sendStatus = await this.sendCommand();
3051
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CONCENTRATOR_START_DISCOVERY);
3052
+ const sendStatus = await this.sendCommand(sendBuffalo);
3046
3053
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3047
3054
  throw new ezspError_1.EzspError(sendStatus);
3048
3055
  }
@@ -3051,11 +3058,11 @@ class Ezsp extends events_1.default {
3051
3058
  * Stops periodic many-to-one route discovery.
3052
3059
  */
3053
3060
  async ezspConcentratorStopDiscovery() {
3054
- if (this.version < 0x0E) {
3061
+ if (this.version < 0x0e) {
3055
3062
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3056
3063
  }
3057
- this.startCommand(enums_2.EzspFrameID.CONCENTRATOR_STOP_DISCOVERY);
3058
- const sendStatus = await this.sendCommand();
3064
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CONCENTRATOR_STOP_DISCOVERY);
3065
+ const sendStatus = await this.sendCommand(sendBuffalo);
3059
3066
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3060
3067
  throw new ezspError_1.EzspError(sendStatus);
3061
3068
  }
@@ -3066,13 +3073,13 @@ class Ezsp extends events_1.default {
3066
3073
  * @param nodeId
3067
3074
  */
3068
3075
  async ezspConcentratorNoteRouteError(status, nodeId) {
3069
- if (this.version < 0x0E) {
3076
+ if (this.version < 0x0e) {
3070
3077
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3071
3078
  }
3072
- this.startCommand(enums_2.EzspFrameID.CONCENTRATOR_NOTE_ROUTE_ERROR);
3073
- this.buffalo.writeUInt32(status);
3074
- this.buffalo.writeUInt16(nodeId);
3075
- const sendStatus = await this.sendCommand();
3079
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CONCENTRATOR_NOTE_ROUTE_ERROR);
3080
+ sendBuffalo.writeUInt32(status);
3081
+ sendBuffalo.writeUInt16(nodeId);
3082
+ const sendStatus = await this.sendCommand(sendBuffalo);
3076
3083
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3077
3084
  throw new ezspError_1.EzspError(sendStatus);
3078
3085
  }
@@ -3083,9 +3090,9 @@ class Ezsp extends events_1.default {
3083
3090
  * @returns An SLStatus value indicating the success or failure of the command.
3084
3091
  */
3085
3092
  async ezspSetBrokenRouteErrorCode(errorCode) {
3086
- this.startCommand(enums_2.EzspFrameID.SET_BROKEN_ROUTE_ERROR_CODE);
3087
- this.buffalo.writeUInt8(errorCode);
3088
- const sendStatus = await this.sendCommand();
3093
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_BROKEN_ROUTE_ERROR_CODE);
3094
+ sendBuffalo.writeUInt8(errorCode);
3095
+ const sendStatus = await this.sendCommand(sendBuffalo);
3089
3096
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3090
3097
  throw new ezspError_1.EzspError(sendStatus);
3091
3098
  }
@@ -3104,13 +3111,13 @@ class Ezsp extends events_1.default {
3104
3111
  * @returns An SLStatus value indicating success or the reason for failure.
3105
3112
  */
3106
3113
  async ezspMultiPhyStart(phyIndex, page, channel, power, bitmask) {
3107
- this.startCommand(enums_2.EzspFrameID.MULTI_PHY_START);
3108
- this.buffalo.writeUInt8(phyIndex);
3109
- this.buffalo.writeUInt8(page);
3110
- this.buffalo.writeUInt8(channel);
3111
- this.buffalo.writeInt8(power);
3112
- this.buffalo.writeUInt8(bitmask);
3113
- const sendStatus = await this.sendCommand();
3114
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MULTI_PHY_START);
3115
+ sendBuffalo.writeUInt8(phyIndex);
3116
+ sendBuffalo.writeUInt8(page);
3117
+ sendBuffalo.writeUInt8(channel);
3118
+ sendBuffalo.writeInt8(power);
3119
+ sendBuffalo.writeUInt8(bitmask);
3120
+ const sendStatus = await this.sendCommand(sendBuffalo);
3114
3121
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3115
3122
  throw new ezspError_1.EzspError(sendStatus);
3116
3123
  }
@@ -3123,9 +3130,9 @@ class Ezsp extends events_1.default {
3123
3130
  * @returns An SLStatus value indicating success or the reason for failure.
3124
3131
  */
3125
3132
  async ezspMultiPhyStop(phyIndex) {
3126
- this.startCommand(enums_2.EzspFrameID.MULTI_PHY_STOP);
3127
- this.buffalo.writeUInt8(phyIndex);
3128
- const sendStatus = await this.sendCommand();
3133
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MULTI_PHY_STOP);
3134
+ sendBuffalo.writeUInt8(phyIndex);
3135
+ const sendStatus = await this.sendCommand(sendBuffalo);
3129
3136
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3130
3137
  throw new ezspError_1.EzspError(sendStatus);
3131
3138
  }
@@ -3145,10 +3152,10 @@ class Ezsp extends events_1.default {
3145
3152
  * @returns An SLStatus value indicating the success or failure of the command.
3146
3153
  */
3147
3154
  async ezspMultiPhySetRadioPower(phyIndex, power) {
3148
- this.startCommand(enums_2.EzspFrameID.MULTI_PHY_SET_RADIO_POWER);
3149
- this.buffalo.writeUInt8(phyIndex);
3150
- this.buffalo.writeInt8(power);
3151
- const sendStatus = await this.sendCommand();
3155
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MULTI_PHY_SET_RADIO_POWER);
3156
+ sendBuffalo.writeUInt8(phyIndex);
3157
+ sendBuffalo.writeInt8(power);
3158
+ const sendStatus = await this.sendCommand(sendBuffalo);
3152
3159
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3153
3160
  throw new ezspError_1.EzspError(sendStatus);
3154
3161
  }
@@ -3160,8 +3167,8 @@ class Ezsp extends events_1.default {
3160
3167
  * @returns An SLStatus value indicating the success or failure of the command.
3161
3168
  */
3162
3169
  async ezspSendLinkPowerDeltaRequest() {
3163
- this.startCommand(enums_2.EzspFrameID.SEND_LINK_POWER_DELTA_REQUEST);
3164
- const sendStatus = await this.sendCommand();
3170
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_LINK_POWER_DELTA_REQUEST);
3171
+ const sendStatus = await this.sendCommand(sendBuffalo);
3165
3172
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3166
3173
  throw new ezspError_1.EzspError(sendStatus);
3167
3174
  }
@@ -3180,11 +3187,11 @@ class Ezsp extends events_1.default {
3180
3187
  * @returns An SLStatus value indicating the success or failure of the command.
3181
3188
  */
3182
3189
  async ezspMultiPhySetRadioChannel(phyIndex, page, channel) {
3183
- this.startCommand(enums_2.EzspFrameID.MULTI_PHY_SET_RADIO_CHANNEL);
3184
- this.buffalo.writeUInt8(phyIndex);
3185
- this.buffalo.writeUInt8(page);
3186
- this.buffalo.writeUInt8(channel);
3187
- const sendStatus = await this.sendCommand();
3190
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MULTI_PHY_SET_RADIO_CHANNEL);
3191
+ sendBuffalo.writeUInt8(phyIndex);
3192
+ sendBuffalo.writeUInt8(page);
3193
+ sendBuffalo.writeUInt8(channel);
3194
+ const sendStatus = await this.sendCommand(sendBuffalo);
3188
3195
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3189
3196
  throw new ezspError_1.EzspError(sendStatus);
3190
3197
  }
@@ -3197,8 +3204,8 @@ class Ezsp extends events_1.default {
3197
3204
  * @returns EmberDutyCycleState * The current duty cycle state in effect.
3198
3205
  */
3199
3206
  async ezspGetDutyCycleState() {
3200
- this.startCommand(enums_2.EzspFrameID.GET_DUTY_CYCLE_STATE);
3201
- const sendStatus = await this.sendCommand();
3207
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_DUTY_CYCLE_STATE);
3208
+ const sendStatus = await this.sendCommand(sendBuffalo);
3202
3209
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3203
3210
  throw new ezspError_1.EzspError(sendStatus);
3204
3211
  }
@@ -3217,9 +3224,9 @@ class Ezsp extends events_1.default {
3217
3224
  * - SLStatus.INVALID_STATE if device is operating on 2.4Ghz
3218
3225
  */
3219
3226
  async ezspSetDutyCycleLimitsInStack(limits) {
3220
- this.startCommand(enums_2.EzspFrameID.SET_DUTY_CYCLE_LIMITS_IN_STACK);
3221
- this.buffalo.writeEmberDutyCycleLimits(limits);
3222
- const sendStatus = await this.sendCommand();
3227
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_DUTY_CYCLE_LIMITS_IN_STACK);
3228
+ sendBuffalo.writeEmberDutyCycleLimits(limits);
3229
+ const sendStatus = await this.sendCommand(sendBuffalo);
3223
3230
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3224
3231
  throw new ezspError_1.EzspError(sendStatus);
3225
3232
  }
@@ -3233,8 +3240,8 @@ class Ezsp extends events_1.default {
3233
3240
  * @returns EmberDutyCycleLimits * Return current duty cycle limits if returnedLimits is not NULL
3234
3241
  */
3235
3242
  async ezspGetDutyCycleLimits() {
3236
- this.startCommand(enums_2.EzspFrameID.GET_DUTY_CYCLE_LIMITS);
3237
- const sendStatus = await this.sendCommand();
3243
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_DUTY_CYCLE_LIMITS);
3244
+ const sendStatus = await this.sendCommand(sendBuffalo);
3238
3245
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3239
3246
  throw new ezspError_1.EzspError(sendStatus);
3240
3247
  }
@@ -3256,9 +3263,9 @@ class Ezsp extends events_1.default {
3256
3263
  * the NodeId element in the EmberPerDeviceDutyCycle will be 0xFFFF.
3257
3264
  */
3258
3265
  async ezspGetCurrentDutyCycle(maxDevices) {
3259
- this.startCommand(enums_2.EzspFrameID.GET_CURRENT_DUTY_CYCLE);
3260
- this.buffalo.writeUInt8(maxDevices);
3261
- const sendStatus = await this.sendCommand();
3266
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_CURRENT_DUTY_CYCLE);
3267
+ sendBuffalo.writeUInt8(maxDevices);
3268
+ const sendStatus = await this.sendCommand(sendBuffalo);
3262
3269
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3263
3270
  throw new ezspError_1.EzspError(sendStatus);
3264
3271
  }
@@ -3275,10 +3282,10 @@ class Ezsp extends events_1.default {
3275
3282
  * @param totalDevices uint8_t The total number of connected end devices that are being monitored for duty cycle.
3276
3283
  * @param arrayOfDeviceDutyCycles EmberPerDeviceDutyCycle * Consumed duty cycles of end devices that are being monitored.
3277
3284
  * The first entry always be the local stack's nodeId, and thus the total aggregate duty cycle for the device.
3278
- */
3285
+ */
3279
3286
  ezspDutyCycleHandler(channelPage, channel, state, totalDevices, arrayOfDeviceDutyCycles) {
3280
- logger_1.logger.debug(`ezspDutyCycleHandler(): callback called with: [channelPage=${channelPage}], [channel=${channel}], `
3281
- + `[state=${state}], [totalDevices=${totalDevices}], [arrayOfDeviceDutyCycles=${arrayOfDeviceDutyCycles}]`, NS);
3287
+ logger_1.logger.debug(`ezspDutyCycleHandler(): callback called with: [channelPage=${channelPage}], [channel=${channel}], ` +
3288
+ `[state=${state}], [totalDevices=${totalDevices}], [arrayOfDeviceDutyCycles=${arrayOfDeviceDutyCycles}]`, NS);
3282
3289
  }
3283
3290
  /**
3284
3291
  * Configure the number of beacons to store when issuing active scans for networks.
@@ -3288,12 +3295,12 @@ class Ezsp extends events_1.default {
3288
3295
  * - SLStatus.OK
3289
3296
  */
3290
3297
  async ezspSetNumBeaconToStore(numBeacons) {
3291
- if (this.version < 0x0E) {
3298
+ if (this.version < 0x0e) {
3292
3299
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3293
3300
  }
3294
- this.startCommand(enums_2.EzspFrameID.SET_NUM_BEACONS_TO_STORE);
3295
- this.buffalo.writeUInt8(numBeacons);
3296
- const sendStatus = await this.sendCommand();
3301
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_NUM_BEACONS_TO_STORE);
3302
+ sendBuffalo.writeUInt8(numBeacons);
3303
+ const sendStatus = await this.sendCommand(sendBuffalo);
3297
3304
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3298
3305
  throw new ezspError_1.EzspError(sendStatus);
3299
3306
  }
@@ -3307,12 +3314,12 @@ class Ezsp extends events_1.default {
3307
3314
  * @returns EmberBeaconData * The beacon to populate upon success.
3308
3315
  */
3309
3316
  async ezspGetStoredBeacon(beaconNumber) {
3310
- if (this.version < 0x0E) {
3317
+ if (this.version < 0x0e) {
3311
3318
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3312
3319
  }
3313
- this.startCommand(enums_2.EzspFrameID.GET_STORED_BEACON);
3314
- this.buffalo.writeUInt8(beaconNumber);
3315
- const sendStatus = await this.sendCommand();
3320
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_STORED_BEACON);
3321
+ sendBuffalo.writeUInt8(beaconNumber);
3322
+ const sendStatus = await this.sendCommand(sendBuffalo);
3316
3323
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3317
3324
  throw new ezspError_1.EzspError(sendStatus);
3318
3325
  }
@@ -3325,8 +3332,8 @@ class Ezsp extends events_1.default {
3325
3332
  * @returns uint8_t The number of cached beacons that have been collected from a scan.
3326
3333
  */
3327
3334
  async ezspGetNumStoredBeacons() {
3328
- this.startCommand(enums_2.EzspFrameID.GET_NUM_STORED_BEACONS);
3329
- const sendStatus = await this.sendCommand();
3335
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_NUM_STORED_BEACONS);
3336
+ const sendStatus = await this.sendCommand(sendBuffalo);
3330
3337
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3331
3338
  throw new ezspError_1.EzspError(sendStatus);
3332
3339
  }
@@ -3338,12 +3345,12 @@ class Ezsp extends events_1.default {
3338
3345
  * @returns An SLStatus value indicating success or the reason for failure. Always `OK` in v13-.
3339
3346
  */
3340
3347
  async ezspClearStoredBeacons() {
3341
- this.startCommand(enums_2.EzspFrameID.CLEAR_STORED_BEACONS);
3342
- const sendStatus = await this.sendCommand();
3348
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CLEAR_STORED_BEACONS);
3349
+ const sendStatus = await this.sendCommand(sendBuffalo);
3343
3350
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3344
3351
  throw new ezspError_1.EzspError(sendStatus);
3345
3352
  }
3346
- if (this.version < 0x0E) {
3353
+ if (this.version < 0x0e) {
3347
3354
  return enums_1.SLStatus.OK;
3348
3355
  }
3349
3356
  else {
@@ -3358,9 +3365,9 @@ class Ezsp extends events_1.default {
3358
3365
  * @returns An SLStatus value indicating success or the reason for failure.
3359
3366
  */
3360
3367
  async ezspSetLogicalAndRadioChannel(radioChannel) {
3361
- this.startCommand(enums_2.EzspFrameID.SET_LOGICAL_AND_RADIO_CHANNEL);
3362
- this.buffalo.writeUInt8(radioChannel);
3363
- const sendStatus = await this.sendCommand();
3368
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_LOGICAL_AND_RADIO_CHANNEL);
3369
+ sendBuffalo.writeUInt8(radioChannel);
3370
+ const sendStatus = await this.sendCommand(sendBuffalo);
3364
3371
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3365
3372
  throw new ezspError_1.EzspError(sendStatus);
3366
3373
  }
@@ -3375,13 +3382,13 @@ class Ezsp extends events_1.default {
3375
3382
  * @returns An SLStatus value indicating success or a reason for failure.
3376
3383
  */
3377
3384
  async ezspSleepyToSleepyNetworkStart(parameters, initiator) {
3378
- if (this.version < 0x0E) {
3385
+ if (this.version < 0x0e) {
3379
3386
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3380
3387
  }
3381
- this.startCommand(enums_2.EzspFrameID.SLEEPY_TO_SLEEPY_NETWORK_START);
3382
- this.buffalo.writeEmberNetworkParameters(parameters);
3383
- this.buffalo.writeUInt8(initiator ? 1 : 0);
3384
- const sendStatus = await this.sendCommand();
3388
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SLEEPY_TO_SLEEPY_NETWORK_START);
3389
+ sendBuffalo.writeEmberNetworkParameters(parameters);
3390
+ sendBuffalo.writeUInt8(initiator ? 1 : 0);
3391
+ const sendStatus = await this.sendCommand(sendBuffalo);
3385
3392
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3386
3393
  throw new ezspError_1.EzspError(sendStatus);
3387
3394
  }
@@ -3395,13 +3402,13 @@ class Ezsp extends events_1.default {
3395
3402
  * @returns Status indicating success or a reason for failure. Call is invalid if destination is on network or is the local node.
3396
3403
  */
3397
3404
  async ezspSendZigbeeLeave(destination, flags) {
3398
- if (this.version < 0x0E) {
3405
+ if (this.version < 0x0e) {
3399
3406
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3400
3407
  }
3401
- this.startCommand(enums_2.EzspFrameID.SEND_ZIGBEE_LEAVE);
3402
- this.buffalo.writeUInt16(destination);
3403
- this.buffalo.writeUInt8(flags);
3404
- const sendStatus = await this.sendCommand();
3408
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_ZIGBEE_LEAVE);
3409
+ sendBuffalo.writeUInt16(destination);
3410
+ sendBuffalo.writeUInt8(flags);
3411
+ const sendStatus = await this.sendCommand(sendBuffalo);
3405
3412
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3406
3413
  throw new ezspError_1.EzspError(sendStatus);
3407
3414
  }
@@ -3413,11 +3420,11 @@ class Ezsp extends events_1.default {
3413
3420
  * @returns Whether the current network permits joining.
3414
3421
  */
3415
3422
  async ezspGetPermitJoining() {
3416
- if (this.version < 0x0E) {
3423
+ if (this.version < 0x0e) {
3417
3424
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3418
3425
  }
3419
- this.startCommand(enums_2.EzspFrameID.GET_PERMIT_JOINING);
3420
- const sendStatus = await this.sendCommand();
3426
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_PERMIT_JOINING);
3427
+ const sendStatus = await this.sendCommand(sendBuffalo);
3421
3428
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3422
3429
  throw new ezspError_1.EzspError(sendStatus);
3423
3430
  }
@@ -3429,11 +3436,11 @@ class Ezsp extends events_1.default {
3429
3436
  * @returns Extended PAN ID of this node. Valid only if it is currently on a network.
3430
3437
  */
3431
3438
  async ezspGetExtendedPanId() {
3432
- if (this.version < 0x0E) {
3439
+ if (this.version < 0x0e) {
3433
3440
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3434
3441
  }
3435
- this.startCommand(enums_2.EzspFrameID.GET_EXTENDED_PAN_ID);
3436
- const sendStatus = await this.sendCommand();
3442
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_EXTENDED_PAN_ID);
3443
+ const sendStatus = await this.sendCommand(sendBuffalo);
3437
3444
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3438
3445
  throw new ezspError_1.EzspError(sendStatus);
3439
3446
  }
@@ -3445,11 +3452,11 @@ class Ezsp extends events_1.default {
3445
3452
  * @returns Return the current network index.
3446
3453
  */
3447
3454
  async ezspGetCurrentNetwork() {
3448
- if (this.version < 0x0E) {
3455
+ if (this.version < 0x0e) {
3449
3456
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3450
3457
  }
3451
- this.startCommand(enums_2.EzspFrameID.GET_CURRENT_NETWORK);
3452
- const sendStatus = await this.sendCommand();
3458
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_CURRENT_NETWORK);
3459
+ const sendStatus = await this.sendCommand(sendBuffalo);
3453
3460
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3454
3461
  throw new ezspError_1.EzspError(sendStatus);
3455
3462
  }
@@ -3462,12 +3469,12 @@ class Ezsp extends events_1.default {
3462
3469
  * @returns Whether or not initial cost was successfully set.
3463
3470
  */
3464
3471
  async ezspSetInitialNeighborOutgoingCost(cost) {
3465
- if (this.version < 0x0E) {
3472
+ if (this.version < 0x0e) {
3466
3473
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3467
3474
  }
3468
- this.startCommand(enums_2.EzspFrameID.SET_INITIAL_NEIGHBOR_OUTGOING_COST);
3469
- this.buffalo.writeUInt8(cost);
3470
- const sendStatus = await this.sendCommand();
3475
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_INITIAL_NEIGHBOR_OUTGOING_COST);
3476
+ sendBuffalo.writeUInt8(cost);
3477
+ const sendStatus = await this.sendCommand(sendBuffalo);
3471
3478
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3472
3479
  throw new ezspError_1.EzspError(sendStatus);
3473
3480
  }
@@ -3479,11 +3486,11 @@ class Ezsp extends events_1.default {
3479
3486
  * @returns The default cost associated with new neighbor's outgoing links.
3480
3487
  */
3481
3488
  async ezspGetInitialNeighborOutgoingCost() {
3482
- if (this.version < 0x0E) {
3489
+ if (this.version < 0x0e) {
3483
3490
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3484
3491
  }
3485
- this.startCommand(enums_2.EzspFrameID.GET_INITIAL_NEIGHBOR_OUTGOING_COST);
3486
- const sendStatus = await this.sendCommand();
3492
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_INITIAL_NEIGHBOR_OUTGOING_COST);
3493
+ const sendStatus = await this.sendCommand(sendBuffalo);
3487
3494
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3488
3495
  throw new ezspError_1.EzspError(sendStatus);
3489
3496
  }
@@ -3495,12 +3502,12 @@ class Ezsp extends events_1.default {
3495
3502
  * @param reset
3496
3503
  */
3497
3504
  async ezspResetRejoiningNeighborsFrameCounter(reset) {
3498
- if (this.version < 0x0E) {
3505
+ if (this.version < 0x0e) {
3499
3506
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3500
3507
  }
3501
- this.startCommand(enums_2.EzspFrameID.RESET_REJOINING_NEIGHBORS_FRAME_COUNTER);
3502
- this.buffalo.writeUInt8(reset ? 1 : 0);
3503
- const sendStatus = await this.sendCommand();
3508
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.RESET_REJOINING_NEIGHBORS_FRAME_COUNTER);
3509
+ sendBuffalo.writeUInt8(reset ? 1 : 0);
3510
+ const sendStatus = await this.sendCommand(sendBuffalo);
3504
3511
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3505
3512
  throw new ezspError_1.EzspError(sendStatus);
3506
3513
  }
@@ -3510,11 +3517,11 @@ class Ezsp extends events_1.default {
3510
3517
  * @returns Whether or not a rejoining neighbor's incoming FC gets reset (true or false).
3511
3518
  */
3512
3519
  async ezspIsResetRejoiningNeighborsFrameCounterEnabled() {
3513
- if (this.version < 0x0E) {
3520
+ if (this.version < 0x0e) {
3514
3521
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3515
3522
  }
3516
- this.startCommand(enums_2.EzspFrameID.IS_RESET_REJOINING_NEIGHBORS_FRAME_COUNTER_ENABLED);
3517
- const sendStatus = await this.sendCommand();
3523
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.IS_RESET_REJOINING_NEIGHBORS_FRAME_COUNTER_ENABLED);
3524
+ const sendStatus = await this.sendCommand(sendBuffalo);
3518
3525
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3519
3526
  throw new ezspError_1.EzspError(sendStatus);
3520
3527
  }
@@ -3529,8 +3536,8 @@ class Ezsp extends events_1.default {
3529
3536
  * @returns An SLStatus value indicating success or the reason for failure.
3530
3537
  */
3531
3538
  async ezspClearBindingTable() {
3532
- this.startCommand(enums_2.EzspFrameID.CLEAR_BINDING_TABLE);
3533
- const sendStatus = await this.sendCommand();
3539
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CLEAR_BINDING_TABLE);
3540
+ const sendStatus = await this.sendCommand(sendBuffalo);
3534
3541
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3535
3542
  throw new ezspError_1.EzspError(sendStatus);
3536
3543
  }
@@ -3544,10 +3551,10 @@ class Ezsp extends events_1.default {
3544
3551
  * @returns An SLStatus value indicating success or the reason for failure.
3545
3552
  */
3546
3553
  async ezspSetBinding(index, value) {
3547
- this.startCommand(enums_2.EzspFrameID.SET_BINDING);
3548
- this.buffalo.writeUInt8(index);
3549
- this.buffalo.writeEmberBindingTableEntry(value);
3550
- const sendStatus = await this.sendCommand();
3554
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_BINDING);
3555
+ sendBuffalo.writeUInt8(index);
3556
+ sendBuffalo.writeEmberBindingTableEntry(value);
3557
+ const sendStatus = await this.sendCommand(sendBuffalo);
3551
3558
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3552
3559
  throw new ezspError_1.EzspError(sendStatus);
3553
3560
  }
@@ -3561,9 +3568,9 @@ class Ezsp extends events_1.default {
3561
3568
  * @returns EmberBindingTableEntry * The contents of the binding entry.
3562
3569
  */
3563
3570
  async ezspGetBinding(index) {
3564
- this.startCommand(enums_2.EzspFrameID.GET_BINDING);
3565
- this.buffalo.writeUInt8(index);
3566
- const sendStatus = await this.sendCommand();
3571
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_BINDING);
3572
+ sendBuffalo.writeUInt8(index);
3573
+ const sendStatus = await this.sendCommand(sendBuffalo);
3567
3574
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3568
3575
  throw new ezspError_1.EzspError(sendStatus);
3569
3576
  }
@@ -3577,9 +3584,9 @@ class Ezsp extends events_1.default {
3577
3584
  * @returns An SLStatus value indicating success or the reason for failure.
3578
3585
  */
3579
3586
  async ezspDeleteBinding(index) {
3580
- this.startCommand(enums_2.EzspFrameID.DELETE_BINDING);
3581
- this.buffalo.writeUInt8(index);
3582
- const sendStatus = await this.sendCommand();
3587
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.DELETE_BINDING);
3588
+ sendBuffalo.writeUInt8(index);
3589
+ const sendStatus = await this.sendCommand(sendBuffalo);
3583
3590
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3584
3591
  throw new ezspError_1.EzspError(sendStatus);
3585
3592
  }
@@ -3595,9 +3602,9 @@ class Ezsp extends events_1.default {
3595
3602
  * @returns True if the binding table entry is active, false otherwise.
3596
3603
  */
3597
3604
  async ezspBindingIsActive(index) {
3598
- this.startCommand(enums_2.EzspFrameID.BINDING_IS_ACTIVE);
3599
- this.buffalo.writeUInt8(index);
3600
- const sendStatus = await this.sendCommand();
3605
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.BINDING_IS_ACTIVE);
3606
+ sendBuffalo.writeUInt8(index);
3607
+ const sendStatus = await this.sendCommand(sendBuffalo);
3601
3608
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3602
3609
  throw new ezspError_1.EzspError(sendStatus);
3603
3610
  }
@@ -3617,9 +3624,9 @@ class Ezsp extends events_1.default {
3617
3624
  * @returns The short ID of the destination node or EMBER_NULL_NODE_ID if no destination is known.
3618
3625
  */
3619
3626
  async ezspGetBindingRemoteNodeId(index) {
3620
- this.startCommand(enums_2.EzspFrameID.GET_BINDING_REMOTE_NODE_ID);
3621
- this.buffalo.writeUInt8(index);
3622
- const sendStatus = await this.sendCommand();
3627
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_BINDING_REMOTE_NODE_ID);
3628
+ sendBuffalo.writeUInt8(index);
3629
+ const sendStatus = await this.sendCommand(sendBuffalo);
3623
3630
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3624
3631
  throw new ezspError_1.EzspError(sendStatus);
3625
3632
  }
@@ -3633,10 +3640,10 @@ class Ezsp extends events_1.default {
3633
3640
  * @param The short ID of the destination node.
3634
3641
  */
3635
3642
  async ezspSetBindingRemoteNodeId(index, nodeId) {
3636
- this.startCommand(enums_2.EzspFrameID.SET_BINDING_REMOTE_NODE_ID);
3637
- this.buffalo.writeUInt8(index);
3638
- this.buffalo.writeUInt16(nodeId);
3639
- const sendStatus = await this.sendCommand();
3643
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_BINDING_REMOTE_NODE_ID);
3644
+ sendBuffalo.writeUInt8(index);
3645
+ sendBuffalo.writeUInt16(nodeId);
3646
+ const sendStatus = await this.sendCommand(sendBuffalo);
3640
3647
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3641
3648
  throw new ezspError_1.EzspError(sendStatus);
3642
3649
  }
@@ -3652,8 +3659,8 @@ class Ezsp extends events_1.default {
3652
3659
  * @param policyDecision SLStatus.OK if the binding was added to the table and any other status if not.
3653
3660
  */
3654
3661
  ezspRemoteSetBindingHandler(entry, index, policyDecision) {
3655
- logger_1.logger.debug(`ezspRemoteSetBindingHandler(): callback called with: [entry=${entry}], [index=${index}], `
3656
- + `[policyDecision=${enums_1.SLStatus[policyDecision]}]`, NS);
3662
+ logger_1.logger.debug(`ezspRemoteSetBindingHandler(): callback called with: [entry=${JSON.stringify(entry)}], [index=${index}], ` +
3663
+ `[policyDecision=${enums_1.SLStatus[policyDecision]}]`, NS);
3657
3664
  }
3658
3665
  /**
3659
3666
  * Callback
@@ -3675,8 +3682,8 @@ class Ezsp extends events_1.default {
3675
3682
  * @returns uint8_t The maximum APS payload length.
3676
3683
  */
3677
3684
  async ezspMaximumPayloadLength() {
3678
- this.startCommand(enums_2.EzspFrameID.MAXIMUM_PAYLOAD_LENGTH);
3679
- const sendStatus = await this.sendCommand();
3685
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MAXIMUM_PAYLOAD_LENGTH);
3686
+ const sendStatus = await this.sendCommand(sendBuffalo);
3680
3687
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3681
3688
  throw new ezspError_1.EzspError(sendStatus);
3682
3689
  }
@@ -3711,18 +3718,18 @@ class Ezsp extends events_1.default {
3711
3718
  * @returns uint8_t * The sequence number that will be used when this message is transmitted.
3712
3719
  */
3713
3720
  async ezspSendUnicast(type, indexOrDestination, apsFrame, messageTag, messageContents) {
3714
- this.startCommand(enums_2.EzspFrameID.SEND_UNICAST);
3715
- this.buffalo.writeUInt8(type);
3716
- this.buffalo.writeUInt16(indexOrDestination);
3717
- this.buffalo.writeEmberApsFrame(apsFrame);
3718
- if (this.version < 0x0E) {
3719
- this.buffalo.writeUInt8(messageTag);
3721
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_UNICAST);
3722
+ sendBuffalo.writeUInt8(type);
3723
+ sendBuffalo.writeUInt16(indexOrDestination);
3724
+ sendBuffalo.writeEmberApsFrame(apsFrame);
3725
+ if (this.version < 0x0e) {
3726
+ sendBuffalo.writeUInt8(messageTag);
3720
3727
  }
3721
3728
  else {
3722
- this.buffalo.writeUInt16(messageTag);
3729
+ sendBuffalo.writeUInt16(messageTag);
3723
3730
  }
3724
- this.buffalo.writePayload(messageContents);
3725
- const sendStatus = await this.sendCommand();
3731
+ sendBuffalo.writePayload(messageContents);
3732
+ const sendStatus = await this.sendCommand(sendBuffalo);
3726
3733
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3727
3734
  throw new ezspError_1.EzspError(sendStatus);
3728
3735
  }
@@ -3746,23 +3753,23 @@ class Ezsp extends events_1.default {
3746
3753
  * @returns uint8_t * The sequence number that will be used when this message is transmitted.
3747
3754
  */
3748
3755
  async ezspSendBroadcast(alias, destination, nwkSequence, apsFrame, radius, messageTag, messageContents) {
3749
- this.startCommand(enums_2.EzspFrameID.SEND_BROADCAST);
3750
- if (this.version < 0x0E) {
3751
- this.buffalo.writeUInt16(destination);
3752
- this.buffalo.writeEmberApsFrame(apsFrame);
3753
- this.buffalo.writeUInt8(radius);
3754
- this.buffalo.writeUInt8(messageTag);
3756
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_BROADCAST);
3757
+ if (this.version < 0x0e) {
3758
+ sendBuffalo.writeUInt16(destination);
3759
+ sendBuffalo.writeEmberApsFrame(apsFrame);
3760
+ sendBuffalo.writeUInt8(radius);
3761
+ sendBuffalo.writeUInt8(messageTag);
3755
3762
  }
3756
3763
  else {
3757
- this.buffalo.writeUInt16(alias);
3758
- this.buffalo.writeUInt16(destination);
3759
- this.buffalo.writeUInt8(nwkSequence);
3760
- this.buffalo.writeEmberApsFrame(apsFrame);
3761
- this.buffalo.writeUInt8(radius);
3762
- this.buffalo.writeUInt16(messageTag);
3764
+ sendBuffalo.writeUInt16(alias);
3765
+ sendBuffalo.writeUInt16(destination);
3766
+ sendBuffalo.writeUInt8(nwkSequence);
3767
+ sendBuffalo.writeEmberApsFrame(apsFrame);
3768
+ sendBuffalo.writeUInt8(radius);
3769
+ sendBuffalo.writeUInt16(messageTag);
3763
3770
  }
3764
- this.buffalo.writePayload(messageContents);
3765
- const sendStatus = await this.sendCommand();
3771
+ sendBuffalo.writePayload(messageContents);
3772
+ const sendStatus = await this.sendCommand(sendBuffalo);
3766
3773
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3767
3774
  throw new ezspError_1.EzspError(sendStatus);
3768
3775
  }
@@ -3777,12 +3784,12 @@ class Ezsp extends events_1.default {
3777
3784
  * @returns An SLStatus value indicating success or the reason for failure.
3778
3785
  */
3779
3786
  async ezspProxyNextBroadcastFromLong(euiSource) {
3780
- if (this.version < 0x0E) {
3787
+ if (this.version < 0x0e) {
3781
3788
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3782
3789
  }
3783
- this.startCommand(enums_2.EzspFrameID.PROXY_NEXT_BROADCAST_FROM_LONG);
3784
- this.buffalo.writeIeeeAddr(euiSource);
3785
- const sendStatus = await this.sendCommand();
3790
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.PROXY_NEXT_BROADCAST_FROM_LONG);
3791
+ sendBuffalo.writeIeeeAddr(euiSource);
3792
+ const sendStatus = await this.sendCommand(sendBuffalo);
3786
3793
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3787
3794
  throw new ezspError_1.EzspError(sendStatus);
3788
3795
  }
@@ -3812,21 +3819,21 @@ class Ezsp extends events_1.default {
3812
3819
  * @returns uint8_t * The sequence number that will be used when this message is transmitted.
3813
3820
  */
3814
3821
  async ezspSendMulticast(apsFrame, hops, broadcastAddr, alias, nwkSequence, messageTag, messageContents) {
3815
- this.startCommand(enums_2.EzspFrameID.SEND_MULTICAST);
3816
- this.buffalo.writeEmberApsFrame(apsFrame);
3817
- this.buffalo.writeUInt8(hops);
3818
- if (this.version < 0x0E) {
3819
- this.buffalo.writeUInt8(ZA_MAX_HOPS); // nonMemberRadius
3820
- this.buffalo.writeUInt8(messageTag);
3822
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_MULTICAST);
3823
+ sendBuffalo.writeEmberApsFrame(apsFrame);
3824
+ sendBuffalo.writeUInt8(hops);
3825
+ if (this.version < 0x0e) {
3826
+ sendBuffalo.writeUInt8(ZA_MAX_HOPS); // nonMemberRadius
3827
+ sendBuffalo.writeUInt8(messageTag);
3821
3828
  }
3822
3829
  else {
3823
- this.buffalo.writeUInt16(broadcastAddr);
3824
- this.buffalo.writeUInt16(alias);
3825
- this.buffalo.writeUInt8(nwkSequence);
3826
- this.buffalo.writeUInt16(messageTag);
3830
+ sendBuffalo.writeUInt16(broadcastAddr);
3831
+ sendBuffalo.writeUInt16(alias);
3832
+ sendBuffalo.writeUInt8(nwkSequence);
3833
+ sendBuffalo.writeUInt16(messageTag);
3827
3834
  }
3828
- this.buffalo.writePayload(messageContents);
3829
- const sendStatus = await this.sendCommand();
3835
+ sendBuffalo.writePayload(messageContents);
3836
+ const sendStatus = await this.sendCommand(sendBuffalo);
3830
3837
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3831
3838
  throw new ezspError_1.EzspError(sendStatus);
3832
3839
  }
@@ -3856,11 +3863,11 @@ class Ezsp extends events_1.default {
3856
3863
  * - SLStatus.OK - The reply was successfully queued for transmission.
3857
3864
  */
3858
3865
  async ezspSendReply(sender, apsFrame, messageContents) {
3859
- this.startCommand(enums_2.EzspFrameID.SEND_REPLY);
3860
- this.buffalo.writeUInt16(sender);
3861
- this.buffalo.writeEmberApsFrame(apsFrame);
3862
- this.buffalo.writePayload(messageContents);
3863
- const sendStatus = await this.sendCommand();
3866
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_REPLY);
3867
+ sendBuffalo.writeUInt16(sender);
3868
+ sendBuffalo.writeEmberApsFrame(apsFrame);
3869
+ sendBuffalo.writePayload(messageContents);
3870
+ const sendStatus = await this.sendCommand(sendBuffalo);
3864
3871
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3865
3872
  throw new ezspError_1.EzspError(sendStatus);
3866
3873
  }
@@ -3882,9 +3889,9 @@ class Ezsp extends events_1.default {
3882
3889
  * for the messageContentsInCallback policy is messageTagAndContentsInCallback.
3883
3890
  */
3884
3891
  ezspMessageSentHandler(status, type, indexOrDestination, apsFrame, messageTag, messageContents = undefined) {
3885
- logger_1.logger.debug(`ezspMessageSentHandler(): callback called with: [status=${enums_1.SLStatus[status]}], [type=${enums_1.EmberOutgoingMessageType[type]}], `
3886
- + `[indexOrDestination=${indexOrDestination}], [apsFrame=${JSON.stringify(apsFrame)}], [messageTag=${messageTag}]`
3887
- + (messageContents ? `, [messageContents=${messageContents.toString('hex')}]` : ''), NS);
3892
+ logger_1.logger.debug(`ezspMessageSentHandler(): callback called with: [status=${enums_1.SLStatus[status]}], [type=${enums_1.EmberOutgoingMessageType[type]}], ` +
3893
+ `[indexOrDestination=${indexOrDestination}], [apsFrame=${JSON.stringify(apsFrame)}], [messageTag=${messageTag}]` +
3894
+ (messageContents ? `, [messageContents=${messageContents.toString('hex')}]` : ''), NS);
3888
3895
  this.emit(EzspEvents.MESSAGE_SENT, status, type, indexOrDestination, apsFrame, messageTag);
3889
3896
  }
3890
3897
  /**
@@ -3925,10 +3932,10 @@ class Ezsp extends events_1.default {
3925
3932
  * - SLStatus.FAIL otherwise.
3926
3933
  */
3927
3934
  async ezspSendManyToOneRouteRequest(concentratorType, radius) {
3928
- this.startCommand(enums_2.EzspFrameID.SEND_MANY_TO_ONE_ROUTE_REQUEST);
3929
- this.buffalo.writeUInt16(concentratorType);
3930
- this.buffalo.writeUInt8(radius);
3931
- const sendStatus = await this.sendCommand();
3935
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_MANY_TO_ONE_ROUTE_REQUEST);
3936
+ sendBuffalo.writeUInt16(concentratorType);
3937
+ sendBuffalo.writeUInt8(radius);
3938
+ const sendStatus = await this.sendCommand(sendBuffalo);
3932
3939
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3933
3940
  throw new ezspError_1.EzspError(sendStatus);
3934
3941
  }
@@ -3947,11 +3954,11 @@ class Ezsp extends events_1.default {
3947
3954
  * @returns The result of sending the first poll.
3948
3955
  */
3949
3956
  async ezspPollForData(interval, units, failureLimit) {
3950
- this.startCommand(enums_2.EzspFrameID.POLL_FOR_DATA);
3951
- this.buffalo.writeUInt16(interval);
3952
- this.buffalo.writeUInt8(units);
3953
- this.buffalo.writeUInt8(failureLimit);
3954
- const sendStatus = await this.sendCommand();
3957
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.POLL_FOR_DATA);
3958
+ sendBuffalo.writeUInt16(interval);
3959
+ sendBuffalo.writeUInt8(units);
3960
+ sendBuffalo.writeUInt8(failureLimit);
3961
+ const sendStatus = await this.sendCommand(sendBuffalo);
3955
3962
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3956
3963
  throw new ezspError_1.EzspError(sendStatus);
3957
3964
  }
@@ -3980,12 +3987,12 @@ class Ezsp extends events_1.default {
3980
3987
  * - SLStatus.NOT_JOINED - The child identified by childId is not our child.
3981
3988
  */
3982
3989
  async ezspSetMessageFlag(childId) {
3983
- if (this.version < 0x0E) {
3990
+ if (this.version < 0x0e) {
3984
3991
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
3985
3992
  }
3986
- this.startCommand(enums_2.EzspFrameID.SET_MESSAGE_FLAG);
3987
- this.buffalo.writeUInt16(childId);
3988
- const sendStatus = await this.sendCommand();
3993
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_MESSAGE_FLAG);
3994
+ sendBuffalo.writeUInt16(childId);
3995
+ const sendStatus = await this.sendCommand(sendBuffalo);
3989
3996
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
3990
3997
  throw new ezspError_1.EzspError(sendStatus);
3991
3998
  }
@@ -4001,12 +4008,12 @@ class Ezsp extends events_1.default {
4001
4008
  * - SLStatus.NOT_JOINED - The child identified by childId is not our child.
4002
4009
  */
4003
4010
  async ezspClearMessageFlag(childId) {
4004
- if (this.version < 0x0E) {
4011
+ if (this.version < 0x0e) {
4005
4012
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
4006
4013
  }
4007
- this.startCommand(enums_2.EzspFrameID.CLEAR_MESSAGE_FLAG);
4008
- this.buffalo.writeUInt16(childId);
4009
- const sendStatus = await this.sendCommand();
4014
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CLEAR_MESSAGE_FLAG);
4015
+ sendBuffalo.writeUInt16(childId);
4016
+ const sendStatus = await this.sendCommand(sendBuffalo);
4010
4017
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4011
4018
  throw new ezspError_1.EzspError(sendStatus);
4012
4019
  }
@@ -4034,14 +4041,14 @@ class Ezsp extends events_1.default {
4034
4041
  * - SLStatus.FAIL - The child was not added to the child/neighbor table.
4035
4042
  */
4036
4043
  async ezspAddChild(shortId, longId, nodeType) {
4037
- if (this.version < 0x0E) {
4044
+ if (this.version < 0x0e) {
4038
4045
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
4039
4046
  }
4040
- this.startCommand(enums_2.EzspFrameID.ADD_CHILD);
4041
- this.buffalo.writeUInt16(shortId);
4042
- this.buffalo.writeIeeeAddr(longId);
4043
- this.buffalo.writeUInt8(nodeType);
4044
- const sendStatus = await this.sendCommand();
4047
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ADD_CHILD);
4048
+ sendBuffalo.writeUInt16(shortId);
4049
+ sendBuffalo.writeIeeeAddr(longId);
4050
+ sendBuffalo.writeUInt8(nodeType);
4051
+ const sendStatus = await this.sendCommand(sendBuffalo);
4045
4052
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4046
4053
  throw new ezspError_1.EzspError(sendStatus);
4047
4054
  }
@@ -4057,12 +4064,12 @@ class Ezsp extends events_1.default {
4057
4064
  * - SLStatus.FAIL - The node was not found in either of the child or neighbor tables.
4058
4065
  */
4059
4066
  async ezspRemoveChild(childEui64) {
4060
- if (this.version < 0x0E) {
4067
+ if (this.version < 0x0e) {
4061
4068
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
4062
4069
  }
4063
- this.startCommand(enums_2.EzspFrameID.REMOVE_CHILD);
4064
- this.buffalo.writeIeeeAddr(childEui64);
4065
- const sendStatus = await this.sendCommand();
4070
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.REMOVE_CHILD);
4071
+ sendBuffalo.writeIeeeAddr(childEui64);
4072
+ const sendStatus = await this.sendCommand(sendBuffalo);
4066
4073
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4067
4074
  throw new ezspError_1.EzspError(sendStatus);
4068
4075
  }
@@ -4076,13 +4083,13 @@ class Ezsp extends events_1.default {
4076
4083
  * @param longId The long ID of the neighbor.
4077
4084
  */
4078
4085
  async ezspRemoveNeighbor(shortId, longId) {
4079
- if (this.version < 0x0E) {
4086
+ if (this.version < 0x0e) {
4080
4087
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
4081
4088
  }
4082
- this.startCommand(enums_2.EzspFrameID.REMOVE_NEIGHBOR);
4083
- this.buffalo.writeUInt16(shortId);
4084
- this.buffalo.writeIeeeAddr(longId);
4085
- const sendStatus = await this.sendCommand();
4089
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.REMOVE_NEIGHBOR);
4090
+ sendBuffalo.writeUInt16(shortId);
4091
+ sendBuffalo.writeIeeeAddr(longId);
4092
+ const sendStatus = await this.sendCommand(sendBuffalo);
4086
4093
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4087
4094
  throw new ezspError_1.EzspError(sendStatus);
4088
4095
  }
@@ -4098,8 +4105,8 @@ class Ezsp extends events_1.default {
4098
4105
  * @param messageContents uint8_t * The incoming message.
4099
4106
  */
4100
4107
  ezspIncomingMessageHandler(type, apsFrame, packetInfo, messageContents) {
4101
- logger_1.logger.debug(`ezspIncomingMessageHandler(): callback called with: [type=${enums_1.EmberIncomingMessageType[type]}], [apsFrame=${JSON.stringify(apsFrame)}], `
4102
- + `[packetInfo:${JSON.stringify(packetInfo)}], [messageContents=${messageContents.toString('hex')}]`, NS);
4108
+ logger_1.logger.debug(`ezspIncomingMessageHandler(): callback called with: [type=${enums_1.EmberIncomingMessageType[type]}], [apsFrame=${JSON.stringify(apsFrame)}], ` +
4109
+ `[packetInfo:${JSON.stringify(packetInfo)}], [messageContents=${messageContents.toString('hex')}]`, NS);
4103
4110
  if (apsFrame.profileId === Zdo.ZDO_PROFILE_ID) {
4104
4111
  this.emit(EzspEvents.ZDO_RESPONSE, apsFrame, packetInfo.senderShortId, messageContents);
4105
4112
  }
@@ -4116,9 +4123,9 @@ class Ezsp extends events_1.default {
4116
4123
  * @returns uint32_t Remaining time(ms) until next MTORR broadcast if the mode is on, MAX_INT32U_VALUE if the mode is off
4117
4124
  */
4118
4125
  async ezspSetSourceRouteDiscoveryMode(mode) {
4119
- this.startCommand(enums_2.EzspFrameID.SET_SOURCE_ROUTE_DISCOVERY_MODE);
4120
- this.buffalo.writeUInt8(mode);
4121
- const sendStatus = await this.sendCommand();
4126
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_SOURCE_ROUTE_DISCOVERY_MODE);
4127
+ sendBuffalo.writeUInt8(mode);
4128
+ const sendStatus = await this.sendCommand(sendBuffalo);
4122
4129
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4123
4130
  throw new ezspError_1.EzspError(sendStatus);
4124
4131
  }
@@ -4194,8 +4201,8 @@ class Ezsp extends events_1.default {
4194
4201
  * The list is passed as uint8_t * to avoid alignment problems.
4195
4202
  */
4196
4203
  ezspIncomingRouteRecordHandler(source, sourceEui, lastHopLqi, lastHopRssi, relayCount, relayList) {
4197
- logger_1.logger.debug(`ezspIncomingRouteRecordHandler(): callback called with: [source=${source}], [sourceEui=${sourceEui}], `
4198
- + `[lastHopLqi=${lastHopLqi}], [lastHopRssi=${lastHopRssi}], [relayCount=${relayCount}], [relayList=${relayList}]`, NS);
4204
+ logger_1.logger.debug(`ezspIncomingRouteRecordHandler(): callback called with: [source=${source}], [sourceEui=${sourceEui}], ` +
4205
+ `[lastHopLqi=${lastHopLqi}], [lastHopRssi=${lastHopRssi}], [relayCount=${relayCount}], [relayList=${relayList}]`, NS);
4199
4206
  // XXX: could at least trigger a `Events.lastSeenChanged` but this is not currently being listened to at the adapter level
4200
4207
  }
4201
4208
  /**
@@ -4206,11 +4213,11 @@ class Ezsp extends events_1.default {
4206
4213
  * @returns SLStatus.OK if send was successful
4207
4214
  */
4208
4215
  async ezspUnicastCurrentNetworkKey(targetShort, targetLong, parentShortId) {
4209
- this.startCommand(enums_2.EzspFrameID.UNICAST_CURRENT_NETWORK_KEY);
4210
- this.buffalo.writeUInt16(targetShort);
4211
- this.buffalo.writeIeeeAddr(targetLong);
4212
- this.buffalo.writeUInt16(parentShortId);
4213
- const sendStatus = await this.sendCommand();
4216
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.UNICAST_CURRENT_NETWORK_KEY);
4217
+ sendBuffalo.writeUInt16(targetShort);
4218
+ sendBuffalo.writeIeeeAddr(targetLong);
4219
+ sendBuffalo.writeUInt16(parentShortId);
4220
+ const sendStatus = await this.sendCommand(sendBuffalo);
4214
4221
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4215
4222
  throw new ezspError_1.EzspError(sendStatus);
4216
4223
  }
@@ -4227,9 +4234,9 @@ class Ezsp extends events_1.default {
4227
4234
  * @returns True if the address table entry is active, false otherwise.
4228
4235
  */
4229
4236
  async ezspAddressTableEntryIsActive(addressTableIndex) {
4230
- this.startCommand(enums_2.EzspFrameID.ADDRESS_TABLE_ENTRY_IS_ACTIVE);
4231
- this.buffalo.writeUInt8(addressTableIndex);
4232
- const sendStatus = await this.sendCommand();
4237
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ADDRESS_TABLE_ENTRY_IS_ACTIVE);
4238
+ sendBuffalo.writeUInt8(addressTableIndex);
4239
+ const sendStatus = await this.sendCommand(sendBuffalo);
4233
4240
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4234
4241
  throw new ezspError_1.EzspError(sendStatus);
4235
4242
  }
@@ -4252,14 +4259,14 @@ class Ezsp extends events_1.default {
4252
4259
  * - SLStatus.ZIGBEE_ADDRESS_TABLE_ENTRY_IS_ACTIVE otherwise.
4253
4260
  */
4254
4261
  async ezspSetAddressTableInfo(addressTableIndex, eui64, id) {
4255
- if (this.version < 0x0E) {
4262
+ if (this.version < 0x0e) {
4256
4263
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
4257
4264
  }
4258
- this.startCommand(enums_2.EzspFrameID.SET_ADDRESS_TABLE_INFO);
4259
- this.buffalo.writeUInt8(addressTableIndex);
4260
- this.buffalo.writeIeeeAddr(eui64);
4261
- this.buffalo.writeUInt16(id);
4262
- const sendStatus = await this.sendCommand();
4265
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_ADDRESS_TABLE_INFO);
4266
+ sendBuffalo.writeUInt8(addressTableIndex);
4267
+ sendBuffalo.writeIeeeAddr(eui64);
4268
+ sendBuffalo.writeUInt16(id);
4269
+ const sendStatus = await this.sendCommand(sendBuffalo);
4263
4270
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4264
4271
  throw new ezspError_1.EzspError(sendStatus);
4265
4272
  }
@@ -4281,12 +4288,12 @@ class Ezsp extends events_1.default {
4281
4288
  * @returns The EUI64 of the address table entry is copied to this location.
4282
4289
  */
4283
4290
  async ezspGetAddressTableInfo(addressTableIndex) {
4284
- if (this.version < 0x0E) {
4291
+ if (this.version < 0x0e) {
4285
4292
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
4286
4293
  }
4287
- this.startCommand(enums_2.EzspFrameID.GET_ADDRESS_TABLE_INFO);
4288
- this.buffalo.writeUInt8(addressTableIndex);
4289
- const sendStatus = await this.sendCommand();
4294
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_ADDRESS_TABLE_INFO);
4295
+ sendBuffalo.writeUInt8(addressTableIndex);
4296
+ const sendStatus = await this.sendCommand(sendBuffalo);
4290
4297
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4291
4298
  throw new ezspError_1.EzspError(sendStatus);
4292
4299
  }
@@ -4311,14 +4318,14 @@ class Ezsp extends events_1.default {
4311
4318
  * @returns An SLStatus value indicating success or the reason for failure. Always `OK` in v13-.
4312
4319
  */
4313
4320
  async ezspSetExtendedTimeout(remoteEui64, extendedTimeout) {
4314
- this.startCommand(enums_2.EzspFrameID.SET_EXTENDED_TIMEOUT);
4315
- this.buffalo.writeIeeeAddr(remoteEui64);
4316
- this.buffalo.writeUInt8(extendedTimeout ? 1 : 0);
4317
- const sendStatus = await this.sendCommand();
4321
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_EXTENDED_TIMEOUT);
4322
+ sendBuffalo.writeIeeeAddr(remoteEui64);
4323
+ sendBuffalo.writeUInt8(extendedTimeout ? 1 : 0);
4324
+ const sendStatus = await this.sendCommand(sendBuffalo);
4318
4325
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4319
4326
  throw new ezspError_1.EzspError(sendStatus);
4320
4327
  }
4321
- if (this.version < 0x0E) {
4328
+ if (this.version < 0x0e) {
4322
4329
  return enums_1.SLStatus.OK;
4323
4330
  }
4324
4331
  else {
@@ -4336,13 +4343,13 @@ class Ezsp extends events_1.default {
4336
4343
  * - SLStatus.FAIL if the normal retry interval will be used.
4337
4344
  */
4338
4345
  async ezspGetExtendedTimeout(remoteEui64) {
4339
- this.startCommand(enums_2.EzspFrameID.GET_EXTENDED_TIMEOUT);
4340
- this.buffalo.writeIeeeAddr(remoteEui64);
4341
- const sendStatus = await this.sendCommand();
4346
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_EXTENDED_TIMEOUT);
4347
+ sendBuffalo.writeIeeeAddr(remoteEui64);
4348
+ const sendStatus = await this.sendCommand(sendBuffalo);
4342
4349
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4343
4350
  throw new ezspError_1.EzspError(sendStatus);
4344
4351
  }
4345
- if (this.version < 0x0E) {
4352
+ if (this.version < 0x0e) {
4346
4353
  const extendedTimeout = this.buffalo.readUInt8() !== 0;
4347
4354
  return extendedTimeout ? enums_1.SLStatus.OK : enums_1.SLStatus.FAIL;
4348
4355
  }
@@ -4373,12 +4380,12 @@ class Ezsp extends events_1.default {
4373
4380
  * false if the normal retry interval was being used.
4374
4381
  */
4375
4382
  async ezspReplaceAddressTableEntry(addressTableIndex, newEui64, newId, newExtendedTimeout) {
4376
- this.startCommand(enums_2.EzspFrameID.REPLACE_ADDRESS_TABLE_ENTRY);
4377
- this.buffalo.writeUInt8(addressTableIndex);
4378
- this.buffalo.writeIeeeAddr(newEui64);
4379
- this.buffalo.writeUInt16(newId);
4380
- this.buffalo.writeUInt8(newExtendedTimeout ? 1 : 0);
4381
- const sendStatus = await this.sendCommand();
4383
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.REPLACE_ADDRESS_TABLE_ENTRY);
4384
+ sendBuffalo.writeUInt8(addressTableIndex);
4385
+ sendBuffalo.writeIeeeAddr(newEui64);
4386
+ sendBuffalo.writeUInt16(newId);
4387
+ sendBuffalo.writeUInt8(newExtendedTimeout ? 1 : 0);
4388
+ const sendStatus = await this.sendCommand(sendBuffalo);
4382
4389
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4383
4390
  throw new ezspError_1.EzspError(sendStatus);
4384
4391
  }
@@ -4395,9 +4402,9 @@ class Ezsp extends events_1.default {
4395
4402
  * @returns The short ID of the node or SL_ZIGBEE_NULL_NODE_ID if the short ID is not known.
4396
4403
  */
4397
4404
  async ezspLookupNodeIdByEui64(eui64) {
4398
- this.startCommand(enums_2.EzspFrameID.LOOKUP_NODE_ID_BY_EUI64);
4399
- this.buffalo.writeIeeeAddr(eui64);
4400
- const sendStatus = await this.sendCommand();
4405
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.LOOKUP_NODE_ID_BY_EUI64);
4406
+ sendBuffalo.writeIeeeAddr(eui64);
4407
+ const sendStatus = await this.sendCommand(sendBuffalo);
4401
4408
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4402
4409
  throw new ezspError_1.EzspError(sendStatus);
4403
4410
  }
@@ -4414,9 +4421,9 @@ class Ezsp extends events_1.default {
4414
4421
  * @returns eui64 The EUI64 of the node.
4415
4422
  */
4416
4423
  async ezspLookupEui64ByNodeId(nodeId) {
4417
- this.startCommand(enums_2.EzspFrameID.LOOKUP_EUI64_BY_NODE_ID);
4418
- this.buffalo.writeUInt16(nodeId);
4419
- const sendStatus = await this.sendCommand();
4424
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.LOOKUP_EUI64_BY_NODE_ID);
4425
+ sendBuffalo.writeUInt16(nodeId);
4426
+ const sendStatus = await this.sendCommand(sendBuffalo);
4420
4427
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4421
4428
  throw new ezspError_1.EzspError(sendStatus);
4422
4429
  }
@@ -4431,9 +4438,9 @@ class Ezsp extends events_1.default {
4431
4438
  * @returns EmberMulticastTableEntry * The contents of the multicast entry.
4432
4439
  */
4433
4440
  async ezspGetMulticastTableEntry(index) {
4434
- this.startCommand(enums_2.EzspFrameID.GET_MULTICAST_TABLE_ENTRY);
4435
- this.buffalo.writeUInt8(index);
4436
- const sendStatus = await this.sendCommand();
4441
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_MULTICAST_TABLE_ENTRY);
4442
+ sendBuffalo.writeUInt8(index);
4443
+ const sendStatus = await this.sendCommand(sendBuffalo);
4437
4444
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4438
4445
  throw new ezspError_1.EzspError(sendStatus);
4439
4446
  }
@@ -4448,10 +4455,10 @@ class Ezsp extends events_1.default {
4448
4455
  * @returns An SLStatus value indicating success or the reason for failure.
4449
4456
  */
4450
4457
  async ezspSetMulticastTableEntry(index, value) {
4451
- this.startCommand(enums_2.EzspFrameID.SET_MULTICAST_TABLE_ENTRY);
4452
- this.buffalo.writeUInt8(index);
4453
- this.buffalo.writeEmberMulticastTableEntry(value);
4454
- const sendStatus = await this.sendCommand();
4458
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_MULTICAST_TABLE_ENTRY);
4459
+ sendBuffalo.writeUInt8(index);
4460
+ sendBuffalo.writeEmberMulticastTableEntry(value);
4461
+ const sendStatus = await this.sendCommand(sendBuffalo);
4455
4462
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4456
4463
  throw new ezspError_1.EzspError(sendStatus);
4457
4464
  }
@@ -4481,9 +4488,9 @@ class Ezsp extends events_1.default {
4481
4488
  * @returns An SLStatus value indicating success or the reason for failure.
4482
4489
  */
4483
4490
  async ezspWriteNodeData(erase) {
4484
- this.startCommand(enums_2.EzspFrameID.WRITE_NODE_DATA);
4485
- this.buffalo.writeUInt8(erase ? 1 : 0);
4486
- const sendStatus = await this.sendCommand();
4491
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.WRITE_NODE_DATA);
4492
+ sendBuffalo.writeUInt8(erase ? 1 : 0);
4493
+ const sendStatus = await this.sendCommand(sendBuffalo);
4487
4494
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4488
4495
  throw new ezspError_1.EzspError(sendStatus);
4489
4496
  }
@@ -4499,11 +4506,11 @@ class Ezsp extends events_1.default {
4499
4506
  * @returns An SLStatus value indicating success or the reason for failure.
4500
4507
  */
4501
4508
  async ezspSendRawMessage(messageContents, priority, useCca) {
4502
- this.startCommand(enums_2.EzspFrameID.SEND_RAW_MESSAGE);
4503
- this.buffalo.writePayload(messageContents);
4504
- this.buffalo.writeUInt8(priority);
4505
- this.buffalo.writeUInt8(useCca ? 1 : 0);
4506
- const sendStatus = await this.sendCommand();
4509
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_RAW_MESSAGE);
4510
+ sendBuffalo.writePayload(messageContents);
4511
+ sendBuffalo.writeUInt8(priority);
4512
+ sendBuffalo.writeUInt8(useCca ? 1 : 0);
4513
+ const sendStatus = await this.sendCommand(sendBuffalo);
4507
4514
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4508
4515
  throw new ezspError_1.EzspError(sendStatus);
4509
4516
  }
@@ -4519,8 +4526,8 @@ class Ezsp extends events_1.default {
4519
4526
  * @param messageContents uint8_t * The raw message that was received.
4520
4527
  */
4521
4528
  ezspMacPassthroughMessageHandler(messageType, packetInfo, messageContents) {
4522
- logger_1.logger.debug(`ezspMacPassthroughMessageHandler(): callback called with: [messageType=${messageType}], `
4523
- + `[packetInfo=${JSON.stringify(packetInfo)}], [messageContents=${messageContents.toString('hex')}]`, NS);
4529
+ logger_1.logger.debug(`ezspMacPassthroughMessageHandler(): callback called with: [messageType=${messageType}], ` +
4530
+ `[packetInfo=${JSON.stringify(packetInfo)}], [messageContents=${messageContents.toString('hex')}]`, NS);
4524
4531
  }
4525
4532
  /**
4526
4533
  * Callback
@@ -4532,21 +4539,21 @@ class Ezsp extends events_1.default {
4532
4539
  * @param messageContents uint8_t * The raw message that was received.
4533
4540
  */
4534
4541
  ezspMacFilterMatchMessageHandler(filterIndexMatch, legacyPassthroughType, packetInfo, messageContents) {
4535
- logger_1.logger.debug(`ezspMacFilterMatchMessageHandler(): callback called with: [filterIndexMatch=${filterIndexMatch}], `
4536
- + `[legacyPassthroughType=${legacyPassthroughType}], [packetInfo=${JSON.stringify(packetInfo)}], `
4537
- + `[messageContents=${messageContents.toString('hex')}]`, NS);
4542
+ logger_1.logger.debug(`ezspMacFilterMatchMessageHandler(): callback called with: [filterIndexMatch=${filterIndexMatch}], ` +
4543
+ `[legacyPassthroughType=${legacyPassthroughType}], [packetInfo=${JSON.stringify(packetInfo)}], ` +
4544
+ `[messageContents=${messageContents.toString('hex')}]`, NS);
4538
4545
  // TODO: needs triple-checking, this is only valid for InterPAN messages
4539
4546
  const msgBuffalo = new buffalo_1.EzspBuffalo(messageContents, 0);
4540
- const macFrameControl = msgBuffalo.readUInt16() & ~(consts_2.MAC_ACK_REQUIRED);
4547
+ const macFrameControl = msgBuffalo.readUInt16() & ~consts_1.MAC_ACK_REQUIRED;
4541
4548
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4542
4549
  const sequence = msgBuffalo.readUInt8();
4543
4550
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4544
4551
  const destPanId = msgBuffalo.readUInt16();
4545
4552
  let destAddress;
4546
- if (macFrameControl === consts_2.LONG_DEST_FRAME_CONTROL) {
4553
+ if (macFrameControl === consts_1.LONG_DEST_FRAME_CONTROL) {
4547
4554
  destAddress = msgBuffalo.readIeeeAddr();
4548
4555
  }
4549
- else if (macFrameControl === consts_2.SHORT_DEST_FRAME_CONTROL) {
4556
+ else if (macFrameControl === consts_1.SHORT_DEST_FRAME_CONTROL) {
4550
4557
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4551
4558
  destAddress = msgBuffalo.readUInt16();
4552
4559
  }
@@ -4558,35 +4565,35 @@ class Ezsp extends events_1.default {
4558
4565
  const sourceAddress = msgBuffalo.readIeeeAddr();
4559
4566
  // Now that we know the correct MAC length, verify the interpan frame is the correct length.
4560
4567
  let remainingLength = msgBuffalo.getBufferLength() - msgBuffalo.getPosition();
4561
- if (remainingLength < (consts_2.STUB_NWK_SIZE + consts_2.MIN_STUB_APS_SIZE)) {
4568
+ if (remainingLength < consts_1.STUB_NWK_SIZE + consts_1.MIN_STUB_APS_SIZE) {
4562
4569
  logger_1.logger.debug(`ezspMacFilterMatchMessageHandler INVALID InterPAN length "${remainingLength}".`, NS);
4563
4570
  return;
4564
4571
  }
4565
4572
  const nwkFrameControl = msgBuffalo.readUInt16();
4566
4573
  remainingLength -= 2; // read 2 more bytes before APS stuff
4567
- if (nwkFrameControl !== consts_2.STUB_NWK_FRAME_CONTROL) {
4574
+ if (nwkFrameControl !== consts_1.STUB_NWK_FRAME_CONTROL) {
4568
4575
  logger_1.logger.debug(`ezspMacFilterMatchMessageHandler INVALID InterPAN nwkFrameControl "${nwkFrameControl}".`, NS);
4569
4576
  return;
4570
4577
  }
4571
4578
  const apsFrameControl = msgBuffalo.readUInt8();
4572
- if ((apsFrameControl & ~(consts_2.INTERPAN_APS_FRAME_DELIVERY_MODE_MASK) & ~(consts_2.INTERPAN_APS_FRAME_SECURITY))
4573
- !== consts_2.INTERPAN_APS_FRAME_CONTROL_NO_DELIVERY_MODE) {
4579
+ if ((apsFrameControl & ~consts_1.INTERPAN_APS_FRAME_DELIVERY_MODE_MASK & ~consts_1.INTERPAN_APS_FRAME_SECURITY) !==
4580
+ consts_1.INTERPAN_APS_FRAME_CONTROL_NO_DELIVERY_MODE) {
4574
4581
  logger_1.logger.debug(`ezspMacFilterMatchMessageHandler INVALID InterPAN apsFrameControl "${apsFrameControl}".`, NS);
4575
4582
  return;
4576
4583
  }
4577
- const messageType = (apsFrameControl & consts_2.INTERPAN_APS_FRAME_DELIVERY_MODE_MASK);
4584
+ const messageType = apsFrameControl & consts_1.INTERPAN_APS_FRAME_DELIVERY_MODE_MASK;
4578
4585
  let groupId = null;
4579
4586
  switch (messageType) {
4580
4587
  case enums_1.EmberInterpanMessageType.UNICAST:
4581
4588
  case enums_1.EmberInterpanMessageType.BROADCAST: {
4582
- if (remainingLength < consts_2.INTERPAN_APS_UNICAST_BROADCAST_SIZE) {
4589
+ if (remainingLength < consts_1.INTERPAN_APS_UNICAST_BROADCAST_SIZE) {
4583
4590
  logger_1.logger.debug(`ezspMacFilterMatchMessageHandler INVALID InterPAN length "${remainingLength}".`, NS);
4584
4591
  return;
4585
4592
  }
4586
4593
  break;
4587
4594
  }
4588
4595
  case enums_1.EmberInterpanMessageType.MULTICAST: {
4589
- if (remainingLength < consts_2.INTERPAN_APS_MULTICAST_SIZE) {
4596
+ if (remainingLength < consts_1.INTERPAN_APS_MULTICAST_SIZE) {
4590
4597
  logger_1.logger.debug(`ezspMacFilterMatchMessageHandler INVALID InterPAN length "${remainingLength}".`, NS);
4591
4598
  return;
4592
4599
  }
@@ -4615,8 +4622,8 @@ class Ezsp extends events_1.default {
4615
4622
  * - SLStatus.ZIGBEE_DELIVERY_FAILED if not
4616
4623
  */
4617
4624
  ezspRawTransmitCompleteHandler(messageContents, status) {
4618
- logger_1.logger.debug(`ezspRawTransmitCompleteHandler(): callback called with: [messageContents=${messageContents.toString('hex')}], `
4619
- + `[status=${enums_1.SLStatus[status]}]`, NS);
4625
+ logger_1.logger.debug(`ezspRawTransmitCompleteHandler(): callback called with: [messageContents=${messageContents.toString('hex')}], ` +
4626
+ `[status=${enums_1.SLStatus[status]}]`, NS);
4620
4627
  }
4621
4628
  /**
4622
4629
  * This function is useful to sleepy end devices.
@@ -4627,9 +4634,9 @@ class Ezsp extends events_1.default {
4627
4634
  * a data poll when a MAC level data poll fails for any reason.
4628
4635
  */
4629
4636
  async ezspSetMacPollFailureWaitTime(waitBeforeRetryIntervalMs) {
4630
- this.startCommand(enums_2.EzspFrameID.SET_MAC_POLL_FAILURE_WAIT_TIME);
4631
- this.buffalo.writeUInt32(waitBeforeRetryIntervalMs);
4632
- const sendStatus = await this.sendCommand();
4637
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_MAC_POLL_FAILURE_WAIT_TIME);
4638
+ sendBuffalo.writeUInt32(waitBeforeRetryIntervalMs);
4639
+ const sendStatus = await this.sendCommand(sendBuffalo);
4633
4640
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4634
4641
  throw new ezspError_1.EzspError(sendStatus);
4635
4642
  }
@@ -4639,11 +4646,11 @@ class Ezsp extends events_1.default {
4639
4646
  * @returns Max MAC retries
4640
4647
  */
4641
4648
  async ezspGetMaxMacRetries() {
4642
- if (this.version < 0x0E) {
4649
+ if (this.version < 0x0e) {
4643
4650
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
4644
4651
  }
4645
- this.startCommand(enums_2.EzspFrameID.GET_MAX_MAC_RETRIES);
4646
- const sendStatus = await this.sendCommand();
4652
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_MAX_MAC_RETRIES);
4653
+ const sendStatus = await this.sendCommand(sendBuffalo);
4647
4654
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4648
4655
  throw new ezspError_1.EzspError(sendStatus);
4649
4656
  }
@@ -4656,9 +4663,9 @@ class Ezsp extends events_1.default {
4656
4663
  * @returns The attempt to set the parameters returns SLStatus.OK
4657
4664
  */
4658
4665
  async ezspSetBeaconClassificationParams(param) {
4659
- this.startCommand(enums_2.EzspFrameID.SET_BEACON_CLASSIFICATION_PARAMS);
4660
- this.buffalo.writeEmberBeaconClassificationParams(param);
4661
- const sendStatus = await this.sendCommand();
4666
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_BEACON_CLASSIFICATION_PARAMS);
4667
+ sendBuffalo.writeEmberBeaconClassificationParams(param);
4668
+ const sendStatus = await this.sendCommand(sendBuffalo);
4662
4669
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4663
4670
  throw new ezspError_1.EzspError(sendStatus);
4664
4671
  }
@@ -4671,8 +4678,8 @@ class Ezsp extends events_1.default {
4671
4678
  * @returns EmberBeaconClassificationParams * Gets the beacon prioritization related variable
4672
4679
  */
4673
4680
  async ezspGetBeaconClassificationParams() {
4674
- this.startCommand(enums_2.EzspFrameID.GET_BEACON_CLASSIFICATION_PARAMS);
4675
- const sendStatus = await this.sendCommand();
4681
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_BEACON_CLASSIFICATION_PARAMS);
4682
+ const sendStatus = await this.sendCommand(sendBuffalo);
4676
4683
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4677
4684
  throw new ezspError_1.EzspError(sendStatus);
4678
4685
  }
@@ -4685,11 +4692,11 @@ class Ezsp extends events_1.default {
4685
4692
  * @returns True if there is a pending message for this network in the APS retry queue, false if not.
4686
4693
  */
4687
4694
  async ezspPendingAckedMessages() {
4688
- if (this.version < 0x0E) {
4695
+ if (this.version < 0x0e) {
4689
4696
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
4690
4697
  }
4691
- this.startCommand(enums_2.EzspFrameID.PENDING_ACKED_MESSAGES);
4692
- const sendStatus = await this.sendCommand();
4698
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.PENDING_ACKED_MESSAGES);
4699
+ const sendStatus = await this.sendCommand(sendBuffalo);
4693
4700
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4694
4701
  throw new ezspError_1.EzspError(sendStatus);
4695
4702
  }
@@ -4701,11 +4708,11 @@ class Ezsp extends events_1.default {
4701
4708
  * @returns
4702
4709
  */
4703
4710
  async ezspRescheduleLinkStatusMsg() {
4704
- if (this.version < 0x0E) {
4711
+ if (this.version < 0x0e) {
4705
4712
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
4706
4713
  }
4707
- this.startCommand(enums_2.EzspFrameID.RESCHEDULE_LINK_STATUS_MSG);
4708
- const sendStatus = await this.sendCommand();
4714
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.RESCHEDULE_LINK_STATUS_MSG);
4715
+ const sendStatus = await this.sendCommand(sendBuffalo);
4709
4716
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4710
4717
  throw new ezspError_1.EzspError(sendStatus);
4711
4718
  }
@@ -4719,13 +4726,13 @@ class Ezsp extends events_1.default {
4719
4726
  * @returns Status of set operation for the network update ID.
4720
4727
  */
4721
4728
  async ezspSetNwkUpdateId(nwkUpdateId, setWhenOnNetwork) {
4722
- if (this.version < 0x0E) {
4729
+ if (this.version < 0x0e) {
4723
4730
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
4724
4731
  }
4725
- this.startCommand(enums_2.EzspFrameID.SET_NWK_UPDATE_ID);
4726
- this.buffalo.writeUInt8(nwkUpdateId);
4727
- this.buffalo.writeUInt8(setWhenOnNetwork ? 1 : 0);
4728
- const sendStatus = await this.sendCommand();
4732
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_NWK_UPDATE_ID);
4733
+ sendBuffalo.writeUInt8(nwkUpdateId);
4734
+ sendBuffalo.writeUInt8(setWhenOnNetwork ? 1 : 0);
4735
+ const sendStatus = await this.sendCommand(sendBuffalo);
4729
4736
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4730
4737
  throw new ezspError_1.EzspError(sendStatus);
4731
4738
  }
@@ -4744,9 +4751,9 @@ class Ezsp extends events_1.default {
4744
4751
  * @returns The success or failure code of the operation.
4745
4752
  */
4746
4753
  async ezspSetInitialSecurityState(state) {
4747
- this.startCommand(enums_2.EzspFrameID.SET_INITIAL_SECURITY_STATE);
4748
- this.buffalo.writeEmberInitialSecurityState(state);
4749
- const sendStatus = await this.sendCommand();
4754
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_INITIAL_SECURITY_STATE);
4755
+ sendBuffalo.writeEmberInitialSecurityState(state);
4756
+ const sendStatus = await this.sendCommand(sendBuffalo);
4750
4757
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4751
4758
  throw new ezspError_1.EzspError(sendStatus);
4752
4759
  }
@@ -4760,8 +4767,8 @@ class Ezsp extends events_1.default {
4760
4767
  * @returns EmberCurrentSecurityState * The security configuration in use by the stack.
4761
4768
  */
4762
4769
  async ezspGetCurrentSecurityState() {
4763
- this.startCommand(enums_2.EzspFrameID.GET_CURRENT_SECURITY_STATE);
4764
- const sendStatus = await this.sendCommand();
4770
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_CURRENT_SECURITY_STATE);
4771
+ const sendStatus = await this.sendCommand(sendBuffalo);
4765
4772
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4766
4773
  throw new ezspError_1.EzspError(sendStatus);
4767
4774
  }
@@ -4820,13 +4827,13 @@ class Ezsp extends events_1.default {
4820
4827
  logger_1.logger.error(`ezspExportKey cannot use INTERNAL key type.`, NS);
4821
4828
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_CALL);
4822
4829
  }
4823
- this.startCommand(enums_2.EzspFrameID.EXPORT_KEY);
4824
- this.buffalo.writeSecManContext(context);
4825
- const sendStatus = await this.sendCommand();
4830
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.EXPORT_KEY);
4831
+ sendBuffalo.writeSecManContext(context);
4832
+ const sendStatus = await this.sendCommand(sendBuffalo);
4826
4833
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4827
4834
  throw new ezspError_1.EzspError(sendStatus);
4828
4835
  }
4829
- if (this.version < 0x0E) {
4836
+ if (this.version < 0x0e) {
4830
4837
  const key = this.buffalo.readSecManKey();
4831
4838
  const status = this.buffalo.readUInt32();
4832
4839
  return [status, key];
@@ -4887,10 +4894,10 @@ class Ezsp extends events_1.default {
4887
4894
  logger_1.logger.error(`ezspImportKey cannot use INTERNAL key type.`, NS);
4888
4895
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_CALL);
4889
4896
  }
4890
- this.startCommand(enums_2.EzspFrameID.IMPORT_KEY);
4891
- this.buffalo.writeSecManContext(context);
4892
- this.buffalo.writeSecManKey(key);
4893
- const sendStatus = await this.sendCommand();
4897
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.IMPORT_KEY);
4898
+ sendBuffalo.writeSecManContext(context);
4899
+ sendBuffalo.writeSecManKey(key);
4900
+ const sendStatus = await this.sendCommand(sendBuffalo);
4894
4901
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4895
4902
  throw new ezspError_1.EzspError(sendStatus);
4896
4903
  }
@@ -4918,10 +4925,10 @@ class Ezsp extends events_1.default {
4918
4925
  * A value of 0xFF is returned if not matching entry is found.
4919
4926
  */
4920
4927
  async ezspFindKeyTableEntry(address, linkKey) {
4921
- this.startCommand(enums_2.EzspFrameID.FIND_KEY_TABLE_ENTRY);
4922
- this.buffalo.writeIeeeAddr(address);
4923
- this.buffalo.writeUInt8(linkKey ? 1 : 0);
4924
- const sendStatus = await this.sendCommand();
4928
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.FIND_KEY_TABLE_ENTRY);
4929
+ sendBuffalo.writeIeeeAddr(address);
4930
+ sendBuffalo.writeUInt8(linkKey ? 1 : 0);
4931
+ const sendStatus = await this.sendCommand(sendBuffalo);
4925
4932
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4926
4933
  throw new ezspError_1.EzspError(sendStatus);
4927
4934
  }
@@ -4937,10 +4944,10 @@ class Ezsp extends events_1.default {
4937
4944
  * @returns An SLStatus value indicating success of failure of the operation
4938
4945
  */
4939
4946
  async ezspSendTrustCenterLinkKey(destinationNodeId, destinationEui64) {
4940
- this.startCommand(enums_2.EzspFrameID.SEND_TRUST_CENTER_LINK_KEY);
4941
- this.buffalo.writeUInt16(destinationNodeId);
4942
- this.buffalo.writeIeeeAddr(destinationEui64);
4943
- const sendStatus = await this.sendCommand();
4947
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_TRUST_CENTER_LINK_KEY);
4948
+ sendBuffalo.writeUInt16(destinationNodeId);
4949
+ sendBuffalo.writeIeeeAddr(destinationEui64);
4950
+ const sendStatus = await this.sendCommand(sendBuffalo);
4944
4951
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4945
4952
  throw new ezspError_1.EzspError(sendStatus);
4946
4953
  }
@@ -4954,9 +4961,9 @@ class Ezsp extends events_1.default {
4954
4961
  * @returns The success or failure of the operation.
4955
4962
  */
4956
4963
  async ezspEraseKeyTableEntry(index) {
4957
- this.startCommand(enums_2.EzspFrameID.ERASE_KEY_TABLE_ENTRY);
4958
- this.buffalo.writeUInt8(index);
4959
- const sendStatus = await this.sendCommand();
4964
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ERASE_KEY_TABLE_ENTRY);
4965
+ sendBuffalo.writeUInt8(index);
4966
+ const sendStatus = await this.sendCommand(sendBuffalo);
4960
4967
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4961
4968
  throw new ezspError_1.EzspError(sendStatus);
4962
4969
  }
@@ -4968,8 +4975,8 @@ class Ezsp extends events_1.default {
4968
4975
  * @returns The success or failure of the operation.
4969
4976
  */
4970
4977
  async ezspClearKeyTable() {
4971
- this.startCommand(enums_2.EzspFrameID.CLEAR_KEY_TABLE);
4972
- const sendStatus = await this.sendCommand();
4978
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CLEAR_KEY_TABLE);
4979
+ const sendStatus = await this.sendCommand(sendBuffalo);
4973
4980
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
4974
4981
  throw new ezspError_1.EzspError(sendStatus);
4975
4982
  }
@@ -4996,9 +5003,9 @@ class Ezsp extends events_1.default {
4996
5003
  * This is not the final result of the attempt. ezspZigbeeKeyEstablishmentHandler(...) will return that.
4997
5004
  */
4998
5005
  async ezspRequestLinkKey(partner) {
4999
- this.startCommand(enums_2.EzspFrameID.REQUEST_LINK_KEY);
5000
- this.buffalo.writeIeeeAddr(partner);
5001
- const sendStatus = await this.sendCommand();
5006
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.REQUEST_LINK_KEY);
5007
+ sendBuffalo.writeIeeeAddr(partner);
5008
+ const sendStatus = await this.sendCommand(sendBuffalo);
5002
5009
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5003
5010
  throw new ezspError_1.EzspError(sendStatus);
5004
5011
  }
@@ -5018,9 +5025,9 @@ class Ezsp extends events_1.default {
5018
5025
  * will be called at a later time with a final status result.
5019
5026
  */
5020
5027
  async ezspUpdateTcLinkKey(maxAttempts) {
5021
- this.startCommand(enums_2.EzspFrameID.UPDATE_TC_LINK_KEY);
5022
- this.buffalo.writeUInt8(maxAttempts);
5023
- const sendStatus = await this.sendCommand();
5028
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.UPDATE_TC_LINK_KEY);
5029
+ sendBuffalo.writeUInt8(maxAttempts);
5030
+ const sendStatus = await this.sendCommand(sendBuffalo);
5024
5031
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5025
5032
  throw new ezspError_1.EzspError(sendStatus);
5026
5033
  }
@@ -5044,8 +5051,8 @@ class Ezsp extends events_1.default {
5044
5051
  * Clear all of the transient link keys from RAM.
5045
5052
  */
5046
5053
  async ezspClearTransientLinkKeys() {
5047
- this.startCommand(enums_2.EzspFrameID.CLEAR_TRANSIENT_LINK_KEYS);
5048
- const sendStatus = await this.sendCommand();
5054
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CLEAR_TRANSIENT_LINK_KEYS);
5055
+ const sendStatus = await this.sendCommand(sendBuffalo);
5049
5056
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5050
5057
  throw new ezspError_1.EzspError(sendStatus);
5051
5058
  }
@@ -5067,8 +5074,8 @@ class Ezsp extends events_1.default {
5067
5074
  * @return SLStatus SLStatus.OK
5068
5075
  *
5069
5076
  */
5070
- this.startCommand(enums_2.EzspFrameID.GET_NETWORK_KEY_INFO);
5071
- const sendStatus = await this.sendCommand();
5077
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_NETWORK_KEY_INFO);
5078
+ const sendStatus = await this.sendCommand(sendBuffalo);
5072
5079
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5073
5080
  throw new ezspError_1.EzspError(sendStatus);
5074
5081
  }
@@ -5118,13 +5125,13 @@ class Ezsp extends events_1.default {
5118
5125
  * EMBER_GET_PRECONFIGURED_KEY_FROM_INSTALL_CODE have not been set in the
5119
5126
  * initial security state).
5120
5127
  */
5121
- this.startCommand(enums_2.EzspFrameID.GET_APS_KEY_INFO);
5122
- this.buffalo.writeSecManContext(context);
5123
- const sendStatus = await this.sendCommand();
5128
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_APS_KEY_INFO);
5129
+ sendBuffalo.writeSecManContext(context);
5130
+ const sendStatus = await this.sendCommand(sendBuffalo);
5124
5131
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5125
5132
  throw new ezspError_1.EzspError(sendStatus);
5126
5133
  }
5127
- if (this.version < 0x0E) {
5134
+ if (this.version < 0x0e) {
5128
5135
  context.eui64 = this.buffalo.readIeeeAddr();
5129
5136
  const keyData = this.buffalo.readSecManAPSKeyMetadata();
5130
5137
  const status = this.buffalo.readUInt32();
@@ -5159,11 +5166,11 @@ class Ezsp extends events_1.default {
5159
5166
  * @return SLStatus.OK upon success, a valid error code otherwise.
5160
5167
  *
5161
5168
  */
5162
- this.startCommand(enums_2.EzspFrameID.IMPORT_LINK_KEY);
5163
- this.buffalo.writeUInt8(index);
5164
- this.buffalo.writeIeeeAddr(address);
5165
- this.buffalo.writeSecManKey(plaintextKey);
5166
- const sendStatus = await this.sendCommand();
5169
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.IMPORT_LINK_KEY);
5170
+ sendBuffalo.writeUInt8(index);
5171
+ sendBuffalo.writeIeeeAddr(address);
5172
+ sendBuffalo.writeSecManKey(plaintextKey);
5173
+ const sendStatus = await this.sendCommand(sendBuffalo);
5167
5174
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5168
5175
  throw new ezspError_1.EzspError(sendStatus);
5169
5176
  }
@@ -5187,13 +5194,13 @@ class Ezsp extends events_1.default {
5187
5194
  * @param plaintext_key sl_zb_sec_man_key_t*
5188
5195
  * @param key_data sl_zb_sec_man_aps_key_metadata_t*
5189
5196
  */
5190
- this.startCommand(enums_2.EzspFrameID.EXPORT_LINK_KEY_BY_INDEX);
5191
- this.buffalo.writeUInt8(index);
5192
- const sendStatus = await this.sendCommand();
5197
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.EXPORT_LINK_KEY_BY_INDEX);
5198
+ sendBuffalo.writeUInt8(index);
5199
+ const sendStatus = await this.sendCommand(sendBuffalo);
5193
5200
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5194
5201
  throw new ezspError_1.EzspError(sendStatus);
5195
5202
  }
5196
- if (this.version < 0x0E) {
5203
+ if (this.version < 0x0e) {
5197
5204
  const context = (0, initters_1.initSecurityManagerContext)();
5198
5205
  context.coreKeyType = enums_1.SecManKeyType.APP_LINK;
5199
5206
  context.keyIndex = index;
@@ -5230,13 +5237,13 @@ class Ezsp extends events_1.default {
5230
5237
  * @param plaintext_key sl_zb_sec_man_key_t*
5231
5238
  * @param key_data sl_zb_sec_man_aps_key_metadata_t*
5232
5239
  */
5233
- this.startCommand(enums_2.EzspFrameID.EXPORT_LINK_KEY_BY_EUI);
5234
- this.buffalo.writeIeeeAddr(eui);
5235
- const sendStatus = await this.sendCommand();
5240
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.EXPORT_LINK_KEY_BY_EUI);
5241
+ sendBuffalo.writeIeeeAddr(eui);
5242
+ const sendStatus = await this.sendCommand(sendBuffalo);
5236
5243
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5237
5244
  throw new ezspError_1.EzspError(sendStatus);
5238
5245
  }
5239
- if (this.version < 0x0E) {
5246
+ if (this.version < 0x0e) {
5240
5247
  const plaintextKey = this.buffalo.readSecManKey();
5241
5248
  const context = (0, initters_1.initSecurityManagerContext)();
5242
5249
  context.coreKeyType = enums_1.SecManKeyType.APP_LINK;
@@ -5269,9 +5276,9 @@ class Ezsp extends events_1.default {
5269
5276
  *
5270
5277
  * @return SLStatus SLStatus.OK upon success, SLStatus.NOT_FOUND otherwise.
5271
5278
  */
5272
- this.startCommand(enums_2.EzspFrameID.CHECK_KEY_CONTEXT);
5273
- this.buffalo.writeSecManContext(context);
5274
- const sendStatus = await this.sendCommand();
5279
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CHECK_KEY_CONTEXT);
5280
+ sendBuffalo.writeSecManContext(context);
5281
+ const sendStatus = await this.sendCommand(sendBuffalo);
5275
5282
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5276
5283
  throw new ezspError_1.EzspError(sendStatus);
5277
5284
  }
@@ -5295,13 +5302,13 @@ class Ezsp extends events_1.default {
5295
5302
  * ::EMBER_AF_PLUGIN_NETWORK_CREATOR_SECURITY_NETWORK_OPEN_TIME_S seconds and
5296
5303
  * ::EMBER_TRANSIENT_KEY_TIMEOUT_S seconds.
5297
5304
  */
5298
- this.startCommand(enums_2.EzspFrameID.IMPORT_TRANSIENT_KEY);
5299
- this.buffalo.writeIeeeAddr(eui64);
5300
- this.buffalo.writeSecManKey(plaintextKey);
5301
- if (this.version < 0x0E) {
5302
- this.buffalo.writeUInt8(flags);
5305
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.IMPORT_TRANSIENT_KEY);
5306
+ sendBuffalo.writeIeeeAddr(eui64);
5307
+ sendBuffalo.writeSecManKey(plaintextKey);
5308
+ if (this.version < 0x0e) {
5309
+ sendBuffalo.writeUInt8(flags);
5303
5310
  }
5304
- const sendStatus = await this.sendCommand();
5311
+ const sendStatus = await this.sendCommand(sendBuffalo);
5305
5312
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5306
5313
  throw new ezspError_1.EzspError(sendStatus);
5307
5314
  }
@@ -5317,13 +5324,13 @@ class Ezsp extends events_1.default {
5317
5324
  * @returns sl_zb_sec_man_aps_key_metadata_t * Metadata about the key.
5318
5325
  */
5319
5326
  async ezspExportTransientKeyByIndex(index) {
5320
- this.startCommand(enums_2.EzspFrameID.EXPORT_TRANSIENT_KEY_BY_INDEX);
5321
- this.buffalo.writeUInt8(index);
5322
- const sendStatus = await this.sendCommand();
5327
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.EXPORT_TRANSIENT_KEY_BY_INDEX);
5328
+ sendBuffalo.writeUInt8(index);
5329
+ const sendStatus = await this.sendCommand(sendBuffalo);
5323
5330
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5324
5331
  throw new ezspError_1.EzspError(sendStatus);
5325
5332
  }
5326
- if (this.version < 0x0E) {
5333
+ if (this.version < 0x0e) {
5327
5334
  const context = this.buffalo.readSecManContext();
5328
5335
  const plaintextKey = this.buffalo.readSecManKey();
5329
5336
  const keyData = this.buffalo.readSecManAPSKeyMetadata();
@@ -5347,13 +5354,13 @@ class Ezsp extends events_1.default {
5347
5354
  * @returns sl_zb_sec_man_aps_key_metadata_t * Metadata about the key.
5348
5355
  */
5349
5356
  async ezspExportTransientKeyByEui(eui) {
5350
- this.startCommand(enums_2.EzspFrameID.EXPORT_TRANSIENT_KEY_BY_EUI);
5351
- this.buffalo.writeIeeeAddr(eui);
5352
- const sendStatus = await this.sendCommand();
5357
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.EXPORT_TRANSIENT_KEY_BY_EUI);
5358
+ sendBuffalo.writeIeeeAddr(eui);
5359
+ const sendStatus = await this.sendCommand(sendBuffalo);
5353
5360
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5354
5361
  throw new ezspError_1.EzspError(sendStatus);
5355
5362
  }
5356
- if (this.version < 0x0E) {
5363
+ if (this.version < 0x0e) {
5357
5364
  const context = this.buffalo.readSecManContext();
5358
5365
  const plaintextKey = this.buffalo.readSecManKey();
5359
5366
  const keyData = this.buffalo.readSecManAPSKeyMetadata();
@@ -5373,12 +5380,12 @@ class Ezsp extends events_1.default {
5373
5380
  * @param frameCounter Value to set the frame counter to.
5374
5381
  */
5375
5382
  async ezspSetIncomingTcLinkKeyFrameCounter(frameCounter) {
5376
- if (this.version < 0x0E) {
5383
+ if (this.version < 0x0e) {
5377
5384
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
5378
5385
  }
5379
- this.startCommand(enums_2.EzspFrameID.SET_INCOMING_TC_LINK_KEY_FRAME_COUNTER);
5380
- this.buffalo.writeUInt32(frameCounter);
5381
- const sendStatus = await this.sendCommand();
5386
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_INCOMING_TC_LINK_KEY_FRAME_COUNTER);
5387
+ sendBuffalo.writeUInt32(frameCounter);
5388
+ const sendStatus = await this.sendCommand(sendBuffalo);
5382
5389
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5383
5390
  throw new ezspError_1.EzspError(sendStatus);
5384
5391
  }
@@ -5393,16 +5400,16 @@ class Ezsp extends events_1.default {
5393
5400
  * @returns Status of the encryption/decryption call.
5394
5401
  */
5395
5402
  async ezspApsCryptMessage(encrypt, lengthCombinedArg, message, apsHeaderEndIndex, remoteEui64) {
5396
- if (this.version < 0x0E) {
5403
+ if (this.version < 0x0e) {
5397
5404
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
5398
5405
  }
5399
- this.startCommand(enums_2.EzspFrameID.APS_CRYPT_MESSAGE);
5400
- this.buffalo.writeUInt8(encrypt ? 1 : 0);
5401
- this.buffalo.writeUInt8(lengthCombinedArg);
5402
- this.buffalo.writeBuffer(message, lengthCombinedArg);
5403
- this.buffalo.writeUInt8(apsHeaderEndIndex);
5404
- this.buffalo.writeIeeeAddr(remoteEui64);
5405
- const sendStatus = await this.sendCommand();
5406
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.APS_CRYPT_MESSAGE);
5407
+ sendBuffalo.writeUInt8(encrypt ? 1 : 0);
5408
+ sendBuffalo.writeUInt8(lengthCombinedArg);
5409
+ sendBuffalo.writeBuffer(message, lengthCombinedArg);
5410
+ sendBuffalo.writeUInt8(apsHeaderEndIndex);
5411
+ sendBuffalo.writeIeeeAddr(remoteEui64);
5412
+ const sendStatus = await this.sendCommand(sendBuffalo);
5406
5413
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5407
5414
  throw new ezspError_1.EzspError(sendStatus);
5408
5415
  }
@@ -5426,9 +5433,9 @@ class Ezsp extends events_1.default {
5426
5433
  * @param parentOfNewNodeId The parent of the node whose status has changed.
5427
5434
  */
5428
5435
  ezspTrustCenterJoinHandler(newNodeId, newNodeEui64, status, policyDecision, parentOfNewNodeId) {
5429
- logger_1.logger.debug(`ezspTrustCenterJoinHandler(): callback called with: [newNodeId=${newNodeId}], [newNodeEui64=${newNodeEui64}], `
5430
- + `[status=${enums_1.EmberDeviceUpdate[status]}], [policyDecision=${enums_1.EmberJoinDecision[policyDecision]}], `
5431
- + `[parentOfNewNodeId=${parentOfNewNodeId}]`, NS);
5436
+ logger_1.logger.debug(`ezspTrustCenterJoinHandler(): callback called with: [newNodeId=${newNodeId}], [newNodeEui64=${newNodeEui64}], ` +
5437
+ `[status=${enums_1.EmberDeviceUpdate[status]}], [policyDecision=${enums_1.EmberJoinDecision[policyDecision]}], ` +
5438
+ `[parentOfNewNodeId=${parentOfNewNodeId}]`, NS);
5432
5439
  // NOTE: this is mostly just passing stuff up to Z2M, so use only one emit for all, let adapter do the rest, no parsing needed
5433
5440
  this.emit(EzspEvents.TRUST_CENTER_JOIN, newNodeId, newNodeEui64, status, policyDecision, parentOfNewNodeId);
5434
5441
  }
@@ -5443,9 +5450,9 @@ class Ezsp extends events_1.default {
5443
5450
  * @returns SLStatus value that indicates the success or failure of the command.
5444
5451
  */
5445
5452
  async ezspBroadcastNextNetworkKey(key) {
5446
- this.startCommand(enums_2.EzspFrameID.BROADCAST_NEXT_NETWORK_KEY);
5447
- this.buffalo.writeEmberKeyData(key);
5448
- const sendStatus = await this.sendCommand();
5453
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.BROADCAST_NEXT_NETWORK_KEY);
5454
+ sendBuffalo.writeEmberKeyData(key);
5455
+ const sendStatus = await this.sendCommand(sendBuffalo);
5449
5456
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5450
5457
  throw new ezspError_1.EzspError(sendStatus);
5451
5458
  }
@@ -5458,8 +5465,8 @@ class Ezsp extends events_1.default {
5458
5465
  * @returns SLStatus value that indicates the success or failure of the command.
5459
5466
  */
5460
5467
  async ezspBroadcastNetworkKeySwitch() {
5461
- this.startCommand(enums_2.EzspFrameID.BROADCAST_NETWORK_KEY_SWITCH);
5462
- const sendStatus = await this.sendCommand();
5468
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.BROADCAST_NETWORK_KEY_SWITCH);
5469
+ const sendStatus = await this.sendCommand(sendBuffalo);
5463
5470
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5464
5471
  throw new ezspError_1.EzspError(sendStatus);
5465
5472
  }
@@ -5479,11 +5486,11 @@ class Ezsp extends events_1.default {
5479
5486
  * @returns EmberAesMmoHashContext * The updated hash context.
5480
5487
  */
5481
5488
  async ezspAesMmoHash(context, finalize, data) {
5482
- this.startCommand(enums_2.EzspFrameID.AES_MMO_HASH);
5483
- this.buffalo.writeEmberAesMmoHashContext(context);
5484
- this.buffalo.writeUInt8(finalize ? 1 : 0);
5485
- this.buffalo.writePayload(data);
5486
- const sendStatus = await this.sendCommand();
5489
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.AES_MMO_HASH);
5490
+ sendBuffalo.writeEmberAesMmoHashContext(context);
5491
+ sendBuffalo.writeUInt8(finalize ? 1 : 0);
5492
+ sendBuffalo.writePayload(data);
5493
+ const sendStatus = await this.sendCommand(sendBuffalo);
5487
5494
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5488
5495
  throw new ezspError_1.EzspError(sendStatus);
5489
5496
  }
@@ -5501,11 +5508,11 @@ class Ezsp extends events_1.default {
5501
5508
  * @returns An SLStatus value indicating success, or the reason for failure
5502
5509
  */
5503
5510
  async ezspRemoveDevice(destShort, destLong, targetLong) {
5504
- this.startCommand(enums_2.EzspFrameID.REMOVE_DEVICE);
5505
- this.buffalo.writeUInt16(destShort);
5506
- this.buffalo.writeIeeeAddr(destLong);
5507
- this.buffalo.writeIeeeAddr(targetLong);
5508
- const sendStatus = await this.sendCommand();
5511
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.REMOVE_DEVICE);
5512
+ sendBuffalo.writeUInt16(destShort);
5513
+ sendBuffalo.writeIeeeAddr(destLong);
5514
+ sendBuffalo.writeIeeeAddr(targetLong);
5515
+ const sendStatus = await this.sendCommand(sendBuffalo);
5509
5516
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5510
5517
  throw new ezspError_1.EzspError(sendStatus);
5511
5518
  }
@@ -5522,11 +5529,11 @@ class Ezsp extends events_1.default {
5522
5529
  * @returns An SLStatus value indicating success, or the reason for failure
5523
5530
  */
5524
5531
  async ezspUnicastNwkKeyUpdate(destShort, destLong, key) {
5525
- this.startCommand(enums_2.EzspFrameID.UNICAST_NWK_KEY_UPDATE);
5526
- this.buffalo.writeUInt16(destShort);
5527
- this.buffalo.writeIeeeAddr(destLong);
5528
- this.buffalo.writeEmberKeyData(key);
5529
- const sendStatus = await this.sendCommand();
5532
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.UNICAST_NWK_KEY_UPDATE);
5533
+ sendBuffalo.writeUInt16(destShort);
5534
+ sendBuffalo.writeIeeeAddr(destLong);
5535
+ sendBuffalo.writeEmberKeyData(key);
5536
+ const sendStatus = await this.sendCommand(sendBuffalo);
5530
5537
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5531
5538
  throw new ezspError_1.EzspError(sendStatus);
5532
5539
  }
@@ -5542,8 +5549,8 @@ class Ezsp extends events_1.default {
5542
5549
  * ezspGenerateCbkeKeysHandler().
5543
5550
  */
5544
5551
  async ezspGenerateCbkeKeys() {
5545
- this.startCommand(enums_2.EzspFrameID.GENERATE_CBKE_KEYS);
5546
- const sendStatus = await this.sendCommand();
5552
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GENERATE_CBKE_KEYS);
5553
+ const sendStatus = await this.sendCommand(sendBuffalo);
5547
5554
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5548
5555
  throw new ezspError_1.EzspError(sendStatus);
5549
5556
  }
@@ -5573,11 +5580,11 @@ class Ezsp extends events_1.default {
5573
5580
  * @param partnerEphemeralPublicKey EmberPublicKeyData * The key establishment partner's ephemeral public key
5574
5581
  */
5575
5582
  async ezspCalculateSmacs(amInitiator, partnerCertificate, partnerEphemeralPublicKey) {
5576
- this.startCommand(enums_2.EzspFrameID.CALCULATE_SMACS);
5577
- this.buffalo.writeUInt8(amInitiator ? 1 : 0);
5578
- this.buffalo.writeEmberCertificateData(partnerCertificate);
5579
- this.buffalo.writeEmberPublicKeyData(partnerEphemeralPublicKey);
5580
- const sendStatus = await this.sendCommand();
5583
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CALCULATE_SMACS);
5584
+ sendBuffalo.writeUInt8(amInitiator ? 1 : 0);
5585
+ sendBuffalo.writeEmberCertificateData(partnerCertificate);
5586
+ sendBuffalo.writeEmberPublicKeyData(partnerEphemeralPublicKey);
5587
+ const sendStatus = await this.sendCommand(sendBuffalo);
5581
5588
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5582
5589
  throw new ezspError_1.EzspError(sendStatus);
5583
5590
  }
@@ -5595,8 +5602,8 @@ class Ezsp extends events_1.default {
5595
5602
  * @param responderSmac EmberSmacData * The calculated value of the responder's SMAC
5596
5603
  */
5597
5604
  ezspCalculateSmacsHandler(status, initiatorSmac, responderSmac) {
5598
- logger_1.logger.debug(`ezspCalculateSmacsHandler(): callback called with: [status=${enums_1.SLStatus[status]}], [initiatorSmac=${initiatorSmac}], `
5599
- + `[responderSmac=${responderSmac}]`, NS);
5605
+ logger_1.logger.debug(`ezspCalculateSmacsHandler(): callback called with: [status=${enums_1.SLStatus[status]}], [initiatorSmac=${initiatorSmac}], ` +
5606
+ `[responderSmac=${responderSmac}]`, NS);
5600
5607
  }
5601
5608
  /**
5602
5609
  * This call starts the generation of the ECC 283k1 curve Ephemeral
@@ -5604,8 +5611,8 @@ class Ezsp extends events_1.default {
5604
5611
  * are returned via ezspGenerateCbkeKeysHandler283k1().
5605
5612
  */
5606
5613
  async ezspGenerateCbkeKeys283k1() {
5607
- this.startCommand(enums_2.EzspFrameID.GENERATE_CBKE_KEYS283K1);
5608
- const sendStatus = await this.sendCommand();
5614
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GENERATE_CBKE_KEYS283K1);
5615
+ const sendStatus = await this.sendCommand(sendBuffalo);
5609
5616
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5610
5617
  throw new ezspError_1.EzspError(sendStatus);
5611
5618
  }
@@ -5622,8 +5629,7 @@ class Ezsp extends events_1.default {
5622
5629
  * @param ephemeralPublicKey EmberPublicKey283k1Data * The generated ephemeral public key.
5623
5630
  */
5624
5631
  ezspGenerateCbkeKeysHandler283k1(status, ephemeralPublicKey) {
5625
- logger_1.logger.debug(`ezspGenerateCbkeKeysHandler283k1(): callback called with: [status=${enums_1.SLStatus[status]}], `
5626
- + `[ephemeralPublicKey=${ephemeralPublicKey}]`, NS);
5632
+ logger_1.logger.debug(`ezspGenerateCbkeKeysHandler283k1(): callback called with: [status=${enums_1.SLStatus[status]}], ` + `[ephemeralPublicKey=${ephemeralPublicKey}]`, NS);
5627
5633
  }
5628
5634
  /**
5629
5635
  * Calculates the SMAC verification keys for both the initiator and responder
@@ -5636,11 +5642,11 @@ class Ezsp extends events_1.default {
5636
5642
  * @param partnerEphemeralPublicKey EmberPublicKey283k1Data * The key establishment partner's ephemeral public key
5637
5643
  */
5638
5644
  async ezspCalculateSmacs283k1(amInitiator, partnerCertificate, partnerEphemeralPublicKey) {
5639
- this.startCommand(enums_2.EzspFrameID.CALCULATE_SMACS283K1);
5640
- this.buffalo.writeUInt8(amInitiator ? 1 : 0);
5641
- this.buffalo.writeEmberCertificate283k1Data(partnerCertificate);
5642
- this.buffalo.writeEmberPublicKey283k1Data(partnerEphemeralPublicKey);
5643
- const sendStatus = await this.sendCommand();
5645
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CALCULATE_SMACS283K1);
5646
+ sendBuffalo.writeUInt8(amInitiator ? 1 : 0);
5647
+ sendBuffalo.writeEmberCertificate283k1Data(partnerCertificate);
5648
+ sendBuffalo.writeEmberPublicKey283k1Data(partnerEphemeralPublicKey);
5649
+ const sendStatus = await this.sendCommand(sendBuffalo);
5644
5650
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5645
5651
  throw new ezspError_1.EzspError(sendStatus);
5646
5652
  }
@@ -5659,8 +5665,8 @@ class Ezsp extends events_1.default {
5659
5665
  * @param responderSmac EmberSmacData * The calculated value of the responder's SMAC
5660
5666
  */
5661
5667
  ezspCalculateSmacsHandler283k1(status, initiatorSmac, responderSmac) {
5662
- logger_1.logger.debug(`ezspCalculateSmacsHandler283k1(): callback called with: [status=${enums_1.SLStatus[status]}], [initiatorSmac=${initiatorSmac}], `
5663
- + `[responderSmac=${responderSmac}]`, NS);
5668
+ logger_1.logger.debug(`ezspCalculateSmacsHandler283k1(): callback called with: [status=${enums_1.SLStatus[status]}], [initiatorSmac=${initiatorSmac}], ` +
5669
+ `[responderSmac=${responderSmac}]`, NS);
5664
5670
  }
5665
5671
  /**
5666
5672
  * Clears the temporary data associated with CBKE and the key establishment,
@@ -5671,9 +5677,9 @@ class Ezsp extends events_1.default {
5671
5677
  * key derived when ezspCalculateSmacs() was previously called.
5672
5678
  */
5673
5679
  async ezspClearTemporaryDataMaybeStoreLinkKey(storeLinkKey) {
5674
- this.startCommand(enums_2.EzspFrameID.CLEAR_TEMPORARY_DATA_MAYBE_STORE_LINK_KEY);
5675
- this.buffalo.writeUInt8(storeLinkKey ? 1 : 0);
5676
- const sendStatus = await this.sendCommand();
5680
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CLEAR_TEMPORARY_DATA_MAYBE_STORE_LINK_KEY);
5681
+ sendBuffalo.writeUInt8(storeLinkKey ? 1 : 0);
5682
+ const sendStatus = await this.sendCommand(sendBuffalo);
5677
5683
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5678
5684
  throw new ezspError_1.EzspError(sendStatus);
5679
5685
  }
@@ -5689,9 +5695,9 @@ class Ezsp extends events_1.default {
5689
5695
  * key derived when ezspCalculateSmacs() was previously called.
5690
5696
  */
5691
5697
  async ezspClearTemporaryDataMaybeStoreLinkKey283k1(storeLinkKey) {
5692
- this.startCommand(enums_2.EzspFrameID.CLEAR_TEMPORARY_DATA_MAYBE_STORE_LINK_KEY283K1);
5693
- this.buffalo.writeUInt8(storeLinkKey ? 1 : 0);
5694
- const sendStatus = await this.sendCommand();
5698
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.CLEAR_TEMPORARY_DATA_MAYBE_STORE_LINK_KEY283K1);
5699
+ sendBuffalo.writeUInt8(storeLinkKey ? 1 : 0);
5700
+ const sendStatus = await this.sendCommand(sendBuffalo);
5695
5701
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5696
5702
  throw new ezspError_1.EzspError(sendStatus);
5697
5703
  }
@@ -5703,8 +5709,8 @@ class Ezsp extends events_1.default {
5703
5709
  * @returns EmberCertificateData * The locally installed certificate.
5704
5710
  */
5705
5711
  async ezspGetCertificate() {
5706
- this.startCommand(enums_2.EzspFrameID.GET_CERTIFICATE);
5707
- const sendStatus = await this.sendCommand();
5712
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_CERTIFICATE);
5713
+ const sendStatus = await this.sendCommand(sendBuffalo);
5708
5714
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5709
5715
  throw new ezspError_1.EzspError(sendStatus);
5710
5716
  }
@@ -5717,8 +5723,8 @@ class Ezsp extends events_1.default {
5717
5723
  * @returns EmberCertificate283k1Data * The locally installed certificate.
5718
5724
  */
5719
5725
  async ezspGetCertificate283k1() {
5720
- this.startCommand(enums_2.EzspFrameID.GET_CERTIFICATE283K1);
5721
- const sendStatus = await this.sendCommand();
5726
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_CERTIFICATE283K1);
5727
+ const sendStatus = await this.sendCommand(sendBuffalo);
5722
5728
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5723
5729
  throw new ezspError_1.EzspError(sendStatus);
5724
5730
  }
@@ -5750,11 +5756,11 @@ class Ezsp extends events_1.default {
5750
5756
  * @param receivedSig EmberSignatureData * The signature of the signed data.
5751
5757
  */
5752
5758
  async ezspDsaVerify(digest, signerCertificate, receivedSig) {
5753
- this.startCommand(enums_2.EzspFrameID.DSA_VERIFY);
5754
- this.buffalo.writeEmberMessageDigest(digest);
5755
- this.buffalo.writeEmberCertificateData(signerCertificate);
5756
- this.buffalo.writeEmberSignatureData(receivedSig);
5757
- const sendStatus = await this.sendCommand();
5759
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.DSA_VERIFY);
5760
+ sendBuffalo.writeEmberMessageDigest(digest);
5761
+ sendBuffalo.writeEmberCertificateData(signerCertificate);
5762
+ sendBuffalo.writeEmberSignatureData(receivedSig);
5763
+ const sendStatus = await this.sendCommand(sendBuffalo);
5758
5764
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5759
5765
  throw new ezspError_1.EzspError(sendStatus);
5760
5766
  }
@@ -5784,11 +5790,11 @@ class Ezsp extends events_1.default {
5784
5790
  * @param receivedSig EmberSignature283k1Data * The signature of the signed data.
5785
5791
  */
5786
5792
  async ezspDsaVerify283k1(digest, signerCertificate, receivedSig) {
5787
- this.startCommand(enums_2.EzspFrameID.DSA_VERIFY283K1);
5788
- this.buffalo.writeEmberMessageDigest(digest);
5789
- this.buffalo.writeEmberCertificate283k1Data(signerCertificate);
5790
- this.buffalo.writeEmberSignature283k1Data(receivedSig);
5791
- const sendStatus = await this.sendCommand();
5793
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.DSA_VERIFY283K1);
5794
+ sendBuffalo.writeEmberMessageDigest(digest);
5795
+ sendBuffalo.writeEmberCertificate283k1Data(signerCertificate);
5796
+ sendBuffalo.writeEmberSignature283k1Data(receivedSig);
5797
+ const sendStatus = await this.sendCommand(sendBuffalo);
5792
5798
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5793
5799
  throw new ezspError_1.EzspError(sendStatus);
5794
5800
  }
@@ -5803,11 +5809,11 @@ class Ezsp extends events_1.default {
5803
5809
  * @param myKey EmberPrivateKeyData *The node's new static private key.
5804
5810
  */
5805
5811
  async ezspSetPreinstalledCbkeData(caPublic, myCert, myKey) {
5806
- this.startCommand(enums_2.EzspFrameID.SET_PREINSTALLED_CBKE_DATA);
5807
- this.buffalo.writeEmberPublicKeyData(caPublic);
5808
- this.buffalo.writeEmberCertificateData(myCert);
5809
- this.buffalo.writeEmberPrivateKeyData(myKey);
5810
- const sendStatus = await this.sendCommand();
5812
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_PREINSTALLED_CBKE_DATA);
5813
+ sendBuffalo.writeEmberPublicKeyData(caPublic);
5814
+ sendBuffalo.writeEmberCertificateData(myCert);
5815
+ sendBuffalo.writeEmberPrivateKeyData(myKey);
5816
+ const sendStatus = await this.sendCommand(sendBuffalo);
5811
5817
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5812
5818
  throw new ezspError_1.EzspError(sendStatus);
5813
5819
  }
@@ -5820,8 +5826,8 @@ class Ezsp extends events_1.default {
5820
5826
  * @returns Status of operation
5821
5827
  */
5822
5828
  async ezspSavePreinstalledCbkeData283k1() {
5823
- this.startCommand(enums_2.EzspFrameID.SAVE_PREINSTALLED_CBKE_DATA283K1);
5824
- const sendStatus = await this.sendCommand();
5829
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SAVE_PREINSTALLED_CBKE_DATA283K1);
5830
+ const sendStatus = await this.sendCommand(sendBuffalo);
5825
5831
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5826
5832
  throw new ezspError_1.EzspError(sendStatus);
5827
5833
  }
@@ -5840,9 +5846,9 @@ class Ezsp extends events_1.default {
5840
5846
  * @returns An SLStatus value indicating success or the reason for failure.
5841
5847
  */
5842
5848
  async mfglibInternalStart(rxCallback) {
5843
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_START);
5844
- this.buffalo.writeUInt8(rxCallback ? 1 : 0);
5845
- const sendStatus = await this.sendCommand();
5849
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_START);
5850
+ sendBuffalo.writeUInt8(rxCallback ? 1 : 0);
5851
+ const sendStatus = await this.sendCommand(sendBuffalo);
5846
5852
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5847
5853
  throw new ezspError_1.EzspError(sendStatus);
5848
5854
  }
@@ -5856,8 +5862,8 @@ class Ezsp extends events_1.default {
5856
5862
  * @returns An SLStatus value indicating success or the reason for failure.
5857
5863
  */
5858
5864
  async mfglibInternalEnd() {
5859
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_END);
5860
- const sendStatus = await this.sendCommand();
5865
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_END);
5866
+ const sendStatus = await this.sendCommand(sendBuffalo);
5861
5867
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5862
5868
  throw new ezspError_1.EzspError(sendStatus);
5863
5869
  }
@@ -5873,8 +5879,8 @@ class Ezsp extends events_1.default {
5873
5879
  * @returns An SLStatus value indicating success or the reason for failure.
5874
5880
  */
5875
5881
  async mfglibInternalStartTone() {
5876
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_START_TONE);
5877
- const sendStatus = await this.sendCommand();
5882
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_START_TONE);
5883
+ const sendStatus = await this.sendCommand(sendBuffalo);
5878
5884
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5879
5885
  throw new ezspError_1.EzspError(sendStatus);
5880
5886
  }
@@ -5886,8 +5892,8 @@ class Ezsp extends events_1.default {
5886
5892
  * @returns An SLStatus value indicating success or the reason for failure.
5887
5893
  */
5888
5894
  async mfglibInternalStopTone() {
5889
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_STOP_TONE);
5890
- const sendStatus = await this.sendCommand();
5895
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_STOP_TONE);
5896
+ const sendStatus = await this.sendCommand(sendBuffalo);
5891
5897
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5892
5898
  throw new ezspError_1.EzspError(sendStatus);
5893
5899
  }
@@ -5900,8 +5906,8 @@ class Ezsp extends events_1.default {
5900
5906
  * @returns An SLStatus value indicating success or the reason for failure.
5901
5907
  */
5902
5908
  async mfglibInternalStartStream() {
5903
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_START_STREAM);
5904
- const sendStatus = await this.sendCommand();
5909
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_START_STREAM);
5910
+ const sendStatus = await this.sendCommand(sendBuffalo);
5905
5911
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5906
5912
  throw new ezspError_1.EzspError(sendStatus);
5907
5913
  }
@@ -5914,8 +5920,8 @@ class Ezsp extends events_1.default {
5914
5920
  * @returns An SLStatus value indicating success or the reason for failure.
5915
5921
  */
5916
5922
  async mfglibInternalStopStream() {
5917
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_STOP_STREAM);
5918
- const sendStatus = await this.sendCommand();
5923
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_STOP_STREAM);
5924
+ const sendStatus = await this.sendCommand(sendBuffalo);
5919
5925
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5920
5926
  throw new ezspError_1.EzspError(sendStatus);
5921
5927
  }
@@ -5932,9 +5938,9 @@ class Ezsp extends events_1.default {
5932
5938
  * @returns An SLStatus value indicating success or the reason for failure.
5933
5939
  */
5934
5940
  async mfglibInternalSendPacket(packetContents) {
5935
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_SEND_PACKET);
5936
- this.buffalo.writePayload(packetContents);
5937
- const sendStatus = await this.sendCommand();
5941
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_SEND_PACKET);
5942
+ sendBuffalo.writePayload(packetContents);
5943
+ const sendStatus = await this.sendCommand(sendBuffalo);
5938
5944
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5939
5945
  throw new ezspError_1.EzspError(sendStatus);
5940
5946
  }
@@ -5948,9 +5954,9 @@ class Ezsp extends events_1.default {
5948
5954
  * @returns An SLStatus value indicating success or the reason for failure.
5949
5955
  */
5950
5956
  async mfglibInternalSetChannel(channel) {
5951
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_SET_CHANNEL);
5952
- this.buffalo.writeUInt8(channel);
5953
- const sendStatus = await this.sendCommand();
5957
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_SET_CHANNEL);
5958
+ sendBuffalo.writeUInt8(channel);
5959
+ const sendStatus = await this.sendCommand(sendBuffalo);
5954
5960
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5955
5961
  throw new ezspError_1.EzspError(sendStatus);
5956
5962
  }
@@ -5962,8 +5968,8 @@ class Ezsp extends events_1.default {
5962
5968
  * @returns uint8_t The current channel.
5963
5969
  */
5964
5970
  async mfglibInternalGetChannel() {
5965
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_GET_CHANNEL);
5966
- const sendStatus = await this.sendCommand();
5971
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_GET_CHANNEL);
5972
+ const sendStatus = await this.sendCommand(sendBuffalo);
5967
5973
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5968
5974
  throw new ezspError_1.EzspError(sendStatus);
5969
5975
  }
@@ -5981,10 +5987,10 @@ class Ezsp extends events_1.default {
5981
5987
  * @returns An SLStatus value indicating success or the reason for failure.
5982
5988
  */
5983
5989
  async mfglibInternalSetPower(txPowerMode, power) {
5984
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_SET_POWER);
5985
- this.buffalo.writeUInt16(txPowerMode);
5986
- this.buffalo.writeInt8(power);
5987
- const sendStatus = await this.sendCommand();
5990
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_SET_POWER);
5991
+ sendBuffalo.writeUInt16(txPowerMode);
5992
+ sendBuffalo.writeInt8(power);
5993
+ const sendStatus = await this.sendCommand(sendBuffalo);
5988
5994
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
5989
5995
  throw new ezspError_1.EzspError(sendStatus);
5990
5996
  }
@@ -5996,8 +6002,8 @@ class Ezsp extends events_1.default {
5996
6002
  * @returns int8_t Power in units of dBm. Refer to radio data sheet for valid range.
5997
6003
  */
5998
6004
  async mfglibInternalGetPower() {
5999
- this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_GET_POWER);
6000
- const sendStatus = await this.sendCommand();
6005
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFGLIB_INTERNAL_GET_POWER);
6006
+ const sendStatus = await this.sendCommand(sendBuffalo);
6001
6007
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6002
6008
  throw new ezspError_1.EzspError(sendStatus);
6003
6009
  }
@@ -6009,12 +6015,12 @@ class Ezsp extends events_1.default {
6009
6015
  * A callback indicating a packet with a valid CRC has been received.
6010
6016
  * @param linkQuality uint8_t The link quality observed during the reception
6011
6017
  * @param rssi int8_t The energy level (in units of dBm) observed during the reception.
6012
- * @param packetLength uint8_t The length of the packetContents parameter in bytes. Will be greater than 3 and less than 123.
6013
6018
  * @param packetContents uint8_t * The received packet (last 2 bytes are not FCS / CRC and may be discarded)
6019
+ * Length will be greater than 3 and less than 123.
6014
6020
  */
6015
- ezspMfglibRxHandler(linkQuality, rssi, packetLength, packetContents) {
6016
- logger_1.logger.debug(`ezspMfglibRxHandler(): callback called with: [linkQuality=${linkQuality}], [rssi=${rssi}], `
6017
- + `[packetLength=${packetLength}], [packetContents=${packetContents}]`, NS);
6021
+ ezspMfglibRxHandler(linkQuality, rssi, packetContents) {
6022
+ logger_1.logger.debug(`ezspMfglibRxHandler(): callback called with: [linkQuality=${linkQuality}], [rssi=${rssi}], ` +
6023
+ `[packetContents=${packetContents.toString('hex')}]`, NS);
6018
6024
  }
6019
6025
  //-----------------------------------------------------------------------------
6020
6026
  // Bootloader Frames
@@ -6031,9 +6037,9 @@ class Ezsp extends events_1.default {
6031
6037
  * @returns An SLStatus value indicating success or the reason for failure.
6032
6038
  */
6033
6039
  async ezspLaunchStandaloneBootloader(mode) {
6034
- this.startCommand(enums_2.EzspFrameID.LAUNCH_STANDALONE_BOOTLOADER);
6035
- this.buffalo.writeUInt8(mode);
6036
- const sendStatus = await this.sendCommand();
6040
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.LAUNCH_STANDALONE_BOOTLOADER);
6041
+ sendBuffalo.writeUInt8(mode);
6042
+ const sendStatus = await this.sendCommand(sendBuffalo);
6037
6043
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6038
6044
  throw new ezspError_1.EzspError(sendStatus);
6039
6045
  }
@@ -6051,11 +6057,11 @@ class Ezsp extends events_1.default {
6051
6057
  * @returns An SLStatus value indicating success or the reason for failure.
6052
6058
  */
6053
6059
  async ezspSendBootloadMessage(broadcast, destEui64, messageContents) {
6054
- this.startCommand(enums_2.EzspFrameID.SEND_BOOTLOAD_MESSAGE);
6055
- this.buffalo.writeUInt8(broadcast ? 1 : 0);
6056
- this.buffalo.writeIeeeAddr(destEui64);
6057
- this.buffalo.writePayload(messageContents);
6058
- const sendStatus = await this.sendCommand();
6060
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SEND_BOOTLOAD_MESSAGE);
6061
+ sendBuffalo.writeUInt8(broadcast ? 1 : 0);
6062
+ sendBuffalo.writeIeeeAddr(destEui64);
6063
+ sendBuffalo.writePayload(messageContents);
6064
+ const sendStatus = await this.sendCommand(sendBuffalo);
6059
6065
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6060
6066
  throw new ezspError_1.EzspError(sendStatus);
6061
6067
  }
@@ -6074,8 +6080,8 @@ class Ezsp extends events_1.default {
6074
6080
  * @returns uint8_t * The value of PHY on the node
6075
6081
  */
6076
6082
  async ezspGetStandaloneBootloaderVersionPlatMicroPhy() {
6077
- this.startCommand(enums_2.EzspFrameID.GET_STANDALONE_BOOTLOADER_VERSION_PLAT_MICRO_PHY);
6078
- const sendStatus = await this.sendCommand();
6083
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_STANDALONE_BOOTLOADER_VERSION_PLAT_MICRO_PHY);
6084
+ const sendStatus = await this.sendCommand(sendBuffalo);
6079
6085
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6080
6086
  throw new ezspError_1.EzspError(sendStatus);
6081
6087
  }
@@ -6094,8 +6100,8 @@ class Ezsp extends events_1.default {
6094
6100
  * @param messageContents uint8_t *The bootload message that was sent.
6095
6101
  */
6096
6102
  ezspIncomingBootloadMessageHandler(longId, packetInfo, messageContents) {
6097
- logger_1.logger.debug(`ezspIncomingBootloadMessageHandler(): callback called with: [longId=${longId}], [packetInfo=${JSON.stringify(packetInfo)}], `
6098
- + `[messageContents=${messageContents.toString('hex')}]`, NS);
6103
+ logger_1.logger.debug(`ezspIncomingBootloadMessageHandler(): callback called with: [longId=${longId}], [packetInfo=${JSON.stringify(packetInfo)}], ` +
6104
+ `[messageContents=${messageContents.toString('hex')}]`, NS);
6099
6105
  }
6100
6106
  /**
6101
6107
  * Callback
@@ -6107,8 +6113,8 @@ class Ezsp extends events_1.default {
6107
6113
  * @param messageContents uint8_t * The message that was sent.
6108
6114
  */
6109
6115
  ezspBootloadTransmitCompleteHandler(status, messageContents) {
6110
- logger_1.logger.debug(`ezspBootloadTransmitCompleteHandler(): callback called with: [status=${enums_1.SLStatus[status]}], `
6111
- + `[messageContents=${messageContents.toString('hex')}]`, NS);
6116
+ logger_1.logger.debug(`ezspBootloadTransmitCompleteHandler(): callback called with: [status=${enums_1.SLStatus[status]}], ` +
6117
+ `[messageContents=${messageContents.toString('hex')}]`, NS);
6112
6118
  }
6113
6119
  /**
6114
6120
  * Perform AES encryption on plaintext using key.
@@ -6117,14 +6123,14 @@ class Ezsp extends events_1.default {
6117
6123
  * @returns uint8_t * 16 bytes of ciphertext.
6118
6124
  */
6119
6125
  async ezspAesEncrypt(plaintext, key) {
6120
- this.startCommand(enums_2.EzspFrameID.AES_ENCRYPT);
6121
- this.buffalo.writeListUInt8(plaintext);
6122
- this.buffalo.writeListUInt8(key);
6123
- const sendStatus = await this.sendCommand();
6126
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.AES_ENCRYPT);
6127
+ sendBuffalo.writeListUInt8(plaintext);
6128
+ sendBuffalo.writeListUInt8(key);
6129
+ const sendStatus = await this.sendCommand(sendBuffalo);
6124
6130
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6125
6131
  throw new ezspError_1.EzspError(sendStatus);
6126
6132
  }
6127
- const ciphertext = this.buffalo.readListUInt8(consts_1.EMBER_ENCRYPTION_KEY_SIZE);
6133
+ const ciphertext = this.buffalo.readListUInt8(consts_2.EMBER_ENCRYPTION_KEY_SIZE);
6128
6134
  return ciphertext;
6129
6135
  }
6130
6136
  /**
@@ -6136,8 +6142,8 @@ class Ezsp extends events_1.default {
6136
6142
  * @param data uint8_t * A pointer to the data received in the current message.
6137
6143
  */
6138
6144
  ezspIncomingMfgTestMessageHandler(messageType, messageContents) {
6139
- logger_1.logger.debug(`ezspIncomingMfgTestMessageHandler(): callback called with: [messageType=${messageType}], `
6140
- + `[messageContents=${messageContents.toString('hex')}]`, NS);
6145
+ logger_1.logger.debug(`ezspIncomingMfgTestMessageHandler(): callback called with: [messageType=${messageType}], ` +
6146
+ `[messageContents=${messageContents.toString('hex')}]`, NS);
6141
6147
  }
6142
6148
  /**
6143
6149
  * A function used on the Golden Node to switch between normal network operation (for testing) and manufacturing configuration.
@@ -6150,12 +6156,12 @@ class Ezsp extends events_1.default {
6150
6156
  * @returns An SLStatus value indicating success or failure of the command.
6151
6157
  */
6152
6158
  async ezspMfgTestSetPacketMode(beginConfiguration) {
6153
- if (this.version < 0x0E) {
6159
+ if (this.version < 0x0e) {
6154
6160
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
6155
6161
  }
6156
- this.startCommand(enums_2.EzspFrameID.MFG_TEST_SET_PACKET_MODE);
6157
- this.buffalo.writeUInt8(beginConfiguration ? 1 : 0);
6158
- const sendStatus = await this.sendCommand();
6162
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFG_TEST_SET_PACKET_MODE);
6163
+ sendBuffalo.writeUInt8(beginConfiguration ? 1 : 0);
6164
+ const sendStatus = await this.sendCommand(sendBuffalo);
6159
6165
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6160
6166
  throw new ezspError_1.EzspError(sendStatus);
6161
6167
  }
@@ -6171,11 +6177,11 @@ class Ezsp extends events_1.default {
6171
6177
  * @returns An SLStatus value indicating success or failure of the command.
6172
6178
  */
6173
6179
  async ezspMfgTestSendRebootCommand() {
6174
- if (this.version < 0x0E) {
6180
+ if (this.version < 0x0e) {
6175
6181
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
6176
6182
  }
6177
- this.startCommand(enums_2.EzspFrameID.MFG_TEST_SEND_REBOOT_COMMAND);
6178
- const sendStatus = await this.sendCommand();
6183
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFG_TEST_SEND_REBOOT_COMMAND);
6184
+ const sendStatus = await this.sendCommand(sendBuffalo);
6179
6185
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6180
6186
  throw new ezspError_1.EzspError(sendStatus);
6181
6187
  }
@@ -6190,12 +6196,12 @@ class Ezsp extends events_1.default {
6190
6196
  * @returns An SLStatus value indicating success or failure of the command.
6191
6197
  */
6192
6198
  async ezspMfgTestSendEui64(newId) {
6193
- if (this.version < 0x0E) {
6199
+ if (this.version < 0x0e) {
6194
6200
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
6195
6201
  }
6196
- this.startCommand(enums_2.EzspFrameID.MFG_TEST_SEND_EUI64);
6197
- this.buffalo.writeIeeeAddr(newId);
6198
- const sendStatus = await this.sendCommand();
6202
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFG_TEST_SEND_EUI64);
6203
+ sendBuffalo.writeIeeeAddr(newId);
6204
+ const sendStatus = await this.sendCommand(sendBuffalo);
6199
6205
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6200
6206
  throw new ezspError_1.EzspError(sendStatus);
6201
6207
  }
@@ -6210,12 +6216,12 @@ class Ezsp extends events_1.default {
6210
6216
  * @returns An SLStatus value indicating success or failure of the command.
6211
6217
  */
6212
6218
  async ezspMfgTestSendManufacturingString(newString) {
6213
- if (this.version < 0x0E) {
6219
+ if (this.version < 0x0e) {
6214
6220
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
6215
6221
  }
6216
- this.startCommand(enums_2.EzspFrameID.MFG_TEST_SEND_MANUFACTURING_STRING);
6217
- this.buffalo.writeListUInt16(newString); // expects 16 bytes
6218
- const sendStatus = await this.sendCommand();
6222
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFG_TEST_SEND_MANUFACTURING_STRING);
6223
+ sendBuffalo.writeListUInt16(newString); // expects 16 bytes
6224
+ const sendStatus = await this.sendCommand(sendBuffalo);
6219
6225
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6220
6226
  throw new ezspError_1.EzspError(sendStatus);
6221
6227
  }
@@ -6231,13 +6237,13 @@ class Ezsp extends events_1.default {
6231
6237
  * @returns An SLStatus value indicating success or failure of the command.
6232
6238
  */
6233
6239
  async ezspMfgTestSendRadioParameters(supportedBands, crystalOffset) {
6234
- if (this.version < 0x0E) {
6240
+ if (this.version < 0x0e) {
6235
6241
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
6236
6242
  }
6237
- this.startCommand(enums_2.EzspFrameID.MFG_TEST_SEND_RADIO_PARAMETERS);
6238
- this.buffalo.writeUInt8(supportedBands);
6239
- this.buffalo.writeInt8(crystalOffset);
6240
- const sendStatus = await this.sendCommand();
6243
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFG_TEST_SEND_RADIO_PARAMETERS);
6244
+ sendBuffalo.writeUInt8(supportedBands);
6245
+ sendBuffalo.writeInt8(crystalOffset);
6246
+ const sendStatus = await this.sendCommand(sendBuffalo);
6241
6247
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6242
6248
  throw new ezspError_1.EzspError(sendStatus);
6243
6249
  }
@@ -6252,12 +6258,12 @@ class Ezsp extends events_1.default {
6252
6258
  * @returns An SLStatus value indicating success or failure of the command.
6253
6259
  */
6254
6260
  async ezspMfgTestSendCommand(command) {
6255
- if (this.version < 0x0E) {
6261
+ if (this.version < 0x0e) {
6256
6262
  throw new ezspError_1.EzspError(enums_1.EzspStatus.ERROR_INVALID_FRAME_ID);
6257
6263
  }
6258
- this.startCommand(enums_2.EzspFrameID.MFG_TEST_SEND_COMMAND);
6259
- this.buffalo.writeUInt8(command);
6260
- const sendStatus = await this.sendCommand();
6264
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.MFG_TEST_SEND_COMMAND);
6265
+ sendBuffalo.writeUInt8(command);
6266
+ const sendStatus = await this.sendCommand(sendBuffalo);
6261
6267
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6262
6268
  throw new ezspError_1.EzspError(sendStatus);
6263
6269
  }
@@ -6276,11 +6282,11 @@ class Ezsp extends events_1.default {
6276
6282
  * @returns An SLStatus value indicating success or the reason for failure.
6277
6283
  */
6278
6284
  async ezspZllNetworkOps(networkInfo, op, radioTxPower) {
6279
- this.startCommand(enums_2.EzspFrameID.ZLL_NETWORK_OPS);
6280
- this.buffalo.writeEmberZllNetwork(networkInfo);
6281
- this.buffalo.writeUInt8(op);
6282
- this.buffalo.writeInt8(radioTxPower);
6283
- const sendStatus = await this.sendCommand();
6285
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_NETWORK_OPS);
6286
+ sendBuffalo.writeEmberZllNetwork(networkInfo);
6287
+ sendBuffalo.writeUInt8(op);
6288
+ sendBuffalo.writeInt8(radioTxPower);
6289
+ const sendStatus = await this.sendCommand(sendBuffalo);
6284
6290
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6285
6291
  throw new ezspError_1.EzspError(sendStatus);
6286
6292
  }
@@ -6295,10 +6301,10 @@ class Ezsp extends events_1.default {
6295
6301
  * @returns An SLStatus value indicating success or the reason for failure.
6296
6302
  */
6297
6303
  async ezspZllSetInitialSecurityState(networkKey, securityState) {
6298
- this.startCommand(enums_2.EzspFrameID.ZLL_SET_INITIAL_SECURITY_STATE);
6299
- this.buffalo.writeEmberKeyData(networkKey);
6300
- this.buffalo.writeEmberZllInitialSecurityState(securityState);
6301
- const sendStatus = await this.sendCommand();
6304
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_SET_INITIAL_SECURITY_STATE);
6305
+ sendBuffalo.writeEmberKeyData(networkKey);
6306
+ sendBuffalo.writeEmberZllInitialSecurityState(securityState);
6307
+ const sendStatus = await this.sendCommand(sendBuffalo);
6302
6308
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6303
6309
  throw new ezspError_1.EzspError(sendStatus);
6304
6310
  }
@@ -6313,9 +6319,9 @@ class Ezsp extends events_1.default {
6313
6319
  * @returns An SLStatus value indicating success or the reason for failure.
6314
6320
  */
6315
6321
  async ezspZllSetSecurityStateWithoutKey(securityState) {
6316
- this.startCommand(enums_2.EzspFrameID.ZLL_SET_SECURITY_STATE_WITHOUT_KEY);
6317
- this.buffalo.writeEmberZllInitialSecurityState(securityState);
6318
- const sendStatus = await this.sendCommand();
6322
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_SET_SECURITY_STATE_WITHOUT_KEY);
6323
+ sendBuffalo.writeEmberZllInitialSecurityState(securityState);
6324
+ const sendStatus = await this.sendCommand(sendBuffalo);
6319
6325
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6320
6326
  throw new ezspError_1.EzspError(sendStatus);
6321
6327
  }
@@ -6330,11 +6336,11 @@ class Ezsp extends events_1.default {
6330
6336
  * @returns An SLStatus value indicating success or the reason for failure.
6331
6337
  */
6332
6338
  async ezspZllStartScan(channelMask, radioPowerForScan, nodeType) {
6333
- this.startCommand(enums_2.EzspFrameID.ZLL_START_SCAN);
6334
- this.buffalo.writeUInt32(channelMask);
6335
- this.buffalo.writeInt8(radioPowerForScan);
6336
- this.buffalo.writeUInt8(nodeType);
6337
- const sendStatus = await this.sendCommand();
6339
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_START_SCAN);
6340
+ sendBuffalo.writeUInt32(channelMask);
6341
+ sendBuffalo.writeInt8(radioPowerForScan);
6342
+ sendBuffalo.writeUInt8(nodeType);
6343
+ const sendStatus = await this.sendCommand(sendBuffalo);
6338
6344
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6339
6345
  throw new ezspError_1.EzspError(sendStatus);
6340
6346
  }
@@ -6348,9 +6354,9 @@ class Ezsp extends events_1.default {
6348
6354
  * @returns An SLStatus value indicating success or the reason for failure.
6349
6355
  */
6350
6356
  async ezspZllSetRxOnWhenIdle(durationMs) {
6351
- this.startCommand(enums_2.EzspFrameID.ZLL_SET_RX_ON_WHEN_IDLE);
6352
- this.buffalo.writeUInt32(durationMs);
6353
- const sendStatus = await this.sendCommand();
6357
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_SET_RX_ON_WHEN_IDLE);
6358
+ sendBuffalo.writeUInt32(durationMs);
6359
+ const sendStatus = await this.sendCommand(sendBuffalo);
6354
6360
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6355
6361
  throw new ezspError_1.EzspError(sendStatus);
6356
6362
  }
@@ -6366,8 +6372,8 @@ class Ezsp extends events_1.default {
6366
6372
  * @param packetInfo Information about the incoming packet received from this network.
6367
6373
  */
6368
6374
  ezspZllNetworkFoundHandler(networkInfo, isDeviceInfoNull, deviceInfo, packetInfo) {
6369
- logger_1.logger.debug(`ezspZllNetworkFoundHandler(): callback called with: [networkInfo=${networkInfo}], [isDeviceInfoNull=${isDeviceInfoNull}], `
6370
- + `[deviceInfo=${deviceInfo}], [packetInfo=${JSON.stringify(packetInfo)}]`, NS);
6375
+ logger_1.logger.debug(`ezspZllNetworkFoundHandler(): callback called with: [networkInfo=${networkInfo}], [isDeviceInfoNull=${isDeviceInfoNull}], ` +
6376
+ `[deviceInfo=${deviceInfo}], [packetInfo=${JSON.stringify(packetInfo)}]`, NS);
6371
6377
  }
6372
6378
  /**
6373
6379
  * Callback
@@ -6385,8 +6391,7 @@ class Ezsp extends events_1.default {
6385
6391
  * @param packetInfo Information about the incoming packet received from this network.
6386
6392
  */
6387
6393
  ezspZllAddressAssignmentHandler(addressInfo, packetInfo) {
6388
- logger_1.logger.debug(`ezspZllAddressAssignmentHandler(): callback called with: [addressInfo=${addressInfo}], `
6389
- + `[packetInfo=${JSON.stringify(packetInfo)}]`, NS);
6394
+ logger_1.logger.debug(`ezspZllAddressAssignmentHandler(): callback called with: [addressInfo=${addressInfo}], ` + `[packetInfo=${JSON.stringify(packetInfo)}]`, NS);
6390
6395
  }
6391
6396
  /**
6392
6397
  * Callback
@@ -6402,8 +6407,8 @@ class Ezsp extends events_1.default {
6402
6407
  * @returns EmberTokTypeStackZllSecurity * Security token return value.
6403
6408
  */
6404
6409
  async ezspZllGetTokens() {
6405
- this.startCommand(enums_2.EzspFrameID.ZLL_GET_TOKENS);
6406
- const sendStatus = await this.sendCommand();
6410
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_GET_TOKENS);
6411
+ const sendStatus = await this.sendCommand(sendBuffalo);
6407
6412
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6408
6413
  throw new ezspError_1.EzspError(sendStatus);
6409
6414
  }
@@ -6416,9 +6421,9 @@ class Ezsp extends events_1.default {
6416
6421
  * @param data EmberTokTypeStackZllData * Data token to be set.
6417
6422
  */
6418
6423
  async ezspZllSetDataToken(data) {
6419
- this.startCommand(enums_2.EzspFrameID.ZLL_SET_DATA_TOKEN);
6420
- this.buffalo.writeEmberTokTypeStackZllData(data);
6421
- const sendStatus = await this.sendCommand();
6424
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_SET_DATA_TOKEN);
6425
+ sendBuffalo.writeEmberTokTypeStackZllData(data);
6426
+ const sendStatus = await this.sendCommand(sendBuffalo);
6422
6427
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6423
6428
  throw new ezspError_1.EzspError(sendStatus);
6424
6429
  }
@@ -6427,8 +6432,8 @@ class Ezsp extends events_1.default {
6427
6432
  * Set the ZLL data token bitmask to reflect the ZLL network state.
6428
6433
  */
6429
6434
  async ezspZllSetNonZllNetwork() {
6430
- this.startCommand(enums_2.EzspFrameID.ZLL_SET_NON_ZLL_NETWORK);
6431
- const sendStatus = await this.sendCommand();
6435
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_SET_NON_ZLL_NETWORK);
6436
+ const sendStatus = await this.sendCommand(sendBuffalo);
6432
6437
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6433
6438
  throw new ezspError_1.EzspError(sendStatus);
6434
6439
  }
@@ -6438,8 +6443,8 @@ class Ezsp extends events_1.default {
6438
6443
  * @returns ZLL network?
6439
6444
  */
6440
6445
  async ezspIsZllNetwork() {
6441
- this.startCommand(enums_2.EzspFrameID.IS_ZLL_NETWORK);
6442
- const sendStatus = await this.sendCommand();
6446
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.IS_ZLL_NETWORK);
6447
+ const sendStatus = await this.sendCommand(sendBuffalo);
6443
6448
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6444
6449
  throw new ezspError_1.EzspError(sendStatus);
6445
6450
  }
@@ -6451,9 +6456,9 @@ class Ezsp extends events_1.default {
6451
6456
  * @param mode The power mode to be set.
6452
6457
  */
6453
6458
  async ezspZllSetRadioIdleMode(mode) {
6454
- this.startCommand(enums_2.EzspFrameID.ZLL_SET_RADIO_IDLE_MODE);
6455
- this.buffalo.writeUInt8(mode);
6456
- const sendStatus = await this.sendCommand();
6459
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_SET_RADIO_IDLE_MODE);
6460
+ sendBuffalo.writeUInt8(mode);
6461
+ const sendStatus = await this.sendCommand(sendBuffalo);
6457
6462
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6458
6463
  throw new ezspError_1.EzspError(sendStatus);
6459
6464
  }
@@ -6463,8 +6468,8 @@ class Ezsp extends events_1.default {
6463
6468
  * @returns uint8_t The current power mode.
6464
6469
  */
6465
6470
  async ezspZllGetRadioIdleMode() {
6466
- this.startCommand(enums_2.EzspFrameID.ZLL_GET_RADIO_IDLE_MODE);
6467
- const sendStatus = await this.sendCommand();
6471
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_GET_RADIO_IDLE_MODE);
6472
+ const sendStatus = await this.sendCommand(sendBuffalo);
6468
6473
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6469
6474
  throw new ezspError_1.EzspError(sendStatus);
6470
6475
  }
@@ -6476,9 +6481,9 @@ class Ezsp extends events_1.default {
6476
6481
  * @param nodeType The node type to be set.
6477
6482
  */
6478
6483
  async ezspSetZllNodeType(nodeType) {
6479
- this.startCommand(enums_2.EzspFrameID.SET_ZLL_NODE_TYPE);
6480
- this.buffalo.writeUInt8(nodeType);
6481
- const sendStatus = await this.sendCommand();
6484
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_ZLL_NODE_TYPE);
6485
+ sendBuffalo.writeUInt8(nodeType);
6486
+ const sendStatus = await this.sendCommand(sendBuffalo);
6482
6487
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6483
6488
  throw new ezspError_1.EzspError(sendStatus);
6484
6489
  }
@@ -6488,9 +6493,9 @@ class Ezsp extends events_1.default {
6488
6493
  * @param uint16_t A mask with the bits to be set or cleared.
6489
6494
  */
6490
6495
  async ezspSetZllAdditionalState(state) {
6491
- this.startCommand(enums_2.EzspFrameID.SET_ZLL_ADDITIONAL_STATE);
6492
- this.buffalo.writeUInt16(state);
6493
- const sendStatus = await this.sendCommand();
6496
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_ZLL_ADDITIONAL_STATE);
6497
+ sendBuffalo.writeUInt16(state);
6498
+ const sendStatus = await this.sendCommand(sendBuffalo);
6494
6499
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6495
6500
  throw new ezspError_1.EzspError(sendStatus);
6496
6501
  }
@@ -6500,8 +6505,8 @@ class Ezsp extends events_1.default {
6500
6505
  * @returns ZLL operation in progress? false on error
6501
6506
  */
6502
6507
  async ezspZllOperationInProgress() {
6503
- this.startCommand(enums_2.EzspFrameID.ZLL_OPERATION_IN_PROGRESS);
6504
- const sendStatus = await this.sendCommand();
6508
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_OPERATION_IN_PROGRESS);
6509
+ const sendStatus = await this.sendCommand(sendBuffalo);
6505
6510
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6506
6511
  throw new ezspError_1.EzspError(sendStatus);
6507
6512
  }
@@ -6513,8 +6518,8 @@ class Ezsp extends events_1.default {
6513
6518
  * @returns ZLL radio on when idle mode is active? false on error
6514
6519
  */
6515
6520
  async ezspZllRxOnWhenIdleGetActive() {
6516
- this.startCommand(enums_2.EzspFrameID.ZLL_RX_ON_WHEN_IDLE_GET_ACTIVE);
6517
- const sendStatus = await this.sendCommand();
6521
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_RX_ON_WHEN_IDLE_GET_ACTIVE);
6522
+ const sendStatus = await this.sendCommand(sendBuffalo);
6518
6523
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6519
6524
  throw new ezspError_1.EzspError(sendStatus);
6520
6525
  }
@@ -6525,8 +6530,8 @@ class Ezsp extends events_1.default {
6525
6530
  * Informs the ZLL API that application scanning is complete
6526
6531
  */
6527
6532
  async ezspZllScanningComplete() {
6528
- this.startCommand(enums_2.EzspFrameID.ZLL_SCANNING_COMPLETE);
6529
- const sendStatus = await this.sendCommand();
6533
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_SCANNING_COMPLETE);
6534
+ const sendStatus = await this.sendCommand(sendBuffalo);
6530
6535
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6531
6536
  throw new ezspError_1.EzspError(sendStatus);
6532
6537
  }
@@ -6536,8 +6541,8 @@ class Ezsp extends events_1.default {
6536
6541
  * @returns uint32_t The primary ZLL channel mask
6537
6542
  */
6538
6543
  async ezspGetZllPrimaryChannelMask() {
6539
- this.startCommand(enums_2.EzspFrameID.GET_ZLL_PRIMARY_CHANNEL_MASK);
6540
- const sendStatus = await this.sendCommand();
6544
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_ZLL_PRIMARY_CHANNEL_MASK);
6545
+ const sendStatus = await this.sendCommand(sendBuffalo);
6541
6546
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6542
6547
  throw new ezspError_1.EzspError(sendStatus);
6543
6548
  }
@@ -6549,8 +6554,8 @@ class Ezsp extends events_1.default {
6549
6554
  * @returns uint32_t The secondary ZLL channel mask
6550
6555
  */
6551
6556
  async ezspGetZllSecondaryChannelMask() {
6552
- this.startCommand(enums_2.EzspFrameID.GET_ZLL_SECONDARY_CHANNEL_MASK);
6553
- const sendStatus = await this.sendCommand();
6557
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_ZLL_SECONDARY_CHANNEL_MASK);
6558
+ const sendStatus = await this.sendCommand(sendBuffalo);
6554
6559
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6555
6560
  throw new ezspError_1.EzspError(sendStatus);
6556
6561
  }
@@ -6562,9 +6567,9 @@ class Ezsp extends events_1.default {
6562
6567
  * @param uint32_t The primary ZLL channel mask
6563
6568
  */
6564
6569
  async ezspSetZllPrimaryChannelMask(zllPrimaryChannelMask) {
6565
- this.startCommand(enums_2.EzspFrameID.SET_ZLL_PRIMARY_CHANNEL_MASK);
6566
- this.buffalo.writeUInt32(zllPrimaryChannelMask);
6567
- const sendStatus = await this.sendCommand();
6570
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_ZLL_PRIMARY_CHANNEL_MASK);
6571
+ sendBuffalo.writeUInt32(zllPrimaryChannelMask);
6572
+ const sendStatus = await this.sendCommand(sendBuffalo);
6568
6573
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6569
6574
  throw new ezspError_1.EzspError(sendStatus);
6570
6575
  }
@@ -6574,9 +6579,9 @@ class Ezsp extends events_1.default {
6574
6579
  * @param uint32_t The secondary ZLL channel mask
6575
6580
  */
6576
6581
  async ezspSetZllSecondaryChannelMask(zllSecondaryChannelMask) {
6577
- this.startCommand(enums_2.EzspFrameID.SET_ZLL_SECONDARY_CHANNEL_MASK);
6578
- this.buffalo.writeUInt32(zllSecondaryChannelMask);
6579
- const sendStatus = await this.sendCommand();
6582
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_ZLL_SECONDARY_CHANNEL_MASK);
6583
+ sendBuffalo.writeUInt32(zllSecondaryChannelMask);
6584
+ const sendStatus = await this.sendCommand(sendBuffalo);
6580
6585
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6581
6586
  throw new ezspError_1.EzspError(sendStatus);
6582
6587
  }
@@ -6585,8 +6590,8 @@ class Ezsp extends events_1.default {
6585
6590
  * Clear ZLL stack tokens.
6586
6591
  */
6587
6592
  async ezspZllClearTokens() {
6588
- this.startCommand(enums_2.EzspFrameID.ZLL_CLEAR_TOKENS);
6589
- const sendStatus = await this.sendCommand();
6593
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.ZLL_CLEAR_TOKENS);
6594
+ const sendStatus = await this.sendCommand(sendBuffalo);
6590
6595
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6591
6596
  throw new ezspError_1.EzspError(sendStatus);
6592
6597
  }
@@ -6609,18 +6614,18 @@ class Ezsp extends events_1.default {
6609
6614
  * @returns Whether a GP Pairing has been created or not.
6610
6615
  */
6611
6616
  async ezspGpProxyTableProcessGpPairing(options, addr, commMode, sinkNetworkAddress, sinkGroupId, assignedAlias, sinkIeeeAddress, gpdKey, gpdSecurityFrameCounter, forwardingRadius) {
6612
- this.startCommand(enums_2.EzspFrameID.GP_PROXY_TABLE_PROCESS_GP_PAIRING);
6613
- this.buffalo.writeUInt32(options);
6614
- this.buffalo.writeEmberGpAddress(addr);
6615
- this.buffalo.writeUInt8(commMode);
6616
- this.buffalo.writeUInt16(sinkNetworkAddress);
6617
- this.buffalo.writeUInt16(sinkGroupId);
6618
- this.buffalo.writeUInt16(assignedAlias);
6619
- this.buffalo.writeIeeeAddr(sinkIeeeAddress);
6620
- this.buffalo.writeEmberKeyData(gpdKey);
6621
- this.buffalo.writeUInt32(gpdSecurityFrameCounter);
6622
- this.buffalo.writeUInt8(forwardingRadius);
6623
- const sendStatus = await this.sendCommand();
6617
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_PROXY_TABLE_PROCESS_GP_PAIRING);
6618
+ sendBuffalo.writeUInt32(options);
6619
+ sendBuffalo.writeEmberGpAddress(addr);
6620
+ sendBuffalo.writeUInt8(commMode);
6621
+ sendBuffalo.writeUInt16(sinkNetworkAddress);
6622
+ sendBuffalo.writeUInt16(sinkGroupId);
6623
+ sendBuffalo.writeUInt16(assignedAlias);
6624
+ sendBuffalo.writeIeeeAddr(sinkIeeeAddress);
6625
+ sendBuffalo.writeEmberKeyData(gpdKey);
6626
+ sendBuffalo.writeUInt32(gpdSecurityFrameCounter);
6627
+ sendBuffalo.writeUInt8(forwardingRadius);
6628
+ const sendStatus = await this.sendCommand(sendBuffalo);
6624
6629
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6625
6630
  throw new ezspError_1.EzspError(sendStatus);
6626
6631
  }
@@ -6639,15 +6644,15 @@ class Ezsp extends events_1.default {
6639
6644
  * @returns An SLStatus value indicating success or the reason for failure.
6640
6645
  */
6641
6646
  async ezspDGpSend(action, useCca, addr, gpdCommandId, gpdAsdu, gpepHandle, gpTxQueueEntryLifetimeMs) {
6642
- this.startCommand(enums_2.EzspFrameID.D_GP_SEND);
6643
- this.buffalo.writeUInt8(action ? 1 : 0);
6644
- this.buffalo.writeUInt8(useCca ? 1 : 0);
6645
- this.buffalo.writeEmberGpAddress(addr);
6646
- this.buffalo.writeUInt8(gpdCommandId);
6647
- this.buffalo.writePayload(gpdAsdu);
6648
- this.buffalo.writeUInt8(gpepHandle);
6649
- this.buffalo.writeUInt16(gpTxQueueEntryLifetimeMs);
6650
- const sendStatus = await this.sendCommand();
6647
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.D_GP_SEND);
6648
+ sendBuffalo.writeUInt8(action ? 1 : 0);
6649
+ sendBuffalo.writeUInt8(useCca ? 1 : 0);
6650
+ sendBuffalo.writeEmberGpAddress(addr);
6651
+ sendBuffalo.writeUInt8(gpdCommandId);
6652
+ sendBuffalo.writePayload(gpdAsdu);
6653
+ sendBuffalo.writeUInt8(gpepHandle);
6654
+ sendBuffalo.writeUInt16(gpTxQueueEntryLifetimeMs);
6655
+ const sendStatus = await this.sendCommand(sendBuffalo);
6651
6656
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6652
6657
  throw new ezspError_1.EzspError(sendStatus);
6653
6658
  }
@@ -6683,18 +6688,18 @@ class Ezsp extends events_1.default {
6683
6688
  * @param gpdCommandPayload uint8_t * The GPD command payload.
6684
6689
  */
6685
6690
  ezspGpepIncomingMessageHandler(status, gpdLink, sequenceNumber, addr, gpdfSecurityLevel, gpdfSecurityKeyType, autoCommissioning, bidirectionalInfo, gpdSecurityFrameCounter, gpdCommandId, mic, proxyTableIndex, gpdCommandPayload) {
6686
- logger_1.logger.debug(`ezspGpepIncomingMessageHandler(): callback called with: [status=${enums_1.EmberGPStatus[status]}], [gpdLink=${gpdLink}], `
6687
- + `[sequenceNumber=${sequenceNumber}], [addr=${JSON.stringify(addr)}], [gpdfSecurityLevel=${enums_1.EmberGpSecurityLevel[gpdfSecurityLevel]}], `
6688
- + `[gpdfSecurityKeyType=${enums_1.EmberGpKeyType[gpdfSecurityKeyType]}], [autoCommissioning=${autoCommissioning}], `
6689
- + `[bidirectionalInfo=${bidirectionalInfo}], [gpdSecurityFrameCounter=${gpdSecurityFrameCounter}], [gpdCommandId=${gpdCommandId}], `
6690
- + `[mic=${mic}], [proxyTableIndex=${proxyTableIndex}], [gpdCommandPayload=${gpdCommandPayload.toString('hex')}]`, NS);
6691
+ logger_1.logger.debug(`ezspGpepIncomingMessageHandler(): callback called with: [status=${enums_1.EmberGPStatus[status]}], [gpdLink=${gpdLink}], ` +
6692
+ `[sequenceNumber=${sequenceNumber}], [addr=${JSON.stringify(addr)}], [gpdfSecurityLevel=${enums_1.EmberGpSecurityLevel[gpdfSecurityLevel]}], ` +
6693
+ `[gpdfSecurityKeyType=${enums_1.EmberGpKeyType[gpdfSecurityKeyType]}], [autoCommissioning=${autoCommissioning}], ` +
6694
+ `[bidirectionalInfo=${bidirectionalInfo}], [gpdSecurityFrameCounter=${gpdSecurityFrameCounter}], [gpdCommandId=${gpdCommandId}], ` +
6695
+ `[mic=${mic}], [proxyTableIndex=${proxyTableIndex}], [gpdCommandPayload=${gpdCommandPayload.toString('hex')}]`, NS);
6691
6696
  if (addr.applicationId === enums_1.EmberGpApplicationId.IEEE_ADDRESS) {
6692
6697
  // XXX: don't bother parsing for upstream for now, since it will be rejected
6693
6698
  logger_1.logger.error(`<=== [GP] Received IEEE address type in message. Support not implemented upstream. Dropping.`, NS);
6694
6699
  return;
6695
6700
  }
6696
6701
  let commandIdentifier = cluster_1.Clusters.greenPower.commands.notification.ID;
6697
- if (gpdCommandId === 0xE0) {
6702
+ if (gpdCommandId === 0xe0) {
6698
6703
  if (!gpdCommandPayload.length) {
6699
6704
  // XXX: seem to be receiving duplicate commissioningNotification from some devices, second one with empty payload?
6700
6705
  // this will mess with the process no doubt, so dropping them
@@ -6711,9 +6716,9 @@ class Ezsp extends events_1.default {
6711
6716
  * @returns EmberGpProxyTableEntry * An EmberGpProxyTableEntry struct containing a copy of the requested proxy entry.
6712
6717
  */
6713
6718
  async ezspGpProxyTableGetEntry(proxyIndex) {
6714
- this.startCommand(enums_2.EzspFrameID.GP_PROXY_TABLE_GET_ENTRY);
6715
- this.buffalo.writeUInt8(proxyIndex);
6716
- const sendStatus = await this.sendCommand();
6719
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_PROXY_TABLE_GET_ENTRY);
6720
+ sendBuffalo.writeUInt8(proxyIndex);
6721
+ const sendStatus = await this.sendCommand(sendBuffalo);
6717
6722
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6718
6723
  throw new ezspError_1.EzspError(sendStatus);
6719
6724
  }
@@ -6727,9 +6732,9 @@ class Ezsp extends events_1.default {
6727
6732
  * @returns uint8_t The index, or 0xFF for not found
6728
6733
  */
6729
6734
  async ezspGpProxyTableLookup(addr) {
6730
- this.startCommand(enums_2.EzspFrameID.GP_PROXY_TABLE_LOOKUP);
6731
- this.buffalo.writeEmberGpAddress(addr);
6732
- const sendStatus = await this.sendCommand();
6735
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_PROXY_TABLE_LOOKUP);
6736
+ sendBuffalo.writeEmberGpAddress(addr);
6737
+ const sendStatus = await this.sendCommand(sendBuffalo);
6733
6738
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6734
6739
  throw new ezspError_1.EzspError(sendStatus);
6735
6740
  }
@@ -6743,9 +6748,9 @@ class Ezsp extends events_1.default {
6743
6748
  * @returns EmberGpSinkTableEntry * An EmberGpSinkTableEntry struct containing a copy of the requested sink entry.
6744
6749
  */
6745
6750
  async ezspGpSinkTableGetEntry(sinkIndex) {
6746
- this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_GET_ENTRY);
6747
- this.buffalo.writeUInt8(sinkIndex);
6748
- const sendStatus = await this.sendCommand();
6751
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_GET_ENTRY);
6752
+ sendBuffalo.writeUInt8(sinkIndex);
6753
+ const sendStatus = await this.sendCommand(sendBuffalo);
6749
6754
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6750
6755
  throw new ezspError_1.EzspError(sendStatus);
6751
6756
  }
@@ -6759,9 +6764,9 @@ class Ezsp extends events_1.default {
6759
6764
  * @returns uint8_t The index, or 0xFF for not found
6760
6765
  */
6761
6766
  async ezspGpSinkTableLookup(addr) {
6762
- this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_LOOKUP);
6763
- this.buffalo.writeEmberGpAddress(addr);
6764
- const sendStatus = await this.sendCommand();
6767
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_LOOKUP);
6768
+ sendBuffalo.writeEmberGpAddress(addr);
6769
+ const sendStatus = await this.sendCommand(sendBuffalo);
6765
6770
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6766
6771
  throw new ezspError_1.EzspError(sendStatus);
6767
6772
  }
@@ -6775,10 +6780,10 @@ class Ezsp extends events_1.default {
6775
6780
  * @returns An SLStatus value indicating success or the reason for failure.
6776
6781
  */
6777
6782
  async ezspGpSinkTableSetEntry(sinkIndex, entry) {
6778
- this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_SET_ENTRY);
6779
- this.buffalo.writeUInt8(sinkIndex);
6780
- this.buffalo.writeEmberGpSinkTableEntry(entry);
6781
- const sendStatus = await this.sendCommand();
6783
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_SET_ENTRY);
6784
+ sendBuffalo.writeUInt8(sinkIndex);
6785
+ sendBuffalo.writeEmberGpSinkTableEntry(entry);
6786
+ const sendStatus = await this.sendCommand(sendBuffalo);
6782
6787
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6783
6788
  throw new ezspError_1.EzspError(sendStatus);
6784
6789
  }
@@ -6790,9 +6795,9 @@ class Ezsp extends events_1.default {
6790
6795
  * @param uint8_t The index of the requested sink table entry.
6791
6796
  */
6792
6797
  async ezspGpSinkTableRemoveEntry(sinkIndex) {
6793
- this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_REMOVE_ENTRY);
6794
- this.buffalo.writeUInt8(sinkIndex);
6795
- const sendStatus = await this.sendCommand();
6798
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_REMOVE_ENTRY);
6799
+ sendBuffalo.writeUInt8(sinkIndex);
6800
+ const sendStatus = await this.sendCommand(sendBuffalo);
6796
6801
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6797
6802
  throw new ezspError_1.EzspError(sendStatus);
6798
6803
  }
@@ -6803,9 +6808,9 @@ class Ezsp extends events_1.default {
6803
6808
  * @returns uint8_t An index of found or allocated sink or 0xFF if failed.
6804
6809
  */
6805
6810
  async ezspGpSinkTableFindOrAllocateEntry(addr) {
6806
- this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_FIND_OR_ALLOCATE_ENTRY);
6807
- this.buffalo.writeEmberGpAddress(addr);
6808
- const sendStatus = await this.sendCommand();
6811
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_FIND_OR_ALLOCATE_ENTRY);
6812
+ sendBuffalo.writeEmberGpAddress(addr);
6813
+ const sendStatus = await this.sendCommand(sendBuffalo);
6809
6814
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6810
6815
  throw new ezspError_1.EzspError(sendStatus);
6811
6816
  }
@@ -6816,8 +6821,8 @@ class Ezsp extends events_1.default {
6816
6821
  * Clear the entire sink table
6817
6822
  */
6818
6823
  async ezspGpSinkTableClearAll() {
6819
- this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_CLEAR_ALL);
6820
- const sendStatus = await this.sendCommand();
6824
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_CLEAR_ALL);
6825
+ const sendStatus = await this.sendCommand(sendBuffalo);
6821
6826
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6822
6827
  throw new ezspError_1.EzspError(sendStatus);
6823
6828
  }
@@ -6826,8 +6831,8 @@ class Ezsp extends events_1.default {
6826
6831
  * Iniitializes Sink Table
6827
6832
  */
6828
6833
  async ezspGpSinkTableInit() {
6829
- this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_INIT);
6830
- const sendStatus = await this.sendCommand();
6834
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_INIT);
6835
+ const sendStatus = await this.sendCommand(sendBuffalo);
6831
6836
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6832
6837
  throw new ezspError_1.EzspError(sendStatus);
6833
6838
  }
@@ -6838,10 +6843,10 @@ class Ezsp extends events_1.default {
6838
6843
  * @param sfc uint32_t Security Frame Counter
6839
6844
  */
6840
6845
  async ezspGpSinkTableSetSecurityFrameCounter(index, sfc) {
6841
- this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_SET_SECURITY_FRAME_COUNTER);
6842
- this.buffalo.writeUInt8(index);
6843
- this.buffalo.writeUInt32(sfc);
6844
- const sendStatus = await this.sendCommand();
6846
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_SET_SECURITY_FRAME_COUNTER);
6847
+ sendBuffalo.writeUInt8(index);
6848
+ sendBuffalo.writeUInt32(sfc);
6849
+ const sendStatus = await this.sendCommand(sendBuffalo);
6845
6850
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6846
6851
  throw new ezspError_1.EzspError(sendStatus);
6847
6852
  }
@@ -6855,12 +6860,12 @@ class Ezsp extends events_1.default {
6855
6860
  * @returns An SLStatus value indicating success or the reason for failure.
6856
6861
  */
6857
6862
  async ezspGpSinkCommission(options, gpmAddrForSecurity, gpmAddrForPairing, sinkEndpoint) {
6858
- this.startCommand(enums_2.EzspFrameID.GP_SINK_COMMISSION);
6859
- this.buffalo.writeUInt8(options);
6860
- this.buffalo.writeUInt16(gpmAddrForSecurity);
6861
- this.buffalo.writeUInt16(gpmAddrForPairing);
6862
- this.buffalo.writeUInt8(sinkEndpoint);
6863
- const sendStatus = await this.sendCommand();
6863
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SINK_COMMISSION);
6864
+ sendBuffalo.writeUInt8(options);
6865
+ sendBuffalo.writeUInt16(gpmAddrForSecurity);
6866
+ sendBuffalo.writeUInt16(gpmAddrForPairing);
6867
+ sendBuffalo.writeUInt8(sinkEndpoint);
6868
+ const sendStatus = await this.sendCommand(sendBuffalo);
6864
6869
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6865
6870
  throw new ezspError_1.EzspError(sendStatus);
6866
6871
  }
@@ -6871,8 +6876,8 @@ class Ezsp extends events_1.default {
6871
6876
  * Clears all entries within the translation table.
6872
6877
  */
6873
6878
  async ezspGpTranslationTableClear() {
6874
- this.startCommand(enums_2.EzspFrameID.GP_TRANSLATION_TABLE_CLEAR);
6875
- const sendStatus = await this.sendCommand();
6879
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_TRANSLATION_TABLE_CLEAR);
6880
+ const sendStatus = await this.sendCommand(sendBuffalo);
6876
6881
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6877
6882
  throw new ezspError_1.EzspError(sendStatus);
6878
6883
  }
@@ -6882,8 +6887,8 @@ class Ezsp extends events_1.default {
6882
6887
  * @returns uint8_t Number of active entries in sink table. 0 if error.
6883
6888
  */
6884
6889
  async ezspGpSinkTableGetNumberOfActiveEntries() {
6885
- this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_GET_NUMBER_OF_ACTIVE_ENTRIES);
6886
- const sendStatus = await this.sendCommand();
6890
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SINK_TABLE_GET_NUMBER_OF_ACTIVE_ENTRIES);
6891
+ const sendStatus = await this.sendCommand(sendBuffalo);
6887
6892
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6888
6893
  throw new ezspError_1.EzspError(sendStatus);
6889
6894
  }
@@ -6898,8 +6903,8 @@ class Ezsp extends events_1.default {
6898
6903
  * @returns uint8_t Total number of tokens.
6899
6904
  */
6900
6905
  async ezspGetTokenCount() {
6901
- this.startCommand(enums_2.EzspFrameID.GET_TOKEN_COUNT);
6902
- const sendStatus = await this.sendCommand();
6906
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_TOKEN_COUNT);
6907
+ const sendStatus = await this.sendCommand(sendBuffalo);
6903
6908
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6904
6909
  throw new ezspError_1.EzspError(sendStatus);
6905
6910
  }
@@ -6913,9 +6918,9 @@ class Ezsp extends events_1.default {
6913
6918
  * @returns EmberTokenInfo * Token information.
6914
6919
  */
6915
6920
  async ezspGetTokenInfo(index) {
6916
- this.startCommand(enums_2.EzspFrameID.GET_TOKEN_INFO);
6917
- this.buffalo.writeUInt8(index);
6918
- const sendStatus = await this.sendCommand();
6921
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_TOKEN_INFO);
6922
+ sendBuffalo.writeUInt8(index);
6923
+ const sendStatus = await this.sendCommand(sendBuffalo);
6919
6924
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6920
6925
  throw new ezspError_1.EzspError(sendStatus);
6921
6926
  }
@@ -6931,10 +6936,10 @@ class Ezsp extends events_1.default {
6931
6936
  * @returns EmberTokenData * Token Data
6932
6937
  */
6933
6938
  async ezspGetTokenData(token, index) {
6934
- this.startCommand(enums_2.EzspFrameID.GET_TOKEN_DATA);
6935
- this.buffalo.writeUInt32(token);
6936
- this.buffalo.writeUInt32(index);
6937
- const sendStatus = await this.sendCommand();
6939
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GET_TOKEN_DATA);
6940
+ sendBuffalo.writeUInt32(token);
6941
+ sendBuffalo.writeUInt32(index);
6942
+ const sendStatus = await this.sendCommand(sendBuffalo);
6938
6943
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6939
6944
  throw new ezspError_1.EzspError(sendStatus);
6940
6945
  }
@@ -6950,11 +6955,11 @@ class Ezsp extends events_1.default {
6950
6955
  * @returns An SLStatus value indicating success or the reason for failure.
6951
6956
  */
6952
6957
  async ezspSetTokenData(token, index, tokenData) {
6953
- this.startCommand(enums_2.EzspFrameID.SET_TOKEN_DATA);
6954
- this.buffalo.writeUInt32(token);
6955
- this.buffalo.writeUInt32(index);
6956
- this.buffalo.writeEmberTokenData(tokenData);
6957
- const sendStatus = await this.sendCommand();
6958
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.SET_TOKEN_DATA);
6959
+ sendBuffalo.writeUInt32(token);
6960
+ sendBuffalo.writeUInt32(index);
6961
+ sendBuffalo.writeEmberTokenData(tokenData);
6962
+ const sendStatus = await this.sendCommand(sendBuffalo);
6958
6963
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6959
6964
  throw new ezspError_1.EzspError(sendStatus);
6960
6965
  }
@@ -6965,8 +6970,8 @@ class Ezsp extends events_1.default {
6965
6970
  * Reset the node by calling halReboot.
6966
6971
  */
6967
6972
  async ezspResetNode() {
6968
- this.startCommand(enums_2.EzspFrameID.RESET_NODE);
6969
- const sendStatus = await this.sendCommand();
6973
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.RESET_NODE);
6974
+ const sendStatus = await this.sendCommand(sendBuffalo);
6970
6975
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6971
6976
  throw new ezspError_1.EzspError(sendStatus);
6972
6977
  }
@@ -6976,8 +6981,8 @@ class Ezsp extends events_1.default {
6976
6981
  * @returns An SLStatus value indicating success or the reason for failure.
6977
6982
  */
6978
6983
  async ezspGpSecurityTestVectors() {
6979
- this.startCommand(enums_2.EzspFrameID.GP_SECURITY_TEST_VECTORS);
6980
- const sendStatus = await this.sendCommand();
6984
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.GP_SECURITY_TEST_VECTORS);
6985
+ const sendStatus = await this.sendCommand(sendBuffalo);
6981
6986
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6982
6987
  throw new ezspError_1.EzspError(sendStatus);
6983
6988
  }
@@ -6990,10 +6995,10 @@ class Ezsp extends events_1.default {
6990
6995
  * @param excludeBootCounter Exclude stack boot counter token.
6991
6996
  */
6992
6997
  async ezspTokenFactoryReset(excludeOutgoingFC, excludeBootCounter) {
6993
- this.startCommand(enums_2.EzspFrameID.TOKEN_FACTORY_RESET);
6994
- this.buffalo.writeUInt8(excludeOutgoingFC ? 1 : 0);
6995
- this.buffalo.writeUInt8(excludeBootCounter ? 1 : 0);
6996
- const sendStatus = await this.sendCommand();
6998
+ const sendBuffalo = this.startCommand(enums_2.EzspFrameID.TOKEN_FACTORY_RESET);
6999
+ sendBuffalo.writeUInt8(excludeOutgoingFC ? 1 : 0);
7000
+ sendBuffalo.writeUInt8(excludeBootCounter ? 1 : 0);
7001
+ const sendStatus = await this.sendCommand(sendBuffalo);
6997
7002
  if (sendStatus !== enums_1.EzspStatus.SUCCESS) {
6998
7003
  throw new ezspError_1.EzspError(sendStatus);
6999
7004
  }