Results 1 to 6 of 6

Thread: Frustrating problem with QextSerialPort write()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Frustrating problem with QextSerialPort write()

    Unless something changed recently, QExtSerialPort doesn't emit readyRead(). You need to periodically check if there is anything to read with a timer. I don't know if that's related to your problem, in theory problems with reading should not stop you from writing (unless some buffer gets full which might happen here).
    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.


  2. #2
    Join Date
    Oct 2007
    Location
    Grenoble, France
    Posts
    80
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Frustrating problem with QextSerialPort write()

    Qt Code:
    1. while (inpSt.compare("quit") != 0)
    2. {
    3. std::getline(std::cin, inpSt);
    4. std::cerr << serialPort->write(inpSt.c_str());
    5. std::cerr << "Sent command: " << inpSt << std::endl;
    6. }
    To copy to clipboard, switch view to plain text mode 
    What do you get from this on stderr?
    And am I missing something or you're not opening the port in your code?
    The rest as wysota wrote
    You have to run a level 3 diagnostic.

    Ashes to ashes, Qt to Qt ( wysota )

  3. #3
    Join Date
    Oct 2009
    Posts
    33
    Thanks
    2

    Default Re: Frustrating problem with QextSerialPort write()

    Thanks to all for the replies.

    @wysota
    Emit seems to be working. I downloaded the latest source from the project website and read under their 'issues' section that event based I/O had been implemented (in POSIX at least, and I'm on linux).

    @calhan
    For some odd reason (maybe copy/paste) the line of code for opening the port isn't in my original post. The line is actually

    Qt Code:
    1. // open serial port
    2. port->open(QIODevice::ReadWrite);
    To copy to clipboard, switch view to plain text mode 

    And it's right after I set up the port parameters, before I launch the helper threads.

    The output of stderr is the expected number of characters I write. An example of a command string I'm outputting to the device is "1 RN".
    The return value of the write command is 4.

    EDIT:
    The issue was with the command string I was sending to the device. The string needed to be terminated with *both* newline and carriage return characters... everything seems okay now. Thanks!


    EDIT (EDIT):
    @kuzulis: I've tried your library and it works as well (since the error was on my part). Thank you for providing the community with a Qt serial i/o library, however I want to agree with what calhan said in that you've advertised your library often (already in another thread of mine!) without really replying to the question.
    Last edited by kachofool; 27th November 2009 at 18:10.

Similar Threads

  1. qextserialport BAUDRATE problem
    By dheeraj in forum Qt Programming
    Replies: 6
    Last Post: 19th March 2009, 19:29
  2. Replies: 7
    Last Post: 29th August 2008, 10:24
  3. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  4. Problem in QExtserialport program.
    By dheeraj in forum Qt Programming
    Replies: 5
    Last Post: 31st May 2008, 10:24
  5. Problem on set QGraphicsTextItem write protect.
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2007, 20:53

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
  •  
Qt is a trademark of The Qt Company.