TangoFactory
¶

-
class
TangoFactory
[source]¶ Bases:
taurus.core.util.singleton.Singleton
,taurus.core.taurusfactory.TaurusFactory
,taurus.core.util.log.Logger
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
-
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: - attr_name (
str
) – a valid attribute name URI - create_if_needed (
bool
) – If True, the Attribute is created if it did not already exist. If False, None is returned if it did not exist
Return type: TangoAttribute
Returns: attribute object
Raise: (
TaurusException
) if the given alias is invalid.- attr_name (
-
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>Return type: TangoConfiguration
Returns: configuration object
-
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 usedReturn type: TangoAuthority
Returns: database object Raise: ( TaurusException
) if the given alias is invalid.
-
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.
type param: TaurusAttribute
orstr
param param: attribute object or full configuration name rtype: TangoAttribute
return: configuration object
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
Return type: Returns: a device object
Raise: (
TaurusException
) if the given dev_name is invalid.- dev_name (
-
getExistingAttributes
()[source]¶ Returns a new dictionary will all registered attributes on this factory
Returns: dictionary will all registered attributes on this factory Return type: dict
-
getExistingDatabases
()[source]¶ Returns a new dictionary will all registered databases on this factory
Returns: dictionary will all registered databases on this factory Return type: dict
-
getExistingDevices
()[source]¶ Returns a new dictionary will all registered devices on this factory
Returns: dictionary will all registered devices on this factory Return type: dict
-
isPollingEnabled
()[source]¶ Tells if the local tango polling is enabled
Return type: bool
Returns: wheter or not the polling is enabled
-
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 (
TangoAttribute
) – the new class that will handle the attribute
- attr_name (
-
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 (
TangoDevice
) – the new class that will handle devices of the given tango class name
- dev_klass_name (
-
removeExistingAttribute
(attr_or_attr_name)[source]¶ Removes a previously registered attribute.
Parameters: attr_or_attr_name ( str
orTangoAttribute
) – attribute name or attribute object
-
removeExistingDevice
(dev_or_dev_name)[source]¶ Removes a previously registered device.
Parameters: dev_or_dev_name ( str
orTangoDevice
) – device name or device object
-
schemes
= ('tango',)¶ the list of schemes that this factory supports. For this factory: ‘tango’ is the only scheme
-
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)