Last active
January 17, 2022 13:42
-
-
Save papr/83345454eca4794a298ca7d798b4587f to your computer and use it in GitHub Desktop.
Python script to turn off the Pupil Capture world camera via the Network API
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
msgpack>=1.0.0 | |
pyzmq |
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
import zmq | |
import msgpack | |
if __name__ == "__main__": | |
# Setup zmq context and remote helper | |
ctx = zmq.Context() | |
socket = zmq.Socket(ctx, zmq.REQ) | |
socket.connect("tcp://127.0.0.1:50020") | |
# send notification: | |
def notify(notification): | |
"""Sends ``notification`` to Pupil Remote""" | |
topic = "notify." + notification["subject"] | |
payload = msgpack.dumps(notification, use_bin_type=True) | |
socket.send_string(topic, flags=zmq.SNDMORE) | |
socket.send(payload) | |
return socket.recv_string() | |
notify( | |
{ | |
"subject": "start_plugin", | |
"name": "UVC_Source", | |
"args": {"frame_size": (1280, 720), "frame_rate": 30, "name": "Turned off"}, | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment