gatt.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*********************************************************************************************
  2. * Filename : btstack_event.h
  3. * Description :
  4. * Author : Minxian
  5. * Email : liminxian@zh-jieli.com
  6. * Last modifiled : 2020-07-01 16:23
  7. * Copyright:(c)JIELI 2011-2020 @ , All Rights Reserved.
  8. *********************************************************************************************/
  9. #ifndef __BT_GATT_H
  10. #define __BT_GATT_H
  11. #include "typedef.h"
  12. typedef struct {
  13. uint16_t start_group_handle;
  14. uint16_t end_group_handle;
  15. uint16_t uuid16;
  16. uint8_t uuid128[16];
  17. } le_service_t, gatt_client_service_t;
  18. typedef struct {
  19. uint16_t start_handle;
  20. uint16_t value_handle;
  21. uint16_t end_handle;
  22. uint16_t properties;
  23. uint16_t uuid16;
  24. uint8_t uuid128[16];
  25. } le_characteristic_t, gatt_client_characteristic_t;
  26. typedef struct {
  27. uint16_t handle;
  28. uint16_t uuid16;
  29. uint8_t uuid128[16];
  30. } gatt_client_characteristic_descriptor_t;
  31. void gatt_client_deserialize_service(const uint8_t *packet, int offset, gatt_client_service_t *service);
  32. void gatt_client_deserialize_characteristic(const uint8_t *packet, int offset, gatt_client_characteristic_t *characteristic);
  33. void gatt_client_deserialize_characteristic_descriptor(const uint8_t *packet, int offset, gatt_client_characteristic_descriptor_t *descriptor);
  34. uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t offset);
  35. uint8_t gatt_client_read_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle);
  36. uint8_t gatt_client_write_value_of_characteristic_without_response(hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t *value);
  37. uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t *data);
  38. void gatt_client_request_can_send_now_event(hci_con_handle_t con_handle);
  39. #endif