units now use aqh as argument.
This commit is contained in:
@@ -190,15 +190,15 @@ AQHREACT_UNIT *AqHomeReact_CreateUnitByName(AQHOME_REACT *aqh, const char *unitT
|
|||||||
/* this does not include u_timer and u_varchanges, because those are only created once globally in init.c */
|
/* this does not include u_timer and u_varchanges, because those are only created once globally in init.c */
|
||||||
if (aqh && unitType && *unitType) {
|
if (aqh && unitType && *unitType) {
|
||||||
if (strcasecmp(unitType, "or")==0)
|
if (strcasecmp(unitType, "or")==0)
|
||||||
return AqHomeReact_UnitOr_new();
|
return AqHomeReact_UnitOr_new(aqh);
|
||||||
else if (strcasecmp(unitType, "valueFilter")==0)
|
else if (strcasecmp(unitType, "valueFilter")==0)
|
||||||
return AqHomeReact_UnitValueFilter_new();
|
return AqHomeReact_UnitValueFilter_new(aqh);
|
||||||
else if (strcasecmp(unitType, "stabilize")==0)
|
else if (strcasecmp(unitType, "stabilize")==0)
|
||||||
return AqHomeReact_UnitStabilize_new();
|
return AqHomeReact_UnitStabilize_new(aqh);
|
||||||
else if (strcasecmp(unitType, "lowPass")==0)
|
else if (strcasecmp(unitType, "lowPass")==0)
|
||||||
return AqHomeReact_UnitLowPass_new();
|
return AqHomeReact_UnitLowPass_new(aqh);
|
||||||
else if (strcasecmp(unitType, "highPass")==0)
|
else if (strcasecmp(unitType, "highPass")==0)
|
||||||
return AqHomeReact_UnitHighPass_new();
|
return AqHomeReact_UnitHighPass_new(aqh);
|
||||||
else {
|
else {
|
||||||
DBG_ERROR(NULL, "Unknown unit type \"%s\"", unitType);
|
DBG_ERROR(NULL, "Unknown unit type \"%s\"", unitType);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -213,12 +213,12 @@ void _setupBuiltinUnits(AQHOME_REACT *aqh)
|
|||||||
{
|
{
|
||||||
AQHREACT_UNIT *unit;
|
AQHREACT_UNIT *unit;
|
||||||
|
|
||||||
unit=AqHomeReact_UnitTimer_new();
|
unit=AqHomeReact_UnitTimer_new(aqh);
|
||||||
AQHREACT_Unit_SetId(unit, ".timer");
|
AQHREACT_Unit_SetId(unit, ".timer");
|
||||||
AQHREACT_Unit_List_Add(unit, aqh->unitList);
|
AQHREACT_Unit_List_Add(unit, aqh->unitList);
|
||||||
aqh->timerUnit=unit;
|
aqh->timerUnit=unit;
|
||||||
|
|
||||||
unit=AqHomeReact_UnitVarChanges_new();
|
unit=AqHomeReact_UnitVarChanges_new(aqh);
|
||||||
AQHREACT_Unit_SetId(unit, ".updatedValue");
|
AQHREACT_Unit_SetId(unit, ".updatedValue");
|
||||||
AQHREACT_Unit_List_Add(unit, aqh->unitList);
|
AQHREACT_Unit_List_Add(unit, aqh->unitList);
|
||||||
aqh->varChangeUnit=unit;
|
aqh->varChangeUnit=unit;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ GWEN_INHERIT_FUNCTIONS(AQHREACT_UNIT)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AQHREACT_Unit_new(void)
|
AQHREACT_UNIT *AQHREACT_Unit_new(AQHOME_REACT *aqh)
|
||||||
{
|
{
|
||||||
AQHREACT_UNIT *unit;
|
AQHREACT_UNIT *unit;
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@ AQHREACT_UNIT *AQHREACT_Unit_new(void)
|
|||||||
GWEN_INHERIT_INIT(AQHREACT_UNIT, unit);
|
GWEN_INHERIT_INIT(AQHREACT_UNIT, unit);
|
||||||
GWEN_LIST_INIT(AQHREACT_UNIT, unit);
|
GWEN_LIST_INIT(AQHREACT_UNIT, unit);
|
||||||
|
|
||||||
|
unit->aqHomeReact=aqh;
|
||||||
unit->inputSlotList=AQHREACT_InputSlot_List_new();
|
unit->inputSlotList=AQHREACT_InputSlot_List_new();
|
||||||
unit->outputSlotList=AQHREACT_OutputSlot_List_new();
|
unit->outputSlotList=AQHREACT_OutputSlot_List_new();
|
||||||
unit->paramList=AQHREACT_Param_List_new();
|
unit->paramList=AQHREACT_Param_List_new();
|
||||||
|
|||||||
@@ -36,9 +36,11 @@ typedef int (*AQHREACT_UNIT_PROCESS_FN)(AQHREACT_UNIT *unit);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AQHREACT_Unit_new(void);
|
AQHREACT_UNIT *AQHREACT_Unit_new(AQHOME_REACT *aqh);
|
||||||
void AQHREACT_Unit_free(AQHREACT_UNIT *unit);
|
void AQHREACT_Unit_free(AQHREACT_UNIT *unit);
|
||||||
|
|
||||||
|
AQHOME_REACT *AQHREACT_Unit_GetAqHomeReact(const AQHREACT_UNIT *unit);
|
||||||
|
|
||||||
const char *AQHREACT_Unit_GetName(const AQHREACT_UNIT *unit);
|
const char *AQHREACT_Unit_GetName(const AQHREACT_UNIT *unit);
|
||||||
void AQHREACT_Unit_SetName(AQHREACT_UNIT *unit, const char *s);
|
void AQHREACT_Unit_SetName(AQHREACT_UNIT *unit, const char *s);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ struct AQHREACT_UNIT {
|
|||||||
GWEN_INHERIT_ELEMENT(AQHREACT_UNIT)
|
GWEN_INHERIT_ELEMENT(AQHREACT_UNIT)
|
||||||
GWEN_LIST_ELEMENT(AQHREACT_UNIT)
|
GWEN_LIST_ELEMENT(AQHREACT_UNIT)
|
||||||
|
|
||||||
|
AQHOME_REACT *aqHomeReact;
|
||||||
char *name;
|
char *name;
|
||||||
char *description;
|
char *description;
|
||||||
char *id;
|
char *id;
|
||||||
|
|||||||
@@ -40,14 +40,14 @@ static void _cbInputData(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHREACT_
|
|||||||
* ------------------------------------------------------------------------------------------------
|
* ------------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitHighPass_new(void)
|
AQHREACT_UNIT *AqHomeReact_UnitHighPass_new(AQHOME_REACT *aqh)
|
||||||
{
|
{
|
||||||
AQHREACT_UNIT *unit;
|
AQHREACT_UNIT *unit;
|
||||||
AQHREACT_OUTPUT_SLOT *outputSlot;
|
AQHREACT_OUTPUT_SLOT *outputSlot;
|
||||||
AQHREACT_INPUT_SLOT *inputSlot;
|
AQHREACT_INPUT_SLOT *inputSlot;
|
||||||
AQHREACT_PARAM *param;
|
AQHREACT_PARAM *param;
|
||||||
|
|
||||||
unit=AQHREACT_Unit_new();
|
unit=AQHREACT_Unit_new(aqh);
|
||||||
AQHREACT_Unit_SetName(unit, "highpass");
|
AQHREACT_Unit_SetName(unit, "highpass");
|
||||||
AQHREACT_Unit_SetDescription(unit, "Highpass filter for data");
|
AQHREACT_Unit_SetDescription(unit, "Highpass filter for data");
|
||||||
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);
|
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#define AQHOMEREACT_UNIT_HIGHPASS_PARAM_NEWVALUE "newValue"
|
#define AQHOMEREACT_UNIT_HIGHPASS_PARAM_NEWVALUE "newValue"
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitHighPass_new(void);
|
AQHREACT_UNIT *AqHomeReact_UnitHighPass_new(AQHOME_REACT *aqh);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,14 +40,14 @@ static void _cbInputData(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHREACT_
|
|||||||
* ------------------------------------------------------------------------------------------------
|
* ------------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitLowPass_new(void)
|
AQHREACT_UNIT *AqHomeReact_UnitLowPass_new(AQHOME_REACT *aqh)
|
||||||
{
|
{
|
||||||
AQHREACT_UNIT *unit;
|
AQHREACT_UNIT *unit;
|
||||||
AQHREACT_OUTPUT_SLOT *outputSlot;
|
AQHREACT_OUTPUT_SLOT *outputSlot;
|
||||||
AQHREACT_INPUT_SLOT *inputSlot;
|
AQHREACT_INPUT_SLOT *inputSlot;
|
||||||
AQHREACT_PARAM *param;
|
AQHREACT_PARAM *param;
|
||||||
|
|
||||||
unit=AQHREACT_Unit_new();
|
unit=AQHREACT_Unit_new(aqh);
|
||||||
AQHREACT_Unit_SetName(unit, "lowpass");
|
AQHREACT_Unit_SetName(unit, "lowpass");
|
||||||
AQHREACT_Unit_SetDescription(unit, "Lowpass filter for data");
|
AQHREACT_Unit_SetDescription(unit, "Lowpass filter for data");
|
||||||
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);
|
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#define AQHOMEREACT_UNIT_LOWPASS_PARAM_NEWVALUE "newValue"
|
#define AQHOMEREACT_UNIT_LOWPASS_PARAM_NEWVALUE "newValue"
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitLowPass_new(void);
|
AQHREACT_UNIT *AqHomeReact_UnitLowPass_new(AQHOME_REACT *aqh);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ static int _sampleInputSlots(const AQHREACT_INPUT_SLOT_LIST *inputSlotList);
|
|||||||
* ------------------------------------------------------------------------------------------------
|
* ------------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitOr_new(void)
|
AQHREACT_UNIT *AqHomeReact_UnitOr_new(AQHOME_REACT *aqh)
|
||||||
{
|
{
|
||||||
AQHREACT_UNIT *unit;
|
AQHREACT_UNIT *unit;
|
||||||
AQHREACT_OUTPUT_SLOT *outputSlot;
|
AQHREACT_OUTPUT_SLOT *outputSlot;
|
||||||
AQHREACT_INPUT_SLOT *inputSlot;
|
AQHREACT_INPUT_SLOT *inputSlot;
|
||||||
|
|
||||||
unit=AQHREACT_Unit_new();
|
unit=AQHREACT_Unit_new(aqh);
|
||||||
AQHREACT_Unit_SetName(unit, "or");
|
AQHREACT_Unit_SetName(unit, "or");
|
||||||
AQHREACT_Unit_SetDescription(unit, "Logical OR inputs");
|
AQHREACT_Unit_SetDescription(unit, "Logical OR inputs");
|
||||||
AQHREACT_Unit_SetProcessFn(unit, _cbProcessFn);
|
AQHREACT_Unit_SetProcessFn(unit, _cbProcessFn);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "aqhome-react/types/unit.h"
|
#include "aqhome-react/types/unit.h"
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitOr_new(void);
|
AQHREACT_UNIT *AqHomeReact_UnitOr_new(AQHOME_REACT *aqh);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ static void _cbInputData(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHREACT_
|
|||||||
* ------------------------------------------------------------------------------------------------
|
* ------------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitPassthrough_new(void)
|
AQHREACT_UNIT *AqHomeReact_UnitPassthrough_new(AQHOME_REACT *aqh)
|
||||||
{
|
{
|
||||||
AQHREACT_UNIT *unit;
|
AQHREACT_UNIT *unit;
|
||||||
AQHREACT_OUTPUT_SLOT *outputSlot;
|
AQHREACT_OUTPUT_SLOT *outputSlot;
|
||||||
AQHREACT_INPUT_SLOT *inputSlot;
|
AQHREACT_INPUT_SLOT *inputSlot;
|
||||||
|
|
||||||
unit=AQHREACT_Unit_new();
|
unit=AQHREACT_Unit_new(aqh);
|
||||||
AQHREACT_Unit_SetName(unit, "passthrough");
|
AQHREACT_Unit_SetName(unit, "passthrough");
|
||||||
AQHREACT_Unit_SetDescription(unit, "Generic passthrough unit");
|
AQHREACT_Unit_SetDescription(unit, "Generic passthrough unit");
|
||||||
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);
|
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitPassthrough_new(void);
|
AQHREACT_UNIT *AqHomeReact_UnitPassthrough_new(AQHOME_REACT *aqh);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -62,14 +62,14 @@ static void _setOutput(AQHREACT_UNIT *unit, AQHREACT_UNIT_STABILIZE *xunit, int
|
|||||||
* ------------------------------------------------------------------------------------------------
|
* ------------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitStabilize_new(void)
|
AQHREACT_UNIT *AqHomeReact_UnitStabilize_new(AQHOME_REACT *aqh)
|
||||||
{
|
{
|
||||||
AQHREACT_UNIT_STABILIZE *xunit;
|
AQHREACT_UNIT_STABILIZE *xunit;
|
||||||
AQHREACT_UNIT *unit;
|
AQHREACT_UNIT *unit;
|
||||||
AQHREACT_OUTPUT_SLOT *outputSlot;
|
AQHREACT_OUTPUT_SLOT *outputSlot;
|
||||||
AQHREACT_INPUT_SLOT *inputSlot;
|
AQHREACT_INPUT_SLOT *inputSlot;
|
||||||
|
|
||||||
unit=AQHREACT_Unit_new();
|
unit=AQHREACT_Unit_new(aqh);
|
||||||
GWEN_NEW_OBJECT(AQHREACT_UNIT_STABILIZE, xunit);
|
GWEN_NEW_OBJECT(AQHREACT_UNIT_STABILIZE, xunit);
|
||||||
GWEN_INHERIT_SETDATA(AQHREACT_UNIT, AQHREACT_UNIT_STABILIZE, unit, xunit, _freeData);
|
GWEN_INHERIT_SETDATA(AQHREACT_UNIT, AQHREACT_UNIT_STABILIZE, unit, xunit, _freeData);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#define AQHOMEREACT_UNIT_STABILIZE_PARAM_HOLDTIME_LOW "holdTimeLow"
|
#define AQHOMEREACT_UNIT_STABILIZE_PARAM_HOLDTIME_LOW "holdTimeLow"
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitStabilize_new(void);
|
AQHREACT_UNIT *AqHomeReact_UnitStabilize_new(AQHOME_REACT *aqh);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitTimer_new(void)
|
AQHREACT_UNIT *AqHomeReact_UnitTimer_new(AQHOME_REACT *aqh)
|
||||||
{
|
{
|
||||||
AQHREACT_UNIT *unit;
|
AQHREACT_UNIT *unit;
|
||||||
|
|
||||||
unit=AqHomeReact_UnitPassthrough_new();
|
unit=AqHomeReact_UnitPassthrough_new(aqh);
|
||||||
AQHREACT_Unit_SetName(unit, "timer");
|
AQHREACT_Unit_SetName(unit, "timer");
|
||||||
AQHREACT_Unit_SetDescription(unit, "Periodically generate a timer signal");
|
AQHREACT_Unit_SetDescription(unit, "Periodically generate a timer signal");
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "aqhome-react/types/unit.h"
|
#include "aqhome-react/types/unit.h"
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitTimer_new(void);
|
AQHREACT_UNIT *AqHomeReact_UnitTimer_new(AQHOME_REACT *aqh);
|
||||||
|
|
||||||
void AqHomeReact_UnitTimer_GenerateTick(AQHREACT_UNIT *unit);
|
void AqHomeReact_UnitTimer_GenerateTick(AQHREACT_UNIT *unit);
|
||||||
|
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ static void _cbInputData(AQHREACT_UNIT *unit, int slotIdForUnit, const AQHREACT_
|
|||||||
* ------------------------------------------------------------------------------------------------
|
* ------------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitValueFilter_new(void)
|
AQHREACT_UNIT *AqHomeReact_UnitValueFilter_new(AQHOME_REACT *aqh)
|
||||||
{
|
{
|
||||||
AQHREACT_UNIT *unit;
|
AQHREACT_UNIT *unit;
|
||||||
AQHREACT_OUTPUT_SLOT *outputSlot;
|
AQHREACT_OUTPUT_SLOT *outputSlot;
|
||||||
AQHREACT_INPUT_SLOT *inputSlot;
|
AQHREACT_INPUT_SLOT *inputSlot;
|
||||||
AQHREACT_PARAM *param;
|
AQHREACT_PARAM *param;
|
||||||
|
|
||||||
unit=AQHREACT_Unit_new();
|
unit=AQHREACT_Unit_new(aqh);
|
||||||
AQHREACT_Unit_SetName(unit, "valuefilter");
|
AQHREACT_Unit_SetName(unit, "valuefilter");
|
||||||
AQHREACT_Unit_SetDescription(unit, "Filter values received from unit VarChanges by value path");
|
AQHREACT_Unit_SetDescription(unit, "Filter values received from unit VarChanges by value path");
|
||||||
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);
|
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#define AQHOMEREACT_UNIT_VALUEFILTER_PARAM_VALUENAME "valueName"
|
#define AQHOMEREACT_UNIT_VALUEFILTER_PARAM_VALUENAME "valueName"
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitValueFilter_new(void);
|
AQHREACT_UNIT *AqHomeReact_UnitValueFilter_new(AQHOME_REACT *aqh);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitVarChanges_new(void)
|
AQHREACT_UNIT *AqHomeReact_UnitVarChanges_new(AQHOME_REACT *aqh)
|
||||||
{
|
{
|
||||||
AQHREACT_UNIT *unit;
|
AQHREACT_UNIT *unit;
|
||||||
|
|
||||||
unit=AqHomeReact_UnitPassthrough_new();
|
unit=AqHomeReact_UnitPassthrough_new(aqh);
|
||||||
AQHREACT_Unit_SetName(unit, "varchanges");
|
AQHREACT_Unit_SetName(unit, "varchanges");
|
||||||
AQHREACT_Unit_SetDescription(unit, "Propagates changes of values on the data server");
|
AQHREACT_Unit_SetDescription(unit, "Propagates changes of values on the data server");
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include "aqhome/data/value.h"
|
#include "aqhome/data/value.h"
|
||||||
|
|
||||||
|
|
||||||
AQHREACT_UNIT *AqHomeReact_UnitVarChanges_new(void);
|
AQHREACT_UNIT *AqHomeReact_UnitVarChanges_new(AQHOME_REACT *aqh);
|
||||||
|
|
||||||
void AqHomeReact_UnitVarChanges_ValueUpdated(AQHREACT_UNIT *unit, const AQH_VALUE *value, uint64_t timestamp, double data);
|
void AqHomeReact_UnitVarChanges_ValueUpdated(AQHREACT_UNIT *unit, const AQH_VALUE *value, uint64_t timestamp, double data);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user