#ifndef CHALETHOMESERVERINTERFACE_H
#define CHALETHOMESERVERINTERFACE_H

#include <QtMqtt/QtMqtt>
#include <QMqttClient>
#include "ChaletData.h"
#include <QTimer>

#define MQTT_SERVER_IP "192.168.51.32"
#define MQTT_SERVER_PORT 1883
#define MQTT_SERVER_LOGIN "jfmartel"
#define MQTT_SERVER_PWD "roland"

class CChaletHomeServerInterface : public QObject
{
    Q_OBJECT
public:
    CChaletHomeServerInterface();
    ~CChaletHomeServerInterface();
    int UpdateChaletData(CChaletMainStatus *Data);
    int ConnectToServer();
    int DisconnectFromServer();

    int Start();


    QMqttClient mMQTTClient;
    QTimer *mConnectionTimer;

public slots:
    void MQTTClientError(QMqttClient::ClientError error);
  //  void MQTTMessageSent(qint32 MsgID);
   // void MQTTMessageStatusChanged(qint32 id, QMqtt::MessageStatus s, const QMqttMessageStatusProperties &properties);
    void StateChanged();
    void ConnectionTimerExpired();



};

#endif // CHALETHOMESERVERINTERFACE_H
