static gboolean __zblib_driver_zclglobal_control_dispatcher(ZigBeeDriver *driver, guint request_id)
{
ZigBeeService *service = NULL;
+ ZblibDriverZclglobalControlPrivData_t *priv_data = NULL;
+ ZblibDriverZclglobalControlOps_t *ops = NULL;
guint request_type;
guint ops_id;
+ gboolean ret = FALSE;
- if (NULL == driver) {
- Z_LOGE("driver is NULL");
- return FALSE;
- }
+ zblib_check_null_ret_error("driver", driver, FALSE);
service = zblib_driver_ref_service(driver);
- if (NULL == service) {
- Z_LOGE("service is NULL");
- return FALSE;
- }
+ zblib_check_null_ret_error("service", service, FALSE);
+
+ /* Fetch private data */
+ priv_data = zblib_driver_ref_object(driver);
+ zblib_check_null_ret_error("priv_data", priv_data, FALSE);
+
+ ops = priv_data->ops;
+ zblib_check_null_ret_error("ops", ops, FALSE);
/* Fetch request_type using request_id */
request_type = zblib_request_ref_request_type_by_request_id(service, request_id);
ops_id = zblib_request_get_ops_id(request_type);
switch (ops_id) {
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_READ_ATTRIBUTES_REQ: {
+ zblib_check_null_ret_error("ops->read_attributes_req",
+ ops->read_attributes_req, FALSE);
+
+ ret = ops->read_attributes_req(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_REQ: {
+ zblib_check_null_ret_error("ops->write_attributes_req",
+ ops->write_attributes_req, FALSE);
+
+ ret = ops->write_attributes_req(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_UNDIVIDED_REQ: {
+ zblib_check_null_ret_error("ops->write_attributes_undivided_req",
+ ops->write_attributes_undivided_req, FALSE);
+
+ ret = ops->write_attributes_undivided_req(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_NO_RESP: {
+ zblib_check_null_ret_error("ops->write_attributes_no_resp",
+ ops->write_attributes_no_resp, FALSE);
+
+ ret = ops->write_attributes_no_resp(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_STRUCTURED: {
+ zblib_check_null_ret_error("ops->write_attributes_structured",
+ ops->write_attributes_structured, FALSE);
+
+ ret = ops->write_attributes_structured(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_READ_ATTRIBUTES_STRUCTURED: {
+ zblib_check_null_ret_error("ops->read_attributes_structured",
+ ops->read_attributes_structured, FALSE);
+
+ ret = ops->read_attributes_structured(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_CONFIGURE_REPORTING_REQ: {
+ zblib_check_null_ret_error("ops->configure_reporting_req",
+ ops->configure_reporting_req, FALSE);
+
+ ret = ops->configure_reporting_req(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_READ_CONFIGURE_REPORTING: {
+ zblib_check_null_ret_error("ops->read_configure_reporting",
+ ops->read_configure_reporting, FALSE);
+
+ ret = ops->read_configure_reporting(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_DISCOVER_ATTRIBUTES: {
+ zblib_check_null_ret_error("ops->discover_attributes",
+ ops->discover_attributes, FALSE);
+
+ ret = ops->discover_attributes(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_DISCOVER_ATTRIBUTES_EXTENDED: {
+ zblib_check_null_ret_error("ops->discover_attributes_extended",
+ ops->discover_attributes_extended, FALSE);
+
+ ret = ops->discover_attributes_extended(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_DISCOVER_COMMANDS_RECEIVED: {
+ zblib_check_null_ret_error("ops->discover_commands_received",
+ ops->discover_commands_received, FALSE);
+
+ ret = ops->discover_commands_received(driver, request_id);
}
break;
case ZBLIB_ZCLGLOBAL_CONTROL_OPS_DISCOVER_COMMANDS_GENERATED: {
+ zblib_check_null_ret_error("ops->discover_commands_generated",
+ ops->discover_commands_generated, FALSE);
+
+ ret = ops->discover_commands_generated(driver, request_id);
}
break;
break;
}
- return TRUE;
+ Z_LOGD("ret: [%d]", ret);
+
+ return ret;
}
static void __zblib_driver_zclglobal_control_free_hook(ZigBeeDriver *driver)
{
ZblibDriverZclglobalControlPrivData_t *priv_data = NULL;
- if (NULL == driver) {
- Z_LOGE("driver is NULL");
- return;
- }
+ zblib_check_null_ret("driver", driver);
/* Fetch private data */
priv_data = zblib_driver_ref_object(driver);
- if (NULL == priv_data) {
- Z_LOGE("priv_data is NULL");
- return;
- }
+ zblib_check_null_ret("priv_data", priv_data);
/* Free resources */
g_free(priv_data);
ZblibDriverZclglobalControlPrivData_t *priv_data = NULL;
gboolean ret;
- if (NULL == plugin) {
- Z_LOGE("plugin is NULL");
- return NULL;
- }
+ zblib_check_null_ret_error("plugin", plugin, NULL);
/* Create new driver */
driver = zblib_driver_new(plugin, driver_name, ZBLIB_DRIVER_TYPE_ZCLGLOBAL_CONTROL);
- if (NULL == driver) {
- Z_LOGE("driver is NULL");
- return NULL;
- }
+ zblib_check_null_ret_error("driver", driver, NULL);
/* Allocate memory for private data */
priv_data = g_malloc0(sizeof(ZblibDriverZclglobalControlPrivData_t));
void zblib_driver_zclglobal_control_free(ZigBeeDriver *driver)
{
- if (NULL == driver) {
- Z_LOGE("driver is NULL");
- return;
- }
+ zblib_check_null_ret("driver", driver);
/* Free driver */
zblib_driver_free(driver);