@project-chip/matter-node.js-examples 0.10.1 → 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 +8 -8
  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
@@ -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);
@@ -19,21 +19,20 @@
19
19
  * Import needed modules from @project-chip/matter-node.js
20
20
  */
21
21
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
22
- import { CommissioningServer, MatterServer } from "@project-chip/matter-node.js";
23
-
24
- import { VendorId } from "@project-chip/matter-node.js/datatype";
25
- import { Aggregator, DeviceTypes, OnOffLightDevice, OnOffPluginUnitDevice } from "@project-chip/matter-node.js/device";
26
- import { Format, Level, Logger } from "@project-chip/matter-node.js/log";
27
- import { QrCode } from "@project-chip/matter-node.js/schema";
28
- import { StorageBackendDisk, StorageManager } from "@project-chip/matter-node.js/storage";
29
- import { Time } from "@project-chip/matter-node.js/time";
30
22
  import {
23
+ StorageBackendDisk,
31
24
  commandExecutor,
32
25
  getIntParameter,
33
26
  getParameter,
34
27
  hasParameter,
35
28
  requireMinNodeVersion,
36
- } from "@project-chip/matter-node.js/util";
29
+ } from "@project-chip/matter.js-nodejs";
30
+
31
+ import { CommissioningServer, MatterServer } from "@project-chip/matter.js";
32
+ import { LogFormat, LogLevel, Logger, StorageManager, Time } from "@project-chip/matter.js-general";
33
+ import { VendorId } from "@project-chip/matter.js/datatype";
34
+ import { Aggregator, DeviceTypes, OnOffLightDevice, OnOffPluginUnitDevice } from "@project-chip/matter.js/device";
35
+ import { QrCode } from "@project-chip/matter.js/schema";
37
36
 
38
37
  const logger = Logger.get("Device");
39
38
 
@@ -42,28 +41,28 @@ requireMinNodeVersion(16);
42
41
  /** Configure logging */
43
42
  switch (getParameter("loglevel")) {
44
43
  case "fatal":
45
- Logger.defaultLogLevel = Level.FATAL;
44
+ Logger.defaultLogLevel = LogLevel.FATAL;
46
45
  break;
47
46
  case "error":
48
- Logger.defaultLogLevel = Level.ERROR;
47
+ Logger.defaultLogLevel = LogLevel.ERROR;
49
48
  break;
50
49
  case "warn":
51
- Logger.defaultLogLevel = Level.WARN;
50
+ Logger.defaultLogLevel = LogLevel.WARN;
52
51
  break;
53
52
  case "info":
54
- Logger.defaultLogLevel = Level.INFO;
53
+ Logger.defaultLogLevel = LogLevel.INFO;
55
54
  break;
56
55
  }
57
56
 
58
57
  switch (getParameter("logformat")) {
59
58
  case "plain":
60
- Logger.format = Format.PLAIN;
59
+ Logger.format = LogFormat.PLAIN;
61
60
  break;
62
61
  case "html":
63
- Logger.format = Format.HTML;
62
+ Logger.format = LogFormat.HTML;
64
63
  break;
65
64
  default:
66
- if (process.stdin?.isTTY) Logger.format = Format.ANSI;
65
+ if (process.stdin?.isTTY) Logger.format = LogFormat.ANSI;
67
66
  }
68
67
 
69
68
  const storageLocation = getParameter("store") ?? ".device-node";
@@ -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 { DeviceTypeId, VendorId } from "@project-chip/matter.js/datatype";
23
23
  import { logEndpoint } from "@project-chip/matter.js/device";
24
24
  import { OnOffLightDevice } from "@project-chip/matter.js/devices/OnOffLightDevice";
@@ -26,7 +26,6 @@ import { OnOffPlugInUnitDevice } from "@project-chip/matter.js/devices/OnOffPlug
26
26
  import { Endpoint, EndpointServer } from "@project-chip/matter.js/endpoint";
27
27
  import { Environment, StorageService } from "@project-chip/matter.js/environment";
