BleCharacteristic class
Represents a Bluetooth Low Energy (BLE) characteristic.
Each characteristic in BLE has a universally unique identifier (UUID), properties that define how the value of the characteristic can be accessed, and permissions that set the security requirements for accessing the value. This class encapsulates these details and provides utility methods to decode properties and permissions for easier understanding and interaction.
Constructors
-
BleCharacteristic({required String address, required String uuid, required List<
BleCharacteristicProperty> properties, required List<BleCharacteristicPermission> ? permissions}) - Creates a BleCharacteristic instance.
-
BleCharacteristic.fromMap(Map<
String, dynamic> map) -
Constructs a BleCharacteristic from a map.
factory
Properties
- address → String
-
The Bluetooth address of the Bluetooth peripheral containing a service with this characteristic.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
permissions
→ List<
BleCharacteristicPermission> ? -
An integer value representing the permissions of the characteristic that is converted into a
List<BleCharacteristicPermission> representing the permissions of the Bluetooth characteristic.
final
-
properties
→ List<
BleCharacteristicProperty> -
An integer value representing the properties of the characteristic that is converted into a
List<BleCharacteristicProperty> representing the properties of the Bluetooth characteristic.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- uuid → String
-
The universally unique identifier (UUID) for the characteristic.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readValue<
T> ({Duration timeout = const Duration(seconds: 5)}) → Future< T> - Asynchronously retrieves the value of the characteristic.
-
subscribe(
) → Stream< BleCharacteristicValue> - Subscribes to a Bluetooth characteristic to listen for updates.
-
toString(
) → String -
Returns a string representation of the BleCharacteristic instance.
override
-
unsubscribe(
) → void - Unsubscribes from a Bluetooth characteristic.
-
writeValue(
{required String value, int? writeType}) → Future< void> - Writes data to a specified characteristic.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited