1 /* 2 * Copyright (c) 2018 Nordic Semiconductor ASA 3 * Copyright (c) 2016 Intel Corporation 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_BAS_H_ 9 #define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_BAS_H_ 10 11 /** 12 * @brief Battery Service (BAS) 13 * @defgroup bt_bas Battery Service (BAS) 14 * @ingroup bluetooth 15 * @{ 16 * 17 * [Experimental] Users should note that the APIs can change 18 * as a part of ongoing development. 19 */ 20 21 #include <stdint.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** @brief Read battery level value. 28 * 29 * Read the characteristic value of the battery level 30 * 31 * @return The battery level in percent. 32 */ 33 uint8_t bt_bas_get_battery_level(void); 34 35 /** @brief Update battery level value. 36 * 37 * Update the characteristic value of the battery level 38 * This will send a GATT notification to all current subscribers. 39 * 40 * @param level The battery level in percent. 41 * 42 * @return Zero in case of success and error code in case of error. 43 */ 44 int bt_bas_set_battery_level(uint8_t level); 45 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 /** 52 * @} 53 */ 54 55 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_BAS_H_ */ 56