Device

Contents

Device#

DeviceImpl#

class tango.LatestDeviceImpl(*args)[source]#

Latest implementation of the TANGO device base class (alias for Device_6Impl).

It inherits from CORBA classes where all the network layer is implemented.

add_attribute(attr, r_meth: Callable | None = None, w_meth: Callable | None = None, is_allo_meth: Callable | None = None) Attr#

Add a new attribute to the device attribute list.

Please, note that if you add an attribute to a device at device creation time, this attribute will be added to the device class attribute list. Therefore, all devices belonging to the same class created after this attribute addition will also have this attribute.

If you pass a reference to unbound method for read, write or is_allowed method (e.g. DeviceClass.read_function or self.__class__.read_function), during execution the corresponding bound method (self.read_function) will be used.

Note: Calling the synchronous add_attribute method from a coroutine function in an asyncio server may cause a deadlock. Use await async_add_attribute() instead. However, if overriding the synchronous method initialize_dynamic_attributes, then the synchronous add_attribute method must be used, even in asyncio servers.

Parameters:
  • attr (attribute or Attr or AttrData) – the new attribute to be added to the list.

  • r_meth (typing.Callable) – the read method to be called on a read request (if attr is of type server.attribute, then use the fget field in the attr object instead)

  • w_meth (typing.Callable) – the write method to be called on a write request (if attr is writable) (if attr is of type server.attribute, then use the fset field in the attr object instead)

  • is_allo_meth (typing.Callable) – the method that is called to check if it is possible to access the attribute or not (if attr is of type server.attribute, then use the fisallowed field in the attr object instead)

Raises:

DevFailed

add_command(cmd, device_level: bool = True)#

Add a new command to the device command list.

Parameters:
  • cmd (server.command) – the new command to be added to the list

  • device_level (bool) – Set this flag to true if the command must be added for only this device

Raises:

DevFailed

add_version_info(self: tango._tango.DeviceImpl, key: str, value: str) None#

Method to add information about the module version a device is using

Parameters:
  • key (str) – Module name

  • value (str) – Module version, or other relevant information.

Added in version 10.0.0.

always_executed_hook(self: tango._tango.Device_6Impl) None#

Hook method.

Default method to implement an action necessary on a device before any command is executed. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs

Raises:

DevFailed: This method does not throw exception but a redefined method can

append_status(self: tango._tango.DeviceImpl, status: str, new_line: bool = False) None#

Appends a string to the device status.

Parameters:
  • status (str) – the string to be appended to the device status

  • new_line (bool) – If true, appends a new line character before the string. Default is False

async async_add_attribute(attr, r_meth: Callable | None = None, w_meth: Callable | None = None, is_allo_meth: Callable | None = None)#

Add a new attribute to the device attribute list.

Please, note that if you add an attribute to a device at device creation time, this attribute will be added to the device class attribute list. Therefore, all devices belonging to the same class created after this attribute addition will also have this attribute.

If you pass a reference to unbound method for read, write or is_allowed method (e.g. DeviceClass.read_function or self.__class__.read_function), during execution the corresponding bound method (self.read_function) will be used.

Note: Calling the synchronous add_attribute method from a coroutine function in an asyncio server may cause a deadlock. Use await async_add_attribute() instead. However, if overriding the synchronous method initialize_dynamic_attributes, then the synchronous add_attribute method must be used, even in asyncio servers.

Parameters:
  • attr (attribute or Attr or AttrData) – the new attribute to be added to the list.

  • r_meth (typing.Callable) – the read method to be called on a read request (if attr is of type server.attribute, then use the fget field in the attr object instead)

  • w_meth (typing.Callable) – the write method to be called on a write request (if attr is writable) (if attr is of type server.attribute, then use the fset field in the attr object instead)

  • is_allo_meth (typing.Callable) – the method that is called to check if it is possible to access the attribute or not (if attr is of type server.attribute, then use the fisallowed field in the attr object instead)

Raises:

DevFailed

Added in version 10.0.0.

async async_remove_attribute(attr_name: str, free_it: bool = False, clean_db: bool = True)#

Remove one attribute from the device attribute list.

