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

@@ -13,10 +13,10 @@
#include "./getdevices.h"
#include "./utils.h"
#include "aqhome/ipc/endpoint2_ipc.h"
#include "aqhome/ipc/msg_ipc_getdevices_req.h"
#include "aqhome/ipc/msg_ipc_getdevices_rsp.h"
#include "aqhome/ipc/msg_ipc_error.h"
#include "aqhome/ipc/endpoint_ipc_tcpc.h"
#include "aqhome/msg/msg_node.h"
#include <gwenhywfar/args.h>
@@ -35,7 +35,7 @@
static int _doGetDevices(GWEN_DB_NODE *dbArgs);
static int _sendGetDevices(GWEN_MSG_ENDPOINT *epTcp);
static int _sendGetDevices(GWEN_MSG_ENDPOINT2 *epTcp);
@@ -119,19 +119,15 @@ int AQH_Tool_GetDevices(GWEN_DB_NODE *dbGlobalArgs, int argc, char **argv)
int _doGetDevices(GWEN_DB_NODE *dbArgs)
{
GWEN_MSG_ENDPOINT_MGR *emgr;
GWEN_MSG_ENDPOINT *epTcp;
GWEN_MSG_ENDPOINT2 *epTcp;
int rv;
int timeoutInSeconds;
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);
timeoutInSeconds=GWEN_DB_GetIntValue(dbArgs, "timeout", 0, 5);
@@ -151,10 +147,10 @@ int _doGetDevices(GWEN_DB_NODE *dbArgs)
GWEN_MSG *msg;
uint16_t code;
msg=Utils_WaitForSpecificIpcMessage(emgr, epTcp, AQH_MSGTYPE_IPC_GETDEVICES_RSP, timeoutInSeconds);
msg=Utils_WaitForSpecificIpcMessage(epTcp, AQH_MSGTYPE_IPC_GETDEVICES_RSP, timeoutInSeconds);
if (msg==NULL) {
DBG_INFO(NULL, "No GET_DEVICE response received.");
GWEN_MsgEndpointMgr_free(emgr);
GWEN_MsgEndpoint2_free(epTcp);
return 2;
}
code=GWEN_IpcMsg_GetCode(msg);
@@ -201,13 +197,13 @@ int _doGetDevices(GWEN_DB_NODE *dbArgs)
}
}
GWEN_MsgEndpointMgr_free(emgr);
GWEN_MsgEndpoint2_free(epTcp);
return 0;
}
int _sendGetDevices(GWEN_MSG_ENDPOINT *epTcp)
int _sendGetDevices(GWEN_MSG_ENDPOINT2 *epTcp)
{
GWEN_MSG *msgOut;
@@ -216,7 +212,7 @@ int _sendGetDevices(GWEN_MSG_ENDPOINT *epTcp)
DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_MsgEndpoint2_AddSendMessage(epTcp, msgOut);
return 0;
}