Send fan-mode over dbus. Fix multizone dbus command

Closes issue #7
This commit is contained in:
Luke
2020-05-23 14:20:59 +12:00
parent de10fe13e7
commit 46041c0343
9 changed files with 121 additions and 21 deletions

View File

@@ -89,7 +89,7 @@ impl AuraDbusWriter {
) -> Result<(), Box<dyn Error>> {
self.connection.process(Duration::from_micros(300))?;
let msg = Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "LedWriteEffect")?
let msg = Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "LedWriteMultizone")?
.append1(&group[0].to_vec())
.append1(&group[1].to_vec())
.append1(&group[2].to_vec())
@@ -115,6 +115,19 @@ impl AuraDbusWriter {
Err(Box::new(dbus::Error::new_custom("name", "message")))
}
#[inline]
pub fn write_fan_mode(&self, level: u8) -> Result<String, Box<dyn std::error::Error>> {
let msg =
Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "FanMode")?.append1(level);
let r = self
.connection
.send_with_reply_and_block(msg, Duration::from_millis(5000))?;
if let Some(reply) = r.get1::<&str>() {
return Ok(reply.to_owned());
}
Err(Box::new(dbus::Error::new_custom("name", "message")))
}
#[inline]
pub fn write_builtin_mode(
&self,