aqhome-apps: all apps now work again.

This commit is contained in:
Martin Preuss
2025-03-09 23:25:02 +01:00
parent 9c1188b4d1
commit 3e4e3ffe2d
58 changed files with 1695 additions and 1425 deletions

View File

@@ -98,7 +98,7 @@ static int readIntConfigWithAlt(GWEN_DB_NODE *dbArgs, const char *varName, const
static int _startIpc(AQH_OBJECT *o, AQH_NODE_SERVER *xo);
static int _startTty(AQH_OBJECT *o, AQH_NODE_SERVER *xo);
static int _startBroker(AQH_OBJECT *o, AQH_NODE_SERVER *xo);
static int _exchangeConnect(AQH_OBJECT *o, AQH_NODE_SERVER *xo, uint32_t flags);
static int _exchangeConnect(AQH_NODE_SERVER *xo, uint32_t flags);
static void _setupDb(AQH_NODE_SERVER *xo);
static int _loadDeviceList(AQH_NODE_SERVER *xo);
@@ -117,7 +117,7 @@ static void _forwardTtyMsgToBroker(AQH_OBJECT *o, AQH_NODE_SERVER *xo, const AQH
static void _forwardValueMessageToBroker(AQH_OBJECT *o, AQH_NODE_SERVER *xo, const AQH_MESSAGE *msg);
static void _forwardDataFromSendStatsMsgToBroker(AQH_NODE_SERVER *xo, const AQH_MESSAGE *msg);
static void _forwardDataFromRecvStatsMsgToBroker(AQH_NODE_SERVER *xo, const AQH_MESSAGE *msg);
static void _forwardTtyMsgToClients(AQH_OBJECT *o, AQH_NODE_SERVER *xo, const AQH_MESSAGE *msg);
static void _forwardTtyMsgToClients(AQH_NODE_SERVER *xo, const AQH_MESSAGE *msg);
static void _publishInt(AQH_NODE_SERVER *xo, uint32_t uid, const char *vPath, int vModality, const char *vUnits, int v);
static void _publishDouble(AQH_NODE_SERVER *xo, uint32_t uid, const char *vPath, int vModality, const char *vUnits, double v);
static void _setDeviceName(AQH_VALUE *value, uint32_t uid);
@@ -151,6 +151,7 @@ AQH_OBJECT *AQH_NodeServer_new(AQH_EVENT_LOOP *eventLoop)
GWEN_NEW_OBJECT(AQH_NODE_SERVER, xo);
GWEN_INHERIT_SETDATA(AQH_OBJECT, AQH_NODE_SERVER, o, xo, _freeData);
xo->ipcClientList=AQH_Object_List_new();
xo->requestTree=AQH_MsgRequest_new();
AQH_Object_SetSignalHandlerFn(o, _handleSignal);
@@ -569,7 +570,7 @@ int _startBroker(AQH_OBJECT *o, AQH_NODE_SERVER *xo)
AQH_Object_Enable(ep);
xo->brokerEndpoint=ep;
rv=_exchangeConnect(o, xo, 0);
rv=_exchangeConnect(xo, 0);
if (rv!=0) {
DBG_ERROR(NULL, "Error connecting to broker: %d", rv);
return (rv<0)?rv:GWEN_ERROR_PERMISSIONS;
@@ -587,7 +588,7 @@ int _startBroker(AQH_OBJECT *o, AQH_NODE_SERVER *xo)
int _exchangeConnect(AQH_OBJECT *o, AQH_NODE_SERVER *xo, uint32_t flags)
int _exchangeConnect(AQH_NODE_SERVER *xo, uint32_t flags)
{
AQH_MESSAGE *msgOut;
uint32_t msgId;
@@ -642,6 +643,42 @@ int _loadDeviceList(AQH_NODE_SERVER *xo)
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
* fini
* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
*/
void AQH_NodeServer_Fini(AQH_OBJECT *o)
{
AQH_NODE_SERVER *xo;
xo=GWEN_INHERIT_GETDATA(AQH_OBJECT, AQH_NODE_SERVER, o);
if (xo) {
AQH_OBJECT *ep;
ep=AQH_Object_List_First(xo->ipcClientList);
while(ep) {
AQH_OBJECT *epNext;
epNext=AQH_Object_List_Next(ep);
AQH_Object_List_Del(ep);
AQH_Object_free(ep);
ep=epNext;
} /* while */
AQH_Object_free(xo->brokerEndpoint);
xo->brokerEndpoint=NULL;
AQH_Object_free(xo->ttyEndpoint);
xo->ttyEndpoint=NULL;
AQH_NodeServer_WriteNodeDb(o);
if (xo->pidFile)
remove(xo->pidFile);
}
}
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
* client management functions
* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -763,7 +800,7 @@ void _handleMsgFromTty(AQH_OBJECT *o, AQH_NODE_SERVER *xo, const AQH_MESSAGE *ms
AQH_NodeServer_NodeMsgToDb(o, msg);
_writeTtyMsgToLogFile(xo, msg);
_forwardTtyMsgToBroker(o, xo, msg);
_forwardTtyMsgToClients(o, xo, msg);
_forwardTtyMsgToClients(xo, msg);
}
@@ -783,7 +820,7 @@ void _forwardTtyMsgToBroker(AQH_OBJECT *o, AQH_NODE_SERVER *xo, const AQH_MESSAG
void _forwardTtyMsgToClients(AQH_OBJECT *o, AQH_NODE_SERVER *xo, const AQH_MESSAGE *msg)
void _forwardTtyMsgToClients(AQH_NODE_SERVER *xo, const AQH_MESSAGE *msg)
{
uint8_t code;
uint32_t msgGroup;