More work on aqhome-react.

- added some units
- added some types
This commit is contained in:
Martin Preuss
2024-03-10 20:15:21 +01:00
parent 656c9cf66f
commit d3a6256c8c
35 changed files with 1159 additions and 80 deletions

View File

@@ -13,6 +13,7 @@
#include "./init.h"
#include "./fini.h"
#include "./loop.h"
#include "aqhome-react/units/u_timer.h"
#include "aqhome/aqhome.h"
@@ -95,8 +96,8 @@ int main(int argc, char **argv)
}
GWEN_Logger_Open(0, "aqhome-react", 0, GWEN_LoggerType_Console, GWEN_LoggerFacility_User);
GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Warning);
//GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Info);
//GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Warning);
GWEN_Logger_SetLevel(0, GWEN_LoggerLevel_Info);
rv=AQH_Init();
if (rv<0) {
@@ -141,11 +142,13 @@ void _serve(AQHOME_REACT *aqh)
time_t startTime;
time_t lastTimerTime;
GWEN_DB_NODE *dbArgs;
AQHREACT_UNIT *timerUnit;
startTime=time(NULL);
lastTimerTime=startTime;
dbArgs=AqHomeReact_GetDbArgs(aqh);
timerUnit=AqHomeReact_GetTimerUnit(aqh);
rv=_setSignalHandlers();
if (rv<0) {
@@ -159,14 +162,17 @@ void _serve(AQHOME_REACT *aqh)
time_t now;
DBG_DEBUG(NULL, "Next loop");
AqHomeReact_Loop(aqh, 500);
AqHomeReact_IoLoop(aqh, 500);
now=time(NULL);
if (now!=lastTimerTime) {
lastTimerTime=now;
/* TODO: fire timer */
AqHomeReact_UnitTimer_GenerateTick(timerUnit);
}
AqHomeReact_ProcessAllUnits(aqh);
if (timeout) {
if ((now-startTime)>timeout) {
DBG_ERROR(NULL, "Timeout, stopping service");