onSamplingStart method

  1. @override
void onSamplingStart()
override

Handler called when sampling period starts.

Implementation

@override
void onSamplingStart() {
  _datum = BluetoothDatum();
  try {
    FlutterBluePlus.instance.startScan(
        scanMode: ScanMode.lowLatency,
        timeout: samplingConfiguration?.duration ??
            Duration(milliseconds: DEFAULT_TIMEOUT));
  } catch (error) {
    FlutterBluePlus.instance.stopScan();
    _datum = ErrorDatum('Error scanning for bluetooth - $error');
  }
}