1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
24
25
26
27
28
29
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
137
/* ... */
/* ... */
#include "common/bt_target.h"
#if defined(GATTC_INCLUDED) && (GATTC_INCLUDED == TRUE)
#include <string.h>
#include "bta/bta_api.h"
#include "bta/bta_sys.h"
#include "bta/bta_gattc_ci.h"
#include "bta/utl.h"
#include "osi/allocator.h"6 includes
/* ... */
void bta_gattc_ci_cache_open(BD_ADDR server_bda, UINT16 evt, tBTA_GATT_STATUS status,
UINT16 conn_id)
{
tBTA_GATTC_CI_EVT *p_evt;
UNUSED(server_bda);
if ((p_evt = (tBTA_GATTC_CI_EVT *) osi_malloc(sizeof(tBTA_GATTC_CI_EVT))) != NULL) {
p_evt->hdr.event = evt;
p_evt->hdr.layer_specific = conn_id;
p_evt->status = status;
bta_sys_sendmsg(p_evt);
}{...}
}{ ... }
/* ... */
void bta_gattc_ci_cache_load(BD_ADDR server_bda, UINT16 evt, UINT16 num_attr,
tBTA_GATTC_NV_ATTR *p_attr, tBTA_GATT_STATUS status,
UINT16 conn_id)
{
tBTA_GATTC_CI_LOAD *p_evt;
UNUSED(server_bda);
if ((p_evt = (tBTA_GATTC_CI_LOAD *) osi_malloc(sizeof(tBTA_GATTC_CI_LOAD))) != NULL) {
memset(p_evt, 0, sizeof(tBTA_GATTC_CI_LOAD));
p_evt->hdr.event = evt;
p_evt->hdr.layer_specific = conn_id;
p_evt->status = status;
p_evt->num_attr = (num_attr > BTA_GATTC_NV_LOAD_MAX) ? BTA_GATTC_NV_LOAD_MAX : num_attr;
if (p_evt->num_attr > 0 && p_attr != NULL) {
memcpy(p_evt->attr, p_attr, p_evt->num_attr * sizeof(tBTA_GATTC_NV_ATTR));
}{...}
bta_sys_sendmsg(p_evt);
}{...}
}{ ... }
/* ... */
void bta_gattc_ci_cache_save(BD_ADDR server_bda, UINT16 evt, tBTA_GATT_STATUS status,
UINT16 conn_id)
{
tBTA_GATTC_CI_EVT *p_evt;
UNUSED(server_bda);
if ((p_evt = (tBTA_GATTC_CI_EVT *) osi_malloc(sizeof(tBTA_GATTC_CI_EVT))) != NULL) {
p_evt->hdr.event = evt;
p_evt->hdr.layer_specific = conn_id;
p_evt->status = status;
bta_sys_sendmsg(p_evt);
}{...}
}{ ... }
#endif/* ... */