I have to communicate with cash-register.
If i send data without polish diacritic chars - it works, but i have to use CP852 encoding (chars (int) value > 127 ie 0xb1 then it does not work.
(i become from cash-register's service an example what to send and i send exacly this same)
QString hex = "0234301c4c49541d4741546f77617220a5a91e42411e43311 e44332c30301e45332c30301e47737a74756b613742413303" ;
QByteArray test = QByteArray::fromHex(hex.toLatin1());
serial = new QSerialPort(this);
serial->setPortName("ttyACM0");
serial->setBaudRate(QSerialPort::Baud9600);
serial->setDataBits(QSerialPort:ata8);
serial->setParity(QSerialPort::NoParity);
serial->setStopBits(QSerialPort::OneStop);
serial->setFlowControl(QSerialPort::NoFlowControl);
if(serial->open(QIODevice::ReadWrite))
{
qDebug()<<"Port is open!";
if(serial->isWritable())
{
qDebug()<<"Yes, i can write to port!";
}
serial->waitForBytesWritten(-1);
serial->write(test.data());
serial->flush(); // Port Error 12 (timed out???)
serial->close()
}
Bookmarks