bleman_conf.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (C) 2019 Koen Zandberg <koen@bergzand.net>
  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_CONF_H
  9. #define APP_BLEMAN_CONF_H
  10. #include "ble_svc_gap.h"
  11. #include "ble_svc_gatt.h"
  12. #include "net/bluetil/ad.h"
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #ifndef CONFIG_BLEMAN_CUSTOM_SERVICE
  17. /* GATT service definitions */
  18. static const struct ble_gatt_svc_def gatt_svr_svcs[] = {
  19. {
  20. .type = BLE_GATT_SVC_TYPE_PRIMARY,
  21. .uuid = BLE_UUID128_DECLARE(CONFIG_BLEMAN_ROOMBA_UUID),
  22. .characteristics = (struct ble_gatt_chr_def[]) { {
  23. 0, /* no more characteristics in this service */
  24. }, }
  25. },
  26. {
  27. /* Heart Rate Service */
  28. .type = BLE_GATT_SVC_TYPE_PRIMARY,
  29. .uuid = BLE_UUID16_DECLARE(BLE_GATT_SVC_HRS),
  30. .characteristics = (struct ble_gatt_chr_def[]) { {
  31. .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_HEART_RATE_MEASURE),
  32. .access_cb = bleman_hrs_handler,
  33. .val_handle = &_bleman.hrs.handle,
  34. .flags = BLE_GATT_CHR_F_NOTIFY,
  35. }, {
  36. .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_BODY_SENSE_LOC),
  37. .access_cb = bleman_hrs_handler,
  38. .flags = BLE_GATT_CHR_F_READ,
  39. }, {
  40. 0, /* no more characteristics in this service */
  41. }, }
  42. },
  43. {
  44. /* Device Information Service */
  45. .type = BLE_GATT_SVC_TYPE_PRIMARY,
  46. .uuid = BLE_UUID16_DECLARE(BLE_GATT_SVC_DEVINFO),
  47. .characteristics = (struct ble_gatt_chr_def[]) { {
  48. .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_MANUFACTURER_NAME),
  49. .access_cb = _devinfo_handler,
  50. .flags = BLE_GATT_CHR_F_READ,
  51. .arg = &_bleman,
  52. }, {
  53. .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_MODEL_NUMBER_STR),
  54. .access_cb = _devinfo_handler,
  55. .flags = BLE_GATT_CHR_F_READ,
  56. .arg = &_bleman,
  57. }, {
  58. .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_SERIAL_NUMBER_STR),
  59. .access_cb = _devinfo_handler,
  60. .flags = BLE_GATT_CHR_F_READ,
  61. .arg = &_bleman,
  62. }, {
  63. .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_FW_REV_STR),
  64. .access_cb = _devinfo_handler,
  65. .flags = BLE_GATT_CHR_F_READ,
  66. .arg = &_bleman,
  67. }, {
  68. .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_HW_REV_STR),
  69. .access_cb = _devinfo_handler,
  70. .flags = BLE_GATT_CHR_F_READ,
  71. .arg = &_bleman,
  72. }, {
  73. 0, /* no more characteristics in this service */
  74. }, }
  75. },
  76. {
  77. /* Battery Level Service */
  78. .type = BLE_GATT_SVC_TYPE_PRIMARY,
  79. .uuid = BLE_UUID16_DECLARE(BLE_GATT_SVC_BAS),
  80. .characteristics = (struct ble_gatt_chr_def[]) { {
  81. .uuid = BLE_UUID16_DECLARE(BLE_GATT_CHAR_BATTERY_LEVEL),
  82. .access_cb = bleman_bas_handler,
  83. .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_READ_AUTHEN | BLE_GATT_CHR_F_NOTIFY,
  84. .val_handle = &_bleman.bas.handle,
  85. .arg = &_bleman,
  86. }, {
  87. 0, /* no more characteristics in this service */
  88. }, }
  89. },
  90. {
  91. 0, /* no more services */
  92. },
  93. };
  94. #endif
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif /* APP_BLEMAN_CONF_H */