mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Add dbus methods and CLI args for battery charge limit
This commit is contained in:
@@ -121,6 +121,19 @@ impl AuraDbusWriter {
|
||||
Err(Box::new(dbus::Error::new_custom("name", "message")))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn write_charge_limit(&self, level: u8) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let msg = Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "ChargeLimit")?
|
||||
.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,
|
||||
|
||||
Reference in New Issue
Block a user