Skip to main content

rs_matter/dm/
devices.rs

1/*
2 *
3 *    Copyright (c) 2022-2026 Project CHIP Authors
4 *
5 *    Licensed under the Apache License, Version 2.0 (the "License");
6 *    you may not use this file except in compliance with the License.
7 *    You may obtain a copy of the License at
8 *
9 *        http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *    Unless required by applicable law or agreed to in writing, software
12 *    distributed under the License is distributed on an "AS IS" BASIS,
13 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *    See the License for the specific language governing permissions and
15 *    limitations under the License.
16 */
17
18use super::types::DeviceType;
19
20pub mod test;
21
22/// A constant representing the device type for the root (ep0) endpoint in Matter.
23///
24/// Matter Device Library revision history: rev 1 was initial; rev 2
25/// added Power Source (conditional, optional); rev 3 added MNGD-feature
26/// restriction on Access Control; rev 4 added conditions and cluster
27/// requirements for Time Sync, TLS Certificate/Client Management. All four
28/// rev-2..4 additions are either conditional or `O` (optional) per spec;
29/// rs-matter implements the rev-1 mandatory set (BasicInfo, AccessControl,
30/// GeneralCommissioning, NetworkCommissioning, GeneralDiagnostics,
31/// AdminCommissioning, OperationalCredentials, GroupKeyManagement) and is
32/// therefore conformant at rev 4.
33pub const DEV_TYPE_ROOT_NODE: DeviceType = DeviceType {
34    dtype: 0x0016,
35    drev: 4,
36};
37
38/// A constant representing the device type for a bridged device endpoint in the node.
39pub const DEV_TYPE_BRIDGED_NODE: DeviceType = DeviceType {
40    dtype: 0x0013,
41    drev: 1,
42};
43
44/// A constant representing the device type for an aggregator endpoint in the node
45///  when the Node contains bridged endpoints.
46pub const DEV_TYPE_AGGREGATOR: DeviceType = DeviceType {
47    dtype: 0x000e,
48    drev: 1,
49};
50
51/// The OTA Requestor device type: a node that obtains and applies software
52/// updates. It hosts the OTA Software Update Requestor cluster (server) and is a
53/// client of the OTA Software Update Provider cluster.
54pub const DEV_TYPE_OTA_REQUESTOR: DeviceType = DeviceType {
55    dtype: 0x0012,
56    drev: 1,
57};
58
59/// The OTA Provider device type: a node that serves software updates. It hosts
60/// the OTA Software Update Provider cluster (server) and is a client of the OTA
61/// Software Update Requestor cluster.
62pub const DEV_TYPE_OTA_PROVIDER: DeviceType = DeviceType {
63    dtype: 0x0014,
64    drev: 1,
65};
66
67/// A constant representing the On/Off Light device in Matter.
68///
69/// Matter Device Library revision history: rev 1 was Zigbee-3.0
70/// initial; rev 2 was the new data-model-format/notation rewrite; rev 3
71/// swapped the deprecated Scenes cluster (0x0005) for Scenes Management
72/// (0x0062). Conformance tests (TC_DeviceConformance::test_TC_IDM_10_5/_6)
73/// always evaluate the cluster set against the *current* spec, so claiming
74/// the latest revision matches the test framework's expectation.
75///
76/// Note: `On/Off Light` mandates Identify, Groups, On/Off (with the `LT`
77/// Lighting feature), and Scenes Management at rev 3. rs-matter does not
78/// yet implement Scenes Management — applications using this device type
79/// won't pass `test_TC_IDM_10_5` until that gap is closed.
80pub const DEV_TYPE_ON_OFF_LIGHT: DeviceType = DeviceType {
81    dtype: 0x0100,
82    drev: 3,
83};
84
85pub const DEV_TYPE_DIMMABLE_LIGHT: DeviceType = DeviceType {
86    dtype: 0x0101,
87    drev: 3,
88};
89
90/// On/Off Light Switch — a controller device type that mandates the
91/// `OnOff` cluster as a **client** (i.e. it initiates On/Off commands to a
92/// bound light) plus the `Binding` cluster as a server (its address book of
93/// bound targets). See the Matter Device Library spec.
94pub const DEV_TYPE_ON_OFF_LIGHT_SWITCH: DeviceType = DeviceType {
95    dtype: 0x0103,
96    drev: 3,
97};
98
99/// Generic Switch — a device type for a button/switch that reports user
100/// presses via the `Switch` cluster (as a **server**), emitting events such as
101/// `InitialPress`/`ShortRelease`. Ecosystems surface these events as automation
102/// triggers. Unlike `DEV_TYPE_ON_OFF_LIGHT_SWITCH`, it does not bind to or
103/// command any device itself. See the Matter Device Library spec.
104pub const DEV_TYPE_GENERIC_SWITCH: DeviceType = DeviceType {
105    dtype: 0x000F,
106    drev: 2,
107};
108
109/// Extended Color Light — mandates OnOff, LevelControl, and
110/// ColorControl with the full feature set (HUE_AND_SATURATION, XY,
111/// COLOR_TEMPERATURE, ENHANCED_HUE, COLOR_LOOP).
112pub const DEV_TYPE_EXTENDED_COLOR_LIGHT: DeviceType = DeviceType {
113    dtype: 0x010D,
114    drev: 4,
115};
116
117/// A constant representing the Smart Speaker device in Matter.
118pub const DEV_TYPE_SMART_SPEAKER: DeviceType = DeviceType {
119    dtype: 0x0022,
120    drev: 2,
121};
122
123/// A constant representing the casting video player device in Matter.
124pub const DEV_TYPE_CASTING_VIDEO_PLAYER: DeviceType = DeviceType {
125    dtype: 0x0023,
126    drev: 1,
127};
128
129/// A constant representing the video player device in Matter.
130pub const DEV_TYPE_VIDEO_PLAYER: DeviceType = DeviceType {
131    dtype: 0x0028,
132    drev: 1,
133};
134
135/// A macro to generate the devices for an endpoint.
136#[allow(unused_macros)]
137#[macro_export]
138macro_rules! devices {
139    ($($device:expr $(,)?)*) => {
140        &[
141            $($device,)*
142        ]
143    }
144}