aranet_core/commands.rs
1//! BLE command constants for Aranet devices.
2//!
3//! This module contains the command bytes used in the Aranet BLE protocol.
4
5/// History V2 request command (read-based protocol).
6/// Format: `[HISTORY_V2_REQUEST, param, start_lo, start_hi]`
7pub const HISTORY_V2_REQUEST: u8 = 0x61;
8
9/// History V1 request command (notification-based protocol).
10/// Format: `[HISTORY_V1_REQUEST, param, start_lo, start_hi, count_lo, count_hi]`
11pub const HISTORY_V1_REQUEST: u8 = 0x82;
12
13/// Set measurement interval command.
14/// Format: `[SET_INTERVAL, minutes]`
15/// Valid minutes: 1, 2, 5, 10
16pub const SET_INTERVAL: u8 = 0x90;
17
18/// Enable/disable Smart Home integration command.
19/// Format: `[SET_SMART_HOME, enabled]`
20/// enabled: 0x00 = disabled, 0x01 = enabled
21pub const SET_SMART_HOME: u8 = 0x91;
22
23/// Set Bluetooth range command.
24/// Format: `[SET_BLUETOOTH_RANGE, range]`
25/// range: 0x00 = standard, 0x01 = extended
26pub const SET_BLUETOOTH_RANGE: u8 = 0x92;
27
28#[cfg(test)]
29mod tests {
30 use super::*;
31
32 #[test]
33 fn test_command_values() {
34 assert_eq!(HISTORY_V2_REQUEST, 0x61);
35 assert_eq!(HISTORY_V1_REQUEST, 0x82);
36 assert_eq!(SET_INTERVAL, 0x90);
37 assert_eq!(SET_SMART_HOME, 0x91);
38 assert_eq!(SET_BLUETOOTH_RANGE, 0x92);
39 }
40}