Add the exception handling logic for TC
[platform/core/connectivity/bluetooth-agent.git] / hid-agent / bluetooth-hid-agent.c
index 542d895..fcf5e01 100644 (file)
@@ -607,29 +607,6 @@ static void __bt_hid_agent_filter_cb(GDBusConnection *connection,
        FN_END;
 }
 
-void _bt_convert_device_path_to_address(const char *device_path,
-                                               char *device_address)
-{
-       char address[BT_ADDRESS_STRING_SIZE] = { 0 };
-       char *dev_addr;
-
-       ret_if(device_path == NULL);
-       ret_if(device_address == NULL);
-
-       dev_addr = strstr(device_path, "dev_");
-       if (dev_addr != NULL) {
-               char *pos = NULL;
-               dev_addr += 4;
-               g_strlcpy(address, dev_addr, sizeof(address));
-
-               while ((pos = strchr(address, '_')) != NULL) {
-                       *pos = ':';
-               }
-
-               g_strlcpy(device_address, address, BT_ADDRESS_STRING_SIZE);
-       }
-}
-
 static void __bt_hid_device_filter_cb(GDBusConnection *connection,
                                        const gchar *sender_name,
                                        const gchar *object_path,
@@ -744,9 +721,8 @@ static void __bt_hid_agent_dbus_init(void)
                return;
        }
 
-       if (!__bt_hid_agent_get_adapter_path(conn, NULL)) {
+       if (!__bt_hid_agent_get_adapter_path(conn, NULL))
                __bt_hid_agent_register();
-       }
 
        interface_added_sig_id = g_dbus_connection_signal_subscribe(conn,
                                NULL, BT_MANAGER_INTERFACE, BT_INTERFACES_ADDED, NULL, NULL, 0,
@@ -806,9 +782,10 @@ static void __bt_hid_agent_dbus_deinit(void)
 bt_hid_agent_error_t _bt_hid_disconnect_profile(void)
 {
        FN_START;
-       GDBusProxy *proxy;
+       GDBusProxy *proxy = NULL;
 
-       proxy = __bt_hid_gdbus_get_device_proxy(bt_hid_info.object_path);
+       if (bt_hid_info.object_path)
+               proxy = __bt_hid_gdbus_get_device_proxy(bt_hid_info.object_path);
 
        if (proxy == NULL) {
                ERR("Error while getting proxy");