32 lines
726 B
C
32 lines
726 B
C
|
|
|||
|
#ifndef SERIALCONNECTION_H
|
|||
|
#define SERIALCONNECTION_H
|
|||
|
|
|||
|
#include "baseConnection.h"
|
|||
|
#include "CSerialPort/SerialPort.h"
|
|||
|
|
|||
|
using namespace itas109;
|
|||
|
|
|||
|
class SerialConnection :public BaseConnection, public CSerialPortListener
|
|||
|
{
|
|||
|
Q_OBJECT
|
|||
|
public:
|
|||
|
SerialConnection();
|
|||
|
~SerialConnection();
|
|||
|
bool open() override;
|
|||
|
bool close() override;
|
|||
|
bool isConnected() override;
|
|||
|
int sendData(const QByteArray &data) override;
|
|||
|
void setting(QMap<QString,QString> &map) override;
|
|||
|
|
|||
|
private slots:
|
|||
|
void onReadEvent(const char *portName, unsigned int readBufferLen) override;
|
|||
|
|
|||
|
private:
|
|||
|
CSerialPort m_SerialPort;
|
|||
|
int readIntervalTimeoutMS = 20;
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
#endif // SERIALCONNECTION_H
|