FakeGattConnection class
A controllable GattConnection for tests.
- Implemented types
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → DeviceId
-
The device id this connection was opened for.
final
- mtu ↔ int
-
MTU returned by requestMtu (capped to the request).
getter/setter pair
-
notifyEnabled
→ Map<
Uuid, bool> -
Whether notifications are currently enabled per characteristic (true on
first listen, false again after the last listener cancels), so tests can
assert the enable-on-first / disable-on-last contract.
final
-
readValues
→ Map<
Uuid, Uint8List> -
Values readCharacteristic returns, keyed by characteristic UUID.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
services
→ List<
BleService> -
Services returned by discoverServices.
final
- state → BleConnectionState
-
no setteroverride
-
stateChanges
→ Stream<
BleConnectionState> -
Connection-state transitions; closes when the link drops.
no setteroverride
- subscribeError ↔ Object?
-
If set, subscribe throws this synchronously (mimicking e.g. the Windows
backend's
BleUnsupportedException).getter/setter pair -
writes
→ List<
({Uuid characteristic, Uint8List value, bool withoutResponse})> -
Everything written, in order, as (characteristic, value, withoutResponse).
final
Methods
-
close(
) → Future< void> -
Closes the connection. Idempotent.
override
-
deliver(
Uuid characteristic, List< int> bytes) → void -
Pushes
bytesas a notification oncharacteristic. -
discoverServices(
) → Future< List< BleService> > -
Discovers services and their characteristics.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readCharacteristic(
Uuid service, Uuid characteristic) → Future< Uint8List> -
Reads the value of
characteristicunderservice.override -
requestMtu(
int requested) → Future< int> -
Returns the usable ATT MTU. Most platforms negotiate the MTU automatically
and ignore the requested
mtu(reporting the auto-negotiated value); Android honours an explicit request. Windows reports the ATT default (23).override -
subscribe(
Uuid service, Uuid characteristic) → Stream< Uint8List> -
Enables notifications/indications on
characteristicand streams the values the peripheral pushes. Cancelling the subscription disables them.override -
toString(
) → String -
A string representation of this object.
inherited
-
writeCharacteristic(
Uuid service, Uuid characteristic, Uint8List value, {bool withoutResponse = false}) → Future< void> -
Writes
valuetocharacteristicunderservice. WithwithoutResponsethe write is unacknowledged (higher throughput, no error feedback).override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited