#ifndef ELEVATORCORE_H
#define ELEVATORCORE_H


#include <QObject>
#include <qmqtt.h>
#include <QSqlDatabase>
#include <QSqlQuery>
#include "logthread.h"
#include "httpthread.h"
#include "databasethread.h"
#include "devinfotcpserver.h"

#include <QObject>

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

signals:

public slots:
    void onConnected();
    void dataLog(QString log);
    void mqtt_data(QString mqtt_msg);
    void mqtt_event(QString mqtt_event);
    void appendSql(QString sql);

private:
    LogThread *logthread;
    HttpThread *httpthread;
    DatabaseThread *dbthread;
    DevInfoTcpServer *devinfoserver;

    QMQTT::Client *m_client;
    QSqlDatabase db;
    quint16 mqttIdx,mqttEventIdx;
    QString ip,port,username,password;
    QString devinfourl,devinfokey,devinfosignature;
    QString httpurl,httpkey,httpsignature;
    QString httpurl1,httpkey1,httpsignature1;

signals:

public slots:
};

#endif // ELEVATORCORE_H
