#ifndef GUARDCORE_H
#define GUARDCORE_H

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

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

signals:

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

private:
    LogThread *logthread;
    HttpThread *httpthread;
    DatabaseThread *dbthread;
    TcpServer *tcpserver;

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

#endif // GUARDCORE_H
