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.GattCharacteristic1.xml --interfaces=org.bluez.GattCharacteristic1 --client=nonblock --methodtype=none --prop-newtype`, see https://github.com/diwic/dbus-rs
#[allow(unused_imports)]
use dbus::arg;
use dbus::nonblock;

pub trait OrgBluezGattCharacteristic1 {
    fn read_value(&self, options: arg::PropMap) -> nonblock::MethodReply<Vec<u8>>;
    fn write_value(&self, value: Vec<u8>, options: arg::PropMap) -> nonblock::MethodReply<()>;
    fn acquire_write(&self, options: arg::PropMap) -> nonblock::MethodReply<(arg::OwnedFd, u16)>;
    fn acquire_notify(&self, options: arg::PropMap) -> nonblock::MethodReply<(arg::OwnedFd, u16)>;
    fn start_notify(&self) -> nonblock::MethodReply<()>;
    fn stop_notify(&self) -> nonblock::MethodReply<()>;
    fn uuid(&self) -> nonblock::MethodReply<String>;
    fn service(&self) -> nonblock::MethodReply<dbus::Path<'static>>;
    fn value(&self) -> nonblock::MethodReply<Vec<u8>>;
    fn notifying(&self) -> nonblock::MethodReply<bool>;
    fn flags(&self) -> nonblock::MethodReply<Vec<String>>;
    fn write_acquired(&self) -> nonblock::MethodReply<bool>;
    fn notify_acquired(&self) -> nonblock::MethodReply<bool>;
}

pub const ORG_BLUEZ_GATT_CHARACTERISTIC1_NAME: &str = "org.bluez.GattCharacteristic1";

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

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

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

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

    pub fn value(&self) -> Option<&Vec<u8>> {
        arg::prop_cast(self.0, "Value")
    }

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

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

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

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

impl<'a, T: nonblock::NonblockReply, C: ::std::ops::Deref<Target = T>> OrgBluezGattCharacteristic1
    for nonblock::Proxy<'a, C>
{
    fn read_value(&self, options: arg::PropMap) -> nonblock::MethodReply<Vec<u8>> {
        self.method_call("org.bluez.GattCharacteristic1", "ReadValue", (options,))
            .and_then(|r: (Vec<u8>,)| Ok(r.0))
    }

    fn write_value(&self, value: Vec<u8>, options: arg::PropMap) -> nonblock::MethodReply<()> {
        self.method_call(
            "org.bluez.GattCharacteristic1",
            "WriteValue",
            (value, options),
        )
    }

    fn acquire_write(&self, options: arg::PropMap) -> nonblock::MethodReply<(arg::OwnedFd, u16)> {
        self.method_call("org.bluez.GattCharacteristic1", "AcquireWrite", (options,))
    }

    fn acquire_notify(&self, options: arg::PropMap) -> nonblock::MethodReply<(arg::OwnedFd, u16)> {
        self.method_call("org.bluez.GattCharacteristic1", "AcquireNotify", (options,))
    }

    fn start_notify(&self) -> nonblock::MethodReply<()> {
        self.method_call("org.bluez.GattCharacteristic1", "StartNotify", ())
    }

    fn stop_notify(&self) -> nonblock::MethodReply<()> {
        self.method_call("org.bluez.GattCharacteristic1", "StopNotify", ())
    }

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

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

    fn value(&self) -> nonblock::MethodReply<Vec<u8>> {
        <Self as nonblock::stdintf::org_freedesktop_dbus::Properties>::get(
            &self,
            "org.bluez.GattCharacteristic1",
            "Value",
        )
    }

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

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

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

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