×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    How to get a function to repeat.

    Hi, I have a short script in Py-S60 that I wrote that grabs a bluetooth address from a device and prints the address to the screen. This script works as it should with no bugs.

    however, I want to be able to repeat this function indefinitely every 30 seconds or so. I.e. the program waits 30 seconds or so, then scans for new bluetooth devices and prints them to the screen.

    Could someone please tell me if there is a way to do this?

    I've tried using the timer.after() function to do this, but it doesn't seem to be working.

    If anyone has any ideas I would really appreciate some help.

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: How to get a function to repeat.

    You could do it in a loop if nothing else works. Something like this:
    Code:
    import appuifw, e32
    
    #Define your exit function
    def quit():
      global running
      running = False
    
    appuifw.app.exit_key_handler = quit
    
    running = True
    
    while running:
      #Call your function
      myfunction()
      #Wait 30 seconds
      e32.ao_sleep(30)

  3. #3
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: How to get a function to repeat.

    Quote Originally Posted by mobmon1 View Post
    however, I want to be able to repeat this function indefinitely every 30 seconds ... I've tried using the timer.after() function to do this, but it doesn't seem to be working.
    Strange, timer does have some problems, but it should be idea for what you need. Here's the result of my experiments:

    http://jouni.miettunen.googlepages.com/timersample

    Cheers,

    --jouni

Similar Threads

  1. ShortMsgReceived - Delphi
    By qb_soft in forum PC Suite API and PC Connectivity SDK
    Replies: 9
    Last Post: 2008-06-22, 10:30
  2. Help with lnk2019 lnk1120 error
    By yuenfatt in forum Symbian
    Replies: 8
    Last Post: 2007-08-24, 08:21
  3. a function return value problem
    By letmefly111 in forum Symbian
    Replies: 3
    Last Post: 2007-07-23, 20:50
  4. EXecute function in RDbStoreDatabase
    By symbians60 in forum Symbian
    Replies: 4
    Last Post: 2007-01-23, 10:59
  5. C-code..unable to make sis
    By Symbian_Neil in forum Symbian
    Replies: 9
    Last Post: 2006-12-02, 07:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×