Results 1 to 2 of 2

Thread: Sending raw data using QextSerialPort [solved]

  1. #1
    Join Date
    Mar 2008
    Posts
    27
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Sending raw data using QextSerialPort [solved]

    Hello,

    I'm trying to send data using QExtSerialPort. The data consits of integers. When I'm trying to send an integer like '9' the data actually sent is '57'. This is the ascii character for '9'.

    The embedded device asks for numbers instead of ascii characters, so I need a way to send raw data over the serial port.

    Does anyone know a way to do this?

    I tried using QDataStream, but the problem is that there is no matching function call for QDataStream::QDataStream(QExtSerialPort**), so that didn't work.

    Thanks in advance

    DrDonut

    OS: Windows xp
    QT: 4.4.3
    QExtSerial: 1.2-alpha
    Last edited by DrDonut; 7th January 2009 at 13:11.

  2. #2
    Join Date
    Mar 2008
    Posts
    27
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sending raw data using QextSerialPort [solved]

    Hi all,

    I've found a solution to the problem.

    Qt Code:
    1. void Aansturing::sendPWM(int speedout)
    2. {
    3. if (port->isOpen()==0){
    4. logwindow->append("Cannot send message (port closed)");}
    5. else {
    6. QByteArray signalout3;
    7. signalout3.append(speedout);
    8. port->write(signalout3, 1);
    9. PWMdata=signalout2;}
    10. }
    To copy to clipboard, switch view to plain text mode 

    So, when the string is declared as an QByteArray, the QExtSerial libary sends the data without converting it to ascii codes.

    Just posting it here for anyone else who has the problem

    Thank you all for your time.

    DrDonut

  3. The following user says thank you to DrDonut for this useful post:

    cooper (7th July 2009)

Similar Threads

  1. Replies: 7
    Last Post: 29th August 2008, 10:24
  2. sending data over signal
    By gyre in forum Newbie
    Replies: 1
    Last Post: 16th December 2007, 23:10
  3. sending encrypted data via mail using smtp
    By vermarajeev in forum General Programming
    Replies: 20
    Last Post: 14th August 2007, 19:47
  4. qt network performance
    By criss in forum Qt Programming
    Replies: 16
    Last Post: 24th July 2006, 09:23
  5. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 12:53

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.