TangoFactory
- class TangoFactory(*p, **k)[source]
A
TaurusFactory
singleton class to provide Tango-specific Taurus Element objects (TangoAuthority, TangoDevice, TangoAttribute)Tango model names are URI based See https://tools.ietf.org/html/rfc3986. For example, a TangoAttribute would be:
tango://foo.org:1234/a/b/c/d#label \___/ \_____/ \__/ \_____/ \___/ | | | | | | hostname port attr | | \____________/\______/ | | | | | scheme authority path fragment
For Tango Elements:
The ‘scheme’ must be the string “tango” (lowercase mandatory)
The ‘authority’ identifies the Tango database (<hostname> and <port> are mandatory if authority is given)
The ‘path’ identifies Tango Device and Attributes. For devices it must have the format _/_/_ or alias For attributes it must have the format _/_/_/_ or devalias/_
The ‘fragment’ is optional and it refers to a member of the model object, thus not being part of the model name itself
Import from
taurus.core.tango
as:from taurus.core.tango import TangoFactory
- caseSensitive = False
- elementTypesMap = {3: <class 'taurus.core.tango.tangodevice.TangoDevice'>, 13: <class 'taurus.core.tango.tangoattribute.TangoAttribute'>, 18: <class 'taurus.core.tango.tangodatabase.TangoAuthority'>}
- getAttribute(attr_name, create_if_needed=True, **kwargs)[source]
Obtain the object corresponding to the given attribute name. If the corresponding attribute already exists, the existing instance is returned. Otherwise a new instance is stored and returned.
- Parameters:
- Returns:
attribute object :raise: (taurus.core.taurusexception.TaurusException) if the given alias is invalid.
- Return type:
taurus.core.tangoattribute.TangoAttribute
- getAttributeInfo(full_attr_name)[source]
Deprecated: Use
taurus.core.tango.TangoFactory.getConfiguration()
instead.Obtain attribute information corresponding to the given attribute name. If the corresponding attribute info already exists, the existing information is returned. Otherwise a new information instance is stored and returned.
- Parameters:
full_attr_name (str) – attribute name in format: <tango device name>’/’<attribute name>
- Returns:
configuration object
- Return type:
- getAuthority(name=None)[source]
Obtain the object corresponding to the given database name or the default database if name is None. If the corresponding authority object already exists, the existing instance is returned. Otherwise a new instance is stored and returned.
- Parameters:
name (str) – database name string alias. If None, the default database is used
- Returns:
database object :raise: (taurus.core.taurusexception.TaurusException) if the given alias is invalid.
- Return type:
taurus.core.tangodatabase.TangoAuthority
- getConfiguration(**kwargs)
- Obtain the object corresponding to the given attribute or full name.
If the corresponding configuration already exists, the existing instance is returned. Otherwise a new instance is stored and returned.
- param param:
attribute object or full configuration name
- type param:
taurus.core.taurusattribute.TaurusAttribute or str
- return:
configuration object
- rtype:
taurus.core.tango.TangoAttribute
Deprecated since version 4.0: Use getAttribute instead
- getDevice(dev_name, create_if_needed=True, **kw)[source]
Obtain the object corresponding to the given tango device name. If the corresponding device already exists, the existing instance is returned. Otherwise a new instance is stored and returned.
- Parameters:
dev_name (str) – tango device name or tango alias for the device. It must be a valid Tango device URI. If authority is not explicit, the default Tango Database will be used
create_if_needed (bool) – If True, the Device is created if it did not exist previously. If False, it returns None if it did not exist
- Returns:
a device object :raise: (taurus.core.taurusexception.TaurusException) if the given dev_name is invalid.
- Return type:
- getExistingAttributes()[source]
Returns a new dictionary will all registered attributes on this factory
- Returns:
dictionary will all registered attributes on this factory
- Return type:
- getExistingDatabases()[source]
Returns a new dictionary will all registered databases on this factory
- Returns:
dictionary will all registered databases on this factory
- Return type:
- getExistingDevices()[source]
Returns a new dictionary will all registered devices on this factory
- Returns:
dictionary will all registered devices on this factory
- Return type:
- isPollingEnabled()[source]
Tells if the local tango polling is enabled
- Returns:
wheter or not the polling is enabled
- Return type:
- is_tango_subscribe_enabled()[source]
Returns the current tango_subscribe_enabled status
Warning
This method belongs to a “Delayed Event Subscription” API added in v.4.2.1-alpha as an experimental feature. This API may not be stable and/or it may be removed in a future release (even on a minor version change)
- registerAttributeClass(attr_name, attr_klass)[source]
Registers a new attribute class for the attribute name.
- Parameters:
attr_name (str) – attribute name
attr_klass (taurus.core.tango.TangoAttribute) – the new class that will handle the attribute
- registerDeviceClass(dev_klass_name, dev_klass)[source]
Registers a new python class to handle tango devices of the given tango class name
- Parameters:
dev_klass_name (str) – tango device class name
dev_klass (taurus.core.tango.TangoDevice) – the new class that will handle devices of the given tango class name
- removeExistingAttribute(attr_or_attr_name)[source]
Removes a previously registered attribute.
- Parameters:
attr_or_attr_name (str or TangoAttribute) – attribute name or attribute object
- removeExistingDevice(dev_or_dev_name)[source]
Removes a previously registered device.
- Parameters:
dev_or_dev_name (str or TangoDevice) – device name or device object
- schemes = ('tango', 'tango-nodb')
- setOperationMode(mode)[source]
Deprecated. setOperationMode(OperationMode mode) -> None Sets the operation mode for the Tango system.
- set_default_tango_host(tango_host)[source]
Sets the new default tango host. The method will transform the given name to an Authority URI.
Note
Calling this method also clears the device alias cache.
- Parameters:
tango_host (str) – the new tango host. It accepts any valid Tango authority name or None to use the defined by $TANGO_HOST env. var.
- set_tango_subscribe_enabled(value)[source]
If True, enables event subscribing on TangoAttribute objects
Warning
This method belongs to a “Delayed Event Subscription” API added in v.4.2.1-alpha as an experimental feature. This API may not be stable and/or it may be removed in a future release (even on a minor version change)