getMeasurementEnabled method

Future<bool?> getMeasurementEnabled()

Checks if a measurement is running on the device.

true if a measurement is running otherwise false.

Implementation

Future<bool?> getMeasurementEnabled() async {
  if (_measurementEnabled == null) {
    _log.warning("Measurement Enabled characteristic not found on device");
    return null;
  }
  List<int> bytes = await _measurementEnabled!.read();
  ByteData byteData = ByteData.sublistView(Uint8List.fromList(bytes));
  bool measurementEnabled = byteData.getUint8(0) == 1;
  return measurementEnabled;
}