Modify API to get in/out cluster list
[platform/core/connectivity/zigbee-manager.git] / zigbee-daemon / zigbee-interface / src / zigbee_service_dbus_interface_service.c
index 03406f1..cf97c6e 100644 (file)
@@ -59,6 +59,7 @@ static void on_service_enable_resp(ZigBeeServiceInterface *service_interface,
 
        if (NULL == resp_data || 0 == resp_data_len) {
                Z_LOGE("resp_data is null");
+               g_free(cb_data);
                return;
        }
 
@@ -83,8 +84,6 @@ static gboolean on_service_enable(ZigbeeService *service_object,
 
        gboolean ret;
 
-       Z_LOGE("KSR");
-
        /* Allocate response callback data */
        resp_cb_data =
                zigbee_service_dbus_interface_create_resp_cb_data(service_object,
@@ -134,6 +133,7 @@ static void on_service_disable_resp(ZigBeeServiceInterface *service_interface,
 
        if (NULL == resp_data || 0 == resp_data_len) {
                Z_LOGE("resp_data is null");
+               g_free(cb_data);
                return;
        }
 
@@ -206,6 +206,7 @@ static void on_service_zb_hw_reset_resp(ZigBeeServiceInterface *service_interfac
 
        if (NULL == resp_data || 0 == resp_data_len) {
                Z_LOGE("resp_data is null");
+               g_free(cb_data);
                return;
        }
 
@@ -278,6 +279,7 @@ static void on_service_form_network_resp(ZigBeeServiceInterface *service_interfa
 
        if (NULL == resp_data || 0 == resp_data_len) {
                Z_LOGE("resp_data is null");
+               g_free(cb_data);
                return;
        }
 
@@ -350,6 +352,7 @@ static void on_service_coex_start_resp(ZigBeeServiceInterface *service_interface
 
        if (NULL == resp_data || 0 == resp_data_len) {
                Z_LOGE("resp_data is null");
+               g_free(cb_data);
                return;
        }
 
@@ -429,6 +432,7 @@ static void on_service_coex_stop_resp(ZigBeeServiceInterface *service_interface,
 
        if (NULL == resp_data || 0 == resp_data_len) {
                Z_LOGE("resp_data is null");
+               g_free(cb_data);
                return;
        }
 
@@ -501,6 +505,7 @@ static void on_service_leave_network_resp(ZigBeeServiceInterface *service_interf
 
        if (NULL == resp_data || 0 == resp_data_len) {
                Z_LOGE("resp_data is null");
+               g_free(cb_data);
                return;
        }
 
@@ -577,6 +582,7 @@ static void on_service_get_network_info_resp(ZigBeeServiceInterface *service_int
 
        if (NULL == resp_data || 0 == resp_data_len) {
                Z_LOGE("resp_data is null");
+               g_free(cb_data);
                return;
        }
 
@@ -654,6 +660,7 @@ static void on_service_permit_join_resp(ZigBeeServiceInterface *service_interfac
 
        if (NULL == resp_data || 0 == resp_data_len) {
                Z_LOGE("resp_data is null");
+               g_free(cb_data);
                return;
        }
 
@@ -735,6 +742,7 @@ static void on_service_leave_request_resp(ZigBeeServiceInterface *service_interf
 
        if (NULL == resp_data || 0 == resp_data_len) {
                Z_LOGE("resp_data is null");
+               g_free(cb_data);
                return;
        }
 
@@ -1176,7 +1184,8 @@ static void on_service_get_cluster_list_resp(ZigBeeServiceInterface *service_int
        GDBusMethodInvocation *invocation;
        ZigbeeServiceGetClusterListResp_t *payload =
                (ZigbeeServiceGetClusterListResp_t*)resp_data;
-       GVariant *v_clusters = NULL;
+       GVariant *v_in_clusters = NULL;
+       GVariant *v_out_clusters = NULL;
 
        NOT_USED(service_interface);
        NOT_USED(request_id);
@@ -1193,11 +1202,13 @@ static void on_service_get_cluster_list_resp(ZigBeeServiceInterface *service_int
        invocation = zigbee_service_dbus_interface_ref_invocation(cb_data);
        zblib_check_null_free_and_ret("invocation", invocation, cb_data);
 
-       v_clusters = g_variant_new_from_data(G_VARIANT_TYPE("aq"),
-               payload->clusters, payload->cluster_count, TRUE, NULL, NULL);
+       v_in_clusters = g_variant_new_from_data(G_VARIANT_TYPE("aq"),
+               payload->in_clusters, payload->in_cluster_count, TRUE, NULL, NULL);
+       v_out_clusters = g_variant_new_from_data(G_VARIANT_TYPE("aq"),
+               payload->out_clusters, payload->out_cluster_count, TRUE, NULL, NULL);
 
        zigbee_service_complete_get_cluster_list(service_object, invocation,
-               payload->result, v_clusters);
+               payload->result, v_in_clusters, v_out_clusters);
 
        g_free(cb_data);
 }