aqhome-nodes: transformed app to use new event2 interface.

This commit is contained in:
Martin Preuss
2025-03-01 15:21:02 +01:00
parent 72e32847c7
commit 0cfec70025
13 changed files with 1822 additions and 382 deletions

View File

@@ -1,6 +1,6 @@
/****************************************************************************
* This file is part of the project AqHome.
* AqHome (c) by 2023 Martin Preuss, all rights reserved.
* AqHome (c) by 2025 Martin Preuss, all rights reserved.
*
* The license for this file can be found in the file COPYING which you
* should have received along with this file.
@@ -12,14 +12,18 @@
#include "./r_setdata.h"
#include "./aqhomed_p.h"
#include "./server_p.h"
#include "aqhome/aqhome.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_result.h"
#include "aqhome/ipc/data/msg_data_set.h"
#include "aqhome/ipc/data/ipc_data.h"
#include "aqhome/msg/msg_value3.h"
#include "aqhome/data/value.h"
#include "aqhome/msg/ipc/m_ipc.h"
#include "aqhome/msg/ipc/m_ipc_result.h"
#include "aqhome/msg/ipc/m_ipc_tag16.h"
#include "aqhome/msg/ipc/data/m_ipcd.h"
#include "aqhome/msg/ipc/data/m_ipcd_setdata.h"
#include "aqhome/msg/node/m_node.h"
#include "aqhome/msg/node/m_value.h"
#include "aqhome/ipc2/endpoint.h"
#include <gwenhywfar/debug.h>
@@ -40,18 +44,20 @@
* ------------------------------------------------------------------------------------------------
*/
static AQH_NODE_INFO *_getNodeInfoFromValue(AQHOMED *aqh, const AQH_VALUE *value);
static AQH_NODE_INFO *_getNodeInfoFromValue(AQH_NODE_SERVER *xo, const AQH_VALUE *value);
static GWEN_MSG_REQUEST *_mkRequest_SetData(AQHOMED *aqh,
GWEN_MSG_ENDPOINT *ep, uint32_t requestMsgId,
int destAddr, int valueId, uint16_t dataVal, uint16_t dataDenom);
static AQH_MSG_REQUEST *_mkRequest_SetData(AQH_OBJECT *o, AQH_NODE_SERVER *xo,
AQH_OBJECT *ep, uint32_t requestMsgId,
int destAddr, int valueId, uint16_t dataVal, uint16_t dataDenom);
static void _rqSubRequestFinished(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST *subRq, int reason);
static void _rqAbort(GWEN_MSG_REQUEST *rq, int reason);
static void _rqSubRequestFinished(AQH_MSG_REQUEST *rq, AQH_MSG_REQUEST *subRq, int reason);
static void _rqAbort(AQH_MSG_REQUEST *rq, int reason);
static GWEN_MSG_REQUEST *_mkSubRequest_SetData(AQHOMED *aqh, int destAddr, int valueId, uint16_t dataVal, uint16_t dataDenom);
static int _subRqHandleResponse(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg);
static void _subRqAbort(GWEN_MSG_REQUEST *rq, int reason);
static AQH_MSG_REQUEST *_mkSubRequest_SetData(AQH_OBJECT *o, AQH_NODE_SERVER *xo,
int destAddr, int valueId, uint16_t dataVal, uint16_t dataDenom);
static int _subRqHandleResponse(AQH_MSG_REQUEST *rq, const AQH_MESSAGE *msg);
static void _subRqAbort(AQH_MSG_REQUEST *rq, int reason);
static void _sendResponseResultToBroker(AQH_OBJECT *ep, uint32_t refMsgId, int result);
@@ -61,171 +67,182 @@ static void _subRqAbort(GWEN_MSG_REQUEST *rq, int reason);
*/
void AqHomeNodes_HandleSetData(AQHOMED *aqh, GWEN_MSG_ENDPOINT *ep, GWEN_MSG *recvdMsg)
void AQH_NodeServer_HandleSetData(AQH_OBJECT *o, AQH_OBJECT *ep, const AQH_MESSAGE *recvdMsg)
{
uint32_t msgId;
if (o) {
AQH_NODE_SERVER *xo;
DBG_INFO(NULL, "Received IPC SetDataRequest message");
msgId=GWEN_IpcMsg_GetMsgId(recvdMsg);
xo=AQH_NodeServer_GetServerData(o);
if (xo) {
uint32_t msgId;
if (aqh->ttyEndpoint && GWEN_MsgEndpoint_GetState(aqh->ttyEndpoint)==GWEN_MSG_ENDPOINT_STATE_CONNECTED) {
AQH_VALUE *value;
DBG_INFO(NULL, "Received IPC SetDataRequest message");
msgId=AQH_IpcMessage_GetMsgId(recvdMsg);
if (xo->ttyEndpoint) {
GWEN_TAG16_LIST *tagList;
AQH_SetDataIpcMsg_Parse(recvdMsg, 0);
value=AQH_SetDataIpcMsg_ReadValue(recvdMsg);
if (value) {
const char *varName;
tagList=AQH_IpcMessageTag16_ParsePayload(recvdMsg, 0);
if (tagList) {
AQH_VALUE *value;
value=AQH_IpcdMessageSetData_ReadValue(tagList);
if (value) {
const char *varName;
varName=AQH_Value_GetName(value);
if (varName) {
char *data;
varName=AQH_Value_GetName(value);
if (varName) {
char *data;
data=AQH_SetDataIpcMsg_ReadData(recvdMsg);
if (data) {
AQH_NODE_INFO *nodeInfo;
data=AQH_IpcdMessageSetData_ReadData(tagList);
if (data) {
AQH_NODE_INFO *nodeInfo;
nodeInfo=_getNodeInfoFromValue(aqh, value);
if (nodeInfo) {
const char *devName;
nodeInfo=_getNodeInfoFromValue(xo, value);
if (nodeInfo) {
const char *devName;
devName=AQH_NodeInfo_GetDeviceId(nodeInfo);
if (devName) {
const AQHNODE_DEVICE *devInfo;
devName=AQH_NodeInfo_GetDeviceId(nodeInfo);
if (devName) {
const AQHNODE_DEVICE *devInfo;
devInfo=AqHomed_GetDeviceDefByName(aqh, devName);
if (devInfo) {
const AQHNODE_VALUE *devValue;
devInfo=AQH_NodeServer_GetDeviceDefByName(o, devName);
if (devInfo) {
const AQHNODE_VALUE *devValue;
devValue=AQHNODE_Value_List_GetByName(AQHNODE_Device_GetValueList(devInfo), varName);
if (devValue) {
uint16_t dataVal=0;
uint16_t dataDenom=0;
devValue=AQHNODE_Value_List_GetByName(AQHNODE_Device_GetValueList(devInfo), varName);
if (devValue) {
uint16_t dataVal=0;
uint16_t dataDenom=0;
if (AQH_ReadDataFromString(AQHNODE_Value_GetDataType(devValue), data, &dataVal, &dataDenom)==0) {
GWEN_MSG_REQUEST *rq;
int destAddr;
if (AQH_ReadDataFromString(AQHNODE_Value_GetDataType(devValue), data, &dataVal, &dataDenom)==0) {
AQH_MSG_REQUEST *rq;
int destAddr;
destAddr=AQH_NodeInfo_GetBusAddress(nodeInfo);
DBG_DEBUG(NULL, "Creating SETDATA request");
destAddr=AQH_NodeInfo_GetBusAddress(nodeInfo);
DBG_DEBUG(NULL, "Creating SETDATA request");
rq=_mkRequest_SetData(aqh, ep, msgId, destAddr, AQHNODE_Value_GetId(devValue), dataVal, dataDenom);
AqHomed_AddRequestToTree(aqh, rq);
/* done */
rq=_mkRequest_SetData(o, xo, ep, msgId, destAddr, AQHNODE_Value_GetId(devValue), dataVal, dataDenom);
AQH_NodeServer_AddRequestToTree(o, rq);
/* done */
}
else {
DBG_ERROR(NULL, "Bad data \"%s\"", data);
_sendResponseResultToBroker(ep, msgId, AQH_MSGDATA_RESULT_ERROR_BADDATA);
}
}
else {
DBG_ERROR(NULL, "Invalid value name \"%s\"", varName);
_sendResponseResultToBroker(ep, msgId, AQH_MSGDATA_RESULT_ERROR_INVALID);
}
}
else {
DBG_ERROR(NULL, "Unknown node \"%s\"", devName);
_sendResponseResultToBroker(ep, msgId, AQH_MSGDATA_RESULT_ERROR_INVALID);
}
}
else {
DBG_ERROR(NULL, "Bad data \"%s\"", data);
AQH_IpcEndpoint_SendResponseResult(ep, msgId, AQH_MSGTYPE_IPC_DATA_RESULT, AQH_MSG_IPC_ERROR_BADDATA);
DBG_ERROR(NULL, "Node not yet fully identified, come back later");
_sendResponseResultToBroker(ep, msgId, AQH_MSGDATA_RESULT_ERROR_TRYAGAIN);
}
}
else {
DBG_ERROR(NULL, "Invalid value name \"%s\"", varName);
AQH_IpcEndpoint_SendResponseResult(ep, msgId, AQH_MSGTYPE_IPC_DATA_RESULT, AQH_MSG_IPC_ERROR_INVALID);
DBG_ERROR(NULL, "No matching nodeinfo");
_sendResponseResultToBroker(ep, msgId, AQH_MSGDATA_RESULT_ERROR_INVALID);
}
free(data);
}
else {
DBG_ERROR(NULL, "Unknown node \"%s\"", devName);
AQH_IpcEndpoint_SendResponseResult(ep, msgId, AQH_MSGTYPE_IPC_DATA_RESULT, AQH_MSG_IPC_ERROR_INVALID);
DBG_ERROR(NULL, "No data");
_sendResponseResultToBroker(ep, msgId, AQH_MSGDATA_RESULT_ERROR_NODATA);
}
}
else {
DBG_ERROR(NULL, "Node not yet fully identified, come back later");
AQH_IpcEndpoint_SendResponseResult(ep, msgId, AQH_MSGTYPE_IPC_DATA_RESULT, AQH_MSG_IPC_ERROR_TRYAGAIN);
DBG_ERROR(NULL, "No var name");
_sendResponseResultToBroker(ep, msgId, AQH_MSGDATA_RESULT_ERROR_NODATA);
}
AQH_Value_free(value);
}
else {
DBG_ERROR(NULL, "No matching nodeinfo");
AQH_IpcEndpoint_SendResponseResult(ep, msgId, AQH_MSGTYPE_IPC_DATA_RESULT, AQH_MSG_IPC_ERROR_INVALID);
DBG_ERROR(NULL, "Could not read value from message");
}
free(data);
}
else {
DBG_ERROR(NULL, "No data");
AQH_IpcEndpoint_SendResponseResult(ep, msgId, AQH_MSGTYPE_IPC_DATA_RESULT, AQH_MSG_IPC_ERROR_NODATA);
GWEN_Tag16_List_free(tagList);
}
}
else {
DBG_ERROR(NULL, "No var name");
AQH_IpcEndpoint_SendResponseResult(ep, msgId, AQH_MSGTYPE_IPC_DATA_RESULT, AQH_MSG_IPC_ERROR_NODATA);
DBG_ERROR(NULL, "TTY endpoint not connected");
_sendResponseResultToBroker(ep, msgId, AQH_MSGDATA_RESULT_ERROR_IO);
}
AQH_Value_free(value);
}
else {
DBG_ERROR(NULL, "Could not read value from message");
}
}
else {
DBG_ERROR(NULL, "TTY endpoint not connected");
AQH_IpcEndpoint_SendResponseResult(ep, msgId, AQH_MSGTYPE_IPC_DATA_RESULT, AQH_MSG_IPC_ERROR_IO);
}
}
/* ------------------------------------------------------------------------------------------------
* IPC Request SETDATA
*/
GWEN_MSG_REQUEST *_mkRequest_SetData(AQHOMED *aqh,
GWEN_MSG_ENDPOINT *ep, uint32_t requestMsgId,
int destAddr, int valueId, uint16_t dataVal, uint16_t dataDenom)
AQH_MSG_REQUEST *_mkRequest_SetData(AQH_OBJECT *o, AQH_NODE_SERVER *xo,
AQH_OBJECT *ep, uint32_t requestMsgId,
int destAddr, int valueId, uint16_t dataVal, uint16_t dataDenom)
{
GWEN_MSG_REQUEST *rq;
GWEN_MSG_REQUEST *subRq;
AQH_MSG_REQUEST *rq;
AQH_MSG_REQUEST *subRq;
rq=GWEN_MsgRequest_new();
GWEN_MsgRequest_SetPrivateData(rq, aqh);
GWEN_MsgRequest_SetEndpoint(rq, ep);
GWEN_MsgRequest_SetRequestMsgId(rq, requestMsgId);
GWEN_MsgRequest_SetSubRequestFinishedFn(rq, _rqSubRequestFinished);
GWEN_MsgRequest_SetAbortFn(rq, _rqAbort);
GWEN_MsgRequest_SetTimestamps(rq, R_SETDATA_REQUEST_EXPIRE_SECS);
rq=AQH_MsgRequest_new();
AQH_MsgRequest_SetPrivateData(rq, o);
AQH_MsgRequest_SetEndpoint(rq, ep);
AQH_MsgRequest_SetRequestMsgId(rq, requestMsgId);
AQH_MsgRequest_SetSubRequestFinishedFn(rq, _rqSubRequestFinished);
AQH_MsgRequest_SetAbortFn(rq, _rqAbort);
AQH_MsgRequest_SetTimestamps(rq, R_SETDATA_REQUEST_EXPIRE_SECS);
subRq=_mkSubRequest_SetData(aqh, destAddr, valueId, dataVal, dataDenom);
GWEN_MsgRequest_Tree2_AddChild(rq, subRq);
subRq=_mkSubRequest_SetData(o, xo, destAddr, valueId, dataVal, dataDenom);
AQH_MsgRequest_Tree2_AddChild(rq, subRq);
return rq;
}
void _rqSubRequestFinished(GWEN_MSG_REQUEST *rq, GWEN_MSG_REQUEST *subRq, int reason)
void _rqSubRequestFinished(AQH_MSG_REQUEST *rq, AQH_MSG_REQUEST *subRq, int reason)
{
GWEN_MSG_ENDPOINT *ep;
AQH_OBJECT *ep;
uint32_t refMsgId;
int result;
DBG_INFO(NULL, "SubRequest finished (reason: %d)", reason);
refMsgId=GWEN_MsgRequest_GetRequestMsgId(rq);
ep=GWEN_MsgRequest_GetEndpoint(rq);
result=GWEN_MsgRequest_GetResult(subRq);
refMsgId=AQH_MsgRequest_GetRequestMsgId(rq);
ep=AQH_MsgRequest_GetEndpoint(rq);
result=AQH_MsgRequest_GetResult(subRq);
if (reason==GWEN_MSG_REQUEST_REASON_ABORTED)
AQH_IpcEndpoint_SendResponseResult(ep, refMsgId, AQH_MSGTYPE_IPC_DATA_RESULT, AQH_MSG_IPC_ERROR_GENERIC);
if (reason==AQH_MSG_REQUEST_REASON_ABORTED)
_sendResponseResultToBroker(ep, refMsgId, AQH_MSGDATA_RESULT_ERROR_GENERIC);
else
AQH_IpcEndpoint_SendResponseResult(ep, refMsgId, AQH_MSGTYPE_IPC_DATA_RESULT, result);
_sendResponseResultToBroker(ep, refMsgId, result);
GWEN_MsgRequest_SetResult(rq, result);
GWEN_MsgRequest_SetState(rq, GWEN_MSG_REQUEST_STATE_DONE);
AQH_MsgRequest_SetResult(rq, result);
AQH_MsgRequest_SetState(rq, AQH_MSG_REQUEST_STATE_DONE);
}
void _rqAbort(GWEN_MSG_REQUEST *rq, int reason)
void _rqAbort(AQH_MSG_REQUEST *rq, int reason)
{
GWEN_MSG_ENDPOINT *ep;
AQH_OBJECT *ep;
uint32_t refMsgId;
GWEN_MSG_REQUEST *rqParent;
AQH_MSG_REQUEST *rqParent;
DBG_INFO(NULL, "Aborting request");
refMsgId=GWEN_MsgRequest_GetRequestMsgId(rq);
ep=GWEN_MsgRequest_GetEndpoint(rq);
AQH_IpcEndpoint_SendResponseResult(ep, refMsgId, AQH_MSGTYPE_IPC_DATA_RESULT, AQH_MSG_IPC_ERROR_GENERIC);
GWEN_MsgRequest_SetState(rq, GWEN_MSG_REQUEST_STATE_DONE);
refMsgId=AQH_MsgRequest_GetRequestMsgId(rq);
ep=AQH_MsgRequest_GetEndpoint(rq);
_sendResponseResultToBroker(ep, refMsgId, AQH_MSGDATA_RESULT_ERROR_GENERIC);
AQH_MsgRequest_SetState(rq, AQH_MSG_REQUEST_STATE_DONE);
rqParent=GWEN_MsgRequest_Tree2_GetParent(rq);
rqParent=AQH_MsgRequest_Tree2_GetParent(rq);
if (rqParent)
GWEN_MsgRequest_SubRequestFinished(rqParent, rq, reason);
AQH_MsgRequest_SubRequestFinished(rqParent, rq, reason);
}
@@ -238,91 +255,100 @@ void _rqAbort(GWEN_MSG_REQUEST *rq, int reason)
*/
GWEN_MSG_REQUEST *_mkSubRequest_SetData(AQHOMED *aqh, int destAddr, int valueId, uint16_t dataVal, uint16_t dataDenom)
AQH_MSG_REQUEST *_mkSubRequest_SetData(AQH_OBJECT *o, AQH_NODE_SERVER *xo,
int destAddr, int valueId, uint16_t dataVal, uint16_t dataDenom)
{
GWEN_MSG_REQUEST *rq;
AQH_MSG_REQUEST *rq;
uint16_t msgId;
GWEN_MSG *msgOut;
AQH_MESSAGE *msgOut;
rq=GWEN_MsgRequest_new();
GWEN_MsgRequest_SetPrivateData(rq, aqh);
GWEN_MsgRequest_SetEndpoint(rq, aqh->ttyEndpoint);
rq=AQH_MsgRequest_new();
AQH_MsgRequest_SetPrivateData(rq, o);
AQH_MsgRequest_SetEndpoint(rq, xo->ttyEndpoint);
GWEN_MsgRequest_SetHandleResponseFn(rq, _subRqHandleResponse);
GWEN_MsgRequest_SetAbortFn(rq, _subRqAbort);
AQH_MsgRequest_SetHandleResponseFn(rq, _subRqHandleResponse);
AQH_MsgRequest_SetAbortFn(rq, _subRqAbort);
msgId=GWEN_MsgEndpoint_GetNextMessageId(aqh->ttyEndpoint) & 0xffff;
GWEN_MsgRequest_SetRequestMsgId(rq, msgId);
GWEN_MsgRequest_SetTimestamps(rq, R_SETDATA_SUBREQUEST_EXPIRE_SECS);
msgId=AQH_Endpoint_GetNextMessageId(xo->ttyEndpoint) & 0xffff;
AQH_MsgRequest_SetRequestMsgId(rq, msgId);
AQH_MsgRequest_SetTimestamps(rq, R_SETDATA_SUBREQUEST_EXPIRE_SECS);
msgOut=AQH_Value3Msg_new(aqh->nodeAddress, destAddr, AQH_MSG_TYPE_VALUE_SET, msgId, valueId, dataVal, dataDenom);
GWEN_MsgEndpoint_AddSendMessage(aqh->ttyEndpoint, msgOut);
msgOut=AQH_ValueMessage_new(xo->nodeAddress, destAddr, AQH_MSG_TYPE_VALUE_SET, msgId, valueId, dataVal, dataDenom);
AQH_Endpoint_AddMsgOut(xo->ttyEndpoint, msgOut);
return rq;
}
int _subRqHandleResponse(GWEN_MSG_REQUEST *rq, GWEN_MSG *msg)
int _subRqHandleResponse(AQH_MSG_REQUEST *rq, const AQH_MESSAGE *msg)
{
AQHOMED *aqh;
uint8_t destAddr;
AQH_OBJECT *o;
DBG_DEBUG(NULL, "Checking message from %02x", AQH_NodeMsg_GetSourceAddress(msg));
aqh=(AQHOMED*)GWEN_MsgRequest_GetPrivateData(rq);
DBG_DEBUG(NULL, "Checking message from %02x", AQH_NodeMessage_GetSourceAddress(msg));
o=(AQH_OBJECT*)AQH_MsgRequest_GetPrivateData(rq);
if (o) {
AQH_NODE_SERVER *xo;
destAddr=AQH_NodeMsg_GetDestAddress(msg);
if (destAddr==0xff || destAddr==aqh->nodeAddress) {
uint8_t msgCode;
xo=AQH_NodeServer_GetServerData(o);
if (xo) {
uint8_t destAddr;
msgCode=AQH_NodeMsg_GetMsgType(msg);
if (msgCode==AQH_MSG_TYPE_VALUE_SET_ACK || msgCode==AQH_MSG_TYPE_VALUE_SET_NACK) {
uint16_t msgId;
destAddr=AQH_NodeMessage_GetDestAddress(msg);
if (destAddr==0xff || destAddr==xo->nodeAddress) {
uint8_t msgCode;
msgId=AQH_Value3Msg_GetMsgId(msg);
if (msgId==GWEN_MsgRequest_GetRequestMsgId(rq)) {
GWEN_MSG_REQUEST *rqParent;
msgCode=AQH_NodeMessage_GetMsgType(msg);
if (msgCode==AQH_MSG_TYPE_VALUE_SET_ACK || msgCode==AQH_MSG_TYPE_VALUE_SET_NACK) {
uint16_t msgId;
DBG_INFO(NULL,
"Received response (%02x) for msg id %04x from %02x",
msgCode, msgId, AQH_NodeMsg_GetSourceAddress(msg));
GWEN_MsgRequest_SetResult(rq, (msgCode==AQH_MSG_TYPE_VALUE_SET_ACK)?AQH_MSG_IPC_SUCCESS:AQH_MSG_IPC_ERROR_GENERIC);
GWEN_MsgRequest_SetState(rq, GWEN_MSG_REQUEST_STATE_DONE);
rqParent=GWEN_MsgRequest_Tree2_GetParent(rq);
if (rqParent)
GWEN_MsgRequest_SubRequestFinished(rqParent, rq, GWEN_MSG_REQUEST_REASON_DONE);
return GWEN_MSG_REQUEST_RESULT_HANDLED;
msgId=AQH_ValueMessage_GetMsgId(msg);
if (msgId==AQH_MsgRequest_GetRequestMsgId(rq)) {
AQH_MSG_REQUEST *rqParent;
DBG_INFO(NULL,
"Received response (%02x) for msg id %04x from %02x",
msgCode, msgId, AQH_NodeMessage_GetSourceAddress(msg));
AQH_MsgRequest_SetResult(rq,
(msgCode==AQH_MSG_TYPE_VALUE_SET_ACK)?AQH_MSGDATA_RESULT_SUCCESS:AQH_MSGDATA_RESULT_ERROR_GENERIC);
AQH_MsgRequest_SetState(rq, AQH_MSG_REQUEST_STATE_DONE);
rqParent=AQH_MsgRequest_Tree2_GetParent(rq);
if (rqParent)
AQH_MsgRequest_SubRequestFinished(rqParent, rq, AQH_MSG_REQUEST_REASON_DONE);
return AQH_MSG_REQUEST_RESULT_HANDLED;
}
else {
DBG_INFO(NULL, " Non-matching message id");
}
}
else {
DBG_INFO(NULL, " Non-matching message code");
}
}
else {
DBG_INFO(NULL, " Non-matching message id");
}
}
else {
DBG_INFO(NULL, " Non-matching message code");
}
}
return GWEN_MSG_REQUEST_RESULT_NOT_HANDLED;
return AQH_MSG_REQUEST_RESULT_NOT_HANDLED;
}
void _subRqAbort(GWEN_MSG_REQUEST *rq, int reason)
void _subRqAbort(AQH_MSG_REQUEST *rq, int reason)
{
GWEN_MSG_REQUEST *rqParent;
AQH_MSG_REQUEST *rqParent;
DBG_INFO(NULL, "Aborting request");
GWEN_MsgRequest_SetResult(rq, AQH_MSG_IPC_ERROR_GENERIC);
GWEN_MsgRequest_SetState(rq, GWEN_MSG_REQUEST_STATE_DONE);
AQH_MsgRequest_SetResult(rq, AQH_MSGDATA_RESULT_ERROR_GENERIC);
AQH_MsgRequest_SetState(rq, AQH_MSG_REQUEST_STATE_DONE);
rqParent=GWEN_MsgRequest_Tree2_GetParent(rq);
rqParent=AQH_MsgRequest_Tree2_GetParent(rq);
if (rqParent)
GWEN_MsgRequest_SubRequestFinished(rqParent, rq, reason);
AQH_MsgRequest_SubRequestFinished(rqParent, rq, reason);
}
AQH_NODE_INFO *_getNodeInfoFromValue(AQHOMED *aqh, const AQH_VALUE *value)
AQH_NODE_INFO *_getNodeInfoFromValue(AQH_NODE_SERVER *xo, const AQH_VALUE *value)
{
const char *s;
unsigned long int uid;
@@ -331,7 +357,7 @@ AQH_NODE_INFO *_getNodeInfoFromValue(AQHOMED *aqh, const AQH_VALUE *value)
if (s && *s && 1==sscanf(s, "%lx", &uid)) {
AQH_NODE_INFO *ni;
ni=AQH_NodeDb_GetNodeInfoByUid(aqh->nodeDb, uid);
ni=AQH_NodeDb_GetNodeInfoByUid(xo->nodeDb, uid);
if (ni==NULL) {
DBG_ERROR(NULL, "Node \"%08lx\" not found", uid);
return NULL;
@@ -342,3 +368,15 @@ AQH_NODE_INFO *_getNodeInfoFromValue(AQHOMED *aqh, const AQH_VALUE *value)
}
void _sendResponseResultToBroker(AQH_OBJECT *ep, uint32_t refMsgId, int result)
{
AQH_MESSAGE *msg;
msg=AQH_IpcMessageResult_new(AQH_IPC_PROTOCOL_DATA_ID, AQH_IPC_PROTOCOL_DATA_VERSION, AQH_MSGTYPE_IPC_DATA_RESULT,
AQH_Endpoint_GetNextMessageId(ep), refMsgId, result, NULL);
AQH_Endpoint_AddMsgOut(ep, msg);
}