BleMockDevice class

Inheritance
  • Object
  • BluetoothDevice
  • BleMockDevice
Available extensions

Constructors

BleMockDevice.new(String id)

Properties

advName String
Advertised Named
no setterinherited
bondState Stream<BluetoothBondState>
Get the current bondState of the device (Android Only)
no setterinherited
connectionState Stream<BluetoothConnectionState>
The current connection state of our app to the device
no setteroverride
connectionStateController StreamController<BluetoothConnectionState>
final
deviceType DeviceType

Available on BluetoothDevice, provided by the DeviceTypeExtension extension

no setter
deviceTypeString String

Available on BluetoothDevice, provided by the DeviceTypeExtension extension

no setter
disconnectReason → DisconnectReason?
The most recent disconnection reason
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
id → DeviceIdentifier
no setterinherited
isAutoConnectEnabled bool
Returns true if autoConnect is currently enabled for this device
no setterinherited
isConnected bool
Returns true if this device is currently connected to your app
no setteroverride
isDisconnected bool
Returns true if this device is currently disconnected from your app
no setterinherited
isDiscoveringServices Stream<bool>
no setterinherited
localName String
no setterinherited
mtu Stream<int>
Stream emits a value:
no setterinherited
mtuNow int
The current MTU size in bytes
no setterinherited
name String
no setterinherited
onServicesReset Stream<void>
Services Reset Stream
no setterinherited
platformName String
platform name
no setteroverride
prevBondState → BluetoothBondState?
Get the previous bondState of the device (Android Only)
no setterinherited
remoteId → DeviceIdentifier
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
services Stream<List<BluetoothService>>
no setterinherited
servicesList List<BluetoothService>
Get services
no setterinherited
servicesStream Stream<List<BluetoothService>>
no setterinherited
state Stream<BluetoothConnectionState>
no setterinherited

Methods

cancelWhenDisconnected(StreamSubscription subscription, {bool next = false, bool delayed = false}) → void
Register a subscription to be canceled when the device is disconnected. This function simplifies cleanup, so you can prevent creating duplicate stream subscriptions.
inherited
clearGattCache() Future<void>
Refresh ble services & characteristics (Android Only)
inherited
connect({bool? autoConnect, int? mtu, Duration? timeout}) Future<void>
Establishes a connection to the Bluetooth Device. timeout if timeout occurs, cancel the connection request and throw exception mtu Android only. Request a larger mtu right after connection, if set. autoConnect reconnect whenever the device is found - if true, this function always returns immediately. - you must listen to connectionState to know when connection occurs. - auto connect is turned off by calling disconnect - auto connect results in a slower connection process compared to a direct connection because it relies on the internal scheduling of background scans.
override
createBond({int timeout = 90, Uint8List? pin}) Future<void>
Force the bonding popup to show now (Android Only) Note! calling this is usually not necessary!! The platform does it automatically.
inherited
disconnect({int? androidDelay, bool? queue, int? timeout}) Future<void>
Cancels connection to the Bluetooth Device
override
discoverServices({bool? subscribeToServicesChanged, int? timeout}) Future<List<BluetoothService>>
Discover services, characteristics, and descriptors of the remote device
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pair() Future<void>
inherited
readRssi({int timeout = 15}) Future<int>
Read the RSSI of connected remote device
inherited
removeBond({int timeout = 30}) Future<void>
Remove bond (Android Only)
inherited
requestConnectionPriority({required ConnectionPriority connectionPriorityRequest}) Future<void>
Request connection priority update (Android only)
override
requestMtu(int desiredMtu, {double predelay = 0.35, int timeout = 15}) Future<int>
Request to change MTU (Android Only)
inherited
setPreferredPhy({required int txPhy, required int rxPhy, required PhyCoding option}) Future<void>
Set the preferred connection (Android Only)
inherited
toString() String
A string representation of this object.
inherited

Operators

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