@project-chip/matter-node.js-examples 0.11.0-alpha.0-20240909-b3b29745 → 0.11.0-alpha.0-20240911-db8f7c80

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. package/dist/esm/examples/BridgedDevicesNode.js +2 -3
  2. package/dist/esm/examples/BridgedDevicesNode.js.map +2 -2
  3. package/dist/esm/examples/BridgedDevicesNodeLegacy.js +14 -15
  4. package/dist/esm/examples/BridgedDevicesNodeLegacy.js.map +2 -2
  5. package/dist/esm/examples/ComposedDeviceNode.js +2 -3
  6. package/dist/esm/examples/ComposedDeviceNode.js.map +2 -2
  7. package/dist/esm/examples/ComposedDeviceNodeLegacy.js +15 -16
  8. package/dist/esm/examples/ComposedDeviceNodeLegacy.js.map +2 -2
  9. package/dist/esm/examples/ControllerNode.js +2 -5
  10. package/dist/esm/examples/ControllerNode.js.map +2 -2
  11. package/dist/esm/examples/ControllerNodeLegacy.js +21 -22
  12. package/dist/esm/examples/ControllerNodeLegacy.js.map +2 -2
  13. package/dist/esm/examples/DeviceNode.js +2 -3
  14. package/dist/esm/examples/DeviceNode.js.map +2 -2
  15. package/dist/esm/examples/DeviceNodeFull.js +4 -8
  16. package/dist/esm/examples/DeviceNodeFull.js.map +2 -2
  17. package/dist/esm/examples/DeviceNodeFullLegacy.js +16 -18
  18. package/dist/esm/examples/DeviceNodeFullLegacy.js.map +2 -2
  19. package/dist/esm/examples/IlluminatedRollerShade.js +1 -1
  20. package/dist/esm/examples/IlluminatedRollerShade.js.map +1 -1
  21. package/dist/esm/examples/LegacyStorageConverter.js +2 -3
  22. package/dist/esm/examples/LegacyStorageConverter.js.map +2 -2
  23. package/dist/esm/examples/LightDevice.js +1 -1
  24. package/dist/esm/examples/LightDevice.js.map +1 -1
  25. package/dist/esm/examples/MultiDeviceNode.js +2 -3
  26. package/dist/esm/examples/MultiDeviceNode.js.map +2 -2
  27. package/dist/esm/examples/MultiDeviceNodeLegacy.js +13 -14
  28. package/dist/esm/examples/MultiDeviceNodeLegacy.js.map +2 -2
  29. package/dist/esm/examples/SensorDeviceNode.js +2 -3
  30. package/dist/esm/examples/SensorDeviceNode.js.map +2 -2
  31. package/dist/esm/examples/cluster/DummyThreadNetworkCommissioningServer.js +11 -8
  32. package/dist/esm/examples/cluster/DummyThreadNetworkCommissioningServer.js.map +2 -2
  33. package/dist/esm/examples/cluster/DummyWifiNetworkCommissioningServer.js +15 -11
  34. package/dist/esm/examples/cluster/DummyWifiNetworkCommissioningServer.js.map +2 -2
  35. package/dist/esm/examples/cluster/DummyWifiNetworkCommissioningServerLegacy.js +12 -10
  36. package/dist/esm/examples/cluster/DummyWifiNetworkCommissioningServerLegacy.js.map +2 -2
  37. package/dist/esm/examples/cluster/MyFancyOwnFunctionality.js +8 -8
  38. package/dist/esm/examples/cluster/MyFancyOwnFunctionality.js.map +2 -2
  39. package/dist/esm/tutorial/example01.js +1 -1
  40. package/dist/esm/tutorial/example01.js.map +1 -1
  41. package/dist/esm/tutorial/example02.js +1 -1
  42. package/dist/esm/tutorial/example02.js.map +1 -1
  43. package/dist/esm/tutorial/example03.js +1 -1
  44. package/dist/esm/tutorial/example03.js.map +1 -1
  45. package/dist/esm/tutorial/example04.js +1 -1
  46. package/dist/esm/tutorial/example04.js.map +1 -1
  47. package/dist/esm/tutorial/example05.js +1 -1
  48. package/dist/esm/tutorial/example05.js.map +1 -1
  49. package/package.json +6 -5
  50. package/src/examples/BridgedDevicesNode.ts +2 -3
  51. package/src/examples/BridgedDevicesNodeLegacy.ts +15 -16
  52. package/src/examples/ComposedDeviceNode.ts +2 -3
  53. package/src/examples/ComposedDeviceNodeLegacy.ts +15 -16
  54. package/src/examples/ControllerNode.ts +2 -6
  55. package/src/examples/ControllerNodeLegacy.ts +22 -23
  56. package/src/examples/DeviceNode.ts +2 -3
  57. package/src/examples/DeviceNodeFull.ts +5 -10
  58. package/src/examples/DeviceNodeFullLegacy.ts +16 -18
  59. package/src/examples/IlluminatedRollerShade.ts +1 -1
  60. package/src/examples/LegacyStorageConverter.ts +3 -3
  61. package/src/examples/LightDevice.ts +1 -1
  62. package/src/examples/MultiDeviceNode.ts +2 -3
  63. package/src/examples/MultiDeviceNodeLegacy.ts +15 -15
  64. package/src/examples/SensorDeviceNode.ts +2 -3
  65. package/src/examples/cluster/DummyThreadNetworkCommissioningServer.ts +11 -8
  66. package/src/examples/cluster/DummyWifiNetworkCommissioningServer.ts +15 -11
  67. package/src/examples/cluster/DummyWifiNetworkCommissioningServerLegacy.ts +12 -10
  68. package/src/examples/cluster/MyFancyOwnFunctionality.ts +9 -9
  69. package/src/tsconfig.json +1 -1
  70. package/src/tutorial/example01.ts +1 -1
  71. package/src/tutorial/example02.ts +1 -1
  72. package/src/tutorial/example03.ts +1 -1
  73. package/src/tutorial/example04.ts +1 -1
  74. package/src/tutorial/example05.ts +1 -1
@@ -3,12 +3,11 @@
3
3
  * Copyright 2022-2024 Matter.js Authors
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { Bytes, Logger } from "@project-chip/matter.js-general";
6
7
  import { GeneralCommissioningBehavior } from "@project-chip/matter.js/behavior/definitions/general-commissioning";
7
8
  import { NetworkCommissioningBehavior } from "@project-chip/matter.js/behavior/definitions/network-commissioning";
8
9
  import { NetworkCommissioning } from "@project-chip/matter.js/cluster";
9
- import { Logger } from "@project-chip/matter.js/log";
10
- import { ByteArray } from "@project-chip/matter.js/util";
11
- const firstNetworkId = new ByteArray(32);
10
+ const firstNetworkId = new Uint8Array(32);
12
11
  class DummyThreadNetworkCommissioningServer extends NetworkCommissioningBehavior.with(
13
12
  NetworkCommissioning.Feature.ThreadNetworkInterface
14
13
  ) {
@@ -29,7 +28,7 @@ class DummyThreadNetworkCommissioningServer extends NetworkCommissioningBehavior
29
28
  networkName: this.endpoint.env.vars.string("ble.thread.networkName"),
30
29
  channel: this.endpoint.env.vars.number("ble.thread.channel"),
31
30
  version: 130,
32
- extendedAddress: ByteArray.fromString(
31
+ extendedAddress: Bytes.fromString(
33
32
  (this.endpoint.env.vars.string("ble.thread.address") ?? "000000000000").toLowerCase()
34
33
  ),
35
34
  rssi: -50,
@@ -47,7 +46,7 @@ class DummyThreadNetworkCommissioningServer extends NetworkCommissioningBehavior
47
46
  breadcrumb
48
47
  }) {
49
48
  console.log(
50
- `---> addOrUpdateThreadNetwork called on NetworkCommissioning cluster: ${operationalDataset.toHex()} ${breadcrumb}`
49
+ `---> addOrUpdateThreadNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(operationalDataset)} ${breadcrumb}`
51
50
  );
52
51
  this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
53
52
  if (breadcrumb !== void 0) {
@@ -63,7 +62,9 @@ class DummyThreadNetworkCommissioningServer extends NetworkCommissioningBehavior
63
62
  };
64
63
  }
65
64
  removeNetwork({ networkId, breadcrumb }) {
66
- console.log(`---> removeNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`);
65
+ console.log(
66
+ `---> removeNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`
67
+ );
67
68
  this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
68
69
  if (breadcrumb !== void 0) {
69
70
  const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);
@@ -78,7 +79,9 @@ class DummyThreadNetworkCommissioningServer extends NetworkCommissioningBehavior
78
79
  };
79
80
  }
80
81
  async connectNetwork({ networkId, breadcrumb }) {
81
- console.log(`---> connectNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`);
82
+ console.log(
83
+ `---> connectNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`
84
+ );
82
85
  this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
83
86
  if (breadcrumb !== void 0) {
84
87
  const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);
@@ -98,7 +101,7 @@ class DummyThreadNetworkCommissioningServer extends NetworkCommissioningBehavior
98
101
  }
