// This code was autogenerated with `dbus-codegen-rust -d org.freedesktop.DBus -p /org/freedesktop/DBus -m none -c blocking -g -i org.freedesktop. --dbuscrate crate --interfaces DBus -o dbus/src/blocking/generated_org_freedesktop_dbus.rs`, see https://github.com/diwic/dbus-rs
use crate as dbus;
#[allow(unused_imports)]
use crate::arg;
use crate::blocking;

pub trait DBus {
    fn hello(&self) -> Result<String, dbus::Error>;
    fn request_name(&self, arg0: &str, arg1: u32) -> Result<u32, dbus::Error>;
    fn release_name(&self, arg0: &str) -> Result<u32, dbus::Error>;
    fn start_service_by_name(&self, arg0: &str, arg1: u32) -> Result<u32, dbus::Error>;
    fn update_activation_environment(&self, arg0: ::std::collections::HashMap<&str, &str>) -> Result<(), dbus::Error>;
    fn name_has_owner(&self, arg0: &str) -> Result<bool, dbus::Error>;
    fn list_names(&self) -> Result<Vec<String>, dbus::Error>;
    fn list_activatable_names(&self) -> Result<Vec<String>, dbus::Error>;
    fn add_match(&self, arg0: &str) -> Result<(), dbus::Error>;
    fn remove_match(&self, arg0: &str) -> Result<(), dbus::Error>;
    fn get_name_owner(&self, arg0: &str) -> Result<String, dbus::Error>;
    fn list_queued_owners(&self, arg0: &str) -> Result<Vec<String>, dbus::Error>;
    fn get_connection_unix_user(&self, arg0: &str) -> Result<u32, dbus::Error>;
    fn get_connection_unix_process_id(&self, arg0: &str) -> Result<u32, dbus::Error>;
    fn get_adt_audit_session_data(&self, arg0: &str) -> Result<Vec<u8>, dbus::Error>;
    fn get_connection_selinux_security_context(&self, arg0: &str) -> Result<Vec<u8>, dbus::Error>;
    fn reload_config(&self) -> Result<(), dbus::Error>;
    fn get_id(&self) -> Result<String, dbus::Error>;
    fn get_connection_credentials(&self, arg0: &str) -> Result<arg::PropMap, dbus::Error>;
    fn features(&self) -> Result<Vec<String>, dbus::Error>;
    fn interfaces(&self) -> Result<Vec<String>, dbus::Error>;
}

#[derive(Debug)]
pub struct DBusNameOwnerChanged {
    pub arg0: String,
    pub arg1: String,
    pub arg2: String,
}

impl arg::AppendAll for DBusNameOwnerChanged {
    fn append(&self, i: &mut arg::IterAppend) {
        arg::RefArg::append(&self.arg0, i);
        arg::RefArg::append(&self.arg1, i);
        arg::RefArg::append(&self.arg2, i);
    }
}

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

impl dbus::message::SignalArgs for DBusNameOwnerChanged {
    const NAME: &'static str = "NameOwnerChanged";
    const INTERFACE: &'static str = "org.freedesktop.DBus";
}

#[derive(Debug)]
pub struct DBusNameLost {
    pub arg0: String,
}

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

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

impl dbus::message::SignalArgs for DBusNameLost {
    const NAME: &'static str = "NameLost";
    const INTERFACE: &'static str = "org.freedesktop.DBus";
}

#[derive(Debug)]
pub struct DBusNameAcquired {
    pub arg0: String,
}

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

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

