QExtSerialPort - receives data only, after port was first opened in other terminal-like application

  • Hi, i'm rather new to Qt, and started a project which require a serial port connection, so I downloaded the qextserialport library, and compiled It into the project. It properly connects with the device, but there is a problem when It comes to data receiving. When I start the compiled application, and send data from the device It receives only 1 byte which is 7F in hex (device send string: "KeyA pressed").
    The problem disappears when I start other app for serial port communication, open port on which the device is connected in that app and close It.
    Any ideas what is going on ?
    here is my code for opening serial port :
    serialPort = new QextSerialPort("COM3");
    serialPort->open(QIODevice::ReadWrite | QIODevice::Unbuffered);

    ui.statusbar->showMessage("succesfull connected with device..");
    else ui.statusbar->showMessage("unable to connect with device..");

    and here is slot_receive() function:

    void USARTtest::slot_receive()
    char data[1024];
    int numBytes = serialPort->bytesAvailable();
    int readed = serialPort->read(data,1024);
    data[readed] = '\0';

    I'm using the 4.7.0 version of Qt, and QT-eclipse integration.

  • Read "this":http://developer.qt.nokia.com/forums/viewreply/67246/
    Perhaps you change your mind and take another library.

  • I didn't hear about that library earlier, I will give it a try :)
    As I see you are one of the developers of that library, so I have a question - does it support the readyRead() signal ? or do I have to manually handle the way I check if there is any incoming data ?

  • Supported.

    Behavior is "almost completely" copies QAbstractSocket, with all methods, etc.
    All I/O is also buffered and non-blocking.
    See examples in /tests directory.
    In the general, try.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.