bluez-generated 0.3.0

Generated async D-Bus bindings for talking to BlueZ on Linux.
Documentation
// This code was autogenerated with `dbus-codegen-rust --file=specs/org.bluez.Device1.xml --interfaces=org.bluez.Device1 --client=nonblock --methodtype=none --prop-newtype`, see https://github.com/diwic/dbus-rs
#[allow(unused_imports)]
use dbus::arg;
use dbus::nonblock;

pub trait OrgBluezDevice1 {
    fn disconnect(&self) -> nonblock::MethodReply<()>;
    fn connect(&self) -> nonblock::MethodReply<()>;
    fn connect_profile(&self, uuid: &str) -> nonblock::MethodReply<()>;
    fn disconnect_profile(&self, uuid: &str) -> nonblock::MethodReply<()>;
    fn pair(&self) -> nonblock::MethodReply<()>;
    fn cancel_pairing(&self) -> nonblock::MethodReply<()>;
    fn address(&self) -> nonblock::MethodReply<String>;
    fn address_type(&self) -> nonblock::MethodReply<String>;
    fn name(&self) -> nonblock::MethodReply<String>;
    fn alias(&self) -> nonblock::MethodReply<String>;
    fn set_alias(&self, value: String) -> nonblock::MethodReply<()>;
    fn class(&self) -> nonblock::MethodReply<u32>;
    fn appearance(&self) -> nonblock::MethodReply<u16>;
    fn icon(&self) -> nonblock::MethodReply<String>;
    fn paired(&self) -> nonblock::MethodReply<bool>;
    fn bonded(&self) -> nonblock::MethodReply<bool>;
    fn trusted(&self) -> nonblock::MethodReply<bool>;
    fn set_trusted(&self, value: bool) -> nonblock::MethodReply<()>;
    fn blocked(&self) -> nonblock::MethodReply<bool>;
    fn set_blocked(&self, value: bool) -> nonblock::MethodReply<()>;
    fn legacy_pairing(&self) -> nonblock::MethodReply<bool>;
    fn rssi(&self) -> nonblock::MethodReply<i16>;
    fn connected(&self) -> nonblock::MethodReply<bool>;
    fn uuids(&self) -> nonblock::MethodReply<Vec<String>>;
    fn modalias(&self) -> nonblock::MethodReply<String>;
    fn adapter(&self) -> nonblock::MethodReply<dbus::Path<'static>>;
    fn manufacturer_data(
        &self,
    ) -> nonblock::MethodReply<
        ::std::collections::HashMap<u16, arg::Variant<Box<dyn arg::RefArg + 'static>>>,
    >;
    fn service_data(&self) -> nonblock::MethodReply<arg::PropMap>;
    fn tx_power(&self) -> nonblock::MethodReply<i16>;
    fn services_resolved(&self) -> nonblock::MethodReply<bool>;
    fn wake_allowed(&self) -> nonblock::MethodReply<bool>;
    fn set_wake_allowed(&self, value: bool) -> nonblock::MethodReply<()>;
}

pub const ORG_BLUEZ_DEVICE1_NAME: &str = "org.bluez.Device1";

#[derive(Copy, Clone, Debug)]
pub struct OrgBluezDevice1Properties<'a>(pub &'a arg::PropMap);

impl<'a> OrgBluezDevice1Properties<'a> {
    pub fn from_interfaces(
        interfaces: &'a ::std::collections::HashMap<String, arg::PropMap>,
    ) -> Option<Self> {
        interfaces.get("org.bluez.Device1").map(Self)
    }

    pub fn address(&self) -> Option<&String> {
        arg::prop_cast(self.0, "Address")
    }

    pub fn address_type(&self) -> Option<&String> {
        arg::prop_cast(self.0, "AddressType")
    }

    pub fn name(&self) -> Option<&String> {
        arg::prop_cast(self.0, "Name")
    }

    pub fn alias(&self) -> Option<&String> {
        arg::prop_cast(self.0, "Alias")
    }

    pub fn class(&self) -> Option<u32> {
        arg::prop_cast(self.0, "Class").copied()
    }

    pub fn appearance(&self) -> Option<u16> {
        arg::prop_cast(self.0, "Appearance").copied()
    }

    pub fn icon(&self) -> Option<&String> {
        arg::prop_cast(self.0, "Icon")
    }

    pub fn paired(&self) -> Option<bool> {
        arg::prop_cast(self.0, "Paired").copied()
    }

    pub fn bonded(&self) -> Option<bool> {
        arg::prop_cast(self.0, "Bonded").copied()
    }

    pub fn trusted(&self) -> Option<bool> {
        arg::prop_cast(self.0, "Trusted").copied()
    }

    pub fn blocked(&self) -> Option<bool> {
        arg::prop_cast(self.0, "Blocked").copied()
    }

    pub fn legacy_pairing(&self) -> Option<bool> {
        arg::prop_cast(self.0, "LegacyPairing").copied()
    }

    pub fn rssi(&self) -> Option<i16> {
        arg::prop_cast(self.0, "RSSI").copied()
    }

