Util#
- class tango.Util(*args, **kwargs)#
This class is a used to store TANGO device server process data and to provide the user with a set of utilities method.
This class is implemented using the singleton design pattern. Therefore a device server process can have only one instance of this class and its constructor is not public. Example:
util = tango.Util.instance() print(util.get_host_name())
- add_Cpp_TgClass(device_class_name, tango_device_class_name)#
Register a new C++ tango class.
If there is a shared library file called MotorClass.so which contains a MotorClass class and a _create_MotorClass_class method. Example:
util.add_Cpp_TgClass('MotorClass', 'Motor')
Note
the parameter ‘device_class_name’ must match the shared library name.
Deprecated since version 7.1.2: Use
tango.Util.add_class()
instead.
- add_TgClass(klass_device_class, klass_device, device_class_name=None)#
Register a new python tango class. Example:
util.add_TgClass(MotorClass, Motor) util.add_TgClass(MotorClass, Motor, 'Motor') # equivalent to previous line
Deprecated since version 7.1.2: Use
tango.Util.add_class()
instead.
- add_class(self, class<DeviceClass>, class<DeviceImpl>, language="python") None #
Register a new tango class (‘python’ or ‘c++’).
If language is ‘python’ then args must be the same as
tango.Util.add_TgClass()
. Otherwise, args should be the ones intango.Util.add_Cpp_TgClass()
. Example:util.add_class(MotorClass, Motor) util.add_class('CounterClass', 'Counter', language='c++')
New in PyTango 7.1.2
- create_device(self, klass_name, device_name, alias=None, cb=None) None #
Creates a new device of the given class in the database, creates a new DeviceImpl for it and calls init_device (just like it is done for existing devices when the DS starts up)
An optional parameter callback is called AFTER the device is registered in the database and BEFORE the init_device for the newly created device is called
- Throws tango.DevFailed:
the device name exists already or
the given class is not registered for this DS.
the cb is not a callable
New in PyTango 7.1.2
- Parameters:
- klass_name:
(
str
) the device class name- device_name:
(
str
) the device name- alias:
(
str
) optional alias. Default value is None meaning do not create device alias- cb:
(
callable
) a callback that is called AFTER the device is registered in the database and BEFORE the init_device for the newly created device is called. Typically you may want to put device and/or attribute properties in the database here. The callback must receive a parameter: device name (str). Default value is None meaning no callback
- Return:
None
- delete_device(self, klass_name, device_name) None #
Deletes an existing device from the database and from this running server
- Throws tango.DevFailed:
the device name doesn’t exist in the database
the device name doesn’t exist in this DS.
New in PyTango 7.1.2
- get_class_list(self) seq<DeviceClass> #
Returns a list of objects of inheriting from DeviceClass
- Parameters:
None
- Return:
(
seq
) a list of objects of inheriting from DeviceClass
- static init(*args) Util #
Static method that creates and gets the singleton object reference. This method returns a reference to the object of the Util class. If the class singleton object has not been created, it will be instantiated
- instance = <ExtensionMock name='_tango.Util.instance' id='129958694254592'>#
- set_use_db = <ExtensionMock name='_tango.Util.set_use_db' id='129958694528896'>#