[][src]Struct rustable::gatt::LocalCharBase

pub struct LocalCharBase {
    pub write_callback: Option<Box<dyn FnMut(&[u8]) -> Result<(Option<ValOrFn>, bool), (String, Option<String>)>>>,
    // some fields omitted
}

LocalCharBase is used to create GATT characteristics to be added to LocalServiceBase.

Fields

write_callback: Option<Box<dyn FnMut(&[u8]) -> Result<(Option<ValOrFn>, bool), (String, Option<String>)>>>

Set a callback that can be when writes are issued by remote device. The callback function can reject a write with an error, with first String being a general a DBus, error name, and the Optional second string being an extended error message.= On a successful write, giving a Some variant will overwrite the value of the characteristic, while None leaves the value the same as it was before the write. The purpose of this allows, the user to change the ValOrFn before it is set the characteristic, for others to use. The bool is used to indicate whether an notification/indication should be issued after an update.

Implementations

impl LocalCharBase[src]

pub fn enable_write_fd(&mut self, on: bool)[src]

Enables AcquireWrite DBus call to be issued by Bluez to the local application. [AcquireWrite] will allow Bluez to issue writes to the local characteristic, using packets over a Unix socket. This can have better performance and lower latency by allowing writes to avoid using DBus. If this is used, then implementors of local characteristic need, to periodically call LocalCharactersitic::check_write_fd() to process these messages, received on the socket, onces added.

pub fn new<T: ToUUID>(uuid: T, flags: CharFlags) -> Self[src]

Creates a new LocalCharBase with uuid and flags.

It can be added a local service with LocalServiceBase::add_char().

Trait Implementations

impl Debug for LocalCharBase[src]

impl Drop for LocalCharBase[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.