Results 1 to 4 of 4

Thread: QtSerialPort : missing received datas / Console application

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    May 2016
    Posts
    2
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QtSerialPort : missing received datas / Console application

    Hi Guys,

    Thank you very much for your answers. I rode the QIODevice::waitForReadyRead definition too fast and I misunderstood this point.

    For guys who will read this thread and who will be faced with the same problem, i can suggest this solution (which is a blocking one). This solution is exposed in qt example.

    Qt Code:
    1. QByteArray dataToReceiveQBA;
    2.  
    3. char* dataToReceive= new char;
    4.  
    5.  
    6.  
    7. cout<< "the device is open Y/N: "<< SerialEmitter->isOpen()<<endl;
    8. cout<< "The value retrun of this function is "<< SerialEmitter->write(TheMessage,TailleMessage*sizeof(char))<<endl;
    9. SerialEmitter->waitForBytesWritten(200);
    10.  
    11. dataToReceiveQBA=SerialEmitter->readAll();
    12.  
    13. while (SerialReceiver->waitForReadyRead(250))
    14. {
    15. dataToReceiveQBA.append(SerialEmitter->readAll());
    16. }
    17.  
    18.  
    19. dataToReceive= dataToReceiveQBA.data();
    To copy to clipboard, switch view to plain text mode 
    Last edited by Awawa; 1st June 2016 at 11:50.

Similar Threads

  1. Replies: 4
    Last Post: 29th July 2015, 05:41
  2. Replies: 2
    Last Post: 22nd March 2014, 18:35
  3. Replies: 1
    Last Post: 15th January 2013, 19:08
  4. Replies: 2
    Last Post: 21st November 2010, 18:03
  5. KDevelop + QT + GDB = Application received SIGTRAP
    By GodOfWar in forum Qt Programming
    Replies: 7
    Last Post: 29th April 2008, 19:59

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.