bsal_srv_bas.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2006-2020, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-05-28 Supperthomas the first version
  9. */
  10. #ifndef __BSAL_SRV_BAS_H__
  11. #define __BSAL_SRV_BAS_H__
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include <stdint.h>
  16. #include <stdbool.h>
  17. #include "bsal.h"
  18. #define GATT_UUID_BATTERY BSAL_GATT_SERVICE_BATTERY_SERVICE
  19. #define GATT_UUID_CHAR_BAS_LEVEL BSAL_UUID_CHAR_BATTERY_LEVEL
  20. #define GATT_SVC_BAS_BATTERY_LEVEL_INDEX 2 /**< @brief Index for battery level chars's value */
  21. #define GATT_SVC_BAS_CHAR_CCCD_INDEX (GATT_SVC_BAS_BATTERY_LEVEL_INDEX+1) /**< @brief CCCD Index for battery level chars's value */
  22. /**
  23. * BSAL battery service init
  24. *
  25. * @param stack_ptr the point of the stack object
  26. * @param app_callback the callback of the service
  27. * @Note init the service
  28. */
  29. void bsal_le_bas_svr_init(void *stack_ptr, void *app_callback);
  30. /**
  31. * BSAL set the battery level local
  32. *
  33. * @param stack_ptr the point of the stack object
  34. * @param app_callback the callback of the service
  35. * @Note init the service
  36. */
  37. void bsal_set_battery_level_static(uint8_t battery_level);
  38. /**
  39. * BSAL set the battery level and send notify
  40. *
  41. * @param stack_ptr the point of the stack object
  42. * @param conn_id the conn_handle of the link
  43. * @param battery_level the battery level of the battery service
  44. * @Note set the notify level
  45. */
  46. void bsal_bas_send_notify_level(void *stack_ptr, uint16_t conn_id, uint8_t battery_level);
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif