BUG in ManageSerialPort.cpp

2009-05-29
2013-04-23
  • Alexandr Ekimov

    Alexandr Ekimov - 2009-05-29

    FROM ThreadReceive::run()
    -------------------
                     mutexReceive.lock();
                    extSerialPort.read(data, Caracteres); // extSerialPort.read(data, numBytes);

                    data[numBytes]='\0';
                    dataReceived = data;
                    mutexReceive.unlock();
                    emit newData(dataReceived);
    -----------------------
    If device says 05 (for example) then dataReceived.size() == 0.

    Fix:
    mutexReceive.lock();
                    extSerialPort.read(data, Caracteres); // extSerialPort.read(data, numBytes);

                    dataReceived.append(data, numBytes);
                    mutexReceive.unlock();
                    emit newData(dataReceived);

     
    • Sebastian Oldani

      thank, i fix this error.

       

Log in to post a comment.