pub struct Characteristic { /* private fields */ }Expand description
A Bluetooth GATT characteristic.
Implementations§
Source§impl Characteristic
impl Characteristic
Sourcepub async fn uuid_async(&self) -> Result<Uuid>
pub async fn uuid_async(&self) -> Result<Uuid>
This method is kept for compatibility with bluest.
Sourcepub async fn properties(&self) -> Result<CharacteristicProperties>
pub async fn properties(&self) -> Result<CharacteristicProperties>
The properties of this this GATT characteristic.
Characteristic properties indicate which operations (e.g. read, write, notify, etc) may be performed on this characteristic.
Sourcepub async fn value(&self) -> Result<Vec<u8>>
pub async fn value(&self) -> Result<Vec<u8>>
The cached value of this characteristic. Returns an error if the value has not yet been read.
Sourcepub async fn read(&self) -> Result<Vec<u8>>
pub async fn read(&self) -> Result<Vec<u8>>
Read the value of this characteristic from the device.
Sourcepub async fn write(&self, value: &[u8]) -> Result<()>
pub async fn write(&self, value: &[u8]) -> Result<()>
Write value to this characteristic on the device and request the device to return a response
indicating a successful write.
Sourcepub async fn write_without_response(&self, value: &[u8]) -> Result<()>
pub async fn write_without_response(&self, value: &[u8]) -> Result<()>
Write value to this characteristic on the device without requesting a response.
Sourcepub fn max_write_len(&self) -> Result<usize>
pub fn max_write_len(&self) -> Result<usize>
Get the maximum amount of data that can be written in a single packet for this characteristic.
The Android API does not provide a method to query the current MTU value directly;
instead, BluetoothGatt.requestMtu() may be called in Adapter::connect_device
to have a possible maximum MTU in the callback. This can be configured with
crate::AdapterConfig::request_mtu_on_connect.
Sourcepub async fn max_write_len_async(&self) -> Result<usize>
pub async fn max_write_len_async(&self) -> Result<usize>
This method is kept for compatibility with bluest.
Sourcepub async fn notify(
&self,
) -> Result<impl Stream<Item = Result<Vec<u8>>> + Send + Unpin + '_>
pub async fn notify( &self, ) -> Result<impl Stream<Item = Result<Vec<u8>>> + Send + Unpin + '_>
Enables notification of value changes for this GATT characteristic.
Returns a stream of values for the characteristic sent from the device.
Sourcepub async fn is_notifying(&self) -> Result<bool>
pub async fn is_notifying(&self) -> Result<bool>
Is the device currently sending notifications for this characteristic?
Sourcepub async fn discover_descriptors(&self) -> Result<Vec<Descriptor>>
pub async fn discover_descriptors(&self) -> Result<Vec<Descriptor>>
This method is kept for compatibility with bluest.
Sourcepub async fn descriptors(&self) -> Result<Vec<Descriptor>>
pub async fn descriptors(&self) -> Result<Vec<Descriptor>>
Get previously discovered descriptors.
Trait Implementations§
Source§impl Clone for Characteristic
impl Clone for Characteristic
Source§fn clone(&self) -> Characteristic
fn clone(&self) -> Characteristic
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more