implemented ipc messages getdevices req/rsp

This commit is contained in:
Martin Preuss
2023-04-22 19:13:59 +02:00
parent 1893d50908
commit 5f7e192e27
16 changed files with 782 additions and 4 deletions

View File

@@ -93,6 +93,47 @@ GWEN_MSG *Utils_WaitForSpecificNodeMessage(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_MSG
GWEN_MSG *Utils_WaitForSpecificIpcMessage(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_MSG_ENDPOINT *epTcp,
int msgCode,
int timeoutInSeconds)
{
time_t startTime;
startTime=time(NULL);
for (;;) {
GWEN_MSG *msg;
time_t now;
GWEN_MsgEndpointMgr_RunAllEndpoints(emgr);
GWEN_MsgEndpointMgr_IoLoopOnce(emgr);
msg=GWEN_MsgEndpoint_TakeFirstReceivedMessage(epTcp);
if (msg) {
uint16_t code;
code=GWEN_IpcMsg_GetCode(msg);
if (code==msgCode) {
DBG_INFO(NULL, "Received expected IPC message");
return msg;
}
else if (code==AQH_MSGTYPE_IPC_ERROR) {
DBG_INFO(NULL, "Received IPC error message");
return msg;
}
GWEN_Msg_free(msg);
}
now=time(NULL);
if (now-startTime>timeoutInSeconds) {
DBG_INFO(NULL, "Timeout");
break;
}
}
return NULL;
}
int Utils_FlushOutMessageQueue(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_MSG_ENDPOINT *epTcp, int timeoutInSeconds)
{
time_t startTime;