API reference

SpikeGLX-remoteCTRL

class spikeGLX_remote.socket_utils.MessageStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Enum for message status to be able to change the message easily across the code

class spikeGLX_remote.socket_utils.MessageType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Enum for message types to be able to change the message easily across the code

class spikeGLX_remote.socket_utils.SocketComm(soctype: str = 'server', host: str = 'localhost', port: int = 8800, use_ssl: bool = False)[source]

Class to handle socket communication between processes or devices :param soctype: str: type of socket, either ‘client’ or ‘server’ :param host: str: host IP address :param port: int: port number :param use_ssl: bool: use ssl encryption

Parameters:
  • acception_thread – threading.Thread: thread to accept connection

  • ssl_sock – ssl.SSLSocket: ssl socket

  • sock – socket.socket: socket

  • _sock – socket.socket: socket

  • _ssl_sock – ssl.SSLSocket: ssl socket

  • context – ssl.SSLContext: ssl context

  • use_ssl – bool: use ssl encryption

  • connected – bool: connection status

  • stop_event – threading.Event: event to stop waiting for connection

  • log – logging.Logger: logger

  • message_time – float: time of last message

accept_connection()[source]

Accepts connection-request from client :return:

close_socket()[source]

Closes the socket :return:

connect() bool[source]

Connects to the server

create_socket()[source]

Creates the socket for the server or client

read_json_message() [<class 'dict'>, None][source]

Reads a json message from the socket until a linebreak is reached then decodes it via json :return: dict, None: message or None if no message is received

read_json_message_fast() [<class 'dict'>, None][source]

Reads a json message from the socket via a large bulk then decodes it via json :return: dict, None: message or None if no message is received

read_json_message_fast_linebreak() [<class 'dict'>, None][source]

Reads a json message from the socket until a linebreak is reached then decodes it via json :return: dict, None: message or None if no message is received

send_json_message(message: dict)[source]

Sends a json message over the socket :param message: dict: message to send of SocketMessage type :return:

stop_waiting_for_connection()[source]

sets the stop event, so the thread will stop waiting for a connection

threaded_accept_connection()[source]

Accepts connection in a separate thread, to not block the main thread

class spikeGLX_remote.socket_utils.SocketMessage[source]

Class to hold all the messages that can be sent over the socket

Parameters:
  • session_path – str: path to the session

  • fps – float: frames per second

  • session_id – str: session id

  • daq_setting_file – str: path to the daq setting file

  • basler_setting_file – str: path to the basler setting file

  • pulse_lag – int: pulse lag after DAQ start

  • start_daq – dict: message to start the daq

  • stop_daq – dict: message to stop the daq

  • start_daq_pulses – dict: message to start the daq pulses

  • stop_daq_pulses – dict: message to stop the daq pulses

  • start_daq_viewing – dict: message to start the daq viewing

  • poll_status – dict: message to poll the status

  • start_video_rec – dict: message to start the video recording

  • start_video_view – dict: message to start the video viewing

  • stop_video – dict: message to stop the video

  • start_video_calibrec – dict: message to start the calibration recording

  • copy_files – dict: message to copy the files

  • purge_files – dict: message to purge the files

  • view_spike_glx – dict: message to view the spike glx

  • start_spike_glx – dict: message to start the spike glx

  • stop_spike_glx – dict: message to stop the spike glx

update_messages()[source]

Updates all the messages with current values. :return: