Remove compiler warnings 72/127772/1
authorAtul Rai <a.rai@samsung.com>
Mon, 1 May 2017 10:10:47 +0000 (15:40 +0530)
committerAtul Rai <a.rai@samsung.com>
Mon, 1 May 2017 10:10:47 +0000 (15:40 +0530)
Change-Id: Ib870e64894a89450274a66ca7aff7cd4f54c01d6
Signed-off-by: Atul Rai <a.rai@samsung.com>
27 files changed:
bt-api/bt-adapter.c
bt-api/bt-audio.c
bt-api/bt-common.c
bt-api/bt-dpm.c
bt-api/bt-event-handler.c
bt-api/bt-gatt-client.c
bt-api/bt-gatt-service.c
bt-api/bt-hdp.c
bt-api/bt-hid-device.c
bt-api/bt-hid.c
bt-api/bt-rfcomm-server.c
bt-api/bt-telephony.c
bt-service-adaptation/services/adapter/bt-service-core-adapter-le.c
bt-service-adaptation/services/adapter/bt-service-core-adapter.c
bt-service-adaptation/services/audio/bt-service-audio.c
bt-service-adaptation/services/audio/hf/bt-service-hf.c
bt-service-adaptation/services/bt-request-handler.c
bt-service-adaptation/services/bt-service-agent-util.c
bt-service-adaptation/services/bt-service-common.c
bt-service-adaptation/services/bt-service-dpm.c
bt-service-adaptation/services/device/bt-service-core-device.c
bt-service-adaptation/services/health/bt-service-hdp.c
bt-service-adaptation/services/hid/bt-service-hidhost.c
bt-service-adaptation/services/include/bt-service-core-adapter.h
bt-service-adaptation/services/include/bt-service-core-device.h
bt-service-adaptation/services/include/bt-service-dpm.h
include/bluetooth-audio-api.h

