GATT Battery Service module

Use the GATT Battery Service module to enable and define the GATT Battery Service, and notify the subscribers about the battery level changes.

Module events

Source Module

Input Event

This Module

Output Event

Sink Module

Battery measurement module

battery_level_event

bas

Source modules for module_state_event

module_state_event

module_state_event

Sink modules for module_state_event

Note

See the Overview: Firmware architecture for more information about the event-based communication in the nRF Desktop application and about how to read this table.

Configuration

The module is enabled with the CONFIG_DESKTOP_BAS_ENABLE option. The option is selected by CONFIG_DESKTOP_HID_PERIPHERAL – Battery Service is required for the HID peripheral device.

Implementation details

The module uses BT_GATT_SERVICE_DEFINE to define the GATT Service. On battery_level_event, the module updates the battery level and notifies the subscribers.

More detailed information about GATT are available in the Zephyr documentation: Generic Attribute Profile (GATT).