@project-chip/matter.js 0.12.3 → 0.12.4-alpha.0-20250210-ad8edf096
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/CommissioningController.d.ts +52 -30
- package/dist/cjs/CommissioningController.d.ts.map +1 -1
- package/dist/cjs/CommissioningController.js +154 -109
- package/dist/cjs/CommissioningController.js.map +1 -1
- package/dist/cjs/device/PairedNode.d.ts +22 -9
- package/dist/cjs/device/PairedNode.d.ts.map +1 -1
- package/dist/cjs/device/PairedNode.js +43 -31
- package/dist/cjs/device/PairedNode.js.map +1 -1
- package/dist/esm/CommissioningController.d.ts +52 -30
- package/dist/esm/CommissioningController.d.ts.map +1 -1
- package/dist/esm/CommissioningController.js +154 -109
- package/dist/esm/CommissioningController.js.map +1 -1
- package/dist/esm/device/PairedNode.d.ts +22 -9
- package/dist/esm/device/PairedNode.d.ts.map +1 -1
- package/dist/esm/device/PairedNode.js +43 -31
- package/dist/esm/device/PairedNode.js.map +1 -1
- package/package.json +8 -8
- package/src/CommissioningController.ts +155 -108
- package/src/device/PairedNode.ts +48 -35
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { Environment, NetInterfaceSet, StorageContext, SyncStorage } from "#general";
|
|
7
|
-
import { CommissionableDevice, CommissionableDeviceIdentifiers,
|
|
7
|
+
import { CommissionableDevice, CommissionableDeviceIdentifiers, DiscoveryAndCommissioningOptions, DiscoveryData, InteractionClient, MdnsBroadcaster, MdnsScanner, NodeDiscoveryType, ScannerSet } from "#protocol";
|
|
8
8
|
import { CaseAuthenticatedTag, DiscoveryCapabilitiesBitmap, FabricId, FabricIndex, NodeId, TypeFromPartialBitSchema, VendorId } from "#types";
|
|
9
9
|
import { CommissioningControllerNodeOptions, PairedNode } from "./device/PairedNode.js";
|
|
10
|
-
import { MatterController } from "./MatterController.js";
|
|
11
10
|
import { MatterNode } from "./MatterNode.js";
|
|
12
11
|
export type ControllerEnvironmentOptions = {
|
|
13
12
|
/**
|
|
@@ -75,19 +74,7 @@ export type NodeCommissioningOptions = CommissioningControllerNodeOptions & {
|
|
|
75
74
|
};
|
|
76
75
|
/** Controller class to commission and connect multiple nodes into one fabric. */
|
|
77
76
|
export declare class CommissioningController extends MatterNode {
|
|
78
|
-
private
|
|
79
|
-
private started;
|
|
80
|
-
private ipv4Disabled?;
|
|
81
|
-
private readonly listeningAddressIpv4?;
|
|
82
|
-
private readonly listeningAddressIpv6?;
|
|
83
|
-
private environment?;
|
|
84
|
-
private storage?;
|
|
85
|
-
private mdnsScanner?;
|
|
86
|
-
private mdnsBroadcaster?;
|
|
87
|
-
private controllerInstance?;
|
|
88
|
-
private initializedNodes;
|
|
89
|
-
private nodeUpdateLabelHandlers;
|
|
90
|
-
private sessionDisconnectedHandler;
|
|
77
|
+
#private;
|
|
91
78
|
/**
|
|
92
79
|
* Creates a new CommissioningController instance
|
|
93
80
|
*
|
|
@@ -95,21 +82,14 @@ export declare class CommissioningController extends MatterNode {
|
|
|
95
82
|
*/
|
|
96
83
|
constructor(options: CommissioningControllerOptions);
|
|
97
84
|
get nodeId(): NodeId | undefined;
|
|
85
|
+
/** Returns the configuration data needed to create a PASE commissioner, e.g. in a mobile app. */
|
|
98
86
|
get paseCommissionerConfig(): {
|
|
99
87
|
caConfig: import("#protocol").CertificateAuthority.Configuration;
|
|
100
88
|
fabricData: import("#protocol").Fabric.Config;
|
|
101
89
|
};
|
|
102
|
-
assertIsAddedToMatterServer(): {
|
|
103
|
-
mdnsScanner: MdnsScanner;
|
|
104
|
-
storage: StorageContext<any> | undefined;
|
|
105
|
-
environment: Environment | undefined;
|
|
106
|
-
};
|
|
107
|
-
assertControllerIsStarted(errorText?: string): MatterController;
|
|
108
|
-
/** Internal method to initialize a MatterController instance. */
|
|
109
|
-
private initializeController;
|
|
110
90
|
/**
|
|
111
91
|
* Commissions/Pairs a new device into the controller fabric. The method returns the NodeId of the commissioned
|
|
112
|
-
* node.
|
|
92
|
+
* node on success.
|
|
113
93
|
*/
|
|
114
94
|
commissionNode(nodeOptions: NodeCommissioningOptions, connectNodeAfterCommissioning?: boolean): Promise<NodeId>;
|
|
115
95
|
/**
|
|
@@ -124,40 +104,53 @@ export declare class CommissioningController extends MatterNode {
|
|
|
124
104
|
* Remove a Node id from the controller. This method should only be used if the decommission method on the
|
|
125
105
|
* PairedNode instance returns an error. By default, it tries to decommission the node from the controller but will
|
|
126
106
|
* remove it also in case of an error during decommissioning. Ideally try to decommission the node before and only
|
|
127
|
-
* use this in case of an error.
|
|
107
|
+
* use this in case of an error as last option.
|
|
108
|
+
* If this method is used the state of the PairedNode instance might be out of sync, so the PairedNode instance
|
|
109
|
+
* should be disconnected first.
|
|
128
110
|
*/
|
|
129
111
|
removeNode(nodeId: NodeId, tryDecommissioning?: boolean): Promise<void>;
|
|
112
|
+
/** @deprecated Use PairedNode.disconnect() instead */
|
|
130
113
|
disconnectNode(nodeId: NodeId): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Returns the PairedNode instance for a given NodeId. The instance is initialized without auto connect if not yet
|
|
116
|
+
* created.
|
|
117
|
+
*/
|
|
131
118
|
getNode(nodeId: NodeId): Promise<PairedNode>;
|
|
132
119
|
/**
|
|
133
120
|
* Connect to an already paired Node.
|
|
134
121
|
* After connection the endpoint data of the device is analyzed and an object structure is created.
|
|
135
122
|
* This call is not blocking and returns an initialized PairedNode instance. The connection or reconnection
|
|
136
123
|
* happens in the background. Please monitor the state of the node to see if the connection was successful.
|
|
124
|
+
*
|
|
125
|
+
* @deprecated Use getNode() instead and call PairedNode.connect() or PairedNode.disconnect() as needed.
|
|
137
126
|
*/
|
|
138
127
|
connectNode(nodeId: NodeId, connectOptions?: CommissioningControllerNodeOptions): Promise<PairedNode>;
|
|
139
|
-
collectStoredAttributeData(nodeId: NodeId): Promise<DecodedAttributeReportValue<any>[]>;
|
|
140
128
|
/**
|
|
141
129
|
* Connects to all paired nodes.
|
|
142
130
|
* After connection the endpoint data of the device is analyzed and an object structure is created.
|
|
131
|
+
*
|
|
132
|
+
* @deprecated Use getCommissionedNodes() to get the list of nodes and getNode(nodeId) instead and call PairedNode.connect() or PairedNode.disconnect() as needed.
|
|
143
133
|
*/
|
|
144
134
|
connect(connectOptions?: CommissioningControllerNodeOptions): Promise<PairedNode[]>;
|
|
145
135
|
/**
|
|
146
136
|
* Set the MDNS Scanner instance. Should be only used internally
|
|
147
137
|
*
|
|
148
138
|
* @param mdnsScanner MdnsScanner instance
|
|
139
|
+
* @private
|
|
149
140
|
*/
|
|
150
141
|
setMdnsScanner(mdnsScanner: MdnsScanner): void;
|
|
151
142
|
/**
|
|
152
143
|
* Set the MDNS Broadcaster instance. Should be only used internally
|
|
153
144
|
*
|
|
154
145
|
* @param mdnsBroadcaster MdnsBroadcaster instance
|
|
146
|
+
* @private
|
|
155
147
|
*/
|
|
156
148
|
setMdnsBroadcaster(mdnsBroadcaster: MdnsBroadcaster): void;
|
|
157
149
|
/**
|
|
158
150
|
* Set the Storage instance. Should be only used internally
|
|
159
151
|
*
|
|
160
152
|
* @param storage storage context to use
|
|
153
|
+
* @private
|
|
161
154
|
*/
|
|
162
155
|
setStorage(storage: StorageContext<SyncStorage>): void;
|
|
163
156
|
/** Returns true if t least one node is commissioned/paired with this controller instance. */
|
|
@@ -167,10 +160,14 @@ export declare class CommissioningController extends MatterNode {
|
|
|
167
160
|
* not be used directly. See the PairedNode class for the public API.
|
|
168
161
|
*/
|
|
169
162
|
createInteractionClient(nodeId: NodeId, discoveryType?: NodeDiscoveryType, forcedConnection?: boolean): Promise<InteractionClient>;
|
|
170
|
-
/**
|
|
163
|
+
/**
|
|
164
|
+
* Returns the PairedNode instance for a given node id, if this node is connected.
|
|
165
|
+
* @deprecated Use getNode() instead
|
|
166
|
+
*/
|
|
171
167
|
getPairedNode(nodeId: NodeId): PairedNode | undefined;
|
|
172
|
-
/** Returns an array with the
|
|
168
|
+
/** Returns an array with the NodeIds of all commissioned nodes. */
|
|
173
169
|
getCommissionedNodes(): NodeId[];
|
|
170
|
+
/** Returns an arra with all commissioned NodeIds and their metadata. */
|
|
174
171
|
getCommissionedNodesDetails(): {
|
|
175
172
|
nodeId: NodeId;
|
|
176
173
|
operationalAddress: string | undefined;
|
|
@@ -178,15 +175,35 @@ export declare class CommissioningController extends MatterNode {
|
|
|
178
175
|
discoveryData: DiscoveryData | undefined;
|
|
179
176
|
deviceData: import("./device/DeviceInformation.js").DeviceInformationData | undefined;
|
|
180
177
|
}[];
|
|
181
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Disconnects all connected nodes and closes the network connections and other resources of the controller.
|
|
180
|
+
* You can use "start()" to restart the controller after closing it.
|
|
181
|
+
*/
|
|
182
182
|
close(): Promise<void>;
|
|
183
|
+
/** Return the port used by the controller for the UDP interface. */
|
|
183
184
|
getPort(): number | undefined;
|
|
185
|
+
/** @private */
|
|
184
186
|
initialize(ipv4Disabled: boolean): void;
|
|
187
|
+
/** @private */
|
|
185
188
|
initializeControllerStore(): Promise<void>;
|
|
186
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* Initialize the controller and initialize and connect to all commissioned nodes if autoConnect is not set to false.
|
|
191
|
+
*/
|
|
187
192
|
start(): Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* Cancels the discovery process for commissionable devices started with discoverCommissionableDevices().
|
|
195
|
+
*/
|
|
188
196
|
cancelCommissionableDeviceDiscovery(identifierData: CommissionableDeviceIdentifiers, discoveryCapabilities?: TypeFromPartialBitSchema<typeof DiscoveryCapabilitiesBitmap>): void;
|
|
197
|
+
/**
|
|
198
|
+
* Starts to discover commissionable devices.
|
|
199
|
+
* The promise will be fulfilled after the provided timeout or when the discovery is stopped via
|
|
200
|
+
* cancelCommissionableDeviceDiscovery(). The discoveredCallback will be called for each discovered device.
|
|
201
|
+
*/
|
|
189
202
|
discoverCommissionableDevices(identifierData: CommissionableDeviceIdentifiers, discoveryCapabilities?: TypeFromPartialBitSchema<typeof DiscoveryCapabilitiesBitmap>, discoveredCallback?: (device: CommissionableDevice) => void, timeoutSeconds?: number): Promise<CommissionableDevice[]>;
|
|
203
|
+
/**
|
|
204
|
+
* Use this method to reset the Controller storage. The method can only be called if the controller is stopped and
|
|
205
|
+
* will remove all commissioning data and paired nodes from the controller.
|
|
206
|
+
*/
|
|
190
207
|
resetStorage(): Promise<void>;
|
|
191
208
|
/** Returns active session information for all connected nodes. */
|
|
192
209
|
getActiveSessionInformation(): {
|
|
@@ -200,7 +217,12 @@ export declare class CommissioningController extends MatterNode {
|
|
|
200
217
|
lastActiveTimestamp: number | undefined;
|
|
201
218
|
numberOfActiveSubscriptions: number;
|
|
202
219
|
}[];
|
|
220
|
+
/** @private */
|
|
203
221
|
validateAndUpdateFabricLabel(nodeId: NodeId): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Updates the fabric label for the controller and all connected nodes.
|
|
224
|
+
* The label is used to identify the controller and all connected nodes in the fabric.
|
|
225
|
+
*/
|
|
204
226
|
updateFabricLabel(label: string): Promise<void>;
|
|
205
227
|
}
|
|
206
228
|
export declare function configureNetwork(options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommissioningController.d.ts","sourceRoot":"","sources":["../../src/CommissioningController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACH,WAAW,EAIX,eAAe,EAGf,cAAc,EACd,WAAW,EAGd,MAAM,UAAU,CAAC;AAGlB,OAAO,EAEH,oBAAoB,EACpB,+BAA+B,
|
|
1
|
+
{"version":3,"file":"CommissioningController.d.ts","sourceRoot":"","sources":["../../src/CommissioningController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACH,WAAW,EAIX,eAAe,EAGf,cAAc,EACd,WAAW,EAGd,MAAM,UAAU,CAAC;AAGlB,OAAO,EAEH,oBAAoB,EACpB,+BAA+B,EAG/B,gCAAgC,EAChC,aAAa,EACb,iBAAiB,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