Results 1 to 2 of 2

Thread: Collect data from different Serial Port Threads "simultaneously"

  1. #1
    Join Date
    Aug 2018
    Posts
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Collect data from different Serial Port Threads "simultaneously"

    Hello everyone! I have some problems with the concept for synchronized data collection. I have 3 Serial Ports (sensors are connected over usb cdc-acm. it's a development kit with Linux on board). Each QSerialPort is in separate Thread (over moveToThread). I send Data to these ports from gui-thread simultaneously (doing with connect one Signal to 3 SerialPort Slots) and become Data from each sensor, Request–Response method. Additionaly i have placed parser in each Serial Port Thread. Now i want to collect received, parsed data from each SerialPort Thread simultaneously (synchronize?). After all data are collected i want process/compare data and send result to the Gui thread (Showing data in qTableWidget etc.).

    Is there a standard procedure or does someone have a suggestion how to do that?

    concept.jpg

    Thank you very much!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,351
    Thanks
    3
    Thanked 5,006 Times in 4,785 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Blog Entries
    4
    Wiki edits
    10

    Default Re: Collect data from different Serial Port Threads "simultaneously"

    The whole point of creating separate threads for each port is to make them asynchronous relative to each other. Seems that this is not what you want. Thus you should handle all three ports in a single thread (which is what you should be doing anyway). Signals such as readyRead() are emitted when there is anything to be read on the port so you can connect to those and do the reading from all the ports in the main thread.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 13
    Last Post: 29th May 2015, 04:30
  2. Replies: 4
    Last Post: 2nd June 2012, 07:04
  3. Replies: 1
    Last Post: 7th April 2010, 21:46
  4. Replies: 3
    Last Post: 25th August 2009, 13:03
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

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.