MRP.MRPHalLocal

class for interfacing (hardware, protocol) sensors running the UnifiedSensorFirmware

class MRPHalLocal.MRPHalLocal(_selected_port: <module 'MRP.MRPHalSerialPortInformation' from '/home/docs/checkouts/readthedocs.org/user_builds/magneticreadoutprocessing/checkouts/latest/src/MagneticReadoutProcessing/MRP/MRPHalSerialPortInformation.py'>, _type: ~MRP.MRPHalSerialPortInformation.MRPRemoteSensorType = MRPRemoteSensorType.BaseSensor)

Baseclass for hardware sensor interaction using a serial interface. It contains functions to send rec commands from/to the sensor but no interpretation

connect() bool

connect to the selected serial port

Returns:

returns true if a serial connection was made

Return type:

bool

disconnect()

disconnects a opened serial port

get_sensor_capabilities() [<class 'str'>]

returns the sensor capabilities defined in the sensor firmware as string list

Returns:

capabilities e.g. static, axis_x,..

Return type:

[str]

get_sensor_count() int

returns the connected sensors relevant for chained sensors

Returns:

sensor count

Return type:

str

get_sensor_id() str

returns the sensors id

Returns:

id as string default unknown

Return type:

str

get_sensor_names() [<class 'str'>]

returns the sensor names defined in the sensor firmware as string list

Returns:

capabilities e.g. static, axis_x,..

Return type:

[str]

is_connected() bool

returns true if the serial port is open

Returns:

returns true if a serial connection is open

Return type:

bool

query_command_float(_cmd: str) float

queries a sensor command and returns the response as float

Parameters:

_cmd (str) – command like help id read…

Returns:

returns the as float parsed result

Return type:

float

query_command_int(_cmd: str) int

queries a sensor command and returns the response as int

Parameters:

_cmd (str) – command like help id read…

Returns:

returns the as int parsed result

Return type:

int

query_command_str(_cmd: str) str

queries a sensor command and returns the response as string

Parameters:

_cmd (str) – command like help id read…

Returns:

returns the response as concat string

Return type:

str

send_command(_cmd: str) [<class 'str'>]

sends a command to the sensor

param _cmd:

command like help id read…

type _cmd:

str

returns:

returns sensor response as line separated by ‘

rtype:

[str]

set_serial_port_information(_port: <module 'MRP.MRPHalSerialPortInformation' from '/home/docs/checkouts/readthedocs.org/user_builds/magneticreadoutprocessing/checkouts/latest/src/MagneticReadoutProcessing/MRP/MRPHalSerialPortInformation.py'>)

set the serial port information = which serial port to connect to if the connect() function is called

Parameters:

_port (MRPHalSerialPortInformation) – serial port information

exception MRPHalLocal.MRPHalLocalException(message='MRPHalLocalException thrown')
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.