src.bluetooth_sig.gatt.characteristics.battery_information¶
Battery Information characteristic implementation.
Implements the Battery Information characteristic (0x2BEC) from the Battery Service. A 16-bit flags field controls the presence of optional fields. A mandatory Battery Features byte is always present after the flags.
All flag bits use normal logic (1 = present, 0 = absent).
References
Bluetooth SIG Battery Service 1.1 org.bluetooth.characteristic.battery_information (GSS YAML)
Classes¶
Name | Description |
|---|---|
Battery Chemistry enumeration as per Bluetooth SIG specification. |
|
Battery Features bitfield as per Bluetooth SIG specification. |
|
Parsed data from Battery Information characteristic. |
|
Battery Information characteristic (0x2BEC). |
|
Battery Information flags as per Bluetooth SIG specification. |
Module Contents¶
- class src.bluetooth_sig.gatt.characteristics.battery_information.BatteryChemistry¶
Bases:
enum.IntEnumBattery Chemistry enumeration as per Bluetooth SIG specification.
- ALKALINE = 1¶
- LEAD_ACID = 2¶
- LITHIUM_ION = 5¶
- LITHIUM_IRON_DISULFIDE = 3¶
- LITHIUM_MANGANESE_DIOXIDE = 4¶
- LITHIUM_POLYMER = 6¶
- NICKEL_CADMIUM = 8¶
- NICKEL_METAL_HYDRIDE = 9¶
- NICKEL_OXYHYDROXIDE = 7¶
- OTHER = 255¶
- SILVER_OXIDE = 10¶
- UNKNOWN = 0¶
- ZINC_AIR = 12¶
- ZINC_CARBON = 13¶
- ZINC_CHLORIDE = 11¶
- class src.bluetooth_sig.gatt.characteristics.battery_information.BatteryFeatures¶
Bases:
enum.IntFlagBattery Features bitfield as per Bluetooth SIG specification.
- RECHARGEABLE = 2¶
- REPLACEABLE = 1¶
- class src.bluetooth_sig.gatt.characteristics.battery_information.BatteryInformation¶
Bases:
msgspec.StructParsed data from Battery Information characteristic.
- flags¶
Raw 16-bit flags field.
- battery_features¶
Mandatory features bitfield (replaceable, rechargeable).
- battery_manufacture_date¶
Days since epoch (1970-01-01). None if absent.
- battery_expiration_date¶
Days since epoch (1970-01-01). None if absent.
- battery_designed_capacity¶
Designed capacity in kWh (medfloat16). None if absent.
- battery_low_energy¶
Low energy threshold in kWh (medfloat16). None if absent.
- battery_critical_energy¶
Critical energy threshold in kWh (medfloat16). None if absent.
- battery_chemistry¶
Chemistry type. None if absent.
- nominal_voltage¶
Nominal voltage in volts (medfloat16). None if absent.
- battery_aggregation_group¶
Aggregation group number (0=none, 1-254=group). None if absent.
- battery_chemistry: BatteryChemistry | None = None¶
- battery_features: BatteryFeatures¶
- flags: BatteryInformationFlags¶
- class src.bluetooth_sig.gatt.characteristics.battery_information.BatteryInformationCharacteristic(info: src.bluetooth_sig.types.CharacteristicInfo | None = None, validation: src.bluetooth_sig.gatt.characteristics.characteristic_meta.ValidationConfig | None = None)¶
Bases:
src.bluetooth_sig.gatt.characteristics.base.BaseCharacteristic[BatteryInformation]Battery Information characteristic (0x2BEC).
Reports physical battery characteristics including features, dates, capacity, chemistry, voltage, and aggregation group.
- Flag-bit assignments (from GSS YAML, 16-bit flags):
Bit 0: Battery Manufacture Date Present Bit 1: Battery Expiration Date Present Bit 2: Battery Designed Capacity Present Bit 3: Battery Low Energy Present Bit 4: Battery Critical Energy Present Bit 5: Battery Chemistry Present Bit 6: Nominal Voltage Present Bit 7: Battery Aggregation Group Present Bits 8-15: Reserved for Future Use
The mandatory Battery Features byte is always present after the flags.
- expected_type¶
- class src.bluetooth_sig.gatt.characteristics.battery_information.BatteryInformationFlags¶
Bases:
enum.IntFlagBattery Information flags as per Bluetooth SIG specification.
- AGGREGATION_GROUP_PRESENT = 128¶
- BATTERY_CHEMISTRY_PRESENT = 32¶
- CRITICAL_ENERGY_PRESENT = 16¶
- DESIGNED_CAPACITY_PRESENT = 4¶
- EXPIRATION_DATE_PRESENT = 2¶
- LOW_ENERGY_PRESENT = 8¶
- MANUFACTURE_DATE_PRESENT = 1¶
- NOMINAL_VOLTAGE_PRESENT = 64¶