@matter/protocol 0.13.0-alpha.0-20250311-3eb0af5f2 → 0.13.0-alpha.0-20250322-f085fa576
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/certificate/CertificateAuthority.d.ts +1 -0
- package/dist/cjs/certificate/CertificateAuthority.d.ts.map +1 -1
- package/dist/cjs/certificate/CertificateAuthority.js.map +1 -1
- package/dist/cjs/cluster/client/ClusterClient.d.ts.map +1 -1
- package/dist/cjs/cluster/client/ClusterClient.js +3 -0
- package/dist/cjs/cluster/client/ClusterClient.js.map +1 -1
- package/dist/cjs/common/FailsafeContext.js +1 -1
- package/dist/cjs/common/FailsafeContext.js.map +1 -1
- package/dist/cjs/interaction/AttributeDataDecoder.d.ts +21 -4
- package/dist/cjs/interaction/AttributeDataDecoder.d.ts.map +1 -1
- package/dist/cjs/interaction/AttributeDataDecoder.js +40 -1
- package/dist/cjs/interaction/AttributeDataDecoder.js.map +1 -1
- package/dist/cjs/interaction/DecodedDataReport.d.ts +4 -2
- package/dist/cjs/interaction/DecodedDataReport.d.ts.map +1 -1
- package/dist/cjs/interaction/DecodedDataReport.js +6 -2
- package/dist/cjs/interaction/DecodedDataReport.js.map +1 -1
- package/dist/cjs/interaction/EventDataDecoder.d.ts +15 -3
- package/dist/cjs/interaction/EventDataDecoder.d.ts.map +1 -1
- package/dist/cjs/interaction/EventDataDecoder.js +39 -2
- package/dist/cjs/interaction/EventDataDecoder.js.map +1 -1
- package/dist/cjs/interaction/InteractionClient.d.ts +44 -4
- package/dist/cjs/interaction/InteractionClient.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionClient.js +65 -12
- package/dist/cjs/interaction/InteractionClient.js.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.js +5 -2
- package/dist/cjs/interaction/InteractionMessenger.js.map +1 -1
- package/dist/cjs/interaction/InteractionServer.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionServer.js +2 -2
- package/dist/cjs/interaction/InteractionServer.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.d.ts +15 -3
- package/dist/cjs/peer/ControllerCommissioner.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.js +17 -6
- package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioningFlow.d.ts +47 -1
- package/dist/cjs/peer/ControllerCommissioningFlow.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerCommissioningFlow.js +133 -133
- package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
- package/dist/cjs/peer/PeerSet.d.ts +2 -2
- package/dist/cjs/peer/PeerSet.d.ts.map +1 -1
- package/dist/cjs/peer/PeerSet.js +6 -1
- package/dist/cjs/peer/PeerSet.js.map +1 -1
- package/dist/cjs/protocol/ChannelManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ChannelManager.js +11 -4
- package/dist/cjs/protocol/ChannelManager.js.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.js +0 -1
- package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
- package/dist/esm/certificate/CertificateAuthority.d.ts +1 -0
- package/dist/esm/certificate/CertificateAuthority.d.ts.map +1 -1
- package/dist/esm/certificate/CertificateAuthority.js.map +1 -1
- package/dist/esm/cluster/client/ClusterClient.d.ts.map +1 -1
- package/dist/esm/cluster/client/ClusterClient.js +3 -0
- package/dist/esm/cluster/client/ClusterClient.js.map +1 -1
- package/dist/esm/common/FailsafeContext.js +1 -1
- package/dist/esm/common/FailsafeContext.js.map +1 -1
- package/dist/esm/interaction/AttributeDataDecoder.d.ts +21 -4
- package/dist/esm/interaction/AttributeDataDecoder.d.ts.map +1 -1
- package/dist/esm/interaction/AttributeDataDecoder.js +40 -1
- package/dist/esm/interaction/AttributeDataDecoder.js.map +1 -1
- package/dist/esm/interaction/DecodedDataReport.d.ts +4 -2
- package/dist/esm/interaction/DecodedDataReport.d.ts.map +1 -1
- package/dist/esm/interaction/DecodedDataReport.js +12 -4
- package/dist/esm/interaction/DecodedDataReport.js.map +1 -1
- package/dist/esm/interaction/EventDataDecoder.d.ts +15 -3
- package/dist/esm/interaction/EventDataDecoder.d.ts.map +1 -1
- package/dist/esm/interaction/EventDataDecoder.js +39 -2
- package/dist/esm/interaction/EventDataDecoder.js.map +1 -1
- package/dist/esm/interaction/InteractionClient.d.ts +44 -4
- package/dist/esm/interaction/InteractionClient.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionClient.js +67 -12
- package/dist/esm/interaction/InteractionClient.js.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.js +6 -2
- package/dist/esm/interaction/InteractionMessenger.js.map +1 -1
- package/dist/esm/interaction/InteractionServer.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionServer.js +12 -3
- package/dist/esm/interaction/InteractionServer.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.d.ts +15 -3
- package/dist/esm/peer/ControllerCommissioner.d.ts.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.js +17 -6
- package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioningFlow.d.ts +47 -1
- package/dist/esm/peer/ControllerCommissioningFlow.d.ts.map +1 -1
- package/dist/esm/peer/ControllerCommissioningFlow.js +133 -133
- package/dist/esm/peer/ControllerCommissioningFlow.js.map +1 -1
- package/dist/esm/peer/PeerSet.d.ts +2 -2
- package/dist/esm/peer/PeerSet.d.ts.map +1 -1
- package/dist/esm/peer/PeerSet.js +7 -2
- package/dist/esm/peer/PeerSet.js.map +1 -1
- package/dist/esm/protocol/ChannelManager.d.ts.map +1 -1
- package/dist/esm/protocol/ChannelManager.js +11 -4
- package/dist/esm/protocol/ChannelManager.js.map +1 -1
- package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeManager.js +0 -1
- package/dist/esm/protocol/ExchangeManager.js.map +1 -1
- package/package.json +6 -6
- package/src/certificate/CertificateAuthority.ts +1 -0
- package/src/cluster/client/ClusterClient.ts +3 -0
- package/src/common/FailsafeContext.ts +1 -1
- package/src/interaction/AttributeDataDecoder.ts +66 -6
- package/src/interaction/DecodedDataReport.ts +24 -5
- package/src/interaction/EventDataDecoder.ts +57 -5
- package/src/interaction/InteractionClient.ts +105 -12
- package/src/interaction/InteractionMessenger.ts +6 -2
- package/src/interaction/InteractionServer.ts +14 -4
- package/src/peer/ControllerCommissioner.ts +30 -6
- package/src/peer/ControllerCommissioningFlow.ts +144 -140
- package/src/peer/PeerSet.ts +7 -2
- package/src/protocol/ChannelManager.ts +11 -4
- package/src/protocol/ExchangeManager.ts +0 -1
|
@@ -31,26 +31,26 @@ class RecoverableCommissioningError extends CommissioningError {
|
|
|
31
31
|
}
|
|
32
32
|
const DEFAULT_FAILSAFE_TIME_MS = 6e4;
|
|
33
33
|
class ControllerCommissioningFlow {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
interactionClient;
|
|
35
|
+
ca;
|
|
36
|
+
fabric;
|
|
37
|
+
transitionToCase;
|
|
38
|
+
commissioningOptions;
|
|
39
|
+
commissioningSteps = new Array();
|
|
40
|
+
commissioningStepResults = /* @__PURE__ */ new Map();
|
|
41
41
|
#clusterClients = /* @__PURE__ */ new Map();
|
|
42
42
|
#commissioningStartedTime;
|
|
43
43
|
#commissioningExpiryTime;
|
|
44
44
|
#lastFailSafeTime;
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
lastBreadcrumb = 1;
|
|
46
|
+
collectedCommissioningData = {};
|
|
47
47
|
#failSafeTimeMs = DEFAULT_FAILSAFE_TIME_MS;
|
|
48
48
|
constructor(interactionClient, ca, fabric, commissioningOptions, transitionToCase) {
|
|
49
|
-
this
|
|
50
|
-
this
|
|
51
|
-
this
|
|
52
|
-
this
|
|
53
|
-
this
|
|
49
|
+
this.interactionClient = interactionClient;
|
|
50
|
+
this.ca = ca;
|
|
51
|
+
this.fabric = fabric;
|
|
52
|
+
this.transitionToCase = transitionToCase;
|
|
53
|
+
this.commissioningOptions = commissioningOptions;
|
|
54
54
|
logger.debug(`Commissioning options: ${Logger.toJSON(commissioningOptions)}`);
|
|
55
55
|
this.#initializeCommissioningSteps();
|
|
56
56
|
}
|
|
@@ -63,7 +63,7 @@ class ControllerCommissioningFlow {
|
|
|
63
63
|
async executeCommissioning() {
|
|
64
64
|
this.#sortSteps();
|
|
65
65
|
let failSafeTimerReArmedAfterPreviousStep = false;
|
|
66
|
-
for (const step of this
|
|
66
|
+
for (const step of this.commissioningSteps) {
|
|
67
67
|
logger.info(`Executing commissioning step ${step.stepNumber}.${step.subStepNumber}: ${step.name}`);
|
|
68
68
|
try {
|
|
69
69
|
if (step.reArmFailsafe && !failSafeTimerReArmedAfterPreviousStep) {
|
|
@@ -128,7 +128,7 @@ class ControllerCommissioningFlow {
|
|
|
128
128
|
logger.debug(
|
|
129
129
|
`Creating new cluster client for cluster ${cluster.name} (endpoint ${endpointId}, isFeatureSpecific ${isFeatureSpecific})`
|
|
130
130
|
);
|
|
131
|
-
const client = ClusterClient(cluster, endpointId, this
|
|
131
|
+
const client = ClusterClient(cluster, endpointId, this.interactionClient);
|
|
132
132
|
this.#clusterClients.set(cluster.id, client);
|
|
133
133
|
return client;
|
|
134
134
|
}
|
|
@@ -137,59 +137,59 @@ class ControllerCommissioningFlow {
|
|
|
137
137
|
* @see {@link MatterSpecification.v13.Core} § 5.5
|
|
138
138
|
*/
|
|
139
139
|
#initializeCommissioningSteps() {
|
|
140
|
-
this
|
|
140
|
+
this.commissioningSteps.push({
|
|
141
141
|
stepNumber: 0,
|
|
142
142
|
// Preparation
|
|
143
143
|
subStepNumber: 1,
|
|
144
144
|
name: "GetInitialData",
|
|
145
145
|
stepLogic: () => this.#getInitialData()
|
|
146
146
|
});
|
|
147
|
-
this
|
|
147
|
+
this.commissioningSteps.push({
|
|
148
148
|
stepNumber: 7,
|
|
149
149
|
subStepNumber: 1,
|
|
150
150
|
name: "GeneralCommissioning.ArmFailsafe",
|
|
151
151
|
stepLogic: () => this.#armFailsafe()
|
|
152
152
|
});
|
|
153
|
-
this
|
|
153
|
+
this.commissioningSteps.push({
|
|
154
154
|
stepNumber: 8,
|
|
155
155
|
subStepNumber: 1,
|
|
156
156
|
name: "GeneralCommissioning.ConfigureRegulatoryInformation",
|
|
157
157
|
stepLogic: () => this.#configureRegulatoryInformation()
|
|
158
158
|
});
|
|
159
|
-
this
|
|
159
|
+
this.commissioningSteps.push({
|
|
160
160
|
stepNumber: 8,
|
|
161
161
|
subStepNumber: 2,
|
|
162
162
|
name: "TimeSynchronization.SynchronizeTime",
|
|
163
163
|
stepLogic: () => this.#synchronizeTime()
|
|
164
164
|
});
|
|
165
|
-
this
|
|
165
|
+
this.commissioningSteps.push({
|
|
166
166
|
stepNumber: 10,
|
|
167
167
|
subStepNumber: 1,
|
|
168
168
|
name: "OperationalCredentials.DeviceAttestation",
|
|
169
169
|
stepLogic: () => this.#deviceAttestation()
|
|
170
170
|
});
|
|
171
|
-
this
|
|
171
|
+
this.commissioningSteps.push({
|
|
172
172
|
stepNumber: 11,
|
|
173
173
|
// includes 11-13
|
|
174
174
|
subStepNumber: 1,
|
|
175
175
|
name: "OperationalCredentials.Certificates",
|
|
176
176
|
stepLogic: () => this.#certificates()
|
|
177
177
|
});
|
|
178
|
-
this
|
|
178
|
+
this.commissioningSteps.push({
|
|
179
179
|
stepNumber: 15,
|
|
180
180
|
subStepNumber: 1,
|
|
181
181
|
name: "AccessControl",
|
|
182
182
|
stepLogic: () => this.#configureAccessControlLists()
|
|
183
183
|
});
|
|
184
|
-
if (this
|
|
185
|
-
this
|
|
184
|
+
if (this.interactionClient.channelType === ChannelType.BLE) {
|
|
185
|
+
this.commissioningSteps.push({
|
|
186
186
|
stepNumber: 16,
|
|
187
187
|
subStepNumber: 1,
|
|
188
188
|
name: "NetworkCommissioning.Validate",
|
|
189
189
|
stepLogic: () => this.#validateNetwork()
|
|
190
190
|
});
|
|
191
|
-
if (this
|
|
192
|
-
this
|
|
191
|
+
if (this.commissioningOptions.wifiNetwork !== void 0) {
|
|
192
|
+
this.commissioningSteps.push({
|
|
193
193
|
stepNumber: 16,
|
|
194
194
|
// includes step 17
|
|
195
195
|
subStepNumber: 2,
|
|
@@ -198,8 +198,8 @@ class ControllerCommissioningFlow {
|
|
|
198
198
|
stepLogic: () => this.#configureNetworkWifi()
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
if (this
|
|
202
|
-
this
|
|
201
|
+
if (this.commissioningOptions.threadNetwork !== void 0) {
|
|
202
|
+
this.commissioningSteps.push({
|
|
203
203
|
stepNumber: 16,
|
|
204
204
|
// includes step 17
|
|
205
205
|
subStepNumber: 3,
|
|
@@ -210,10 +210,10 @@ class ControllerCommissioningFlow {
|
|
|
210
210
|
}
|
|
211
211
|
} else {
|
|
212
212
|
logger.info(
|
|
213
|
-
`Skipping NetworkCommissioning steps because the device is already on IP network (${this
|
|
213
|
+
`Skipping NetworkCommissioning steps because the device is already on IP network (${this.interactionClient.channelType})`
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
|
-
this
|
|
216
|
+
this.commissioningSteps.push({
|
|
217
217
|
stepNumber: 18,
|
|
218
218
|
// includes step 19 (CASE connection)
|
|
219
219
|
subStepNumber: 1,
|
|
@@ -221,13 +221,13 @@ class ControllerCommissioningFlow {
|
|
|
221
221
|
reArmFailsafe: true,
|
|
222
222
|
stepLogic: () => this.#reconnectWithDevice()
|
|
223
223
|
});
|
|
224
|
-
this
|
|
224
|
+
this.commissioningSteps.push({
|
|
225
225
|
stepNumber: 20,
|
|
226
226
|
subStepNumber: 1,
|
|
227
227
|
name: "GeneralCommissioning.Complete",
|
|
228
228
|
stepLogic: () => this.#completeCommissioning()
|
|
229
229
|
});
|
|
230
|
-
this
|
|
230
|
+
this.commissioningSteps.push({
|
|
231
231
|
stepNumber: 99,
|
|
232
232
|
// Should be allowed in Step 13, but Tasmota is not supporting this
|
|
233
233
|
subStepNumber: 1,
|
|
@@ -236,16 +236,16 @@ class ControllerCommissioningFlow {
|
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
#sortSteps() {
|
|
239
|
-
this
|
|
239
|
+
this.commissioningSteps.sort((a, b) => {
|
|
240
240
|
if (a.stepNumber !== b.stepNumber) return a.stepNumber - b.stepNumber;
|
|
241
241
|
return a.subStepNumber - b.subStepNumber;
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
#setCommissioningStepResult(step, result) {
|
|
245
|
-
this
|
|
245
|
+
this.commissioningStepResults.set(`${step.stepNumber}-${step.subStepNumber}`, result);
|
|
246
246
|
}
|
|
247
247
|
getCommissioningStepResult(stepNumber, subStepNumber) {
|
|
248
|
-
return this
|
|
248
|
+
return this.commissioningStepResults.get(`${stepNumber}-${subStepNumber}`);
|
|
249
249
|
}
|
|
250
250
|
/** Helper method to check for errorCode/debugTest responses and throw error on failure */
|
|
251
251
|
#ensureOperationalCredentialsSuccess(context, { statusCode, debugText, fabricIndex }) {
|
|
@@ -275,9 +275,9 @@ class ControllerCommissioningFlow {
|
|
|
275
275
|
*/
|
|
276
276
|
async #getInitialData() {
|
|
277
277
|
const descriptorClient = this.#getClusterClient(Descriptor.Cluster);
|
|
278
|
-
this
|
|
279
|
-
this
|
|
280
|
-
const networkData = await this
|
|
278
|
+
this.collectedCommissioningData.rootPartsList = await descriptorClient.getPartsListAttribute();
|
|
279
|
+
this.collectedCommissioningData.rootServerList = await descriptorClient.getServerListAttribute();
|
|
280
|
+
const networkData = await this.interactionClient.getMultipleAttributes({
|
|
281
281
|
attributes: [
|
|
282
282
|
{
|
|
283
283
|
clusterId: NetworkCommissioning.Complete.id,
|
|
@@ -301,17 +301,17 @@ class ControllerCommissioningFlow {
|
|
|
301
301
|
networkStatus.push({ endpointId, value });
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
-
this
|
|
305
|
-
this
|
|
304
|
+
this.collectedCommissioningData.networkFeatures = networkFeatures;
|
|
305
|
+
this.collectedCommissioningData.networkStatus = networkStatus;
|
|
306
306
|
const basicInfoClient = this.#getClusterClient(BasicInformation.Cluster);
|
|
307
|
-
this
|
|
308
|
-
this
|
|
309
|
-
this
|
|
307
|
+
this.collectedCommissioningData.vendorId = await basicInfoClient.getVendorIdAttribute();
|
|
308
|
+
this.collectedCommissioningData.productId = await basicInfoClient.getProductIdAttribute();
|
|
309
|
+
this.collectedCommissioningData.productName = await basicInfoClient.getProductNameAttribute();
|
|
310
310
|
const generalCommissioningClient = this.#getClusterClient(GeneralCommissioning.Cluster);
|
|
311
|
-
this
|
|
311
|
+
this.collectedCommissioningData.supportsConcurrentConnection = await generalCommissioningClient.getSupportsConcurrentConnectionAttribute();
|
|
312
312
|
return {
|
|
313
313
|
code: 0 /* Success */,
|
|
314
|
-
breadcrumb: this
|
|
314
|
+
breadcrumb: this.lastBreadcrumb
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
@@ -325,9 +325,9 @@ class ControllerCommissioningFlow {
|
|
|
325
325
|
*/
|
|
326
326
|
async #armFailsafe() {
|
|
327
327
|
const client = this.#getClusterClient(GeneralCommissioning.Cluster);
|
|
328
|
-
if (this
|
|
328
|
+
if (this.collectedCommissioningData.basicCommissioningInfo === void 0) {
|
|
329
329
|
const basicCommissioningInfo = await client.getBasicCommissioningInfoAttribute();
|
|
330
|
-
this
|
|
330
|
+
this.collectedCommissioningData.basicCommissioningInfo = basicCommissioningInfo;
|
|
331
331
|
this.#failSafeTimeMs = basicCommissioningInfo.failSafeExpiryLengthSeconds * 1e3;
|
|
332
332
|
this.#commissioningStartedTime = Time.nowMs();
|
|
333
333
|
this.#commissioningExpiryTime = this.#commissioningStartedTime + basicCommissioningInfo.maxCumulativeFailsafeSeconds * 1e3;
|
|
@@ -335,14 +335,14 @@ class ControllerCommissioningFlow {
|
|
|
335
335
|
this.#ensureGeneralCommissioningSuccess(
|
|
336
336
|
"armFailSafe",
|
|
337
337
|
await client.armFailSafe({
|
|
338
|
-
breadcrumb: this
|
|
339
|
-
expiryLengthSeconds: this
|
|
338
|
+
breadcrumb: this.lastBreadcrumb,
|
|
339
|
+
expiryLengthSeconds: this.collectedCommissioningData.basicCommissioningInfo?.failSafeExpiryLengthSeconds
|
|
340
340
|
})
|
|
341
341
|
);
|
|
342
342
|
this.#lastFailSafeTime = Time.nowMs();
|
|
343
343
|
return {
|
|
344
344
|
code: 0 /* Success */,
|
|
345
|
-
breadcrumb: this
|
|
345
|
+
breadcrumb: this.lastBreadcrumb
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
348
|
async #resetFailsafeTimer() {
|
|
@@ -350,7 +350,7 @@ class ControllerCommissioningFlow {
|
|
|
350
350
|
try {
|
|
351
351
|
const client = this.#getClusterClient(GeneralCommissioning.Cluster);
|
|
352
352
|
await client.armFailSafe({
|
|
353
|
-
breadcrumb: this
|
|
353
|
+
breadcrumb: this.lastBreadcrumb,
|
|
354
354
|
expiryLengthSeconds: 0
|
|
355
355
|
});
|
|
356
356
|
this.#lastFailSafeTime = void 0;
|
|
@@ -366,26 +366,26 @@ class ControllerCommissioningFlow {
|
|
|
366
366
|
* Commissionee using the SetRegulatoryConfig command.
|
|
367
367
|
*/
|
|
368
368
|
async #configureRegulatoryInformation() {
|
|
369
|
-
if (this
|
|
369
|
+
if (this.collectedCommissioningData.networkFeatures === void 0) {
|
|
370
370
|
throw new CommissioningError("No network features collected. This should never happen.");
|
|
371
371
|
}
|
|
372
|
-
const hasRadioNetwork = this
|
|
372
|
+
const hasRadioNetwork = this.collectedCommissioningData.networkFeatures.some(
|
|
373
373
|
({ value: { wiFiNetworkInterface, threadNetworkInterface } }) => wiFiNetworkInterface || threadNetworkInterface
|
|
374
374
|
);
|
|
375
375
|
if (hasRadioNetwork) {
|
|
376
376
|
const client = this.#getClusterClient(GeneralCommissioning.Cluster);
|
|
377
377
|
let locationCapability = await client.getLocationCapabilityAttribute();
|
|
378
378
|
if (locationCapability === GeneralCommissioning.RegulatoryLocationType.IndoorOutdoor) {
|
|
379
|
-
locationCapability = this
|
|
379
|
+
locationCapability = this.commissioningOptions.regulatoryLocation;
|
|
380
380
|
} else {
|
|
381
381
|
logger.debug(
|
|
382
382
|
`Device does not support a configurable regulatory location type. Location is set to "${locationCapability === GeneralCommissioning.RegulatoryLocationType.Indoor ? "Indoor" : "Outdoor"}"`
|
|
383
383
|
);
|
|
384
384
|
}
|
|
385
|
-
let countryCode = this
|
|
385
|
+
let countryCode = this.commissioningOptions.regulatoryCountryCode;
|
|
386
386
|
const regulatoryResult = await client.setRegulatoryConfig(
|
|
387
387
|
{
|
|
388
|
-
breadcrumb: this
|
|
388
|
+
breadcrumb: this.lastBreadcrumb++,
|
|
389
389
|
newRegulatoryConfig: locationCapability,
|
|
390
390
|
countryCode
|
|
391
391
|
},
|
|
@@ -400,7 +400,7 @@ class ControllerCommissioningFlow {
|
|
|
400
400
|
"setRegulatoryConfig",
|
|
401
401
|
await client.setRegulatoryConfig(
|
|
402
402
|
{
|
|
403
|
-
breadcrumb: this
|
|
403
|
+
breadcrumb: this.lastBreadcrumb,
|
|
404
404
|
newRegulatoryConfig: locationCapability,
|
|
405
405
|
countryCode
|
|
406
406
|
},
|
|
@@ -412,12 +412,12 @@ class ControllerCommissioningFlow {
|
|
|
412
412
|
}
|
|
413
413
|
return {
|
|
414
414
|
code: 0 /* Success */,
|
|
415
|
-
breadcrumb: this
|
|
415
|
+
breadcrumb: this.lastBreadcrumb
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
418
|
return {
|
|
419
419
|
code: 2 /* Skipped */,
|
|
420
|
-
breadcrumb: this
|
|
420
|
+
breadcrumb: this.lastBreadcrumb
|
|
421
421
|
};
|
|
422
422
|
}
|
|
423
423
|
/**
|
|
@@ -430,14 +430,14 @@ class ControllerCommissioningFlow {
|
|
|
430
430
|
* ▪ The Commissioner SHOULD set a Default NTP server using the SetDefaultNTP command if the NTPClient Feature is supported and the DefaultNTP attribute is null. If the current value is non-null, Commissioners MAY opt to overwrite the current value.
|
|
431
431
|
*/
|
|
432
432
|
async #synchronizeTime() {
|
|
433
|
-
if (this
|
|
433
|
+
if (this.collectedCommissioningData.rootServerList !== void 0 && this.collectedCommissioningData.rootServerList.find(
|
|
434
434
|
(clusterId) => clusterId === TimeSynchronizationCluster.id
|
|
435
435
|
)) {
|
|
436
436
|
logger.debug("TimeSynchronization cluster is supported");
|
|
437
437
|
}
|
|
438
438
|
return {
|
|
439
439
|
code: 2 /* Skipped */,
|
|
440
|
-
breadcrumb: this
|
|
440
|
+
breadcrumb: this.lastBreadcrumb
|
|
441
441
|
};
|
|
442
442
|
}
|
|
443
443
|
/**
|
|
@@ -470,7 +470,7 @@ class ControllerCommissioningFlow {
|
|
|
470
470
|
}
|
|
471
471
|
return {
|
|
472
472
|
code: 0 /* Success */,
|
|
473
|
-
breadcrumb: this
|
|
473
|
+
breadcrumb: this.lastBreadcrumb
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
476
|
/**
|
|
@@ -502,31 +502,31 @@ class ControllerCommissioningFlow {
|
|
|
502
502
|
const operationalPublicKey = CertificateManager.getPublicKeyFromCsr(certSigningRequest);
|
|
503
503
|
await operationalCredentialsClusterClient.addTrustedRootCertificate(
|
|
504
504
|
{
|
|
505
|
-
rootCaCertificate: this
|
|
505
|
+
rootCaCertificate: this.ca.rootCert
|
|
506
506
|
},
|
|
507
507
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
508
508
|
);
|
|
509
|
-
const peerOperationalCert = this
|
|
509
|
+
const peerOperationalCert = this.ca.generateNoc(
|
|
510
510
|
operationalPublicKey,
|
|
511
|
-
this
|
|
512
|
-
this
|
|
511
|
+
this.fabric.fabricId,
|
|
512
|
+
this.interactionClient.address.nodeId
|
|
513
513
|
);
|
|
514
514
|
const addNocResponse = await operationalCredentialsClusterClient.addNoc(
|
|
515
515
|
{
|
|
516
516
|
nocValue: peerOperationalCert,
|
|
517
517
|
icacValue: new Uint8Array(0),
|
|
518
|
-
ipkValue: this
|
|
519
|
-
adminVendorId: this
|
|
520
|
-
caseAdminSubject: this
|
|
518
|
+
ipkValue: this.fabric.identityProtectionKey,
|
|
519
|
+
adminVendorId: this.fabric.rootVendorId,
|
|
520
|
+
caseAdminSubject: this.fabric.rootNodeId
|
|
521
521
|
},
|
|
522
522
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
523
523
|
);
|
|
524
524
|
this.#ensureOperationalCredentialsSuccess("addNoc", addNocResponse);
|
|
525
525
|
const { fabricIndex } = addNocResponse;
|
|
526
|
-
this
|
|
526
|
+
this.collectedCommissioningData.fabricIndex = fabricIndex;
|
|
527
527
|
return {
|
|
528
528
|
code: 0 /* Success */,
|
|
529
|
-
breadcrumb: this
|
|
529
|
+
breadcrumb: this.lastBreadcrumb
|
|
530
530
|
};
|
|
531
531
|
}
|
|
532
532
|
/**
|
|
@@ -537,12 +537,12 @@ class ControllerCommissioningFlow {
|
|
|
537
537
|
* the commissioning process.
|
|
538
538
|
*/
|
|
539
539
|
async #updateFabricLabel() {
|
|
540
|
-
const { fabricIndex } = this
|
|
540
|
+
const { fabricIndex } = this.collectedCommissioningData;
|
|
541
541
|
if (fabricIndex === void 0) {
|
|
542
542
|
logger.error("No fabric index available after addNoc. This should never happen.");
|
|
543
543
|
return {
|
|
544
544
|
code: 1 /* Failure */,
|
|
545
|
-
breadcrumb: this
|
|
545
|
+
breadcrumb: this.lastBreadcrumb
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
548
|
const operationalCredentialCluster = this.#getClusterClient(OperationalCredentials.Cluster);
|
|
@@ -550,7 +550,7 @@ class ControllerCommissioningFlow {
|
|
|
550
550
|
this.#ensureOperationalCredentialsSuccess(
|
|
551
551
|
"updateFabricLabel",
|
|
552
552
|
await operationalCredentialCluster.updateFabricLabel({
|
|
553
|
-
label: this
|
|
553
|
+
label: this.fabric.label,
|
|
554
554
|
fabricIndex
|
|
555
555
|
})
|
|
556
556
|
);
|
|
@@ -559,7 +559,7 @@ class ControllerCommissioningFlow {
|
|
|
559
559
|
}
|
|
560
560
|
return {
|
|
561
561
|
code: 0 /* Success */,
|
|
562
|
-
breadcrumb: this
|
|
562
|
+
breadcrumb: this.lastBreadcrumb
|
|
563
563
|
};
|
|
564
564
|
}
|
|
565
565
|
/**
|
|
@@ -572,7 +572,7 @@ class ControllerCommissioningFlow {
|
|
|
572
572
|
async #configureAccessControlLists() {
|
|
573
573
|
return {
|
|
574
574
|
code: 2 /* Skipped */,
|
|
575
|
-
breadcrumb: this
|
|
575
|
+
breadcrumb: this.lastBreadcrumb
|
|
576
576
|
};
|
|
577
577
|
}
|
|
578
578
|
/**
|
|
@@ -589,14 +589,14 @@ class ControllerCommissioningFlow {
|
|
|
589
589
|
* operational network.
|
|
590
590
|
*/
|
|
591
591
|
async #validateNetwork() {
|
|
592
|
-
if (this
|
|
592
|
+
if (this.collectedCommissioningData.networkFeatures === void 0 || this.collectedCommissioningData.networkStatus === void 0) {
|
|
593
593
|
throw new CommissioningError("No network features or status collected. This should never happen.");
|
|
594
594
|
}
|
|
595
|
-
if (this
|
|
596
|
-
const anyEthernetInterface = this
|
|
595
|
+
if ((this.commissioningOptions.wifiNetwork === void 0 || !this.commissioningOptions.wifiNetwork.wifiSsid || !this.commissioningOptions.wifiNetwork.wifiCredentials) && (this.commissioningOptions.threadNetwork === void 0 || !this.commissioningOptions.threadNetwork.networkName || !this.commissioningOptions.threadNetwork.operationalDataset)) {
|
|
596
|
+
const anyEthernetInterface = this.collectedCommissioningData.networkFeatures.length === 0 || this.collectedCommissioningData.networkFeatures.some(
|
|
597
597
|
({ value: { ethernetNetworkInterface } }) => ethernetNetworkInterface === true
|
|
598
598
|
);
|
|
599
|
-
const anyInterfaceConnected = this
|
|
599
|
+
const anyInterfaceConnected = this.collectedCommissioningData.networkStatus.length === 0 || this.collectedCommissioningData.networkStatus.some(
|
|
600
600
|
({ value }) => value.some(({ connected }) => connected)
|
|
601
601
|
);
|
|
602
602
|
if (!anyEthernetInterface && !anyInterfaceConnected) {
|
|
@@ -607,22 +607,22 @@ class ControllerCommissioningFlow {
|
|
|
607
607
|
}
|
|
608
608
|
return {
|
|
609
609
|
code: 0 /* Success */,
|
|
610
|
-
breadcrumb: this
|
|
610
|
+
breadcrumb: this.lastBreadcrumb
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
613
|
async #configureNetworkWifi() {
|
|
614
|
-
if (this
|
|
614
|
+
if (this.commissioningOptions.wifiNetwork === void 0) {
|
|
615
615
|
logger.debug("WiFi network is not configured");
|
|
616
616
|
return {
|
|
617
617
|
code: 2 /* Skipped */,
|
|
618
|
-
breadcrumb: this
|
|
618
|
+
breadcrumb: this.lastBreadcrumb
|
|
619
619
|
};
|
|
620
620
|
}
|
|
621
|
-
if (this
|
|
622
|
-
const rootNetworkFeatures = this
|
|
621
|
+
if (this.collectedCommissioningData.networkFeatures !== void 0 && this.collectedCommissioningData.networkStatus !== void 0) {
|
|
622
|
+
const rootNetworkFeatures = this.collectedCommissioningData.networkFeatures.find(
|
|
623
623
|
({ endpointId }) => endpointId === 0
|
|
624
624
|
)?.value;
|
|
625
|
-
const rootNetworkStatus = this
|
|
625
|
+
const rootNetworkStatus = this.collectedCommissioningData.networkStatus.find(
|
|
626
626
|
({ endpointId }) => endpointId === 0
|
|
627
627
|
)?.value;
|
|
628
628
|
logger.debug(
|
|
@@ -632,15 +632,15 @@ class ControllerCommissioningFlow {
|
|
|
632
632
|
logger.debug("Commissionee does not support any WiFi network interface");
|
|
633
633
|
return {
|
|
634
634
|
code: 2 /* Skipped */,
|
|
635
|
-
breadcrumb: this
|
|
635
|
+
breadcrumb: this.lastBreadcrumb
|
|
636
636
|
};
|
|
637
637
|
}
|
|
638
638
|
if (rootNetworkStatus !== void 0 && rootNetworkStatus.length > 0 && rootNetworkStatus[0].connected) {
|
|
639
639
|
logger.debug("Commissionee is already connected to the WiFi network");
|
|
640
|
-
this
|
|
640
|
+
this.collectedCommissioningData.successfullyConnectedToNetwork = true;
|
|
641
641
|
return {
|
|
642
642
|
code: 2 /* Skipped */,
|
|
643
|
-
breadcrumb: this
|
|
643
|
+
breadcrumb: this.lastBreadcrumb
|
|
644
644
|
};
|
|
645
645
|
}
|
|
646
646
|
}
|
|
@@ -650,12 +650,12 @@ class ControllerCommissioningFlow {
|
|
|
650
650
|
EndpointNumber(0),
|
|
651
651
|
true
|
|
652
652
|
);
|
|
653
|
-
const ssid = Bytes.fromString(this
|
|
654
|
-
const credentials = Bytes.fromString(this
|
|
653
|
+
const ssid = Bytes.fromString(this.commissioningOptions.wifiNetwork.wifiSsid);
|
|
654
|
+
const credentials = Bytes.fromString(this.commissioningOptions.wifiNetwork.wifiCredentials);
|
|
655
655
|
const { networkingStatus, wiFiScanResults, debugText } = await networkCommissioningClusterClient.scanNetworks(
|
|
656
656
|
{
|
|
657
657
|
ssid,
|
|
658
|
-
breadcrumb: this
|
|
658
|
+
breadcrumb: this.lastBreadcrumb++
|
|
659
659
|
},
|
|
660
660
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
661
661
|
);
|
|
@@ -664,7 +664,7 @@ class ControllerCommissioningFlow {
|
|
|
664
664
|
}
|
|
665
665
|
if (wiFiScanResults === void 0 || wiFiScanResults.length === 0) {
|
|
666
666
|
throw new CommissioningError(
|
|
667
|
-
`Commissionee did not return any WiFi networks for the requested SSID ${this
|
|
667
|
+
`Commissionee did not return any WiFi networks for the requested SSID ${this.commissioningOptions.wifiNetwork.wifiSsid}`
|
|
668
668
|
);
|
|
669
669
|
}
|
|
670
670
|
const {
|
|
@@ -675,7 +675,7 @@ class ControllerCommissioningFlow {
|
|
|
675
675
|
{
|
|
676
676
|
ssid,
|
|
677
677
|
credentials,
|
|
678
|
-
breadcrumb: this
|
|
678
|
+
breadcrumb: this.lastBreadcrumb++
|
|
679
679
|
},
|
|
680
680
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
681
681
|
);
|
|
@@ -686,7 +686,7 @@ class ControllerCommissioningFlow {
|
|
|
686
686
|
throw new CommissioningError(`Commissionee did not return network index`);
|
|
687
687
|
}
|
|
688
688
|
logger.debug(
|
|
689
|
-
`Commissionee added WiFi network ${this
|
|
689
|
+
`Commissionee added WiFi network ${this.commissioningOptions.wifiNetwork.wifiSsid} with network index ${networkIndex}`
|
|
690
690
|
);
|
|
691
691
|
const updatedNetworks = await networkCommissioningClusterClient.getNetworksAttribute();
|
|
692
692
|
if (updatedNetworks[networkIndex] === void 0) {
|
|
@@ -694,54 +694,54 @@ class ControllerCommissioningFlow {
|
|
|
694
694
|
}
|
|
695
695
|
const { networkId, connected } = updatedNetworks[networkIndex];
|
|
696
696
|
if (connected) {
|
|
697
|
-
this
|
|
697
|
+
this.collectedCommissioningData.successfullyConnectedToNetwork = true;
|
|
698
698
|
logger.debug(
|
|
699
|
-
`Commissionee is already connected to WiFi network ${this
|
|
699
|
+
`Commissionee is already connected to WiFi network ${this.commissioningOptions.wifiNetwork.wifiSsid} (networkId ${Bytes.toHex(networkId)})`
|
|
700
700
|
);
|
|
701
701
|
return {
|
|
702
702
|
code: 0 /* Success */,
|
|
703
|
-
breadcrumb: this
|
|
703
|
+
breadcrumb: this.lastBreadcrumb
|
|
704
704
|
};
|
|
705
705
|
}
|
|
706
706
|
const connectResult = await networkCommissioningClusterClient.connectNetwork(
|
|
707
707
|
{
|
|
708
708
|
networkId,
|
|
709
|
-
breadcrumb: this
|
|
709
|
+
breadcrumb: this.lastBreadcrumb++
|
|
710
710
|
},
|
|
711
711
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
712
712
|
);
|
|
713
713
|
if (connectResult.networkingStatus !== NetworkCommissioning.NetworkCommissioningStatus.Success) {
|
|
714
714
|
throw new CommissioningError(`Commissionee failed to connect to WiFi network: ${connectResult.debugText}`);
|
|
715
715
|
}
|
|
716
|
-
this
|
|
716
|
+
this.collectedCommissioningData.successfullyConnectedToNetwork = true;
|
|
717
717
|
logger.debug(
|
|
718
|
-
`Commissionee successfully connected to WiFi network ${this
|
|
718
|
+
`Commissionee successfully connected to WiFi network ${this.commissioningOptions.wifiNetwork.wifiSsid} (networkId ${Bytes.toHex(networkId)})`
|
|
719
719
|
);
|
|
720
720
|
return {
|
|
721
721
|
code: 0 /* Success */,
|
|
722
|
-
breadcrumb: this
|
|
722
|
+
breadcrumb: this.lastBreadcrumb
|
|
723
723
|
};
|
|
724
724
|
}
|
|
725
725
|
async #configureNetworkThread() {
|
|
726
|
-
if (this
|
|
727
|
-
logger.
|
|
726
|
+
if (this.collectedCommissioningData.successfullyConnectedToNetwork) {
|
|
727
|
+
logger.info("Node is already connected to a network. Skipping Thread configuration.");
|
|
728
728
|
return {
|
|
729
729
|
code: 2 /* Skipped */,
|
|
730
|
-
breadcrumb: this
|
|
730
|
+
breadcrumb: this.lastBreadcrumb
|
|
731
731
|
};
|
|
732
732
|
}
|
|
733
|
-
if (this
|
|
733
|
+
if (this.commissioningOptions.threadNetwork === void 0) {
|
|
734
734
|
logger.debug("Thread network is not configured");
|
|
735
735
|
return {
|
|
736
736
|
code: 2 /* Skipped */,
|
|
737
|
-
breadcrumb: this
|
|
737
|
+
breadcrumb: this.lastBreadcrumb
|
|
738
738
|
};
|
|
739
739
|
}
|
|
740
|
-
if (this
|
|
741
|
-
const rootNetworkFeatures = this
|
|
740
|
+
if (this.collectedCommissioningData.networkFeatures !== void 0 && this.collectedCommissioningData.networkStatus !== void 0) {
|
|
741
|
+
const rootNetworkFeatures = this.collectedCommissioningData.networkFeatures.find(
|
|
742
742
|
({ endpointId }) => endpointId === 0
|
|
743
743
|
)?.value;
|
|
744
|
-
const rootNetworkStatus = this
|
|
744
|
+
const rootNetworkStatus = this.collectedCommissioningData.networkStatus.find(
|
|
745
745
|
({ endpointId }) => endpointId === 0
|
|
746
746
|
)?.value;
|
|
747
747
|
logger.debug(
|
|
@@ -751,14 +751,14 @@ class ControllerCommissioningFlow {
|
|
|
751
751
|
logger.debug("Commissionee does not support any Thread network interface");
|
|
752
752
|
return {
|
|
753
753
|
code: 2 /* Skipped */,
|
|
754
|
-
breadcrumb: this
|
|
754
|
+
breadcrumb: this.lastBreadcrumb
|
|
755
755
|
};
|
|
756
756
|
}
|
|
757
757
|
if (rootNetworkStatus !== void 0 && rootNetworkStatus.length > 0 && rootNetworkStatus[0].connected) {
|
|
758
758
|
logger.debug("Commissionee is already connected to the Thread network");
|
|
759
759
|
return {
|
|
760
760
|
code: 2 /* Skipped */,
|
|
761
|
-
breadcrumb: this
|
|
761
|
+
breadcrumb: this.lastBreadcrumb
|
|
762
762
|
};
|
|
763
763
|
}
|
|
764
764
|
}
|
|
@@ -769,7 +769,7 @@ class ControllerCommissioningFlow {
|
|
|
769
769
|
true
|
|
770
770
|
);
|
|
771
771
|
const { networkingStatus, threadScanResults, debugText } = await networkCommissioningClusterClient.scanNetworks(
|
|
772
|
-
{ breadcrumb: this
|
|
772
|
+
{ breadcrumb: this.lastBreadcrumb++ },
|
|
773
773
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
774
774
|
);
|
|
775
775
|
if (networkingStatus !== NetworkCommissioning.NetworkCommissioningStatus.Success) {
|
|
@@ -777,19 +777,19 @@ class ControllerCommissioningFlow {
|
|
|
777
777
|
}
|
|
778
778
|
if (threadScanResults === void 0 || threadScanResults.length === 0) {
|
|
779
779
|
throw new CommissioningError(
|
|
780
|
-
`Commissionee did not return any Thread networks for the requested Network ${this
|
|
780
|
+
`Commissionee did not return any Thread networks for the requested Network ${this.commissioningOptions.threadNetwork.networkName}`
|
|
781
781
|
);
|
|
782
782
|
}
|
|
783
783
|
const wantedNetworkFound = threadScanResults.find(
|
|
784
|
-
({ networkName }) => networkName === this
|
|
784
|
+
({ networkName }) => networkName === this.commissioningOptions.threadNetwork?.networkName
|
|
785
785
|
);
|
|
786
786
|
if (wantedNetworkFound === void 0) {
|
|
787
787
|
throw new CommissioningError(
|
|
788
|
-
`Commissionee did not return the requested Network ${this
|
|
788
|
+
`Commissionee did not return the requested Network ${this.commissioningOptions.threadNetwork.networkName}: ${Logger.toJSON(threadScanResults)}`
|
|
789
789
|
);
|
|
790
790
|
}
|
|
791
791
|
logger.debug(
|
|
792
|
-
`Commissionee found wanted Thread network ${this
|
|
792
|
+
`Commissionee found wanted Thread network ${this.commissioningOptions.threadNetwork.networkName}: ${Logger.toJSON(wantedNetworkFound)}`
|
|
793
793
|
);
|
|
794
794
|
const {
|
|
795
795
|
networkingStatus: addNetworkingStatus,
|
|
@@ -797,8 +797,8 @@ class ControllerCommissioningFlow {
|
|
|
797
797
|
networkIndex
|
|
798
798
|
} = await networkCommissioningClusterClient.addOrUpdateThreadNetwork(
|
|
799
799
|
{
|
|
800
|
-
operationalDataset: Bytes.fromHex(this
|
|
801
|
-
breadcrumb: this
|
|
800
|
+
operationalDataset: Bytes.fromHex(this.commissioningOptions.threadNetwork.operationalDataset),
|
|
801
|
+
breadcrumb: this.lastBreadcrumb++
|
|
802
802
|
},
|
|
803
803
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
804
804
|
);
|
|
@@ -809,7 +809,7 @@ class ControllerCommissioningFlow {
|
|
|
809
809
|
throw new CommissioningError(`Commissionee did not return network index`);
|
|
810
810
|
}
|
|
811
811
|
logger.debug(
|
|
812
|
-
`Commissionee added Thread network ${this
|
|
812
|
+
`Commissionee added Thread network ${this.commissioningOptions.threadNetwork.networkName} with network index ${networkIndex}`
|
|
813
813
|
);
|
|
814
814
|
const updatedNetworks = await networkCommissioningClusterClient.getNetworksAttribute();
|
|
815
815
|
if (updatedNetworks[networkIndex] === void 0) {
|
|
@@ -818,17 +818,17 @@ class ControllerCommissioningFlow {
|
|
|
818
818
|
const { networkId, connected } = updatedNetworks[networkIndex];
|
|
819
819
|
if (connected) {
|
|
820
820
|
logger.debug(
|
|
821
|
-
`Commissionee is already connected to Thread network ${this
|
|
821
|
+
`Commissionee is already connected to Thread network ${this.commissioningOptions.threadNetwork.networkName} (networkId ${Bytes.toHex(networkId)})`
|
|
822
822
|
);
|
|
823
823
|
return {
|
|
824
824
|
code: 0 /* Success */,
|
|
825
|
-
breadcrumb: this
|
|
825
|
+
breadcrumb: this.lastBreadcrumb
|
|
826
826
|
};
|
|
827
827
|
}
|
|
828
828
|
const connectResult = await networkCommissioningClusterClient.connectNetwork(
|
|
829
829
|
{
|
|
830
830
|
networkId,
|
|
831
|
-
breadcrumb: this
|
|
831
|
+
breadcrumb: this.lastBreadcrumb++
|
|
832
832
|
},
|
|
833
833
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
834
834
|
);
|
|
@@ -838,11 +838,11 @@ class ControllerCommissioningFlow {
|
|
|
838
838
|
);
|
|
839
839
|
}
|
|
840
840
|
logger.debug(
|
|
841
|
-
`Commissionee successfully connected to Thread network ${this
|
|
841
|
+
`Commissionee successfully connected to Thread network ${this.commissioningOptions.threadNetwork.networkName} (networkId ${Bytes.toHex(networkId)})`
|
|
842
842
|
);
|
|
843
843
|
return {
|
|
844
844
|
code: 0 /* Success */,
|
|
845
|
-
breadcrumb: this
|
|
845
|
+
breadcrumb: this.lastBreadcrumb
|
|
846
846
|
};
|
|
847
847
|
}
|
|
848
848
|
/**
|
|
@@ -854,7 +854,7 @@ class ControllerCommissioningFlow {
|
|
|
854
854
|
* (CASE)”) session with the Commissionee over the operational network.
|
|
855
855
|
*/
|
|
856
856
|
async #reconnectWithDevice() {
|
|
857
|
-
const isConcurrentFlow = this
|
|
857
|
+
const isConcurrentFlow = this.collectedCommissioningData.supportsConcurrentConnection !== false;
|
|
858
858
|
logger.debug(`Reconnecting with device with ${isConcurrentFlow ? "concurrent" : "non-concurrent"} flow ...`);
|
|
859
859
|
const reArmFailsafeInterval = Time.getPeriodicTimer(
|
|
860
860
|
"Re-Arm Failsafe during reconnect",
|
|
@@ -877,8 +877,8 @@ class ControllerCommissioningFlow {
|
|
|
877
877
|
if (isConcurrentFlow) {
|
|
878
878
|
reArmFailsafeInterval.start();
|
|
879
879
|
}
|
|
880
|
-
const transitionResult = await this
|
|
881
|
-
this
|
|
880
|
+
const transitionResult = await this.transitionToCase(
|
|
881
|
+
this.interactionClient.address,
|
|
882
882
|
// Assume concurrent connections are supported if not know (which should not be the case when we came here)
|
|
883
883
|
isConcurrentFlow
|
|
884
884
|
);
|
|
@@ -887,15 +887,15 @@ class ControllerCommissioningFlow {
|
|
|
887
887
|
logger.debug("CASE commissioning handled externally, terminating commissioning flow");
|
|
888
888
|
return {
|
|
889
889
|
code: 3 /* Stop */,
|
|
890
|
-
breadcrumb: this
|
|
890
|
+
breadcrumb: this.lastBreadcrumb
|
|
891
891
|
};
|
|
892
892
|
}
|
|
893
|
-
this
|
|
893
|
+
this.interactionClient = transitionResult;
|
|
894
894
|
this.#clusterClients.clear();
|
|
895
895
|
logger.debug("Successfully reconnected with device ...");
|
|
896
896
|
return {
|
|
897
897
|
code: 0 /* Success */,
|
|
898
|
-
breadcrumb: this
|
|
898
|
+
breadcrumb: this.lastBreadcrumb
|
|
899
899
|
};
|
|
900
900
|
}
|
|
901
901
|
/**
|
|
@@ -916,7 +916,7 @@ class ControllerCommissioningFlow {
|
|
|
916
916
|
this.#lastFailSafeTime = void 0;
|
|
917
917
|
return {
|
|
918
918
|
code: 0 /* Success */,
|
|
919
|
-
breadcrumb: this
|
|
919
|
+
breadcrumb: this.lastBreadcrumb
|
|
920
920
|
};
|
|
921
921
|
}
|
|
922
922
|
}
|