+void zigbee_service_dbus_interface_custom_notification(ZigBeeServiceInterface *service_interface,
+ guint noti_id, gpointer noti_data, guint noti_data_len, gpointer noti_cb_data)
+{
+ ZigbeeCustom *custom_object;
+
+ zblib_check_null_ret("service_interface", service_interface);
+
+ if (NULL == noti_data || 0 == noti_data_len) {
+ Z_LOGE("noti_data=%p or noti_data_len=%d is null", noti_data, noti_data_len);
+ return;
+ }
+
+ custom_object = _service_interface_ref_zigbee_custom(service_interface);
+ zblib_check_null_ret("custom_object", custom_object);
+
+ NOT_USED(noti_cb_data);
+
+ switch (noti_id) {
+ case ZBLIB_CUSTOM_NOTI_APS_SEND: {
+ int i;
+ GVariant* payload = NULL;
+ GVariantBuilder *attr_builder = NULL;
+ ZigbeeCustomApsSendNoti_t *rsp = (ZigbeeCustomApsSendNoti_t*)noti_data;
+
+ Z_LOGD("'aps_send_rsp' from : [0x%X]", rsp->node_id);
+
+ Z_LOGD("rsp->node_id=%x", rsp->node_id);
+ Z_LOGD("rsp->src_ep = %x", rsp->src_ep);
+ Z_LOGD("rsp->dest_ep = %x", rsp->dest_ep);
+ Z_LOGD("rsp->cluster_id = %x", rsp->cluster_id);
+ Z_LOGD("rsp->profile_id = %x", rsp->profile_id);
+ Z_LOGD("rsp->cmd_id = %x", rsp->cmd_id);
+ Z_LOGD("rsp->payload_len = %x", rsp->payload_len);
+
+ attr_builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+ for (i = 0; i < rsp->payload_len; i++) {
+ g_variant_builder_add(attr_builder, "(y)", rsp->payload[i]);
+ Z_LOGD("rsp->payload[%d] = %x", i, rsp->payload[i]);
+ }
+ payload = g_variant_builder_end(attr_builder);
+ g_variant_builder_unref(attr_builder);
+
+ zigbee_custom_emit_aps_send_rsp(custom_object, rsp->node_id, rsp->src_ep,
+ rsp->dest_ep, rsp->cluster_id, rsp->profile_id, rsp->payload_len,
+ payload);
+ }
+ break;
+ case ZBLIB_CUSTOM_NOTI_ZCL_SEND: {
+ int i;
+ GVariant* payload = NULL;
+ GVariantBuilder *attr_builder = NULL;
+ ZigbeeCustomZclSendNoti_t *rsp = (ZigbeeCustomZclSendNoti_t*)noti_data;
+
+ Z_LOGD("'zcl_send_rsp' from : [0x%X]", rsp->node_id);
+
+ Z_LOGD("rsp->node_id=%x", rsp->node_id);
+ Z_LOGD("rsp->src_ep = %x", rsp->src_ep);
+ Z_LOGD("rsp->dest_ep = %x", rsp->dest_ep);
+ Z_LOGD("rsp->cluster_id = %x", rsp->cluster_id);
+ Z_LOGD("rsp->profile_id = %x", rsp->profile_id);
+ Z_LOGD("rsp->cmd_id = %x", rsp->cmd_id);
+ Z_LOGD("rsp->payload_len = %x", rsp->payload_len);
+
+ attr_builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+ for (i = 0; i < rsp->payload_len; i++) {
+ g_variant_builder_add(attr_builder, "(y)", rsp->payload[i]);
+ Z_LOGD("rsp->payload[%d] = %x", i, rsp->payload[i]);
+ }
+ payload = g_variant_builder_end(attr_builder);
+ g_variant_builder_unref(attr_builder);
+
+ zigbee_custom_emit_zcl_send_rsp(custom_object, rsp->node_id, rsp->src_ep,
+ rsp->dest_ep, rsp->cluster_id, rsp->profile_id, rsp->payload_len, payload);
+ }
+ break;
+ case ZBLIB_CUSTOM_NOTI_SEND_TO_LOCAL: {
+ int i;
+ GVariant* data = NULL;
+ GVariantBuilder *attr_builder = NULL;
+ ZigbeeCustomSendToLocalNoti_t *rsp = (ZigbeeCustomSendToLocalNoti_t*)noti_data;
+
+ Z_LOGD("'send_to_local_rsp' length : [0x%X]", rsp->length);
+
+ attr_builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+ for (i = 0; i < rsp->length; i++) {
+ g_variant_builder_add(attr_builder, "(y)", rsp->data[i]);
+ Z_LOGD("rsp->data[%d] = %x", i, rsp->data[i]);
+ }
+ data = g_variant_builder_end(attr_builder);
+ g_variant_builder_unref(attr_builder);
+
+ zigbee_custom_emit_send_to_local_rsp(custom_object, rsp->length, data);
+
+ if (data) g_variant_unref(data);
+ }
+ break;
+ default:
+ Z_LOGE("Unexpected notification [%x]", noti_id);
+ break;
+ }
+
+ /* ZigbeeCustom should be dereferenced */
+ g_object_unref(custom_object);
+}
+