rs_matter_node_core/icd.rs
1/*
2 *
3 * Copyright (c) 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
18//! What an Intermittently Connected Device (ICD) advertises about itself.
19
20/// The operating mode of a Long-Idle-Time-capable ICD.
21#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
22#[cfg_attr(feature = "defmt", derive(defmt::Format))]
23pub enum IcdOperatingMode {
24 /// Short Idle Time
25 Sit,
26 /// Long Idle Time
27 Lit,
28}
29
30/// What an ICD advertises about itself, over DNS-SD and in the session
31/// parameters of its CASE / PASE handshakes - and what its subscriptions are
32/// paced by.
33///
34/// The ICD Management handler keeps `Matter` supplied with it
35/// (see `Matter::icd_advertisement`); a node
36/// that is not an ICD advertises none.
37#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
38#[cfg_attr(feature = "defmt", derive(defmt::Format))]
39pub struct IcdAdvertisement {
40 /// The `ActiveModeThreshold`, in milliseconds: the advertised
41 /// `SESSION_ACTIVE_THRESHOLD` (`SAT` TXT key).
42 pub active_threshold_ms: u16,
43 /// The slow polling interval in effect, in milliseconds: what the device is
44 /// reachable within while idle, so the least `SESSION_IDLE_INTERVAL`
45 /// (`SII` TXT key) it may advertise.
46 pub slow_poll_ms: u32,
47 /// The current operating mode of a Long-Idle-Time-capable ICD: the `ICD`
48 /// TXT key (`0` for `SIT`, `1` for `LIT`). `None` for a SIT-only ICD, which
49 /// has no `ICD` key.
50 pub operating_mode: Option<IcdOperatingMode>,
51 /// The idle mode duration, in seconds. Subscriptions to the device pick
52 /// their max interval from it, so that their reports wake the device no
53 /// more often than idle mode ends anyway.
54 pub idle_mode_duration_s: u32,
55}