// This code was autogenerated with `dbus-codegen-rust -s -d org.asuslinux.Daemon -f org.asuslinux.Daemon -c blocking -p /org/asuslinux/Charge -m None`, see https://github.com/diwic/dbus-rs
use dbus as dbus;
#[allow(unused_imports)]
use dbus::arg;
use dbus::blocking;

pub trait OrgAsuslinuxDaemon {
    fn set_limit(&self, limit: u8) -> Result<(), dbus::Error>;
    fn limit(&self) -> Result<i16, dbus::Error>;
}

impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> OrgAsuslinuxDaemon for blocking::Proxy<'a, C> {

    fn set_limit(&self, limit: u8) -> Result<(), dbus::Error> {
        self.method_call("org.asuslinux.Daemon", "SetLimit", (limit, ))
    }

    fn limit(&self) -> Result<i16, dbus::Error> {
        self.method_call("org.asuslinux.Daemon", "Limit", ())
            .and_then(|r: (i16, )| Ok(r.0, ))
    }
}

#[derive(Debug)]
pub struct OrgAsuslinuxDaemonNotifyCharge {
    pub limit: u8,
}

impl arg::AppendAll for OrgAsuslinuxDaemonNotifyCharge {
    fn append(&self, i: &mut arg::IterAppend) {
        arg::RefArg::append(&self.limit, i);
    }
}

impl arg::ReadAll for OrgAsuslinuxDaemonNotifyCharge {
    fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
        Ok(OrgAsuslinuxDaemonNotifyCharge {
            limit: i.read()?,
        })
    }
}

impl dbus::message::SignalArgs for OrgAsuslinuxDaemonNotifyCharge {
    const NAME: &'static str = "NotifyCharge";
    const INTERFACE: &'static str = "org.asuslinux.Daemon";
}
