@matter/protocol 0.13.0-alpha.0-20250318-c1aa38b08 → 0.13.0-alpha.0-20250323-770919c6a
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/ble/BtpSessionHandler.js +2 -2
- package/dist/cjs/ble/BtpSessionHandler.js.map +1 -1
- 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/certificate/CertificateManager.d.ts.map +1 -1
- package/dist/cjs/certificate/CertificateManager.js +21 -19
- package/dist/cjs/certificate/CertificateManager.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/cluster/server/AttributeServer.d.ts.map +1 -1
- package/dist/cjs/cluster/server/AttributeServer.js +5 -5
- package/dist/cjs/cluster/server/AttributeServer.js.map +1 -1
- package/dist/cjs/cluster/server/CommandServer.js +2 -2
- package/dist/cjs/cluster/server/CommandServer.js.map +1 -1
- package/dist/cjs/common/FailsafeContext.js +1 -1
- package/dist/cjs/common/FailsafeContext.js.map +1 -1
- package/dist/cjs/endpoint/EndpointStructureLogger.js +1 -1
- package/dist/cjs/endpoint/EndpointStructureLogger.js.map +1 -1
- package/dist/cjs/events/OccurrenceManager.d.ts.map +1 -1
- package/dist/cjs/events/OccurrenceManager.js +2 -2
- package/dist/cjs/events/OccurrenceManager.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 +41 -2
- package/dist/cjs/interaction/AttributeDataDecoder.js.map +1 -1
- package/dist/cjs/interaction/AttributeDataEncoder.d.ts.map +1 -1
- package/dist/cjs/interaction/AttributeDataEncoder.js +3 -3
- package/dist/cjs/interaction/AttributeDataEncoder.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 +71 -18
- 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 +7 -4
- 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 +7 -7
- package/dist/cjs/interaction/InteractionServer.js.map +1 -1
- package/dist/cjs/interaction/ServerSubscription.d.ts.map +1 -1
- package/dist/cjs/interaction/ServerSubscription.js +1 -1
- package/dist/cjs/interaction/ServerSubscription.js.map +1 -1
- package/dist/cjs/mdns/MdnsScanner.js +2 -2
- package/dist/cjs/mdns/MdnsScanner.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 +136 -136
- package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
- package/dist/cjs/peer/ControllerDiscovery.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerDiscovery.js +4 -4
- package/dist/cjs/peer/ControllerDiscovery.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 +1 -2
- package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
- package/dist/esm/ble/BtpSessionHandler.js +2 -2
- package/dist/esm/ble/BtpSessionHandler.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/certificate/CertificateManager.d.ts.map +1 -1
- package/dist/esm/certificate/CertificateManager.js +22 -19
- package/dist/esm/certificate/CertificateManager.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/cluster/server/AttributeServer.d.ts.map +1 -1
- package/dist/esm/cluster/server/AttributeServer.js +15 -6
- package/dist/esm/cluster/server/AttributeServer.js.map +1 -1
- package/dist/esm/cluster/server/CommandServer.js +3 -3
- package/dist/esm/cluster/server/CommandServer.js.map +1 -1
- package/dist/esm/common/FailsafeContext.js +1 -1
- package/dist/esm/common/FailsafeContext.js.map +1 -1
- package/dist/esm/endpoint/EndpointStructureLogger.js +1 -1
- package/dist/esm/endpoint/EndpointStructureLogger.js.map +1 -1
- package/dist/esm/events/OccurrenceManager.d.ts.map +1 -1
- package/dist/esm/events/OccurrenceManager.js +3 -2
- package/dist/esm/events/OccurrenceManager.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 +41 -2
- package/dist/esm/interaction/AttributeDataDecoder.js.map +1 -1
- package/dist/esm/interaction/AttributeDataEncoder.d.ts.map +1 -1
- package/dist/esm/interaction/AttributeDataEncoder.js +4 -4
- package/dist/esm/interaction/AttributeDataEncoder.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 +74 -18
- 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 +8 -4
- 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 +17 -8
- package/dist/esm/interaction/InteractionServer.js.map +1 -1
- package/dist/esm/interaction/ServerSubscription.d.ts.map +1 -1
- package/dist/esm/interaction/ServerSubscription.js +2 -1
- package/dist/esm/interaction/ServerSubscription.js.map +1 -1
- package/dist/esm/mdns/MdnsScanner.js +2 -2
- package/dist/esm/mdns/MdnsScanner.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 +18 -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 +147 -137
- package/dist/esm/peer/ControllerCommissioningFlow.js.map +1 -1
- package/dist/esm/peer/ControllerDiscovery.d.ts.map +1 -1
- package/dist/esm/peer/ControllerDiscovery.js +5 -5
- package/dist/esm/peer/ControllerDiscovery.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 +2 -2
- package/dist/esm/protocol/ExchangeManager.js.map +1 -1
- package/package.json +6 -6
- package/src/ble/BtpSessionHandler.ts +2 -2
- package/src/certificate/CertificateAuthority.ts +1 -0
- package/src/certificate/CertificateManager.ts +22 -19
- package/src/cluster/client/ClusterClient.ts +3 -0
- package/src/cluster/server/AttributeServer.ts +15 -6
- package/src/cluster/server/CommandServer.ts +3 -3
- package/src/common/FailsafeContext.ts +1 -1
- package/src/endpoint/EndpointStructureLogger.ts +1 -1
- package/src/events/OccurrenceManager.ts +3 -2
- package/src/interaction/AttributeDataDecoder.ts +67 -7
- package/src/interaction/AttributeDataEncoder.ts +4 -4
- package/src/interaction/DecodedDataReport.ts +24 -5
- package/src/interaction/EventDataDecoder.ts +57 -5
- package/src/interaction/InteractionClient.ts +112 -18
- package/src/interaction/InteractionMessenger.ts +8 -4
- package/src/interaction/InteractionServer.ts +19 -9
- package/src/interaction/ServerSubscription.ts +2 -1
- package/src/mdns/MdnsScanner.ts +2 -2
- package/src/peer/ControllerCommissioner.ts +32 -7
- package/src/peer/ControllerCommissioningFlow.ts +160 -146
- package/src/peer/ControllerDiscovery.ts +5 -5
- package/src/peer/PeerSet.ts +7 -2
- package/src/protocol/ChannelManager.ts +11 -4
- package/src/protocol/ExchangeManager.ts +2 -2
|
@@ -52,27 +52,27 @@ class RecoverableCommissioningError extends CommissioningError {
|
|
|
52
52
|
}
|
|
53
53
|
const DEFAULT_FAILSAFE_TIME_MS = 6e4;
|
|
54
54
|
class ControllerCommissioningFlow {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
interactionClient;
|
|
56
|
+
ca;
|
|
57
|
+
fabric;
|
|
58
|
+
transitionToCase;
|
|
59
|
+
commissioningOptions;
|
|
60
|
+
commissioningSteps = new Array();
|
|
61
|
+
commissioningStepResults = /* @__PURE__ */ new Map();
|
|
62
62
|
#clusterClients = /* @__PURE__ */ new Map();
|
|
63
63
|
#commissioningStartedTime;
|
|
64
64
|
#commissioningExpiryTime;
|
|
65
65
|
#lastFailSafeTime;
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
lastBreadcrumb = 1;
|
|
67
|
+
collectedCommissioningData = {};
|
|
68
68
|
#failSafeTimeMs = DEFAULT_FAILSAFE_TIME_MS;
|
|
69
69
|
constructor(interactionClient, ca, fabric, commissioningOptions, transitionToCase) {
|
|
70
|
-
this
|
|
71
|
-
this
|
|
72
|
-
this
|
|
73
|
-
this
|
|
74
|
-
this
|
|
75
|
-
logger.debug(`Commissioning options: ${import_general.
|
|
70
|
+
this.interactionClient = interactionClient;
|
|
71
|
+
this.ca = ca;
|
|
72
|
+
this.fabric = fabric;
|
|
73
|
+
this.transitionToCase = transitionToCase;
|
|
74
|
+
this.commissioningOptions = commissioningOptions;
|
|
75
|
+
logger.debug(`Commissioning options: ${import_general.Diagnostic.json(commissioningOptions)}`);
|
|
76
76
|
this.#initializeCommissioningSteps();
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
@@ -84,7 +84,7 @@ class ControllerCommissioningFlow {
|
|
|
84
84
|
async executeCommissioning() {
|
|
85
85
|
this.#sortSteps();
|
|
86
86
|
let failSafeTimerReArmedAfterPreviousStep = false;
|
|
87
|
-
for (const step of this
|
|
87
|
+
for (const step of this.commissioningSteps) {
|
|
88
88
|
logger.info(`Executing commissioning step ${step.stepNumber}.${step.subStepNumber}: ${step.name}`);
|
|
89
89
|
try {
|
|
90
90
|
if (step.reArmFailsafe && !failSafeTimerReArmedAfterPreviousStep) {
|
|
@@ -149,7 +149,7 @@ class ControllerCommissioningFlow {
|
|
|
149
149
|
logger.debug(
|
|
150
150
|
`Creating new cluster client for cluster ${cluster.name} (endpoint ${endpointId}, isFeatureSpecific ${isFeatureSpecific})`
|
|
151
151
|
);
|
|
152
|
-
const client = (0, import_ClusterClient.ClusterClient)(cluster, endpointId, this
|
|
152
|
+
const client = (0, import_ClusterClient.ClusterClient)(cluster, endpointId, this.interactionClient);
|
|
153
153
|
this.#clusterClients.set(cluster.id, client);
|
|
154
154
|
return client;
|
|
155
155
|
}
|
|
@@ -158,59 +158,59 @@ class ControllerCommissioningFlow {
|
|
|
158
158
|
* @see {@link MatterSpecification.v13.Core} § 5.5
|
|
159
159
|
*/
|
|
160
160
|
#initializeCommissioningSteps() {
|
|
161
|
-
this
|
|
161
|
+
this.commissioningSteps.push({
|
|
162
162
|
stepNumber: 0,
|
|
163
163
|
// Preparation
|
|
164
164
|
subStepNumber: 1,
|
|
165
165
|
name: "GetInitialData",
|
|
166
166
|
stepLogic: () => this.#getInitialData()
|
|
167
167
|
});
|
|
168
|
-
this
|
|
168
|
+
this.commissioningSteps.push({
|
|
169
169
|
stepNumber: 7,
|
|
170
170
|
subStepNumber: 1,
|
|
171
171
|
name: "GeneralCommissioning.ArmFailsafe",
|
|
172
172
|
stepLogic: () => this.#armFailsafe()
|
|
173
173
|
});
|
|
174
|
-
this
|
|
174
|
+
this.commissioningSteps.push({
|
|
175
175
|
stepNumber: 8,
|
|
176
176
|
subStepNumber: 1,
|
|
177
177
|
name: "GeneralCommissioning.ConfigureRegulatoryInformation",
|
|
178
178
|
stepLogic: () => this.#configureRegulatoryInformation()
|
|
179
179
|
});
|
|
180
|
-
this
|
|
180
|
+
this.commissioningSteps.push({
|
|
181
181
|
stepNumber: 8,
|
|
182
182
|
subStepNumber: 2,
|
|
183
183
|
name: "TimeSynchronization.SynchronizeTime",
|
|
184
184
|
stepLogic: () => this.#synchronizeTime()
|
|
185
185
|
});
|
|
186
|
-
this
|
|
186
|
+
this.commissioningSteps.push({
|
|
187
187
|
stepNumber: 10,
|
|
188
188
|
subStepNumber: 1,
|
|
189
189
|
name: "OperationalCredentials.DeviceAttestation",
|
|
190
190
|
stepLogic: () => this.#deviceAttestation()
|
|
191
191
|
});
|
|
192
|
-
this
|
|
192
|
+
this.commissioningSteps.push({
|
|
193
193
|
stepNumber: 11,
|
|
194
194
|
// includes 11-13
|
|
195
195
|
subStepNumber: 1,
|
|
196
196
|
name: "OperationalCredentials.Certificates",
|
|
197
197
|
stepLogic: () => this.#certificates()
|
|
198
198
|
});
|
|
199
|
-
this
|
|
199
|
+
this.commissioningSteps.push({
|
|
200
200
|
stepNumber: 15,
|
|
201
201
|
subStepNumber: 1,
|
|
202
202
|
name: "AccessControl",
|
|
203
203
|
stepLogic: () => this.#configureAccessControlLists()
|
|
204
204
|
});
|
|
205
|
-
if (this
|
|
206
|
-
this
|
|
205
|
+
if (this.interactionClient.channelType === import_general.ChannelType.BLE) {
|
|
206
|
+
this.commissioningSteps.push({
|
|
207
207
|
stepNumber: 16,
|
|
208
208
|
subStepNumber: 1,
|
|
209
209
|
name: "NetworkCommissioning.Validate",
|
|
210
210
|
stepLogic: () => this.#validateNetwork()
|
|
211
211
|
});
|
|
212
|
-
if (this
|
|
213
|
-
this
|
|
212
|
+
if (this.commissioningOptions.wifiNetwork !== void 0) {
|
|
213
|
+
this.commissioningSteps.push({
|
|
214
214
|
stepNumber: 16,
|
|
215
215
|
// includes step 17
|
|
216
216
|
subStepNumber: 2,
|
|
@@ -219,8 +219,8 @@ class ControllerCommissioningFlow {
|
|
|
219
219
|
stepLogic: () => this.#configureNetworkWifi()
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
-
if (this
|
|
223
|
-
this
|
|
222
|
+
if (this.commissioningOptions.threadNetwork !== void 0) {
|
|
223
|
+
this.commissioningSteps.push({
|
|
224
224
|
stepNumber: 16,
|
|
225
225
|
// includes step 17
|
|
226
226
|
subStepNumber: 3,
|
|
@@ -231,10 +231,10 @@ class ControllerCommissioningFlow {
|
|
|
231
231
|
}
|
|
232
232
|
} else {
|
|
233
233
|
logger.info(
|
|
234
|
-
`Skipping NetworkCommissioning steps because the device is already on IP network (${this
|
|
234
|
+
`Skipping NetworkCommissioning steps because the device is already on IP network (${this.interactionClient.channelType})`
|
|
235
235
|
);
|
|
236
236
|
}
|
|
237
|
-
this
|
|
237
|
+
this.commissioningSteps.push({
|
|
238
238
|
stepNumber: 18,
|
|
239
239
|
// includes step 19 (CASE connection)
|
|
240
240
|
subStepNumber: 1,
|
|
@@ -242,13 +242,13 @@ class ControllerCommissioningFlow {
|
|
|
242
242
|
reArmFailsafe: true,
|
|
243
243
|
stepLogic: () => this.#reconnectWithDevice()
|
|
244
244
|
});
|
|
245
|
-
this
|
|
245
|
+
this.commissioningSteps.push({
|
|
246
246
|
stepNumber: 20,
|
|
247
247
|
subStepNumber: 1,
|
|
248
248
|
name: "GeneralCommissioning.Complete",
|
|
249
249
|
stepLogic: () => this.#completeCommissioning()
|
|
250
250
|
});
|
|
251
|
-
this
|
|
251
|
+
this.commissioningSteps.push({
|
|
252
252
|
stepNumber: 99,
|
|
253
253
|
// Should be allowed in Step 13, but Tasmota is not supporting this
|
|
254
254
|
subStepNumber: 1,
|
|
@@ -257,16 +257,16 @@ class ControllerCommissioningFlow {
|
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
259
|
#sortSteps() {
|
|
260
|
-
this
|
|
260
|
+
this.commissioningSteps.sort((a, b) => {
|
|
261
261
|
if (a.stepNumber !== b.stepNumber) return a.stepNumber - b.stepNumber;
|
|
262
262
|
return a.subStepNumber - b.subStepNumber;
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
265
|
#setCommissioningStepResult(step, result) {
|
|
266
|
-
this
|
|
266
|
+
this.commissioningStepResults.set(`${step.stepNumber}-${step.subStepNumber}`, result);
|
|
267
267
|
}
|
|
268
268
|
getCommissioningStepResult(stepNumber, subStepNumber) {
|
|
269
|
-
return this
|
|
269
|
+
return this.commissioningStepResults.get(`${stepNumber}-${subStepNumber}`);
|
|
270
270
|
}
|
|
271
271
|
/** Helper method to check for errorCode/debugTest responses and throw error on failure */
|
|
272
272
|
#ensureOperationalCredentialsSuccess(context, { statusCode, debugText, fabricIndex }) {
|
|
@@ -296,9 +296,9 @@ class ControllerCommissioningFlow {
|
|
|
296
296
|
*/
|
|
297
297
|
async #getInitialData() {
|
|
298
298
|
const descriptorClient = this.#getClusterClient(import_descriptor.Descriptor.Cluster);
|
|
299
|
-
this
|
|
300
|
-
this
|
|
301
|
-
const networkData = await this
|
|
299
|
+
this.collectedCommissioningData.rootPartsList = await descriptorClient.getPartsListAttribute();
|
|
300
|
+
this.collectedCommissioningData.rootServerList = await descriptorClient.getServerListAttribute();
|
|
301
|
+
const networkData = await this.interactionClient.getMultipleAttributes({
|
|
302
302
|
attributes: [
|
|
303
303
|
{
|
|
304
304
|
clusterId: import_network_commissioning.NetworkCommissioning.Complete.id,
|
|
@@ -322,17 +322,17 @@ class ControllerCommissioningFlow {
|
|
|
322
322
|
networkStatus.push({ endpointId, value });
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
this
|
|
326
|
-
this
|
|
325
|
+
this.collectedCommissioningData.networkFeatures = networkFeatures;
|
|
326
|
+
this.collectedCommissioningData.networkStatus = networkStatus;
|
|
327
327
|
const basicInfoClient = this.#getClusterClient(import_basic_information.BasicInformation.Cluster);
|
|
328
|
-
this
|
|
329
|
-
this
|
|
330
|
-
this
|
|
328
|
+
this.collectedCommissioningData.vendorId = await basicInfoClient.getVendorIdAttribute();
|
|
329
|
+
this.collectedCommissioningData.productId = await basicInfoClient.getProductIdAttribute();
|
|
330
|
+
this.collectedCommissioningData.productName = await basicInfoClient.getProductNameAttribute();
|
|
331
331
|
const generalCommissioningClient = this.#getClusterClient(import_general_commissioning.GeneralCommissioning.Cluster);
|
|
332
|
-
this
|
|
332
|
+
this.collectedCommissioningData.supportsConcurrentConnection = await generalCommissioningClient.getSupportsConcurrentConnectionAttribute();
|
|
333
333
|
return {
|
|
334
334
|
code: 0 /* Success */,
|
|
335
|
-
breadcrumb: this
|
|
335
|
+
breadcrumb: this.lastBreadcrumb
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
/**
|
|
@@ -346,9 +346,9 @@ class ControllerCommissioningFlow {
|
|
|
346
346
|
*/
|
|
347
347
|
async #armFailsafe() {
|
|
348
348
|
const client = this.#getClusterClient(import_general_commissioning.GeneralCommissioning.Cluster);
|
|
349
|
-
if (this
|
|
349
|
+
if (this.collectedCommissioningData.basicCommissioningInfo === void 0) {
|
|
350
350
|
const basicCommissioningInfo = await client.getBasicCommissioningInfoAttribute();
|
|
351
|
-
this
|
|
351
|
+
this.collectedCommissioningData.basicCommissioningInfo = basicCommissioningInfo;
|
|
352
352
|
this.#failSafeTimeMs = basicCommissioningInfo.failSafeExpiryLengthSeconds * 1e3;
|
|
353
353
|
this.#commissioningStartedTime = import_general.Time.nowMs();
|
|
354
354
|
this.#commissioningExpiryTime = this.#commissioningStartedTime + basicCommissioningInfo.maxCumulativeFailsafeSeconds * 1e3;
|
|
@@ -356,14 +356,14 @@ class ControllerCommissioningFlow {
|
|
|
356
356
|
this.#ensureGeneralCommissioningSuccess(
|
|
357
357
|
"armFailSafe",
|
|
358
358
|
await client.armFailSafe({
|
|
359
|
-
breadcrumb: this
|
|
360
|
-
expiryLengthSeconds: this
|
|
359
|
+
breadcrumb: this.lastBreadcrumb,
|
|
360
|
+
expiryLengthSeconds: this.collectedCommissioningData.basicCommissioningInfo?.failSafeExpiryLengthSeconds
|
|
361
361
|
})
|
|
362
362
|
);
|
|
363
363
|
this.#lastFailSafeTime = import_general.Time.nowMs();
|
|
364
364
|
return {
|
|
365
365
|
code: 0 /* Success */,
|
|
366
|
-
breadcrumb: this
|
|
366
|
+
breadcrumb: this.lastBreadcrumb
|
|
367
367
|
};
|
|
368
368
|
}
|
|
369
369
|
async #resetFailsafeTimer() {
|
|
@@ -371,7 +371,7 @@ class ControllerCommissioningFlow {
|
|
|
371
371
|
try {
|
|
372
372
|
const client = this.#getClusterClient(import_general_commissioning.GeneralCommissioning.Cluster);
|
|
373
373
|
await client.armFailSafe({
|
|
374
|
-
breadcrumb: this
|
|
374
|
+
breadcrumb: this.lastBreadcrumb,
|
|
375
375
|
expiryLengthSeconds: 0
|
|
376
376
|
});
|
|
377
377
|
this.#lastFailSafeTime = void 0;
|
|
@@ -387,26 +387,26 @@ class ControllerCommissioningFlow {
|
|
|
387
387
|
* Commissionee using the SetRegulatoryConfig command.
|
|
388
388
|
*/
|
|
389
389
|
async #configureRegulatoryInformation() {
|
|
390
|
-
if (this
|
|
390
|
+
if (this.collectedCommissioningData.networkFeatures === void 0) {
|
|
391
391
|
throw new CommissioningError("No network features collected. This should never happen.");
|
|
392
392
|
}
|
|
393
|
-
const hasRadioNetwork = this
|
|
393
|
+
const hasRadioNetwork = this.collectedCommissioningData.networkFeatures.some(
|
|
394
394
|
({ value: { wiFiNetworkInterface, threadNetworkInterface } }) => wiFiNetworkInterface || threadNetworkInterface
|
|
395
395
|
);
|
|
396
396
|
if (hasRadioNetwork) {
|
|
397
397
|
const client = this.#getClusterClient(import_general_commissioning.GeneralCommissioning.Cluster);
|
|
398
398
|
let locationCapability = await client.getLocationCapabilityAttribute();
|
|
399
399
|
if (locationCapability === import_general_commissioning.GeneralCommissioning.RegulatoryLocationType.IndoorOutdoor) {
|
|
400
|
-
locationCapability = this
|
|
400
|
+
locationCapability = this.commissioningOptions.regulatoryLocation;
|
|
401
401
|
} else {
|
|
402
402
|
logger.debug(
|
|
403
403
|
`Device does not support a configurable regulatory location type. Location is set to "${locationCapability === import_general_commissioning.GeneralCommissioning.RegulatoryLocationType.Indoor ? "Indoor" : "Outdoor"}"`
|
|
404
404
|
);
|
|
405
405
|
}
|
|
406
|
-
let countryCode = this
|
|
406
|
+
let countryCode = this.commissioningOptions.regulatoryCountryCode;
|
|
407
407
|
const regulatoryResult = await client.setRegulatoryConfig(
|
|
408
408
|
{
|
|
409
|
-
breadcrumb: this
|
|
409
|
+
breadcrumb: this.lastBreadcrumb++,
|
|
410
410
|
newRegulatoryConfig: locationCapability,
|
|
411
411
|
countryCode
|
|
412
412
|
},
|
|
@@ -421,7 +421,7 @@ class ControllerCommissioningFlow {
|
|
|
421
421
|
"setRegulatoryConfig",
|
|
422
422
|
await client.setRegulatoryConfig(
|
|
423
423
|
{
|
|
424
|
-
breadcrumb: this
|
|
424
|
+
breadcrumb: this.lastBreadcrumb,
|
|
425
425
|
newRegulatoryConfig: locationCapability,
|
|
426
426
|
countryCode
|
|
427
427
|
},
|
|
@@ -433,12 +433,12 @@ class ControllerCommissioningFlow {
|
|
|
433
433
|
}
|
|
434
434
|
return {
|
|
435
435
|
code: 0 /* Success */,
|
|
436
|
-
breadcrumb: this
|
|
436
|
+
breadcrumb: this.lastBreadcrumb
|
|
437
437
|
};
|
|
438
438
|
}
|
|
439
439
|
return {
|
|
440
440
|
code: 2 /* Skipped */,
|
|
441
|
-
breadcrumb: this
|
|
441
|
+
breadcrumb: this.lastBreadcrumb
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
444
|
/**
|
|
@@ -451,14 +451,14 @@ class ControllerCommissioningFlow {
|
|
|
451
451
|
* ▪ 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.
|
|
452
452
|
*/
|
|
453
453
|
async #synchronizeTime() {
|
|
454
|
-
if (this
|
|
454
|
+
if (this.collectedCommissioningData.rootServerList !== void 0 && this.collectedCommissioningData.rootServerList.find(
|
|
455
455
|
(clusterId) => clusterId === import_time_synchronization.TimeSynchronizationCluster.id
|
|
456
456
|
)) {
|
|
457
457
|
logger.debug("TimeSynchronization cluster is supported");
|
|
458
458
|
}
|
|
459
459
|
return {
|
|
460
460
|
code: 2 /* Skipped */,
|
|
461
|
-
breadcrumb: this
|
|
461
|
+
breadcrumb: this.lastBreadcrumb
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
464
|
/**
|
|
@@ -491,7 +491,7 @@ class ControllerCommissioningFlow {
|
|
|
491
491
|
}
|
|
492
492
|
return {
|
|
493
493
|
code: 0 /* Success */,
|
|
494
|
-
breadcrumb: this
|
|
494
|
+
breadcrumb: this.lastBreadcrumb
|
|
495
495
|
};
|
|
496
496
|
}
|
|
497
497
|
/**
|
|
@@ -523,31 +523,31 @@ class ControllerCommissioningFlow {
|
|
|
523
523
|
const operationalPublicKey = import_CertificateManager.CertificateManager.getPublicKeyFromCsr(certSigningRequest);
|
|
524
524
|
await operationalCredentialsClusterClient.addTrustedRootCertificate(
|
|
525
525
|
{
|
|
526
|
-
rootCaCertificate: this
|
|
526
|
+
rootCaCertificate: this.ca.rootCert
|
|
527
527
|
},
|
|
528
528
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
529
529
|
);
|
|
530
|
-
const peerOperationalCert = this
|
|
530
|
+
const peerOperationalCert = this.ca.generateNoc(
|
|
531
531
|
operationalPublicKey,
|
|
532
|
-
this
|
|
533
|
-
this
|
|
532
|
+
this.fabric.fabricId,
|
|
533
|
+
this.interactionClient.address.nodeId
|
|
534
534
|
);
|
|
535
535
|
const addNocResponse = await operationalCredentialsClusterClient.addNoc(
|
|
536
536
|
{
|
|
537
537
|
nocValue: peerOperationalCert,
|
|
538
538
|
icacValue: new Uint8Array(0),
|
|
539
|
-
ipkValue: this
|
|
540
|
-
adminVendorId: this
|
|
541
|
-
caseAdminSubject: this
|
|
539
|
+
ipkValue: this.fabric.identityProtectionKey,
|
|
540
|
+
adminVendorId: this.fabric.rootVendorId,
|
|
541
|
+
caseAdminSubject: this.fabric.rootNodeId
|
|
542
542
|
},
|
|
543
543
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
544
544
|
);
|
|
545
545
|
this.#ensureOperationalCredentialsSuccess("addNoc", addNocResponse);
|
|
546
546
|
const { fabricIndex } = addNocResponse;
|
|
547
|
-
this
|
|
547
|
+
this.collectedCommissioningData.fabricIndex = fabricIndex;
|
|
548
548
|
return {
|
|
549
549
|
code: 0 /* Success */,
|
|
550
|
-
breadcrumb: this
|
|
550
|
+
breadcrumb: this.lastBreadcrumb
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
553
|
/**
|
|
@@ -558,12 +558,12 @@ class ControllerCommissioningFlow {
|
|
|
558
558
|
* the commissioning process.
|
|
559
559
|
*/
|
|
560
560
|
async #updateFabricLabel() {
|
|
561
|
-
const { fabricIndex } = this
|
|
561
|
+
const { fabricIndex } = this.collectedCommissioningData;
|
|
562
562
|
if (fabricIndex === void 0) {
|
|
563
563
|
logger.error("No fabric index available after addNoc. This should never happen.");
|
|
564
564
|
return {
|
|
565
565
|
code: 1 /* Failure */,
|
|
566
|
-
breadcrumb: this
|
|
566
|
+
breadcrumb: this.lastBreadcrumb
|
|
567
567
|
};
|
|
568
568
|
}
|
|
569
569
|
const operationalCredentialCluster = this.#getClusterClient(import_operational_credentials.OperationalCredentials.Cluster);
|
|
@@ -571,7 +571,7 @@ class ControllerCommissioningFlow {
|
|
|
571
571
|
this.#ensureOperationalCredentialsSuccess(
|
|
572
572
|
"updateFabricLabel",
|
|
573
573
|
await operationalCredentialCluster.updateFabricLabel({
|
|
574
|
-
label: this
|
|
574
|
+
label: this.fabric.label,
|
|
575
575
|
fabricIndex
|
|
576
576
|
})
|
|
577
577
|
);
|
|
@@ -580,7 +580,7 @@ class ControllerCommissioningFlow {
|
|
|
580
580
|
}
|
|
581
581
|
return {
|
|
582
582
|
code: 0 /* Success */,
|
|
583
|
-
breadcrumb: this
|
|
583
|
+
breadcrumb: this.lastBreadcrumb
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
586
|
/**
|
|
@@ -593,7 +593,7 @@ class ControllerCommissioningFlow {
|
|
|
593
593
|
async #configureAccessControlLists() {
|
|
594
594
|
return {
|
|
595
595
|
code: 2 /* Skipped */,
|
|
596
|
-
breadcrumb: this
|
|
596
|
+
breadcrumb: this.lastBreadcrumb
|
|
597
597
|
};
|
|
598
598
|
}
|
|
599
599
|
/**
|
|
@@ -610,14 +610,14 @@ class ControllerCommissioningFlow {
|
|
|
610
610
|
* operational network.
|
|
611
611
|
*/
|
|
612
612
|
async #validateNetwork() {
|
|
613
|
-
if (this
|
|
613
|
+
if (this.collectedCommissioningData.networkFeatures === void 0 || this.collectedCommissioningData.networkStatus === void 0) {
|
|
614
614
|
throw new CommissioningError("No network features or status collected. This should never happen.");
|
|
615
615
|
}
|
|
616
|
-
if (this
|
|
617
|
-
const anyEthernetInterface = this
|
|
616
|
+
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)) {
|
|
617
|
+
const anyEthernetInterface = this.collectedCommissioningData.networkFeatures.length === 0 || this.collectedCommissioningData.networkFeatures.some(
|
|
618
618
|
({ value: { ethernetNetworkInterface } }) => ethernetNetworkInterface === true
|
|
619
619
|
);
|
|
620
|
-
const anyInterfaceConnected = this
|
|
620
|
+
const anyInterfaceConnected = this.collectedCommissioningData.networkStatus.length === 0 || this.collectedCommissioningData.networkStatus.some(
|
|
621
621
|
({ value }) => value.some(({ connected }) => connected)
|
|
622
622
|
);
|
|
623
623
|
if (!anyEthernetInterface && !anyInterfaceConnected) {
|
|
@@ -628,40 +628,40 @@ class ControllerCommissioningFlow {
|
|
|
628
628
|
}
|
|
629
629
|
return {
|
|
630
630
|
code: 0 /* Success */,
|
|
631
|
-
breadcrumb: this
|
|
631
|
+
breadcrumb: this.lastBreadcrumb
|
|
632
632
|
};
|
|
633
633
|
}
|
|
634
634
|
async #configureNetworkWifi() {
|
|
635
|
-
if (this
|
|
635
|
+
if (this.commissioningOptions.wifiNetwork === void 0) {
|
|
636
636
|
logger.debug("WiFi network is not configured");
|
|
637
637
|
return {
|
|
638
638
|
code: 2 /* Skipped */,
|
|
639
|
-
breadcrumb: this
|
|
639
|
+
breadcrumb: this.lastBreadcrumb
|
|
640
640
|
};
|
|
641
641
|
}
|
|
642
|
-
if (this
|
|
643
|
-
const rootNetworkFeatures = this
|
|
642
|
+
if (this.collectedCommissioningData.networkFeatures !== void 0 && this.collectedCommissioningData.networkStatus !== void 0) {
|
|
643
|
+
const rootNetworkFeatures = this.collectedCommissioningData.networkFeatures.find(
|
|
644
644
|
({ endpointId }) => endpointId === 0
|
|
645
645
|
)?.value;
|
|
646
|
-
const rootNetworkStatus = this
|
|
646
|
+
const rootNetworkStatus = this.collectedCommissioningData.networkStatus.find(
|
|
647
647
|
({ endpointId }) => endpointId === 0
|
|
648
648
|
)?.value;
|
|
649
649
|
logger.debug(
|
|
650
|
-
`Root Networks found: ${import_general.
|
|
650
|
+
`Root Networks found: ${import_general.Diagnostic.json(rootNetworkFeatures)} - ${import_general.Diagnostic.json(rootNetworkStatus)}`
|
|
651
651
|
);
|
|
652
652
|
if (rootNetworkFeatures?.wiFiNetworkInterface !== true) {
|
|
653
653
|
logger.debug("Commissionee does not support any WiFi network interface");
|
|
654
654
|
return {
|
|
655
655
|
code: 2 /* Skipped */,
|
|
656
|
-
breadcrumb: this
|
|
656
|
+
breadcrumb: this.lastBreadcrumb
|
|
657
657
|
};
|
|
658
658
|
}
|
|
659
659
|
if (rootNetworkStatus !== void 0 && rootNetworkStatus.length > 0 && rootNetworkStatus[0].connected) {
|
|
660
660
|
logger.debug("Commissionee is already connected to the WiFi network");
|
|
661
|
-
this
|
|
661
|
+
this.collectedCommissioningData.successfullyConnectedToNetwork = true;
|
|
662
662
|
return {
|
|
663
663
|
code: 2 /* Skipped */,
|
|
664
|
-
breadcrumb: this
|
|
664
|
+
breadcrumb: this.lastBreadcrumb
|
|
665
665
|
};
|
|
666
666
|
}
|
|
667
667
|
}
|
|
@@ -671,12 +671,12 @@ class ControllerCommissioningFlow {
|
|
|
671
671
|
(0, import_types.EndpointNumber)(0),
|
|
672
672
|
true
|
|
673
673
|
);
|
|
674
|
-
const ssid = import_general.Bytes.fromString(this
|
|
675
|
-
const credentials = import_general.Bytes.fromString(this
|
|
674
|
+
const ssid = import_general.Bytes.fromString(this.commissioningOptions.wifiNetwork.wifiSsid);
|
|
675
|
+
const credentials = import_general.Bytes.fromString(this.commissioningOptions.wifiNetwork.wifiCredentials);
|
|
676
676
|
const { networkingStatus, wiFiScanResults, debugText } = await networkCommissioningClusterClient.scanNetworks(
|
|
677
677
|
{
|
|
678
678
|
ssid,
|
|
679
|
-
breadcrumb: this
|
|
679
|
+
breadcrumb: this.lastBreadcrumb++
|
|
680
680
|
},
|
|
681
681
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
682
682
|
);
|
|
@@ -685,7 +685,7 @@ class ControllerCommissioningFlow {
|
|
|
685
685
|
}
|
|
686
686
|
if (wiFiScanResults === void 0 || wiFiScanResults.length === 0) {
|
|
687
687
|
throw new CommissioningError(
|
|
688
|
-
`Commissionee did not return any WiFi networks for the requested SSID ${this
|
|
688
|
+
`Commissionee did not return any WiFi networks for the requested SSID ${this.commissioningOptions.wifiNetwork.wifiSsid}`
|
|
689
689
|
);
|
|
690
690
|
}
|
|
691
691
|
const {
|
|
@@ -696,7 +696,7 @@ class ControllerCommissioningFlow {
|
|
|
696
696
|
{
|
|
697
697
|
ssid,
|
|
698
698
|
credentials,
|
|
699
|
-
breadcrumb: this
|
|
699
|
+
breadcrumb: this.lastBreadcrumb++
|
|
700
700
|
},
|
|
701
701
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
702
702
|
);
|
|
@@ -707,7 +707,7 @@ class ControllerCommissioningFlow {
|
|
|
707
707
|
throw new CommissioningError(`Commissionee did not return network index`);
|
|
708
708
|
}
|
|
709
709
|
logger.debug(
|
|
710
|
-
`Commissionee added WiFi network ${this
|
|
710
|
+
`Commissionee added WiFi network ${this.commissioningOptions.wifiNetwork.wifiSsid} with network index ${networkIndex}`
|
|
711
711
|
);
|
|
712
712
|
const updatedNetworks = await networkCommissioningClusterClient.getNetworksAttribute();
|
|
713
713
|
if (updatedNetworks[networkIndex] === void 0) {
|
|
@@ -715,71 +715,71 @@ class ControllerCommissioningFlow {
|
|
|
715
715
|
}
|
|
716
716
|
const { networkId, connected } = updatedNetworks[networkIndex];
|
|
717
717
|
if (connected) {
|
|
718
|
-
this
|
|
718
|
+
this.collectedCommissioningData.successfullyConnectedToNetwork = true;
|
|
719
719
|
logger.debug(
|
|
720
|
-
`Commissionee is already connected to WiFi network ${this
|
|
720
|
+
`Commissionee is already connected to WiFi network ${this.commissioningOptions.wifiNetwork.wifiSsid} (networkId ${import_general.Bytes.toHex(networkId)})`
|
|
721
721
|
);
|
|
722
722
|
return {
|
|
723
723
|
code: 0 /* Success */,
|
|
724
|
-
breadcrumb: this
|
|
724
|
+
breadcrumb: this.lastBreadcrumb
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
727
|
const connectResult = await networkCommissioningClusterClient.connectNetwork(
|
|
728
728
|
{
|
|
729
729
|
networkId,
|
|
730
|
-
breadcrumb: this
|
|
730
|
+
breadcrumb: this.lastBreadcrumb++
|
|
731
731
|
},
|
|
732
732
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
733
733
|
);
|
|
734
734
|
if (connectResult.networkingStatus !== import_network_commissioning.NetworkCommissioning.NetworkCommissioningStatus.Success) {
|
|
735
735
|
throw new CommissioningError(`Commissionee failed to connect to WiFi network: ${connectResult.debugText}`);
|
|
736
736
|
}
|
|
737
|
-
this
|
|
737
|
+
this.collectedCommissioningData.successfullyConnectedToNetwork = true;
|
|
738
738
|
logger.debug(
|
|
739
|
-
`Commissionee successfully connected to WiFi network ${this
|
|
739
|
+
`Commissionee successfully connected to WiFi network ${this.commissioningOptions.wifiNetwork.wifiSsid} (networkId ${import_general.Bytes.toHex(networkId)})`
|
|
740
740
|
);
|
|
741
741
|
return {
|
|
742
742
|
code: 0 /* Success */,
|
|
743
|
-
breadcrumb: this
|
|
743
|
+
breadcrumb: this.lastBreadcrumb
|
|
744
744
|
};
|
|
745
745
|
}
|
|
746
746
|
async #configureNetworkThread() {
|
|
747
|
-
if (this
|
|
748
|
-
logger.
|
|
747
|
+
if (this.collectedCommissioningData.successfullyConnectedToNetwork) {
|
|
748
|
+
logger.info("Node is already connected to a network. Skipping Thread configuration.");
|
|
749
749
|
return {
|
|
750
750
|
code: 2 /* Skipped */,
|
|
751
|
-
breadcrumb: this
|
|
751
|
+
breadcrumb: this.lastBreadcrumb
|
|
752
752
|
};
|
|
753
753
|
}
|
|
754
|
-
if (this
|
|
754
|
+
if (this.commissioningOptions.threadNetwork === void 0) {
|
|
755
755
|
logger.debug("Thread network is not configured");
|
|
756
756
|
return {
|
|
757
757
|
code: 2 /* Skipped */,
|
|
758
|
-
breadcrumb: this
|
|
758
|
+
breadcrumb: this.lastBreadcrumb
|
|
759
759
|
};
|
|
760
760
|
}
|
|
761
|
-
if (this
|
|
762
|
-
const rootNetworkFeatures = this
|
|
761
|
+
if (this.collectedCommissioningData.networkFeatures !== void 0 && this.collectedCommissioningData.networkStatus !== void 0) {
|
|
762
|
+
const rootNetworkFeatures = this.collectedCommissioningData.networkFeatures.find(
|
|
763
763
|
({ endpointId }) => endpointId === 0
|
|
764
764
|
)?.value;
|
|
765
|
-
const rootNetworkStatus = this
|
|
765
|
+
const rootNetworkStatus = this.collectedCommissioningData.networkStatus.find(
|
|
766
766
|
({ endpointId }) => endpointId === 0
|
|
767
767
|
)?.value;
|
|
768
768
|
logger.debug(
|
|
769
|
-
`Root Networks found: ${import_general.
|
|
769
|
+
`Root Networks found: ${import_general.Diagnostic.json(rootNetworkFeatures)} - ${import_general.Diagnostic.json(rootNetworkStatus)}`
|
|
770
770
|
);
|
|
771
771
|
if (rootNetworkFeatures?.threadNetworkInterface !== true) {
|
|
772
772
|
logger.debug("Commissionee does not support any Thread network interface");
|
|
773
773
|
return {
|
|
774
774
|
code: 2 /* Skipped */,
|
|
775
|
-
breadcrumb: this
|
|
775
|
+
breadcrumb: this.lastBreadcrumb
|
|
776
776
|
};
|
|
777
777
|
}
|
|
778
778
|
if (rootNetworkStatus !== void 0 && rootNetworkStatus.length > 0 && rootNetworkStatus[0].connected) {
|
|
779
779
|
logger.debug("Commissionee is already connected to the Thread network");
|
|
780
780
|
return {
|
|
781
781
|
code: 2 /* Skipped */,
|
|
782
|
-
breadcrumb: this
|
|
782
|
+
breadcrumb: this.lastBreadcrumb
|
|
783
783
|
};
|
|
784
784
|
}
|
|
785
785
|
}
|
|
@@ -790,7 +790,7 @@ class ControllerCommissioningFlow {
|
|
|
790
790
|
true
|
|
791
791
|
);
|
|
792
792
|
const { networkingStatus, threadScanResults, debugText } = await networkCommissioningClusterClient.scanNetworks(
|
|
793
|
-
{ breadcrumb: this
|
|
793
|
+
{ breadcrumb: this.lastBreadcrumb++ },
|
|
794
794
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
795
795
|
);
|
|
796
796
|
if (networkingStatus !== import_network_commissioning.NetworkCommissioning.NetworkCommissioningStatus.Success) {
|
|
@@ -798,19 +798,19 @@ class ControllerCommissioningFlow {
|
|
|
798
798
|
}
|
|
799
799
|
if (threadScanResults === void 0 || threadScanResults.length === 0) {
|
|
800
800
|
throw new CommissioningError(
|
|
801
|
-
`Commissionee did not return any Thread networks for the requested Network ${this
|
|
801
|
+
`Commissionee did not return any Thread networks for the requested Network ${this.commissioningOptions.threadNetwork.networkName}`
|
|
802
802
|
);
|
|
803
803
|
}
|
|
804
804
|
const wantedNetworkFound = threadScanResults.find(
|
|
805
|
-
({ networkName }) => networkName === this
|
|
805
|
+
({ networkName }) => networkName === this.commissioningOptions.threadNetwork?.networkName
|
|
806
806
|
);
|
|
807
807
|
if (wantedNetworkFound === void 0) {
|
|
808
808
|
throw new CommissioningError(
|
|
809
|
-
`Commissionee did not return the requested Network ${this
|
|
809
|
+
`Commissionee did not return the requested Network ${this.commissioningOptions.threadNetwork.networkName}: ${import_general.Diagnostic.json(threadScanResults)}`
|
|
810
810
|
);
|
|
811
811
|
}
|
|
812
812
|
logger.debug(
|
|
813
|
-
`Commissionee found wanted Thread network ${this
|
|
813
|
+
`Commissionee found wanted Thread network ${this.commissioningOptions.threadNetwork.networkName}: ${import_general.Diagnostic.json(wantedNetworkFound)}`
|
|
814
814
|
);
|
|
815
815
|
const {
|
|
816
816
|
networkingStatus: addNetworkingStatus,
|
|
@@ -818,8 +818,8 @@ class ControllerCommissioningFlow {
|
|
|
818
818
|
networkIndex
|
|
819
819
|
} = await networkCommissioningClusterClient.addOrUpdateThreadNetwork(
|
|
820
820
|
{
|
|
821
|
-
operationalDataset: import_general.Bytes.fromHex(this
|
|
822
|
-
breadcrumb: this
|
|
821
|
+
operationalDataset: import_general.Bytes.fromHex(this.commissioningOptions.threadNetwork.operationalDataset),
|
|
822
|
+
breadcrumb: this.lastBreadcrumb++
|
|
823
823
|
},
|
|
824
824
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
825
825
|
);
|
|
@@ -830,7 +830,7 @@ class ControllerCommissioningFlow {
|
|
|
830
830
|
throw new CommissioningError(`Commissionee did not return network index`);
|
|
831
831
|
}
|
|
832
832
|
logger.debug(
|
|
833
|
-
`Commissionee added Thread network ${this
|
|
833
|
+
`Commissionee added Thread network ${this.commissioningOptions.threadNetwork.networkName} with network index ${networkIndex}`
|
|
834
834
|
);
|
|
835
835
|
const updatedNetworks = await networkCommissioningClusterClient.getNetworksAttribute();
|
|
836
836
|
if (updatedNetworks[networkIndex] === void 0) {
|
|
@@ -839,17 +839,17 @@ class ControllerCommissioningFlow {
|
|
|
839
839
|
const { networkId, connected } = updatedNetworks[networkIndex];
|
|
840
840
|
if (connected) {
|
|
841
841
|
logger.debug(
|
|
842
|
-
`Commissionee is already connected to Thread network ${this
|
|
842
|
+
`Commissionee is already connected to Thread network ${this.commissioningOptions.threadNetwork.networkName} (networkId ${import_general.Bytes.toHex(networkId)})`
|
|
843
843
|
);
|
|
844
844
|
return {
|
|
845
845
|
code: 0 /* Success */,
|
|
846
|
-
breadcrumb: this
|
|
846
|
+
breadcrumb: this.lastBreadcrumb
|
|
847
847
|
};
|
|
848
848
|
}
|
|
849
849
|
const connectResult = await networkCommissioningClusterClient.connectNetwork(
|
|
850
850
|
{
|
|
851
851
|
networkId,
|
|
852
|
-
breadcrumb: this
|
|
852
|
+
breadcrumb: this.lastBreadcrumb++
|
|
853
853
|
},
|
|
854
854
|
{ useExtendedFailSafeMessageResponseTimeout: true }
|
|
855
855
|
);
|
|
@@ -859,11 +859,11 @@ class ControllerCommissioningFlow {
|
|
|
859
859
|
);
|
|
860
860
|
}
|
|
861
861
|
logger.debug(
|
|
862
|
-
`Commissionee successfully connected to Thread network ${this
|
|
862
|
+
`Commissionee successfully connected to Thread network ${this.commissioningOptions.threadNetwork.networkName} (networkId ${import_general.Bytes.toHex(networkId)})`
|
|
863
863
|
);
|
|
864
864
|
return {
|
|
865
865
|
code: 0 /* Success */,
|
|
866
|
-
breadcrumb: this
|
|
866
|
+
breadcrumb: this.lastBreadcrumb
|
|
867
867
|
};
|
|
868
868
|
}
|
|
869
869
|
/**
|
|
@@ -875,7 +875,7 @@ class ControllerCommissioningFlow {
|
|
|
875
875
|
* (CASE)”) session with the Commissionee over the operational network.
|
|
876
876
|
*/
|
|
877
877
|
async #reconnectWithDevice() {
|
|
878
|
-
const isConcurrentFlow = this
|
|
878
|
+
const isConcurrentFlow = this.collectedCommissioningData.supportsConcurrentConnection !== false;
|
|
879
879
|
logger.debug(`Reconnecting with device with ${isConcurrentFlow ? "concurrent" : "non-concurrent"} flow ...`);
|
|
880
880
|
const reArmFailsafeInterval = import_general.Time.getPeriodicTimer(
|
|
881
881
|
"Re-Arm Failsafe during reconnect",
|
|
@@ -898,8 +898,8 @@ class ControllerCommissioningFlow {
|
|
|
898
898
|
if (isConcurrentFlow) {
|
|
899
899
|
reArmFailsafeInterval.start();
|
|
900
900
|
}
|
|
901
|
-
const transitionResult = await this
|
|
902
|
-
this
|
|
901
|
+
const transitionResult = await this.transitionToCase(
|
|
902
|
+
this.interactionClient.address,
|
|
903
903
|
// Assume concurrent connections are supported if not know (which should not be the case when we came here)
|
|
904
904
|
isConcurrentFlow
|
|
905
905
|
);
|
|
@@ -908,15 +908,15 @@ class ControllerCommissioningFlow {
|
|
|
908
908
|
logger.debug("CASE commissioning handled externally, terminating commissioning flow");
|
|
909
909
|
return {
|
|
910
910
|
code: 3 /* Stop */,
|
|
911
|
-
breadcrumb: this
|
|
911
|
+
breadcrumb: this.lastBreadcrumb
|
|
912
912
|
};
|
|
913
913
|
}
|
|
914
|
-
this
|
|
914
|
+
this.interactionClient = transitionResult;
|
|
915
915
|
this.#clusterClients.clear();
|
|
916
916
|
logger.debug("Successfully reconnected with device ...");
|
|
917
917
|
return {
|
|
918
918
|
code: 0 /* Success */,
|
|
919
|
-
breadcrumb: this
|
|
919
|
+
breadcrumb: this.lastBreadcrumb
|
|
920
920
|
};
|
|
921
921
|
}
|
|
922
922
|
/**
|
|
@@ -937,7 +937,7 @@ class ControllerCommissioningFlow {
|
|
|
937
937
|
this.#lastFailSafeTime = void 0;
|
|
938
938
|
return {
|
|
939
939
|
code: 0 /* Success */,
|
|
940
|
-
breadcrumb: this
|
|
940
|
+
breadcrumb: this.lastBreadcrumb
|
|
941
941
|
};
|
|
942
942
|
}
|
|
943
943
|
}
|