stopFetchMeasurement method

  1. @override
Future<VtjCommandResult<StopFetchMeasurementResult>> stopFetchMeasurement(
  1. BluetoothDevice device
)
override

Stop sending measurement data (started with fetchMeasurement). See BLE Interface Specification Section 7.13

Implementation

@override
Future<VtjCommandResult<StopFetchMeasurementResult>> stopFetchMeasurement(
  BluetoothDevice device,
) async {
  // Cancel the download subscription
  final deviceId = device.remoteId.str;
  await _downloadSubscriptions[deviceId]?.cancel();
  _downloadSubscriptions.remove(deviceId);

  // Reset fetch state
  _fetchRegistry.getManager(device).reset();

  return _executeCommand<StopFetchMeasurementResult>(
    device: device,
    createCommand: () => StopFetchMeasurementCommand(),
  );
}