subscribeToBatteryPercentageStream method

Future<Stream<int>> subscribeToBatteryPercentageStream(
  1. String deviceId
)

Subscribes to the battery percentage stream from the BLE device with the given deviceId.

deviceId - The identifier of the target device.

Returns a stream of battery percentage updates.

Implementation

Future<Stream<int>> subscribeToBatteryPercentageStream(
    String deviceId) async {
  try {
    return _bleDevicesStreamsHandler.batteryHandler
        .getBatteryPercentageStream(deviceId);
  } catch (e) {
    _appLogger.error("Error subscribing to battery percentage stream: $e");
    rethrow;
  }
}