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.
- reset() bool [source]
Reset handler.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- get_manipulators() GetManipulatorsResponse [source]
Get all registered manipulators.
- Returns:
Result of connected manipulators, platform information, and error message (if any).
- Return type:
vbl_aquarium.models.ephys_link.GetManipulatorsResponse
- register_manipulator(manipulator_id: str) str [source]
Register a manipulator.
- Parameters:
manipulator_id (str) – The ID of the manipulator to register.
- Returns:
Error message on error, empty string otherwise.
- 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:
Error message on error, empty string otherwise.
- Return type:
str
- get_pos(manipulator_id: str) PositionalResponse [source]
Get the current position of a manipulator.
- Parameters:
manipulator_id (str) – The ID of the manipulator to get the position of.
- Returns:
Positional information for the manipulator and error message (if any).
- Return type:
vbl_aquarium.models.ephys_link.PositionalResponse
- get_angles(manipulator_id: str) AngularResponse [source]
Get the current position of a manipulator.
- Parameters:
manipulator_id (str) – The ID of the manipulator to get the angles of.
- Returns:
Angular information for the manipulator and error message (if any).
- Return type:
vbl_aquarium.models.ephys_link.AngularResponse
- get_shank_count(manipulator_id: str) ShankCountResponse [source]
Get the number of shanks on the probe
- Parameters:
manipulator_id (str) – The ID of the manipulator to get the number of shanks of.
- Returns:
Number of shanks on the probe.
- Return type:
vbl_aquarium.models.ephys_link.ShankCountResponse
- async goto_pos(request: GotoPositionRequest) PositionalResponse [source]
Move manipulator to position
- Parameters:
request (
vbl_aquarium.models.ephys_link.GotoPositionRequest
) – The goto request parsed from the server.- Returns:
Resulting position of the manipulator and error message (if any).
- Return type:
vbl_aquarium.models.ephys_link.PositionalResponse
- async drive_to_depth(request: DriveToDepthRequest) DriveToDepthResponse [source]
Drive manipulator to depth
- Parameters:
request (
vbl_aquarium.models.ephys_link.DriveToDepthRequest
) – The drive to depth request parsed from the server.- Returns:
Resulting depth of the manipulator and error message (if any).
- Return type:
ephys_link.common.DriveToDepthOutputData
- set_inside_brain(request: InsideBrainRequest) BooleanStateResponse [source]
Set manipulator inside brain state (restricts motion)
- Parameters:
request (
vbl_aquarium.models.ephys_link.InsideBrainRequest
) – The inside brain request parsed from the server.- Returns:
New inside brain state of the manipulator and error message (if any).
- Return type:
vbl_aquarium.models.ephys_link.BooleanStateResponse
- async calibrate(manipulator_id: str, sio: AsyncClient | AsyncServer) str [source]
Calibrate manipulator
- Parameters:
manipulator_id (str) – ID of manipulator to calibrate
sio (
socketio.AsyncServer
) – SocketIO object (to call sleep)
- Returns:
Error message on error, empty string otherwise.
- 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:
Error message on error, empty string otherwise.
- Return type:
str
- set_can_write(request: CanWriteRequest) BooleanStateResponse [source]
Set manipulator can_write state (enables/disabled moving manipulator)
- Parameters:
request (
vbl_aquarium.models.ephys_link.CanWriteRequest
) – The can write request parsed from the server.- Returns:
New can_write state of the manipulator and error message (if any).
- Return type:
ephys_link.common.StateOutputData