@matter/node 0.17.0-alpha.0-20260518-7f13c7285 → 0.17.0
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/behavior/state/managed/values/ListManager.js +2 -2
- package/dist/cjs/behavior/state/managed/values/ListManager.js.map +1 -1
- package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.js +1 -1
- package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.js.map +1 -1
- package/dist/cjs/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/access-control/AccessControlServer.js +17 -20
- package/dist/cjs/behaviors/access-control/AccessControlServer.js.map +1 -1
- package/dist/cjs/behaviors/color-control/ColorControlServer.js +3 -3
- package/dist/cjs/behaviors/color-control/ColorControlServer.js.map +1 -1
- package/dist/cjs/behaviors/descriptor/DescriptorServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/descriptor/DescriptorServer.js +10 -0
- package/dist/cjs/behaviors/descriptor/DescriptorServer.js.map +1 -1
- package/dist/cjs/behaviors/door-lock/DoorLockServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/door-lock/DoorLockServer.js +55 -58
- package/dist/cjs/behaviors/door-lock/DoorLockServer.js.map +1 -1
- package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +5 -5
- package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
- package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.js +20 -20
- package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.js.map +1 -1
- package/dist/cjs/behaviors/groups/GroupsServer.js +11 -11
- package/dist/cjs/behaviors/groups/GroupsServer.js.map +1 -1
- package/dist/cjs/behaviors/level-control/LevelControlServer.js +2 -2
- package/dist/cjs/behaviors/level-control/LevelControlServer.js.map +1 -1
- package/dist/cjs/behaviors/mode-select/ModeSelectServer.js +1 -1
- package/dist/cjs/behaviors/mode-select/ModeSelectServer.js.map +1 -1
- package/dist/cjs/behaviors/operational-credentials/OperationalCredentialsServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/operational-credentials/OperationalCredentialsServer.js +13 -16
- package/dist/cjs/behaviors/operational-credentials/OperationalCredentialsServer.js.map +1 -1
- package/dist/cjs/behaviors/switch/SwitchServer.js +1 -1
- package/dist/cjs/behaviors/switch/SwitchServer.js.map +1 -1
- package/dist/cjs/behaviors/window-covering/WindowCoveringServer.js +5 -5
- package/dist/cjs/behaviors/window-covering/WindowCoveringServer.js.map +1 -1
- package/dist/cjs/devices/closure-panel.d.ts +0 -18
- package/dist/cjs/devices/closure-panel.d.ts.map +1 -1
- package/dist/cjs/devices/closure-panel.js +1 -8
- package/dist/cjs/devices/closure-panel.js.map +2 -2
- package/dist/cjs/devices/closure.d.ts +0 -18
- package/dist/cjs/devices/closure.d.ts.map +1 -1
- package/dist/cjs/devices/closure.js +1 -8
- package/dist/cjs/devices/closure.js.map +2 -2
- package/dist/cjs/devices/door-lock.d.ts +0 -18
- package/dist/cjs/devices/door-lock.d.ts.map +1 -1
- package/dist/cjs/devices/door-lock.js +1 -8
- package/dist/cjs/devices/door-lock.js.map +2 -2
- package/dist/cjs/devices/window-covering.d.ts +0 -16
- package/dist/cjs/devices/window-covering.d.ts.map +1 -1
- package/dist/cjs/devices/window-covering.js +1 -9
- package/dist/cjs/devices/window-covering.js.map +2 -2
- package/dist/cjs/endpoint/type/MutableEndpoint.d.ts.map +1 -1
- package/dist/cjs/endpoint/type/MutableEndpoint.js +1 -7
- package/dist/cjs/endpoint/type/MutableEndpoint.js.map +1 -1
- package/dist/cjs/node/server/InteractionServer.d.ts.map +1 -1
- package/dist/cjs/node/server/InteractionServer.js +21 -24
- package/dist/cjs/node/server/InteractionServer.js.map +1 -1
- package/dist/cjs/node/server/ServerSubscription.js +2 -2
- package/dist/cjs/node/server/ServerSubscription.js.map +1 -1
- package/dist/esm/behavior/state/managed/values/ListManager.js +3 -3
- package/dist/esm/behavior/state/managed/values/ListManager.js.map +1 -1
- package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.js +2 -2
- package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.js.map +1 -1
- package/dist/esm/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
- package/dist/esm/behaviors/access-control/AccessControlServer.js +18 -21
- package/dist/esm/behaviors/access-control/AccessControlServer.js.map +1 -1
- package/dist/esm/behaviors/color-control/ColorControlServer.js +4 -4
- package/dist/esm/behaviors/color-control/ColorControlServer.js.map +1 -1
- package/dist/esm/behaviors/descriptor/DescriptorServer.d.ts.map +1 -1
- package/dist/esm/behaviors/descriptor/DescriptorServer.js +11 -1
- package/dist/esm/behaviors/descriptor/DescriptorServer.js.map +1 -1
- package/dist/esm/behaviors/door-lock/DoorLockServer.d.ts.map +1 -1
- package/dist/esm/behaviors/door-lock/DoorLockServer.js +56 -59
- package/dist/esm/behaviors/door-lock/DoorLockServer.js.map +1 -1
- package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +6 -6
- package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
- package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.d.ts.map +1 -1
- package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.js +21 -21
- package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.js.map +1 -1
- package/dist/esm/behaviors/groups/GroupsServer.js +12 -12
- package/dist/esm/behaviors/groups/GroupsServer.js.map +1 -1
- package/dist/esm/behaviors/level-control/LevelControlServer.js +3 -3
- package/dist/esm/behaviors/level-control/LevelControlServer.js.map +1 -1
- package/dist/esm/behaviors/mode-select/ModeSelectServer.js +2 -2
- package/dist/esm/behaviors/mode-select/ModeSelectServer.js.map +1 -1
- package/dist/esm/behaviors/operational-credentials/OperationalCredentialsServer.d.ts.map +1 -1
- package/dist/esm/behaviors/operational-credentials/OperationalCredentialsServer.js +14 -17
- package/dist/esm/behaviors/operational-credentials/OperationalCredentialsServer.js.map +1 -1
- package/dist/esm/behaviors/switch/SwitchServer.js +2 -2
- package/dist/esm/behaviors/switch/SwitchServer.js.map +1 -1
- package/dist/esm/behaviors/window-covering/WindowCoveringServer.js +6 -6
- package/dist/esm/behaviors/window-covering/WindowCoveringServer.js.map +1 -1
- package/dist/esm/devices/closure-panel.d.ts +0 -18
- package/dist/esm/devices/closure-panel.d.ts.map +1 -1
- package/dist/esm/devices/closure-panel.js +1 -8
- package/dist/esm/devices/closure-panel.js.map +1 -1
- package/dist/esm/devices/closure.d.ts +0 -18
- package/dist/esm/devices/closure.d.ts.map +1 -1
- package/dist/esm/devices/closure.js +1 -10
- package/dist/esm/devices/closure.js.map +1 -1
- package/dist/esm/devices/door-lock.d.ts +0 -18
- package/dist/esm/devices/door-lock.d.ts.map +1 -1
- package/dist/esm/devices/door-lock.js +1 -10
- package/dist/esm/devices/door-lock.js.map +1 -1
- package/dist/esm/devices/window-covering.d.ts +0 -16
- package/dist/esm/devices/window-covering.d.ts.map +1 -1
- package/dist/esm/devices/window-covering.js +1 -11
- package/dist/esm/devices/window-covering.js.map +1 -1
- package/dist/esm/endpoint/type/MutableEndpoint.d.ts.map +1 -1
- package/dist/esm/endpoint/type/MutableEndpoint.js +1 -7
- package/dist/esm/endpoint/type/MutableEndpoint.js.map +1 -1
- package/dist/esm/node/server/InteractionServer.d.ts.map +1 -1
- package/dist/esm/node/server/InteractionServer.js +21 -25
- package/dist/esm/node/server/InteractionServer.js.map +1 -1
- package/dist/esm/node/server/ServerSubscription.js +3 -3
- package/dist/esm/node/server/ServerSubscription.js.map +1 -1
- package/package.json +6 -6
- package/src/behavior/state/managed/values/ListManager.ts +3 -3
- package/src/behavior/system/subscriptions/SubscriptionsServer.ts +2 -2
- package/src/behaviors/access-control/AccessControlServer.ts +18 -21
- package/src/behaviors/color-control/ColorControlServer.ts +4 -4
- package/src/behaviors/descriptor/DescriptorServer.ts +13 -1
- package/src/behaviors/door-lock/DoorLockServer.ts +56 -59
- package/src/behaviors/general-diagnostics/GeneralDiagnosticsServer.ts +6 -6
- package/src/behaviors/group-key-management/GroupKeyManagementServer.ts +22 -22
- package/src/behaviors/groups/GroupsServer.ts +12 -12
- package/src/behaviors/level-control/LevelControlServer.ts +3 -3
- package/src/behaviors/mode-select/ModeSelectServer.ts +2 -2
- package/src/behaviors/operational-credentials/OperationalCredentialsServer.ts +14 -17
- package/src/behaviors/switch/SwitchServer.ts +2 -2
- package/src/behaviors/window-covering/WindowCoveringServer.ts +6 -6
- package/src/devices/closure-panel.ts +1 -20
- package/src/devices/closure.ts +1 -22
- package/src/devices/door-lock.ts +1 -22
- package/src/devices/window-covering.ts +1 -23
- package/src/endpoint/type/MutableEndpoint.ts +1 -8
- package/src/node/server/InteractionServer.ts +21 -25
- package/src/node/server/ServerSubscription.ts +3 -3
|
@@ -11,7 +11,7 @@ import { Endpoint } from "#endpoint/Endpoint.js";
|
|
|
11
11
|
import { RootEndpoint } from "#endpoints/root";
|
|
12
12
|
import { InternalError, Logger } from "@matter/general";
|
|
13
13
|
import { assertRemoteActor, Fabric } from "@matter/protocol";
|
|
14
|
-
import {
|
|
14
|
+
import { Status, StatusResponseError } from "@matter/types";
|
|
15
15
|
import { Groups } from "@matter/types/clusters/groups";
|
|
16
16
|
import { GroupsBehavior } from "./GroupsBehavior.js";
|
|
17
17
|
|
|
@@ -86,14 +86,14 @@ export class GroupsServer extends GroupsBase {
|
|
|
86
86
|
const fabric = this.context.session.associatedFabric;
|
|
87
87
|
|
|
88
88
|
if (groupId < 1) {
|
|
89
|
-
return { status:
|
|
89
|
+
return { status: Status.ConstraintError, groupId };
|
|
90
90
|
}
|
|
91
91
|
if (groupName.length > 16) {
|
|
92
|
-
return { status:
|
|
92
|
+
return { status: Status.ConstraintError, groupId };
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
if (!fabric.groups.groupKeyIdMap.has(groupId)) {
|
|
96
|
-
return { status:
|
|
96
|
+
return { status: Status.UnsupportedAccess, groupId };
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
const endpointNumber = this.endpoint.number;
|
|
@@ -108,7 +108,7 @@ export class GroupsServer extends GroupsBase {
|
|
|
108
108
|
return { status: error.code, groupId };
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
return { status:
|
|
111
|
+
return { status: Status.Success, groupId };
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
override viewGroup({ groupId }: Groups.ViewGroupRequest): Groups.ViewGroupResponse {
|
|
@@ -116,7 +116,7 @@ export class GroupsServer extends GroupsBase {
|
|
|
116
116
|
const fabric = this.context.session.associatedFabric;
|
|
117
117
|
|
|
118
118
|
if (groupId < 1) {
|
|
119
|
-
return { status:
|
|
119
|
+
return { status: Status.ConstraintError, groupId, groupName: "" };
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
const fabricIndex = fabric.fabricIndex;
|
|
@@ -125,9 +125,9 @@ export class GroupsServer extends GroupsBase {
|
|
|
125
125
|
const { groupTable } = this.#rootEndpoint.stateOf(GroupKeyManagementServer);
|
|
126
126
|
const groupEntry = groupTable.find(entry => entry.groupId === groupId && entry.fabricIndex === fabricIndex);
|
|
127
127
|
if (groupEntry === undefined || !groupEntry.endpoints.includes(endpointNumber)) {
|
|
128
|
-
return { status:
|
|
128
|
+
return { status: Status.NotFound, groupId, groupName: "" };
|
|
129
129
|
}
|
|
130
|
-
return { status:
|
|
130
|
+
return { status: Status.Success, groupId, groupName: groupEntry.groupName ?? "" };
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
override async getGroupMembership({
|
|
@@ -154,7 +154,7 @@ export class GroupsServer extends GroupsBase {
|
|
|
154
154
|
|
|
155
155
|
override async removeGroup({ groupId }: Groups.RemoveGroupRequest): Promise<Groups.RemoveGroupResponse> {
|
|
156
156
|
if (groupId < 1) {
|
|
157
|
-
return { status:
|
|
157
|
+
return { status: Status.ConstraintError, groupId };
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
try {
|
|
@@ -169,9 +169,9 @@ export class GroupsServer extends GroupsBase {
|
|
|
169
169
|
.get(ScenesManagementServer)
|
|
170
170
|
.removeScenesForGroupOnFabric(this.context.session.associatedFabric.fabricIndex, groupId);
|
|
171
171
|
}
|
|
172
|
-
return { status:
|
|
172
|
+
return { status: Status.Success, groupId };
|
|
173
173
|
}
|
|
174
|
-
return { status:
|
|
174
|
+
return { status: Status.NotFound, groupId };
|
|
175
175
|
} catch (error) {
|
|
176
176
|
StatusResponseError.accept(error);
|
|
177
177
|
return { status: error.code, groupId };
|
|
@@ -197,7 +197,7 @@ export class GroupsServer extends GroupsBase {
|
|
|
197
197
|
if (this.endpoint.stateOf(IdentifyBehavior).identifyTime > 0) {
|
|
198
198
|
// We identify ourselves currently
|
|
199
199
|
const { status } = await this.addGroup({ groupId, groupName });
|
|
200
|
-
if (status !==
|
|
200
|
+
if (status !== Status.Success) {
|
|
201
201
|
throw new StatusResponseError(`Failed to add group ${groupId}`, status);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
@@ -16,7 +16,7 @@ import { AggregatorEndpoint } from "#endpoints/aggregator";
|
|
|
16
16
|
import { ServerNode } from "#node/ServerNode.js";
|
|
17
17
|
import { AsyncObservable, cropValueRange, Identity, Logger, MaybePromise, Millis } from "@matter/general";
|
|
18
18
|
import { Val } from "@matter/protocol";
|
|
19
|
-
import {
|
|
19
|
+
import { Status, StatusResponseError } from "@matter/types";
|
|
20
20
|
import { GeneralDiagnostics } from "@matter/types/clusters/general-diagnostics";
|
|
21
21
|
import { LevelControl } from "@matter/types/clusters/level-control";
|
|
22
22
|
import { LevelControlBehavior } from "./LevelControlBehavior.js";
|
|
@@ -79,7 +79,7 @@ export class LevelControlBaseServer extends LevelControlBase {
|
|
|
79
79
|
if (this.state.currentLevel === null) {
|
|
80
80
|
throw new StatusResponseError(
|
|
81
81
|
"The currentLevel value is null, so we cannot operate on it.",
|
|
82
|
-
|
|
82
|
+
Status.Failure,
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
return this.state.currentLevel;
|
|
@@ -269,7 +269,7 @@ export class LevelControlBaseServer extends LevelControlBase {
|
|
|
269
269
|
*/
|
|
270
270
|
#assertRateValue(rate: number | null) {
|
|
271
271
|
if (rate === 0) {
|
|
272
|
-
throw new StatusResponseError(`Illegal move rate of 0`,
|
|
272
|
+
throw new StatusResponseError(`Illegal move rate of 0`, Status.InvalidCommand);
|
|
273
273
|
}
|
|
274
274
|
if (rate === null) {
|
|
275
275
|
return this.state.defaultMoveRate ?? null;
|
|
@@ -8,7 +8,7 @@ import { GeneralDiagnosticsBehavior } from "#behaviors/general-diagnostics";
|
|
|
8
8
|
import { OnOffServer } from "#behaviors/on-off";
|
|
9
9
|
import { ServerNode } from "#node/ServerNode.js";
|
|
10
10
|
import { Logger, MaybePromise } from "@matter/general";
|
|
11
|
-
import {
|
|
11
|
+
import { Status, StatusResponseError } from "@matter/types";
|
|
12
12
|
import { GeneralDiagnostics } from "@matter/types/clusters/general-diagnostics";
|
|
13
13
|
import { ModeSelect } from "@matter/types/clusters/mode-select";
|
|
14
14
|
import { OnOff } from "@matter/types/clusters/on-off";
|
|
@@ -89,7 +89,7 @@ export class ModeSelectBaseServer extends ModeSelectBase {
|
|
|
89
89
|
if (!this.state.supportedModes.some(({ mode: supportedMode }) => supportedMode === mode)) {
|
|
90
90
|
throw new StatusResponseError(
|
|
91
91
|
`Mode ${mode} provided in ${fieldName} is not supported`,
|
|
92
|
-
|
|
92
|
+
Status.InvalidCommand,
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "@matter/protocol";
|
|
37
37
|
import {
|
|
38
38
|
FabricIndex,
|
|
39
|
-
|
|
39
|
+
Status,
|
|
40
40
|
StatusResponse,
|
|
41
41
|
StatusResponseError,
|
|
42
42
|
SubjectId,
|
|
@@ -95,7 +95,7 @@ export class OperationalCredentialsServer extends OperationalCredentialsBase {
|
|
|
95
95
|
assertRemoteActor(this.context);
|
|
96
96
|
|
|
97
97
|
if (attestationNonce.byteLength !== 32) {
|
|
98
|
-
throw new StatusResponseError("Invalid attestation nonce length",
|
|
98
|
+
throw new StatusResponseError("Invalid attestation nonce length", Status.InvalidCommand);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
const certification = await this.getCertification();
|
|
@@ -118,16 +118,13 @@ export class OperationalCredentialsServer extends OperationalCredentialsBase {
|
|
|
118
118
|
assertRemoteActor(this.context);
|
|
119
119
|
|
|
120
120
|
if (csrNonce.byteLength !== 32) {
|
|
121
|
-
throw new StatusResponseError("Invalid csr nonce length",
|
|
121
|
+
throw new StatusResponseError("Invalid csr nonce length", Status.InvalidCommand);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
const session = this.context.session;
|
|
125
125
|
NodeSession.assert(session);
|
|
126
126
|
if (isForUpdateNoc && session.isPase) {
|
|
127
|
-
throw new StatusResponseError(
|
|
128
|
-
"csrRequest for UpdateNoc received on a PASE session",
|
|
129
|
-
StatusCode.InvalidCommand,
|
|
130
|
-
);
|
|
127
|
+
throw new StatusResponseError("csrRequest for UpdateNoc received on a PASE session", Status.InvalidCommand);
|
|
131
128
|
}
|
|
132
129
|
|
|
133
130
|
const commissioner = this.env.get(DeviceCommissioner);
|
|
@@ -135,7 +132,7 @@ export class OperationalCredentialsServer extends OperationalCredentialsBase {
|
|
|
135
132
|
if (failsafeContext.fabricIndex !== undefined) {
|
|
136
133
|
throw new StatusResponseError(
|
|
137
134
|
`csrRequest received after ${failsafeContext.forUpdateNoc ? "UpdateNOC" : "AddNOC"} already invoked`,
|
|
138
|
-
|
|
135
|
+
Status.ConstraintError,
|
|
139
136
|
);
|
|
140
137
|
}
|
|
141
138
|
|
|
@@ -162,7 +159,7 @@ export class OperationalCredentialsServer extends OperationalCredentialsBase {
|
|
|
162
159
|
default:
|
|
163
160
|
throw new StatusResponseError(
|
|
164
161
|
`Unsupported certificate type: ${certificateType}`,
|
|
165
|
-
|
|
162
|
+
Status.InvalidCommand,
|
|
166
163
|
);
|
|
167
164
|
}
|
|
168
165
|
}
|
|
@@ -216,7 +213,7 @@ export class OperationalCredentialsServer extends OperationalCredentialsBase {
|
|
|
216
213
|
if (failsafeContext.fabricIndex !== undefined) {
|
|
217
214
|
throw new StatusResponseError(
|
|
218
215
|
`AddNoc is illegal after ${failsafeContext.forUpdateNoc ? "UpdateNOC" : "AddNOC"} in the same failsafe context`,
|
|
219
|
-
|
|
216
|
+
Status.ConstraintError,
|
|
220
217
|
);
|
|
221
218
|
}
|
|
222
219
|
|
|
@@ -237,7 +234,7 @@ export class OperationalCredentialsServer extends OperationalCredentialsBase {
|
|
|
237
234
|
if (failsafeContext.forUpdateNoc) {
|
|
238
235
|
throw new StatusResponseError(
|
|
239
236
|
`AddNoc is illegal after CsrRequest for UpdateNOC in same failsafe context`,
|
|
240
|
-
|
|
237
|
+
Status.ConstraintError,
|
|
241
238
|
);
|
|
242
239
|
}
|
|
243
240
|
|
|
@@ -316,14 +313,14 @@ export class OperationalCredentialsServer extends OperationalCredentialsBase {
|
|
|
316
313
|
if (timedOp.fabricIndex !== undefined) {
|
|
317
314
|
throw new StatusResponseError(
|
|
318
315
|
`UpdateNoc is illegal after ${timedOp.forUpdateNoc ? "UpdateNOC" : "AddNOC"} in same failsafe context`,
|
|
319
|
-
|
|
316
|
+
Status.ConstraintError,
|
|
320
317
|
);
|
|
321
318
|
}
|
|
322
319
|
|
|
323
320
|
if (timedOp.forUpdateNoc === false) {
|
|
324
321
|
throw new StatusResponseError(
|
|
325
322
|
"UpdateNoc is illegal after CsrRequest for AddNOC in same failsafe context",
|
|
326
|
-
|
|
323
|
+
Status.ConstraintError,
|
|
327
324
|
);
|
|
328
325
|
}
|
|
329
326
|
|
|
@@ -348,7 +345,7 @@ export class OperationalCredentialsServer extends OperationalCredentialsBase {
|
|
|
348
345
|
if (this.context.session.associatedFabric.fabricIndex !== timedOp.associatedFabric?.fabricIndex) {
|
|
349
346
|
throw new StatusResponseError(
|
|
350
347
|
"Fabric of this session and the failsafe context do not match",
|
|
351
|
-
|
|
348
|
+
Status.ConstraintError,
|
|
352
349
|
);
|
|
353
350
|
}
|
|
354
351
|
|
|
@@ -427,14 +424,14 @@ export class OperationalCredentialsServer extends OperationalCredentialsBase {
|
|
|
427
424
|
if (failsafeContext.rootCertSet) {
|
|
428
425
|
throw new StatusResponseError(
|
|
429
426
|
"Trusted root certificate already added in this FailSafe context",
|
|
430
|
-
|
|
427
|
+
Status.ConstraintError,
|
|
431
428
|
);
|
|
432
429
|
}
|
|
433
430
|
|
|
434
431
|
if (failsafeContext.fabricIndex !== undefined) {
|
|
435
432
|
throw new StatusResponseError(
|
|
436
433
|
`Cannot add trusted root certificates after ${failsafeContext.forUpdateNoc ? "UpdateNOC" : "AddNOC"}`,
|
|
437
|
-
|
|
434
|
+
Status.ConstraintError,
|
|
438
435
|
);
|
|
439
436
|
}
|
|
440
437
|
|
|
@@ -448,7 +445,7 @@ export class OperationalCredentialsServer extends OperationalCredentialsBase {
|
|
|
448
445
|
error instanceof ValidationError ||
|
|
449
446
|
error instanceof UnexpectedDataError
|
|
450
447
|
) {
|
|
451
|
-
throw new StatusResponseError(error.message,
|
|
448
|
+
throw new StatusResponseError(error.message, Status.InvalidCommand);
|
|
452
449
|
}
|
|
453
450
|
throw error;
|
|
454
451
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { ActionContext } from "#behavior/context/ActionContext.js";
|
|
8
8
|
import { Duration, Logger, MaybePromise, Millis, Observable, Seconds, Time, Timer } from "@matter/general";
|
|
9
9
|
import { FieldElement } from "@matter/model";
|
|
10
|
-
import {
|
|
10
|
+
import { Status, StatusResponseError } from "@matter/types";
|
|
11
11
|
import { Switch } from "@matter/types/clusters/switch";
|
|
12
12
|
import { SwitchBehavior } from "./SwitchBehavior.js";
|
|
13
13
|
|
|
@@ -110,7 +110,7 @@ export class SwitchBaseServer extends SwitchServerBase {
|
|
|
110
110
|
// TODO remove when Validator logic can assess that with 1.3 introduction
|
|
111
111
|
#assertPositionInRange(position: number) {
|
|
112
112
|
if (position < 0 || position >= this.state.numberOfPositions) {
|
|
113
|
-
throw new StatusResponseError(`Position ${position} invalid`,
|
|
113
|
+
throw new StatusResponseError(`Position ${position} invalid`, Status.ConstraintError);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Diagnostic, ImplementationError, isDeepEqual, Logger, MaybePromise, Worker } from "@matter/general";
|
|
8
|
-
import {
|
|
8
|
+
import { Status, StatusResponseError } from "@matter/types";
|
|
9
9
|
import { WindowCovering } from "@matter/types/clusters/window-covering";
|
|
10
10
|
import { WindowCoveringBehavior } from "./WindowCoveringBehavior.js";
|
|
11
11
|
|
|
@@ -165,13 +165,13 @@ export class WindowCoveringBaseServer extends WindowCoveringBase {
|
|
|
165
165
|
mode.calibrationMode = false;
|
|
166
166
|
}
|
|
167
167
|
if (mode.maintenanceMode && !this.state.supportsMaintenanceMode) {
|
|
168
|
-
throw new StatusResponseError("Maintenance mode not supported",
|
|
168
|
+
throw new StatusResponseError("Maintenance mode not supported", Status.ConstraintError);
|
|
169
169
|
}
|
|
170
170
|
this.internal.inMaintenanceMode = !!mode.maintenanceMode;
|
|
171
171
|
|
|
172
172
|
if (mode.calibrationMode) {
|
|
173
173
|
if (!this.internal.supportsCalibration) {
|
|
174
|
-
throw new StatusResponseError("Calibration not supported",
|
|
174
|
+
throw new StatusResponseError("Calibration not supported", Status.ConstraintError);
|
|
175
175
|
}
|
|
176
176
|
if (this.internal.calibrationMode === CalibrationMode.Running) {
|
|
177
177
|
// What to do here? For now lets leave unchanged
|
|
@@ -286,14 +286,14 @@ export class WindowCoveringBaseServer extends WindowCoveringBase {
|
|
|
286
286
|
*/
|
|
287
287
|
#assertMotionLockStatus() {
|
|
288
288
|
if (this.internal.inMaintenanceMode) {
|
|
289
|
-
throw new StatusResponseError("Device is in maintenance mode",
|
|
289
|
+
throw new StatusResponseError("Device is in maintenance mode", Status.Busy);
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
switch (this.internal.calibrationMode) {
|
|
293
293
|
case CalibrationMode.Enabled:
|
|
294
294
|
if (!this.internal.supportsCalibration) {
|
|
295
295
|
// Should never happy normally because mode attribute should never be set
|
|
296
|
-
throw new StatusResponseError("Calibration not implemented",
|
|
296
|
+
throw new StatusResponseError("Calibration not implemented", Status.Failure);
|
|
297
297
|
}
|
|
298
298
|
break;
|
|
299
299
|
case CalibrationMode.Running:
|
|
@@ -304,7 +304,7 @@ export class WindowCoveringBaseServer extends WindowCoveringBase {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
if (!this.state.configStatus.operational) {
|
|
307
|
-
throw new StatusResponseError("Device is not operational",
|
|
307
|
+
throw new StatusResponseError("Device is not operational", Status.Failure);
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
import {
|
|
10
10
|
ClosureDimensionServer as BaseClosureDimensionServer
|
|
11
11
|
} from "../behaviors/closure-dimension/ClosureDimensionServer.js";
|
|
12
|
-
import { WindowCoveringServer as BaseWindowCoveringServer } from "../behaviors/window-covering/WindowCoveringServer.js";
|
|
13
|
-
import { ClosureControlServer as BaseClosureControlServer } from "../behaviors/closure-control/ClosureControlServer.js";
|
|
14
12
|
import { MutableEndpoint } from "../endpoint/type/MutableEndpoint.js";
|
|
15
13
|
import { SupportedBehaviors } from "../endpoint/properties/SupportedBehaviors.js";
|
|
16
14
|
import { Identity } from "@matter/general";
|
|
@@ -45,27 +43,10 @@ export namespace ClosurePanelRequirements {
|
|
|
45
43
|
*/
|
|
46
44
|
export const ClosureDimensionServer = BaseClosureDimensionServer;
|
|
47
45
|
|
|
48
|
-
/**
|
|
49
|
-
* The WindowCovering cluster is optional per the Matter specification.
|
|
50
|
-
*
|
|
51
|
-
* We provide this alias to the default implementation {@link WindowCoveringServer} for convenience.
|
|
52
|
-
*/
|
|
53
|
-
export const WindowCoveringServer = BaseWindowCoveringServer;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* The ClosureControl cluster is optional per the Matter specification.
|
|
57
|
-
*
|
|
58
|
-
* We provide this alias to the default implementation {@link ClosureControlServer} for convenience.
|
|
59
|
-
*/
|
|
60
|
-
export const ClosureControlServer = BaseClosureControlServer;
|
|
61
|
-
|
|
62
46
|
/**
|
|
63
47
|
* An implementation for each server cluster supported by the endpoint per the Matter specification.
|
|
64
48
|
*/
|
|
65
|
-
export const server = {
|
|
66
|
-
mandatory: { ClosureDimension: ClosureDimensionServer },
|
|
67
|
-
optional: { WindowCovering: WindowCoveringServer, ClosureControl: ClosureControlServer }
|
|
68
|
-
};
|
|
49
|
+
export const server = { mandatory: { ClosureDimension: ClosureDimensionServer } };
|
|
69
50
|
}
|
|
70
51
|
|
|
71
52
|
export const ClosurePanelDeviceDefinition = MutableEndpoint({
|
package/src/devices/closure.ts
CHANGED
|
@@ -8,10 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
import { IdentifyServer as BaseIdentifyServer } from "../behaviors/identify/IdentifyServer.js";
|
|
10
10
|
import { ClosureControlServer as BaseClosureControlServer } from "../behaviors/closure-control/ClosureControlServer.js";
|
|
11
|
-
import { WindowCoveringServer as BaseWindowCoveringServer } from "../behaviors/window-covering/WindowCoveringServer.js";
|
|
12
|
-
import {
|
|
13
|
-
ClosureDimensionServer as BaseClosureDimensionServer
|
|
14
|
-
} from "../behaviors/closure-dimension/ClosureDimensionServer.js";
|
|
15
11
|
import { MutableEndpoint } from "../endpoint/type/MutableEndpoint.js";
|
|
16
12
|
import { SupportedBehaviors } from "../endpoint/properties/SupportedBehaviors.js";
|
|
17
13
|
import { Identity } from "@matter/general";
|
|
@@ -46,27 +42,10 @@ export namespace ClosureRequirements {
|
|
|
46
42
|
*/
|
|
47
43
|
export const ClosureControlServer = BaseClosureControlServer;
|
|
48
44
|
|
|
49
|
-
/**
|
|
50
|
-
* The WindowCovering cluster is optional per the Matter specification.
|
|
51
|
-
*
|
|
52
|
-
* We provide this alias to the default implementation {@link WindowCoveringServer} for convenience.
|
|
53
|
-
*/
|
|
54
|
-
export const WindowCoveringServer = BaseWindowCoveringServer;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The ClosureDimension cluster is optional per the Matter specification.
|
|
58
|
-
*
|
|
59
|
-
* We provide this alias to the default implementation {@link ClosureDimensionServer} for convenience.
|
|
60
|
-
*/
|
|
61
|
-
export const ClosureDimensionServer = BaseClosureDimensionServer;
|
|
62
|
-
|
|
63
45
|
/**
|
|
64
46
|
* An implementation for each server cluster supported by the endpoint per the Matter specification.
|
|
65
47
|
*/
|
|
66
|
-
export const server = {
|
|
67
|
-
mandatory: { Identify: IdentifyServer, ClosureControl: ClosureControlServer },
|
|
68
|
-
optional: { WindowCovering: WindowCoveringServer, ClosureDimension: ClosureDimensionServer }
|
|
69
|
-
};
|
|
48
|
+
export const server = { mandatory: { Identify: IdentifyServer, ClosureControl: ClosureControlServer } };
|
|
70
49
|
}
|
|
71
50
|
|
|
72
51
|
export const ClosureDeviceDefinition = MutableEndpoint({
|
package/src/devices/door-lock.ts
CHANGED
|
@@ -8,10 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
import { IdentifyServer as BaseIdentifyServer } from "../behaviors/identify/IdentifyServer.js";
|
|
10
10
|
import { DoorLockServer as BaseDoorLockServer } from "../behaviors/door-lock/DoorLockServer.js";
|
|
11
|
-
import { GroupsServer as BaseGroupsServer } from "../behaviors/groups/GroupsServer.js";
|
|
12
|
-
import {
|
|
13
|
-
ScenesManagementServer as BaseScenesManagementServer
|
|
14
|
-
} from "../behaviors/scenes-management/ScenesManagementServer.js";
|
|
15
11
|
import { MutableEndpoint } from "../endpoint/type/MutableEndpoint.js";
|
|
16
12
|
import { SupportedBehaviors } from "../endpoint/properties/SupportedBehaviors.js";
|
|
17
13
|
import { Identity } from "@matter/general";
|
|
@@ -39,27 +35,10 @@ export namespace DoorLockRequirements {
|
|
|
39
35
|
*/
|
|
40
36
|
export const DoorLockServer = BaseDoorLockServer;
|
|
41
37
|
|
|
42
|
-
/**
|
|
43
|
-
* The Groups cluster is optional per the Matter specification.
|
|
44
|
-
*
|
|
45
|
-
* We provide this alias to the default implementation {@link GroupsServer} for convenience.
|
|
46
|
-
*/
|
|
47
|
-
export const GroupsServer = BaseGroupsServer;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The ScenesManagement cluster is optional per the Matter specification.
|
|
51
|
-
*
|
|
52
|
-
* We provide this alias to the default implementation {@link ScenesManagementServer} for convenience.
|
|
53
|
-
*/
|
|
54
|
-
export const ScenesManagementServer = BaseScenesManagementServer;
|
|
55
|
-
|
|
56
38
|
/**
|
|
57
39
|
* An implementation for each server cluster supported by the endpoint per the Matter specification.
|
|
58
40
|
*/
|
|
59
|
-
export const server = {
|
|
60
|
-
mandatory: { Identify: IdentifyServer, DoorLock: DoorLockServer },
|
|
61
|
-
optional: { Groups: GroupsServer, ScenesManagement: ScenesManagementServer }
|
|
62
|
-
};
|
|
41
|
+
export const server = { mandatory: { Identify: IdentifyServer, DoorLock: DoorLockServer } };
|
|
63
42
|
}
|
|
64
43
|
|
|
65
44
|
export const DoorLockDeviceDefinition = MutableEndpoint({
|
|
@@ -9,10 +9,6 @@
|
|
|
9
9
|
import { IdentifyServer as BaseIdentifyServer } from "../behaviors/identify/IdentifyServer.js";
|
|
10
10
|
import { WindowCoveringServer as BaseWindowCoveringServer } from "../behaviors/window-covering/WindowCoveringServer.js";
|
|
11
11
|
import { GroupsServer as BaseGroupsServer } from "../behaviors/groups/GroupsServer.js";
|
|
12
|
-
import { ClosureControlServer as BaseClosureControlServer } from "../behaviors/closure-control/ClosureControlServer.js";
|
|
13
|
-
import {
|
|
14
|
-
ClosureDimensionServer as BaseClosureDimensionServer
|
|
15
|
-
} from "../behaviors/closure-dimension/ClosureDimensionServer.js";
|
|
16
12
|
import { MutableEndpoint } from "../endpoint/type/MutableEndpoint.js";
|
|
17
13
|
import { SupportedBehaviors } from "../endpoint/properties/SupportedBehaviors.js";
|
|
18
14
|
import { Identity } from "@matter/general";
|
|
@@ -49,30 +45,12 @@ export namespace WindowCoveringRequirements {
|
|
|
49
45
|
*/
|
|
50
46
|
export const GroupsServer = BaseGroupsServer;
|
|
51
47
|
|
|
52
|
-
/**
|
|
53
|
-
* The ClosureControl cluster is optional per the Matter specification.
|
|
54
|
-
*
|
|
55
|
-
* We provide this alias to the default implementation {@link ClosureControlServer} for convenience.
|
|
56
|
-
*/
|
|
57
|
-
export const ClosureControlServer = BaseClosureControlServer;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The ClosureDimension cluster is optional per the Matter specification.
|
|
61
|
-
*
|
|
62
|
-
* We provide this alias to the default implementation {@link ClosureDimensionServer} for convenience.
|
|
63
|
-
*/
|
|
64
|
-
export const ClosureDimensionServer = BaseClosureDimensionServer;
|
|
65
|
-
|
|
66
48
|
/**
|
|
67
49
|
* An implementation for each server cluster supported by the endpoint per the Matter specification.
|
|
68
50
|
*/
|
|
69
51
|
export const server = {
|
|
70
52
|
mandatory: { Identify: IdentifyServer, WindowCovering: WindowCoveringServer },
|
|
71
|
-
optional: {
|
|
72
|
-
Groups: GroupsServer,
|
|
73
|
-
ClosureControl: ClosureControlServer,
|
|
74
|
-
ClosureDimension: ClosureDimensionServer
|
|
75
|
-
}
|
|
53
|
+
optional: { Groups: GroupsServer }
|
|
76
54
|
};
|
|
77
55
|
}
|
|
78
56
|
|
|
@@ -6,13 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
import { Behavior } from "#behavior/Behavior.js";
|
|
8
8
|
import { isClientBehavior } from "#behavior/cluster/cluster-behavior-utils.js";
|
|
9
|
-
import { Logger } from "@matter/general";
|
|
10
9
|
import { SupportedBehaviors } from "../properties/SupportedBehaviors.js";
|
|
11
10
|
import { SupportedClientClusters } from "../properties/SupportedClientClusters.js";
|
|
12
11
|
import { EndpointType } from "./EndpointType.js";
|
|
13
12
|
|
|
14
|
-
const logger = Logger.get("MutableEndpoint");
|
|
15
|
-
|
|
16
13
|
/**
|
|
17
14
|
* A MutableEndpoint is an EndpointType with factory functions that make it convenient to reconfigure the endpoint.
|
|
18
15
|
*
|
|
@@ -58,12 +55,8 @@ export function MutableEndpoint<const T extends EndpointType.Options>(options: T
|
|
|
58
55
|
const mandatoryClients: SupportedBehaviors = options.requirements?.client?.mandatory ?? {};
|
|
59
56
|
if (Object.keys(mandatoryClients).length > 0) {
|
|
60
57
|
const merged = SupportedClientClusters.extend(clientClusters, Object.values(mandatoryClients));
|
|
61
|
-
|
|
62
|
-
if (added.length > 0) {
|
|
58
|
+
if (Object.keys(merged).some(k => !(k in clientClusters))) {
|
|
63
59
|
clientClusters = merged;
|
|
64
|
-
logger.debug(
|
|
65
|
-
`Auto-registered mandatory client cluster(s) [${added.join(", ")}] for device type ${type.name}`,
|
|
66
|
-
);
|
|
67
60
|
}
|
|
68
61
|
}
|
|
69
62
|
|