@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.
- package/dist/esm/examples/BridgedDevicesNode.js +2 -3
- package/dist/esm/examples/BridgedDevicesNode.js.map +2 -2
- package/dist/esm/examples/BridgedDevicesNodeLegacy.js +14 -15
- package/dist/esm/examples/BridgedDevicesNodeLegacy.js.map +2 -2
- package/dist/esm/examples/ComposedDeviceNode.js +2 -3
- package/dist/esm/examples/ComposedDeviceNode.js.map +2 -2
- package/dist/esm/examples/ComposedDeviceNodeLegacy.js +15 -16
- package/dist/esm/examples/ComposedDeviceNodeLegacy.js.map +2 -2
- package/dist/esm/examples/ControllerNode.js +2 -5
- package/dist/esm/examples/ControllerNode.js.map +2 -2
- package/dist/esm/examples/ControllerNodeLegacy.js +21 -22
- package/dist/esm/examples/ControllerNodeLegacy.js.map +2 -2
- package/dist/esm/examples/DeviceNode.js +2 -3
- package/dist/esm/examples/DeviceNode.js.map +2 -2
- package/dist/esm/examples/DeviceNodeFull.js +4 -8
- package/dist/esm/examples/DeviceNodeFull.js.map +2 -2
- package/dist/esm/examples/DeviceNodeFullLegacy.js +16 -18
- package/dist/esm/examples/DeviceNodeFullLegacy.js.map +2 -2
- package/dist/esm/examples/IlluminatedRollerShade.js +1 -1
- package/dist/esm/examples/IlluminatedRollerShade.js.map +1 -1
- package/dist/esm/examples/LegacyStorageConverter.js +2 -3
- package/dist/esm/examples/LegacyStorageConverter.js.map +2 -2
- package/dist/esm/examples/LightDevice.js +1 -1
- package/dist/esm/examples/LightDevice.js.map +1 -1
- package/dist/esm/examples/MultiDeviceNode.js +2 -3
- package/dist/esm/examples/MultiDeviceNode.js.map +2 -2
- package/dist/esm/examples/MultiDeviceNodeLegacy.js +13 -14
- package/dist/esm/examples/MultiDeviceNodeLegacy.js.map +2 -2
- package/dist/esm/examples/SensorDeviceNode.js +2 -3
- package/dist/esm/examples/SensorDeviceNode.js.map +2 -2
- package/dist/esm/examples/cluster/DummyThreadNetworkCommissioningServer.js +11 -8
- package/dist/esm/examples/cluster/DummyThreadNetworkCommissioningServer.js.map +2 -2
- package/dist/esm/examples/cluster/DummyWifiNetworkCommissioningServer.js +15 -11
- package/dist/esm/examples/cluster/DummyWifiNetworkCommissioningServer.js.map +2 -2
- package/dist/esm/examples/cluster/DummyWifiNetworkCommissioningServerLegacy.js +12 -10
- package/dist/esm/examples/cluster/DummyWifiNetworkCommissioningServerLegacy.js.map +2 -2
- package/dist/esm/examples/cluster/MyFancyOwnFunctionality.js +8 -8
- package/dist/esm/examples/cluster/MyFancyOwnFunctionality.js.map +2 -2
- package/dist/esm/tutorial/example01.js +1 -1
- package/dist/esm/tutorial/example01.js.map +1 -1
- package/dist/esm/tutorial/example02.js +1 -1
- package/dist/esm/tutorial/example02.js.map +1 -1
- package/dist/esm/tutorial/example03.js +1 -1
- package/dist/esm/tutorial/example03.js.map +1 -1
- package/dist/esm/tutorial/example04.js +1 -1
- package/dist/esm/tutorial/example04.js.map +1 -1
- package/dist/esm/tutorial/example05.js +1 -1
- package/dist/esm/tutorial/example05.js.map +1 -1
- package/package.json +6 -5
- package/src/examples/BridgedDevicesNode.ts +2 -3
- package/src/examples/BridgedDevicesNodeLegacy.ts +15 -16
- package/src/examples/ComposedDeviceNode.ts +2 -3
- package/src/examples/ComposedDeviceNodeLegacy.ts +15 -16
- package/src/examples/ControllerNode.ts +2 -6
- package/src/examples/ControllerNodeLegacy.ts +22 -23
- package/src/examples/DeviceNode.ts +2 -3
- package/src/examples/DeviceNodeFull.ts +5 -10
- package/src/examples/DeviceNodeFullLegacy.ts +16 -18
- package/src/examples/IlluminatedRollerShade.ts +1 -1
- package/src/examples/LegacyStorageConverter.ts +3 -3
- package/src/examples/LightDevice.ts +1 -1
- package/src/examples/MultiDeviceNode.ts +2 -3
- package/src/examples/MultiDeviceNodeLegacy.ts +15 -15
- package/src/examples/SensorDeviceNode.ts +2 -3
- package/src/examples/cluster/DummyThreadNetworkCommissioningServer.ts +11 -8
- package/src/examples/cluster/DummyWifiNetworkCommissioningServer.ts +15 -11
- package/src/examples/cluster/DummyWifiNetworkCommissioningServerLegacy.ts +12 -10
- package/src/examples/cluster/MyFancyOwnFunctionality.ts +9 -9
- package/src/tsconfig.json +1 -1
- package/src/tutorial/example01.ts +1 -1
- package/src/tutorial/example02.ts +1 -1
- package/src/tutorial/example03.ts +1 -1
- package/src/tutorial/example04.ts +1 -1
- package/src/tutorial/example05.ts +1 -1
@@ -4,12 +4,12 @@
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
5
5
|
*/
|
6
6
|
|
7
|
+
import { Bytes } 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 { ByteArray } from "@project-chip/matter.js/util";
|
11
11
|
|
12
|
-
const firstNetworkId = new
|
12
|
+
const firstNetworkId = new Uint8Array(32);
|
13
13
|
|
14
14
|
/**
|
15
15
|
* This represents a Dummy version of a Wifi Network Commissioning Cluster Server without real Wifi related logic, beside
|
@@ -20,7 +20,9 @@ export class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBeh
|
|
20
20
|
NetworkCommissioning.Feature.WiFiNetworkInterface,
|
21
21
|
) {
|
22
22
|
override scanNetworks({ ssid, breadcrumb }: NetworkCommissioning.ScanNetworksRequest) {
|
23
|
-
console.log(
|
23
|
+
console.log(
|
24
|
+
`---> scanNetworks called on NetworkCommissioning cluster: ${ssid ? Bytes.toHex(ssid) : undefined} ${breadcrumb}`,
|
25
|
+
);
|
24
26
|
|
25
27
|
// Simulate successful scan
|
26
28
|
if (breadcrumb !== undefined) {
|
@@ -42,10 +44,8 @@ export class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBeh
|
|
42
44
|
wpa2Personal: true,
|
43
45
|
wpa3Personal: true,
|
44
46
|
},
|
45
|
-
ssid: ssid ||
|
46
|
-
bssid:
|
47
|
-
this.endpoint.env.vars.get("ble.wifi.scanBssid") ?? "00:00:00:00:00:00",
|
48
|
-
),
|
47
|
+
ssid: ssid || Bytes.fromString(this.endpoint.env.vars.get("ble.wifi.scanSsid") ?? "TestSSID"), // Set a valid existing local Wi-Fi SSID here
|
48
|
+
bssid: Bytes.fromString(this.endpoint.env.vars.get("ble.wifi.scanBssid") ?? "00:00:00:00:00:00"),
|
49
49
|
channel: 1,
|
50
50
|
},
|
51
51
|
],
|
@@ -58,7 +58,7 @@ export class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBeh
|
|
58
58
|
breadcrumb,
|
59
59
|
}: NetworkCommissioning.AddOrUpdateWiFiNetworkRequest) {
|
60
60
|
console.log(
|
61
|
-
`---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${
|
61
|
+
`---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(ssid)} ${Bytes.toHex(credentials)} ${breadcrumb}`,
|
62
62
|
);
|
63
63
|
|
64
64
|
this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
|
@@ -80,7 +80,9 @@ export class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBeh
|
|
80
80
|
}
|
81
81
|
|
82
82
|
override removeNetwork({ networkId, breadcrumb }: NetworkCommissioning.RemoveNetworkRequest) {
|
83
|
-
console.log(
|
83
|
+
console.log(
|
84
|
+
`---> removeNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`,
|
85
|
+
);
|
84
86
|
|
85
87
|
this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
|
86
88
|
|
@@ -101,7 +103,9 @@ export class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBeh
|
|
101
103
|
}
|
102
104
|
|
103
105
|
override async connectNetwork({ networkId, breadcrumb }: NetworkCommissioning.ConnectNetworkRequest) {
|
104
|
-
console.log(
|
106
|
+
console.log(
|
107
|
+
`---> connectNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`,
|
108
|
+
);
|
105
109
|
|
106
110
|
this.session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
|
107
111
|
|
@@ -130,7 +134,7 @@ export class DummyWifiNetworkCommissioningServer extends NetworkCommissioningBeh
|
|
130
134
|
|
131
135
|
override reorderNetwork({ networkId, networkIndex, breadcrumb }: NetworkCommissioning.ReorderNetworkRequest) {
|
132
136
|
console.log(
|
133
|
-
`---> reorderNetwork called on NetworkCommissioning cluster: ${
|
137
|
+
`---> reorderNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${networkIndex} ${breadcrumb}`,
|
134
138
|
);
|
135
139
|
|
136
140
|
// Simulate successful connection
|
@@ -4,16 +4,16 @@
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
5
5
|
*/
|
6
6
|
|
7
|
-
import { getParameter } from "@project-chip/matter
|
7
|
+
import { getParameter } from "@project-chip/matter.js-nodejs";
|
8
8
|
import {
|
9
9
|
ClusterServer,
|
10
10
|
ClusterServerObj,
|
11
11
|
GeneralCommissioningCluster,
|
12
12
|
NetworkCommissioning,
|
13
13
|
} from "@project-chip/matter.js/cluster";
|
14
|
-
import {
|
14
|
+
import { Bytes } from "../../../../general/dist/cjs/index.js";
|
15
15
|
|
16
|
-
const firstNetworkId = new
|
16
|
+
const firstNetworkId = new Uint8Array(32);
|
17
17
|
|
18
18
|
const WifiNetworkCluster = NetworkCommissioning.Cluster.with(NetworkCommissioning.Feature.WiFiNetworkInterface);
|
19
19
|
|
@@ -37,7 +37,9 @@ const Server: ClusterServerObj<typeof WifiNetworkCluster> = ClusterServer(
|
|
37
37
|
},
|
38
38
|
{
|
39
39
|
scanNetworks: async ({ request: { ssid, breadcrumb }, attributes: { lastNetworkingStatus }, endpoint }) => {
|
40
|
-
console.log(
|
40
|
+
console.log(
|
41
|
+
`---> scanNetworks called on NetworkCommissioning cluster: ${ssid ? Bytes.toHex(ssid) : undefined} ${breadcrumb}`,
|
42
|
+
);
|
41
43
|
|
42
44
|
// Simulate successful scan
|
43
45
|
if (breadcrumb !== undefined) {
|
@@ -59,8 +61,8 @@ const Server: ClusterServerObj<typeof WifiNetworkCluster> = ClusterServer(
|
|
59
61
|
wpa2Personal: true,
|
60
62
|
wpa3Personal: true,
|
61
63
|
},
|
62
|
-
ssid: ssid ||
|
63
|
-
bssid:
|
64
|
+
ssid: ssid || Bytes.fromString(getParameter("ble-wifi-scan-ssid") ?? "TestSSID"), // Set a valid existing local Wi-Fi SSID here
|
65
|
+
bssid: Bytes.fromString(getParameter("ble-wifi-scan-bssid") ?? "00:00:00:00:00:00"),
|
64
66
|
channel: 1,
|
65
67
|
},
|
66
68
|
],
|
@@ -73,7 +75,7 @@ const Server: ClusterServerObj<typeof WifiNetworkCluster> = ClusterServer(
|
|
73
75
|
session,
|
74
76
|
}) => {
|
75
77
|
console.log(
|
76
|
-
`---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${
|
78
|
+
`---> addOrUpdateWiFiNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(ssid)} ${Bytes.toHex(credentials)} ${breadcrumb}`,
|
77
79
|
);
|
78
80
|
|
79
81
|
session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
|
@@ -100,7 +102,7 @@ const Server: ClusterServerObj<typeof WifiNetworkCluster> = ClusterServer(
|
|
100
102
|
session,
|
101
103
|
}) => {
|
102
104
|
console.log(
|
103
|
-
`---> removeNetwork called on NetworkCommissioning cluster: ${
|
105
|
+
`---> removeNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`,
|
104
106
|
);
|
105
107
|
|
106
108
|
session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
|
@@ -127,7 +129,7 @@ const Server: ClusterServerObj<typeof WifiNetworkCluster> = ClusterServer(
|
|
127
129
|
session,
|
128
130
|
}) => {
|
129
131
|
console.log(
|
130
|
-
`---> connectNetwork called on NetworkCommissioning cluster: ${
|
132
|
+
`---> connectNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${breadcrumb}`,
|
131
133
|
);
|
132
134
|
|
133
135
|
session.context.assertFailSafeArmed("Failsafe timer needs to be armed to add or update networks.");
|
@@ -162,7 +164,7 @@ const Server: ClusterServerObj<typeof WifiNetworkCluster> = ClusterServer(
|
|
162
164
|
endpoint,
|
163
165
|
}) => {
|
164
166
|
console.log(
|
165
|
-
`---> reorderNetwork called on NetworkCommissioning cluster: ${
|
167
|
+
`---> reorderNetwork called on NetworkCommissioning cluster: ${Bytes.toHex(networkId)} ${networkIndex} ${breadcrumb}`,
|
166
168
|
);
|
167
169
|
|
168
170
|
// Simulate successful connection
|
@@ -4,6 +4,15 @@
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
5
5
|
*/
|
6
6
|
|
7
|
+
import { Identity, MaybePromise } from "@project-chip/matter.js-general";
|
8
|
+
import {
|
9
|
+
AttributeElement,
|
10
|
+
ClusterElement,
|
11
|
+
ClusterModel,
|
12
|
+
CommandElement,
|
13
|
+
EventElement,
|
14
|
+
FieldElement,
|
15
|
+
} from "@project-chip/matter.js-model";
|
7
16
|
import { ClusterBehavior } from "@project-chip/matter.js/behavior/cluster";
|
8
17
|
import {
|
9
18
|
Attribute,
|
@@ -14,16 +23,7 @@ import {
|
|
14
23
|
MutableCluster,
|
15
24
|
} from "@project-chip/matter.js/cluster";
|
16
25
|
import { ClusterId, VendorId } from "@project-chip/matter.js/datatype";
|
17
|
-
import {
|
18
|
-
AttributeElement,
|
19
|
-
ClusterElement,
|
20
|
-
ClusterModel,
|
21
|
-
CommandElement,
|
22
|
-
EventElement,
|
23
|
-
FieldElement,
|
24
|
-
} from "@project-chip/matter.js/model";
|
25
26
|
import { TlvField, TlvInt16, TlvNullable, TlvObject, TlvString, TypeFromSchema } from "@project-chip/matter.js/tlv";
|
26
|
-
import { Identity, MaybePromise } from "@project-chip/matter.js/util";
|
27
27
|
|
28
28
|
/** Define the Cluster ID, custom clusters use a special extended formt that also contains the Vendor Id */
|
29
29
|
const myFancyClusterId = ClusterId.buildVendorSpecific(VendorId(0xfff4), 0xfc00);
|
package/src/tsconfig.json
CHANGED