impl dbus::message::SignalArgs for DBusNameAcquired {
    const NAME: &'static str = "NameAcquired";
    const INTERFACE: &'static str = "org.freedesktop.DBus";
}

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

    fn hello(&self) -> Result<String, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "Hello", ())
            .and_then(|r: (String, )| Ok(r.0, ))
    }

    fn request_name(&self, arg0: &str, arg1: u32) -> Result<u32, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "RequestName", (arg0, arg1, ))
            .and_then(|r: (u32, )| Ok(r.0, ))
    }

    fn release_name(&self, arg0: &str) -> Result<u32, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "ReleaseName", (arg0, ))
            .and_then(|r: (u32, )| Ok(r.0, ))
    }

    fn start_service_by_name(&self, arg0: &str, arg1: u32) -> Result<u32, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "StartServiceByName", (arg0, arg1, ))
            .and_then(|r: (u32, )| Ok(r.0, ))
    }

    fn update_activation_environment(&self, arg0: ::std::collections::HashMap<&str, &str>) -> Result<(), dbus::Error> {
        self.method_call("org.freedesktop.DBus", "UpdateActivationEnvironment", (arg0, ))
    }

    fn name_has_owner(&self, arg0: &str) -> Result<bool, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "NameHasOwner", (arg0, ))
            .and_then(|r: (bool, )| Ok(r.0, ))
    }

    fn list_names(&self) -> Result<Vec<String>, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "ListNames", ())
            .and_then(|r: (Vec<String>, )| Ok(r.0, ))
    }

    fn list_activatable_names(&self) -> Result<Vec<String>, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "ListActivatableNames", ())
            .and_then(|r: (Vec<String>, )| Ok(r.0, ))
    }

    fn add_match(&self, arg0: &str) -> Result<(), dbus::Error> {
        self.method_call("org.freedesktop.DBus", "AddMatch", (arg0, ))
    }

    fn remove_match(&self, arg0: &str) -> Result<(), dbus::Error> {
        self.method_call("org.freedesktop.DBus", "RemoveMatch", (arg0, ))
    }

    fn get_name_owner(&self, arg0: &str) -> Result<String, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "GetNameOwner", (arg0, ))
            .and_then(|r: (String, )| Ok(r.0, ))
    }

    fn list_queued_owners(&self, arg0: &str) -> Result<Vec<String>, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "ListQueuedOwners", (arg0, ))
            .and_then(|r: (Vec<String>, )| Ok(r.0, ))
    }

    fn get_connection_unix_user(&self, arg0: &str) -> Result<u32, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "GetConnectionUnixUser", (arg0, ))
            .and_then(|r: (u32, )| Ok(r.0, ))
    }

    fn get_connection_unix_process_id(&self, arg0: &str) -> Result<u32, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "GetConnectionUnixProcessID", (arg0, ))
            .and_then(|r: (u32, )| Ok(r.0, ))
    }

    fn get_adt_audit_session_data(&self, arg0: &str) -> Result<Vec<u8>, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "GetAdtAuditSessionData", (arg0, ))
            .and_then(|r: (Vec<u8>, )| Ok(r.0, ))
    }

    fn get_connection_selinux_security_context(&self, arg0: &str) -> Result<Vec<u8>, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "GetConnectionSELinuxSecurityContext", (arg0, ))
            .and_then(|r: (Vec<u8>, )| Ok(r.0, ))
    }

    fn reload_config(&self) -> Result<(), dbus::Error> {
        self.method_call("org.freedesktop.DBus", "ReloadConfig", ())
    }

    fn get_id(&self) -> Result<String, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "GetId", ())
            .and_then(|r: (String, )| Ok(r.0, ))
    }

    fn get_connection_credentials(&self, arg0: &str) -> Result<arg::PropMap, dbus::Error> {
        self.method_call("org.freedesktop.DBus", "GetConnectionCredentials", (arg0, ))
            .and_then(|r: (arg::PropMap, )| Ok(r.0, ))
    }

    fn features(&self) -> Result<Vec<String>, dbus::Error> {
        <Self as blocking::stdintf::org_freedesktop_dbus::Properties>::get(self, "org.freedesktop.DBus", "Features")
    }

    fn interfaces(&self) -> Result<Vec<String>, dbus::Error> {
        <Self as blocking::stdintf::org_freedesktop_dbus::Properties>::get(self, "org.freedesktop.DBus", "Interfaces")
    }
}
