2022-05-29 23:24:27 +08:00
|
|
|
#ifndef SERIALPORTBASE_H
|
|
|
|
#define SERIALPORTBASE_H
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class SerialPortBase
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
// SerialPortBase();
|
|
|
|
// ~SerialPortBase();
|
|
|
|
|
2022-05-31 22:44:39 +08:00
|
|
|
virtual int OpenSerialPort(string portName, int baudrate) = 0;
|
2022-05-29 23:24:27 +08:00
|
|
|
virtual int CloseSerialPort() = 0;
|
|
|
|
virtual int SetBaudrate(int baudrate) = 0;
|
2022-05-31 22:44:39 +08:00
|
|
|
virtual int SendData1(const char *data, const unsigned int len) = 0;
|
|
|
|
virtual int SendData(const char chrSendBuffer[],const unsigned short usLen) = 0;
|
2022-06-20 10:48:38 +08:00
|
|
|
virtual int ReadData(char * receivedData) = 0;
|
2022-05-29 23:24:27 +08:00
|
|
|
protected:
|
|
|
|
private:
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SERIALPORTBASE_H
|