Modules
Battery Service (BAS)
BLE Services

Definitions and prototypes for the BAS interface. More...

Collaboration diagram for Battery Service (BAS):

## Modules
| Defines
| Enumerations
| Structures
| Typedefs
| Functions

## Detailed Description

Definitions and prototypes for the BAS interface.

The Battery Service exposes the state of a battery within a device. This module implements the Battery Service with the Battery Level characteristic.

After bas_init_t variable is initialized, the application must call bas_service_init() to add the Battery Service(s) and Battery Level characteristic(s) to the BLE Stack database. However the value of Battery Level characteristic is stored within bas_init_t::batt_lvl which locates in user space.

The module supports more than one instance of the Battery service with bas_service_init(). When the device has more than one instance, each Battery Level characteristic shall include a Characteristic Presentation Format descriptor to identify the instance. bas_init_t::char_mask shall be set with the mask BAS_CHAR_FORMAT_SUP to add the descriptor to the BLE stack database.

If bas_init_t::char_mask is set with the mask BAS_CHAR_LVL_NTF_SUP, the module will support notification of the Battery Level characteristic through the bas_batt_lvl_update() function. If an event handler is provided by the application, the Battery Service will pass Battery Service events to the application.