Thread: implementing to set time interval to allow program to run on its own??

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    1

    Unhappy implementing to set time interval to allow program to run on its own??

    Hi, i am currently working on a project which involve setting the device (Bluetooth - wireless communication stuff) to detect other clients. i am now finding out how to implement this system :

    the device will detect its client every time interval (say 5 min). means once it detect its client, it will read the information and disconnect to the client and after every 5mins it will automatically scan for its client again.

    Does anyone have any ideas /suggestions on how to go about implenting it???

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    114
    Depends on system.

    I would for example use a thread to handle the client detection/connection/keep alive/+other things regarding connection. That way I won't disrupt the rest of the program. Problem arise when you are working with a singlethreaded system. I've once developed for single threaded PDA's, and what we had to do was to call the, in this case, keep alive function in the main msgloop. Problem though with other parts of the program that could take a couple of minutes to complete (syncronization of mail for example). Here we had to call the keep alive every now and then inside the big loop since we knew we wouldn't get to the main msgloop in a while.

    Hope this can help you a little, I'm afraid its all I can do with that sparse information you supplied. Happy coding.

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    What system are you using?

    Perhaps you could make use of software interrupts. Let an interrupt occur every 5 minutes, then an interrupt service routine will be launched which calls a function which detects the other Bluetooth device, makes a connection, does data transfer and disconnects.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. time program showing time since epoch?
    By cus in forum Linux Programming
    Replies: 5
    Last Post: 01-10-2009, 01:56 PM
  2. How to time how long a program takes to run?
    By advancedk in forum C Programming
    Replies: 2
    Last Post: 08-18-2008, 07:50 PM
  3. can't get this program to run correctly
    By Amyaayaa in forum C++ Programming
    Replies: 3
    Last Post: 02-05-2008, 04:16 PM
  4. Replies: 7
    Last Post: 08-19-2007, 08:10 AM
  5. Trying to make rand different per program run
    By Dreamerv3 in forum C++ Programming
    Replies: 6
    Last Post: 01-18-2002, 03:26 AM