@project-chip/matter.js 0.0.2 → 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 → 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/TlvObject.js +6 -2
- 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/ByteArray.js +2 -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-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/{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 +7 -8
- package/dist/schema/BitmapSchema.js +0 -48
- package/dist-cjs/schema/BitmapSchema.js +0 -55
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Cluster, WritableAttribute, Attribute, Event, OptionalWritableAttribute } from "./Cluster.js";
|
|
7
|
+
import { TlvClusterId } from "../common/ClusterId.js";
|
|
8
|
+
import { TlvEndpointNumber } from "../common/EndpointNumber.js";
|
|
9
|
+
import { TlvDeviceTypeId } from "../common/DeviceTypeId.js";
|
|
10
|
+
import { TlvNodeId } from "../common/NodeId.js";
|
|
11
|
+
import { TlvSubjectId } from "../common/SubjectId.js";
|
|
12
|
+
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
|
|
13
|
+
import { TlvNullable } from "../tlv/TlvNullable.js";
|
|
14
|
+
import { TlvEnum, TlvUInt16 } from "../tlv/TlvNumber.js";
|
|
15
|
+
import { TlvArray } from "../tlv/TlvArray.js";
|
|
16
|
+
import { TlvByteString } from "../tlv/TlvString.js";
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* Defines the clusters on this Node to which this Access Control Entry grants access.
|
|
20
|
+
*
|
|
21
|
+
* A single target SHALL contain at least one field (Cluster, Endpoint, or DeviceType), and SHALL NOT
|
|
22
|
+
* contain both an Endpoint field and a DeviceType field.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.10.5.3
|
|
25
|
+
*/
|
|
26
|
+
const TlvTarget = TlvObject({
|
|
27
|
+
/** Cluster to grant access on. */
|
|
28
|
+
cluster: TlvField(0, TlvNullable(TlvClusterId)),
|
|
29
|
+
/** Endpoint to grant access on. */
|
|
30
|
+
endpoint: TlvField(1, TlvNullable(TlvEndpointNumber)),
|
|
31
|
+
/** Device type to grant access on. */
|
|
32
|
+
deviceType: TlvField(1, TlvNullable(TlvDeviceTypeId)),
|
|
33
|
+
});
|
|
34
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.10.5.3 */
|
|
35
|
+
const TlvAccessControlEntry = TlvObject({
|
|
36
|
+
/** Specifies the level of privilege granted by this Access Control Entry. */
|
|
37
|
+
privilege: TlvField(1, TlvEnum()),
|
|
38
|
+
/** Specifies the authentication mode required by this Access Control Entry. */
|
|
39
|
+
authMode: TlvField(2, TlvEnum()),
|
|
40
|
+
/** Specifies a list of Subject IDs, to which this Access Control Entry grants access. */
|
|
41
|
+
subjects: TlvField(3, TlvNullable(TlvArray(TlvSubjectId))),
|
|
42
|
+
/** Specifies a list of TargetStruct, which define the clusters on this Node to which this Access Control Entry grants access. */
|
|
43
|
+
targets: TlvField(4, TlvNullable(TlvArray(TlvTarget))), /* maxArrayLength: targetsPerAccessControlEntry */
|
|
44
|
+
});
|
|
45
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.10.5.4 */
|
|
46
|
+
const TlvAccessControlExtensionEntry = TlvObject({
|
|
47
|
+
/** Used by manufacturers to store arbitrary TLV-encoded data related to a fabric’s Access Control Entries. */
|
|
48
|
+
data: TlvField(1, TlvByteString.bound({ maxLength: 128 })),
|
|
49
|
+
});
|
|
50
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.10.7.1 */
|
|
51
|
+
const AccessChangeEvent = (entrySchema) => ({
|
|
52
|
+
/** The Node ID of the Administrator that made the change, if the change occurred via a CASE session. */
|
|
53
|
+
adminNodeID: TlvField(1, TlvNullable(TlvNodeId)),
|
|
54
|
+
/** The Passcode ID of the Administrator that made the change, if the change occurred via a PASE session. */
|
|
55
|
+
adminPasscodeID: TlvField(2, TlvNullable(TlvUInt16)),
|
|
56
|
+
/** The type of change as appropriate. */
|
|
57
|
+
changeType: TlvField(3, TlvEnum()),
|
|
58
|
+
/** The latest value of the changed entry. */
|
|
59
|
+
latestValue: TlvField(4, TlvNullable(entrySchema)),
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* The Access Control Cluster exposes a data model view of a Node’s Access Control List (ACL),
|
|
63
|
+
* which codifies the rules used to manage and enforce Access Control for the Node’s endpoints
|
|
64
|
+
* and their associated cluster instances. Access to this Access Control Cluster itself requires
|
|
65
|
+
* a special Administer privilege level, such that only Nodes granted such privilege (hereafter
|
|
66
|
+
* termed "Administrators") can manage the Access Control Cluster.
|
|
67
|
+
* The Access Control Cluster SHALL be present on the root node endpoint of each Node, and SHALL
|
|
68
|
+
* NOT be present on any other Endpoint of any Node.
|
|
69
|
+
*
|
|
70
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.10
|
|
71
|
+
*/
|
|
72
|
+
export const AccessControlCluster = Cluster({
|
|
73
|
+
id: 0x1f,
|
|
74
|
+
name: "Access Control",
|
|
75
|
+
revision: 1,
|
|
76
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.10.5 */
|
|
77
|
+
attributes: {
|
|
78
|
+
/** Codifies a single grant of privilege on this Node. */
|
|
79
|
+
acl: WritableAttribute(0, TlvArray(TlvAccessControlEntry), { default: [], writeAcl: 2 /* AccessLevel.Administer */, readAcl: 2 /* AccessLevel.Administer */ }),
|
|
80
|
+
/** MAY be used by Administrators to store arbitrary data related to fabric’s Access Control Entries. */
|
|
81
|
+
extension: OptionalWritableAttribute(1, TlvArray(TlvAccessControlExtensionEntry), { default: [], writeAcl: 2 /* AccessLevel.Administer */, readAcl: 2 /* AccessLevel.Administer */ }),
|
|
82
|
+
/** Provide the minimum number of Subjects per entry that are supported by this server. */
|
|
83
|
+
subjectsPerAccessControlEntry: Attribute(2, TlvUInt16.bound({ min: 4 }), { default: 4 }),
|
|
84
|
+
/** Provides the minimum number of Targets per entry that are supported by this server. */
|
|
85
|
+
targetsPerAccessControlEntry: Attribute(3, TlvUInt16.bound({ min: 3 }), { default: 3 }),
|
|
86
|
+
/** Provides the minimum number of ACL Entries per fabric that are supported by this server. */
|
|
87
|
+
accessControlEntriesPerFabric: Attribute(4, TlvUInt16.bound({ min: 3 }), { default: 3 }),
|
|
88
|
+
},
|
|
89
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.10.7 */
|
|
90
|
+
events: {
|
|
91
|
+
/**
|
|
92
|
+
* The cluster SHALL send AccessControlEntryChanged events whenever its ACL attribute data is changed by an
|
|
93
|
+
* Administrator.
|
|
94
|
+
*/
|
|
95
|
+
accessControlEntryChanged: Event(0, 1 /* EventPriority.Info */, AccessChangeEvent(TlvAccessControlEntry)),
|
|
96
|
+
/**
|
|
97
|
+
* The cluster SHALL send AccessControlExtensionChanged events whenever its extension attribute data is changed
|
|
98
|
+
* by an Administrator.
|
|
99
|
+
*/
|
|
100
|
+
accessControlExtensionChanged: Event(1, 1 /* EventPriority.Info */, AccessChangeEvent(TlvAccessControlExtensionEntry)), /* readAcl: AccessLevel.Administer */
|
|
101
|
+
},
|
|
102
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvFabricIndex } from "../common/FabricIndex.js";
|
|
7
|
+
import { TlvVendorId } from "../common/VendorId.js";
|
|
8
|
+
import { TlvBoolean } from "../tlv/TlvBoolean.js";
|
|
9
|
+
import { TlvUInt16, TlvUInt32 } from "../tlv/TlvNumber.js";
|
|
10
|
+
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
|
|
11
|
+
import { TlvString, TlvString256max, TlvString32max, TlvString64max } from "../tlv/TlvString.js";
|
|
12
|
+
import { Attribute, Cluster, Event, OptionalAttribute, OptionalEvent, OptionalWritableAttribute, WritableAttribute } from "./Cluster.js";
|
|
13
|
+
/**
|
|
14
|
+
* Provides constant values related to overall global capabilities of this Node, that are not cluster-specific.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.1.6.2
|
|
17
|
+
*/
|
|
18
|
+
const TlvCapabilityMinima = TlvObject({
|
|
19
|
+
/** Indicates the minimum number of concurrent CASE sessions that are supported per fabric. */
|
|
20
|
+
caseSessionsPerFabric: TlvField(0, TlvUInt16.bound({ min: 3 })),
|
|
21
|
+
/** Indicate the actual minimum number of concurrent subscriptions supported per fabric. */
|
|
22
|
+
subscriptionsPerFabric: TlvField(1, TlvUInt16.bound({ min: 3 })),
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* This cluster provides attributes and events for determining basic information about Nodes, which supports both
|
|
26
|
+
* commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number,
|
|
27
|
+
* which apply to the whole Node. Also allows setting user device information such as location.
|
|
28
|
+
*
|
|
29
|
+
* @see {@link MatterCoreSpecificationV1_0} § 11.1
|
|
30
|
+
*/
|
|
31
|
+
export const BasicInformationCluster = Cluster({
|
|
32
|
+
id: 0x28,
|
|
33
|
+
name: "Basic Information",
|
|
34
|
+
revision: 1,
|
|
35
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.1.6.3 */
|
|
36
|
+
attributes: {
|
|
37
|
+
/** Revision number of the Data Model against which the Node is certified */
|
|
38
|
+
dataModelRevision: Attribute(0, TlvUInt16),
|
|
39
|
+
/** Human-readable (displayable) name of the vendor for the Node. */
|
|
40
|
+
vendorName: Attribute(1, TlvString32max),
|
|
41
|
+
/** Specifies the {@link VendorId}. */
|
|
42
|
+
vendorId: Attribute(2, TlvVendorId),
|
|
43
|
+
/** Human-readable name of the model for the Node such as the model number assigned by the vendor. */
|
|
44
|
+
productName: Attribute(3, TlvString32max),
|
|
45
|
+
/** Product ID assigned by the vendor that is unique to the specific product of the Node. */
|
|
46
|
+
productId: Attribute(4, TlvUInt16),
|
|
47
|
+
/** User defined name for the Node. It is set during initial commissioning and may be updated by further reconfigurations. */
|
|
48
|
+
nodeLabel: WritableAttribute(5, TlvString32max, { default: "", writeAcl: 1 /* AccessLevel.Manage */ }),
|
|
49
|
+
/** ISO 3166-1 alpha-2 code where the Node is located. Might affect some regulatory aspects. */
|
|
50
|
+
location: WritableAttribute(6, TlvString.bound({ length: 2 }), { default: "XX", writeAcl: 2 /* AccessLevel.Administer */ }),
|
|
51
|
+
/** Version number of the hardware of the Node. The meaning of its value, and the versioning scheme, are vendor defined. */
|
|
52
|
+
hardwareVersion: Attribute(7, TlvUInt16, { default: 0 }),
|
|
53
|
+
/** Human-readable representation of the {@link BasicInformationCluster.attributes.hardwareVersion hardwareVersion} attribute. */
|
|
54
|
+
hardwareVersionString: Attribute(8, TlvString.bound({ minLength: 1, maxLength: 64 })),
|
|
55
|
+
/** Current version number for the software running on this Node. A larger value is newer than a lower value. */
|
|
56
|
+
softwareVersion: Attribute(9, TlvUInt32, { default: 0 }),
|
|
57
|
+
/** Human-readable representation of the {@link BasicInformationCluster.attributes.softwareVersion softwareVersion} attribute. */
|
|
58
|
+
softwareVersionString: Attribute(10, TlvString.bound({ minLength: 1, maxLength: 64 })),
|
|
59
|
+
/** Node manufacturing date formatted with YYYYMMDD. The additional 8 characters might include other vendor related information. */
|
|
60
|
+
manufacturingDate: OptionalAttribute(11, TlvString.bound({ minLength: 8, maxLength: 16 })),
|
|
61
|
+
/** Human-readable vendor assigned part number for the Node whose meaning and numbering scheme is vendor defined. */
|
|
62
|
+
partNumber: OptionalAttribute(12, TlvString32max),
|
|
63
|
+
/** Link to a product specific web page following the syntax as specified in RFC 3986. */
|
|
64
|
+
productURL: OptionalAttribute(13, TlvString256max),
|
|
65
|
+
/** Vendor specific human readable product label. */
|
|
66
|
+
productLabel: OptionalAttribute(14, TlvString64max),
|
|
67
|
+
/** Human readable serial number. */
|
|
68
|
+
serialNumber: OptionalAttribute(15, TlvString32max),
|
|
69
|
+
/** Allows to disable the ability to configure the Node through an on-Node user interface. */
|
|
70
|
+
localConfigDisabled: OptionalWritableAttribute(16, TlvBoolean, { default: false, writeAcl: 1 /* AccessLevel.Manage */ }),
|
|
71
|
+
/** Indicates whether the Node can be reached over the non-native network for bridged devices. */
|
|
72
|
+
reachable: OptionalAttribute(17, TlvBoolean, { default: true }),
|
|
73
|
+
/** Unique identifier for the device, which is constructed in a manufacturer specific manner, updated during factory reset. */
|
|
74
|
+
uniqueId: OptionalAttribute(18, TlvString32max),
|
|
75
|
+
/** Minimum guaranteed value for some system-wide, not cluster-specific, resource capabilities. */
|
|
76
|
+
capabilityMinima: Attribute(19, TlvCapabilityMinima, { default: { caseSessionsPerFabric: 3, subscriptionsPerFabric: 3 } }),
|
|
77
|
+
},
|
|
78
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.1.6.5 */
|
|
79
|
+
events: {
|
|
80
|
+
/** First event fired as soon as reasonable after completing a boot or reboot process. */
|
|
81
|
+
startUp: Event(0, 0 /* EventPriority.Critical */, { softwareVersion: TlvField(0, TlvUInt32) }),
|
|
82
|
+
/** Last event fired prior to any orderly shutdown sequence on a best-effort basis. */
|
|
83
|
+
shutDown: OptionalEvent(1, 0 /* EventPriority.Critical */),
|
|
84
|
+
/** Fired prior to permanently leaving a given Fabric. */
|
|
85
|
+
leave: OptionalEvent(2, 1 /* EventPriority.Info */, { fabricIndex: TlvField(0, TlvFabricIndex) }),
|
|
86
|
+
/** Fired when there is a change in the {@link BasicInformationCluster.attributes.reachable reachable} attribute. */
|
|
87
|
+
reachableChanged: OptionalEvent(3, 1 /* EventPriority.Info */, { reachableNewValue: TlvField(0, TlvBoolean) }),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Cluster, WritableAttribute } from "./Cluster.js";
|
|
7
|
+
import { TlvClusterId } from "../common/ClusterId.js";
|
|
8
|
+
import { TlvEndpointNumber } from "../common/EndpointNumber.js";
|
|
9
|
+
import { TlvNodeId } from "../common/NodeId.js";
|
|
10
|
+
import { TlvGroupId } from "../common/GroupId.js";
|
|
11
|
+
import { TlvObject, TlvOptionalField } from "../tlv/TlvObject.js";
|
|
12
|
+
import { TlvArray } from "../tlv/TlvArray.js";
|
|
13
|
+
/**
|
|
14
|
+
* Provides information about endpoint conformance to a release of a device type definition.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.5.5.1
|
|
17
|
+
*/
|
|
18
|
+
const TlvTarget = TlvObject({
|
|
19
|
+
/** Contains the remote target node ID. If the Endpoint field is present, this field SHALL be present. */
|
|
20
|
+
node: TlvOptionalField(1, TlvNodeId),
|
|
21
|
+
/** Contains the target group ID that represents remote endpoints. If the Endpoint field is present, this field SHALL NOT be present. */
|
|
22
|
+
group: TlvOptionalField(2, TlvGroupId),
|
|
23
|
+
/** Contains the remote endpoint that the local endpoint is bound to. If the Group field is present, this field SHALL NOT be present. */
|
|
24
|
+
endpoint: TlvOptionalField(3, TlvEndpointNumber),
|
|
25
|
+
/**
|
|
26
|
+
* Contains the cluster ID (client & server) on the local and target endpoint(s). If this field is present, the
|
|
27
|
+
* client cluster SHALL also exist on this endpoint (with this Binding cluster). If this field is present, the
|
|
28
|
+
* target SHALL be this cluster on the target endpoint(s).
|
|
29
|
+
*/
|
|
30
|
+
cluster: TlvOptionalField(4, TlvClusterId),
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* A binding represents a persistent relationship between an endpoint and one or more other local or
|
|
34
|
+
* remote endpoints. A binding does not require that the relationship exists. It is up to the node
|
|
35
|
+
* application to set up the relationship.
|
|
36
|
+
*
|
|
37
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.6
|
|
38
|
+
*/
|
|
39
|
+
export const BindingCluster = Cluster({
|
|
40
|
+
id: 0x1e,
|
|
41
|
+
name: "Binding",
|
|
42
|
+
revision: 1,
|
|
43
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.6.5 */
|
|
44
|
+
attributes: {
|
|
45
|
+
/** List of device types and corresponding revisions declaring endpoint conformance. */
|
|
46
|
+
binding: WritableAttribute(0, TlvArray(TlvTarget), { default: [] }), /* non-volatile */
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvFabricIndex } from "../common/FabricIndex.js";
|
|
7
|
+
import { TlvVendorId } from "../common/VendorId.js";
|
|
8
|
+
import { TlvBoolean } from "../tlv/TlvBoolean.js";
|
|
9
|
+
import { TlvUInt16, TlvUInt32 } from "../tlv/TlvNumber.js";
|
|
10
|
+
import { TlvField } from "../tlv/TlvObject.js";
|
|
11
|
+
import { TlvString, TlvString256max, TlvString32max, TlvString64max } from "../tlv/TlvString.js";
|
|
12
|
+
import { Attribute, Cluster, Event, OptionalAttribute, OptionalEvent, OptionalWritableAttribute } from "./Cluster.js";
|
|
13
|
+
/**
|
|
14
|
+
* This Cluster serves two purposes towards a Node communicating with a Bridge:
|
|
15
|
+
* * indicate that the functionality on the Endpoint where it is placed (and its Parts) is bridged from a
|
|
16
|
+
* non-Matter technology, and
|
|
17
|
+
* * provide a centralized collection of attributes that the Node MAY collect to aid in conveying information
|
|
18
|
+
* regarding the Bridged Device to a user, such as the vendor name, the model name, or user-assigned name.
|
|
19
|
+
*
|
|
20
|
+
* This cluster is Derived from Basic Information Cluster.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.13
|
|
23
|
+
*/
|
|
24
|
+
export const BridgedDeviceBasicInformationCluster = Cluster({
|
|
25
|
+
id: 0x39,
|
|
26
|
+
name: "Bridged Device Basic Information",
|
|
27
|
+
revision: 1,
|
|
28
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.13.6 */
|
|
29
|
+
attributes: {
|
|
30
|
+
/** Human-readable (displayable) name of the vendor for the Node. */
|
|
31
|
+
vendorName: OptionalAttribute(1, TlvString32max),
|
|
32
|
+
/** Specifies the {@link VendorId}. */
|
|
33
|
+
vendorId: OptionalAttribute(2, TlvVendorId),
|
|
34
|
+
/** Human-readable name of the model for the Node such as the model number assigned by the vendor. */
|
|
35
|
+
productName: OptionalAttribute(3, TlvString32max),
|
|
36
|
+
/** User defined name for the Node. It is set during initial commissioning and may be updated by further reconfigurations. */
|
|
37
|
+
nodeLabel: OptionalWritableAttribute(5, TlvString32max, { default: "", writeAcl: 1 /* AccessLevel.Manage */ }),
|
|
38
|
+
/** Version number of the hardware of the Node. The meaning of its value, and the versioning scheme, are vendor defined. */
|
|
39
|
+
hardwareVersion: OptionalAttribute(7, TlvUInt16, { default: 0 }),
|
|
40
|
+
/** Human-readable representation of the {@link BasicInformationCluster.attributes.hardwareVersion hardwareVersion} attribute. */
|
|
41
|
+
hardwareVersionString: OptionalAttribute(8, TlvString.bound({ minLength: 1, maxLength: 64 })),
|
|
42
|
+
/** Current version number for the software running on this Node. A larger value is newer than a lower value. */
|
|
43
|
+
softwareVersion: OptionalAttribute(9, TlvUInt32, { default: 0 }),
|
|
44
|
+
/** Human-readable representation of the {@link BasicInformationCluster.attributes.softwareVersion softwareVersion} attribute. */
|
|
45
|
+
softwareVersionString: OptionalAttribute(10, TlvString.bound({ minLength: 1, maxLength: 64 })),
|
|
46
|
+
/** Node manufacturing date formatted with YYYYMMDD. The additional 8 characters might include other vendor related information. */
|
|
47
|
+
manufacturingDate: OptionalAttribute(11, TlvString.bound({ minLength: 8, maxLength: 16 })),
|
|
48
|
+
/** Human-readable vendor assigned part number for the Node whose meaning and numbering scheme is vendor defined. */
|
|
49
|
+
partNumber: OptionalAttribute(12, TlvString32max),
|
|
50
|
+
/** Link to a product specific web page following the syntax as specified in RFC 3986. */
|
|
51
|
+
productURL: OptionalAttribute(13, TlvString256max),
|
|
52
|
+
/** Vendor specific human readable product label. */
|
|
53
|
+
productLabel: OptionalAttribute(14, TlvString64max),
|
|
54
|
+
/** Human-readable serial number. */
|
|
55
|
+
serialNumber: OptionalAttribute(15, TlvString32max),
|
|
56
|
+
/** Indicates whether the bridged device is reachable by the bridge over the non-Matter network. */
|
|
57
|
+
reachable: Attribute(17, TlvBoolean, { default: true }),
|
|
58
|
+
/** Unique identifier for the device, which is constructed in a manufacturer specific manner, updated during factory reset. */
|
|
59
|
+
uniqueId: OptionalAttribute(18, TlvString32max),
|
|
60
|
+
},
|
|
61
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 11.1.6.5 */
|
|
62
|
+
events: {
|
|
63
|
+
/** First event fired as soon as reasonable after completing a boot or reboot process. */
|
|
64
|
+
startUp: OptionalEvent(0, 0 /* EventPriority.Critical */, { softwareVersion: TlvField(0, TlvUInt32) }),
|
|
65
|
+
/** Last event fired prior to any orderly shutdown sequence on a best-effort basis. */
|
|
66
|
+
shutDown: OptionalEvent(1, 0 /* EventPriority.Critical */),
|
|
67
|
+
/** Fired prior to permanently leaving a given Fabric. */
|
|
68
|
+
leave: OptionalEvent(2, 1 /* EventPriority.Info */, { fabricIndex: TlvField(0, TlvFabricIndex) }),
|
|
69
|
+
/** Fired when there is a change in the {@link BasicInformationCluster.attributes.reachable reachable} attribute */
|
|
70
|
+
reachableChanged: Event(3, 1 /* EventPriority.Info */, { reachableNewValue: TlvField(0, TlvBoolean) }),
|
|
71
|
+
},
|
|
72
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { TlvBitmap, TlvUInt16, TlvUInt32 } from "../tlv/TlvNumber.js";
|
|
7
|
+
import { TlvObject } from "../tlv/TlvObject.js";
|
|
8
|
+
import { TlvVoid } from "../tlv/TlvVoid.js";
|
|
9
|
+
import { Merge } from "../util/Type.js";
|
|
10
|
+
;
|
|
11
|
+
export const Attribute = (id, schema, { default: conformanceValue, readAcl = 0 /* AccessLevel.View */ } = {}) => ({ id, schema, optional: false, writable: false, default: conformanceValue, readAcl });
|
|
12
|
+
export const OptionalAttribute = (id, schema, { default: conformanceValue, readAcl = 0 /* AccessLevel.View */ } = {}) => ({ id, schema, optional: true, writable: false, default: conformanceValue, readAcl });
|
|
13
|
+
export const WritableAttribute = (id, schema, { default: conformanceValue, readAcl = 0 /* AccessLevel.View */, writeAcl = 0 /* AccessLevel.View */ } = {}) => ({ id, schema, optional: false, writable: true, default: conformanceValue, readAcl, writeAcl });
|
|
14
|
+
export const OptionalWritableAttribute = (id, schema, { default: conformanceValue, readAcl = 0 /* AccessLevel.View */, writeAcl = 0 /* AccessLevel.View */ } = {}) => ({ id, schema, optional: true, writable: true, default: conformanceValue, readAcl, writeAcl });
|
|
15
|
+
/* Interfaces and helper methods to define a cluster command */
|
|
16
|
+
export const TlvNoArguments = TlvObject({});
|
|
17
|
+
export const TlvNoResponse = TlvVoid;
|
|
18
|
+
;
|
|
19
|
+
;
|
|
20
|
+
export const Command = (requestId, requestSchema, responseId, responseSchema) => ({ optional: false, requestId, requestSchema, responseId, responseSchema });
|
|
21
|
+
export const OptionalCommand = (requestId, requestSchema, responseId, responseSchema) => ({ optional: true, requestId, requestSchema, responseId, responseSchema });
|
|
22
|
+
export const Event = (id, priority, data = {}) => ({ id, schema: TlvObject(data), priority, optional: false });
|
|
23
|
+
export const OptionalEvent = (id, priority, data = {}) => ({ id, schema: TlvObject(data), priority, optional: true });
|
|
24
|
+
export const GlobalAttributes = (features) => ({
|
|
25
|
+
clusterRevision: Attribute(0xFFFD, TlvUInt16),
|
|
26
|
+
featureMap: Attribute(0xFFFC, TlvBitmap(TlvUInt32, features)),
|
|
27
|
+
});
|
|
28
|
+
export const Cluster = ({ id, name, revision, features = {}, attributes = {}, commands = {}, events = {}, }) => ({
|
|
29
|
+
id,
|
|
30
|
+
name,
|
|
31
|
+
revision,
|
|
32
|
+
features,
|
|
33
|
+
commands,
|
|
34
|
+
attributes: Merge(attributes, GlobalAttributes(features)),
|
|
35
|
+
events,
|
|
36
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Attribute, Cluster } from "./Cluster.js";
|
|
7
|
+
import { TlvDeviceTypeId } from "../common/DeviceTypeId.js";
|
|
8
|
+
import { TlvClusterId } from "../common/ClusterId.js";
|
|
9
|
+
import { TlvEndpointNumber } from "../common/EndpointNumber.js";
|
|
10
|
+
import { TlvField, TlvObject } from "../tlv/TlvObject.js";
|
|
11
|
+
import { TlvUInt16 } from "../tlv/TlvNumber.js";
|
|
12
|
+
import { TlvArray } from "../tlv/TlvArray.js";
|
|
13
|
+
/**
|
|
14
|
+
* Provides information about endpoint conformance to a release of a device type definition.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.5.5.1
|
|
17
|
+
*/
|
|
18
|
+
const TlvDeviceType = TlvObject({
|
|
19
|
+
/** Indicates the device type definition */
|
|
20
|
+
type: TlvField(0, TlvDeviceTypeId),
|
|
21
|
+
/** Indicates the implemented revision of the device type definition */
|
|
22
|
+
revision: TlvField(1, TlvUInt16.bound({ min: 1 })),
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* This cluster describes an endpoint instance on the node, independently of other endpoints, but also
|
|
26
|
+
* allows composition of endpoints to conform to complex device type patterns.
|
|
27
|
+
* This Cluster is also meant to replace the support from the Zigbee Device Object (ZDO) for describing a node,
|
|
28
|
+
* its endpoints and clusters.
|
|
29
|
+
*
|
|
30
|
+
* @see {@link MatterCoreSpecificationV1_0} § 9.5
|
|
31
|
+
*/
|
|
32
|
+
export const DescriptorCluster = Cluster({
|
|
33
|
+
id: 0x1d,
|
|
34
|
+
name: "Descriptor",
|
|
35
|
+
revision: 1,
|
|
36
|
+
/** @see {@link MatterCoreSpecificationV1_0} § 9.5.4 */
|
|
37
|
+
attributes: {
|
|
38
|
+
/** List of device types and corresponding revisions declaring endpoint conformance. */
|
|
39
|
+
deviceTypeList: Attribute(0, TlvArray(TlvDeviceType, { minLength: 1 })),
|
|
40
|
+
/** List containing each cluster ID for the server clusters present on the endpoint instance. */
|
|
41
|
+
serverList: Attribute(1, TlvArray(TlvClusterId), { default: [] }),
|
|
42
|
+
/** List containing each cluster ID for the client clusters present on the endpoint instance. */
|
|
43
|
+
clientList: Attribute(3, TlvArray(TlvClusterId), { default: [] }),
|
|
44
|
+
/**
|
|
45
|
+
* This indicates composition of the device type instance. Device type instance composition SHALL
|
|
46
|
+
* include the endpoints in this list.
|
|
47
|
+
*/
|
|
48
|
+
partsList: Attribute(4, TlvArray(TlvEndpointNumber), { default: [] }),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -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
|
+
});
|