@project-chip/matter.js 0.16.0-alpha.0-20251020-3f6e46245 → 0.16.0-alpha.0-20251022-5a69ce65a
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/CommissioningController.d.ts +4 -42
- package/dist/cjs/CommissioningController.d.ts.map +1 -1
- package/dist/cjs/CommissioningController.js +17 -93
- package/dist/cjs/CommissioningController.js.map +1 -1
- package/dist/cjs/MatterController.d.ts +39 -68
- package/dist/cjs/MatterController.d.ts.map +1 -1
- package/dist/cjs/MatterController.js +175 -212
- package/dist/cjs/MatterController.js.map +2 -2
- package/dist/cjs/PaseCommissioner.d.ts.map +1 -1
- package/dist/cjs/PaseCommissioner.js +4 -14
- package/dist/cjs/PaseCommissioner.js.map +2 -2
- package/dist/esm/CommissioningController.d.ts +4 -42
- package/dist/esm/CommissioningController.d.ts.map +1 -1
- package/dist/esm/CommissioningController.js +18 -101
- package/dist/esm/CommissioningController.js.map +1 -1
- package/dist/esm/MatterController.d.ts +39 -68
- package/dist/esm/MatterController.d.ts.map +1 -1
- package/dist/esm/MatterController.js +178 -221
- package/dist/esm/MatterController.js.map +2 -2
- package/dist/esm/PaseCommissioner.d.ts.map +1 -1
- package/dist/esm/PaseCommissioner.js +5 -17
- package/dist/esm/PaseCommissioner.js.map +1 -1
- package/package.json +8 -8
- package/src/CommissioningController.ts +22 -126
- package/src/MatterController.ts +240 -268
- package/src/PaseCommissioner.ts +4 -18
- package/src/tsconfig.json +2 -2
|
@@ -3,14 +3,11 @@
|
|
|
3
3
|
* Copyright 2022-2025 Matter.js Authors
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { ImplementationError, Logger, Minutes
|
|
6
|
+
import { ImplementationError, Logger, Minutes } from "#general";
|
|
7
7
|
import {
|
|
8
8
|
ControllerDiscovery,
|
|
9
9
|
MdnsService
|
|
10
10
|
} from "#protocol";
|
|
11
|
-
import {
|
|
12
|
-
configureNetwork as configureControllerNetwork
|
|
13
|
-
} from "./CommissioningController.js";
|
|
14
11
|
import { MatterController } from "./MatterController.js";
|
|
15
12
|
const logger = new Logger("PaseCommissioner");
|
|
16
13
|
class PaseCommissioner {
|
|
@@ -46,26 +43,17 @@ class PaseCommissioner {
|
|
|
46
43
|
return this.controllerInstance;
|
|
47
44
|
}
|
|
48
45
|
const { certificateAuthorityConfig: rootCertificateData, fabricConfig } = this.options;
|
|
49
|
-
let mdnsClient;
|
|
50
|
-
let ipv4Disabled = false;
|
|
51
46
|
try {
|
|
52
|
-
|
|
53
|
-
ipv4Disabled = !mdnsService.enableIpv4;
|
|
54
|
-
mdnsClient = mdnsService.client;
|
|
47
|
+
await this.environment.load(MdnsService);
|
|
55
48
|
} catch {
|
|
56
49
|
logger.debug("No networking available, using only BLE");
|
|
57
50
|
}
|
|
58
|
-
const { scanners, netInterfaces } = await configureControllerNetwork({
|
|
59
|
-
network: this.environment.get(Network),
|
|
60
|
-
mdnsClient,
|
|
61
|
-
ipv4Disabled,
|
|
62
|
-
...this.options
|
|
63
|
-
});
|
|
64
51
|
return await MatterController.createAsPaseCommissioner({
|
|
52
|
+
id: "PaseCommissioner",
|
|
53
|
+
// In Memory anyway
|
|
54
|
+
environment: this.environment,
|
|
65
55
|
certificateAuthorityConfig: rootCertificateData,
|
|
66
56
|
fabricConfig,
|
|
67
|
-
scanners,
|
|
68
|
-
transports: netInterfaces,
|
|
69
57
|
adminFabricLabel: this.options.fabricConfig.label
|
|
70
58
|
});
|
|
71
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/PaseCommissioner.ts"],
|
|
4
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,SAAsB,qBAAqB,QAAQ,
|
|
4
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,SAAsB,qBAAqB,QAAQ,eAAe;AAClE;AAAA,EAII;AAAA,EAGA;AAAA,OAEG;AAOP,SAAS,wBAAwB;AAEjC,MAAM,SAAS,IAAI,OAAO,kBAAkB;AAkBrC,MAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS1B,YAA6B,SAAkC;AAAlC;AACzB,QAAI,QAAQ,gBAAgB,QAAW;AACnC,YAAM,IAAI,oBAAoB,wDAAwD;AAAA,IAC1F;AACA,UAAM,EAAE,YAAY,IAAI,QAAQ;AAChC,SAAK,cAAc;AAAA,EACvB;AAAA,EAdiB;AAAA,EACT;AAAA,EAeR,IAAI,SAAS;AACT,WAAO,KAAK,oBAAoB;AAAA,EACpC;AAAA,EAEA,0BAA0B,WAAoB;AAC1C,QAAI,KAAK,uBAAuB,QAAW;AACvC,YAAM,IAAI;AAAA,QACN,aAAa;AAAA,MACjB;AAAA,IACJ;AACA,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA,EAGA,MAAc,uBAAuB;AACjC,QAAI,KAAK,uBAAuB,QAAW;AACvC,aAAO,KAAK;AAAA,IAChB;AAEA,UAAM,EAAE,4BAA4B,qBAAqB,aAA2B,IAAI,KAAK;AAE7F,QAAI;AACA,YAAM,KAAK,YAAY,KAAK,WAAW;AAAA,IAC3C,QAAQ;AACJ,aAAO,MAAM,yCAAyC;AAAA,IAC1D;AAEA,WAAO,MAAM,iBAAiB,yBAAyB;AAAA,MACnD,IAAI;AAAA;AAAA,MACJ,aAAa,KAAK;AAAA,MAClB,4BAA4B;AAAA,MAC5B;AAAA,MACA,kBAAkB,KAAK,QAAQ,aAAa;AAAA,IAChD,CAAC;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,eACF,aACA,+BACF;AACE,UAAM,aAAa,KAAK,0BAA0B;AAElD,WAAO,MAAM,WAAW,WAAW,aAAa,EAAE,8BAA8B,CAAC;AAAA,EACrF;AAAA;AAAA,EAGA,MAAM,QAAQ;AACV,UAAM,KAAK,oBAAoB,MAAM;AACrC,SAAK,qBAAqB;AAAA,EAC9B;AAAA;AAAA,EAGA,MAAM,QAAQ;AACV,UAAM,UAAU,KAAK,YAAY;AACjC,YAAQ,IAAI,IAAI;AAChB,QAAI,KAAK,uBAAuB,QAAW;AACvC,WAAK,qBAAqB,MAAM,KAAK,qBAAqB;AAAA,IAC9D;AAAA,EACJ;AAAA,EAEA,oCACI,gBACA,uBACF;AACE,UAAM,aAAa,KAAK,0BAA0B;AAClD,eACK,gBAAgB,qBAAqB,EACrC;AAAA,MAAQ,CAAC,YACN,oBAAoB,oCAAoC,SAAS,cAAc;AAAA,IACnF;AAAA,EACR;AAAA,EAEA,MAAM,8BACF,gBACA,uBACA,oBACA,UAAU,QAAQ,EAAE,GACtB;AACE,UAAM,aAAa,KAAK,0BAA0B;AAClD,WAAO,MAAM,oBAAoB;AAAA,MAC7B,WAAW,gBAAgB,qBAAqB;AAAA,MAChD;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AACJ;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@project-chip/matter.js",
|
|
3
|
-
"version": "0.16.0-alpha.0-
|
|
3
|
+
"version": "0.16.0-alpha.0-20251022-5a69ce65a",
|
|
4
4
|
"description": "Matter protocol in pure js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iot",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"#*": "./src/*"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@matter/general": "0.16.0-alpha.0-
|
|
48
|
-
"@matter/model": "0.16.0-alpha.0-
|
|
49
|
-
"@matter/node": "0.16.0-alpha.0-
|
|
50
|
-
"@matter/protocol": "0.16.0-alpha.0-
|
|
51
|
-
"@matter/types": "0.16.0-alpha.0-
|
|
47
|
+
"@matter/general": "0.16.0-alpha.0-20251022-5a69ce65a",
|
|
48
|
+
"@matter/model": "0.16.0-alpha.0-20251022-5a69ce65a",
|
|
49
|
+
"@matter/node": "0.16.0-alpha.0-20251022-5a69ce65a",
|
|
50
|
+
"@matter/protocol": "0.16.0-alpha.0-20251022-5a69ce65a",
|
|
51
|
+
"@matter/types": "0.16.0-alpha.0-20251022-5a69ce65a"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@matter/tools": "0.16.0-alpha.0-
|
|
55
|
-
"@matter/testing": "0.16.0-alpha.0-
|
|
54
|
+
"@matter/tools": "0.16.0-alpha.0-20251022-5a69ce65a",
|
|
55
|
+
"@matter/testing": "0.16.0-alpha.0-20251022-5a69ce65a"
|
|
56
56
|
},
|
|
57
57
|
"files": [
|
|
58
58
|
"dist/**/*",
|
|
@@ -8,22 +8,20 @@ import { OperationalCredentials } from "#clusters";
|
|
|
8
8
|
import { ControllerStore } from "#ControllerStore.js";
|
|
9
9
|
import {
|
|
10
10
|
ClassExtends,
|
|
11
|
-
ConnectionlessTransportSet,
|
|
12
11
|
Crypto,
|
|
13
12
|
Environment,
|
|
14
13
|
ImplementationError,
|
|
15
14
|
InternalError,
|
|
16
15
|
Logger,
|
|
17
16
|
Minutes,
|
|
18
|
-
Network,
|
|
19
|
-
NoAddressAvailableError,
|
|
20
17
|
StorageContext,
|
|
21
|
-
UdpInterface,
|
|
22
18
|
UnexpectedDataError,
|
|
23
19
|
} from "#general";
|
|
24
20
|
import { LegacyControllerStore } from "#LegacyControllerStore.js";
|
|
25
21
|
import {
|
|
22
|
+
ActiveSessionInformation,
|
|
26
23
|
Ble,
|
|
24
|
+
CertificateAuthority,
|
|
27
25
|
CommissionableDevice,
|
|
28
26
|
CommissionableDeviceIdentifiers,
|
|
29
27
|
ControllerCommissioningFlow,
|
|
@@ -31,14 +29,11 @@ import {
|
|
|
31
29
|
DecodedAttributeReportValue,
|
|
32
30
|
DiscoveryAndCommissioningOptions,
|
|
33
31
|
DiscoveryData,
|
|
32
|
+
Fabric,
|
|
33
|
+
FabricGroups,
|
|
34
34
|
InteractionClient,
|
|
35
|
-
MdnsAdvertiser,
|
|
36
|
-
MdnsClient,
|
|
37
|
-
MdnsServer,
|
|
38
|
-
MdnsService,
|
|
39
35
|
MessageChannel,
|
|
40
36
|
NodeDiscoveryType,
|
|
41
|
-
ScannerSet,
|
|
42
37
|
} from "#protocol";
|
|
43
38
|
import {
|
|
44
39
|
CaseAuthenticatedTag,
|
|
@@ -49,7 +44,6 @@ import {
|
|
|
49
44
|
TypeFromPartialBitSchema,
|
|
50
45
|
VendorId,
|
|
51
46
|
} from "#types";
|
|
52
|
-
import { CertificateAuthority, Fabric, MdnsScannerTargetCriteria } from "@matter/protocol";
|
|
53
47
|
import { CommissioningControllerNodeOptions, NodeStates, PairedNode } from "./device/PairedNode.js";
|
|
54
48
|
import { MatterController } from "./MatterController.js";
|
|
55
49
|
|
|
@@ -163,20 +157,16 @@ export class CommissioningController {
|
|
|
163
157
|
readonly #listeningAddressIpv6?: string;
|
|
164
158
|
|
|
165
159
|
readonly #options: CommissioningControllerOptions;
|
|
160
|
+
#id: string;
|
|
166
161
|
|
|
167
162
|
#environment: Environment; // Set when new API was initialized correctly
|
|
168
163
|
#storage?: StorageContext;
|
|
169
164
|
|
|
170
|
-
#mdnsClient?: MdnsClient;
|
|
171
|
-
#mdnsServer?: MdnsServer;
|
|
172
|
-
|
|
173
165
|
#controllerInstance?: MatterController;
|
|
174
166
|
readonly #initializedNodes = new Map<NodeId, PairedNode>();
|
|
175
167
|
readonly #nodeUpdateLabelHandlers = new Map<NodeId, (nodeState: NodeStates) => Promise<void>>();
|
|
176
168
|
readonly #sessionDisconnectedHandler = new Map<NodeId, () => Promise<void>>();
|
|
177
169
|
|
|
178
|
-
#mdnsTargetCriteria?: MdnsScannerTargetCriteria;
|
|
179
|
-
|
|
180
170
|
/**
|
|
181
171
|
* Creates a new CommissioningController instance
|
|
182
172
|
*
|
|
@@ -189,6 +179,7 @@ export class CommissioningController {
|
|
|
189
179
|
|
|
190
180
|
const { environment, id } = options.environment;
|
|
191
181
|
this.#environment = new Environment(id, environment);
|
|
182
|
+
this.#id = id;
|
|
192
183
|
|
|
193
184
|
this.#options = options;
|
|
194
185
|
this.#crypto = this.#environment.get(Crypto);
|
|
@@ -216,10 +207,10 @@ export class CommissioningController {
|
|
|
216
207
|
}
|
|
217
208
|
|
|
218
209
|
#assertDependencies() {
|
|
219
|
-
if (this.#
|
|
210
|
+
if (this.#storage === undefined && this.#environment === undefined) {
|
|
220
211
|
throw new ImplementationError("Add the node to the Matter instance before.");
|
|
221
212
|
}
|
|
222
|
-
return {
|
|
213
|
+
return { storage: this.#storage, environment: this.#environment };
|
|
223
214
|
}
|
|
224
215
|
|
|
225
216
|
#assertControllerIsStarted(errorText?: string) {
|
|
@@ -248,7 +239,7 @@ export class CommissioningController {
|
|
|
248
239
|
rootFabric,
|
|
249
240
|
} = this.#options;
|
|
250
241
|
|
|
251
|
-
const {
|
|
242
|
+
const { storage, environment } = this.#assertDependencies();
|
|
252
243
|
|
|
253
244
|
// Initialize the Storage in a compatible way for the legacy API and new style for new API
|
|
254
245
|
// TODO: clean this up when we really implement ControllerNode/ClientNode concepts in new API
|
|
@@ -256,20 +247,9 @@ export class CommissioningController {
|
|
|
256
247
|
? environment.get(ControllerStore)
|
|
257
248
|
: new LegacyControllerStore(storage!);
|
|
258
249
|
|
|
259
|
-
const { netInterfaces, scanners, port } = await configureNetwork({
|
|
260
|
-
network: environment?.maybeGet(Network) ?? Environment.default.get(Network),
|
|
261
|
-
ble: environment?.maybeGet(Ble) ?? Environment.default.maybeGet(Ble),
|
|
262
|
-
ipv4Disabled: this.#ipv4Disabled,
|
|
263
|
-
mdnsClient,
|
|
264
|
-
localPort,
|
|
265
|
-
listeningAddressIpv4: this.#listeningAddressIpv4,
|
|
266
|
-
listeningAddressIpv6: this.#listeningAddressIpv6,
|
|
267
|
-
});
|
|
268
|
-
|
|
269
250
|
const controller = await MatterController.create({
|
|
251
|
+
id: this.#id,
|
|
270
252
|
controllerStore,
|
|
271
|
-
scanners,
|
|
272
|
-
transports: netInterfaces,
|
|
273
253
|
sessionClosedCallback: peerNodeId => {
|
|
274
254
|
logger.info(`Session for peer node ${peerNodeId} disconnected ...`);
|
|
275
255
|
const handler = this.#sessionDisconnectedHandler.get(peerNodeId);
|
|
@@ -285,9 +265,16 @@ export class CommissioningController {
|
|
|
285
265
|
rootNodeId,
|
|
286
266
|
rootCertificateAuthority,
|
|
287
267
|
rootFabric,
|
|
268
|
+
ble: !!(environment?.maybeGet(Ble) ?? Environment.default.maybeGet(Ble)),
|
|
269
|
+
ipv4: !this.#ipv4Disabled,
|
|
270
|
+
listeningAddressIpv4: this.#listeningAddressIpv4,
|
|
271
|
+
listeningAddressIpv6: this.#listeningAddressIpv6,
|
|
272
|
+
localPort,
|
|
273
|
+
environment: this.#environment,
|
|
288
274
|
});
|
|
289
|
-
|
|
290
|
-
|
|
275
|
+
|
|
276
|
+
if (!controller.ble) {
|
|
277
|
+
logger.warn("BLE is not enabled on this platform");
|
|
291
278
|
}
|
|
292
279
|
return controller;
|
|
293
280
|
}
|
|
@@ -486,26 +473,6 @@ export class CommissioningController {
|
|
|
486
473
|
return Array.from(this.#initializedNodes.values());
|
|
487
474
|
}
|
|
488
475
|
|
|
489
|
-
/**
|
|
490
|
-
* Set the MDNS Scanner instance. Should be only used internally
|
|
491
|
-
*
|
|
492
|
-
* @param mdnsServer MdnsScanner instance
|
|
493
|
-
* @private
|
|
494
|
-
*/
|
|
495
|
-
setMdnsClient(mdnsServer: MdnsClient) {
|
|
496
|
-
this.#mdnsClient = mdnsServer;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Set the MDNS Broadcaster instance. Should be only used internally
|
|
501
|
-
*
|
|
502
|
-
* @param mdnsServer MdnsBroadcaster instance
|
|
503
|
-
* @private
|
|
504
|
-
*/
|
|
505
|
-
setMdnsServer(mdnsServer: MdnsServer) {
|
|
506
|
-
this.#mdnsServer = mdnsServer;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
476
|
/** Returns true if t least one node is commissioned/paired with this controller instance. */
|
|
510
477
|
isCommissioned() {
|
|
511
478
|
const controller = this.#assertControllerIsStarted();
|
|
@@ -572,10 +539,6 @@ export class CommissioningController {
|
|
|
572
539
|
}
|
|
573
540
|
await this.#controllerInstance?.close();
|
|
574
541
|
|
|
575
|
-
if (this.#mdnsClient !== undefined && this.#mdnsTargetCriteria !== undefined) {
|
|
576
|
-
this.#mdnsClient.targetCriteriaProviders.delete(this.#mdnsTargetCriteria);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
542
|
this.#controllerInstance = undefined;
|
|
580
543
|
this.#initializedNodes.clear();
|
|
581
544
|
this.#ipv4Disabled = undefined;
|
|
@@ -622,12 +585,6 @@ export class CommissioningController {
|
|
|
622
585
|
await this.initializeControllerStore();
|
|
623
586
|
}
|
|
624
587
|
|
|
625
|
-
// Load the MDNS service from the environment and set onto the controller
|
|
626
|
-
const mdnsService = await env.load(MdnsService);
|
|
627
|
-
this.#ipv4Disabled = !mdnsService.enableIpv4;
|
|
628
|
-
this.setMdnsServer(mdnsService.server);
|
|
629
|
-
this.setMdnsClient(mdnsService.client);
|
|
630
|
-
|
|
631
588
|
this.#environment = env;
|
|
632
589
|
const runtime = env.runtime;
|
|
633
590
|
runtime.add(this);
|
|
@@ -638,17 +595,7 @@ export class CommissioningController {
|
|
|
638
595
|
this.#controllerInstance = await this.#initializeController();
|
|
639
596
|
}
|
|
640
597
|
|
|
641
|
-
this.#
|
|
642
|
-
commissionable: true,
|
|
643
|
-
operationalTargets: [
|
|
644
|
-
{
|
|
645
|
-
operationalId: this.#controllerInstance.fabricConfig.operationalId,
|
|
646
|
-
},
|
|
647
|
-
],
|
|
648
|
-
};
|
|
649
|
-
this.#mdnsClient?.targetCriteriaProviders.add(this.#mdnsTargetCriteria);
|
|
650
|
-
|
|
651
|
-
this.#controllerInstance.announce();
|
|
598
|
+
await this.#controllerInstance.start();
|
|
652
599
|
if (this.#options.autoConnect !== false && this.#controllerInstance.isCommissioned()) {
|
|
653
600
|
await this.connect();
|
|
654
601
|
}
|
|
@@ -709,7 +656,7 @@ export class CommissioningController {
|
|
|
709
656
|
}
|
|
710
657
|
|
|
711
658
|
/** Returns active session information for all connected nodes. */
|
|
712
|
-
getActiveSessionInformation() {
|
|
659
|
+
getActiveSessionInformation(): ActiveSessionInformation[] {
|
|
713
660
|
return this.#controllerInstance?.getActiveSessionInformation() ?? [];
|
|
714
661
|
}
|
|
715
662
|
|
|
@@ -791,59 +738,8 @@ export class CommissioningController {
|
|
|
791
738
|
}
|
|
792
739
|
}
|
|
793
740
|
|
|
794
|
-
get groups() {
|
|
741
|
+
get groups(): FabricGroups {
|
|
795
742
|
const controllerInstance = this.#assertControllerIsStarted();
|
|
796
743
|
return controllerInstance.getFabrics()[0].groups;
|
|
797
744
|
}
|
|
798
745
|
}
|
|
799
|
-
|
|
800
|
-
export async function configureNetwork(options: {
|
|
801
|
-
network: Network;
|
|
802
|
-
ble?: Ble;
|
|
803
|
-
ipv4Disabled?: boolean;
|
|
804
|
-
mdnsClient?: MdnsClient;
|
|
805
|
-
localPort?: number;
|
|
806
|
-
listeningAddressIpv6?: string;
|
|
807
|
-
listeningAddressIpv4?: string;
|
|
808
|
-
}) {
|
|
809
|
-
const { network, ble, ipv4Disabled, mdnsClient, localPort, listeningAddressIpv6, listeningAddressIpv4 } = options;
|
|
810
|
-
|
|
811
|
-
const netInterfaces = new ConnectionlessTransportSet();
|
|
812
|
-
const scanners = new ScannerSet();
|
|
813
|
-
|
|
814
|
-
let udpInterface: UdpInterface;
|
|
815
|
-
try {
|
|
816
|
-
udpInterface = await UdpInterface.create(network, "udp6", localPort, listeningAddressIpv6);
|
|
817
|
-
netInterfaces.add(udpInterface);
|
|
818
|
-
} catch (error) {
|
|
819
|
-
NoAddressAvailableError.accept(error);
|
|
820
|
-
logger.info(`IPv6 UDP interface not created because IPv6 is not available, but required my Matter.`);
|
|
821
|
-
throw error;
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
if (!ipv4Disabled) {
|
|
825
|
-
// TODO: Add option to transport different ports to broadcaster
|
|
826
|
-
try {
|
|
827
|
-
netInterfaces.add(await UdpInterface.create(network, "udp4", udpInterface.port, listeningAddressIpv4));
|
|
828
|
-
} catch (error) {
|
|
829
|
-
NoAddressAvailableError.accept(error);
|
|
830
|
-
logger.info(`IPv4 UDP interface not created because IPv4 is not available`);
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
if (mdnsClient) {
|
|
834
|
-
scanners.add(mdnsClient);
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
if (ble === undefined) {
|
|
838
|
-
logger.warn("BLE is not supported on this platform");
|
|
839
|
-
} else {
|
|
840
|
-
try {
|
|
841
|
-
netInterfaces.add(ble.centralInterface);
|
|
842
|
-
scanners.add(ble.scanner);
|
|
843
|
-
} catch (e) {
|
|
844
|
-
logger.error("Disabling BLE due to initialization error:", e);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
return { netInterfaces, scanners, port: udpInterface.port };
|
|
849
|
-
}
|