zigbee-herdsman 0.33.9 → 0.34.2

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 (122) hide show
  1. package/.github/workflows/ci.yml +2 -2
  2. package/.release-please-manifest.json +1 -1
  3. package/CHANGELOG.md +27 -0
  4. package/dist/adapter/adapter.d.ts.map +1 -1
  5. package/dist/adapter/adapter.js +2 -1
  6. package/dist/adapter/adapter.js.map +1 -1
  7. package/dist/adapter/ember/adapter/emberAdapter.d.ts +818 -0
  8. package/dist/adapter/ember/adapter/emberAdapter.d.ts.map +1 -0
  9. package/dist/adapter/ember/adapter/emberAdapter.js +2991 -0
  10. package/dist/adapter/ember/adapter/emberAdapter.js.map +1 -0
  11. package/dist/adapter/ember/adapter/endpoints.d.ts +25 -0
  12. package/dist/adapter/ember/adapter/endpoints.d.ts.map +1 -0
  13. package/dist/adapter/ember/adapter/endpoints.js +66 -0
  14. package/dist/adapter/ember/adapter/endpoints.js.map +1 -0
  15. package/dist/adapter/ember/adapter/index.d.ts +3 -0
  16. package/dist/adapter/ember/adapter/index.d.ts.map +1 -0
  17. package/dist/adapter/ember/adapter/index.js +6 -0
  18. package/dist/adapter/ember/adapter/index.js.map +1 -0
  19. package/dist/adapter/ember/adapter/oneWaitress.d.ts +97 -0
  20. package/dist/adapter/ember/adapter/oneWaitress.d.ts.map +1 -0
  21. package/dist/adapter/ember/adapter/oneWaitress.js +226 -0
  22. package/dist/adapter/ember/adapter/oneWaitress.js.map +1 -0
  23. package/dist/adapter/ember/adapter/requestQueue.d.ts +59 -0
  24. package/dist/adapter/ember/adapter/requestQueue.d.ts.map +1 -0
  25. package/dist/adapter/ember/adapter/requestQueue.js +144 -0
  26. package/dist/adapter/ember/adapter/requestQueue.js.map +1 -0
  27. package/dist/adapter/ember/adapter/tokensManager.d.ts +69 -0
  28. package/dist/adapter/ember/adapter/tokensManager.d.ts.map +1 -0
  29. package/dist/adapter/ember/adapter/tokensManager.js +685 -0
  30. package/dist/adapter/ember/adapter/tokensManager.js.map +1 -0
  31. package/dist/adapter/ember/consts.d.ts +198 -0
  32. package/dist/adapter/ember/consts.d.ts.map +1 -0
  33. package/dist/adapter/ember/consts.js +253 -0
  34. package/dist/adapter/ember/consts.js.map +1 -0
  35. package/dist/adapter/ember/enums.d.ts +2184 -0
  36. package/dist/adapter/ember/enums.d.ts.map +1 -0
  37. package/dist/adapter/ember/enums.js +2391 -0
  38. package/dist/adapter/ember/enums.js.map +1 -0
  39. package/dist/adapter/ember/ezsp/buffalo.d.ts +156 -0
  40. package/dist/adapter/ember/ezsp/buffalo.d.ts.map +1 -0
  41. package/dist/adapter/ember/ezsp/buffalo.js +1033 -0
  42. package/dist/adapter/ember/ezsp/buffalo.js.map +1 -0
  43. package/dist/adapter/ember/ezsp/consts.d.ts +116 -0
  44. package/dist/adapter/ember/ezsp/consts.d.ts.map +1 -0
  45. package/dist/adapter/ember/ezsp/consts.js +128 -0
  46. package/dist/adapter/ember/ezsp/consts.js.map +1 -0
  47. package/dist/adapter/ember/ezsp/enums.d.ts +879 -0
  48. package/dist/adapter/ember/ezsp/enums.d.ts.map +1 -0
  49. package/dist/adapter/ember/ezsp/enums.js +948 -0
  50. package/dist/adapter/ember/ezsp/enums.js.map +1 -0
  51. package/dist/adapter/ember/ezsp/ezsp.d.ts +2664 -0
  52. package/dist/adapter/ember/ezsp/ezsp.d.ts.map +1 -0
  53. package/dist/adapter/ember/ezsp/ezsp.js +6449 -0
  54. package/dist/adapter/ember/ezsp/ezsp.js.map +1 -0
  55. package/dist/adapter/ember/types.d.ts +733 -0
  56. package/dist/adapter/ember/types.d.ts.map +1 -0
  57. package/dist/adapter/ember/types.js +3 -0
  58. package/dist/adapter/ember/types.js.map +1 -0
  59. package/dist/adapter/ember/uart/ash.d.ts +443 -0
  60. package/dist/adapter/ember/uart/ash.d.ts.map +1 -0
  61. package/dist/adapter/ember/uart/ash.js +1567 -0
  62. package/dist/adapter/ember/uart/ash.js.map +1 -0
  63. package/dist/adapter/ember/uart/consts.d.ts +91 -0
  64. package/dist/adapter/ember/uart/consts.d.ts.map +1 -0
  65. package/dist/adapter/ember/uart/consts.js +100 -0
  66. package/dist/adapter/ember/uart/consts.js.map +1 -0
  67. package/dist/adapter/ember/uart/enums.d.ts +191 -0
  68. package/dist/adapter/ember/uart/enums.d.ts.map +1 -0
  69. package/dist/adapter/ember/uart/enums.js +197 -0
  70. package/dist/adapter/ember/uart/enums.js.map +1 -0
  71. package/dist/adapter/ember/uart/parser.d.ts +10 -0
  72. package/dist/adapter/ember/uart/parser.d.ts.map +1 -0
  73. package/dist/adapter/ember/uart/parser.js +41 -0
  74. package/dist/adapter/ember/uart/parser.js.map +1 -0
  75. package/dist/adapter/ember/uart/queues.d.ts +85 -0
  76. package/dist/adapter/ember/uart/queues.d.ts.map +1 -0
  77. package/dist/adapter/ember/uart/queues.js +212 -0
  78. package/dist/adapter/ember/uart/queues.js.map +1 -0
  79. package/dist/adapter/ember/uart/writer.d.ts +15 -0
  80. package/dist/adapter/ember/uart/writer.d.ts.map +1 -0
  81. package/dist/adapter/ember/uart/writer.js +48 -0
  82. package/dist/adapter/ember/uart/writer.js.map +1 -0
  83. package/dist/adapter/ember/utils/initters.d.ts +20 -0
  84. package/dist/adapter/ember/utils/initters.d.ts.map +1 -0
  85. package/dist/adapter/ember/utils/initters.js +58 -0
  86. package/dist/adapter/ember/utils/initters.js.map +1 -0
  87. package/dist/adapter/ember/utils/math.d.ts +51 -0
  88. package/dist/adapter/ember/utils/math.d.ts.map +1 -0
  89. package/dist/adapter/ember/utils/math.js +102 -0
  90. package/dist/adapter/ember/utils/math.js.map +1 -0
  91. package/dist/adapter/ember/zdo.d.ts +921 -0
  92. package/dist/adapter/ember/zdo.d.ts.map +1 -0
  93. package/dist/adapter/ember/zdo.js +723 -0
  94. package/dist/adapter/ember/zdo.js.map +1 -0
  95. package/dist/adapter/ezsp/adapter/ezspAdapter.d.ts.map +1 -1
  96. package/dist/adapter/ezsp/adapter/ezspAdapter.js +28 -22
  97. package/dist/adapter/ezsp/adapter/ezspAdapter.js.map +1 -1
  98. package/dist/adapter/ezsp/driver/driver.d.ts +1 -2
  99. package/dist/adapter/ezsp/driver/driver.d.ts.map +1 -1
  100. package/dist/adapter/ezsp/driver/driver.js +21 -21
  101. package/dist/adapter/ezsp/driver/driver.js.map +1 -1
  102. package/dist/adapter/ezsp/driver/ezsp.d.ts +2 -0
  103. package/dist/adapter/ezsp/driver/ezsp.d.ts.map +1 -1
  104. package/dist/adapter/ezsp/driver/ezsp.js +24 -5
  105. package/dist/adapter/ezsp/driver/ezsp.js.map +1 -1
  106. package/dist/adapter/ezsp/driver/parser.d.ts +1 -2
  107. package/dist/adapter/ezsp/driver/parser.d.ts.map +1 -1
  108. package/dist/adapter/ezsp/driver/parser.js +29 -40
  109. package/dist/adapter/ezsp/driver/parser.js.map +1 -1
  110. package/dist/adapter/ezsp/driver/uart.d.ts +1 -0
  111. package/dist/adapter/ezsp/driver/uart.d.ts.map +1 -1
  112. package/dist/adapter/ezsp/driver/uart.js +38 -13
  113. package/dist/adapter/ezsp/driver/uart.js.map +1 -1
  114. package/dist/adapter/ezsp/driver/writer.d.ts.map +1 -1
  115. package/dist/adapter/ezsp/driver/writer.js +10 -13
  116. package/dist/adapter/ezsp/driver/writer.js.map +1 -1
  117. package/dist/adapter/tstype.d.ts +1 -1
  118. package/dist/adapter/tstype.d.ts.map +1 -1
  119. package/dist/utils/backup.d.ts.map +1 -1
  120. package/dist/utils/backup.js +4 -0
  121. package/dist/utils/backup.js.map +1 -1
  122. package/package.json +1 -1
