X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=zigbee-daemon%2Fzigbee-interface%2Fsrc%2Fzigbee_service_dbus_interface_zcl_poll_control.c;h=85d618cb91b33b50427c9a5fca2490367c51d7e2;hb=ab352270fe347a65bcecd1ed154dd8cab2fc5492;hp=c5ca8143135f0261d9949462b0ed01cfd8db6d08;hpb=3f34f77cd7023575fb803d1c25a91105e3e0f5c3;p=platform%2Fcore%2Fconnectivity%2Fzigbee-manager.git diff --git a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_poll_control.c b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_poll_control.c index c5ca814..85d618c 100644 --- a/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_poll_control.c +++ b/zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_poll_control.c @@ -18,98 +18,272 @@ #include "zigbee_service_interface_common.h" +#include + +static void on_zcl_poll_control_check_in_response_resp(ZigBeeServiceInterface *service_interface, + guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data) +{ + ZigbeeServiceInterfaceRespCbData_t *cb_data = + (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data; + + NOT_USED(cb_data); + NOT_USED(service_interface); + NOT_USED(request_id); + NOT_USED(resp_data); + NOT_USED(resp_data_len); +} + static gboolean on_zcl_poll_control_check_in_response(ZigbeeZcl_poll_control *zcl_poll_control_object, GDBusMethodInvocation *invocation, gshort node_id, - gchar dst_ep, + gchar dest_ep, gchar start_fast_polling, gshort fast_poll_timeout, gpointer user_data) { ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data; + ZigbeeZclPollControlCheckInResponse_t req; + ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL; - NOT_USED(zcl_poll_control_object); - NOT_USED(invocation); - NOT_USED(service_interface); - NOT_USED(node_id); - NOT_USED(dst_ep); - NOT_USED(start_fast_polling); - NOT_USED(fast_poll_timeout); + gboolean ret; - /* - * TODO - - * Create and send request for processing - */ + memset(&req, 0x0, sizeof(ZigbeeZclPollControlCheckInResponse_t)); + + /* Update request structure */ + req.node_id = node_id; + req.dest_ep = dest_ep; + req.start_fast_polling = start_fast_polling; + req.fast_poll_timeout = fast_poll_timeout; + + /* Allocate response callback data */ + resp_cb_data = + zigbee_service_dbus_interface_create_resp_cb_data(zcl_poll_control_object, + invocation, NULL, 0); + if (NULL == resp_cb_data) { + Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!"); + + /* Send failure response */ + ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + + return TRUE; + } + + /* Dispatch request */ + ret = zigbee_service_dbus_interface_dispatch_request(service_interface, + ZBLIB_DRIVER_TYPE_ZCL_POLL_CONTROL, + ZBLIB_ZCL_POLL_CONTROL_OPS_CHECK_IN_RESPONSE, + &req, sizeof(req), + on_zcl_poll_control_check_in_response_resp, resp_cb_data); + if (FALSE == ret) { + Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); + + /* Free response callback data */ + zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data); + + /* Send failure response */ + ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + + return TRUE; + } return TRUE; } +static void on_zcl_poll_control_fast_poll_stop_resp(ZigBeeServiceInterface *service_interface, + guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data) +{ + ZigbeeServiceInterfaceRespCbData_t *cb_data = + (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data; + + NOT_USED(cb_data); + NOT_USED(service_interface); + NOT_USED(request_id); + NOT_USED(resp_data); + NOT_USED(resp_data_len); +} + static gboolean on_zcl_poll_control_fast_poll_stop(ZigbeeZcl_poll_control *zcl_poll_control_object, GDBusMethodInvocation *invocation, gshort node_id, - gchar dst_ep, + gchar dest_ep, gpointer user_data) { ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data; + ZigbeeZclPollControlFastPollStop_t req; + ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL; - NOT_USED(zcl_poll_control_object); - NOT_USED(invocation); - NOT_USED(service_interface); - NOT_USED(node_id); - NOT_USED(dst_ep); + gboolean ret; - /* - * TODO - - * Create and send request for processing - */ + memset(&req, 0x0, sizeof(ZigbeeZclPollControlFastPollStop_t)); + + /* Update request structure */ + req.node_id = node_id; + req.dest_ep = dest_ep; + + /* Allocate response callback data */ + resp_cb_data = + zigbee_service_dbus_interface_create_resp_cb_data(zcl_poll_control_object, + invocation, NULL, 0); + if (NULL == resp_cb_data) { + Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!"); + + /* Send failure response */ + ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + + return TRUE; + } + + /* Dispatch request */ + ret = zigbee_service_dbus_interface_dispatch_request(service_interface, + ZBLIB_DRIVER_TYPE_ZCL_POLL_CONTROL, + ZBLIB_ZCL_POLL_CONTROL_OPS_FAST_POLL_STOP, + &req, sizeof(req), + on_zcl_poll_control_fast_poll_stop_resp, resp_cb_data); + if (FALSE == ret) { + Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); + + /* Free response callback data */ + zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data); + + /* Send failure response */ + ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + + return TRUE; + } return TRUE; } +static void on_zcl_poll_control_set_long_poll_interval_resp(ZigBeeServiceInterface *service_interface, + guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data) +{ + ZigbeeServiceInterfaceRespCbData_t *cb_data = + (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data; + + NOT_USED(cb_data); + NOT_USED(service_interface); + NOT_USED(request_id); + NOT_USED(resp_data); + NOT_USED(resp_data_len); +} + static gboolean on_zcl_poll_control_set_long_poll_interval(ZigbeeZcl_poll_control *zcl_poll_control_object, GDBusMethodInvocation *invocation, gshort node_id, - gchar dst_ep, + gchar dest_ep, guint new_long_poll_interval, gpointer user_data) { ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data; + ZigbeeZclPollControlSetLongPollInterval_t req; + ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL; - NOT_USED(zcl_poll_control_object); - NOT_USED(invocation); - NOT_USED(service_interface); - NOT_USED(node_id); - NOT_USED(dst_ep); - NOT_USED(new_long_poll_interval); + gboolean ret; - /* - * TODO - - * Create and send request for processing - */ + memset(&req, 0x0, sizeof(ZigbeeZclPollControlSetLongPollInterval_t)); + + /* Update request structure */ + req.node_id = node_id; + req.dest_ep = dest_ep; + req.new_long_poll_interval = new_long_poll_interval; + + /* Allocate response callback data */ + resp_cb_data = + zigbee_service_dbus_interface_create_resp_cb_data(zcl_poll_control_object, + invocation, NULL, 0); + if (NULL == resp_cb_data) { + Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!"); + + /* Send failure response */ + ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + + return TRUE; + } + + /* Dispatch request */ + ret = zigbee_service_dbus_interface_dispatch_request(service_interface, + ZBLIB_DRIVER_TYPE_ZCL_POLL_CONTROL, + ZBLIB_ZCL_POLL_CONTROL_OPS_SET_LONG_POLL_INTERVAL, + &req, sizeof(req), + on_zcl_poll_control_set_long_poll_interval_resp, resp_cb_data); + if (FALSE == ret) { + Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); + + /* Free response callback data */ + zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data); + + /* Send failure response */ + ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + + return TRUE; + } return TRUE; } +static void on_zcl_poll_control_set_short_poll_interval_resp(ZigBeeServiceInterface *service_interface, + guint request_id, gpointer resp_data, guint resp_data_len, gpointer resp_cb_data) +{ + ZigbeeServiceInterfaceRespCbData_t *cb_data = + (ZigbeeServiceInterfaceRespCbData_t *)resp_cb_data; + + NOT_USED(cb_data); + NOT_USED(service_interface); + NOT_USED(request_id); + NOT_USED(resp_data); + NOT_USED(resp_data_len); +} + static gboolean on_zcl_poll_control_set_short_poll_interval(ZigbeeZcl_poll_control *zcl_poll_control_object, GDBusMethodInvocation *invocation, gshort node_id, - gchar dst_ep, + gchar dest_ep, guint new_short_poll_interval, gpointer user_data) { ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data; + ZigbeeZclPollControlSetShortPollInterval_t req; + ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL; - NOT_USED(zcl_poll_control_object); - NOT_USED(invocation); - NOT_USED(service_interface); - NOT_USED(node_id); - NOT_USED(dst_ep); - NOT_USED(new_short_poll_interval); + gboolean ret; - /* - * TODO - - * Create and send request for processing - */ + memset(&req, 0x0, sizeof(ZigbeeZclPollControlSetShortPollInterval_t)); + + /* Update request structure */ + req.node_id = node_id; + req.dest_ep = dest_ep; + req.new_short_poll_interval = new_short_poll_interval; + + /* Allocate response callback data */ + resp_cb_data = + zigbee_service_dbus_interface_create_resp_cb_data(zcl_poll_control_object, + invocation, NULL, 0); + if (NULL == resp_cb_data) { + Z_LOGE("zigbee_service_dbus_interface_create_resp_cb_data failed!"); + + /* Send failure response */ + ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + + return TRUE; + } + + /* Dispatch request */ + ret = zigbee_service_dbus_interface_dispatch_request(service_interface, + ZBLIB_DRIVER_TYPE_ZCL_POLL_CONTROL, + ZBLIB_ZCL_POLL_CONTROL_OPS_SET_SHORT_POLL_INTERVAL, + &req, sizeof(req), + on_zcl_poll_control_set_short_poll_interval_resp, resp_cb_data); + if (FALSE == ret) { + Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!"); + + /* Free response callback data */ + zigbee_service_dbus_interface_destroy_resp_cb_data(resp_cb_data); + + /* Send failure response */ + ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG); + + return TRUE; + } return TRUE; }