Note: Call of synchronous remove_attribute method from a coroutine function in an asyncio server may cause a deadlock. Use await async_remove_attribute() instead. However, if overriding the synchronous method initialize_dynamic_attributes, then the synchronous remove_attribute method must be used, even in asyncio servers.

Parameters:
  • attr_name (str) – attribute name

  • free_it (bool) – free Attr object flag. Default False

  • clean_db (bool) – clean attribute related info in db. Default True

Raises:

DevFailed

Added in version 10.0.0.

check_command_exists(self: tango._tango.DeviceImpl, cmd_name: str) None#

Check that a command is supported by the device and does not need input value.

The method throws an exception if the command is not defined or needs an input value.

Parameters:

cmd_name (str) – the command name

Raises:

DevFailed

Raises:

API_IncompatibleCmdArgumentType

Raises:

API_CommandNotFound

debug_stream(msg: str, *args, source: Callable | None = None) None#

Sends the given message to the tango debug stream.

Since PyTango 7.1.3, the same can be achieved with:

print(msg, file=self.log_debug)
Parameters:
  • msg (str) – the message to be sent to the debug stream

  • *args – Arguments to format a message string.

  • source (typing.Callable) – Function that will be inspected for filename and lineno in the log message.

Added in version 9.4.2: added source parameter

delete_device(self: tango._tango.Device_6Impl) None#
dev_state(self: tango._tango.Device_6Impl) tango._tango.DevState#

Get device state.

Default method to get device state. The behaviour of this method depends on the device state. If the device state is ON or ALARM, it reads the attribute(s) with an alarm level defined, check if the read value is above/below the alarm and eventually change the state to ALARM, return the device state. For all the other device states, this method simply returns the state.

This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.

Raises:

DevFailed: If it is necessary to read attribute(s) and a problem occurs during the reading

dev_status(self: tango._tango.Device_6Impl) str#

Get device status.

Default method to get device status. It returns the contents of the device dev_status field. If the device state is ALARM, alarm messages are added to the device status.

This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.

Raises:

DevFailed: If it is necessary to read attribute(s) and a problem occurs during the reading

error_stream(msg: str, *args, source: Callable | None = None) None#

Sends the given message to the tango error stream.

Since PyTango 7.1.3, the same can be achieved with:

print(msg, file=self.log_error)
Parameters:
  • msg (str) – the message to be sent to the error stream

  • *args – Arguments to format a message string.

  • source (typing.Callable) – Function that will be inspected for filename and lineno in the log message.

Added in version 9.4.2: added source parameter

fatal_stream(msg: str, *args, source: Callable | None = None) None#

Sends the given message to the tango fatal stream.

Since PyTango 7.1.3, the same can be achieved with:

print(msg, file=self.log_fatal)
Parameters:
  • msg (str) – the message to be sent to the fatal stream

  • *args – Arguments to format a message string.

  • source (typing.Callable) – Function that will be inspected for filename and lineno in the log message.

Added in version 9.4.2: added source parameter

fill_attr_polling_buffer(attribute_name: str, attr_history_stack: TimedAttrData | list[TimedAttrData]) None#

Fill attribute polling buffer with your own data. E.g.:

def fill_history(self):
    # note is such case quality will ATTR_VALID, and time_stamp will be time.time()
    self.fill_attr_polling_buffer(attribute_name, TimedAttrData(my_new_value))

or:

def fill_history(self):
    data = TimedAttrData(value=my_new_value,
                         quality=AttrQuality.ATTR_WARNING,
                         w_value=my_new_w_value,
                         time_stamp=my_time)

    self.fill_attr_polling_buffer(attribute_name, data)

or:

