/****************************************************************************
 * 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 AQHOMEREACT_U_VARCHANGES_H
#define AQHOMEREACT_U_VARCHANGES_H


#include "aqhome-react/server.h"
#include "aqhome-react/types/unit.h"

#include "aqhome/data/value.h"


#define AQHOMEREACT_UNIT_VARCHANGES_OUTSLOT_OUTINT    0
#define AQHOMEREACT_UNIT_VARCHANGES_OUTSLOT_OUTDOUBLE 1
#define AQHOMEREACT_UNIT_VARCHANGES_OUTSLOT_OUTSTRING 2



AQHREACT_UNIT *AqHomeReact_UnitVarChanges_new(AQH_OBJECT *aqh);

/**
 * Called from AqHomeReact when a value on the server changed.
 */
void AqHomeReact_UnitVarChanges_ValueUpdated(AQHREACT_UNIT *unit, const AQH_VALUE *value, uint64_t timestamp, double data);

/**
 * Called from AqHomeReact when a local variable changed (see @ref AqHomeReact_SetDoubleValue).
 */
void AqHomeReact_UnitVarChanges_DoubleVarUpdated(AQHREACT_UNIT *unit, const char *varName, uint64_t timestamp, double data);

/**
 * Called from AqHomeReact when a local variable changed (see @ref AqHomeReact_SetCharValue).
 */
void AqHomeReact_UnitVarChanges_StringVarUpdated(AQHREACT_UNIT *unit, const char *varName, uint64_t timestamp, const char *data);


/**
 * Called from AqHomeReact when a local variable changed (see @ref AqHomeReact_SetIntValue).
 */
void AqHomeReact_UnitVarChanges_IntVarUpdated(AQHREACT_UNIT *unit, const char *varName, uint64_t timestamp, int data);



#endif


