Results 1 to 2 of 2

Thread: add a delay before return in script

  1. #1
    Join Date
    Jun 2011
    Location
    London UK
    Posts
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default add a delay before return in script

    Hi,
    I am new in QT(yesterday started). I use the following piece of code in a packet generator.
    What I would like to do is to add a delay in ms before or after the return pvf line.
    I want my script to hang there for a few miliseconds before ends.

    Is there a way I can do that?

    Any help appreciated.

    Thanks in advance.

    protocol.protocolFrameSize = function() { return 12; }

    > protocol.protocolFrameValueVariable = true;

    > protocol.protocolFrameValue = function(index)

    > {

    > var pfv = [0x80, 0x08, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x36, 0x20, 0xfb,
    > 0x90];

    > var seq = (index+1) & 0xFFFF;

    > var timesync = (index * 160) & 0xFFFFFFFF;

    > pfv[2] = seq >> 8;

    > pfv[3] = seq & 0xFF;

    > pfv[4] = (timesync >> 24) & 0xFF;

    > pfv[5] = (timesync >> 16) & 0xFF;

    > pfv[6] = (timesync >> 8) & 0xFF;

    > pfv[7] = timesync & 0xFF;

    > return pfv;

    > }

  2. #2
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    164
    Thanks
    1
    Thanked 26 Times in 26 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: add a delay before return in script

    Basically you can use sleep command( on *nix systems) and Sleep on windows. There is no sleep command in Qt, unless you need it for your custom QThread. You can always set some loop and check if QTime::elapsed is bigger than something.

Similar Threads

  1. To add delay
    By vinayaka in forum Newbie
    Replies: 0
    Last Post: 3rd June 2011, 13:21
  2. Add Delay.
    By Johncdy in forum Qt Programming
    Replies: 1
    Last Post: 16th March 2011, 08:18
  3. Can I include a script from script?
    By yycking in forum Qt Programming
    Replies: 1
    Last Post: 24th April 2009, 03:01
  4. Qt script return pointer
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 30th December 2008, 21:54

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.