def fill_history(self):
    data = [TimedAttrData(my_new_value),
            TimedAttrData(error=RuntimeError("Cannot read value")]

    self.fill_attr_polling_buffer(attribute_name, data)
Parameters:
Raises:

DevFailed

Added in version 10.1.0.

fill_cmd_polling_buffer(command_name: str, cmd_history_stack: TimedCmdData | list[TimedCmdData]) None#

Fill command polling buffer with your own data. E.g.:

def fill_history(self):
    # note is such case time_stamp will be set to time.time()
    self.fill_cmd_polling_buffer(command_name, TimedCmdData(my_new_value))

or:

def fill_history(self):
    data = TimedCmdData(value=my_new_value,
                         time_stamp=my_time)

    self.fill_cmd_polling_buffer(command_name, data)

or:

def fill_history(self):
    data = [TimedCmdData(my_new_value),
            TimedCmdData(error=RuntimeError("Cannot read value")]

    self.fill_cmd_polling_buffer(command_name, data)
Parameters:
Raises:

DevFailed

Added in version 10.1.0.

get_attr_min_poll_period(self: tango._tango.DeviceImpl) tango._tango.StdStringVector#

Returns the min attribute poll period in milliseconds

Added in version 7.2.0.

get_attr_poll_ring_depth(self: tango._tango.DeviceImpl, attr_name: str) int#

Returns the attribute poll ring depth.

Parameters:

attr_name (str) – the attribute name

Added in version 7.1.2.

get_attribute_config(attr_names) list[AttributeConfig]#

Returns the list of AttributeConfig for the requested names

Parameters:

attr_names (list[str] | str) – sequence of str with attribute names, or single attribute name

Returns:

tango.AttributeConfig for each requested attribute name

Return type:

list[tango.AttributeConfig]

get_attribute_config_2(attr_names: str | list[str]) list[AttributeConfig_2]#

Returns the list of AttributeConfig_2 for the requested names

Parameters:

attr_names (list[str] | str) – sequence of str with attribute names, or single attribute name

Returns:

tango.AttributeConfig_2 for each requested attribute name

get_attribute_config_3(attr_names: str | list[str]) list[AttributeConfig_3]#

Returns the list of AttributeConfig_3 for the requested names

Parameters:

attr_names (list[str] | str) – sequence of str with attribute names, or single attribute name

Returns:

tango.AttributeConfig_3 for each requested attribute name

get_attribute_poll_period(self: tango._tango.DeviceImpl, attr_name: str) int#

Returns the attribute polling period (milliseconds) or 0 if the attribute is not polled.

Parameters:

attr_name (str) – attribute name

Added in version 8.0.0.

get_client_ident(self: tango._tango.DeviceImpl) tango._tango.ClientAddr#

Get client identification.

This method is only useful while handling a command or attribute read/write. I.e., when a method has been invoked by a client. It will return None if the method was not invoked in the context of a client call. E.g., called on startup, or called internally (e.g., from the polling loop).

It can only be used with tango.GreenMode.Synchronous device servers. Other device servers will not have the correct context active at the time the attribute/command handler is running. E.g., for an asyncio device server, the handler is running in the asyncio event loop thread.

Returns:

client identification structure

Return type:

ClientAddr | None

get_cmd_min_poll_period(self: tango._tango.DeviceImpl) tango._tango.StdStringVector#

Returns the min command poll period in milliseconds.

Added in version 7.2.0.

get_cmd_poll_ring_depth(self: tango._tango.DeviceImpl, cmd_name: str) int#

Returns the command poll ring depth.

Parameters:

cmd_name (str) – the command name

Added in version 7.1.2.

get_command_poll_period(self: tango._tango.DeviceImpl, cmd_name: str) int#

Returns the command polling period (milliseconds) or 0 if the command is not polled.

Parameters:

cmd_name (str) – command name

Added in version 8.0.0.

get_dev_idl_version(self: tango._tango.DeviceImpl) int#

Returns the IDL version.

Added in version 7.1.2.

get_device_attr(self: tango._tango.DeviceImpl) tango._tango.MultiAttribute#

Get device multi attribute object.

get_device_class() DeviceClass#

Get device class singleton.

get_device_properties(ds_class: DeviceClass = None) None#

Utility method that fetches all the device properties from the database and converts them into members of this DeviceImpl.

Parameters:

ds_class (DeviceClass) – the DeviceClass object. Optional. Default value is None meaning that the corresponding DeviceClass object for this DeviceImpl will be used

Raises:

DevFailed:

get_exported_flag(self: tango._tango.DeviceImpl) bool#

Returns the state of the exported flag

Added in version 7.1.2.

get_logger(self: tango._tango.DeviceImpl) tango._tango.Logger#

Returns the Logger object for this device

get_min_poll_period(self: tango._tango.DeviceImpl) int#

Returns the min poll period in milliseconds.

Added in version 7.2.0.

get_name(self: tango._tango.DeviceImpl) str#

Get the device name.

get_non_auto_polled_attr(self: tango._tango.DeviceImpl) tango._tango.StdStringVector#

Returns the list of non automatic polled attributes

Added in version 7.1.2.

get_non_auto_polled_cmd(self: tango._tango.DeviceImpl) tango._tango.StdStringVector#

Returns the list of non automatic polled commands

Added in version 7.1.2.

get_poll_old_factor(self: tango._tango.DeviceImpl) int#

Returns the poll old factor

Added in version 7.1.2.

get_poll_ring_depth(self: tango._tango.DeviceImpl) int#

Returns the poll ring depth

Added in version 7.1.2.

get_polled_attr(self: tango._tango.DeviceImpl) tango._tango.StdStringVector#

Returns the list of polled attributes

Added in version 7.1.2.

get_polled_cmd(self: tango._tango.DeviceImpl) tango._tango.StdStringVector#

Returns the list of polled commands

Added in version 7.1.2.

get_prev_state(self: tango._tango.DeviceImpl) tango._tango.DevState#

Get the device’s previous state.

get_state(self: tango._tango.DeviceImpl) tango._tango.DevState#

Get the device state.

get_status(self: tango._tango.DeviceImpl) str#

Get the device status.

get_version_info(self: tango._tango.DeviceImpl) dict#

Returns a dict with versioning of different modules related to the pytango device.

Example:
{
    "Build.PyTango.NumPy": "1.26.4",
    "Build.PyTango.Pybind11": "3.0.1",
    "Build.PyTango.Python": "3.12.2",
    "Build.PyTango.cppTango":"10.0.0",
    "NumPy": "1.26.4",
    "PyTango": "10.0.0.dev0",
    "Python": "3.12.2",
    "cppTango": "10.0.0",
    "omniORB": "4.3.2",
    "zmq": "4.3.5"
}

Added in version 10.0.0.

info_stream(msg: str, *args, source: Callable | None = None) None#

Sends the given message to the tango info stream.

Since PyTango 7.1.3, the same can be achieved with:

print(msg, file=self.log_info)
Parameters:
  • msg (str) – the message to be sent to the info stream

  • *args – Arguments to format a message string.

  • source (typing.Callable) – Function that will be inspected for filename and lineno in the log message.

Added in version 9.4.2: added source parameter

init_device(self: tango._tango.Device_6Impl) None#
init_logger(self: tango._tango.DeviceImpl) None#

Setups logger for the device. Called automatically when device starts.

is_attribute_polled(self: tango._tango.DeviceImpl, attr_name: str) bool#

True if the attribute is polled.

Parameters:

attr_name (str) – attribute name

is_command_polled(self: tango._tango.DeviceImpl, cmd_name: str) bool#

True if the command is polled.

Parameters:

cmd_name (str) – attribute name

is_device_locked(self: tango._tango.DeviceImpl) bool#

Returns if this device is locked by a client.

Added in version 7.1.2.

is_polled(self: tango._tango.DeviceImpl) bool#

Returns if it is polled

Added in version 7.1.2.

is_there_subscriber(self: tango._tango.DeviceImpl, attr_name: str, event_type: tango._tango.EventType) bool#

Check if there is subscriber(s) listening for the event.

This method returns a boolean set to true if there are some subscriber(s) listening on the event specified by the two method arguments. Be aware that there is some delay (up to 600 sec) between this method returning false and the last subscriber unsubscription or crash…

The device interface change event is not supported by this method.

Parameters:
  • attr_name (str) – the attribute name

  • event_type (EventType) – the event type

poll_attribute(self: tango._tango.DeviceImpl, attr_name: str, period_ms: SupportsInt | SupportsIndex) None#

Add an attribute to the list of polled attributes.

Parameters:
  • attr_name (str) – attribute name

  • period_ms (int) – polling period in milliseconds

poll_command(self: tango._tango.DeviceImpl, cmd_name: str, period_ms: SupportsInt | SupportsIndex) None#

Add a command to the list of polled commands.

Parameters:
  • cmd_name (str) – command name

  • period_ms (int) – polling period in milliseconds

push_alarm_event(self, attr_name: str, except: Exception)#
push_alarm_event(self, attr_name: str, data: Any) None
push_alarm_event(self, attr_name: str, data: Any, time_stamp: float, quality: AttrQuality) None
push_alarm_event(self, attr_name: str, str_data: str, data: Any) None
push_alarm_event(self, attr_name: str, str_data: str, data: Any, time_stamp: float, quality: AttrQuality) None

Push an alarm event for the given attribute name.

Parameters:
  • attr_name (str) – attribute name

  • data (typing.Any) – the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type

  • str_data (str) – special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.

  • except (Exception | DevFailed) – Instead of data, you may want to send an exception.

  • time_stamp (float) – the time stamp

  • quality (AttrQuality) – the attribute quality factor

Raises:

DevFailed: If the attribute data type is not coherent.

Changed in version 10.1.0: Removed optional ‘dim_x’ and ‘dim_y’ arguments. The dimensions are automatically determined from the data.

push_archive_event(self, attr_name: str, except: Exception)#
push_archive_event(self, attr_name: str, data: Any) None
push_archive_event(self, attr_name: str, data: Any, time_stamp: float, quality: AttrQuality) None
push_archive_event(self, attr_name: str, str_data: str, data: Any) None
push_archive_event(self, attr_name: str, str_data: str, data: Any, time_stamp: float, quality: AttrQuality) None

Push an archive event for the given attribute name.

Parameters:
  • attr_name (str) – attribute name

  • data (typing.Any) – the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type

  • str_data (str) – special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.

  • except (Exception | DevFailed) – Instead of data, you may want to send an exception.

  • time_stamp (float) – the time stamp

  • quality (AttrQuality) – the attribute quality factor

Raises:

DevFailed: If the attribute data type is not coherent.

Changed in version 10.1.0: Removed optional ‘dim_x’ and ‘dim_y’ arguments. The dimensions are automatically determined from the data.

push_att_conf_event(self: tango._tango.DeviceImpl, attr: tango._tango.Attribute) None#

Push an attribute configuration event.

Parameters:

attr (Attribute) – the attribute for which the configuration event will be sent.

Added in version 7.2.1.

push_change_event(self, attr_name: str, except: Exception)#
push_change_event(self, attr_name: str, data: Any) None
push_change_event(self, attr_name: str, data: Any, time_stamp: float, quality: AttrQuality) None
push_change_event(self, attr_name: str, str_data: str, data: Any) None
push_change_event(self, attr_name: str, str_data: str, data: Any, time_stamp: float, quality: AttrQuality) None

Push a change event for the given attribute name.

Parameters:
  • attr_name (str) – attribute name

  • data (typing.Any) – the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type

  • str_data (str) – special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.

  • except (Exception | DevFailed) – Instead of data, you may want to send an exception.

  • time_stamp (float) – the time stamp

  • quality (AttrQuality) – the attribute quality factor

Raises:

DevFailed: If the attribute data type is not coherent.

Changed in version 10.1.0: Removed optional ‘dim_x’ and ‘dim_y’ arguments. The dimensions are automatically determined from the data.

push_data_ready_event(self: tango._tango.DeviceImpl, attr_name: str, counter: SupportsInt | SupportsIndex) None#

Push a data ready event for the given attribute name.

The method needs the attribute name and a “counter” which will be passed within the event

Parameters:
  • attr_name (str) – attribute name

  • counter (int) – the user counter

Raises:

DevFailed: If the attribute name is unknown

push_event(self, attr_name: str, filt_names, filt_vals, except: Exception)#
push_event(self, attr_name: str, filt_names, filt_vals, data: Any) None
push_event(self, attr_name: str, filt_names, filt_vals, str_data: str, data: Any) None
push_event(self, attr_name: str, filt_names, filt_vals, data: Any, time_stamp: float, quality: AttrQuality) None
push_event(self, attr_name: str, filt_names, filt_vals, str_data: str, data: Any, time_stamp: float, quality: AttrQuality) None

Push a user event for the given attribute name.

Parameters:
  • attr_name (str) – attribute name

  • filt_names (:py:obj:list[str]) – unused (kept for backwards compatibility) - pass an empty list.

  • filt_vals (:py:obj:list[float]) – unused (kept for backwards compatibility) - pass an empty list.

  • data (typing.Any) – the data to be sent as attribute event data. Data must be compatible with the attribute type and format. for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements compatible with the attribute type

  • str_data (str) – special variation for DevEncoded data type. In this case ‘data’ must be a str or an object with the buffer interface.

  • except (Exception | DevFailed) – Instead of data, you may want to send an exception.

  • time_stamp (float) – the time stamp

  • quality (AttrQuality) – the attribute quality factor

Raises:

DevFailed: If the attribute data type is not coherent.

Changed in version 10.1.0: Removed optional ‘dim_x’ and ‘dim_y’ arguments. The dimensions are automatically determined from the data.

read_attr_hardware(self: tango._tango.Device_6Impl, attr_list: tango._tango.StdLongVector) None#

Read the hardware to return attribute value(s).

Default method to implement an action necessary on a device to read the hardware involved in a read attribute CORBA call. This method must be redefined in sub-classes in order to support attribute reading

Parameters:

attr_list (list[int]) – list of indices in the device object attribute vector of an attribute to be read.

Raises:

DevFailed: This method does not throw exception but a redefined method can

register_signal(self: tango._tango.DeviceImpl, signo: SupportsInt | SupportsIndex, own_handler: bool = False) None#

Register this device as device to be informed when signal signo is sent to to the device server process

Parameters:
  • signo (int) – signal identifier

  • own_handler (bool) – true if you want the device signal handler to be executed in its own handler instead of being executed by the signal thread. If this parameter is set to true, care should be taken on how the handler is written. A default false value is provided

remove_attribute(attr_name: str, free_it: bool = False, clean_db: bool = True) None#

Remove one attribute from the device attribute list.

Note: Call of synchronous remove_attribute method from a coroutine function in an asyncio server may cause a deadlock. Use await async_remove_attribute() instead. However, if overriding the synchronous method initialize_dynamic_attributes, then the synchronous remove_attribute method must be used, even in asyncio servers.

Parameters:
  • attr_name (str) – attribute name

  • free_it (bool) – free Attr object flag. Default False

  • clean_db (bool) – clean attribute related info in db. Default True

Raises:

DevFailed

Added in version 9.5.0: free_it parameter. clean_db parameter.

remove_command(cmd_name: str, free_it: bool = False, clean_db: bool = True) None#

Remove one command from the device command list.

Parameters:
  • cmd_name (str) – command name to be removed from the list

  • free_it (bool) – set to true if the command object must be freed.

  • clean_db (bool) – Clean command related information (included polling info if the command is polled) from database.

Raises:

DevFailed

server_init_hook(self: tango._tango.Device_6Impl) None#

Hook method.

This method is called once the device server admin device is exported. This allows for instance for the different devices to subscribe to events at server startup on attributes from other devices of the same device server with stateless parameter set to false.

This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs.

Added in version 9.4.2.

set_alarm_event(self: tango._tango.DeviceImpl, attr_name: str, implemented: bool, detect: bool = True) None#

Set an implemented flag for the attribute to indicate that the server fires alarm events manually, without the polling to be started.

If the detect parameter is set to true, the criteria specified for the alarm event (rel_change and abs_change) are verified and the event is only pushed if a least one of them are fulfilled (change in value compared to previous event exceeds a threshold). If detect is set to false the event is fired without any value checking!

Parameters:
  • attr_name (str) – attribute name

  • implemented (bool) – True when the server fires alarm events manually.

  • detect (bool) – Triggers the verification of the alarm event properties when set to true. Default value is true.

Added in version 10.0.0.

set_archive_event(self: tango._tango.DeviceImpl, attr_name: str, implemented: bool, detect: bool = True) None#

Set an implemented flag for the attribute to indicate that the server fires archive events manually, without the polling to be started.

If the detect parameter is set to true, the criteria specified for the archive event (rel_change and abs_change) are verified and the event is only pushed if a least one of them are fulfilled (change in value compared to previous event exceeds a threshold). If detect is set to false the event is fired without any value checking!

Parameters:
  • attr_name (str) – attribute name

  • implemented (bool) – True when the server fires change events manually.

  • detect (bool) – Triggers the verification of the change event properties when set to true. Default value is true.

set_attribute_config(self: tango._tango.DeviceImpl, new_conf: list[AttributeConfig]) None#

Sets attribute configuration locally and in the Tango database

Parameters:

new_conf (list[tango.AttributeConfig]) – The new attribute(s) configuration. One AttributeConfig structure is needed for each attribute to update

Added in version 10.0.0.

set_attribute_config_3(self: tango._tango.Device_3Impl, new_conf: list[AttributeConfig_3]) None#

Sets attribute configuration locally and in the Tango database

Parameters:

new_conf (list[tango.AttributeConfig_3]) – The new attribute(s) configuration. One AttributeConfig structure is needed for each attribute to update

set_change_event(self: tango._tango.DeviceImpl, attr_name: str, implemented: bool, detect: bool = True) None#

Set an implemented flag for the attribute to indicate that the server fires change events manually, without the polling to be started.

If the detect parameter is set to true, the criteria specified for the change event (rel_change and abs_change) are verified and the event is only pushed if a least one of them are fulfilled (change in value compared to previous event exceeds a threshold). If detect is set to false the event is fired without any value checking!

Parameters:
  • attr_name (str) – attribute name

  • implemented (bool) – True when the server fires change events manually.

  • detect (bool) – Triggers the verification of the change event properties when set to true. Default value is true.

set_data_ready_event(self: tango._tango.DeviceImpl, attr_name: str, implemented: bool) None#

Set an implemented flag for the attribute to indicate that the server fires data ready events manually.

Parameters:
  • attr_name (str) – attribute name

  • implemented (bool) – True when the server fires change events manually.

set_state(self: tango._tango.DeviceImpl, new_state: tango._tango.DevState) None#

Set device state.

Parameters:

new_state (DevState) – the new device state

set_status(self: tango._tango.DeviceImpl, new_status: str) None#

Set device status.

Parameters:

new_status (str) – the new device status

signal_handler(self: tango._tango.Device_3Impl, signo: SupportsInt | SupportsIndex) None#

Signal handler.

The method executed when the signal arrived in the device server process. This method is defined as virtual and then, can be redefined following device needs.

Parameters:

signo (int) – the signal number

Raises:

DevFailed: This method does not throw exception but a redefined method can

start_logging(self: tango._tango.DeviceImpl) None#

Starts logging

stop_logging(self: tango._tango.DeviceImpl) None#

Stops logging

stop_poll_attribute(self: tango._tango.DeviceImpl, attr_name: str) None#

Remove an attribute from the list of polled attributes.

Parameters:

attr_name (str) – attribute name

stop_poll_command(self: tango._tango.DeviceImpl, cmd_name: str) None#

Remove a command from the list of polled commands.

Parameters:

cmd_name (str) – cmd_name name

stop_polling(*args, **kwargs)#

Overloaded function.

  1. stop_polling(self: tango._tango.DeviceImpl) -> None

Stop all polling for a device. If the device is polled, call this method before deleting it.

Added in version 7.1.2.

  1. stop_polling(self: tango._tango.DeviceImpl, with_db_upd: bool) -> None

Stop all polling for a device. If the device is polled, call this method before deleting it.

Parameters:

with_db_upd (bool) – Is it necessary to update db?

Added in version 7.1.2.

unregister_signal(self: tango._tango.DeviceImpl, signo: SupportsInt | SupportsIndex) None#

Unregister this device as device to be informed when signal signo is sent to to the device server process

Parameters:

signo (int) – signal identifier

warn_stream(msg: str, *args, source: Callable | None = None) None#

Sends the given message to the tango warn stream.

Since PyTango 7.1.3, the same can be achieved with:

print(msg, file=self.log_warn)
Parameters:
  • msg (str) – the message to be sent to the warn stream

  • *args – Arguments to format a message string.

  • source (typing.Callable) – Function that will be inspected for filename and lineno in the log message.

Added in version 9.4.2: added source parameter

write_attr_hardware(self: tango._tango.Device_6Impl, attr_list: tango._tango.StdLongVector) None#

Write the hardware for attributes.

Default method to implement an action necessary on a device to write the hardware involved in a write attribute. This method must be redefined in sub-classes in order to support writable attribute

Parameters:

attr_list (list[int]) – list of indices in the device object attribute vector of an attribute to be written.

Raises:

DevFailed: This method does not throw exception but a redefined method can