| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #ifndef LOGSERIALPORT_H
- #define LOGSERIALPORT_H
- #include <QObject>
- #include <QWidget>
- #include <QSerialPort>
- #include <QQueue>
- #include "utils/rtuhelper.h"
- #include <QPair>
- #include <QDateTime>
- #include <QFile>
- #include <QTimer>
- #include "QDebug"
- #include "globalinfo.h"
- #ifdef _MSC_VER
- #pragma execution_character_set("utf-8")
- #endif
- class LogSerialPort : public QObject,public UtilsFun::RTUHelper
- {
- Q_OBJECT
- public:
- explicit LogSerialPort(QObject *parent = nullptr);
- // inline bool isStart() const {return started;}
- // inline bool isOpened() const {return opened;}
- float toFloat(const QByteArray & ray);
- signals:
- // void refValue();
- // void newValue(int id,qint64 tm, double v);
- public slots:
- // void open(const QString & name, int bandwith);
- // void close();
- // void checkBuchang(double buchang, double max, double min);
- private slots:
- // void doTimerOut();
- // void readData();
- void doHandle(const QByteArray & data);
- // void save(int, const QDateTime &tm, double v);
- private:
- QSerialPort * _port;
- QTimer * _timer;
- QQueue<QByteArray> _sendQueue;
- bool started;
- bool needReply;
- bool opened;
- QPair<QDateTime,QFile * > _save;
- QByteArray _getData;
- QByteArray _resetData;
- scaledata scaledata;
- double buchang;
- double max;
- double min;
- };
- #endif // LOGSERIALPORT_H
|