28
28
  import { ServerNode } from "@project-chip/matter.js/node";
29
- import { Time } from "@project-chip/matter.js/time";
30
29
  import { execSync } from "child_process";
31
30
 
32
31
  requireMinNodeVersion(16);
@@ -21,21 +21,20 @@
21
21
  * Import needed modules from @project-chip/matter-node.js
22
22
  */
23
23
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
24
- import { CommissioningServer, MatterServer } from "@project-chip/matter-node.js";
25
-
26
- import { VendorId } from "@project-chip/matter-node.js/datatype";
27
- import { DeviceTypes, OnOffLightDevice, OnOffPluginUnitDevice } from "@project-chip/matter-node.js/device";
28
- import { Format, Level, Logger } from "@project-chip/matter-node.js/log";
29
- import { QrCode } from "@project-chip/matter-node.js/schema";
30
- import { StorageBackendDisk, StorageManager } from "@project-chip/matter-node.js/storage";
31
- import { Time } from "@project-chip/matter-node.js/time";
32
24
  import {
33
25
  commandExecutor,
34
26
  getIntParameter,
35
27
  getParameter,
36
28
  hasParameter,
37
29
  requireMinNodeVersion,
38
- } from "@project-chip/matter-node.js/util";
30
+ StorageBackendDisk,
31
+ } from "@project-chip/matter.js-nodejs";
32
+
33
+ import { CommissioningServer, MatterServer } from "@project-chip/matter.js";
34
+ import { LogFormat, Logger, LogLevel, StorageManager, Time } from "@project-chip/matter.js-general";
35
+ import { VendorId } from "@project-chip/matter.js/datatype";
36
+ import { DeviceTypes, OnOffLightDevice, OnOffPluginUnitDevice } from "@project-chip/matter.js/device";
37
+ import { QrCode } from "@project-chip/matter.js/schema";
39
38
 
40
39
  const logger = Logger.get("Device");
41
40
 
@@ -44,28 +43,28 @@ requireMinNodeVersion(16);
44
43
  /** Configure logging */
45
44
  switch (getParameter("loglevel")) {
46
45
  case "fatal":
47
- Logger.defaultLogLevel = Level.FATAL;
46
+ Logger.defaultLogLevel = LogLevel.FATAL;
48
47
  break;
49
48
  case "error":
50
- Logger.defaultLogLevel = Level.ERROR;
49
+ Logger.defaultLogLevel = LogLevel.ERROR;
51
50
  break;
52
51
  case "warn":
53
- Logger.defaultLogLevel = Level.WARN;
52
+ Logger.defaultLogLevel = LogLevel.WARN;
54
53
  break;
55
54
  case "info":
56
- Logger.defaultLogLevel = Level.INFO;
55
+ Logger.defaultLogLevel = LogLevel.INFO;
57
56
  break;
58
57
  }
59
58
 
60
59
  switch (getParameter("logformat")) {
61
60
  case "plain":
62
- Logger.format = Format.PLAIN;
61
+ Logger.format = LogFormat.PLAIN;
63
62
  break;
64
63
  case "html":
65
- Logger.format = Format.HTML;
64
+ Logger.format = LogFormat.HTML;
66
65
  break;
67
66
  default:
68
- if (process.stdin?.isTTY) Logger.format = Format.ANSI;
67
+ if (process.stdin?.isTTY) Logger.format = LogFormat.ANSI;
69
68
  }
70
69
 
71
70
  const storageLocation = getParameter("store") ?? ".device-node";
@@ -15,12 +15,11 @@
15
15
  * Import needed modules from @project-chip/matter-node.js
16
16
  */
17
17
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
18
- // Include this first to auto-register Crypto, Network and Time Node.js implementations
19
- import "@project-chip/matter-node.js";
18
+ import { requireMinNodeVersion } from "@project-chip/matter.js-nodejs";
20
19
 
21
20
  import { BleNode } from "@project-chip/matter-node-ble.js/ble";
