pub struct AttributeTable<'d, M: RawMutex, const MAX: usize> { /* private fields */ }
Expand description
A table of attributes.
Implementations§
Source§impl<'d, M: RawMutex, const MAX: usize> AttributeTable<'d, M, MAX>
impl<'d, M: RawMutex, const MAX: usize> AttributeTable<'d, M, MAX>
Sourcepub fn add_service(
&mut self,
service: Service,
) -> ServiceBuilder<'_, 'd, M, MAX>
pub fn add_service( &mut self, service: Service, ) -> ServiceBuilder<'_, 'd, M, MAX>
Add a service to the attribute table (group of characteristics)
Sourcepub fn set<T: AttributeHandle>(
&self,
attribute_handle: &T,
input: &T::Value,
) -> Result<(), Error>
pub fn set<T: AttributeHandle>( &self, attribute_handle: &T, input: &T::Value, ) -> Result<(), Error>
Set the value of a characteristic
The provided data must exactly match the size of the storage for the characteristic, otherwise this function will panic.
If the characteristic for the handle cannot be found, or the shape of the data does not match the type of the characterstic, an error is returned
Sourcepub fn get<T: AttributeHandle<Value = V>, V: FromGatt>(
&self,
attribute_handle: &T,
) -> Result<T::Value, Error>
pub fn get<T: AttributeHandle<Value = V>, V: FromGatt>( &self, attribute_handle: &T, ) -> Result<T::Value, Error>
Read the value of the characteristic and pass the value to the provided closure.
The return value of the closure is returned in this function and is assumed to be infallible.
If the characteristic for the handle cannot be found, an error is returned.
Sourcepub fn find_characteristic_by_value_handle<T: AsGatt>(
&self,
handle: u16,
) -> Result<Characteristic<T>, Error>
pub fn find_characteristic_by_value_handle<T: AsGatt>( &self, handle: u16, ) -> Result<Characteristic<T>, Error>
Return the characteristic which corresponds to the supplied value handle
If no characteristic corresponding to the given value handle was found, returns an error