#include "zigbee_service_interface_common.h"
+#include <zblib_driver_mfglib_control.h>
+
+static void on_mfglib_control_start_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_mfglib_control_start(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gboolean mfglib_start,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlStart_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
- NOT_USED(mfglib_start);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlStart_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+ req.mfglib_start = ((mfglib_start == TRUE) ? 1 : 0);
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_START,
+ &req, sizeof(req),
+ on_mfglib_control_start_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_mfglib_control_end_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_mfglib_control_end(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlEnd_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlEnd_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_END,
+ &req, sizeof(req),
+ on_mfglib_control_end_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_mfglib_control_start_tone_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_mfglib_control_start_tone(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlStartTone_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlStartTone_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_START_TONE,
+ &req, sizeof(req),
+ on_mfglib_control_start_tone_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_mfglib_control_stop_tone_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_mfglib_control_stop_tone(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlStopTone_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlStopTone_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_STOP_TONE,
+ &req, sizeof(req),
+ on_mfglib_control_stop_tone_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_mfglib_control_start_stream_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_mfglib_control_start_stream(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlStartStream_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlStartStream_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_START_STREAM,
+ &req, sizeof(req),
+ on_mfglib_control_start_stream_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_mfglib_control_stop_stream_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_mfglib_control_stop_stream(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlStopStream_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlStopStream_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_STOP_STREAM,
+ &req, sizeof(req),
+ on_mfglib_control_stop_stream_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_mfglib_control_send_packet_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_mfglib_control_send_packet(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *packet_content,
gint packet_length,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlSendPacket_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(packet_content);
- NOT_USED(packet_length);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlSendPacket_t));
+
+ /* Update request structure */
+ g_variant_get(packet_content, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.packet_content[i])) {
+ i++;
+ if (i >= (guint)packet_length)
+ break;
+ }
+ req.packet_length = packet_length;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_SEND_PACKET,
+ &req, sizeof(req),
+ on_mfglib_control_send_packet_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_mfglib_control_set_channel_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_mfglib_control_set_channel(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gchar channel,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlSetChannel_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
- NOT_USED(channel);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlSetChannel_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+ req.channel = channel;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_SET_CHANNEL,
+ &req, sizeof(req),
+ on_mfglib_control_set_channel_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_mfglib_control_get_channel_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_mfglib_control_get_channel(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlGetChannel_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlGetChannel_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_GET_CHANNEL,
+ &req, sizeof(req),
+ on_mfglib_control_get_channel_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_mfglib_control_set_power_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_mfglib_control_set_power(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
guint power,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlSetPower_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
- NOT_USED(tx_power_mode);
- NOT_USED(power);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlSetPower_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+ req.tx_power_mode = tx_power_mode;
+ req.power = power;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_SET_POWER,
+ &req, sizeof(req),
+ on_mfglib_control_set_power_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_mfglib_control_get_power_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_mfglib_control_get_power(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlGetPower_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlGetPower_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_GET_POWER,
+ &req, sizeof(req),
+ on_mfglib_control_get_power_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_mfglib_control_set_synoffset_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_mfglib_control_set_synoffset(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gchar test_channel,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlSetSynOffset_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
- NOT_USED(test_channel);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlSetSynOffset_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+ req.channel = test_channel;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_SET_SYNOFFSET,
+ &req, sizeof(req),
+ on_mfglib_control_set_synoffset_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_mfglib_control_get_synoffset_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_mfglib_control_get_synoffset(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *packet,
gchar rssi,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlGetSynOffset_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(packet);
- NOT_USED(packet_length);
- NOT_USED(link_quality);
- NOT_USED(rssi);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlGetSynOffset_t));
+
+ /* Update request structure */
+ g_variant_get(packet, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.packet[i])) {
+ i++;
+ if (i >= (guint)packet_length)
+ break;
+ }
+ req.packet_length = packet_length;
+ req.link_quality = link_quality;
+ req.rssi = rssi;
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_GET_SYNOFFSET,
+ &req, sizeof(req),
+ on_mfglib_control_get_synoffset_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_mfglib_control_rx_start_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_mfglib_control_rx_start(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlRxStart_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlRxStart_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_RX_START,
+ &req, sizeof(req),
+ on_mfglib_control_rx_start_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_mfglib_control_rx_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_mfglib_control_rx_stop(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlRxStop_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlRxStop_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_RX_STOP,
+ &req, sizeof(req),
+ on_mfglib_control_rx_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_mfglib_control_rx_verify_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_mfglib_control_rx_verify(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlRxVerify_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlRxVerify_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_RX_VERIFY,
+ &req, sizeof(req),
+ on_mfglib_control_rx_verify_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_mfglib_control_get_rssi_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_mfglib_control_get_rssi(ZigbeeMfglib_control *mfglib_control_object,
GDBusMethodInvocation *invocation,
GVariant *eui64,
gpointer user_data)
{
- ZigBeeService *service = (ZigBeeService *)user_data;
+ ZigBeeServiceInterface *service_interface = (ZigBeeServiceInterface *)user_data;
+ ZigbeeMfglibControlGetRssi_t req;
+ ZigbeeServiceInterfaceRespCbData_t *resp_cb_data = NULL;
- NOT_USED(mfglib_control_object);
- NOT_USED(invocation);
- NOT_USED(service);
- NOT_USED(eui64);
+ GVariantIter *iter = NULL;
+ guint i = 0;
- /*
- * TODO -
- * Create and send request for processing
- */
+ gboolean ret;
+
+ memset(&req, 0x0, sizeof(ZigbeeMfglibControlGetRssi_t));
+
+ /* Update request structure */
+ g_variant_get(eui64, "ay", &iter);
+ while (g_variant_iter_loop(iter, "y", req.eui64[i])) {
+ i++;
+ if (i >= ZIGBEE_EUI64_SIZE)
+ break;
+ }
+
+ /* Allocate response callback data */
+ resp_cb_data =
+ zigbee_service_dbus_interface_create_resp_cb_data(mfglib_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_MFGLIB_CONTROL,
+ ZBLIB_MFGLIB_CONTROL_OPS_GET_RSSI,
+ &req, sizeof(req),
+ on_mfglib_control_get_rssi_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;
}
-gboolean zigbee_service_dbus_interface_mfglib_control_init(ZigBeeService *service,
+gboolean zigbee_service_dbus_interface_mfglib_control_init(ZigBeeServiceInterface *service_interface,
ZigbeeObjectSkeleton *zigbee_object)
{
ZigbeeMfglib_control *mfglib_control_object;
- if (NULL == service) {
- Z_LOGE("service is NULL");
+ if (NULL == service_interface) {
+ Z_LOGE("service_interface is NULL");
return FALSE;
}
*/
g_signal_connect(mfglib_control_object,
"handle-start",
- G_CALLBACK(on_mfglib_control_start), service);
+ G_CALLBACK(on_mfglib_control_start), service_interface);
g_signal_connect(mfglib_control_object,
"handle-end",
- G_CALLBACK(on_mfglib_control_end), service);
+ G_CALLBACK(on_mfglib_control_end), service_interface);
g_signal_connect(mfglib_control_object,
"handle-start-tone",
- G_CALLBACK(on_mfglib_control_start_tone), service);
+ G_CALLBACK(on_mfglib_control_start_tone), service_interface);
g_signal_connect(mfglib_control_object,
"handle-stop-tone",
- G_CALLBACK(on_mfglib_control_stop_tone), service);
+ G_CALLBACK(on_mfglib_control_stop_tone), service_interface);
g_signal_connect(mfglib_control_object,
"handle-start-stream",
- G_CALLBACK(on_mfglib_control_start_stream), service);
+ G_CALLBACK(on_mfglib_control_start_stream), service_interface);
g_signal_connect(mfglib_control_object,
"handle-stop-stream",
- G_CALLBACK(on_mfglib_control_stop_stream), service);
+ G_CALLBACK(on_mfglib_control_stop_stream), service_interface);
g_signal_connect(mfglib_control_object,
"handle-send-packet",
- G_CALLBACK(on_mfglib_control_send_packet), service);
+ G_CALLBACK(on_mfglib_control_send_packet), service_interface);
g_signal_connect(mfglib_control_object,
"handle-set-channel",
- G_CALLBACK(on_mfglib_control_set_channel), service);
+ G_CALLBACK(on_mfglib_control_set_channel), service_interface);
g_signal_connect(mfglib_control_object,
"handle-get-channel",
- G_CALLBACK(on_mfglib_control_get_channel), service);
+ G_CALLBACK(on_mfglib_control_get_channel), service_interface);
g_signal_connect(mfglib_control_object,
"handle-set-power",
- G_CALLBACK(on_mfglib_control_set_power), service);
+ G_CALLBACK(on_mfglib_control_set_power), service_interface);
g_signal_connect(mfglib_control_object,
"handle-get-power",
- G_CALLBACK(on_mfglib_control_get_power), service);
+ G_CALLBACK(on_mfglib_control_get_power), service_interface);
g_signal_connect(mfglib_control_object,
"handle-set-synoffset",
- G_CALLBACK(on_mfglib_control_set_synoffset), service);
+ G_CALLBACK(on_mfglib_control_set_synoffset), service_interface);
g_signal_connect(mfglib_control_object,
"handle-get-synoffset",
- G_CALLBACK(on_mfglib_control_get_synoffset), service);
+ G_CALLBACK(on_mfglib_control_get_synoffset), service_interface);
g_signal_connect(mfglib_control_object,
"handle-rx-start",
- G_CALLBACK(on_mfglib_control_rx_start), service);
+ G_CALLBACK(on_mfglib_control_rx_start), service_interface);
g_signal_connect(mfglib_control_object,
"handle-rx-stop",
- G_CALLBACK(on_mfglib_control_rx_stop), service);
+ G_CALLBACK(on_mfglib_control_rx_stop), service_interface);
g_signal_connect(mfglib_control_object,
"handle-rx-verify",
- G_CALLBACK(on_mfglib_control_rx_verify), service);
+ G_CALLBACK(on_mfglib_control_rx_verify), service_interface);
g_signal_connect(mfglib_control_object,
"handle-get-rssi",
- G_CALLBACK(on_mfglib_control_get_rssi), service);
+ G_CALLBACK(on_mfglib_control_get_rssi), service_interface);
return TRUE;
}