Skip to content

BluetoothProbe

Scans for nearby, visible Bluetooth devices and collects a Bluetooth measurement that lists each device found during the scan.

Used for the ConnectivitySamplingPackage.BLUETOOTH measure. Uses a PeriodicSamplingConfiguration for the interval and duration of the scan. Use a BluetoothScanPeriodicSamplingConfiguration to filter by services and remoteIds. If the scan fails, the measurement holds an Error.

Inheritance

Constructors

BluetoothProbe

BluetoothProbe()

Constants

DEFAULT_TIMEOUT

int const DEFAULT_TIMEOUT

Default scan timeout in milliseconds (4 seconds), used if no duration is configured.

Properties

bufferingStream

Stream get bufferingStream
override

The stream of events to be buffered. Must be specified by sub-classes.

remoteIds

List<String> get remoteIds

The remote device ids to filter the scan on. Empty if no BluetoothScanPeriodicSamplingConfiguration is used.

services

List<Guid> get services

The service UUIDs to filter the scan on. Empty if no BluetoothScanPeriodicSamplingConfiguration is used.

Methods

getMeasurement

Future<Measurement?> getMeasurement()
override

Subclasses should implement / override this method to collect the Measurement. This method will be called every time data has been buffered for a duration and should return the final measurement for the buffered data.

Can return null if no data is available. Can return an Error if an error occurs.

onSamplingData

void onSamplingData(
  1. dynamic event
)
override

Handler for handling onData events from the buffering stream.

onSamplingEnd

void onSamplingEnd()
override

Handler called when sampling period ends.

onSamplingStart

void onSamplingStart()
override

Handler called when sampling period starts.