#ifndef _OT_SLAVE_2_H
#define _OT_SLAVE_2_H

#include "Arduino.h"
#include <opentherm.h>

typedef void (*OT_Data_CB)(const OpenthermData&);

class OT_V2R2_Slave {

protected:
  static OpenthermData  message;
  OT_Data_CB		cbPostReq;
  bool                  chEnable;
  bool                  chActive;
  float                 chTemperature;
  bool                  dhwEnable;
  bool                  dhwActive;
  float                 dhwTemperature;
  

public:
  OT_V2R2_Slave (OT_Data_CB cbPostReq = 0);

  virtual void  Setup ();
  virtual void  Loop ();
  
  virtual void  HandleRequest (OpenthermData& message);
  virtual void  ConfigReq (OpenthermData& message);
  virtual void  StatusReq (OpenthermData& message);
  virtual void  FaultReq (OpenthermData& message);

  virtual bool  CH_Enable (bool enable = true);
  virtual bool  CH_Disable ();
  virtual void  CH_Temperature (float);
  virtual bool  DHW_Enable (bool enable = true);
  virtual bool  DHW_Disable ();
  virtual void  DHW_Temperature (float);

private:
  static void ListenAfterResponse ();

};

#endif	// _OT_SLAVE_2_H
