#include "zigbee_service_interface_common.h"
+#include <zblib_driver_zcl_poll_control.h>
+
+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;
}