bas.h 1.1 KB

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