Simple API¶
A simple, blocking API that wraps the Asynchonous API.
- class pupil_labs.realtime_api.simple.Device(address, port, full_name=None, dns_name=None, start_streaming_by_default=False, suppress_decoding_warnings=True)[source]¶
Bases:
DeviceBase
Hint
Use
pupil_labs.realtime_api.simple.discover_devices()
instead of initializing the class manually. See the Find one or more devices example.- property battery_state: Literal['OK', 'LOW', 'CRITICAL']¶
- Return type:
Literal
['OK'
,'LOW'
,'CRITICAL'
]
- estimate_time_offset(number_of_measurements=100, sleep_between_measurements_seconds=None)[source]¶
Estimate the time offset between the host device and the client.
See
pupil_labs.realtime_api.time_echo
for details.- Return type:
- property memory_state: Literal['OK', 'LOW', 'CRITICAL']¶
- Return type:
Literal
['OK'
,'LOW'
,'CRITICAL'
]
- property module_serial: str | None | Literal['default']¶
Returns
None
or"default"
if no glasses are connected
- receive_gaze_datum(timeout_seconds=None)[source]¶
- Return type:
Union
[GazeData
,DualMonocularGazeData
,EyestateGazeData
,None
]
- recording_cancel()[source]¶
Wraps
pupil_labs.realtime_api.device.Device.recording_cancel()
- Raises:
pupil_labs.realtime_api.device.DeviceError – if the recording could not be started Possible reasons include - Recording not running
- recording_start()[source]¶
Wraps
pupil_labs.realtime_api.device.Device.recording_start()
- Raises:
pupil_labs.realtime_api.device.DeviceError – if the recording could not be started. Possible reasons include - Recording already running - Template has required fields - Low battery - Low storage - No wearer selected - No workspace selected - Setup bottom sheets not completed
- Return type:
- recording_stop_and_save()[source]¶
Wraps
pupil_labs.realtime_api.device.Device.recording_stop_and_save()
- Raises:
pupil_labs.realtime_api.device.DeviceError – if the recording could not be started Possible reasons include - Recording not running - template has required fields
- send_event(event_name, event_timestamp_unix_ns=None)[source]¶
- Raises:
pupil_labs.realtime_api.device.DeviceError – if sending the event fails
- Return type:
- property serial_number_glasses: str | None | Literal['default']¶
Returns
None
or"default"
if no glasses are connected
- namedtuple pupil_labs.realtime_api.simple.MatchedGazeEyesSceneItem(scene, eyes, gaze)[source]¶
Bases:
NamedTuple
MatchedGazeEyesSceneItem(scene, eyes, gaze)
- Fields:
scene (
SimpleVideoFrame
) – Alias for field number 0eyes (
SimpleVideoFrame
) – Alias for field number 1gaze (
Union
[GazeData
,DualMonocularGazeData
,EyestateGazeData
]) – Alias for field number 2
- namedtuple pupil_labs.realtime_api.simple.MatchedItem(frame, gaze)[source]¶
Bases:
NamedTuple
MatchedItem(frame, gaze)
- Fields:
frame (
SimpleVideoFrame
) – Alias for field number 0gaze (
Union
[GazeData
,DualMonocularGazeData
,EyestateGazeData
]) – Alias for field number 1
- namedtuple pupil_labs.realtime_api.simple.SimpleVideoFrame(bgr_pixels, timestamp_unix_seconds)[source]¶
Bases:
NamedTuple
SimpleVideoFrame(bgr_pixels, timestamp_unix_seconds)
- Fields:
- property datetime¶
- property timestamp_unix_ns¶
- pupil_labs.realtime_api.simple.discover_devices(search_duration_seconds)[source]¶
Return all devices that could be found in the given search duration.
See also
The asynchronous equivalent
pupil_labs.realtime_api.discovery.discover_devices()
- Return type:
List
[Device
]
- pupil_labs.realtime_api.simple.discover_one_device(max_search_duration_seconds=10.0)[source]¶
Return the first device that could be found in the given search duration.
See also
The asynchronous equivalent
pupil_labs.realtime_api.discovery.Network.wait_for_new_device()
- Return type:
Optional
[Device
]