getDataAvailable method

Future<bool?> getDataAvailable()

Check if the device has data stored.

true if data is available on the device, otherwise false.

Implementation

Future<bool?> getDataAvailable() async {
  if (_dataAvailable == null) {
    _log.warning("Data Available characteristic not found on device");
    return null;
  }
  List<int> bytes = await _dataAvailable!.read();
  ByteData byteData = ByteData.sublistView(Uint8List.fromList(bytes));
  bool dataAvailable = byteData.getUint8(0) == 1;
  return dataAvailable;
}