ephys_link.platform_handler
Handle communications with platform specific API
Handles relaying WebSocket messages to the appropriate platform API functions and conducting error checks on the input and output values
Function names here are the same as the WebSocket events. They are called when the server receives an event from a client. In general, each function does the following:
Receive extracted arguments from
ephys_link.server
Call and check the appropriate platform API function (overloaded by each platform)
Log/handle successes and failures
Return the callback parameters to
ephys_link.server
Classes
An abstract class that defines the interface for a manipulator handler. |
- class PlatformHandler[source]
Bases:
ABC
An abstract class that defines the interface for a manipulator handler.
- get_manipulators() GetManipulatorsOutputData [source]
Get all registered manipulators
- Returns:
Callback parameters (manipulators, error)
- Return type:
- register_manipulator(manipulator_id: str) str [source]
Register a manipulator
- Parameters:
manipulator_id (str) – The ID of the manipulator to register.
- Returns:
Callback parameter (Error message (on error))
- Return type:
str
- unregister_manipulator(manipulator_id: str) str [source]
Unregister a manipulator
- Parameters:
manipulator_id (str) – The ID of the manipulator to unregister.
- Returns:
Callback parameters (error message (on error))
- get_pos(manipulator_id: str) PositionalOutputData [source]
Get the current position of a manipulator
- Parameters:
manipulator_id (str) – The ID of the manipulator to get the position of.
- Returns:
Callback parameters (manipulator ID, position in (x, y, z, w) (or an empty array on error), error message)
- Return type:
- async goto_pos(manipulator_id: str, position: list[float], speed: int) PositionalOutputData [source]
Move manipulator to position
- Parameters:
manipulator_id (str) – The ID of the manipulator to move
position (list[float]) – The position to move to
speed (int) – The speed to move at (in µm/s)
- Returns:
Callback parameters (manipulator ID, position in (x, y, z, w) (or an empty array on error), error message)
- Return type:
- async drive_to_depth(manipulator_id: str, depth: float, speed: int) DriveToDepthOutputData [source]
Drive manipulator to depth
- Parameters:
manipulator_id (str) – The ID of the manipulator to drive
depth (float) – The depth to drive to
speed (int) – The speed to drive at (in µm/s)
- Returns:
Callback parameters (manipulator ID, depth (or 0 on error), error message)
- Return type:
- set_inside_brain(manipulator_id: str, inside: bool) StateOutputData [source]
Set manipulator inside brain state (restricts motion)
- Parameters:
manipulator_id (str) – The ID of the manipulator to set the state of
inside (bool) – True if inside brain, False if outside
- Returns:
Callback parameters (manipulator ID, inside, error message)
- Return type:
- async calibrate(manipulator_id: str, sio: AsyncServer) str [source]
Calibrate manipulator
- Parameters:
manipulator_id (str) – ID of manipulator to calibrate
sio (
socketio.AsyncServer
) – SocketIO object (to call sleep)
- Returns:
Callback parameters (manipulator ID, error message)
- Return type:
str
- bypass_calibration(manipulator_id: str) str [source]
Bypass calibration of manipulator
- Parameters:
manipulator_id (str) – ID of manipulator to bypass calibration
- Returns:
Callback parameters (manipulator ID, error message)
- Return type:
str
- set_can_write(manipulator_id: str, can_write: bool, hours: float, sio: AsyncServer) StateOutputData [source]
Set manipulator can_write state (enables/disabled moving manipulator)
- Parameters:
manipulator_id (str) – The ID of the manipulator to set the state of
can_write (bool) – True if allowed to move, False if outside
hours (float) – The number of hours to allow writing (0 = forever)
sio (
socketio.AsyncServer
) – SocketIO object from server to emit reset event
- Returns:
Callback parameters (manipulator ID, can_write, error message)
- Return type: