Skip to content

BluetoothScanPeriodicSamplingConfiguration

A sampling configuration specifying how to scan for Bluetooth devices on a regular basis for a specific period.

Used with the ConnectivitySamplingPackage.BLUETOOTH measure. A scan starts every interval and runs for duration. The scan is filtered on withServices and withRemoteIds to only collect data from specific services and remote ids. Empty lists mean no filtering.

Filtering on remoteIds allows Android to scan for devices in the background without needing to be in the foreground. This is not possible on iOS.

Inheritance
Annotations

Constructors

BluetoothScanPeriodicSamplingConfiguration.fromJson

BluetoothScanPeriodicSamplingConfiguration.fromJson(
  1. Map<String, dynamic> json
)

BluetoothScanPeriodicSamplingConfiguration

BluetoothScanPeriodicSamplingConfiguration({
  1. required Duration interval,
  2. required Duration duration,
  3. List<String> withServices = const [],
  4. List<String> withRemoteIds = const [],
})

Properties

fromJsonFunction

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

withRemoteIds

List<String> withRemoteIds
getter/setter pair

List of remote device IDs to filter the scan results.

withServices

List<String> withServices
getter/setter pair

List of Bluetooth service UUIDs to filter the scan results.

Methods

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.