#ifndef DMPDATACORE_H
#define DMPDATACORE_H

#include <QObject>
#include <qmqtt.h>
#include <QTimer>
#include <QDateTime>
#include <QStringList>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include "qreplytimeout.h"
#include "dmpdataserver.h"
#include "logthread.h"
#include "databasethread.h"
#include "websocketserver.h"

class DmpDataCore : public QObject
{
    Q_OBJECT
public:
    explicit DmpDataCore(QObject *parent = nullptr);
    ~DmpDataCore();
    void start();

signals:

public slots:
    void time_out();
    void CommData(QString data);
    void DatabaseData(QString sql);
    void getRealtimeValue(QString DeviceCode, QString bstr, QString pointstr, QDateTime t);
    void reply_timeout1();
    void finishedSlot1(QNetworkReply *reply);
    void onConnected();

private:
    QTimer *timer;

    DMPDataServer *dataserver;
    LogThread *logthread;
    DatabaseThread *dbthread;
    WebsocketServer *wsserver;

    QStringList bstrlist;
    QStringList pointstrlist;
    bool isSending1;

    QNetworkAccessManager *networkmanager1;

    quint16 mqttIdx;
    QMQTT::Client *m_client;
};

#endif // DMPDATACORE_H
