taurus taurus

Previous topic

TangoDevice

Next topic

TangoServInfo

This Page

TangoFactory

Inheritance diagram of TangoFactory

class TangoFactory

Bases: taurus.core.util.singleton.Singleton, taurus.core.taurusfactory.TaurusFactory, taurus.core.util.log.Logger

A Singleton class designed to provide Tango related objects.

The TangoFactory model containning the Factory for the Tango scheme

Tango Factory uses the Taurus object naming (URI based):

foo://username:password@example.com:8042/over/there/index.dtb;type=animal?name=ferret#nose
\_/   \________________/\_________/ \__/\_________/ \___/ \_/ \_________/ \_________/ \__/
 |            |              |       |       |        |    |       |            |      |
scheme     userinfo      hostname   port   path filename extension parameter(s) query fragment
          \____________________________/
                      |
                   authority

For Tango:

  • The ‘scheme’ must be the string “tango” (lowercase mandatory)
  • The ‘authority’ is the Tango database (<hostname> and <port> mandatory)
  • The ‘path’ is the Tango object, which can be a Device or Attribute. For device it must have the format _/_/_ or alias For attribute it must have the format _/_/_/_ or devalias/_
  • The ‘filename’ and ‘extension’ are always empty
  • The ‘parameter’ is always empty
  • The ‘the query’ is valid when the ‘path’ corresponds to an Attribute. Valid queries must have the format configuration=<config param>. Valid configuration parameters are: label, format, description, unit, display_unit, standard_unit, max_value, min_value, max_alarm, min_alarm, max_warning, min_warning. in this case the Tango object is a Configuration
addAttributeToPolling(attribute, period, unsubscribe_evts=False)

Activates the polling (client side) for the given attribute with the given period (seconds).

Parameters:
  • attribute (:class:~`taurus.core.tango.TangoAttribute`) – attribute name.
  • period (:class:~`float`) – polling period (in seconds)
  • unsubscribe_evts (:class:~`bool`) – whether or not to unsubscribe from events
cleanUp()

Cleanup the singleton instance

disablePolling()

Disable the application tango polling

enablePolling()

Enable the application tango polling

findObjectClass(absolute_name)

Obtain the class object corresponding to the given name.

Parameters:absolute_name (:class:~`str`) – the object absolute name string
Return type::class:~`taurus.core.taurusmodel.TaurusModel`
Returns:a class object that should be a subclass of a taurus.core.taurusmodel.TaurusModel
Raise:(:exc:~`taurus.core.taurusexception.TaurusException`) if the given name is invalid.
getAttribute(attr_name, **kwargs)

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 (:class:~`str`) – attribute name
Return type::class:~`taurus.core.tangoattribute.TangoAttribute`
Returns:attribute object
Raise:(:exc:~`taurus.core.taurusexception.TaurusException`) if the given alias is invalid.
getAttributeInfo(full_attr_name)

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 (:class:~`str`) – attribute name in format: <tango device name>’/’<attribute name>
Return type::class:~`taurus.core.tango.TangoConfiguration`
Returns:configuration object
getConfiguration(param)

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.

Parameters:param (:class:~`taurus.core.taurusattribute.TaurusAttribute` or :class:~`str`) – attrubute object or full configuration name
Return type::class:~`taurus.core.tango.TangoConfiguration`
Returns:configuration object
getDatabase(db_name=None)

Obtain the object corresponding to the given database name or the default database if db_name is None. If the corresponding database object already exists, the existing instance is returned. Otherwise a new instance is stored and returned.

Parameters:db_name (:class:~`str`) – database name string alias. If None, the default database is used
Return type::class:~`taurus.core.tangodatabase.TangoDatabase`
Returns:database object
Raise:(:exc:~`taurus.core.taurusexception.TaurusException`) if the given alias is invalid.
getDevice(dev_name, **kw)

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 (:class:~`str`) – tango device name or tango alias for the device. It should be formed like: <host>:<port>/<tango device name> - If <host>:<port> is ommited then it will use the default database. - <tango device name> can be full tango device name (_/_/_) or a device alias.
Return type::class:~`taurus.core.tango.TangoDevice`
Returns:a device object
Raise:(:exc:~`taurus.core.taurusexception.TaurusException`) if the given dev_name is invalid.
getExistingAttribute(attr_name)

