Results 1 to 9 of 9

Thread: UDP datagram receive

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Oct 2007
    Posts
    5
    Thanks
    1

    Default Re: UDP datagram receive

    Wysota,

    Thanks for your help. I believe it is the decoding part since in the GUI I can watch the last four digits after the decimal point change in real time. Also, if I uncomment the line: // temperature_string = "023.1234"; then the the GUI shows 23.1234 which is the format I'd like to see.

    Here's the function which I am having trouble with:

    double WeatherBalloon::temperature()
    {
    double temperature;
    QString temperature_string; //("123.1234")
    QByteArray sensogram(socketDevice.bytesAvailable());
    QDataStream out(sensogram, IO_WriteOnly);
    out.setVersion(1);
    socketDevice.writeBlock(sensogram, sensogram.size(), 0x0A640005, 80);
    // out << temperature; //out anything to 10.100.0.5
    socketDevice.readBlock(sensogram.data(), sensogram.size());
    QDataStream in(sensogram, IO_ReadOnly);
    in.setVersion(1);
    in >> temperature_string;
    // temperature_string = "023.1234";
    temperature = temperature_string.toDouble();
    return temperature;
    Last edited by mdannenb; 26th July 2008 at 13:34. Reason: updated contents

Similar Threads

  1. Receive file over TCP
    By winarko in forum Qt Programming
    Replies: 18
    Last Post: 29th May 2008, 17:25

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.