Driver
Generated reference for ovok_flutter: driver.
- Stable unknown
- Release candidate since 0.1.0-rc.4
- Development since 0.1.0-dev.27+7d4ccf0
BluetoothDeviceDefinition
class BluetoothDeviceDefinitionA custom device definition with an advertisement matcher and protocol.
Constructors
BluetoothDeviceDefinition.new
BluetoothDeviceDefinition({
required String key,
required bool Function(BluetoothAdvertisement) matches,
required BluetoothDeviceProtocol protocol,
})Creates a custom device definition.
| Parameter | Type | Kind | Default |
|---|---|---|---|
key | String | required named | |
matches | bool Function(BluetoothAdvertisement) | required named | |
protocol | BluetoothDeviceProtocol | required named |
Properties
BluetoothDeviceDefinition.key
final String keyA unique device key reported with readings.
BluetoothDeviceDefinition.matches
final bool Function(BluetoothAdvertisement) matchesWhether an advertisement belongs to this device.
BluetoothDeviceDefinition.protocol
final BluetoothDeviceProtocol protocolReads this device's bytes and yields decoded measurements.
BluetoothDeviceErrorEvent
final class BluetoothDeviceErrorEvent extends BluetoothDeviceEventA device or protocol error that does not end the connection.
Constructors
BluetoothDeviceErrorEvent.new
BluetoothDeviceErrorEvent(BluetoothError error)Creates a recoverable device error event.
| Parameter | Type | Kind | Default |
|---|---|---|---|
error | BluetoothError | positional |
Properties
BluetoothDeviceErrorEvent.error
final BluetoothError errorThe reported device failure.
BluetoothDeviceEvent
sealed class BluetoothDeviceEventAn event a Bluetooth driver reports while it runs.
Constructors
BluetoothDeviceEvent.new
BluetoothDeviceEvent()Creates a driver event.
BluetoothDeviceMatch
class BluetoothDeviceMatchThe result of matching an advertisement to a device driver.
Constructors
BluetoothDeviceMatch.new
BluetoothDeviceMatch({required String key, required BluetoothDriver driver})Creates a match for a device key and driver.
| Parameter | Type | Kind | Default |
|---|---|---|---|
key | String | required named | |
driver | BluetoothDriver | required named |
Properties
BluetoothDeviceMatch.key
final String keyThe device key reported with readings.
BluetoothDeviceMatch.driver
final BluetoothDriver driverThe driver that reads this peripheral.
BluetoothDeviceProtocol
typedef BluetoothDeviceProtocol = Stream<Map<String, dynamic>> Function(BluetoothLink)A device protocol reads measurements from an open GATT link.
BluetoothDeviceSupport
abstract interface class BluetoothDeviceSupportSupport that recognizes peripherals from their advertisements.
Methods
BluetoothDeviceSupport.match
BluetoothDeviceMatch? match(BluetoothAdvertisement advertisement)Returns this support's match, or null when it does not recognize the ad.
| Parameter | Type | Kind | Default |
|---|---|---|---|
advertisement | BluetoothAdvertisement | positional |
Returns BluetoothDeviceMatch?.
BluetoothDriver
typedef BluetoothDriver = Stream<BluetoothDeviceEvent> Function(BluetoothPeripheral, BluetoothCancellation)A driver connects to one peripheral and reports events until it disconnects.
BluetoothDriverStatus
enum BluetoothDriverStatusA status that a device driver can report.
Values
BluetoothDriverStatus.connected
static const BluetoothDriverStatus connectedThe device link is open.
BluetoothDriverStatus.measuring
static const BluetoothDriverStatus measuringThe device is sending measurements.
BluetoothDriverStatus.disconnected
static const BluetoothDriverStatus disconnectedThe device link has closed.
BluetoothReadingEvent
final class BluetoothReadingEvent extends BluetoothDeviceEventA reading reported by a device driver.
Constructors
BluetoothReadingEvent.new
BluetoothReadingEvent({required String? id, required JsonMap reading})Creates a reading event.
| Parameter | Type | Kind | Default |
|---|---|---|---|
id | String? | required named | |
reading | JsonMap | required named |
Properties
BluetoothReadingEvent.id
final String? idA stable device reading ID, or null if it cannot be recognized on resend.
BluetoothReadingEvent.reading
final JsonMap readingThe decoded measurement.
BluetoothStatusEvent
final class BluetoothStatusEvent extends BluetoothDeviceEventA device connection state event.
Constructors
BluetoothStatusEvent.new
BluetoothStatusEvent(BluetoothDriverStatus status)Creates a connection status event.
| Parameter | Type | Kind | Default |
|---|---|---|---|
status | BluetoothDriverStatus | positional |
Properties
BluetoothStatusEvent.status
final BluetoothDriverStatus statusThe new connection state.
defineDevice
BluetoothDeviceSupport defineDevice(BluetoothDeviceDefinition device)Builds a BluetoothDeviceSupport for a custom GATT protocol.
| Parameter | Type | Kind | Default |
|---|---|---|---|
device | BluetoothDeviceDefinition | positional |
gattDriver
BluetoothDriver gattDriver(String key, BluetoothDeviceProtocol protocol)Connects to a peripheral and runs a device protocol over its GATT link.
| Parameter | Type | Kind | Default |
|---|---|---|---|
key | String | positional | |
protocol | BluetoothDeviceProtocol | positional |
Last updated on