![]() |
nRF Connect SDK Bare Metal API 2.0.99
|
| uint32_t ble_bas_battery_level_update | ( | struct ble_bas * | bas, |
| uint16_t | conn_handle, | ||
| uint8_t | battery_level ) |
#include <ble_bas.h>
Update battery level.
Updates the battery level in the GATT database and sends a notification if the notification bit in the CCCD is set for conn_handle.
| bas | Battery service. |
| conn_handle | Connection handle. |
| battery_level | Battery level (in percent of full capacity) or BLE_BAS_BATTERY_LEVEL_LAST to notify the last value. |
| NRF_SUCCESS | On success. |
| NRF_ERROR_NULL | If bas is NULL. |
| NRF_ERROR_INVALID_PARAM | If battery_level is outside of the valid range (0-100) and not equal to BLE_BAS_BATTERY_LEVEL_LAST. |