Last active
January 12, 2016 09:11
-
-
Save xaxxontech/1a49a2afc238b20989ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time, oculusprimesocket | |
oculusprimesocket.reconnect = True | |
oculusprimesocket.connect() | |
while True: # loop forever | |
# wait for docked | |
dockstatus = None | |
while not dockstatus == "docked": | |
time.sleep(10) | |
oculusprimesocket.sendString("state dockstatus") | |
s = oculusprimesocket.waitForReplySearch("<state> dockstatus") | |
dockstatus = s.split()[3] | |
time.sleep(10) # wait for camera to turn off (if just auto-docked) | |
oculusprimesocket.sendString("cancelroute") # cancel active patrol route | |
# turn on mic and enable sound detection | |
oculusprimesocket.sendString("publish mic") | |
oculusprimesocket.sendString("setstreamactivitythreshold 0 40") | |
# wait for detection | |
oculusprimesocket.waitForReplySearch("<state> streamactivity (?!null)") | |
# run patrol route named 'recon' | |
oculusprimesocket.sendString("runroute recon") | |
# wait for route start and un-dock before restarting loop | |
oculusprimesocket.waitForReplySearch("<state> dockstatus un-docked") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment