@project-chip/matter.js 0.0.2 → 0.2.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 → dist/cjs}/tlv/TlvObject.js +6 -2
- package/{dist-cjs → dist/cjs}/util/ByteArray.js +2 -0
- package/{dist-cjs → dist/cjs}/util/Type.js +3 -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/{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/{tlv → es/tlv}/TlvObject.js +6 -2
- package/dist/{util → es/util}/ByteArray.js +2 -0
- package/dist/{util → es/util}/Type.js +1 -1
- package/package.json +7 -8
- package/dist/schema/BitmapSchema.js +0 -48
- package/dist-cjs/schema/BitmapSchema.js +0 -55
- /package/{dist-cjs → dist/cjs}/schema/Schema.js +0 -0
- /package/{dist-cjs → dist/cjs}/spec/Specifications.js +0 -0
- /package/{dist-cjs → dist/cjs}/tlv/TlvAny.js +0 -0
- /package/{dist-cjs → dist/cjs}/tlv/TlvArray.js +0 -0
- /package/{dist-cjs → dist/cjs}/tlv/TlvBoolean.js +0 -0
- /package/{dist-cjs → dist/cjs}/tlv/TlvCodec.js +0 -0
- /package/{dist-cjs → dist/cjs}/tlv/TlvNullable.js +0 -0
- /package/{dist-cjs → dist/cjs}/tlv/TlvNumber.js +0 -0
- /package/{dist-cjs → dist/cjs}/tlv/TlvSchema.js +0 -0
- /package/{dist-cjs → dist/cjs}/tlv/TlvString.js +0 -0
- /package/{dist-cjs → dist/cjs}/tlv/TlvVoid.js +0 -0
- /package/{dist-cjs → dist/cjs}/tlv/TlvWrapper.js +0 -0
- /package/{dist-cjs → dist/cjs}/util/DataReader.js +0 -0
- /package/{dist-cjs → dist/cjs}/util/DataWriter.js +0 -0
- /package/{dist-cjs → dist/cjs}/util/Number.js +0 -0
- /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/{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}/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}/DataReader.js +0 -0
- /package/dist/{util → es/util}/DataWriter.js +0 -0
- /package/dist/{util → es/util}/Number.js +0 -0
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Attribute, OptionalAttribute, Cluster, Command, OptionalCommand, TlvNoResponse } from "./Cluster.js";
|
|
7
|
+
import { TlvGroupId } from "../common/GroupId.js";
|
|
8
|
+
import { TlvClusterId } from "../common/ClusterId.js";
|
|
9
|
+
import { TlvNodeId } from "../common/NodeId.js";
|
|
10
|
+
import { TlvAttributeId } from "../common/AttributeId.js";
|
|
11
|
+
import { TlvField, TlvObject, TlvOptionalField } from "../tlv/TlvObject.js";
|
|
12
|
+
import { TlvArray } from "../tlv/TlvArray.js";
|
|
13
|
+
import { TlvAny } from "../tlv/TlvAny.js";
|
|
14
|
+
import { TlvBitmap, TlvEnum, TlvUInt16, TlvUInt8 } from "../tlv/TlvNumber.js";
|
|
15
|
+
import { TlvString } from "../tlv/TlvString.js";
|
|
16
|
+
import { TlvNullable } from "../tlv/TlvNullable.js";
|
|
17
|
+
import { BitFlag } from "../schema/BitmapSchema.js";
|
|
18
|
+
import { TlvBoolean } from "../tlv/TlvBoolean.js";
|
|
19
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.6.1 */
|
|
20
|
+
const TlvAttributeValuePair = TlvObject({
|
|
21
|
+
/**
|
|
22
|
+
* This field SHALL be present or not present, for all instances in the Scenes cluster. If this field is
|
|
23
|
+
* not present, then the data type of AttributeValue SHALL be determined by the order and data type defined
|
|
24
|
+
* in the cluster specification. Otherwise the data type of AttributeValue SHALL be the data type of the
|
|
25
|
+
* attribute indicated by AttributeID.
|
|
26
|
+
*/
|
|
27
|
+
attributeId: TlvField(0, TlvAttributeId),
|
|
28
|
+
/** This is the attribute value as part of an extension field set. */
|
|
29
|
+
attributeValue: TlvField(1, TlvArray(TlvAny)),
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* This data type indicates for a given cluster a set of attributes and their values. Only attributes which
|
|
33
|
+
* have the "S" designation in the Quality column of the cluster specification SHALL be used in the
|
|
34
|
+
* AttributeValueList field.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.6.2
|
|
37
|
+
*/
|
|
38
|
+
export const TlvExtensionFieldSet = TlvObject({
|
|
39
|
+
clusterId: TlvField(0, TlvClusterId),
|
|
40
|
+
attributeValueList: TlvField(1, TlvArray(TlvAttributeValuePair)),
|
|
41
|
+
});
|
|
42
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.2 and 1.4.9.9 */
|
|
43
|
+
const TlvAddSceneRequest = TlvObject({
|
|
44
|
+
groupId: TlvField(0, TlvGroupId),
|
|
45
|
+
sceneId: TlvField(1, TlvUInt8),
|
|
46
|
+
transitionTime: TlvField(2, TlvUInt16),
|
|
47
|
+
sceneName: TlvField(3, TlvString.bound({ maxLength: 16 })),
|
|
48
|
+
extensionFieldSets: TlvField(4, TlvArray(TlvExtensionFieldSet)),
|
|
49
|
+
});
|
|
50
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.3 and § 1.4.9.10 */
|
|
51
|
+
const TlvViewSceneRequest = TlvObject({
|
|
52
|
+
groupId: TlvField(0, TlvGroupId),
|
|
53
|
+
sceneId: TlvField(1, TlvUInt8),
|
|
54
|
+
});
|
|
55
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.4 */
|
|
56
|
+
const TlvRemoveSceneRequest = TlvObject({
|
|
57
|
+
groupId: TlvField(0, TlvGroupId),
|
|
58
|
+
sceneId: TlvField(1, TlvUInt8),
|
|
59
|
+
});
|
|
60
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.5 */
|
|
61
|
+
const TlvRemoveAllScenesRequest = TlvObject({
|
|
62
|
+
groupId: TlvField(0, TlvGroupId),
|
|
63
|
+
});
|
|
64
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.6 */
|
|
65
|
+
const TlvStoreSceneRequest = TlvObject({
|
|
66
|
+
groupId: TlvField(0, TlvGroupId),
|
|
67
|
+
sceneId: TlvField(1, TlvUInt8),
|
|
68
|
+
});
|
|
69
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.7 */
|
|
70
|
+
const TlvRecallSceneRequest = TlvObject({
|
|
71
|
+
groupId: TlvField(0, TlvGroupId),
|
|
72
|
+
sceneId: TlvField(1, TlvUInt8),
|
|
73
|
+
transitionTime: TlvOptionalField(2, TlvNullable(TlvUInt16)),
|
|
74
|
+
});
|
|
75
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.8 */
|
|
76
|
+
const TlvGetSceneMembershipRequest = TlvObject({
|
|
77
|
+
groupId: TlvField(0, TlvGroupId),
|
|
78
|
+
});
|
|
79
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.11.1 */
|
|
80
|
+
const TlvScenesCopyMode = TlvBitmap(TlvUInt8, {
|
|
81
|
+
copyAllScenes: BitFlag(0),
|
|
82
|
+
});
|
|
83
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.11 */
|
|
84
|
+
const TlvCopySceneRequest = TlvObject({
|
|
85
|
+
/** Contains information of how the scene copy is to proceed. Bitmap: see 1.4.9.11.1 */
|
|
86
|
+
mode: TlvField(0, TlvScenesCopyMode),
|
|
87
|
+
/** Specifies the identifier of the group from which the scene is to be copied. */
|
|
88
|
+
groupIdFrom: TlvField(1, TlvGroupId),
|
|
89
|
+
/** Specifies the identifier of the scene from which the scene is to be copied. */
|
|
90
|
+
sceneIdFrom: TlvField(2, TlvUInt8),
|
|
91
|
+
/** Specifies the identifier of the group to which the scene is to be copied. */
|
|
92
|
+
TlvGroupIdo: TlvField(3, TlvGroupId),
|
|
93
|
+
/** Specifies the identifier of the scene to which the scene is to be copied. */
|
|
94
|
+
sceneIdTo: TlvField(4, TlvUInt8),
|
|
95
|
+
});
|
|
96
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.12 and § 1.4.9.18 */
|
|
97
|
+
const TlvAddSceneResponse = TlvObject({
|
|
98
|
+
status: TlvField(0, TlvEnum()),
|
|
99
|
+
groupId: TlvField(1, TlvGroupId),
|
|
100
|
+
sceneId: TlvField(2, TlvUInt8),
|
|
101
|
+
});
|
|
102
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.13 and § 1.4.9.19 */
|
|
103
|
+
const TlvViewSceneResponse = TlvObject({
|
|
104
|
+
status: TlvField(0, TlvEnum()),
|
|
105
|
+
groupId: TlvField(1, TlvGroupId),
|
|
106
|
+
sceneId: TlvField(2, TlvUInt8),
|
|
107
|
+
transitionTime: TlvOptionalField(3, TlvUInt16),
|
|
108
|
+
sceneName: TlvOptionalField(4, TlvString.bound({ maxLength: 16 })),
|
|
109
|
+
extensionFieldSets: TlvOptionalField(5, TlvArray(TlvExtensionFieldSet)),
|
|
110
|
+
});
|
|
111
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.14 */
|
|
112
|
+
const TlvRemoveSceneResponse = TlvObject({
|
|
113
|
+
status: TlvField(0, TlvEnum()),
|
|
114
|
+
groupId: TlvField(1, TlvGroupId),
|
|
115
|
+
sceneId: TlvField(2, TlvUInt8),
|
|
116
|
+
});
|
|
117
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.15 */
|
|
118
|
+
const TlvRemoveAllScenesResponse = TlvObject({
|
|
119
|
+
status: TlvField(0, TlvEnum()),
|
|
120
|
+
groupId: TlvField(1, TlvGroupId),
|
|
121
|
+
});
|
|
122
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.16 */
|
|
123
|
+
const TlvStoreSceneResponse = TlvObject({
|
|
124
|
+
status: TlvField(0, TlvEnum()),
|
|
125
|
+
groupId: TlvField(1, TlvGroupId),
|
|
126
|
+
sceneId: TlvField(2, TlvUInt8),
|
|
127
|
+
});
|
|
128
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.17 */
|
|
129
|
+
const TlvGetSceneMembershipResponse = TlvObject({
|
|
130
|
+
status: TlvField(0, TlvEnum()),
|
|
131
|
+
capacity: TlvField(1, TlvNullable(TlvUInt8)),
|
|
132
|
+
groupId: TlvField(2, TlvGroupId),
|
|
133
|
+
sceneList: TlvOptionalField(3, TlvArray(TlvUInt8)),
|
|
134
|
+
});
|
|
135
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9.20 */
|
|
136
|
+
const TlvCopySceneResponse = TlvObject({
|
|
137
|
+
/** Contains the status of the copy scene attempt. */
|
|
138
|
+
status: TlvField(0, TlvEnum()),
|
|
139
|
+
/** Specifies the identifier of the group from which the scene was copied. */
|
|
140
|
+
groupIdFrom: TlvField(1, TlvGroupId),
|
|
141
|
+
/** Specifies the identifier of the scene from which the scene was copied. */
|
|
142
|
+
sceneIdFrom: TlvField(2, TlvUInt8),
|
|
143
|
+
});
|
|
144
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.7.5 */
|
|
145
|
+
const TlvNameSupportBitmap = TlvBitmap(TlvUInt8, {
|
|
146
|
+
sceneNames: BitFlag(7),
|
|
147
|
+
});
|
|
148
|
+
/**
|
|
149
|
+
* The Scenes cluster provides attributes and commands for setting up and recalling scenes.
|
|
150
|
+
* Each scene corresponds to a set of stored values of specified attributes for one or more
|
|
151
|
+
* clusters on the same end point as the Scenes cluster.
|
|
152
|
+
*
|
|
153
|
+
* @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4
|
|
154
|
+
*/
|
|
155
|
+
export const ScenesCluster = Cluster({
|
|
156
|
+
id: 0x05,
|
|
157
|
+
name: "Scenes",
|
|
158
|
+
revision: 4,
|
|
159
|
+
features: {
|
|
160
|
+
/** The ability to store a name for a scene. */
|
|
161
|
+
sceneNames: BitFlag(0),
|
|
162
|
+
},
|
|
163
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.7 */
|
|
164
|
+
attributes: {
|
|
165
|
+
/** Specifies the number of scenes currently in the server’s Scene Table. */
|
|
166
|
+
sceneCount: Attribute(0, TlvUInt8, { default: 0 }),
|
|
167
|
+
/** Holds the scene identifier of the scene last invoked. */
|
|
168
|
+
currentScene: Attribute(1, TlvUInt8, { default: 0 }),
|
|
169
|
+
/** Holds the group identifier of the scene last invoked, or 0 if the scene last invoked is not associated with a group. */
|
|
170
|
+
currentGroup: Attribute(2, TlvUInt16.bound({ min: 0, max: 0xfff7 }), { default: 0 }),
|
|
171
|
+
/** Indicates whether the state of the server corresponds to that associated with the CurrentScene and CurrentGroup attributes. */
|
|
172
|
+
sceneValid: Attribute(3, TlvBoolean, { default: false }),
|
|
173
|
+
/**
|
|
174
|
+
* This attribute provides legacy, read-only access to whether the Scene
|
|
175
|
+
* Names feature is supported. The most significant bit, bit 7, SHALL be
|
|
176
|
+
* equal to bit 0 of the FeatureMap attribute. All other bits SHALL be 0.
|
|
177
|
+
*
|
|
178
|
+
* TODO because we (will) support group names we need to set bit 7 to 1, rest is 0
|
|
179
|
+
*/
|
|
180
|
+
nameSupport: Attribute(4, TlvNameSupportBitmap, { default: { sceneNames: true } }),
|
|
181
|
+
/** Holds the Node ID (the IEEE address in case of Zigbee) of the node that last configured the Scene Table. */
|
|
182
|
+
lastConfiguredBy: OptionalAttribute(5, TlvNullable(TlvNodeId)),
|
|
183
|
+
},
|
|
184
|
+
/** @see {@link MatterApplicationClusterSpecificationV1_0} § 1.4.9 */
|
|
185
|
+
commands: {
|
|
186
|
+
/**
|
|
187
|
+
* Add a scene to the scene table.
|
|
188
|
+
* Extension field sets are supported, and are inputed as
|
|
189
|
+
* '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}'
|
|
190
|
+
*/
|
|
191
|
+
addScene: Command(0, TlvAddSceneRequest, 0, TlvAddSceneResponse),
|
|
192
|
+
/**
|
|
193
|
+
* Retrieves the requested scene entry from its Scene table.
|
|
194
|
+
*/
|
|
195
|
+
viewScene: Command(1, TlvViewSceneRequest, 1, TlvViewSceneResponse),
|
|
196
|
+
/**
|
|
197
|
+
* Removes the requested scene entry, corresponding to the value of the GroupID field, from its Scene Table
|
|
198
|
+
*/
|
|
199
|
+
removeScene: Command(2, TlvRemoveSceneRequest, 2, TlvRemoveSceneResponse),
|
|
200
|
+
/**
|
|
201
|
+
* Remove all scenes, corresponding to the value of the GroupID field, from its Scene Table
|
|
202
|
+
*/
|
|
203
|
+
removeAllScenes: Command(3, TlvRemoveAllScenesRequest, 3, TlvRemoveAllScenesResponse),
|
|
204
|
+
/**
|
|
205
|
+
* Adds the scene entry into its Scene Table along with all extension field sets corresponding to the current
|
|
206
|
+
* state of other clusters on the same endpoint
|
|
207
|
+
*/
|
|
208
|
+
storeScenes: Command(4, TlvStoreSceneRequest, 4, TlvStoreSceneResponse),
|
|
209
|
+
/**
|
|
210
|
+
* Set the attributes and corresponding state for each other cluster implemented on the endpoint accordingly to
|
|
211
|
+
* the requested scene entry in the Scene Table
|
|
212
|
+
*/
|
|
213
|
+
recallScene: Command(5, TlvRecallSceneRequest, 5, TlvNoResponse),
|
|
214
|
+
/**
|
|
215
|
+
* Get an unused scene identifier when no commissioning tool is in the network, or for a commissioning tool to
|
|
216
|
+
* get the used scene identifiers within a certain group
|
|
217
|
+
*/
|
|
218
|
+
getSceneMembership: Command(6, TlvGetSceneMembershipRequest, 6, TlvGetSceneMembershipResponse),
|
|
219
|
+
/**
|
|
220
|
+
* Allows a scene to be added using a finer scene transition time than the AddScene command.
|
|
221
|
+
*/
|
|
222
|
+
enhancedAddScene: OptionalCommand(0x40, TlvAddSceneRequest, 0x40, TlvAddSceneResponse),
|
|
223
|
+
/**
|
|
224
|
+
* Allows a scene to be retrieved using a finer scene transition time than the ViewScene command
|
|
225
|
+
*/
|
|
226
|
+
enhancedViewScene: OptionalCommand(0x41, TlvViewSceneRequest, 0x41, TlvViewSceneResponse),
|
|
227
|
+
/**
|
|
228
|
+
* Allows a client to efficiently copy scenes from one group/scene identifier pair to another group/scene
|
|
229
|
+
* identifier pair.
|
|
230
|
+
*/
|
|
231
|
+
copyScene: OptionalCommand(0x42, TlvCopySceneRequest, 0x42, TlvCopySceneResponse),
|
|
232
|
+
},
|
|
233
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvUInt32 } from "../tlv/TlvNumber.js";
|
|
7
|
+
import { TlvWrapper } from "../tlv/TlvWrapper.js";
|
|
8
|
+
/**
|
|
9
|
+
* An Attribute ID is a 32 bit number and indicates an attribute defined in a cluster specification.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link MatterCoreSpecificationV1_0} § 7.18.2.15
|
|
12
|
+
*/
|
|
13
|
+
export class AttributeId {
|
|
14
|
+
constructor(id) {
|
|
15
|
+
this.id = id;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Tlv schema for an Attribute Id. */
|
|
19
|
+
export const TlvAttributeId = new TlvWrapper(TlvUInt32, attributeId => attributeId.id, value => new AttributeId(value));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvUInt32 } from "../tlv/TlvNumber.js";
|
|
7
|
+
import { TlvWrapper } from "../tlv/TlvWrapper.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Cluster Identifier is a 32 bit number and SHALL reference a single cluster specification and
|
|
10
|
+
* SHALL define conformance to that specification.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link MatterCoreSpecificationV1_0} § 7.10
|
|
13
|
+
*/
|
|
14
|
+
export class ClusterId {
|
|
15
|
+
constructor(id) {
|
|
16
|
+
this.id = id;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** Tlv schema for a cluster Id. */
|
|
20
|
+
export const TlvClusterId = new TlvWrapper(TlvUInt32, clusterId => clusterId.id, value => new ClusterId(value));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvUInt32 } from "../tlv/TlvNumber.js";
|
|
7
|
+
import { TlvWrapper } from "../tlv/TlvWrapper.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Device type ID is a 32-bit number that defines the type of the device.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link MatterCoreSpecificationV1_0} § 7.15
|
|
12
|
+
*/
|
|
13
|
+
export class DeviceTypeId {
|
|
14
|
+
constructor(id) {
|
|
15
|
+
this.id = id;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Tlv schema for a Device type ID. */
|
|
19
|
+
export const TlvDeviceTypeId = new TlvWrapper(TlvUInt32, deviceTypeId => deviceTypeId.id, value => new DeviceTypeId(value));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvUInt16 } from "../tlv/TlvNumber.js";
|
|
7
|
+
import { TlvWrapper } from "../tlv/TlvWrapper.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Endpoint Number is a 16-bit number that that indicates an instance of a device type.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link MatterCoreSpecificationV1_0} § 7.18.2.11
|
|
12
|
+
*/
|
|
13
|
+
export class EndpointNumber {
|
|
14
|
+
constructor(number) {
|
|
15
|
+
this.number = number;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Tlv schema for an Endpoint number. */
|
|
19
|
+
export const TlvEndpointNumber = new TlvWrapper(TlvUInt16, endpointNumber => endpointNumber.number, value => new EndpointNumber(value));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvUInt64 } from "../tlv/TlvNumber.js";
|
|
7
|
+
import { TlvWrapper } from "../tlv/TlvWrapper.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Fabric ID is a 64-bit number that uniquely identifies the Fabric within the scope of
|
|
10
|
+
* a particular root CA.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link MatterCoreSpecificationV1_0} § 2.5.1
|
|
13
|
+
*/
|
|
14
|
+
export class FabricId {
|
|
15
|
+
constructor(id) {
|
|
16
|
+
this.id = id;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/** Tlv schema for a Node Identifier. */
|
|
20
|
+
export const TlvFabricId = new TlvWrapper(TlvUInt64, fabricId => fabricId.id, value => new FabricId(BigInt(value)));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvUInt8 } from "../tlv/TlvNumber.js";
|
|
7
|
+
import { TlvWrapper } from "../tlv/TlvWrapper.js";
|
|
8
|
+
/**
|
|
9
|
+
* Each fabric supported on a node is referenced by fabric-index that is unique on the node. This
|
|
10
|
+
* fabric-index enables the look-up of the full fabric information from the fabric-index. A fabric-index
|
|
11
|
+
* of 0 (zero) or null SHALL indicate that there is no fabric associated with the context in which the
|
|
12
|
+
* fabric-index is being used. If fabric-index is used in a context that is exclusively associated with
|
|
13
|
+
* a fabric, such as fabric-scoped data model elements, then the fabric-index values SHALL NOT include 0
|
|
14
|
+
* (zero) or null.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link MatterCoreSpecificationV1_0} § 7.5.2
|
|
17
|
+
*/
|
|
18
|
+
export class FabricIndex {
|
|
19
|
+
constructor(index) {
|
|
20
|
+
this.index = index;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Tlv Schema for a Fabric Index. */
|
|
24
|
+
export const TlvFabricIndex = new TlvWrapper(TlvUInt8.bound({ min: 1, max: 254 }), farbricIndex => farbricIndex.index, value => new FabricIndex(value));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvUInt16 } from "../tlv/TlvNumber.js";
|
|
7
|
+
import { TlvWrapper } from "../tlv/TlvWrapper.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Group Identifier (Group ID or GID) is a 16-bit number that identifies a set of Nodes across a
|
|
10
|
+
* Fabric at the message layer (see Section 4.15, “Group Key Management”). A Group ID can further
|
|
11
|
+
* be bound to one or more Endpoints within each Node in the group at the interaction layer.
|
|
12
|
+
*
|
|
13
|
+
* The Group ID space is allocated as described in Table 2, “Group ID Allocations”:
|
|
14
|
+
* 0x0000 - Null or unspecified Group ID
|
|
15
|
+
* 0x0001 - 0xFEFF: Application Group ID, assigned by fabric Administrator
|
|
16
|
+
* 0xFF00 - 0xFFFF: Universal Group ID range reserved for static multicast and anycast identifiers
|
|
17
|
+
*
|
|
18
|
+
* @see {@link MatterCoreSpecificationV1_0} § 2.5.4
|
|
19
|
+
*/
|
|
20
|
+
export class GroupId {
|
|
21
|
+
constructor(id) {
|
|
22
|
+
this.id = id;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Tlv Schema for a Group Id. */
|
|
26
|
+
export const TlvGroupId = new TlvWrapper(TlvUInt16, groupId => groupId.id, value => new GroupId(value));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvUInt64 } from "../tlv/TlvNumber.js";
|
|
7
|
+
import { TlvWrapper } from "../tlv/TlvWrapper.js";
|
|
8
|
+
import { Endian } from "../util/ByteArray.js";
|
|
9
|
+
import { DataWriter } from "../util/DataWriter.js";
|
|
10
|
+
/**
|
|
11
|
+
* A Node Identifier (Node ID) is a 64-bit number that uniquely identifies an individual Node or a
|
|
12
|
+
* group of Nodes on a Fabric.
|
|
13
|
+
*
|
|
14
|
+
* @see {@link MatterCoreSpecificationV1_0} § 2.5.5
|
|
15
|
+
*/
|
|
16
|
+
export class NodeId {
|
|
17
|
+
constructor(id) {
|
|
18
|
+
this.id = id;
|
|
19
|
+
}
|
|
20
|
+
toString() {
|
|
21
|
+
const writer = new DataWriter(Endian.Big);
|
|
22
|
+
writer.writeUInt64(this.id);
|
|
23
|
+
return writer.toByteArray().toHex().toUpperCase();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** Tlv schema for a Node Identifier. */
|
|
27
|
+
export const TlvNodeId = new TlvWrapper(TlvUInt64, nodeId => nodeId.id, value => new NodeId(BigInt(value)));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvUInt16 } from "../tlv/TlvNumber.js";
|
|
7
|
+
import { TlvWrapper } from "../tlv/TlvWrapper.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Vendor Identifier (Vendor ID or VID) is a 16-bit number that uniquely identifies a particular
|
|
10
|
+
* product manufacturer, vendor, or group thereof. Each Vendor ID is statically allocated by the
|
|
11
|
+
* Connectivity Standards Alliance (see [CSA Manufacturer Code Database]).
|
|
12
|
+
*
|
|
13
|
+
* @see {@link MatterCoreSpecificationV1_0} § 2.5.2
|
|
14
|
+
*/
|
|
15
|
+
export class VendorId {
|
|
16
|
+
constructor(id) {
|
|
17
|
+
this.id = id;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** Data model for a Vendor Identifier. */
|
|
21
|
+
export const TlvVendorId = new TlvWrapper(TlvUInt16, vendorId => vendorId.id, value => new VendorId(value));
|
|
@@ -20,3 +20,15 @@ export * from "./tlv/TlvString.js";
|
|
|
20
20
|
export * from "./tlv/TlvNumber.js";
|
|
21
21
|
export * from "./tlv/TlvVoid.js";
|
|
22
22
|
export * from "./tlv/TlvWrapper.js";
|
|
23
|
+
export * from "./cluster/AccessControlCluster.js";
|
|
24
|
+
export * from "./cluster/BasicInformationCluster.js";
|
|
25
|
+
export * from "./cluster/BindingCluster.js";
|
|
26
|
+
export * from "./cluster/BridgedDeviceBasicInformationCluster.js";
|
|
27
|
+
export * from "./cluster/DescriptorCluster.js";
|
|
28
|
+
export * from "./cluster/GeneralCommissioningCluster.js";
|
|
29
|
+
export * from "./cluster/GroupsCluster.js";
|
|
30
|
+
export * from "./cluster/IdentifyCluster.js";
|
|
31
|
+
export * from "./cluster/LabelCluster.js";
|
|
32
|
+
export * from "./cluster/OnOffCluster.js";
|
|
33
|
+
export * from "./cluster/OperationalCredentialsCluster.js";
|
|
34
|
+
export * from "./cluster/ScenesCluster.js";
|