/****************************************************************************
 * 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 <config.h>
#endif

#include "./u_timer.h"
#include "./u_passthrough.h"

#include <gwenhywfar/debug.h>



AQHREACT_UNIT *AqHomeReact_UnitTimer_new(AQH_OBJECT *aqh)
{
  AQHREACT_UNIT *unit;

  unit=AqHomeReact_UnitPassthrough_new(aqh);
  AQHREACT_Unit_SetTypeName(unit, "timer");
  AQHREACT_Unit_SetDescription(unit, "Periodically generate a timer signal");

  return unit;
}



void AqHomeReact_UnitTimer_GenerateTick(AQHREACT_UNIT *unit)
{
  AQHREACT_PORT *outputPort;

  outputPort=AQHREACT_Unit_GetOutputPortByIdForUnit(unit, AQHOMEREACT_UNIT_PASSTHROUGH_OUTSLOT_OUTPUT);
  if (outputPort)
    AQHREACT_Unit_OutputDoubleData(unit, outputPort, 1.0);
}






