getStorageLevel method

Future<int?> getStorageLevel()

Get storage level of device in percentage of used space.

ECG Move 4 did not seem to work with this

Implementation

Future<int?> getStorageLevel() async {
  if (_storageLevel == null) {
    _log.warning("Storage Level characteristic not found on device");
    return null;
  }
  List<int> bytes = await _storageLevel!.read();
  ByteData byteData = ByteData.sublistView(Uint8List.fromList(bytes));
  int status = byteData.getUint8(0);
  return status;
}