Specify the sender to receive necessary PropertiesChanged signals.
[platform/core/connectivity/bluetooth-agent.git] / ag-agent / bluetooth-ag-agent.c
index a1f9d0b..893e824 100644 (file)
@@ -408,9 +408,12 @@ gboolean __bt_ag_agent_is_companion_device(const char *addr)
 
        if (g_strcmp0(host_device_address, addr) == 0) {
                INFO("addr[%s] is companion device", addr);
+               free(host_device_address);
                return TRUE;
        }
 
+       free(host_device_address);
+
        return FALSE;
 #else
        /* TODO : Need to add companion device check condition for Phone models */
@@ -674,7 +677,7 @@ gboolean _bt_ag_agent_answer_call(unsigned int call_id,
        DBG("Sender = %s", sender);
 
        _bt_ag_agent_emit_signal(ag_dbus_conn, path,
-                                       BT_AG_SERVICE_NAME, "Answer",
+                                       BT_HEADSET_INTERFACE, "Answer",
                                        g_variant_new("(u)", call_id));
        FN_END;
        return TRUE;
@@ -695,7 +698,7 @@ gboolean _bt_ag_agent_reject_call(unsigned int call_id,
        DBG("Sender = %s", sender);
 
        _bt_ag_agent_emit_signal(ag_dbus_conn, path,
-                                       BT_AG_SERVICE_NAME, "Reject",
+                                       BT_HEADSET_INTERFACE, "Reject",
                                        g_variant_new("(u)", call_id));
        FN_END;
        return TRUE;
@@ -716,7 +719,7 @@ gboolean _bt_ag_agent_release_call(unsigned int call_id,
        DBG("Sender = %s", sender);
 
        _bt_ag_agent_emit_signal(ag_dbus_conn, path,
-                                       BT_AG_SERVICE_NAME, "Release",
+                                       BT_HEADSET_INTERFACE, "Release",
                                        g_variant_new("(u)", call_id));
 
        FN_END;
@@ -943,7 +946,7 @@ gboolean _bt_ag_agent_threeway_call(unsigned int chld_value,
                return FALSE;
 #endif
        _bt_ag_agent_emit_signal(ag_dbus_conn, path,
-                                       BT_AG_SERVICE_NAME, "Threeway",
+                                       BT_HEADSET_INTERFACE, "Threeway",
                                        g_variant_new("(u)", chld_value));
        FN_END;
        return TRUE;
@@ -1272,7 +1275,7 @@ gboolean _bt_hfp_agent_nrec_status(gboolean status,
 
        if (ag_dbus_conn)
                _bt_ag_agent_emit_signal(ag_dbus_conn, hs->path,
-                                       BT_AG_SERVICE_NAME, "NrecStatusChanged",
+                                       BT_HEADSET_INTERFACE, "NrecStatusChanged",
                                        g_variant_new("(b)", status));
        FN_END;
        return TRUE;
@@ -2466,7 +2469,7 @@ static void __bt_ag_agent_print_at_buffer(char *message, const char *buf)
                i++;
        }
        if (message)
-               INFO("%s Buffer = [%s], Len(%d)", message, s, strlen(s));
+               INFO("%s Buffer = [%s], Len(%zd)", message, s, strlen(s));
        else
                INFO("[%s]", s);
 }
@@ -2496,7 +2499,7 @@ static int __bt_ag_send_at_valist(bt_ag_info_t *hdset, va_list list,
 
        count = vsnprintf(rsp_buffer, sizeof(rsp_buffer), list_format, list);
        if (count < 0) {
-               ERR("count is %d", count);
+               ERR("count is %zd", count);
                return -EINVAL;
        }
 
@@ -2646,8 +2649,8 @@ static gboolean __bt_ag_event_handler(GIOChannel *channel,
                        break;
                }
 
-               cmd_len = 1 + (off_t) get_cr -
-                       (off_t) &slconn->buffer[slconn->start];
+               cmd_len = 1 + (off_t)(intptr_t)get_cr -
+                       (off_t)(intptr_t)&slconn->buffer[slconn->start];
                *get_cr = '\0';
 
                if (cmd_len > 1) {
@@ -2789,7 +2792,7 @@ static gboolean __bt_ag_agent_is_device_vr_blacklisted(const char *lap_addr)
 
        rewind(fp);
 
-       buffer = g_malloc0(sizeof(char) * size);
+       buffer = g_malloc0((sizeof(char) * size) + 1);
        if (buffer == NULL) {
                ERR("g_malloc0 is failed");
                fclose(fp);
@@ -4263,7 +4266,7 @@ void _bt_ag_agent_check_transport_state(void)
 
                proxy =  g_dbus_proxy_new_sync(ag_dbus_conn,
                                G_DBUS_PROXY_FLAGS_NONE, NULL,
-                               "org.PulseAudio2", A2DP_SOURCE_ENDPOINT,
+                               "org.pulseaudio.Server", A2DP_SOURCE_ENDPOINT,
                                BLUEZ_MEDIA_ENDPOINT_INTERFACE, NULL, &err);
 
                if (!proxy) {
@@ -4400,7 +4403,7 @@ static void __bt_ag_agent_dbus_init(void)
 
 #ifdef TIZEN_FEATURE_BT_MEDIA_ENHANCE
        media_sig_id = g_dbus_connection_signal_subscribe(ag_dbus_conn,
-                               NULL, BT_PROPERTIES_INTERFACE, NULL, NULL,
+                               BLUEZ_SERVICE_NAME, BT_PROPERTIES_INTERFACE, NULL, NULL,
                                NULL, 0, __bt_ag_agent_media_filter_cb,
                                NULL, NULL);