more work on new events2-based apps.

This commit is contained in:
Martin Preuss
2025-03-11 00:56:18 +01:00
parent 9cca3af402
commit 263ce00a14
11 changed files with 135 additions and 24 deletions

View File

@@ -251,7 +251,7 @@ int AQH_ToolClient_Run(AQH_OBJECT *o)
if (xo) {
int rv;
rv=AQH_ToolClient_Connect(o, 0, xo->flags, 0);
rv=AQH_ToolClient_Connect(o, xo->flags, 0, 0);
if (rv<0) {
DBG_ERROR(NULL, "Error connecting (%d)", rv);
return 2;
@@ -397,6 +397,7 @@ int _exchangeConnectMsgs(AQH_TOOL_CLIENT *xo, uint32_t flags)
userId=GWEN_DB_GetCharValue(xo->dbLocalArgs, "userId", 0, NULL);
passw=GWEN_DB_GetCharValue(xo->dbLocalArgs, "password", 0, NULL);
DBG_ERROR(NULL, "Sending connect message for proto=%d.%d", xo->protoId, xo->protoVer);
msgId=AQH_Endpoint_GetNextMessageId(xo->ipcEndpoint);
msgOut=AQH_IpcMessageConnect_new(xo->protoId, xo->protoVer,
AQH_MSGTYPE_IPC_CONNECT_REQ,
@@ -492,7 +493,7 @@ AQH_MESSAGE *AQH_ToolClient_WaitForNodeMsg(AQH_OBJECT *o, int nodeSrcAddr, uint8
}
}
else {
DBG_ERROR(NULL, "Received unexpected message %d (%x), ignoring", code, code);
DBG_INFO(NULL, "Received unexpected message %d (%x), ignoring", code, code);
}
GWEN_Tag16_List_free(tagList);
}
@@ -543,7 +544,6 @@ int _sendWaitAndHandle(AQH_OBJECT *o, AQH_TOOL_CLIENT *xo)
return 2;
}
AQH_Endpoint_AddMsgOut(xo->ipcEndpoint, msgOut);
return _waitAndHandle(o, xo, msgId);
}
@@ -630,7 +630,7 @@ int _nodesWaitAndHandle(AQH_OBJECT *o, AQH_TOOL_CLIENT *xo)
if (msgIn) {
int rv;
DBG_ERROR(NULL, "Handling node message %d", AQH_NodeMessage_GetMsgType(msgIn));
DBG_INFO(NULL, "Handling node message %d", AQH_NodeMessage_GetMsgType(msgIn));
rv=_handleNodeResponseMessage(o, msgIn, first);
AQH_Message_free(msgIn);
first=0;
@@ -639,7 +639,7 @@ int _nodesWaitAndHandle(AQH_OBJECT *o, AQH_TOOL_CLIENT *xo)
return 3;
}
else if (rv==1) {
DBG_ERROR(NULL, "Done.");
DBG_INFO(NULL, "Done.");
return 0;
}
}

View File

@@ -79,8 +79,7 @@ int AQH_Tool_GetNodes(GWEN_DB_NODE *dbGlobalArgs, int argc, char **argv)
eventLoop=AQH_EventLoop_new();
o=AQH_ToolClient_new(eventLoop, AQH_IPC_PROTOCOL_NODES_ID, AQH_IPC_PROTOCOL_NODES_VERSION, dbGlobalArgs, args);
AQH_ToolClient_SetFlags(o, AQH_TOOL_CLIENT_CONNECTFLAGS_WITHCONNECTMSG | AQH_TOOL_CLIENT_CONNECTFLAGS_WITHGRPMSG);
AQH_ToolClient_SetAcceptedGroups(o, AQH_MSG_TYPEGROUP_ALL);
AQH_ToolClient_SetFlags(o, AQH_TOOL_CLIENT_CONNECTFLAGS_WITHCONNECTMSG);
AQH_ToolClient_SetCreateRequestMessageFn(o, _createRequestMessage);
AQH_ToolClient_SetHandleResponseMessageFn(o, _handleResponseMessage);
@@ -141,7 +140,7 @@ void _printNode(const AQH_NODE_INFO *ni)
uint32_t u;
const GWEN_TIMESTAMP *ts;
fprintf(stdout, "- node: addr=%d, uid=0x%08x, device=",
fprintf(stdout, "- node: addr=%3d, uid=0x%08x, device=",
AQH_NodeInfo_GetBusAddress(ni),
(unsigned int) AQH_NodeInfo_GetUid(ni));
ts=AQH_NodeInfo_GetTimestampLastChange(ni);

View File

@@ -128,7 +128,7 @@ int _handleResponseMessage(AQH_OBJECT *o, const AQH_MESSAGE *msg, GWEN_UNUSED co
return 1;
}
else {
DBG_ERROR(NULL, "Unexpected message \"%d\"", code);
DBG_INFO(NULL, "Unexpected message \"%d\"", code);
return 0;
}