[pytango] 169/483: api2 initial implementation
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:37 UTC 2017
This is an automated email from the git hooks/post-receive script.
sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.
commit bc174c86dbe6230df34af2a55335e4e329596db5
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date: Fri Oct 19 16:06:12 2012 +0000
api2 initial implementation
git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@21357 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
PyTango/api2.py | 438 +++++++-
PyTango/attr_data.py | 98 +-
PyTango/connection.py | 2 +-
PyTango/databaseds/database.py | 2336 ++++++++++++++++++++++++++++++++++++++++
PyTango/db.py | 3 +-
PyTango/device_class.py | 7 +-
PyTango/device_server.py | 23 +-
PyTango/log4tango.py | 63 +-
PyTango/utils.py | 60 +-
doc/server/index.rst | 3 +-
doc/tep/tep-0001.rst | 53 +-
doc/tep/tep-0002.rst | 2 +
setup.py | 4 +-
13 files changed, 2976 insertions(+), 116 deletions(-)
diff --git a/PyTango/api2.py b/PyTango/api2.py
index 36f16ce..b46a32a 100644
--- a/PyTango/api2.py
+++ b/PyTango/api2.py
@@ -21,46 +21,315 @@
##
################################################################################
-"""This is a PyTango module which provides a high level device server API."""
+"""This module provides a high level device server API. It implements
+:ref:`TEP1 <pytango-TEP1>`. It exposes an easier API for developing a tango
+device server.
+
+Here is the summary of features which this module exposes and are not available
+on the low level :mod:`PyTango` server API:
+
+#. Automatic inheritance from the latest :class:`~PyTango.DeviceImpl`
+#. default implementation of :meth:`Device.__init__`
+ calls :meth:`Device.init_device`. Around 90% of the
+ different device classes which inherit from low level
+ :class:`~PyTango.DeviceImpl` only implement `__init__` to call their
+ `init_device`
+#. has a default implementation of :meth:`Device.init_device`
+ which calls :meth:`Device.get_device_properties`. Again,
+ 90% of existing device classes do that
+#. Automatically creates a hidden :class:`~PyTango.DeviceClass` class
+#. recognizes :func:`attribute` members and automatically
+ registers them as tango attributes in the hidden
+ :class:`~PyTango.DeviceClass`
+#. recognizes :class:`command` decorated functions and
+ automatically registers them as tango commands in the hidden
+ :class:`~PyTango.DeviceClass`
+#. recognizes :func:`device_property` members and
+ automatically registers them as tango device properties in the hidden
+ :class:`~PyTango.DeviceClass`
+#. recognizes :func:`class_property` members and
+ automatically registers them as tango class properties in the hidden
+ :class:`~PyTango.DeviceClass`
+#. read and write attribute methods don't need :class:`~PyTango.Attribute`
+ parameter. Access to :class:`~PyTango.Attribute` object is with simple::
+
+ self.<attr name>
+
+#. read attribute methods can set attribute return value with::
+
+ self.<attr name> = <value>
+
+ instead of::
+
+ attr.set_value(<value>)
+
+:class:`Device` works very well in conjuction with:
+
+#. :meth:`attribute`
+#. :class:`command`
+#. :meth:`device_property`
+#. :meth:`class_property`
+#. :meth:`~PyTango.server_run`
+
+Here is an example of a PowerSupply device with:
+
+#. a read-only double scalar `voltage` attribute
+#. a read/write double scalar `current` attribute
+#. a `ramp` command
+#. a `host` device property
+
+.. code-block:: python
+ :linenos:
+
+ from time import time
+
+ from PyTango import AttrQuality, DebugIt, server_run
+ from PyTango.api2 import Device, DeviceMeta
+ from PyTango.api2 import attribute, command, device_property
+
+ class PowerSupply(Device):
+ __metaclass__ = DeviceMeta
+
+ voltage = attribute()
+
+ current = attribute(label="Current", unit="A",
+ fread="read_current",
+ fwrite="write_current")
+
+ host = device_property()
+
+ def read_voltage(self):
+ self.voltage = 10.0
+
+ def read_current(self):
+ self.current = 2.5, time(), AttrQuality.ON
+
+ @DebugIt()
+ def write_current(self):
+ new_current = self.current.get_write_value()
+
+ @command()
+ def ramp(self):
+ self.info_stream("Ramping on " + self.host + "...")
+
+ def main():
+ classes = PowerSupply,
+ server_run(classes)
+
+ if __name__ == "__main__":
+ main()
+
+And here is the equivalent code using the low-level API:
+
+.. code-block:: python
+ :linenos:
+
+ import sys
+ import time
+
+ import PyTango
+
+ class PowerSupply(PyTango.Device_4Impl):
+
+ def __init__(self, devclass, name):
+ PyTango.Device_4Impl.__init__(self, devclass, name)
+ self.init_device()
+
+ def init_device(self):
+ self.get_device_properties()
+
+ def read_voltage(self, attr):
+ attr.set_value(10.0)
+
+ def read_current(self):
+ attr.set_value_date_quality(2.5, time.time(), PyTango.AttrQuality.ON)
+
+ @PyTango.DebugIt()
+ def write_current(self, attr):
+ new_current = attr.get_write_value()
+
+ def ramp(self):
+ self.info_stream("Ramping on " + self.host + "...")
+
+
+ class PowerSupplyClass(PyTango.DeviceClass):
+
+ class_property_list = {}
+
+ device_property_list = {
+ 'host':
+ [PyTango.DevString, "host of power supply", "localhost"],
+ }
+
+ cmd_list = {
+ 'ramp':
+ [ [PyTango.DevVoid, "nothing"],
+ [PyTango.DevVoid, "nothing"] ],
+ }
+
+ attr_list = {
+ 'voltage':
+ [[PyTango.DevDouble,
+ PyTango.SCALAR,
+ PyTango.READ]],
+ 'current':
+ [[PyTango.DevDouble,
+ PyTango.SCALAR,
+ PyTango.READ_WRITE],
+ { 'label' : 'Current', 'unit' : 'A' }],
+ }
+
+
+ def main():
+ try:
+ py = PyTango.Util(sys.argv)
+ py.add_class(PowerSupplyClass,PowerSupply,'PowerSupply')
+
+ U = PyTango.Util.instance()
+ U.server_init()
+ U.server_run()
+
+ except PyTango.DevFailed,e:
+ print '-------> Received a DevFailed exception:',e
+ except Exception,e:
+ print '-------> An unforeseen exception occured....',e
+
+ if __name__ == "__main__":
+ main()
+
+
+*Pretty cool, uh?*
+"""
from __future__ import with_statement
from __future__ import print_function
-__all__ = ["DeviceMeta", "Device", "attribute", "command",
+__all__ = ["DeviceMeta", "Device", "LatestDeviceImpl", "attribute", "command",
"device_property", "class_property"]
import inspect
import functools
+import __builtin__
from ._PyTango import DeviceImpl, Attribute, WAttribute, CmdArgType, \
- AttrDataFormat, AttrWriteType, DispLevel
+ AttrDataFormat, AttrWriteType, DispLevel, constants
from .attr_data import AttrData
from .device_class import DeviceClass
-from .utils import get_tango_device_classes
+from .utils import get_tango_device_classes, is_non_str_seq, is_pure_str
from .log4tango import DebugIt
API_VERSION = 2
LatestDeviceImpl = get_tango_device_classes()[-1]
-def check_tango_device_klass_attribute_methods(tango_device_klass, attr_data):
- """Checks if the read and write methods have the correct signature. If a
- read/write method doesn't have a parameter (the traditional Attribute),
- then the method is wrapped into another method to make this work
+def __build_to_tango_type():
+ ret = \
+ {
+ int : CmdArgType.DevLong,
+ str : CmdArgType.DevString,
+ bool : CmdArgType.DevBoolean,
+ bytearray : CmdArgType.DevEncoded,
+ float : CmdArgType.DevDouble,
+ chr : CmdArgType.DevUChar,
+ None : CmdArgType.DevVoid,
+
+ 'int' : CmdArgType.DevLong,
+ 'int16' : CmdArgType.DevShort,
+ 'int32' : CmdArgType.DevLong,
+ 'int64' : CmdArgType.DevLong64,
+ 'uint' : CmdArgType.DevULong,
+ 'uint16' : CmdArgType.DevUShort,
+ 'uint32' : CmdArgType.DevULong,
+ 'uint64' : CmdArgType.DevULong64,
+ 'str' : CmdArgType.DevString,
+ 'string' : CmdArgType.DevString,
+ 'text' : CmdArgType.DevString,
+ 'bool' : CmdArgType.DevBoolean,
+ 'boolean' : CmdArgType.DevBoolean,
+ 'bytes' : CmdArgType.DevEncoded,
+ 'bytearray' : CmdArgType.DevEncoded,
+ 'float' : CmdArgType.DevDouble,
+ 'float32' : CmdArgType.DevFloat,
+ 'float64' : CmdArgType.DevDouble,
+ 'double' : CmdArgType.DevDouble,
+ 'byte' : CmdArgType.DevUChar,
+ 'chr' : CmdArgType.DevUChar,
+ 'char' : CmdArgType.DevUChar,
+ 'None' : CmdArgType.DevVoid,
+ }
+
+ for key in dir(CmdArgType):
+ if key.startswith("Dev"):
+ value = getattr(CmdArgType, key)
+ ret[key] = ret[value] = value
+
+ if constants.NUMPY_SUPPORT:
+ import numpy
+ FROM_TANGO_TO_NUMPY_TYPE = { \
+ CmdArgType.DevBoolean : numpy.bool8,
+ CmdArgType.DevUChar : numpy.ubyte,
+ CmdArgType.DevShort : numpy.short,
+ CmdArgType.DevUShort : numpy.ushort,
+ CmdArgType.DevLong : numpy.int32,
+ CmdArgType.DevULong : numpy.uint32,
+ CmdArgType.DevLong64 : numpy.int64,
+ CmdArgType.DevULong64 : numpy.uint64,
+ CmdArgType.DevString : numpy.str,
+ CmdArgType.DevDouble : numpy.float64,
+ CmdArgType.DevFloat : numpy.float32,
+ }
+
+ for key,value in FROM_TANGO_TO_NUMPY_TYPE.items():
+ ret[value] = key
+
+ head = "{0:40} {0:40}\n".format(40*"=")
+ doc = "{0} {1:38} {2:38} \n{0}".format(head,'type','tango type')
+ keys = sorted(ret)
+ for key in keys:
+ value = ret[key]
+ if type(key) == type:
+ key_name = key.__name__
+ if key_name in __builtin__.__dict__:
+ key = ":py:obj:`{0}`".format(key_name)
+ elif key.__module__ == 'numpy':
+ key = ":py:obj:`numpy.{0}`".format(key_name)
+ else:
+ key = "``{0}``".format(key_name)
+ elif is_pure_str(key):
+ key = "``'{0}'``".format(key)
+ else:
+ key = "``{0}``".format(key)
+ value = "``{0}``".format(value)
+ doc += " {0:38} {1:38} \n".format(key, str(value))
+ doc += head
+ return ret, doc
+
+TO_TANGO_TYPE, __type_doc = __build_to_tango_type()
+
+
+
+def get_tango_type(dtype):
+ return TO_TANGO_TYPE[dtype]
+
+get_tango_type.__doc__ = __type_doc
+
+def check_tango_device_klass_attribute_method(tango_device_klass, method_name):
+ """Checks if method given by it's name for the given DeviceImpl class has
+ the correct signature. If a read/write method doesn't have a parameter
+ (the traditional Attribute), then the method is wrapped into another method
+ which has correct parameter definition to make it work.
:param tango_device_klass: a DeviceImpl class
:type tango_device_klass: class
- :param attr_data: the attribute data information
- :type attr_data: AttrData"""
-
- read_name = attr_data.read_method_name
- read_obj = real_read_obj = getattr(tango_device_klass, read_name)
+ :param method_name: method to be cheched
+ :type attr_data: str"""
+ f_obj = real_f_obj = getattr(tango_device_klass, method_name)
# discover the real method because it may be hidden by a tango decorator
# like PyTango.DebugIt. Unfortunately we cannot detect other decorators yet
- while hasattr(real_read_obj, "_wrapped"):
- real_read_obj = real_read_obj._wrapped
- argspec = inspect.getargspec(real_read_obj)
+ while hasattr(real_f_obj, "_wrapped"):
+ real_f_obj = real_f_obj._wrapped
+ argspec = inspect.getargspec(real_f_obj)
if argspec.varargs and len(argspec.varargs):
return
nb = len(argspec.args) - 1
@@ -68,11 +337,25 @@ def check_tango_device_klass_attribute_methods(tango_device_klass, attr_data):
nb -= len(argspec.defaults)
if nb > 0:
return
- @functools.wraps(read_obj)
- def read_attr(self, attr):
- return read_obj(self)
- setattr(tango_device_klass, read_name, read_attr)
+ @functools.wraps(f_obj)
+ def f_attr(self, attr):
+ return f_obj(self)
+ setattr(tango_device_klass, method_name, f_attr)
+
+def check_tango_device_klass_attribute_methods(tango_device_klass, attr_data):
+ """Checks if the read and write methods have the correct signature. If a
+ read/write method doesn't have a parameter (the traditional Attribute),
+ then the method is wrapped into another method to make this work
+ :param tango_device_klass: a DeviceImpl class
+ :type tango_device_klass: class
+ :param attr_data: the attribute data information
+ :type attr_data: AttrData"""
+ if attr_data.attr_write in (AttrWriteType.READ, AttrWriteType.READ_WRITE):
+ check_tango_device_klass_attribute_method(tango_device_klass, attr_data.read_method_name)
+ if attr_data.attr_write in (AttrWriteType.WRITE, AttrWriteType.READ_WRITE):
+ check_tango_device_klass_attribute_method(tango_device_klass, attr_data.write_method_name)
+
def create_tango_deviceclass_klass(tango_device_klass, attrs=None):
klass_name = tango_device_klass.__name__
if not issubclass(tango_device_klass, (Device)):
@@ -117,33 +400,44 @@ def create_tango_device_klass(name, bases, attrs):
return klass
def DeviceMeta(name, bases, attrs):
+ """The :py:data:`metaclass` callable for :class:`Device`. Every subclass of
+ :class:`Device` must have associated this metaclass to itself in order to
+ work properly (boost-python internal limitation).
+
+ Example (python 2.x)::
+
+ from PyTango.api2 import Device, DeviceMeta
+
+ class PowerSupply(Device):
+ __metaclass__ = DeviceMeta
+
+ Example (python 3.x)::
+
+ from PyTango.api2 import Device, DeviceMeta
+
+ class PowerSupply(Device, metaclass=DeviceMeta):
+ pass
+ """
return create_tango_device_klass(name, bases, attrs)
class Device(LatestDeviceImpl):
- """High level DeviceImpl API"""
+ """High level DeviceImpl API.
+
+ .. seealso::
+
+ Module :py:mod:`PyTango.api2`
+ Full API2 documentation"""
def __init__(self, cl, name):
- super(Device, self).__init__(cl, name)
- self.debug_stream("-> __init__()")
- with_exception = True
- try:
- self.init_device()
- with_exception = False
- finally:
- if with_exception:
- debug_msg = "<- __init__() raised exception!"
- else:
- debug_msg = "<- __init__()"
- self.debug_stream(debug_msg)
-
- @DebugIt()
+ LatestDeviceImpl.__init__(self, cl, name)
+ self.init_device()
+
def init_device(self):
"""Tango init_device method. Default implementation calls
- get_device_properties()"""
+ :meth:`get_device_properties`"""
self.get_device_properties()
- @DebugIt()
def always_executed_hook(self):
"""Tango always_executed_hook. Default implementation does nothing"""
pass
@@ -165,8 +459,10 @@ class AttrData2(AttrData):
if dtype == CmdArgType.DevEncoded:
if is_tuple and len(value) == 4:
attr.set_value_date_quality(*value)
+ elif is_tuple and len(value) == 3 and is_non_str_seq(value[0]):
+ attr.set_value_date_quality(value[0][0], value[0][1], *value[1:])
else:
- attr.set_value(value)
+ attr.set_value(*value)
else:
if is_tuple:
if len(value) == 3:
@@ -191,16 +487,78 @@ class AttrData2(AttrData):
obj.remove_attribute(self.attr_name)
def attribute(**kwargs):
+ if 'dtype' in kwargs:
+ kwargs['dtype'] = get_tango_type(kwargs['dtype'])
return AttrData2.from_dict(kwargs)
+
+
+attribute.__doc__ = """\
+declares a new tango attribute in a :class:`Device`. To be used like the python
+native :obj:`property` function. To declare a scalar, PyTango.DevDouble, read-only
+attribute called *voltage* in a *PowerSupply* :class:`Device` do::
+
+ class PowerSupply(Device):
+
+ voltage = attribute()
+
+ def read_voltage(self):
+ self.voltage = 1.0
+
+It receives multiple keyword arguments.
+
+ :param name: alternative attribute name [default: class member name]
+ :type name: :obj:`str`
+ :param dtype: data type (see :ref:`Data type equivalence <pytango-api2-datatypes>`)
+ [default: :obj:`~PyTango.CmdArgType`\ ``.DevDouble``]
+ :type dtype: :obj:`object`
+ :param dformat: data format [default: :obj:`~PyTango.AttrDataFormat`\ ``.SCALAR``]
+ :type dformat: :obj:`~PyTango.AttrDataFormat`
+ :param max_dim_x: maximum size for x dimension (ignored for
+ :obj:`~PyTango.AttrDataFormat`\ ``.SCALAR`` format) [default: 1]
+ :type max_dim_x: :obj:`int`
+ :param max_dim_y: maximum size for y dimension (ignored for
+ :obj:`~PyTango.AttrDataFormat`\ ``.SCALAR`` and
+ :obj:`~PyTango.AttrDataFormat`\ ``.SPECTRUM`` formats) [default: 0]
+ :type max_dim_y: :obj:`int`
+ :param display_level: display level [default: :obj:`~PyTango.DisLevel`\ ``.OPERATOR``]
+ :type display_level: :obj:`~PyTango.DispLevel`
+ :param polling_period: polling period [default: -1, meaning no polling]
+ :type polling_period: :obj:`int`
+ :param memorized: attribute should or not be memorized [default: False]
+ :type memorized: :obj:`bool`
+ :param hw_memorized: attribute write method should be called at startup when
+ restoring memorize value (dangerous!) [default: False]
+ :type hw_memorized: :obj:`bool`
+ :param access: read/write access. [default: if no fread and no fwrite methods
+ are given it is :obj:`~PyTango.AttrWriteType`\ ``.READ``. If
+ only fread is given then :obj:`~PyTango.AttrWriteType`\ ``.READ``.
+ if only fwrite is given then :obj:`~PyTango.AttrWriteType`\ ``.WRITE``.
+ if both fread and fwrite are given then :obj:`~PyTango.AttrWriteType`\ ``.READ_WRITE``
+ :type access: :obj:`~PyTango.AttrWriteType`
+ :param fread: read method name or method object [default: 'read_<attr_name>']
+ :type fread: :obj:`str` or :obj:`callable`
+ :param fwrite: write method name or method object [default: 'write_<attr_name>']
+ :type fwrite: :obj:`str` or :obj:`callable`
+ :param is_allowed: is allowed method name or method object [default: 'is_<attr_name>_allowed']
+ :type is_allowed: :obj:`str` or :obj:`callable`
+ :param label: attribute label
+ :type label: obj:`str`
+.. _pytango-api2-datatypes:
-def cmd():
- pass
+.. rubric:: Data type equivalence
+
+""" + __type_doc
+class command:
+ """TODO"""
+ pass
def device_property():
+ """TODO"""
pass
def class_property():
+ """TODO"""
pass
diff --git a/PyTango/attr_data.py b/PyTango/attr_data.py
index 02cb01a..5467a45 100644
--- a/PyTango/attr_data.py
+++ b/PyTango/attr_data.py
@@ -25,13 +25,18 @@
This is an internal PyTango module.
"""
+from __future__ import with_statement
+from __future__ import print_function
+
__all__ = [ "AttrData" ]
__docformat__ = "restructuredtext"
+import inspect
+
from ._PyTango import Except, CmdArgType, AttrDataFormat, AttrWriteType, \
DispLevel, UserDefaultAttrProp, Attr, SpectrumAttr, ImageAttr
-from .utils import is_non_str_seq
+from .utils import is_non_str_seq, is_pure_str
class AttrData(object):
@@ -50,15 +55,90 @@ class AttrData(object):
self.polling_period = -1
self.memorized = False
self.hw_memorized = False
- self.read_method_name = "read_%s" % name
- self.write_method_name = "write_%s" % name
- self.is_allowed_name = "is_%s_allowed" % name
+ if name is None:
+ self.read_method_name = None
+ self.write_method_name = None
+ self.is_allowed_name = None
+ else:
+ self.read_method_name = "read_" + name
+ self.write_method_name = "write_" + name
+ self.is_allowed_name = "is_" + name + "_allowed"
self.attr_class = None
self.attr_args = []
self.att_prop = None
if attr_info is not None:
self.from_attr_info(attr_info)
+ @classmethod
+ def from_dict(cls, attr_dict):
+ attr_dict = dict(attr_dict)
+ name = attr_dict.pop('name', None)
+ class_name = attr_dict.pop('class_name', None)
+ self = cls(name, class_name)
+ self.attr_type = attr_dict.pop('dtype', CmdArgType.DevDouble)
+ self.attr_format = attr_dict.pop('dformat', AttrDataFormat.SCALAR)
+ self.dim_x = attr_dict.pop('max_dim_x', 1)
+ self.dim_y = attr_dict.pop('max_dim_y', 0)
+ self.display_level = attr_dict.pop('display_level', DispLevel.OPERATOR)
+ self.polling_period = attr_dict.pop('polling_period', -1)
+ self.memorized = attr_dict.pop('memorized', False)
+ self.hw_memorized = attr_dict.pop('hw_memorized', False)
+
+ is_access_explicit = "access" in attr_dict
+ if is_access_explicit:
+ self.attr_write = attr_dict.pop('access')
+ else:
+ # access is defined by which methods were defined
+ r_explicit, w_explicit = "fread" in attr_dict, "fwrite" in attr_dict
+ if r_explicit and w_explicit:
+ self.attr_write = AttrWriteType.READ_WRITE
+ elif r_explicit:
+ self.attr_write = AttrWriteType.READ
+ elif w_explicit:
+ self.attr_write = AttrWriteType.WRITE
+ else:
+ self.attr_write = AttrWriteType.READ
+
+ fread = attr_dict.pop('fread', None)
+ if fread is not None:
+ if is_pure_str(fread):
+ self.read_method_name = fread
+ elif inspect.isroutine(fread):
+ self.read_method_name = fread.__name__
+ fwrite = attr_dict.pop('fwrite', None)
+ if fwrite is not None:
+ if is_pure_str(fwrite):
+ self.write_method_name = fwrite
+ elif inspect.isroutine(fwrite):
+ self.write_method_name = fwrite.__name__
+ fisallowed = attr_dict.pop('fisallowed', None)
+ if fisallowed is not None:
+ if is_pure_str(fisallowed):
+ self.is_allowed_name = fisallowed
+ elif inspect.isroutine(fisallowed):
+ self.is_allowed_name = fisallowed.__name__
+ self.attr_class = attr_dict.pop("klass", self.DftAttrClassMap[self.attr_format])
+ self.attr_args.extend((self.attr_name, self.attr_type, self.attr_write))
+ if not self.attr_format == AttrDataFormat.SCALAR:
+ self.attr_args.append(self.dim_x)
+ if not self.attr_format == AttrDataFormat.SPECTRUM:
+ self.attr_args.append(self.dim_y)
+ if len(attr_dict):
+ self.att_prop = self.__create_user_default_attr_prop(self.attr_name, attr_dict)
+ return self
+
+ def _set_name(self, name):
+ old_name = self.attr_name
+ self.attr_name = name
+ self.attr_args[0] = name
+ if old_name is None:
+ if self.read_method_name is None:
+ self.read_method_name = "read_" + name
+ if self.write_method_name is None:
+ self.write_method_name = "write_" + name
+ if self.is_allowed_name is None:
+ self.is_allowed_name = "is_" + name + "_allowed"
+
def __throw_exception(self, msg, meth="create_attribute()"):
Except.throw_exception("PyDs_WrongAttributeDefinition", msg, meth)
@@ -74,11 +154,11 @@ class AttrData(object):
elif k == 'delta_time':
p.set_delta_t(str(v))
elif not k_lower in ('display level', 'polling period', 'memorized'):
- name = self.get_name()
- msg = "Wrong definition of attribute %s in " \
- "class %s\nThe object extra information '%s' " \
- "is not recognized!" % (attr_name, name, k)
- self.__throw_create_attribute_exception(msg)
+ msg = "Wrong definition of attribute. " \
+ "The object extra information '%s' " \
+ "is not recognized!" % (k,)
+ Except.throw_exception("PyDs_WrongAttributeDefinition", msg,
+ "create_user_default_attr_prop()")
return p
def from_attr_info(self, attr_info):
diff --git a/PyTango/connection.py b/PyTango/connection.py
index 7211b53..0245c0b 100644
--- a/PyTango/connection.py
+++ b/PyTango/connection.py
@@ -30,12 +30,12 @@ __all__ = ["connection_init"]
__docformat__ = "restructuredtext"
import operator
+import collections
from ._PyTango import Connection, DeviceData, __CallBackAutoDie, CmdArgType, \
DeviceProxy, Database, ExtractAs
from .utils import document_method as __document_method
from .utils import document_static_method as __document_static_method
-import collections
def __CallBackAutoDie__cmd_ended_aux(self, fn):
diff --git a/PyTango/databaseds/database.py b/PyTango/databaseds/database.py
new file mode 100644
index 0000000..d579778
--- /dev/null
+++ b/PyTango/databaseds/database.py
@@ -0,0 +1,2336 @@
+#!/usr/bin/env python
+# -*- coding:utf-8 -*-
+
+
+##############################################################################
+## license :
+##============================================================================
+##
+## File : DataBase.py
+##
+## Project : TANGO
+##
+## $Author : controls$
+##
+## $Revision : $
+##
+## $Date : $
+##
+## $HeadUrl : $
+##============================================================================
+## This file is generated by POGO
+## (Program Obviously used to Generate tango Object)
+##
+## (c) - Software Engineering Group - ESRF
+##############################################################################
+
+"""This class manage the TANGO database."""
+
+__all__ = ["DataBase", "DataBaseClass", "main"]
+
+__docformat__ = 'restructuredtext'
+
+import PyTango
+import sys
+# Add additional import
+#----- PROTECTED REGION ID(DataBase.additionnal_import) ENABLED START -----#
+
+import db_access
+
+th_exc = PyTango.Except.throw_exception
+
+from db_errors import *
+
+DB_FRONTED = {
+ "sqlite3" : "db2",
+ "pyodbc" : "pyodbc"
+}
+
+def check_device_name(dev_name):
+ if '*' in dev_name:
+ return False, None, None
+
+ if dev_name.startswith("tango:"):
+ dev_name = dev_name[6:]
+ elif dev_name.startswith("taco:"):
+ dev_name = dev_name[5:]
+ if dev_name.startswith("//"):
+ dev_name = dev_name[2:]
+ if not '/' in dev_name or dev_name.startswith("/"):
+ return False, None, None
+ dfm = dev_name.split("/")
+ if len(dfm) != 3:
+ return False, None, None
+ # check that each element has at least one character
+ if not all(map(len,dfm)):
+ return False, None, None
+ return True, dev_name, dfm
+
+def replace_wildcard(text):
+ # escape '%' with '\'
+ text = text.replace("%", "\\%")
+ # escape '_' with '\'
+ text = text.replace("_", "\\_")
+ # escape '"' with '\'
+ text = text.replace('"', '\\"')
+ # escape ''' with '\'
+ text = text.replace("'", "\\'")
+ # replace '*' with '%'
+ text = text.replace("*", "%")
+ return text
+
+
+#----- PROTECTED REGION END -----# // DataBase.additionnal_import
+
+##############################################################################
+## Device States Description
+##
+## No states for this device
+##############################################################################
+
+class DataBase (PyTango.Device_4Impl):
+
+#--------- Add you global variables here --------------------------
+#----- PROTECTED REGION ID(DataBase.global_variables) ENABLED START -----#
+
+ def get_device_properties(self, device_klass):
+ return
+
+#----- PROTECTED REGION END -----# // DataBase.global_variables
+#------------------------------------------------------------------
+# Device constructor
+#------------------------------------------------------------------
+ def __init__(self,cl, name):
+ PyTango.Device_4Impl.__init__(self,cl,name)
+ self.debug_stream("In " + self.get_name() + ".__init__()")
+ DataBase.init_device(self)
+
+#------------------------------------------------------------------
+# Device destructor
+#------------------------------------------------------------------
+ def delete_device(self):
+ self.debug_stream("In " + self.get_name() + ".delete_device()")
+ #----- PROTECTED REGION ID(DataBase.delete_device) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.delete_device
+
+#------------------------------------------------------------------
+# Device initialization
+#------------------------------------------------------------------
+ def init_device(self):
+ self.debug_stream("In " + self.get_name() + ".init_device()")
+ self.get_device_properties(self.get_device_class())
+ self.attr_StoredProcedureRelease_read = ''
+ self.attr_Timing_average_read = [0.0]
+ self.attr_Timing_minimum_read = [0.0]
+ self.attr_Timing_maximum_read = [0.0]
+ self.attr_Timing_calls_read = [0.0]
+ self.attr_Timing_index_read = ['']
+ self.attr_Timing_info_read = ['']
+ #----- PROTECTED REGION ID(DataBase.init_device) ENABLED START -----#
+
+ self.db = db_access.Tango_sqlite3()
+
+
+ #----- PROTECTED REGION END -----# // DataBase.init_device
+
+#------------------------------------------------------------------
+# Always excuted hook method
+#------------------------------------------------------------------
+ def always_executed_hook(self):
+ self.debug_stream("In " + self.get_name() + ".always_excuted_hook()")
+ #----- PROTECTED REGION ID(DataBase.always_executed_hook) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.always_executed_hook
+
+#==================================================================
+#
+# DataBase read/write attribute methods
+#
+#==================================================================
+
+#------------------------------------------------------------------
+# Read StoredProcedureRelease attribute
+#------------------------------------------------------------------
+ def read_StoredProcedureRelease(self, attr):
+ self.debug_stream("In " + self.get_name() + ".read_StoredProcedureRelease()")
+ #----- PROTECTED REGION ID(DataBase.StoredProcedureRelease_read) ENABLED START -----#
+ self.attr_StoredProcedureRelease_read = db.get_stored_procedure_release()
+ #----- PROTECTED REGION END -----# // DataBase.StoredProcedureRelease_read
+ attr.set_value(self.attr_StoredProcedureRelease_read)
+
+#------------------------------------------------------------------
+# Read Timing_average attribute
+#------------------------------------------------------------------
+ def read_Timing_average(self, attr):
+ self.debug_stream("In " + self.get_name() + ".read_Timing_average()")
+ #----- PROTECTED REGION ID(DataBase.Timing_average_read) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.Timing_average_read
+ attr.set_value(self.attr_Timing_average_read)
+
+#------------------------------------------------------------------
+# Read Timing_minimum attribute
+#------------------------------------------------------------------
+ def read_Timing_minimum(self, attr):
+ self.debug_stream("In " + self.get_name() + ".read_Timing_minimum()")
+ #----- PROTECTED REGION ID(DataBase.Timing_minimum_read) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.Timing_minimum_read
+ attr.set_value(self.attr_Timing_minimum_read)
+
+#------------------------------------------------------------------
+# Read Timing_maximum attribute
+#------------------------------------------------------------------
+ def read_Timing_maximum(self, attr):
+ self.debug_stream("In " + self.get_name() + ".read_Timing_maximum()")
+ #----- PROTECTED REGION ID(DataBase.Timing_maximum_read) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.Timing_maximum_read
+ attr.set_value(self.attr_Timing_maximum_read)
+
+#------------------------------------------------------------------
+# Read Timing_calls attribute
+#------------------------------------------------------------------
+ def read_Timing_calls(self, attr):
+ self.debug_stream("In " + self.get_name() + ".read_Timing_calls()")
+ #----- PROTECTED REGION ID(DataBase.Timing_calls_read) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.Timing_calls_read
+ attr.set_value(self.attr_Timing_calls_read)
+
+#------------------------------------------------------------------
+# Read Timing_index attribute
+#------------------------------------------------------------------
+ def read_Timing_index(self, attr):
+ self.debug_stream("In " + self.get_name() + ".read_Timing_index()")
+ #----- PROTECTED REGION ID(DataBase.Timing_index_read) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.Timing_index_read
+ attr.set_value(self.attr_Timing_index_read)
+
+#------------------------------------------------------------------
+# Read Timing_info attribute
+#------------------------------------------------------------------
+ def read_Timing_info(self, attr):
+ self.debug_stream("In " + self.get_name() + ".read_Timing_info()")
+ #----- PROTECTED REGION ID(DataBase.Timing_info_read) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.Timing_info_read
+ attr.set_value(self.attr_Timing_info_read)
+
+
+
+
+#------------------------------------------------------------------
+# Read Attribute Hardware
+#------------------------------------------------------------------
+ def read_attr_hardware(self, data):
+ self.debug_stream("In " + self.get_name() + ".read_attr_hardware()")
+ #----- PROTECTED REGION ID(DataBase.read_attr_hardware) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.read_attr_hardware
+
+
+#==================================================================
+#
+# DataBase command methods
+#
+#==================================================================
+
+#------------------------------------------------------------------
+# DbAddDevice command:
+#------------------------------------------------------------------
+ def DbAddDevice(self, argin):
+ """ Add a Tango class device to a specific device server
+
+ :param argin: Str[0] = Full device server process name
+ Str[1] = Device name
+ Str[2] = Tango class name
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbAddDevice()")
+ #----- PROTECTED REGION ID(DataBase.DbAddDevice) ENABLED START -----#
+
+ if len(argin) < 3:
+ self.warn_stream("DataBase::AddDevice(): incorrect number of input arguments ")
+ th_exc(DB_IncorrectArguments,
+ "incorrect no. of input arguments, needs at least 3 (server,device,class)",
+ "DataBase::AddDevice()")
+
+ self.info_stream("DataBase::AddDevice(): insert " + argin[0] + " %s server with device " + argin[1])
+ server_name, d_name, klass_name = argin[:3]
+ if len(argin) > 3:
+ alias = argin[3]
+ else:
+ alias = None
+
+ ret, dev_name, dfm = check_device_name(d_name)
+ if not ret:
+ th_exc(DB_IncorrectDeviceName,
+ "device name (" + d_name + ") syntax error (should be [tango:][//instance/]domain/family/member)",
+ "DataBase::AddDevice()")
+ # Lock table
+ self.db.add_device(server_name, (dev_name, dfm) , klass_name, alias=alias)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbAddDevice
+
+#------------------------------------------------------------------
+# DbAddServer command:
+#------------------------------------------------------------------
+ def DbAddServer(self, argin):
+ """ Create a device server process entry in database
+
+ :param argin: Str[0] = Full device server name
+ Str[1] = Device(s) name
+ Str[2] = Tango class name
+ Str[n] = Device name
+ Str[n + 1] = Tango class name
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbAddServer()")
+ #----- PROTECTED REGION ID(DataBase.DbAddServer) ENABLED START -----#
+
+ if len(argin) < 3 or not len(argin) % 2:
+ self.warn_stream("DataBase::AddServer(): incorrect number of input arguments ")
+ th_exc(DB_IncorrectArguments,
+ "incorrect no. of input arguments, needs at least 3 (server,device,class)",
+ "DataBase::AddServer()")
+ server_name = argin[0]
+
+ db = self.db
+ cursor = db.get_cursor()
+ for i in range((len(argin)-1)/2):
+ d_name, klass_name = argin[i*2+1], argin[i*2+2]
+ ret, dev_name, dfm = check_device_name(d_name)
+ if not ret:
+ th_exc(DB_IncorrectDeviceName,
+ "device name (" + d_name + ") syntax error (should be [tango:][//instance/]domain/family/member)",
+ "DataBase::AddServer()")
+ db.add_device(server_name, (dev_name, dfm) , klass_name, cursor=cursor)
+
+ cursor.connection.commit()
+ cursor.close()
+
+ #----- PROTECTED REGION END -----# // DataBase.DbAddServer
+
+#------------------------------------------------------------------
+# DbDeleteAttributeAlias command:
+#------------------------------------------------------------------
+ def DbDeleteAttributeAlias(self, argin):
+ """ Delete an attribute alias.
+
+ :param argin: Attriibute alias name.
+ :type: PyTango.DevString
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteAttributeAlias()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteAttributeAlias) ENABLED START -----#
+
+ self.db.delete_attribute_alias(argin)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteAttributeAlias
+
+#------------------------------------------------------------------
+# DbDeleteClassAttribute command:
+#------------------------------------------------------------------
+ def DbDeleteClassAttribute(self, argin):
+ """ delete a class attribute and all its properties from database
+
+ :param argin: Str[0] = Tango class name
+ Str[1] = Attribute name
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteClassAttribute()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteClassAttribute) ENABLED START -----#
+
+ if len(argin) < 2:
+ self.warn_stream("DataBase::db_delete_class_attribute(): insufficient number of arguments ")
+ th_exc(DB_IncorrectArguments,
+ "insufficient number of arguments to delete class attribute",
+ "DataBase::DeleteClassAttribute()")
+
+ klass_name, attr_name = argin[:2]
+
+ self.db.delete_class_attribute(klass_name, attr_name)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteClassAttribute
+
+#------------------------------------------------------------------
+# DbDeleteClassAttributeProperty command:
+#------------------------------------------------------------------
+ def DbDeleteClassAttributeProperty(self, argin):
+ """ delete class attribute properties from database
+
+ :param argin: Str[0] = Tango class name
+ Str[1] = Attribute name
+ Str[2] = Property name
+ Str[n] = Property name
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteClassAttributeProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteClassAttributeProperty) ENABLED START -----#
+
+ if len(argin) < 3:
+ self.warn_stream("DataBase::db_delete_class_attribute_property(): insufficient number of arguments ")
+ th_exc(DB_IncorrectArguments,
+ "insufficient number of arguments to delete class attribute property",
+ "DataBase::DeleteClassAttributeProperty()")
+
+ klass_name, attr_name = argin[:2]
+
+ db = self.db
+ cursor = db.get_cursor()
+ for prop_name in argin[2:]:
+ db.delete_class_attribute_property(klass_name, attr_name, prop_name, cursor=cursor)
+ cursor.connection.commit()
+ cursor.close()
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteClassAttributeProperty
+
+#------------------------------------------------------------------
+# DbDeleteClassProperty command:
+#------------------------------------------------------------------
+ def DbDeleteClassProperty(self, argin):
+ """ Delete class properties from database
+
+ :param argin: Str[0] = Tango class name
+ Str[1] = Property name
+ Str[n] = Property name
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteClassProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteClassProperty) ENABLED START -----#
+
+ klass_name = argin[0]
+
+ db = self.db
+ cursor = db.get_cursor()
+ for prop_name in argin[1:]:
+ db.delete_class_property(prop_name, cursor=cursor)
+ cursor.connection.commit()
+ cursor.close()
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteClassProperty
+
+#------------------------------------------------------------------
+# DbDeleteDevice command:
+#------------------------------------------------------------------
+ def DbDeleteDevice(self, argin):
+ """ Delete a devcie from database
+
+ :param argin: device name
+ :type: PyTango.DevString
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteDevice()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteDevice) ENABLED START -----#
+
+ ret, dev_name, dfm = check_device_name(argin)
+ if not ret:
+ self.warn_stream("DataBase::db_delete_device(): device name " + argin + " incorrect ")
+ th_exc(DB_IncorrectDeviceName,
+ "failed to delete device, device name incorrect",
+ "DataBase::DeleteDevice()")
+ self.db.delete_device(dev_name)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteDevice
+
+#------------------------------------------------------------------
+# DbDeleteDeviceAlias command:
+#------------------------------------------------------------------
+ def DbDeleteDeviceAlias(self, argin):
+ """ Delete a device alias.
+
+ :param argin: device alias name
+ :type: PyTango.DevString
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteDeviceAlias()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteDeviceAlias) ENABLED START -----#
+
+ self.db.delete_device_alias(argin)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteDeviceAlias
+
+#------------------------------------------------------------------
+# DbDeleteDeviceAttribute command:
+#------------------------------------------------------------------
+ def DbDeleteDeviceAttribute(self, argin):
+ """ Delete device attribute properties from database
+
+ :param argin: Str[0] = Device name
+ Str[1] = Attribute name
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteDeviceAttribute()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteDeviceAttribute) ENABLED START -----#
+
+ if len(argin) < 2:
+ self.warn_stream("DataBase::db_delete_device_attribute(): insufficient number of arguments ")
+ th_exc(DB_IncorrectArguments,
+ "insufficient number of arguments to delete device attribute",
+ "DataBase::DeleteDeviceAttribute()")
+
+ dev_name, attr_name = argin[:2]
+
+ ret, dev_name, dfm = check_device_name(argin)
+ if not ret:
+ self.warn_stream("DataBase::db_delete_device_attribute(): device name " + dev_name + " incorrect ")
+ th_exc(DB_IncorrectDeviceName,
+ "failed to delete device attribute, device name incorrect",
+ "DataBase::DeleteDeviceAttribute()")
+
+ self.db.delete_device_attribute(dev_name, attr_name)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteDeviceAttribute
+
+#------------------------------------------------------------------
+# DbDeleteDeviceAttributeProperty command:
+#------------------------------------------------------------------
+ def DbDeleteDeviceAttributeProperty(self, argin):
+ """ delete a device attribute property from the database
+
+ :param argin: Str[0] = Device name
+ Str[1] = Attribute name
+ Str[2] = Property name
+ Str[n] = Property name
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteDeviceAttributeProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteDeviceAttributeProperty) ENABLED START -----#
+
+ if len(argin) < 3:
+ self.warn_stream("DataBase::db_delete_device_attribute_property(): insufficient number of arguments ")
+ th_exc(DB_IncorrectArguments,
+ "insufficient number of arguments to delete device attribute property",
+ "DataBase::DeleteDeviceAttributeProperty()")
+
+ dev_name, attr_name = argin[:2]
+
+ ret, dev_name, dfm = check_device_name(argin)
+ if not ret:
+ self.warn_stream("DataBase::db_delete_device_attribute_property(): device name " + dev_name + " incorrect ")
+ th_exc(DB_IncorrectDeviceName,
+ "failed to delete device attribute property, device name incorrect",
+ "DataBase::DeleteDeviceAttributeProperty()")
+
+ db = self.db
+ cursor = db.get_cursor()
+ for prop_name in argin[2:]:
+ self.db.delete_device_attribute_property(dev_name, attr_name, prop_name, cursor=cursor)
+ cursor.connection.commit()
+ cursor.close()
+
+
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteDeviceAttributeProperty
+
+#------------------------------------------------------------------
+# DbDeleteDeviceProperty command:
+#------------------------------------------------------------------
+ def DbDeleteDeviceProperty(self, argin):
+ """ Delete device property(ies)
+
+ :param argin: Str[0] = Device name
+ Str[1] = Property name
+ Str[n] = Property name
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteDeviceProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteDeviceProperty) ENABLED START -----#
+
+ dev_name = argin[0]
+ db = self.db
+ cursor = db.get_cursor()
+ for prop_name in argin[1:]:
+ self.db.delete_device_property(dev_name, prop_name)
+ cursor.connection.commit()
+ cursor.close()
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteDeviceProperty
+
+#------------------------------------------------------------------
+# DbDeleteProperty command:
+#------------------------------------------------------------------
+ def DbDeleteProperty(self, argin):
+ """ Delete free property from database
+
+ :param argin: Str[0] = Object name
+ Str[1] = Property name
+ Str[n] = Property name
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteProperty) ENABLED START -----#
+
+ obj_name = argin[0];
+ db = self.db
+ cursor = db.get_cursor()
+ for prop_name in argin[1:]:
+ self.db.delete_property(obj_name, prop_name)
+ cursor.connection.commit()
+ cursor.close()
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteProperty
+
+#------------------------------------------------------------------
+# DbDeleteServer command:
+#------------------------------------------------------------------
+ def DbDeleteServer(self, argin):
+ """ Delete server from the database but dont delete device properties
+
+ :param argin: Device server name
+ :type: PyTango.DevString
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteServer()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteServer) ENABLED START -----#
+
+ if '*' in argin or '%' in argin or not '/' in argin:
+ self.warn_stream("DataBase::db_delete_server(): server name " + argin + " incorrect ")
+ th_exc(DB_IncorrectServerName,
+ "failed to delete server, server name incorrect",
+ "DataBase::DeleteServer()")
+
+ self.db.delete_server(argin)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteServer
+
+#------------------------------------------------------------------
+# DbDeleteServerInfo command:
+#------------------------------------------------------------------
+ def DbDeleteServerInfo(self, argin):
+ """ delete info related to a Tango devvice server process
+
+ :param argin: Device server name
+ :type: PyTango.DevString
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteServerInfo()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteServerInfo) ENABLED START -----#
+
+ self.db.delete_server_info(argin)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteServerInfo
+
+#------------------------------------------------------------------
+# DbExportDevice command:
+#------------------------------------------------------------------
+ def DbExportDevice(self, argin):
+ """ Export a device to the database
+
+ :param argin: Str[0] = Device name
+ Str[1] = CORBA IOR
+ Str[2] = Device server process host name
+ Str[3] = Device server process PID or string ``null``
+ Str[4] = Device server process version
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbExportDevice()")
+ #----- PROTECTED REGION ID(DataBase.DbExportDevice) ENABLED START -----#
+
+ if len(argin) < 5:
+ self.warn_stream("DataBase::DbExportDevice(): insufficient export info for device ")
+ th_exc(DB_IncorrectArguments,
+ "insufficient export info for device",
+ "DataBase::ExportDevice()")
+
+ dev_name, IOR, host, pid, version = argin[:5]
+ if pid.lower() == 'null'):
+ pid = "-1"
+ self.db.export_device(dev_name, IOR, host, pid, version)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbExportDevice
+
+#------------------------------------------------------------------
+# DbExportEvent command:
+#------------------------------------------------------------------
+ def DbExportEvent(self, argin):
+ """ Export Event channel to database
+
+ :param argin: Str[0] = event channel name (or factory name)
+ Str[1] = CORBA IOR
+ Str[2] = Notifd host name
+ Str[3] = Notifd pid
+ Str[4] = Notifd version
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbExportEvent()")
+ #----- PROTECTED REGION ID(DataBase.DbExportEvent) ENABLED START -----#
+
+ if len(argin) < 5:
+ self.warn_stream("DataBase::db_export_event(): insufficient export info for event ")
+ th_exc(DB_IncorrectArguments,
+ "insufficient export info for event",
+ "DataBase::ExportEvent()")
+
+ event, IOR, host, pid, version = argin[:5]
+ event = replace_wildcard(event.lower())
+ self.db.export_event(event, IOR, host, pid, version)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbExportEvent
+
+#------------------------------------------------------------------
+# DbGetAliasDevice command:
+#------------------------------------------------------------------
+ def DbGetAliasDevice(self, argin):
+ """ Get device name from its alias.
+
+ :param argin: Alias name
+ :type: PyTango.DevString
+ :return: Device name
+ :rtype: PyTango.DevString """
+ self.debug_stream("In " + self.get_name() + ".DbGetAliasDevice()")
+ argout = ''
+ #----- PROTECTED REGION ID(DataBase.DbGetAliasDevice) ENABLED START -----#
+
+ if not argin:
+ argin = "%"
+ else:
+ argin = replace_wildcard(argin)
+
+ argout = self.db.get_alias_device(argin)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetAliasDevice
+ return argout
+
+#------------------------------------------------------------------
+# DbGetAttributeAlias command:
+#------------------------------------------------------------------
+ def DbGetAttributeAlias(self, argin):
+ """ Get the attribute name for the given alias.
+ If alias not found in database, returns an empty string.
+
+ :param argin: The attribute alias name
+ :type: PyTango.DevString
+ :return: The attribute name (device/attribute)
+ :rtype: PyTango.DevString """
+ self.debug_stream("In " + self.get_name() + ".DbGetAttributeAlias()")
+ argout = ''
+ #----- PROTECTED REGION ID(DataBase.DbGetAttributeAlias) ENABLED START -----#
+
+ argout = self.db.get_attribute_alias(argin)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetAttributeAlias
+ return argout
+
+#------------------------------------------------------------------
+# DbGetAttributeAliasList command:
+#------------------------------------------------------------------
+ def DbGetAttributeAliasList(self, argin):
+ """ Get attribute alias list for a specified filter
+
+ :param argin: attribute alias filter string (eg: att*)
+ :type: PyTango.DevString
+ :return: attribute aliases
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetAttributeAliasList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetAttributeAliasList) ENABLED START -----#
+
+ if not argin:
+ argin = "%"
+ else:
+ argin = replace_wildcard(argin)
+
+ argout = self.db.get_attribute_alias_list(argin)
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetAttributeAliasList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetClassAttributeList command:
+#------------------------------------------------------------------
+ def DbGetClassAttributeList(self, argin):
+ """ Get attrilute list for a given Tango class with a specified filter
+
+ :param argin: Str[0] = Tango class name
+ Str[1] = Attribute name filter (eg: att*)
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Class attribute name
+ Str[n] = Class attribute name
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetClassAttributeList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetClassAttributeList) ENABLED START -----#
+
+
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetClassAttributeList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetClassAttributeProperty command:
+#------------------------------------------------------------------
+ def DbGetClassAttributeProperty(self, argin):
+ """ Get Tango class property(ies) value
+
+ :param argin: Str[0] = Tango class name
+ Str[1] = Attribute name
+ Str[n] = Attribute name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Tango class name
+ Str[1] = Attribute property number
+ Str[2] = Attribute property 1 name
+ Str[3] = Attribute property 1 value
+ Str[n + 1] = Attribute property 2 name
+ Str[n + 2] = Attribute property 2 value
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetClassAttributeProperty()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetClassAttributeProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetClassAttributeProperty
+ return argout
+
+#------------------------------------------------------------------
+# DbGetClassAttributeProperty2 command:
+#------------------------------------------------------------------
+ def DbGetClassAttributeProperty2(self, argin):
+ """ This command supports array property compared to the old command called
+ DbGetClassAttributeProperty. The old command has not been deleted from the
+ server for compatibility reasons.
+
+ :param argin: Str[0] = Tango class name
+ Str[1] = Attribute name
+ Str[n] = Attribute name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Tango class name
+ Str[1] = Attribute property number
+ Str[2] = Attribute property 1 name
+ Str[3] = Attribute property 1 value number (array case)
+ Str[4] = Attribute property 1 value
+ Str[n] = Attribute property 1 value (array case)
+ Str[n + 1] = Attribute property 2 name
+ Str[n + 2] = Attribute property 2 value number (array case)
+ Str[n + 3] = Attribute property 2 value
+ Str[n + m] = Attribute property 2 value (array case)
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetClassAttributeProperty2()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetClassAttributeProperty2) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetClassAttributeProperty2
+ return argout
+
+#------------------------------------------------------------------
+# DbGetClassAttributePropertyHist command:
+#------------------------------------------------------------------
+ def DbGetClassAttributePropertyHist(self, argin):
+ """ Retrieve Tango class attribute property history
+
+ :param argin: Str[0] = Tango class
+ Str[1] = Attribute name
+ Str[2] = Property name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Attribute name
+ Str[1] = Property name
+ Str[2] = date
+ Str[3] = Property value number (array case)
+ Str[4] = Property value 1
+ Str[n] = Property value n
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetClassAttributePropertyHist()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetClassAttributePropertyHist) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetClassAttributePropertyHist
+ return argout
+
+#------------------------------------------------------------------
+# DbGetClassForDevice command:
+#------------------------------------------------------------------
+ def DbGetClassForDevice(self, argin):
+ """ Get Tango class for the specified device.
+
+ :param argin: Device name
+ :type: PyTango.DevString
+ :return: Device Tango class
+ :rtype: PyTango.DevString """
+ self.debug_stream("In " + self.get_name() + ".DbGetClassForDevice()")
+ argout = ''
+ #----- PROTECTED REGION ID(DataBase.DbGetClassForDevice) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetClassForDevice
+ return argout
+
+#------------------------------------------------------------------
+# DbGetClassInheritanceForDevice command:
+#------------------------------------------------------------------
+ def DbGetClassInheritanceForDevice(self, argin):
+ """ Get class inheritance for the specified device.
+
+ :param argin: Device name
+ :type: PyTango.DevString
+ :return: Classes off the specified device.
+ [0] - is the class of the device.
+ [1] - is the class from the device class is inherited.
+ ........and so on
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetClassInheritanceForDevice()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetClassInheritanceForDevice) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetClassInheritanceForDevice
+ return argout
+
+#------------------------------------------------------------------
+# DbGetClassList command:
+#------------------------------------------------------------------
+ def DbGetClassList(self, argin):
+ """ Get Tango class list with a specified filter
+
+ :param argin: Filter
+ :type: PyTango.DevString
+ :return: Class list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetClassList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetClassList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetClassList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetClassProperty command:
+#------------------------------------------------------------------
+ def DbGetClassProperty(self, argin):
+ """
+
+ :param argin: Str[0] = Tango class
+ Str[1] = Property name
+ Str[2] = Property name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Tango class
+ Str[1] = Property number
+ Str[2] = Property name
+ Str[3] = Property value number (array case)
+ Str[4] = Property value
+ Str[n] = Propery value (array case)
+ ....
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetClassProperty()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetClassProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetClassProperty
+ return argout
+
+#------------------------------------------------------------------
+# DbGetClassPropertyHist command:
+#------------------------------------------------------------------
+ def DbGetClassPropertyHist(self, argin):
+ """ Retrieve Tango class property history
+
+ :param argin: Str[0] = Tango class
+ Str[1] = Property name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Property name
+ Str[1] = date
+ Str[2] = Property value number (array case)
+ Str[3] = Property value 1
+ Str[n] = Property value n
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetClassPropertyHist()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetClassPropertyHist) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetClassPropertyHist
+ return argout
+
+#------------------------------------------------------------------
+# DbGetClassPropertyList command:
+#------------------------------------------------------------------
+ def DbGetClassPropertyList(self, argin):
+ """ Get property list for a given Tango class with a specified filter
+
+ :param argin: The filter
+ :type: PyTango.DevString
+ :return: Property name list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetClassPropertyList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetClassPropertyList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetClassPropertyList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceAlias command:
+#------------------------------------------------------------------
+ def DbGetDeviceAlias(self, argin):
+ """ Return alias for device name if found.
+
+ :param argin: The device name
+ :type: PyTango.DevString
+ :return: The alias found
+ :rtype: PyTango.DevString """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceAlias()")
+ argout = ''
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceAlias) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceAlias
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceAliasList command:
+#------------------------------------------------------------------
+ def DbGetDeviceAliasList(self, argin):
+ """ Get device alias name with a specific filter
+
+ :param argin: The filter
+ :type: PyTango.DevString
+ :return: Device alias list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceAliasList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceAliasList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceAliasList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceAttributeList command:
+#------------------------------------------------------------------
+ def DbGetDeviceAttributeList(self, argin):
+ """ Return list of attributes matching the wildcard
+ for the specified device
+
+ :param argin: Str[0] = Device name
+ Str[1] = Wildcard
+ :type: PyTango.DevVarStringArray
+ :return: attribute name list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceAttributeList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceAttributeList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceAttributeList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceAttributeProperty command:
+#------------------------------------------------------------------
+ def DbGetDeviceAttributeProperty(self, argin):
+ """ Get device attribute property(ies) value
+
+ :param argin: Str[0] = Device name
+ Str[1] = Attribute name
+ Str[n] = Attribute name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Device name
+ Str[1] = Attribute property number
+ Str[2] = Attribute property 1 name
+ Str[3] = Attribute property 1 value
+ Str[n + 1] = Attribute property 2 name
+ Str[n + 2] = Attribute property 2 value
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceAttributeProperty()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceAttributeProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceAttributeProperty
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceAttributeProperty2 command:
+#------------------------------------------------------------------
+ def DbGetDeviceAttributeProperty2(self, argin):
+ """ Retrieve device attribute properties. This command has the possibility to retrieve
+ device attribute properties which are arrays. It is not possible with the old
+ DbGetDeviceAttributeProperty command. Nevertheless, the old command has not been
+ deleted for compatibility reason
+
+ :param argin: Str[0] = Device name
+ Str[1] = Attribute name
+ Str[n] = Attribute name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Device name
+ Str[1] = Attribute property number
+ Str[2] = Attribute property 1 name
+ Str[3] = Attribute property 1 value number (array case)
+ Str[4] = Attribute property 1 value
+ Str[n] = Attribute property 1 value (array case)
+ Str[n + 1] = Attribute property 2 name
+ Str[n + 2] = Attribute property 2 value number (array case)
+ Str[n + 3] = Attribute property 2 value
+ Str[n + m] = Attribute property 2 value (array case)
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceAttributeProperty2()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceAttributeProperty2) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceAttributeProperty2
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceAttributePropertyHist command:
+#------------------------------------------------------------------
+ def DbGetDeviceAttributePropertyHist(self, argin):
+ """ Retrieve device attribute property history
+
+ :param argin: Str[0] = Device name
+ Str[1] = Attribute name
+ Str[2] = Property name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Attribute name
+ Str[1] = Property name
+ Str[2] = date
+ Str[3] = Property value number (array case)
+ Str[4] = Property value 1
+ Str[n] = Property value n
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceAttributePropertyHist()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceAttributePropertyHist) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceAttributePropertyHist
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceClassList command:
+#------------------------------------------------------------------
+ def DbGetDeviceClassList(self, argin):
+ """ Get Tango classes/device list embedded in a specific device server
+
+ :param argin: Device server process name
+ :type: PyTango.DevString
+ :return: Str[0] = Device name
+ Str[1] = Tango class
+ Str[n] = Device name
+ Str[n + 1] = Tango class
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceClassList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceClassList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceClassList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceDomainList command:
+#------------------------------------------------------------------
+ def DbGetDeviceDomainList(self, argin):
+ """ Get list of device domain name matching the specified
+
+ :param argin: The wildcard
+ :type: PyTango.DevString
+ :return: Device name domain list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceDomainList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceDomainList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceDomainList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceExportedList command:
+#------------------------------------------------------------------
+ def DbGetDeviceExportedList(self, argin):
+ """ Get a list of exported devices whose names satisfy the filter (wildcard is
+
+ :param argin: filter
+ :type: PyTango.DevString
+ :return: list of exported devices
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceExportedList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceExportedList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceExportedList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceFamilyList command:
+#------------------------------------------------------------------
+ def DbGetDeviceFamilyList(self, argin):
+ """ Get a list of device name families for device name matching the
+ specified wildcard
+
+ :param argin: The wildcard
+ :type: PyTango.DevString
+ :return: Family list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceFamilyList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceFamilyList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceFamilyList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceInfo command:
+#------------------------------------------------------------------
+ def DbGetDeviceInfo(self, argin):
+ """ Returns info from DbImportDevice and started/stopped dates.
+
+ :param argin: Device name
+ :type: PyTango.DevString
+ :return: Str[0] = Device name
+ Str[1] = CORBA IOR
+ Str[2] = Device version
+ Str[3] = Device Server name
+ Str[4] = Device Server process host name
+ Str[5] = Started date (or ? if not set)
+ Str[6] = Stopped date (or ? if not set)
+ Str[7] = Device class
+
+ Lg[0] = Device exported flag
+ Lg[1] = Device Server process PID (or -1 if not set)
+ :rtype: PyTango.DevVarLongStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceInfo()")
+ argout = [0],['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceInfo) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceInfo
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceList command:
+#------------------------------------------------------------------
+ def DbGetDeviceList(self, argin):
+ """ Get a list of devices for specified server and class.
+
+ :param argin: argin[0] : server name
+ argin[1] : class name
+ :type: PyTango.DevVarStringArray
+ :return: The list of devices for specified server and class.
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceWideList command:
+#------------------------------------------------------------------
+ def DbGetDeviceWideList(self, argin):
+ """ Get a list of devices whose names satisfy the filter.
+
+ :param argin: filter
+ :type: PyTango.DevString
+ :return: list of exported devices
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceWideList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceWideList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceWideList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceMemberList command:
+#------------------------------------------------------------------
+ def DbGetDeviceMemberList(self, argin):
+ """ Get a list of device name members for device name matching the
+ specified filter
+
+ :param argin: The filter
+ :type: PyTango.DevString
+ :return: Device names member list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceMemberList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceMemberList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceMemberList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceProperty command:
+#------------------------------------------------------------------
+ def DbGetDeviceProperty(self, argin):
+ """
+
+ :param argin: Str[0] = Device name
+ Str[1] = Property name
+ Str[n] = Property name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Device name
+ Str[1] = Property number
+ Str[2] = Property name
+ Str[3] = Property value number (array case)
+ Str[4] = Property value 1
+ Str[n] = Property value n (array case)
+ Str[n + 1] = Property name
+ Str[n + 2] = Property value number (array case)
+ Str[n + 3] = Property value 1
+ Str[n + m] = Property value m
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceProperty()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceProperty
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDevicePropertyHist command:
+#------------------------------------------------------------------
+ def DbGetDevicePropertyHist(self, argin):
+ """ Retrieve device property history
+
+ :param argin: Str[0] = Device name
+ Str[2] = Property name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Property name
+ Str[1] = date
+ Str[2] = Property value number (array case)
+ Str[3] = Property value 1
+ Str[n] = Property value n
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDevicePropertyHist()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDevicePropertyHist) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDevicePropertyHist
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDevicePropertyList command:
+#------------------------------------------------------------------
+ def DbGetDevicePropertyList(self, argin):
+ """ Get property list belonging to the specified device and with
+ name matching the specified filter
+
+ :param argin: Str[0] = device name
+ Str[1] = Filter
+ :type: PyTango.DevVarStringArray
+ :return: Property name list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDevicePropertyList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDevicePropertyList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDevicePropertyList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetDeviceServerClassList command:
+#------------------------------------------------------------------
+ def DbGetDeviceServerClassList(self, argin):
+ """ Get list of Tango classes for a device server
+
+ :param argin: device server process name
+ :type: PyTango.DevString
+ :return: list of classes for this device server
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDeviceServerClassList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDeviceServerClassList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDeviceServerClassList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetExportdDeviceListForClass command:
+#------------------------------------------------------------------
+ def DbGetExportdDeviceListForClass(self, argin):
+ """ Query the database for device exported for the specified class.
+
+ :param argin: Class name
+ :type: PyTango.DevString
+ :return: Device exported list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetExportdDeviceListForClass()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetExportdDeviceListForClass) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetExportdDeviceListForClass
+ return argout
+
+#------------------------------------------------------------------
+# DbGetHostList command:
+#------------------------------------------------------------------
+ def DbGetHostList(self, argin):
+ """ Get host list with name matching the specified filter
+
+ :param argin: The filter
+ :type: PyTango.DevString
+ :return: Host name list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetHostList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetHostList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetHostList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetHostServerList command:
+#------------------------------------------------------------------
+ def DbGetHostServerList(self, argin):
+ """ Get list of device server process name running on host with name matching
+ the specified filter
+
+ :param argin: The filter
+ :type: PyTango.DevString
+ :return: Device server process name list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetHostServerList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetHostServerList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetHostServerList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetHostServersInfo command:
+#------------------------------------------------------------------
+ def DbGetHostServersInfo(self, argin):
+ """ Get info about all servers running on specified host, name, mode and level
+
+ :param argin: Host name
+ :type: PyTango.DevString
+ :return: Server info for all servers running on specified host
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetHostServersInfo()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetHostServersInfo) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetHostServersInfo
+ return argout
+
+#------------------------------------------------------------------
+# DbGetInstanceNameList command:
+#------------------------------------------------------------------
+ def DbGetInstanceNameList(self, argin):
+ """ Returns the instance names found for specified server.
+
+ :param argin: Server name
+ :type: PyTango.DevString
+ :return: The instance names found for specified server.
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetInstanceNameList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetInstanceNameList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetInstanceNameList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetObjectList command:
+#------------------------------------------------------------------
+ def DbGetObjectList(self, argin):
+ """ Get list of free object defined in database with name
+ matching the specified filter
+
+ :param argin: The filter
+ :type: PyTango.DevString
+ :return: Object name list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetObjectList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetObjectList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetObjectList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetProperty command:
+#------------------------------------------------------------------
+ def DbGetProperty(self, argin):
+ """ Get free object property
+
+ :param argin: Str[0] = Object name
+ Str[1] = Property name
+ Str[n] = Property name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Object name
+ Str[1] = Property number
+ Str[2] = Property name
+ Str[3] = Property value number (array case)
+ Str[4] = Property value 1
+ Str[n] = Property value n (array case)
+ Str[n + 1] = Property name
+ Str[n + 2] = Property value number (array case)
+ Str[n + 3] = Property value 1
+ Str[n + m] = Property value m
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetProperty()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetProperty
+ return argout
+
+#------------------------------------------------------------------
+# DbGetPropertyHist command:
+#------------------------------------------------------------------
+ def DbGetPropertyHist(self, argin):
+ """ Retrieve object property history
+
+ :param argin: Str[0] = Object name
+ Str[2] = Property name
+ :type: PyTango.DevVarStringArray
+ :return: Str[0] = Property name
+ Str[1] = date
+ Str[2] = Property value number (array case)
+ Str[3] = Property value 1
+ Str[n] = Property value n
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetPropertyHist()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetPropertyHist) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetPropertyHist
+ return argout
+
+#------------------------------------------------------------------
+# DbGetPropertyList command:
+#------------------------------------------------------------------
+ def DbGetPropertyList(self, argin):
+ """ Get list of property defined for a free object and matching the
+ specified filter
+
+ :param argin: Str[0] = Object name
+ Str[1] = filter
+ :type: PyTango.DevVarStringArray
+ :return: Property name list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetPropertyList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetPropertyList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetPropertyList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetServerInfo command:
+#------------------------------------------------------------------
+ def DbGetServerInfo(self, argin):
+ """ Get info about host, mode and level for specified server
+
+ :param argin: server name
+ :type: PyTango.DevString
+ :return: server info
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetServerInfo()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetServerInfo) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetServerInfo
+ return argout
+
+#------------------------------------------------------------------
+# DbGetServerList command:
+#------------------------------------------------------------------
+ def DbGetServerList(self, argin):
+ """ Get list of device server process defined in database
+ with name matching the specified filter
+
+ :param argin: The filter
+ :type: PyTango.DevString
+ :return: Device server process name list
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetServerList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetServerList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetServerList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetServerNameList command:
+#------------------------------------------------------------------
+ def DbGetServerNameList(self, argin):
+ """ Returns the list of server names found for the wildcard specified.
+ It returns only the server executable name without instance name as DbGetServerList.
+
+ :param argin: wildcard for server names.
+ :type: PyTango.DevString
+ :return: server names found.
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetServerNameList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetServerNameList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetServerNameList
+ return argout
+
+#------------------------------------------------------------------
+# DbImportDevice command:
+#------------------------------------------------------------------
+ def DbImportDevice(self, argin):
+ """ Import a device from the database
+
+ :param argin: Device name (or alias)
+ :type: PyTango.DevString
+ :return: Str[0] = device name
+ Str[1] = CORBA IOR
+ Str[2] = device version
+ Str[3] = device server process name
+ Str[4] = host name
+ Str[5] = Tango class name
+
+ Lg[0] = Exported flag
+ Lg[1] = Device server process PID
+ :rtype: PyTango.DevVarLongStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbImportDevice()")
+ argout = [0],['']
+ #----- PROTECTED REGION ID(DataBase.DbImportDevice) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbImportDevice
+ return argout
+
+#------------------------------------------------------------------
+# DbImportEvent command:
+#------------------------------------------------------------------
+ def DbImportEvent(self, argin):
+ """ Get event channel info from database
+
+ :param argin: name of event channel or factory
+ :type: PyTango.DevString
+ :return: export information e.g. IOR
+ :rtype: PyTango.DevVarLongStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbImportEvent()")
+ argout = [0],['']
+ #----- PROTECTED REGION ID(DataBase.DbImportEvent) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbImportEvent
+ return argout
+
+#------------------------------------------------------------------
+# DbInfo command:
+#------------------------------------------------------------------
+ def DbInfo(self):
+ """ Get miscellaneous numbers on information
+ stored in database
+
+ :param :
+ :type: PyTango.DevVoid
+ :return: Miscellaneous info like:
+ - Device defined in database
+ - Device marked as exported in database
+ - Device server process defined in database
+ - Device server process marked as exported in database
+ - Device properties defined in database
+ - Class properties defined in database
+ - Device attribute properties defined in database
+ - Class attribute properties defined in database
+ - Object properties defined in database
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbInfo()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbInfo) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbInfo
+ return argout
+
+#------------------------------------------------------------------
+# DbPutAttributeAlias command:
+#------------------------------------------------------------------
+ def DbPutAttributeAlias(self, argin):
+ """ Define an alias for an attribute
+
+ :param argin: Str[0] = attribute name
+ Str[1] = attribute alias
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbPutAttributeAlias()")
+ #----- PROTECTED REGION ID(DataBase.DbPutAttributeAlias) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbPutAttributeAlias
+
+#------------------------------------------------------------------
+# DbPutClassAttributeProperty command:
+#------------------------------------------------------------------
+ def DbPutClassAttributeProperty(self, argin):
+ """ Create/Update class attribute property(ies) in database
+
+ :param argin: Str[0] = Tango class name
+ Str[1] = Attribute number
+ Str[2] = Attribute name
+ Str[3] = Property number
+ Str[4] = Property name
+ Str[5] = Property value
+ .....
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbPutClassAttributeProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbPutClassAttributeProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbPutClassAttributeProperty
+
+#------------------------------------------------------------------
+# DbPutClassAttributeProperty2 command:
+#------------------------------------------------------------------
+ def DbPutClassAttributeProperty2(self, argin):
+ """ This command adds support for array properties compared to the previous one
+ called DbPutClassAttributeProperty. The old comman is still there for compatibility reason
+
+ :param argin: Str[0] = Tango class name
+ Str[1] = Attribute number
+ Str[2] = Attribute name
+ Str[3] = Property number
+ Str[4] = Property name
+ Str[5] = Property value number (array case)
+ Str[5] = Property value 1
+ Str[n] = Property value n (array case)
+ .....
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbPutClassAttributeProperty2()")
+ #----- PROTECTED REGION ID(DataBase.DbPutClassAttributeProperty2) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbPutClassAttributeProperty2
+
+#------------------------------------------------------------------
+# DbPutClassProperty command:
+#------------------------------------------------------------------
+ def DbPutClassProperty(self, argin):
+ """ Create / Update class property(ies)
+
+ :param argin: Str[0] = Tango class name
+ Str[1] = Property number
+ Str[2] = Property name
+ Str[3] = Property value number
+ Str[4] = Property value 1
+ Str[n] = Property value n
+ ....
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbPutClassProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbPutClassProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbPutClassProperty
+
+#------------------------------------------------------------------
+# DbPutDeviceAlias command:
+#------------------------------------------------------------------
+ def DbPutDeviceAlias(self, argin):
+ """ Define alias for a given device name
+
+ :param argin: Str[0] = device name
+ Str[1] = alias name
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbPutDeviceAlias()")
+ #----- PROTECTED REGION ID(DataBase.DbPutDeviceAlias) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbPutDeviceAlias
+
+#------------------------------------------------------------------
+# DbPutDeviceAttributeProperty command:
+#------------------------------------------------------------------
+ def DbPutDeviceAttributeProperty(self, argin):
+ """ Create/Update device attribute property(ies) in database
+
+ :param argin: Str[0] = Device name
+ Str[1] = Attribute number
+ Str[2] = Attribute name
+ Str[3] = Property number
+ Str[4] = Property name
+ Str[5] = Property value
+ .....
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbPutDeviceAttributeProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbPutDeviceAttributeProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbPutDeviceAttributeProperty
+
+#------------------------------------------------------------------
+# DbPutDeviceAttributeProperty2 command:
+#------------------------------------------------------------------
+ def DbPutDeviceAttributeProperty2(self, argin):
+ """ Put device attribute property. This command adds the possibility to have attribute property
+ which are arrays. Not possible with the old DbPutDeviceAttributeProperty command.
+ This old command is not deleted for compatibility reasons.
+
+ :param argin: Str[0] = Device name
+ Str[1] = Attribute number
+ Str[2] = Attribute name
+ Str[3] = Property number
+ Str[4] = Property name
+ Str[5] = Property value number (array case)
+ Str[5] = Property value 1
+ Str[n] = Property value n (array case)
+ .....
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbPutDeviceAttributeProperty2()")
+ #----- PROTECTED REGION ID(DataBase.DbPutDeviceAttributeProperty2) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbPutDeviceAttributeProperty2
+
+#------------------------------------------------------------------
+# DbPutDeviceProperty command:
+#------------------------------------------------------------------
+ def DbPutDeviceProperty(self, argin):
+ """ Create / Update device property(ies)
+
+ :param argin: Str[0] = Tango device name
+ Str[1] = Property number
+ Str[2] = Property name
+ Str[3] = Property value number
+ Str[4] = Property value 1
+ Str[n] = Property value n
+ ....
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbPutDeviceProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbPutDeviceProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbPutDeviceProperty
+
+#------------------------------------------------------------------
+# DbPutProperty command:
+#------------------------------------------------------------------
+ def DbPutProperty(self, argin):
+ """ Create / Update free object property(ies)
+
+ :param argin: Str[0] = Object name
+ Str[1] = Property number
+ Str[2] = Property name
+ Str[3] = Property value number
+ Str[4] = Property value 1
+ Str[n] = Property value n
+ ....
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbPutProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbPutProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbPutProperty
+
+#------------------------------------------------------------------
+# DbPutServerInfo command:
+#------------------------------------------------------------------
+ def DbPutServerInfo(self, argin):
+ """ Update server info including host, mode and level
+
+ :param argin: server info
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbPutServerInfo()")
+ #----- PROTECTED REGION ID(DataBase.DbPutServerInfo) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbPutServerInfo
+
+#------------------------------------------------------------------
+# DbUnExportDevice command:
+#------------------------------------------------------------------
+ def DbUnExportDevice(self, argin):
+ """ Mark a device as non exported in database
+
+ :param argin: Device name
+ :type: PyTango.DevString
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbUnExportDevice()")
+ #----- PROTECTED REGION ID(DataBase.DbUnExportDevice) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbUnExportDevice
+
+#------------------------------------------------------------------
+# DbUnExportEvent command:
+#------------------------------------------------------------------
+ def DbUnExportEvent(self, argin):
+ """ Mark one event channel as non exported in database
+
+ :param argin: name of event channel or factory to unexport
+ :type: PyTango.DevString
+ :return: none
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbUnExportEvent()")
+ #----- PROTECTED REGION ID(DataBase.DbUnExportEvent) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbUnExportEvent
+
+#------------------------------------------------------------------
+# DbUnExportServer command:
+#------------------------------------------------------------------
+ def DbUnExportServer(self, argin):
+ """ Mark all devices belonging to a specified device server
+ process as non exported
+
+ :param argin: Device server name (executable/instance)
+ :type: PyTango.DevString
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbUnExportServer()")
+ #----- PROTECTED REGION ID(DataBase.DbUnExportServer) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbUnExportServer
+
+#------------------------------------------------------------------
+# ResetTimingValues command:
+#------------------------------------------------------------------
+ def ResetTimingValues(self):
+ """ Reset the timing attribute values.
+
+ :param :
+ :type: PyTango.DevVoid
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".ResetTimingValues()")
+ #----- PROTECTED REGION ID(DataBase.ResetTimingValues) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.ResetTimingValues
+
+#------------------------------------------------------------------
+# DbGetDataForServerCache command:
+#------------------------------------------------------------------
+ def DbGetDataForServerCache(self, argin):
+ """ This command returns all the data needed by a device server process during its
+ startup sequence. The aim of this command is to minimize database access during
+ device server startup sequence.
+
+ :param argin: Elt[0] = DS name (exec_name/inst_name), Elt[1] = Host name
+ :type: PyTango.DevVarStringArray
+ :return: All the data needed by the device server during its startup sequence. Precise list depend on the device server
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetDataForServerCache()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetDataForServerCache) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetDataForServerCache
+ return argout
+
+#------------------------------------------------------------------
+# DbDeleteAllDeviceAttributeProperty command:
+#------------------------------------------------------------------
+ def DbDeleteAllDeviceAttributeProperty(self, argin):
+ """ Delete all attribute properties for the specified device attribute(s)
+
+ :param argin: str[0] = device name
+ Str[1]...str[n] = attribute name(s)
+ :type: PyTango.DevVarStringArray
+ :return:
+ :rtype: PyTango.DevVoid """
+ self.debug_stream("In " + self.get_name() + ".DbDeleteAllDeviceAttributeProperty()")
+ #----- PROTECTED REGION ID(DataBase.DbDeleteAllDeviceAttributeProperty) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbDeleteAllDeviceAttributeProperty
+
+#------------------------------------------------------------------
+# DbMySqlSelect command:
+#------------------------------------------------------------------
+ def DbMySqlSelect(self, argin):
+ """ This is a very low level command.
+ It executes the specified SELECT command on TANGO database and returns its result without filter.
+
+ :param argin: MySql Select command
+ :type: PyTango.DevString
+ :return: MySql Select command result
+ - svalues : select results
+ - lvalue[n] : =0 if svalue[n] is null else =1
+ (last lvalue -1) is number of rows, (last lvalue) is number of fields
+ :rtype: PyTango.DevVarLongStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbMySqlSelect()")
+ argout = [0],['']
+ #----- PROTECTED REGION ID(DataBase.DbMySqlSelect) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbMySqlSelect
+ return argout
+
+#------------------------------------------------------------------
+# DbGetCSDbServerList command:
+#------------------------------------------------------------------
+ def DbGetCSDbServerList(self):
+ """ Get a list of host:port for all database server defined in the control system
+
+ :param :
+ :type: PyTango.DevVoid
+ :return: List of host:port with one element for each database server
+ :rtype: PyTango.DevVarStringArray """
+ self.debug_stream("In " + self.get_name() + ".DbGetCSDbServerList()")
+ argout = ['']
+ #----- PROTECTED REGION ID(DataBase.DbGetCSDbServerList) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetCSDbServerList
+ return argout
+
+#------------------------------------------------------------------
+# DbGetAttributeAlias2 command:
+#------------------------------------------------------------------
+ def DbGetAttributeAlias2(self, argin):
+ """ Get the attribute alias from the attribute name.
+ Returns one empty string if nothing found in database
+
+ :param argin: The attribute name (dev_name/att_name)
+ :type: PyTango.DevString
+ :return: The attribute alias name (or empty string)
+ :rtype: PyTango.DevString """
+ self.debug_stream("In " + self.get_name() + ".DbGetAttributeAlias2()")
+ argout = ''
+ #----- PROTECTED REGION ID(DataBase.DbGetAttributeAlias2) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetAttributeAlias2
+ return argout
+
+#------------------------------------------------------------------
+# DbGetAliasAttribute command:
+#------------------------------------------------------------------
+ def DbGetAliasAttribute(self, argin):
+ """ Get the attribute name from the given alias.
+ If the given alias is not found in database, returns an empty string
+
+ :param argin: The attribute alias
+ :type: PyTango.DevString
+ :return: The attribute name (dev_name/att_name)
+ :rtype: PyTango.DevString """
+ self.debug_stream("In " + self.get_name() + ".DbGetAliasAttribute()")
+ argout = ''
+ #----- PROTECTED REGION ID(DataBase.DbGetAliasAttribute) ENABLED START -----#
+
+ #----- PROTECTED REGION END -----# // DataBase.DbGetAliasAttribute
+ return argout
+
+
+#==================================================================
+#
+# DataBaseClass class definition
+#
+#==================================================================
+class DataBaseClass(PyTango.DeviceClass):
+
+ # Class Properties
+ class_property_list = {
+ }
+
+
+ # Device Properties
+ device_property_list = {
+ }
+
+
+ # Command definitions
+ cmd_list = {
+ 'DbAddDevice':
+ [[PyTango.DevVarStringArray, "Str[0] = Full device server process name\nStr[1] = Device name\nStr[2] = Tango class name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbAddServer':
+ [[PyTango.DevVarStringArray, "Str[0] = Full device server name\nStr[1] = Device(s) name\nStr[2] = Tango class name\nStr[n] = Device name\nStr[n + 1] = Tango class name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteAttributeAlias':
+ [[PyTango.DevString, "Attriibute alias name."],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteClassAttribute':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Attribute name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteClassAttributeProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Attribute name\nStr[2] = Property name\nStr[n] = Property name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteClassProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Property name\nStr[n] = Property name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteDevice':
+ [[PyTango.DevString, "device name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteDeviceAlias':
+ [[PyTango.DevString, "device alias name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteDeviceAttribute':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Attribute name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteDeviceAttributeProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Attribute name\nStr[2] = Property name\nStr[n] = Property name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteDeviceProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Property name\nStr[n] = Property name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Object name\nStr[1] = Property name\nStr[n] = Property name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteServer':
+ [[PyTango.DevString, "Device server name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbDeleteServerInfo':
+ [[PyTango.DevString, "Device server name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbExportDevice':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = CORBA IOR\nStr[2] = Device server process host name\nStr[3] = Device server process PID or string ``null``\nStr[4] = Device server process version"],
+ [PyTango.DevVoid, "none"]],
+ 'DbExportEvent':
+ [[PyTango.DevVarStringArray, "Str[0] = event channel name (or factory name)\nStr[1] = CORBA IOR\nStr[2] = Notifd host name\nStr[3] = Notifd pid\nStr[4] = Notifd version"],
+ [PyTango.DevVoid, "none"]],
+ 'DbGetAliasDevice':
+ [[PyTango.DevString, "Alias name"],
+ [PyTango.DevString, "Device name"]],
+ 'DbGetAttributeAlias':
+ [[PyTango.DevString, "The attribute alias name"],
+ [PyTango.DevString, "The attribute name (device/attribute)"]],
+ 'DbGetAttributeAliasList':
+ [[PyTango.DevString, "attribute alias filter string (eg: att*)"],
+ [PyTango.DevVarStringArray, "attribute aliases"]],
+ 'DbGetClassAttributeList':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Attribute name filter (eg: att*)"],
+ [PyTango.DevVarStringArray, "Str[0] = Class attribute name\nStr[n] = Class attribute name"]],
+ 'DbGetClassAttributeProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Attribute name\nStr[n] = Attribute name"],
+ [PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Attribute property number\nStr[2] = Attribute property 1 name\nStr[3] = Attribute property 1 value\nStr[n + 1] = Attribute property 2 name\nStr[n + 2] = Attribute property 2 value"]],
+ 'DbGetClassAttributeProperty2':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Attribute name\nStr[n] = Attribute name"],
+ [PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Attribute property number\nStr[2] = Attribute property 1 name\nStr[3] = Attribute property 1 value number (array case)\nStr[4] = Attribute property 1 value\nStr[n] = Attribute property 1 value (array case)\nStr[n + 1] = Attribute property 2 name\nStr[n + 2] = Attribute property 2 value number (array case)\nStr[n + 3] = Attribute property 2 value\nStr[n + m] = Attribute property 2 value (array case)"]],
+ 'DbGetClassAttributePropertyHist':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class\nStr[1] = Attribute name\nStr[2] = Property name"],
+ [PyTango.DevVarStringArray, "Str[0] = Attribute name\nStr[1] = Property name\nStr[2] = date\nStr[3] = Property value number (array case)\nStr[4] = Property value 1\nStr[n] = Property value n"]],
+ 'DbGetClassForDevice':
+ [[PyTango.DevString, "Device name"],
+ [PyTango.DevString, "Device Tango class"]],
+ 'DbGetClassInheritanceForDevice':
+ [[PyTango.DevString, "Device name"],
+ [PyTango.DevVarStringArray, "Classes off the specified device.\n[0] - is the class of the device.\n[1] - is the class from the device class is inherited.\n........and so on"]],
+ 'DbGetClassList':
+ [[PyTango.DevString, "Filter"],
+ [PyTango.DevVarStringArray, "Class list"]],
+ 'DbGetClassProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class\nStr[1] = Property name\nStr[2] = Property name"],
+ [PyTango.DevVarStringArray, "Str[0] = Tango class\nStr[1] = Property number\nStr[2] = Property name\nStr[3] = Property value number (array case)\nStr[4] = Property value\nStr[n] = Propery value (array case)\n...."]],
+ 'DbGetClassPropertyHist':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class\nStr[1] = Property name"],
+ [PyTango.DevVarStringArray, "Str[0] = Property name\nStr[1] = date\nStr[2] = Property value number (array case)\nStr[3] = Property value 1\nStr[n] = Property value n"]],
+ 'DbGetClassPropertyList':
+ [[PyTango.DevString, "The filter"],
+ [PyTango.DevVarStringArray, "Property name list"]],
+ 'DbGetDeviceAlias':
+ [[PyTango.DevString, "The device name"],
+ [PyTango.DevString, "The alias found"]],
+ 'DbGetDeviceAliasList':
+ [[PyTango.DevString, "The filter"],
+ [PyTango.DevVarStringArray, "Device alias list"]],
+ 'DbGetDeviceAttributeList':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Wildcard"],
+ [PyTango.DevVarStringArray, "attribute name list"]],
+ 'DbGetDeviceAttributeProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Attribute name\nStr[n] = Attribute name"],
+ [PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Attribute property number\nStr[2] = Attribute property 1 name\nStr[3] = Attribute property 1 value\nStr[n + 1] = Attribute property 2 name\nStr[n + 2] = Attribute property 2 value"]],
+ 'DbGetDeviceAttributeProperty2':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Attribute name\nStr[n] = Attribute name"],
+ [PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Attribute property number\nStr[2] = Attribute property 1 name\nStr[3] = Attribute property 1 value number (array case)\nStr[4] = Attribute property 1 value\nStr[n] = Attribute property 1 value (array case)\nStr[n + 1] = Attribute property 2 name\nStr[n + 2] = Attribute property 2 value number (array case)\nStr[n + 3] = Attribute property 2 value\nStr[n + m] = Attribute property 2 value (array case)"]],
+ 'DbGetDeviceAttributePropertyHist':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Attribute name\nStr[2] = Property name"],
+ [PyTango.DevVarStringArray, "Str[0] = Attribute name\nStr[1] = Property name\nStr[2] = date\nStr[3] = Property value number (array case)\nStr[4] = Property value 1\nStr[n] = Property value n"]],
+ 'DbGetDeviceClassList':
+ [[PyTango.DevString, "Device server process name"],
+ [PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Tango class\nStr[n] = Device name\nStr[n + 1] = Tango class"]],
+ 'DbGetDeviceDomainList':
+ [[PyTango.DevString, "The wildcard"],
+ [PyTango.DevVarStringArray, "Device name domain list"]],
+ 'DbGetDeviceExportedList':
+ [[PyTango.DevString, "filter"],
+ [PyTango.DevVarStringArray, "list of exported devices"]],
+ 'DbGetDeviceFamilyList':
+ [[PyTango.DevString, "The wildcard"],
+ [PyTango.DevVarStringArray, "Family list"]],
+ 'DbGetDeviceInfo':
+ [[PyTango.DevString, "Device name"],
+ [PyTango.DevVarLongStringArray, "Str[0] = Device name\nStr[1] = CORBA IOR\nStr[2] = Device version\nStr[3] = Device Server name\nStr[4] = Device Server process host name\nStr[5] = Started date (or ? if not set)\nStr[6] = Stopped date (or ? if not set)\nStr[7] = Device class\n\nLg[0] = Device exported flag\nLg[1] = Device Server process PID (or -1 if not set)"]],
+ 'DbGetDeviceList':
+ [[PyTango.DevVarStringArray, "argin[0] : server name\nargin[1] : class name"],
+ [PyTango.DevVarStringArray, "The list of devices for specified server and class."]],
+ 'DbGetDeviceWideList':
+ [[PyTango.DevString, "filter"],
+ [PyTango.DevVarStringArray, "list of exported devices"]],
+ 'DbGetDeviceMemberList':
+ [[PyTango.DevString, "The filter"],
+ [PyTango.DevVarStringArray, "Device names member list"]],
+ 'DbGetDeviceProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Property name\nStr[n] = Property name"],
+ [PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Property number\nStr[2] = Property name\nStr[3] = Property value number (array case)\nStr[4] = Property value 1\nStr[n] = Property value n (array case)\nStr[n + 1] = Property name\nStr[n + 2] = Property value number (array case)\nStr[n + 3] = Property value 1\nStr[n + m] = Property value m"]],
+ 'DbGetDevicePropertyHist':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[2] = Property name"],
+ [PyTango.DevVarStringArray, "Str[0] = Property name\nStr[1] = date\nStr[2] = Property value number (array case)\nStr[3] = Property value 1\nStr[n] = Property value n"]],
+ 'DbGetDevicePropertyList':
+ [[PyTango.DevVarStringArray, "Str[0] = device name\nStr[1] = Filter"],
+ [PyTango.DevVarStringArray, "Property name list"]],
+ 'DbGetDeviceServerClassList':
+ [[PyTango.DevString, "device server process name"],
+ [PyTango.DevVarStringArray, "list of classes for this device server"]],
+ 'DbGetExportdDeviceListForClass':
+ [[PyTango.DevString, "Class name"],
+ [PyTango.DevVarStringArray, "Device exported list"]],
+ 'DbGetHostList':
+ [[PyTango.DevString, "The filter"],
+ [PyTango.DevVarStringArray, "Host name list"]],
+ 'DbGetHostServerList':
+ [[PyTango.DevString, "The filter"],
+ [PyTango.DevVarStringArray, "Device server process name list"]],
+ 'DbGetHostServersInfo':
+ [[PyTango.DevString, "Host name"],
+ [PyTango.DevVarStringArray, "Server info for all servers running on specified host"]],
+ 'DbGetInstanceNameList':
+ [[PyTango.DevString, "Server name"],
+ [PyTango.DevVarStringArray, "The instance names found for specified server."]],
+ 'DbGetObjectList':
+ [[PyTango.DevString, "The filter"],
+ [PyTango.DevVarStringArray, "Object name list"]],
+ 'DbGetProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Object name\nStr[1] = Property name\nStr[n] = Property name"],
+ [PyTango.DevVarStringArray, "Str[0] = Object name\nStr[1] = Property number\nStr[2] = Property name\nStr[3] = Property value number (array case)\nStr[4] = Property value 1\nStr[n] = Property value n (array case)\nStr[n + 1] = Property name\nStr[n + 2] = Property value number (array case)\nStr[n + 3] = Property value 1\nStr[n + m] = Property value m"]],
+ 'DbGetPropertyHist':
+ [[PyTango.DevVarStringArray, "Str[0] = Object name\nStr[2] = Property name"],
+ [PyTango.DevVarStringArray, "Str[0] = Property name\nStr[1] = date\nStr[2] = Property value number (array case)\nStr[3] = Property value 1\nStr[n] = Property value n"]],
+ 'DbGetPropertyList':
+ [[PyTango.DevVarStringArray, "Str[0] = Object name\nStr[1] = filter"],
+ [PyTango.DevVarStringArray, "Property name list"]],
+ 'DbGetServerInfo':
+ [[PyTango.DevString, "server name"],
+ [PyTango.DevVarStringArray, "server info"]],
+ 'DbGetServerList':
+ [[PyTango.DevString, "The filter"],
+ [PyTango.DevVarStringArray, "Device server process name list"]],
+ 'DbGetServerNameList':
+ [[PyTango.DevString, "wildcard for server names."],
+ [PyTango.DevVarStringArray, "server names found."]],
+ 'DbImportDevice':
+ [[PyTango.DevString, "Device name (or alias)"],
+ [PyTango.DevVarLongStringArray, "Str[0] = device name\nStr[1] = CORBA IOR\nStr[2] = device version\nStr[3] = device server process name\nStr[4] = host name\nStr[5] = Tango class name\n\nLg[0] = Exported flag\nLg[1] = Device server process PID"]],
+ 'DbImportEvent':
+ [[PyTango.DevString, "name of event channel or factory"],
+ [PyTango.DevVarLongStringArray, "export information e.g. IOR"]],
+ 'DbInfo':
+ [[PyTango.DevVoid, "none"],
+ [PyTango.DevVarStringArray, "Miscellaneous info like:\n- Device defined in database\n- Device marked as exported in database\n- Device server process defined in database\n- Device server process marked as exported in database\n- Device properties defined in database\n- Class properties defined in database\n- Device attribute properties defined in database\n- Class attribute properties defined in database\n- Object properties defined in database"]],
+ 'DbPutAttributeAlias':
+ [[PyTango.DevVarStringArray, "Str[0] = attribute name\nStr[1] = attribute alias"],
+ [PyTango.DevVoid, "none"]],
+ 'DbPutClassAttributeProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Attribute number\nStr[2] = Attribute name\nStr[3] = Property number\nStr[4] = Property name\nStr[5] = Property value\n....."],
+ [PyTango.DevVoid, "none"]],
+ 'DbPutClassAttributeProperty2':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Attribute number\nStr[2] = Attribute name\nStr[3] = Property number\nStr[4] = Property name\nStr[5] = Property value number (array case)\nStr[5] = Property value 1\nStr[n] = Property value n (array case)\n....."],
+ [PyTango.DevVoid, "none"]],
+ 'DbPutClassProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango class name\nStr[1] = Property number\nStr[2] = Property name\nStr[3] = Property value number\nStr[4] = Property value 1\nStr[n] = Property value n\n...."],
+ [PyTango.DevVoid, "none"]],
+ 'DbPutDeviceAlias':
+ [[PyTango.DevVarStringArray, "Str[0] = device name\nStr[1] = alias name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbPutDeviceAttributeProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Attribute number\nStr[2] = Attribute name\nStr[3] = Property number\nStr[4] = Property name\nStr[5] = Property value\n....."],
+ [PyTango.DevVoid, "none"]],
+ 'DbPutDeviceAttributeProperty2':
+ [[PyTango.DevVarStringArray, "Str[0] = Device name\nStr[1] = Attribute number\nStr[2] = Attribute name\nStr[3] = Property number\nStr[4] = Property name\nStr[5] = Property value number (array case)\nStr[5] = Property value 1\nStr[n] = Property value n (array case)\n....."],
+ [PyTango.DevVoid, "none"]],
+ 'DbPutDeviceProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Tango device name\nStr[1] = Property number\nStr[2] = Property name\nStr[3] = Property value number\nStr[4] = Property value 1\nStr[n] = Property value n\n...."],
+ [PyTango.DevVoid, "none"]],
+ 'DbPutProperty':
+ [[PyTango.DevVarStringArray, "Str[0] = Object name\nStr[1] = Property number\nStr[2] = Property name\nStr[3] = Property value number\nStr[4] = Property value 1\nStr[n] = Property value n\n...."],
+ [PyTango.DevVoid, "none"]],
+ 'DbPutServerInfo':
+ [[PyTango.DevVarStringArray, "server info"],
+ [PyTango.DevVoid, "none"]],
+ 'DbUnExportDevice':
+ [[PyTango.DevString, "Device name"],
+ [PyTango.DevVoid, "none"]],
+ 'DbUnExportEvent':
+ [[PyTango.DevString, "name of event channel or factory to unexport"],
+ [PyTango.DevVoid, "none"]],
+ 'DbUnExportServer':
+ [[PyTango.DevString, "Device server name (executable/instance)"],
+ [PyTango.DevVoid, "none"]],
+ 'ResetTimingValues':
+ [[PyTango.DevVoid, "none"],
+ [PyTango.DevVoid, "none"]],
+ 'DbGetDataForServerCache':
+ [[PyTango.DevVarStringArray, "Elt[0] = DS name (exec_name/inst_name), Elt[1] = Host name"],
+ [PyTango.DevVarStringArray, "All the data needed by the device server during its startup sequence. Precise list depend on the device server"]],
+ 'DbDeleteAllDeviceAttributeProperty':
+ [[PyTango.DevVarStringArray, "str[0] = device name\nStr[1]...str[n] = attribute name(s)"],
+ [PyTango.DevVoid, "none"]],
+ 'DbMySqlSelect':
+ [[PyTango.DevString, "MySql Select command"],
+ [PyTango.DevVarLongStringArray, "MySql Select command result\n - svalues : select results\n - lvalue[n] : =0 if svalue[n] is null else =1\n (last lvalue -1) is number of rows, (last lvalue) is number of fields"]],
+ 'DbGetCSDbServerList':
+ [[PyTango.DevVoid, "none"],
+ [PyTango.DevVarStringArray, "List of host:port with one element for each database server"]],
+ 'DbGetAttributeAlias2':
+ [[PyTango.DevString, "The attribute name (dev_name/att_name)"],
+ [PyTango.DevString, "The attribute alias name (or empty string)"]],
+ 'DbGetAliasAttribute':
+ [[PyTango.DevString, "The attribute alias"],
+ [PyTango.DevString, "The attribute name (dev_name/att_name)"]],
+ }
+
+
+ # Attribute definitions
+ attr_list = {
+ 'StoredProcedureRelease':
+ [[PyTango.DevString,
+ PyTango.SCALAR,
+ PyTango.READ]],
+ 'Timing_average':
+ [[PyTango.DevDouble,
+ PyTango.SPECTRUM,
+ PyTango.READ, 64]],
+ 'Timing_minimum':
+ [[PyTango.DevDouble,
+ PyTango.SPECTRUM,
+ PyTango.READ, 64]],
+ 'Timing_maximum':
+ [[PyTango.DevDouble,
+ PyTango.SPECTRUM,
+ PyTango.READ, 64]],
+ 'Timing_calls':
+ [[PyTango.DevDouble,
+ PyTango.SPECTRUM,
+ PyTango.READ, 64]],
+ 'Timing_index':
+ [[PyTango.DevString,
+ PyTango.SPECTRUM,
+ PyTango.READ, 64]],
+ 'Timing_info':
+ [[PyTango.DevString,
+ PyTango.SPECTRUM,
+ PyTango.READ, 64]],
+ }
+
+
+#------------------------------------------------------------------
+# DataBaseClass Constructor
+#------------------------------------------------------------------
+ def __init__(self, name):
+ PyTango.DeviceClass.__init__(self, name)
+ self.set_type(name);
+ print "In DataBase Class constructor"
+
+#==================================================================
+#
+# DataBase class main method
+#
+#==================================================================
+def main():
+ try:
+ py = PyTango.Util(sys.argv)
+ py.add_class(DataBaseClass,DataBase,'DataBase')
+
+ U = PyTango.Util.instance()
+ U.server_init()
+ U.server_run()
+
+ except PyTango.DevFailed,e:
+ print '-------> Received a DevFailed exception:',e
+ except Exception,e:
+ print '-------> An unforeseen exception occured....',e
+
+if __name__ == '__main__':
+ main()
diff --git a/PyTango/db.py b/PyTango/db.py
index c7eb770..8ac9034 100644
--- a/PyTango/db.py
+++ b/PyTango/db.py
@@ -29,6 +29,8 @@ __all__ = ["db_init"]
__docformat__ = "restructuredtext"
+import collections
+
from ._PyTango import StdStringVector, Database, DbDatum, DbData, \
DbDevInfo, DbDevInfos, DbDevImportInfo, DbDevExportInfo, DbDevExportInfos, \
DbHistory, DbServerInfo
@@ -36,7 +38,6 @@ from ._PyTango import StdStringVector, Database, DbDatum, DbData, \
from .utils import is_pure_str, is_non_str_seq, seq_2_StdStringVector, \
seq_2_DbDevInfos, seq_2_DbDevExportInfos, seq_2_DbData, DbData_2_dict
from .utils import document_method as __document_method
-import collections
#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
# DbDatum extension
diff --git a/PyTango/device_class.py b/PyTango/device_class.py
index 5af4f56..db2e4e6 100644
--- a/PyTango/device_class.py
+++ b/PyTango/device_class.py
@@ -284,7 +284,7 @@ class DeviceClass(_DeviceClass):
attr_list = {}
def __init__(self, name):
- _DeviceClass.__init__(self,name)
+ _DeviceClass.__init__(self, name)
self.dyn_att_added_methods = []
try:
pu = self.prop_util = PropUtil()
@@ -321,7 +321,10 @@ class DeviceClass(_DeviceClass):
"""for internal usage only"""
for attr_name, attr_info in self.attr_list.items():
- attr_data = AttrData(attr_name, self.get_name(), attr_info)
+ if isinstance(attr_info, AttrData):
+ attr_data = attr_info
+ else:
+ attr_data = AttrData(attr_name, self.get_name(), attr_info)
self.__create_attribute(attr_list, attr_data)
def __create_attribute(self, attr_list, attr_data):
diff --git a/PyTango/device_server.py b/PyTango/device_server.py
index e001ea1..8c05fa5 100644
--- a/PyTango/device_server.py
+++ b/PyTango/device_server.py
@@ -261,7 +261,17 @@ def __Attribute__set_properties(self, attr_cfg, dev = None):
else:
self._set_properties(attr_cfg, dev)
-
+def __Attribute__str(self):
+ return '%s(%s)' % (self.__class__.__name__, self.get_name())
+
+def __init_Attribute():
+ Attribute.__str__ = __Attribute__str
+ Attribute.__repr__ = __Attribute__str
+ Attribute.get_properties = __Attribute__get_properties
+ Attribute.get_properties_2 = __Attribute__get_properties_2
+ Attribute.get_properties_3 = __Attribute__get_properties_3
+ Attribute.set_properties = __Attribute__set_properties
+
def __DeviceImpl__get_device_class(self):
try:
return self._device_class_instance
@@ -645,17 +655,6 @@ def __init_Attr():
Attr.__str__ = __Attr__str
Attr.__repr__ = __Attr__str
-def __Attribute__str(self):
- return '%s(%s)' % (self.__class__.__name__, self.get_name())
-
-def __init_Attribute():
- Attribute.__str__ = __Attribute__str
- Attribute.__repr__ = __Attribute__str
- Attribute.get_properties = __Attribute__get_properties
- Attribute.get_properties_2 = __Attribute__get_properties_2
- Attribute.get_properties_3 = __Attribute__get_properties_3
- Attribute.set_properties = __Attribute__set_properties
-
def __init_Logger():
Logger.log = __Logger__log
Logger.log_unconditionally = __Logger__log_unconditionally
diff --git a/PyTango/log4tango.py b/PyTango/log4tango.py
index a609c88..3e5088a 100644
--- a/PyTango/log4tango.py
+++ b/PyTango/log4tango.py
@@ -104,44 +104,63 @@ class LogIt(object):
self._show_kwargs = show_kwargs
self._show_ret = show_ret
- def __compact(self, v, maxlen=25):
+ def __compact_elem(self, v, maxlen=25):
v = repr(v)
if len(v) > maxlen:
v = v[:maxlen-6] + " [...]"
return v
- def __compact_dict(self, k, v, maxlen=None):
+ def __compact_elems(self, elems):
+ return map(self.__compact_elem, elems)
+
+ def __compact_elems_str(self, elems):
+ return ", ".join(self.__compact_elems(elems))
+
+ def __compact_item(self, k, v, maxlen=None):
if maxlen is None:
return "%s=%s" % (k, self.__compact(v))
return "%s=%s" % (k, self.__compact(v, maxlen=maxlen))
- def is_enabled(self, d):
- return d.get_logger().is_debug_enabled()
+ def __compact_dict(self, d, maxlen=None):
+ return ( self.__compact_item(k,v) for k,v in d.items() )
- def get_log_func(self, d):
- return d.debug_stream
+ def __compact_dict_str(self, d, maxlen=None):
+ return ", ".join(self.__compact_dict(d, maxlen=maxlen))
+
+ def is_enabled(self, obj):
+ return obj.get_logger().is_debug_enabled()
+
+ def get_log_func(self, obj):
+ return obj.debug_stream
def __call__(self, f):
@functools.wraps(f)
def log_stream(*args, **kwargs):
- d = args[0]
- if not self.is_enabled(d):
+ dev = args[0]
+ if not self.is_enabled(dev):
return f(*args, **kwargs)
- in_msg = "-> %s(" % f.__name__
+ log = self.get_log_func(dev)
+ f_name = dev.__class__.__name__ + "." + f.__name__
+ sargs = ""
if self._show_args:
- in_msg += ", ".join(map(self.__compact, args[1:]))
+ sargs = self.__compact_elems_str(args[1:])
if self._show_kwargs:
- kwargs_str = ( self.__compact_dict(k,v) for k,v in kwargs.items() )
- in_msg += ", ".join(kwargs_str)
- in_msg += ")"
- self.get_log_func(d)(in_msg)
- ret = f(*args, **kwargs)
- out_msg = ""
- if self._show_ret:
- out_msg += self.__compact(ret) + " "
- out_msg += "<- %s()" % f.__name__
- self.get_log_func(d)(out_msg)
- return ret
+ sargs += self.__compact_dict_str(kwargs)
+ log("-> {0}({1})".format(f_name, sargs))
+ with_exc = True
+ try:
+ ret = f(*args, **kwargs)
+ with_exc = False
+ return ret
+ finally:
+ if with_exc:
+ log("<- {0}() raised exception!".format(f_name))
+ else:
+ sret = ""
+ if self._show_ret:
+ sret = self.__compact_elem(ret) + " "
+ log("{0}<- {1}()".format(sret, f_name))
+ log_stream._wrapped = f
return log_stream
@@ -282,4 +301,4 @@ class FatalIt(LogIt):
return d.get_logger().is_fatal_enabled()
def get_log_func(self, d):
- return d.fatal_stream
\ No newline at end of file
+ return d.fatal_stream
diff --git a/PyTango/utils.py b/PyTango/utils.py
index fbbb24f..69a3509 100644
--- a/PyTango/utils.py
+++ b/PyTango/utils.py
@@ -33,7 +33,8 @@ __all__ = [ "is_pure_str", "is_seq", "is_non_str_seq", "is_integer",
"is_int_type", "is_float_type", "obj_2_str", "seqStr_2_obj",
"document_method", "document_static_method", "document_enum",
"CaselessList", "CaselessDict", "EventCallBack", "get_home",
- "from_version_str_to_hex_str", "from_version_str_to_int", ]
+ "from_version_str_to_hex_str", "from_version_str_to_int",
+ "server_run", "decorator" ]
__docformat__ = "restructuredtext"
@@ -41,11 +42,13 @@ import sys
import os
import collections
import numbers
+import functools
+import inspect
+import traceback
from ._PyTango import StdStringVector, StdDoubleVector, \
DbData, DbDevInfos, DbDevExportInfos, CmdArgType, AttrDataFormat, \
- EventData, AttrConfEventData, DataReadyEventData, DevFailed
-from ._PyTango import constants
+ EventData, AttrConfEventData, DataReadyEventData, DevFailed, constants
_scalar_int_types = (CmdArgType.DevShort, CmdArgType.DevUShort,
CmdArgType.DevInt, CmdArgType.DevLong, CmdArgType.DevULong,
@@ -90,9 +93,27 @@ _scalar_to_array_type = {
CmdArgType.ConstDevString : CmdArgType.DevVarStringArray,
}
+__device_classes = None
+
+def get_tango_device_classes():
+ global __device_classes
+ if __device_classes is None:
+ import PyTango
+ __device_classes = [PyTango.DeviceImpl]
+ i = 2
+ while True:
+ dc = "Device_{0}Impl".format(i)
+ try:
+ __device_classes.append(getattr(PyTango, dc))
+ i = i + 1
+ except AttributeError:
+ break
+ return __device_classes
+
__str_klasses = str,
__int_klasses = int,
__number_klasses = numbers.Number,
+__seq_klasses = collections.Sequence, bytearray
__use_unicode = False
try:
@@ -114,16 +135,18 @@ if constants.NUMPY_SUPPORT:
import numpy
__int_klasses = tuple(list(__int_klasses) + [numpy.integer])
__number_klasses = tuple(list(__number_klasses) + [numpy.number])
-
+ __seq_klasses = tuple(list(__seq_klasses) + [numpy.ndarray])
+
__str_klasses = tuple(__str_klasses)
__int_klasses = tuple(__int_klasses)
__number_klasses = tuple(__number_klasses)
+__seq_klasses = tuple(__seq_klasses)
def is_pure_str(obj):
return isinstance(obj , __str_klasses)
def is_seq(obj):
- return isinstance(obj, (collections.Sequence, bytearray))
+ return isinstance(obj, __seq_klasses)
def is_non_str_seq(obj):
return is_seq(obj) and not is_pure_str(obj)
@@ -1031,14 +1054,31 @@ def __server_run(classes, args=None, msg_stream=sys.stderr):
args = sys.argv
util = PyTango.Util(args)
- for klass_name, (klass_klass, klass) in classes.items():
- util.add_class(klass_klass, klass, klass_name)
+ if is_seq(classes):
+ for klass_info in classes:
+ if not hasattr(klass_info, '_api') or klass_info._api < 2:
+ raise Exception("When giving a single class, it must implement API2 (see PyTango.api2)")
+ klass_klass = klass_info._DeviceClass
+ klass_name = klass_info._DeviceClassName
+ klass = klass_info
+ util.add_class(klass_klass, klass, klass_name)
+ else:
+ for klass_name, klass_info in classes.items():
+ if is_seq(klass_info):
+ klass_klass, klass = klass_info
+ else:
+ if not hasattr(klass_info, '_api') or klass_info._api < 2:
+ raise Exception("When giving a single class, it must implement API2 (see PyTango.api2)")
+ klass_klass = klass_info._DeviceClass
+ klass_name = klass_info._DeviceClassName
+ klass = klass_info
+ util.add_class(klass_klass, klass, klass_name)
u_instance = PyTango.Util.instance()
u_instance.server_init()
msg_stream.write("Ready to accept request\n")
u_instance.server_run()
-def server_run(classes, args=None, msg_stream=sys.stderr):
+def server_run(classes, args=None, msg_stream=sys.stderr, verbose=False):
"""Provides a simple way to run a tango server. It handles exceptions
by writting a message to the msg_stream
@@ -1073,7 +1113,11 @@ def server_run(classes, args=None, msg_stream=sys.stderr):
write("Exiting: Keyboard interrupt\n")
except DevFailed as df:
write("Exiting: Server exited with PyTango.DevFailed:\n" + str(df) + "\n")
+ if verbose:
+ write(traceback.format_exc())
except Exception as e:
write("Exiting: Server exited with unforseen exception:\n" + str(e) + "\n")
+ if verbose:
+ write(traceback.format_exc())
write("\nExited\n")
diff --git a/doc/server/index.rst b/doc/server/index.rst
index caf5099..1a3894e 100644
--- a/doc/server/index.rst
+++ b/doc/server/index.rst
@@ -998,7 +998,8 @@ Server API
.. toctree::
:maxdepth: 2
-
+
+ api2
device
device_class
logging
diff --git a/doc/tep/tep-0001.rst b/doc/tep/tep-0001.rst
index 76321d8..042eaac 100644
--- a/doc/tep/tep-0001.rst
+++ b/doc/tep/tep-0001.rst
@@ -1,3 +1,8 @@
+
+.. currentmodule:: PyTango.api2
+
+.. _pytango-TEP1:
+
=================================
TEP 1 - Device Server API Level 2
=================================
@@ -6,14 +11,14 @@ TEP 1 - Device Server API Level 2
TEP: 1
================== ====================================================
Title: Device Server API Level 2
- Version: 1.0.0
- Last-Modified: 17-Oct-2012
+ Version: 2.0.0
+ Last-Modified: 18-Oct-2012
Author: Tiago Coutinho <tcoutinho at cells.es>
Status: Active
Type: Standards Track
Content-Type: text/x-rst
Created: 17-Oct-2012
- Post-History: 17-Oct-2012
+ Post-History: 18-Oct-2012
================== ====================================================
Abstract
@@ -342,17 +347,21 @@ The final code could look something like this::
#!/usr/bin/env python
from PyTango import server_run
- from PyTango.api2 import Device, DeviceMeta, Attr
+ from PyTango.api2 import Device, DeviceMeta, attribute, command, \
+ device_property, class_property
class Motor(Device):
__metaclass__ = DeviceMeta
-
+
+ position = attribute()
+
def read_position(self, attr):
attr.set_value(2.3)
- position = Attr()
-
+ @command()
+ def move(self, position):
+ pass
def main():
server_run((Motor,))
@@ -406,10 +415,10 @@ Ok, a pogo generated code could look like this::
attr.set_value(self.attr_Position_read)
- position = Attr(name='position',
- dtype=PyTango.DevDouble,
- dformat=PyTango.AttrDataFormat.SCALAR,
- fread=read_position)
+ position = attribute(name='position',
+ dtype=PyTango.DevDouble,
+ dformat=PyTango.AttrDataFormat.SCALAR,
+ fread=read_position)
def main():
classes = Motor,
@@ -422,18 +431,24 @@ but still is far more inteligable than the original version.
References
==========
+
+Changes
+=======
+
+From 1.0.0 to 2.0.0
+-------------------
+* API Changes
+ * changed Attr to attribute
+ * changed Cmd to command
+ * changed Prop to device_property
+ * changed ClassProp to class_property
+
+* Included command and properties in the example
+* Added references to API documentation
Copyright
=========
This document has been placed in the public domain.
-..
- Local Variables:
- mode: indented-text
- indent-tabs-mode: nil
- sentence-end-double-space: t
- fill-column: 70
- coding: utf-8
- End:
diff --git a/doc/tep/tep-0002.rst b/doc/tep/tep-0002.rst
index 8210160..79307a2 100644
--- a/doc/tep/tep-0002.rst
+++ b/doc/tep/tep-0002.rst
@@ -1,6 +1,8 @@
.. currentmodule:: PyTango.databaseds
+.. _pytango-TEP2:
+
===================================================
TEP 2 - Tango database serverless
===================================================
diff --git a/setup.py b/setup.py
index b8575f4..cde2899 100644
--- a/setup.py
+++ b/setup.py
@@ -84,7 +84,7 @@ def uniquify(seq):
def get_c_numpy():
NUMPY_ROOT = os.environ.get('NUMPY_ROOT')
if NUMPY_ROOT is not None:
- d = os.path.join(NUMPY_ROOT, 'include','numpy')
+ d = os.path.join(NUMPY_ROOT, 'include')
if os.path.isdir(d):
return d
if numpy is None:
@@ -330,7 +330,9 @@ def main():
'Operating System :: POSIX',
'Operating System :: POSIX :: Linux',
'Operating System :: Unix',
+ 'Programming Language :: C',
'Programming Language :: Python',
+ 'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering',
'Topic :: Software Development :: Libraries',
]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git
More information about the debian-science-commits
mailing list