///串口工具类
class Serial
{
public:
Serial();
~Serial();
///打开串口,speed为波特率,使用数字表示9600,115200等,bits位数,stopbits停止位,parity奇偶校验位 1奇数,2偶数,0无检验
int open(string sDeviceName, int speed = B9600, int bits = 8, int stopbits = 1, int parity = 0);
///关闭串口
void close();
///写入字符串
int writeString(string str);
///写入以字符串表示的十六进制
int writeHex(string str);
///读取16进制数据,并返回成字符串
string readHex(int iReadSize = 1000, int iTimeout = 3000);
///读取字符串数据,并返回成字符串
string readString(int iReadSize = 1000, int iTimeout = 3000);
};