From 557a678d0b3f23c8225b597e78260a9267a8b884 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sat, 18 Mar 2023 23:25:48 +0100 Subject: [PATCH] aqhome: added modules field to nodeinfo. --- aqhome/nodes/nodeinfo.t2d | 131 +++++++++++++++++++++++++++++++++++--- 1 file changed, 122 insertions(+), 9 deletions(-) diff --git a/aqhome/nodes/nodeinfo.t2d b/aqhome/nodes/nodeinfo.t2d index 6b55043..cc86835 100644 --- a/aqhome/nodes/nodeinfo.t2d +++ b/aqhome/nodes/nodeinfo.t2d @@ -18,9 +18,110 @@
aqhome/api.h
+
gwenhywfar/error.h
+ + + + + + $(api) int $(struct_prefix)_AddModule($(struct_type) *t, uint8_t v); + + + + + + + + int $(struct_prefix)_AddModule($(struct_type) *t, uint8_t v) { + int i; + + assert(t); + + for(i=0; i < $(modules.maxlen); i++) { + if (t->modules[i]==0) { + t->modules[i]=v; + return 0; + } + } + DBG_ERROR(AQH_LOGDOMAIN, "Too many module entries"); + return GWEN_ERROR_BUFFER_OVERFLOW; + } + + + + + + + + + $(api) int $(struct_prefix)_HasModule(const $(struct_type) *t, uint8_t v); + + + + + + + + int $(struct_prefix)_HasModule(const $(struct_type) *t, uint8_t v) { + int i; + + assert(t); + for (i=0; i<$(modules.maxlen); i++) { + if (t->modules[i]==v) + return 1; + } + return 0; + } + + + + + + + + + $(api) int $(struct_prefix)_GetMaxModuleCount(void); + + + + + + + + int $(struct_prefix)_GetMaxModuleCount(void) { + return $(modules.maxlen); + } + + + + + + + + + $(api) void $(struct_prefix)_ClearModules($(struct_type) *t); + + + + + + + + void $(struct_prefix)_ClearModules($(struct_type) *t) { + int i; + + assert(t); + for (i=0; i<$(modules.maxlen); i++) { + t->modules[i]=0; + } + } + + + + @@ -30,39 +131,51 @@ - + 0 0 - sortByMember + sortByMember with_getbymember public - + + 0 + 0 + public + with_getbymember + + + 0 0 public - + 0 0 public - + 0 0 public - - 0 - 0 + + + omit + const + const public - + + This array contains one entry for every module the node contains (0 for empty entries). + Call $(struct_prefix)_GetMaxModuleCount() to get the size of this array. +