@project-chip/matter-node.js-examples 0.8.0-alpha.0-20240311-6a811d05 → 0.8.0-alpha.0-20240314-ed7b831b
Sign up to get free protection for your applications and to get access to all the features.
@@ -44,7 +44,7 @@ class DummyThreadNetworkCommissioningServer extends NetworkCommissioningBehavior
|
|
44
44
|
}
|
45
45
|
addOrUpdateThreadNetwork({ operationalDataset, breadcrumb }) {
|
46
46
|
console.log(
|
47
|
-
`--->
|
47
|
+
`---> addOrUpdateThreadNetwork called on NetworkCommissioning cluster: ${operationalDataset.toHex()} ${breadcrumb}`
|
48
48
|
);
|
49
49
|
this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
|
50
50
|
if (breadcrumb !== void 0) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../src/examples/cluster/DummyThreadNetworkCommissioningServer.ts"],
|
4
|
-
"sourcesContent": ["/**\n * @license\n * Copyright 2022-2024 Matter.js Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { GeneralCommissioningBehavior } from \"@project-chip/matter.js/behavior/definitions/general-commissioning\";\nimport {\n AddOrUpdateThreadNetworkRequest,\n ConnectNetworkRequest,\n NetworkCommissioningBehavior,\n RemoveNetworkRequest,\n ReorderNetworkRequest,\n ScanNetworksRequest,\n ScanNetworksResponse,\n} from \"@project-chip/matter.js/behavior/definitions/network-commissioning\";\nimport { NetworkCommissioning } from \"@project-chip/matter.js/cluster\";\nimport { Logger } from \"@project-chip/matter.js/log\";\nimport { ByteArray } from \"@project-chip/matter.js/util\";\n\nconst firstNetworkId = new ByteArray(32);\n\n/**\n * This represents a Dummy version of a
|
5
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,oCAAoC;AAC7C;AAAA,EAGI;AAAA,OAKG;AACP,SAAS,4BAA4B;AACrC,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAE1B,MAAM,iBAAiB,IAAI,UAAU,EAAE;AAOhC,MAAM,8CAA8C,6BAA6B;AAAA,EACpF,qBAAqB,QAAQ;AACjC,EAAE;AAAA,EACW,aAAa,EAAE,WAAW,GAA8C;AAC7E,YAAQ,IAAI,6DAA6D,UAAU,EAAE;AAGrF,QAAI,eAAe,QAAW;AAC1B,YAAM,8BAA8B,KAAK,MAAM,IAAI,4BAA4B;AAC/E,kCAA4B,MAAM,aAAa;AAAA,IACnD;AAEA,UAAM,mBAAmB,qBAAqB,2BAA2B;AACzE,SAAK,MAAM,uBAAuB;AAElC,UAAM,oBAAoB;AAAA,MACtB;AAAA,QACI,OAAO,KAAK,SAAS,IAAI,KAAK,OAAO,kBAAkB;AAAA,QACvD,eAAe,OAAO,KAAK,SAAS,IAAI,KAAK,OAAO,0BAA0B,CAAC;AAAA,QAC/E,aAAa,KAAK,SAAS,IAAI,KAAK,OAAO,wBAAwB;AAAA,QACnE,SAAS,KAAK,SAAS,IAAI,KAAK,OAAO,oBAAoB;AAAA,QAC3D,SAAS;AAAA,QACT,iBAAiB,UAAU;AAAA,WACtB,KAAK,SAAS,IAAI,KAAK,OAAO,oBAAoB,KAAK,gBAAgB,YAAY;AAAA,QACxF;AAAA,QACA,MAAM;AAAA,QACN,KAAK;AAAA,MACT;AAAA,IACJ;AACA,YAAQ,IAAI,OAAO,OAAO,iBAAiB,CAAC;AAE5C,WAAO;AAAA,MACH;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAES,yBAAyB,EAAE,oBAAoB,WAAW,GAAoC;AACnG,YAAQ;AAAA,MACJ,
|
4
|
+
"sourcesContent": ["/**\n * @license\n * Copyright 2022-2024 Matter.js Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { GeneralCommissioningBehavior } from \"@project-chip/matter.js/behavior/definitions/general-commissioning\";\nimport {\n AddOrUpdateThreadNetworkRequest,\n ConnectNetworkRequest,\n NetworkCommissioningBehavior,\n RemoveNetworkRequest,\n ReorderNetworkRequest,\n ScanNetworksRequest,\n ScanNetworksResponse,\n} from \"@project-chip/matter.js/behavior/definitions/network-commissioning\";\nimport { NetworkCommissioning } from \"@project-chip/matter.js/cluster\";\nimport { Logger } from \"@project-chip/matter.js/log\";\nimport { ByteArray } from \"@project-chip/matter.js/util\";\n\nconst firstNetworkId = new ByteArray(32);\n\n/**\n * This represents a Dummy version of a Thread Network Commissioning Cluster Server without real thread related logic, beside\n * returning some values provided as CLI parameters. This dummy implementation is only there for tests/as showcase for BLE\n * commissioning of a device.\n */\nexport class DummyThreadNetworkCommissioningServer extends NetworkCommissioningBehavior.with(\n NetworkCommissioning.Feature.ThreadNetworkInterface,\n) {\n override scanNetworks({ breadcrumb }: ScanNetworksRequest): ScanNetworksResponse {\n console.log(`---> scanNetworks called on NetworkCommissioning cluster: ${breadcrumb}`);\n\n // Simulate successful scan\n if (breadcrumb !== undefined) {\n const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);\n generalCommissioningCluster.state.breadcrumb = breadcrumb;\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n this.state.lastNetworkingStatus = networkingStatus;\n\n const threadScanResults = [\n {\n panId: this.endpoint.env.vars.number(\"ble.thread.panId\"),\n extendedPanId: BigInt(this.endpoint.env.vars.string(\"ble.thread.extendedPanId\")),\n networkName: this.endpoint.env.vars.string(\"ble.thread.networkName\"),\n channel: this.endpoint.env.vars.number(\"ble.thread.channel\"),\n version: 130,\n extendedAddress: ByteArray.fromString(\n (this.endpoint.env.vars.string(\"ble.thread.address\") ?? \"000000000000\").toLowerCase(),\n ),\n rssi: -50,\n lqi: 50,\n },\n ];\n console.log(Logger.toJSON(threadScanResults));\n\n return {\n networkingStatus,\n threadScanResults,\n };\n }\n\n override addOrUpdateThreadNetwork({ operationalDataset, breadcrumb }: AddOrUpdateThreadNetworkRequest) {\n console.log(\n `---> addOrUpdateThreadNetwork called on NetworkCommissioning cluster: ${operationalDataset.toHex()} ${breadcrumb}`,\n );\n\n this.session.context.assertFailSafeArmed(\"Failsafe timer needs to be armed to add or update networks.\");\n\n // Simulate successful add or update\n if (breadcrumb !== undefined) {\n const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);\n generalCommissioningCluster.state.breadcrumb = breadcrumb;\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n this.state.lastNetworkingStatus = networkingStatus;\n this.state.lastNetworkId = firstNetworkId;\n\n return {\n networkingStatus,\n networkIndex: 0,\n };\n }\n\n override removeNetwork({ networkId, breadcrumb }: RemoveNetworkRequest) {\n console.log(`---> removeNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`);\n\n this.session.context.assertFailSafeArmed(\"Failsafe timer needs to be armed to add or update networks.\");\n\n // Simulate successful add or update\n if (breadcrumb !== undefined) {\n const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);\n generalCommissioningCluster.state.breadcrumb = breadcrumb;\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n this.state.lastNetworkingStatus = networkingStatus;\n this.state.lastNetworkId = firstNetworkId;\n\n return {\n networkingStatus,\n networkIndex: 0,\n };\n }\n\n override async connectNetwork({ networkId, breadcrumb }: ConnectNetworkRequest) {\n console.log(`---> connectNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`);\n\n this.session.context.assertFailSafeArmed(\"Failsafe timer needs to be armed to add or update networks.\");\n\n // Simulate successful connection\n if (breadcrumb !== undefined) {\n const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);\n generalCommissioningCluster.state.breadcrumb = breadcrumb;\n }\n\n this.state.networks[0].connected = true;\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n this.state.lastNetworkingStatus = networkingStatus;\n this.state.lastNetworkId = firstNetworkId;\n this.state.lastConnectErrorValue = null;\n\n // Announce operational in IP network\n const device = this.session.context;\n await device.startAnnouncement();\n\n return {\n networkingStatus,\n errorValue: null,\n };\n }\n\n override reorderNetwork({ networkId, networkIndex, breadcrumb }: ReorderNetworkRequest) {\n console.log(\n `---> reorderNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${networkIndex} ${breadcrumb}`,\n );\n\n // Simulate successful connection\n if (breadcrumb !== undefined) {\n const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);\n generalCommissioningCluster.state.breadcrumb = breadcrumb;\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n this.state.lastNetworkingStatus = networkingStatus;\n\n return {\n networkingStatus,\n networkIndex: 0,\n };\n }\n}\n"],
|
5
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,oCAAoC;AAC7C;AAAA,EAGI;AAAA,OAKG;AACP,SAAS,4BAA4B;AACrC,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAE1B,MAAM,iBAAiB,IAAI,UAAU,EAAE;AAOhC,MAAM,8CAA8C,6BAA6B;AAAA,EACpF,qBAAqB,QAAQ;AACjC,EAAE;AAAA,EACW,aAAa,EAAE,WAAW,GAA8C;AAC7E,YAAQ,IAAI,6DAA6D,UAAU,EAAE;AAGrF,QAAI,eAAe,QAAW;AAC1B,YAAM,8BAA8B,KAAK,MAAM,IAAI,4BAA4B;AAC/E,kCAA4B,MAAM,aAAa;AAAA,IACnD;AAEA,UAAM,mBAAmB,qBAAqB,2BAA2B;AACzE,SAAK,MAAM,uBAAuB;AAElC,UAAM,oBAAoB;AAAA,MACtB;AAAA,QACI,OAAO,KAAK,SAAS,IAAI,KAAK,OAAO,kBAAkB;AAAA,QACvD,eAAe,OAAO,KAAK,SAAS,IAAI,KAAK,OAAO,0BAA0B,CAAC;AAAA,QAC/E,aAAa,KAAK,SAAS,IAAI,KAAK,OAAO,wBAAwB;AAAA,QACnE,SAAS,KAAK,SAAS,IAAI,KAAK,OAAO,oBAAoB;AAAA,QAC3D,SAAS;AAAA,QACT,iBAAiB,UAAU;AAAA,WACtB,KAAK,SAAS,IAAI,KAAK,OAAO,oBAAoB,KAAK,gBA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AM,8BAA8B,KAAK,MAAM,IAAI,4BAA4B;AAC/E,kCAA4B,MAAM,aAAa;AAAA,IACnD;AAEA,SAAK,MAAM,SAAS,CAAC,EAAE,YAAY;AAEnC,UAAM,mBAAmB,qBAAqB,2BAA2B;AACzE,SAAK,MAAM,uBAAuB;AAClC,SAAK,MAAM,gBAAgB;AAC3B,SAAK,MAAM,wBAAwB;AAGnC,UAAM,SAAS,KAAK,QAAQ;AAC5B,UAAM,OAAO,kBAAkB;AAE/B,WAAO;AAAA,MACH;AAAA,MACA,YAAY;AAAA,IAChB;AAAA,EACJ;AAAA,EAES,eAAe,EAAE,WAAW,cAAc,WAAW,GAA0B;AACpF,YAAQ;AAAA,MACJ,+DAA+D,UAAU,MAAM,CAAC,IAAI,YAAY,IAAI,UAAU;AAAA,IAClH;AAGA,QAAI,eAAe,QAAW;AAC1B,YAAM,8BAA8B,KAAK,MAAM,IAAI,4BAA4B;AAC/E,kCAA4B,MAAM,aAAa;AAAA,IACnD;AAEA,UAAM,mBAAmB,qBAAqB,2BAA2B;AACzE,SAAK,MAAM,uBAAuB;AAElC,WAAO;AAAA,MACH;AAAA,MACA,cAAc;AAAA,IAClB;AAAA,EACJ;AACJ;",
|
6
6
|
"names": []
|
7
7
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@project-chip/matter-node.js-examples",
|
3
|
-
"version": "0.8.0-alpha.0-
|
3
|
+
"version": "0.8.0-alpha.0-20240314-ed7b831b",
|
4
4
|
"description": "CLI/Reference implementation scripts for Matter protocol for node.js",
|
5
5
|
"keywords": [
|
6
6
|
"iot",
|
@@ -45,13 +45,13 @@
|
|
45
45
|
"matter-controller": "./dist/esm/examples/ControllerNode.js"
|
46
46
|
},
|
47
47
|
"devDependencies": {
|
48
|
-
"typescript": "^5.
|
48
|
+
"typescript": "^5.4.2"
|
49
49
|
},
|
50
50
|
"dependencies": {
|
51
|
-
"@project-chip/matter-node-ble.js": "0.8.0-alpha.0-
|
52
|
-
"@project-chip/matter-node.js": "0.8.0-alpha.0-
|
53
|
-
"@project-chip/matter.js": "0.8.0-alpha.0-
|
54
|
-
"@project-chip/matter.js-tools": "0.8.0-alpha.0-
|
51
|
+
"@project-chip/matter-node-ble.js": "0.8.0-alpha.0-20240314-ed7b831b",
|
52
|
+
"@project-chip/matter-node.js": "0.8.0-alpha.0-20240314-ed7b831b",
|
53
|
+
"@project-chip/matter.js": "0.8.0-alpha.0-20240314-ed7b831b",
|
54
|
+
"@project-chip/matter.js-tools": "0.8.0-alpha.0-20240314-ed7b831b"
|
55
55
|
},
|
56
56
|
"engines": {
|
57
57
|
"_comment": "For Crypto.hkdf support",
|
@@ -67,5 +67,5 @@
|
|
67
67
|
"publishConfig": {
|
68
68
|
"access": "public"
|
69
69
|
},
|
70
|
-
"gitHead": "
|
70
|
+
"gitHead": "623686700b0b87f0622a913ca59701a58f15333a"
|
71
71
|
}
|
@@ -21,7 +21,7 @@ import { ByteArray } from "@project-chip/matter.js/util";
|
|
21
21
|
const firstNetworkId = new ByteArray(32);
|
22
22
|
|
23
23
|
/**
|
24
|
-
* This represents a Dummy version of a
|
24
|
+
* This represents a Dummy version of a Thread Network Commissioning Cluster Server without real thread related logic, beside
|
25
25
|
* returning some values provided as CLI parameters. This dummy implementation is only there for tests/as showcase for BLE
|
26
26
|
* commissioning of a device.
|
27
27
|
*/
|
@@ -64,7 +64,7 @@ export class DummyThreadNetworkCommissioningServer extends NetworkCommissioningB
|
|
64
64
|
|
65
65
|
override addOrUpdateThreadNetwork({ operationalDataset, breadcrumb }: AddOrUpdateThreadNetworkRequest) {
|
66
66
|
console.log(
|
67
|
-
`--->
|
67
|
+
`---> addOrUpdateThreadNetwork called on NetworkCommissioning cluster: ${operationalDataset.toHex()} ${breadcrumb}`,
|
68
68
|
);
|
69
69
|
|
70
70
|
this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
|