diff --git a/apps/aqhome-react/aqhome_react.h b/apps/aqhome-react/aqhome_react.h index b58f04e..a552fce 100644 --- a/apps/aqhome-react/aqhome_react.h +++ b/apps/aqhome-react/aqhome_react.h @@ -15,7 +15,6 @@ typedef struct AQHOME_REACT AQHOME_REACT; #include "aqhome-react/types/unit.h" -#include "aqhome-react/types/unitnet.h" AQHOME_REACT *AqHomeReact_new(); diff --git a/apps/aqhome-react/net_read.c b/apps/aqhome-react/net_read.c index c85363c..9bf4508 100644 --- a/apps/aqhome-react/net_read.c +++ b/apps/aqhome-react/net_read.c @@ -13,7 +13,6 @@ #include "./net_read.h" #include "aqhome-react/aqhome_react_p.h" #include "aqhome-react/types/unit.h" -#include "aqhome-react/types/unitnet.h" #include "aqhome-react/units/u_module.h" #include "aqhome/aqhome.h" diff --git a/apps/aqhome-react/types/inputslot.c b/apps/aqhome-react/types/inputslot.c deleted file mode 100644 index f9920c5..0000000 --- a/apps/aqhome-react/types/inputslot.c +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************** - * This file is part of the project AqHome. - * AqHome (c) by 2024 Martin Preuss, all rights reserved. - * - * The license for this file can be found in the file COPYING which you - * should have received along with this file. - ****************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include -#endif - - -#include "./inputslot_p.h" -#include "aqhome-react/types/unit.h" - -#include -#include - - -GWEN_LIST_FUNCTIONS(AQHREACT_INPUT_SLOT, AQHREACT_InputSlot); - - - -AQHREACT_INPUT_SLOT *AQHREACT_InputSlot_new() -{ - AQHREACT_INPUT_SLOT *inSlot; - - GWEN_NEW_OBJECT(AQHREACT_INPUT_SLOT, inSlot); - GWEN_LIST_INIT(AQHREACT_INPUT_SLOT, inSlot); - inSlot->idForUnit=-1; - - return inSlot; -} - - - -void AQHREACT_InputSlot_free(AQHREACT_INPUT_SLOT *inSlot) -{ - if (inSlot) { - GWEN_LIST_FINI(AQHREACT_INPUT_SLOT, inSlot); - free(inSlot->name); - free(inSlot->description); - AQHREACT_DataObject_free(inSlot->currentDataObject); - GWEN_FREE_OBJECT(inSlot); - } -} - - - -AQHREACT_INPUT_SLOT *AQHREACT_InputSlot_dup(const AQHREACT_INPUT_SLOT *origSlot) -{ - if (origSlot) { - AQHREACT_INPUT_SLOT *inSlot; - - inSlot=AQHREACT_InputSlot_new(); - AQHREACT_InputSlot_SetName(inSlot, origSlot->name); - AQHREACT_InputSlot_SetDescription(inSlot, origSlot->description); - inSlot->idForUnit=origSlot->idForUnit; - inSlot->flags=origSlot->flags & ~AQHREACT_UNIT_FLAGS_MULTI; /* don't copy MULTI flag */ - inSlot->acceptedDataType=origSlot->acceptedDataType; - /* don't copy current dataObject */ - return inSlot; - } - - return NULL; -} - - - -const char *AQHREACT_InputSlot_GetName(const AQHREACT_INPUT_SLOT *inSlot) -{ - return inSlot?inSlot->name:NULL; -} - - - -void AQHREACT_InputSlot_SetName(AQHREACT_INPUT_SLOT *inSlot, const char *s) -{ - if (inSlot) { - free(inSlot->name); - inSlot->name=s?strdup(s):NULL; - } -} - - - -const char *AQHREACT_InputSlot_GetDescription(const AQHREACT_INPUT_SLOT *inSlot) -{ - return inSlot?inSlot->description:NULL; -} - - - -void AQHREACT_InputSlot_SetDescription(AQHREACT_INPUT_SLOT *inSlot, const char *s) -{ - if (inSlot) { - free(inSlot->description); - inSlot->description=s?strdup(s):NULL; - } -} - - - -int AQHREACT_InputSlot_GetIdForUnit(const AQHREACT_INPUT_SLOT *inSlot) -{ - return inSlot?inSlot->idForUnit:0; -} - - - -void AQHREACT_InputSlot_SetIdForUnit(AQHREACT_INPUT_SLOT *inSlot, int i) -{ - if (inSlot) - inSlot->idForUnit=i; -} - - - -uint32_t AQHREACT_InputSlot_GetFlags(const AQHREACT_INPUT_SLOT *inSlot) -{ - return inSlot?inSlot->flags:0; -} - - - -void AQHREACT_InputSlot_SetFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i) -{ - if (inSlot) - inSlot->flags=i; -} - - - -void AQHREACT_InputSlot_AddFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i) -{ - if (inSlot) - inSlot->flags|=i; -} - - - -void AQHREACT_InputSlot_SubFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i) -{ - if (inSlot) - inSlot->flags&=~i; -} - - - -int AQHREACT_InputSlot_GetAcceptedDataType(const AQHREACT_INPUT_SLOT *inSlot) -{ - return inSlot?inSlot->acceptedDataType:AQHREACT_DATAOBJECTTYPE_UNKNOWN; -} - - - -void AQHREACT_InputSlot_SetAcceptedDataType(AQHREACT_INPUT_SLOT *inSlot, int i) -{ - if (inSlot) - inSlot->acceptedDataType=i; -} - - - -AQHREACT_DATAOBJECT *AQHREACT_InputSlot_GetCurrentDataObject(const AQHREACT_INPUT_SLOT *inSlot) -{ - return inSlot?inSlot->currentDataObject:NULL; -} - - - -void AQHREACT_InputSlot_SetCurrentDataObject(AQHREACT_INPUT_SLOT *inSlot, AQHREACT_DATAOBJECT *dataObject) -{ - if (inSlot) { - AQHREACT_DataObject_free(inSlot->currentDataObject); - inSlot->currentDataObject=dataObject; - } -} - - - -void AQHREACT_InputSlot_Dump(const AQHREACT_INPUT_SLOT *inSlot, GWEN_BUFFER *buf, int indent) -{ - if (inSlot && buf) { - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "id................: %d\n", inSlot->idForUnit); - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "name..............: %s\n", (inSlot->name)?(inSlot->name):""); - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "description.......: %s\n", (inSlot->description)?(inSlot->description):""); - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "accepted data type: %s\n", AQHREACT_DataObjectType_toString(inSlot->acceptedDataType)); - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "flags.............: %08x\n", inSlot->flags); - } -} - - - -void AQHREACT_InputSlot_List_Dump(const AQHREACT_INPUT_SLOT_LIST *inSlotList, GWEN_BUFFER *buf, int indent, const char *title) -{ - if (inSlotList && buf) { - const AQHREACT_INPUT_SLOT *inSlot; - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "%s\n", (title && *title)?title:"Input Slot List:\n"); - - inSlot=AQHREACT_InputSlot_List_First(inSlotList); - while(inSlot) { - GWEN_Buffer_FillWithBytes(buf, ' ', indent+2); - GWEN_Buffer_AppendString(buf, "Input Slot:\n"); - AQHREACT_InputSlot_Dump(inSlot, buf, indent+4); - inSlot=AQHREACT_InputSlot_List_Next(inSlot); - } - } -} - - - - - - diff --git a/apps/aqhome-react/types/inputslot.h b/apps/aqhome-react/types/inputslot.h deleted file mode 100644 index ba21702..0000000 --- a/apps/aqhome-react/types/inputslot.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** - * This file is part of the project AqHome. - * AqHome (c) by 2024 Martin Preuss, all rights reserved. - * - * The license for this file can be found in the file COPYING which you - * should have received along with this file. - ****************************************************************************/ - -#ifndef AQHOME_REACT_INPUTSLOT_H -#define AQHOME_REACT_INPUTSLOT_H - - -#include - - -typedef struct AQHREACT_INPUT_SLOT AQHREACT_INPUT_SLOT; -GWEN_LIST_FUNCTION_DEFS(AQHREACT_INPUT_SLOT, AQHREACT_InputSlot) - - -#include "aqhome-react/aqhome_react.h" -#include "aqhome-react/types/dataobject.h" - - -AQHREACT_INPUT_SLOT *AQHREACT_InputSlot_new(); -AQHREACT_INPUT_SLOT *AQHREACT_InputSlot_dup(const AQHREACT_INPUT_SLOT *origSlot); -void AQHREACT_InputSlot_free(AQHREACT_INPUT_SLOT *inSlot); - -const char *AQHREACT_InputSlot_GetName(const AQHREACT_INPUT_SLOT *inSlot); -void AQHREACT_InputSlot_SetName(AQHREACT_INPUT_SLOT *inSlot, const char *s); - -const char *AQHREACT_InputSlot_GetDescription(const AQHREACT_INPUT_SLOT *inSlot); -void AQHREACT_InputSlot_SetDescription(AQHREACT_INPUT_SLOT *inSlot, const char *s); - -int AQHREACT_InputSlot_GetIdForUnit(const AQHREACT_INPUT_SLOT *inSlot); -void AQHREACT_InputSlot_SetIdForUnit(AQHREACT_INPUT_SLOT *inSlot, int i); - -uint32_t AQHREACT_InputSlot_GetFlags(const AQHREACT_INPUT_SLOT *inSlot); -void AQHREACT_InputSlot_SetFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i); -void AQHREACT_InputSlot_AddFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i); -void AQHREACT_InputSlot_SubFlags(AQHREACT_INPUT_SLOT *inSlot, uint32_t i); - -int AQHREACT_InputSlot_GetAcceptedDataType(const AQHREACT_INPUT_SLOT *inSlot); -void AQHREACT_InputSlot_SetAcceptedDataType(AQHREACT_INPUT_SLOT *inSlot, int i); - -AQHREACT_DATAOBJECT *AQHREACT_InputSlot_GetCurrentDataObject(const AQHREACT_INPUT_SLOT *inSlot); -void AQHREACT_InputSlot_SetCurrentDataObject(AQHREACT_INPUT_SLOT *inSlot, AQHREACT_DATAOBJECT *dataObject); - -void AQHREACT_InputSlot_Dump(const AQHREACT_INPUT_SLOT *inSlot, GWEN_BUFFER *buf, int indent); -void AQHREACT_InputSlot_List_Dump(const AQHREACT_INPUT_SLOT_LIST *inSlotList, GWEN_BUFFER *buf, int indent, const char *title); - - - - -#endif - diff --git a/apps/aqhome-react/types/inputslot_p.h b/apps/aqhome-react/types/inputslot_p.h deleted file mode 100644 index b34de74..0000000 --- a/apps/aqhome-react/types/inputslot_p.h +++ /dev/null @@ -1,29 +0,0 @@ -/**************************************************************************** - * This file is part of the project AqHome. - * AqHome (c) by 2024 Martin Preuss, all rights reserved. - * - * The license for this file can be found in the file COPYING which you - * should have received along with this file. - ****************************************************************************/ - -#ifndef AQHOME_REACT_INPUTSLOT_P_H -#define AQHOME_REACT_INPUTSLOT_P_H - - -#include "aqhome-react/types/inputslot.h" - - -struct AQHREACT_INPUT_SLOT { - GWEN_LIST_ELEMENT(AQHREACT_INPUT_SLOT) - - char *name; - char *description; - int idForUnit; - uint32_t flags; - int acceptedDataType; - AQHREACT_DATAOBJECT *currentDataObject; -}; - - -#endif - diff --git a/apps/aqhome-react/types/outputslot.c b/apps/aqhome-react/types/outputslot.c deleted file mode 100644 index 429729b..0000000 --- a/apps/aqhome-react/types/outputslot.c +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** - * This file is part of the project AqHome. - * AqHome (c) by 2024 Martin Preuss, all rights reserved. - * - * The license for this file can be found in the file COPYING which you - * should have received along with this file. - ****************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include -#endif - - -#include "./outputslot_p.h" -#include "aqhome-react/types/dataobject.h" - -#include - - - -GWEN_LIST_FUNCTIONS(AQHREACT_OUTPUT_SLOT, AQHREACT_OutputSlot) - - -AQHREACT_OUTPUT_SLOT *AQHREACT_OutputSlot_new() -{ - AQHREACT_OUTPUT_SLOT *outSlot; - - GWEN_NEW_OBJECT(AQHREACT_OUTPUT_SLOT, outSlot); - GWEN_LIST_INIT(AQHREACT_OUTPUT_SLOT, outSlot); - outSlot->linkList=AQHREACT_Link_List_new(); - outSlot->id=-1; - return outSlot; -} - - - -void AQHREACT_OutputSlot_free(AQHREACT_OUTPUT_SLOT *outSlot) -{ - if (outSlot) { - GWEN_LIST_FINI(AQHREACT_OUTPUT_SLOT, outSlot); - free(outSlot->name); - free(outSlot->description); - AQHREACT_Link_List_free(outSlot->linkList); - GWEN_FREE_OBJECT(outSlot); - } -} - - - -int AQHREACT_OutputSlot_GetIdForUnit(const AQHREACT_OUTPUT_SLOT *outSlot) -{ - return outSlot?outSlot->id:-1; -} - - - -void AQHREACT_OutputSlot_SetIdForUnit(AQHREACT_OUTPUT_SLOT *outSlot, int i) -{ - if (outSlot) - outSlot->id=i; -} - - - -const char *AQHREACT_OutputSlot_GetName(const AQHREACT_OUTPUT_SLOT *outSlot) -{ - return outSlot?outSlot->name:NULL; -} - - - -void AQHREACT_OutputSlot_SetName(AQHREACT_OUTPUT_SLOT *outSlot, const char *s) -{ - if (outSlot) { - free(outSlot->name); - outSlot->name=s?strdup(s):NULL; - } -} - - - -const char *AQHREACT_OutputSlot_GetDescription(const AQHREACT_OUTPUT_SLOT *outSlot) -{ - return outSlot?outSlot->description:NULL; -} - - - -void AQHREACT_OutputSlot_SetDescription(AQHREACT_OUTPUT_SLOT *outSlot, const char *s) -{ - if (outSlot) { - free(outSlot->description); - outSlot->description=s?strdup(s):NULL; - } -} - - - -uint32_t AQHREACT_OutputSlot_GetFlags(const AQHREACT_OUTPUT_SLOT *outSlot) -{ - return outSlot?outSlot->flags:0; -} - - - -void AQHREACT_OutputSlot_SetFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f) -{ - if (outSlot) - outSlot->flags=f; -} - - - -void AQHREACT_OutputSlot_AddFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f) -{ - if (outSlot) - outSlot->flags|=f; -} - - - -void AQHREACT_OutputSlot_SubFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f) -{ - if (outSlot) - outSlot->flags&=~f; -} - - - -int AQHREACT_OutputSlot_GetEmittedDataType(const AQHREACT_OUTPUT_SLOT *outSlot) -{ - return outSlot?outSlot->emittedDataType:AQHREACT_DATAOBJECTTYPE_UNKNOWN; -} - - - -void AQHREACT_OutputSlot_SetEmittedDataType(AQHREACT_OUTPUT_SLOT *outSlot, int i) -{ - if (outSlot) - outSlot->emittedDataType=i; -} - - - -AQHREACT_LINK_LIST *AQHREACT_OutputSlot_GetLinkList(const AQHREACT_OUTPUT_SLOT *outSlot) -{ - return outSlot?outSlot->linkList:NULL; -} - - - -void AQHREACT_OutputSlot_AddLink(AQHREACT_OUTPUT_SLOT *outSlot, AQHREACT_LINK *lnk) -{ - if (outSlot) - AQHREACT_Link_List_Add(lnk, outSlot->linkList); -} - - - -void AQHREACT_OutputSlot_Dump(const AQHREACT_OUTPUT_SLOT *outSlot, GWEN_BUFFER *buf, int indent) -{ - if (outSlot && buf) { - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "id...............: %d (%d)\n", outSlot->id, outSlot->idForUnit); - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "name.............: %s\n", (outSlot->name)?(outSlot->name):""); - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "description......: %s\n", (outSlot->description)?(outSlot->description):""); - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "emitted data type: %s\n", AQHREACT_DataObjectType_toString(outSlot->emittedDataType)); - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "flags............: %08x\n", outSlot->flags); - - AQHREACT_Link_List_Dump(outSlot->linkList, buf, indent, "Link List:"); - } -} - - - -void AQHREACT_OutputSlot_List_Dump(const AQHREACT_OUTPUT_SLOT_LIST *outSlotList, GWEN_BUFFER *buf, int indent, const char *title) -{ - if (outSlotList && buf) { - const AQHREACT_OUTPUT_SLOT *outSlot; - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "%s\n", (title && *title)?title:"Output Slot List:\n"); - - outSlot=AQHREACT_OutputSlot_List_First(outSlotList); - while(outSlot) { - GWEN_Buffer_FillWithBytes(buf, ' ', indent+2); - GWEN_Buffer_AppendString(buf, "Output Slot:\n"); - AQHREACT_OutputSlot_Dump(outSlot, buf, indent+4); - outSlot=AQHREACT_OutputSlot_List_Next(outSlot); - } - } -} - - - - - - - - - - diff --git a/apps/aqhome-react/types/outputslot.h b/apps/aqhome-react/types/outputslot.h deleted file mode 100644 index 264347e..0000000 --- a/apps/aqhome-react/types/outputslot.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** - * This file is part of the project AqHome. - * AqHome (c) by 2024 Martin Preuss, all rights reserved. - * - * The license for this file can be found in the file COPYING which you - * should have received along with this file. - ****************************************************************************/ - -#ifndef AQHOME_REACT_OUTPUTSLOT_H -#define AQHOME_REACT_OUTPUTSLOT_H - -#include - - -typedef struct AQHREACT_OUTPUT_SLOT AQHREACT_OUTPUT_SLOT; -GWEN_LIST_FUNCTION_DEFS(AQHREACT_OUTPUT_SLOT, AQHREACT_OutputSlot) - - -#include "aqhome-react/aqhome_react.h" -#include "aqhome-react/types/link.h" - - - -AQHREACT_OUTPUT_SLOT *AQHREACT_OutputSlot_new(); -void AQHREACT_OutputSlot_free(AQHREACT_OUTPUT_SLOT *outSlot); - -const char *AQHREACT_OutputSlot_GetName(const AQHREACT_OUTPUT_SLOT *outSlot); -void AQHREACT_OutputSlot_SetName(AQHREACT_OUTPUT_SLOT *outSlot, const char *s); - -const char *AQHREACT_OutputSlot_GetDescription(const AQHREACT_OUTPUT_SLOT *outSlot); -void AQHREACT_OutputSlot_SetDescription(AQHREACT_OUTPUT_SLOT *outSlot, const char *s); - -int AQHREACT_OutputSlot_GetIdForUnit(const AQHREACT_OUTPUT_SLOT *outSlot); -void AQHREACT_OutputSlot_SetIdForUnit(AQHREACT_OUTPUT_SLOT *outSlot, int i); - -uint32_t AQHREACT_OutputSlot_GetFlags(const AQHREACT_OUTPUT_SLOT *outSlot); -void AQHREACT_OutputSlot_SetFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f); -void AQHREACT_OutputSlot_AddFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f); -void AQHREACT_OutputSlot_SubFlags(AQHREACT_OUTPUT_SLOT *outSlot, uint32_t f); - -int AQHREACT_OutputSlot_GetEmittedDataType(const AQHREACT_OUTPUT_SLOT *outSlot); -void AQHREACT_OutputSlot_SetEmittedDataType(AQHREACT_OUTPUT_SLOT *outSlot, int i); - - -AQHREACT_LINK_LIST *AQHREACT_OutputSlot_GetLinkList(const AQHREACT_OUTPUT_SLOT *outSlot); -void AQHREACT_OutputSlot_AddLink(AQHREACT_OUTPUT_SLOT *outSlot, AQHREACT_LINK *lnk); - -void AQHREACT_OutputSlot_Dump(const AQHREACT_OUTPUT_SLOT *outSlot, GWEN_BUFFER *buf, int indent); -void AQHREACT_OutputSlot_List_Dump(const AQHREACT_OUTPUT_SLOT_LIST *outSlotList, GWEN_BUFFER *buf, int indent, const char *title); - - - -#endif - diff --git a/apps/aqhome-react/types/outputslot_p.h b/apps/aqhome-react/types/outputslot_p.h deleted file mode 100644 index 67aa9bd..0000000 --- a/apps/aqhome-react/types/outputslot_p.h +++ /dev/null @@ -1,31 +0,0 @@ -/**************************************************************************** - * This file is part of the project AqHome. - * AqHome (c) by 2024 Martin Preuss, all rights reserved. - * - * The license for this file can be found in the file COPYING which you - * should have received along with this file. - ****************************************************************************/ - -#ifndef AQHOME_REACT_OUTPUTSLOT_P_H -#define AQHOME_REACT_OUTPUTSLOT_P_H - - -#include "aqhome-react/types/outputslot.h" - - -struct AQHREACT_OUTPUT_SLOT { - GWEN_LIST_ELEMENT(AQHREACT_OUTPUT_SLOT) - - int id; - char *name; - char *description; - int idForUnit; - uint32_t flags; - int emittedDataType; - - AQHREACT_LINK_LIST *linkList; -}; - - -#endif - diff --git a/apps/aqhome-react/types/unitnet.c b/apps/aqhome-react/types/unitnet.c deleted file mode 100644 index fcbd63b..0000000 --- a/apps/aqhome-react/types/unitnet.c +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************** - * This file is part of the project AqHome. - * AqHome (c) by 2024 Martin Preuss, all rights reserved. - * - * The license for this file can be found in the file COPYING which you - * should have received along with this file. - ****************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include -#endif - - -#include "./unitnet_p.h" - -#include - - -GWEN_LIST_FUNCTIONS(AQHREACT_UNIT_NET, AQHREACT_UnitNet) - - - -AQHREACT_UNIT_NET *AQHREACT_UnitNet_new(void) -{ - AQHREACT_UNIT_NET *unitNet; - - GWEN_NEW_OBJECT(AQHREACT_UNIT_NET, unitNet); - GWEN_LIST_INIT(AQHREACT_UNIT_NET, unitNet); - - unitNet->unitList=AQHREACT_Unit_List_new(); - unitNet->paramList=AQHREACT_Param_List_new(); - - return unitNet; -} - - - -void AQHREACT_UnitNet_free(AQHREACT_UNIT_NET *unitNet) -{ - if (unitNet) { - GWEN_LIST_FINI(AQHREACT_UNIT_NET, unitNet); - AQHREACT_Param_List_free(unitNet->paramList); - AQHREACT_Unit_List_free(unitNet->unitList); - GWEN_FREE_OBJECT(unitNet); - } -} - - - -const char *AQHREACT_UnitNet_GetName(const AQHREACT_UNIT_NET *unitNet) -{ - return unitNet?unitNet->name:NULL; -} - - - -void AQHREACT_UnitNet_SetName(AQHREACT_UNIT_NET *unitNet, const char *s) -{ - if (unitNet) { - free(unitNet->name); - unitNet->name=s?strdup(s):NULL; - } -} - - - -AQHREACT_UNIT_LIST *AQHREACT_UnitNet_GetUnitList(const AQHREACT_UNIT_NET *unitNet) -{ - return unitNet?unitNet->unitList:NULL; -} - - - -AQHREACT_UNIT *AQHREACT_UnitNet_GetUnitById(const AQHREACT_UNIT_NET *unitNet, const char *s) -{ - return (unitNet && s && *s)?AQHREACT_Unit_List_GetById(unitNet->unitList, s):NULL; -} - - - -void AQHREACT_UnitNet_AddUnit(AQHREACT_UNIT_NET *unitNet, AQHREACT_UNIT *unit) -{ - if (unitNet && unit) - AQHREACT_Unit_List_Add(unit, unitNet->unitList); -} - - - -AQHREACT_PARAM_LIST *AQHREACT_UnitNet_GetParamList(const AQHREACT_UNIT_NET *unitNet) -{ - return unitNet?unitNet->paramList:NULL; -} - - - -void AQHREACT_UnitNet_AddParam(AQHREACT_UNIT_NET *unitNet, AQHREACT_PARAM *param) -{ - if (unitNet) - AQHREACT_Param_List_Add(param, unitNet->paramList); -} - - - -AQHREACT_PARAM *AQHREACT_UnitNet_GetParamByName(const AQHREACT_UNIT_NET *unitNet, const char *paramName) -{ - if (unitNet && unitNet->paramList && paramName && *paramName) { - AQHREACT_PARAM *param; - - param=AQHREACT_Param_List_First(unitNet->paramList); - while(param) { - const char *s; - - s=AQHREACT_Param_GetName(param); - if (s && *s && strcasecmp(paramName, s)==0) - return param; - param=AQHREACT_Param_List_Next(param); - } - } - return NULL; -} - - - -AQHREACT_UNIT_NET *AQHREACT_UnitNet_List_GetByName(const AQHREACT_UNIT_NET_LIST *unitNetList, const char *name) -{ - if (unitNetList && name && *name) { - AQHREACT_UNIT_NET *unitNet; - - unitNet=AQHREACT_UnitNet_List_First(unitNetList); - while(unitNet) { - const char *s; - - s=AQHREACT_UnitNet_GetName(unitNet); - if (s && *s && strcasecmp(s, name)==0) - return unitNet; - unitNet=AQHREACT_UnitNet_List_Next(unitNet); - } - } - - return NULL; -} - - - -void AQHREACT_UnitNet_Dump(const AQHREACT_UNIT_NET *unitNet, GWEN_BUFFER *buf, int indent) -{ - if (unitNet && buf) { - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "Network \"%s\"\n", (unitNet->name)?(unitNet->name):""); - AQHREACT_Param_List_Dump(unitNet->paramList, buf, indent, "Network Parameter List:"); - AQHREACT_Unit_List_Dump(unitNet->unitList, buf, indent, "Unit List:"); - } -} - - - -void AQHREACT_UnitNet_List_Dump(const AQHREACT_UNIT_NET_LIST *unitNetList, GWEN_BUFFER *buf, int indent, const char *title) -{ - if (unitNetList && buf) { - const AQHREACT_UNIT_NET *unitNet; - - if (indent) - GWEN_Buffer_FillWithBytes(buf, ' ', indent); - GWEN_Buffer_AppendArgs(buf, "%s\n", (title && *title)?title:"Unit List:\n"); - - unitNet=AQHREACT_UnitNet_List_First(unitNetList); - while(unitNet) { - AQHREACT_UnitNet_Dump(unitNet, buf, indent+2); - unitNet=AQHREACT_UnitNet_List_Next(unitNet); - } - } -} - - - - - - - - diff --git a/apps/aqhome-react/types/unitnet.h b/apps/aqhome-react/types/unitnet.h deleted file mode 100644 index 0ebc291..0000000 --- a/apps/aqhome-react/types/unitnet.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - * This file is part of the project AqHome. - * AqHome (c) by 2024 Martin Preuss, all rights reserved. - * - * The license for this file can be found in the file COPYING which you - * should have received along with this file. - ****************************************************************************/ - -#ifndef AQHOME_REACT_UNIT_NET_H -#define AQHOME_REACT_UNIT_NET_H - - -#include - - -typedef struct AQHREACT_UNIT_NET AQHREACT_UNIT_NET; -GWEN_LIST_FUNCTION_DEFS(AQHREACT_UNIT_NET, AQHREACT_UnitNet) - - -#include "aqhome-react/aqhome_react.h" -#include "aqhome-react/types/param.h" - - -AQHREACT_UNIT_NET *AQHREACT_UnitNet_new(void); -void AQHREACT_UnitNet_free(AQHREACT_UNIT_NET *unitNet); - -const char *AQHREACT_UnitNet_GetName(const AQHREACT_UNIT_NET *unitNet); -void AQHREACT_UnitNet_SetName(AQHREACT_UNIT_NET *unitNet, const char *s); - -AQHREACT_UNIT_LIST *AQHREACT_UnitNet_GetUnitList(const AQHREACT_UNIT_NET *unitNet); -AQHREACT_UNIT *AQHREACT_UnitNet_GetUnitById(const AQHREACT_UNIT_NET *unitNet, const char *s); -void AQHREACT_UnitNet_AddUnit(AQHREACT_UNIT_NET *unitNet, AQHREACT_UNIT *unit); - -AQHREACT_PARAM_LIST *AQHREACT_UnitNet_GetParamList(const AQHREACT_UNIT_NET *unitNet); -void AQHREACT_UnitNet_AddParam(AQHREACT_UNIT_NET *unitNet, AQHREACT_PARAM *param); -AQHREACT_PARAM *AQHREACT_UnitNet_GetParamByName(const AQHREACT_UNIT_NET *unitNet, const char *paramName); - - -AQHREACT_UNIT_NET *AQHREACT_UnitNet_List_GetByName(const AQHREACT_UNIT_NET_LIST *unitNetList, const char *name); - -void AQHREACT_UnitNet_Dump(const AQHREACT_UNIT_NET *unitNet, GWEN_BUFFER *buf, int indent); -void AQHREACT_UnitNet_List_Dump(const AQHREACT_UNIT_NET_LIST *unitNetList, GWEN_BUFFER *buf, int indent, const char *title); - - - -#endif - diff --git a/apps/aqhome-react/types/unitnet_p.h b/apps/aqhome-react/types/unitnet_p.h deleted file mode 100644 index 5cfe3cd..0000000 --- a/apps/aqhome-react/types/unitnet_p.h +++ /dev/null @@ -1,26 +0,0 @@ -/**************************************************************************** - * This file is part of the project AqHome. - * AqHome (c) by 2024 Martin Preuss, all rights reserved. - * - * The license for this file can be found in the file COPYING which you - * should have received along with this file. - ****************************************************************************/ - -#ifndef AQHOME_REACT_UNIT_NET_P_H -#define AQHOME_REACT_UNIT_NET_P_H - - -#include "aqhome-react/types/unitnet.h" - - -struct AQHREACT_UNIT_NET { - GWEN_LIST_ELEMENT(AQHREACT_UNIT_NET) - - char *name; - AQHREACT_UNIT_LIST *unitList; - AQHREACT_PARAM_LIST *paramList; -}; - - -#endif -