2016-02-04 17:19:21 +01:00
|
|
|
#ifndef HALINTERFACES_H
|
|
|
|
|
#define HALINTERFACES_H
|
|
|
|
|
|
2016-05-09 17:49:24 +02:00
|
|
|
#include "HalConfiguration.h"
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_DEBUG
|
|
|
|
|
#define DEBUG(msg) \
|
|
|
|
|
Serial.println(msg); \
|
|
|
|
|
Serial.flush();
|
|
|
|
|
#define DEBUGF(msg, ...) \
|
|
|
|
|
static char buffer[80];\
|
|
|
|
|
snprintf(buffer, sizeof(buffer), msg, __VA_ARGS__);\
|
|
|
|
|
Serial.println(buffer);\
|
|
|
|
|
Serial.flush();
|
|
|
|
|
#else
|
|
|
|
|
#define DEBUG(msg)
|
|
|
|
|
#define DEBUGF(msg, ...)
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-02-24 21:51:16 +01:00
|
|
|
|
2016-05-02 10:56:15 +02:00
|
|
|
class Sensor
|
2016-02-04 17:19:21 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual void setup() = 0;
|
2016-02-24 14:37:48 +01:00
|
|
|
};
|
|
|
|
|
|
2016-05-02 10:56:15 +02:00
|
|
|
class SensorPowerConsumption : public Sensor
|
2016-02-24 14:37:48 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
// returns number of pulses from power meter
|
2016-02-24 21:51:16 +01:00
|
|
|
virtual unsigned int getConsumption() = 0;
|
2016-02-24 14:37:48 +01:00
|
|
|
virtual void reset() = 0;
|
|
|
|
|
};
|
2016-02-04 17:19:21 +01:00
|
|
|
|
2016-05-02 10:56:15 +02:00
|
|
|
class SensorTemperature : public Sensor
|
2016-02-04 17:19:21 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual int getTemperature() = 0;
|
|
|
|
|
virtual int getHumidity() = 0;
|
2016-02-24 14:37:48 +01:00
|
|
|
};
|
2016-02-04 17:19:21 +01:00
|
|
|
|
2016-05-02 10:56:15 +02:00
|
|
|
class SensorLight : public Sensor
|
2016-02-04 17:19:21 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual void setup() = 0;
|
2016-02-24 21:51:16 +01:00
|
|
|
virtual unsigned int getLuminosity() = 0;
|
2016-02-24 14:37:48 +01:00
|
|
|
};
|
2016-02-04 17:19:21 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Protocol
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual void setup() = 0;
|
|
|
|
|
virtual void send() = 0;
|
2016-02-24 14:37:48 +01:00
|
|
|
};
|
2016-02-04 17:19:21 +01:00
|
|
|
|
2016-02-24 21:51:16 +01:00
|
|
|
class ProtocolPowerConsumption : public Protocol
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual void setConsumption(unsigned int cons) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ProtocolTemperature : public Protocol
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual void setTemperature(float temp) = 0;
|
|
|
|
|
virtual void setHumidity(unsigned char humidity) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ProtocolLight : public Protocol
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
virtual void setLuminosity(int lumen) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // HALINTERFACES_H
|