hrs.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (C) 2020 Inria
  3. *
  4. * This file is subject to the terms and conditions of the GNU Lesser
  5. * General Public License v2.1. See the file LICENSE in the top level
  6. * directory for more details.
  7. */
  8. #ifndef _APP_BLEMAN_HRS_H
  9. #define _APP_BLEMAN_HRS_H
  10. #include <stdint.h>
  11. #include "event.h"
  12. #include "event/timeout.h"
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /**
  17. * @brief Controller battery measurement interval in milliseconds
  18. */
  19. #ifndef BLEMAN_HEART_RATE_UPDATE_INTERVAL
  20. #define BLEMAN_HEART_RATE_UPDATE_INTERVAL 1 * MS_PER_SEC
  21. #endif
  22. typedef struct {
  23. event_timeout_t evt; /**< Event timeout for HRS notifications */
  24. event_t ev; /**< Event for HRS notifications */
  25. uint16_t bpm; /**< Last submitted heart rate */
  26. int step;
  27. uint16_t handle; /**< notification handle */
  28. } bleman_hrs_t;
  29. /**
  30. * @brief handler for bleman heart rate service requests
  31. */
  32. int bleman_hrs_handler(uint16_t conn_handle, uint16_t attr_handle,
  33. struct ble_gatt_access_ctxt *ctxt, void *arg);
  34. /**
  35. * @brief Enable or disable bleman heart rate service notifications
  36. */
  37. void bleman_hrs_notify(bleman_hrs_t *hrs, bool enable);
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif /* APP_BLEMAN_BAS_H */