#ifndef LIGHTINGCORE_H
#define LIGHTINGCORE_H

#include <QObject>
#include <qmqtt.h>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QDateTime>
#include <QTimer>
#include "logthread.h"
#include "clientthread.h"
#include "tcpserver.h"

class LightingCore : public QObject
{
    Q_OBJECT
public:
    explicit LightingCore(QObject *parent = nullptr);
    ~LightingCore();
    void start();
    void shm_init();
    bool shm_load();

signals:

public slots:
    void onConnected();
    void dataLog(QString log);
    void mqtt_data(QString mqtt_msg);
    void control_data(QString deviceId,int switchStatus);
    void time_out();
    void response_msg(QString msg);

private:
    LogThread *logthread;
    ClientThread *clientthread;
    TcpServer *tcpserver;

    QMQTT::Client *m_client;
    QSqlDatabase db;
    quint16 mqttIdx;
    QString ip,port,username,password;
    QTimer *timer;
};

#endif // LIGHTINGCORE_H
