#ifndef LOGSERIALPORT_H #define LOGSERIALPORT_H #include #include #include #include #include "utils/rtuhelper.h" #include #include #include #include #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 _sendQueue; bool started; bool needReply; bool opened; QPair _save; QByteArray _getData; QByteArray _resetData; scaledata scaledata; double buchang; double max; double min; }; #endif // LOGSERIALPORT_H