Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

Seriaport: Check parity problem

$
0
0
Hello, I installed qtSerialport (Qt 4.8) in a pc with Ubuntu 12.04 a few days ago. I can send and receive commands through a serialport, but I cannot check the parity of the received data. Here is my code. Should I check some flag o something else? bool configurarPuerto(QString *msg){       this->serialPort->close();     this->serialPort->setPort("ttyS3");       *msg="Configuracion del puerto serie: ";     if (!this->serialPort->open(QIODevice::ReadWrite)) {         *msg+="Error abriendo el dispositivo";         return false;     }       /*         I choose the configuration policy         - SkipPolicy: Ignora los comandos invalidos         - PassZeroPolicy: Lee 0         - IgnorePolicy: Ignora el bit de paridad         - StopReceivingPolicy: Deja de recibir datos     */       if (!this->serialPort->setDataErrorPolicy(SerialPort::StopReceivingPolicy)){        qDebug()<<"Configuration error";     }         if (!this->serialPort->setParity(SerialPort::EvenParity)) {         *msg+="Error seteando paridad par";         return false;     }       return true; }

Viewing all articles
Browse latest Browse all 18427

Trending Articles