1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//! This module contains some standard interfaces and an easy way to call them.
//!
//! See the [D-Bus specification](https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces) for more information about these standard interfaces.
//! 
//! The code here was originally created by dbus-codegen.
//! Signal handling is not yet implemented here - use `Message::signal` to emit or `Connection.add_match` to receive, as usual.
//!
//! # Example
//! ```
//! use dbus::{Connection, BusType};
//! use dbus::stdintf::OrgFreedesktopDBusIntrospectable;
//! let c = Connection::get_private(BusType::Session).unwrap();
//! let p = c.with_path("org.freedesktop.DBus", "/", 10000);
//! println!("Introspection XML: {}", p.introspect().unwrap());
//! ```
//!

#![allow(missing_docs)]

/// Methods of the [org.freedesktop.DBus.Peer](https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-peer) interface.
pub trait OrgFreedesktopDBusPeer {
    fn ping(&self) -> Result<(), super::Error>;
    fn get_machine_id(&self) -> Result<String, super::Error>;
}

impl<'a, C: ::std::ops::Deref<Target=super::Connection>> OrgFreedesktopDBusPeer for super::ConnPath<'a, C> {

    fn ping(&self) -> Result<(), super::Error> {
        let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Peer".into(), &"Ping".into(), |_| {
        }));
        try!(m.as_result());
        Ok(())
    }

    fn get_machine_id(&self) -> Result<String, super::Error> {
        let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Peer".into(), &"GetMachineId".into(), |_| {
        }));
        try!(m.as_result());
        let mut i = m.iter_init();
        let a0: String = try!(i.read());
        Ok(a0)
    }
}

/// Method of the [org.freedesktop.DBus.Introspectable](https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-introspectable) interface.
pub trait OrgFreedesktopDBusIntrospectable {
    fn introspect(&self) -> Result<String, super::Error>;
}

impl<'a, C: ::std::ops::Deref<Target=super::Connection>> OrgFreedesktopDBusIntrospectable for super::ConnPath<'a, C> {

    fn introspect(&self) -> Result<String, super::Error> {
        let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Introspectable".into(), &"Introspect".into(), |_| {
        }));
        try!(m.as_result());
        let mut i = m.iter_init();
        let a0: String = try!(i.read());
        Ok(a0)
    }
}

/// Methods of the [org.freedesktop.DBus.Properties](https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties) interface.
pub trait OrgFreedesktopDBusProperties {
    fn get(&self, interfacename: &str, propertyname: &str) -> Result<super::arg::Variant<Box<super::arg::RefArg>>, super::Error>;
    fn get_all(&self, interfacename: &str) -> Result<::std::collections::HashMap<String, super::arg::Variant<Box<super::arg::RefArg>>>, super::Error>;
    fn set(&self, interfacename: &str, propertyname: &str, value: super::arg::Variant<Box<super::arg::RefArg>>) -> Result<(), super::Error>;
}

impl<'a, C: ::std::ops::Deref<Target=super::Connection>> OrgFreedesktopDBusProperties for super::ConnPath<'a, C> {

    fn get(&self, interfacename: &str, propertyname: &str) -> Result<super::arg::Variant<Box<super::arg::RefArg>>, super::Error> {
        let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Get".into(), |msg| {
            let mut i = super::arg::IterAppend::new(msg);
            i.append(interfacename);
            i.append(propertyname);
        }));
        try!(m.as_result());
        let mut i = m.iter_init();
        let a0: super::arg::Variant<Box<super::arg::RefArg>> = try!(i.read());
        Ok(a0)
    }

    fn get_all(&self, interfacename: &str) -> Result<::std::collections::HashMap<String, super::arg::Variant<Box<super::arg::RefArg>>>, super::Error> {
        let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"GetAll".into(), |msg| {
            let mut i = super::arg::IterAppend::new(msg);
            i.append(interfacename);
        }));
        try!(m.as_result());
        let mut i = m.iter_init();
        let a0: ::std::collections::HashMap<String, super::arg::Variant<Box<super::arg::RefArg>>> = try!(i.read());
        Ok(a0)
    }

    fn set(&self, interfacename: &str, propertyname: &str, value: super::arg::Variant<Box<super::arg::RefArg>>) -> Result<(), super::Error> {
        let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.Properties".into(), &"Set".into(), |msg| {
            let mut i = super::arg::IterAppend::new(msg);
            i.append(interfacename);
            i.append(propertyname);
            i.append(value);
        }));
        try!(m.as_result());
        Ok(())
    }
}

/// Method of the [org.freedesktop.DBus.ObjectManager](https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager) interface.
pub trait OrgFreedesktopDBusObjectManager {
    fn get_managed_objects(&self) -> Result<::std::collections::HashMap<super::Path<'static>, ::std::collections::HashMap<String, ::std::collections::HashMap<String, super::arg::Variant<Box<super::arg::RefArg>>>>>, super::Error>;
}

impl<'a, C: ::std::ops::Deref<Target=super::Connection>> OrgFreedesktopDBusObjectManager for super::ConnPath<'a, C> {

    fn get_managed_objects(&self) -> Result<::std::collections::HashMap<super::Path<'static>, ::std::collections::HashMap<String, ::std::collections::HashMap<String, super::arg::Variant<Box<super::arg::RefArg>>>>>, super::Error> {
        let mut m = try!(self.method_call_with_args(&"org.freedesktop.DBus.ObjectManager".into(), &"GetManagedObjects".into(), |_| {
        }));
        try!(m.as_result());
        let mut i = m.iter_init();
        let a0 = try!(i.read());
        Ok(a0)
    }
}