//创建串口对象QSerialPort s = new QSerialPort("/dev/ttySAC2", this);//配置串口信息s->setBaudRate(QSerialPort::Baud9600);//波特率s->setDataBits(QSerialPort::Data8);//数据位s->setStopBits(QSerialPort::OneStop);//奇偶校验s->setParity(QSerialPort::NoParity);//停止位s->setFlowControl(QSerialPort::NoFlowControl);//流控
//如果是连接电脑端还需设置端口名称
//s->setPortName("COM3");//打开串口if (s->open(QIODevice::ReadWrite)){qDebug()<<"open ok";}eles{qDebug()<<"open fail";}//绑定读取信号与相应的槽connect(s, &QSerialPort::readyRead, this, &serial::readmsg);
setBaudRate:
setDataBits:
setParity:
setStopBits:
setFlowControl: