aqhome: completed adapting to msgio2 interface.

This commit is contained in:
Martin Preuss
2023-07-12 13:33:04 +02:00
parent 39987b31c7
commit 08c3875a26
66 changed files with 1765 additions and 3914 deletions

View File

@@ -16,7 +16,7 @@
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h"
#include "aqhome/ipc/msg_ipc_ping.h"
#include "aqhome/ipc/msg_ipc_forward.h"
#include "aqhome/ipc/endpoint_ipc_tcpc.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/msg/msg_node.h"
#include <gwenhywfar/args.h>
@@ -35,7 +35,7 @@
static int _doPing(GWEN_DB_NODE *dbArgs);
static int _sendPing(GWEN_MSG_ENDPOINT *epTcp, int nodeAddr);
static int _sendPing(GWEN_MSG_ENDPOINT2 *epTcp, int nodeAddr);
@@ -130,21 +130,17 @@ int AQH_Tool_Ping(GWEN_DB_NODE *dbGlobalArgs, int argc, char **argv)
int _doPing(GWEN_DB_NODE *dbArgs)
{
GWEN_MSG_ENDPOINT_MGR *emgr;
GWEN_MSG_ENDPOINT *epTcp;
GWEN_MSG_ENDPOINT2 *epTcp;
int rv;
int nodeAddr;
int timeoutInSeconds;
GWEN_MSG *msg;
emgr=GWEN_MsgEndpointMgr_new();
epTcp=Utils_SetupIpcEndpoint(emgr, dbArgs);
epTcp=Utils_SetupIpcEndpoint(dbArgs);
if (epTcp==NULL) {
DBG_ERROR(NULL, "ERROR creating TCP connection");
return 2;
}
GWEN_MsgEndpointMgr_AddEndpoint(emgr, epTcp);
nodeAddr=GWEN_DB_GetIntValue(dbArgs, "nodeAddr", 0, 0);
timeoutInSeconds=GWEN_DB_GetIntValue(dbArgs, "timeout", 0, 5);
@@ -163,21 +159,20 @@ int _doPing(GWEN_DB_NODE *dbArgs)
return 2;
}
msg=Utils_WaitForSpecificNodeMessage(emgr, epTcp, AQH_MSG_TYPE_PONG, nodeAddr, timeoutInSeconds);
msg=Utils_WaitForSpecificNodeMessage(epTcp, AQH_MSG_TYPE_PONG, nodeAddr, timeoutInSeconds);
if (msg==NULL) {
DBG_INFO(NULL, "No PONG response received.");
GWEN_MsgEndpointMgr_free(emgr);
return 2;
}
fprintf(stdout, "PONG response received\n");
GWEN_MsgEndpointMgr_free(emgr);
GWEN_MsgEndpoint2_free(epTcp);
return 0;
}
int _sendPing(GWEN_MSG_ENDPOINT *epTcp, int nodeAddr)
int _sendPing(GWEN_MSG_ENDPOINT2 *epTcp, int nodeAddr)
{
GWEN_MSG *msgOut;
@@ -186,7 +181,7 @@ int _sendPing(GWEN_MSG_ENDPOINT *epTcp, int nodeAddr)
DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
return 0;
}