Skip to content

Device#

This is the base class for all Python defined devices located in the PythonDevices folder inside the Measmatic data directory. For properties and methods available for devices that are defined by Measmatic, please refer to Device.


property communicator#

The reference to the communicator of the device.

Returns#

Type Description
Communicator The reference to the communicator of the device.

property device_class#

The class of the device.

Returns#

Type Description
DeviceClass The class of the device.

property device_configuration#

The configuration of the device.

Returns#

Type Description
Any The configuration of the device.

property device_type_caption#

The designation of the device type. This designation for the device type is intended for display within the user interface. It specifies a specific device type and does not change, unlike the name, which can be changed by the user.

Returns#

Type Description
str The designation of the device type.

property identification_caption#

Returns a well-formed name for the device. This designation should be set based on IdentificationRawString() during initialization with Initialize().

Returns#

Type Description
str A well-formed name for the device.

property identification_raw_string#

Returns the character string identifying the device. This should be set during initialization with Initialize() of the device and represents the unprocessed response to the request *IDN?

Returns#

Type Description
str The identification raw string.

property is_debug_enabled#

If debug is enabled.

Returns#

Type Description
bool True if debug is enabled otherwise False .

property is_initialized#

If the device is initialized.

Returns#

Type Description
bool True if device is initialized otherwise False .

property name#

Returns the name of the device. The name is used to identify the device by the user. The user can set the name according to their preference.

Returns#

Type Description
str The name of the device.

method after_initialize()#

Method can be overridden and is called after the device was successfully initialized.


method after_shutdown()#

Method can be overridden and is executed after device shutdown is called.


method before_initialize()#

Method can be overridden and is executed before device shutdown is called.


method before_shutdown()#

Method can be overridden and is executed in order to check the model. If the model is not correct, an exception should be thrown.


method check_model()#

Method can be overridden and is executed in order to check the model. If the model is not correct, an exception should be thrown.


method end_try_lock()#

Ends exclusive control of the device. This function must be called up if TryLock is used.


method establish_safe_condition_impl()#

Method can be overridden and is called to establish a safe condition of the device.


method initialize()#

Method can be overridden and is called to initialize the device. Locking and exception handling needs not to be done in this method as it is already done by the base class.


method query(str: str, timeout_in_milliseconds: int = -1)#

Sends a character string to the device and then waits for the response.

Parameters#

Name Description
str The string to be sent.
timeout_in_milliseconds The maximum timeout that is waited to lock the device and send the request. Default: -1

Returns#

Type Description
str The response from the device.

method receive_line(timeout_in_milliseconds: int = -1)#

Receives a line from the device.

Parameters#

Name Description
timeout_in_milliseconds The maximum timeout that is waited to lock the device and receive the line. Default: -1

Returns#

Type Description
str The response from the device.

method send_line(str: str, timeout_in_milliseconds: int = -1)#

Sends a line to the device.

Parameters#

Name Description
str The string to be sent.
timeout_in_milliseconds The maximum timeout that is waited to lock the device and receive the line. Default: -1

method try_lock(timeout_in_milliseconds: int = -1, should_log_error_message: bool = true)#

Locks the device for access from other threads.

Parameters#

Name Description
timeout_in_milliseconds The maximum timeout that is waited to lock the device. Default: -1
should_log_error_message A value indicating wether an error message should be written to application log in case the lock for the device Default: true

Returns#

Type Description
bool True if the device could be locked within the given time otherwise False .