Skip to main content

zigbee_deconz/
ids.rs

1//! Command ids, parameters, states and statuses.
2
3/// Command ids.
4pub mod command {
5    /// APS data confirm (read one).
6    pub const APS_DATA_CONFIRM: u8 = 0x04;
7    /// Device state.
8    pub const DEVICE_STATE: u8 = 0x07;
9    /// Change the network state (offline or connected).
10    pub const CHANGE_NETWORK_STATE: u8 = 0x08;
11    /// Read a parameter.
12    pub const READ_PARAMETER: u8 = 0x0A;
13    /// Write a parameter.
14    pub const WRITE_PARAMETER: u8 = 0x0B;
15    /// Firmware version.
16    pub const VERSION: u8 = 0x0D;
17    /// The device state changed (unsolicited).
18    pub const DEVICE_STATE_CHANGED: u8 = 0x0E;
19    /// Send an APS frame.
20    pub const APS_DATA_REQUEST: u8 = 0x12;
21    /// APS data indication (read one received frame).
22    pub const APS_DATA_INDICATION: u8 = 0x17;
23    /// A Green Power frame (unsolicited).
24    pub const ZIGBEE_GREEN_POWER: u8 = 0x19;
25    /// A child polled (unsolicited).
26    pub const MAC_POLL: u8 = 0x1C;
27}
28
29/// Network parameters for `READ_PARAMETER` and `WRITE_PARAMETER`.
30pub mod param {
31    /// The coordinator's IEEE address (u64).
32    pub const MAC_ADDRESS: u8 = 0x01;
33    /// PAN id (u16).
34    pub const NWK_PANID: u8 = 0x05;
35    /// Network address (u16).
36    pub const NWK_ADDRESS: u8 = 0x07;
37    /// The running network's extended PAN id (u64).
38    pub const NWK_EXTENDED_PANID: u8 = 0x08;
39    /// Act as coordinator (u8).
40    pub const APS_DESIGNED_COORDINATOR: u8 = 0x09;
41    /// Channels (u32).
42    pub const CHANNEL_MASK: u8 = 0x0A;
43    /// The extended PAN id to form with (u64).
44    pub const APS_EXTENDED_PANID: u8 = 0x0B;
45    /// Trust center address (u64).
46    pub const TRUST_CENTER_ADDRESS: u8 = 0x0E;
47    /// Security mode (u8).
48    pub const SECURITY_MODE: u8 = 0x10;
49    /// Form with the configured PAN id (u8).
50    pub const USE_PREDEFINED_NWK_PANID: u8 = 0x15;
51    /// Network key: index (u8) then key.
52    pub const NETWORK_KEY: u8 = 0x18;
53    /// A link key: IEEE address (u64) then key.
54    pub const LINK_KEY: u8 = 0x19;
55    /// Current channel (u8).
56    pub const CURRENT_CHANNEL: u8 = 0x1C;
57    /// Permit joining, seconds (u8).
58    pub const PERMIT_JOIN: u8 = 0x21;
59    /// Serial protocol version (u16).
60    pub const PROTOCOL_VERSION: u8 = 0x22;
61    /// Network update id (u8).
62    pub const NWK_UPDATE_ID: u8 = 0x24;
63    /// Watchdog time to live, seconds (u32).
64    pub const WATCHDOG_TTL: u8 = 0x26;
65    /// Outgoing network frame counter (u32).
66    pub const NWK_FRAME_COUNTER: u8 = 0x27;
67    /// Pass ZDP responses to the host (u16).
68    pub const APP_ZDP_RESPONSE_HANDLING: u8 = 0x28;
69}
70
71/// Network states (the low two bits of the device state).
72pub mod net_state {
73    /// Not on a network.
74    pub const OFFLINE: u8 = 0;
75    /// Joining.
76    pub const JOINING: u8 = 1;
77    /// Running.
78    pub const CONNECTED: u8 = 2;
79    /// Leaving.
80    pub const LEAVING: u8 = 3;
81}
82
83/// Device state flags.
84pub mod device_state {
85    /// The network state's bits.
86    pub const NETWORK_MASK: u8 = 0x03;
87    /// An APS data confirm is waiting.
88    pub const CONFIRM_PENDING: u8 = 0x04;
89    /// An APS data indication is waiting.
90    pub const INDICATION_PENDING: u8 = 0x08;
91    /// The configuration changed.
92    pub const CONFIG_CHANGED: u8 = 0x10;
93    /// The firmware can take another APS data request.
94    pub const REQUEST_FREE: u8 = 0x20;
95}
96
97/// Frame statuses.
98pub mod status {
99    /// Success.
100    pub const SUCCESS: u8 = 0;
101    /// Failure.
102    pub const FAILURE: u8 = 1;
103    /// Busy.
104    pub const BUSY: u8 = 2;
105    /// Timeout.
106    pub const TIMEOUT: u8 = 3;
107    /// Unsupported.
108    pub const UNSUPPORTED: u8 = 4;
109    /// Error.
110    pub const ERROR: u8 = 5;
111    /// No network.
112    pub const NO_NETWORK: u8 = 6;
113    /// Invalid value.
114    pub const INVALID_VALUE: u8 = 7;
115}
116
117/// APS transmit options.
118pub mod tx_option {
119    /// Request an APS acknowledgement.
120    pub const ACK: u8 = 0x04;
121}
122
123/// Security modes.
124pub mod security_mode {
125    /// The network key under the trust center link key.
126    pub const TC_LINK_KEY: u8 = 3;
127}
128
129/// Platforms in byte 1 of the firmware version.
130pub mod platform {
131    /// ConBee, RaspBee (AVR).
132    pub const AVR: u8 = 0x05;
133    /// ConBee II, RaspBee II (ARM).
134    pub const ARM: u8 = 0x07;
135    /// ConBee III (EFR32).
136    pub const EFR32: u8 = 0x09;
137}