2018-09-11 20:05:46 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Nordic Semiconductor ASA
|
|
|
|
* Copyright (c) 2016 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_BAS_H_
|
|
|
|
#define ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_BAS_H_
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Battery Service (BAS)
|
2020-09-04 16:18:09 +08:00
|
|
|
* @defgroup bt_bas Battery Service (BAS)
|
2018-09-11 20:05:46 +08:00
|
|
|
* @ingroup bluetooth
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* [Experimental] Users should note that the APIs can change
|
|
|
|
* as a part of ongoing development.
|
|
|
|
*/
|
|
|
|
|
2019-08-13 01:54:12 +08:00
|
|
|
#include <zephyr/types.h>
|
|
|
|
|
2018-09-11 20:05:46 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/** @brief Read battery level value.
|
|
|
|
*
|
|
|
|
* Read the characteristic value of the battery level
|
|
|
|
*
|
|
|
|
* @return The battery level in percent.
|
|
|
|
*/
|
2020-09-04 16:18:09 +08:00
|
|
|
uint8_t bt_bas_get_battery_level(void);
|
2018-09-11 20:05:46 +08:00
|
|
|
|
|
|
|
/** @brief Update battery level value.
|
|
|
|
*
|
|
|
|
* Update the characteristic value of the battery level
|
|
|
|
* This will send a GATT notification to all current subscribers.
|
|
|
|
*
|
|
|
|
* @param level The battery level in percent.
|
|
|
|
*
|
|
|
|
* @return Zero in case of success and error code in case of error.
|
|
|
|
*/
|
2020-09-04 16:18:09 +08:00
|
|
|
int bt_bas_set_battery_level(uint8_t level);
|
2018-09-11 20:05:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_BAS_H_ */
|