trouble-host

Crates

0.6.0

Versions

default

Flavors

CharacteristicBuilder

Struct CharacteristicBuilder 

Source
pub struct CharacteristicBuilder<'r, 'd, T: AsGatt + ?Sized, M: RawMutex, const MAX: usize> { /* private fields */ }
Expand description

Builder for characteristics.

Implementations§

Source§

impl<'r, 'd, T: AsGatt + ?Sized, M: RawMutex, const MAX: usize> CharacteristicBuilder<'r, 'd, T, M, MAX>

Source

pub fn add_descriptor<DT: AsGatt, U: Into<Uuid>>( &mut self, uuid: U, permissions: AttPermissions, value: DT, store: &'d mut [u8], ) -> Descriptor<DT>

Add a characteristic descriptor for this characteristic.

Source

pub fn add_descriptor_small<DT: AsGatt, U: Into<Uuid>>( &mut self, uuid: U, permissions: AttPermissions, value: DT, ) -> Descriptor<DT>

Add a characteristic to this service using inline storage. The descriptor value must be 8 bytes or less.

Source

pub fn add_descriptor_ro<DT: AsGatt + ?Sized, U: Into<Uuid>>( &mut self, uuid: U, read_permission: PermissionLevel, data: &'d DT, ) -> Descriptor<DT>

Add a read only characteristic descriptor for this characteristic.

Source

pub fn read_permission(self, read: PermissionLevel) -> Self

Set the read permission for this characteristic

Source

pub fn write_permission(self, write: PermissionLevel) -> Self

Set the write permission for this characteristic

Source

pub fn cccd_permission(self, write: PermissionLevel) -> Self

Set the write permission for the Client Characteristic Configuration Descriptor for this characteristic

Panics if this characteristic does not have a Client Characteristic Configuration Descriptor.

Source

pub fn to_raw(self) -> CharacteristicBuilder<'r, 'd, [u8], M, MAX>

Convert this characteristic’s type to raw bytes

Source

pub fn build(self) -> Characteristic<T>

Return the built characteristic.

Auto Trait Implementations§

§

impl<'r, 'd, T, M, const MAX: usize> Freeze for CharacteristicBuilder<'r, 'd, T, M, MAX>
where T: ?Sized,

§

impl<'r, 'd, T, M, const MAX: usize> !RefUnwindSafe for CharacteristicBuilder<'r, 'd, T, M, MAX>

§

impl<'r, 'd, T, M, const MAX: usize> Send for CharacteristicBuilder<'r, 'd, T, M, MAX>
where T: Send + ?Sized, M: Send,

§

impl<'r, 'd, T, M, const MAX: usize> Sync for CharacteristicBuilder<'r, 'd, T, M, MAX>
where T: Sync + ?Sized, M: Sync,

§

impl<'r, 'd, T, M, const MAX: usize> Unpin for CharacteristicBuilder<'r, 'd, T, M, MAX>
where T: Unpin + ?Sized,

§

impl<'r, 'd, T, M, const MAX: usize> !UnwindSafe for CharacteristicBuilder<'r, 'd, T, M, MAX>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.