pub struct Characteristic<T: AsGatt> {
pub cccd_handle: Option<u16>,
pub handle: u16,
/* private fields */
}Expand description
A characteristic in the attribute table.
Fields§
§cccd_handle: Option<u16>Handle value assigned to the Client Characteristic Configuration Descriptor (if any)
handle: u16Handle value assigned to this characteristic when it is added to the Gatt Attribute Table
Implementations§
Source§impl<T: FromGatt> Characteristic<T>
impl<T: FromGatt> Characteristic<T>
Sourcepub async fn notify<P: PacketPool>(
&self,
connection: &GattConnection<'_, '_, P>,
value: &T,
) -> Result<(), Error>
pub async fn notify<P: PacketPool>( &self, connection: &GattConnection<'_, '_, P>, value: &T, ) -> Result<(), Error>
Write a value to a characteristic, and notify a connection with the new value of the characteristic.
If the provided connection has not subscribed for this characteristic, it will not be notified.
If the characteristic does not support notifications, an error is returned.
Sourcepub async fn indicate<P: PacketPool>(
&self,
connection: &GattConnection<'_, '_, P>,
value: &T,
) -> Result<(), Error>
pub async fn indicate<P: PacketPool>( &self, connection: &GattConnection<'_, '_, P>, value: &T, ) -> Result<(), Error>
Write a value to a characteristic, and indicate a connection with the new value of the characteristic.
If the provided connection has not subscribed for this characteristic, it will not be sent an indication.
If the characteristic does not support indications, an error is returned.
This function does not block for the confirmation to the indication message, if the client sends a confirmation this will be seen on the GattConnection as a crate::att::AttClient::Confirmation event.
Sourcepub fn set<M: RawMutex, P: PacketPool, const AT: usize, const CT: usize, const CN: usize>(
&self,
server: &AttributeServer<'_, M, P, AT, CT, CN>,
value: &T,
) -> Result<(), Error>
pub fn set<M: RawMutex, P: PacketPool, const AT: usize, const CT: usize, const CN: usize>( &self, server: &AttributeServer<'_, M, P, AT, CT, CN>, value: &T, ) -> Result<(), Error>
Set the value of the characteristic in the provided attribute server.
Sourcepub fn get<M: RawMutex, P: PacketPool, const AT: usize, const CT: usize, const CN: usize>(
&self,
server: &AttributeServer<'_, M, P, AT, CT, CN>,
) -> Result<T, Error>
pub fn get<M: RawMutex, P: PacketPool, const AT: usize, const CT: usize, const CN: usize>( &self, server: &AttributeServer<'_, M, P, AT, CT, CN>, ) -> Result<T, Error>
Read the value of the characteristic.
If the characteristic for the handle cannot be found, an error is returned.
Sourcepub fn cccd_handle(&self) -> Option<CharacteristicPropertiesHandle>
pub fn cccd_handle(&self) -> Option<CharacteristicPropertiesHandle>
Returns the attribute handle for the characteristic’s properties (if available)
Trait Implementations§
Source§impl<T: AsGatt> AttributeHandle for Characteristic<T>
impl<T: AsGatt> AttributeHandle for Characteristic<T>
Source§impl<T: Clone + AsGatt> Clone for Characteristic<T>
impl<T: Clone + AsGatt> Clone for Characteristic<T>
Source§fn clone(&self) -> Characteristic<T>
fn clone(&self) -> Characteristic<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more