22
- import { requireMinNodeVersion } from "@project-chip/matter-node.js/util";
23
21
  import { CommissioningController, NodeCommissioningOptions } from "@project-chip/matter.js";
22
+ import { Logger, singleton, Time } from "@project-chip/matter.js-general";
24
23
  import { Ble } from "@project-chip/matter.js/ble";
25
24
  import {
26
25
  BasicInformationCluster,
@@ -32,11 +31,8 @@ import {
32
31
  import { NodeId } from "@project-chip/matter.js/datatype";
33
32
  import { NodeStateInformation } from "@project-chip/matter.js/device";
34
33
  import { Environment, StorageService } from "@project-chip/matter.js/environment";
35
- import { Logger } from "@project-chip/matter.js/log";
36
34
  import { CommissioningOptions } from "@project-chip/matter.js/protocol";
37
35
  import { ManualPairingCodeCodec } from "@project-chip/matter.js/schema";
38
- import { Time } from "@project-chip/matter.js/time";
39
- import { singleton } from "@project-chip/matter.js/util";
40
36
 
41
37
  const logger = Logger.get("Controller");
42
38
 
@@ -15,29 +15,28 @@
15
15
  * Import needed modules from @project-chip/matter-node.js
16
16
  */
17
17
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
18
- import { CommissioningController, MatterServer, NodeCommissioningOptions } from "@project-chip/matter-node.js";
18
+ import {
19
+ StorageBackendDisk,
20
+ getIntParameter,
21
+ getParameter,
22
+ hasParameter,
23
+ requireMinNodeVersion,
24
+ } from "@project-chip/matter.js-nodejs";
19
25
 
20
26
  import { BleNode } from "@project-chip/matter-node-ble.js/ble";
21
- import { Ble } from "@project-chip/matter-node.js/ble";
27
+ import { CommissioningController, MatterServer, NodeCommissioningOptions } from "@project-chip/matter.js";
28
+ import { LogFormat, LogLevel, Logger, StorageManager, singleton } from "@project-chip/matter.js-general";
29
+ import { Ble } from "@project-chip/matter.js/ble";
22
30
  import {
23
31
  BasicInformationCluster,
24
32
  DescriptorCluster,
25
33
  GeneralCommissioning,
26
34
  OnOffCluster,
27
- } from "@project-chip/matter-node.js/cluster";
28
- import { NodeId } from "@project-chip/matter-node.js/datatype";
29
- import { NodeStateInformation } from "@project-chip/matter-node.js/device";
30
- import { Format, Level, Logger } from "@project-chip/matter-node.js/log";
31
- import { CommissioningOptions } from "@project-chip/matter-node.js/protocol";
32
- import { ManualPairingCodeCodec } from "@project-chip/matter-node.js/schema";
33
- import { StorageBackendDisk, StorageManager } from "@project-chip/matter-node.js/storage";
34
- import {
35
- getIntParameter,
36
- getParameter,
37
- hasParameter,
38
- requireMinNodeVersion,
39
- singleton,
40
- } from "@project-chip/matter-node.js/util";
35
+ } from "@project-chip/matter.js/cluster";
36
+ import { NodeId } from "@project-chip/matter.js/datatype";
37
+ import { NodeStateInformation } from "@project-chip/matter.js/device";
38
+ import { CommissioningOptions } from "@project-chip/matter.js/protocol";
39
+ import { ManualPairingCodeCodec } from "@project-chip/matter.js/schema";
41
40
 
42
41
  const logger = Logger.get("Controller");
43
42
 
@@ -46,28 +45,28 @@ requireMinNodeVersion(16);
46
45
  /** Configure logging */
47
46
  switch (getParameter("loglevel")) {
48
47
  case "fatal":
49
- Logger.defaultLogLevel = Level.FATAL;
48
+ Logger.defaultLogLevel = LogLevel.FATAL;
50
49
  break;
51
50
  case "error":
52
- Logger.defaultLogLevel = Level.ERROR;
51
+ Logger.defaultLogLevel = LogLevel.ERROR;
53
52
  break;
54
53
  case "warn":
55
- Logger.defaultLogLevel = Level.WARN;
54
+ Logger.defaultLogLevel = LogLevel.WARN;
56
55
  break;
57
56
  case "info":
58
- Logger.defaultLogLevel = Level.INFO;
57
+ Logger.defaultLogLevel = LogLevel.INFO;
59
58
  break;
60
59
  }
61
60
 
62
61
  switch (getParameter("logformat")) {
63
62
  case "plain":
64
- Logger.format = Format.PLAIN;
63
+ Logger.format = LogFormat.PLAIN;
65
64
  break;
66
65
  case "html":
67
- Logger.format = Format.HTML;
66
+ Logger.format = LogFormat.HTML;
68
67
  break;
69
68
  default:
70
- if (process.stdin?.isTTY) Logger.format = Format.ANSI;
69
+ if (process.stdin?.isTTY) Logger.format = LogFormat.ANSI;
71
70
  }
72
71
 
73
72
  if (hasParameter("ble")) {
@@ -15,9 +15,9 @@
15
15
  * Import needed modules from @project-chip/matter-node.js
16
16
  */
17
17
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
18
- import "@project-chip/matter-node.js";
18
+ import { requireMinNodeVersion } from "@project-chip/matter.js-nodejs";
19
19
 
20
- import { requireMinNodeVersion } from "@project-chip/matter-node.js/util";
20
+ import { Time } from "@project-chip/matter.js-general";
21
21
  import { DeviceTypeId, VendorId } from "@project-chip/matter.js/datatype";
22
22
  import { logEndpoint } from "@project-chip/matter.js/device";
23
23
  import { OnOffLightDevice } from "@project-chip/matter.js/devices/OnOffLightDevice";
@@ -25,7 +25,6 @@ import { OnOffPlugInUnitDevice } from "@project-chip/matter.js/devices/OnOffPlug
25
25
  import { Endpoint, EndpointServer } from "@project-chip/matter.js/endpoint";
26
26
  import { Environment, StorageService } from "@project-chip/matter.js/environment";
27
27
  import { ServerNode } from "@project-chip/matter.js/node";
28
- import { Time } from "@project-chip/matter.js/time";
29
28
  import { execSync } from "child_process";
30
29
 
31
30
  requireMinNodeVersion(16);
@@ -24,16 +24,14 @@
24
24
  * Import needed modules from @project-chip/matter-node.js
25
25
  */
26
26
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
27
- import "@project-chip/matter-node.js";
27
+ import { createFileLogger, requireMinNodeVersion } from "@project-chip/matter.js-nodejs";
28
28
 
29
29
  import { BleNode } from "@project-chip/matter-node-ble.js/ble";
30
- import { GeneralDiagnostics } from "@project-chip/matter-node.js/cluster";
31
- import { createFileLogger } from "@project-chip/matter-node.js/log";
32
- import { requireMinNodeVersion } from "@project-chip/matter-node.js/util";
30
+ import { LogLevel, Logger, Time, logLevelFromString, singleton } from "@project-chip/matter.js-general";
33
31
  import { NetworkCommissioningServer } from "@project-chip/matter.js/behavior/definitions/network-commissioning";
34
32
  import { OnOffServer } from "@project-chip/matter.js/behavior/definitions/on-off";
35
33
  import { Ble } from "@project-chip/matter.js/ble";
36
- import { NetworkCommissioning } from "@project-chip/matter.js/cluster";
34
+ import { GeneralDiagnostics, NetworkCommissioning } from "@project-chip/matter.js/cluster";
37
35
  import { DeviceTypeId, VendorId } from "@project-chip/matter.js/datatype";
38
36
  import { logEndpoint } from "@project-chip/matter.js/device";
39
37
  import { OnOffLightDevice } from "@project-chip/matter.js/devices/OnOffLightDevice";
@@ -42,11 +40,8 @@ import { Endpoint, EndpointServer } from "@project-chip/matter.js/endpoint";
42
40
  import { RootRequirements } from "@project-chip/matter.js/endpoint/definitions";
43
41
  import { Environment, StorageService } from "@project-chip/matter.js/environment";
44
42
  import { FabricAction } from "@project-chip/matter.js/fabric";
45
- import { Level, Logger, levelFromString } from "@project-chip/matter.js/log";
46
43
  import { ServerNode } from "@project-chip/matter.js/node";
47
44
  import { QrCode } from "@project-chip/matter.js/schema";
48
- import { Time } from "@project-chip/matter.js/time";
49
- import { ByteArray, singleton } from "@project-chip/matter.js/util";
50
45
  import { execSync } from "child_process";
51
46
  import { DummyThreadNetworkCommissioningServer } from "./cluster/DummyThreadNetworkCommissioningServer.js";
52
47
  import { DummyWifiNetworkCommissioningServer } from "./cluster/DummyWifiNetworkCommissioningServer.js";
@@ -104,7 +99,7 @@ function executeCommand(scriptParamName: string) {
104
99
  const logFile = environment.vars.string("logfile.filename");
105
100
  if (logFile !== undefined) {
106
101
  Logger.addLogger("filelogger", await createFileLogger(logFile), {
107
- defaultLogLevel: levelFromString(environment.vars.string("logfile.loglevel")) ?? Level.DEBUG,
102
+ defaultLogLevel: logLevelFromString(environment.vars.string("logfile.loglevel")) ?? LogLevel.DEBUG,
108
103
  });
109
104
  }
110
105
 
@@ -254,7 +249,7 @@ if (Ble.enabled) {
254
249
  );
255
250
  }
256
251
 
257
- const networkId = new ByteArray(32);
252
+ const networkId = new Uint8Array(32);
258
253
  // Physical devices appear as "nodes" on a Matter network. As a device implementer you use a NodeServer to bring a
259
254
  // device online.
260
255
  //
@@ -19,24 +19,22 @@
19
19
  * Import needed modules from @project-chip/matter-node.js
20
20
  */
21
21
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
22
- import { CommissioningServer, MatterServer } from "@project-chip/matter-node.js";
23
-
24
- import { BleNode } from "@project-chip/matter-node-ble.js/ble";
25
- import { Ble } from "@project-chip/matter-node.js/ble";
26
- import { OnOffLightDevice, OnOffPluginUnitDevice, logEndpoint } from "@project-chip/matter-node.js/device";
27
- import { Format, Level, Logger } from "@project-chip/matter-node.js/log";
28
- import { QrCode } from "@project-chip/matter-node.js/schema";
29
- import { StorageBackendDisk, StorageManager } from "@project-chip/matter-node.js/storage";
30
- import { Time } from "@project-chip/matter-node.js/time";
31
22
  import {
23
+ StorageBackendDisk,
32
24
  commandExecutor,
33
25
  getIntParameter,
34
26
  getParameter,
35
27
  hasParameter,
36
28
  requireMinNodeVersion,
37
- singleton,
38
- } from "@project-chip/matter-node.js/util";
29
+ } from "@project-chip/matter.js-nodejs";
30
+
31
+ import { BleNode } from "@project-chip/matter-node-ble.js/ble";
32
+ import { CommissioningServer, MatterServer } from "@project-chip/matter.js";
33
+ import { LogFormat, LogLevel, Logger, StorageManager, Time, singleton } from "@project-chip/matter.js-general";
34
+ import { Ble } from "@project-chip/matter.js/ble";
39
35
  import { DeviceTypeId, VendorId } from "@project-chip/matter.js/datatype";
36
+ import { OnOffLightDevice, OnOffPluginUnitDevice, logEndpoint } from "@project-chip/matter.js/device";
37
+ import { QrCode } from "@project-chip/matter.js/schema";
40
38
  import DummyWifiNetworkCommissioningClusterServer from "./cluster/DummyWifiNetworkCommissioningServerLegacy.js";
41
39
 
42
40
  const logger = Logger.get("Device");
@@ -46,28 +44,28 @@ requireMinNodeVersion(16);
46
44
  /** Configure logging */
47
45
  switch (getParameter("loglevel")) {
48
46
  case "fatal":
49
- Logger.defaultLogLevel = Level.FATAL;
47
+ Logger.defaultLogLevel = LogLevel.FATAL;
50
48
  break;
51
49
  case "error":
52
- Logger.defaultLogLevel = Level.ERROR;
50
+ Logger.defaultLogLevel = LogLevel.ERROR;
53
51
  break;
54
52
  case "warn":
55
- Logger.defaultLogLevel = Level.WARN;
53
+ Logger.defaultLogLevel = LogLevel.WARN;
56
54
  break;
57
55
  case "info":
58
- Logger.defaultLogLevel = Level.INFO;
56
+ Logger.defaultLogLevel = LogLevel.INFO;
59
57
  break;
60
58
  }
61
59
 
62
60
  switch (getParameter("logformat")) {
63
61
  case "plain":
64
- Logger.format = Format.PLAIN;
62
+ Logger.format = LogFormat.PLAIN;
65
63
  break;
66
64
  case "html":
67
- Logger.format = Format.HTML;
65
+ Logger.format = LogFormat.HTML;
68
66
  break;
69
67
  default:
70
- if (process.stdin?.isTTY) Logger.format = Format.ANSI;
68
+ if (process.stdin?.isTTY) Logger.format = LogFormat.ANSI;
71
69
  }
72
70
 
73
71
  if (hasParameter("ble")) {
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
9
- import "@project-chip/matter-node.js";
9
+ import "@project-chip/matter.js-nodejs";
10
10
 
11
11
  import {
12
12
  MovementDirection,
@@ -5,10 +5,10 @@
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  */
7
7
 
8
- import "@project-chip/matter-node.js";
9
- import { StorageBackendDisk } from "@project-chip/matter-node.js/storage";
8
+ import { StorageBackendDisk } from "@project-chip/matter.js-nodejs";
9
+
10
+ import { Time } from "@project-chip/matter.js-general";
10
11
  import { Environment, StorageService } from "@project-chip/matter.js/environment";
11
- import { Time } from "@project-chip/matter.js/time";
12
12
  import { LocalStorage } from "node-localstorage";
13
13
 
14
14
  const environment = Environment.default;
@@ -8,7 +8,7 @@
8
8
  // This demonstrates bringing a "light" device online with matter.js.
9
9
 
10
10
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
11
- import "@project-chip/matter-node.js";
11
+ import "@project-chip/matter.js-nodejs";
12
12
 
13
13
  import { OnOffLightDevice, OnOffLightRequirements } from "@project-chip/matter.js/devices/OnOffLightDevice";
14
14
  import { ServerNode } from "@project-chip/matter.js/node";
@@ -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 { DeviceTypeId, VendorId } from "@project-chip/matter.js/datatype";
23
23
  import { logEndpoint } from "@project-chip/matter.js/device";
24
24
  import { OnOffLightDevice } from "@project-chip/matter.js/devices/OnOffLightDevice";
@@ -26,7 +26,6 @@ import { OnOffPlugInUnitDevice } from "@project-chip/matter.js/devices/OnOffPlug
26
26
  import { Endpoint, EndpointServer } from "@project-chip/matter.js/endpoint";
27
27
  import { Environment, StorageService } from "@project-chip/matter.js/environment";
28
28
  import { ServerNode } from "@project-chip/matter.js/node";
29
- import { Time } from "@project-chip/matter.js/time";
30
29
  import { execSync } from "child_process";
31
30
 
32
31
  requireMinNodeVersion(16);
@@ -21,21 +21,21 @@
21
21
  * Import needed modules from @project-chip/matter-node.js
22
22
  */
23
23
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
24
- import { CommissioningServer, MatterServer } from "@project-chip/matter-node.js";
25
-
26
- import { DeviceTypes, OnOffLightDevice, OnOffPluginUnitDevice } from "@project-chip/matter-node.js/device";
27
- import { Format, Level, Logger } from "@project-chip/matter-node.js/log";
28
- import { QrCode } from "@project-chip/matter-node.js/schema";
29
- import { StorageBackendDisk, StorageManager } from "@project-chip/matter-node.js/storage";
30
- import { Time } from "@project-chip/matter-node.js/time";
31
24
  import {
25
+ StorageBackendDisk,
32
26
  commandExecutor,
33
27
  getIntParameter,
34
28
  getParameter,
35
29
  hasParameter,
36
30
  requireMinNodeVersion,
37
- } from "@project-chip/matter-node.js/util";
31
+ } from "@project-chip/matter.js-nodejs";
32
+
33
+ import { CommissioningServer, MatterServer } from "@project-chip/matter.js";
34
+
35
+ import { LogFormat, LogLevel, Logger, StorageManager, Time } from "@project-chip/matter.js-general";
38
36
  import { VendorId } from "@project-chip/matter.js/datatype";
37
+ import { DeviceTypes, OnOffLightDevice, OnOffPluginUnitDevice } from "@project-chip/matter.js/device";
38
+ import { QrCode } from "@project-chip/matter.js/schema";
39
39
 
40
40
  const logger = Logger.get("MultiDevice");
41
41
 
@@ -44,28 +44,28 @@ requireMinNodeVersion(16);
44
44
  /** Configure logging */
45
45
  switch (getParameter("loglevel")) {
46
46
  case "fatal":
47
- Logger.defaultLogLevel = Level.FATAL;
47
+ Logger.defaultLogLevel = LogLevel.FATAL;
48
48
  break;
49
49
  case "error":
50
- Logger.defaultLogLevel = Level.ERROR;
50
+ Logger.defaultLogLevel = LogLevel.ERROR;
51
51
  break;
52
52
  case "warn":
53
- Logger.defaultLogLevel = Level.WARN;
53
+ Logger.defaultLogLevel = LogLevel.WARN;
54
54
  break;
55
55
  case "info":
56
- Logger.defaultLogLevel = Level.INFO;
56
+ Logger.defaultLogLevel = LogLevel.INFO;
57
57
  break;
58
58
  }
59
59
 
60
60
  switch (getParameter("logformat")) {
61
61
  case "plain":
62
- Logger.format = Format.PLAIN;
62
+ Logger.format = LogFormat.PLAIN;
63
63
  break;
64
64
  case "html":
65
- Logger.format = Format.HTML;
65
+ Logger.format = LogFormat.HTML;
66
66
  break;
67
67
  default:
68
- if (process.stdin?.isTTY) Logger.format = Format.ANSI;
68
+ if (process.stdin?.isTTY) Logger.format = LogFormat.ANSI;
69
69
  }
70
70
 
71
71
  const storageLocation = getParameter("store") ?? ".device-node";
@@ -15,9 +15,9 @@
15
15
  * Import needed modules from @project-chip/matter-node.js
16
16
  */
17
17
  // Include this first to auto-register Crypto, Network and Time Node.js implementations
18
- import "@project-chip/matter-node.js";
18
+ import { requireMinNodeVersion } from "@project-chip/matter.js-nodejs";
19
19
 
20
- import { requireMinNodeVersion } from "@project-chip/matter-node.js/util";
20
+ import { Time } from "@project-chip/matter.js-general";
21
21
  import { DeviceTypeId, VendorId } from "@project-chip/matter.js/datatype";
22
22
  import { logEndpoint } from "@project-chip/matter.js/device";
23
23
  import { HumiditySensorDevice } from "@project-chip/matter.js/devices/HumiditySensorDevice";
@@ -25,7 +25,6 @@ import { TemperatureSensorDevice } from "@project-chip/matter.js/devices/Tempera
25
25
  import { Endpoint, EndpointServer } from "@project-chip/matter.js/endpoint";
26
26
  import { Environment, StorageService } from "@project-chip/matter.js/environment";
27
27
  import { ServerNode } from "@project-chip/matter.js/node";
28
- import { Time } from "@project-chip/matter.js/time";
29
28
  import { execSync } from "child_process";
30
29
 
31
30
  requireMinNodeVersion(16);
@@ -4,13 +4,12 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
+ import { Bytes, Logger } from "@project-chip/matter.js-general";
7
8
  import { GeneralCommissioningBehavior } from "@project-chip/matter.js/behavior/definitions/general-commissioning";
8
9
  import { NetworkCommissioningBehavior } from "@project-chip/matter.js/behavior/definitions/network-commissioning";
9
10
  import { NetworkCommissioning } from "@project-chip/matter.js/cluster";
10
- import { Logger } from "@project-chip/matter.js/log";
11
- import { ByteArray } from "@project-chip/matter.js/util";
12
11
 
13
- const firstNetworkId = new ByteArray(32);
12
+ const firstNetworkId = new Uint8Array(32);
14
13
 
15
14
  /**
16
15
  * This represents a Dummy version of a Thread Network Commissioning Cluster Server without real thread related logic, beside
@@ -41,7 +40,7 @@ export class DummyThreadNetworkCommissioningServer extends NetworkCommissioningB
41
40
  networkName: this.endpoint.env.vars.string("ble.thread.networkName"),
42
41
  channel: this.endpoint.env.vars.number("ble.thread.channel"),
43
42
  version: 130,
44
- extendedAddress: ByteArray.fromString(
43
+ extendedAddress: Bytes.fromString(
45
44
  (this.endpoint.env.vars.string("ble.thread.address") ?? "000000000000").toLowerCase(),
46
45
  ),
47
46
  rssi: -50,
@@ -61,7 +60,7 @@ export class DummyThreadNetworkCommissioningServer extends NetworkCommissioningB
61
60
  breadcrumb,
62
61
  }: NetworkCommissioning.AddOrUpdateThreadNetworkRequest) {
63
62
  console.log(
64
- `---> addOrUpdateThreadNetwork called on NetworkCommissioning cluster: ${operationalDataset.toHex()} ${breadcrumb}`,
63
+ `---> addOrUpdateThreadNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(operationalDataset)} ${breadcrumb}`,
65
64
  );
66
65
 
67
66
  this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
@@ -83,7 +82,9 @@ export class DummyThreadNetworkCommissioningServer extends NetworkCommissioningB
83
82
  }
84
83
 
85
84
  override removeNetwork({ networkId, breadcrumb }: NetworkCommissioning.RemoveNetworkRequest) {
86
- console.log(`---> removeNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`);
85
+ console.log(
86
+ `---> removeNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`,
87
+ );
87
88
 
88
89
  this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
89
90
 
@@ -104,7 +105,9 @@ export class DummyThreadNetworkCommissioningServer extends NetworkCommissioningB
104
105
  }
105
106
 
106
107
  override async connectNetwork({ networkId, breadcrumb }: NetworkCommissioning.ConnectNetworkRequest) {
107
- console.log(`---> connectNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${breadcrumb}`);
108
+ console.log(
109
+ `---> connectNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`,
110
+ );
108
111
 
109
112
  this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
110
113
 
@@ -133,7 +136,7 @@ export class DummyThreadNetworkCommissioningServer extends NetworkCommissioningB
133
136
 
134
137
  override reorderNetwork({ networkId, networkIndex, breadcrumb }: NetworkCommissioning.ReorderNetworkRequest) {
135
138
  console.log(
136
- `---> reorderNetwork called on NetworkCommissioning cluster: ${networkId.toHex()} ${networkIndex} ${breadcrumb}`,
139
+ `---> reorderNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${networkIndex} ${breadcrumb}`,
137
140
  );
138
141
 
139
142
  // Simulate successful connection