I'm working in Qt creator c++ and linux os, and I'm trying to create program that reads and sends sms messages. Everything works fine, but when I try to read cmti signal that signals that new message is received it brakes and os sends me SIGBUS, bus error.
My code is simply:
port->setPortName(s);
bool status = port->open(QSerialPort::ReadWrite);
if(status)
{
port->setBaudRate(115200, QSerialPort::AllDirections);
port->setDataBits(QSerialPort::Data8);
port->setParity(QSerialPort::NoParity);
QByteArray in;
if(port->waitForReadyRead(300))
{
in = port->readAll();
while (port->waitForReadyRead(64))
{
in += in->readAll();
}
}
//...
}
When modem sends cmti and port gets that signal in port->watiForReadyRead() it gives me error and never gets to port->readAll(). Also, when this error occurs it changes ttyUSB port for modem.
My best guess is that modem blocks port so my app can read. In c# in widows I have solved this by setting read timeout on serial port, but I can't do this in qt.
Can anyone help with this???