Skip to content

Instantly share code, notes, and snippets.

@xaxxontech
Last active January 12, 2016 09:11
Show Gist options
  • Save xaxxontech/1a49a2afc238b20989ed to your computer and use it in GitHub Desktop.
Save xaxxontech/1a49a2afc238b20989ed to your computer and use it in GitHub Desktop.
#!/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