adapted to latest changes in gwen.

This commit is contained in:
Martin Preuss
2023-03-30 00:41:06 +02:00
parent 2417c46638
commit 9ae7a8032e
3 changed files with 26 additions and 7 deletions

View File

@@ -170,11 +170,17 @@ GWEN_MSG_ENDPOINT_MGR *_setupService(GWEN_DB_NODE *dbArgs)
{
GWEN_MSG_ENDPOINT_MGR *emgr;
int nodeAddress;
const char *dbfile;
int rv;
nodeAddress=GWEN_DB_GetIntValue(dbArgs, "nodeAddress", 0, 240);
dbfile=GWEN_DB_GetCharValue(dbArgs, "dbfile", 0, "aqhome.db");
emgr=AQH_MsgManager_new(nodeAddress & 0xff);
if (dbfile && *dbfile)
AQH_MsgManager_SetDbFilename(emgr, dbfile);
rv=_setupTty(emgr, dbArgs);
if (rv<0) {
DBG_INFO(NULL, "here (%d)", rv);
@@ -221,6 +227,7 @@ int _setupTty(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs)
DBG_ERROR(NULL, "Error creating endpoint TTY");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint_SetAcceptedGroupIds(epTty, AQH_MSGMGR_ENDPOINTGROUP_NODE);
GWEN_MsgEndpointMgr_AddEndpoint(emgr, epTty);
}
else {
@@ -246,6 +253,7 @@ int _setupLog(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs)
DBG_ERROR(AQH_LOGDOMAIN, "Error creating endpoint LOG");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint_SetAcceptedGroupIds(epLog, AQH_MSGMGR_ENDPOINTGROUP_NODE);
GWEN_MsgEndpointMgr_AddEndpoint(emgr, epLog);
}
return 0;
@@ -264,11 +272,12 @@ int _setupIpc(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs)
if (tcpAddress && *tcpAddress && tcpPort) {
GWEN_MSG_ENDPOINT *epTcp;
epTcp=AQH_TcpdIpcNodeEndpoint_new(tcpAddress, tcpPort, NULL, AQH_MSGMGR_ENDPOINTGROUP_IPC);
epTcp=AQH_TcpdIpcNodeEndpoint_new(tcpAddress, tcpPort, NULL, AQH_MSGMGR_ENDPOINTGROUP_NODE|AQH_MSGMGR_ENDPOINTGROUP_IPC);
if (epTcp==NULL) {
DBG_ERROR(AQH_LOGDOMAIN, "Error creating endpoint TCP");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint_SetAcceptedGroupIds(epTcp, AQH_MSGMGR_ENDPOINTGROUP_NODE | AQH_MSGMGR_ENDPOINTGROUP_IPC);
GWEN_MsgEndpointMgr_AddEndpoint(emgr, epTcp);
}
return 0;
@@ -293,11 +302,12 @@ int _setupMqtt(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs)
if (mqttAddress && *mqttAddress && mqttPort) {
GWEN_MSG_ENDPOINT *epMqtt;
epMqtt=AQH_MqttClientEndpoint_new(mqttAddress, mqttPort, NULL, AQH_MSGMGR_ENDPOINTGROUP_NODE|AQH_MSGMGR_ENDPOINTGROUP_MQTT);
epMqtt=AQH_MqttClientEndpoint_new(mqttAddress, mqttPort, NULL, AQH_MSGMGR_ENDPOINTGROUP_MQTT);
if (epMqtt==NULL) {
DBG_ERROR(AQH_LOGDOMAIN, "Error creating endpoint TCP");
return GWEN_ERROR_GENERIC;
}
GWEN_MsgEndpoint_SetAcceptedGroupIds(epMqtt, AQH_MSGMGR_ENDPOINTGROUP_NODE | AQH_MSGMGR_ENDPOINTGROUP_MQTT);
if (mqttClientId && *mqttClientId)
AQH_MqttClientEndpoint_SetClientId(epMqtt, mqttClientId);
if (mqttTopicPrefix && *mqttTopicPrefix)
@@ -447,6 +457,17 @@ int _readArgs(int argc, char **argv, GWEN_DB_NODE *dbArgs)
I18S("Specify keepalive time in seconds (defaults: 600)"),
I18S("Specify keepalive time in seconds (defaults: 600)")
},
{
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
GWEN_ArgsType_Char, /* type */
"dbfile", /* name */
0, /* minnum */
1, /* maxnum */
"db", /* short option */
"dbfile", /* long option */
I18S("Specify DB file to read/write node database"),
I18S("Specify DB file to read/write node database")
},
{
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
GWEN_ArgsType_Char, /* type */