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 BluetoothDeviceDefinition

A 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.

ParameterTypeKindDefault
keyStringrequired named
matchesbool Function(BluetoothAdvertisement)required named
protocolBluetoothDeviceProtocolrequired named

Properties

BluetoothDeviceDefinition.key

final String key

A unique device key reported with readings.

BluetoothDeviceDefinition.matches

final bool Function(BluetoothAdvertisement) matches

Whether an advertisement belongs to this device.

BluetoothDeviceDefinition.protocol

final BluetoothDeviceProtocol protocol

Reads this device's bytes and yields decoded measurements.

BluetoothDeviceErrorEvent

final class BluetoothDeviceErrorEvent extends BluetoothDeviceEvent

A device or protocol error that does not end the connection.

Constructors

BluetoothDeviceErrorEvent.new

BluetoothDeviceErrorEvent(BluetoothError error)

Creates a recoverable device error event.

ParameterTypeKindDefault
errorBluetoothErrorpositional

Properties

BluetoothDeviceErrorEvent.error

final BluetoothError error

The reported device failure.

BluetoothDeviceEvent

sealed class BluetoothDeviceEvent

An event a Bluetooth driver reports while it runs.

Constructors

BluetoothDeviceEvent.new

BluetoothDeviceEvent()

Creates a driver event.

BluetoothDeviceMatch

class BluetoothDeviceMatch

The 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.

ParameterTypeKindDefault
keyStringrequired named
driverBluetoothDriverrequired named

Properties

BluetoothDeviceMatch.key

final String key

The device key reported with readings.

BluetoothDeviceMatch.driver

final BluetoothDriver driver

The 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 BluetoothDeviceSupport

Support 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.

ParameterTypeKindDefault
advertisementBluetoothAdvertisementpositional

Returns BluetoothDeviceMatch?.

BluetoothDriver

typedef BluetoothDriver = Stream<BluetoothDeviceEvent> Function(BluetoothPeripheral, BluetoothCancellation)

A driver connects to one peripheral and reports events until it disconnects.

BluetoothDriverStatus

enum BluetoothDriverStatus

A status that a device driver can report.

Values

BluetoothDriverStatus.connected

static const BluetoothDriverStatus connected

The device link is open.

BluetoothDriverStatus.measuring

static const BluetoothDriverStatus measuring

The device is sending measurements.

BluetoothDriverStatus.disconnected

static const BluetoothDriverStatus disconnected

The device link has closed.

BluetoothReadingEvent

final class BluetoothReadingEvent extends BluetoothDeviceEvent

A reading reported by a device driver.

Constructors

BluetoothReadingEvent.new

BluetoothReadingEvent({required String? id, required JsonMap reading})

Creates a reading event.

ParameterTypeKindDefault
idString?required named
readingJsonMaprequired named

Properties

BluetoothReadingEvent.id

final String? id

A stable device reading ID, or null if it cannot be recognized on resend.

BluetoothReadingEvent.reading

final JsonMap reading

The decoded measurement.

BluetoothStatusEvent

final class BluetoothStatusEvent extends BluetoothDeviceEvent

A device connection state event.

Constructors

BluetoothStatusEvent.new

BluetoothStatusEvent(BluetoothDriverStatus status)

Creates a connection status event.

ParameterTypeKindDefault
statusBluetoothDriverStatuspositional

Properties

BluetoothStatusEvent.status

final BluetoothDriverStatus status

The new connection state.

defineDevice

BluetoothDeviceSupport defineDevice(BluetoothDeviceDefinition device)

Builds a BluetoothDeviceSupport for a custom GATT protocol.

ParameterTypeKindDefault
deviceBluetoothDeviceDefinitionpositional

gattDriver

BluetoothDriver gattDriver(String key, BluetoothDeviceProtocol protocol)

Connects to a peripheral and runs a device protocol over its GATT link.

ParameterTypeKindDefault
keyStringpositional
protocolBluetoothDeviceProtocolpositional

Last updated on

On this page