Bluetooth: services: battery service enhancements
This commit moves the BLE GATT Battery service from /samples/bluetooth/gatt to /subsys/bluetooth/services and adds a Kconfig entry to enable and configure the service; when enabled, it will register itself automatically. Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no> Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
6a0fcf1b45
commit
30d65809fc
29 changed files with 269 additions and 115 deletions
55
include/bluetooth/services/bas.h
Normal file
55
include/bluetooth/services/bas.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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)
|
||||
* @defgroup bt_gatt_bas Battery Service (BAS)
|
||||
* @ingroup bluetooth
|
||||
* @{
|
||||
*
|
||||
* [Experimental] Users should note that the APIs can change
|
||||
* as a part of ongoing development.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <zephyr/types.h>
|
||||
|
||||
/** @brief Read battery level value.
|
||||
*
|
||||
* Read the characteristic value of the battery level
|
||||
*
|
||||
* @return The battery level in percent.
|
||||
*/
|
||||
u8_t bt_gatt_bas_get_battery_level(void);
|
||||
|
||||
/** @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.
|
||||
*/
|
||||
int bt_gatt_bas_set_battery_level(u8_t level);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SERVICES_BAS_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue