#ifndef GENERATORCORE_H
#define GENERATORCORE_H

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

class GeneratorCore : public QObject
{
    Q_OBJECT
public:
    explicit GeneratorCore(QObject *parent = nullptr);
    ~GeneratorCore();
    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;

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

#endif // GENERATORCORE_H
