
#ifndef DomoEspManagerDef
#define DomoEspManagerDef 1

//#include <ESP8266WiFi.h>//este para esp8266
//#include <PubSubClient.h>
#include <SPI.h>
/*
#include <SimpleDHT.h>
#include <Wire.h>
#include <Adafruit_BMP085.h>
*/
#include "MqttVarManager.h"
#include "MqttUtiles.h"
#include "MqttSensManager.h"
class PubSubClient;
class WiFiClient;
class MqttSensManager;
/*
 * clase principal
 */

class DomoConfig
{
  public:
  
  char ssidWifi[24];
  char keyWifi[32];
  char ideEsp[16];//identificador unico por esp
  char hostMQTT[16];
  int portMQTT;

  virtual void ConfigSens(MqttSensManager* sens)=0;


  
};
//TODO falta funcion en configuracion para añadir sensores y variables
class DomoEspManager: public MqttReceiver
{
  public:
  //variables-------------
  MqttVarArray avar;
  MqttTopicAttay topics;

  MqttVarManager vars;
  MqttSensManager sens;

  WifiManager wifi;
  MqttManager mqtt;
  //PubSubClient client_qqtt(WifiManager::espClient);
  DomoEspManager();
  //PubSubClient client_qqtt(espClient);
  void inicia(PubSubClient *mqttClient, WiFiClient* espClient, DomoConfig* conf);
  void loop();
  
  //funciones auxiliares
  virtual void OnMqtt(char* topic, char* payload);
  virtual void SubscribeMqtt(PubSubClient *client_mqtt);
  
};
#endif
