disconnect method

Future<void> disconnect()

Disconnects from the Movesense device and cleans up all sensor subscriptions.

Implementation

Future<void> disconnect() async {
  try {
    if (connectedSerial != null) {
      Mds.disconnect(connectedSerial!);
      connectedSerial = null;
    }
    // Clean up any remaining subscriptions
    await stopAccelerometer();
    await stopGyroscope();
    await stopMagnetometer();
  } catch (e) {
    if (kDebugMode) {
      print('Error disconnecting Movesense device: $e');
    }
  }
}