99 lines
1.8 KiB
C++
99 lines
1.8 KiB
C++
#ifndef DefinesDef
|
|
#define DefinesDef 1
|
|
|
|
#define DEBUG_PS 1
|
|
|
|
#define MAXTOPICVAR 32//maximo de caracteres de los topic de las variables
|
|
#define MAX_CHAR_PAN_LCD 35//MAXIMO DE CARACTRES POR PANTALLA LCD
|
|
#define MAX_PAN_LCD 3//MAXIMO DE PANTALLAS POR SENSOR LCD
|
|
//vars--------------------
|
|
#define MAXSTR 2024//maximo de caracteres para str
|
|
|
|
//sens--------------------
|
|
#define MAXSENS 16 //maximo de sensores totales
|
|
#define MAX_ACTIVADORES 5//maximo de activadores por actuador
|
|
|
|
|
|
|
|
|
|
#define MAXINTERRUP 8
|
|
|
|
|
|
|
|
#ifndef DO
|
|
#define D0 16
|
|
#endif
|
|
#ifndef D1
|
|
#define D1 5
|
|
#endif
|
|
#ifndef D2
|
|
#define D2 4
|
|
#endif
|
|
#ifndef D3
|
|
#define D3 0
|
|
#endif
|
|
#ifndef D4
|
|
#define D4 2
|
|
#endif
|
|
#ifndef D5
|
|
#define D5 14
|
|
#endif
|
|
#ifndef D6
|
|
#define D6 12
|
|
#endif
|
|
#ifndef D7
|
|
#define D7 13
|
|
#endif
|
|
#ifndef D8
|
|
#define D8 15
|
|
#endif
|
|
|
|
class Topic
|
|
{
|
|
public:
|
|
enum TipoTopic//indica el tipo de sensor
|
|
{
|
|
NO_RECONOCIDO=0,//TIPO TOPIC NO RECONOCIDO
|
|
GET,//TIPO GET
|
|
SET,//TIPO SET
|
|
PUL//TIPO PULSANTE (HA SUCEDIDO ALGO)
|
|
};
|
|
};
|
|
|
|
class PubSubClient;
|
|
//clases
|
|
class MqttReceiver
|
|
{
|
|
public:
|
|
virtual void OnMqtt(char* topic, char* payload)=0;
|
|
virtual void SubscribeMqtt(PubSubClient *client_mqtt){}
|
|
};
|
|
|
|
class IMqttManager
|
|
{
|
|
public:
|
|
virtual void MqttSend(char* topic, char* payload)=0;
|
|
virtual void MqttSubs(char* topic)=0;
|
|
};
|
|
|
|
static char buffer_t[MAXTOPICVAR];
|
|
static char buffer_p[MAXTOPICVAR];
|
|
|
|
class DomoEspSensorReceiver
|
|
{
|
|
public:
|
|
char topic[MAXTOPICVAR];
|
|
|
|
virtual void OnMqtt(IMqttManager * man, char* topic, char* payload, int tipo){};
|
|
virtual void SubscribeMqtt(IMqttManager* man){};
|
|
virtual void procesa(IMqttManager * man, int tiempo){};
|
|
virtual void inicia(){};
|
|
virtual float getVal()=0;
|
|
};
|
|
|
|
class ISensorManager
|
|
{
|
|
public:
|
|
virtual void Add(DomoEspSensorReceiver* sensor)=0;
|
|
};
|
|
#endif |