btif_gatt_multi_adv_util.c revision 4a7ad9be81cc2b515502f2c1fb1b7ec7e3104146
1/******************************************************************************
2 *
3 *  Copyright (C) 2014  Broadcom Corporation
4 *
5 *  Licensed under the Apache License, Version 2.0 (the "License");
6 *  you may not use this file except in compliance with the License.
7 *  You may obtain a copy of the License at:
8 *
9 *  http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 *
17 ******************************************************************************/
18
19
20/*******************************************************************************
21 *
22 *  Filename:      btif_gatt_multi_adv_util.c
23 *
24 *  Description:   Multi ADV helper implementation
25 *
26 *******************************************************************************/
27
28#include <stdio.h>
29#include <stdlib.h>
30#include "bt_target.h"
31
32#define LOG_TAG "BtGatt.btif"
33#if (BLE_INCLUDED == TRUE)
34
35#include "btif_gatt_multi_adv_util.h"
36#include "btif_common.h"
37#include <hardware/bt_gatt.h>
38#include "bta_gatt_api.h"
39#include "btif_gatt_util.h"
40
41/*******************************************************************************
42**  Static variables
43********************************************************************************/
44static int multi_adv_enable_count = 0;
45static btgatt_multi_adv_common_data *p_multi_adv_com_data_cb = NULL;
46
47btgatt_multi_adv_common_data *btif_obtain_multi_adv_data_cb()
48{
49    if(p_multi_adv_com_data_cb == NULL)
50       p_multi_adv_com_data_cb = GKI_getbuf(sizeof(btgatt_multi_adv_common_data));
51    return p_multi_adv_com_data_cb;
52}
53
54void btif_gattc_init_multi_adv_cb(void)
55{
56    int i;
57    btgatt_multi_adv_common_data *p_multi_adv_data_cb = btif_obtain_multi_adv_data_cb();
58
59    if(NULL == p_multi_adv_data_cb)
60        return;
61
62    if(multi_adv_enable_count == 0)
63    {
64        memset(p_multi_adv_data_cb,0,sizeof(btgatt_multi_adv_common_data));
65
66        for (i=0; i < BTM_BLE_MULTI_ADV_MAX; i++)
67        {
68           p_multi_adv_data_cb->clntif_map[i][CLNT_IF_IDX] = INVALID_ADV_INST;
69           p_multi_adv_data_cb->clntif_map[i][INST_ID_IDX] = INVALID_ADV_INST;
70        }
71    }
72    multi_adv_enable_count++;
73}
74
75void btif_gattc_destroy_multi_adv_cb()
76{
77    if(multi_adv_enable_count > 0)
78        multi_adv_enable_count --;
79    if(multi_adv_enable_count == 0)
80    {
81        GKI_freebuf(p_multi_adv_com_data_cb);
82        p_multi_adv_com_data_cb = NULL;
83    }
84}
85
86int btif_multi_adv_add_instid_map(int client_if, int inst_id, BOOLEAN gen_temp_instid)
87{
88    int i=0;
89
90    btgatt_multi_adv_common_data *p_multi_adv_data_cb = btif_obtain_multi_adv_data_cb();
91
92    if(NULL == p_multi_adv_data_cb)
93        return INVALID_ADV_INST;
94
95    for(i=0; i < BTM_BLE_MULTI_ADV_MAX; i++)
96    {
97       if(client_if == p_multi_adv_data_cb->clntif_map[i][CLNT_IF_IDX])
98       {
99          if(!gen_temp_instid)
100          {
101             // Write the final inst_id value obtained from stack layer
102             p_multi_adv_data_cb->clntif_map[i][INST_ID_IDX] = inst_id;
103             BTIF_TRACE_DEBUG("%s -Index: %d, Found client_if: %d", __FUNCTION__,
104                i, p_multi_adv_data_cb->clntif_map[i][CLNT_IF_IDX]);
105             break;
106          }
107          else
108          {
109              //Store the passed in inst_id value
110             if(inst_id != INVALID_ADV_INST)
111                 p_multi_adv_data_cb->clntif_map[i][INST_ID_IDX] = inst_id;
112             else
113                 p_multi_adv_data_cb->clntif_map[i][INST_ID_IDX] = (i + 1);
114             BTIF_TRACE_DEBUG("%s - Index:%d,Found client_if: %d", __FUNCTION__,
115                i, p_multi_adv_data_cb->clntif_map[i][CLNT_IF_IDX]);
116             break;
117          }
118       }
119    }
120
121    if(i < BTM_BLE_MULTI_ADV_MAX)
122        return i;
123
124    // If client ID if is not found, then write both values
125    for(i=0; i < BTM_BLE_MULTI_ADV_MAX; i++)
126    {
127        if(INVALID_ADV_INST == p_multi_adv_data_cb->clntif_map[i][CLNT_IF_IDX])
128        {
129             p_multi_adv_data_cb->clntif_map[i][CLNT_IF_IDX] = client_if;
130             if(inst_id != INVALID_ADV_INST)
131                p_multi_adv_data_cb->clntif_map[i][INST_ID_IDX] = inst_id;
132             else
133                p_multi_adv_data_cb->clntif_map[i][INST_ID_IDX] = (i + 1);
134             BTIF_TRACE_DEBUG("%s -Not found - Index:%d, client_if: %d, Inst ID: %d",
135                            __FUNCTION__,i,
136                            p_multi_adv_data_cb->clntif_map[i][CLNT_IF_IDX],
137                            p_multi_adv_data_cb->clntif_map[i][INST_ID_IDX]);
138             break;
139        }
140    }
141
142    if(i < BTM_BLE_MULTI_ADV_MAX)
143        return i;
144    return INVALID_ADV_INST;
145}
146
147int btif_multi_adv_instid_for_clientif(int client_if)
148{
149    int i=0, ret = INVALID_ADV_INST;
150
151    btgatt_multi_adv_common_data *p_multi_adv_data_cb = btif_obtain_multi_adv_data_cb();
152
153    if(NULL == p_multi_adv_data_cb)
154        return INVALID_ADV_INST;
155
156    // Retrieve the existing inst_id for the client_if value
157    for(i=0; i < BTM_BLE_MULTI_ADV_MAX; i++)
158    {
159       if(client_if == p_multi_adv_data_cb->clntif_map[i][CLNT_IF_IDX])
160          ret = p_multi_adv_data_cb->clntif_map[i][INST_ID_IDX];
161    }
162
163    if(ret != INVALID_ADV_INST)
164        return ret;
165
166    return INVALID_ADV_INST;
167}
168
169
170int btif_gattc_obtain_idx_for_datacb(int value, int arrindex)
171{
172    int i=0;
173
174    btgatt_multi_adv_common_data *p_multi_adv_data_cb = btif_obtain_multi_adv_data_cb();
175
176    if(NULL == p_multi_adv_data_cb)
177        return INVALID_ADV_INST;
178
179    // Retrieve the array index for the inst_id value
180    for(i=0; i < BTM_BLE_MULTI_ADV_MAX; i++)
181    {
182       if(value == p_multi_adv_data_cb->clntif_map[i][arrindex])
183           break;
184    }
185
186    if(i < BTM_BLE_MULTI_ADV_MAX)
187    {
188        BTIF_TRACE_DEBUG("%s, %d",__FUNCTION__,i+1);
189        return (i + 1);
190    }
191
192    BTIF_TRACE_DEBUG("%s Invalid instance",__FUNCTION__);
193    return INVALID_ADV_INST;
194}
195
196
197void btif_gattc_adv_data_packager(int client_if, bool set_scan_rsp,
198                bool include_name, bool include_txpower, int min_interval, int max_interval,
199                int appearance, uint16_t manufacturer_len, char* manufacturer_data,
200                uint16_t service_data_len, char* service_data, uint16_t service_uuid_len,
201                char* service_uuid, btif_adv_data_t *p_multi_adv_inst)
202{
203    memset(p_multi_adv_inst, 0 , sizeof(btif_adv_data_t));
204
205    p_multi_adv_inst->client_if = (uint8_t) client_if;
206    p_multi_adv_inst->set_scan_rsp = set_scan_rsp;
207    p_multi_adv_inst->include_name = include_name;
208    p_multi_adv_inst->include_txpower = include_txpower;
209    p_multi_adv_inst->min_interval = min_interval;
210    p_multi_adv_inst->max_interval = max_interval;
211    p_multi_adv_inst->appearance = appearance;
212    p_multi_adv_inst->manufacturer_len = manufacturer_len;
213
214    if(manufacturer_len > 0)
215    {
216        p_multi_adv_inst->p_manufacturer_data = GKI_getbuf(manufacturer_len);
217        memcpy(p_multi_adv_inst->p_manufacturer_data, manufacturer_data, manufacturer_len);
218    }
219
220    p_multi_adv_inst->service_data_len = service_data_len;
221    if(service_data_len > 0)
222    {
223        p_multi_adv_inst->p_service_data = GKI_getbuf(service_data_len);
224        memcpy(p_multi_adv_inst->p_service_data, service_data, service_data_len);
225    }
226
227    p_multi_adv_inst->service_uuid_len = service_uuid_len;
228    if(service_uuid_len > 0)
229    {
230        p_multi_adv_inst->p_service_uuid = GKI_getbuf(service_uuid_len);
231        memcpy(p_multi_adv_inst->p_service_uuid, service_uuid, service_uuid_len);
232    }
233}
234
235BOOLEAN btif_gattc_copy_datacb(int cbindex, btif_adv_data_t *p_adv_data, BOOLEAN bInstData)
236{
237    int i=0;
238    btgatt_multi_adv_common_data *p_multi_adv_data_cb = btif_obtain_multi_adv_data_cb();
239    if(NULL == p_multi_adv_data_cb || cbindex < 0)
240       return false;
241
242    BTIF_TRACE_DEBUG("%s", __FUNCTION__);
243    memset(&p_multi_adv_data_cb->inst_cb[cbindex].data, 0, sizeof(tBTA_BLE_ADV_DATA));
244
245    if (!p_adv_data->set_scan_rsp)
246    {
247         p_multi_adv_data_cb->inst_cb[cbindex].is_scan_rsp = p_adv_data->set_scan_rsp ? 1 : 0;
248         p_multi_adv_data_cb->inst_cb[cbindex].mask = BTM_BLE_AD_BIT_FLAGS;
249         p_multi_adv_data_cb->inst_cb[cbindex].data.flag = ADV_FLAGS;
250    }
251
252    if (p_adv_data->include_name)
253        p_multi_adv_data_cb->inst_cb[cbindex].mask |= BTM_BLE_AD_BIT_DEV_NAME;
254
255    if (p_adv_data->include_txpower)
256        p_multi_adv_data_cb->inst_cb[cbindex].mask |= BTM_BLE_AD_BIT_TX_PWR;
257
258    if (false == bInstData && p_adv_data->min_interval > 0 && p_adv_data->max_interval > 0 &&
259        p_adv_data->max_interval > p_adv_data->min_interval)
260    {
261        p_multi_adv_data_cb->inst_cb[cbindex].mask |= BTM_BLE_AD_BIT_INT_RANGE;
262        p_multi_adv_data_cb->inst_cb[cbindex].data.int_range.low =
263                                        p_adv_data->min_interval;
264        p_multi_adv_data_cb->inst_cb[cbindex].data.int_range.hi =
265                                        p_adv_data->max_interval;
266    }
267    else
268    if(true == bInstData)
269    {
270        if (p_multi_adv_data_cb->inst_cb[cbindex].param.adv_int_min > 0 &&
271            p_multi_adv_data_cb->inst_cb[cbindex].param.adv_int_max > 0 &&
272            p_multi_adv_data_cb->inst_cb[cbindex].param.adv_int_max >
273            p_multi_adv_data_cb->inst_cb[cbindex].param.adv_int_min)
274        {
275              p_multi_adv_data_cb->inst_cb[cbindex].data.int_range.low =
276              p_multi_adv_data_cb->inst_cb[cbindex].param.adv_int_min;
277              p_multi_adv_data_cb->inst_cb[cbindex].data.int_range.hi =
278              p_multi_adv_data_cb->inst_cb[cbindex].param.adv_int_max;
279        }
280
281        if (p_adv_data->include_txpower)
282        {
283            p_multi_adv_data_cb->inst_cb[cbindex].data.tx_power =
284                p_multi_adv_data_cb->inst_cb[cbindex].param.tx_power;
285        }
286    }
287
288    if (p_adv_data->appearance != 0)
289    {
290        p_multi_adv_data_cb->inst_cb[cbindex].mask |= BTM_BLE_AD_BIT_APPEARANCE;
291        p_multi_adv_data_cb->inst_cb[cbindex].data.appearance = p_adv_data->appearance;
292    }
293
294    if (p_adv_data->manufacturer_len > 0 && p_adv_data->p_manufacturer_data != NULL)
295    {
296         p_multi_adv_data_cb->inst_cb[cbindex].data.p_manu =
297                            GKI_getbuf(sizeof(tBTA_BLE_MANU));
298         if(p_multi_adv_data_cb->inst_cb[cbindex].data.p_manu != NULL)
299         {
300            p_multi_adv_data_cb->inst_cb[cbindex].data.p_manu->p_val =
301                            GKI_getbuf(p_adv_data->manufacturer_len);
302            if (p_multi_adv_data_cb->inst_cb[cbindex].data.p_manu->p_val != NULL)
303            {
304                 p_multi_adv_data_cb->inst_cb[cbindex].mask |= BTM_BLE_AD_BIT_MANU;
305                 p_multi_adv_data_cb->inst_cb[cbindex].data.p_manu->len =
306                                p_adv_data->manufacturer_len;
307                 memcpy(p_multi_adv_data_cb->inst_cb[cbindex].data.p_manu->p_val,
308                    p_adv_data->p_manufacturer_data, p_adv_data->manufacturer_len);
309            }
310         }
311     }
312
313     tBTA_BLE_PROP_ELEM *p_elem_service_data = NULL;
314     tBTA_BLE_PROP_ELEM *p_elem_service_128 = NULL;
315
316     if (p_adv_data->service_data_len > 0 && p_adv_data->p_service_data != NULL)
317     {
318         BTIF_TRACE_DEBUG("%s - In service_data", __FUNCTION__);
319         p_elem_service_data = GKI_getbuf(sizeof(tBTA_BLE_PROP_ELEM));
320         if (p_elem_service_data != NULL)
321         {
322             p_elem_service_data->p_val = GKI_getbuf(p_adv_data->service_data_len);
323             if (p_elem_service_data->p_val != NULL)
324             {
325                 p_elem_service_data->adv_type = BTM_BLE_AD_TYPE_SERVICE_DATA;
326                 p_elem_service_data->len = p_adv_data->service_data_len;
327                 memcpy(p_elem_service_data->p_val, p_adv_data->p_service_data,
328                             p_adv_data->service_data_len);
329             } else {
330                     GKI_freebuf(p_elem_service_data);
331                     p_elem_service_data = NULL;
332               }
333             }
334         }
335
336         if (p_adv_data->service_uuid_len > 0 && p_adv_data->p_service_uuid != NULL)
337         {
338             p_multi_adv_data_cb->inst_cb[cbindex].data.p_services =
339                                            GKI_getbuf(sizeof(tBTA_BLE_SERVICE));
340             p_multi_adv_data_cb->inst_cb[cbindex].data.p_services->list_cmpl = FALSE;
341             p_multi_adv_data_cb->inst_cb[cbindex].data.p_services->num_service = 0;
342             p_multi_adv_data_cb->inst_cb[cbindex].data.p_services->p_uuid =
343                 GKI_getbuf(p_adv_data->service_uuid_len / LEN_UUID_128 * LEN_UUID_16);
344             if (p_multi_adv_data_cb->inst_cb[cbindex].data.p_services->p_uuid != NULL)
345             {
346                 UINT16 *p_uuid_out = p_multi_adv_data_cb->inst_cb[cbindex].data.p_services->p_uuid;
347                 while (p_adv_data->service_uuid_len >= LEN_UUID_128)
348                 {
349                     bt_uuid_t uuid;
350                     memset(&uuid, 0, sizeof(bt_uuid_t));
351                     memcpy(&uuid.uu, p_adv_data->p_service_uuid, LEN_UUID_128);
352                     tBT_UUID bt_uuid;
353                     memset(&bt_uuid, 0, sizeof(tBT_UUID));
354                     btif_to_bta_uuid(&bt_uuid, &uuid);
355
356                     if (bt_uuid.len == LEN_UUID_16)
357                     {
358                         p_multi_adv_data_cb->inst_cb[cbindex].mask |= BTM_BLE_AD_BIT_SERVICE;
359                         ++p_multi_adv_data_cb->inst_cb[cbindex].data.p_services->num_service;
360                         *p_uuid_out++ = bt_uuid.uu.uuid16;
361                     } else if (bt_uuid.len == LEN_UUID_128 && p_elem_service_128 == NULL) {
362                         /* Currently, only one 128-bit UUID is supported */
363                         p_elem_service_128 = GKI_getbuf(sizeof(tBTA_BLE_PROP_ELEM));
364                         if (p_elem_service_128 != NULL)
365                         {
366                             p_elem_service_128->p_val = GKI_getbuf(LEN_UUID_128);
367                             if (p_elem_service_128->p_val != NULL)
368                             {
369                                 p_elem_service_128->adv_type = BTM_BLE_AD_TYPE_128SRV_PART;
370                                 p_elem_service_128->len = LEN_UUID_128;
371                                 memcpy(p_elem_service_128->p_val, bt_uuid.uu.uuid128, LEN_UUID_128);
372                             } else {
373                                 GKI_freebuf(p_elem_service_128);
374                                 p_elem_service_128 = NULL;
375                             }
376                         }
377                     }
378                     p_adv_data->p_service_uuid += LEN_UUID_128;
379                     p_adv_data->service_uuid_len -= LEN_UUID_128;
380                 }
381             }
382         }
383
384         if (p_elem_service_data != NULL || p_elem_service_128 != NULL)
385         {
386             p_multi_adv_data_cb->inst_cb[cbindex].data.p_proprietary =
387                                                GKI_getbuf(sizeof(tBTA_BLE_PROPRIETARY));
388             if (p_multi_adv_data_cb->inst_cb[cbindex].data.p_proprietary != NULL)
389             {
390                 tBTA_BLE_PROPRIETARY *p_prop = p_multi_adv_data_cb->inst_cb[cbindex].
391                            data.p_proprietary;
392                 tBTA_BLE_PROP_ELEM *p_elem = NULL;
393                 p_prop->num_elem = 0;
394                 p_multi_adv_data_cb->inst_cb[cbindex].mask |= BTM_BLE_AD_BIT_PROPRIETARY;
395                 if (p_elem_service_128 != NULL)
396                     ++p_prop->num_elem;
397                 if (p_elem_service_data != NULL)
398                     ++p_prop->num_elem;
399                 p_prop->p_elem = GKI_getbuf(sizeof(tBTA_BLE_PROP_ELEM) * p_prop->num_elem);
400                 p_elem = p_prop->p_elem;
401                 if (p_elem_service_128 != NULL)
402                 {
403                     memcpy(p_elem++, p_elem_service_128, sizeof(tBTA_BLE_PROP_ELEM));
404                     GKI_freebuf(p_elem_service_128);
405                 }
406                 if (p_elem_service_data != NULL)
407                 {
408                     memcpy(p_elem++, p_elem_service_data, sizeof(tBTA_BLE_PROP_ELEM));
409                     GKI_freebuf(p_elem_service_data);
410                 }
411             }
412         }
413
414#if (defined(BLE_PERIPHERAL_ADV_NAME) && (BLE_PERIPHERAL_ADV_NAME == TRUE))
415     p_multi_adv_data_cb->inst_cb[cbindex].mask |= BTM_BLE_AD_BIT_DEV_NAME;
416#endif
417     return true;
418}
419
420void btif_gattc_clear_clientif(int client_if)
421{
422    int i=0;
423
424    btgatt_multi_adv_common_data *p_multi_adv_data_cb = btif_obtain_multi_adv_data_cb();
425
426    if(NULL == p_multi_adv_data_cb)
427        return;
428
429    // Clear both the inst_id and client_if values
430    for(i=0; i < BTM_BLE_MULTI_ADV_MAX; i++)
431    {
432       if(client_if == p_multi_adv_data_cb->clntif_map[i][CLNT_IF_IDX])
433       {
434          p_multi_adv_data_cb->clntif_map[i][INST_ID_IDX] = INVALID_ADV_INST;
435          p_multi_adv_data_cb->clntif_map[i][CLNT_IF_IDX] = INVALID_ADV_INST;
436          BTIF_TRACE_DEBUG("Cleaning up index %d for clnt_if :%d,", i, client_if);
437          break;
438       }
439    }
440}
441
442void btif_gattc_cleanup_inst_cb(int inst_id)
443{
444    int cbindex = 0;
445    // Check for invalid instance id
446    if (inst_id < 0 || inst_id > BTM_BLE_MULTI_ADV_MAX)
447        return;
448
449    btgatt_multi_adv_common_data *p_multi_adv_data_cb = btif_obtain_multi_adv_data_cb();
450
451    if(NULL == p_multi_adv_data_cb)
452        return;
453
454    if(inst_id > 0)
455    {
456        cbindex = btif_gattc_obtain_idx_for_datacb(inst_id, INST_ID_IDX);
457        if (cbindex < 0)
458            return;
459    }
460    else
461    if(STD_ADV_INSTID == inst_id)
462      cbindex = STD_ADV_INSTID;
463
464    BTIF_TRACE_DEBUG("Cleaning up multi_inst_cb for inst_id %d, cbindex %d", inst_id, cbindex);
465    btif_gattc_cleanup_multi_inst_cb(&p_multi_adv_data_cb->inst_cb[cbindex]);
466}
467
468void btif_gattc_cleanup_multi_inst_cb(btgatt_multi_adv_inst_cb *p_multi_inst_cb)
469{
470    // Manufacturer data cleanup
471    if (p_multi_inst_cb->data.p_manu != NULL)
472    {
473        if (p_multi_inst_cb->data.p_manu->p_val != NULL)
474           GKI_freebuf(p_multi_inst_cb->data.p_manu->p_val);
475        GKI_freebuf(p_multi_inst_cb->data.p_manu);
476    }
477
478    // Proprietary data cleanup
479    if (p_multi_inst_cb->data.p_proprietary != NULL)
480    {
481        int i = 0;
482        tBTA_BLE_PROP_ELEM *p_elem = p_multi_inst_cb->data.p_proprietary->p_elem;
483        while (i++ != p_multi_inst_cb->data.p_proprietary->num_elem
484            && p_elem)
485        {
486            if (p_elem->p_val != NULL)
487                GKI_freebuf(p_elem->p_val);
488            ++p_elem;
489        }
490
491        if (p_multi_inst_cb->data.p_proprietary->p_elem != NULL)
492            GKI_freebuf(p_multi_inst_cb->data.p_proprietary->p_elem);
493        GKI_freebuf(p_multi_inst_cb->data.p_proprietary);
494    }
495
496    // Service list cleanup
497    if (p_multi_inst_cb->data.p_services != NULL)
498    {
499        if (p_multi_inst_cb->data.p_services->p_uuid != NULL)
500           GKI_freebuf(p_multi_inst_cb->data.p_services->p_uuid);
501        GKI_freebuf(p_multi_inst_cb->data.p_services);
502    }
503
504    // Service data cleanup
505    if (p_multi_inst_cb->data.p_service_data != NULL)
506    {
507        if (p_multi_inst_cb->data.p_service_data->p_val != NULL)
508           GKI_freebuf(p_multi_inst_cb->data.p_service_data->p_val);
509        GKI_freebuf(p_multi_inst_cb->data.p_service_data);
510    }
511
512    if (p_multi_inst_cb->data.p_services_128b != NULL)
513        GKI_freebuf(p_multi_inst_cb->data.p_services_128b);
514
515    if (p_multi_inst_cb->data.p_service_32b != NULL)
516    {
517        if (p_multi_inst_cb->data.p_service_32b->p_uuid != NULL)
518           GKI_freebuf(p_multi_inst_cb->data.p_service_32b->p_uuid);
519        GKI_freebuf(p_multi_inst_cb->data.p_service_32b);
520    }
521
522    if (p_multi_inst_cb->data.p_sol_services != NULL)
523    {
524        if (p_multi_inst_cb->data.p_sol_services->p_uuid != NULL)
525           GKI_freebuf(p_multi_inst_cb->data.p_sol_services->p_uuid);
526        GKI_freebuf(p_multi_inst_cb->data.p_sol_services);
527    }
528
529    if (p_multi_inst_cb->data.p_sol_service_32b != NULL)
530    {
531        if (p_multi_inst_cb->data.p_sol_service_32b->p_uuid != NULL)
532           GKI_freebuf(p_multi_inst_cb->data.p_sol_service_32b->p_uuid);
533        GKI_freebuf(p_multi_inst_cb->data.p_sol_service_32b);
534    }
535
536    if(p_multi_inst_cb->data.p_sol_service_128b != NULL)
537        GKI_freebuf(p_multi_inst_cb->data.p_sol_service_128b);
538}
539
540#endif
541