adapted to latest changes in gwen (msgio API v2 becomes v1).

This commit is contained in:
Martin Preuss
2023-07-12 19:30:53 +02:00
parent 7a4edb6854
commit 0fd58567fe
37 changed files with 956 additions and 956 deletions

View File

@@ -13,11 +13,11 @@
#include "./utils.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/endpoint_ipc.h"
#include "aqhome/ipc/msg_ipc_setaccmsggrps.h"
#include "aqhome/ipc/msg_ipc_forward.h"
#include <gwenhywfar/endpoint2_tcpc.h>
#include <gwenhywfar/endpoint_tcpc.h>
#include <gwenhywfar/debug.h>
#include <time.h>
@@ -26,9 +26,9 @@
GWEN_MSG_ENDPOINT2 *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs)
GWEN_MSG_ENDPOINT *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs)
{
GWEN_MSG_ENDPOINT2 *epTcp;
GWEN_MSG_ENDPOINT *epTcp;
const char *tcpAddress;
int tcpPort;
int rv;
@@ -37,15 +37,15 @@ GWEN_MSG_ENDPOINT2 *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs)
tcpPort=GWEN_DB_GetIntValue(dbArgs, "tcpPort", 0, 45454);
DBG_INFO(NULL, "Setup tcp client endpoint to %s:%d", tcpAddress, tcpPort);
epTcp=AQH_IpcEndpoint2_CreateIpcTcpClient(tcpAddress, tcpPort, "aqhome-tool-IPC", 0);
epTcp=AQH_IpcEndpoint_CreateIpcTcpClient(tcpAddress, tcpPort, "aqhome-tool-IPC", 0);
if (epTcp==NULL) {
DBG_ERROR(NULL, "Error creating endpoint TCPc");
return NULL;
}
rv=GWEN_TcpcEndpoint2_StartConnect(epTcp);
rv=GWEN_TcpcEndpoint_StartConnect(epTcp);
if (rv<0 && rv!=GWEN_ERROR_IN_PROGRESS) {
DBG_ERROR(NULL, "Error connecting (%d)", rv);
GWEN_MsgEndpoint2_free(epTcp);
GWEN_MsgEndpoint_free(epTcp);
return NULL;
}
@@ -54,7 +54,7 @@ GWEN_MSG_ENDPOINT2 *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs)
GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT *epTcp,
int msgCode,
int nodeAddr,
int timeoutInSeconds)
@@ -67,8 +67,8 @@ GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *msg;
time_t now;
GWEN_MsgEndpoint2_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint2_TakeFirstReceivedMessage(epTcp);
GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp);
if (msg) {
if (GWEN_IpcMsg_GetCode(msg)==AQH_MSGTYPE_IPC_FORWARD) {
GWEN_MSG *nodeMsg;
@@ -103,7 +103,7 @@ GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT *epTcp,
int msgCode,
int timeoutInSeconds)
{
@@ -115,8 +115,8 @@ GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT2 *epTcp,
GWEN_MSG *msg;
time_t now;
GWEN_MsgEndpoint2_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint2_TakeFirstReceivedMessage(epTcp);
GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */
msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp);
if (msg) {
uint16_t code;
@@ -143,16 +143,16 @@ GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT2 *epTcp,
int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSeconds)
int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds)
{
time_t startTime;
startTime=time(NULL);
while(GWEN_MsgEndpoint2_HaveMessageToSend(epTcp)) {
while(GWEN_MsgEndpoint_HaveMessageToSend(epTcp)) {
time_t now;
GWEN_MsgEndpoint2_IoLoop(epTcp, 2000); /* 2000 ms */
GWEN_MsgEndpoint_IoLoop(epTcp, 2000); /* 2000 ms */
now=time(NULL);
if (now-startTime>timeoutInSeconds) {
DBG_INFO(NULL, "Timeout");
@@ -165,7 +165,7 @@ int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT2 *epTcp, int timeoutInSeconds)
int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *epTcp, uint32_t groups)
int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT *epTcp, uint32_t groups)
{
GWEN_MSG *msgOut;
@@ -174,7 +174,7 @@ int Utils_SendAcceptedMsgGroups(GWEN_MSG_ENDPOINT2 *epTcp, uint32_t groups)
DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
return 0;
}