index 4e11edb..f43df8b 100644 (file)
@@ -26,7 +26,7 @@
 
 static int __bt_fill_device_list(GArray *out_param2, GPtrArray **dev_list)
 {
-       int i;
+       unsigned int i;
        guint size;
        bluetooth_device_info_t info;
 
@@ -513,7 +513,7 @@ BT_EXPORT_API int bluetooth_get_profile_connected_device_list(
        char uuid[BLUETOOTH_UUID_STRING_MAX];
        int result;
        guint size;
-       int i;
+       unsigned int i;
 
        BT_CHECK_PARAMETER(profile_uuid, return);
        BT_CHECK_PARAMETER(addr_list, return);
index a6666ce..c667d98 100644 (file)
@@ -715,7 +715,7 @@ BT_EXPORT_API int bluetooth_hf_terminate_call()
        return BLUETOOTH_ERROR_NONE;
 }
 
-BT_EXPORT_API int bluetooth_hf_initiate_call(char *number)
+BT_EXPORT_API int bluetooth_hf_initiate_call(const char *number)
 {
        GVariant *reply = NULL;
        GError *err = NULL;
index c27cf46..746ca66 100644 (file)
@@ -293,7 +293,7 @@ void _bt_convert_addr_type_to_string(char *address,
 
 int _bt_copy_utf8_string(char *dest, const char *src, unsigned int length)
 {
-       int i;
+       unsigned int i;
        const char *p = src;
        char *next;
        int count;
@@ -340,7 +340,7 @@ gboolean _bt_utf8_validate(char *name)
 
 
 static GDBusProxy *profile_gproxy;
-static GDBusConnection *gconn;
+static GDBusConnection *gconn_g;
 static int latest_id = -1;
 #define BT_RFCOMM_ID_MAX 245
 static gboolean id_used[BT_RFCOMM_ID_MAX];
@@ -426,6 +426,7 @@ static const GDBusInterfaceVTable method_table = {
        __new_connection_method,
        NULL,
        NULL,
+       {0}
 };
 
 void _bt_swap_addr(unsigned char *dst, const unsigned char *src)
@@ -483,10 +484,10 @@ void __rfcomm_delete_id(int id)
 
 static GDBusConnection *__get_gdbus_connection()
 {
-       if (gconn == NULL)
-               gconn = g_bus_get_private_conn();
+       if (gconn_g == NULL)
+               gconn_g = g_bus_get_private_conn();
 
-       return gconn;
+       return gconn_g;
 }
 
 static GDBusProxy *__bt_gdbus_get_profile_proxy(void)
@@ -1064,7 +1065,6 @@ int _bt_cancel_discovers(char *address)
        GError *err = NULL;
        object_path = _bt_get_device_object_path(address);
        if (object_path == NULL) {
-               GVariant *ret = NULL;
                BT_ERR("No searched device");
                adapter_proxy = __bt_gdbus_get_adapter_proxy();
                retv_if(adapter_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
index 2ec42ac..bed7368 100644 (file)
@@ -127,7 +127,7 @@ static bt_dpm_status_e _bt_check_dpm_blacklist_device(bluetooth_device_address_t
        return BT_DPM_ALLOWED;
 }
 
-static bt_dpm_status_e _bt_check_dpm_blacklist_uuid(char *uuid)
+static bt_dpm_status_e _bt_check_dpm_blacklist_uuid(const char *uuid)
 {
        bt_dpm_status_e bt_dpm_status = BT_DPM_ALLOWED;
        bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
@@ -150,7 +150,7 @@ static bt_dpm_status_e _bt_check_dpm_blacklist_uuid(char *uuid)
        }
 
        if (g_strcmp0(BT_OPP_UUID, uuid) == 0) {
-               bt_dpm_status_t dpm_status = BLUETOOTH_DPM_ALLOWED;
+               dpm_status = BLUETOOTH_DPM_ALLOWED;
                bluetooth_dpm_get_data_transfer_state(&dpm_status);
                return (dpm_status == BLUETOOTH_DPM_RESTRICTED ? BT_DPM_RESTRICTED : BT_DPM_ALLOWED);
        }
index ca9afdd..aa293a0 100644 (file)
@@ -2084,7 +2084,7 @@ void __bt_pbap_client_event_filter(GDBusConnection *connection,
        BT_DBG("Type: %s", g_variant_get_type_string(parameters));
 
        if (strcasecmp(signal_name, BT_PBAP_CONNECTED) == 0) {
-               bt_pbap_connected_t connected = { { { 0 }, }, };
+               bt_pbap_connected_t connected;
                char *address = NULL;
 
                g_variant_get(parameters, "(i&s)", &result, &address);
@@ -2101,7 +2101,7 @@ void __bt_pbap_client_event_filter(GDBusConnection *connection,
                                result, &connected,
                                event_info->cb, event_info->user_data);
        } else if (strcasecmp(signal_name, BT_PBAP_DISCONNECTED) == 0) {
-               bt_pbap_connected_t disconnected = { { { 0 }, }, };
+               bt_pbap_connected_t disconnected;
                char *address = NULL;
 
                g_variant_get(parameters, "(i&s)", &result, &address);
@@ -2115,7 +2115,7 @@ void __bt_pbap_client_event_filter(GDBusConnection *connection,
                                result, &disconnected,
                                event_info->cb, event_info->user_data);
        } else if (strcasecmp(signal_name, BT_PBAP_PHONEBOOK_SIZE) == 0) {
-               bt_pbap_phonebook_size_t pb_size = { { { 0 }, }, };
+               bt_pbap_phonebook_size_t pb_size;
                char *address = NULL;
                int size = 0;
 
@@ -2131,7 +2131,7 @@ void __bt_pbap_client_event_filter(GDBusConnection *connection,
                                result, &pb_size,
                                event_info->cb, event_info->user_data);
        } else if (strcasecmp(signal_name, BT_PBAP_PHONEBOOK_PULL) == 0) {
-               bt_pbap_phonebook_pull_t pb_pull = { { { 0 } }, };
+               bt_pbap_phonebook_pull_t pb_pull;
                char *address = NULL;
                char *vcf_file = NULL;
                int success = -1;
@@ -2149,13 +2149,13 @@ void __bt_pbap_client_event_filter(GDBusConnection *connection,
                                result, &pb_pull,
                                event_info->cb, event_info->user_data);
        } else if (strcasecmp(signal_name, BT_PBAP_VCARD_LIST) == 0) {
-               bt_pbap_vcard_list_t vc_list = { { { 0 } }, };
+               bt_pbap_vcard_list_t vc_list;
                char *address = NULL;
                gsize count = 0;
                gchar **list = NULL;
                GVariant *string_var;
                int success = -1;
-               int i = 0;
+               unsigned int i = 0;
 
                g_variant_get(parameters, "(i&sv)", &result, &address, &string_var);
 
@@ -2181,7 +2181,7 @@ void __bt_pbap_client_event_filter(GDBusConnection *connection,
                g_variant_unref(string_var);
                //free lists
        } else if (strcasecmp(signal_name, BT_PBAP_VCARD_PULL) == 0) {
-               bt_pbap_vcard_pull_t vc_pull = { { { 0 } }, };
+               bt_pbap_vcard_pull_t vc_pull;
                char *address = NULL;
                char *vcf_file = NULL;
                int success = -1;
@@ -2199,13 +2199,13 @@ void __bt_pbap_client_event_filter(GDBusConnection *connection,
                                result, &vc_pull,
                                event_info->cb, event_info->user_data);
        } else if (strcasecmp(signal_name, BT_PBAP_SEARCH_PHONEBOOK) == 0) {
-               bt_pbap_phonebook_search_list_t vc_list = { { { 0 } }, };
+               bt_pbap_phonebook_search_list_t vc_list;
                char *address = NULL;
                gsize count = 0;
                gchar **list = NULL;
                GVariant *string_var;
                int success = -1;
-               int i = 0;
+               unsigned int i = 0;
 
                g_variant_get(parameters, "(i&s@as)", &result, &address, &string_var);
 
@@ -2574,7 +2574,7 @@ void __bt_hf_agent_event_filter(GDBusConnection *connection,
                        g_variant_unref(var_data);
                }
 
-               if (handle && (call_count == g_list_length(handle->list))) {
+               if (handle && (call_count == (int)g_list_length(handle->list))) {
                        handle->count = call_count;
                        _bt_hf_event_cb(BLUETOOTH_EVENT_HF_CALL_STATUS,
                                        result, handle,
index aa0c4c4..7eb5997 100755 (executable)
@@ -96,7 +96,7 @@ static char **__get_string_array_from_gptr_array(GPtrArray *gp)
 {
        gchar *gp_path = NULL;
        char **path = NULL;
-       int i;
+       unsigned int i;
 
        if (gp->len == 0)
                return NULL;
@@ -1174,7 +1174,8 @@ static int __bluetooth_gatt_descriptor_iter(const char *char_handle,
        GVariant *value = NULL;
        GVariant *result = NULL;
        GDBusConnection *g_conn;
-       int i, ret = BLUETOOTH_ERROR_NONE;
+       unsigned int i;
+       int ret = BLUETOOTH_ERROR_NONE;
        const char *uuid = NULL;
        gsize len = 0;
        GVariantIter *desc_value_iter, *property_iter;
index be36111..cb6e191 100644 (file)
@@ -1164,24 +1164,28 @@ static const GDBusInterfaceVTable desc_interface_vtable = {
        __bt_gatt_desc_method_call,
        NULL,
        NULL,
+       { 0 }
 };
 
 static const GDBusInterfaceVTable char_interface_vtable = {
        __bt_gatt_char_method_call,
        NULL,
        NULL,
+       { 0 }
 };
 
 static const GDBusInterfaceVTable serv_interface_vtable = {
        NULL,
        NULL,
        NULL,
+       { 0 }
 };
 
 static const GDBusInterfaceVTable manager_interface_vtable = {
        __bt_gatt_manager_method_call,
        NULL,
-       NULL
+       NULL,
+       { 0 }
 };
 
 static GDBusNodeInfo *__bt_gatt_create_method_node_info(
index 9481c1c..1c61a61 100755 (executable)
@@ -134,7 +134,7 @@ static hdp_obj_info_t *__bt_hdp_internal_gslist_obj_find_using_fd(unsigned int s
                        if (!info)
                                return NULL;
 
-                       if (sock_fd == info->fd)
+                       if ((int)sock_fd == info->fd)
                                return info;
                }
        }
@@ -168,7 +168,6 @@ static gboolean __bt_hdp_internal_data_received(GIOChannel *gio,
 
        if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR)) {
                bt_hdp_disconnected_t disconn_info;
-               bt_user_info_t *user_info;
                hdp_app_list_t *list;
 
                BT_DBG("GIOCondition %d", cond);
@@ -393,7 +392,7 @@ BT_EXPORT_API int bluetooth_hdp_send_data(unsigned int channel_id,
                                            const char *buffer,
                                            unsigned int size)
 {
-       int wbytes = 0;
+       unsigned int wbytes = 0;
        int written = 0;
        hdp_obj_info_t *info;
        int result;
index e61a908..d02a9b8 100755 (executable)
@@ -321,9 +321,9 @@ static gboolean __is_error_by_disconnect(GError *err)
 }
 
 static gboolean __received_cb(GIOChannel *chan, GIOCondition cond,
-                                                               gpointer data)
+                                                               gpointer user_data)
 {
-       hid_connected_device_info_t *info = data;
+       hid_connected_device_info_t *info = user_data;
        GIOStatus status = G_IO_STATUS_NORMAL;
        char buffer[20];
        gsize len = 0;
@@ -457,11 +457,11 @@ static gboolean __received_cb(GIOChannel *chan, GIOCondition cond,
                default: {
                        BT_INFO("unsupported HIDP control message");
                        BT_ERR("Send Handshake Message");
-                       guint8 type = BT_HID_TRANS_HANDSHAKE |
+                       guint8 type1 = BT_HID_TRANS_HANDSHAKE |
                                BT_HID_HSHK_ERR_UNSUPPORTED_REQUEST;
                        data.type = HTYPE_TRANS_UNKNOWN;
                        int fd = g_io_channel_unix_get_fd(chan);
-                       int bytes = write(fd,  &type, sizeof(type));
+                       int bytes = write(fd,  &type1, sizeof(type1));
                        BT_INFO("Bytes Written %d", bytes);
                        break;
                }
index 0b99621..ba9e203 100644 (file)
@@ -80,7 +80,7 @@ BT_EXPORT_API int bluetooth_hid_connect(hid_device_address_t *device_address)
                return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
-       if (_bt_check_dpm(BT_DPM_UUID, BT_HID_UUID) == BT_DPM_RESTRICTED) {
+       if (_bt_check_dpm(BT_DPM_UUID, (void *)BT_HID_UUID) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist uuid");
                return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
index 9a0795b..4b457ac 100644 (file)
@@ -730,7 +730,7 @@ static int __process_cmsg(struct msghdr *msg)
                        continue;
 
                if (cmsg_ptr->cmsg_type == SCM_RIGHTS) {
-                       int *desc = (int *)CMSG_DATA(cmsg_ptr);
+                       //int *desc = (int *)CMSG_DATA(cmsg_ptr);
                        int count
                                = ((cmsg_ptr->cmsg_len - CMSG_LEN(0)) / sizeof(int));
 
@@ -739,7 +739,8 @@ static int __process_cmsg(struct msghdr *msg)
                                continue;
                        }
 
-                       sock_fd = desc[0];
+                       //sock_fd = desc[0];
+                       memcpy(&sock_fd, CMSG_DATA(cmsg_ptr), sizeof(sock_fd));
                        BT_DBG("Remote client fd: %d", sock_fd);
                }
        }
index 2f550d6..f24ccaf 100755 (executable)
@@ -220,6 +220,7 @@ static const GDBusInterfaceVTable method_table = {
        __bt_telephony_method,
        NULL,
        NULL,
+       {0}
 };
 
 static int __bt_telephony_get_error(const char *error_message)
@@ -877,7 +878,10 @@ static gboolean __bluetooth_telephony_is_headset(uint32_t device_class)
                        break;
                }
                break;
+       default:
+               break;
        }
+
        BT_DBG("[%d]", flag);
        FN_END;
        return flag;
@@ -1034,7 +1038,7 @@ static int __bluetooth_telephony_get_connected_device(void)
                                        device_class = g_variant_get_uint32(value);
                                        BT_DBG("Device Class: %d", device_class);
                                } else if (!g_strcmp0(key, "UUID")) {
-                                       int i = 0;
+                                       unsigned int i = 0;
                                        uuids = (gchar **)g_variant_get_strv(value, &len);
                                        BT_DBG_UUID(uuids, len, i);
                                } else if (!g_strcmp0(key, "Address")) {
@@ -1980,7 +1984,7 @@ BT_EXPORT_API int bluetooth_telephony_call_retrieved(unsigned int call_id)
 BT_EXPORT_API int bluetooth_telephony_call_swapped(void *call_list,
                                unsigned int call_count)
 {
-       int i;
+       unsigned int i;
        int ret;
        GList *list = call_list;
        bt_telephony_call_status_info_t *call_status;
index 38c53df..231004b 100644 (file)
@@ -479,7 +479,7 @@ static void __bt_le_event_handler(int event_type, gpointer event_data)
                break;
        }
        case OAL_EVENT_BLE_MULTI_ADVERTISING_UPDATE: {
-                BT_INFO("OAL Event: Advertising Params updated");
+                       BT_INFO("OAL Event: Advertising Params updated");
                break;
        }
        case OAL_EVENT_BLE_DISCOVERY_STARTED: {
index 73e9f79..ada191e 100644 (file)
@@ -93,10 +93,10 @@ static int __bt_adapter_state_discovery_request(gboolean enable,
                unsigned short max_response, unsigned short duration, unsigned int mask);
 static void __bt_adapter_discovery_state_change_callback(int bt_discovery_status);
 static gboolean __bt_is_service_request_present(int service_function);
-#ifdef TIZEN_MOBILE
+#ifndef TIZEN_TV
 static void __bt_set_visible_mode(void);
-#endif
 static void __bt_set_local_name(void);
+#endif
 
 /* Initialize BT stack (Initialize OAL layer) */
 int _bt_stack_init(void)
@@ -692,7 +692,7 @@ static void __bt_adapter_event_handler(int event_type, gpointer event_data)
        BT_DBG("-");
 }
 
-static int __bt_init_profiles()
+int _bt_init_profiles()
 {
        int ret;
 
@@ -767,6 +767,25 @@ static int __bt_init_profiles()
        return BLUETOOTH_ERROR_NONE;
 }
 
+int _bt_cleanup_profiles(void)
+{
+       /* TODO: Cleanup bluetooth profiles */
+       _bt_hidhost_deinitialize();
+       _bt_socket_deinit();
+#if 0
+       /* TODO: Cleanup bluetooth audio profiles */
+       //_bt_audio_deinitialize(BT_A2DP_SOURCE_MODULE);
+       //_bt_audio_deinitialize(BT_AVRCP_MODULE);
+       //_bt_audio_deinitialize(BT_A2DP_SINK_MODULE);
+       //_bt_audio_deinitialize(BT_AG_MODULE);
+       //_bt_audio_deinitialize(BT_AVRCP_CTRL_MODULE);
+       //_bt_audio_deinitialize(BT_AUDIO_ALL_MODULE);
+#endif
+       _bt_hdp_deinit();
+
+       return BLUETOOTH_ERROR_NONE;
+}
+
 /* OAL post initialization handler */
 static void __bt_post_oal_init(void)
 {
@@ -774,7 +793,7 @@ static void __bt_post_oal_init(void)
        int status = VCONFKEY_BT_STATUS_OFF;
 
        BT_DBG("OAL initialized, Init profiles..");
-       ret = __bt_init_profiles();
+       ret = _bt_init_profiles();
        if (ret != BLUETOOTH_ERROR_NONE)
                BT_ERR("Bluetooth profile init error: %d", ret);
 
@@ -791,8 +810,6 @@ static void __bt_post_oal_init(void)
                if (ret != BLUETOOTH_ERROR_NONE)
                        BT_ERR("_bt_enable_adapter failed with error: %d", ret);
        }
-
-       return;
 }
 
 /* OAL initialization handler */
@@ -862,7 +879,7 @@ static void __bt_adapter_handle_pending_requests(int service_function, void *use
                        g_array_append_vals(out_param, user_data, size);
                        break;
                case BT_IS_SERVICE_USED: {
-                       int i;
+                       unsigned int i;
                        gboolean used = FALSE;
                        unsigned char *uuid;
                        char uuid_str[BT_UUID_STRING_SIZE];
@@ -898,7 +915,7 @@ static void __bt_adapter_handle_pending_requests(int service_function, void *use
                        if (NULL != req_info->user_data)
                                continue;
 
-                       BT_DBG("Total num of bonded devices = [%d]", count);
+                       BT_DBG("BT_GET_BONDED_DEVICES: count = [%d]", count);
                        /* No bonded devices, return method invocation */
                        if (0 == count || !addr_list)
                                break;
@@ -947,21 +964,48 @@ static void __bt_adapter_handle_pending_requests(int service_function, void *use
        }
 }
 
+#ifndef TIZEN_TV
+static void __bt_phone_name_changed_cb(keynode_t *node, void *data)
+{
+       char *phone_name = NULL;
+       char *ptr = NULL;
+
+       if (node == NULL)
+               return;
+
+       if (vconf_keynode_get_type(node) == VCONF_TYPE_STRING) {
+               phone_name = vconf_keynode_get_str(node);
+
+               if (phone_name && strlen(phone_name) != 0) {
+                       if (!g_utf8_validate(phone_name, -1,
+                                       (const char **)&ptr))
+                               *ptr = '\0';
+
+                       _bt_set_local_name(phone_name);
+               }
+       }
+}
+#endif
+
 /* Request return handlings */
 static gboolean __bt_adapter_post_set_enabled(gpointer user_data)
 {
        BT_INFO("__bt_adapter_post_set_enabled>>");
 
-#ifdef TIZEN_MOBILE
+#ifndef TIZEN_TV
        __bt_set_visible_mode();
+
+       /* add the vconf noti handler */
+       if (0 != vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
+                       (vconf_callback_fn)__bt_phone_name_changed_cb, NULL))
+               BT_ERR("DEVICE_NAME key changed notification registration failed");
+
+       __bt_set_local_name();
 #else
-#ifdef TIZEN_TV
        if (BLUETOOTH_ERROR_NONE != _bt_set_discoverable_mode(
                        BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE, 0))
                BT_ERR("Fail to set discoverable mode");
 #endif
-#endif
-       __bt_set_local_name();
 
        /* Get All properties */
        if (OAL_STATUS_SUCCESS != adapter_get_properties())
@@ -974,7 +1018,14 @@ static gboolean __bt_adapter_post_set_enabled(gpointer user_data)
 static gboolean __bt_adapter_post_set_disabled(gpointer user_data)
 {
        BT_INFO("_bt_adapter_post_set_disabled>>");
+
+#ifndef TIZEN_TV
        /* Add Adapter disabled post processing codes */
+       if (vconf_ignore_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
+                       (vconf_callback_fn)__bt_phone_name_changed_cb) != 0)
+               BT_ERR("vconf_ignore_key_changed failed");
+#endif
+
        return FALSE;
 }
 
@@ -1010,7 +1061,7 @@ static void __bt_adapter_update_bt_disabled(void)
 
        /* Update Bluetooth Status to notify other modules */
        if (vconf_set_int(VCONFKEY_BT_STATUS, VCONFKEY_BT_STATUS_OFF) != 0)
-               BT_ERR("Set vconf failed\n");
+               BT_ERR("Set vconf failed");
 
        /* TODO:Add timer function to handle any further post processing */
        g_idle_add((GSourceFunc)__bt_adapter_post_set_disabled, NULL);
@@ -1023,7 +1074,6 @@ static void __bt_adapter_update_bt_disabled(void)
                        g_variant_new("(i)", result));
 }
 
-
 static void __bt_adapter_state_set_status(bt_status_t status)
 {
         BT_INFO("adapter_status changed [%d] -> [%d]", adapter_state, status);
@@ -1073,8 +1123,7 @@ static int __bt_adapter_state_handle_request(gboolean enable)
        BT_DBG("");
 
        switch (adapter_state) {
-       case BT_ACTIVATING:
-       {
+       case BT_ACTIVATING: {
                BT_INFO("Adapter is currently in activating state, state [%d]",
                                adapter_state);
                if (enable) {
@@ -1100,8 +1149,7 @@ static int __bt_adapter_state_handle_request(gboolean enable)
                }
                break;
        }
-       case BT_ACTIVATED:
-       {
+       case BT_ACTIVATED: {
                BT_INFO("Adapter is currently in activated state, state [%d]",
                                adapter_state);
                if (enable) {
@@ -1127,8 +1175,7 @@ static int __bt_adapter_state_handle_request(gboolean enable)
                }
                break;
        }
-       case BT_DEACTIVATING:
-       {
+       case BT_DEACTIVATING: {
                BT_INFO("Adapter is currently in deactivating state, state [%d]",
                                adapter_state);
                if (!enable) {
@@ -1149,8 +1196,7 @@ static int __bt_adapter_state_handle_request(gboolean enable)
                }
                break;
        }
-       case BT_DEACTIVATED:
-       {
+       case BT_DEACTIVATED: {
                BT_INFO("Adapter is currently in deactivated state, state [%d]",
                                adapter_state);
                if (!enable) {
@@ -1170,7 +1216,11 @@ static int __bt_adapter_state_handle_request(gboolean enable)
                }
                break;
        }
+       default:
+               BT_ERR("Unknown state: %d", adapter_state);
+               break;
        }
+
        if (enable && result == BLUETOOTH_ERROR_NONE) {
                /* Adapter enable request is successful, setup event handlers */
                _bt_service_register_event_handler_callback(
@@ -1236,7 +1286,7 @@ static int __bt_adapter_state_discovery_request(gboolean enable,
                                result = BLUETOOTH_ERROR_INTERNAL;
                        } else {
                                BT_ERR("Start Discovery Triggered successfully");
-                       __bt_adapter_update_discovery_status(ADAPTER_DISCOVERY_STARTING);
+                               __bt_adapter_update_discovery_status(ADAPTER_DISCOVERY_STARTING);
                                result = BLUETOOTH_ERROR_NONE;
                        }
                }
@@ -1261,6 +1311,9 @@ static int __bt_adapter_state_discovery_request(gboolean enable,
                }
                break;
        }
+       default:
+               BT_ERR("Unknown state: %d", adapter_discovery_state);
+               break;
        }
 
        BT_DBG("-");
@@ -1297,7 +1350,7 @@ static void __bt_adapter_discovery_state_change_callback(int bt_discovery_status
        }
 }
 
-#ifdef TIZEN_MOBILE
+#ifndef TIZEN_TV
 static void __bt_set_visible_mode(void)
 {
        int timeout = 0;
@@ -1338,7 +1391,6 @@ static void __bt_set_visible_mode(void)
        }
 #endif
 }
-#endif
 
 static void __bt_set_local_name(void)
 {
@@ -1358,3 +1410,4 @@ static void __bt_set_local_name(void)
        }
        free(phone_name);
 }
+#endif
index 87f740c..19e1bd2 100644 (file)
@@ -611,7 +611,7 @@ static void __bt_audio_cleanup_resources(void)
 static void __bt_audio_device_property_event_handler(event_dev_properties_t *event)
 {
        GSList *l;
-       int count;
+       unsigned int count;
        char address[BT_ADDRESS_STRING_SIZE] = { 0 };
        bt_pending_audio_conn_t *info = NULL;
        int value = BLUETOOTH_ERROR_NONE;
@@ -638,7 +638,7 @@ static void __bt_audio_device_property_event_handler(event_dev_properties_t *eve
                if (info && g_strcmp0(info->address, address) == 0 && info->search_status == SERVICE_SEARCH_STARTED) {
                        BT_INFO("Service searching is ongoing for addr [%s], Services received for the same!", info->address);
                        info->search_status = SERVICE_SEARCH_DONE;
-                       for(count=0; count < rem_info->uuid_count; count++) {
+                       for(count = 0; count < rem_info->uuid_count; count++) {
                                BT_INFO("Device [%s] has UUID [%s]", address, rem_info->uuids[count]);
                                if (g_strcmp0(A2DP_SINK_UUID, rem_info->uuids[count]) == 0 && (info->conn_req_type == BT_AUDIO_ALL) ) {
                                        BT_INFO("Device supports A2DP Sink Profile");
index 630e32f..092536c 100755 (executable)
@@ -35,7 +35,7 @@
 #include <bt-service-hf.h>
 #include <bt-service-event.h>
 
-void static __bt_hf_handle_audio_disconnection_state(bt_address_t *address)
+static void __bt_hf_handle_audio_disconnection_state(bt_address_t *address)
 {
        BT_DBG("+");
        GVariant *param;
index a06fba1..9a0ff5c 100644 (file)
@@ -78,7 +78,7 @@ static const gchar bt_service_introspection_xml[] =
 "      </interface>"
 "</node>";
 
-GDBusNodeInfo *node_info = NULL;
+GDBusNodeInfo *node_info_g = NULL;
 
 static void __bt_service_method(GDBusConnection *connection,
                const gchar *sender,
@@ -382,6 +382,7 @@ static const GDBusInterfaceVTable method_table = {
        __bt_service_method,
        NULL,
        NULL,
+       {0}
 };
 
 int __bt_bluez_request(int function_name,
@@ -2064,6 +2065,8 @@ int __bt_obexd_request(int function_name,
 
        switch (function_name) {
                /*TODO*/
+       default:
+               break;
        }
 
        FN_END;
@@ -2087,6 +2090,8 @@ int __bt_agent_request(int function_name,
 
        switch (function_name) {
                /*TODO*/
+       default:
+               break;
        }
 
        return result;
@@ -2104,6 +2109,8 @@ int __bt_core_request(int function_name,
 
        switch (function_name) {
                /*TODO*/
+       default:
+               break;
        }
 
        return result;
@@ -2117,7 +2124,7 @@ gboolean __bt_service_check_privilege(int function_name,
        gboolean result = TRUE;
        char *client_creds = NULL;
        char *user_creds = NULL;
-       char *client_session = "";
+       const char *client_session = "";
        enum cynara_client_creds client_creds_method = CLIENT_METHOD_SMACK;
        enum cynara_user_creds user_creds_method = USER_METHOD_UID;
        char err_msg[256] = {0, };
@@ -2523,15 +2530,15 @@ int _bt_service_register(void)
        if (owner_id == 0)
                goto fail;
 
-       node_info = __bt_service_create_method_node_info(
+       node_info_g = __bt_service_create_method_node_info(
                        bt_service_introspection_xml);
 
-       if (node_info == NULL)
+       if (node_info_g == NULL)
                goto fail;
 
-       result = __bt_service_register_object(conn, node_info, TRUE);
-       g_dbus_node_info_unref(node_info);
-       node_info = NULL;
+       result = __bt_service_register_object(conn, node_info_g, TRUE);
+       g_dbus_node_info_unref(node_info_g);
+       node_info_g = NULL;
 
        if (result != BLUETOOTH_ERROR_NONE)
                goto fail;
@@ -2570,9 +2577,9 @@ void _bt_service_unregister(void)
                        g_object_unref(bt_service_conn);
                        bt_service_conn = NULL;
                }
-               if (node_info) {
-                       g_dbus_node_info_unref(node_info);
-                       node_info = NULL;
+               if (node_info_g) {
+                       g_dbus_node_info_unref(node_info_g);
+                       node_info_g = NULL;
                }
                if (owner_id > 0) {
                        g_bus_unown_name(owner_id);
index 6d88e07..618c54c 100644 (file)
 gboolean _bt_agent_is_hid_keyboard(unsigned int dev_class)
 {
        switch ((dev_class & 0x1f00) >> 8) {
-               case 0x05:
-                       switch ((dev_class & 0xc0) >> 6) {
-                               case 0x01:
-                                       /* input-keyboard" */
-                                       return TRUE;
-                       }
+       case 0x05:
+               switch ((dev_class & 0xc0) >> 6) {
+               case 0x01:
+                       /* input-keyboard" */
+                       return TRUE;
+               default:
                        break;
+               }
+               break;
+       default:
+               break;
        }
 
        return FALSE;
@@ -92,7 +96,7 @@ gboolean _bt_agent_is_device_blacklist(const char *address,
        int i;
        FILE *fp;
        long size;
-       size_t result;
+       long result;
 
        BT_DBG("+");
 
@@ -187,46 +191,51 @@ gboolean _bt_agent_is_auto_response(unsigned int dev_class,
                return FALSE;
 
        switch ((dev_class & 0x1f00) >> 8) {
-               case 0x04:
-                       switch ((dev_class & 0xfc) >> 2) {
-                               case 0x01:
-                               case 0x02:
-                                       /* Headset */
-                                       is_headset = TRUE;
-                                       break;
-                               case 0x06:
-                                       /* Headphone */
-                                       is_headset = TRUE;
-                                       break;
-                               case 0x0b:      /* VCR */
-                               case 0x0c:      /* Video Camera */
-                               case 0x0d:      /* Camcorder */
-                                       break;
-                               default:
-                                       /* Other audio device */
-                                       is_headset = TRUE;
-                                       break;
-                       }
+       case 0x04:
+               switch ((dev_class & 0xfc) >> 2) {
+               case 0x01:
+               case 0x02:
+                       /* Headset */
+                       is_headset = TRUE;
+                       break;
+               case 0x06:
+                       /* Headphone */
+                       is_headset = TRUE;
+                       break;
+               case 0x0b:      /* VCR */
+               case 0x0c:      /* Video Camera */
+               case 0x0d:      /* Camcorder */
+                       break;
+               default:
+                       /* Other audio device */
+                       is_headset = TRUE;
                        break;
-               case 0x05:
-                       switch (dev_class & 0xff) {
-                               case 0x80:  /* 0x80: Pointing device(Mouse) */
-                                       is_mouse = TRUE;
-                                       break;
-
-                               case 0x40: /* 0x40: input device (BT keyboard) */
-                                       /* Get the LAP(Lower Address part) */
-                                       g_strlcpy(lap_address, address, sizeof(lap_address));
-
-                                       /* Need to Auto pair the blacklisted Keyboard */
-                                       if (_bt_agent_is_device_blacklist(lap_address, name) != TRUE) {
-                                               BT_DBG("Device is not black listed\n");
-                                               return FALSE;
-                                       } else {
-                                               BT_ERR("Device is black listed\n");
-                                               return TRUE;
-                                       }
+               }
+               break;
+       case 0x05:
+               switch (dev_class & 0xff) {
+               case 0x80:  /* 0x80: Pointing device(Mouse) */
+                       is_mouse = TRUE;
+                       break;
+
+               case 0x40: /* 0x40: input device (BT keyboard) */
+                       /* Get the LAP(Lower Address part) */
+                       g_strlcpy(lap_address, address, sizeof(lap_address));
+
+                       /* Need to Auto pair the blacklisted Keyboard */
+                       if (_bt_agent_is_device_blacklist(lap_address, name) != TRUE) {
+                               BT_DBG("Device is not black listed\n");
+                               return FALSE;
+                       } else {
+                               BT_ERR("Device is black listed\n");
+                               return TRUE;
                        }
+                       break;
+               default:
+                       break;
+               }
+       default:
+               break;
        }
 
        if ((!is_headset) && (!is_mouse))
index 7d8b3f5..9c63534 100644 (file)
@@ -865,6 +865,7 @@ void _bt_copy_remote_dev(bt_remote_dev_info_t *dev_info, remote_device_t *oal_de
        dev_info->uuid_count = oal_device->uuid_count;
        BT_INFO("UUID Count [%d]", dev_info->uuid_count);
        dev_info->trust = oal_device->is_trusted;
+       BT_INFO("iS Trusted [%d]", dev_info->trust);
 
        if (dev_info->uuid_count > 0)
                dev_info->uuids = g_new0(char *, dev_info->uuid_count);
index ddb0b9e..4cf40e5 100644 (file)
@@ -65,17 +65,20 @@ static dpm_profile_state_t dpm_profile_state[DPM_PROFILE_NONE]  = {
        [DPM_POLICY_BLUETOOTH_SPP_PROFILE_STATE] = {DPM_STATUS_ERROR},
 };
 
-int _bt_launch_dpm_popup(char *mode)
+int _bt_launch_dpm_popup(const char *mode)
 {
        int ret = 0;
        bundle *b;
+       char *str;
 
        b = bundle_create();
        retv_if(b == NULL, BLUETOOTH_ERROR_INTERNAL);
 
        bundle_add(b, "mode", mode);
 
-       ret = syspopup_launch(BT_DPM_SYSPOPUP, b);
+       str = g_strdup(BT_DPM_SYSPOPUP);
+       ret = syspopup_launch(str, b);
+       g_free(str);
 
        if (ret < 0)
                BT_ERR("Popup launch failed: %d\n", ret);
index 1c56d5d..1af341b 100644 (file)
@@ -361,11 +361,11 @@ static void __bt_handle_ongoing_device_service_search(bt_remote_dev_info_t *remo
        GVariant *uuids = NULL;
        GVariantBuilder *builder = NULL;
        GVariant *manufacturer_data;
-       int i = 0;
+       unsigned int i = 0;
        BT_INFO("Send Service Search request event");
 
        builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
-       for (i=0; i < remote_dev_info->uuid_count; i++) {
+       for (i = 0; i < remote_dev_info->uuid_count; i++) {
                g_variant_builder_add(builder, "s",
                                remote_dev_info->uuids[i]);
        }
@@ -399,7 +399,7 @@ static void __bt_handle_ongoing_device_service_search(bt_remote_dev_info_t *remo
 static void __bt_device_services_callback(event_dev_services_t* uuid_list)
 {
        bt_remote_dev_info_t *rem_info = NULL;
-       int i;
+       unsigned int i;
        BT_DBG("+");
 
        if (trigger_bond_info && _bt_compare_adddress(trigger_bond_info->dev_addr,
@@ -441,7 +441,7 @@ static void __bt_device_services_callback(event_dev_services_t* uuid_list)
                rem_info->uuids = g_new0(char *, rem_info->uuid_count);
 
        /* Fill Remote Device Service List list */
-       for (i=0; i < rem_info->uuid_count; i++) {
+       for (i = 0; i < rem_info->uuid_count; i++) {
                rem_info->uuids[i] = g_malloc0(BLUETOOTH_UUID_STRING_MAX);
                _bt_uuid_to_string((service_uuid_t *)&uuid_list->service_list[i].uuid, rem_info->uuids[i]);
                BT_DBG("UUID value=%s", rem_info->uuids[i]);
@@ -521,9 +521,10 @@ static void __bt_handle_ongoing_bond(bt_remote_dev_info_t *remote_dev_info)
                GVariant *uuids = NULL;
                GVariantBuilder *builder = NULL;
                GVariant *manufacturer_data;
-               int i = 0;
+               unsigned int i = 0;
+
                builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
-               for (i=0; i < remote_dev_info->uuid_count; i++) {
+               for (i = 0; i < remote_dev_info->uuid_count; i++) {
                        g_variant_builder_add(builder, "s",
                                        remote_dev_info->uuids[i]);
                }
@@ -682,8 +683,9 @@ static void __bt_device_handle_bond_failed_event(event_dev_bond_failed_t* bond_f
                        __bt_device_handle_pending_requests(result, BT_BOND_DEVICE,
                                        trigger_bond_info->addr, BT_ADDRESS_STRING_SIZE);
                        __bt_free_bond_info(BT_DEVICE_BOND_INFO);
-                       __bt_free_pairing_info(&trigger_pairing_info);
                }
+
+               __bt_free_pairing_info(&trigger_pairing_info);
                break;
        }
        case OAL_STATUS_INTERNAL_ERROR:
@@ -699,17 +701,17 @@ static void __bt_device_handle_bond_failed_event(event_dev_bond_failed_t* bond_f
                                        BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED,
                                        param);
                        __bt_free_bond_info(BT_DEVICE_UNBOND_INFO);
-                       __bt_free_pairing_info(&trigger_pairing_info);
                } else if (trigger_bond_info) {
                        if (__bt_device_handle_bond_state()!= BLUETOOTH_ERROR_NONE) {
                                if (trigger_bond_info) {
                                        __bt_device_handle_pending_requests(BLUETOOTH_ERROR_INTERNAL, BT_BOND_DEVICE,
                                                        trigger_bond_info->addr, BT_ADDRESS_STRING_SIZE);
                                        __bt_free_bond_info(BT_DEVICE_BOND_INFO);
-                                       __bt_free_pairing_info(&trigger_pairing_info);
                                }
                        }
                }
+
+               __bt_free_pairing_info(&trigger_pairing_info);
                break;
        }
        default:
@@ -1115,9 +1117,10 @@ static void __bt_device_remote_device_found_callback(gpointer event_data, gboole
                BT_DBG("Name %s", dev_info->name);
                GVariant *uuids = NULL;
                GVariantBuilder *builder = NULL;
-               int i = 0;
+               unsigned int i = 0;
+
                builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
-               for (i=0; i < dev_info->uuid_count; i++) {
+               for (i = 0; i < dev_info->uuid_count; i++) {
                        g_variant_builder_add(builder, "s",
                                        dev_info->uuids[i]);
                }
index 0ed8e72..625c9a2 100644 (file)
@@ -107,7 +107,7 @@ static void __bt_hdp_handle_pending_request_info(int result,
                        if (!conn_data)
                                break;
 
-                       if (*((int *)req_info->user_data) != conn_data->channel_id)
+                       if (*((int *)req_info->user_data) != (int)conn_data->channel_id)
                                break;
 
                        out_param = g_array_new(FALSE, FALSE, sizeof(gchar));
@@ -122,7 +122,7 @@ static void __bt_hdp_handle_pending_request_info(int result,
                case BT_HDP_DISCONNECT: {
                        bt_hdp_disconnected_t *disconn_data = data;
 
-                       if (*((int *)req_info->user_data) != disconn_data->channel_id)
+                       if (*((int *)req_info->user_data) != (int)disconn_data->channel_id)
                                break;
 
                        out_param = g_array_new(FALSE, FALSE, sizeof(gchar));
@@ -142,7 +142,7 @@ static void __bt_hdp_handle_pending_request_info(int result,
                                bt_hdp_conn_info_t *info = data;
                                bt_hdp_connected_t *conn_data = info->data;
 
-                               if (*((int *)req_info->user_data) != conn_data->channel_id)
+                               if (*((int *)req_info->user_data) != (int)conn_data->channel_id)
                                        break;
 
                                BT_DBG("fd: %d", info->fd);
@@ -495,10 +495,8 @@ gboolean __send_fd(gpointer data)
                g_free(info->data);
                g_free(info);
        } else {
-               bt_hdp_conn_info_t info;
-
-               __bt_hdp_handle_pending_request_info(BLUETOOTH_ERROR_INTERNAL,
-                               BT_HDP_GET_FD, (void *)&info, sizeof(bt_hdp_conn_info_t));
+               __bt_hdp_handle_pending_request_info(
+                               BLUETOOTH_ERROR_INTERNAL, BT_HDP_GET_FD, NULL, 0);
        }
 
        BT_DBG("-");
@@ -521,7 +519,7 @@ int _bt_hdp_get_fd(int channel_id)
                        continue;
 
                conn_info = (bt_hdp_connected_t *)(info->data);
-               if (conn_info && (conn_info->channel_id == channel_id)) {
+               if (conn_info && ((int)conn_info->channel_id == channel_id)) {
                        BT_DBG("Match found");
                        break;
                }
index 0593fbc..5607dc0 100644 (file)
 #include <dlog.h>
 #include <string.h>
 
-#include "bluetooth-api.h"
 #include "bt-internal-types.h"
 #include "bt-request-handler.h"
 #include "bt-service-util.h"
 #include "bt-service-event.h"
+#include "bt-service-event-receiver.h"
 #include "bt-service-common.h"
 #include "bt-service-hidhost.h"
-#include "bt-service-event-receiver.h"
 #include "oal-event.h"
 #include "oal-device-mgr.h"
 #include "oal-hid-host.h"
index 6aa30c5..c97311c 100755 (executable)
@@ -76,6 +76,10 @@ int _bt_set_connectable(gboolean connectable);
 
 int _bt_adapter_get_bonded_devices(void);
 
+int _bt_init_profiles();
+
+int _bt_cleanup_profiles(void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index c48e11e..47201cf 100755 (executable)
@@ -21,6 +21,7 @@
 #define _BT_SERVICE_CORE_DEVICE_H_
 
 #include <sys/types.h>
+#include "bluetooth-api.h"
 
 #ifdef __cplusplus
 extern "C" {
index bdac494..3f983c6 100644 (file)
@@ -113,7 +113,7 @@ struct dpm_profile_val {
 };
 typedef struct dpm_profile_val dpm_profile_state_t;
 
-int _bt_launch_dpm_popup(char *mode);
+int _bt_launch_dpm_popup(const char *mode);
 dpm_result_t _bt_dpm_set_allow_bluetooth_mode(dpm_bt_allow_t value);
 dpm_bt_allow_t _bt_dpm_get_allow_bluetooth_mode(void);
 dpm_result_t _bt_dpm_activate_bluetooth_device_restriction(dpm_status_t value);
index 9fb39dd..0102c86 100755 (executable)
@@ -229,7 +229,7 @@ int bluetooth_hf_answer_call();
 
 int bluetooth_hf_terminate_call();
 
-int bluetooth_hf_initiate_call(char *number);
+int bluetooth_hf_initiate_call(const char *number);
 
 int bluetooth_hf_voice_recognition(unsigned int status);