Events
An event is a text line starting with EVT, sent by the device on its own when its state changes. Events go to the PC set with DEST, on UDP port 55153 — the same port as command replies. They are never sent to the sender of the current command, and nothing is sent when no destination is set.
Events are only a hint to re-read the state: when in doubt, send INFO.
note
Only the first words of an event are stable. Free text after them is informational and may change: do not parse it.
Event list
| Event | Sent when |
|---|---|
EVT config id=<n> fs=… lower=… upper=… dsp=… dsp_hz=… channels=… setup=… | A setting really changed (from a command, a Studio program or another board). id is the new config_id. Repeating the current value sends nothing. |
EVT headstage connected | A headstage was plugged in. |
EVT headstage ready chip=<model> channels=<n> | The headstage is identified and its channel count is known. |
EVT headstage swapped | A different headstage replaced the previous one. |
EVT headstage lost | The headstage was unplugged or stopped answering. |
EVT headstage fault | A headstage is present but cannot be identified. |
EVT acquisition stopped (headstage change) | Acquisition was stopped automatically because the headstage changed. SETUP must be done again. |
EVT dest taken | Another PC has taken over the destination. Sent to the previous destination, once. See Session and Ownership. |
EVT i2c bus recovered | The I2C bus was recovered after a fault. |
chip=<model> is an opaque model identifier. Do not rely on its value.
Reading events
listen_events.py
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(("0.0.0.0", 55153))
while True:
data, addr = sock.recvfrom(2048)
for line in data.decode(errors="replace").splitlines():
if line.startswith("EVT "):
print(addr[0], line)