Detect surround sound

This commit is contained in:
Lennard Kittner
2025-09-25 19:58:09 +02:00
parent 3627f3d639
commit deae62cd01

View File

@@ -165,27 +165,28 @@ impl Device for CloudIIWireless {
} }
println!("Received packet: {:?}", response); println!("Received packet: {:?}", response);
match ( match (
response[0],
response[3], response[3],
response[4], response[4],
response[7], response[7],
response[12], response[12],
response[14], response[14],
) { ) {
(GET_BATTERY_CMD_ID, _, level, _, _) => { (_, GET_BATTERY_CMD_ID, _, level, _, _) => {
println!("Battery Level {level}"); println!("Battery Level {level}");
Some(vec![DeviceEvent::BatterLevel(level)]) Some(vec![DeviceEvent::BatterLevel(level)])
} }
(GET_CHARGING_CMD_ID, status, _, _, _) => { (11, GET_CHARGING_CMD_ID, status, _, _, _) => {
println!("Charging {status} {:?}", ChargingStatus::from(status)); println!("Charging {status} {:?}", ChargingStatus::from(status));
Some(vec![DeviceEvent::Charging(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}"); println!("Shutdown time {shutdown}");
Some(vec![DeviceEvent::AutomaticShutdownAfter( Some(vec![DeviceEvent::AutomaticShutdownAfter(
Duration::from_secs(shutdown as u64 * 60), 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); println!("More info {} {}", surround, other);
Some(vec![ Some(vec![
DeviceEvent::SideToneOn((other & 16) != 0), DeviceEvent::SideToneOn((other & 16) != 0),
@@ -193,6 +194,10 @@ impl Device for CloudIIWireless {
DeviceEvent::SurroundSound((surround & 2) != 0), DeviceEvent::SurroundSound((surround & 2) != 0),
]) ])
} }
(10, surround, _, _, _, _) => {
println!("Surround sound {}", surround);
Some(vec![DeviceEvent::SurroundSound((surround & 3) == 0)])
}
_ => { _ => {
println!("Unknown device event: {:?}", response); println!("Unknown device event: {:?}", response);
None None