Announcement

Collapse
No announcement yet.

Need Timed Interval Between RPC Calls with Snapconnect

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need Timed Interval Between RPC Calls with Snapconnect

    For my application I need to wait approximately two minutes between two RPC calls. My code goes something like this:

    Code:
    snap.Snap.Rpc(target_mac, 'func')
    wait_two_minutes()  # nested loops that do nothing
    snap.Snap.Rpc(target_mac, 'func')
    When I run this, the two Rpc calls are consistently made immediately after one another after the two minute delay. I've been reading about the packet buffer in the snapconnect documentation but I still don't know how to get these functions to run at different times. Any help or similar experiences is greatly appreciated!

  • #2
    Send the first RPC, and set a global variable to a value of perhaps 120. In your one-second hook function (prefix it with @setHook(HOOK_1S)), decrement that variable, and if it becomes zero, send the second RPC. You cannot put long delays in the execution of a single function, it will block pretty much everything from happening.

    Comment

    X