99
102
  reorderNetwork({ networkId, networkIndex, breadcrumb }) {
100
103
  console.log(
101
- `---> reorderNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${networkIndex} ${breadcrumb}`
104
+ `---> reorderNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${networkIndex} ${breadcrumb}`
102
105
  );
103
106
  if (breadcrumb !== void 0) {
104
107
  const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);
@@ -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 { NetworkCommissioningBehavior } 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({\n breadcrumb,\n }: NetworkCommissioning.ScanNetworksRequest): NetworkCommissioning.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({\n operationalDataset,\n breadcrumb,\n }: NetworkCommissioning.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 }: NetworkCommissioning.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 }: NetworkCommissioning.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 }: NetworkCommissioning.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,SAAS,oCAAoC;AAC7C,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,aA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AM,aAAa;AAAA,IACnD;AAEA,UAAM,mBAAmB,qBAAqB,2BAA2B;AACzE,SAAK,MAAM,uBAAuB;AAElC,WAAO;AAAA,MACH;AAAA,MACA,cAAc;AAAA,IAClB;AAAA,EACJ;AACJ;",
4
+ "sourcesContent": ["/**\n * @license\n * Copyright 2022-2024 Matter.js Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Bytes, Logger } from \"@project-chip/matter.js-general\";\nimport { GeneralCommissioningBehavior } from \"@project-chip/matter.js/behavior/definitions/general-commissioning\";\nimport { NetworkCommissioningBehavior } from \"@project-chip/matter.js/behavior/definitions/network-commissioning\";\nimport { NetworkCommissioning } from \"@project-chip/matter.js/cluster\";\n\nconst firstNetworkId = new Uint8Array(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({\n breadcrumb,\n }: NetworkCommissioning.ScanNetworksRequest): NetworkCommissioning.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: Bytes.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({\n operationalDataset,\n breadcrumb,\n }: NetworkCommissioning.AddOrUpdateThreadNetworkRequest) {\n console.log(\n `---> addOrUpdateThreadNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(operationalDataset)} ${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 }: NetworkCommissioning.RemoveNetworkRequest) {\n console.log(\n `---> removeNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${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 async connectNetwork({ networkId, breadcrumb }: NetworkCommissioning.ConnectNetworkRequest) {\n console.log(\n `---> connectNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`,\n );\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 }: NetworkCommissioning.ReorderNetworkRequest) {\n console.log(\n `---> reorderNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${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,OAAO,cAAc;AAC9B,SAAS,oCAAoC;AAC7C,SAAS,oCAAoC;AAC7C,SAAS,4BAA4B;AAErC,MAAM,iBAAiB,IAAI,WAAW,EAAE;AAOjC,MAAM,8CAA8C,6BAA6B;AAAA,EACpF,qBAAqB,QAAQ;AACjC,EAAE;AAAA,EACW,aAAa;AAAA,IAClB;AAAA,EACJ,GAAwF;AACpF,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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
@@ -3,16 +3,18 @@
3
3
  * Copyright 2022-2024 Matter.js Authors
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { Bytes } from "@project-chip/matter.js-general";
6
7
  import { GeneralCommissioningBehavior } from "@project-chip/matter.js/behavior/definitions/general-commissioning";
7
8
  import { NetworkCommissioningBehavior } from "@project-chip/matter.js/behavior/definitions/network-commissioning";
8
9
  import { NetworkCommissioning } from "@project-chip/matter.js/cluster";
9
- import { ByteArray } from "@project-chip/matter.js/util";
10
- const firstNetworkId = new ByteArray(32);
10
+ const firstNetworkId = new Uint8Array(32);
11
11
  class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBehavior.with(
12
12
  NetworkCommissioning.Feature.WiFiNetworkInterface
13
13
  ) {
14
14
  scanNetworks({ ssid, breadcrumb }) {
15
- console.log(`---> scanNetworks called on NetworkCommissioning cluster: ${ssid?.toHex()} ${breadcrumb}`);
15
+ console.log(
16
+ `---> scanNetworks called on NetworkCommissioning cluster: ${ssid ? Bytes.toHex(ssid) : void 0} ${breadcrumb}`
17
+ );
16
18
  if (breadcrumb !== void 0) {
17
19
  const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);
18
20
  generalCommissioningCluster.state.breadcrumb = breadcrumb;
@@ -30,11 +32,9 @@ class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBehavior.w
30
32
  wpa2Personal: true,
31
33
  wpa3Personal: true
32
34
  },
33
- ssid: ssid || ByteArray.fromString(this.endpoint.env.vars.get("ble.wifi.scanSsid") ?? "TestSSID"),
35
+ ssid: ssid || Bytes.fromString(this.endpoint.env.vars.get("ble.wifi.scanSsid") ?? "TestSSID"),
34
36
  // Set a valid existing local Wi-Fi SSID here
35
- bssid: ByteArray.fromString(
36
- this.endpoint.env.vars.get("ble.wifi.scanBssid") ?? "00:00:00:00:00:00"
37
- ),
37
+ bssid: Bytes.fromString(this.endpoint.env.vars.get("ble.wifi.scanBssid") ?? "00:00:00:00:00:00"),
38
38
  channel: 1
39
39
  }
40
40
  ]
@@ -46,7 +46,7 @@ class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBehavior.w
46
46
  breadcrumb
47
47
  }) {
48
48
  console.log(
49
- `---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${ssid.toHex()} ${credentials.toHex()} ${breadcrumb}`
49
+ `---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(ssid)} ${Bytes.toHex(credentials)} ${breadcrumb}`
50
50
  );
51
51
  this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
52
52
  if (breadcrumb !== void 0) {
@@ -62,7 +62,9 @@ class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBehavior.w
62
62
  };
63
63
  }
64
64
  removeNetwork({ networkId, breadcrumb }) {
65
- console.log(`---> removeNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`);
65
+ console.log(
66
+ `---> removeNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`
67
+ );
66
68
  this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
67
69
  if (breadcrumb !== void 0) {
68
70
  const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);
@@ -77,7 +79,9 @@ class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBehavior.w
77
79
  };
78
80
  }
79
81
  async connectNetwork({ networkId, breadcrumb }) {
80
- console.log(`---> connectNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`);
82
+ console.log(
83
+ `---> connectNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`
84
+ );
81
85
  this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
82
86
  if (breadcrumb !== void 0) {
83
87
  const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);
@@ -97,7 +101,7 @@ class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBehavior.w
97
101
  }
