@project-chip/matter.js 0.0.1 → 0.1.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/README.md +14 -0
- package/dist/cjs/cluster/AccessControlCluster.js +105 -0
- package/dist/cjs/cluster/BasicInformationCluster.js +92 -0
- package/dist/cjs/cluster/BindingCluster.js +51 -0
- package/dist/cjs/cluster/BridgedDeviceBasicInformationCluster.js +75 -0
- package/dist/cjs/cluster/Cluster.js +49 -0
- package/dist/cjs/cluster/DescriptorCluster.js +53 -0
- package/dist/cjs/cluster/GeneralCommissioningCluster.js +89 -0
- package/dist/cjs/cluster/GroupsCluster.js +140 -0
- package/dist/cjs/cluster/IdentifyCluster.js +55 -0
- package/dist/cjs/cluster/LabelCluster.js +55 -0
- package/dist/cjs/cluster/OnOffCluster.js +105 -0
- package/dist/cjs/cluster/OperationalCredentialsCluster.js +205 -0
- package/dist/cjs/cluster/ScenesCluster.js +236 -0
- package/dist/cjs/common/AttributeId.js +23 -0
- package/dist/cjs/common/ClusterId.js +24 -0
- package/dist/cjs/common/DeviceTypeId.js +23 -0
- package/dist/cjs/common/EndpointNumber.js +23 -0
- package/dist/cjs/common/FabricId.js +24 -0
- package/dist/cjs/common/FabricIndex.js +28 -0
- package/dist/cjs/common/GroupId.js +30 -0
- package/dist/cjs/common/NodeId.js +31 -0
- package/dist/cjs/common/SubjectId.js +11 -0
- package/dist/cjs/common/VendorId.js +25 -0
- package/{dist-cjs → dist/cjs}/matter.js +12 -0
- package/dist/cjs/protocol/InteractionProtocol.js +136 -0
- package/dist/cjs/schema/BitmapSchema.js +133 -0
- package/dist/cjs/schema/Schema.js +26 -0
- package/dist/cjs/spec/Specifications.js +7 -0
- package/dist/cjs/tlv/TlvAny.js +71 -0
- package/dist/cjs/tlv/TlvArray.js +52 -0
- package/dist/cjs/tlv/TlvBoolean.js +27 -0
- package/dist/cjs/tlv/TlvCodec.js +248 -0
- package/dist/cjs/tlv/TlvNullable.js +37 -0
- package/dist/cjs/tlv/TlvNumber.js +83 -0
- package/dist/cjs/tlv/TlvObject.js +85 -0
- package/dist/cjs/tlv/TlvSchema.js +92 -0
- package/dist/cjs/tlv/TlvString.js +56 -0
- package/dist/cjs/tlv/TlvVoid.js +26 -0
- package/dist/cjs/tlv/TlvWrapper.js +27 -0
- package/dist/cjs/util/ByteArray.js +50 -0
- package/dist/cjs/util/DataReader.js +69 -0
- package/dist/cjs/util/DataWriter.js +102 -0
- package/dist/cjs/util/Number.js +46 -0
- package/dist/cjs/util/Type.js +10 -0
- package/dist/dts/cluster/AccessControlCluster.d.ts +108 -0
- package/dist/dts/cluster/BasicInformationCluster.d.ts +57 -0
- package/dist/dts/cluster/BindingCluster.d.ts +23 -0
- package/dist/dts/cluster/BridgedDeviceBasicInformationCluster.d.ts +53 -0
- package/dist/dts/cluster/Cluster.d.ts +109 -0
- package/dist/dts/cluster/DescriptorCluster.d.ts +25 -0
- package/dist/dts/cluster/GeneralCommissioningCluster.d.ts +94 -0
- package/dist/dts/cluster/GroupsCluster.d.ts +92 -0
- package/dist/dts/cluster/IdentifyCluster.d.ts +60 -0
- package/dist/dts/cluster/LabelCluster.d.ts +34 -0
- package/dist/dts/cluster/OnOffCluster.d.ts +85 -0
- package/dist/dts/cluster/OperationalCredentialsCluster.d.ts +156 -0
- package/dist/dts/cluster/ScenesCluster.d.ts +200 -0
- package/dist/dts/common/AttributeId.d.ts +17 -0
- package/dist/dts/common/ClusterId.d.ts +18 -0
- package/dist/dts/common/DeviceTypeId.d.ts +17 -0
- package/dist/dts/common/EndpointNumber.d.ts +17 -0
- package/dist/dts/common/FabricId.d.ts +18 -0
- package/dist/dts/common/FabricIndex.d.ts +22 -0
- package/dist/dts/common/GroupId.d.ts +24 -0
- package/dist/dts/common/NodeId.d.ts +19 -0
- package/dist/dts/common/SubjectId.d.ts +15 -0
- package/dist/dts/common/VendorId.d.ts +19 -0
- package/dist/{matter.d.ts → dts/matter.d.ts} +12 -0
- package/dist/dts/protocol/InteractionProtocol.d.ts +159 -0
- package/dist/{schema → dts/schema}/BitmapSchema.d.ts +15 -3
- package/dist/{schema → dts/schema}/Schema.d.ts +0 -0
- package/dist/{spec → dts/spec}/Specifications.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvAny.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvArray.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvBoolean.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvCodec.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvNullable.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvNumber.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvObject.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvSchema.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvString.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvVoid.d.ts +0 -0
- package/dist/{tlv → dts/tlv}/TlvWrapper.d.ts +0 -0
- package/dist/{util → dts/util}/ByteArray.d.ts +0 -0
- package/dist/{util → dts/util}/DataReader.d.ts +0 -0
- package/dist/{util → dts/util}/DataWriter.d.ts +0 -0
- package/dist/{util → dts/util}/Number.d.ts +0 -0
- package/dist/{util → dts/util}/Type.d.ts +1 -0
- package/dist/es/cluster/AccessControlCluster.js +102 -0
- package/dist/es/cluster/BasicInformationCluster.js +89 -0
- package/dist/es/cluster/BindingCluster.js +48 -0
- package/dist/es/cluster/BridgedDeviceBasicInformationCluster.js +72 -0
- package/dist/es/cluster/Cluster.js +36 -0
- package/dist/es/cluster/DescriptorCluster.js +50 -0
- package/dist/es/cluster/GeneralCommissioningCluster.js +86 -0
- package/dist/es/cluster/GroupsCluster.js +137 -0
- package/dist/es/cluster/IdentifyCluster.js +52 -0
- package/dist/es/cluster/LabelCluster.js +52 -0
- package/dist/es/cluster/OnOffCluster.js +102 -0
- package/dist/es/cluster/OperationalCredentialsCluster.js +202 -0
- package/dist/es/cluster/ScenesCluster.js +233 -0
- package/dist/es/common/AttributeId.js +19 -0
- package/dist/es/common/ClusterId.js +20 -0
- package/dist/es/common/DeviceTypeId.js +19 -0
- package/dist/es/common/EndpointNumber.js +19 -0
- package/dist/es/common/FabricId.js +20 -0
- package/dist/es/common/FabricIndex.js +24 -0
- package/dist/es/common/GroupId.js +26 -0
- package/dist/es/common/NodeId.js +27 -0
- package/dist/es/common/SubjectId.js +8 -0
- package/dist/es/common/VendorId.js +21 -0
- package/dist/{matter.js → es/matter.js} +12 -0
- package/dist/es/protocol/InteractionProtocol.js +133 -0
- package/dist/es/schema/BitmapSchema.js +125 -0
- package/dist/{schema → es/schema}/Schema.js +0 -0
- package/dist/{spec → es/spec}/Specifications.js +0 -0
- package/dist/{tlv → es/tlv}/TlvAny.js +0 -0
- package/dist/{tlv → es/tlv}/TlvArray.js +0 -0
- package/dist/{tlv → es/tlv}/TlvBoolean.js +0 -0
- package/dist/{tlv → es/tlv}/TlvCodec.js +0 -0
- package/dist/{tlv → es/tlv}/TlvNullable.js +0 -0
- package/dist/{tlv → es/tlv}/TlvNumber.js +0 -0
- package/dist/{tlv → es/tlv}/TlvObject.js +6 -2
- package/dist/{tlv → es/tlv}/TlvSchema.js +0 -0
- package/dist/{tlv → es/tlv}/TlvString.js +0 -0
- package/dist/{tlv → es/tlv}/TlvVoid.js +0 -0
- package/dist/{tlv → es/tlv}/TlvWrapper.js +0 -0
- package/dist/{util → es/util}/ByteArray.js +2 -0
- package/dist/{util → es/util}/DataReader.js +0 -0
- package/dist/{util → es/util}/DataWriter.js +0 -0
- package/dist/{util → es/util}/Number.js +0 -0
- package/dist/{util → es/util}/Type.js +1 -1
- package/package.json +6 -6
- package/dist/schema/BitmapSchema.js +0 -48
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Attribute, Cluster, Command, TlvNoArguments, WritableAttribute } from "./Cluster.js";
|
|
7
|
+
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
|
|
8
|
+
import { TlvEnum, TlvUInt16, TlvUInt64 } from "../tlv/TlvNumber.js";
|
|
9
|
+
import { TlvString } from "../tlv/TlvString.js";
|
|
10
|
+
import { TlvBoolean } from "../tlv/TlvBoolean.js";
|
|
11
|
+
/**
|
|
12
|
+
* This structure provides some constant values that MAY be of use to all commissioners.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.9.5.2
|
|
15
|
+
*/
|
|
16
|
+
const TlvBasicCommissioningInfo = TlvObject({
|
|
17
|
+
/** Contains a conservative initial duration (in seconds) to set in the FailSafe for the commissioning flow to complete successfully. */
|
|
18
|
+
failSafeExpiryLengthSeconds: TlvField(0, TlvUInt16),
|
|
19
|
+
/** Contain a conservative value in seconds denoting the maximum total duration for which a fail-safe timer can be re-armed. */
|
|
20
|
+
maxCumulativeFailsafeSeconds: TlvField(1, TlvUInt16),
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Used by the following commands as response payload:
|
|
24
|
+
* ArmFailSafeResponse, @see {@link MatterCoreSpecificationV1_0} § 11.9.7.3
|
|
25
|
+
* CommissioningCompleteResponse, @see {@link MatterCoreSpecificationV1_0} § 11.9.7.7
|
|
26
|
+
* CommissioningCompleteResponse, @see {@link MatterCoreSpecificationV1_0} § 11.9.7.7
|
|
27
|
+
*/
|
|
28
|
+
const TlvCommissioningSuccessFailureResponse = TlvObject({
|
|
29
|
+
/** Contain the result of the operation. */
|
|
30
|
+
errorCode: TlvField(0, TlvEnum()),
|
|
31
|
+
/** Should help developers in troubleshooting errors. The value MAY go into logs or crash reports, not User UIs. */
|
|
32
|
+
debugText: TlvField(1, TlvString.bound({ maxLength: 128 })),
|
|
33
|
+
});
|
|
34
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.9.7.3. */
|
|
35
|
+
const TlvArmFailSafeRequest = TlvObject({
|
|
36
|
+
/** Contains timeframe for fail-safe timer actions. */
|
|
37
|
+
expiryLengthSeconds: TlvField(0, TlvUInt16),
|
|
38
|
+
/** Value to atomically set the Breadcrumb attribute on success of this command. */
|
|
39
|
+
breadcrumbStep: TlvField(1, TlvUInt64),
|
|
40
|
+
});
|
|
41
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.9.7.4 */
|
|
42
|
+
const TlvSetRegulatoryConfigRequest = TlvObject({
|
|
43
|
+
/** Contains the new regulatory location to be set. */
|
|
44
|
+
newRegulatoryConfig: TlvField(0, TlvEnum()),
|
|
45
|
+
/** Contains a ISO 3166-1 alpha-2 country code*/
|
|
46
|
+
countryCode: TlvField(1, TlvString.bound({ length: 2 })),
|
|
47
|
+
/** Value to atomically set the Breadcrumb attribute on success of this command. */
|
|
48
|
+
breadcrumbStep: TlvField(2, TlvUInt64),
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* This cluster is used to manage global aspects of the Commissioning flow.
|
|
52
|
+
*
|
|
53
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.9
|
|
54
|
+
*/
|
|
55
|
+
export const GeneralCommissioningCluster = Cluster({
|
|
56
|
+
id: 0x30,
|
|
57
|
+
name: "General Commissioning",
|
|
58
|
+
revision: 1,
|
|
59
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.9.6 */
|
|
60
|
+
attributes: {
|
|
61
|
+
/** Allows for the storage of a client-provided small payload which Administrators and Commissioners MAY write
|
|
62
|
+
* and then subsequently read, to keep track of their own progress.
|
|
63
|
+
*/
|
|
64
|
+
breadcrumb: WritableAttribute(0, TlvUInt64, { default: BigInt(0), writeAcl: 2 /* AccessLevel.Administer */ }),
|
|
65
|
+
/** Describe critical parameters needed at the beginning of commissioning flow. */
|
|
66
|
+
commissioningInfo: Attribute(1, TlvBasicCommissioningInfo),
|
|
67
|
+
/** Indicates the regulatory configuration for the product. */
|
|
68
|
+
regulatoryConfig: Attribute(2, TlvEnum()),
|
|
69
|
+
/** Indicates if this Node needs to be told an exact RegulatoryLocation. */
|
|
70
|
+
locationCapability: Attribute(3, TlvEnum(), { default: 2 /* RegulatoryLocationType.IndoorOutdoor */ }),
|
|
71
|
+
/** Indicates whether this device supports "concurrent connection flow" commissioning mode */
|
|
72
|
+
supportsConcurrentConnections: Attribute(4, TlvBoolean, { default: true }),
|
|
73
|
+
},
|
|
74
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.9.7 */
|
|
75
|
+
commands: {
|
|
76
|
+
/** Arms the persistent fail-safe timer with an expiry time of now + ExpiryLengthSeconds using device clock. */
|
|
77
|
+
armFailSafe: Command(0, TlvArmFailSafeRequest, 1, TlvCommissioningSuccessFailureResponse),
|
|
78
|
+
/** Sets or Updates the regulatory configuration to be used during commissioning. */
|
|
79
|
+
setRegulatoryConfig: Command(2, TlvSetRegulatoryConfigRequest, 3, TlvCommissioningSuccessFailureResponse),
|
|
80
|
+
/**
|
|
81
|
+
* Informs that all steps of Commissioning/Reconfiguration needed during the fail-safe period have been
|
|
82
|
+
* completed.
|
|
83
|
+
*/
|
|
84
|
+
commissioningComplete: Command(4, TlvNoArguments, 5, TlvCommissioningSuccessFailureResponse),
|
|
85
|
+
},
|
|
86
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Attribute, Cluster, Command, TlvNoArguments, TlvNoResponse } from "./Cluster.js";
|
|
7
|
+
import { TlvGroupId } from "../common/GroupId.js";
|
|
8
|
+
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
|
|
9
|
+
import { TlvString } from "../tlv/TlvString.js";
|
|
10
|
+
import { TlvBitmap, TlvEnum, TlvUInt8 } from "../tlv/TlvNumber.js";
|
|
11
|
+
import { TlvArray } from "../tlv/TlvArray.js";
|
|
12
|
+
import { TlvNullable } from "../tlv/TlvNullable.js";
|
|
13
|
+
import { BitFlag } from "../schema/BitmapSchema.js";
|
|
14
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7.1 */
|
|
15
|
+
const TlvAddGroupRequest = TlvObject({
|
|
16
|
+
groupId: TlvField(0, TlvGroupId),
|
|
17
|
+
groupName: TlvField(1, TlvString.bound({ maxLength: 16 })),
|
|
18
|
+
});
|
|
19
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7.7 */
|
|
20
|
+
const TlvAddGroupResponse = TlvObject({
|
|
21
|
+
status: TlvField(0, TlvEnum()),
|
|
22
|
+
groupId: TlvField(1, TlvGroupId), /* type: min: 1 */
|
|
23
|
+
});
|
|
24
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7.2 */
|
|
25
|
+
const TlvViewGroupRequest = TlvObject({
|
|
26
|
+
groupId: TlvField(0, TlvGroupId), /* type: min: 1 */
|
|
27
|
+
});
|
|
28
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7.8 */
|
|
29
|
+
const TlvViewGroupResponse = TlvObject({
|
|
30
|
+
status: TlvField(0, TlvEnum()),
|
|
31
|
+
groupId: TlvField(1, TlvGroupId),
|
|
32
|
+
groupName: TlvField(2, TlvString.bound({ maxLength: 16 })),
|
|
33
|
+
});
|
|
34
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7.3 */
|
|
35
|
+
const TlvGetGroupMembershipRequest = TlvObject({
|
|
36
|
+
groupList: TlvField(0, TlvArray(TlvGroupId)), /* groupId min: 1 */
|
|
37
|
+
});
|
|
38
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7.9 */
|
|
39
|
+
const TlvGetGroupMembershipResponse = TlvObject({
|
|
40
|
+
/** contain the remaining capacity of the Group Table of the node. */
|
|
41
|
+
capacity: TlvField(0, TlvNullable(TlvUInt8)),
|
|
42
|
+
groupList: TlvField(1, TlvArray(TlvGroupId)), /* groupId min: 1 */
|
|
43
|
+
});
|
|
44
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7.4 */
|
|
45
|
+
const TlvRemoveGroupRequest = TlvObject({
|
|
46
|
+
groupId: TlvField(0, TlvGroupId), /* min: 1 */
|
|
47
|
+
});
|
|
48
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7.10 */
|
|
49
|
+
const TlvRemoveGroupResponse = TlvObject({
|
|
50
|
+
status: TlvField(0, TlvEnum()),
|
|
51
|
+
groupId: TlvField(1, TlvGroupId), /* min: 1 */
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Formally not defined in specs state:
|
|
55
|
+
* If the RemoveAllGroups command was received as unicast and a response is not
|
|
56
|
+
* suppressed, the server SHALL generate a response with the Status field set to SUCCESS.
|
|
57
|
+
*
|
|
58
|
+
* @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7.5.1
|
|
59
|
+
*/
|
|
60
|
+
const TlvRemoveAllGroupResponse = TlvObject({
|
|
61
|
+
status: TlvField(0, TlvEnum()),
|
|
62
|
+
});
|
|
63
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7.6 */
|
|
64
|
+
const TlvAddGroupIfIdentifyingRequest = TlvObject({
|
|
65
|
+
groupId: TlvField(0, TlvGroupId),
|
|
66
|
+
groupName: TlvField(1, TlvString.bound({ maxLength: 16 })),
|
|
67
|
+
});
|
|
68
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.6.1 */
|
|
69
|
+
const TlvNameSupportBitmap = TlvBitmap(TlvUInt8, {
|
|
70
|
+
groupNames: BitFlag(7),
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* The Groups cluster manages, per endpoint, the content of the node-wide Group
|
|
74
|
+
* Table that is part of the underlying interaction layer.
|
|
75
|
+
*
|
|
76
|
+
* @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3
|
|
77
|
+
*/
|
|
78
|
+
export const GroupsCluster = Cluster({
|
|
79
|
+
id: 0x04,
|
|
80
|
+
name: "Groups",
|
|
81
|
+
revision: 4,
|
|
82
|
+
features: {
|
|
83
|
+
/** The ability to store a name for a group. */
|
|
84
|
+
groupNames: BitFlag(0),
|
|
85
|
+
},
|
|
86
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.6 */
|
|
87
|
+
attributes: {
|
|
88
|
+
/**
|
|
89
|
+
* This attribute provides legacy, read-only access to whether the Group
|
|
90
|
+
* Names feature is supported. The most significant bit, bit 7, SHALL be
|
|
91
|
+
* equal to bit 0 of the FeatureMap attribute. All other bits SHALL be 0.
|
|
92
|
+
*
|
|
93
|
+
* TODO because we (will) support group names we need to set bit 7 to 1, rest is 0
|
|
94
|
+
*/
|
|
95
|
+
nameSupport: Attribute(0, TlvNameSupportBitmap, { default: { groupNames: true } }),
|
|
96
|
+
},
|
|
97
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.3.7 */
|
|
98
|
+
commands: {
|
|
99
|
+
/**
|
|
100
|
+
* The AddGroup command allows a client to add group membership in a particular group for the server endpoint.
|
|
101
|
+
*/
|
|
102
|
+
addGroup: Command(0, TlvAddGroupRequest, 0, TlvAddGroupResponse),
|
|
103
|
+
/**
|
|
104
|
+
* The ViewGroup command allows a client to request that the server responds with a ViewGroupResponse command
|
|
105
|
+
* containing the name string for a particular group.
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
viewGroup: Command(1, TlvViewGroupRequest, 0, TlvViewGroupResponse),
|
|
109
|
+
/**
|
|
110
|
+
* The GetGroupMembership command allows a client to inquire about the group membership of the server endpoint,
|
|
111
|
+
* in a number of ways.
|
|
112
|
+
*/
|
|
113
|
+
getGroupMembership: Command(2, TlvGetGroupMembershipRequest, 2, TlvGetGroupMembershipResponse),
|
|
114
|
+
/**
|
|
115
|
+
* The RemoveGroup command allows a client to request that the server removes the membership for the server
|
|
116
|
+
* endpoint, if any, in a particular group.
|
|
117
|
+
*/
|
|
118
|
+
removeGroup: Command(3, TlvRemoveGroupRequest, 3, TlvRemoveGroupResponse),
|
|
119
|
+
/**
|
|
120
|
+
* The RemoveAllGroups command allows a client to direct the server to remove all group associations for the
|
|
121
|
+
* server endpoint.
|
|
122
|
+
*
|
|
123
|
+
* TODO: According to specs the response might be suppressed:
|
|
124
|
+
* If the RemoveAllGroups command was received as unicast and a response is not suppressed, the server
|
|
125
|
+
* SHALL generate a response with the Status field set to SUCCESS.
|
|
126
|
+
* Else potentially no response?
|
|
127
|
+
*
|
|
128
|
+
*/
|
|
129
|
+
removeAllGroups: Command(4, TlvNoArguments, 4, TlvRemoveAllGroupResponse),
|
|
130
|
+
/**
|
|
131
|
+
* The AddGroupIfIdentifying command allows a client to add group membership in a particular group for the
|
|
132
|
+
* server endpoint, on condition that the endpoint is identifying itself.
|
|
133
|
+
*
|
|
134
|
+
*/
|
|
135
|
+
addGroupIfIdentifying: Command(5, TlvAddGroupIfIdentifyingRequest, 5, TlvNoResponse),
|
|
136
|
+
}
|
|
137
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Attribute, WritableAttribute, Cluster, Command, OptionalCommand, TlvNoResponse, TlvNoArguments } from "./Cluster.js";
|
|
7
|
+
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
|
|
8
|
+
import { TlvEnum, TlvUInt16 } from "../tlv/TlvNumber.js";
|
|
9
|
+
import { BitFlag } from "../schema/BitmapSchema.js";
|
|
10
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.2.6.1 */
|
|
11
|
+
const TlvIdentifyRequest = TlvObject({
|
|
12
|
+
identifyTime: TlvField(0, TlvUInt16),
|
|
13
|
+
});
|
|
14
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.2.6.3 */
|
|
15
|
+
const TlvTriggerEffectRequest = TlvObject({
|
|
16
|
+
effectIdentifier: TlvField(0, TlvEnum()),
|
|
17
|
+
effectVariant: TlvField(1, TlvEnum()),
|
|
18
|
+
});
|
|
19
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.2.6.4 */
|
|
20
|
+
const TlvIdentifyQueryResponse = TlvObject({
|
|
21
|
+
timeout: TlvField(0, TlvUInt16),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Attributes and commands for putting a device into Identification mode (e.g. flashing a light).
|
|
25
|
+
*
|
|
26
|
+
* @see {@link MatterApplicationClusterSpecificationV1_0} § 1.2
|
|
27
|
+
*/
|
|
28
|
+
export const IdentifyCluster = Cluster({
|
|
29
|
+
id: 0x03,
|
|
30
|
+
name: "Identify",
|
|
31
|
+
revision: 4,
|
|
32
|
+
features: {
|
|
33
|
+
/** Replies to multicast / groupcast queries if the identification state is active. */
|
|
34
|
+
query: BitFlag(0),
|
|
35
|
+
},
|
|
36
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.2.5 */
|
|
37
|
+
attributes: {
|
|
38
|
+
/** Specifies the remaining length of time, in seconds, that the endpoint will continue to identify itself. */
|
|
39
|
+
identifyTime: WritableAttribute(0, TlvUInt16, { default: 0 }),
|
|
40
|
+
/** Specifies how the identification state is presented to the user. */
|
|
41
|
+
identifyType: Attribute(1, TlvEnum(), { default: 0 }),
|
|
42
|
+
},
|
|
43
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.2.6 */
|
|
44
|
+
commands: {
|
|
45
|
+
/** Starts or stops the receiving device identifying itself. */
|
|
46
|
+
identify: Command(0, TlvIdentifyRequest, 0, TlvNoResponse),
|
|
47
|
+
/** Request the target or targets to respond if they are currently identifying themselves. */
|
|
48
|
+
identifyQuery: Command(1, TlvNoArguments, 0, TlvIdentifyQueryResponse),
|
|
49
|
+
/** Allows the support of feedback to the user, such as a certain light effect when identifying. */
|
|
50
|
+
triggerEffect: OptionalCommand(0x40, TlvTriggerEffectRequest, 0, TlvNoResponse),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Attribute, Cluster, WritableAttribute } from "./Cluster.js";
|
|
7
|
+
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
|
|
8
|
+
import { TlvString } from "../tlv/TlvString.js";
|
|
9
|
+
import { TlvArray } from "../tlv/TlvArray.js";
|
|
10
|
+
/**
|
|
11
|
+
* This is a string tuple with strings that are user defined.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.7.5.1
|
|
14
|
+
*/
|
|
15
|
+
const TlvLabel = TlvObject({
|
|
16
|
+
/** Contains a string as label without a further defined semantic n this base cluster. */
|
|
17
|
+
label: TlvField(0, TlvString.bound({ length: 16 })),
|
|
18
|
+
/** Contains a string as value without a further defined semantic n this base cluster. */
|
|
19
|
+
value: TlvField(1, TlvString.bound({ length: 16 })), /* default: "" */
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* This cluster provides a feature to tag an endpoint with zero or more labels.
|
|
23
|
+
* Derived from LabelCluster ({@link MatterCoreSpecificationV1_0} § 9.7)
|
|
24
|
+
*
|
|
25
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.9
|
|
26
|
+
*/
|
|
27
|
+
export const UserLabelCluster = Cluster({
|
|
28
|
+
id: 0x41,
|
|
29
|
+
name: "User Label",
|
|
30
|
+
revision: 1,
|
|
31
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.9.4 */
|
|
32
|
+
attributes: {
|
|
33
|
+
/** An implementation SHALL support at least 4 list entries per node for all User Label cluster instances on the node. */
|
|
34
|
+
labelList: WritableAttribute(0, TlvArray(TlvLabel), { default: [], writeAcl: 1 /* AccessLevel.Manage */ }), /* non-volatile */
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* This cluster provides a feature for the device to tag an endpoint with zero or more read only labels.
|
|
39
|
+
* Derived from LabelCluster ({@link MatterCoreSpecificationV1_0} § 9.7)
|
|
40
|
+
*
|
|
41
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.8
|
|
42
|
+
*/
|
|
43
|
+
export const FixedLabelCluster = Cluster({
|
|
44
|
+
id: 0x40,
|
|
45
|
+
name: "Fixed Label",
|
|
46
|
+
revision: 1,
|
|
47
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.8.4 */
|
|
48
|
+
attributes: {
|
|
49
|
+
/** List of fixed labels. */
|
|
50
|
+
labelList: Attribute(0, TlvArray(TlvLabel), { default: [] }), /* non-volatile */
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Attribute, Cluster, Command, TlvNoArguments, TlvNoResponse } from "./Cluster.js";
|
|
7
|
+
import { BitFlag } from "../schema/BitmapSchema.js";
|
|
8
|
+
import { TlvBoolean } from "../tlv/TlvBoolean.js";
|
|
9
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.5.7.4.2 */
|
|
10
|
+
// const TlvEffectVariant = TlvUInt8 as TlvSchema<DyingLightEffectVariant | DelayedAllOffEffectVariant>;
|
|
11
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.5.7.4 */
|
|
12
|
+
/* const TlvOffWithEffectRequest = TlvObject({
|
|
13
|
+
effectIdentifier: TlvField(0, TlvEnum<OnOffEffectIdentifier>()),
|
|
14
|
+
effectVariant: TlvField(1, TlvEffectVariant),
|
|
15
|
+
}) as TlvSchema<
|
|
16
|
+
{ effectIdentifier: OnOffEffectIdentifier.DelayedAllOff, effectVariant: DelayedAllOffEffectVariant } |
|
|
17
|
+
{ effectIdentifier: OnOffEffectIdentifier.DyingLight, effectVariant: DyingLightEffectVariant }
|
|
18
|
+
>; */
|
|
19
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.5.7.4.2 */
|
|
20
|
+
/* const TlvOnOffControlBitmap = TlvBitmap(TlvUInt8, {
|
|
21
|
+
acceptOnlyWhenOn: BitFlag(1),
|
|
22
|
+
}) */
|
|
23
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.5.7.6. */
|
|
24
|
+
/* const TlvOnWithTimedOffRequest = TlvObject({
|
|
25
|
+
onOffControl: TlvField(0, TlvOnOffControlBitmap),
|
|
26
|
+
onTime: TlvField(1, TlvNullable(TlvUInt8.bound({ min: 0, max: 254 }))),
|
|
27
|
+
offWaitTime: TlvField(2, TlvNullable(TlvUInt8.bound({ min: 0, max: 254 }))),
|
|
28
|
+
}); */
|
|
29
|
+
/**
|
|
30
|
+
* Attributes and commands for switching devices between 'On' and 'Off' states.
|
|
31
|
+
*
|
|
32
|
+
* @see {@link MatterApplicationClusterSpecificationV1_0} § 1.5
|
|
33
|
+
*/
|
|
34
|
+
export const OnOffCluster = Cluster({
|
|
35
|
+
id: 0x06,
|
|
36
|
+
name: "On/Off",
|
|
37
|
+
revision: 4,
|
|
38
|
+
features: {
|
|
39
|
+
/** Level Control for Lighting - Behavior that supports lighting applications */
|
|
40
|
+
lightingLevelControl: BitFlag(0),
|
|
41
|
+
},
|
|
42
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.5.6 */
|
|
43
|
+
attributes: {
|
|
44
|
+
/** Indicates whether the device type implemented on the endpoint is turned off (false) or turned on (true). */
|
|
45
|
+
onOff: Attribute(0, TlvBoolean, { default: false }), /* reportable: true, scene:true */
|
|
46
|
+
// The following attributes are only needed for "Level Control for Lighting" support
|
|
47
|
+
/** Used to remember if a state is already storednin an old scene to not store one again when sending another Off command */
|
|
48
|
+
//globalSceneControl: OptionalAttribute(0x4000, TlvBoolean, { default: true }),
|
|
49
|
+
/**
|
|
50
|
+
* Specifies the length of time (in 1/10ths second) that the ‘On’ state SHALL be maintained before
|
|
51
|
+
* automatically transitioning to the ‘Off’ state when using the OnWithTimedOff command.
|
|
52
|
+
*/
|
|
53
|
+
//onTime: OptionalWritableAttribute(0x4001, TlvNullable(TlvUInt16)), { default: 0 }), /* unit: 1/10s */
|
|
54
|
+
/**
|
|
55
|
+
* Specifies the length of time (in 1/10ths second) that the ‘Off’ state SHALL be guarded to prevent
|
|
56
|
+
* another OnWithTimedOff command turning the server back to its ‘On’ state
|
|
57
|
+
*/
|
|
58
|
+
//offWaitTime: OptionalWritableAttribute(0x4002, TlvNullable(TlvUInt16), { default: 0 }), /* unit: 1/10s */
|
|
59
|
+
/** Defines the desired startup behavior of a device when it is supplied with power. */
|
|
60
|
+
//startUpOnOff: OptionalWritableAttribute(0x4003, TlvNullable(TlvEnum<StartUpOnOff>()), { writeAcl: AccessLevel.Manage }),
|
|
61
|
+
},
|
|
62
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.5.7 */
|
|
63
|
+
commands: {
|
|
64
|
+
/**
|
|
65
|
+
* On receipt of this command, a device SHALL enter its ‘Off’ state. This state is device dependent, but it is
|
|
66
|
+
* recommended that it is used for power off or similar functions. On receipt of the Off command, the OnTime
|
|
67
|
+
* attribute SHALL be set to 0.
|
|
68
|
+
*/
|
|
69
|
+
off: Command(0, TlvNoArguments, 0, TlvNoResponse),
|
|
70
|
+
/**
|
|
71
|
+
* On receipt of this command, a device SHALL enter its ‘On’ state. This state is device dependent, but it is
|
|
72
|
+
* recommended that it is used for power on or similar functions. On receipt of the On command, if the value
|
|
73
|
+
* of the OnTime attribute is equal to 0, the device SHALL set the OffWaitTime attribute to 0.
|
|
74
|
+
*/
|
|
75
|
+
on: Command(1, TlvNoArguments, 1, TlvNoResponse),
|
|
76
|
+
/**
|
|
77
|
+
* On receipt of this command, if a device is in its ‘Off’ state it SHALL enter its ‘On’ state. Otherwise,
|
|
78
|
+
* if it is in its ‘On’ state it SHALL enter its ‘Off’ state. On receipt of the Toggle command, if the value
|
|
79
|
+
* of the OnOff attribute is equal to FALSE and if the value of the OnTime attribute is equal to 0, the device
|
|
80
|
+
* SHALL set the OffWaitTime attribute to 0. If the value of the OnOff attribute is equal to TRUE, the OnTime
|
|
81
|
+
* attribute SHALL be set to 0.
|
|
82
|
+
*/
|
|
83
|
+
toggle: Command(2, TlvNoArguments, 2, TlvNoResponse),
|
|
84
|
+
// The following attributes are only needed for "Level Control for Lighting" support
|
|
85
|
+
// So we declare them option for now!
|
|
86
|
+
// TODO: Split these out into a separate Cluster Spec that adds "Level Control for Lighting" support
|
|
87
|
+
/**
|
|
88
|
+
* The OffWithEffect command allows devices to be turned off using enhanced ways of fading.
|
|
89
|
+
*/
|
|
90
|
+
//offWithEffect: OptionalCommand(0x40, OffWithEffectRequestT, 0x40, NoResponseT),
|
|
91
|
+
/**
|
|
92
|
+
* The OnWithRecallGlobalScene command allows the recall of the settings when the device was turned off.
|
|
93
|
+
*/
|
|
94
|
+
//onWithRecallGlobalScene: OptionalCommand(0x41, NoArgumentsT, 0x41, NoResponseT),
|
|
95
|
+
/**
|
|
96
|
+
* The OnWithTimedOff command allows devices to be turned on for a specific duration with a guarded off
|
|
97
|
+
* duration so that SHOULD the device be subsequently switched off, further OnWithTimedOff commands, received
|
|
98
|
+
* during this time, are prevented from turning the devices back on.
|
|
99
|
+
*/
|
|
100
|
+
//onWithTimedOff: OptionalCommand(0x42, OnWithTimedOffRequestT, 0x42, NoResponseT),
|
|
101
|
+
},
|
|
102
|
+
});
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvVendorId } from "../common/VendorId.js";
|
|
7
|
+
import { TlvNodeId } from "../common/NodeId.js";
|
|
8
|
+
import { TlvSubjectId } from "../common/SubjectId.js";
|
|
9
|
+
import { TlvFabricId } from "../common/FabricId.js";
|
|
10
|
+
import { TlvFabricIndex } from "../common/FabricIndex.js";
|
|
11
|
+
import { Attribute, Cluster, Command, TlvNoResponse } from "./Cluster.js";
|
|
12
|
+
import { TlvField, TlvObject, TlvOptionalField } from "../tlv/TlvObject.js";
|
|
13
|
+
import { TlvByteString, TlvString, TlvString32max } from "../tlv/TlvString.js";
|
|
14
|
+
import { TlvNullable } from "../tlv/TlvNullable.js";
|
|
15
|
+
import { TlvBoolean } from "../tlv/TlvBoolean.js";
|
|
16
|
+
import { TlvEnum, TlvUInt32, TlvUInt8 } from "../tlv/TlvNumber.js";
|
|
17
|
+
import { TlvArray } from "../tlv/TlvArray.js";
|
|
18
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.5.1 */
|
|
19
|
+
export const RESP_MAX = 900;
|
|
20
|
+
/**
|
|
21
|
+
* Encodes a Fabric Reference for a fabric within which a given Node is currently commissioned.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.17.5.3
|
|
24
|
+
*/
|
|
25
|
+
const TlvFabricDescriptor = TlvObject({
|
|
26
|
+
/** Contains the public key for the trusted root that scopes the fabric referenced by FabricIndex and its associated operational credential. */
|
|
27
|
+
rootPublicKey: TlvField(1, TlvByteString.bound({ length: 65 })),
|
|
28
|
+
/** Contains the value of AdminVendorID provided in the AddNOC command that led to the creation of this FabricDescriptorStruct. */
|
|
29
|
+
vendorId: TlvField(2, TlvVendorId),
|
|
30
|
+
/** Contains the FabricID allocated to the fabric referenced by FabricIndex. */
|
|
31
|
+
fabricID: TlvField(3, TlvFabricId),
|
|
32
|
+
/** Contain the NodeID in use within the fabric referenced by FabricIndex. */
|
|
33
|
+
nodeID: TlvField(4, TlvNodeId),
|
|
34
|
+
/** Contains a commissioner-set label for the fabric referenced by FabricIndex. */
|
|
35
|
+
label: TlvField(5, TlvString.bound({ maxLength: 32 })), /* default: "" */
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Encodes a fabric sensitive NOC chain, underpinning a commissioned Operational Identity for a given Node.
|
|
39
|
+
*
|
|
40
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.17.5.2
|
|
41
|
+
*/
|
|
42
|
+
const TlvNoc = TlvObject({
|
|
43
|
+
/** Contains the NOC for the struct’s associated fabric. */
|
|
44
|
+
noc: TlvField(1, TlvByteString.bound({ maxLength: 400 })),
|
|
45
|
+
/** Contain the ICAC or the struct’s associated fabric. */
|
|
46
|
+
icac: TlvField(2, TlvNullable(TlvByteString.bound({ maxLength: 400 }))), /* default(not present): null */
|
|
47
|
+
});
|
|
48
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.1 */
|
|
49
|
+
const TlvAttestationRequest = TlvObject({
|
|
50
|
+
/** Contains the attestation nonce to be used in the computation of the Attestation Information. */
|
|
51
|
+
attestationNonce: TlvField(0, TlvByteString.bound({ length: 32 })),
|
|
52
|
+
});
|
|
53
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.2 */
|
|
54
|
+
const TlvAttestationResponse = TlvObject({
|
|
55
|
+
/** Contains the octet string of the serialized attestation_elements_message. */
|
|
56
|
+
elements: TlvField(0, TlvByteString.bound({ maxLength: RESP_MAX })),
|
|
57
|
+
/** Contain the octet string of the necessary attestation_signature. */
|
|
58
|
+
signature: TlvField(1, TlvByteString.bound({ length: 64 })),
|
|
59
|
+
});
|
|
60
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.5 */
|
|
61
|
+
const TlvCertSigningRequestRequest = TlvObject({
|
|
62
|
+
/** Contains the CSRNonce to be used in the computation of the NOCSR information. */
|
|
63
|
+
certSigningRequestNonce: TlvField(0, TlvByteString.bound({ length: 32 })),
|
|
64
|
+
/**
|
|
65
|
+
* If set to true, the internal state of the CSR associated keypair SHALL be tagged as being for
|
|
66
|
+
* a subsequent UpdateNOC, otherwise the internal state of the CSR SHALL be tagged as being for a
|
|
67
|
+
* subsequent AddNOC
|
|
68
|
+
* */
|
|
69
|
+
isForUpdateNOC: TlvOptionalField(1, TlvBoolean), /* default: false */
|
|
70
|
+
});
|
|
71
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.6 */
|
|
72
|
+
const TlvCertSigningRequestResponse = TlvObject({
|
|
73
|
+
/** Contains the octet string of the serialized nocsr_elements_message. */
|
|
74
|
+
elements: TlvField(0, TlvByteString.bound({ maxLength: RESP_MAX })),
|
|
75
|
+
/** Contain the octet string of the necessary attestation_signature. */
|
|
76
|
+
signature: TlvField(1, TlvByteString.bound({ length: 64 })),
|
|
77
|
+
});
|
|
78
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.3 */
|
|
79
|
+
const TlvCertChainRequest = TlvObject({
|
|
80
|
+
/** Contains the type of certificate to be requested. */
|
|
81
|
+
type: TlvField(0, TlvEnum()),
|
|
82
|
+
});
|
|
83
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.4 */
|
|
84
|
+
const TlvCertChainResponse = TlvObject({
|
|
85
|
+
/** Contains the octet string of the requested certificate. */
|
|
86
|
+
certificate: TlvField(0, TlvByteString.bound({ maxLength: 600 })),
|
|
87
|
+
});
|
|
88
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.8 */
|
|
89
|
+
const TlvAddNocRequest = TlvObject({
|
|
90
|
+
/** Contains the Node Operational Certificate (NOC) to be added. */
|
|
91
|
+
operationalCert: TlvField(0, TlvByteString.bound({ maxLength: 400 })),
|
|
92
|
+
/** Contains the Intermediate CA Certificate (ICAC). */
|
|
93
|
+
intermediateCaCert: TlvOptionalField(1, TlvByteString.bound({ maxLength: 400 })),
|
|
94
|
+
/** Contains the value of the Epoch Key for the Identity Protection Key (IPK) to set for the Fabric which is to be added. */
|
|
95
|
+
identityProtectionKey: TlvField(2, TlvByteString.bound({ length: 16 })),
|
|
96
|
+
/**
|
|
97
|
+
* Used to atomically add an Access Control Entry enabling that Subject to subsequently administer
|
|
98
|
+
* the Node whose operational identity is being added by this command.
|
|
99
|
+
*/
|
|
100
|
+
caseAdminNode: TlvField(3, TlvSubjectId),
|
|
101
|
+
/** Contains the Vendor ID of the entity issuing the AddNOC command. */
|
|
102
|
+
adminVendorId: TlvField(4, TlvVendorId),
|
|
103
|
+
});
|
|
104
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.9 */
|
|
105
|
+
const TlvUpdateNocRequest = TlvObject({
|
|
106
|
+
/** Contains the Node Operational Certificate (NOC). */
|
|
107
|
+
operationalCert: TlvField(0, TlvByteString.bound({ maxLength: 400 })),
|
|
108
|
+
/** Contains the Intermediate CA Certificate (ICAC). */
|
|
109
|
+
intermediateCaCert: TlvOptionalField(1, TlvByteString.bound({ maxLength: 400 })),
|
|
110
|
+
});
|
|
111
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.13 */
|
|
112
|
+
const TlvAddTrustedRootCertificateRequest = TlvObject({
|
|
113
|
+
/** Contains the Trusted Root Certificate (TRC) to be added. */
|
|
114
|
+
certificate: TlvField(0, TlvByteString.bound({ maxLength: 400 })),
|
|
115
|
+
});
|
|
116
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.10 */
|
|
117
|
+
const TlvOperationalCertificateStatusResponse = TlvObject({
|
|
118
|
+
/** Contains a NOCStatus value representing the status of an operation involving a NOC. */
|
|
119
|
+
status: TlvField(0, TlvEnum()),
|
|
120
|
+
/** When action was successful, contains the Fabric Index of the Fabric last added, removed or updated. */
|
|
121
|
+
fabricIndex: TlvOptionalField(1, TlvFabricIndex),
|
|
122
|
+
/** Optionally contains debugging textual information from the cluster implementation and should be visible in logs, not User UI */
|
|
123
|
+
debugText: TlvOptionalField(2, TlvString.bound({ maxLength: 128 })),
|
|
124
|
+
});
|
|
125
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.5.4 */
|
|
126
|
+
export const TlvAttestation = TlvObject({
|
|
127
|
+
declaration: TlvField(1, TlvByteString),
|
|
128
|
+
attestationNonce: TlvField(2, TlvByteString.bound({ length: 32 })),
|
|
129
|
+
timestamp: TlvField(3, TlvUInt32),
|
|
130
|
+
firmwareInfo: TlvOptionalField(4, TlvByteString),
|
|
131
|
+
});
|
|
132
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.5.6 */
|
|
133
|
+
export const TlvCertSigningRequest = TlvObject({
|
|
134
|
+
certSigningRequest: TlvField(1, TlvByteString),
|
|
135
|
+
certSigningRequestNonce: TlvField(2, TlvByteString.bound({ length: 32 })),
|
|
136
|
+
vendorReserved1: TlvOptionalField(3, TlvByteString),
|
|
137
|
+
vendorReserved2: TlvOptionalField(4, TlvByteString),
|
|
138
|
+
vendorReserved3: TlvOptionalField(5, TlvByteString),
|
|
139
|
+
});
|
|
140
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.11 */
|
|
141
|
+
const TlvUpdateFabricLabelRequest = TlvObject({
|
|
142
|
+
/** Contains the label to set for the fabric associated with the current secure session. */
|
|
143
|
+
label: TlvField(0, TlvString32max),
|
|
144
|
+
});
|
|
145
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7.12 */
|
|
146
|
+
const TlvRemoveFabricRequest = TlvObject({
|
|
147
|
+
/** Contains the Fabric Index reference associated with the Fabric which is to be removed from the device. */
|
|
148
|
+
fabricIndex: TlvField(0, TlvFabricIndex),
|
|
149
|
+
});
|
|
150
|
+
/**
|
|
151
|
+
* This cluster is used to add or remove Operational Credentials on a Commissionee or Node, as well as manage the
|
|
152
|
+
* associated Fabrics.
|
|
153
|
+
*
|
|
154
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.17
|
|
155
|
+
*/
|
|
156
|
+
export const OperationalCredentialsCluster = Cluster({
|
|
157
|
+
id: 0x3e,
|
|
158
|
+
name: "Operational Credentials",
|
|
159
|
+
revision: 1,
|
|
160
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.6 */
|
|
161
|
+
attributes: {
|
|
162
|
+
/** Contains all NOCs applicable to this Node. */
|
|
163
|
+
nocs: Attribute(0, TlvArray(TlvNoc), { readAcl: 2 /* AccessLevel.Administer */ }),
|
|
164
|
+
/** Describes all fabrics to which this Node is commissioned. */
|
|
165
|
+
fabrics: Attribute(1, TlvArray(TlvFabricDescriptor)),
|
|
166
|
+
/** Contains the number of Fabrics that are supported by the device. */
|
|
167
|
+
supportedFabrics: Attribute(2, TlvUInt8.bound({ min: 5, max: 254 })),
|
|
168
|
+
/** Contains the number of Fabrics to which the device is currently commissioned. */
|
|
169
|
+
commissionedFabrics: Attribute(3, TlvUInt8),
|
|
170
|
+
/** Contains a read-only list of Trusted Root CA Certificates installed on the Node. */
|
|
171
|
+
trustedRootCertificates: Attribute(4, TlvArray(TlvByteString, { maxLength: 400 })),
|
|
172
|
+
/** Contain accessing fabric index. */
|
|
173
|
+
currentFabricIndex: Attribute(5, TlvUInt8),
|
|
174
|
+
},
|
|
175
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.17.7 */
|
|
176
|
+
commands: {
|
|
177
|
+
/** Sender is requesting attestation information from the receiver. */
|
|
178
|
+
requestAttestation: Command(0, TlvAttestationRequest, 1, TlvAttestationResponse),
|
|
179
|
+
/** Sender is requesting a device attestation certificate from the receiver. */
|
|
180
|
+
requestCertChain: Command(2, TlvCertChainRequest, 3, TlvCertChainResponse),
|
|
181
|
+
/** Sender is requesting a certificate signing request (CSR) from the receiver. */
|
|
182
|
+
requestCertSigning: Command(4, TlvCertSigningRequestRequest, 5, TlvCertSigningRequestResponse),
|
|
183
|
+
/** Sender is requesting to add the new node operational certificates. */
|
|
184
|
+
addOperationalCert: Command(6, TlvAddNocRequest, 8, TlvOperationalCertificateStatusResponse),
|
|
185
|
+
/** Sender is requesting to update the node operational certificates. */
|
|
186
|
+
updateOperationalCert: Command(7, TlvUpdateNocRequest, 8, TlvOperationalCertificateStatusResponse),
|
|
187
|
+
/**
|
|
188
|
+
* This command SHALL be used by an Administrative Node to set the user-visible Label field for a given
|
|
189
|
+
* Fabric, as reflected by entries in the Fabrics attribute.
|
|
190
|
+
*/
|
|
191
|
+
updateFabricLabel: Command(9, TlvUpdateFabricLabelRequest, 8, TlvOperationalCertificateStatusResponse),
|
|
192
|
+
/**
|
|
193
|
+
* This command is used by Administrative Nodes to remove a given fabric index and delete all associated
|
|
194
|
+
* fabric-scoped data.
|
|
195
|
+
*/
|
|
196
|
+
removeFabric: Command(10, TlvRemoveFabricRequest, 8, TlvOperationalCertificateStatusResponse),
|
|
197
|
+
/**
|
|
198
|
+
* This command SHALL add a Trusted Root CA Certificate, provided as its CHIP Certificate representation.
|
|
199
|
+
*/
|
|
200
|
+
addRootCert: Command(11, TlvAddTrustedRootCertificateRequest, 11, TlvNoResponse),
|
|
201
|
+
},
|
|
202
|
+
});
|