Debug message cleanup
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-request-sender.c
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *              http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <glib.h>
19 #include <dlog.h>
20 #include <string.h>
21
22 #include "bluetooth-api.h"
23 #include "bluetooth-hid-api.h"
24 #include "bluetooth-audio-api.h"
25 #include "bt-internal-types.h"
26 #include "bluetooth-ipsp-api.h"
27
28 #include "bt-common.h"
29 #include "bt-request-sender.h"
30 #include "bt-event-handler.h"
31 #include "bluetooth-media-control.h"
32
33 static GSList *sending_requests;
34
35 static GDBusProxy *service_gproxy;
36
37 static GDBusProxy *__bt_gdbus_init_service_proxy(void)
38 {
39         GDBusConnection *service_gconn;
40         GDBusProxy *proxy;
41         GError *err = NULL;
42
43         service_gconn = _bt_gdbus_get_system_gconn();
44
45         if (!service_gconn)
46                 return NULL;
47
48         proxy =  g_dbus_proxy_new_sync(service_gconn,
49                         G_DBUS_PROXY_FLAGS_NONE, NULL,
50                         BT_DBUS_NAME,
51                         BT_SERVICE_PATH,
52                         BT_DBUS_NAME,
53                         NULL, &err);
54         if (!proxy) {
55                 if (err) {
56                          BT_ERR("Unable to create proxy: %s", err->message);
57                          g_clear_error(&err);
58                 }
59
60                 return NULL;
61         }
62
63         service_gproxy = proxy;
64
65         return proxy;
66 }
67
68 static GDBusProxy *__bt_gdbus_get_service_proxy(void)
69 {
70         return (service_gproxy) ? service_gproxy : __bt_gdbus_init_service_proxy();
71 }
72
73 void _bt_gdbus_deinit_proxys(void)
74 {
75         if (service_gproxy) {
76                 g_object_unref(service_gproxy);
77                 service_gproxy = NULL;
78         }
79 }
80
81 static void __bt_get_event_info(int service_function, GArray *output,
82                         int *event, int *event_type, void **param_data)
83 {
84         ret_if(event == NULL);
85
86         BT_DBG("service_function : %s (0x%x)",
87                 _bt_convert_service_function_to_string(service_function),
88                 service_function);
89         switch (service_function) {
90         case BT_BOND_DEVICE:
91         case BT_BOND_DEVICE_BY_TYPE:
92                 *event_type = BT_ADAPTER_EVENT;
93                 *event = BLUETOOTH_EVENT_BONDING_FINISHED;
94                 ret_if(output == NULL);
95                 *param_data = &g_array_index(output,
96                                 bluetooth_device_info_t, 0);
97                 break;
98         case BT_UNBOND_DEVICE:
99                 *event_type = BT_ADAPTER_EVENT;
100                 *event = BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED;
101                 ret_if(output == NULL);
102                 *param_data = &g_array_index(output,
103                                 bluetooth_device_info_t, 0);
104                 break;
105         case BT_SEARCH_SERVICE:
106                 *event_type = BT_ADAPTER_EVENT;
107                 *event = BLUETOOTH_EVENT_SERVICE_SEARCHED;
108                 ret_if(output == NULL);
109                 *param_data = &g_array_index(output,
110                                 bluetooth_device_info_t, 0);
111                 break;
112         case BT_HID_CONNECT:
113                 *event_type = BT_HID_EVENT;
114                 *event = BLUETOOTH_HID_CONNECTED;
115                 ret_if(output == NULL);
116                 *param_data = &g_array_index(output,
117                                 bluetooth_device_address_t, 0);
118                 break;
119         case BT_HID_DISCONNECT:
120                 *event_type = BT_HID_EVENT;
121                 *event = BLUETOOTH_HID_DISCONNECTED;
122                 ret_if(output == NULL);
123                 *param_data = &g_array_index(output,
124                                 bluetooth_device_address_t, 0);
125                 break;
126         case BT_AUDIO_CONNECT:
127         case BT_AG_CONNECT:
128                 *event_type = BT_HEADSET_EVENT;
129                 *event = BLUETOOTH_EVENT_AG_CONNECTED;
130                 ret_if(output == NULL);
131                 *param_data = &g_array_index(output, char, 0);
132                 break;
133         case BT_AUDIO_DISCONNECT:
134         case BT_AG_DISCONNECT:
135                 *event_type = BT_HEADSET_EVENT;
136                 *event = BLUETOOTH_EVENT_AG_DISCONNECTED;
137                 ret_if(output == NULL);
138                 *param_data = &g_array_index(output, char, 0);
139                 break;
140         case BT_AV_CONNECT:
141                 *event_type = BT_HEADSET_EVENT;
142                 *event = BLUETOOTH_EVENT_AV_CONNECTED;
143                 ret_if(output == NULL);
144                 *param_data = &g_array_index(output, char, 0);
145                 break;
146         case BT_AV_DISCONNECT:
147                 *event_type = BT_HEADSET_EVENT;
148                 *event = BLUETOOTH_EVENT_AV_DISCONNECTED;
149                 ret_if(output == NULL);
150                 *param_data = &g_array_index(output, char, 0);
151                 break;
152         case BT_AV_SOURCE_CONNECT:
153                 *event_type = BT_A2DP_SOURCE_EVENT;
154                 *event = BLUETOOTH_EVENT_AV_SOURCE_CONNECTED;
155                 ret_if(output == NULL);
156                 *param_data = &g_array_index(output, char, 0);
157                 break;
158         case BT_AV_SOURCE_DISCONNECT:
159                 *event_type = BT_A2DP_SOURCE_EVENT;
160                 *event = BLUETOOTH_EVENT_AV_SOURCE_DISCONNECTED;
161                 ret_if(output == NULL);
162                 *param_data = &g_array_index(output, char, 0);
163                 break;
164         case BT_HF_CONNECT:
165                 *event_type = BT_HF_AGENT_EVENT;
166                 *event = BLUETOOTH_EVENT_HF_CONNECTED;
167                 ret_if(output == NULL);
168                 *param_data = &g_array_index(output, char, 0);
169                 break;
170         case BT_HF_DISCONNECT:
171                 *event_type = BT_HF_AGENT_EVENT;
172                 *event = BLUETOOTH_EVENT_HF_DISCONNECTED;
173                 ret_if(output == NULL);
174                 *param_data = &g_array_index(output, char, 0);
175                 break;
176         case BT_NETWORK_CONNECT:
177                 *event_type = BT_ADAPTER_EVENT;
178                 *event = BLUETOOTH_EVENT_NETWORK_CONNECTED;
179                 ret_if(output == NULL);
180                 *param_data = &g_array_index(output,
181                                 bluetooth_device_address_t, 0);
182                 break;
183         case BT_NETWORK_DISCONNECT:
184                 *event_type = BT_ADAPTER_EVENT;
185                 *event = BLUETOOTH_EVENT_NETWORK_DISCONNECTED;
186                 ret_if(output == NULL);
187                 *param_data = &g_array_index(output,
188                                 bluetooth_device_address_t, 0);
189                 break;
190         case BT_RFCOMM_CLIENT_CONNECT:
191                 *event_type = BT_RFCOMM_CLIENT_EVENT;
192                 *event = BLUETOOTH_EVENT_RFCOMM_CONNECTED;
193                 ret_if(output == NULL);
194                 *param_data = &g_array_index(output,
195                                 bluetooth_rfcomm_connection_t, 0);
196                 break;
197         case BT_AVRCP_CONTROL_CONNECT:
198                 *event_type = BT_AVRCP_CONTROL_EVENT;
199                 *event = BLUETOOTH_EVENT_AVRCP_CONTROL_CONNECTED;
200                 ret_if(output == NULL);
201                 *param_data = &g_array_index(output, char, 0);
202                 break;
203         case BT_AVRCP_CONTROL_DISCONNECT:
204                 *event_type = BT_AVRCP_CONTROL_EVENT;
205                 *event = BLUETOOTH_EVENT_AVRCP_CONTROL_DISCONNECTED;
206                 ret_if(output == NULL);
207                 *param_data = &g_array_index(output, char, 0);
208                 break;
209         case BT_REQ_ATT_MTU:
210                 *event_type = BT_DEVICE_EVENT;
211                 *event = BLUETOOTH_EVENT_GATT_ATT_MTU_CHANGED;
212                 ret_if(output == NULL);
213                 *param_data = &g_array_index(output,
214                                 bluetooth_device_address_t, 0);
215                 break;
216         case BT_CONNECT_LE:
217                 *event_type = BT_DEVICE_EVENT;
218                 *event = BLUETOOTH_EVENT_GATT_CONNECTED;
219                 ret_if(output == NULL);
220                 *param_data = &g_array_index(output,
221                                 bluetooth_device_address_t, 0);
222                 break;
223         case BT_DISCONNECT_LE:
224                 *event_type = BT_DEVICE_EVENT;
225                 *event = BLUETOOTH_EVENT_GATT_DISCONNECTED;
226                 ret_if(output == NULL);
227                 *param_data = &g_array_index(output,
228                                 bluetooth_device_address_t, 0);
229                 break;
230         case BT_TDS_READ_TRANSPORT_DATA:
231                 *event_type = BT_TDS_EVENT;
232                 *event = BLUETOOTH_EVENT_TDS_TRANSPORT_DATA_RECEIVED;
233                 ret_if(output == NULL);
234                 *param_data = &g_array_index(output,
235                         bluetooth_device_address_t, 0);
236                 break;
237         case BT_TDS_ENABLE_CONTROL_POINT:
238                 *event_type = BT_TDS_EVENT;
239                 *event = BLUETOOTH_EVENT_TDS_CONTROL_POINT_ENABLED;
240                 ret_if(output == NULL);
241                 *param_data = &g_array_index(output,
242                         bluetooth_device_address_t, 0);
243                 break;
244         case BT_TDS_ACTIVATE_CONTROL_POINT:
245                 *event_type = BT_TDS_EVENT;
246                 *event = BLUETOOTH_EVENT_TDS_ACTIVATION_INDICATION;
247                 ret_if(output == NULL);
248                 *param_data = &g_array_index(output,
249                         bluetooth_device_address_t, 0);
250                 break;
251         default:
252                 BT_ERR("Unknown function");
253                 return;
254         }
255 }
256
257 /*
258 out param1: API result
259 out param2: return paramter
260 out param3:
261 */
262 static void __bt_fill_garray_from_variant(GVariant *var, GArray *param)
263 {
264         char *data;
265         int size;
266
267         size = g_variant_get_size(var);
268         if (size > 0) {
269                 data = (char *)g_variant_get_data(var);
270                 if (data)
271                         param = g_array_append_vals(param, data, size);
272
273         }
274 }
275
276 static void __send_request_cb(GDBusProxy *proxy,
277                                 GAsyncResult *res,
278                                 gpointer user_data)
279 {
280         bluetooth_event_param_t bt_event;
281         bt_req_info_t *cb_data = user_data;
282         int result = BLUETOOTH_ERROR_NONE;
283         int event_type = BT_ADAPTER_EVENT;
284         int request_id;
285         GError *error = NULL;
286         GVariant *value;
287         GVariant *param1;
288 //      GVariant *param2;
289         GArray *out_param1 = NULL;
290 //      GArray *out_param2 = NULL;
291
292         BT_DBG("+");
293         memset(&bt_event, 0x00, sizeof(bluetooth_event_param_t));
294
295         value = g_dbus_proxy_call_finish(proxy, res, &error);
296         if (value == NULL) {
297                 if (error) {
298                         /* dBUS gives error cause */
299                         BT_ERR("D-Bus API failure: message[%s]",
300                                                         error->message);
301                         g_clear_error(&error);
302                 }
303                 result = BLUETOOTH_ERROR_TIMEOUT;
304
305                 ret_if(cb_data == NULL);
306
307                 __bt_get_event_info(cb_data->service_function, NULL,
308                                 &bt_event.event, &event_type,
309                                 &bt_event.param_data);
310         } else {
311                 g_variant_get(value, "(iv)", &result, &param1);
312                 g_variant_unref(value);
313
314                 if (param1) {
315                         out_param1 = g_array_new(TRUE, TRUE, sizeof(gchar));
316                         __bt_fill_garray_from_variant(param1, out_param1);
317                         g_variant_unref(param1);
318                 }
319
320 //              if (param2) {
321 //                      out_param2 = g_array_new(TRUE, TRUE, sizeof(gchar));
322 //                      __bt_fill_garray_from_variant(param2, out_param2);
323 //                      result = g_array_index(out_param2, int, 0);
324 //                      g_variant_unref(param2);
325 //                      g_array_free(out_param2, TRUE);
326 //              } else {
327 //                      result = BLUETOOTH_ERROR_INTERNAL;
328 //              }
329
330                 ret_if(cb_data == NULL);
331
332                 __bt_get_event_info(cb_data->service_function, out_param1,
333                                 &bt_event.event, &event_type,
334                                 &bt_event.param_data);
335
336                 BT_DBG("service_function [%d]", cb_data->service_function);
337                 if (result == BLUETOOTH_ERROR_NONE && out_param1) {
338                         if (cb_data->service_function == BT_OPP_PUSH_FILES) {
339                                 request_id = g_array_index(out_param1, int, 0);
340                                 BT_DBG("request_id : %d", request_id);
341                                 _bt_add_push_request_id(request_id);
342                         } else if (cb_data->service_function == BT_MAP_LIST_FOLDERS) {
343                                 request_id = g_array_index(out_param1, int, 0);
344                                 BT_DBG("request_id : %d", request_id);
345                                 _bt_add_push_request_id(request_id);
346                         } else if (cb_data->service_function == BT_MAP_LIST_FILTER_FIELDS) {
347                                 request_id = g_array_index(out_param1, int, 0);
348                                 BT_DBG("request_id : %d", request_id);
349                                 _bt_add_push_request_id(request_id);
350                         } else if (cb_data->service_function == BT_MAP_LIST_MESSAGES) {
351                                 request_id = g_array_index(out_param1, int, 0);
352                                 BT_DBG("request_id : %d", request_id);
353                                 _bt_add_push_request_id(request_id);
354                         } else if (cb_data->service_function == BT_MAP_GET_MESSAGE) {
355                                 request_id = g_array_index(out_param1, int, 0);
356                                 BT_DBG("request_id : %d", request_id);
357                                 _bt_add_push_request_id(request_id);
358                         } else if (cb_data->service_function == BT_MAP_PUSH_MESSAGE) {
359                                 request_id = g_array_index(out_param1, int, 0);
360                                 BT_DBG("request_id : %d", request_id);
361                                 _bt_add_push_request_id(request_id);
362                         }
363
364                         goto done;
365                 }
366         }
367
368         if (cb_data->cb == NULL)
369                 goto done;
370
371         /* Only if fail case, call the callback function*/
372         bt_event.result = result;
373         BT_INFO("event_type[%d], result= %s [0x%x]", event_type,
374                 _bt_convert_error_to_string(result), result);
375
376         if (event_type == BT_ADAPTER_EVENT || event_type == BT_RFCOMM_CLIENT_EVENT) {
377                 ((bluetooth_cb_func_ptr)cb_data->cb)(bt_event.event,
378                                 &bt_event,
379                                 cb_data->user_data);
380         } else if (event_type == BT_HID_EVENT) {
381                 ((hid_cb_func_ptr)cb_data->cb)(bt_event.event,
382                                 (hid_event_param_t *)&bt_event,
383                                 cb_data->user_data);
384         } else if (event_type == BT_HEADSET_EVENT) {
385                 ((bt_audio_func_ptr)cb_data->cb)(bt_event.event,
386                                 (bt_audio_event_param_t *)&bt_event,
387                                 cb_data->user_data);
388         } else if (event_type == BT_HF_AGENT_EVENT) {
389                 ((bt_audio_func_ptr)cb_data->cb)(bt_event.event,
390                                 (bt_audio_event_param_t *)&bt_event,
391                                 cb_data->user_data);
392         } else if (event_type == BT_AVRCP_CONTROL_EVENT) {
393                 ((media_cb_func_ptr)cb_data->cb)(bt_event.event,
394                                 (media_event_param_t *)&bt_event,
395                                 cb_data->user_data);
396         } else if (event_type == BT_A2DP_SOURCE_EVENT) {
397                 ((bt_audio_func_ptr)cb_data->cb)(bt_event.event,
398                                 (bt_audio_event_param_t *)&bt_event,
399                                 cb_data->user_data);
400         } else if (event_type == BT_DEVICE_EVENT) {
401                 ((bluetooth_cb_func_ptr)cb_data->cb)(bt_event.event,
402                                 &bt_event,
403                                 cb_data->user_data);
404         } else if (event_type == BT_TDS_EVENT) {
405                 ((bluetooth_cb_func_ptr)cb_data->cb)(bt_event.event,
406                                 &bt_event,
407                                 cb_data->user_data);
408         } else {
409                 BT_INFO("Not handled event type : %d", event_type);
410         }
411 done:
412         if (out_param1)
413                 g_array_free(out_param1, TRUE);
414
415         sending_requests = g_slist_remove(sending_requests, (void *)cb_data);
416
417         g_free(cb_data);
418         BT_DBG("-");
419 }
420
421 int _bt_sync_send_request(int service_type, int service_function,
422                         GArray *in_param1, GArray *in_param2,
423                         GArray *in_param3, GArray *in_param4,
424                         GArray **out_param1)
425 {
426         int result = BLUETOOTH_ERROR_NONE;
427         GError *error = NULL;
428         GArray *in_param5 = NULL;
429 //      GArray *out_param2 = NULL;
430
431         GDBusProxy  *proxy;
432         GVariant *ret;
433         GVariant *param1;
434         GVariant *param2;
435         GVariant *param3;
436         GVariant *param4;
437         GVariant *param5;
438
439         switch (service_type) {
440         case BT_BLUEZ_SERVICE:
441         case BT_OBEX_SERVICE:
442         case BT_AGENT_SERVICE:
443         case BT_CHECK_PRIVILEGE:
444                 proxy = __bt_gdbus_get_service_proxy();
445                 if (!proxy)
446                         return BLUETOOTH_ERROR_INTERNAL;
447
448                 in_param5 = g_array_new(TRUE, TRUE, sizeof(gchar));
449
450
451
452                 param1 = g_variant_new_from_data((const GVariantType *)"ay",
453                                         in_param1->data, in_param1->len,
454                                         TRUE, NULL, NULL);
455                 param2 = g_variant_new_from_data((const GVariantType *)"ay",
456                                         in_param2->data, in_param2->len,
457                                         TRUE, NULL, NULL);
458                 param3 = g_variant_new_from_data((const GVariantType *)"ay",
459                                         in_param3->data, in_param3->len,
460                                         TRUE, NULL, NULL);
461                 param4 = g_variant_new_from_data((const GVariantType *)"ay",
462                                         in_param4->data, in_param4->len,
463                                         TRUE, NULL, NULL);
464                 param5 = g_variant_new_from_data((const GVariantType *)"ay",
465                                         in_param5->data, in_param5->len,
466                                         TRUE, NULL, NULL);
467
468                 ret = g_dbus_proxy_call_sync(proxy, "service_request",
469                                         g_variant_new("(iii@ay@ay@ay@ay@ay)",
470                                                 service_type, service_function,
471                                                 BT_SYNC_REQ, param1,
472                                                 param2, param3,
473                                                 param4, param5),
474                                         G_DBUS_CALL_FLAGS_NONE, -1,
475                                         NULL, &error);
476
477                 g_array_free(in_param5, TRUE);
478
479                 if (ret == NULL) {
480                         /* dBUS-RPC is failed */
481                         BT_ERR("dBUS-RPC is failed");
482
483                         if (error != NULL) {
484                                 /* dBUS gives error cause */
485                                 BT_ERR("D-Bus API failure: errCode[%x], message[%s]",
486                                        error->code, error->message);
487
488                                 g_clear_error(&error);
489                         } else {
490                                 /* dBUS does not give error cause dBUS-RPC is failed */
491                                 BT_ERR("error returned was NULL");
492                         }
493
494                         return BLUETOOTH_ERROR_INTERNAL;
495                 }
496
497                 param1 = NULL;
498 //              param2 = NULL;
499
500                 g_variant_get(ret, "(iv)", &result, &param1);
501
502                 if (param1) {
503                         *out_param1 = g_array_new(TRUE, TRUE, sizeof(gchar));
504                         __bt_fill_garray_from_variant(param1, *out_param1);
505                         g_variant_unref(param1);
506                 }
507
508 //              if (param2) {
509 //                      out_param2 = g_array_new(TRUE, TRUE, sizeof(gchar));
510 //                      __bt_fill_garray_from_variant(param2, out_param2);
511 //                      result = g_array_index(out_param2, int, 0);
512 //                      g_variant_unref(param2);
513 //                      g_array_free(out_param2, TRUE);
514 //              } else {
515 //                      result = BLUETOOTH_ERROR_INTERNAL;
516 //              }
517
518                 g_variant_unref(ret);
519                 break;
520         default:
521                 BT_ERR("Unknown service type");
522                 return BLUETOOTH_ERROR_INTERNAL;
523         }
524
525         return result;
526 }
527
528 int _bt_async_send_request(int service_type, int service_function,
529                         GArray *in_param1, GArray *in_param2,
530                         GArray *in_param3, GArray *in_param4,
531                         void *callback, void *user_data)
532 {
533         GArray* in_param5 = NULL;
534         bt_req_info_t *cb_data;
535
536         GDBusProxy *proxy;
537         int timeout;
538         GVariant *param1;
539         GVariant *param2;
540         GVariant *param3;
541         GVariant *param4;
542         GVariant *param5;
543
544         BT_DBG("service_function : %s (0x%x)",
545                         _bt_convert_service_function_to_string(service_function),
546                         service_function);
547
548         cb_data = g_new0(bt_req_info_t, 1);
549
550         cb_data->service_function = service_function;
551         cb_data->cb = callback;
552         cb_data->user_data = user_data;
553
554         switch (service_type) {
555         case BT_BLUEZ_SERVICE:
556         case BT_OBEX_SERVICE:
557                 proxy =  __bt_gdbus_get_service_proxy();
558                 if (!proxy) {
559                         g_free(cb_data);
560                         return BLUETOOTH_ERROR_INTERNAL;
561                 }
562
563                 /* Do not timeout the request in certain cases. Sometime the
564                  * request may take undeterministic time to reponse.
565                  * (for ex: pairing retry) */
566                 if (service_function == BT_BOND_DEVICE ||
567                         service_function == BT_BOND_DEVICE_BY_TYPE)
568                         timeout = INT_MAX;
569                 else
570                         timeout = BT_DBUS_TIMEOUT_MAX;
571
572                 in_param5 = g_array_new(TRUE, TRUE, sizeof(gchar));
573
574                 param1 = g_variant_new_from_data((const GVariantType *)"ay",
575                                         in_param1->data, in_param1->len,
576                                         TRUE, NULL, NULL);
577                 param2 = g_variant_new_from_data((const GVariantType *)"ay",
578                                         in_param2->data, in_param2->len,
579                                         TRUE, NULL, NULL);
580                 param3 = g_variant_new_from_data((const GVariantType *)"ay",
581                                         in_param3->data, in_param3->len,
582                                         TRUE, NULL, NULL);
583                 param4 = g_variant_new_from_data((const GVariantType *)"ay",
584                                         in_param4->data, in_param4->len,
585                                         TRUE, NULL, NULL);
586                 param5 = g_variant_new_from_data((const GVariantType *)"ay",
587                                         in_param5->data, in_param5->len,
588                                         TRUE, NULL, NULL);
589
590                 g_dbus_proxy_call(proxy, "service_request",
591                                         g_variant_new("(iii@ay@ay@ay@ay@ay)",
592                                                 service_type, service_function,
593                                                 BT_ASYNC_REQ, param1, param2,
594                                                 param3, param4, param5),
595                                         G_DBUS_CALL_FLAGS_NONE,
596                                         timeout, NULL,
597                                         (GAsyncReadyCallback)__send_request_cb,
598                                         (gpointer)cb_data);
599                 sending_requests = g_slist_append(sending_requests, cb_data);
600
601                 g_array_free(in_param5, TRUE);
602                 break;
603         default:
604                 g_free(cb_data);
605                 break;
606         }
607
608         return BLUETOOTH_ERROR_NONE;
609 }
610