addBattery method

Future<BlueZBattery> addBattery(
  1. BlueZDevice device, {
  2. int percentage = 0,
  3. String source = '',
})

Registers a new battery attached to a device. percentage is the amount of charge in this battery. If provided, source describes where the battery information comes from.

Implementation

Future<BlueZBattery> addBattery(BlueZDevice device,
    {int percentage = 0, String source = ''}) async {
  var battery = BlueZBattery(
      DBusObjectPath('${path.value}/battery$_nextBatteryId'), device,
      percentage: percentage, source: source);
  _nextBatteryId += 1;

  await _client.registerObject(battery);
  return battery;
}