Returns a registered attribute or None if the corresponding attribute as not been registered. This is used mainly to avoid recursion between two objects supplied by this factory which can ask for the other object in the constructor.

Parameters:attr_name (:class:~`str`) – attribute name
Return type::class:~`taurus.core.tango.TangoAttribute` or :class:~`None`
Returns:attribute object or None
getExistingAttributes()

Returns a new dictionary will all registered attributes on this factory

Returns:dictionary will all registered attributes on this factory
Return type:dict
getExistingConfigurations()

Returns a new dictionary will all registered configurations on this factory

Returns:dictionary will all registered configurations on this factory
Return type:dict
getExistingDatabases()

Returns a new dictionary will all registered databases on this factory

Returns:dictionary will all registered databases on this factory
Return type:dict
getExistingDevice(dev_name)

Returns a registered device or None if the corresponding device as not been registered. This is used mainly to avoid recursion between two objects supplied by this factory which can ask for the other object in the constructor.

Parameters:dev_name (:class:~`str`) – tango device name or tango alias for the device. It should be formed like: <host>:<port>/<tango device name> - If <host>:<port> is ommited then it will use the default database. - <tango device name> can be full tango device name (_/_/_) or a device alias.
Return type::class:~`taurus.core.tango.TangoDevice` or :class:~`None`
Returns:device object or None
getExistingDevices()

Returns a new dictionary will all registered devices on this factory

Returns:dictionary will all registered devices on this factory
Return type:dict
init(*args, **kwargs)

Singleton instance initialization. For internal usage only

isPollingEnabled()

Tells if the local tango polling is enabled

Return type::class:~`bool`
Returns:wheter or not the polling is enabled
reInit()

Reinitialize the singleton

registerAttributeClass(attr_name, attr_klass)

Registers a new attribute class for the attribute name.

Parameters:
  • attr_name (:class:~`str`) – attribute name
  • attr_klass (:class:~`taurus.core.tango.TangoAttribute`) – the new class that will handle the attribute
registerDeviceClass(dev_klass_name, dev_klass)

Registers a new python class to handle tango devices of the given tango class name

Parameters:
  • dev_klass_name (:class:~`str`) – tango device class name
  • dev_klass (:class:~`taurus.core.tango.TangoDevice`) – the new class that will handle devices of the given tango class name
removeAttributeFromPolling(attribute)

Deactivate the polling (client side) for the given attribute. If the polling of the attribute was not previously enabled, nothing happens.

Parameters:attribute (:class:~`str`) – attribute name.
removeExistingAttribute(attr_or_attr_name)

Removes a previously registered attribute.

Parameters:attr_or_attr_name (:class:~`str` or :class:~`TangoAttribute`) – attribute name or attribute object
removeExistingDevice(dev_or_dev_name)

Removes a previously registered device.

Parameters:dev_or_dev_name (:class:~`str` or :class:~`TangoDevice`) – device name or device object
schemes = ('tango',)

the list of schemes that this factory supports. For this factory: ‘tango’ is the only scheme

set_default_tango_host(tango_host)

Sets the new default tango host.

Parameters:tango_host (:class:~`str`) – the new tango host
unregisterAttributeClass(attr_name)

Unregisters the attribute class for the given attribute If no class was registered before for the given attribute, this call as no effect

Parameters:attr_name (:class:~`str`) – attribute name
unregisterDeviceClass(dev_klass_name)

Unregisters the class for the given tango class name If no class was registered before for the given attribute, this call as no effect

Parameters:dev_klass_name (:class:~`str`) – tango device class name