Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. QExtSerialPort readyRead Signal
Forum Updated to NodeBB v4.3 + New Features

QExtSerialPort readyRead Signal

Scheduled Pinned Locked Moved 3rd Party Software
4 Posts 3 Posters 8.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kruvva
    wrote on last edited by
    #1

    Hello Team,

    I am working on the serial port communication on Windows 7 and using QExtSerialPort library to handle the communication. After defining the port I connect the readyRead signal to my slot ReadPaket, as shown below.
    @
    pPort = new QextSerialPort();
    pPort->setPortName("COM1");
    pPort->setBaudRate( BAUD9600 );
    pPort->setDataBits( DATA_8 );
    pPort->setStopBits( STOP_1 );
    pPort->setParity( PAR_NONE );
    pPort->setFlowControl( FLOW_OFF );
    pPort->setDtr( true );
    pPort->setRts( true );
    pPort->setQueryMode( QextSerialBase::EventDriven );

    connect( pPort, SIGNAL(readyRead()), this, SLOT(ReadPacket()) );
    @
    When I write data to the port, it is triggering the ReadPacket() slot for every byte in the data. I want the slot to be triggered only once when the new data is arrived. How can I achieve this? Is there some thing wrong in the port settings?

    Thanks in advance
    [edit: code highlighted / Denis Kormalev]

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kruvva
      wrote on last edited by
      #2

      Let me correct the connect () line in the above:

      connect( pPort, SIGNAL (readyRead()), this, SLOT (ReadPacket()) );

      Thanks

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DenisKormalev
        wrote on last edited by
        #3

        please don't forget about @ tags around your code

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          [quote author="kruvva" date="1306436734"]
          When I write data to the port, it is triggering the ReadPacket() slot for every byte in the data. I want the slot to be triggered only once when the new data is arrived. How can I achieve this? Is there some thing wrong in the port settings?[/quote]
          How would the class know that all your data (or all the data you are interested in) has arrived?

          If you get your data in bursts (a block of data, then nothing for a little while, then another block of data), you may look into "this wiki entry":http://developer.qt.nokia.com/wiki/Delay_action_to_wait_for_user_interaction. I explain how to fix this issue when related to UI's, but the code is equally applicable to this case. Or alternatively, you can simply check how many bytes are available when the slot is triggered, and if that number is too low, don't do anything.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved