I am writing a Qt application to communicate with another computer through a serial port. I have 2 real questions.
1. I can send and receive data in order, but sometimes the serial port βeatsβ part of my input. For example, if I send:
cd /application/bin
sometimes (not always) he will receive only:
cd /applica
(Since it is a terminal, it repeats the entry back. Also, my invitation tells me that I am clearly in the wrong place.)
2. In addition, sometimes the Qt slot, which fires when there is available data, does not fire, although I know that there is data that I can get. If I send another \r\n down the port, the slot will be lit. For example, sometimes I ls something and the command name will be read back from the port, but the contents of the folder are sitting there in limbo until I return again. Then I get a list of directories and two requests.
Here is my code:
void Logic::onReadyRead(){ QByteArray incomingData; incomingData = port->readAll(); QString s(incomingData); emit dataAvailable(s);
source share