InPlay API
in_ble_gatt.h
1 
13 #ifndef IN_BLE_GATT_H
14 #define IN_BLE_GATT_H
15 
25 #include <stdint.h>
26 #include "in_ble_att.h"
27 
28 /*
29  * DEFINES
30  ****************************************************************************************
31  */
32 
33 /*
34  * Macros
35  ****************************************************************************************
36  */
37 
38 
39 /*
40  * Enumerations
41  ****************************************************************************************
42  */
43 
45 /*@TRACE*/
47 {
58 };
59 
62 {
69 };
70 
73 {
86 };
87 
90 {
99 };
100 
103 {
112 };
113 
114 /*
115  * Structures
116  ****************************************************************************************
117  */
118 
120 typedef struct
121 {
123  uint16_t start_hdl;
125  uint16_t end_hdl;
127  uint8_t uuid_len;
129  uint8_t uuid[];
131 
133 typedef struct
134 {
136  uint16_t start_hdl;
138  uint16_t end_hdl;
140  uint8_t uuid_len;
142  uint8_t uuid[];
144 
146 typedef struct
147 {
149  uint16_t handle;
151  uint16_t offset;
153  uint16_t length;
155 
158 typedef struct
159 {
161  uint16_t start_hdl;
163  uint16_t end_hdl;
165  uint8_t uuid_len;
167  uint8_t uuid[];
169 
171 typedef struct
172 {
174  uint16_t handle;
176  uint16_t len;
178 
180 typedef union
181 {
189 
191 typedef struct
192 {
194  uint8_t nb;
198 
200 typedef struct
201 {
206  uint16_t handle;
208  uint16_t offset;
210  uint16_t length;
212  uint8_t value[];
214 
215 
217 typedef struct
218 {
220  uint8_t uuid[BLE_UUID_128_LEN];
221 
223  uint16_t prop;
224 
225 
237  uint16_t max_len;
238 
240  uint16_t ext_prop;
242 
244 typedef struct
245 {
247  uint16_t start_hdl;
248 
250  uint8_t prop;
251 
253  uint8_t uuid[BLE_UUID_128_LEN];
254 
256  uint8_t nb_att;
257 
260 
262 
264 typedef struct
265 {
267  uint16_t handle;
269  uint16_t length;
271  uint8_t value[];
272 } ble_att_val_t;
273 
275 typedef struct
276 {
278  uint16_t handle;
280  uint16_t perm;
282  uint16_t ext_perm;
284 
285 
286 /*
287  * Functions
288  ****************************************************************************************
289  */
290 
302 int in_ble_gatt_exc_mtu(void *hdl, int conidx, uint16_t *p_mtu, comp_cb callback);
303 
316 int in_ble_gatt_sdp(void *hdl, int conidx, int sdp_type, ble_gatt_sdp_t *p_sdp, comp_cb callback);
317 
330 int in_ble_gatt_discovery(void *hdl, int conidx, int disc_type, ble_gatt_disc_t *p_disc, comp_cb callback);
331 
344 int in_ble_gatt_read(void *hdl, int conidx, int read_type, ble_gatt_read_req_t *p_req, comp_cb callback);
345 
358 int in_ble_gatt_write(void *hdl, int conidx, int wrt_type, ble_gatt_write_t *p_write, comp_cb callback);
359 
371 int in_ble_gatt_excute_write(void *hdl, int conidx, bool execute, comp_cb callback);
372 
386 int in_ble_gatt_register_ind_ntf_event(void *hdl, int conidx, bool reg, uint32_t start_hdl, uint32_t end_hdl, comp_cb callback);
387 
399 int in_ble_gatt_indication_cfm(void *hdl, int conidx, uint16_t handle);
400 
414 int in_ble_gatt_send_ind(void *hdl, int conidx, uint32_t handle, uint32_t length, uint8_t *value, comp_cb callback);
415 
429 int in_ble_gatt_send_ntf(void *hdl, int conidx, uint32_t handle, uint32_t length, uint8_t *value, comp_cb callback);
430 int in_ble_gatt_send_ntf_direct(void *hdl, int conidx, uint32_t handle, uint32_t length, uint8_t *value);
431 
444 int in_ble_gatt_send_svc_changed(void *hdl, int conidx, uint32_t svc_shdl, uint32_t svc_ehdl, comp_cb callback);
445 
457 int in_ble_gatt_add_svc(void *hdl, ble_gatt_svc_desc_t *p_svc, uint16_t *p_hdl, comp_cb callback);
458 
470 int in_ble_gatt_get_svc_perm(void *hdl, uint16_t start_hdl, uint8_t *p_perm, comp_cb callback);
471 
483 int in_ble_gatt_set_svc_perm(void *hdl, uint16_t start_hdl, uint8_t perm, comp_cb callback);
484 
496 int in_ble_gatt_get_att_perm(void *hdl, uint16_t handle, ble_att_perm_t *p_perm, comp_cb callback);
497 
510 int in_ble_gatt_set_att_perm(void *hdl, uint16_t handle, uint16_t perm, uint16_t ext_perm, comp_cb callback);
511 
523 int in_ble_gatt_get_att_value(void *hdl, uint16_t handle, ble_att_val_t *p_att_val, comp_cb callback);
524 
537 int in_ble_gatt_set_att_value(void *hdl, uint16_t handle, uint16_t length, uint8_t *value, comp_cb callback);
538 
552 int in_ble_gatt_att_info_req_cfm(void *hdl, int conidx, uint16_t handle, uint16_t length, uint8_t status);
553 
566 int in_ble_gatt_write_req_cfm(void *hdl, uint8_t conidx, uint16_t handle, uint8_t status);
567 
582 int in_ble_gatt_read_req_cfm(void *hdl, uint8_t conidx, uint16_t handle, uint8_t status, uint16_t length, uint8_t *value);
583 
585 
586 #endif /* IN_BLE_GATT_H */
587 
int in_ble_gatt_get_att_perm(void *hdl, uint16_t handle, ble_att_perm_t *p_perm, comp_cb callback)
Retrieve attribute permission
Read command (Simple, Long, Multiple, or by UUID)
Definition: in_ble_gatt.h:191
ble_gatt_read_simple_t simple
Simple Read (GATT_READ or GATT_READ_LONG)
Definition: in_ble_gatt.h:183
Read long attribute.
Definition: in_ble_gatt.h:94
int in_ble_gatt_get_svc_perm(void *hdl, uint16_t start_hdl, uint8_t *p_perm, comp_cb callback)
Retrieve service attribute permission
request union according to read type
Definition: in_ble_gatt.h:180
ble_gatt_sdp_att_type
Service Discovery Attribute type.
Definition: in_ble_gatt.h:46
int in_ble_gatt_sdp(void *hdl, int conidx, int sdp_type, ble_gatt_sdp_t *p_sdp, comp_cb callback)
Service Discovery Procedure.
int in_ble_gatt_set_svc_perm(void *hdl, uint16_t start_hdl, uint8_t perm, comp_cb callback)
Set service attribute permission
ble_gatt_read_type
Gatt read type.
Definition: in_ble_gatt.h:89
Search specific service.
Definition: in_ble_gatt.h:64
int in_ble_gatt_send_ind(void *hdl, int conidx, uint32_t handle, uint32_t length, uint8_t *value, comp_cb callback)
Send indication.
Execute write.
Definition: in_ble_gatt.h:111
uint16_t start_hdl
Search start handle.
Definition: in_ble_gatt.h:123
No Attribute Information.
Definition: in_ble_gatt.h:49
int in_ble_gatt_read(void *hdl, int conidx, int read_type, ble_gatt_read_req_t *p_req, comp_cb callback)
Read Attribute.
Discover characteristic descriptor.
Definition: in_ble_gatt.h:85
ble_gatt_read_t req
request union according to read type
Definition: in_ble_gatt.h:196
uint16_t end_hdl
End handle.
Definition: in_ble_gatt.h:163
uint16_t offset
Write offset.
Definition: in_ble_gatt.h:208
Service Discovery Procedure (SDP)
Definition: in_ble_gatt.h:120
uint8_t uuid_len
Service UUID Length.
Definition: in_ble_gatt.h:127
int in_ble_gatt_send_svc_changed(void *hdl, int conidx, uint32_t svc_shdl, uint32_t svc_ehdl, comp_cb callback)
Inform Service changed.
int in_ble_gatt_read_req_cfm(void *hdl, uint8_t conidx, uint16_t handle, uint8_t status, uint16_t length, uint8_t *value)
Confirm attribute read reqeust
Write signed.
Definition: in_ble_gatt.h:109
uint16_t ext_prop
Attribute extended properties,.
Definition: in_ble_gatt.h:240
Discover all characteristics.
Definition: in_ble_gatt.h:81
int in_ble_gatt_write(void *hdl, int conidx, int wrt_type, ble_gatt_write_t *p_write, comp_cb callback)
Write Attribute.
Read attribute by UUID.
Definition: in_ble_gatt.h:96
Simple Read (GATT_READ or GATT_READ_LONG)
Definition: in_ble_gatt.h:146
Service description.
Definition: in_ble_gatt.h:244
Write peer attribute value.
Definition: in_ble_gatt.h:200
uint16_t handle
attribute handle
Definition: in_ble_gatt.h:174
int in_ble_gatt_write_req_cfm(void *hdl, uint8_t conidx, uint16_t handle, uint8_t status)
Confirm attribute write reqeust
uint16_t length
Length of data to read (0 = read all)
Definition: in_ble_gatt.h:153
Read Multiple short characteristic (GATT_READ_MULTIPLE)
Definition: in_ble_gatt.h:171
uint16_t perm
Attribute permission,.
Definition: in_ble_gatt.h:280
uint16_t handle
attribute handle
Definition: in_ble_gatt.h:149
uint16_t length
Write length.
Definition: in_ble_gatt.h:210
Included Service Information.
Definition: in_ble_gatt.h:51
uint16_t ext_perm
Extended Attribute permission,.
Definition: in_ble_gatt.h:282
int in_ble_gatt_set_att_perm(void *hdl, uint16_t handle, uint16_t perm, uint16_t ext_perm, comp_cb callback)
Set attribute permission
attribute permission
Definition: in_ble_gatt.h:275
int in_ble_gatt_excute_write(void *hdl, int conidx, bool execute, comp_cb callback)
Execute Write command for queue writes.
int in_ble_gatt_send_ntf(void *hdl, int conidx, uint32_t handle, uint32_t length, uint8_t *value, comp_cb callback)
Send notification.
uint8_t prop
Service properties,.
Definition: in_ble_gatt.h:250
uint8_t uuid_len
UUID length.
Definition: in_ble_gatt.h:140
ble_gatt_write_type
Gatt write type.
Definition: in_ble_gatt.h:102
int in_ble_gatt_exc_mtu(void *hdl, int conidx, uint16_t *p_mtu, comp_cb callback)
Exchange MTU request.
Attribute Description.
Definition: in_ble_gatt.h:217
uint16_t start_hdl
Attribute Start Handle (0 = dynamically allocated)
Definition: in_ble_gatt.h:247
uint8_t uuid_len
Size of UUID.
Definition: in_ble_gatt.h:165
Attributes Discovery Structure.
Definition: in_ble_gatt.h:133
Characteristic Declaration.
Definition: in_ble_gatt.h:53
Read multiple attribute.
Definition: in_ble_gatt.h:98
Discover services by UUID.
Definition: in_ble_gatt.h:77
Discover all services.
Definition: in_ble_gatt.h:75
uint16_t max_len
Definition: in_ble_gatt.h:237
Discover included services.
Definition: in_ble_gatt.h:79
uint16_t end_hdl
end handle range
Definition: in_ble_gatt.h:138
uint16_t length
Attribute value length.
Definition: in_ble_gatt.h:269
Search for all services.
Definition: in_ble_gatt.h:66
uint16_t prop
Attribute Properties,.
Definition: in_ble_gatt.h:223
int in_ble_gatt_att_info_req_cfm(void *hdl, int conidx, uint16_t handle, uint16_t length, uint8_t status)
Confirm attribute prepare write reqeust
ble_gatt_sdp_type
Gatt SDP type.
Definition: in_ble_gatt.h:61
uint16_t handle
Handle of the attribute.
Definition: in_ble_gatt.h:278
uint8_t nb
number of read (only used for multiple read)
Definition: in_ble_gatt.h:194
Attribute Value.
Definition: in_ble_gatt.h:55
ble_gatt_read_by_uuid_t by_uuid
Read by UUID (GATT_READ_BY_UUID)
Definition: in_ble_gatt.h:185
ble_gatt_disc_type
Gatt discovery type.
Definition: in_ble_gatt.h:72
Write attribute.
Definition: in_ble_gatt.h:105
uint16_t handle
Attribute handle.
Definition: in_ble_gatt.h:206
int in_ble_gatt_register_ind_ntf_event(void *hdl, int conidx, bool reg, uint32_t start_hdl, uint32_t end_hdl, comp_cb callback)
Registration to peer device events (Indication/Notification)
Attribute Descriptor.
Definition: in_ble_gatt.h:57
uint8_t nb_att
Number of attributes.
Definition: in_ble_gatt.h:256
uint16_t start_hdl
Start handle.
Definition: in_ble_gatt.h:161
int in_ble_gatt_indication_cfm(void *hdl, int conidx, uint16_t handle)
Confirm receive Indication.
uint16_t offset
start offset in data payload (0
Definition: in_ble_gatt.h:151
int in_ble_gatt_get_att_value(void *hdl, uint16_t handle, ble_att_val_t *p_att_val, comp_cb callback)
Retrieve attribute value
int in_ble_gatt_discovery(void *hdl, int conidx, int disc_type, ble_gatt_disc_t *p_disc, comp_cb callback)
Attributes Discovery.
int in_ble_gatt_add_svc(void *hdl, ble_gatt_svc_desc_t *p_svc, uint16_t *p_hdl, comp_cb callback)
Add a new Service
bool auto_execute
Definition: in_ble_gatt.h:204
uint16_t handle
Handle of the attribute.
Definition: in_ble_gatt.h:267
Write no response.
Definition: in_ble_gatt.h:107
Definition: in_ble_gatt.h:158
int in_ble_gatt_set_att_value(void *hdl, uint16_t handle, uint16_t length, uint8_t *value, comp_cb callback)
Set attribute value
Read attribute.
Definition: in_ble_gatt.h:92
Discover characteristic by UUID.
Definition: in_ble_gatt.h:83
uint16_t end_hdl
Search end handle.
Definition: in_ble_gatt.h:125
uint16_t start_hdl
start handle
Definition: in_ble_gatt.h:136
uint16_t len
Known Handle length (shall be != 0)
Definition: in_ble_gatt.h:176
attribute value
Definition: in_ble_gatt.h:264
Cancel Service Discovery Procedure.
Definition: in_ble_gatt.h:68