ba_get_full_battery_info#

Read detailed battery diagnostics from the device.

Function Signature#

function battery = ba_get_full_battery_info()

Usage#

battery = ba_get_full_battery_info()

Outputs#

battery

struct with fields:

level

charge in percent, 0 to 100.

health

battery health in percent, 0 to 100.

voltage

battery voltage in millivolts.

current

current in milliamperes; negative while discharging.

is_charger_connected

logical.

charging_state

‘charging’, ‘discharging_active’, ‘discharging_inactive’ or ‘unknown’.

charge_level

‘good’, ‘low’, ‘critical’ or ‘unknown’.

Example#

battery = ba_get_full_battery_info()

Notes#

Requires an active device connection. Makes several Bluetooth reads, so use it sparingly; ba_get_battery_info is the quick level and charging check. A field the device could not report reads 0 or ‘unknown’.

Source File#

matlab/ba_get_full_battery_info.m