Results 1 to 2 of 2

Thread: who can help me? It cost me many days.

  1. #1

    Question who can help me? It cost me many days.

    I downloaded qt-emb-2.3.10 and qt-x11-2.3.2 from network,in my application ,i must get date from serial and output date to serial.but when get date from serial(com1),when date length is bigger one ,My gui was destoryed .the application can't response to my mouse and keyboard.
    if I run gui application or serial applictaion not in the same time,these work in good normal,when run then in the same time,the serial application can't get date from serial or the gui application can't diaplay in normal.

    read function :
    int CXcjp::ReadBuf(char *data, int datalength)
    {
    int retval = 0;
    if(!m_fd)
    return 0;
    int readcount=0;
    FD_ZERO (&fs_read);
    FD_SET (m_fd, &fs_read);
    tv_timeout.tv_sec = TimeOut_Sec (datalength, GetBaudrate ());
    tv_timeout.tv_usec = TimeOut_uSec(datalength,GetBaudrate());
    retval = select (m_fd + 1, &fs_read, NULL, NULL, &tv_timeout);
    if (retval)
    readcount=read (m_fd, data, datalength);
    else
    readcount=-1;
    return readcount;
    }

    /*
    * Write datalength bytes in buffer given by UINT8 *data,
    * return value: bytes written
    * Nonblock mode
    */
    int CXcjp::WriteBuf(char * data, int datalength)
    {
    int retval, len = 0, total_len = 0;
    if(!m_fd)
    return -1;
    FD_ZERO (&fs_write);
    FD_SET (m_fd, &fs_write);
    tv_timeout.tv_sec = TimeOut_Sec (datalength, GetBaudrate ());
    tv_timeout.tv_usec = TimeOut_uSec(datalength,GetBaudrate());
    retval = select (m_fd + 1, NULL, &fs_write, NULL, &tv_timeout);

    for (total_len = 0, len = 0; total_len < datalength {
    retval = select (m_fd + 1, NULL, &fs_write, NULL, &tv_timeout);
    if (retval) {
    len = write (m_fd, &data[total_len], datalength - total_len);
    if (len > 0) {
    total_len += len;
    }
    }
    else {
    tcflush (m_fd,TCOFLUSH);
    break;
    }
    }
    return total_len;
    }

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: who can help me? It cost me many days.

    What about the rest of the application code? What is the exact problem? Without seeing the GUI part, it is hard to say anything.

Similar Threads

  1. to set date and time in the file info of two days back
    By thomasjoy in forum Qt Programming
    Replies: 1
    Last Post: 11th October 2007, 16:54
  2. Video Links to Dey Days 2006
    By sunil.thaha in forum General Discussion
    Replies: 3
    Last Post: 21st January 2007, 18:42
  3. cost of emitting signal
    By quickNitin in forum Newbie
    Replies: 1
    Last Post: 29th November 2006, 08:53
  4. Who is going to visit Trolltech Developer Days in Munich
    By Conel in forum General Discussion
    Replies: 2
    Last Post: 23rd August 2006, 18:54

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.