BleDevice class

Available extensions

Constructors

BleDevice({required String deviceId, required String? name, int? rssi, bool? paired, List<String> services = const [], bool? isSystemDevice, List<ManufacturerData> manufacturerDataList = const [], Map<String, Uint8List> serviceData = const {}, int? timestamp, int? timestampMicroseconds, bool? connectable})

Properties

connectable ↔ bool?
Whether the device is connectable based on its advertising flags.
getter/setter pair
connectionChangeStream → Stream<BleConnectionChange>

Available on BleDevice, provided by the BleDeviceExtension extension

A stream of BleConnectionChange that emits connection status changes together with the platform's error message and code.
no setter
connectionState → Future<BleConnectionState>
Returns connection state of the device. All platforms will return Connected/Disconnected states. Android and Apple can also return Connecting/Disconnecting states.
no setter
connectionStream → Stream<bool>

Available on BleDevice, provided by the BleDeviceExtension extension

A stream of bool that emits connection status changes for the device.
no setter
deviceId ↔ String
Unique identifier of the device.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
isConnected → Future<bool>

Available on BleDevice, provided by the BleDeviceExtension extension

Checks if the device is currently connected.
no setter
isSystemDevice ↔ bool?
getter/setter pair
manufacturerData → Uint8List?
no setter
manufacturerDataList ↔ List<ManufacturerData>
getter/setter pair
name ↔ String?
getter/setter pair
paired ↔ bool?
getter/setter pair
pairingStateStream → Stream<bool>

Available on BleDevice, provided by the BleDeviceExtension extension

A stream of bool that emits pairing status changes for the device.
no setter
rawName ↔ String?
getter/setter pair
receivesAdvertisements → bool
On web, it returns true if the web browser supports receiving advertisements from this device. The rest of the platforms will always return true.
no setter
rssi ↔ int?
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serviceData ↔ Map<String, Uint8List>
getter/setter pair
services ↔ List<String>
List of services advertised by the device.
getter/setter pair
timestamp ↔ int?
getter/setter pair
timestampDateTime → DateTime?
no setter
timestampMicroseconds ↔ int?
getter/setter pair
timestampMicrosecondsDateTime → DateTime?
no setter

Methods

connect({bool autoConnect = false, Duration? timeout, ConnectionPlatformConfig? platformConfig}) → Future<void>

Available on BleDevice, provided by the BleDeviceExtension extension

Connects to the device. autoConnect enables automatic reconnection when the device becomes available. platformConfig sets platform specific connection options.
copyWith({String? deviceId}) → BleDevice
Returns a copy of this device with deviceId optionally replaced.
disconnect({Duration? timeout, String? queueId}) → Future<void>

Available on BleDevice, provided by the BleDeviceExtension extension

Disconnects from the device.
discoverServices({Duration? timeout, bool withDescriptors = false, String? queueId, DiscoverServicesPlatformConfig? platformConfig}) → Future<List<BleService>>

Available on BleDevice, provided by the BleDeviceExtension extension

Discovers the services offered by the device.
getCharacteristic(String characteristic, {required String service, bool preferCached = true, Duration? timeout, String? queueId}) → Future<BleCharacteristic>

Available on BleDevice, provided by the BleDeviceExtension extension

Retrieves a specific characteristic from a service.
getService(String service, {bool preferCached = true, Duration? timeout, String? queueId}) → Future<BleService>

Available on BleDevice, provided by the BleDeviceExtension extension

Retrieves a specific service.
isPaired({BleCommand? pairingCommand, Duration? timeout, String? queueId}) → Future<bool?>

Available on BleDevice, provided by the BleDeviceExtension extension

Check if a device is paired.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pair({BleCommand? pairingCommand, Duration? timeout, String? queueId}) → Future<void>

Available on BleDevice, provided by the BleDeviceExtension extension

Pair a device.
readRssi() → Future<int>
Read the RSSI value of this connected device.
requestMtu(int expectedMtu, {String? queueId}) → Future<int>

Available on BleDevice, provided by the BleDeviceExtension extension

Requests an MTU (Maximum Transmission Unit) value for the connection.
toString() → String
A string representation of this object.
override
unpair({Duration? timeout, String? queueId}) → Future<void>

Available on BleDevice, provided by the BleDeviceExtension extension

Unpair a device.

Operators

operator ==(Object other) → bool
The equality operator.
inherited