I am designing a real time application on Qt. got stuck in QExtserialport the design has hardware part which sense and send signal through UART communication. I design application to display GUI interface. the following code not open port in Qt. but it does on Minicom, cutecom display value's.
HeadeFile.h
INCLUDEPATH += .
include(..project/qextserialport-1.2rc/src/qextserialport.pri)
CONFIG += extserialport
Mainwindow.cpp
Qextserialport *rs232_;
Mainwindow.cpp
rs232_ = new QextSerialPort("/dev/ttyS0");
rs232_->open( QIODevice::ReadWrite );
if (!rs232_->isOpen()) {
qDebug()<<"....Port ttyS0 CanNot Open...."<<endl
}
rs232_->setBaudRate(BAUD4800);
rs232_->setFlowControl(FLOW_OFF);
rs232_->setParity(PAR_ODD);
rs232_->setDataBits(DATA_8);
rs232_->setStopBits(STOP_1);
QTimer *s2_timer = new QTimer(this);
s2_timer->setInterval(17);
s2_timer->start();
connect(rs232_, SIGNAL(readyRead()), this, SLOT(onDataAvailable()));
it always display "Port ttyS0 CanNot Open"
updated Qt to 5.6, solved by QtSerialPort. http://doc.qt.io/qt-5/qtserialport-index.html