98
102
  reorderNetwork({ networkId, networkIndex, breadcrumb }) {
99
103
  console.log(
100
- `---> reorderNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${networkIndex} ${breadcrumb}`
104
+ `---> reorderNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${networkIndex} ${breadcrumb}`
101
105
  );
102
106
  if (breadcrumb !== void 0) {
103
107
  const generalCommissioningCluster = this.agent.get(GeneralCommissioningBehavior);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/examples/cluster/DummyWifiNetworkCommissioningServer.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 { NetworkCommissioningBehavior } from \"@project-chip/matter.js/behavior/definitions/network-commissioning\";\nimport { NetworkCommissioning } from \"@project-chip/matter.js/cluster\";\nimport { ByteArray } from \"@project-chip/matter.js/util\";\n\nconst firstNetworkId = new ByteArray(32);\n\n/**\n * This represents a Dummy version of a Wifi Network Commissioning Cluster Server without real Wifi 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 DummyWifiNetworkCommissioningServer extends NetworkCommissioningBehavior.with(\n NetworkCommissioning.Feature.WiFiNetworkInterface,\n) {\n override scanNetworks({ ssid, breadcrumb }: NetworkCommissioning.ScanNetworksRequest) {\n console.log(`---> scanNetworks called on NetworkCommissioning cluster: ${ssid?.toHex()} ${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 return {\n networkingStatus,\n wiFiScanResults: [\n {\n security: {\n unencrypted: false,\n wep: false,\n wpaPersonal: false,\n wpa2Personal: true,\n wpa3Personal: true,\n },\n ssid: ssid || ByteArray.fromString(this.endpoint.env.vars.get(\"ble.wifi.scanSsid\") ?? \"TestSSID\"), // Set a valid existing local Wi-Fi SSID here\n bssid: ByteArray.fromString(\n this.endpoint.env.vars.get(\"ble.wifi.scanBssid\") ?? \"00:00:00:00:00:00\",\n ),\n channel: 1,\n },\n ],\n };\n }\n\n override addOrUpdateWiFiNetwork({\n ssid,\n credentials,\n breadcrumb,\n }: NetworkCommissioning.AddOrUpdateWiFiNetworkRequest) {\n console.log(\n `---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${ssid.toHex()} ${credentials.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 }: NetworkCommissioning.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 }: NetworkCommissioning.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 }: NetworkCommissioning.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,SAAS,oCAAoC;AAC7C,SAAS,4BAA4B;AACrC,SAAS,iBAAiB;AAE1B,MAAM,iBAAiB,IAAI,UAAU,EAAE;AAOhC,MAAM,4CAA4C,6BAA6B;AAAA,EAClF,qBAAqB,QAAQ;AACjC,EAAE;AAAA,EACW,aAAa,EAAE,MAAM,WAAW,GAA6C;AAClF,YAAQ,IAAI,6DAA6D,MAAM,MAAM,CAAC,IAAI,UAAU,EAAE;AA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copyright 2022-2024 Matter.js Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Bytes } from \"@project-chip/matter.js-general\";\nimport { GeneralCommissioningBehavior } from \"@project-chip/matter.js/behavior/definitions/general-commissioning\";\nimport { NetworkCommissioningBehavior } from \"@project-chip/matter.js/behavior/definitions/network-commissioning\";\nimport { NetworkCommissioning } from \"@project-chip/matter.js/cluster\";\n\nconst firstNetworkId = new Uint8Array(32);\n\n/**\n * This represents a Dummy version of a Wifi Network Commissioning Cluster Server without real Wifi 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 DummyWifiNetworkCommissioningServer extends NetworkCommissioningBehavior.with(\n NetworkCommissioning.Feature.WiFiNetworkInterface,\n) {\n override scanNetworks({ ssid, breadcrumb }: NetworkCommissioning.ScanNetworksRequest) {\n console.log(\n `---> scanNetworks called on NetworkCommissioning cluster: ${ssid ? Bytes.toHex(ssid) : undefined} ${breadcrumb}`,\n );\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 return {\n networkingStatus,\n wiFiScanResults: [\n {\n security: {\n unencrypted: false,\n wep: false,\n wpaPersonal: false,\n wpa2Personal: true,\n wpa3Personal: true,\n },\n ssid: ssid || Bytes.fromString(this.endpoint.env.vars.get(\"ble.wifi.scanSsid\") ?? \"TestSSID\"), // Set a valid existing local Wi-Fi SSID here\n bssid: Bytes.fromString(this.endpoint.env.vars.get(\"ble.wifi.scanBssid\") ?? \"00:00:00:00:00:00\"),\n channel: 1,\n },\n ],\n };\n }\n\n override addOrUpdateWiFiNetwork({\n ssid,\n credentials,\n breadcrumb,\n }: NetworkCommissioning.AddOrUpdateWiFiNetworkRequest) {\n console.log(\n `---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(ssid)} ${Bytes.toHex(credentials)} ${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 }: NetworkCommissioning.RemoveNetworkRequest) {\n console.log(\n `---> removeNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${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 async connectNetwork({ networkId, breadcrumb }: NetworkCommissioning.ConnectNetworkRequest) {\n console.log(\n `---> connectNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`,\n );\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 }: NetworkCommissioning.ReorderNetworkRequest) {\n console.log(\n `---> reorderNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${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,aAAa;AACtB,SAAS,oCAAoC;AAC7C,SAAS,oCAAoC;AAC7C,SAAS,4BAA4B;AAErC,MAAM,iBAAiB,IAAI,WAAW,EAAE;AAOjC,MAAM,4CAA4C,6BAA6B;AAAA,EAClF,qBAAqB,QAAQ;AACjC,EAAE;AAAA,EACW,aAAa,EAAE,MAAM,WAAW,GAA6C;AAClF,YAAQ;AAAA,MACJ,6DAA6D,OAAO,MAAM,MAAM,IAAI,IAAI,MAAS,IAAI,UAAU;AAAA,IACnH;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,iBAAiB;AAAA,QACb;AAAA,UACI,UAAU;AAAA,YACN,aAAa;AAAA,YACb,KAAK;AAAA,YACL,aAAa;AAAA,YACb,cAAc;AAAA,YACd,cAA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GAA+C;AACjG,YAAQ;AAAA,MACJ,+DAA+D,MAAM,MAAM,SAAS,CAAC,IAAI,UAAU;AAAA,IACvG;AAEA,SAAK,QAAQ,QAAQ,oBAAoB,6DAA6D;AAGtG,QAAI,eAAe,QAAW;AAC1B,YAAM,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,GAA+C;AACzG,YAAQ;AAAA,MACJ,+DAA+D,MAAM,MAAM,SAAS,CAAC,IAAI,YAAY,IAAI,UAAU;AAAA,IACvH;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
  }
@@ -3,14 +3,14 @@
3
3
  * Copyright 2022-2024 Matter.js Authors
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { getParameter } from "@project-chip/matter-node.js/util";
6
+ import { getParameter } from "@project-chip/matter.js-nodejs";
7
7
  import {
8
8
  ClusterServer,
9
9
  GeneralCommissioningCluster,
10
10
  NetworkCommissioning
11
11
  } from "@project-chip/matter.js/cluster";
12
- import { ByteArray } from "@project-chip/matter.js/util";
13
- const firstNetworkId = new ByteArray(32);
12
+ import { Bytes } from "../../../../general/dist/cjs/index.js";
13
+ const firstNetworkId = new Uint8Array(32);
14
14
  const WifiNetworkCluster = NetworkCommissioning.Cluster.with(NetworkCommissioning.Feature.WiFiNetworkInterface);
15
15
  const Server = ClusterServer(
16
16
  NetworkCommissioning.Cluster.with(NetworkCommissioning.Feature.WiFiNetworkInterface),
@@ -27,7 +27,9 @@ const Server = ClusterServer(
27
27
  },
28
28
  {
29
29
  scanNetworks: async ({ request: { ssid, breadcrumb }, attributes: { lastNetworkingStatus }, endpoint }) => {
30
- console.log(`---> scanNetworks called on NetworkCommissioning cluster: ${ssid?.toHex()} ${breadcrumb}`);
30
+ console.log(
31
+ `---> scanNetworks called on NetworkCommissioning cluster: ${ssid ? Bytes.toHex(ssid) : void 0} ${breadcrumb}`
32
+ );
31
33
  if (breadcrumb !== void 0) {
32
34
  const generalCommissioningCluster = endpoint.getClusterServer(GeneralCommissioningCluster);
33
35
  generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);
@@ -45,9 +47,9 @@ const Server = ClusterServer(
45
47
  wpa2Personal: true,
46
48
  wpa3Personal: true
47
49
  },
48
- ssid: ssid || ByteArray.fromString(getParameter("ble-wifi-scan-ssid") ?? "TestSSID"),
50
+ ssid: ssid || Bytes.fromString(getParameter("ble-wifi-scan-ssid") ?? "TestSSID"),
49
51
  // Set a valid existing local Wi-Fi SSID here
50
- bssid: ByteArray.fromString(getParameter("ble-wifi-scan-bssid") ?? "00:00:00:00:00:00"),
52
+ bssid: Bytes.fromString(getParameter("ble-wifi-scan-bssid") ?? "00:00:00:00:00:00"),
51
53
  channel: 1
52
54
  }
53
55
  ]
@@ -60,7 +62,7 @@ const Server = ClusterServer(
60
62
  session
61
63
  }) => {
62
64
  console.log(
63
- `---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${ssid.toHex()} ${credentials.toHex()} ${breadcrumb}`
65
+ `---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(ssid)} ${Bytes.toHex(credentials)} ${breadcrumb}`
64
66
  );
65
67
  session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
66
68
  if (breadcrumb !== void 0) {
@@ -82,7 +84,7 @@ const Server = ClusterServer(
82
84
  session
83
85
  }) => {
84
86
  console.log(
85
- `---> removeNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`
87
+ `---> removeNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`
86
88
  );
87
89
  session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
88
90
  if (breadcrumb !== void 0) {
@@ -104,7 +106,7 @@ const Server = ClusterServer(
104
106
  session
105
107
  }) => {
106
108
  console.log(
107
- `---> connectNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`
109
+ `---> connectNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`
108
110
  );
109
111
  session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
110
112
  if (breadcrumb !== void 0) {
@@ -131,7 +133,7 @@ const Server = ClusterServer(
131
133
  endpoint
132
134
  }) => {
133
135
  console.log(
134
- `---> reorderNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${networkIndex} ${breadcrumb}`
136
+ `---> reorderNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${networkIndex} ${breadcrumb}`
135
137
  );
136
138
  if (breadcrumb !== void 0) {
137
139
  const generalCommissioningCluster = endpoint.getClusterServer(GeneralCommissioningCluster);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/examples/cluster/DummyWifiNetworkCommissioningServerLegacy.ts"],
4
- "sourcesContent": ["/**\n * @license\n * Copyright 2022-2024 Matter.js Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { getParameter } from \"@project-chip/matter-node.js/util\";\nimport {\n ClusterServer,\n ClusterServerObj,\n GeneralCommissioningCluster,\n NetworkCommissioning,\n} from \"@project-chip/matter.js/cluster\";\nimport { ByteArray } from \"@project-chip/matter.js/util\";\n\nconst firstNetworkId = new ByteArray(32);\n\nconst WifiNetworkCluster = NetworkCommissioning.Cluster.with(NetworkCommissioning.Feature.WiFiNetworkInterface);\n\n/**\n * This represents a Dummy version of a Wifi Network Commissioning Cluster Server without real Wifi 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 */\nconst Server: ClusterServerObj<typeof WifiNetworkCluster> = ClusterServer(\n NetworkCommissioning.Cluster.with(NetworkCommissioning.Feature.WiFiNetworkInterface),\n {\n maxNetworks: 1,\n interfaceEnabled: true,\n lastConnectErrorValue: 0,\n lastNetworkId: null,\n lastNetworkingStatus: null,\n networks: [{ networkId: firstNetworkId, connected: false }],\n scanMaxTimeSeconds: 3,\n connectMaxTimeSeconds: 3,\n supportedWiFiBands: [NetworkCommissioning.WiFiBand[\"2G4\"]],\n },\n {\n scanNetworks: async ({ request: { ssid, breadcrumb }, attributes: { lastNetworkingStatus }, endpoint }) => {\n console.log(`---> scanNetworks called on NetworkCommissioning cluster: ${ssid?.toHex()} ${breadcrumb}`);\n\n // Simulate successful scan\n if (breadcrumb !== undefined) {\n const generalCommissioningCluster = endpoint.getClusterServer(GeneralCommissioningCluster);\n generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n lastNetworkingStatus?.setLocal(networkingStatus);\n\n return {\n networkingStatus,\n wiFiScanResults: [\n {\n security: {\n unencrypted: false,\n wep: false,\n wpaPersonal: false,\n wpa2Personal: true,\n wpa3Personal: true,\n },\n ssid: ssid || ByteArray.fromString(getParameter(\"ble-wifi-scan-ssid\") ?? \"TestSSID\"), // Set a valid existing local Wi-Fi SSID here\n bssid: ByteArray.fromString(getParameter(\"ble-wifi-scan-bssid\") ?? \"00:00:00:00:00:00\"),\n channel: 1,\n },\n ],\n };\n },\n addOrUpdateWiFiNetwork: async ({\n request: { ssid, credentials, breadcrumb },\n attributes: { lastNetworkingStatus, lastNetworkId },\n endpoint,\n session,\n }) => {\n console.log(\n `---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${ssid.toHex()} ${credentials.toHex()} ${breadcrumb}`,\n );\n\n 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 = endpoint.getClusterServer(GeneralCommissioningCluster);\n generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n lastNetworkingStatus?.setLocal(networkingStatus);\n lastNetworkId?.setLocal(firstNetworkId);\n\n return {\n networkingStatus,\n networkIndex: 0,\n };\n },\n removeNetwork: async ({\n request: { networkId, breadcrumb },\n attributes: { lastNetworkingStatus, lastNetworkId },\n endpoint,\n session,\n }) => {\n console.log(\n `---> removeNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`,\n );\n\n 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 = endpoint.getClusterServer(GeneralCommissioningCluster);\n generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n lastNetworkingStatus?.setLocal(networkingStatus);\n lastNetworkId?.setLocal(firstNetworkId);\n\n return {\n networkingStatus,\n networkIndex: 0,\n };\n },\n connectNetwork: async ({\n request: { networkId, breadcrumb },\n attributes: { lastNetworkingStatus, lastNetworkId, lastConnectErrorValue, networks },\n endpoint,\n session,\n }) => {\n console.log(\n `---> connectNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`,\n );\n\n 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 = endpoint.getClusterServer(GeneralCommissioningCluster);\n generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);\n }\n\n const networkList = networks.getLocal();\n networkList[0].connected = true;\n networks.setLocal(networkList);\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n lastNetworkingStatus?.setLocal(networkingStatus);\n lastNetworkId?.setLocal(firstNetworkId);\n lastConnectErrorValue?.setLocal(null);\n\n // Announce operational in IP network\n const device = session.context;\n await device.startAnnouncement();\n\n return {\n networkingStatus,\n errorValue: null,\n };\n },\n reorderNetwork: async ({\n request: { networkId, networkIndex, breadcrumb },\n attributes: { lastNetworkingStatus },\n endpoint,\n }) => {\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 = endpoint.getClusterServer(GeneralCommissioningCluster);\n generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n lastNetworkingStatus?.setLocal(networkingStatus);\n\n return {\n networkingStatus,\n networkIndex: 0,\n };\n },\n },\n);\n\nexport default Server;\n"],
5
- "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,oBAAoB;AAC7B;AAAA,EACI;AAAA,EAEA;AAAA,EACA;AAAA,OACG;AACP,SAAS,iBAAiB;AAE1B,MAAM,iBAAiB,IAAI,UAAU,EAAE;AAEvC,MAAM,qBAAqB,qBAAqB,QAAQ,KAAK,qBAAqB,QAAQ,oBAAoB;AAO9G,MAAM,SAAsD;AAAA,EACxD,qBAAqB,QAAQ,KAAK,qBAAqB,QAAQ,oBAAoB;AAAA,EACnF;AAAA,IACI,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,uBAAuB;AAA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BAAmB,qBAAqB,2BAA2B;AACzE,4BAAsB,SAAS,gBAAgB;AAC/C,qBAAe,SAAS,cAAc;AACtC,6BAAuB,SAAS,IAAI;AAGpC,YAAM,SAAS,QAAQ;AACvB,YAAM,OAAO,kBAAkB;AAE/B,aAAO;AAAA,QACH;AAAA,QACA,YAAY;AAAA,MAChB;AAAA,IACJ;AAAA,IACA,gBAAgB,OAAO;AAAA,MACnB,SAAS,EAAE,WAAW,cAAc,WAAW;AAAA,MAC/C,YAAY,EAAE,qBAAqB;AAAA,MACnC;AAAA,IACJ,MAAM;AACF,cAAQ;AAAA,QACJ,+DAA+D,UAAU,MAAM,CAAC,IAAI,YAAY,IAAI,UAAU;AAAA,MAClH;AAGA,UAAI,eAAe,QAAW;AAC1B,cAAM,8BAA8B,SAAS,iBAAiB,2BAA2B;AACzF,qCAA6B,uBAAuB,UAAU;AAAA,MAClE;AAEA,YAAM,mBAAmB,qBAAqB,2BAA2B;AACzE,4BAAsB,SAAS,gBAAgB;AAE/C,aAAO;AAAA,QACH;AAAA,QACA,cAAc;AAAA,MAClB;AAAA,IACJ;AAAA,EACJ;AACJ;AAEA,IAAO,oDAAQ;",
4
+ "sourcesContent": ["/**\n * @license\n * Copyright 2022-2024 Matter.js Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { getParameter } from \"@project-chip/matter.js-nodejs\";\nimport {\n ClusterServer,\n ClusterServerObj,\n GeneralCommissioningCluster,\n NetworkCommissioning,\n} from \"@project-chip/matter.js/cluster\";\nimport { Bytes } from \"../../../../general/dist/cjs/index.js\";\n\nconst firstNetworkId = new Uint8Array(32);\n\nconst WifiNetworkCluster = NetworkCommissioning.Cluster.with(NetworkCommissioning.Feature.WiFiNetworkInterface);\n\n/**\n * This represents a Dummy version of a Wifi Network Commissioning Cluster Server without real Wifi 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 */\nconst Server: ClusterServerObj<typeof WifiNetworkCluster> = ClusterServer(\n NetworkCommissioning.Cluster.with(NetworkCommissioning.Feature.WiFiNetworkInterface),\n {\n maxNetworks: 1,\n interfaceEnabled: true,\n lastConnectErrorValue: 0,\n lastNetworkId: null,\n lastNetworkingStatus: null,\n networks: [{ networkId: firstNetworkId, connected: false }],\n scanMaxTimeSeconds: 3,\n connectMaxTimeSeconds: 3,\n supportedWiFiBands: [NetworkCommissioning.WiFiBand[\"2G4\"]],\n },\n {\n scanNetworks: async ({ request: { ssid, breadcrumb }, attributes: { lastNetworkingStatus }, endpoint }) => {\n console.log(\n `---> scanNetworks called on NetworkCommissioning cluster: ${ssid ? Bytes.toHex(ssid) : undefined} ${breadcrumb}`,\n );\n\n // Simulate successful scan\n if (breadcrumb !== undefined) {\n const generalCommissioningCluster = endpoint.getClusterServer(GeneralCommissioningCluster);\n generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n lastNetworkingStatus?.setLocal(networkingStatus);\n\n return {\n networkingStatus,\n wiFiScanResults: [\n {\n security: {\n unencrypted: false,\n wep: false,\n wpaPersonal: false,\n wpa2Personal: true,\n wpa3Personal: true,\n },\n ssid: ssid || Bytes.fromString(getParameter(\"ble-wifi-scan-ssid\") ?? \"TestSSID\"), // Set a valid existing local Wi-Fi SSID here\n bssid: Bytes.fromString(getParameter(\"ble-wifi-scan-bssid\") ?? \"00:00:00:00:00:00\"),\n channel: 1,\n },\n ],\n };\n },\n addOrUpdateWiFiNetwork: async ({\n request: { ssid, credentials, breadcrumb },\n attributes: { lastNetworkingStatus, lastNetworkId },\n endpoint,\n session,\n }) => {\n console.log(\n `---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(ssid)} ${Bytes.toHex(credentials)} ${breadcrumb}`,\n );\n\n 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 = endpoint.getClusterServer(GeneralCommissioningCluster);\n generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n lastNetworkingStatus?.setLocal(networkingStatus);\n lastNetworkId?.setLocal(firstNetworkId);\n\n return {\n networkingStatus,\n networkIndex: 0,\n };\n },\n removeNetwork: async ({\n request: { networkId, breadcrumb },\n attributes: { lastNetworkingStatus, lastNetworkId },\n endpoint,\n session,\n }) => {\n console.log(\n `---> removeNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`,\n );\n\n 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 = endpoint.getClusterServer(GeneralCommissioningCluster);\n generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n lastNetworkingStatus?.setLocal(networkingStatus);\n lastNetworkId?.setLocal(firstNetworkId);\n\n return {\n networkingStatus,\n networkIndex: 0,\n };\n },\n connectNetwork: async ({\n request: { networkId, breadcrumb },\n attributes: { lastNetworkingStatus, lastNetworkId, lastConnectErrorValue, networks },\n endpoint,\n session,\n }) => {\n console.log(\n `---> connectNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`,\n );\n\n 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 = endpoint.getClusterServer(GeneralCommissioningCluster);\n generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);\n }\n\n const networkList = networks.getLocal();\n networkList[0].connected = true;\n networks.setLocal(networkList);\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n lastNetworkingStatus?.setLocal(networkingStatus);\n lastNetworkId?.setLocal(firstNetworkId);\n lastConnectErrorValue?.setLocal(null);\n\n // Announce operational in IP network\n const device = session.context;\n await device.startAnnouncement();\n\n return {\n networkingStatus,\n errorValue: null,\n };\n },\n reorderNetwork: async ({\n request: { networkId, networkIndex, breadcrumb },\n attributes: { lastNetworkingStatus },\n endpoint,\n }) => {\n console.log(\n `---> reorderNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${networkIndex} ${breadcrumb}`,\n );\n\n // Simulate successful connection\n if (breadcrumb !== undefined) {\n const generalCommissioningCluster = endpoint.getClusterServer(GeneralCommissioningCluster);\n generalCommissioningCluster?.setBreadcrumbAttribute(breadcrumb);\n }\n\n const networkingStatus = NetworkCommissioning.NetworkCommissioningStatus.Success;\n lastNetworkingStatus?.setLocal(networkingStatus);\n\n return {\n networkingStatus,\n networkIndex: 0,\n };\n },\n },\n);\n\nexport default Server;\n"],
5
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,oBAAoB;AAC7B;AAAA,EACI;AAAA,EAEA;AAAA,EACA;AAAA,OACG;AACP,SAAS,aAAa;AAEtB,MAAM,iBAAiB,IAAI,WAAW,EAAE;AAExC,MAAM,qBAAqB,qBAAqB,QAAQ,KAAK,qBAAqB,QAAQ,oBAAoB;AAO9G,MAAM,SAAsD;AAAA,EACxD,qBAAqB,QAAQ,KAAK,qBAAqB,QAAQ,oBAAoB;AAAA,EACnF;AAAA,IACI,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,uBAAuB;AAAA,IACvB,eAAe;AAAA,IACf,sBAAsB;AAAA,IACtB,UAAU,CAAC,EAAE,WAAW,gBAAgB,WAAW,MAAM,CAAC;AAAA,IAC1D,oBAAoB;AAAA,IACpB,uBAAuB;AAAA,IACvB,oBAAoB,CAAC,qBAAqB,SAAS,KAAK,CAAC;AAAA,EAC7D;AAAA,EACA;AAAA,IACI,cAAc,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,GAAG,YAAY,EAAE,qBAAqB,GAAG,SAAS,MAAM;AACvG,c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EAAE,WAAW,cAAc,WAAW;AAAA,MAC/C,YAAY,EAAE,qBAAqB;AAAA,MACnC;AAAA,IACJ,MAAM;AACF,cAAQ;AAAA,QACJ,+DAA+D,MAAM,MAAM,SAAS,CAAC,IAAI,YAAY,IAAI,UAAU;AAAA,MACvH;AAGA,UAAI,eAAe,QAAW;AAC1B,cAAM,8BAA8B,SAAS,iBAAiB,2BAA2B;AACzF,qCAA6B,uBAAuB,UAAU;AAAA,MAClE;AAEA,YAAM,mBAAmB,qBAAqB,2BAA2B;AACzE,4BAAsB,SAAS,gBAAgB;AAE/C,aAAO;AAAA,QACH;AAAA,QACA,cAAc;AAAA,MAClB;AAAA,IACJ;AAAA,EACJ;AACJ;AAEA,IAAO,oDAAQ;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,14 @@
3
3
  * Copyright 2022-2024 Matter.js Authors
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import {
7
+ AttributeElement,
8
+ ClusterElement,
9
+ ClusterModel,
10
+ CommandElement,
11
+ EventElement,
12
+ FieldElement
13
+ } from "@project-chip/matter.js-model";
6
14
  import { ClusterBehavior } from "@project-chip/matter.js/behavior/cluster";
7
15
  import {
8
16
  Attribute,
@@ -13,14 +21,6 @@ import {
13
21
  MutableCluster
14
22
  } from "@project-chip/matter.js/cluster";
15
23
  import { ClusterId, VendorId } from "@project-chip/matter.js/datatype";
16
- import {
17
- AttributeElement,
18
- ClusterElement,
19
- ClusterModel,
20
- CommandElement,
21
- EventElement,
22
- FieldElement
23
- } from "@project-chip/matter.js/model";
24
24
  import { TlvField, TlvInt16, TlvNullable, TlvObject, TlvString } from "@project-chip/matter.js/tlv";
25
25
  const myFancyClusterId = ClusterId.buildVendorSpecific(VendorId(65524), 64512);
26
26
  var MyFancyOwnFunctionality;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/examples/cluster/MyFancyOwnFunctionality.ts"],
4
- "sourcesContent": ["/**\n * @license\n * Copyright 2022-2024 Matter.js Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ClusterBehavior } from \"@project-chip/matter.js/behavior/cluster\";\nimport {\n Attribute,\n ClusterRegistry,\n Command,\n Event,\n EventPriority,\n MutableCluster,\n} from \"@project-chip/matter.js/cluster\";\nimport { ClusterId, VendorId } from \"@project-chip/matter.js/datatype\";\nimport {\n AttributeElement,\n ClusterElement,\n ClusterModel,\n CommandElement,\n EventElement,\n FieldElement,\n} from \"@project-chip/matter.js/model\";\nimport { TlvField, TlvInt16, TlvNullable, TlvObject, TlvString, TypeFromSchema } from \"@project-chip/matter.js/tlv\";\nimport { Identity, MaybePromise } from \"@project-chip/matter.js/util\";\n\n/** Define the Cluster ID, custom clusters use a special extended formt that also contains the Vendor Id */\nconst myFancyClusterId = ClusterId.buildVendorSpecific(VendorId(0xfff4), 0xfc00);\n\n/**\n * Defines the Cluster on Tlv Schema level in a special namespace structure to match the official cluster\n * structures of matter.js.\n * All places that contains \"MyFancy...\" belong to the custom cluster details, all rest can be left statically like the\n * given names.\n * For more examples and usages of features in such clusters and how the code should look then check the standard\n * cluster Tlv definitions in packages/matter.js/cluster/definitions/*\n */\nexport namespace MyFancyOwnFunctionality {\n /**\n * Input to the MyFancyOwnFunctionality myFancyCommand command\n */\n export const TlvMyFancyCommandRequest = TlvObject({ value: TlvField(0, TlvString) });\n\n /**\n * Response of the MyFancyOwnFunctionality myFancyCommand command\n */\n export const TlvMyFancyCommandResponse = TlvObject({ response: TlvField(0, TlvString) });\n\n /**\n * Event for the MyFancyOwnFunctionality myFancyEvent event\n */\n export const TlvMyFancyEvent = TlvObject({ eventValue: TlvField(0, TlvString) });\n\n /**\n * @see {@link Cluster}\n */\n export const ClusterInstance = MutableCluster({\n id: myFancyClusterId,\n name: \"MyFancyOwnFunctionality\",\n revision: 1,\n\n attributes: {\n /** My fancy attribute */\n myFancyValue: Attribute(0x0, TlvNullable(TlvInt16)),\n },\n\n commands: {\n /** My fancy command */\n myFancyCommand: Command(0x1, TlvMyFancyCommandRequest, 0x2, TlvMyFancyCommandResponse),\n },\n\n events: {\n /** My fancy event */\n myFancyEvent: Event(0x5, EventPriority.Info, TlvMyFancyEvent),\n },\n });\n\n /**\n * My Fancy Cluster\n *\n * This cluster provides an interface to some fancy custom functions.\n */\n export interface Cluster extends Identity<typeof ClusterInstance> {}\n\n export const Cluster: Cluster = ClusterInstance;\n\n export const Complete = Cluster;\n}\n\nexport type MyFancyOwnFunctionalityCluster = MyFancyOwnFunctionality.Cluster;\nexport const MyFancyOwnFunctionalityCluster = MyFancyOwnFunctionality.Cluster;\nClusterRegistry.register(MyFancyOwnFunctionality.Complete);\n\n/**\n * matter.js Model Schema for the cluster, need to match with the Tlv Schema above.\n * See more details in packages/matter.js/behavior/definitions/*\n */\nconst MyFancySchema = ClusterElement({\n name: \"MyFancyOwnFunctionality\",\n id: myFancyClusterId,\n classification: \"application\",\n description: \"My Fancy Functionality\",\n\n children: [\n AttributeElement({ name: \"ClusterRevision\", id: 0xfffd, type: \"ClusterRevision\", default: 1 }),\n\n AttributeElement({\n name: \"MyFancyValue\",\n id: 0x0,\n type: \"int16\",\n access: \"R V\",\n conformance: \"M\",\n quality: \"X\",\n }),\n\n CommandElement({\n name: \"MyFancyCommand\",\n id: 0x1,\n access: \"O\",\n conformance: \"M\",\n direction: \"request\",\n response: \"MyFancyCommandResponse\",\n\n children: [FieldElement({ name: \"value\", id: 0x0, type: \"string\", conformance: \"M\" })],\n }),\n CommandElement({\n name: \"MyFancyCommandResponse\",\n id: 0x2,\n conformance: \"M\",\n direction: \"request\",\n\n children: [FieldElement({ name: \"response\", id: 0x0, type: \"string\", conformance: \"M\" })],\n }),\n\n EventElement({\n name: \"MyFancyEvent\",\n id: 0x5,\n access: \"V\",\n conformance: \"O\",\n priority: \"info\",\n children: [\n FieldElement({\n name: \"EventValue\",\n id: 0x0,\n type: \"string\",\n conformance: \"M\",\n }),\n ],\n }),\n ],\n});\n\n/**\n * Interface definitions - exposes the Implementation interface for the cluster and some types to be used in the\n * cluster implementations.\n */\nexport type MyFancyCommandRequest = TypeFromSchema<typeof MyFancyOwnFunctionality.TlvMyFancyCommandRequest>;\nexport type MyFancyCommandResponse = TypeFromSchema<typeof MyFancyOwnFunctionality.TlvMyFancyCommandResponse>;\nexport type MyFancyEvent = TypeFromSchema<typeof MyFancyOwnFunctionality.TlvMyFancyEvent>;\n\nexport namespace MyFancyOwnFunctionalityInterface {\n export interface Base {\n myFancyCommand(request: MyFancyCommandRequest): MaybePromise<MyFancyCommandResponse>;\n }\n}\n\nexport type MyFancyOwnFunctionalityInterface = {\n components: [{ flags: {}; methods: MyFancyOwnFunctionalityInterface.Base }];\n};\n\n/**\n * Behavior definition for the cluster command handler implementation\n */\nexport const MyFancyOwnFunctionalityBehavior = ClusterBehavior.withInterface<MyFancyOwnFunctionalityInterface>().for(\n MyFancyOwnFunctionality.Cluster,\n new ClusterModel(MyFancySchema),\n);\n\ntype MyFancyOwnFunctionalityBehaviorType = InstanceType<typeof MyFancyOwnFunctionalityBehavior>;\nexport interface MyFancyOwnFunctionalityBehavior extends MyFancyOwnFunctionalityBehaviorType {}\ntype StateType = InstanceType<typeof MyFancyOwnFunctionalityBehavior.State>;\nexport namespace MyFancyOwnFunctionalityBehavior {\n export interface State extends StateType {}\n}\n"],
5
- "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,uBAAuB;AAChC;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,WAAW,gBAAgB;AACpC;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,UAAU,UAAU,aAAa,WAAW,iBAAiC;AAItF,MAAM,mBAAmB,UAAU,oBAAoB,SAAS,KAAM,GAAG,KAAM;AAUxE,IAAU;AAAA,CAAV,CAAUA,6BAAV;AAII,EAAMA,yBAAA,2BAA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V,UAAU,CAAC,aAAa,EAAE,MAAM,SAAS,IAAI,GAAK,MAAM,UAAU,aAAa,IAAI,CAAC,CAAC;AAAA,IACzF,CAAC;AAAA,IACD,eAAe;AAAA,MACX,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,aAAa;AAAA,MACb,WAAW;AAAA,MAEX,UAAU,CAAC,aAAa,EAAE,MAAM,YAAY,IAAI,GAAK,MAAM,UAAU,aAAa,IAAI,CAAC,CAAC;AAAA,IAC5F,CAAC;AAAA,IAED,aAAa;AAAA,MACT,MAAM;AAAA,MACN,IAAI;AAAA,MACJ,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,UAAU;AAAA,MACV,UAAU;AAAA,QACN,aAAa;AAAA,UACT,MAAM;AAAA,UACN,IAAI;AAAA,UACJ,MAAM;AAAA,UACN,aAAa;AAAA,QACjB,CAAC;AAAA,MACL;AAAA,IACJ,CAAC;AAAA,EACL;AACJ,CAAC;AAuBM,MAAM,kCAAkC,gBAAgB,cAAgD,EAAE;AAAA,EAC7G,wBAAwB;AAAA,EACxB,IAAI,aAAa,aAAa;AAClC;",
4
+ "sourcesContent": ["/**\n * @license\n * Copyright 2022-2024 Matter.js Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Identity, MaybePromise } from \"@project-chip/matter.js-general\";\nimport {\n AttributeElement,\n ClusterElement,\n ClusterModel,\n CommandElement,\n EventElement,\n FieldElement,\n} from \"@project-chip/matter.js-model\";\nimport { ClusterBehavior } from \"@project-chip/matter.js/behavior/cluster\";\nimport {\n Attribute,\n ClusterRegistry,\n Command,\n Event,\n EventPriority,\n MutableCluster,\n} from \"@project-chip/matter.js/cluster\";\nimport { ClusterId, VendorId } from \"@project-chip/matter.js/datatype\";\nimport { TlvField, TlvInt16, TlvNullable, TlvObject, TlvString, TypeFromSchema } from \"@project-chip/matter.js/tlv\";\n\n/** Define the Cluster ID, custom clusters use a special extended formt that also contains the Vendor Id */\nconst myFancyClusterId = ClusterId.buildVendorSpecific(VendorId(0xfff4), 0xfc00);\n\n/**\n * Defines the Cluster on Tlv Schema level in a special namespace structure to match the official cluster\n * structures of matter.js.\n * All places that contains \"MyFancy...\" belong to the custom cluster details, all rest can be left statically like the\n * given names.\n * For more examples and usages of features in such clusters and how the code should look then check the standard\n * cluster Tlv definitions in packages/matter.js/cluster/definitions/*\n */\nexport namespace MyFancyOwnFunctionality {\n /**\n * Input to the MyFancyOwnFunctionality myFancyCommand command\n */\n export const TlvMyFancyCommandRequest = TlvObject({ value: TlvField(0, TlvString) });\n\n /**\n * Response of the MyFancyOwnFunctionality myFancyCommand command\n */\n export const TlvMyFancyCommandResponse = TlvObject({ response: TlvField(0, TlvString) });\n\n /**\n * Event for the MyFancyOwnFunctionality myFancyEvent event\n */\n export const TlvMyFancyEvent = TlvObject({ eventValue: TlvField(0, TlvString) });\n\n /**\n * @see {@link Cluster}\n */\n export const ClusterInstance = MutableCluster({\n id: myFancyClusterId,\n name: \"MyFancyOwnFunctionality\",\n revision: 1,\n\n attributes: {\n /** My fancy attribute */\n myFancyValue: Attribute(0x0, TlvNullable(TlvInt16)),\n },\n\n commands: {\n /** My fancy command */\n myFancyCommand: Command(0x1, TlvMyFancyCommandRequest, 0x2, TlvMyFancyCommandResponse),\n },\n\n events: {\n /** My fancy event */\n myFancyEvent: Event(0x5, EventPriority.Info, TlvMyFancyEvent),\n },\n });\n\n /**\n * My Fancy Cluster\n *\n * This cluster provides an interface to some fancy custom functions.\n */\n export interface Cluster extends Identity<typeof ClusterInstance> {}\n\n export const Cluster: Cluster = ClusterInstance;\n\n export const Complete = Cluster;\n}\n\nexport type MyFancyOwnFunctionalityCluster = MyFancyOwnFunctionality.Cluster;\nexport const MyFancyOwnFunctionalityCluster = MyFancyOwnFunctionality.Cluster;\nClusterRegistry.register(MyFancyOwnFunctionality.Complete);\n\n/**\n * matter.js Model Schema for the cluster, need to match with the Tlv Schema above.\n * See more details in packages/matter.js/behavior/definitions/*\n */\nconst MyFancySchema = ClusterElement({\n name: \"MyFancyOwnFunctionality\",\n id: myFancyClusterId,\n classification: \"application\",\n description: \"My Fancy Functionality\",\n\n children: [\n AttributeElement({ name: \"ClusterRevision\", id: 0xfffd, type: \"ClusterRevision\", default: 1 }),\n\n AttributeElement({\n name: \"MyFancyValue\",\n id: 0x0,\n type: \"int16\",\n access: \"R V\",\n conformance: \"M\",\n quality: \"X\",\n }),\n\n CommandElement({\n name: \"MyFancyCommand\",\n id: 0x1,\n access: \"O\",\n conformance: \"M\",\n direction: \"request\",\n response: \"MyFancyCommandResponse\",\n\n children: [FieldElement({ name: \"value\", id: 0x0, type: \"string\", conformance: \"M\" })],\n }),\n CommandElement({\n name: \"MyFancyCommandResponse\",\n id: 0x2,\n conformance: \"M\",\n direction: \"request\",\n\n children: [FieldElement({ name: \"response\", id: 0x0, type: \"string\", conformance: \"M\" })],\n }),\n\n EventElement({\n name: \"MyFancyEvent\",\n id: 0x5,\n access: \"V\",\n conformance: \"O\",\n priority: \"info\",\n children: [\n FieldElement({\n name: \"EventValue\",\n id: 0x0,\n type: \"string\",\n conformance: \"M\",\n }),\n ],\n }),\n ],\n});\n\n/**\n * Interface definitions - exposes the Implementation interface for the cluster and some types to be used in the\n * cluster implementations.\n */\nexport type MyFancyCommandRequest = TypeFromSchema<typeof MyFancyOwnFunctionality.TlvMyFancyCommandRequest>;\nexport type MyFancyCommandResponse = TypeFromSchema<typeof MyFancyOwnFunctionality.TlvMyFancyCommandResponse>;\nexport type MyFancyEvent = TypeFromSchema<typeof MyFancyOwnFunctionality.TlvMyFancyEvent>;\n\nexport namespace MyFancyOwnFunctionalityInterface {\n export interface Base {\n myFancyCommand(request: MyFancyCommandRequest): MaybePromise<MyFancyCommandResponse>;\n }\n}\n\nexport type MyFancyOwnFunctionalityInterface = {\n components: [{ flags: {}; methods: MyFancyOwnFunctionalityInterface.Base }];\n};\n\n/**\n * Behavior definition for the cluster command handler implementation\n */\nexport const MyFancyOwnFunctionalityBehavior = ClusterBehavior.withInterface<MyFancyOwnFunctionalityInterface>().for(\n MyFancyOwnFunctionality.Cluster,\n new ClusterModel(MyFancySchema),\n);\n\ntype MyFancyOwnFunctionalityBehaviorType = InstanceType<typeof MyFancyOwnFunctionalityBehavior>;\nexport interface MyFancyOwnFunctionalityBehavior extends MyFancyOwnFunctionalityBehaviorType {}\ntype StateType = InstanceType<typeof MyFancyOwnFunctionalityBehavior.State>;\nexport namespace MyFancyOwnFunctionalityBehavior {\n export interface State extends StateType {}\n}\n"],
5
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,uBAAuB;AAChC;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,WAAW,gBAAgB;AACpC,SAAS,UAAU,UAAU,aAAa,WAAW,iBAAiC;AAGtF,MAAM,mBAAmB,UAAU,oBAAoB,SAAS,KAAM,GAAG,KAAM;AAUxE,IAAU;AAAA,CAAV,CAAUA,6BAAV;AAII,EAAMA,yBAAA,2BAA2B,UAAU,EAAE,OAAO,SAAS,GAAG,SAAS,EAAE,CAAC;AAK5E,EAAMA,yBAAA,4BAA4B,UAAU,EAAE,UAAU,SAAS,GAAG,SAAS,EAAE,CAAC;AAKhF,EAAMA,yBAAA,kBAAkB,UAAU,EAAE,YAAY,SAAS,GAAG,SAAS,EAAE,CAAC;AAKxE,EAAMA,yBAAA,kBAAkB,eAAe;AAAA,IAC1C,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,UAAU;AAAA,IAEV,YAAY;AAAA;AAAA,MAER,cAAc,UAAU,GAAK,YAAY,QAAQ,CAAC;AAAA,IACtD;AAAA,IAEA,UAAU;AAAA;AAAA,MAEN,gBAAgB,QAAQ,GAAKA,yBAAA,0BAA0B,GAAKA,yBAAA,yBAAyB;AAAA,IACzF;AAAA,IAEA,QAAQ;AAAA;AA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jB,CAAC;AAAA,MACL;AAAA,IACJ,CAAC;AAAA,EACL;AACJ,CAAC;AAuBM,MAAM,kCAAkC,gBAAgB,cAAgD,EAAE;AAAA,EAC7G,wBAAwB;AAAA,EACxB,IAAI,aAAa,aAAa;AAClC;",
6
6
  "names": ["MyFancyOwnFunctionality"]
7
7
  }
@@ -1,4 +1,4 @@
1
- import "@project-chip/matter-node.js";
1
+ import "@project-chip/matter.js-nodejs";
2
2
  import { ServerNode } from "@project-chip/matter.js/node";
3
3
  const node = await ServerNode.create();
4
4
  await node.run();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tutorial/example01.ts"],
4
- "sourcesContent": ["import \"@project-chip/matter-node.js\";\nimport { ServerNode } from \"@project-chip/matter.js/node\";\n\nconst node = await ServerNode.create();\n\nawait node.run();\n"],
4
+ "sourcesContent": ["import \"@project-chip/matter.js-nodejs\";\nimport { ServerNode } from \"@project-chip/matter.js/node\";\n\nconst node = await ServerNode.create();\n\nawait node.run();\n"],
5
5
  "mappings": "AAAA,OAAO;AACP,SAAS,kBAAkB;AAE3B,MAAM,OAAO,MAAM,WAAW,OAAO;AAErC,MAAM,KAAK,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import "@project-chip/matter-node.js";
1
+ import "@project-chip/matter.js-nodejs";
2
2
  import { OnOffLightDevice } from "@project-chip/matter.js/devices/OnOffLightDevice";
3
3
  import { ServerNode } from "@project-chip/matter.js/node";
4
4
  const node = await ServerNode.create();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tutorial/example02.ts"],
4
- "sourcesContent": ["import \"@project-chip/matter-node.js\";\nimport { OnOffLightDevice } from \"@project-chip/matter.js/devices/OnOffLightDevice\";\nimport { ServerNode } from \"@project-chip/matter.js/node\";\n\nconst node = await ServerNode.create();\n\nawait node.add(OnOffLightDevice);\n\nawait node.run();\n"],
4
+ "sourcesContent": ["import \"@project-chip/matter.js-nodejs\";\nimport { OnOffLightDevice } from \"@project-chip/matter.js/devices/OnOffLightDevice\";\nimport { ServerNode } from \"@project-chip/matter.js/node\";\n\nconst node = await ServerNode.create();\n\nawait node.add(OnOffLightDevice);\n\nawait node.run();\n"],
5
5
  "mappings": "AAAA,OAAO;AACP,SAAS,wBAAwB;AACjC,SAAS,kBAAkB;AAE3B,MAAM,OAAO,MAAM,WAAW,OAAO;AAErC,MAAM,KAAK,IAAI,gBAAgB;AAE/B,MAAM,KAAK,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import "@project-chip/matter-node.js";
1
+ import "@project-chip/matter.js-nodejs";
2
2
  import { OnOffLightDevice, OnOffLightRequirements } from "@project-chip/matter.js/devices/OnOffLightDevice";
3
3
  import { ServerNode } from "@project-chip/matter.js/node";
4
4
  class MyOnOffServer extends OnOffLightRequirements.OnOffServer {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tutorial/example03.ts"],
4
- "sourcesContent": ["import \"@project-chip/matter-node.js\";\nimport { OnOffLightDevice, OnOffLightRequirements } from \"@project-chip/matter.js/devices/OnOffLightDevice\";\nimport { ServerNode } from \"@project-chip/matter.js/node\";\n\nclass MyOnOffServer extends OnOffLightRequirements.OnOffServer {\n override on() {\n console.log(\"Turning on\");\n }\n\n override off() {\n console.log(\"Turning off\");\n }\n}\n\nconst node = await ServerNode.create();\n\nawait node.add(OnOffLightDevice.with(MyOnOffServer));\n\nawait node.run();\n"],
4
+ "sourcesContent": ["import \"@project-chip/matter.js-nodejs\";\nimport { OnOffLightDevice, OnOffLightRequirements } from \"@project-chip/matter.js/devices/OnOffLightDevice\";\nimport { ServerNode } from \"@project-chip/matter.js/node\";\n\nclass MyOnOffServer extends OnOffLightRequirements.OnOffServer {\n override on() {\n console.log(\"Turning on\");\n }\n\n override off() {\n console.log(\"Turning off\");\n }\n}\n\nconst node = await ServerNode.create();\n\nawait node.add(OnOffLightDevice.with(MyOnOffServer));\n\nawait node.run();\n"],
5
5
  "mappings": "AAAA,OAAO;AACP,SAAS,kBAAkB,8BAA8B;AACzD,SAAS,kBAAkB;AAE3B,MAAM,sBAAsB,uBAAuB,YAAY;AAAA,EAClD,KAAK;AACV,YAAQ,IAAI,YAAY;AAAA,EAC5B;AAAA,EAES,MAAM;AACX,YAAQ,IAAI,aAAa;AAAA,EAC7B;AACJ;AAEA,MAAM,OAAO,MAAM,WAAW,OAAO;AAErC,MAAM,KAAK,IAAI,iBAAiB,KAAK,aAAa,CAAC;AAEnD,MAAM,KAAK,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import "@project-chip/matter-node.js";
1
+ import "@project-chip/matter.js-nodejs";
2
2
  import { OnOffLightDevice } from "@project-chip/matter.js/devices/OnOffLightDevice";
3
3
  import { ServerNode } from "@project-chip/matter.js/node";
4
4
  const node = await ServerNode.create();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tutorial/example04.ts"],
4
- "sourcesContent": ["import \"@project-chip/matter-node.js\";\nimport { OnOffLightDevice } from \"@project-chip/matter.js/devices/OnOffLightDevice\";\nimport { ServerNode } from \"@project-chip/matter.js/node\";\n\nconst node = await ServerNode.create();\n\nconst light = await node.add(OnOffLightDevice);\n\nlight.events.onOff.onOff$Changed.on(newValue => {\n console.log(`Light is ${newValue ? \"on\" : \"off\"}`);\n});\n\nawait node.run();\n"],
4
+ "sourcesContent": ["import \"@project-chip/matter.js-nodejs\";\nimport { OnOffLightDevice } from \"@project-chip/matter.js/devices/OnOffLightDevice\";\nimport { ServerNode } from \"@project-chip/matter.js/node\";\n\nconst node = await ServerNode.create();\n\nconst light = await node.add(OnOffLightDevice);\n\nlight.events.onOff.onOff$Changed.on(newValue => {\n console.log(`Light is ${newValue ? \"on\" : \"off\"}`);\n});\n\nawait node.run();\n"],
5
5
  "mappings": "AAAA,OAAO;AACP,SAAS,wBAAwB;AACjC,SAAS,kBAAkB;AAE3B,MAAM,OAAO,MAAM,WAAW,OAAO;AAErC,MAAM,QAAQ,MAAM,KAAK,IAAI,gBAAgB;AAE7C,MAAM,OAAO,MAAM,cAAc,GAAG,cAAY;AAC5C,UAAQ,IAAI,YAAY,WAAW,OAAO,KAAK,EAAE;AACrD,CAAC;AAED,MAAM,KAAK,IAAI;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import "@project-chip/matter-node.js";
1
+ import "@project-chip/matter.js-nodejs";
2
2
  import { OnOffLightDevice } from "@project-chip/matter.js/devices/OnOffLightDevice";
3
3
  import { ServerNode } from "@project-chip/matter.js/node";
4
4
  const node = await ServerNode.create();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tutorial/example05.ts"],
4
- "sourcesContent": ["import \"@project-chip/matter-node.js\";\nimport { OnOffLightDevice } from \"@project-chip/matter.js/devices/OnOffLightDevice\";\nimport { ServerNode } from \"@project-chip/matter.js/node\";\n\nconst node = await ServerNode.create();\n\nconst light = await node.add(OnOffLightDevice);\n\nawait node.start();\n\nawait light.act(async agent => {\n await agent.onOff.toggle();\n console.log(\"On/off state after first toggle\", agent.onOff.state);\n\n await agent.onOff.toggle();\n console.log(\"On/off state after second toggle\", agent.onOff.state);\n});\n\nawait node.close();\n"],
4
+ "sourcesContent": ["import \"@project-chip/matter.js-nodejs\";\nimport { OnOffLightDevice } from \"@project-chip/matter.js/devices/OnOffLightDevice\";\nimport { ServerNode } from \"@project-chip/matter.js/node\";\n\nconst node = await ServerNode.create();\n\nconst light = await node.add(OnOffLightDevice);\n\nawait node.start();\n\nawait light.act(async agent => {\n await agent.onOff.toggle();\n console.log(\"On/off state after first toggle\", agent.onOff.state);\n\n await agent.onOff.toggle();\n console.log(\"On/off state after second toggle\", agent.onOff.state);\n});\n\nawait node.close();\n"],
5
5
  "mappings": "AAAA,OAAO;AACP,SAAS,wBAAwB;AACjC,SAAS,kBAAkB;AAE3B,MAAM,OAAO,MAAM,WAAW,OAAO;AAErC,MAAM,QAAQ,MAAM,KAAK,IAAI,gBAAgB;AAE7C,MAAM,KAAK,MAAM;AAEjB,MAAM,MAAM,IAAI,OAAM,UAAS;AAC3B,QAAM,MAAM,MAAM,OAAO;AACzB,UAAQ,IAAI,mCAAmC,MAAM,MAAM,KAAK;AAEhE,QAAM,MAAM,MAAM,OAAO;AACzB,UAAQ,IAAI,oCAAoC,MAAM,MAAM,KAAK;AACrE,CAAC;AAED,MAAM,KAAK,MAAM;",
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.11.0-alpha.0-20240909-b3b29745",
3
+ "version": "0.11.0-alpha.0-20240911-db8f7c80",
4
4
  "description": "CLI/Reference implementation scripts for Matter protocol for node.js",
5
5
  "keywords": [
6
6
  "iot",
@@ -64,10 +64,11 @@
64
64
  "typescript": "~5.5.3"
65
65
  },
66
66
  "dependencies": {
67
- "@project-chip/matter-node-ble.js": "0.11.0-alpha.0-20240909-b3b29745",
68
- "@project-chip/matter-node.js": "0.11.0-alpha.0-20240909-b3b29745",
69
- "@project-chip/matter.js": "0.11.0-alpha.0-20240909-b3b29745",
70
- "@project-chip/matter.js-tools": "0.11.0-alpha.0-20240909-b3b29745"
67
+ "@project-chip/matter-node-ble.js": "0.11.0-alpha.0-20240911-db8f7c80",
68
+ "@project-chip/matter.js-nodejs": "0.11.0-alpha.0-20240911-db8f7c80",
69
+ "@project-chip/matter.js": "0.11.0-alpha.0-20240911-db8f7c80",
70
+ "@project-chip/matter.js-general": "0.11.0-alpha.0-20240911-db8f7c80",
71
+ "@project-chip/matter.js-tools": "0.11.0-alpha.0-20240911-db8f7c80"
71
72
  },
72
73
  "engines": {
73
74
  "node": ">=18.0.0"
@@ -16,9 +16,9 @@
16
16
  * Import needed modules from @project-chip/matter-node.js
17
17
  */
18
18
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
19
- import "@project-chip/matter-node.js";
19
+ import { requireMinNodeVersion } from "@project-chip/matter.js-nodejs";
20
20
 
21
- import { requireMinNodeVersion } from "@project-chip/matter-node.js/util";
21
+ import { Time } from "@project-chip/matter.js-general";
22
22
  import { BridgedDeviceBasicInformationServer } from "@project-chip/matter.js/behavior/definitions/bridged-device-basic-information";
23
23
  import { VendorId } from "@project-chip/matter.js/datatype";
24
24
  import { logEndpoint } from "@project-chip/matter.js/device";
@@ -28,7 +28,6 @@ import { Endpoint, EndpointServer } from "@project-chip/matter.js/endpoint";
28
28
  import { AggregatorEndpoint } from "@project-chip/matter.js/endpoints/AggregatorEndpoint";
29
29
  import { Environment, StorageService } from "@project-chip/matter.js/environment";
30
30
  import { ServerNode } from "@project-chip/matter.js/node";
31
- import { Time } from "@project-chip/matter.js/time";
32
31
  import { execSync } from "child_process";
33
32
 
34
33
  requireMinNodeVersion(16);