2 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "setting_control_bt.h"
18 #include "setting_debug.h"
25 GPtrArray *dev_list = NULL;
26 bluetooth_device_info_t *dev;
27 gboolean is_connected = FALSE;
29 dev_list = g_ptr_array_new();
30 if (dev_list == NULL) {
31 printf("Setting - g_ptr_array_new is failed\n");
35 ret = bluetooth_get_bonded_device_list(&dev_list);
36 if (ret != BLUETOOTH_ERROR_NONE) {
37 printf("Setting - bluetooth_get_bonded_device_list is failed 0x%X\n", ret);
38 g_ptr_array_free(dev_list, TRUE);
42 for (i = 0; i < dev_list->len; i++) {
45 dev = g_ptr_array_index(dev_list, i);
47 printf("Setting - Invalid bluetooth device\n");
51 ret = bluetooth_is_device_connected(&dev->device_address,
52 BLUETOOTH_HFG_SERVICE, &is_connected);
53 if (ret == BLUETOOTH_ERROR_NONE && is_connected) {
58 if (dev_list != NULL) {
59 g_ptr_array_foreach(dev_list, (GFunc)g_free, NULL);
60 g_ptr_array_free(dev_list, TRUE);
63 DBG("Setting - connected? %d", is_connected);