SmartSnippets DA1459x SDK
ble_mgr_gatts.h
Go to the documentation of this file.
1 
41 #ifndef BLE_MGR_GATTS_H_
42 #define BLE_MGR_GATTS_H_
43 
44 #include <stdint.h>
45 #include "osal.h"
46 #include "ble_mgr_cmd.h"
47 #include "ble_att.h"
48 #include "ble_gatt.h"
49 #include "ble_gatts.h"
50 
51 enum ble_cmd_gatts_opcode {
52  BLE_MGR_GATTS_SERVICE_ADD_CMD = BLE_MGR_CMD_CAT_FIRST(BLE_MGR_GATTS_CMD_CAT),
53  BLE_MGR_GATTS_SERVICE_INCLUDE_ADD_CMD,
54  BLE_MGR_GATTS_SERVICE_CHARACTERISTIC_ADD_CMD,
55  BLE_MGR_GATTS_SERVICE_DESCRIPTOR_ADD_CMD,
56  BLE_MGR_GATTS_SERVICE_REGISTER_CMD,
57  BLE_MGR_GATTS_SERVICE_ENABLE_CMD,
58  BLE_MGR_GATTS_SERVICE_DISABLE_CMD,
59  BLE_MGR_GATTS_SERVICE_CHARACTERISTIC_GET_PROP_CMD,
60  BLE_MGR_GATTS_SERVICE_CHARACTERISTIC_SET_PROP_CMD,
61  BLE_MGR_GATTS_GET_VALUE_CMD,
62  BLE_MGR_GATTS_SET_VALUE_CMD,
63  BLE_MGR_GATTS_READ_CFM_CMD,
64  BLE_MGR_GATTS_WRITE_CFM_CMD,
65  BLE_MGR_GATTS_PREPARE_WRITE_CFM_CMD,
66  BLE_MGR_GATTS_SEND_EVENT_CMD,
67  BLE_MGR_GATTS_SERVICE_CHANGED_IND_CMD,
68  /* Dummy command opcode, needs to be always defined after all commands */
69  BLE_MGR_GATTS_LAST_CMD,
70 };
71 
72 typedef struct {
74  att_uuid_t uuid;
75  gatt_service_t type;
76  uint16_t num_attrs;
77 } ble_mgr_gatts_service_add_cmd_t;
78 
79 typedef struct {
81  ble_error_t status;
82 } ble_mgr_gatts_service_add_rsp_t;
83 
84 void ble_mgr_gatts_service_add_cmd_handler(void *param);
85 
86 typedef struct {
88  uint16_t handle;
89 } ble_mgr_gatts_service_add_include_cmd_t;
90 
91 typedef struct {
93  ble_error_t status;
94  uint16_t h_offset;
95 } ble_mgr_gatts_service_add_include_rsp_t;
96 
97 void ble_mgr_gatts_service_add_include_cmd_handler(void *param);
98 
99 typedef struct {
100  ble_mgr_msg_hdr_t hdr;
101  att_uuid_t uuid;
102  uint16_t prop;
103  uint16_t perm;
104  uint16_t max_len;
105  gatts_flag_t flags;
106 } ble_mgr_gatts_service_add_characteristic_cmd_t;
107 
108 typedef struct {
109  ble_mgr_msg_hdr_t hdr;
110  ble_error_t status;
111  uint16_t h_offset;
112  uint16_t h_val_offset;
113 } ble_mgr_gatts_service_add_characteristic_rsp_t;
114 
115 void ble_mgr_gatts_service_add_characteristic_cmd_handler(void *param);
116 
117 typedef struct {
118  ble_mgr_msg_hdr_t hdr;
119  att_uuid_t uuid;
120  uint16_t perm;
121  uint16_t max_len;
122  gatts_flag_t flags;
123 } ble_mgr_gatts_service_add_descriptor_cmd_t;
124 
125 typedef struct {
126  ble_mgr_msg_hdr_t hdr;
127  ble_error_t status;
128  uint16_t h_offset;
129 } ble_mgr_gatts_service_add_descriptor_rsp_t;
130 
131 void ble_mgr_gatts_service_add_descriptor_cmd_handler(void *param);
132 
133 typedef struct {
134  ble_mgr_msg_hdr_t hdr;
135 } ble_mgr_gatts_service_register_cmd_t;
136 
137 typedef struct {
138  ble_mgr_msg_hdr_t hdr;
139  ble_error_t status;
140  uint16_t handle;
141 } ble_mgr_gatts_service_register_rsp_t;
142 
143 void ble_mgr_gatts_service_register_cmd_handler(void *param);
144 
145 typedef struct {
146  ble_mgr_msg_hdr_t hdr;
147  uint16_t handle;
148 } ble_mgr_gatts_service_enable_cmd_t;
149 
150 typedef struct {
151  ble_mgr_msg_hdr_t hdr;
152  ble_error_t status;
153 } ble_mgr_gatts_service_enable_rsp_t;
154 
155 void ble_mgr_gatts_service_enable_cmd_handler(void *param);
156 
157 typedef struct {
158  ble_mgr_msg_hdr_t hdr;
159  uint16_t handle;
160 } ble_mgr_gatts_service_disable_cmd_t;
161 
162 typedef struct {
163  ble_mgr_msg_hdr_t hdr;
164  ble_error_t status;
165 } ble_mgr_gatts_service_disable_rsp_t;
166 
167 void ble_mgr_gatts_service_disable_cmd_handler(void *param);
168 
169 typedef struct {
170  ble_mgr_msg_hdr_t hdr;
171  uint16_t handle;
172 } ble_mgr_gatts_service_characteristic_get_prop_cmd_t;
173 
174 typedef struct {
175  ble_mgr_msg_hdr_t hdr;
176  ble_error_t status;
177  gatt_prop_t prop;
178  att_perm_t perm;
179 } ble_mgr_gatts_service_characteristic_get_prop_rsp_t;
180 
181 void ble_mgr_gatts_service_characteristic_get_prop_cmd_handler(void *param);
182 
183 typedef struct {
184  ble_mgr_msg_hdr_t hdr;
185  uint16_t handle;
186  gatt_prop_t prop;
187  att_perm_t perm;
188 } ble_mgr_gatts_service_characteristic_set_prop_cmd_t;
189 
190 typedef struct {
191  ble_mgr_msg_hdr_t hdr;
192  ble_error_t status;
193 } ble_mgr_gatts_service_characteristic_set_prop_rsp_t;
194 
195 void ble_mgr_gatts_service_characteristic_set_prop_cmd_handler(void *param);
196 
197 typedef struct {
198  ble_mgr_msg_hdr_t hdr;
199  uint16_t handle;
200  uint16_t max_len;
201 } ble_mgr_gatts_get_value_cmd_t;
202 
203 typedef struct {
204  ble_mgr_msg_hdr_t hdr;
205  ble_error_t status;
206  uint16_t length;
207  uint8_t value[0];
208 } ble_mgr_gatts_get_value_rsp_t;
209 
210 void ble_mgr_gatts_get_value_cmd_handler(void *param);
211 
212 typedef struct {
213  ble_mgr_msg_hdr_t hdr;
214  uint16_t handle;
215  uint16_t length;
216  uint8_t value[0];
217 } ble_mgr_gatts_set_value_cmd_t;
218 
219 typedef struct {
220  ble_mgr_msg_hdr_t hdr;
221  ble_error_t status;
222 } ble_mgr_gatts_set_value_rsp_t;
223 
224 void ble_mgr_gatts_set_value_cmd_handler(void *param);
225 
226 typedef struct {
227  ble_mgr_msg_hdr_t hdr;
228  uint16_t conn_idx;
229  uint16_t handle;
230  ble_error_t status;
231  uint16_t length;
232  uint8_t value[0];
233 } ble_mgr_gatts_read_cfm_cmd_t;
234 
235 typedef struct {
236  ble_mgr_msg_hdr_t hdr;
237  ble_error_t status;
238 } ble_mgr_gatts_read_cfm_rsp_t;
239 
240 void ble_mgr_gatts_read_cfm_cmd_handler(void *param);
241 
242 typedef struct {
243  ble_mgr_msg_hdr_t hdr;
244  uint16_t conn_idx;
245  uint16_t handle;
246  uint8_t status;
247 } ble_mgr_gatts_write_cfm_cmd_t;
248 
249 typedef struct {
250  ble_mgr_msg_hdr_t hdr;
251  ble_error_t status;
252 } ble_mgr_gatts_write_cfm_rsp_t;
253 
254 void ble_mgr_gatts_write_cfm_cmd_handler(void *param);
255 
256 typedef struct {
257  ble_mgr_msg_hdr_t hdr;
258  uint16_t conn_idx;
259  uint16_t handle;
260  uint16_t length;
261  uint8_t status;
262 } ble_mgr_gatts_prepare_write_cfm_cmd_t;
263 
264 typedef struct {
265  ble_mgr_msg_hdr_t hdr;
266  ble_error_t status;
267 } ble_mgr_gatts_prepare_write_cfm_rsp_t;
268 
269 void ble_mgr_gatts_prepare_write_cfm_cmd_handler(void *param);
270 
271 typedef struct {
272  ble_mgr_msg_hdr_t hdr;
273  uint16_t conn_idx;
274  uint16_t handle;
275  gatt_event_t type;
276  uint16_t length;
277  uint8_t value[0];
278 } ble_mgr_gatts_send_event_cmd_t;
279 
280 typedef struct {
281  ble_mgr_msg_hdr_t hdr;
282  ble_error_t status;
283 } ble_mgr_gatts_send_event_rsp_t;
284 
285 void ble_mgr_gatts_send_event_cmd_handler(void *param);
286 
287 typedef struct {
288  ble_mgr_msg_hdr_t hdr;
289  uint16_t conn_idx;
290  uint16_t start_handle;
291  uint16_t end_handle;
292 } ble_mgr_gatts_service_changed_ind_cmd_t;
293 
294 typedef struct {
295  ble_mgr_msg_hdr_t hdr;
296  ble_error_t status;
297 } ble_mgr_gatts_service_changed_ind_rsp_t;
298 
299 void ble_mgr_gatts_service_changed_ind_cmd_handler(void *param);
300 
305 
306 void ble_mgr_gatts_write_value_req_evt_handler(ble_gtl_msg_t *gtl);
307 
308 void ble_mgr_gatts_prepare_write_req_evt_handler(ble_gtl_msg_t *gtl);
309 
310 void ble_mgr_gatts_event_sent_evt_handler(ble_gtl_msg_t *gtl);
311 
312 #endif /* BLE_MGR_GATTS_H_ */
313 
gatt_event_t
gatt_event_t
Definition: ble_gatt.h:49
gatts_flag_t
gatts_flag_t
Definition: ble_gatts.h:48
ble_mgr_cmd.h
BLE manager command definitions.
gatt_prop_t
gatt_prop_t
Definition: ble_gatt.h:55
ble_gatts.h
BLE GATT Server API.
ble_gatt.h
Common definitions for GATT API.
ble_mgr_msg_hdr_t
Definition: ble_mgr_cmd.h:54
osal.h
OS abstraction layer API.
gatt_service_t
gatt_service_t
Definition: ble_gatt.h:43
ble_gtl_msg
Definition: ad_ble.h:212
att_perm_t
att_perm_t
Definition: ble_att.h:48
ble_mgr_gatts_read_value_req_evt_handler
void ble_mgr_gatts_read_value_req_evt_handler(ble_gtl_msg_t *gtl)
ble_att.h
Attribute protocol API.
ble_error_t
ble_error_t
Definition: ble_common.h:53