nRF Connect SDK Bare Metal API 2.0.99
Loading...
Searching...
No Matches

◆ ble_bas_battery_level_update()

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.

Parameters
basBattery service.
conn_handleConnection handle.
battery_levelBattery level (in percent of full capacity) or BLE_BAS_BATTERY_LEVEL_LAST to notify the last value.
Return values
NRF_SUCCESSOn success.
NRF_ERROR_NULLIf bas is NULL.
NRF_ERROR_INVALID_PARAMIf battery_level is outside of the valid range (0-100) and not equal to BLE_BAS_BATTERY_LEVEL_LAST.
Returns
In addition, this function may return any error returned by the following SoftDevice functions:
  • sd_ble_gatts_value_set()
  • sd_ble_gatts_hvx()