40
40
#define BLE_GATT_CL_SUPP_FEAT_BITMASK 0x07
41
41
42
42
#define GATTP_MAX_NUM_INC_SVR 0
43
+
44
+
#if GATTS_ROBUST_CACHING_ENABLED
43
45
#define GATTP_MAX_CHAR_NUM 5
46
+
#else
47
+
#define GATTP_MAX_CHAR_NUM 2
48
+
#endif /* GATTS_ROBUST_CACHING_ENABLED */
49
+
44
50
#define GATTP_MAX_ATTR_NUM (GATTP_MAX_CHAR_NUM * 2 + GATTP_MAX_NUM_INC_SVR + 1)
45
51
#define GATTP_MAX_CHAR_VALUE_SIZE 50
46
52
@@ -196,14 +202,15 @@ tGATT_STATUS gatt_proc_read (UINT16 conn_id, tGATTS_REQ_TYPE type, tGATT_READ_RE
196
202
197
203
GATT_TRACE_DEBUG("%s handle %x", __func__, p_data->handle);
198
204
199
-
UINT8 tcb_idx = GATT_GET_TCB_IDX(conn_id);
200
-
tGATT_TCB *tcb = gatt_get_tcb_by_idx(tcb_idx);
201
-
202
205
if (p_data->is_long) {
203
206
p_rsp->attr_value.offset = p_data->offset;
204
207
}
205
208
206
209
p_rsp->attr_value.handle = p_data->handle;
210
+
#if GATTS_ROBUST_CACHING_ENABLED
211
+
212
+
UINT8 tcb_idx = GATT_GET_TCB_IDX(conn_id);
213
+
tGATT_TCB *tcb = gatt_get_tcb_by_idx(tcb_idx);
207
214
208
215
/* handle request for reading client supported features */
209
216
if (p_data->handle == gatt_cb.handle_of_cl_supported_feat) {
@@ -229,7 +236,7 @@ tGATT_STATUS gatt_proc_read (UINT16 conn_id, tGATTS_REQ_TYPE type, tGATT_READ_RE
229
236
memcpy(p_rsp->attr_value.value, &gatt_cb.gatt_sr_supported_feat_mask, 1);
230
237
return GATT_SUCCESS;
231
238
}
232
-
239
+
#endif /* GATTS_ROBUST_CACHING_ENABLED */
233
240
/* handle request for reading service changed des and the others */
234
241
status = GATTS_GetAttributeValue(p_data->handle, &len, &value);
235
242
if(status == GATT_SUCCESS && len > 0 && value) {
@@ -241,7 +248,7 @@ tGATT_STATUS gatt_proc_read (UINT16 conn_id, tGATTS_REQ_TYPE type, tGATT_READ_RE
241
248
}
242
249
return status;
243
250
}
244
-
251
+
#if GATTS_ROBUST_CACHING_ENABLED
245
252
static tGATT_STATUS gatt_sr_write_cl_supp_feat(UINT16 conn_id, tGATT_WRITE_REQ *p_data)
246
253
{
247
254
UINT8 val_new;
@@ -286,7 +293,7 @@ static tGATT_STATUS gatt_sr_write_cl_supp_feat(UINT16 conn_id, tGATT_WRITE_REQ *
286
293
#endif
287
294
return GATT_SUCCESS;
288
295
}
289
-
296
+
#endif /* GATTS_ROBUST_CACHING_ENABLED */
290
297
/******************************************************************************
291
298
**
292
299
** Function gatt_proc_write_req
@@ -301,7 +308,7 @@ tGATT_STATUS gatt_proc_write_req(UINT16 conn_id, tGATTS_REQ_TYPE type, tGATT_WRI
301
308
if(p_data->len > GATT_MAX_ATTR_LEN) {
302
309
p_data->len = GATT_MAX_ATTR_LEN;
303
310
}
304
-
311
+
#if GATTS_ROBUST_CACHING_ENABLED
305
312
if (p_data->handle == gatt_cb.handle_of_h_r) {
306
313
return GATT_WRITE_NOT_PERMIT;
307
314
}
@@ -317,7 +324,7 @@ tGATT_STATUS gatt_proc_write_req(UINT16 conn_id, tGATTS_REQ_TYPE type, tGATT_WRI
317
324
if (p_data->handle == gatt_cb.handle_of_sr_supported_feat) {
318
325
return GATT_WRITE_NOT_PERMIT;
319
326
}
320
-
327
+
#endif /* GATTS_ROBUST_CACHING_ENABLED */
321
328
return GATTS_SetAttributeValue(p_data->handle,
322
329
p_data->len,
323
330
p_data->value);
@@ -470,7 +477,7 @@ void gatt_profile_db_init (void)
470
477
};
471
478
472
479
GATTS_AddCharDescriptor (service_handle, GATT_PERM_READ | GATT_PERM_WRITE , &descr_uuid, &attr_val, NULL);
473
-
480
+
#if GATTS_ROBUST_CACHING_ENABLED
474
481
/* add Client Supported Features characteristic */
475
482
uuid.uu.uuid16 = GATT_UUID_CLIENT_SUP_FEAT;
476
483
gatt_cb.handle_of_cl_supported_feat = GATTS_AddCharacteristic(service_handle, &uuid, GATT_PERM_READ | GATT_PERM_WRITE,
@@ -483,7 +490,7 @@ void gatt_profile_db_init (void)
483
490
/* add Server Supported Features characteristic */
484
491
uuid.uu.uuid16 = GATT_UUID_SERVER_SUP_FEAT;
485
492
gatt_cb.handle_of_sr_supported_feat = GATTS_AddCharacteristic(service_handle, &uuid, GATT_PERM_READ, GATT_CHAR_PROP_BIT_READ, NULL, NULL);
486
-
493
+
#endif /* GATTS_ROBUST_CACHING_ENABLED */
487
494
/* start service */
488
495
status = GATTS_StartService (gatt_cb.gatt_if, service_handle, GATTP_TRANSPORT_SUPPORTED );
489
496
@@ -689,6 +696,7 @@ void GATT_ConfigServiceChangeCCC (BD_ADDR remote_bda, BOOLEAN enable, tBT_TRANSP
689
696
gatt_cl_start_config_ccc(p_clcb);
690
697
}
691
698
699
+
#if GATTS_ROBUST_CACHING_ENABLED
692
700
/*******************************************************************************
693
701
**
694
702
** Function gatt_sr_is_cl_robust_caching_supported
@@ -700,14 +708,8 @@ void GATT_ConfigServiceChangeCCC (BD_ADDR remote_bda, BOOLEAN enable, tBT_TRANSP
700
708
*******************************************************************************/
701
709
static BOOLEAN gatt_sr_is_cl_robust_caching_supported(tGATT_TCB *p_tcb)
702
710
{
703
-
// Server robust caching not enabled
704
-
if (!GATTS_ROBUST_CACHING_ENABLED) {
705
-
return FALSE;
706
-
}
707
-
708
711
return (p_tcb->cl_supp_feat & BLE_GATT_CL_SUPP_FEAT_ROBUST_CACHING_BITMASK);
709
712
}
710
-
711
713
/*******************************************************************************
712
714
**
713
715
** Function gatt_sr_is_cl_change_aware
@@ -791,4 +793,5 @@ void gatt_sr_update_cl_status(tGATT_TCB *p_tcb, BOOLEAN chg_aware)
791
793
792
794
GATT_TRACE_DEBUG("%s status %d", __func__, chg_aware);
793
795
}
796
+
#endif /* GATTS_ROBUST_CACHING_ENABLED */
794
797
#endif /* BLE_INCLUDED == TRUE && GATTS_INCLUDED == TRUE */
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4