@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
package/README.md
CHANGED
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
Implementation of Matter protocol in typescript with no native dependencies (and very limited dependencies).
|
|
6
6
|
|
|
7
|
+
## Current status
|
|
8
|
+
|
|
9
|
+
This is work in progress.
|
|
10
|
+
|
|
11
|
+
Completed implementations:
|
|
12
|
+
- [X] TLV codec (coder/decoder) and schema mapping and validation engine
|
|
13
|
+
- [X] 12 cluster definitions (including TLV structures for all messages)
|
|
14
|
+
|
|
15
|
+
## matter.js usage
|
|
16
|
+
|
|
17
|
+
matter.js is used at the core of those two projects:
|
|
18
|
+
* [matternode](https://github.com/project-chip/matternode): a light-weight node.js implementation of a Matter Node
|
|
19
|
+
* [node-matter](https://github.com/mfucci/node-matter): a Matter client / server running on node.js compatible with HA (Android / iOs support in progress)
|
|
20
|
+
|
|
7
21
|
## Tests
|
|
8
22
|
|
|
9
23
|
Run tests in node.js: npm run test
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2022 Project CHIP Authors
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.AccessControlCluster = void 0;
|
|
9
|
+
const Cluster_js_1 = require("./Cluster.js");
|
|
10
|
+
const ClusterId_js_1 = require("../common/ClusterId.js");
|
|
11
|
+
const EndpointNumber_js_1 = require("../common/EndpointNumber.js");
|
|
12
|
+
const DeviceTypeId_js_1 = require("../common/DeviceTypeId.js");
|
|
13
|
+
const NodeId_js_1 = require("../common/NodeId.js");
|
|
14
|
+
const SubjectId_js_1 = require("../common/SubjectId.js");
|
|
15
|
+
const TlvObject_js_1 = require("../tlv/TlvObject.js");
|
|
16
|
+
const TlvNullable_js_1 = require("../tlv/TlvNullable.js");
|
|
17
|
+
const TlvNumber_js_1 = require("../tlv/TlvNumber.js");
|
|
18
|
+
const TlvArray_js_1 = require("../tlv/TlvArray.js");
|
|
19
|
+
const TlvString_js_1 = require("../tlv/TlvString.js");
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* Defines the clusters on this Node to which this Access Control Entry grants access.
|
|
23
|
+
*
|
|
24
|
+
* A single target SHALL contain at least one field (Cluster, Endpoint, or DeviceType), and SHALL NOT
|
|
25
|
+
* contain both an Endpoint field and a DeviceType field.
|
|
26
|
+
*
|
|
27
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.10.5.3
|
|
28
|
+
*/
|
|
29
|
+
const TlvTarget = (0, TlvObject_js_1.TlvObject)({
|
|
30
|
+
/** Cluster to grant access on. */
|
|
31
|
+
cluster: (0, TlvObject_js_1.TlvField)(0, (0, TlvNullable_js_1.TlvNullable)(ClusterId_js_1.TlvClusterId)),
|
|
32
|
+
/** Endpoint to grant access on. */
|
|
33
|
+
endpoint: (0, TlvObject_js_1.TlvField)(1, (0, TlvNullable_js_1.TlvNullable)(EndpointNumber_js_1.TlvEndpointNumber)),
|
|
34
|
+
/** Device type to grant access on. */
|
|
35
|
+
deviceType: (0, TlvObject_js_1.TlvField)(1, (0, TlvNullable_js_1.TlvNullable)(DeviceTypeId_js_1.TlvDeviceTypeId)),
|
|
36
|
+
});
|
|
37
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.10.5.3 */
|
|
38
|
+
const TlvAccessControlEntry = (0, TlvObject_js_1.TlvObject)({
|
|
39
|
+
/** Specifies the level of privilege granted by this Access Control Entry. */
|
|
40
|
+
privilege: (0, TlvObject_js_1.TlvField)(1, (0, TlvNumber_js_1.TlvEnum)()),
|
|
41
|
+
/** Specifies the authentication mode required by this Access Control Entry. */
|
|
42
|
+
authMode: (0, TlvObject_js_1.TlvField)(2, (0, TlvNumber_js_1.TlvEnum)()),
|
|
43
|
+
/** Specifies a list of Subject IDs, to which this Access Control Entry grants access. */
|
|
44
|
+
subjects: (0, TlvObject_js_1.TlvField)(3, (0, TlvNullable_js_1.TlvNullable)((0, TlvArray_js_1.TlvArray)(SubjectId_js_1.TlvSubjectId))),
|
|
45
|
+
/** Specifies a list of TargetStruct, which define the clusters on this Node to which this Access Control Entry grants access. */
|
|
46
|
+
targets: (0, TlvObject_js_1.TlvField)(4, (0, TlvNullable_js_1.TlvNullable)((0, TlvArray_js_1.TlvArray)(TlvTarget))), /* maxArrayLength: targetsPerAccessControlEntry */
|
|
47
|
+
});
|
|
48
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.10.5.4 */
|
|
49
|
+
const TlvAccessControlExtensionEntry = (0, TlvObject_js_1.TlvObject)({
|
|
50
|
+
/** Used by manufacturers to store arbitrary TLV-encoded data related to a fabric’s Access Control Entries. */
|
|
51
|
+
data: (0, TlvObject_js_1.TlvField)(1, TlvString_js_1.TlvByteString.bound({ maxLength: 128 })),
|
|
52
|
+
});
|
|
53
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.10.7.1 */
|
|
54
|
+
const AccessChangeEvent = (entrySchema) => ({
|
|
55
|
+
/** The Node ID of the Administrator that made the change, if the change occurred via a CASE session. */
|
|
56
|
+
adminNodeID: (0, TlvObject_js_1.TlvField)(1, (0, TlvNullable_js_1.TlvNullable)(NodeId_js_1.TlvNodeId)),
|
|
57
|
+
/** The Passcode ID of the Administrator that made the change, if the change occurred via a PASE session. */
|
|
58
|
+
adminPasscodeID: (0, TlvObject_js_1.TlvField)(2, (0, TlvNullable_js_1.TlvNullable)(TlvNumber_js_1.TlvUInt16)),
|
|
59
|
+
/** The type of change as appropriate. */
|
|
60
|
+
changeType: (0, TlvObject_js_1.TlvField)(3, (0, TlvNumber_js_1.TlvEnum)()),
|
|
61
|
+
/** The latest value of the changed entry. */
|
|
62
|
+
latestValue: (0, TlvObject_js_1.TlvField)(4, (0, TlvNullable_js_1.TlvNullable)(entrySchema)),
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* The Access Control Cluster exposes a data model view of a Node’s Access Control List (ACL),
|
|
66
|
+
* which codifies the rules used to manage and enforce Access Control for the Node’s endpoints
|
|
67
|
+
* and their associated cluster instances. Access to this Access Control Cluster itself requires
|
|
68
|
+
* a special Administer privilege level, such that only Nodes granted such privilege (hereafter
|
|
69
|
+
* termed "Administrators") can manage the Access Control Cluster.
|
|
70
|
+
* The Access Control Cluster SHALL be present on the root node endpoint of each Node, and SHALL
|
|
71
|
+
* NOT be present on any other Endpoint of any Node.
|
|
72
|
+
*
|
|
73
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.10
|
|
74
|
+
*/
|
|
75
|
+
exports.AccessControlCluster = (0, Cluster_js_1.Cluster)({
|
|
76
|
+
id: 0x1f,
|
|
77
|
+
name: "Access Control",
|
|
78
|
+
revision: 1,
|
|
79
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.10.5 */
|
|
80
|
+
attributes: {
|
|
81
|
+
/** Codifies a single grant of privilege on this Node. */
|
|
82
|
+
acl: (0, Cluster_js_1.WritableAttribute)(0, (0, TlvArray_js_1.TlvArray)(TlvAccessControlEntry), { default: [], writeAcl: 2 /* AccessLevel.Administer */, readAcl: 2 /* AccessLevel.Administer */ }),
|
|
83
|
+
/** MAY be used by Administrators to store arbitrary data related to fabric’s Access Control Entries. */
|
|
84
|
+
extension: (0, Cluster_js_1.OptionalWritableAttribute)(1, (0, TlvArray_js_1.TlvArray)(TlvAccessControlExtensionEntry), { default: [], writeAcl: 2 /* AccessLevel.Administer */, readAcl: 2 /* AccessLevel.Administer */ }),
|
|
85
|
+
/** Provide the minimum number of Subjects per entry that are supported by this server. */
|
|
86
|
+
subjectsPerAccessControlEntry: (0, Cluster_js_1.Attribute)(2, TlvNumber_js_1.TlvUInt16.bound({ min: 4 }), { default: 4 }),
|
|
87
|
+
/** Provides the minimum number of Targets per entry that are supported by this server. */
|
|
88
|
+
targetsPerAccessControlEntry: (0, Cluster_js_1.Attribute)(3, TlvNumber_js_1.TlvUInt16.bound({ min: 3 }), { default: 3 }),
|
|
89
|
+
/** Provides the minimum number of ACL Entries per fabric that are supported by this server. */
|
|
90
|
+
accessControlEntriesPerFabric: (0, Cluster_js_1.Attribute)(4, TlvNumber_js_1.TlvUInt16.bound({ min: 3 }), { default: 3 }),
|
|
91
|
+
},
|
|
92
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.10.7 */
|
|
93
|
+
events: {
|
|
94
|
+
/**
|
|
95
|
+
* The cluster SHALL send AccessControlEntryChanged events whenever its ACL attribute data is changed by an
|
|
96
|
+
* Administrator.
|
|
97
|
+
*/
|
|
98
|
+
accessControlEntryChanged: (0, Cluster_js_1.Event)(0, 1 /* EventPriority.Info */, AccessChangeEvent(TlvAccessControlEntry)),
|
|
99
|
+
/**
|
|
100
|
+
* The cluster SHALL send AccessControlExtensionChanged events whenever its extension attribute data is changed
|
|
101
|
+
* by an Administrator.
|
|
102
|
+
*/
|
|
103
|
+
accessControlExtensionChanged: (0, Cluster_js_1.Event)(1, 1 /* EventPriority.Info */, AccessChangeEvent(TlvAccessControlExtensionEntry)), /* readAcl: AccessLevel.Administer */
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2022 Project CHIP Authors
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.BasicInformationCluster = void 0;
|
|
9
|
+
const FabricIndex_js_1 = require("../common/FabricIndex.js");
|
|
10
|
+
const VendorId_js_1 = require("../common/VendorId.js");
|
|
11
|
+
const TlvBoolean_js_1 = require("../tlv/TlvBoolean.js");
|
|
12
|
+
const TlvNumber_js_1 = require("../tlv/TlvNumber.js");
|
|
13
|
+
const TlvObject_js_1 = require("../tlv/TlvObject.js");
|
|
14
|
+
const TlvString_js_1 = require("../tlv/TlvString.js");
|
|
15
|
+
const Cluster_js_1 = require("./Cluster.js");
|
|
16
|
+
/**
|
|
17
|
+
* Provides constant values related to overall global capabilities of this Node, that are not cluster-specific.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.1.6.2
|
|
20
|
+
*/
|
|
21
|
+
const TlvCapabilityMinima = (0, TlvObject_js_1.TlvObject)({
|
|
22
|
+
/** Indicates the minimum number of concurrent CASE sessions that are supported per fabric. */
|
|
23
|
+
caseSessionsPerFabric: (0, TlvObject_js_1.TlvField)(0, TlvNumber_js_1.TlvUInt16.bound({ min: 3 })),
|
|
24
|
+
/** Indicate the actual minimum number of concurrent subscriptions supported per fabric. */
|
|
25
|
+
subscriptionsPerFabric: (0, TlvObject_js_1.TlvField)(1, TlvNumber_js_1.TlvUInt16.bound({ min: 3 })),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* This cluster provides attributes and events for determining basic information about Nodes, which supports both
|
|
29
|
+
* commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number,
|
|
30
|
+
* which apply to the whole Node. Also allows setting user device information such as location.
|
|
31
|
+
*
|
|
32
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.1
|
|
33
|
+
*/
|
|
34
|
+
exports.BasicInformationCluster = (0, Cluster_js_1.Cluster)({
|
|
35
|
+
id: 0x28,
|
|
36
|
+
name: "Basic Information",
|
|
37
|
+
revision: 1,
|
|
38
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.1.6.3 */
|
|
39
|
+
attributes: {
|
|
40
|
+
/** Revision number of the Data Model against which the Node is certified */
|
|
41
|
+
dataModelRevision: (0, Cluster_js_1.Attribute)(0, TlvNumber_js_1.TlvUInt16),
|
|
42
|
+
/** Human-readable (displayable) name of the vendor for the Node. */
|
|
43
|
+
vendorName: (0, Cluster_js_1.Attribute)(1, TlvString_js_1.TlvString32max),
|
|
44
|
+
/** Specifies the {@link VendorId}. */
|
|
45
|
+
vendorId: (0, Cluster_js_1.Attribute)(2, VendorId_js_1.TlvVendorId),
|
|
46
|
+
/** Human-readable name of the model for the Node such as the model number assigned by the vendor. */
|
|
47
|
+
productName: (0, Cluster_js_1.Attribute)(3, TlvString_js_1.TlvString32max),
|
|
48
|
+
/** Product ID assigned by the vendor that is unique to the specific product of the Node. */
|
|
49
|
+
productId: (0, Cluster_js_1.Attribute)(4, TlvNumber_js_1.TlvUInt16),
|
|
50
|
+
/** User defined name for the Node. It is set during initial commissioning and may be updated by further reconfigurations. */
|
|
51
|
+
nodeLabel: (0, Cluster_js_1.WritableAttribute)(5, TlvString_js_1.TlvString32max, { default: "", writeAcl: 1 /* AccessLevel.Manage */ }),
|
|
52
|
+
/** ISO 3166-1 alpha-2 code where the Node is located. Might affect some regulatory aspects. */
|
|
53
|
+
location: (0, Cluster_js_1.WritableAttribute)(6, TlvString_js_1.TlvString.bound({ length: 2 }), { default: "XX", writeAcl: 2 /* AccessLevel.Administer */ }),
|
|
54
|
+
/** Version number of the hardware of the Node. The meaning of its value, and the versioning scheme, are vendor defined. */
|
|
55
|
+
hardwareVersion: (0, Cluster_js_1.Attribute)(7, TlvNumber_js_1.TlvUInt16, { default: 0 }),
|
|
56
|
+
/** Human-readable representation of the {@link BasicInformationCluster.attributes.hardwareVersion hardwareVersion} attribute. */
|
|
57
|
+
hardwareVersionString: (0, Cluster_js_1.Attribute)(8, TlvString_js_1.TlvString.bound({ minLength: 1, maxLength: 64 })),
|
|
58
|
+
/** Current version number for the software running on this Node. A larger value is newer than a lower value. */
|
|
59
|
+
softwareVersion: (0, Cluster_js_1.Attribute)(9, TlvNumber_js_1.TlvUInt32, { default: 0 }),
|
|
60
|
+
/** Human-readable representation of the {@link BasicInformationCluster.attributes.softwareVersion softwareVersion} attribute. */
|
|
61
|
+
softwareVersionString: (0, Cluster_js_1.Attribute)(10, TlvString_js_1.TlvString.bound({ minLength: 1, maxLength: 64 })),
|
|
62
|
+
/** Node manufacturing date formatted with YYYYMMDD. The additional 8 characters might include other vendor related information. */
|
|
63
|
+
manufacturingDate: (0, Cluster_js_1.OptionalAttribute)(11, TlvString_js_1.TlvString.bound({ minLength: 8, maxLength: 16 })),
|
|
64
|
+
/** Human-readable vendor assigned part number for the Node whose meaning and numbering scheme is vendor defined. */
|
|
65
|
+
partNumber: (0, Cluster_js_1.OptionalAttribute)(12, TlvString_js_1.TlvString32max),
|
|
66
|
+
/** Link to a product specific web page following the syntax as specified in RFC 3986. */
|
|
67
|
+
productURL: (0, Cluster_js_1.OptionalAttribute)(13, TlvString_js_1.TlvString256max),
|
|
68
|
+
/** Vendor specific human readable product label. */
|
|
69
|
+
productLabel: (0, Cluster_js_1.OptionalAttribute)(14, TlvString_js_1.TlvString64max),
|
|
70
|
+
/** Human readable serial number. */
|
|
71
|
+
serialNumber: (0, Cluster_js_1.OptionalAttribute)(15, TlvString_js_1.TlvString32max),
|
|
72
|
+
/** Allows to disable the ability to configure the Node through an on-Node user interface. */
|
|
73
|
+
localConfigDisabled: (0, Cluster_js_1.OptionalWritableAttribute)(16, TlvBoolean_js_1.TlvBoolean, { default: false, writeAcl: 1 /* AccessLevel.Manage */ }),
|
|
74
|
+
/** Indicates whether the Node can be reached over the non-native network for bridged devices. */
|
|
75
|
+
reachable: (0, Cluster_js_1.OptionalAttribute)(17, TlvBoolean_js_1.TlvBoolean, { default: true }),
|
|
76
|
+
/** Unique identifier for the device, which is constructed in a manufacturer specific manner, updated during factory reset. */
|
|
77
|
+
uniqueId: (0, Cluster_js_1.OptionalAttribute)(18, TlvString_js_1.TlvString32max),
|
|
78
|
+
/** Minimum guaranteed value for some system-wide, not cluster-specific, resource capabilities. */
|
|
79
|
+
capabilityMinima: (0, Cluster_js_1.Attribute)(19, TlvCapabilityMinima, { default: { caseSessionsPerFabric: 3, subscriptionsPerFabric: 3 } }),
|
|
80
|
+
},
|
|
81
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.1.6.5 */
|
|
82
|
+
events: {
|
|
83
|
+
/** First event fired as soon as reasonable after completing a boot or reboot process. */
|
|
84
|
+
startUp: (0, Cluster_js_1.Event)(0, 0 /* EventPriority.Critical */, { softwareVersion: (0, TlvObject_js_1.TlvField)(0, TlvNumber_js_1.TlvUInt32) }),
|
|
85
|
+
/** Last event fired prior to any orderly shutdown sequence on a best-effort basis. */
|
|
86
|
+
shutDown: (0, Cluster_js_1.OptionalEvent)(1, 0 /* EventPriority.Critical */),
|
|
87
|
+
/** Fired prior to permanently leaving a given Fabric. */
|
|
88
|
+
leave: (0, Cluster_js_1.OptionalEvent)(2, 1 /* EventPriority.Info */, { fabricIndex: (0, TlvObject_js_1.TlvField)(0, FabricIndex_js_1.TlvFabricIndex) }),
|
|
89
|
+
/** Fired when there is a change in the {@link BasicInformationCluster.attributes.reachable reachable} attribute. */
|
|
90
|
+
reachableChanged: (0, Cluster_js_1.OptionalEvent)(3, 1 /* EventPriority.Info */, { reachableNewValue: (0, TlvObject_js_1.TlvField)(0, TlvBoolean_js_1.TlvBoolean) }),
|
|
91
|
+
},
|
|
92
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2022 Project CHIP Authors
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.BindingCluster = void 0;
|
|
9
|
+
const Cluster_js_1 = require("./Cluster.js");
|
|
10
|
+
const ClusterId_js_1 = require("../common/ClusterId.js");
|
|
11
|
+
const EndpointNumber_js_1 = require("../common/EndpointNumber.js");
|
|
12
|
+
const NodeId_js_1 = require("../common/NodeId.js");
|
|
13
|
+
const GroupId_js_1 = require("../common/GroupId.js");
|
|
14
|
+
const TlvObject_js_1 = require("../tlv/TlvObject.js");
|
|
15
|
+
const TlvArray_js_1 = require("../tlv/TlvArray.js");
|
|
16
|
+
/**
|
|
17
|
+
* Provides information about endpoint conformance to a release of a device type definition.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.5.5.1
|
|
20
|
+
*/
|
|
21
|
+
const TlvTarget = (0, TlvObject_js_1.TlvObject)({
|
|
22
|
+
/** Contains the remote target node ID. If the Endpoint field is present, this field SHALL be present. */
|
|
23
|
+
node: (0, TlvObject_js_1.TlvOptionalField)(1, NodeId_js_1.TlvNodeId),
|
|
24
|
+
/** Contains the target group ID that represents remote endpoints. If the Endpoint field is present, this field SHALL NOT be present. */
|
|
25
|
+
group: (0, TlvObject_js_1.TlvOptionalField)(2, GroupId_js_1.TlvGroupId),
|
|
26
|
+
/** Contains the remote endpoint that the local endpoint is bound to. If the Group field is present, this field SHALL NOT be present. */
|
|
27
|
+
endpoint: (0, TlvObject_js_1.TlvOptionalField)(3, EndpointNumber_js_1.TlvEndpointNumber),
|
|
28
|
+
/**
|
|
29
|
+
* Contains the cluster ID (client & server) on the local and target endpoint(s). If this field is present, the
|
|
30
|
+
* client cluster SHALL also exist on this endpoint (with this Binding cluster). If this field is present, the
|
|
31
|
+
* target SHALL be this cluster on the target endpoint(s).
|
|
32
|
+
*/
|
|
33
|
+
cluster: (0, TlvObject_js_1.TlvOptionalField)(4, ClusterId_js_1.TlvClusterId),
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* A binding represents a persistent relationship between an endpoint and one or more other local or
|
|
37
|
+
* remote endpoints. A binding does not require that the relationship exists. It is up to the node
|
|
38
|
+
* application to set up the relationship.
|
|
39
|
+
*
|
|
40
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.6
|
|
41
|
+
*/
|
|
42
|
+
exports.BindingCluster = (0, Cluster_js_1.Cluster)({
|
|
43
|
+
id: 0x1e,
|
|
44
|
+
name: "Binding",
|
|
45
|
+
revision: 1,
|
|
46
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.6.5 */
|
|
47
|
+
attributes: {
|
|
48
|
+
/** List of device types and corresponding revisions declaring endpoint conformance. */
|
|
49
|
+
binding: (0, Cluster_js_1.WritableAttribute)(0, (0, TlvArray_js_1.TlvArray)(TlvTarget), { default: [] }), /* non-volatile */
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2022 Project CHIP Authors
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.BridgedDeviceBasicInformationCluster = void 0;
|
|
9
|
+
const FabricIndex_js_1 = require("../common/FabricIndex.js");
|
|
10
|
+
const VendorId_js_1 = require("../common/VendorId.js");
|
|
11
|
+
const TlvBoolean_js_1 = require("../tlv/TlvBoolean.js");
|
|
12
|
+
const TlvNumber_js_1 = require("../tlv/TlvNumber.js");
|
|
13
|
+
const TlvObject_js_1 = require("../tlv/TlvObject.js");
|
|
14
|
+
const TlvString_js_1 = require("../tlv/TlvString.js");
|
|
15
|
+
const Cluster_js_1 = require("./Cluster.js");
|
|
16
|
+
/**
|
|
17
|
+
* This Cluster serves two purposes towards a Node communicating with a Bridge:
|
|
18
|
+
* * indicate that the functionality on the Endpoint where it is placed (and its Parts) is bridged from a
|
|
19
|
+
* non-Matter technology, and
|
|
20
|
+
* * provide a centralized collection of attributes that the Node MAY collect to aid in conveying information
|
|
21
|
+
* regarding the Bridged Device to a user, such as the vendor name, the model name, or user-assigned name.
|
|
22
|
+
*
|
|
23
|
+
* This cluster is Derived from Basic Information Cluster.
|
|
24
|
+
*
|
|
25
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.13
|
|
26
|
+
*/
|
|
27
|
+
exports.BridgedDeviceBasicInformationCluster = (0, Cluster_js_1.Cluster)({
|
|
28
|
+
id: 0x39,
|
|
29
|
+
name: "Bridged Device Basic Information",
|
|
30
|
+
revision: 1,
|
|
31
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.13.6 */
|
|
32
|
+
attributes: {
|
|
33
|
+
/** Human-readable (displayable) name of the vendor for the Node. */
|
|
34
|
+
vendorName: (0, Cluster_js_1.OptionalAttribute)(1, TlvString_js_1.TlvString32max),
|
|
35
|
+
/** Specifies the {@link VendorId}. */
|
|
36
|
+
vendorId: (0, Cluster_js_1.OptionalAttribute)(2, VendorId_js_1.TlvVendorId),
|
|
37
|
+
/** Human-readable name of the model for the Node such as the model number assigned by the vendor. */
|
|
38
|
+
productName: (0, Cluster_js_1.OptionalAttribute)(3, TlvString_js_1.TlvString32max),
|
|
39
|
+
/** User defined name for the Node. It is set during initial commissioning and may be updated by further reconfigurations. */
|
|
40
|
+
nodeLabel: (0, Cluster_js_1.OptionalWritableAttribute)(5, TlvString_js_1.TlvString32max, { default: "", writeAcl: 1 /* AccessLevel.Manage */ }),
|
|
41
|
+
/** Version number of the hardware of the Node. The meaning of its value, and the versioning scheme, are vendor defined. */
|
|
42
|
+
hardwareVersion: (0, Cluster_js_1.OptionalAttribute)(7, TlvNumber_js_1.TlvUInt16, { default: 0 }),
|
|
43
|
+
/** Human-readable representation of the {@link BasicInformationCluster.attributes.hardwareVersion hardwareVersion} attribute. */
|
|
44
|
+
hardwareVersionString: (0, Cluster_js_1.OptionalAttribute)(8, TlvString_js_1.TlvString.bound({ minLength: 1, maxLength: 64 })),
|
|
45
|
+
/** Current version number for the software running on this Node. A larger value is newer than a lower value. */
|
|
46
|
+
softwareVersion: (0, Cluster_js_1.OptionalAttribute)(9, TlvNumber_js_1.TlvUInt32, { default: 0 }),
|
|
47
|
+
/** Human-readable representation of the {@link BasicInformationCluster.attributes.softwareVersion softwareVersion} attribute. */
|
|
48
|
+
softwareVersionString: (0, Cluster_js_1.OptionalAttribute)(10, TlvString_js_1.TlvString.bound({ minLength: 1, maxLength: 64 })),
|
|
49
|
+
/** Node manufacturing date formatted with YYYYMMDD. The additional 8 characters might include other vendor related information. */
|
|
50
|
+
manufacturingDate: (0, Cluster_js_1.OptionalAttribute)(11, TlvString_js_1.TlvString.bound({ minLength: 8, maxLength: 16 })),
|
|
51
|
+
/** Human-readable vendor assigned part number for the Node whose meaning and numbering scheme is vendor defined. */
|
|
52
|
+
partNumber: (0, Cluster_js_1.OptionalAttribute)(12, TlvString_js_1.TlvString32max),
|
|
53
|
+
/** Link to a product specific web page following the syntax as specified in RFC 3986. */
|
|
54
|
+
productURL: (0, Cluster_js_1.OptionalAttribute)(13, TlvString_js_1.TlvString256max),
|
|
55
|
+
/** Vendor specific human readable product label. */
|
|
56
|
+
productLabel: (0, Cluster_js_1.OptionalAttribute)(14, TlvString_js_1.TlvString64max),
|
|
57
|
+
/** Human-readable serial number. */
|
|
58
|
+
serialNumber: (0, Cluster_js_1.OptionalAttribute)(15, TlvString_js_1.TlvString32max),
|
|
59
|
+
/** Indicates whether the bridged device is reachable by the bridge over the non-Matter network. */
|
|
60
|
+
reachable: (0, Cluster_js_1.Attribute)(17, TlvBoolean_js_1.TlvBoolean, { default: true }),
|
|
61
|
+
/** Unique identifier for the device, which is constructed in a manufacturer specific manner, updated during factory reset. */
|
|
62
|
+
uniqueId: (0, Cluster_js_1.OptionalAttribute)(18, TlvString_js_1.TlvString32max),
|
|
63
|
+
},
|
|
64
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.1.6.5 */
|
|
65
|
+
events: {
|
|
66
|
+
/** First event fired as soon as reasonable after completing a boot or reboot process. */
|
|
67
|
+
startUp: (0, Cluster_js_1.OptionalEvent)(0, 0 /* EventPriority.Critical */, { softwareVersion: (0, TlvObject_js_1.TlvField)(0, TlvNumber_js_1.TlvUInt32) }),
|
|
68
|
+
/** Last event fired prior to any orderly shutdown sequence on a best-effort basis. */
|
|
69
|
+
shutDown: (0, Cluster_js_1.OptionalEvent)(1, 0 /* EventPriority.Critical */),
|
|
70
|
+
/** Fired prior to permanently leaving a given Fabric. */
|
|
71
|
+
leave: (0, Cluster_js_1.OptionalEvent)(2, 1 /* EventPriority.Info */, { fabricIndex: (0, TlvObject_js_1.TlvField)(0, FabricIndex_js_1.TlvFabricIndex) }),
|
|
72
|
+
/** Fired when there is a change in the {@link BasicInformationCluster.attributes.reachable reachable} attribute */
|
|
73
|
+
reachableChanged: (0, Cluster_js_1.Event)(3, 1 /* EventPriority.Info */, { reachableNewValue: (0, TlvObject_js_1.TlvField)(0, TlvBoolean_js_1.TlvBoolean) }),
|
|
74
|
+
},
|
|
75
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2022 Project CHIP Authors
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.Cluster = exports.GlobalAttributes = exports.OptionalEvent = exports.Event = exports.OptionalCommand = exports.Command = exports.TlvNoResponse = exports.TlvNoArguments = exports.OptionalWritableAttribute = exports.WritableAttribute = exports.OptionalAttribute = exports.Attribute = void 0;
|
|
9
|
+
const TlvNumber_js_1 = require("../tlv/TlvNumber.js");
|
|
10
|
+
const TlvObject_js_1 = require("../tlv/TlvObject.js");
|
|
11
|
+
const TlvVoid_js_1 = require("../tlv/TlvVoid.js");
|
|
12
|
+
const Type_js_1 = require("../util/Type.js");
|
|
13
|
+
;
|
|
14
|
+
const Attribute = (id, schema, { default: conformanceValue, readAcl = 0 /* AccessLevel.View */ } = {}) => ({ id, schema, optional: false, writable: false, default: conformanceValue, readAcl });
|
|
15
|
+
exports.Attribute = Attribute;
|
|
16
|
+
const OptionalAttribute = (id, schema, { default: conformanceValue, readAcl = 0 /* AccessLevel.View */ } = {}) => ({ id, schema, optional: true, writable: false, default: conformanceValue, readAcl });
|
|
17
|
+
exports.OptionalAttribute = OptionalAttribute;
|
|
18
|
+
const WritableAttribute = (id, schema, { default: conformanceValue, readAcl = 0 /* AccessLevel.View */, writeAcl = 0 /* AccessLevel.View */ } = {}) => ({ id, schema, optional: false, writable: true, default: conformanceValue, readAcl, writeAcl });
|
|
19
|
+
exports.WritableAttribute = WritableAttribute;
|
|
20
|
+
const OptionalWritableAttribute = (id, schema, { default: conformanceValue, readAcl = 0 /* AccessLevel.View */, writeAcl = 0 /* AccessLevel.View */ } = {}) => ({ id, schema, optional: true, writable: true, default: conformanceValue, readAcl, writeAcl });
|
|
21
|
+
exports.OptionalWritableAttribute = OptionalWritableAttribute;
|
|
22
|
+
/* Interfaces and helper methods to define a cluster command */
|
|
23
|
+
exports.TlvNoArguments = (0, TlvObject_js_1.TlvObject)({});
|
|
24
|
+
exports.TlvNoResponse = TlvVoid_js_1.TlvVoid;
|
|
25
|
+
;
|
|
26
|
+
;
|
|
27
|
+
const Command = (requestId, requestSchema, responseId, responseSchema) => ({ optional: false, requestId, requestSchema, responseId, responseSchema });
|
|
28
|
+
exports.Command = Command;
|
|
29
|
+
const OptionalCommand = (requestId, requestSchema, responseId, responseSchema) => ({ optional: true, requestId, requestSchema, responseId, responseSchema });
|
|
30
|
+
exports.OptionalCommand = OptionalCommand;
|
|
31
|
+
const Event = (id, priority, data = {}) => ({ id, schema: (0, TlvObject_js_1.TlvObject)(data), priority, optional: false });
|
|
32
|
+
exports.Event = Event;
|
|
33
|
+
const OptionalEvent = (id, priority, data = {}) => ({ id, schema: (0, TlvObject_js_1.TlvObject)(data), priority, optional: true });
|
|
34
|
+
exports.OptionalEvent = OptionalEvent;
|
|
35
|
+
const GlobalAttributes = (features) => ({
|
|
36
|
+
clusterRevision: (0, exports.Attribute)(0xFFFD, TlvNumber_js_1.TlvUInt16),
|
|
37
|
+
featureMap: (0, exports.Attribute)(0xFFFC, (0, TlvNumber_js_1.TlvBitmap)(TlvNumber_js_1.TlvUInt32, features)),
|
|
38
|
+
});
|
|
39
|
+
exports.GlobalAttributes = GlobalAttributes;
|
|
40
|
+
const Cluster = ({ id, name, revision, features = {}, attributes = {}, commands = {}, events = {}, }) => ({
|
|
41
|
+
id,
|
|
42
|
+
name,
|
|
43
|
+
revision,
|
|
44
|
+
features,
|
|
45
|
+
commands,
|
|
46
|
+
attributes: (0, Type_js_1.Merge)(attributes, (0, exports.GlobalAttributes)(features)),
|
|
47
|
+
events,
|
|
48
|
+
});
|
|
49
|
+
exports.Cluster = Cluster;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2022 Project CHIP Authors
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.DescriptorCluster = void 0;
|
|
9
|
+
const Cluster_js_1 = require("./Cluster.js");
|
|
10
|
+
const DeviceTypeId_js_1 = require("../common/DeviceTypeId.js");
|
|
11
|
+
const ClusterId_js_1 = require("../common/ClusterId.js");
|
|
12
|
+
const EndpointNumber_js_1 = require("../common/EndpointNumber.js");
|
|
13
|
+
const TlvObject_js_1 = require("../tlv/TlvObject.js");
|
|
14
|
+
const TlvNumber_js_1 = require("../tlv/TlvNumber.js");
|
|
15
|
+
const TlvArray_js_1 = require("../tlv/TlvArray.js");
|
|
16
|
+
/**
|
|
17
|
+
* Provides information about endpoint conformance to a release of a device type definition.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.5.5.1
|
|
20
|
+
*/
|
|
21
|
+
const TlvDeviceType = (0, TlvObject_js_1.TlvObject)({
|
|
22
|
+
/** Indicates the device type definition */
|
|
23
|
+
type: (0, TlvObject_js_1.TlvField)(0, DeviceTypeId_js_1.TlvDeviceTypeId),
|
|
24
|
+
/** Indicates the implemented revision of the device type definition */
|
|
25
|
+
revision: (0, TlvObject_js_1.TlvField)(1, TlvNumber_js_1.TlvUInt16.bound({ min: 1 })),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* This cluster describes an endpoint instance on the node, independently of other endpoints, but also
|
|
29
|
+
* allows composition of endpoints to conform to complex device type patterns.
|
|
30
|
+
* This Cluster is also meant to replace the support from the Zigbee Device Object (ZDO) for describing a node,
|
|
31
|
+
* its endpoints and clusters.
|
|
32
|
+
*
|
|
33
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.5
|
|
34
|
+
*/
|
|
35
|
+
exports.DescriptorCluster = (0, Cluster_js_1.Cluster)({
|
|
36
|
+
id: 0x1d,
|
|
37
|
+
name: "Descriptor",
|
|
38
|
+
revision: 1,
|
|
39
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.5.4 */
|
|
40
|
+
attributes: {
|
|
41
|
+
/** List of device types and corresponding revisions declaring endpoint conformance. */
|
|
42
|
+
deviceTypeList: (0, Cluster_js_1.Attribute)(0, (0, TlvArray_js_1.TlvArray)(TlvDeviceType, { minLength: 1 })),
|
|
43
|
+
/** List containing each cluster ID for the server clusters present on the endpoint instance. */
|
|
44
|
+
serverList: (0, Cluster_js_1.Attribute)(1, (0, TlvArray_js_1.TlvArray)(ClusterId_js_1.TlvClusterId), { default: [] }),
|
|
45
|
+
/** List containing each cluster ID for the client clusters present on the endpoint instance. */
|
|
46
|
+
clientList: (0, Cluster_js_1.Attribute)(3, (0, TlvArray_js_1.TlvArray)(ClusterId_js_1.TlvClusterId), { default: [] }),
|
|
47
|
+
/**
|
|
48
|
+
* This indicates composition of the device type instance. Device type instance composition SHALL
|
|
49
|
+
* include the endpoints in this list.
|
|
50
|
+
*/
|
|
51
|
+
partsList: (0, Cluster_js_1.Attribute)(4, (0, TlvArray_js_1.TlvArray)(EndpointNumber_js_1.TlvEndpointNumber), { default: [] }),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2022 Project CHIP Authors
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.GeneralCommissioningCluster = void 0;
|
|
9
|
+
const Cluster_js_1 = require("./Cluster.js");
|
|
10
|
+
const TlvObject_js_1 = require("../tlv/TlvObject.js");
|
|
11
|
+
const TlvNumber_js_1 = require("../tlv/TlvNumber.js");
|
|
12
|
+
const TlvString_js_1 = require("../tlv/TlvString.js");
|
|
13
|
+
const TlvBoolean_js_1 = require("../tlv/TlvBoolean.js");
|
|
14
|
+
/**
|
|
15
|
+
* This structure provides some constant values that MAY be of use to all commissioners.
|
|
16
|
+
*
|
|
17
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.9.5.2
|
|
18
|
+
*/
|
|
19
|
+
const TlvBasicCommissioningInfo = (0, TlvObject_js_1.TlvObject)({
|
|
20
|
+
/** Contains a conservative initial duration (in seconds) to set in the FailSafe for the commissioning flow to complete successfully. */
|
|
21
|
+
failSafeExpiryLengthSeconds: (0, TlvObject_js_1.TlvField)(0, TlvNumber_js_1.TlvUInt16),
|
|
22
|
+
/** Contain a conservative value in seconds denoting the maximum total duration for which a fail-safe timer can be re-armed. */
|
|
23
|
+
maxCumulativeFailsafeSeconds: (0, TlvObject_js_1.TlvField)(1, TlvNumber_js_1.TlvUInt16),
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Used by the following commands as response payload:
|
|
27
|
+
* ArmFailSafeResponse, @see {@link MatterCoreSpecificationV1_0} § 11.9.7.3
|
|
28
|
+
* CommissioningCompleteResponse, @see {@link MatterCoreSpecificationV1_0} § 11.9.7.7
|
|
29
|
+
* CommissioningCompleteResponse, @see {@link MatterCoreSpecificationV1_0} § 11.9.7.7
|
|
30
|
+
*/
|
|
31
|
+
const TlvCommissioningSuccessFailureResponse = (0, TlvObject_js_1.TlvObject)({
|
|
32
|
+
/** Contain the result of the operation. */
|
|
33
|
+
errorCode: (0, TlvObject_js_1.TlvField)(0, (0, TlvNumber_js_1.TlvEnum)()),
|
|
34
|
+
/** Should help developers in troubleshooting errors. The value MAY go into logs or crash reports, not User UIs. */
|
|
35
|
+
debugText: (0, TlvObject_js_1.TlvField)(1, TlvString_js_1.TlvString.bound({ maxLength: 128 })),
|
|
36
|
+
});
|
|
37
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.9.7.3. */
|
|
38
|
+
const TlvArmFailSafeRequest = (0, TlvObject_js_1.TlvObject)({
|
|
39
|
+
/** Contains timeframe for fail-safe timer actions. */
|
|
40
|
+
expiryLengthSeconds: (0, TlvObject_js_1.TlvField)(0, TlvNumber_js_1.TlvUInt16),
|
|
41
|
+
/** Value to atomically set the Breadcrumb attribute on success of this command. */
|
|
42
|
+
breadcrumbStep: (0, TlvObject_js_1.TlvField)(1, TlvNumber_js_1.TlvUInt64),
|
|
43
|
+
});
|
|
44
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.9.7.4 */
|
|
45
|
+
const TlvSetRegulatoryConfigRequest = (0, TlvObject_js_1.TlvObject)({
|
|
46
|
+
/** Contains the new regulatory location to be set. */
|
|
47
|
+
newRegulatoryConfig: (0, TlvObject_js_1.TlvField)(0, (0, TlvNumber_js_1.TlvEnum)()),
|
|
48
|
+
/** Contains a ISO 3166-1 alpha-2 country code*/
|
|
49
|
+
countryCode: (0, TlvObject_js_1.TlvField)(1, TlvString_js_1.TlvString.bound({ length: 2 })),
|
|
50
|
+
/** Value to atomically set the Breadcrumb attribute on success of this command. */
|
|
51
|
+
breadcrumbStep: (0, TlvObject_js_1.TlvField)(2, TlvNumber_js_1.TlvUInt64),
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* This cluster is used to manage global aspects of the Commissioning flow.
|
|
55
|
+
*
|
|
56
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.9
|
|
57
|
+
*/
|
|
58
|
+
exports.GeneralCommissioningCluster = (0, Cluster_js_1.Cluster)({
|
|
59
|
+
id: 0x30,
|
|
60
|
+
name: "General Commissioning",
|
|
61
|
+
revision: 1,
|
|
62
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.9.6 */
|
|
63
|
+
attributes: {
|
|
64
|
+
/** Allows for the storage of a client-provided small payload which Administrators and Commissioners MAY write
|
|
65
|
+
* and then subsequently read, to keep track of their own progress.
|
|
66
|
+
*/
|
|
67
|
+
breadcrumb: (0, Cluster_js_1.WritableAttribute)(0, TlvNumber_js_1.TlvUInt64, { default: BigInt(0), writeAcl: 2 /* AccessLevel.Administer */ }),
|
|
68
|
+
/** Describe critical parameters needed at the beginning of commissioning flow. */
|
|
69
|
+
commissioningInfo: (0, Cluster_js_1.Attribute)(1, TlvBasicCommissioningInfo),
|
|
70
|
+
/** Indicates the regulatory configuration for the product. */
|
|
71
|
+
regulatoryConfig: (0, Cluster_js_1.Attribute)(2, (0, TlvNumber_js_1.TlvEnum)()),
|
|
72
|
+
/** Indicates if this Node needs to be told an exact RegulatoryLocation. */
|
|
73
|
+
locationCapability: (0, Cluster_js_1.Attribute)(3, (0, TlvNumber_js_1.TlvEnum)(), { default: 2 /* RegulatoryLocationType.IndoorOutdoor */ }),
|
|
74
|
+
/** Indicates whether this device supports "concurrent connection flow" commissioning mode */
|
|
75
|
+
supportsConcurrentConnections: (0, Cluster_js_1.Attribute)(4, TlvBoolean_js_1.TlvBoolean, { default: true }),
|
|
76
|
+
},
|
|
77
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.9.7 */
|
|
78
|
+
commands: {
|
|
79
|
+
/** Arms the persistent fail-safe timer with an expiry time of now + ExpiryLengthSeconds using device clock. */
|
|
80
|
+
armFailSafe: (0, Cluster_js_1.Command)(0, TlvArmFailSafeRequest, 1, TlvCommissioningSuccessFailureResponse),
|
|
81
|
+
/** Sets or Updates the regulatory configuration to be used during commissioning. */
|
|
82
|
+
setRegulatoryConfig: (0, Cluster_js_1.Command)(2, TlvSetRegulatoryConfigRequest, 3, TlvCommissioningSuccessFailureResponse),
|
|
83
|
+
/**
|
|
84
|
+
* Informs that all steps of Commissioning/Reconfiguration needed during the fail-safe period have been
|
|
85
|
+
* completed.
|
|
86
|
+
*/
|
|
87
|
+
commissioningComplete: (0, Cluster_js_1.Command)(4, Cluster_js_1.TlvNoArguments, 5, TlvCommissioningSuccessFailureResponse),
|
|
88
|
+
},
|
|
89
|
+
});
|