#include "zigbee_service_interface_common.h"
+#include <zblib_driver_zclglobal_control.h>
+
+static void on_zclglobal_control_read_attributes_req_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_zclglobal_control_read_attributes_req(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
GVariant *attribute_id,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlReadAttributesRequest_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(attribute_id);
- NOT_USED(attribute_ids_length);
- NOT_USED(node_id);
- NOT_USED(cluster_id);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(dest_ep);
+ GVariantIter *iter = NULL;
+ gint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlReadAttributesRequest_t));
+
+ /* Update request structure */
+ g_variant_get(attribute_id, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.attribute_id[i])) {
+ i++;
+ if (i >= attribute_ids_length)
+ break;
+ }
+ req.attribute_id_len = attribute_ids_length;
+ req.node_id = node_id;
+ req.cluster_id = cluster_id;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.dest_ep = dest_ep;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_READ_ATTRIBUTES_REQ,
+ &req, sizeof(req),
+ on_zclglobal_control_read_attributes_req_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_zclglobal_control_write_attributes_req_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_zclglobal_control_write_attributes_req(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
GVariant *write_attribute,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlWriteAttributesRequest_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(write_attribute);
- NOT_USED(records_length);
- NOT_USED(node_id);
- NOT_USED(cluster_id);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(dest_ep);
+ GVariantIter *iter = NULL;
+ gint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlReadAttributesRequest_t));
+
+ /* Update request structure */
+ g_variant_get(write_attribute, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.write_records[i])) {
+ i++;
+ if (i >= records_length)
+ break;
+ }
+ req.records_len = records_length;
+ req.node_id = node_id;
+ req.cluster_id = cluster_id;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.dest_ep = dest_ep;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_REQ,
+ &req, sizeof(req),
+ on_zclglobal_control_write_attributes_req_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_zclglobal_control_write_attributes_undivided_req_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_zclglobal_control_write_attributes_undivided_req(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
GVariant *write_attribute,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlWriteAttributesUndividedRequest_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(write_attribute);
- NOT_USED(records_length);
- NOT_USED(node_id);
- NOT_USED(cluster_id);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(src_ep);
- NOT_USED(dest_ep);
+ GVariantIter *iter = NULL;
+ gint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlWriteAttributesUndividedRequest_t));
+
+ /* Update request structure */
+ g_variant_get(write_attribute, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.write_records[i])) {
+ i++;
+ if (i >= records_length)
+ break;
+ }
+ req.records_len = records_length;
+ req.node_id = node_id;
+ req.cluster_id = cluster_id;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.src_ep = src_ep;
+ req.dest_ep = dest_ep;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_UNDIVIDED_REQ,
+ &req, sizeof(req),
+ on_zclglobal_control_write_attributes_undivided_req_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_zclglobal_control_write_attributes_no_resp_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_zclglobal_control_write_attributes_no_resp(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
GVariant *write_attribute,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlWriteAttributesNoResponse_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(write_attribute);
- NOT_USED(records_length);
- NOT_USED(node_id);
- NOT_USED(cluster_id);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(src_ep);
- NOT_USED(dest_ep);
+ GVariantIter *iter = NULL;
+ gint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlWriteAttributesNoResponse_t));
+
+ /* Update request structure */
+ g_variant_get(write_attribute, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.write_records[i])) {
+ i++;
+ if (i >= records_length)
+ break;
+ }
+ req.records_len = records_length;
+ req.node_id = node_id;
+ req.cluster_id = cluster_id;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.src_ep = src_ep;
+ req.dest_ep = dest_ep;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_NO_RESP,
+ &req, sizeof(req),
+ on_zclglobal_control_write_attributes_no_resp_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_zclglobal_control_write_attributes_structured_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_zclglobal_control_write_attributes_structured(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
GVariant *write_attribute,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlWriteAttributesStructed_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(write_attribute);
- NOT_USED(records_length);
- NOT_USED(node_id);
- NOT_USED(cluster_id);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(src_ep);
- NOT_USED(dest_ep);
+ GVariantIter *iter = NULL;
+ gint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlWriteAttributesStructed_t));
+
+ /* Update request structure */
+ g_variant_get(write_attribute, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.write_records[i])) {
+ i++;
+ if (i >= records_length)
+ break;
+ }
+ req.records_len = records_length;
+ req.node_id = node_id;
+ req.cluster_id = cluster_id;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.src_ep = src_ep;
+ req.dest_ep = dest_ep;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_STRUCTURED,
+ &req, sizeof(req),
+ on_zclglobal_control_write_attributes_structured_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_zclglobal_control_read_attributes_structured_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_zclglobal_control_read_attributes_structured(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
GVariant *read_attribute,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlReadAttributesStructed_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(read_attribute);
- NOT_USED(records_length);
- NOT_USED(node_id);
- NOT_USED(cluster_id);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(src_ep);
- NOT_USED(dest_ep);
+ GVariantIter *iter = NULL;
+ gint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlReadAttributesStructed_t));
+
+ /* Update request structure */
+ g_variant_get(read_attribute, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.read_records[i])) {
+ i++;
+ if (i >= records_length)
+ break;
+ }
+ req.records_len = records_length;
+ req.node_id = node_id;
+ req.cluster_id = cluster_id;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.src_ep = src_ep;
+ req.dest_ep = dest_ep;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_READ_ATTRIBUTES_STRUCTURED,
+ &req, sizeof(req),
+ on_zclglobal_control_read_attributes_structured_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_zclglobal_control_configure_reporting_req_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_zclglobal_control_configure_reporting_req(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
GVariant *read_attribute,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlConfigureReportingReq_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(read_attribute);
- NOT_USED(records_length);
- NOT_USED(node_id);
- NOT_USED(cluster_id);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(src_ep);
- NOT_USED(dest_ep);
+ GVariantIter *iter = NULL;
+ gint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlConfigureReportingReq_t));
+
+ /* Update request structure */
+ g_variant_get(read_attribute, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.read_records[i])) {
+ i++;
+ if (i >= records_length)
+ break;
+ }
+ req.records_len = records_length;
+ req.node_id = node_id;
+ req.cluster_id = cluster_id;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.src_ep = src_ep;
+ req.dest_ep = dest_ep;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_CONFIGURE_REPORTING_REQ,
+ &req, sizeof(req),
+ on_zclglobal_control_configure_reporting_req_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_zclglobal_control_read_configure_reporting_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_zclglobal_control_read_configure_reporting(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
GVariant *read_attribute,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlReadConfigureReporting_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(read_attribute);
- NOT_USED(records_length);
- NOT_USED(node_id);
- NOT_USED(cluster_id);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(src_ep);
- NOT_USED(dest_ep);
+ GVariantIter *iter = NULL;
+ gint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlReadConfigureReporting_t));
+
+ /* Update request structure */
+ g_variant_get(read_attribute, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.read_records[i])) {
+ i++;
+ if (i >= records_length)
+ break;
+ }
+ req.records_len = records_length;
+ req.node_id = node_id;
+ req.cluster_id = cluster_id;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.src_ep = src_ep;
+ req.dest_ep = dest_ep;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_READ_CONFIGURE_REPORTING,
+ &req, sizeof(req),
+ on_zclglobal_control_read_configure_reporting_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_zclglobal_control_discover_attributes_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_zclglobal_control_discover_attributes(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
gshort node_id,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlDiscoverAttributes_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(node_id);
- NOT_USED(dest_ep);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(cluster_id);
- NOT_USED(start_attr);
- NOT_USED(max);
+ gboolean ret;
- /*
- * TODO -
- * Create and send request for processing
- */
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlDiscoverAttributes_t));
+
+ /* Update request structure */
+ req.node_id = node_id;
+ req.dest_ep = dest_ep;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.cluster_id = cluster_id;
+ req.start_attribute = start_attr;
+ req.max = max;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_DISCOVER_ATTRIBUTES,
+ &req, sizeof(req),
+ on_zclglobal_control_discover_attributes_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_zclglobal_control_discover_attributes_extended_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_zclglobal_control_discover_attributes_extended(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
gshort node_id,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlDiscoverAttributesExtended_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(node_id);
- NOT_USED(dest_ep);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(cluster_id);
- NOT_USED(start_attr);
- NOT_USED(max);
+ gboolean ret;
- /*
- * TODO -
- * Create and send request for processing
- */
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlDiscoverAttributesExtended_t));
+
+ /* Update request structure */
+ req.node_id = node_id;
+ req.dest_ep = dest_ep;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.cluster_id = cluster_id;
+ req.start_attribute = start_attr;
+ req.max = max;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_DISCOVER_ATTRIBUTES_EXTENDED,
+ &req, sizeof(req),
+ on_zclglobal_control_discover_attributes_extended_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_zclglobal_control_discover_commands_received_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_zclglobal_control_discover_commands_received(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
gshort node_id,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlDiscoverCommandsReceived_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(node_id);
- NOT_USED(dest_ep);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(cluster_id);
- NOT_USED(start_attr);
- NOT_USED(max);
+ gboolean ret;
- /*
- * TODO -
- * Create and send request for processing
- */
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlDiscoverCommandsReceived_t));
+
+ /* Update request structure */
+ req.node_id = node_id;
+ req.dest_ep = dest_ep;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.cluster_id = cluster_id;
+ req.start_attribute = start_attr;
+ req.max = max;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_DISCOVER_COMMANDS_RECEIVED,
+ &req, sizeof(req),
+ on_zclglobal_control_discover_commands_received_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_zclglobal_control_discover_commands_generated_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_zclglobal_control_discover_commands_generated(ZigbeeZclglobal_control *zclglobal_control_object,
GDBusMethodInvocation *invocation,
gshort node_id,
gpointer user_data)
{
ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeZclglobalControlDiscoverCommandsGenerated_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(zclglobal_control_object);
- NOT_USED(invocation);
- NOT_USED(service_interface);
- NOT_USED(node_id);
- NOT_USED(dest_ep);
- NOT_USED(zcl_frame_ctrl);
- NOT_USED(cluster_id);
- NOT_USED(start_attr);
- NOT_USED(max);
+ gboolean ret;
- /*
- * TODO -
- * Create and send request for processing
- */
+ memset(&req, 0x0, sizeof(ZigbeeZclglobalControlDiscoverCommandsGenerated_t));
+
+ /* Update request structure */
+ req.node_id = node_id;
+ req.dest_ep = dest_ep;
+ req.zcl_frame_ctrl = zcl_frame_ctrl;
+ req.cluster_id = cluster_id;
+ req.start_attribute = start_attr;
+ req.max = max;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(zclglobal_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_ZCLGLOBAL_CONTROL,
+ ZBLIB_ZCLGLOBAL_CONTROL_OPS_DISCOVER_COMMANDS_GENERATED,
+ &req, sizeof(req),
+ on_zclglobal_control_discover_commands_generated_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;
}