@@ -0,0 +1,818 @@
1
+ /// <reference types="node" />
2
+ import { Adapter, TsType } from "../..";
3
+ import { LoggerStub } from "../../../controller/logger-stub";
4
+ import { Backup } from "../../../models";
5
+ import { FrameType, Direction, ZclFrame } from "../../../zcl";
6
+ import { ZclDataPayload } from "../../events";
7
+ import { EmberNetworkStatus } from "../enums";
8
+ import { EmberEUI64, EmberExtendedPanId, EmberKeyData, EmberNetworkParameters, EmberNodeId, EmberPanId } from "../types";
9
+ export type NetworkCache = {
10
+ eui64: EmberEUI64;
11
+ parameters: EmberNetworkParameters;
12
+ status: EmberNetworkStatus;
13
+ };
14
+ /**
15
+ * Use for a link key backup.
16
+ *
17
+ * Each entry notes the EUI64 of the device it is paired to and the key data.
18
+ * This key may be hashed and not the actual link key currently in use.
19
+ */
20
+ type LinkKeyBackupData = {
21
+ deviceEui64: EmberEUI64;
22
+ key: EmberKeyData;
23
+ outgoingFrameCounter: number;
24
+ incomingFrameCounter: number;
25
+ };
26
+ /**
27
+ * Relay calls between Z2M and EZSP-layer and handle any error that might occur via queue & waitress.
28
+ *
29
+ * Anything post `start` that requests anything from the EZSP layer must run through the request queue for proper execution flow.
30
+ */
31
+ export declare class EmberAdapter extends Adapter {
32
+ /** Key in STACK_CONFIGS */
33
+ readonly stackConfig: 'default' | 'zigbeed';
34
+ /** EMBER_LOW_RAM_CONCENTRATOR or EMBER_HIGH_RAM_CONCENTRATOR. */
35
+ private concentratorType;
36
+ private readonly ezsp;
37
+ private version;
38
+ private requestQueue;
39
+ private oneWaitress;
40
+ /** Periodically retrieve counters then clear them. */
41
+ private watchdogCountersHandle;
42
+ /** Hold ZDO request in process. */
43
+ private zdoRequestBuffalo;
44
+ /** Sequence number used for ZDO requests. static uint8_t */
45
+ private zdoRequestSequence;
46
+ /** Default radius used for broadcast ZDO requests. uint8_t */
47
+ private zdoRequestRadius;
48
+ private interpanLock;
49
+ /**
50
+ * Cached network params to avoid NCP calls. Prevents frequent EZSP transactions.
51
+ * NOTE: Do not use directly, use getter functions for it that check if valid or need retrieval from NCP.
52
+ */
53
+ private networkCache;
54
+ private defaultApsOptions;
55
+ /**
56
+ * Mirrors the NCP multicast table. null === not in use.
57
+ * Index 0 is Green Power and must always remain there.
58
+ */
59
+ private multicastTable;
60
+ constructor(networkOptions: TsType.NetworkOptions, serialPortOptions: TsType.SerialPortOptions, backupPath: string, adapterOptions: TsType.AdapterOptions, logger?: LoggerStub);
61
+ /**
62
+ * Emitted from @see Ezsp.ezspStackStatusHandler
63
+ * @param status
64
+ */
65
+ private onStackStatus;
66
+ /**
67
+ * Emitted from @see Ezsp.ezspMessageSentHandler
68
+ * WARNING: Cannot rely on `ezspMessageSentHandler` > `ezspIncomingMessageHandler` order, some devices mix it up!
69
+ *
70
+ * @param type
71
+ * @param indexOrDestination
72
+ * @param apsFrame
73
+ * @param messageTag
74
+ */
75
+ private onMessageSentDeliveryFailed;
76
+ /**
77
+ * Emitted from @see Ezsp.ezspIncomingMessageHandler
78
+ *
79
+ * @param clusterId The ZDO response cluster ID.
80
+ * @param sender The sender of the response. Should match `payload.nodeId` in many responses.
81
+ * @param payload If null, the response indicated a failure.
82
+ */
83
+ private onZDOResponse;
84
+ /**
85
+ * Emitted from @see Ezsp.ezspIncomingMessageHandler
86
+ *
87
+ * @param sender
88
+ * @param nodeId
89
+ * @param eui64
90
+ * @param macCapFlags
91
+ */
92
+ private onEndDeviceAnnounce;
93
+ /**
94
+ * Emitted from @see Ezsp.ezspIncomingMessageHandler
95
+ *
96
+ * @param type
97
+ * @param apsFrame
98
+ * @param lastHopLqi
99
+ * @param sender
100
+ * @param messageContents
101
+ */
102
+ private onIncomingMessage;
103
+ /**
104
+ * Emitted from @see Ezsp.ezspMacFilterMatchMessageHandler when the message is a valid InterPAN touchlink message.
105
+ *
106
+ * @param sourcePanId
107
+ * @param sourceAddress
108
+ * @param groupId
109
+ * @param lastHopLqi
110
+ * @param messageContents
111
+ */
112
+ private onTouchlinkMessage;
113
+ /**
114
+ * Emitted from @see Ezsp.ezspGpepIncomingMessageHandler
115
+ *
116
+ * @param sender uint32_t or EmberEUI64 depending on `EmberGpApplicationId`. See emitter
117
+ * @param gpdCommandId
118
+ * @param gpdLink
119
+ * @param sequenceNumber
120
+ * @param deviceId
121
+ * @param options
122
+ * @param key
123
+ * @param counter
124
+ */
125
+ private onGreenpowerMessage;
126
+ /**
127
+ * Emitted from @see Ezsp.ezspTrustCenterJoinHandler
128
+ *
129
+ * @param newNodeId
130
+ * @param newNodeEui64
131
+ * @param status
132
+ * @param policyDecision
133
+ * @param parentOfNewNodeId
134
+ */
135
+ private onTrustCenterJoin;
136
+ private watchdogCounters;
137
+ private initVariables;
138
+ /**
139
+ * Proceed to execute the long list of commands required to setup comms between Host<>NCP.
140
+ * This is called by start and on internal reset.
141
+ */
142
+ private initEzsp;
143
+ /**
144
+ * NCP Config init. Should always be called first in the init stack (after version cmd).
145
+ * @returns
146
+ */
147
+ private initNCPPreConfiguration;
148
+ /**
149
+ * NCP Address table init.
150
+ * @returns
151
+ */
152
+ private initNCPAddressTable;
153
+ /**
154
+ * NCP configuration init
155
+ */
156
+ private initNCPConfiguration;
157
+ /**
158
+ * NCP concentrator init. Also enables source route discovery mode with RESCHEDULE.
159
+ *
160
+ * From AN1233:
161
+ * To function correctly in a Zigbee PRO network, a trust center also requires that:
162
+ *
163
+ * 1. The trust center application must act as a concentrator (either high or low RAM).
164
+ * 2. The trust center application must have support for source routing.
165
+ * It must record the source routes and properly handle requests by the stack for a particular source route.
166
+ * 3. The trust center application must use an address cache for security, in order to maintain a mapping of IEEE address to short ID.
167
+ *
168
+ * Failure to satisfy all of the above requirements may result in failures when joining/rejoining devices to the network across multiple hops
169
+ * (through a target node that is neither the trust center nor one of its neighboring routers.)
170
+ */
171
+ private initNCPConcentrator;
172
+ /**
173
+ * Register fixed endpoints and set any related multicast entries that need to be.
174
+ */
175
+ private registerFixedEndpoints;
176
+ /**
177
+ *
178
+ * @returns True if the network needed to be formed.
179
+ */
180
+ private initTrustCenter;
181
+ /**
182
+ * Form a network using given parameters.
183
+ */
184
+ private formNetwork;
185
+ /**
186
+ * Loads currently stored backup and returns it in internal backup model.
187
+ */
188
+ getStoredBackup(): Promise<Backup>;
189
+ /**
190
+ * Export link keys for backup.
191
+ *
192
+ * @return List of keys data with AES hashed keys
193
+ */
194
+ exportLinkKeys(): Promise<LinkKeyBackupData[]>;
195
+ /**
196
+ * Import link keys from backup.
197
+ *
198
+ * @param backupData
199
+ */
200
+ importLinkKeys(backupData: LinkKeyBackupData[]): Promise<void>;
201
+ /**
202
+ * Routine to update the network key and broadcast the update to the network after a set time.
203
+ * NOTE: This should run at a large interval, but before the uint32_t of the frame counter is able to reach all Fs (can't wrap to 0).
204
+ * This may disrupt sleepy end devices that miss the update, but they should be able to TC rejoin (in most cases...).
205
+ * On the other hand, the more often this runs, the more secure the network is...
206
+ */
207
+ private broadcastNetworkKeyUpdate;
208
+ /**
209
+ * Received when EZSP layer alerts of a problem that needs the NCP to be reset.
210
+ * @param status
211
+ */
212
+ private onNcpNeedsResetAndInit;
213
+ /**
214
+ * Called right before a NCP reset.
215
+ */
216
+ private onNCPPreReset;
217
+ /**
218
+ * Called right after a NCP reset, right before the creation of endpoints.
219
+ */
220
+ private onNCPPostReset;
221
+ /**
222
+ * Handle changes in groups that needs to be propagated to the NCP multicast table.
223
+ *
224
+ * XXX: Since Z2M doesn't explicitly check-in downstream when groups are created/removed, we look at outgoing genGroups commands.
225
+ * If the NCP doesn't know about groups, it can miss messages from some devices (remotes for example), so we add it...
226
+ *
227
+ * @param commandId
228
+ * @param groupId
229
+ */
230
+ private onGroupChange;
231
+ /**
232
+ * Clear the cached network values (set to invalid values).
233
+ */
234
+ private clearNetworkCache;
235
+ /**
236
+ * Return the current network state.
237
+ * This call caches the results on the host to prevent frequent EZSP transactions.
238
+ * Check against UNKNOWN_NETWORK_STATE for validity.
239
+ */
240
+ emberNetworkState(): Promise<EmberNetworkStatus>;
241
+ /**
242
+ * Return the EUI 64 of the local node
243
+ * This call caches the results on the host to prevent frequent EZSP transactions.
244
+ * Check against BLANK_EUI64 for validity.
245
+ */
246
+ emberGetEui64(): Promise<EmberEUI64>;
247
+ /**
248
+ * Return the PAN ID of the local node.
249
+ * This call caches the results on the host to prevent frequent EZSP transactions.
250
+ * Check against INVALID_PAN_ID for validity.
251
+ */
252
+ emberGetPanId(): Promise<EmberPanId>;
253
+ /**
254
+ * Return the Extended PAN ID of the local node.
255
+ * This call caches the results on the host to prevent frequent EZSP transactions.
256
+ * Check against BLANK_EXTENDED_PAN_ID for validity.
257
+ */
258
+ emberGetExtendedPanId(): Promise<EmberExtendedPanId>;
259
+ /**
260
+ * Return the radio channel (uint8_t) of the current network.
261
+ * This call caches the results on the host to prevent frequent EZSP transactions.
262
+ * Check against INVALID_RADIO_CHANNEL for validity.
263
+ */
264
+ emberGetRadioChannel(): Promise<number>;
265
+ emberStartEnergyScan(): Promise<void>;
266
+ /**
267
+ * Ensure the Host & NCP are aligned on protocols using version.
268
+ * Cache the retrieved information.
269
+ *
270
+ * NOTE: currently throws on mismatch until support for lower versions is implemented (not planned atm)
271
+ *
272
+ * Does nothing if ncpNeedsResetAndInit == true.
273
+ */
274
+ private emberVersion;
275
+ /**
276
+ * This function sets an EZSP config value.
277
+ * WARNING: Do not call for values that cannot be set after init without first resetting NCP (like table sizes).
278
+ * To avoid an extra NCP call, this does not check for it.
279
+ * @param configId
280
+ * @param value uint16_t
281
+ * @returns
282
+ */
283
+ private emberSetEzspConfigValue;
284
+ /**
285
+ * This function sets an EZSP value.
286
+ * @param valueId
287
+ * @param valueLength uint8_t
288
+ * @param value uint8_t *
289
+ * @returns
290
+ */
291
+ private emberSetEzspValue;
292
+ /**
293
+ * This function sets an EZSP policy.
294
+ * @param policyId
295
+ * @param decisionId Can be bitop
296
+ * @returns
297
+ */
298
+ private emberSetEzspPolicy;
299
+ /**
300
+ * Here we convert the normal Ember AES hash call to the specialized EZSP call.
301
+ * This came about because we cannot pass a block of data that is
302
+ * both input and output into EZSP. The block must be broken up into two
303
+ * elements. We unify the two pieces here to make it invisible to the users.
304
+ * @param context EmberAesMmoHashContext *
305
+ * @param finalize
306
+ * @param data uint8_t * Expected of valid length (as in, not larger alloc)
307
+ * @returns status
308
+ * @returns result context or null
309
+ */
310
+ private aesMmoHash;
311
+ /**
312
+ * This routine processes the passed chunk of data and updates
313
+ * the hash calculation based on it. The data passed in MUST
314
+ * have a length that is a multiple of 16.
315
+ *
316
+ * @param context EmberAesMmoHashContext* A pointer to the location of the hash context to update.
317
+ * @param data const uint8_t* A pointer to the location of the data to hash.
318
+ *
319
+ * @returns An ::EmberStatus value indicating EMBER_SUCCESS if the hash was
320
+ * calculated successfully. EMBER_INVALID_CALL if the block size is not a
321
+ * multiple of 16 bytes, and EMBER_INDEX_OUT_OF_RANGE is returned when the
322
+ * data exceeds the maximum limits of the hash function.
323
+ * @returns result context or null
324
+ */
325
+ private emberAesMmoHashUpdate;
326
+ /**
327
+ * This routine processes the passed chunk of data (if non-NULL)
328
+ * and update the hash context that is passed in. In then performs
329
+ * the final calculations on the hash and returns the final answer
330
+ * in the result parameter of the ::EmberAesMmoHashContext structure.
331
+ * The length of the data passed in may be any value, it does not have
332
+ * to be a multiple of 16.
333
+ *
334
+ * @param context EmberAesMmoHashContext * A pointer to the location of the hash context to finalize.
335
+ * @param data uint8_t * A pointer to the location of data to hash. May be NULL.
336
+ *
337
+ * @returns An ::EmberStatus value indicating EMBER_SUCCESS if the hash was
338
+ * calculated successfully. EMBER_INVALID_CALL if the block size is not a
339
+ * multiple of 16 bytes, and EMBER_INDEX_OUT_OF_RANGE is returned when the
340
+ * data exceeds the maximum limits of the hash function.
341
+ * @returns result context or null
342
+ */
343
+ private emberAesMmoHashFinal;
344
+ /**
345
+ * This is a convenience method when the hash data is less than 255
346
+ * bytes. It inits, updates, and finalizes the hash in one function call.
347
+ *
348
+ * @param data const uint8_t* The data to hash. Expected of valid length (as in, not larger alloc)
349
+ *
350
+ * @returns An ::EmberStatus value indicating EMBER_SUCCESS if the hash was
351
+ * calculated successfully. EMBER_INVALID_CALL if the block size is not a
352
+ * multiple of 16 bytes, and EMBER_INDEX_OUT_OF_RANGE is returned when the
353
+ * data exceeds the maximum limits of the hash function.
354
+ * @returns result uint8_t* The location where the result of the hash will be written.
355
+ */
356
+ private emberAesHashSimple;
357
+ /**
358
+ * Enable local permit join and optionally broadcast the ZDO Mgmt_Permit_Join_req message.
359
+ * This API can be called from any device type and still return EMBER_SUCCESS.
360
+ * If the API is called from an end device, the permit association bit will just be left off.
361
+ *
362
+ * @param duration uint8_t The duration that the permit join bit will remain on
363
+ * and other devices will be able to join the current network.
364
+ * @param broadcastMgmtPermitJoin whether or not to broadcast the ZDO Mgmt_Permit_Join_req message.
365
+ *
366
+ * @returns status of whether or not permit join was enabled.
367
+ * @returns apsFrame Will be null if not broadcasting.
368
+ * @returns messageTag The tag passed to ezspSend${x} function.
369
+ */
370
+ private emberPermitJoining;
371
+ /**
372
+ * Set the trust center policy bitmask using decision.
373
+ * @param decision
374
+ * @returns
375
+ */
376
+ private emberSetJoinPolicy;
377
+ /**
378
+ * Get Source Route Overhead
379
+ *
380
+ * Returns the number of bytes needed in a packet for source routing.
381
+ * Since each hop consumes 2 bytes in the packet, this routine calculates the
382
+ * total number of bytes needed based on number of hops to reach the destination.
383
+ *
384
+ * This function is called by the framework to determine the overhead required
385
+ * in the network frame for source routing to a particular destination.
386
+ *
387
+ * @param destination The node id of the destination Ver.: always
388
+ * @returns int8u The number of bytes needed for source routing in a packet.
389
+ */
390
+ emberGetSourceRouteOverhead(destination: EmberNodeId): Promise<number>;
391
+ /**
392
+ * Return the maximum size of the payload that the Application Support sub-layer will accept for
393
+ * the given message type, destination, and APS frame.
394
+ *
395
+ * The size depends on multiple factors, including the security level in use and additional information
396
+ * added to the message to support the various options.
397
+ *
398
+ * @param type The outgoing message type.
399
+ * @param indexOrDestination uint16_t Depending on the message type, this is either the
400
+ * EmberNodeId of the destination, an index into the address table, an index
401
+ * into the binding table, the multicast identifier, or a broadcast address.
402
+ * @param apsFrame EmberApsFrame *The APS frame for the message.
403
+ * @return uint8_t The maximum APS payload length for the given message.
404
+ */
405
+ private maximumApsPayloadLength;
406
+ /**
407
+ * ZDO
408
+ * Change the default radius for broadcast ZDO requests
409
+ *
410
+ * @param radius uint8_t The radius to be used for future ZDO request broadcasts.
411
+ */
412
+ private setZDORequestRadius;
413
+ /**
414
+ * ZDO
415
+ * Retrieve the default radius for broadcast ZDO requests
416
+ *
417
+ * @return uint8_t The radius to be used for future ZDO request broadcasts.
418
+ */
419
+ private getZDORequestRadius;
420
+ /**
421
+ * ZDO
422
+ * Get the next device request sequence number.
423
+ *
424
+ * Requests have sequence numbers so that they can be matched up with the
425
+ * responses. To avoid complexities, the library uses numbers with the high
426
+ * bit clear and the stack uses numbers with the high bit set.
427
+ *
428
+ * @return uint8_t The next device request sequence number
429
+ */
430
+ private nextZDORequestSequence;
431
+ /**
432
+ * ZDO
433
+ *
434
+ * @param destination
435
+ * @param clusterId uint16_t
436
+ * @param options
437
+ * @param length uint8_t
438
+ * @returns status Indicates success or failure (with reason) of send
439
+ * @returns apsFrame The APS Frame resulting of the request being built and sent (`sequence` set from stack-given value).
440
+ * @returns messageTag The tag passed to ezspSend${x} function.
441
+ */
442
+ private sendZDORequestBuffer;
443
+ /**
444
+ * ZDO
445
+ * Service Discovery Functions
446
+ * Request the specified node to send a list of its endpoints that
447
+ * match the specified application profile and, optionally, lists of input
448
+ * and/or output clusters.
449
+ * @param target The node whose matching endpoints are desired. The request can
450
+ * be sent unicast or broadcast ONLY to the "RX-on-when-idle-address" (0xFFFD)
451
+ * If sent as a broadcast, any node that has matching endpoints will send a
452
+ * response.
453
+ * @param profile uint16_t The application profile to match.
454
+ * @param inCount uint8_t The number of input clusters. To not match any input
455
+ * clusters, set this value to 0.
456
+ * @param outCount uint8_t The number of output clusters. To not match any output
457
+ * clusters, set this value to 0.
458
+ * @param inClusters uint16_t * The list of input clusters.
459
+ * @param outClusters uint16_t * The list of output clusters.
460
+ * @param options The options to use when sending the unicast request. See
461
+ * emberSendUnicast() for a description. This parameter is ignored if the target
462
+ * is a broadcast address.
463
+ * @returns An EmberStatus value. EMBER_SUCCESS, MESSAGE_TOO_LONG,
464
+ * EMBER_NETWORK_DOWN or EMBER_NETWORK_BUSY.
465
+ */
466
+ private emberMatchDescriptorsRequest;
467
+ /**
468
+ * ZDO
469
+ * Device Discovery Functions
470
+ * Request the 16 bit network address of a node whose EUI64 is known.
471
+ *
472
+ * @param target The EUI64 of the node.
473
+ * @param reportKids true to request that the target list their children
474
+ * in the response.
475
+ * @param childStartIndex uint8_t The index of the first child to list in the response.
476
+ * Ignored if @c reportKids is false.
477
+ *
478
+ * @return An ::EmberStatus value.
479
+ * - ::EMBER_SUCCESS - The request was transmitted successfully.
480
+ * - ::EMBER_NO_BUFFERS - Insufficient message buffers were available to construct the request.
481
+ * - ::EMBER_NETWORK_DOWN - The node is not part of a network.
482
+ * - ::EMBER_NETWORK_BUSY - Transmission of the request failed.
483
+ */
484
+ private emberNetworkAddressRequest;
485
+ /**
486
+ * ZDO
487
+ * Device Discovery Functions
488
+ * @brief Request the EUI64 of a node whose 16 bit network address is known.
489
+ *
490
+ * @param target uint16_t The network address of the node.
491
+ * @param reportKids uint8_t true to request that the target list their children
492
+ * in the response.
493
+ * @param childStartIndex uint8_t The index of the first child to list in the response.
494
+ * Ignored if reportKids is false.
495
+ * @param options The options to use when sending the request. See ::emberSendUnicast() for a description.
496
+ *
497
+ * @return An ::EmberStatus value.
498
+ * - ::EMBER_SUCCESS
499
+ * - ::EMBER_NO_BUFFERS
500
+ * - ::EMBER_NETWORK_DOWN
501
+ * - ::EMBER_NETWORK_BUSY
502
+ */
503
+ private emberIeeeAddressRequest;
504
+ /**
505
+ * ZDO
506
+ * @param discoveryNodeId uint16_t
507
+ * @param reportKids uint8_t
508
+ * @param childStartIndex uint8_t
509
+ * @param options
510
+ * @param targetNodeIdOfRequest
511
+ */
512
+ private emberIeeeAddressRequestToTarget;
513
+ /**
514
+ * ZDO
515
+ *
516
+ * @param target uint16_t
517
+ * @param clusterId uint16_t
518
+ * @param options
519
+ * @returns
520
+ */
521
+ private emberSendZigDevRequestTarget;
522
+ /**
523
+ * ZDO
524
+ * @brief Request the specified node to send the simple descriptor for
525
+ * the specified endpoint.
526
+ * The simple descriptor contains information specific
527
+ * to a single endpoint. It describes the application profile identifier,
528
+ * application device identifier, application device version, application flags,
529
+ * application input clusters and application output clusters. It is defined in
530
+ * the ZigBee Application Framework Specification.
531
+ *
532
+ * @param target uint16_t The node of interest.
533
+ * @param targetEndpoint uint8_t The endpoint on the target node whose simple
534
+ * descriptor is desired.
535
+ * @param options The options to use when sending the request. See
536
+ * emberSendUnicast() for a description.
537
+ *
538
+ * @return An EmberStatus value. ::EMBER_SUCCESS, ::EMBER_NO_BUFFERS,
539
+ * ::EMBER_NETWORK_DOWN or ::EMBER_NETWORK_BUSY.
540
+ */
541
+ private emberSimpleDescriptorRequest;
542
+ /**
543
+ * ZDO
544
+ * @brief Send a request to remove a binding entry with the specified
545
+ * contents from the specified node.
546
+ *
547
+ * @param target The node on which the binding will be removed.
548
+ * @param source The source EUI64 in the binding entry.
549
+ * @param sourceEndpoint The source endpoint in the binding entry.
550
+ * @param clusterId The cluster ID in the binding entry.
551
+ * @param type The type of binding, either ::UNICAST_BINDING,
552
+ * ::MULTICAST_BINDING, or ::UNICAST_MANY_TO_ONE_BINDING.
553
+ * ::UNICAST_MANY_TO_ONE_BINDING is an Ember-specific extension
554
+ * and should be used only when the target is an Ember device.
555
+ * @param destination The destination EUI64 in the binding entry for the
556
+ * ::UNICAST_BINDING or ::UNICAST_MANY_TO_ONE_BINDING.
557
+ * @param groupAddress The group address for the ::MULTICAST_BINDING.
558
+ * @param destinationEndpoint The destination endpoint in the binding entry for
559
+ * the ::UNICAST_BINDING or ::UNICAST_MANY_TO_ONE_BINDING.
560
+ * @param options The options to use when sending the request. See
561
+ * emberSendUnicast() for a description.
562
+ *
563
+ * @return An ::EmberStatus value.
564
+ * - ::EMBER_SUCCESS
565
+ * - ::EMBER_NO_BUFFERS
566
+ * _ ::EMBER_NETWORK_DOWN
567
+ * - ::EMBER_NETWORK_BUSY
568
+ * @param target
569
+ * @param bindClusterId
570
+ * @param source
571
+ * @param sourceEndpoint uint8_t
572
+ * @param clusterId uint16_t
573
+ * @param type uint8_t
574
+ * @param destination
575
+ * @param groupAddress uint16_t
576
+ * @param destinationEndpoint uint8_t
577
+ * @param options
578
+ */
579
+ private emberSendZigDevBindRequest;
580
+ /**
581
+ * ZDO
582
+ * Send a request to create a binding entry with the specified
583
+ * contents on the specified node.
584
+ *
585
+ * @param target The node on which the binding will be created.
586
+ * @param source The source EUI64 in the binding entry.
587
+ * @param sourceEndpoint The source endpoint in the binding entry.
588
+ * @param clusterId The cluster ID in the binding entry.
589
+ * @param type The type of binding, either ::UNICAST_BINDING,
590
+ * ::MULTICAST_BINDING, or ::UNICAST_MANY_TO_ONE_BINDING.
591
+ * ::UNICAST_MANY_TO_ONE_BINDING is an Ember-specific extension
592
+ * and should be used only when the target is an Ember device.
593
+ * @param destination The destination EUI64 in the binding entry for
594
+ * ::UNICAST_BINDING or ::UNICAST_MANY_TO_ONE_BINDING.
595
+ * @param groupAddress The group address for the ::MULTICAST_BINDING.
596
+ * @param destinationEndpoint The destination endpoint in the binding entry for
597
+ * the ::UNICAST_BINDING or ::UNICAST_MANY_TO_ONE_BINDING.
598
+ * @param options The options to use when sending the request. See
599
+ * emberSendUnicast() for a description.
600
+ *
601
+ * @return An EmberStatus value. ::EMBER_SUCCESS, ::EMBER_NO_BUFFERS,
602
+ * ::EMBER_NETWORK_DOWN or ::EMBER_NETWORK_BUSY.
603
+ */
604
+ private emberBindRequest;
605
+ /**
606
+ * ZDO
607
+ * Send a request to remove a binding entry with the specified
608
+ * contents from the specified node.
609
+ *
610
+ * @param target The node on which the binding will be removed.
611
+ * @param source The source EUI64 in the binding entry.
612
+ * @param sourceEndpoint uint8_t The source endpoint in the binding entry.
613
+ * @param clusterId uint16_t The cluster ID in the binding entry.
614
+ * @param type uint8_t The type of binding, either ::UNICAST_BINDING,
615
+ * ::MULTICAST_BINDING, or ::UNICAST_MANY_TO_ONE_BINDING.
616
+ * ::UNICAST_MANY_TO_ONE_BINDING is an Ember-specific extension
617
+ * and should be used only when the target is an Ember device.
618
+ * @param destination The destination EUI64 in the binding entry for the
619
+ * ::UNICAST_BINDING or ::UNICAST_MANY_TO_ONE_BINDING.
620
+ * @param groupAddress The group address for the ::MULTICAST_BINDING.
621
+ * @param destinationEndpoint uint8_t The destination endpoint in the binding entry for
622
+ * the ::UNICAST_BINDING or ::UNICAST_MANY_TO_ONE_BINDING.
623
+ * @param options The options to use when sending the request. See
624
+ * emberSendUnicast() for a description.
625
+ *
626
+ * @return An ::EmberStatus value.
627
+ * - ::EMBER_SUCCESS
628
+ * - ::EMBER_NO_BUFFERS
629
+ * _ ::EMBER_NETWORK_DOWN
630
+ * - ::EMBER_NETWORK_BUSY
631
+ */
632
+ private emberUnbindRequest;
633
+ /**
634
+ * ZDO
635
+ * Request the specified node to send a list of its active
636
+ * endpoints. An active endpoint is one for which a simple descriptor is
637
+ * available.
638
+ *
639
+ * @param target The node whose active endpoints are desired.
640
+ * @param options The options to use when sending the request. See
641
+ * emberSendUnicast() for a description.
642
+ *
643
+ * @return An EmberStatus value. ::EMBER_SUCCESS, ::EMBER_NO_BUFFERS,
644
+ * ::EMBER_NETWORK_DOWN or ::EMBER_NETWORK_BUSY.
645
+ */
646
+ private emberActiveEndpointsRequest;
647
+ /**
648
+ * ZDO
649
+ * Request the specified node to send its power descriptor.
650
+ * The power descriptor gives a dynamic indication of the power
651
+ * status of the node. It describes current power mode,
652
+ * available power sources, current power source and
653
+ * current power source level. It is defined in the ZigBee
654
+ * Application Framework Specification.
655
+ *
656
+ * @param target The node whose power descriptor is desired.
657
+ * @param options The options to use when sending the request. See
658
+ * emberSendUnicast() for a description.
659
+ *
660
+ * @return An EmberStatus value. ::EMBER_SUCCESS, ::EMBER_NO_BUFFERS,
661
+ * ::EMBER_NETWORK_DOWN or ::EMBER_NETWORK_BUSY.
662
+ */
663
+ private emberPowerDescriptorRequest;
664
+ /**
665
+ * ZDO
666
+ * Request the specified node to send its node descriptor.
667
+ * The node descriptor contains information about the capabilities of the ZigBee
668
+ * node. It describes logical type, APS flags, frequency band, MAC capabilities
669
+ * flags, manufacturer code and maximum buffer size. It is defined in the ZigBee
670
+ * Application Framework Specification.
671
+ *
672
+ * @param target The node whose node descriptor is desired.
673
+ * @param options The options to use when sending the request. See
674
+ * emberSendUnicast() for a description.
675
+ *
676
+ * @return An ::EmberStatus value. ::EMBER_SUCCESS, ::EMBER_NO_BUFFERS,
677
+ * ::EMBER_NETWORK_DOWN or ::EMBER_NETWORK_BUSY.
678
+ */
679
+ private emberNodeDescriptorRequest;
680
+ /**
681
+ * ZDO
682
+ * Request the specified node to send its LQI (neighbor) table.
683
+ * The response gives PAN ID, EUI64, node ID and cost for each neighbor. The
684
+ * EUI64 is only available if security is enabled. The other fields in the
685
+ * response are set to zero. The response format is defined in the ZigBee Device
686
+ * Profile Specification.
687
+ *
688
+ * @param target The node whose LQI table is desired.
689
+ * @param startIndex uint8_t The index of the first neighbor to include in the
690
+ * response.
691
+ * @param options The options to use when sending the request. See
692
+ * emberSendUnicast() for a description.
693
+ *
694
+ * @return An EmberStatus value. ::EMBER_SUCCESS, ::EMBER_NO_BUFFERS,
695
+ * ::EMBER_NETWORK_DOWN or ::EMBER_NETWORK_BUSY.
696
+ */
697
+ private emberLqiTableRequest;
698
+ /**
699
+ * ZDO
700
+ * Request the specified node to send its routing table.
701
+ * The response gives destination node ID, status and many-to-one flags,
702
+ * and the next hop node ID.
703
+ * The response format is defined in the ZigBee Device
704
+ * Profile Specification.
705
+ *
706
+ * @param target The node whose routing table is desired.
707
+ * @param startIndex uint8_t The index of the first route entry to include in the
708
+ * response.
709
+ * @param options The options to use when sending the request. See
710
+ * emberSendUnicast() for a description.
711
+ *
712
+ * @return An EmberStatus value. ::EMBER_SUCCESS, ::EMBER_NO_BUFFERS,
713
+ * ::EMBER_NETWORK_DOWN or ::EMBER_NETWORK_BUSY.
714
+ */
715
+ private emberRoutingTableRequest;
716
+ /**
717
+ * ZDO
718
+ * Request the specified node to send its nonvolatile bindings.
719
+ * The response gives source address, source endpoint, cluster ID, destination
720
+ * address and destination endpoint for each binding entry. The response format
721
+ * is defined in the ZigBee Device Profile Specification.
722
+ * Note that bindings that have the Ember-specific ::UNICAST_MANY_TO_ONE_BINDING
723
+ * type are reported as having the standard ::UNICAST_BINDING type.
724
+ *
725
+ * @param target The node whose binding table is desired.
726
+ * @param startIndex uint8_t The index of the first binding entry to include in the
727
+ * response.
728
+ * @param options The options to use when sending the request. See
729
+ * emberSendUnicast() for a description.
730
+ *
731
+ * @return An EmberStatus value. ::EMBER_SUCCESS, ::EMBER_NO_BUFFERS,
732
+ * ::EMBER_NETWORK_DOWN or ::EMBER_NETWORK_BUSY.
733
+ */
734
+ private emberBindingTableRequest;
735
+ /**
736
+ * ZDO
737
+ *
738
+ * @param clusterId uint16_t
739
+ * @param target
740
+ * @param startIndex uint8_t
741
+ * @param options
742
+ * @returns
743
+ */
744
+ private emberTableRequest;
745
+ /**
746
+ * ZDO
747
+ * Request the specified node to remove the specified device from
748
+ * the network. The device to be removed must be the node to which the request
749
+ * is sent or one of its children.
750
+ *
751
+ * @param target The node which will remove the device.
752
+ * @param deviceAddress All zeros if the target is to remove itself from
753
+ * the network or the EUI64 of a child of the target device to remove
754
+ * that child.
755
+ * @param leaveRequestFlags uint8_t A bitmask of leave options.
756
+ * Include ::AND_REJOIN if the target is to rejoin the network immediately after leaving.
757
+ * @param options The options to use when sending the request. See
758
+ * emberSendUnicast() for a description.
759
+ *
760
+ * @return An EmberStatus value. ::EMBER_SUCCESS, ::EMBER_NO_BUFFERS,
761
+ * ::EMBER_NETWORK_DOWN or ::EMBER_NETWORK_BUSY.
762
+ */
763
+ private emberLeaveRequest;
764
+ /**
765
+ * ZDO
766
+ * Request the specified node to allow or disallow association.
767
+ *
768
+ * @param target The node which will allow or disallow association. The request
769
+ * can be broadcast by using a broadcast address (0xFFFC/0xFFFD/0xFFFF). No
770
+ * response is sent if the request is broadcast.
771
+ * @param duration uint8_t A value of 0x00 disables joining. A value of 0xFF enables
772
+ * joining. Any other value enables joining for that number of seconds.
773
+ * @param authentication uint8_t Controls Trust Center authentication behavior.
774
+ * @param options The options to use when sending the request. See
775
+ * emberSendUnicast() for a description. This parameter is ignored if the target
776
+ * is a broadcast address.
777
+ *
778
+ * @return An EmberStatus value. ::EMBER_SUCCESS, ::EMBER_NO_BUFFERS,
779
+ * ::EMBER_NETWORK_DOWN or ::EMBER_NETWORK_BUSY.
780
+ */
781
+ private emberPermitJoiningRequest;
782
+ static isValidPath(path: string): Promise<boolean>;
783
+ static autoDetectPath(): Promise<string>;
784
+ start(): Promise<TsType.StartResult>;
785
+ stop(): Promise<void>;
786
+ getCoordinator(): Promise<TsType.Coordinator>;
787
+ getCoordinatorVersion(): Promise<TsType.CoordinatorVersion>;
788
+ reset(type: "soft" | "hard"): Promise<void>;
789
+ supportsBackup(): Promise<boolean>;
790
+ backup(ieeeAddressesInDatabase: string[]): Promise<Backup>;
791
+ getNetworkParameters(): Promise<TsType.NetworkParameters>;
792
+ setTransmitPower(value: number): Promise<void>;
793
+ addInstallCode(ieeeAddress: string, key: Buffer): Promise<void>;
794
+ /** WARNING: Adapter impl. Starts timer immediately upon returning */
795
+ waitFor(networkAddress: number, endpoint: number, frameType: FrameType, direction: Direction, transactionSequenceNumber: number, clusterID: number, commandIdentifier: number, timeout: number): {
796
+ promise: Promise<ZclDataPayload>;
797
+ cancel: () => void;
798
+ };
799
+ permitJoin(seconds: number, networkAddress: number): Promise<void>;
800
+ lqi(networkAddress: number): Promise<TsType.LQI>;
801
+ routingTable(networkAddress: number): Promise<TsType.RoutingTable>;
802
+ nodeDescriptor(networkAddress: number): Promise<TsType.NodeDescriptor>;
803
+ activeEndpoints(networkAddress: number): Promise<TsType.ActiveEndpoints>;
804
+ simpleDescriptor(networkAddress: number, endpointID: number): Promise<TsType.SimpleDescriptor>;
805
+ bind(destinationNetworkAddress: number, sourceIeeeAddress: string, sourceEndpoint: number, clusterID: number, destinationAddressOrGroup: string | number, type: "endpoint" | "group", destinationEndpoint?: number): Promise<void>;
806
+ unbind(destinationNetworkAddress: number, sourceIeeeAddress: string, sourceEndpoint: number, clusterID: number, destinationAddressOrGroup: string | number, type: "endpoint" | "group", destinationEndpoint: number): Promise<void>;
807
+ removeDevice(networkAddress: number, ieeeAddr: string): Promise<void>;
808
+ sendZclFrameToEndpoint(ieeeAddr: string, networkAddress: number, endpoint: number, zclFrame: ZclFrame, timeout: number, disableResponse: boolean, disableRecovery: boolean, sourceEndpoint?: number): Promise<ZclDataPayload>;
809
+ sendZclFrameToGroup(groupID: number, zclFrame: ZclFrame, sourceEndpoint?: number): Promise<void>;
810
+ sendZclFrameToAll(endpoint: number, zclFrame: ZclFrame, sourceEndpoint: number): Promise<void>;
811
+ setChannelInterPAN(channel: number): Promise<void>;
812
+ sendZclFrameInterPANToIeeeAddr(zclFrame: ZclFrame, ieeeAddress: string): Promise<void>;
813
+ sendZclFrameInterPANBroadcast(zclFrame: ZclFrame, timeout: number): Promise<ZclDataPayload>;
814
+ restoreChannelInterPAN(): Promise<void>;
815
+ private checkInterpanLock;
816
+ }
817
+ export {};
818
+ //# sourceMappingURL=emberAdapter.d.ts.map