aqhome-react: more work on modules and networks.

- tested AND network and new suntime units.
- add unit XML property "invert" (inverts output for logical units)
This commit is contained in:
Martin Preuss
2024-04-20 17:28:20 +02:00
parent f3c68a8bba
commit 87114cecea
17 changed files with 641 additions and 104 deletions

View File

@@ -83,10 +83,11 @@ void AQHREACT_Link_Dump(const AQHREACT_LINK *lnk, GWEN_BUFFER *buf, int indent)
portName=(lnk->targetPort)?AQHREACT_Port_GetName(lnk->targetPort):NULL;
if (indent)
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
GWEN_Buffer_AppendArgs(buf, "- target unit id: %s (%s), target slot name: %s\n",
GWEN_Buffer_AppendArgs(buf, "- target unit id: %s (%s), target slot name: %s [%d]\n",
unitId?unitId:"<no id>",
unitName?unitName:"<no name>",
portName?portName:"<no port>");
portName?portName:"<no port>",
(lnk->targetPort)?AQHREACT_Port_GetIdForUnit(lnk->targetPort):0);
}
}

View File

@@ -263,8 +263,9 @@ void AQHREACT_Port_Dump(const AQHREACT_PORT *port, GWEN_BUFFER *buf, int indent)
if (port && buf) {
if (indent)
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
GWEN_Buffer_AppendArgs(buf, "- \"%s\" (%s, %08x)\n",
GWEN_Buffer_AppendArgs(buf, "- \"%s\"[%d] (%s, %08x)\n",
(port->name)?(port->name):"<no name>",
port->idForUnit,
AQHREACT_DataObjectType_toString(port->dataType),
port->flags);
if (port->linkList && AQHREACT_Link_List_GetCount(port->linkList))

View File

@@ -167,6 +167,24 @@ void AQHREACT_Unit_SetGpTimestamp(AQHREACT_UNIT *unit, uint64_t t)
int AQHREACT_Unit_GetGpInt(const AQHREACT_UNIT *unit)
{
return unit?unit->gpInt:0;
}
void AQHREACT_Unit_SetGpInt(AQHREACT_UNIT *unit, int i)
{
if (unit)
unit->gpInt=i;
}
AQHREACT_PORT_LIST *AQHREACT_Unit_GetInputPortList(const AQHREACT_UNIT *unit)
{
return unit?unit->inputPortList:NULL;
@@ -214,6 +232,7 @@ AQHREACT_PORT *AQHREACT_Unit_GetOrCreateUnusedInputPortByName(AQHREACT_UNIT *uni
AQHREACT_PORT *newPort;
newPort=AQHREACT_Port_dup(port);
AQHREACT_Port_SetIdForUnit(port, (unit->nextInputPortId)++);
AQHREACT_Unit_AddInputPort(unit, newPort);
return newPort;
}

View File

@@ -22,6 +22,7 @@ GWEN_INHERIT_FUNCTION_DEFS(AQHREACT_UNIT)
#define AQHREACT_UNIT_FLAGS_CHANGED 0x80000000
#define AQHREACT_UNIT_FLAGS_INUSE 0x40000000
#define AQHREACT_UNIT_FLAGS_MULTI 0x20000000
#define AQHREACT_UNIT_FLAGS_INVERT 0x10000000 /** invert output of boolean units */
#include "aqhome-react/aqhome_react.h"
@@ -62,6 +63,10 @@ void AQHREACT_Unit_SubFlags(AQHREACT_UNIT *unit, uint32_t i);
uint64_t AQHREACT_Unit_GetGpTimestamp(const AQHREACT_UNIT *unit);
void AQHREACT_Unit_SetGpTimestamp(AQHREACT_UNIT *unit, uint64_t t);
/** general purpose integer, unit is free to use it */
int AQHREACT_Unit_GetGpInt(const AQHREACT_UNIT *unit);
void AQHREACT_Unit_SetGpInt(AQHREACT_UNIT *unit, int i);
AQHREACT_PORT_LIST *AQHREACT_Unit_GetInputPortList(const AQHREACT_UNIT *unit);
void AQHREACT_Unit_AddInputPort(AQHREACT_UNIT *unit, AQHREACT_PORT *port);

View File

@@ -24,6 +24,7 @@ struct AQHREACT_UNIT {
uint32_t flags;
uint64_t gpTimestamp;
int gpInt;
int nextInputPortId;