mxcubeweb.core.adapter.adapter_base#

Classes

ActuatorAdapterBase(ho, role, app[, ...])

AdapterBase(ho, role, app[, ...])

Hardware Object Adapter Base class.

class mxcubeweb.core.adapter.adapter_base.ActuatorAdapterBase(ho, role, app, resource_handler_config=None)[source]#

Bases: AdapterBase

get_value()[source]#

Retrieve value from underlying hardware object.

Returns:

The value.

Return type:

(str)

Raises:

ValueError – When value for any reason can’t be retrieved.

limits()[source]#

Read the energy limits.

Returns:

Two floats (min, max).

Return type:

(tuple)

Raises:

ValueError – When limits for any reason can’t be retrieved.

set_value(value) str[source]#

Sets a value on underlying hardware object.

Parameters:

value (float) – Value to be set.

Returns:

The actual value set as str.

Return type:

(str)

Raises:
  • ValueError – When conversion or treatment of value fails.

  • StopIteration – When a value change was interrupted (abort/cancel).

Emits:

hardware_object_value_changed with values over websocket

stop()[source]#

Stop an action/movement.

value_change(*args, **kwargs)[source]#

Signal handler to send values to the client via socketIO.

class mxcubeweb.core.adapter.adapter_base.AdapterBase(ho, role, app, resource_handler_config=None)[source]#

Bases: object

Hardware Object Adapter Base class.

property adapter_type#

Adapter type.

Returns:

The data type of the value

Return type:

(str)

available()[source]#

Check if the hardware object is considered to be available/online/enabled.

Returns:

True if available.

Return type:

(bool)

emit_ho_changed(state, **kwargs)[source]#

Signal handler to send entire object to the client via socketIO.

property ho#

Underlaying HardwareObject.

Returns:

HardwareObject

Return type:

(object)

msg()[source]#

Return a message describing the current state.

Should be used to communicate details of the state to the user.

Returns:

The message string.

Return type:

(str)

read_only()[source]#

Return true if the hardware object is read only.

Return true if the hardware object is read only and set_value can not be called.

Returns:

True if read enly.

Return type:

(bool)

state()[source]#

Retrieve the state of the underlying hardware object as a JavaScript string.

Retrieves the state of the underlying hardware object and converts it to a str that can be used by the javascript front end.

Returns:

The state

Return type:

(str)

state_change(state, **kwargs)[source]#

Signal handler to send the state to the client via socketIO.