From deae62cd01b6d7bde6b684fc64a607a09f066f4f Mon Sep 17 00:00:00 2001 From: Lennard Kittner Date: Thu, 25 Sep 2025 19:58:09 +0200 Subject: [PATCH] Detect surround sound --- src/devices/cloud_ii_wireless.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/devices/cloud_ii_wireless.rs b/src/devices/cloud_ii_wireless.rs index da6b454..6ef343c 100644 --- a/src/devices/cloud_ii_wireless.rs +++ b/src/devices/cloud_ii_wireless.rs @@ -165,27 +165,28 @@ impl Device for CloudIIWireless { } println!("Received packet: {:?}", response); match ( + response[0], response[3], response[4], response[7], response[12], response[14], ) { - (GET_BATTERY_CMD_ID, _, level, _, _) => { + (_, GET_BATTERY_CMD_ID, _, level, _, _) => { println!("Battery Level {level}"); Some(vec![DeviceEvent::BatterLevel(level)]) } - (GET_CHARGING_CMD_ID, status, _, _, _) => { + (11, GET_CHARGING_CMD_ID, status, _, _, _) => { println!("Charging {status} {:?}", ChargingStatus::from(status)); Some(vec![DeviceEvent::Charging(ChargingStatus::from(status))]) } - (GET_AUTO_SHUTDOWN_CMD_ID, shutdown, _, _, _) => { + (_, GET_AUTO_SHUTDOWN_CMD_ID, shutdown, _, _, _) => { println!("Shutdown time {shutdown}"); Some(vec![DeviceEvent::AutomaticShutdownAfter( Duration::from_secs(shutdown as u64 * 60), )]) } - (GET_MUTE_CMD_ID, muted, _, surround, other) => { + (_, GET_MUTE_CMD_ID, muted, _, surround, other) => { println!("More info {} {}", surround, other); Some(vec![ DeviceEvent::SideToneOn((other & 16) != 0), @@ -193,6 +194,10 @@ impl Device for CloudIIWireless { DeviceEvent::SurroundSound((surround & 2) != 0), ]) } + (10, surround, _, _, _, _) => { + println!("Surround sound {}", surround); + Some(vec![DeviceEvent::SurroundSound((surround & 3) == 0)]) + } _ => { println!("Unknown device event: {:?}", response); None