    pub fn connected(&self) -> Option<bool> {
        arg::prop_cast(self.0, "Connected").copied()
    }

    pub fn uuids(&self) -> Option<&Vec<String>> {
        arg::prop_cast(self.0, "UUIDs")
    }

    pub fn modalias(&self) -> Option<&String> {
        arg::prop_cast(self.0, "Modalias")
    }

    pub fn adapter(&self) -> Option<&dbus::Path<'static>> {
        arg::prop_cast(self.0, "Adapter")
    }

    pub fn manufacturer_data(
        &self,
    ) -> Option<&::std::collections::HashMap<u16, arg::Variant<Box<dyn arg::RefArg + 'static>>>>
    {
        arg::prop_cast(self.0, "ManufacturerData")
    }

    pub fn service_data(&self) -> Option<&arg::PropMap> {
        arg::prop_cast(self.0, "ServiceData")
    }

    pub fn tx_power(&self) -> Option<i16> {
        arg::prop_cast(self.0, "TxPower").copied()
    }

    pub fn services_resolved(&self) -> Option<bool> {
        arg::prop_cast(self.0, "ServicesResolved").copied()
    }

    pub fn wake_allowed(&self) -> Option<bool> {
        arg::prop_cast(self.0, "WakeAllowed").copied()
    }
}

impl<'a, T: nonblock::NonblockReply, C: ::std::ops::Deref<Target = T>> OrgBluezDevice1
    for nonblock::Proxy<'a, C>
{
    fn disconnect(&self) -> nonblock::MethodReply<()> {
        self.method_call("org.bluez.Device1", "Disconnect", ())
    }

    fn connect(&self) -> nonblock::MethodReply<()> {
        self.method_call("org.bluez.Device1", "Connect", ())
    }

    fn connect_profile(&self, uuid: &str) -> nonblock::MethodReply<()> {
        self.method_call("org.bluez.Device1", "ConnectProfile", (uuid,))
    }

    fn disconnect_profile(&self, uuid: &str) -> nonblock::MethodReply<()> {
        self.method_call("org.bluez.Device1", "DisconnectProfile", (uuid,))
    }

    fn pair(&self) -> nonblock::MethodReply<()> {
        self.method_call("org.bluez.Device1", "Pair", ())
    }

    fn cancel_pairing(&self) -> nonblock::MethodReply<()> {
        self.method_call("org.bluez.Device1", "CancelPairing", ())
    }

    fn address(&self) -> nonblock::MethodReply<String> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Address",
        )
    }

    fn address_type(&self) -> nonblock::MethodReply<String> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "AddressType",
        )
    }

    fn name(&self) -> nonblock::MethodReply<String> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Name",
        )
    }

    fn alias(&self) -> nonblock::MethodReply<String> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Alias",
        )
    }

    fn class(&self) -> nonblock::MethodReply<u32> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Class",
        )
    }

    fn appearance(&self) -> nonblock::MethodReply<u16> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Appearance",
        )
    }

    fn icon(&self) -> nonblock::MethodReply<String> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Icon",
        )
    }

    fn paired(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Paired",
        )
    }

    fn bonded(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Bonded",
        )
    }

    fn trusted(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Trusted",
        )
    }

    fn blocked(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Blocked",
        )
    }

    fn legacy_pairing(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "LegacyPairing",
        )
    }

    fn rssi(&self) -> nonblock::MethodReply<i16> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "RSSI",
        )
    }

    fn connected(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Connected",
        )
    }

    fn uuids(&self) -> nonblock::MethodReply<Vec<String>> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "UUIDs",
        )
    }

    fn modalias(&self) -> nonblock::MethodReply<String> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Modalias",
        )
    }

    fn adapter(&self) -> nonblock::MethodReply<dbus::Path<'static>> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "Adapter",
        )
    }

    fn manufacturer_data(
        &self,
    ) -> nonblock::MethodReply<
        ::std::collections::HashMap<u16, arg::Variant<Box<dyn arg::RefArg + 'static>>>,
    > {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "ManufacturerData",
        )
    }

    fn service_data(&self) -> nonblock::MethodReply<arg::PropMap> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "ServiceData",
        )
    }

    fn tx_power(&self) -> nonblock::MethodReply<i16> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "TxPower",
        )
    }

    fn services_resolved(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "ServicesResolved",
        )
    }

    fn wake_allowed(&self) -> nonblock::MethodReply<bool> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.Device1",
            "WakeAllowed",
        )
    }

    fn set_alias(&self, value: String) -> nonblock::MethodReply<()> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
            &self,
            "org.bluez.Device1",
            "Alias",
            value,
        )
    }

    fn set_trusted(&self, value: bool) -> nonblock::MethodReply<()> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
            &self,
            "org.bluez.Device1",
            "Trusted",
            value,
        )
    }

    fn set_blocked(&self, value: bool) -> nonblock::MethodReply<()> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
            &self,
            "org.bluez.Device1",
            "Blocked",
            value,
        )
    }

    fn set_wake_allowed(&self, value: bool) -> nonblock::MethodReply<()> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::set(
            &self,
            "org.bluez.Device1",
            "WakeAllowed",
            value,
        )
    }
}