[SCM] Packaging for pytango branch, upstream, updated. 7d5a2ee39922078ed7d863bfd53d7b0de03dd220
Picca Frédéric-Emmanuel
picca at synchrotron-soleil.fr
Tue Nov 23 22:04:19 UTC 2010
The following commit has been merged in the upstream branch:
commit 7d5a2ee39922078ed7d863bfd53d7b0de03dd220
Author: Picca Frédéric-Emmanuel <picca at synchrotron-soleil.fr>
Date: Tue Nov 9 20:59:12 2010 +0100
Imported Upstream version 7.1.3
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..07def70
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,12 @@
+recursive-include PyTango *.py
+recursive-include PyTango3 *.py
+graft src
+graft doc
+graft build/sphinx/html
+
+global-exclude *.pyc
+exclude setup.cfg
+exclude .project
+exclude .pydevproject
+exclude images/*
+exclude src/precompiled_header.hpp.gch
\ No newline at end of file
diff --git a/PKG-INFO b/PKG-INFO
index 4d81fd4..c9ef151 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,11 +1,11 @@
Metadata-Version: 1.1
Name: PyTango
-Version: 7.1.2
+Version: 7.1.3
Summary: A python binding for the Tango control system
Home-page: http://packages.python.org/PyTango
Author: Tiago Coutinho
Author-email: tcoutinho at cells.es
-License: GPL
+License: LGPL
Download-URL: http://pypi.python.org/packages/source/P/PyTango
Description: This module implements the Python Tango Device API mapping
Keywords: Tango,CORBA,binding
@@ -15,10 +15,12 @@ Platform: Windows 95/98/ME
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Other Environment
Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
Classifier: Natural Language :: English
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Operating System :: Unix
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries
diff --git a/PKG-INFO b/PyTango.egg-info/PKG-INFO
similarity index 81%
copy from PKG-INFO
copy to PyTango.egg-info/PKG-INFO
index 4d81fd4..c9ef151 100644
--- a/PKG-INFO
+++ b/PyTango.egg-info/PKG-INFO
@@ -1,11 +1,11 @@
Metadata-Version: 1.1
Name: PyTango
-Version: 7.1.2
+Version: 7.1.3
Summary: A python binding for the Tango control system
Home-page: http://packages.python.org/PyTango
Author: Tiago Coutinho
Author-email: tcoutinho at cells.es
-License: GPL
+License: LGPL
Download-URL: http://pypi.python.org/packages/source/P/PyTango
Description: This module implements the Python Tango Device API mapping
Keywords: Tango,CORBA,binding
@@ -15,10 +15,12 @@ Platform: Windows 95/98/ME
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Other Environment
Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
Classifier: Natural Language :: English
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Operating System :: Unix
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries
diff --git a/PyTango.egg-info/SOURCES.txt b/PyTango.egg-info/SOURCES.txt
new file mode 100644
index 0000000..754f057
--- /dev/null
+++ b/PyTango.egg-info/SOURCES.txt
@@ -0,0 +1,160 @@
+MANIFEST.in
+ez_setup.py
+setup.py
+PyTango/__init__.py
+PyTango/api_util.py
+PyTango/attribute_proxy.py
+PyTango/base_types.py
+PyTango/callback.py
+PyTango/connection.py
+PyTango/db.py
+PyTango/device_attribute.py
+PyTango/device_class.py
+PyTango/device_data.py
+PyTango/device_proxy.py
+PyTango/device_server.py
+PyTango/globals.py
+PyTango/group.py
+PyTango/group_element.py
+PyTango/group_reply.py
+PyTango/group_reply_list.py
+PyTango/log4tango.py
+PyTango/pytango_init.py
+PyTango/pytango_pprint.py
+PyTango/pyutil.py
+PyTango/release.py
+PyTango/tango_numpy.py
+PyTango/time_val.py
+PyTango/utils.py
+PyTango.egg-info/PKG-INFO
+PyTango.egg-info/SOURCES.txt
+PyTango.egg-info/dependency_links.txt
+PyTango.egg-info/top_level.txt
+PyTango/ipython/__init__.py
+PyTango/ipython/ipy_cli.py
+PyTango/ipython/ipy_install.py
+PyTango/ipython/ipy_qt.py
+PyTango/ipython/ipython.py
+PyTango/ipython/ipython_00_10.py
+PyTango3/__init__.py
+PyTango3/tango3.py
+cPyTango/__init__.py
+cPyTango/cPyTango.py
+cPyTango/enumeration.py
+doc/WINDOWS-COMPILATION-EXAMPLE.TXT
+doc/api.rst
+doc/conf.py
+doc/contents.rst
+doc/database.rst
+doc/exception.rst
+doc/faq.rst
+doc/index.rst
+doc/logo-medium.png
+doc/logo.png
+doc/quicktour.rst
+doc/quicktour_old.rst
+doc/revision.rst
+doc/start.rst
+doc/title.png
+doc/_templates/layout.html
+doc/client/attribute_proxy.rst
+doc/client/device_proxy.rst
+doc/client/group.rst
+doc/client/index.rst
+doc/client/miscellaneous.rst
+doc/client/other.rst
+doc/server/attribute.rst
+doc/server/device.rst
+doc/server/device_class.rst
+doc/server/index.rst
+doc/server/logging.rst
+doc/server/util.rst
+doc/sphinxext/ipython_console_highlighting.py
+doc/sphinxext/spock_console_highlighting.py
+doc/spock/features.rst
+doc/spock/highlights.rst
+doc/spock/index.rst
+doc/spock/spock00.png
+doc/spock/spock01.png
+doc/spock/spock02.png
+doc/spock/spock03.png
+doc/spock/spock04.png
+src/api_util.cpp
+src/archive_event_info.cpp
+src/attr_conf_event_data.cpp
+src/attribute_alarm_info.cpp
+src/attribute_dimension.cpp
+src/attribute_event_info.cpp
+src/attribute_info.cpp
+src/attribute_info_ex.cpp
+src/attribute_proxy.cpp
+src/base_types.cpp
+src/base_types_numpy.hpp
+src/callback.cpp
+src/callback.h
+src/change_event_info.cpp
+src/command_info.cpp
+src/connection.cpp
+src/constants.cpp
+src/data_ready_event_data.cpp
+src/database.cpp
+src/db.cpp
+src/defs.h
+src/dev_command_info.cpp
+src/dev_error.cpp
+src/device_attribute.cpp
+src/device_attribute.h
+src/device_attribute_config.cpp
+src/device_attribute_history.cpp
+src/device_attribute_numpy.hpp
+src/device_data.cpp
+src/device_data_history.cpp
+src/device_info.cpp
+src/device_proxy.cpp
+src/enums.cpp
+src/event_data.cpp
+src/exception.cpp
+src/exception.h
+src/fast_from_py.h
+src/fast_from_py_numpy.hpp
+src/from_py.cpp
+src/from_py.h
+src/group.cpp
+src/group_element.cpp
+src/group_reply.cpp
+src/group_reply_list.cpp
+src/locker_info.cpp
+src/locking_thread.cpp
+src/periodic_event_info.cpp
+src/poll_device.cpp
+src/precompiled_header.hpp
+src/pytango.cpp
+src/pytgutils.cpp
+src/pytgutils.h
+src/pyutils.cpp
+src/pyutils.h
+src/tango_numpy.h
+src/tgutils.h
+src/time_val.cpp
+src/to_py.cpp
+src/to_py.h
+src/to_py_numpy.hpp
+src/version.cpp
+src/server/attr.cpp
+src/server/attr.h
+src/server/attribute.cpp
+src/server/attribute.h
+src/server/command.cpp
+src/server/command.h
+src/server/device_class.cpp
+src/server/device_class.h
+src/server/device_impl.cpp
+src/server/device_impl.h
+src/server/dserver.cpp
+src/server/log4tango.cpp
+src/server/multi_attribute.cpp
+src/server/subdev.cpp
+src/server/tango_util.cpp
+src/server/user_default_attr_prop.cpp
+src/server/wattribute.cpp
+src/server/wattribute_numpy.hpp
\ No newline at end of file
diff --git a/PyTango.egg-info/dependency_links.txt b/PyTango.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/PyTango.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/PyTango.egg-info/top_level.txt b/PyTango.egg-info/top_level.txt
new file mode 100644
index 0000000..1e260ca
--- /dev/null
+++ b/PyTango.egg-info/top_level.txt
@@ -0,0 +1,3 @@
+_PyTango
+PyTango
+PyTango3
diff --git a/PyTango/__init__.py b/PyTango/__init__.py
index 4176180..e61ac2d 100644
--- a/PyTango/__init__.py
+++ b/PyTango/__init__.py
@@ -1,7 +1,38 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is the main PyTango package file.
+Documentation for this package can be found online:
+
+http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+"""
+
+__docformat__ = "restructuredtext"
try:
+ import time
from _PyTango import *
-except ImportError as ie:
+except ImportError, ie:
if not ie.args[0].count("_PyTango"):
raise ie
print 80*"-"
@@ -13,8 +44,10 @@ except ImportError as ie:
print 80*"-"
import sys
sys.exit(1)
-
-from release import Release
+
+ArgType = _PyTango.CmdArgType
+
+from release import *
__author__ = "\n".join([ "%s <%s>" % x for x in Release.authors.values()])
__version_info__ = Release.version_info
@@ -24,61 +57,13 @@ __version_number__ = Release.version_number
__version_description__ = Release.version_description
__doc__ = Release.long_description
-from base_types import init_base_types as __init_base_types
-from pytango_pprint import init_pprint as __init_pprint
-from db import init_db as __init_db
-from connection import init_Connection as __init_Connection
-from device_proxy import init_DeviceProxy as __init_DeviceProxy
-from attribute_proxy import init_AttributeProxy as __init_AttributeProxy, AttributeProxy
-from group import init_Group as __init_Group, Group
-from pyutil import init_PyUtil as __init_PyUtil
-from device_server import ChangeEventProp, PeriodicEventProp, ArchiveEventProp
-from device_server import AttributeAlarm, EventProperties
-from device_server import AttributeConfig, AttributeConfig_2, AttributeConfig_3
-from device_server import init_DeviceServer as __init_DeviceServer
-from group_reply import init_GroupReply as __init_GroupReply
-from group_reply_list import init_GroupReplyList as __init_GroupReplyList
-from device_attribute import init_DeviceAttribute as __init_DeviceAttribute
-from device_data import init_DeviceData as __init_DeviceData
-from pyutil import Util
-from device_class import DeviceClass
-from device_class import init_DeviceClass as __init_DeviceClass
-from callback import init_Callback as __init_Callback
-from time_val import __init_TimeVal
-
-from globals import get_class, get_classes
-from globals import get_cpp_class, get_cpp_classes
-from globals import get_constructed_class, get_constructed_classes
-from globals import class_factory, delete_class_list
-from globals import class_list, cpp_class_list, constructed_class
-
-from utils import is_scalar as is_scalar_type
-from utils import is_array as is_array_type
-from utils import is_numerical as is_numerical_type
-from utils import is_int as is_int_type
-from utils import is_float as is_float_type
-from utils import obj_2_str, seqStr_2_obj
-
-from tango_numpy import NumpyType, numpy_type, numpy_spectrum, numpy_image
-
-ArgType = _PyTango.CmdArgType
-
-def __init():
- __init_base_types()
- __init_pprint()
- __init_db()
- __init_Connection()
- __init_DeviceProxy()
- __init_AttributeProxy()
- __init_Group()
- __init_PyUtil()
- __init_DeviceServer()
- __init_DeviceClass()
- __init_DeviceAttribute()
- __init_DeviceData()
- __init_GroupReply()
- __init_GroupReplyList()
- __init_Callback()
- __init_TimeVal()
-
-__init()
+import pytango_init
+from log4tango import *
+from device_server import *
+from attribute_proxy import *
+from group import *
+from pyutil import *
+from device_class import *
+from globals import *
+from utils import *
+from tango_numpy import *
diff --git a/PyTango/api_util.py b/PyTango/api_util.py
new file mode 100644
index 0000000..463d1f3
--- /dev/null
+++ b/PyTango/api_util.py
@@ -0,0 +1,145 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
+
+from _PyTango import ApiUtil
+
+from utils import document_method, document_static_method
+
+def __init_api_util():
+ pass
+
+def __doc_api_util():
+
+ ApiUtil.__doc__ = """
+ This class allows you to access the tango syncronization model API.
+ It is designed as a singleton. To get a reference to the singleton object
+ you must do::
+
+ import PyTango
+ apiutil = PyTango.ApiUtil.instance()
+
+ .. versionadded:: 7.1.3"""
+
+ document_static_method(ApiUtil, "instance", """
+ instance() -> ApiUtil
+
+ Returns the ApiUtil singleton instance.
+
+ Parameters : None
+ Return : (ApiUtil) a reference to the ApiUtil singleton object.
+
+ .. versionadded:: 7.1.3
+ """ )
+
+ document_method(ApiUtil, "pending_asynch_call", """
+ pending_asynch_call(self, req) -> int
+
+ Return number of asynchronous pending requests (any device).
+ The input parameter is an enumeration with three values which are:
+
+ - POLLING: Return only polling model asynchronous request number
+ - CALL_BACK: Return only callback model asynchronous request number
+ - ALL_ASYNCH: Return all asynchronous request number
+
+ Parameters :
+ - req : (asyn_req_type) asynchronous request type
+
+ Return : (int) the number of pending requests for the given type
+
+ .. versionadded:: 7.1.3
+ """ )
+
+ document_method(ApiUtil, "get_asynch_replies", """
+ get_asynch_replies(self) -> None
+
+ Fire callback methods for all (any device) asynchronous requests
+ (command and attribute) with already arrived replied. Returns
+ immediately if there is no replies already arrived or if there is
+ no asynchronous requests.
+
+ Parameters : None
+ Return : None
+
+ Throws : None, all errors are reported using the err and errors fields
+ of the parameter passed to the callback method.
+
+ .. versionadded:: 7.1.3
+
+ get_asynch_replies(self) -> None
+
+ Fire callback methods for all (any device) asynchronous requests
+ (command and attributes) with already arrived replied. Wait and
+ block the caller for timeout milliseconds if they are some
+ device asynchronous requests which are not yet arrived.
+ Returns immediately if there is no asynchronous request.
+ If timeout is set to 0, the call waits until all the asynchronous
+ requests sent has received a reply.
+
+ Parameters :
+ - timeout : (int) timeout (milliseconds)
+ Return : None
+
+ Throws : AsynReplyNotArrived. All other errors are reported using
+ the err and errors fields of the object passed to the callback methods.
+
+ .. versionadded:: 7.1.3
+ """ )
+
+ document_method(ApiUtil, "set_asynch_cb_sub_model", """
+ set_asynch_cb_sub_model(self, model) -> None
+
+ Set the asynchronous callback sub-model between the pull and push sub-model.
+ The cb_sub_model data type is an enumeration with two values which are:
+
+ - PUSH_CALLBACK: The push sub-model
+ - PULL_CALLBACK: The pull sub-model
+
+ Parameters :
+ - model : (cb_sub_model) the callback sub-model
+ Return : None
+
+ .. versionadded:: 7.1.3
+ """ )
+
+ document_method(ApiUtil, "get_asynch_cb_sub_model", """
+ get_asynch_cb_sub_model(self) -> cb_sub_model
+
+ Get the asynchronous callback sub-model.
+
+ Parameters : None
+ Return : (cb_sub_model) the active asynchronous callback sub-model.
+
+ .. versionadded:: 7.1.3
+ """ )
+
+def init(doc=True):
+ __init_api_util()
+ if doc:
+ __doc_api_util()
\ No newline at end of file
diff --git a/PyTango/attribute_proxy.py b/PyTango/attribute_proxy.py
index 1ed6ce7..e871750 100644
--- a/PyTango/attribute_proxy.py
+++ b/PyTango/attribute_proxy.py
@@ -1,4 +1,39 @@
-import operator, types
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module. It completes the binding of
+:class:`PyTango.AttributeProxy`.
+
+To access these members use directly :mod:`PyTango` module and NOT
+PyTango.attribute_proxy.
+"""
+
+__all__ = [ "AttributeProxy" ]
+
+__docformat__ = "restructuredtext"
+
+import operator
+import types
from _PyTango import StdStringVector
from _PyTango import DbData, DbDatum
@@ -237,38 +272,41 @@ class AttributeProxy(object):
def __repr__(self):
return "AttributeProxy(%s)" % self.name()
-def _method_dev_and_name(dp_fn_name):
+def _method_dev_and_name(dp_fn_name, doc=True):
def __new_fn(self, *args, **kwds):
return getattr(self._AttributeProxy__dev_proxy, dp_fn_name)(self.name(), *args, **kwds)
- __new_fn.__doc__ = "This method is a simple way to do:\n" + \
- "\tself.get_device_proxy()."+dp_fn_name+ \
- "(self.name(), ...)\n\n" + \
- "For convenience, here is the documentation of DeviceProxy." + \
- dp_fn_name + "(...):\n" + \
- str(getattr(DeviceProxy, dp_fn_name).__doc__)
+ if doc:
+ __new_fn.__doc__ = "This method is a simple way to do:\n" + \
+ "\tself.get_device_proxy()."+dp_fn_name+ \
+ "(self.name(), ...)\n\n" + \
+ "For convenience, here is the documentation of DeviceProxy." + \
+ dp_fn_name + "(...):\n" + \
+ str(getattr(DeviceProxy, dp_fn_name).__doc__)
__new_fn.__name__ = dp_fn_name
return __new_fn
-def _method_device(dp_fn_name):
+def _method_device(dp_fn_name, doc=True):
def __new_fn(self, *args, **kwds):
return getattr(self._AttributeProxy__dev_proxy, dp_fn_name)(*args, **kwds)
- __new_fn.__doc__ = "This method is a simple way to do:\n" + \
- "\tself.get_device_proxy()."+dp_fn_name+ \
- "(...)\n\n" + \
- "For convenience, here is the documentation of DeviceProxy." + \
- dp_fn_name + "(...):\n" + \
- str(getattr(DeviceProxy, dp_fn_name).__doc__)
+ if doc:
+ __new_fn.__doc__ = "This method is a simple way to do:\n" + \
+ "\tself.get_device_proxy()."+dp_fn_name+ \
+ "(...)\n\n" + \
+ "For convenience, here is the documentation of DeviceProxy." + \
+ dp_fn_name + "(...):\n" + \
+ str(getattr(DeviceProxy, dp_fn_name).__doc__)
__new_fn.__name__ = dp_fn_name
return __new_fn
-def _method_attribute(dp_fn_name):
+def _method_attribute(dp_fn_name, doc=True):
def __new_fn(self, *args, **kwds):
return getattr(self._AttributeProxy__attr_proxy, dp_fn_name)(*args, **kwds)
- __new_fn.__doc__ = getattr(_AttributeProxy, dp_fn_name).__doc__
+ if doc:
+ __new_fn.__doc__ = getattr(_AttributeProxy, dp_fn_name).__doc__
__new_fn.__name__ = dp_fn_name
return __new_fn
-def __init_AttributeProxy():
+def __init_AttributeProxy(doc=True):
_AttributeProxy.get_property = __AttributeProxy__get_property
_AttributeProxy.put_property = __AttributeProxy__put_property
@@ -276,48 +314,48 @@ def __init_AttributeProxy():
# General methods
#AttributeProxy.name manually defined
- AttributeProxy.status = _method_device('status')
- AttributeProxy.state = _method_device('state')
- AttributeProxy.ping = _method_device('ping')
- AttributeProxy.get_transparency_reconnection=_method_device('get_transparency_reconnection')
- AttributeProxy.set_transparency_reconnection=_method_device('set_transparency_reconnection')
+ AttributeProxy.status = _method_device('status', doc=doc)
+ AttributeProxy.state = _method_device('state', doc=doc)
+ AttributeProxy.ping = _method_device('ping', doc=doc)
+ AttributeProxy.get_transparency_reconnection=_method_device('get_transparency_reconnection', doc=doc)
+ AttributeProxy.set_transparency_reconnection=_method_device('set_transparency_reconnection', doc=doc)
# Property methods
- AttributeProxy.get_property = _method_attribute('get_property')
- AttributeProxy.put_property = _method_attribute('put_property')
- AttributeProxy.delete_property = _method_attribute('delete_property')
+ AttributeProxy.get_property = _method_attribute('get_property', doc=doc)
+ AttributeProxy.put_property = _method_attribute('put_property', doc=doc)
+ AttributeProxy.delete_property = _method_attribute('delete_property', doc=doc)
# Attribute methods
- AttributeProxy.get_config = _method_dev_and_name('get_attribute_config')
- AttributeProxy.set_config = _method_device('set_attribute_config')
+ AttributeProxy.get_config = _method_dev_and_name('get_attribute_config', doc=doc)
+ AttributeProxy.set_config = _method_device('set_attribute_config', doc=doc)
- AttributeProxy.write = _method_dev_and_name('write_attribute')
- AttributeProxy.read = _method_dev_and_name('read_attribute')
- AttributeProxy.write_read = _method_dev_and_name('write_read_attribute')
+ AttributeProxy.write = _method_dev_and_name('write_attribute', doc=doc)
+ AttributeProxy.read = _method_dev_and_name('read_attribute', doc=doc)
+ AttributeProxy.write_read = _method_dev_and_name('write_read_attribute', doc=doc)
# History methods...
- AttributeProxy.history = _method_dev_and_name('attribute_history')
+ AttributeProxy.history = _method_dev_and_name('attribute_history', doc=doc)
# Polling administration methods
- AttributeProxy.poll = _method_dev_and_name('poll_attribute')
- AttributeProxy.get_poll_period = _method_dev_and_name('get_attribute_poll_period')
- AttributeProxy.is_polled = _method_dev_and_name('is_attribute_polled')
- AttributeProxy.stop_poll = _method_dev_and_name('stop_poll_attribute')
+ AttributeProxy.poll = _method_dev_and_name('poll_attribute', doc=doc)
+ AttributeProxy.get_poll_period = _method_dev_and_name('get_attribute_poll_period', doc=doc)
+ AttributeProxy.is_polled = _method_dev_and_name('is_attribute_polled', doc=doc)
+ AttributeProxy.stop_poll = _method_dev_and_name('stop_poll_attribute', doc=doc)
# Asynchronous methods
- AttributeProxy.read_asynch = _method_dev_and_name('read_attribute_asynch')
- AttributeProxy.read_reply = _method_device('read_attribute_reply')
- AttributeProxy.write_asynch = _method_device('write_attribute_asynch')
- AttributeProxy.write_reply = _method_device('write_attribute_reply')
+ AttributeProxy.read_asynch = _method_dev_and_name('read_attribute_asynch', doc=doc)
+ AttributeProxy.read_reply = _method_device('read_attribute_reply', doc=doc)
+ AttributeProxy.write_asynch = _method_device('write_attribute_asynch', doc=doc)
+ AttributeProxy.write_reply = _method_device('write_attribute_reply', doc=doc)
# Event methods
- AttributeProxy.subscribe_event = _method_dev_and_name('subscribe_event')
- AttributeProxy.unsubscribe_event = _method_device('unsubscribe_event')
+ AttributeProxy.subscribe_event = _method_dev_and_name('subscribe_event', doc=doc)
+ AttributeProxy.unsubscribe_event = _method_device('unsubscribe_event', doc=doc)
- AttributeProxy.get_events = _method_device('get_events')
- AttributeProxy.event_queue_size = _method_device('event_queue_size')
- AttributeProxy.get_last_event_date = _method_device('get_last_event_date')
- AttributeProxy.is_event_queue_empty = _method_device('is_event_queue_empty')
+ AttributeProxy.get_events = _method_device('get_events', doc=doc)
+ AttributeProxy.event_queue_size = _method_device('event_queue_size', doc=doc)
+ AttributeProxy.get_last_event_date = _method_device('get_last_event_date', doc=doc)
+ AttributeProxy.is_event_queue_empty = _method_device('is_event_queue_empty', doc=doc)
-def init_AttributeProxy():
- __init_AttributeProxy()
+def init(doc=True):
+ __init_AttributeProxy(doc=doc)
diff --git a/PyTango/base_types.py b/PyTango/base_types.py
index f308b54..67aaeb8 100644
--- a/PyTango/base_types.py
+++ b/PyTango/base_types.py
@@ -1,9 +1,39 @@
-from _PyTango import *
-from utils import document_method, document_static_method, document_enum
-from utils import document_enum as __document_enum
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
import operator
+from _PyTango import *
+from utils import document_method, document_static_method
+from utils import document_enum as __document_enum
+
def __StdVector__add(self, seq):
ret = seq.__class__(self)
ret.extend(seq)
@@ -46,16 +76,18 @@ def __fillVectorClass(klass):
klass.__original_getitem = klass.__getitem__
klass.__getitem__ = __StdVector__getitem
-def init_base_types():
+def __init_base_types():
v_klasses = (StdStringVector,StdLongVector,StdDoubleVector,CommandInfoList, \
AttributeInfoList,AttributeInfoListEx,DbData,DbDevInfos, \
DbDevExportInfos,DbDevImportInfos,DbHistoryList, \
DeviceDataHistoryList, StdGroupReplyVector, \
StdGroupCmdReplyVector, StdGroupAttrReplyVector)
-
+
for v_klass in v_klasses:
__fillVectorClass(v_klass)
+
+def __doc_base_types():
def document_enum(enum_name, desc):
import PyTango
@@ -581,3 +613,8 @@ def init_base_types():
- tv_sec : seconds
- tv_usec : microseconds
- tv_nsec : nanoseconds"""
+
+def init(doc=True):
+ __init_base_types()
+ if doc:
+ __doc_base_types()
\ No newline at end of file
diff --git a/PyTango/callback.py b/PyTango/callback.py
index 96ae047..1ee40bb 100644
--- a/PyTango/callback.py
+++ b/PyTango/callback.py
@@ -1,3 +1,32 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
from _PyTango import CmdDoneEvent, AttrReadEvent, AttrWrittenEvent
# __CallBackAutoDie, __CallBackPushEvent
@@ -47,6 +76,7 @@ def __doc_Callback():
- ext :
"""
-def init_Callback():
+def init(doc=True):
__init_Callback()
- __doc_Callback()
+ if doc:
+ __doc_Callback()
diff --git a/PyTango/connection.py b/PyTango/connection.py
index 8106057..3302ad8 100644
--- a/PyTango/connection.py
+++ b/PyTango/connection.py
@@ -1,3 +1,32 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
from _PyTango import Connection, DeviceData, __CallBackAutoDie, CmdArgType
from _PyTango import DeviceProxy, Database
@@ -511,6 +540,7 @@ def __doc_Connection():
New in PyTango 7.0.0
""")
-def init_Connection():
+def init(doc=True):
__init_Connection()
- __doc_Connection()
+ if doc:
+ __doc_Connection()
diff --git a/PyTango/db.py b/PyTango/db.py
index e8fd101..b125e9e 100644
--- a/PyTango/db.py
+++ b/PyTango/db.py
@@ -1,4 +1,35 @@
-import types, operator
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
+
+import types
+import operator
from _PyTango import StdStringVector
from _PyTango import Database, DbDatum, DbData
@@ -2006,14 +2037,17 @@ def __doc_DbServerInfo():
- mode : str
- level : str"""
-def init_db():
+def init(doc=True):
__init_DbDatum()
- __doc_DbDatum()
+ if doc:
+ __doc_DbDatum()
+
__init_Database()
- __doc_Database()
- __doc_DbDevExportInfo()
- __doc_DbDevImportInfo()
- __doc_DbDevInfo()
- __doc_DbHistory()
- __doc_DbServerInfo()
+ if doc:
+ __doc_Database()
+ __doc_DbDevExportInfo()
+ __doc_DbDevImportInfo()
+ __doc_DbDevInfo()
+ __doc_DbHistory()
+ __doc_DbServerInfo()
diff --git a/PyTango/device_attribute.py b/PyTango/device_attribute.py
index c878fb2..f18f072 100644
--- a/PyTango/device_attribute.py
+++ b/PyTango/device_attribute.py
@@ -1,3 +1,33 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
+
import copy
from utils import document_method as __document_method
@@ -82,6 +112,7 @@ def __init_DeviceAttribute():
DeviceAttribute.ExtractAs = ExtractAs
pass
-def init_DeviceAttribute():
+def init(doc=True):
__init_DeviceAttribute()
- __doc_DeviceAttribute()
+ if doc:
+ __doc_DeviceAttribute()
diff --git a/PyTango/device_class.py b/PyTango/device_class.py
index ff09bc3..ea44caf 100644
--- a/PyTango/device_class.py
+++ b/PyTango/device_class.py
@@ -1,4 +1,35 @@
-import types, operator
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = [ "DeviceClass" ]
+
+__docformat__ = "restructuredtext"
+
+import types
+import operator
from _PyTango import Except, DevFailed
from _PyTango import _DeviceClass, Database
@@ -873,6 +904,7 @@ def __doc_DeviceClass():
Return : None
""" )
-def init_DeviceClass():
+def init(doc=True):
__init_DeviceClass()
- __doc_DeviceClass()
+ if doc:
+ __doc_DeviceClass()
diff --git a/PyTango/device_data.py b/PyTango/device_data.py
index 6f9c974..e47c4a7 100644
--- a/PyTango/device_data.py
+++ b/PyTango/device_data.py
@@ -1,4 +1,31 @@
-
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
from utils import document_method as __document_method
from _PyTango import DeviceData
@@ -60,7 +87,8 @@ def __doc_DeviceData():
Return : The content arg type.
""" )
-def init_DeviceData():
+def init(doc=True):
__init_DeviceData()
- __doc_DeviceData()
+ if doc:
+ __doc_DeviceData()
diff --git a/PyTango/device_proxy.py b/PyTango/device_proxy.py
index cc3dec0..346bc57 100644
--- a/PyTango/device_proxy.py
+++ b/PyTango/device_proxy.py
@@ -1,3 +1,33 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
+
import operator, types
from _PyTango import StdStringVector
@@ -1656,6 +1686,7 @@ def __doc_DeviceProxy():
New in PyTango 7.0.0
""" )
-def init_DeviceProxy():
+def init(doc=True):
__init_DeviceProxy()
- __doc_DeviceProxy()
+ if doc:
+ __doc_DeviceProxy()
diff --git a/PyTango/device_server.py b/PyTango/device_server.py
index 8456a70..b22ea4e 100644
--- a/PyTango/device_server.py
+++ b/PyTango/device_server.py
@@ -1,4 +1,38 @@
-import copy, operator, types
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = [ "ChangeEventProp", "PeriodicEventProp", "ArchiveEventProp",
+ "AttributeAlarm", "EventProperties",
+ "AttributeConfig", "AttributeConfig_2", "AttributeConfig_3"]
+
+__docformat__ = "restructuredtext"
+
+import copy
+import operator
+import types
import _PyTango
from _PyTango import StdStringVector, StdDoubleVector
@@ -12,8 +46,9 @@ from utils import seq_2_StdStringVector, seq_2_StdDoubleVector
from utils import document_method as __document_method
from utils import copy_doc
+import log4tango
-class AttributeAlarm:
+class AttributeAlarm(object):
"""This class represents the python interface for the Tango IDL object
AttributeAlarm."""
@@ -26,7 +61,7 @@ class AttributeAlarm:
self.delta_val = ''
self.extensions = []
-class ChangeEventProp:
+class ChangeEventProp(object):
"""This class represents the python interface for the Tango IDL object
ChangeEventProp."""
@@ -35,7 +70,7 @@ class ChangeEventProp:
self.abs_change = ''
self.extensions = []
-class PeriodicEventProp:
+class PeriodicEventProp(object):
"""This class represents the python interface for the Tango IDL object
PeriodicEventProp."""
@@ -43,7 +78,7 @@ class PeriodicEventProp:
self.period = ''
self.extensions = []
-class ArchiveEventProp:
+class ArchiveEventProp(object):
"""This class represents the python interface for the Tango IDL object
ArchiveEventProp."""
@@ -53,7 +88,7 @@ class ArchiveEventProp:
self.period = ''
self.extensions = []
-class EventProperties:
+class EventProperties(object):
"""This class represents the python interface for the Tango IDL object
EventProperties."""
@@ -62,7 +97,7 @@ class EventProperties:
self.per_event = PeriodicEventProp()
self.arch_event = ArchiveEventProp()
-def init_attr_config(attr_cfg):
+def __init_attr_config(attr_cfg):
"""Helper function to initialize attribute config objects"""
attr_cfg.name = ''
attr_cfg.writable = -1
@@ -81,31 +116,31 @@ def init_attr_config(attr_cfg):
attr_cfg.writable_attr_name = ''
attr_cfg.extensions = []
-class AttributeConfig:
+class AttributeConfig(object):
"""This class represents the python interface for the Tango IDL object
AttributeConfig."""
def __init__(self):
- init_attr_config(self)
+ __init_attr_config(self)
self.min_alarm = ''
self.max_alarm = ''
-class AttributeConfig_2:
+class AttributeConfig_2(object):
"""This class represents the python interface for the Tango IDL object
AttributeConfig_2."""
def __init__(self):
- init_attr_config(self)
+ __init_attr_config(self)
self.level = -1
self.min_alarm = ''
self.max_alarm = ''
-class AttributeConfig_3:
+class AttributeConfig_3(object):
"""This class represents the python interface for the Tango IDL object
AttributeConfig_3."""
def __init__(self):
- init_attr_config(self)
+ __init_attr_config(self)
self.level = -1
self.att_alarm = AttributeAlarm()
self.event_prop = EventProperties()
@@ -257,6 +292,10 @@ def __DeviceImpl__debug_stream(self, *msg):
Sends the given message to the tango debug stream.
+ Since PyTango 7.1.3, the same can be achieved with::
+
+ print >>self.log_debug, msg
+
Parameters :
- msg : (str) the message to be sent to the debug stream
Return : None
@@ -269,6 +308,10 @@ def __DeviceImpl__info_stream(self, *msg):
Sends the given message to the tango info stream.
+ Since PyTango 7.1.3, the same can be achieved with::
+
+ print >>self.log_info, msg
+
Parameters :
- msg : (str) the message to be sent to the info stream
Return : None
@@ -281,6 +324,10 @@ def __DeviceImpl__warn_stream(self, *msg):
Sends the given message to the tango warn stream.
+ Since PyTango 7.1.3, the same can be achieved with::
+
+ print >>self.log_warn, msg
+
Parameters :
- msg : (str) the message to be sent to the warn stream
Return : None
@@ -293,6 +340,10 @@ def __DeviceImpl__error_stream(self, *msg):
Sends the given message to the tango error stream.
+ Since PyTango 7.1.3, the same can be achieved with::
+
+ print >>self.log_error, msg
+
Parameters :
- msg : (str) the message to be sent to the error stream
Return : None
@@ -305,12 +356,46 @@ def __DeviceImpl__fatal_stream(self, *msg):
Sends the given message to the tango fatal stream.
+ Since PyTango 7.1.3, the same can be achieved with::
+
+ print >>self.log_fatal, msg
+
Parameters :
- msg : (str) the message to be sent to the fatal stream
Return : None
"""
self.__fatal_stream(__join_msg(msg))
+ at property
+def __DeviceImpl__debug(self):
+ if not hasattr(self, "_debug_s"):
+ self._debug_s = log4tango.TangoStream(self.debug_stream)
+ return self._debug_s
+
+ at property
+def __DeviceImpl__info(self):
+ if not hasattr(self, "_info_s"):
+ self._info_s = log4tango.TangoStream(self.info_stream)
+ return self._info_s
+
+ at property
+def __DeviceImpl__warn(self):
+ if not hasattr(self, "_warn_s"):
+ self._warn_s = log4tango.TangoStream(self.warn_stream)
+ return self._warn_s
+
+ at property
+def __DeviceImpl__error(self):
+ if not hasattr(self, "_error_s"):
+ self._error_s = log4tango.TangoStream(self.error_stream)
+ return self._error_s
+
+ at property
+def __DeviceImpl__fatal(self):
+ if not hasattr(self, "_fatal_s"):
+ self._fatal_s = log4tango.TangoStream(self.fatal_stream)
+ return self._fatal_s
+
def __DeviceImpl__str(self):
return '%s(%s)' % (self.__class__.__name__, self.get_name())
@@ -328,6 +413,11 @@ def __init_DeviceImpl():
DeviceImpl.warn_stream = __DeviceImpl__warn_stream
DeviceImpl.error_stream = __DeviceImpl__error_stream
DeviceImpl.fatal_stream = __DeviceImpl__fatal_stream
+ DeviceImpl.log_debug = __DeviceImpl__debug
+ DeviceImpl.log_info = __DeviceImpl__info
+ DeviceImpl.log_warn = __DeviceImpl__warn
+ DeviceImpl.log_error = __DeviceImpl__error
+ DeviceImpl.log_fatal = __DeviceImpl__fatal
def __Logger__log(self, level, *msg):
"""
@@ -2096,16 +2186,17 @@ def __doc_UserDefaultAttrProp():
Return : None
""" )
-def init_DeviceServer():
+def init(doc=True):
__init_DeviceImpl()
__init_Attribute()
__init_Attr()
__init_Logger()
- __doc_DeviceImpl()
- __doc_extra_DeviceImpl(Device_3Impl)
- __doc_extra_DeviceImpl(Device_4Impl)
- __doc_Attribute()
- __doc_WAttribute()
- __doc_MultiAttribute()
- __doc_UserDefaultAttrProp()
- __doc_Attr()
+ if doc:
+ __doc_DeviceImpl()
+ __doc_extra_DeviceImpl(Device_3Impl)
+ __doc_extra_DeviceImpl(Device_4Impl)
+ __doc_Attribute()
+ __doc_WAttribute()
+ __doc_MultiAttribute()
+ __doc_UserDefaultAttrProp()
+ __doc_Attr()
diff --git a/PyTango/globals.py b/PyTango/globals.py
index 5c9d937..33d8f83 100644
--- a/PyTango/globals.py
+++ b/PyTango/globals.py
@@ -1,3 +1,35 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = [ "get_class", "get_classes", "get_cpp_class", "get_cpp_classes",
+ "get_constructed_class", "get_constructed_classes",
+ "class_factory", "delete_class_list",
+ "class_list", "cpp_class_list", "constructed_class"]
+
+__docformat__ = "restructuredtext"
# list of tuple<DeviceClass class, DeviceImpl class, tango device class name>
class_list = []
diff --git a/PyTango/group.py b/PyTango/group.py
index 4f63071..ea8aeba 100644
--- a/PyTango/group.py
+++ b/PyTango/group.py
@@ -1,10 +1,40 @@
-
-import operator, types
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = [ "Group" ]
+
+__docformat__ = "restructuredtext"
+
+import operator
+import types
from _PyTango import __Group as _RealGroup, GroupElement
from utils import document_method as __document_method
-from group_element import init_GroupElement as __init_GroupElement
+import group_element
# I define Group as a proxy to __Group, where group is the actual
# C++ Tango::Group object. Most functions just call the __group object
@@ -182,7 +212,8 @@ def __doc_Group():
Throws :
""" )
-def init_Group():
- __init_GroupElement()
- __doc_Group()
+def init(doc=True):
+ group_element.init(doc=doc)
+ if doc:
+ __doc_Group()
__init_proxy_Group()
diff --git a/PyTango/group_element.py b/PyTango/group_element.py
index fecf02a..cd4a6ef 100644
--- a/PyTango/group_element.py
+++ b/PyTango/group_element.py
@@ -1,4 +1,35 @@
-import operator, types
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
+
+import operator
+import types
from _PyTango import StdStringVector
from _PyTango import GroupElement
@@ -549,6 +580,7 @@ def __doc_GroupElement():
# get_parent(self)
-def init_GroupElement():
+def init(doc=True):
__init_GroupElement()
- __doc_GroupElement()
+ if doc:
+ __doc_GroupElement()
diff --git a/PyTango/group_reply.py b/PyTango/group_reply.py
index 50a95f4..3cd1e55 100644
--- a/PyTango/group_reply.py
+++ b/PyTango/group_reply.py
@@ -1,9 +1,38 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
from utils import document_method as __document_method
from _PyTango import GroupReply
from _PyTango import GroupCmdReply
from _PyTango import GroupAttrReply
-from PyTango import ExtractAs
+from _PyTango import ExtractAs
def __GroupCmdReply__get_data(self):
return self.get_data_raw().extract()
@@ -79,7 +108,7 @@ def __doc_GroupReply():
Return : (DeviceAttribute) Whatever is stored there, or None.
""" )
-
-def init_GroupReply():
+def init(doc=True):
__init_GroupReply()
- __doc_GroupReply()
+ if doc:
+ __doc_GroupReply()
diff --git a/PyTango/group_reply_list.py b/PyTango/group_reply_list.py
index ba3d1f6..db61348 100644
--- a/PyTango/group_reply_list.py
+++ b/PyTango/group_reply_list.py
@@ -1,4 +1,32 @@
-# -*- coding: utf-8 -*-
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
from utils import document_method as __document_method
from _PyTango import GroupReplyList
@@ -64,6 +92,7 @@ def __init_GroupReplyList():
def __doc_GroupReplyList():
pass
-def init_GroupReplyList():
+def init(doc=True):
__init_GroupReplyList()
- __doc_GroupReplyList()
+ if doc:
+ __doc_GroupReplyList()
diff --git a/PyTango/ipython/__init__.py b/PyTango/ipython/__init__.py
index 932c32e..e56afa1 100644
--- a/PyTango/ipython/__init__.py
+++ b/PyTango/ipython/__init__.py
@@ -1,3 +1,25 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
from ipython import *
from ipy_install import install
\ No newline at end of file
diff --git a/PyTango/ipython/ipy_cli.py b/PyTango/ipython/ipy_cli.py
index 82a5111..c449165 100644
--- a/PyTango/ipython/ipy_cli.py
+++ b/PyTango/ipython/ipy_cli.py
@@ -1,3 +1,25 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
import re
import StringIO
diff --git a/PyTango/ipython/ipy_install.py b/PyTango/ipython/ipy_install.py
index a543e46..cc029e7 100755
--- a/PyTango/ipython/ipy_install.py
+++ b/PyTango/ipython/ipy_install.py
@@ -1,5 +1,27 @@
#!/usr/bin/env python
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
import sys
import os
import StringIO
@@ -8,7 +30,7 @@ import IPython.genutils
import PyTango
__PROFILE = """\
-#!/usr/bin/env python
+#!/usr/bin/env ipython
\"\"\"An automaticaly generated IPython profile designed to provide a user
friendly interface to Tango.
Created with PyTango {pytangover} for IPython {ipyver}\"\"\"
@@ -45,7 +67,7 @@ def install(ipydir=None,verbose=True):
f.write(profile)
f.close()
out.write("[DONE]\n\n")
- except Exception as e:
+ except Exception, e:
out.write("[FAILED]\n\n")
raise e
@@ -79,4 +101,3 @@ def main():
if __name__ == "__main__":
main()
-
\ No newline at end of file
diff --git a/PyTango/ipython/ipy_qt.py b/PyTango/ipython/ipy_qt.py
index 9b42f00..e8afe84 100644
--- a/PyTango/ipython/ipy_qt.py
+++ b/PyTango/ipython/ipy_qt.py
@@ -1,5 +1,29 @@
-import operator, logging
-import datetime, time
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+import operator
+import logging
+import time
+import datetime
import PyTango
import PyQt4.Qt as Qt
diff --git a/PyTango/ipython/ipython.py b/PyTango/ipython/ipython.py
index 96b8e81..077ca63 100644
--- a/PyTango/ipython/ipython.py
+++ b/PyTango/ipython/ipython.py
@@ -1,3 +1,24 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
try:
import IPython
diff --git a/PyTango/ipython/ipython_00_10.py b/PyTango/ipython/ipython_00_10.py
index 6027584..b1950d6 100644
--- a/PyTango/ipython/ipython_00_10.py
+++ b/PyTango/ipython/ipython_00_10.py
@@ -1,8 +1,28 @@
#!/usr/bin/env python
-"""An IPython profile designed to provide a user friendly interface to Tango"""
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
-from __future__ import with_statement
+"""An IPython profile designed to provide a user friendly interface to Tango"""
import sys
import os
@@ -24,6 +44,7 @@ import PyTango
import PyTango.utils
_DB_SYMB = "db"
+_DFT_TANGO_HOST = None
_SPOCK_STORE = "__spock_store"
_SPOCK_ERR = "__spock_error"
_spock_init = False
@@ -199,7 +220,7 @@ def magic_switchdb(self, parameter_s=''):
In [3]: switchdb homer"""
if parameter_s == '':
- raise UsageError("%switchdb: Must specify a tango database name. See '%switchdb?'")
+ raise IPython.ipapi.UsageError("%switchdb: Must specify a tango database name. See '%switchdb?'")
return init_db(IPython.ipapi.get(), parameter_s)
def magic_lsdev(self, parameter_s=''):
@@ -481,10 +502,26 @@ def __tango_exc_handler(ip, etype, value, tb):
def __safe_tango_exec(f, *args, **kwargs):
try:
return f(*args, **kwargs)
- except PyTango.DevFailed as df:
+ except PyTango.DevFailed, df:
print df[0].reason,":",df[0].desc
print "For more information type: get_last_tango_error"
-
+
+def __get_default_tango_host():
+ global _DFT_TANGO_HOST
+ if _DFT_TANGO_HOST is None:
+ _DFT_TANGO_HOST = os.environ.get("TANGO_HOST")
+ if _DFT_TANGO_HOST is None:
+ # ok, it must have been defined in the tangorc way. Since the
+ # method Tango::Connection::get_env_var is protected we do a hack to
+ # get the tango_host: Create a temporary Database object. It is not
+ #very nice but is done only once in the lifetime of the application
+ try:
+ db = PyTango.Database()
+ _DFT_TANGO_HOST = "%s:%s" % (db.get_db_host(), db.get_db_port())
+ except:
+ pass
+ return _DFT_TANGO_HOST
+
def __get_db(host_port=None):
"""host_port == None: Use current DB whatever it is or create
default if doesn't exist
@@ -500,9 +537,9 @@ def __get_db(host_port=None):
if host_port is None:
if db is None:
- host_port = os.environ.get("TANGO_HOST")
+ host_port = __get_default_tango_host()
elif host_port == '':
- host_port = os.environ.get("TANGO_HOST")
+ host_port = __get_default_tango_host()
else:
host_port = host_port.strip().replace(" ",":")
if host_port.count(":") == 0:
@@ -523,13 +560,14 @@ def __get_db(host_port=None):
ip.user_ns["DB_NAME"] = host_port
except Exception, e:
print
- print "Could not access Database", host_port
if db:
+ print "Could not access Database", host_port
old_host_port = "%s:%s" % (db.get_db_host(), db.get_db_port())
print "Maintaining connection to Database", old_host_port
ip.user_ns["DB_NAME"] = old_host_port
else:
- print "You are not connected to any Database."
+ print "Could not access any Database."
+ print "Make sure .tangorc, /etc/tangorc or TANGO_HOST environment is defined."
ip.user_ns["DB_NAME"] = "OFFLINE"
# register the 'db' in the user namespace
@@ -903,12 +941,33 @@ def init_magic(ip):
#__expose_magic(ip, "get_alias_map", get_alias_map)
#__expose_magic(ip, "get_device_list", get_device_list)
#__expose_magic(ip, "get_alias_list", get_alias_list)
-
+
+def complete(text):
+ """a super complete!!!!"""
+ self = IPython.ipapi.get().IP
+ complete = self.Completer.complete
+ state = 0
+ comps = set()
+ while True:
+ newcomp = complete("", state, line_buffer=text)
+ if newcomp is None:
+ break
+ comps.add(newcomp)
+ state += 1
+ outcomps = sorted(comps)
+ return outcomps
def init_ipython(ip, store=True, pytango=True, colors=True, console=True, magic=True):
+
+ if ip is None:
+ raise Exception("Spock's init_ipython must be called from inside IPython")
+
global _spock_init
if _spock_init is True: return
+ #ip.IP._orig_complete = ip.IP.complete
+ #ip.IP.complete = complete
+
if colors: init_colors(ip)
if store: init_store(ip)
if pytango: init_pytango(ip)
@@ -916,4 +975,4 @@ def init_ipython(ip, store=True, pytango=True, colors=True, console=True, magic=
if console: init_console(ip)
if magic: init_magic(ip)
- _spock_init = True
\ No newline at end of file
+ _spock_init = True
diff --git a/PyTango/log4tango.py b/PyTango/log4tango.py
new file mode 100644
index 0000000..4a7618e
--- /dev/null
+++ b/PyTango/log4tango.py
@@ -0,0 +1,284 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module. It provides tango log classes that can
+be used as decorators in any method of :class:`PyTango.DeviceImpl`.
+
+To access these members use directly :mod:`PyTango` module and NOT PyTango.log4tango.
+
+Example::
+
+ import PyTango
+
+ class MyDev(PyTango.Device_4Impl):
+
+ PyTango.InfoIt()
+ def read_Current(self, attr):
+ attr.set_value(self._current)
+"""
+
+__all__ = [ "TangoStream", "LogIt", "DebugIt", "InfoIt", "WarnIt",
+ "ErrorIt", "FatalIt" ]
+
+__docformat__ = "restructuredtext"
+
+import functools
+
+class TangoStream:
+
+ def __init__(self, fn):
+ self._fn = fn
+ self._accum = ""
+
+ def write(self, s):
+ self._accum += s
+ # while there is no new line, just accumulate the buffer
+ try:
+ if s[-1] == '\n' or s.index('\n') >= 0:
+ self.flush()
+ except ValueError:
+ pass
+
+ def flush(self):
+ b = self._accum
+ if b is None or len(self._accum) == 0:
+ return
+ #take the '\n' because the log adds it
+ if b[-1] == '\n': b = b[:-1]
+ self._fn(b)
+ self._accum = ""
+
+
+class LogIt(object):
+ """A class designed to be a decorator of any method of a
+ :class:`PyTango.DeviceImpl` subclass. The idea is to log the entrance and
+ exit of any decorated method.
+
+ Example::
+
+ class MyDevice(PyTango.Device_4Impl):
+
+ @PyTango.LogIt()
+ def read_Current(self, attr):
+ attr.set_value(self._current, 1)
+
+ All log messages generated by this class have DEBUG level. If you whish
+ to have different log level messages, you should implement subclasses that
+ log to those levels. See, for example, :class:`PyTango.InfoIt`.
+
+ The constructor receives three optional arguments:
+ * show_args - shows method arguments in log message (defaults to False)
+ * show_kwargs - shows keyword method arguments in log message (defaults to False)
+ * show_ret - shows return value in log message (defaults to False)
+ """
+
+ def __init__(self, show_args=False, show_kwargs=False, show_ret=False):
+ """Initializes de LogIt object.
+
+ :param show_args: (bool) show arguments in log message (default is False)
+ :param show_kwargs: (bool) show keyword arguments in log message (default is False)
+ :param show_ret: (bool) show return in log message (default is False)
+ """
+ self._show_args = show_args
+ self._show_kwargs = show_kwargs
+ self._show_ret = show_ret
+
+ def __compact(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):
+ if maxlen is None:
+ return "%s=%s" % (k, __compact(v))
+ return "%s=%s" % (k, __compact(v, maxlen=maxlen))
+
+ def is_enabled(self, d):
+ return d.get_logger().is_debug_enabled()
+
+ def get_log_func(self, d):
+ return d.debug_stream
+
+ def __call__(self, f):
+ @functools.wraps(f)
+ def log_stream(*args, **kwargs):
+ d = args[0]
+ if not self.is_enabled(d):
+ return f(*args, **kwargs)
+ in_msg = "-> %s(" % f.func_name
+ if self._show_args:
+ in_msg += ", ".join(map(self.__compact, 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.func_name
+ self.get_log_func(d)(out_msg)
+ return ret
+ return log_stream
+
+
+class DebugIt(LogIt):
+ """A class designed to be a decorator of any method of a
+ :class:`PyTango.DeviceImpl` subclass. The idea is to log the entrance and
+ exit of any decorated method as DEBUG level records.
+
+ Example::
+
+ class MyDevice(PyTango.Device_4Impl):
+
+ @PyTango.DebugIt()
+ def read_Current(self, attr):
+ attr.set_value(self._current, 1)
+
+ All log messages generated by this class have DEBUG level.
+
+ The constructor receives three optional arguments:
+ * show_args - shows method arguments in log message (defaults to False)
+ * show_kwargs - shows keyword method arguments in log message (defaults to False)
+ * show_ret - shows return value in log message (defaults to False)
+ """
+
+ def is_enabled(self, d):
+ return d.get_logger().is_debug_enabled()
+
+ def get_log_func(self, d):
+ return d.debug_stream
+
+
+class InfoIt(LogIt):
+ """A class designed to be a decorator of any method of a
+ :class:`PyTango.DeviceImpl` subclass. The idea is to log the entrance and
+ exit of any decorated method as INFO level records.
+
+ Example::
+
+ class MyDevice(PyTango.Device_4Impl):
+
+ @PyTango.InfoIt()
+ def read_Current(self, attr):
+ attr.set_value(self._current, 1)
+
+ All log messages generated by this class have INFO level.
+
+ The constructor receives three optional arguments:
+ * show_args - shows method arguments in log message (defaults to False)
+ * show_kwargs - shows keyword method arguments in log message (defaults to False)
+ * show_ret - shows return value in log message (defaults to False)
+ """
+
+ def is_enabled(self, d):
+ return d.get_logger().is_info_enabled()
+
+ def get_log_func(self, d):
+ return d.info_stream
+
+
+class WarnIt(LogIt):
+ """A class designed to be a decorator of any method of a
+ :class:`PyTango.DeviceImpl` subclass. The idea is to log the entrance and
+ exit of any decorated method as WARN level records.
+
+ Example::
+
+ class MyDevice(PyTango.Device_4Impl):
+
+ @PyTango.WarnIt()
+ def read_Current(self, attr):
+ attr.set_value(self._current, 1)
+
+ All log messages generated by this class have WARN level.
+
+ The constructor receives three optional arguments:
+ * show_args - shows method arguments in log message (defaults to False)
+ * show_kwargs - shows keyword method arguments in log message (defaults to False)
+ * show_ret - shows return value in log message (defaults to False)
+ """
+
+ def is_enabled(self, d):
+ return d.get_logger().is_warn_enabled()
+
+ def get_log_func(self, d):
+ return d.warn_stream
+
+
+class ErrorIt(LogIt):
+ """A class designed to be a decorator of any method of a
+ :class:`PyTango.DeviceImpl` subclass. The idea is to log the entrance and
+ exit of any decorated method as ERROR level records.
+
+ Example::
+
+ class MyDevice(PyTango.Device_4Impl):
+
+ @PyTango.ErrorIt()
+ def read_Current(self, attr):
+ attr.set_value(self._current, 1)
+
+ All log messages generated by this class have ERROR level.
+
+ The constructor receives three optional arguments:
+ * show_args - shows method arguments in log message (defaults to False)
+ * show_kwargs - shows keyword method arguments in log message (defaults to False)
+ * show_ret - shows return value in log message (defaults to False)
+ """
+
+ def is_enabled(self, d):
+ return d.get_logger().is_error_enabled()
+
+ def get_log_func(self, d):
+ return d.error_stream
+
+
+class FatalIt(LogIt):
+ """A class designed to be a decorator of any method of a
+ :class:`PyTango.DeviceImpl` subclass. The idea is to log the entrance and
+ exit of any decorated method as FATAL level records.
+
+ Example::
+
+ class MyDevice(PyTango.Device_4Impl):
+
+ @PyTango.FatalIt()
+ def read_Current(self, attr):
+ attr.set_value(self._current, 1)
+
+ All log messages generated by this class have FATAL level.
+
+ The constructor receives three optional arguments:
+ * show_args - shows method arguments in log message (defaults to False)
+ * show_kwargs - shows keyword method arguments in log message (defaults to False)
+ * show_ret - shows return value in log message (defaults to False)
+ """
+
+ def is_enabled(self, d):
+ return d.get_logger().is_fatal_enabled()
+
+ def get_log_func(self, d):
+ return d.fatal_stream
\ No newline at end of file
diff --git a/PyTango/pytango_init.py b/PyTango/pytango_init.py
new file mode 100644
index 0000000..7603870
--- /dev/null
+++ b/PyTango/pytango_init.py
@@ -0,0 +1,81 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
+
+import attribute_proxy
+import base_types
+import callback
+import api_util
+import connection
+import db
+import device_attribute
+import device_class
+import device_data
+import device_proxy
+import device_server
+import group
+import group_reply
+import group_reply_list
+import pytango_pprint
+import pyutil
+import time_val
+
+__INITIALIZED = False
+__DOC = True
+
+def __init():
+ global __INITIALIZED
+ if __INITIALIZED:
+ return
+
+ global __DOC
+ doc = __DOC
+ base_types.init(doc=doc)
+ callback.init(doc=doc)
+ api_util.init(doc=doc)
+ connection.init(doc=doc)
+ db.init(doc=doc)
+ device_attribute.init(doc=doc)
+ device_class.init(doc=doc)
+ device_data.init(doc=doc)
+ device_proxy.init(doc=doc)
+ device_server.init(doc=doc)
+ group.init(doc=doc)
+ group_reply.init(doc=doc)
+ group_reply_list.init(doc=doc)
+ pytango_pprint.init(doc=doc)
+ pyutil.init(doc=doc)
+ time_val.init(doc=doc)
+
+ # must come last: depends on device_proxy.init()
+ attribute_proxy.init(doc=doc)
+
+ __INITIALIZED = True
+
+__init()
\ No newline at end of file
diff --git a/PyTango/pytango_pprint.py b/PyTango/pytango_pprint.py
index 9470e33..3acd798 100644
--- a/PyTango/pytango_pprint.py
+++ b/PyTango/pytango_pprint.py
@@ -1,3 +1,33 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
+
from _PyTango import *
from device_server import AttributeAlarm, EventProperties
@@ -37,7 +67,7 @@ def __str__Struct_Helper(self, f=repr):
"""str method for struct"""
attrs = [ n for n in dir(self) if __inc_param(self, n)]
fmt = attrs and '%%%ds = %%s' % max( map(len, attrs) ) or "%s = %s"
- return '%s[\n%s]' % (self.__class__.__name__, __struct_params_str(self, fmt, f))
+ return '%s[\n%s]\n' % (self.__class__.__name__, __struct_params_str(self, fmt, f))
def __str__Struct(self):
return __str__Struct_Helper(self, f=repr)
@@ -76,7 +106,7 @@ def __str__DevError(self):
desc = %s
origin = %s
reason = %s
-severity = %s]""" % (desc, self.origin, self.reason, self.severity)
+severity = %s]\n""" % (desc, self.origin, self.reason, self.severity)
return s
def __registerStructStr():
@@ -108,6 +138,6 @@ def __registerStructStr():
DevError.__str__ = __str__DevError
-def init_pprint():
+def init(doc=True):
__registerSeqStr()
__registerStructStr()
diff --git a/PyTango/pyutil.py b/PyTango/pyutil.py
index 7240cf6..8a0cc83 100644
--- a/PyTango/pyutil.py
+++ b/PyTango/pyutil.py
@@ -1,4 +1,36 @@
-import os, copy, operator
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = [ "Util" ]
+
+__docformat__ = "restructuredtext"
+
+import os
+import copy
+import operator
from _PyTango import _Util, Except, DevFailed, DbDevInfo
from utils import document_method as __document_method
@@ -71,7 +103,7 @@ def __Util__create_device(self, klass_name, device_name, alias=None, cb=None):
device_exists = True
try:
db.import_device(device_name)
- except DevFailed as df:
+ except DevFailed, df:
device_exists = not df[0].reason == "DB_DeviceNotDefined"
# 1 - Make sure device name doesn't exist already in the database
@@ -145,7 +177,7 @@ def __Util__delete_device(self, klass_name, device_name):
device_exists = True
try:
db.import_device(device_name)
- except DevFailed as df:
+ except DevFailed, df:
device_exists = not df[0].reason == "DB_DeviceNotDefined"
# 1 - Make sure device name exists in the database
@@ -198,11 +230,15 @@ class Util(_Util):
_Util.init(args)
_Util.init_python()
- def add_TgClass(self, klass_device_class, klass_device, device_class_name):
+ def add_TgClass(self, klass_device_class, klass_device, device_class_name=None):
"""Register a new python tango class.
Example:
- util.add_TgClass(MotorClass, Motor, 'Motor')"""
+ util.add_TgClass(MotorClass, Motor)
+ util.add_TgClass(MotorClass, Motor, 'Motor') # equivalent to previous line"""
+
+ if device_class_name is None:
+ device_class_name = klass_device.__name__
class_list.append((klass_device_class, klass_device, device_class_name))
@@ -229,8 +265,8 @@ class Util(_Util):
in :meth:`PyTango.Util.add_Cpp_TgClass`.
Example:
- util.add_class(MotorClass, Motor, 'Motor')
- util.add_class('CounterClass', 'Counter')
+ util.add_class(MotorClass, Motor)
+ util.add_class('CounterClass', 'Counter', language='c++')
New in PyTango 7.1.2"""
language = kwargs.get("language", "python")
@@ -628,6 +664,7 @@ def __doc_Util():
# Return : None
# """ )
-def init_PyUtil():
+def init(doc=True):
__init_Util()
- __doc_Util()
+ if doc:
+ __doc_Util()
diff --git a/PyTango/release.py b/PyTango/release.py
index 598f0f3..2f0c766 100644
--- a/PyTango/release.py
+++ b/PyTango/release.py
@@ -1,3 +1,32 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = [ "Release" ]
+
+__docformat__ = "restructuredtext"
class Release:
"""
@@ -17,14 +46,14 @@ class Release:
- keywords : (seq<str>) list of keywords
- licence : (str) the licence"""
name = 'PyTango'
- version_info = (7, 1, 2, 'final', 0)
+ version_info = (7, 1, 3, 'final', 0)
version = '.'.join(map(str, version_info[:3]))
version_long = version + ''.join(map(str, version_info[3:]))
version_description = 'This version implements the C++ Tango 7.1 API.'
version_number = int(version.replace('.',''))
description = 'A python binding for the Tango control system'
long_description = 'This module implements the Python Tango Device API mapping'
- license = 'GPL'
+ license = 'LGPL'
authors = { 'Coutinho' : ('Tiago Coutinho' , 'tcoutinho at cells.es') }
url = 'http://packages.python.org/PyTango'
download_url = 'http://pypi.python.org/packages/source/P/PyTango'
diff --git a/PyTango/tango_numpy.py b/PyTango/tango_numpy.py
index ec26b38..8b8996d 100644
--- a/PyTango/tango_numpy.py
+++ b/PyTango/tango_numpy.py
@@ -1,4 +1,32 @@
-# -*- coding: utf-8 -*-
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = [ "NumpyType", "numpy_type", "numpy_spectrum", "numpy_image" ]
+
+__docformat__ = "restructuredtext"
import _PyTango
diff --git a/PyTango/time_val.py b/PyTango/time_val.py
index 9d0707d..60e12ce 100644
--- a/PyTango/time_val.py
+++ b/PyTango/time_val.py
@@ -1,6 +1,37 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+__all__ = []
+
+__docformat__ = "restructuredtext"
+
import time
import datetime
import operator
+
from _PyTango import TimeVal
def __TimeVal__init(self, a=None, b=None, c=None):
@@ -160,6 +191,6 @@ def __init_TimeVal():
TimeVal.isoformat = __TimeVal__isoformat
TimeVal.__str__ = __TimeVal__str__
-def init_TimeVal():
+def init(doc=True):
__init_TimeVal()
diff --git a/PyTango/utils.py b/PyTango/utils.py
index 2326147..7107ac7 100644
--- a/PyTango/utils.py
+++ b/PyTango/utils.py
@@ -1,5 +1,43 @@
-# -*- coding: utf-8 -*-
-import types, operator
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
+"""
+This is an internal PyTango module.
+"""
+
+from __future__ import with_statement
+
+__all__ = [ "is_scalar_type", "is_array_type", "is_numerical_type",
+ "is_int_type", "is_float_type", "obj_2_str", "seqStr_2_obj",
+ "document_method", "document_static_method", "document_enum",
+ "CaselessList", "CaselessDict" ]
+
+__docformat__ = "restructuredtext"
+
+import sys
+import os
+import socket
+import types
+import operator
from _PyTango import StdStringVector, DbData, DbDevInfos, DbDevExportInfos, CmdArgType, AttrDataFormat
@@ -50,10 +88,14 @@ def is_scalar(tg_type):
global _scalar_types
return tg_type in _scalar_types
+is_scalar_type = is_scalar
+
def is_array(tg_type):
global _array_types
return tg_type in _array_types
+is_array_type = is_array
+
def is_numerical(tg_type, inc_array=False):
global _scalar_numerical_types, _array_numerical_types
if tg_type in _scalar_numerical_types:
@@ -62,6 +104,8 @@ def is_numerical(tg_type, inc_array=False):
return False
return tg_type in _array_numerical_types
+is_numerical_type = is_numerical
+
def is_int(tg_type, inc_array=False):
global _scalar_int_types, _array_int_types
if tg_type in _scalar_int_types:
@@ -70,6 +114,8 @@ def is_int(tg_type, inc_array=False):
return False
return tg_type in _array_int_types
+is_int_type = is_int
+
def is_float(tg_type, inc_array=False):
global _scalar_float_types, _array_float_types
if tg_type in _scalar_float_types:
@@ -78,6 +124,8 @@ def is_float(tg_type, inc_array=False):
return False
return tg_type in _array_float_types
+is_float_type = is_float
+
def seq_2_StdStringVector(seq, vec=None):
if vec is None:
if isinstance(seq, StdStringVector): return seq
@@ -169,10 +217,10 @@ def _seqStr_2_obj_from_type(seq, tg_type):
return seq[0]
if tg_type == CmdArgType.DevBoolean:
- return seq[0].capitalize() == 'True'
-
+ return seq[0].lower() == 'true'
+
#sequence cases
- if tg_type == CmdArgType.DevVarStringArray:
+ if tg_type in (CmdArgType.DevVarCharArray, CmdArgType.DevVarStringArray):
return seq
global _array_int_types
@@ -189,6 +237,12 @@ def _seqStr_2_obj_from_type(seq, tg_type):
argout.append(float(x))
return argout
+ if tg_type == CmdArgType.DevVarBooleanArray:
+ argout = []
+ for x in seq:
+ argout.append(x.lower() == 'true')
+ return argout
+
return []
def _seqStr_2_obj_from_type_format(seq, tg_type, tg_format):
@@ -457,7 +511,7 @@ class CaselessList(list):
def __iadd__(self, item):
"""To add a list in place."""
- for entry in item: self.append(entry)
+ for entry in item: self.append(entry)
def __mul__(self, item):
"""To multiply itself, and return a CaselessList.
@@ -517,4 +571,78 @@ class CaselessDict(dict):
def keys(self):
return CaselessList(dict.keys(self))
-
\ No newline at end of file
+
+__DEFAULT_FACT_IOR_FILE = "/tmp/rdifact.ior"
+__BASE_LINE = "notifd"
+__END_NOTIFD_LINE = "/DEVICE/notifd:"
+__NOTIFD_FACTORY_PREFIX = "notifd/factory/"
+
+def notifd2db(notifd_ior_file=__DEFAULT_FACT_IOR_FILE, files=None, host=None, out=sys.stdout):
+ ior_string = ""
+ with file(notifd_ior_file) as ior_file:
+ ior_string = ior_file.read()
+
+ if files is None:
+ return _notifd2db_real_db(ior_string, host=host, out=out)
+ else:
+ return _notifd2db_file_db(ior_string, files, out=out)
+
+def _notifd2db_file_db(ior_string, files, out=sys.stdout):
+ raise RuntimeError("Not implemented yet")
+
+ print >>out, "going to export notification service event factory to " \
+ "device server property file(s) ..."
+ for f in files:
+ with file(f, "w") as out_file:
+ pass
+ return
+
+def _notifd2db_real_db(ior_string, host=None, out=sys.stdout):
+ import PyTango
+ print >>out, "going to export notification service event factory to " \
+ "Tango database ..."
+
+ num_retries = 3
+ while num_retries > 0:
+ try:
+ db = PyTango.Database()
+ db.set_timeout_millis(10000)
+ num_retries = 0
+ except PyTango.DevFailed, df:
+ num_retries -= 1
+ if num_retries == 0:
+ print >>out, "Can't create Tango database object"
+ print >>out, str(df)
+ return
+ print >>out, "Can't create Tango database object, retrying...."
+
+ if host is None:
+ host_name = socket.getfqdn()
+
+ global __NOTIFD_FACTORY_PREFIX
+ notifd_factory_name = __NOTIFD_FACTORY_PREFIX + host_name
+
+ args = notifd_factory_name, ior_string, host_name, str(os.getpid()), "1"
+
+ num_retries = 3
+ while num_retries > 0:
+ try:
+ ret = db.command_inout("DbExportEvent", args)
+ print >>out, "Successfully exported notification service event " \
+ "factory for host", host_name, "to Tango database !"
+ break
+ except PyTango.CommunicationFailed, cf:
+ if len(cf.errors) >= 2:
+ if e.errors[1].reason == "API_DeviceTimedOut":
+ if num_retries > 0:
+ num_retries -= 1
+ else:
+ num_retries = 0
+ else:
+ num_retries = 0
+ except Exception, e:
+ num_retries = 0
+
+ if num_retries == 0:
+ print >>out, "Failed to export notification service event factory " \
+ "to TANGO database"
diff --git a/PyTango3/__init__.py b/PyTango3/__init__.py
index 19571fa..f0be582 100644
--- a/PyTango3/__init__.py
+++ b/PyTango3/__init__.py
@@ -1 +1,23 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
from tango3 import *
diff --git a/PyTango3/tango3.py b/PyTango3/tango3.py
index e91ce33..06c41d8 100644
--- a/PyTango3/tango3.py
+++ b/PyTango3/tango3.py
@@ -1,3 +1,25 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
from PyTango import *
import PyTango
diff --git a/cPyTango/__init__.py b/cPyTango/__init__.py
new file mode 100644
index 0000000..55f9c92
--- /dev/null
+++ b/cPyTango/__init__.py
@@ -0,0 +1 @@
+from cPyTango import *
diff --git a/cPyTango/cPyTango.py b/cPyTango/cPyTango.py
new file mode 100644
index 0000000..4c4b838
--- /dev/null
+++ b/cPyTango/cPyTango.py
@@ -0,0 +1,873 @@
+import ctypes
+import ctypes.util
+import atexit
+import enumeration
+import time
+
+_tango_lib_name = ctypes.util.find_library("c_tango")
+
+if _tango_lib_name is None:
+ raise RuntimeException("Failed to find c_tango shared library")
+
+_ref = ctypes.byref
+String = ctypes.c_char_p
+StringPtr = ctypes.POINTER(String)
+Int = ctypes.c_int
+IntPtr = ctypes.POINTER(Int)
+Enum = ctypes.c_int
+Length = ctypes.c_uint
+Bool = ctypes.c_short
+
+c_tango = ctypes.CDLL(_tango_lib_name)
+
+TangoDataType = Enum
+TangoDataTypeEnum = enumeration.Enumeration("TangoDataTypeEnum", (
+ "DEV_VOID",
+ "DEV_BOOLEAN",
+ "DEV_SHORT",
+ "DEV_LONG",
+ "DEV_FLOAT",
+ "DEV_DOUBLE",
+ "DEV_USHORT",
+ "DEV_ULONG",
+ "DEV_STRING",
+ "DEVVAR_CHARARRAY",
+ "DEVVAR_SHORTARRAY",
+ "DEVVAR_LONGARRAY",
+ "DEVVAR_FLOATARRAY",
+ "DEVVAR_DOUBLEARRAY",
+ "DEVVAR_USHORTARRAY",
+ "DEVVAR_ULONGARRAY",
+ "DEVVAR_STRINGARRAY",
+ "DEVVAR_LONGSTRINGARRAY",
+ "DEVVAR_DOUBLESTRINGARRAY",
+ "DEV_STATE",
+ "CONST_DEV_STRING",
+ "DEVVAR_BOOLEANARRAY",
+ "DEV_UCHAR",
+ "DEV_LONG64",
+ "DEV_ULONG64",
+ "DEVVAR_LONG64ARRAY",
+ "DEVVAR_ULONG64ARRAY",
+ "DEV_INT" ) )
+locals().update(TangoDataTypeEnum.lookup)
+TangoDataTypePtr = ctypes.POINTER(TangoDataType)
+
+def _is_scalar(data_type):
+ if data_type <= TangoDataTypeEnum.DEV_STRING: return True
+ if data_type > TangoDataTypeEnum.DEV_STRING and data_type < TangoDataTypeEnum.DEV_STATE: return False
+ if data_type == TangoDataTypeEnum.DEVVAR_BOOLEANARRAY or \
+ data_type == TangoDataTypeEnum.DEVVAR_LONG64ARRAY or \
+ data_type == TangoDataTypeEnum.DEVVAR_ULONG64ARRAY:
+ return False
+ return True
+
+TangoDataTypeEnum.is_scalar = _is_scalar
+
+TangoDevState = Enum
+TangoDevStateEnum = enumeration.Enumeration("TangoDevStateEnum", (
+ "ON",
+ "OFF",
+ "CLOSE",
+ "OPEN",
+ "INSERT",
+ "EXTRACT",
+ "MOVING",
+ "STANDBY",
+ "FAULT",
+ "INIT",
+ "RUNNING",
+ "ALARM",
+ "DISABLE",
+ "UNKNOWN") )
+locals().update(TangoDevStateEnum.lookup)
+TangoDevStatePtr = ctypes.POINTER(TangoDevState)
+
+AttrQuality = Enum
+AttrQualityEnum = enumeration.Enumeration("AttrQualityEnum", (
+ "ATTR_VALID",
+ "ATTR_INVALID",
+ "ATTR_ALARM",
+ "ATTR_CHANGING",
+ "ATTR_WARNING" ) )
+locals().update(AttrQualityEnum.lookup)
+AttrQualityPtr = ctypes.POINTER(AttrQuality)
+
+AttrWriteType = Enum
+AttrWriteTypeEnum = enumeration.Enumeration("AttrWriteTypeEnum", (
+ "READ",
+ "READ_WITH_WRITE",
+ "WRITE",
+ "READ_WRITE" ) )
+locals().update(AttrWriteTypeEnum.lookup)
+AttrWriteTypePtr = ctypes.POINTER(AttrWriteType)
+
+AttrDataFormat = Enum
+AttrDataFormatEnum = enumeration.Enumeration("AttrDataFormatEnum", (
+ "SCALAR",
+ "SPECTRUM",
+ "IMAGE" ) )
+locals().update(AttrDataFormatEnum.lookup)
+AttrDataFormatPtr = ctypes.POINTER(AttrDataFormat)
+
+DispLevel = Enum
+DispLevelEnum = enumeration.Enumeration("DispLevelEnum", (
+ "OPERATOR",
+ "EXPERT" ) )
+locals().update(DispLevelEnum.lookup)
+DispLevelPtr = ctypes.POINTER(DispLevel)
+
+ErrSeverity = Enum
+ErrSeverityEnum = enumeration.Enumeration("ErrSeverityEnum", (
+ "WARN",
+ "ERR",
+ "PANIC" ) )
+locals().update(ErrSeverityEnum.lookup)
+ErrSeverityPtr = ctypes.POINTER(ErrSeverity)
+
+DevSource = Enum
+DevSourceEnum = enumeration.Enumeration("DevSourceEnum", (
+ "DEV",
+ "CACHE",
+ "CACHE_DEV" ) )
+locals().update(DevSourceEnum.lookup)
+DevSourcePtr = ctypes.POINTER(DevSource)
+
+TangoDevLong = ctypes.c_int32
+TangoDevLongPtr = ctypes.POINTER(TangoDevLong)
+TangoDevULong = ctypes.c_uint32
+TangoDevULongPtr = ctypes.POINTER(TangoDevULong)
+TangoDevLong64 = ctypes.c_int64
+TangoDevLong64Ptr = ctypes.POINTER(TangoDevLong64)
+TangoDevULong64 = ctypes.c_uint64
+TangoDevULong64Ptr = ctypes.POINTER(TangoDevULong64)
+
+
+class VarArray(ctypes.Structure):
+
+ def __len__(self):
+ return self.length
+
+ def __getitem__(self, i):
+ if not isinstance(i,int): raise TypeError("tuple indices must be integers")
+ if i < 0 or i > self.length-1: raise IndexError("tuple index out of range")
+ return self.sequence[i]
+
+
+class VarBoolArray(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", ctypes.POINTER(ctypes.c_int16))
+
+
+class VarCharArray(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", ctypes.POINTER(ctypes.c_char))
+
+
+class VarShortArray(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", ctypes.POINTER(ctypes.c_int16))
+
+
+class VarUShortArray(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", ctypes.POINTER(ctypes.c_uint16))
+
+
+class VarLongArray(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", TangoDevLongPtr)
+
+
+class VarULongArray(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", TangoDevULongPtr)
+
+
+class VarLong64Array(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", TangoDevLong64Ptr)
+
+
+class VarULong64Array(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", TangoDevULong64Ptr)
+
+
+class VarFloatArray(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", ctypes.POINTER(ctypes.c_float))
+
+
+class VarDoubleArray(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", ctypes.POINTER(ctypes.c_double))
+
+
+class VarStringArray(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", StringPtr)
+
+ def __str__(self):
+ l = self.length
+ if l == 1:
+ return self.sequence[0]
+ return str(list(seq[:10]))
+VarStringArrayPtr = ctypes.POINTER(VarStringArray)
+
+class VarStateArray(VarArray):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", TangoDevStatePtr)
+
+ def __str__(self):
+ l = self.length
+ if l == 1:
+ return TangoDevStateEnum.whatis(self.sequence[0])
+ return map(cPyTango.TangoDevStateEnum.whatis, seq[:10])
+
+
+class TangoAttributeData(ctypes.Union):
+ _fields_ = \
+ ("bool_arr", VarBoolArray), \
+ ("char_arr", VarCharArray), \
+ ("short_arr", VarShortArray), \
+ ("ushort_arr", VarUShortArray), \
+ ("long_arr", VarLongArray), \
+ ("ulong_arr", VarULongArray), \
+ ("long64_arr", VarLong64Array), \
+ ("ulong64_arr", VarULong64Array), \
+ ("float_arr", VarFloatArray), \
+ ("double_arr", VarDoubleArray), \
+ ("string_arr", VarStringArray), \
+ ("state_arr", VarStateArray)
+
+ def get_raw(self, type):
+ if type == DEV_BOOLEAN: return self.bool_arr
+ elif type == DEV_UCHAR: return self.char_arr
+ elif type == DEV_SHORT: return self.short_arr
+ elif type == DEV_USHORT: return self.ushort_arr
+ elif type == DEV_LONG: return self.long_arr
+ elif type == DEV_ULONG: return self.ulong_arr
+ elif type == DEV_LONG64: return self.long64_arr
+ elif type == DEV_ULONG64: return self.ulong64_arr
+ elif type == DEV_FLOAT: return self.float_arr
+ elif type == DEV_DOUBLE: return self.double_arr
+ elif type == DEV_STRING: return self.string_arr
+ elif type == DEV_STATE: return self.state_arr
+
+ def get(self, type):
+ raw = self.get_raw(type)
+ if TangoDataTypeEnum.is_scalar(type):
+ return raw[0]
+ return raw
+
+ def representation(self, type):
+ return str(self.get_raw(type))
+TangoAttributeDataPtr = ctypes.POINTER(TangoAttributeData)
+
+
+class TangoCommandData(ctypes.Union):
+ _fields_ = \
+ ("bool_val", Bool), \
+ ("short_val", ctypes.c_short), \
+ ("ushort_val", ctypes.c_ushort), \
+ ("long_val", ctypes.c_int32), \
+ ("ulong_val", ctypes.c_uint32), \
+ ("float_val", ctypes.c_float), \
+ ("double_val", ctypes.c_double), \
+ ("string_val", ctypes.c_char_p), \
+ ("state_val", TangoDevState), \
+ ("long64_val", ctypes.c_int64), \
+ ("ulong64_val", ctypes.c_uint64), \
+ ("bool_arr", VarBoolArray), \
+ ("char_arr", VarCharArray), \
+ ("short_arr", VarShortArray), \
+ ("ushort_arr", VarUShortArray), \
+ ("long_arr", VarLongArray), \
+ ("ulong_arr", VarULongArray), \
+ ("long64_arr", VarLong64Array), \
+ ("ulong64_arr", VarULong64Array), \
+ ("float_arr", VarFloatArray), \
+ ("double_arr", VarDoubleArray), \
+ ("string_arr", VarStringArray), \
+ ("state_arr", VarStateArray),
+TangoCommandDataPtr = ctypes.POINTER(TangoCommandData)
+
+
+class TangoPropertyData(ctypes.Union):
+ _fields_ = \
+ ("bool_val", Bool), \
+ ("char_val", ctypes.c_char), \
+ ("short_val", ctypes.c_short), \
+ ("ushort_val", ctypes.c_ushort), \
+ ("long_val", ctypes.c_int32), \
+ ("ulong_val", ctypes.c_uint32), \
+ ("float_val", ctypes.c_float), \
+ ("double_val", ctypes.c_double), \
+ ("string_val", ctypes.c_char_p), \
+ ("long64_val", ctypes.c_int64), \
+ ("ulong64_val", ctypes.c_uint64), \
+ ("short_arr", VarShortArray), \
+ ("ushort_arr", VarUShortArray), \
+ ("long_arr", VarLongArray), \
+ ("ulong_arr", VarULongArray), \
+ ("long64_arr", VarLong64Array), \
+ ("ulong64_arr", VarULong64Array), \
+ ("float_arr", VarFloatArray), \
+ ("double_arr", VarDoubleArray), \
+ ("string_arr", VarStringArray),
+TangoPropertyDataPtr = ctypes.POINTER(TangoPropertyData)
+
+
+class CommandData(ctypes.Structure):
+ _fields_ = \
+ ("arg_type",TangoDataType), \
+ ("cmd_data",TangoCommandData)
+CommandDataPtr = ctypes.POINTER(CommandData)
+
+
+_time_t = ctypes.c_long
+_suseconds_t = ctypes.c_long
+
+class timeval(ctypes.Structure):
+ _fields_ = \
+ ("tv_sec", _time_t), \
+ ("tv_usec", _suseconds_t),
+
+ def __str__(self):
+ return time.ctime(self.tv_sec + 1E-6 * self.tv_usec)
+timevalPtr = ctypes.POINTER(timeval)
+
+
+class AttributeData(ctypes.Structure):
+ _fields_ = \
+ ("data_type", TangoDataType), \
+ ("attr_data", TangoAttributeData), \
+ ("quality", AttrQuality), \
+ ("name", String), \
+ ("dim_x", Int), \
+ ("dim_y", Int), \
+ ("time_stamp", timeval)
+
+ def __str__(self):
+ s = "AttributeData[\n"
+ s += "name: %s\n" % self.name
+ s += "data_type: %s\n" % TangoDataTypeEnum.whatis(self.data_type)
+ s += "quality: %s\n" % AttrQualityEnum.whatis(self.quality)
+ s += "dim_x: %d\n" % self.dim_x
+ s += "dim_y: %d\n" % self.dim_y
+ s += "time_stamp: %s\n" % self.time_stamp
+ s += "attr_data: %s\n" % str(self.attr_data.representation(self.data_type))
+ s += "]\n"
+ return s
+
+ def get_raw_data(self):
+ return self.attr_data.get_raw(self.data_type)
+
+ def get_data(self):
+ return self.attr_data.get(self.data_type)
+AttributeDataPtr = ctypes.POINTER(AttributeData)
+
+
+class AttributeDataList(ctypes.Structure):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", AttributeDataPtr)
+
+ def __len__(self):
+ return self.length
+
+ def __getitem__(self, i):
+ if not isinstance(i,int): raise TypeError("tuple indices must be integers")
+ if i < 0 or i > self.length-1: raise IndexError("tuple index out of range")
+ return self.sequence[i]
+
+ def __str__(self):
+ s = "AttributeDataList[\n"
+ for attr in self: s += attr
+ return s
+AttributeDataListPtr = ctypes.POINTER(AttributeDataList)
+
+
+class DevFailed(ctypes.Structure):
+ _fields_ = \
+ ("desc", String), \
+ ("reason", String), \
+ ("origin", String), \
+ ("severity", ErrSeverity)
+
+ def __str__(self):
+ s = "Severity : %d\n" % self.severity
+ s += "Reason : %s\n" % self.reason
+ s += "Description : %s\n" % self.desc
+ s += "Origin : %s\n\n" % self.origin
+ return s
+
+ def __repr__(self):
+ return self.__str__()
+DevFailedPtr = ctypes.POINTER(DevFailed)
+
+
+class ErrorStack(ctypes.Structure):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", DevFailedPtr)
+
+ def __len__(self):
+ return self.length
+
+ def __getitem__(self, i):
+ if not isinstance(i,int): raise TypeError("tuple indices must be integers")
+ if i < 0 or i > self.length-1: raise IndexError("tuple index out of range")
+ return self.sequence[i]
+
+ def __str__(self):
+ s = "\nTango exception:\n"
+ for i in xrange(self.length):
+ s += str(self.sequence[i])
+ return s
+
+ def __repr__(self):
+ return self.__str__()
+ErrorStackPtr = ctypes.POINTER(ErrorStack)
+
+
+class CommandInfo(ctypes.Structure):
+ _fields_ = \
+ ("cmd_name", String), \
+ ("cmd_tag", Int), \
+ ("in_type", Int), \
+ ("out_type", Int), \
+ ("in_type_desc", String), \
+ ("out_type_desc", String), \
+ ("disp_level", DispLevel)
+CommandInfoPtr = ctypes.POINTER(CommandInfo)
+
+
+class CommandInfoList(ctypes.Structure):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", CommandInfoPtr)
+CommandInfoListPtr = ctypes.POINTER(CommandInfoList)
+
+
+class AttributeInfo(ctypes.Structure):
+ _fields_ = \
+ ("name", String), \
+ ("writable", AttrWriteType), \
+ ("data_format", AttrDataFormat), \
+ ("data_type", TangoDataType), \
+ ("max_dim_x", Int), \
+ ("max_dim_y", Int), \
+ ("description", String), \
+ ("label", String), \
+ ("unit", String), \
+ ("standard_unit", String), \
+ ("display_unit", String), \
+ ("format", String), \
+ ("min_value", String), \
+ ("max_value", String), \
+ ("min_alarm", String), \
+ ("max_alarm", String), \
+ ("writable_attr_name", String), \
+ ("disp_level", DispLevel)
+AttributeInfoPtr = ctypes.POINTER(AttributeInfo)
+
+
+class AttributeInfoList(ctypes.Structure):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", AttributeInfoPtr)
+AttributeInfoListPtr = ctypes.POINTER(AttributeInfoList)
+
+
+class DbDatum(ctypes.Structure):
+ _fields_ = \
+ ("property_name", String), \
+ ("data_type", TangoDataType), \
+ ("prop_data", TangoPropertyData), \
+ ("is_empty", Bool), \
+ ("wrong_data_type", Bool)
+DbDatumPtr = ctypes.POINTER(DbDatum)
+
+
+class DbData(ctypes.Structure):
+ _fields_ = \
+ ("length", Length), \
+ ("sequence", DbDatumPtr)
+DbDataPtr = ctypes.POINTER(DbData)
+
+
+DeviceProxyPtr = ctypes.c_void_p
+DeviceProxyPtrPtr = ctypes.POINTER(DeviceProxyPtr)
+DatabasePtr = ctypes.c_void_p
+DatabasePtrPtr = ctypes.POINTER(DatabasePtr)
+
+
+c_tango.tango_create_device_proxy.argtypes = (String, DeviceProxyPtrPtr, ErrorStackPtr, )
+c_tango.tango_delete_device_proxy.argtypes = (DeviceProxyPtrPtr, ErrorStackPtr, )
+c_tango.tango_set_timeout_millis.argtypes = (DeviceProxyPtr, Int, ErrorStackPtr, )
+c_tango.tango_get_timeout_millis.argtypes = (DeviceProxyPtr, IntPtr, ErrorStackPtr, )
+c_tango.tango_set_source.argtypes = (DeviceProxyPtr, DevSource, ErrorStackPtr, )
+c_tango.tango_get_source.argtypes = (DeviceProxyPtr, DevSourcePtr, ErrorStackPtr, )
+c_tango.tango_command_query.argtypes = (DeviceProxyPtr, String, CommandInfoPtr, ErrorStackPtr, )
+c_tango.tango_command_list_query.argtypes = (DeviceProxyPtr, CommandInfoListPtr, ErrorStackPtr, )
+c_tango.tango_command_inout.argtypes = (DeviceProxyPtr, String, CommandDataPtr, CommandDataPtr, ErrorStackPtr, )
+c_tango.tango_free_CommandData.argtypes = (CommandDataPtr, )
+c_tango.tango_free_CommandInfo.argtypes = (CommandInfoPtr, )
+c_tango.tango_free_CommandInfoList.argtypes = (CommandInfoListPtr, )
+c_tango.tango_get_attribute_list.argtypes = (DeviceProxyPtr, VarStringArrayPtr, ErrorStackPtr, )
+c_tango.tango_get_attribute_config.argtypes = (DeviceProxyPtr, VarStringArrayPtr, AttributeInfoListPtr, ErrorStackPtr, )
+c_tango.tango_attribute_list_query.argtypes = (DeviceProxyPtr, AttributeInfoListPtr, ErrorStackPtr, )
+c_tango.tango_read_attribute.argtypes = (DeviceProxyPtr, String, AttributeDataPtr, ErrorStackPtr, )
+c_tango.tango_write_attribute.argtypes = (DeviceProxyPtr, String, AttributeDataPtr, ErrorStackPtr, )
+c_tango.tango_read_attributes.argtypes = (DeviceProxyPtr, VarStringArrayPtr, AttributeDataListPtr, ErrorStackPtr, )
+c_tango.tango_write_attributes.argtypes = (DeviceProxyPtr, AttributeDataListPtr, ErrorStackPtr, )
+c_tango.tango_free_AttributeData.argtypes = (AttributeDataPtr, )
+c_tango.tango_free_AttributeDataList.argtypes = (AttributeDataListPtr, )
+c_tango.tango_free_VarStringArray.argtypes = (VarStringArrayPtr, )
+c_tango.tango_print_ErrorStack.argtypes = (ErrorStackPtr, )
+c_tango.tango_free_ErrorStack.argtypes = (ErrorStackPtr, )
+c_tango.tango_create_database_proxy.argtypes = (DatabasePtrPtr, ErrorStackPtr, )
+c_tango.tango_delete_database_proxy.argtypes = (DatabasePtrPtr, ErrorStackPtr, )
+c_tango.tango_get_device_exported.argtypes = (DatabasePtr, String, DbDatumPtr, ErrorStackPtr, )
+c_tango.tango_get_device_exported_for_class.argtypes = (DatabasePtr, String, DbDatumPtr, ErrorStackPtr, )
+c_tango.tango_get_object_list.argtypes = (DatabasePtr, String, DbDatumPtr, ErrorStackPtr, )
+c_tango.tango_get_object_property_list.argtypes = (DatabasePtr, String, String, DbDatumPtr, ErrorStackPtr, )
+c_tango.tango_get_property.argtypes = (DatabasePtr, String, DbDataPtr, ErrorStackPtr, )
+c_tango.tango_put_property.argtypes = (DatabasePtr, String, DbDataPtr, ErrorStackPtr, )
+c_tango.tango_delete_property.argtypes = (DatabasePtr, String, DbDataPtr, ErrorStackPtr, )
+c_tango.tango_get_device_property.argtypes = (DeviceProxyPtr, DbDataPtr, ErrorStackPtr, )
+c_tango.tango_put_device_property.argtypes = (DeviceProxyPtr, DbDataPtr, ErrorStackPtr, )
+c_tango.tango_delete_device_property.argtypes = (DeviceProxyPtr, DbDataPtr, ErrorStackPtr, )
+c_tango.tango_free_DbDatum.argtypes = (DbDatumPtr, )
+c_tango.tango_free_DbData.argtypes = (DbDataPtr, )
+
+
+def tango_create_device_proxy(dev_name):
+ dev_name = ctypes.create_string_buffer(dev_name)
+ dev_ptr = ctypes.c_void_p()
+ err_stack = ErrorStack()
+ result = c_tango.tango_create_device_proxy(dev_name, _ref(dev_ptr), _ref(err_stack))
+ if result:
+ return dev_ptr
+ raise Exception(err_stack)
+
+def tango_delete_device_proxy(dev_ptr):
+ err_stack = ErrorStack()
+ result = c_tango.tango_delete_device_proxy(_ref(dev_ptr), _ref(err_stack))
+ if result:
+ return True
+ raise Exception(err_stack)
+
+def tango_set_timeout_millis(dev_ptr, millis):
+ err_stack = ErrorStack()
+ millis = ctypes.c_int(millis)
+ result = c_tango.tango_set_timeout_millis(dev_ptr, millis, _ref(err_stack))
+ if result:
+ return True
+ raise Exception(err_stack)
+
+def tango_get_timeout_millis(dev_ptr):
+ err_stack = ErrorStack()
+ millis = ctypes.c_int()
+ result = c_tango.tango_get_timeout_millis(dev_ptr, _ref(millis), _ref(err_stack))
+ if result:
+ return millis
+ raise Exception(err_stack)
+
+def tango_set_source(dev_ptr, src):
+ """src -> DevSource"""
+ err_stack = ErrorStack()
+ result = c_tango.tango_set_source(dev_ptr, src, _ref(err_stack))
+ if result:
+ return True
+ raise Exception(err_stack)
+
+def tango_get_source(dev_ptr):
+ err_stack = ErrorStack()
+ src = ctypes.c_int()
+ result = c_tango.tango_get_source(dev_ptr, _ref(src), _ref(err_stack))
+ if result:
+ return src
+ raise Exception(err_stack)
+
+def tango_command_query(dev_ptr, cmd_name):
+ err_stack = ErrorStack()
+ cmd_name = ctypes.create_string_buffer(cmd_name)
+ cmd_info = CommandInfo()
+ result = c_tango.tango_command_query(dev_ptr, cmd_name, _ref(cmd_info), _ref(err_stack))
+ if result:
+ return cmd_info
+ raise Exception(err_stack)
+
+def tango_command_list_query(dev_ptr):
+ err_stack = ErrorStack()
+ cmd_info_list = CommandInfoList()
+ result = c_tango.tango_command_list_query(dev_ptr, _ref(cmd_info_list), _ref(err_stack))
+ if result:
+ return cmd_info_list
+ raise Exception(err_stack)
+
+def tango_command_inout(dev_ptr, cmd_name, arg_in):
+ """arg_in->CommandData"""
+ err_stack = ErrorStack()
+ cmd_name = ctypes.create_string_buffer(cmd_name)
+ arg_out = CommandData()
+ result = c_tango.tango_command_inout(dev_ptr, cmd_name, _ref(arg_in), _ref(arg_out), _ref(err_stack))
+ if result:
+ return arg_out
+ raise Exception(err_stack)
+
+def tango_free_CommandData(cmd_data):
+ c_tango.tango_free_CommandData(_ref(cmd_data))
+
+def tango_free_CommandInfo(cmd_info):
+ c_tango.tango_free_CommandInfo(_ref(cmd_info))
+
+def tango_free_CommandInfoList(cmd_info_list):
+ c_tango.tango_free_CommandInfoList(_ref(cmd_info_list))
+
+def tango_get_attribute_list(dev_ptr):
+ err_stack = ErrorStack()
+ attr_names = VarStringArray()
+ result = c_tango.tango_get_attribute_list(dev_ptr, _ref(attr_names), _ref(err_stack))
+ if result:
+ return attr_names
+ raise Exception(err_stack)
+
+def tango_get_attribute_config(dev_ptr, attr_names):
+ print "TODO"
+ return
+ err_stack = ErrorStack()
+ attr_names = VarStringArray()
+ attr_info_list = AttributeInfoList()
+ result = c_tango.tango_get_attribute_config(dev_ptr, _ref(attr_names), _ref(attr_info_list), _ref(err_stack))
+ if result:
+ return attr_info_list
+ raise Exception(err_stack)
+
+def tango_attribute_list_query(dev_ptr):
+ err_stack = ErrorStack()
+ attr_info_list = AttributeInfoList()
+ result = c_tango.tango_attribute_list_query(dev_ptr, _ref(attr_info_list), _ref(err_stack))
+ if result:
+ return attr_info_list
+ raise Exception(err_stack)
+
+def tango_read_attribute(dev_ptr, attr_name):
+ attr_name = ctypes.create_string_buffer(attr_name)
+ attr_data = AttributeData()
+ err_stack = ErrorStack()
+ result = c_tango.tango_read_attribute(dev_ptr, attr_name, _ref(attr_data), _ref(err_stack))
+ if result:
+ return attr_data
+ raise Exception(err_stack)
+
+def tango_write_attribute(dev_ptr, attr_name, value):
+ print "TODO"
+ return
+ attr_data = AttributeData()
+ attr_data.name = ctypes.create_string_buffer(attr_name)
+ attr_data.attr_data = value
+ err_stack = ErrorStack()
+ result = c_tango.tango_write_attribute(dev_ptr, attr_name, _ref(attr_data), _ref(err_stack))
+ if result:
+ return True
+ raise Exception(err_stack)
+
+def tango_read_attributes(dev_ptr, attr_names):
+ print "TODO"
+ return
+ attr_data_list = AttributeDataList()
+ attr_names = VarStringArray()
+ err_stack = ErrorStack()
+ result = c_tango.tango_read_attribute(dev_ptr, _ref(attr_names), _ref(attr_data_list), _ref(err_stack))
+ if result:
+ return attr_data
+ raise Exception(err_stack)
+
+def tango_write_attributes(dev_ptr, attr_data_list):
+ """attr_data_list->AttributeDataList"""
+ err_stack = ErrorStack()
+ result = c_tango.tango_write_attributes(dev_ptr, _ref(attr_data_list), _ref(err_stack))
+ if result:
+ return True
+ raise Exception(err_stack)
+
+def tango_free_AttributeData(attr_data):
+ c_tango.tango_free_AttributeData(_ref(attr_data))
+
+def tango_free_AttributeDataList(attr_data_list):
+ c_tango.tango_free_AttributeDataList(_ref(attr_data_list))
+
+def tango_free_VarStringArray(str_array):
+ c_tango.tango_free_VarStringArray(_ref(str_array))
+
+def tango_print_ErrorStack(err_stack):
+ """Should not be used. This function prints to STDOUT instead of sys.stdout.
+ Use: 'print err_stack' instead"""
+ c_tango.tango_print_ErrorStack(_ref(err_stack))
+
+def tango_free_ErrorStack(err_stack):
+ c_tango.tango_free_ErrorStack(_ref(err_stack))
+
+def tango_create_database_proxy():
+ err_stack = ErrorStack()
+ db_ptr = ctypes.c_void_p()
+ result = c_tango.tango_create_database_proxy(_ref(db_ptr), _ref(err_stack))
+ if result:
+ return db_ptr
+ raise Exception(err_stack)
+
+def tango_delete_database_proxy(db_ptr):
+ err_stack = ErrorStack()
+ result = c_tango.tango_delete_database_proxy(_ref(db_ptr), _ref(err_stack))
+ if result:
+ return True
+ raise Exception(err_stack)
+
+def tango_get_device_exported(db_ptr, name_filter):
+ err_stack = ErrorStack()
+ name_filter = ctypes.create_string_buffer(name_filter)
+ db_datum = DbDatum()
+ result = c_tango.tango_get_device_exported(db_ptr, name_filter, _ref(db_datum), _ref(err_stack))
+ if result:
+ return db_datum
+ raise Exception(err_stack)
+
+def tango_get_device_exported_for_class(db_ptr, class_name):
+ err_stack = ErrorStack()
+ class_name = ctypes.create_string_buffer(class_name)
+ db_datum = DbDatum()
+ result = c_tango.tango_get_device_exported_for_class(db_ptr, class_name, _ref(db_datum), _ref(err_stack))
+ if result:
+ return db_datum
+ raise Exception(err_stack)
+
+def tango_get_object_list(db_ptr, name_filter):
+ err_stack = ErrorStack()
+ name_filter = ctypes.create_string_buffer(name_filter)
+ db_datum = DbDatum()
+ result = c_tango.tango_get_object_list(db_ptr, name_filter, _ref(db_datum), _ref(err_stack))
+ if result:
+ return db_datum
+ raise Exception(err_stack)
+
+def tango_get_object_property_list(db_ptr, obj_name, name_filter):
+ err_stack = ErrorStack()
+ obj_name = ctypes.create_string_buffer(obj_name)
+ name_filter = ctypes.create_string_buffer(name_filter)
+ db_datum = DbDatum()
+ result = c_tango.tango_get_object_property_list(db_ptr, obj_name, name_filter, _ref(db_datum), _ref(err_stack))
+ if result:
+ return db_datum
+ raise Exception(err_stack)
+
+def tango_get_property(db_ptr, obj_name):
+ err_stack = ErrorStack()
+ obj_name = ctypes.create_string_buffer(obj_name)
+ db_data = DbData()
+ result = c_tango.tango_get_property(db_ptr, obj_name, _ref(db_data), _ref(err_stack))
+ if result:
+ return db_datum
+ raise Exception(err_stack)
+
+def tango_put_property(db_ptr, obj_name, prop_list):
+ """prop_list -> DbData"""
+ err_stack = ErrorStack()
+ obj_name = ctypes.create_string_buffer(obj_name)
+ result = c_tango.tango_put_property(db_ptr, obj_name, _ref(prop_list), _ref(err_stack))
+ if result:
+ return True
+ raise Exception(err_stack)
+
+def tango_delete_property(db_ptr, obj_name, prop_list):
+ """prop_list -> DbData"""
+ err_stack = ErrorStack()
+ obj_name = ctypes.create_string_buffer(obj_name)
+ result = c_tango.tango_delete_property(db_ptr, obj_name, _ref(prop_list), _ref(err_stack))
+ if result:
+ return True
+ raise Exception(err_stack)
+
+def tango_get_device_property(dev_ptr, prop_list):
+ """prop_list -> DbData"""
+ err_stack = ErrorStack()
+ result = c_tango.tango_get_device_property(dev_ptr, _ref(prop_list), _ref(err_stack))
+ if result:
+ return prop_list
+ raise Exception(err_stack)
+
+def tango_put_device_property(dev_ptr, prop_list):
+ """prop_list -> DbData"""
+ err_stack = ErrorStack()
+ result = c_tango.tango_put_device_property(dev_ptr, _ref(prop_list), _ref(err_stack))
+ if result:
+ return True
+ raise Exception(err_stack)
+
+def tango_delete_device_property(dev_ptr, prop_list):
+ """prop_list -> DbData"""
+ err_stack = ErrorStack()
+ result = c_tango.tango_delete_device_property(dev_ptr, _ref(prop_list), _ref(err_stack))
+ if result:
+ return True
+ raise Exception(err_stack)
+
+def tango_free_DbDatum(db_datum):
+ c_tango.tango_free_DbDatum(_ref(db_datum))
+
+def tango_free_DbData(db_data):
+ c_tango.tango_free_DbData(_ref(db_data))
+
+
+class DeviceProxy:
+ def __init__(self, dev_name):
+ self._dev_name = dev_name
+ self._dev = tango_create_device_proxy(dev_name)
+
+ def read_attribute(self, attr_name):
+ return tango_read_attribute(self._dev, attr_name)
+
+ def write_attribute(self, attr_name, value):
+ return tango_read_attribute(self._dev, attr)
+
+ def read_attributes(self, attr_name_list):
+ return tango_read_attributes(self._dev, attr_name_list)
+
+ def get_property(self, attr_name_list):
+ if isinstance(attr_name_list, str):
+ attr_name_list = [ attr_name_list ]
+ n = len(attr_name_list)
+ db_data = DbData()
+ db_data.length = n
+ db_data.sequence = (n*DbDatum)()
+ for i in xrange(n):
+ db_data.sequence[i].property_name = attr_name_list[i]
+ db_data.sequence[i].data_type = DEV_STRING
+ return tango_get_device_property(self._dev, db_data)
+
+ def __del__(self):
+ try:
+ if self._dev:
+ try:
+ tango_delete_device_proxy(self._dev)
+ except Exception, e:
+ print e
+ except AttributeError:
+ #The error was in the constructor and therefore _dev is not defined
+ pass
+
diff --git a/cPyTango/enumeration.py b/cPyTango/enumeration.py
new file mode 100644
index 0000000..c999114
--- /dev/null
+++ b/cPyTango/enumeration.py
@@ -0,0 +1,86 @@
+import types
+
+"""
+ Enumeration module.
+ In C, enums allow you to declare a bunch of constants with unique values,
+ without necessarily specifying the actual values (except in cases where you
+ need to). Python has an accepted idiom that's fine for very small numbers of
+ constants (A, B, C, D = range(4)) but it doesn't scale well to large numbers,
+ and it doesn't allow you to specify values for some constants while leaving
+ others unspecified. This approach does those things, while verifying that all
+ values (specified and unspecified) are unique. Enum values then are attributes
+ of an Enumeration class (Volkswagen.BEETLE, Volkswagen.PASSAT, etc.).
+"""
+
+
+class Enumeration:
+ """ Enumeration class intended to provide the 'enum' feature present in many
+ programming languages.
+ Usage:
+ car = ThingWithType(Volkswagen.BEETLE)
+ print whatkind(car.type, Volkswagen)
+ bug = ThingWithType(Insect.BEETLE)
+ print whatkind(bug.type, Insect)
+
+ Notice that car's and bug's attributes don't include any of the
+ enum machinery, because that machinery is all CLASS attributes and
+ not INSTANCE attributes. So you can generate thousands of cars and
+ bugs with reckless abandon, never worrying that time or memory will
+ be wasted on redundant copies of the enum stuff.
+
+ print car.__dict__
+ print bug.__dict__
+ pprint.pprint(Volkswagen.__dict__)
+ pprint.pprint(Insect.__dict__)
+ """
+
+ def __init__(self, name, enumList):
+ self.__doc__ = name
+ lookup = { }
+ reverseLookup = { }
+ uniqueNames = [ ]
+ self._uniqueValues = uniqueValues = [ ]
+ self._uniqueId = 0
+ for x in enumList:
+ if type(x) == types.TupleType:
+ x, i = x
+ if type(x) != types.StringType:
+ raise EnumException, "enum name is not a string: " + x
+ if type(i) != types.IntType:
+ raise EnumException, "enum value is not an integer: " + i
+ if x in uniqueNames:
+ raise EnumException, "enum name is not unique: " + x
+ if i in uniqueValues:
+ raise EnumException, "enum value is not unique for " + x
+ uniqueNames.append(x)
+ uniqueValues.append(i)
+ lookup[x] = i
+ reverseLookup[i] = x
+ for x in enumList:
+ if type(x) != types.TupleType:
+ if type(x) != types.StringType:
+ raise EnumException, "enum name is not a string: " + x
+ if x in uniqueNames:
+ raise EnumException, "enum name is not unique: " + x
+ uniqueNames.append(x)
+ i = self.generateUniqueId()
+ uniqueValues.append(i)
+ lookup[x] = i
+ reverseLookup[i] = x
+ self.lookup = lookup
+ self.reverseLookup = reverseLookup
+
+ def generateUniqueId(self):
+ while self._uniqueId in self._uniqueValues:
+ self._uniqueId += 1
+ n = self._uniqueId
+ self._uniqueId += 1
+ return n
+
+ def __getattr__(self, attr):
+ if not self.lookup.has_key(attr):
+ raise AttributeError
+ return self.lookup[attr]
+
+ def whatis(self, value):
+ return self.reverseLookup[value]
diff --git a/doc/_templates/layout.html b/doc/_templates/layout.html
new file mode 100644
index 0000000..ed3d08e
--- /dev/null
+++ b/doc/_templates/layout.html
@@ -0,0 +1,10 @@
+{% extends "sphinxdoc/layout.html" %}
+
+{% block rootrellink %}
+ <li><a href="{{ pathto('index') }}">home</a>| </li>
+ <li><a href="{{ pathto('start') }}">getting started</a>| </li>
+ <li><a href="{{ pathto('quicktour') }}">quick tour</a>| </li>
+ <li><a href="{{ pathto('contents') }}">documentation </a> »</li>
+{% endblock %}
+
+
diff --git a/doc/api.rst b/doc/api.rst
new file mode 100644
index 0000000..e964fa1
--- /dev/null
+++ b/doc/api.rst
@@ -0,0 +1,16 @@
+
+.. currentmodule:: PyTango
+
+.. _api:
+
+===========
+PyTango API
+===========
+
+.. toctree::
+ :maxdepth: 2
+
+ client/index
+ database
+ server/index
+ exception
diff --git a/doc/client/miscellaneous.rst b/doc/client/miscellaneous.rst
index 3fc69d5..18870a6 100644
--- a/doc/client/miscellaneous.rst
+++ b/doc/client/miscellaneous.rst
@@ -2,6 +2,12 @@
.. currentmodule:: PyTango
+API util
+--------
+
+.. autoclass:: PyTango.ApiUtil
+ :members:
+
Information classes
-------------------
diff --git a/doc/conf.py b/doc/conf.py
index 6bfc89d..098d428 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -1,4 +1,25 @@
-# -*- coding: utf-8 -*-
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
#
# PyTango documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 5 14:31:50 2009.
diff --git a/doc/contents.rst b/doc/contents.rst
new file mode 100644
index 0000000..fe0a652
--- /dev/null
+++ b/doc/contents.rst
@@ -0,0 +1,21 @@
+
+.. currentmodule:: PyTango
+
+.. _contents:
+
+========
+Contents
+========
+
+.. toctree::
+ :maxdepth: 2
+
+ start
+ spock/index
+ API <api>
+ faq
+ History of changes <revision>
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
\ No newline at end of file
diff --git a/doc/faq.rst b/doc/faq.rst
index 5e94400..aec878b 100644
--- a/doc/faq.rst
+++ b/doc/faq.rst
@@ -1,3 +1,5 @@
+.. currentmodule:: PyTango
+
FAQ
===
@@ -163,9 +165,9 @@ reference, the proper code would be::
Server
~~~~~~
-#. replace `PyTango.PyUtil` with :class:`PyTango.Util`
+#. replace `PyTango.PyUtil` with :class:`Util`
-#. replace `PyTango.PyDeviceClass` with :class:`PyTango.DeviceClass`
+#. replace `PyTango.PyDeviceClass` with :class:`DeviceClass`
#. state and status overwrite
in PyTango <= 3.0.4, in order to overwrite the default state and status in a device
@@ -178,7 +180,8 @@ General
~~~~~~~
#. AttributeValue does **NOT** exist anymore.
- - the result of a read_attribute call on a DeviceProxy/Group is now a DeviceAttribute object
+ - the result of a read_attribute call on a :class:`DeviceProxy` / :class:`Group`
+ is now a :class:`DeviceAttribute` object
- write_attribute does not accept AttributeValue anymore
(See :class:`DeviceProxy` API documentation for more details)
@@ -195,7 +198,7 @@ General
dev_proxy.command_inout( 'Go', [[1.0, 2.0], ['1', '2', '3']] )
-#. PyTango.EventType enumeration constants changed to match C++ enumeration
+#. :class:`EventType` enumeration constants changed to match C++ enumeration
- CHANGE -> CHANGE_EVENT
- QUALITY -> QUALITY_EVENT
- PERIODIC -> PERIODIC_EVENT
@@ -204,8 +207,8 @@ General
- ATTR_CONF_EVENT remains
#. Exception handling
- in 3.0.4 :class:`PyTango.DevFailed` was a tuple of dictionaries.
- Now :class:`PyTango.DevFailed` is a tuple of :class:`PyTango.DevError`.
+ in 3.0.4 :class:`DevFailed` was a tuple of dictionaries.
+ Now :class:`DevFailed` is a tuple of :class:`DevError`.
This means that code::
try:
@@ -235,8 +238,18 @@ Server side V3 to V4 upgrade
If you want your server to support the V4 interface provided by Tango 7
instead of the V3 provided by Tango 6:
-- replace the inheritance of your device class from :class:`PyTango.Device_3Impl` to :class:`PyTango.Device_4Impl`
-- in the `init_device` method replace the call `PyTango.Device_3Impl.init_device(self...` with `PyTango.Device_4Impl.init_device(self...`
+- replace the inheritance of your device class from :class:`Device_3Impl` to :class:`Device_4Impl`
+- in the `init_device` method replace the call::
+
+ Device_3Impl.init_device(self)
+
+ with::
+
+ Device_4Impl.init_device(self)
+
+ or better yet, if your device class only inherits from :class:`Device_4Impl`::
+
+ super(<your class>, self).init_device()
Improved server side image attribute read API
#############################################
diff --git a/doc/index.rst b/doc/index.rst
index 56fb1a6..0bb9bc8 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -13,6 +13,12 @@ Welcome to PyTango 7.1 documentation!
.. sidebar:: Latest news
+ 2010-11-05:
+ PyTango 7.1.3 is out!
+
+ 2010-08-19:
+ :ref:`Tango logging <logging>` updated
+
2010-08-06:
PyTango 7.1.2 is out!
diff --git a/doc/quicktour.rst b/doc/quicktour.rst
new file mode 100644
index 0000000..ab8c6cf
--- /dev/null
+++ b/doc/quicktour.rst
@@ -0,0 +1,531 @@
+.. _quick-tour:
+
+A quick tour
+------------
+
+This quick tour will guide you through the first steps on using PyTango.
+This is the new quick tour guide based on the :ref:`spock` console.
+You can still find the old version of this tour based on a simple python
+console :ref:`here <quick-tour-old>`.
+
+Check PyTango version
+~~~~~~~~~~~~~~~~~~~~~
+
+Start an ipython spock console with::
+
+ ipython -p spock
+
+and type:
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: PyTango.__version__
+ Result [1]: '7.1.2'
+
+ Spock <homer:10000> [2]: PyTango.__version_long__
+ Result [2]: '7.1.2dev0'
+
+ Spock <homer:10000> [3]: PyTango.__version_number__
+ Result [3]: 712
+
+ Spock <homer:10000> [4]: PyTango.__version_description__
+ Result [4]: 'This version implements the C++ Tango 7.1 API.'
+
+or alternatively:
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: PyTango.Release.version
+ Result [1]: '7.1.2'
+
+ Spock <homer:10000> [2]: PyTango.Release.version_long
+ Result [2]: '7.1.2dev0'
+
+ Spock <homer:10000> [3]: PyTango.Release.version_number
+ Result [3]: 712
+
+ Spock <homer:10000> [4]: PyTango.Release.version_description
+ Result [4]: 'This version implements the C++ Tango 7.1 API.'
+
+.. tip::
+
+ When typing, try pressing <tab>. Since Spock has autocomplete embedded you
+ should get a list of possible completions. Example::
+
+ PyTango.Release.<tab>
+
+ Should get a list of all members of :class:`PyTango.Release` class.
+
+Check Tango C++ version
+~~~~~~~~~~~~~~~~~~~~~~~
+
+From a client (This is only possible since PyTango 7.0.0)
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: import PyTango.constants
+
+ Spock <homer:10000> [2]: PyTango.constants.TgLibVers
+ Result [2]: '7.1.1'
+
+From a server you can alternatively do::
+
+ u = PyTango.Util.instance()
+ tg_cpp_lib_ver = u.get_tango_lib_release()
+
+
+Test the connection to the Device and get it's current state
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+One of the most basic examples is to get a reference to a device and
+determine if it is running or not.
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: # What is a DeviceProxy, really?
+ Spock <homer:10000> [1]: DeviceProxy?
+ DeviceProxy is the high level Tango object which provides the client with
+ an easy-to-use interface to TANGO devices. DeviceProxy provides interfaces
+ to all TANGO Device interfaces.The DeviceProxy manages timeouts, stateless
+ connections and reconnection if the device server is restarted. To create
+ a DeviceProxy, a Tango Device name must be set in the object constructor.
+
+ Example :
+ dev = PyTango.DeviceProxy("sys/tg_test/1")
+
+ Spock <homer:10000> [2]: tangotest = DeviceProxy("sys/tg_test/1")
+
+ Spock <homer:10000> [3]: # ping it
+ Spock <homer:10000> [4]: tangotest.ping()
+ Result [4]: 110
+
+ Spock <homer:10000> [3]: # Lets test the state
+ Spock <homer:10000> [5]: tangotest.state()
+ Result [5]: PyTango._PyTango.DevState.RUNNING
+
+ Spock <homer:10000> [3]: # And now the status
+ Spock <homer:10000> [5]: tangotest.status()
+ Result [5]: 'The device is in RUNNING state.'
+
+.. note::
+ Did you notice that you didn't write PyTango.DeviceProxy but instead just DeviceProxy?
+ This is because :ref:`spock` automatically exports the :class:`PyTango.DeviceProxy`,
+ :class:`PyTango.AttributeProxy`, :class:`PyTango.Database` and :class:`PyTango.Group`
+ classes to the namespace. If you are writting code outside :ref:`spock` you **MUST**
+ use the `PyTango` module prefix.
+
+.. tip::
+
+ When typing the device name in the :class:`PyTango.DeviceProxy` creation
+ line, try pressing the <tab> key. You should get a list of devices::
+
+ tangotest = DeviceProxy("sys<tab>
+
+ Better yet (and since the Tango Class of 'sys/tg_test/1' is 'TangoTest'),
+ try doing::
+
+ tangotest = TangoTest("<tab>
+
+ Now the list of devices should be reduced to the ones that belong to the
+ 'TangoTest' class. Note that TangoTest only works in Spock. If you are
+ writting code outside :ref:`spock` you **MUST** use
+ :class:`PyTango.DeviceProxy` instead.
+
+Execute commands with scalar arguments on a Device
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+As you can see in the following example, when scalar types are used, PyTango
+automatically manages the data types, and writing scripts is quite easy.
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: tangotest = TangoTest("sys/tg_test/1")
+
+ Spock <homer:10000> [2]: # classical way
+ Spock <homer:10000> [2]: r = tangotest.command_inout("DevString", "Hello, world!")
+
+ Spock <homer:10000> [3]: print "Result of execution of DevString command =", r
+ Result of execution of DevString command = Hello, world!
+
+ Spock <homer:10000> [4]: # 'pythonic' way
+ Spock <homer:10000> [5]: tangotest.DevString("Hello, world!")
+ Result [5]: 'Hello, world!'
+
+ Spock <homer:10000> [6]: # type is automatically managed by PyTango
+ Spock <homer:10000> [7]: tangotest.DevULong(12456)
+ Result [7]: 12456
+
+Execute commands with more complex types
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In this case you have to use put your arguments data in the correct python
+structures.
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: tangotest = TangoTest("sys/tg_test/1")
+
+ Spock <homer:10000> [2]: argin = [1, 2, 3], ["Hello", "World"]
+
+ Spock <homer:10000> [3]: tango_test.DevVarLongArray(argin)
+ Result [3]: [array([1, 2, 3]), ['Hello', 'World']]
+
+.. note::
+ notice that the command returns a list of two elements. The first element is
+ a :class:`numpy.ndarray` (assuming PyTango is compiled with numpy support).
+ This is because PyTango does a best effort to convert all numeric array types
+ to numpy arrays.
+
+Reading and writing attributes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Basic read/write attribute operations.
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: # Read a scalar attribute
+ Spock <homer:10000> [2]: print tangotest.read_attribute("long_scalar")
+ DeviceAttribute[
+ data_format = PyTango._PyTango.AttrDataFormat.SCALAR
+ dim_x = 1
+ dim_y = 0
+ has_failed = False
+ is_empty = False
+ name = 'long_scalar'
+ nb_read = 1
+ nb_written = 1
+ quality = PyTango._PyTango.AttrQuality.ATTR_VALID
+ r_dimension = AttributeDimension(dim_x = 1, dim_y = 0)
+ time = TimeVal(tv_nsec = 0, tv_sec = 1281084943, tv_usec = 461730)
+ type = PyTango._PyTango.CmdArgType.DevLong
+ value = 239
+ w_dim_x = 1
+ w_dim_y = 0
+ w_dimension = AttributeDimension(dim_x = 1, dim_y = 0)
+ w_value = 0]
+
+ Spock <homer:10000> [3]: # Read a spectrum attribute
+ Spock <pc151:10000> [4]: print tangotest.read_attribute("double_spectrum")
+ DeviceAttribute[
+ data_format = PyTango._PyTango.AttrDataFormat.SPECTRUM
+ dim_x = 20
+ dim_y = 0
+ has_failed = False
+ is_empty = False
+ name = 'double_spectrum'
+ nb_read = 20
+ nb_written = 20
+ quality = PyTango._PyTango.AttrQuality.ATTR_VALID
+ r_dimension = AttributeDimension(dim_x = 20, dim_y = 0)
+ time = TimeVal(tv_nsec = 0, tv_sec = 1281085195, tv_usec = 244760)
+ type = PyTango._PyTango.CmdArgType.DevDouble
+ value = array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.,
+ 11., 12., 13., 14., 15., 16., 17., 18., 19.])
+ w_dim_x = 20
+ w_dim_y = 0
+ w_dimension = AttributeDimension(dim_x = 20, dim_y = 0)
+ w_value = array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.,
+ 11., 12., 13., 14., 15., 16., 17., 18., 19.])]
+
+ Spock <homer:10000> [5]: # Write a scalar attribute
+ Spock <homer:10000> [6]: scalar_value = 18
+ Spock <homer:10000> [7]: tangotest.write_attribute("long_scalar", scalar_value)
+
+ Spock <homer:10000> [8]: # Write a spectrum attribute
+ Spock <homer:10000> [9]: spectrum_value = numpy.random.rand(100)*10
+ Spock <homer:10000> [10]: tangotest.write_attribute("double_spectrum", spectrum_value)
+
+
+ Spock <homer:10000> [11]: # Write an image attribute
+ Spock <homer:10000> [12]: image_value = numpy.random.randint(0,10,size=(10,10))
+ Spock <homer:10000> [13]: tangotest.write_attribute("long_image", image_value)
+
+.. tip::
+
+ If you are only interested in the attribute's read value you can do insted:
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: tangotest.long_scalar
+ Result [1]: 239
+
+ The same is valid for writting a new value to an attribute:
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: tangotest.long_scalar = 18
+
+.. note::
+
+ If PyTango is compiled with numpy support the values got when reading
+ a spectrum or an image will be numpy arrays. This results in a faster and
+ more memory efficient PyTango. You can also use numpy to specify the values when
+ writing attributes, especially if you know the exact attribute type.::
+
+ # Creating an unitialized double spectrum of 1000 elements
+ spectrum_value = PyTango.numpy_spectrum(PyTango.DevDouble, 1000)
+
+ # Creating an spectrum with a range
+ # Note that I do NOT use PyTango.DevLong here, BUT PyTango.NumpyType.DevLong
+ # numpy functions do not understand normal python types, so there's a
+ # translation available in PyTango.NumpyType
+ spectrum_value = numpy.arange(5, 1000, 2, PyTango.NumpyType.DevLong)
+
+ # Creating a 2x2 long image from an existing one
+ image_value = PyTango.numpy_image(PyTango.DevLong, [[1,2],[3,4]])
+
+Registering devices
+~~~~~~~~~~~~~~~~~~~
+
+Defining devices in the Tango DataBase:
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: # The 3 devices name we want to create
+ Spock <homer:10000> [2]: # Note: these 3 devices will be served by the same DServer
+ Spock <homer:10000> [3]: new_device_name1="px1/tdl/mouse1"
+ Spock <homer:10000> [4]: new_device_name2="px1/tdl/mouse2"
+ Spock <homer:10000> [5]: new_device_name3="px1/tdl/mouse3"
+
+ Spock <homer:10000> [6]: # Define the Tango Class served by this DServer
+ Spock <homer:10000> [7]: new_device_info_mouse = PyTango.DbDevInfo()
+ Spock <homer:10000> [8]: new_device_info_mouse._class = "Mouse"
+ Spock <homer:10000> [9]: new_device_info_mouse.server = "ds_Mouse/server_mouse"
+
+ Spock <homer:10000> [10]: # add the first device
+ Spock <homer:10000> [11]: new_device_info_mouse.name = new_device_name1
+ Spock <homer:10000> [12]: db.add_device(new_device_info_mouse)
+
+ Spock <homer:10000> [13]: # add the next device
+ Spock <homer:10000> [14]: new_device_info_mouse.name = new_device_name2
+ Spock <homer:10000> [15]: db.add_device(new_device_info_mouse)
+
+ Spock <homer:10000> [16]: # add the third device
+ Spock <homer:10000> [17]: new_device_info_mouse.name = new_device_name3
+ Spock <homer:10000> [18]: db.add_device(new_device_info_mouse)
+
+Setting up Device properties
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+A more complex example using python subtilities.
+The following python script example (containing some functions and instructions
+manipulating a Galil motor axis device server) gives an idea of how the Tango
+API should be accessed from Python.
+
+ .. sourcecode:: spock
+
+ Spock <homer:10000> [1]: # connecting to the motor axis device
+ Spock <homer:10000> [2]: axis1 = DeviceProxy ("microxas/motorisation/galilbox")
+
+ Spock <homer:10000> [3]: # Getting Device Properties
+ Spock <homer:10000> [4]: property_names = ["AxisBoxAttachement",
+ ....: "AxisEncoderType",
+ ....: "AxisNumber",
+ ....: "CurrentAcceleration",
+ ....: "CurrentAccuracy",
+ ....: "CurrentBacklash",
+ ....: "CurrentDeceleration",
+ ....: "CurrentDirection",
+ ....: "CurrentMotionAccuracy",
+ ....: "CurrentOvershoot",
+ ....: "CurrentRetry",
+ ....: "CurrentScale",
+ ....: "CurrentSpeed",
+ ....: "CurrentVelocity",
+ ....: "EncoderMotorRatio",
+ ....: "logging_level",
+ ....: "logging_target",
+ ....: "UserEncoderRatio",
+ ....: "UserOffset"]
+
+ Spock <homer:10000> [5]: axis_properties = axis1.get_property(property_names)
+ Spock <homer:10000> [6]: for prop in axis_properties.keys():
+ ....: print "%s: %s" % (prop, axis_properties[prop][0])
+
+ Spock <homer:10000> [7]: # Changing Properties
+ Spock <homer:10000> [8]: axis_properties["AxisBoxAttachement"] = ["microxas/motorisation/galilbox"]
+ Spock <homer:10000> [9]: axis_properties["AxisEncoderType"] = ["1"]
+ Spock <homer:10000> [10]: axis_properties["AxisNumber"] = ["6"]
+ Spock <homer:10000> [11]: axis1.put_property(axis_properties)
+
+ Spock <homer:10000> [12]: # Reading attributes
+ Spock <homer:10000> [13]: att_list = axis.get_attribute_list()
+ Spock <homer:10000> [14]: for att in att_list:
+ ....: att_val = axis.read_attribute(att)
+ ....: print "%s: %s" % (att.name, att_val.value)
+
+ Spock <homer:10000> [15]: # Changing some attribute values
+ Spock <homer:10000> [16]: axis1.write_attribute("AxisBackslash", 0.5)
+ Spock <homer:10000> [17]: axis1.write_attribute("AxisDirection", 1.0)
+ Spock <homer:10000> [18]: axis1.write_attribute("AxisVelocity", 1000.0)
+ Spock <homer:10000> [19]: axis1.write_attribute("AxisOvershoot", 500.0)
+
+ Spock <homer:10000> [20]: # Testing some device commands
+ Spock <homer:10000> [21]: pos1=axis1.read_attribute("AxisCurrentPosition")
+ Spock <homer:10000> [22]: axis1.command_inout("AxisBackward")
+ Spock <homer:10000> [23]: while pos1.value > 1000.0:
+ ....: pos1 = axis1.read_attribute("AxisCurrentPosition")
+ ....: print "position axis 1 = ", pos1.value
+
+ Spock <homer:10000> [24]: axis1.command_inout("AxisStop")
+
+A quick tour of Tango device server binding through an example
+--------------------------------------------------------------
+
+To write a tango device server in python, you need to import two modules in your script which are:
+
+1. The PyTango module
+
+2. The python sys module provided in the classical python distribution
+
+The following in the python script for a Tango device server with two commands and two attributes. The commands are:
+
+1. IOLOng which receives a Tango Long and return it multiply by 2. This command is allowed only if the device is in the ON state.
+
+2. IOStringArray which receives an array of Tango strings and which returns it but in the reverse order. This command is only allowed if the device is in the ON state.
+
+The attributes are:
+
+1. Long_attr wich is a Tango long attribute, Scalar and Read only with a minimum alarm set to 1000 and a maximum alarm set to 1500
+
+2. Short_attr_rw which is a Tango short attribute, Scalar and Read/Write
+
+The following code is the complete device server code::
+
+ import PyTango
+ import sys
+
+ class PyDsExp(PyTango.Device_3Impl):
+
+ def __init__(self,cl,name):
+ PyTango.Device_3Impl.__init__(self,cl,name)
+ self.debug_stream('In PyDsExp __init__')
+ PyDsExp.init_device(self)
+
+ def init_device(self):
+ self.debug_stream('In Python init_device method')
+ self.set_state(PyTango.DevState.ON)
+ self.attr_short_rw = 66
+ self.attr_long = 1246
+
+ #------------------------------------------------------------------
+
+ def delete_device(self):
+ self.debug_stream('[delete_device] for device %s ' % self.get_name())
+
+ #------------------------------------------------------------------
+ # COMMANDS
+ #------------------------------------------------------------------
+
+ def is_IOLong_allowed(self):
+ return self.get_state() == PyTango.DevState.ON
+
+ def IOLong(self, in_data):
+ self.debug_stream('[IOLong::execute] received number %s' % str(in_data))
+ in_data = in_data * 2;
+ self.debug_stream('[IOLong::execute] return number %s' % str(in_data))
+ return in_data;
+
+ #------------------------------------------------------------------
+
+ def is_IOStringArray_allowed(self):
+ return self.get_state() == PyTango.DevState.ON
+
+ def IOStringArray(self, in_data):
+ l = range(len(in_data)-1, -1, -1);
+ out_index=0
+ out_data=[]
+ for i in l:
+ self.debug_stream('[IOStringArray::execute] received String' % in_data[out_index])
+ out_data.append(in_data[i])
+ self.debug_stream('[IOStringArray::execute] return String %s' %out_data[out_index])
+ out_index += 1
+ self.y = out_data
+ return out_data
+
+ #------------------------------------------------------------------
+ # ATTRIBUTES
+ #------------------------------------------------------------------
+
+ def read_attr_hardware(self, data):
+ self.debug_stream('In read_attr_hardware')
+
+ #------------------------------------------------------------------
+
+ def read_Long_attr(self, the_att):
+ self.debug_stream('[PyDsExp::read_attr] attribute name Long_attr')
+
+ # Before PyTango 7.0.0
+ #PyTango.set_attribute_value(the_att, self.attr_long)
+
+ # Now:
+ the_att.set_value(self.attr_long)
+
+ #------------------------------------------------------------------
+
+ def read_Short_attr_rw(self, the_att):
+ self.debug_stream('[PyDsExp::read_attr] attribute name Short_attr_rw')
+
+ # Before PyTango 7.0.0
+ #PyTango.set_attribute_value(the_att, self.attr_short_rw)
+
+ # Now:
+ the_att.set_value(self.attr_short_rw)
+
+ #------------------------------------------------------------------
+
+ def write_Short_attr_rw(self, the_att):
+ self.debug_stream('In write_Short_attr_rw for attribute %s' % the_att.get_name())
+
+ # Before PyTango 7.0.0
+ #data = []
+ #PyTango.get_write_value(the_att, data)
+
+ # Now:
+ data = the_att.get_write_value()
+ self.attr_short_rw = data[0]
+
+ #------------------------------------------------------------------
+ # CLASS
+ #------------------------------------------------------------------
+
+ class PyDsExpClass(PyTango.DeviceClass):
+
+ def __init__(self, name):
+ PyTango.DeviceClass.__init__(self, name)
+ self.set_type("TestDevice")
+ print 'In PyDsExpClass __init__'
+
+ cmd_list = { 'IOLong' : [ [ PyTango.ArgType.DevLong, "Number" ],
+ [ PyTango.ArgType.DevLong, "Number * 2" ] ],
+ 'IOStringArray' : [ [ PyTango.ArgType.DevVarStringArray, "Array of string" ],
+ [ PyTango.ArgType.DevVarStringArray, "This reversed array"] ],
+ }
+
+ attr_list = { 'Long_attr' : [ [ PyTango.ArgType.DevLong ,
+ PyTango.AttrDataFormat.SCALAR ,
+ PyTango.AttrWriteType.READ],
+ { 'min alarm' : 1000, 'max alarm' : 1500 } ],
+
+ 'Short_attr_rw' : [ [ PyTango.ArgType.DevShort,
+ PyTango.AttrDataFormat.SCALAR,
+ PyTango.AttrWriteType.READ_WRITE ] ]
+ }
+
+ if __name__ == '__main__':
+ try:
+ util = PyTango.Util(sys.argv)
+
+ #
+ # Deprecated: util.add_TgClass(PyDsExpClass, PyDsExp, 'PyDsExp')
+ util.add_class(PyDsExpClass, PyDsExp, 'PyDsExp')
+
+ 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
+
+.. _IPython: http://ipython.scipy.org/
\ No newline at end of file
diff --git a/doc/quicktour_old.rst b/doc/quicktour_old.rst
new file mode 100644
index 0000000..fc8633e
--- /dev/null
+++ b/doc/quicktour_old.rst
@@ -0,0 +1,439 @@
+.. _quick-tour-old:
+
+A quick tour (original)
+-----------------------
+
+This quick tour will guide you through the first steps on using PyTango.
+This is the original quick tour guide that uses a simple Python console.
+There is a new version of this document which uses :ref:`spock` console in its
+examples. You can find this new version :ref:`here <quick-tour>`.
+
+Check PyTango version
+~~~~~~~~~~~~~~~~~~~~~
+
+Start a python console and type:
+
+ >>> import PyTango
+ >>> PyTango.__version__
+ '7.1.2'
+ >>> PyTango.__version_long__
+ '7.1.2dev0'
+ >>> PyTango.__version_number__
+ 712
+ >>> PyTango.__version_description__
+ 'This version implements the C++ Tango 7.1 API.'
+
+or alternatively:
+
+ >>> import PyTango
+ >>> PyTango.Release.version
+ '7.1.2'
+ >>> PyTango.Release.version_long
+ '7.1.2dev0'
+ >>> PyTango.Release.version_number
+ 712
+ >>> PyTango.Release.version_description
+ 'This version implements the C++ Tango 7.1 API.'
+
+Check Tango C++ version
+~~~~~~~~~~~~~~~~~~~~~~~
+
+From a client (This is only possible since PyTango 7.0.0)
+
+ >>> import PyTango.constants
+ >>> PyTango.constants.TgLibVers
+ '7.1.1'
+
+From a server you can alternatively do::
+
+ u = PyTango.Util.instance()
+ tg_cpp_lib_ver = u.get_tango_lib_release()
+
+
+Test the connection to the Device and get it's current state
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+One of the most basic examples is to get a reference to a device and
+determine if it is running or not::
+
+ from PyTango import *
+ import sys, os, time
+
+ # Protect the script from Exceptions
+ try:
+ # Get proxy on the tangotest1 device
+ print "Getting DeviceProxy "
+ tangotest = DeviceProxy("tango/tangotest/1")
+
+ # ping it
+ print tangotest.ping()
+
+ # get the state
+ print tangotest.state()
+
+ # First use the classical command_inout way to execute the DevString command
+ # (DevString in this case is a command of the TangoTest device)
+
+ result= tangotest.command_inout("DevString", "First hello to device")
+ print "Result of execution of DevString command=", result
+
+ # the same with a Device specific command
+ result= tangotest.DevString("Second Hello to device")
+ print "Result of execution of DevString command=", result
+
+ # Please note that argin argument type is automagically managed by python
+ result= tangotest.DevULong(12456)
+ print "Result of execution of DevULong command=", result
+
+ # Catch Tango and Systems Exceptions
+ except:
+ print "Failed with exception !"
+ print sys.exc_info()[0]
+
+Execute commands with scalar arguments on a Device
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+As you can see in the following example, when scalar types are used, the Tango
+binding automagically manages the data types, and writing scripts is quite easy::
+
+ from PyTango import *
+ import sys, os, time
+
+ tangotest = DeviceProxy("tango/tangotest/1")
+
+ # First use the classical command_inout way to execute the DevString command
+ # (DevString in this case is a command of the TangoTest device)
+
+ result= tangotest.command_inout("DevString", "First hello to device")
+ print "Result of execution of DevString command=", result
+
+ # the same with a Device specific command
+ result= tangotest.DevString("Second Hello to device")
+ print "Result of execution of DevString command=", result
+
+ # Please note that argin argument type is automagically managed by python
+ result= tangotest.DevULong(12456)
+ print "Result of execution of DevULong command=", result
+
+Execute commands with more complex types
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In this case you have to use put your arguments data in the correct python
+structures::
+
+ from PyTango import *
+ import sys, os, time
+
+ print "Getting DeviceProxy "
+ tango_test = DeviceProxy("tango/tangotest/1")
+ # The input argument is a DevVarLongStringArray
+ # so create the argin variable containing
+ # an array of longs and an array of strings
+ argin = ([1,2,3], ["Hello", "TangoTest device"])
+
+ result= tango_test.DevVarLongArray(argin)
+ print "Result of execution of DevVarLongArray command=", result
+
+Reading and writing attributes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Basic read/write attribute operations::
+
+ #Read a scalar attribute
+ scalar=tangotest.read_attribute("long_scalar")
+
+ #Read a spectrum attribute
+ spectrum=tangotest.read_attribute("double_spectrum")
+
+ # Write a scalar attribute
+ scalar_value = 18
+ tangotest.write_attribute("long_scalar", scalar_value)
+
+ # Write a spectrum attribute
+ spectrum_value = [1.2, 3.2, 12.3]
+ tangotest.write_attribute("double_spectrum", spectrum_value)
+
+ # Write an image attribute
+ image_value = [ [1, 2], [3, 4] ]
+ tangotest.write_attribute("long_image", image_value)
+
+
+Note that if PyTango is compiled with numpy support the values got when reading
+a spectrum or an image will be numpy arrays. This results in a faster and
+more memory efficient PyTango. You can also use numpy to specify the values when
+writing attributes, especially if you know the exact attribute type.::
+
+ import PyTango, numpy
+
+ # Creating an unitialized double spectrum of 1000 elements
+ spectrum_value = PyTango.numpy_spectrum(PyTango.DevDouble, 1000)
+
+ # Creating an spectrum with a range
+ # Note that I do NOT use PyTango.DevLong here, BUT PyTango.NumpyType.DevLong
+ # numpy functions do not understand normal python types, so there's a
+ # translation available in PyTango.NumpyType
+ spectrum_value = numpy.arange(5, 1000, 2, PyTango.NumpyType.DevLong)
+
+ # Creating a 2x2 long image from an existing one
+ image_value = PyTango.numpy_image(PyTango.DevLong, [[1,2],[3,4]])
+
+
+Registering devices
+~~~~~~~~~~~~~~~~~~~
+
+Defining devices in the Tango DataBase::
+
+ from PyTango import *
+ import sys, os, time
+
+ # A reference on the DataBase
+ db = Database()
+
+ # The 3 devices name we want to create
+ # Note: these 3 devices will be served by the same DServer
+ new_device_name1="px1/tdl/mouse1"
+ new_device_name2="px1/tdl/mouse2"
+ new_device_name3="px1/tdl/mouse3"
+
+ # Define the Tango Class served by this DServer
+ new_device_info_mouse = DbDevInfo()
+ new_device_info_mouse._class = "Mouse"
+ new_device_info_mouse.server = "ds_Mouse/server_mouse"
+
+ # add the first device
+ print "Creation Device:" , new_device_name1
+ new_device_info_mouse.name = new_device_name1
+ db.add_device(new_device_info_mouse)
+
+ # add the next device
+ print "Creation Device:" , new_device_name2
+ new_device_info_mouse.name = new_device_name2
+ db.add_device(new_device_info_mouse)
+ # add the third device
+ print "Creation Device:" , new_device_name3
+ new_device_info_mouse.name = new_device_name3
+ db.add_device(new_device_info_mouse)
+
+
+Setting up Device properties
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+A more complex example using python subtilities.
+The following python script example (containing some functions and instructions
+manipulating a Galil motor axis device server) gives an idea of how the Tango
+API should be accessed from Python::
+
+ from PyTango import *
+ import sys, os, time
+
+ # connecting to the motor axis device
+ axis1 = DeviceProxy ("microxas/motorisation/galilbox")
+
+ # Getting Device Properties
+ property_names = ["AxisBoxAttachement",
+ "AxisEncoderType",
+ "AxisNumber",
+ "CurrentAcceleration",
+ "CurrentAccuracy",
+ "CurrentBacklash",
+ "CurrentDeceleration",
+ "CurrentDirection",
+ "CurrentMotionAccuracy",
+ "CurrentOvershoot",
+ "CurrentRetry",
+ "CurrentScale",
+ "CurrentSpeed",
+ "CurrentVelocity",
+ "EncoderMotorRatio",
+ "logging_level",
+ "logging_target",
+ "UserEncoderRatio",
+ "UserOffset"]
+ axis_properties = axis1.get_property(property_names)
+ for prop in axis_properties.keys():
+ print "%s: %s" % (prop, axis_properties[prop][0])
+
+ # Changing Properties
+ axis_properties["AxisBoxAttachement"] = ["microxas/motorisation/galilbox"]
+ axis_properties["AxisEncoderType"] = ["1"]
+ axis_properties["AxisNumber"] = ["6"]
+ axis1.put_property(axis_properties)
+
+ # Reading attributes
+ att_list = axis.get_attribute_list()
+ for att in att_list:
+ att_val = axis.read_attribute(att)
+ print "%s: %s" % (att, att_val.value)
+
+ # Changing some attribute values
+ axis1.write_attribute("AxisBackslash", 0.5)
+ axis1.write_attribute("AxisDirection", 1.0)
+ axis1.write_attribute("AxisVelocity", 1000.0)
+ axis1.write_attribute("AxisOvershoot", 500.0)
+
+ # Testing some device commands
+ pos1=axis1.read_attribute("AxisCurrentPosition")
+ axis1.command_inout("AxisBackward")
+ while pos1.value > 1000.0:
+ pos1=axis1.read_attribute("AxisCurrentPosition")
+ print "position axis 1 = ",pos1.value
+ axis1.command_inout("AxisStop")
+
+A quick tour of Tango device server binding through an example
+--------------------------------------------------------------
+
+To write a tango device server in python, you need to import two modules in your script which are:
+
+1. The PyTango module
+
+2. The python sys module provided in the classical python distribution
+
+The following in the python script for a Tango device server with two commands and two attributes. The commands are:
+
+1. IOLOng which receives a Tango Long and return it multiply by 2. This command is allowed only if the device is in the ON state.
+
+2. IOStringArray which receives an array of Tango strings and which returns it but in the reverse order. This command is only allowed if the device is in the ON state.
+
+The attributes are:
+
+1. Long_attr wich is a Tango long attribute, Scalar and Read only with a minimum alarm set to 1000 and a maximum alarm set to 1500
+
+2. Short_attr_rw which is a Tango short attribute, Scalar and Read/Write
+
+The following code is the complete device server code::
+
+ import PyTango
+ import sys
+
+ class PyDsExp(PyTango.Device_3Impl):
+
+ def __init__(self,cl,name):
+ PyTango.Device_3Impl.__init__(self,cl,name)
+ self.debug_stream('In PyDsExp __init__')
+ PyDsExp.init_device(self)
+
+ def init_device(self):
+ self.debug_stream('In Python init_device method')
+ self.set_state(PyTango.DevState.ON)
+ self.attr_short_rw = 66
+ self.attr_long = 1246
+
+ #------------------------------------------------------------------
+
+ def delete_device(self):
+ self.debug_stream('[delete_device] for device %s ' % self.get_name())
+
+ #------------------------------------------------------------------
+ # COMMANDS
+ #------------------------------------------------------------------
+
+ def is_IOLong_allowed(self):
+ return self.get_state() == PyTango.DevState.ON
+
+ def IOLong(self, in_data):
+ self.debug_stream('[IOLong::execute] received number %s' % str(in_data))
+ in_data = in_data * 2;
+ self.debug_stream('[IOLong::execute] return number %s' % str(in_data))
+ return in_data;
+
+ #------------------------------------------------------------------
+
+ def is_IOStringArray_allowed(self):
+ return self.get_state() == PyTango.DevState.ON
+
+ def IOStringArray(self, in_data):
+ l = range(len(in_data)-1, -1, -1);
+ out_index=0
+ out_data=[]
+ for i in l:
+ self.debug_stream('[IOStringArray::execute] received String' % in_data[out_index])
+ out_data.append(in_data[i])
+ self.debug_stream('[IOStringArray::execute] return String %s' %out_data[out_index])
+ out_index += 1
+ self.y = out_data
+ return out_data
+
+ #------------------------------------------------------------------
+ # ATTRIBUTES
+ #------------------------------------------------------------------
+
+ def read_attr_hardware(self, data):
+ self.debug_stream('In read_attr_hardware')
+
+ #------------------------------------------------------------------
+
+ def read_Long_attr(self, the_att):
+ self.debug_stream('[PyDsExp::read_attr] attribute name Long_attr')
+
+ # Before PyTango 7.0.0
+ #PyTango.set_attribute_value(the_att, self.attr_long)
+
+ # Now:
+ the_att.set_value(self.attr_long)
+
+ #------------------------------------------------------------------
+
+ def read_Short_attr_rw(self, the_att):
+ self.debug_stream('[PyDsExp::read_attr] attribute name Short_attr_rw')
+
+ # Before PyTango 7.0.0
+ #PyTango.set_attribute_value(the_att, self.attr_short_rw)
+
+ # Now:
+ the_att.set_value(self.attr_short_rw)
+
+ #------------------------------------------------------------------
+
+ def write_Short_attr_rw(self, the_att):
+ self.debug_stream('In write_Short_attr_rw for attribute %s' % the_att.get_name())
+
+ # Before PyTango 7.0.0
+ #data = []
+ #PyTango.get_write_value(the_att, data)
+
+ # Now:
+ data = the_att.get_write_value()
+ self.attr_short_rw = data[0]
+
+ #------------------------------------------------------------------
+ # CLASS
+ #------------------------------------------------------------------
+
+ class PyDsExpClass(PyTango.DeviceClass):
+
+ def __init__(self, name):
+ PyTango.DeviceClass.__init__(self, name)
+ self.set_type("TestDevice")
+ print 'In PyDsExpClass __init__'
+
+ cmd_list = { 'IOLong' : [ [ PyTango.ArgType.DevLong, "Number" ],
+ [ PyTango.ArgType.DevLong, "Number * 2" ] ],
+ 'IOStringArray' : [ [ PyTango.ArgType.DevVarStringArray, "Array of string" ],
+ [ PyTango.ArgType.DevVarStringArray, "This reversed array"] ],
+ }
+
+ attr_list = { 'Long_attr' : [ [ PyTango.ArgType.DevLong ,
+ PyTango.AttrDataFormat.SCALAR ,
+ PyTango.AttrWriteType.READ],
+ { 'min alarm' : 1000, 'max alarm' : 1500 } ],
+
+ 'Short_attr_rw' : [ [ PyTango.ArgType.DevShort,
+ PyTango.AttrDataFormat.SCALAR,
+ PyTango.AttrWriteType.READ_WRITE ] ]
+ }
+
+ if __name__ == '__main__':
+ try:
+ util = PyTango.Util(sys.argv)
+
+ #
+ # Deprecated: util.add_TgClass(PyDsExpClass, PyDsExp, 'PyDsExp')
+ util.add_class(PyDsExpClass, PyDsExp, 'PyDsExp')
+
+ 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
diff --git a/doc/revision.rst b/doc/revision.rst
new file mode 100644
index 0000000..4e9c2b8
--- /dev/null
+++ b/doc/revision.rst
@@ -0,0 +1,160 @@
+.. _revision:
+
+Revision
+--------
+
+:Contributers: T\. Coutinho
+
+:Last Update: |today|
+
+.. _history-modifications:
+
+History of modifications:
+
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| Date | Revision | Description | Author |
++==========+==================================================================================+=====================================================+=======================+
+| 18/07/03 | 1.0 | Initial Version | M\. Ounsy |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 06/10/03 | 2.0 | Extension of the "Getting Started" paragraph | A\. Buteau/M\. Ounsy |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 14/10/03 | 3.0 | Added Exception Handling paragraph | M\. Ounsy |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 13/06/05 | 4.0 | Ported to Latex, added events, AttributeProxy | V\. Forchì |
+| | | and ApiUtil | |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| | | fixed bug with python 2.5 and and state events | |
+| 13/06/05 | 4.1 | new Database constructor | V\. Forchì |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 15/01/06 | 5.0 | Added Device Server classes | E\.Taurel |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 15/03/07 | 6.0 | Added AttrInfoEx, AttributeConfig events, 64bits, | T\. Coutinho |
+| | | write_attribute | |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 21/03/07 | 6.1 | Added groups | T\. Coutinho |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 15/06/07 | `6.2 <http://www.tango-controls.org/Documents/bindings/PyTango-3.0.3.pdf>`_ | Added dynamic attributes doc | E\. Taurel |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 06/05/08 | `7.0 <http://www.tango-controls.org/Documents/bindings/PyTango-3.0.4.pdf>`_ | Update to Tango 6.1. Added DB methods, version info | T\. Coutinho |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 10/07/09 | `8.0 <http://www.tango-controls.org/static/PyTango/v7/doc/html/index.html>`_ | Update to Tango 7. Major refactoring. Migrated doc | T\. Coutinho/R\. Suñe |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 24/07/09 | `8.1 <http://www.tango-controls.org/static/PyTango/v7/doc/html/index.html>`_ | Added migration info, added missing API doc | T\. Coutinho/R\. Suñe |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 21/09/09 | `8.2 <http://www.tango-controls.org/static/PyTango/v7/doc/html/index.html>`_ | Added migration info, release of 7.0.0beta2 | T\. Coutinho/R\. Suñe |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 12/11/09 | `8.3 <http://www.tango-controls.org/static/PyTango/v71/doc/html/index.html>`_ | Update to Tango 7.1. | T\. Coutinho/R\. Suñe |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| ??/12/09 | `8.4 <http://www.tango-controls.org/static/PyTango/v71rc1/doc/html/index.html>`_ | Update to PyTango 7.1.0 rc1 | T\. Coutinho/R\. Suñe |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 19/02/10 | `8.5 <http://www.tango-controls.org/static/PyTango/v711/doc/html/index.html>`_ | Update to PyTango 7.1.1 | T\. Coutinho/R\. Suñe |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 06/08/10 | `8.6 <http://www.tango-controls.org/static/PyTango/v712/doc/html/index.html>`_ | Update to PyTango 7.1.2 | T\. Coutinho |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+| 05/11/10 | `8.7 <http://www.tango-controls.org/static/PyTango/v712/doc/html/index.html>`_ | Update to PyTango 7.1.3 | T\. Coutinho |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+
+.. _version-history:
+
+Version history
+---------------
+
++------------+-------------------------------------------------------------------------------------+
+| version | Changes |
++============+=====================================================================================+
+| 7.1.3 | Features: |
+| | - tango logging with print statement |
+| | - tango logging with decorators |
+| | - from sourceforge: |
+| | - 3060380: ApiUtil should be exported to PyTango |
+| | |
+| | Bug fixes: |
+| | - added licence header to all source code files |
+| | - spock didn't work without TANGO_HOST env. variable (it didn't recognize |
+| | tangorc) |
+| | - spock should give a proper message if it tries to be initialized outside |
+| | ipython |
+| | - from sourceforge: |
+| | - 3048798: licence issue GPL != LGPL |
+| | - 3073378: DeviceImpl.signal_handler raising exception crashes DS |
+| | - 3088031: Python DS unable to read DevVarBooleanArray property |
+| | - 3102776: PyTango 7.1.2 does not work with python 2.4 & boost 1.33.0 |
+| | - 3102778: Fix compilation warnings in linux |
++------------+-------------------------------------------------------------------------------------+
+| 7.1.2 | Features: |
+| | - from sourceforge: |
+| | - 2995964: Dynamic device creation |
+| | - 3010399: The DeviceClass.get_device_list that exists in C++ is missing |
+| | - 3023686: Missing DeviceProxy.<attribute name> |
+| | - 3025396: DeviceImpl is missing some CORBA methods |
+| | - 3032005: IPython extension for PyTango |
+| | - 3033476: Make client objects pickable |
+| | - 3039902: PyTango.Util.add_class would be useful |
+| | |
+| | Bug fixes: |
+| | - from sourceforge: |
+| | - 2975940: DS command with DevVarCharArray return type fails |
+| | - 3000467: DeviceProxy.unlock is LOCKING instead of unlocking! |
+| | - 3010395: Util.get_device_* methods don't work |
+| | - 3010425: Database.dev_name does not work |
+| | - 3016949: command_inout_asynch callback does not work |
+| | - 3020300: PyTango does not compile with gcc 4.1.x |
+| | - 3030399: Database put(delete)_attribute_alias generates segfault |
++------------+-------------------------------------------------------------------------------------+
+| 7.1.1 | Features: |
+| | - Improved setup script |
+| | - Interfaced with PyPI |
+| | - Cleaned build script warnings due to unclean python C++ macro definitions |
+| | - from sourceforge: 2985993, 2971217 |
+| | |
+| | Bug fixes: |
+| | - from sourceforge: 2983299, 2953689, 2953030 |
++------------+-------------------------------------------------------------------------------------+
+| 7.1.0 | Features: |
+| | - from sourceforge: |
+| | - 2908176: read_*, write_* and is_*_allowed() methods can now be defined |
+| | - 2941036: TimeVal conversion to time and datetime |
+| | - added str representation on Attr, Attribute, DeviceImpl and DeviceClass |
+| | |
+| | Bug fixes: |
+| | - from sourceforge: 2903755, 2908176, 2914194, 2909927, 2936173, 2949099 |
++------------+-------------------------------------------------------------------------------------+
+| 7.1.0rc1 | Features: |
+| | - v = image_attribute.get_write_value() returns square sequences (arrays of |
+| | arrays, or numpy objects) now instead of flat lists. Also for spectrum |
+| | attributes a numpy is returned by default now instead. |
+| | - image_attribute.set_value(v) accepts numpy arrays now or square sequences |
+| | instead of just flat lists. So, dim_x and dim_y are useless now. Also the |
+| | numpy path is faster. |
+| | - new enum AttrSerialModel |
+| | - Attribute new methods: set(get)_attr_serial_model, set_change_event, |
+| | set_archive_event, is_change_event, is_check_change_event, |
+| | is_archive_criteria, is_check_archive_criteria, remove_configuration |
+| | - added support for numpy scalars in tango operations like write_attribute |
+| | (ex: now a DEV_LONG attribute can receive a numpy.int32 argument in a |
+| | write_attribute method call) |
+| | |
+| | Bug fixes: |
+| | - DeviceImpl.set_value for scalar attributes |
+| | - DeviceImpl.push_***_event |
+| | - server commands with DevVar***StringArray as parameter or as return type |
+| | - in windows,a bug in PyTango.Util prevented servers from starting up |
+| | - DeviceImpl.get_device_properties for string properties assigns only first |
+| | character of string to object member instead of entire string |
+| | - added missing methods to Util |
+| | - exported SubDevDiag class |
+| | - error in read/events of attributes of type DevBoolean READ_WRITE |
+| | - error in automatic unsubscribe events of DeviceProxy when the object |
+| | disapears (happens only on some compilers with some optimization flags) |
+| | - fix possible bug when comparing attribute names in DeviceProxy |
+| | - pretty print of DevFailed -> fix deprecation warning in python 2.6 |
+| | - device class properties where not properly fetched when there is no |
+| | property value defined |
+| | - memory leak when converting DevFailed exceptions from C++ to python |
+| | - python device server file without extension does not start |
+| | |
+| | Documentation: |
+| | - Improved FAQ |
+| | - Improved compilation chapter |
+| | - Improved migration information |
++------------+-------------------------------------------------------------------------------------+
diff --git a/doc/server/index.rst b/doc/server/index.rst
index c11158e..df1d033 100644
--- a/doc/server/index.rst
+++ b/doc/server/index.rst
@@ -17,12 +17,14 @@ IOLong and IOStringArray and two attributes called Long_attr and Short_attr_rw.
Importing python modules
------------------------
-To write a Python script which is a Tango device server, you need to import two modules which are :
+To write a Python script which is a Tango device server, you need to import
+two modules which are:
1. The :mod:`PyTango` module which is the Python to C++ interface
2. The Python classical sys module
-This could be done with code like (supposing the PYTHONPATH environment variable is correctly set)::
+This could be done with code like (supposing the PYTHONPATH environment variable
+is correctly set)::
import PyTango
import sys
@@ -31,17 +33,17 @@ The main part of a Python device server
---------------------------------------
The rule of this part of a Tango device server is to:
-- Create the :class:`PyTango.Util` object passing it the Python interpreter command line arguments
-- Add to this object the list of Tango class(es) which have to be hosted by this interpreter
-- Initialize the device server
-- Run the device server loop
+ - Create the :class:`Util` object passing it the Python interpreter command line arguments
+ - Add to this object the list of Tango class(es) which have to be hosted by this interpreter
+ - Initialize the device server
+ - Run the device server loop
The following is a typical code for this main function::
if __name__ == '__main__':
util = PyTango.Util(sys.argv)
#Deprecated : util.add_TgClass(PyDsExpClass, PyDsExp, 'PyDsExp')
- util.add_class(PyDsExpClass, PyDsExp, 'PyDsExp')
+ util.add_class(PyDsExpClass, PyDsExp)
U = PyTango.Util.instance()
U.server_init()
@@ -50,15 +52,15 @@ The following is a typical code for this main function::
**Line 2**
Create the Util object passing it the interpreter command line arguments
**Line 4**
- Add the Tango class 'PyDsExp' to the device server. The add_class()
- method of the Util class has three arguments which are the Tango class
- PyDsExpClass instance, the Tango PyDsExp instance and the Tango class name.
- This :meth:`PyTango.Util.add_class` method is only available since version
+ Add the Tango class *PyDsExp* to the device server. The :meth:`Util.add_class`
+ method of the Util class has two arguments which are the Tango class
+ PyDsExpClass instance and the Tango PyDsExp instance.
+ This :meth:`Util.add_class` method is only available since version
7.1.2. If you are using an older version please use
- :meth:`PyTango.Util.add_TgClass` instead.
-**Line 6**
- Initialize the Tango device server
+ :meth:`Util.add_TgClass` instead.
**Line 7**
+ Initialize the Tango device server
+**Line 8**
Run the device server loop
The PyDsExpClass class in Python
@@ -89,6 +91,8 @@ In our example, the code of this Python class looks like::
PyTango.AttrWriteType.READ_WRITE ] ]
}
+
+
**Line 1**
The PyDsExpClass class has to inherit from the PyTango.PyDeviceClass class
@@ -207,89 +211,76 @@ In our example, the code of this class looks like::
def __init__(self,cl,name):
PyTango.Device_4Impl.__init__(self, cl, name)
- print 'In PyDsExp __init__'
+ self.info_stream('In PyDsExp.__init__')
PyDsExp.init_device(self)
def init_device(self):
- print 'In Python init_device method'
+ self.info_stream('In Python init_device method')
self.set_state(PyTango.DevState.ON)
self.attr_short_rw = 66
self.attr_long = 1246
- #------------------------------------------------------------------
+ #------------------------------------------------------------------
def delete_device(self):
- print "[Device delete_device method] for device",self.get_name()
+ self.info_stream('PyDsExp.delete_device')
- #------------------------------------------------------------------
- # COMMANDS
- #------------------------------------------------------------------
+ #------------------------------------------------------------------
+ # COMMANDS
+ #------------------------------------------------------------------
def is_IOLong_allowed(self):
return self.get_state() == PyTango.DevState.ON
def IOLong(self, in_data):
- print "[IOLong::execute] received number",in_data
- in_data = in_data * 2;
- print "[IOLong::execute] return number",in_data
- return in_data;
+ self.info_stream('IOLong', in_data)
+ in_data = in_data * 2
+ self.info_stream('IOLong returns', in_data)
+ return in_data
- #------------------------------------------------------------------
+ #------------------------------------------------------------------
def is_IOStringArray_allowed(self):
return self.get_state() == PyTango.DevState.ON
def IOStringArray(self, in_data):
- l = range(len(in_data)-1, -1, -1);
+ l = range(len(in_data)-1, -1, -1)
out_index=0
out_data=[]
for i in l:
- print "[IOStringArray::execute] received String",in_data[out_index]
+ self.info_stream('IOStringArray <-', in_data[out_index])
out_data.append(in_data[i])
- print "[IOStringArray::execute] return String",out_data[out_index]
+ self.info_stream('IOStringArray ->',out_data[out_index])
out_index += 1
self.y = out_data
return out_data
- #------------------------------------------------------------------
- # ATTRIBUTES
- #------------------------------------------------------------------
+ #------------------------------------------------------------------
+ # ATTRIBUTES
+ #------------------------------------------------------------------
def read_attr_hardware(self, data):
- print 'In read_attr_hardware'
+ self.info_stream('In read_attr_hardware')
- #------------------------------------------------------------------
+ #------------------------------------------------------------------
def read_Long_attr(self, the_att):
- print "[PyDsExp::read_attr] attribute name Long_attr"
+ self.info_stream("read_Long_attr")
- # Before PyTango 7.0.0
- #PyTango.set_attribute_value(the_att, self.attr_long)
-
- # Now:
the_att.set_value(self.attr_long)
- #------------------------------------------------------------------
+ #------------------------------------------------------------------
def read_Short_attr_rw(self, the_att):
- print "[PyDsExp::read_attr] attribute name Short_attr_rw"
+ self.info_stream("read_Short_attr_rw")
- # Before PyTango 7.0.0
- #PyTango.set_attribute_value(the_att, self.attr_short_rw)
-
- # Now:
the_att.set_value(self.attr_short_rw)
- #------------------------------------------------------------------
+ #------------------------------------------------------------------
def write_Short_attr_rw(self, the_att):
- print "In write_Short_attr_rw for attribute ",the_att.get_name()
+ self.info_stream("write_Short_attr_rw")
- # Before PyTango 7.0.0
- #data = []
- #PyTango.get_write_value(the_att, data)
-
- # Now:
self.attr_short_rw = the_att.get_write_value()
**Line 1**
@@ -318,14 +309,14 @@ In our example, the code of this class looks like::
**Line 53 to 54**
The *read_attr_hardware()* method. Its argument is a Python sequence of
Python integer.
-**Line 58 to 65**
+**Line 58 to 61**
The method executed when the Long_attr attribute is read. Note that before
PyTango 7 it sets the attribute value with the PyTango.set_attribute_value
function. Now the same can be done using the set_value of the attribute
object
-**Line 69 to 76**
+**Line 65 to 68**
The method executed when the Short_attr_rw attribute is read.
-**Line 80 to 89**
+**Line 72 to 75**
The method executed when the Short_attr_rw attribute is written.
Note that before PyTango 7 it gets the attribute value with a call to the
Attribute method *get_write_value* with a list as argument. Now the write
@@ -449,34 +440,33 @@ of the appropiate type for output arguments as well, as it is much more efficien
+-------------------------+-------------------------------------------+
The following code is an example of how you write code executed when a client
-read an attribute which is called Long_attr::
-
- def read_Long_attr(self, the_att):
- print "[PyDsExp::read_attr] attribute name Long_attr"
- the_att.set_value(self.attr_long)
-
-**Line 1**
- Method declaration with "the_att" being an instance of the Attribute class
- representing the Long_attr attribute
-**Line 3**
- Set the attribute value using the method set_value() with the attribute
- value as parameter
+calls a command named IOLong::
+
+ def is_IOLong_allowed(self):
+ self.debug_stream("in is_IOLong_allowed")
+ return self.get_state() == PyTango.DevState.ON
+
+ def IOLong(self, in_data):
+ self.info_stream('IOLong', in_data)
+ in_data = in_data * 2
+ self.info_stream('IOLong returns', in_data)
+ return in_data
+
+**Line 1-3**
+ the is_IOLong_allowed method determines in which conditions the command
+ 'IOLong' can be executed. In this case, the command can only be executed if
+ the device is in 'ON' state.
+**Line 6**
+ write a log message to the tango INFO stream (click :ref:`here <logging>` for
+ more information about PyTango log system).
+**Line 7**
+ does something with the input parameter
+**Line 8**
+ write another log message to the tango INFO stream (click :ref:`here <logging>` for
+ more information about PyTango log system).
+**Line 9**
+ return the output of executing the tango command
-The following code is an example of how you write code executed when a client
-write the Short_attr_rw attribute::
-
- def write_Short_attr_rw(self, the_att):
- print "In write_Short_attr_rw for attribute ",the_att.get_name()
- self.attr_short_rw = the_att.get_write_value()
-
-**Line 1**
- Method declaration with "the_att" being an instance of the Attribute class
- representing the Short_attr_rw attribute
-**Line 3**
- Get the value sent by the client using the method *get_write_value()* and
- store it in the device object. Our attribute is a scalar short attribute so
- the return value is an int.
-
Implementing an attribute
#########################
@@ -569,12 +559,15 @@ The following code is an example of how you write code executed when a client re
called Long_attr::
def read_Long_attr(self, the_att):
- print "[PyDsExp::read_attr] attribute name Long_attr"
+ self.info_stream("read attribute name Long_attr")
the_att.set_value(self.attr_long)
**Line 1**
Method declaration with "the_att" being an instance of the Attribute
class representing the Long_attr attribute
+**Line 2**
+ write a log message to the tango INFO stream (click :ref:`here <logging>` for
+ more information about PyTango log system).
**Line 3**
Set the attribute value using the method set_value() with the attribute
value as parameter.
@@ -583,20 +576,136 @@ The following code is an example of how you write code executed when a client
write the Short_attr_rw attribute::
def write_Short_attr_rw(self,the_att):
- print "In write_Short_attr_rw for attribute ",the_att.get_name()
+ self.info_stream("In write_Short_attr_rw for attribute ",the_att.get_name())
self.attr_short_rw = the_att.get_write_value(data)
**Line 1**
Method declaration with "the_att" being an instance of the Attribute
class representing the Short_attr_rw attribute
+**Line 2**
+ write a log message to the tango INFO stream (click :ref:`here <logging>` for
+ more information about PyTango log system).
**Line 3**
Get the value sent by the client using the method get_write_value() and
store the value written in the device object. Our attribute is a scalar
short attribute so the return value is an int
+.. _logging:
+
+Logging
+#######
+
+This chapter instructs you on how to use the tango logging API (log4tango) to
+create tango log messages on your device server.
+
+The logging system explained here is the Tango Logging Service (TLS). For
+detailed information on how this logging system works please check:
+
+ * `3.5 The tango logging service <http://www.esrf.eu/computing/cs/tango/tango_doc/kernel_doc/ds_prog/node4.html#sec:The-Tango-Logging>`_
+ * `9.3 The tango logging service <http://www.esrf.eu/computing/cs/tango/tango_doc/kernel_doc/ds_prog/node9.html#SECTION00930000000000000000>`_
+
+The easiest way to start seeing log messages on your device server console is
+by starting it with the verbose option. Example::
+
+ python PyDsExp.py PyDs1 -v4
+
+This activates the console tango logging target and filters messages with
+importance level DEBUG or more.
+The links above provided detailed information on how to configure log levels
+and log targets. In this document we will focus on how to write log messages on
+your device server.
+
+Basic logging
+~~~~~~~~~~~~~
+
+The most basic way to write a log message on your device is to use the
+:class:`PyTango.DeviceImpl` logging related methods:
+
+ * :meth:`PyTango.DeviceImpl.debug_stream`
+ * :meth:`PyTango.DeviceImpl.info_stream`
+ * :meth:`PyTango.DeviceImpl.warn_stream`
+ * :meth:`PyTango.DeviceImpl.error_stream`
+ * :meth:`PyTango.DeviceImpl.fatal_stream`
+
+Example::
+
+ def read_Long_attr(self, the_att):
+ self.info_stream("read attribute name Long_attr")
+ the_att.set_value(self.attr_long)
+
+This will print a message like::
+
+ 1282206864 [-1215867200] INFO test/pydsexp/1 read attribute name Long_attr
+
+every time a client asks to read the 'Long_attr' attribute value.
+
+Logging with print statement
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+*This feature is only possible since PyTango 7.1.3*
+
+It is possible to use the print statement to log messages into the tango logging
+system. This is achieved by using the python's print extend form sometimes
+refered to as *print chevron*.
+
+Same example as above, but now using *print chevron*::
+
+ def read_Long_attr(self, the_att):
+ print >>self.log_info, "read attribute name Long_attr"
+ the_att.set_value(self.attr_long)
+
+Or using the python 3k print function::
+
+ def read_Long_attr(self, the_att):
+ print("read attribute name Long_attr", file=self.log_info)
+ the_att.set_value(self.attr_long)
+
+Logging with decorators
+~~~~~~~~~~~~~~~~~~~~~~~
+
+*This feature is only possible since PyTango 7.1.3*
+
+PyTango provides a set of decorators that place automatic log messages when
+you enter and when you leave a python method. For example::
+
+ @PyTango.DebugIt()
+ def read_Long_attr(self, the_att):
+ the_att.set_value(self.attr_long)
+
+will generate a pair of log messages each time a client asks for the 'Long_attr'
+value. Your output would look something like::
+
+ 1282208997 [-1215965504] DEBUG test/pydsexp/1 -> read_Long_attr()
+ 1282208997 [-1215965504] DEBUG test/pydsexp/1 <- read_Long_attr()
+
+Decorators exist for all tango log levels:
+ * :class:`PyTango.DebugIt`
+ * :class:`PyTango.InfoIt`
+ * :class:`PyTango.WarnIt`
+ * :class:`PyTango.ErrorIt`
+ * :class:`PyTango.FatalIt`
+
+The decorators receive three optional arguments:
+ * show_args - shows method arguments in log message (defaults to False)
+ * show_kwargs shows keyword method arguments in log message (defaults to False)
+ * show_ret - shows return value in log message (defaults to False)
+
+Example::
+
+ @PyTango.DebugIt(show_args=True, show_ret=True)
+ def IOLong(self, in_data):
+ return in_data * 2
+
+will output something like::
+
+ 1282221947 [-1261438096] DEBUG test/pydsexp/1 -> IOLong(23)
+ 1282221947 [-1261438096] DEBUG test/pydsexp/1 46 <- IOLong()
+
Dynamic devices
###############
+*This feature is only possible since PyTango 7.1.2*
+
Starting from PyTango 7.1.2 it is possible to create devices in a device server
"en caliente". This means that you can create a command in your "management device"
of a device server that creates devices of (possibly) several other tango classes.
@@ -605,9 +714,9 @@ There are two ways to create a new device which are described below.
Dynamic device from a known tango class name
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If you know the tango class name but you don't have access to the :ref:`PyTango.DeviceClass`
+If you know the tango class name but you don't have access to the :class:`PyTango.DeviceClass`
(or you are too lazy to search how to get it ;-) the way to do it is call
-:ref:`PyTango.Util.create_device`/:ref:`PyTango.Util.delete_device`.
+:meth:`PyTango.Util.create_device` / :meth:`PyTango.Util.delete_device`.
Here is an example of implementing a tango command on one of your devices that
creates a device of some arbitrary class (the example assumes the tango commands
'CreateDevice' and 'DeleteDevice' receive a parameter of type DevVarStringArray
@@ -634,9 +743,9 @@ here.
Dynamic device from a known tango class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-If you already have access to the :ref:`PyTango.DeviceClass` object that
+If you already have access to the :class:`PyTango.DeviceClass` object that
corresponds to the tango class of the device to be created you can call directly
-the :ref:`PyTango.DeviceClass.create_device`/:ref:`PyTango.DeviceClass.delete_device`.
+the :meth:`PyTango.DeviceClass.create_device` / :meth:`PyTango.DeviceClass.delete_device`.
For example, if you wish to create a clone of your device, you can create a
tango command called Clone::
@@ -763,5 +872,6 @@ Server API
device
device_class
+ logging
attribute
util
diff --git a/doc/server/logging.rst b/doc/server/logging.rst
new file mode 100644
index 0000000..704b953
--- /dev/null
+++ b/doc/server/logging.rst
@@ -0,0 +1,40 @@
+Logging decorators
+==================
+
+.. currentmodule:: PyTango
+
+LogIt
+-----
+
+.. autoclass:: PyTango.LogIt
+ :members:
+
+DebugIt
+-------
+
+.. autoclass:: PyTango.DebugIt
+ :members:
+
+InfoIt
+------
+
+.. autoclass:: PyTango.InfoIt
+ :members:
+
+WarnIt
+-------
+
+.. autoclass:: PyTango.WarnIt
+ :members:
+
+ErrorIt
+-------
+
+.. autoclass:: PyTango.ErrorIt
+ :members:
+
+FatalIt
+-------
+
+.. autoclass:: PyTango.FatalIt
+ :members:
diff --git a/doc/sphinxext/ipython_console_highlighting.pyc b/doc/sphinxext/ipython_console_highlighting.pyc
deleted file mode 100644
index 755127b..0000000
Binary files a/doc/sphinxext/ipython_console_highlighting.pyc and /dev/null differ
diff --git a/doc/sphinxext/spock_console_highlighting.py.orig b/doc/sphinxext/spock_console_highlighting.py.orig
deleted file mode 100644
index de27155..0000000
--- a/doc/sphinxext/spock_console_highlighting.py.orig
+++ /dev/null
@@ -1,114 +0,0 @@
-"""reST directive for syntax-highlighting spock interactive sessions.
-
-XXX - See what improvements can be made based on the new (as of Sept 2009)
-'pycon' lexer for the python console. At the very least it will give better
-highlighted tracebacks.
-"""
-
-#-----------------------------------------------------------------------------
-# Needed modules
-
-# Standard library
-import re
-
-# Third party
-from pygments.lexer import Lexer, do_insertions
-from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer,
- PythonTracebackLexer)
-from pygments.token import Comment, Generic
-
-from sphinx import highlighting
-
-#-----------------------------------------------------------------------------
-# Global constants
-line_re = re.compile('.*?\n')
-
-#-----------------------------------------------------------------------------
-# Code begins - classes and functions
-
-class SpockConsoleLexer(Lexer):
- """
- For spock console output or doctests, such as:
-
- .. sourcecode:: spock
-
- In [1]: a = 'foo'
-
- In [2]: a
- Out[2]: 'foo'
-
- In [3]: print a
- foo
-
- In [4]: 1 / 0
-
- Notes:
-
- - Tracebacks are not currently supported.
-
- - It assumes the default spock prompts, not customized ones.
- """
-
- name = 'Spock console session'
- aliases = ['spock']
- mimetypes = ['text/x-spock-console']
- input_prompt = re.compile("(In \[[0-9]+\]: )|( \.\.\.+:)")
- output_prompt = re.compile("(Out\[[0-9]+\]: )|( \.\.\.+:)")
- continue_prompt = re.compile(" \.\.\.+:")
- tb_start = re.compile("\-+")
-
- def get_tokens_unprocessed(self, text):
- pylexer = PythonLexer(**self.options)
- tblexer = PythonTracebackLexer(**self.options)
-
- curcode = ''
- insertions = []
- for match in line_re.finditer(text):
- line = match.group()
- input_prompt = self.input_prompt.match(line)
- continue_prompt = self.continue_prompt.match(line.rstrip())
- output_prompt = self.output_prompt.match(line)
- if line.startswith("#"):
- insertions.append((len(curcode),
- [(0, Comment, line)]))
- elif input_prompt is not None:
- insertions.append((len(curcode),
- [(0, Generic.Prompt, input_prompt.group())]))
- curcode += line[input_prompt.end():]
- elif continue_prompt is not None:
- insertions.append((len(curcode),
- [(0, Generic.Prompt, continue_prompt.group())]))
- curcode += line[continue_prompt.end():]
- elif output_prompt is not None:
- # Use the 'error' token for output. We should probably make
- # our own token, but error is typicaly in a bright color like
- # red, so it works fine for our output prompts.
- insertions.append((len(curcode),
- [(0, Generic.Error, output_prompt.group())]))
- curcode += line[output_prompt.end():]
- else:
- if curcode:
- for item in do_insertions(insertions,
- pylexer.get_tokens_unprocessed(curcode)):
- yield item
- curcode = ''
- insertions = []
- yield match.start(), Generic.Output, line
- if curcode:
- for item in do_insertions(insertions,
- pylexer.get_tokens_unprocessed(curcode)):
- yield item
-
-
-def setup(app):
- """Setup as a sphinx extension."""
-
- # This is only a lexer, so adding it below to pygments appears sufficient.
- # But if somebody knows that the right API usage should be to do that via
- # sphinx, by all means fix it here. At least having this setup.py
- # suppresses the sphinx warning we'd get without it.
- pass
-
-#-----------------------------------------------------------------------------
-# Register the extension as a valid pygments lexer
-highlighting.lexers['spock'] = SpockConsoleLexer()
\ No newline at end of file
diff --git a/doc/sphinxext/spock_console_highlighting.pyc b/doc/sphinxext/spock_console_highlighting.pyc
deleted file mode 100644
index e7668d5..0000000
Binary files a/doc/sphinxext/spock_console_highlighting.pyc and /dev/null differ
diff --git a/ez_setup.py b/ez_setup.py
new file mode 100644
index 0000000..1ff1d3e
--- /dev/null
+++ b/ez_setup.py
@@ -0,0 +1,284 @@
+#!python
+"""Bootstrap setuptools installation
+
+If you want to use setuptools in your package's setup.py, just include this
+file in the same directory with it, and add this to the top of your setup.py::
+
+ from ez_setup import use_setuptools
+ use_setuptools()
+
+If you want to require a specific version of setuptools, set a download
+mirror, or use an alternate download directory, you can do so by supplying
+the appropriate options to ``use_setuptools()``.
+
+This file can also be run as a script to install or upgrade setuptools.
+"""
+import sys
+DEFAULT_VERSION = "0.6c11"
+DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
+
+md5_data = {
+ 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
+ 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
+ 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
+ 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
+ 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
+ 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
+ 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
+ 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
+ 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
+ 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
+ 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090',
+ 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4',
+ 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7',
+ 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5',
+ 'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de',
+ 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b',
+ 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2',
+ 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086',
+ 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
+ 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
+ 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
+ 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
+ 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
+ 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
+ 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
+ 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
+ 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
+ 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
+ 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
+ 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
+ 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
+ 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
+ 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
+ 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
+ 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
+ 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
+ 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
+ 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
+ 'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03',
+ 'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a',
+ 'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6',
+ 'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a',
+}
+
+import sys, os
+try: from hashlib import md5
+except ImportError: from md5 import md5
+
+def _validate_md5(egg_name, data):
+ if egg_name in md5_data:
+ digest = md5(data).hexdigest()
+ if digest != md5_data[egg_name]:
+ print >>sys.stderr, (
+ "md5 validation of %s failed! (Possible download problem?)"
+ % egg_name
+ )
+ sys.exit(2)
+ return data
+
+def use_setuptools(
+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
+ download_delay=15
+):
+ """Automatically find/download setuptools and make it available on sys.path
+
+ `version` should be a valid setuptools version number that is available
+ as an egg for download under the `download_base` URL (which should end with
+ a '/'). `to_dir` is the directory where setuptools will be downloaded, if
+ it is not already available. If `download_delay` is specified, it should
+ be the number of seconds that will be paused before initiating a download,
+ should one be required. If an older version of setuptools is installed,
+ this routine will print a message to ``sys.stderr`` and raise SystemExit in
+ an attempt to abort the calling script.
+ """
+ was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
+ def do_download():
+ egg = download_setuptools(version, download_base, to_dir, download_delay)
+ sys.path.insert(0, egg)
+ import setuptools; setuptools.bootstrap_install_from = egg
+ try:
+ import pkg_resources
+ except ImportError:
+ return do_download()
+ try:
+ pkg_resources.require("setuptools>="+version); return
+ except pkg_resources.VersionConflict, e:
+ if was_imported:
+ print >>sys.stderr, (
+ "The required version of setuptools (>=%s) is not available, and\n"
+ "can't be installed while this script is running. Please install\n"
+ " a more recent version first, using 'easy_install -U setuptools'."
+ "\n\n(Currently using %r)"
+ ) % (version, e.args[0])
+ sys.exit(2)
+ else:
+ del pkg_resources, sys.modules['pkg_resources'] # reload ok
+ return do_download()
+ except pkg_resources.DistributionNotFound:
+ return do_download()
+
+def download_setuptools(
+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
+ delay = 15
+):
+ """Download setuptools from a specified location and return its filename
+
+ `version` should be a valid setuptools version number that is available
+ as an egg for download under the `download_base` URL (which should end
+ with a '/'). `to_dir` is the directory where the egg will be downloaded.
+ `delay` is the number of seconds to pause before an actual download attempt.
+ """
+ import urllib2, shutil
+ egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
+ url = download_base + egg_name
+ saveto = os.path.join(to_dir, egg_name)
+ src = dst = None
+ if not os.path.exists(saveto): # Avoid repeated downloads
+ try:
+ from distutils import log
+ if delay:
+ log.warn("""
+---------------------------------------------------------------------------
+This script requires setuptools version %s to run (even to display
+help). I will attempt to download it for you (from
+%s), but
+you may need to enable firewall access for this script first.
+I will start the download in %d seconds.
+
+(Note: if this machine does not have network access, please obtain the file
+
+ %s
+
+and place it in this directory before rerunning this script.)
+---------------------------------------------------------------------------""",
+ version, download_base, delay, url
+ ); from time import sleep; sleep(delay)
+ log.warn("Downloading %s", url)
+ src = urllib2.urlopen(url)
+ # Read/write all in one block, so we don't create a corrupt file
+ # if the download is interrupted.
+ data = _validate_md5(egg_name, src.read())
+ dst = open(saveto,"wb"); dst.write(data)
+ finally:
+ if src: src.close()
+ if dst: dst.close()
+ return os.path.realpath(saveto)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+def main(argv, version=DEFAULT_VERSION):
+ """Install or upgrade setuptools and EasyInstall"""
+ try:
+ import setuptools
+ except ImportError:
+ egg = None
+ try:
+ egg = download_setuptools(version, delay=0)
+ sys.path.insert(0,egg)
+ from setuptools.command.easy_install import main
+ return main(list(argv)+[egg]) # we're done here
+ finally:
+ if egg and os.path.exists(egg):
+ os.unlink(egg)
+ else:
+ if setuptools.__version__ == '0.0.1':
+ print >>sys.stderr, (
+ "You have an obsolete version of setuptools installed. Please\n"
+ "remove it from your system entirely before rerunning this script."
+ )
+ sys.exit(2)
+
+ req = "setuptools>="+version
+ import pkg_resources
+ try:
+ pkg_resources.require(req)
+ except pkg_resources.VersionConflict:
+ try:
+ from setuptools.command.easy_install import main
+ except ImportError:
+ from easy_install import main
+ main(list(argv)+[download_setuptools(delay=0)])
+ sys.exit(0) # try to force an exit
+ else:
+ if argv:
+ from setuptools.command.easy_install import main
+ main(argv)
+ else:
+ print "Setuptools version",version,"or greater has been installed."
+ print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
+
+def update_md5(filenames):
+ """Update our built-in md5 registry"""
+
+ import re
+
+ for name in filenames:
+ base = os.path.basename(name)
+ f = open(name,'rb')
+ md5_data[base] = md5(f.read()).hexdigest()
+ f.close()
+
+ data = [" %r: %r,\n" % it for it in md5_data.items()]
+ data.sort()
+ repl = "".join(data)
+
+ import inspect
+ srcfile = inspect.getsourcefile(sys.modules[__name__])
+ f = open(srcfile, 'rb'); src = f.read(); f.close()
+
+ match = re.search("\nmd5_data = {\n([^}]+)}", src)
+ if not match:
+ print >>sys.stderr, "Internal error!"
+ sys.exit(2)
+
+ src = src[:match.start(1)] + repl + src[match.end(1):]
+ f = open(srcfile,'w')
+ f.write(src)
+ f.close()
+
+
+if __name__=='__main__':
+ if len(sys.argv)>2 and sys.argv[1]=='--md5update':
+ update_md5(sys.argv[2:])
+ else:
+ main(sys.argv[1:])
+
+
+
+
+
+
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..861a9f5
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,5 @@
+[egg_info]
+tag_build =
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/setup.py b/setup.py
index 5ecf587..b7a2a0b 100644
--- a/setup.py
+++ b/setup.py
@@ -1,11 +1,40 @@
+#############################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+##
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+##
+## This is free software; you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+
import os
import sys
import errno
-from distutils.core import setup, Extension
-from distutils.dist import Distribution
+from ez_setup import use_setuptools
+use_setuptools()
+
+from setuptools import setup
+from setuptools import Extension, Distribution
+
+#from distutils.core import setup, Extension
+#from distutils.dist import Distribution
import distutils.sysconfig
+
try:
import sphinx
except:
@@ -88,10 +117,12 @@ classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Other Environment',
'Intended Audience :: Developers',
- 'License :: OSI Approved :: GNU General Public License (GPL)',
+ 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
'Natural Language :: English',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
+ 'Operating System :: POSIX :: Linux',
+ 'Operating System :: Unix',
'Programming Language :: Python',
'Topic :: Scientific/Engineering',
'Topic :: Software Development :: Libraries',
@@ -123,12 +154,18 @@ macros = []
if not numpy_available or not numpy_capi_available:
macros.append( ('DISABLE_PYTANGO_NUMPY', None) )
+library_dirs = [
+ os.path.join(TANGO_ROOT, 'lib'),
+ os.path.join(BOOST_ROOT, 'lib'),
+]
+
if os.name == 'nt':
include_dirs += [ BOOST_ROOT ]
if please_debug:
libraries += [
- #'libboost_python-vc80-mt-1_38', Boost in windows autodetects the proper library to link itself with...
+ #'libboost_python-vc80-mt-1_38', Boost in windows autodetects the
+ #proper library to link itself with...
'omniORB414d_rt',
'omniDynamic414d_rt',
'omnithread34d_rt',
@@ -139,14 +176,16 @@ if os.name == 'nt':
macros += [ ('_DEBUG', None) ]
else:
libraries += [
- #'libboost_python-vc80-mt-1_38', Boost in windows autodetects the proper library to link itself with...
+ #'libboost_python-vc80-mt-1_38', Boost in windows autodetects the
+ #proper library to link itself with...
'omniORB414_rt',
'omniDynamic414_rt',
'omnithread34_rt',
'COS414_rt',
]
-
+ library_dirs += [ os.path.join(OMNI_ROOT, 'lib', 'x86_win32') ]
+
extra_compile_args += [
'/EHsc'
]
@@ -169,6 +208,7 @@ else:
extra_link_args += ['-g' , '-O0']
include_dirs += [ os.path.join(BOOST_ROOT, 'include') ]
+
libraries += [
'boost_python',
'pthread',
@@ -180,6 +220,9 @@ else:
'COS4',
]
+ library_dirs += [ os.path.join(OMNI_ROOT, 'lib') ]
+
+
# Note for PyTango developers:
# Compilation time can be greatly reduced by compiling the file
# src/precompiled_header.hpp as src/precompiled_header.hpp.gch
@@ -189,6 +232,9 @@ else:
# '-includesrc/precompiled_header.hpp',
]
+ #if not please_debug:
+ # extra_compile_args += [ '-g0' ]
+
extra_link_args += [
'-Wl,-h',
'-Wl,--strip-all',
@@ -197,15 +243,8 @@ else:
macros += []
include_dirs = uniquify(include_dirs)
-
-library_dirs = [
- os.path.join(TANGO_ROOT, 'lib'),
- os.path.join(OMNI_ROOT, 'lib', 'x86_win32'),
- os.path.join(BOOST_ROOT, 'lib'),
-]
library_dirs = uniquify(library_dirs)
-
_cppfiles_exclude = []
_cppfiles = [ os.path.join('src',fname) for fname in os.listdir('src') if fname.endswith('.cpp') and not fname in _cppfiles_exclude]
_cppfiles += [ os.path.join('src','server',fname) for fname in os.listdir(os.path.join('src','server')) if fname.endswith('.cpp') and not fname in _cppfiles_exclude]
@@ -222,8 +261,11 @@ _pytango = Extension(name = '_PyTango',
depends = []
)
+from setuptools import Command
+#from distutils.cmd import Command
from distutils.command.build import build as dftbuild
-from distutils.cmd import Command
+from distutils.command.build_ext import build_ext as dftbuild_ext
+from distutils.unixccompiler import UnixCCompiler
class build(dftbuild):
@@ -239,6 +281,18 @@ class build(dftbuild):
cmdclass = {'build' : build }
+class build_ext(dftbuild_ext):
+
+ def build_extensions(self):
+ if isinstance(self.compiler, UnixCCompiler):
+ compiler_pars = self.compiler.compiler_so
+ while '-Wstrict-prototypes' in compiler_pars:
+ del compiler_pars[compiler_pars.index('-Wstrict-prototypes')]
+ #self.compiler.compiler_so = " ".join(compiler_pars)
+ dftbuild_ext.build_extensions(self)
+
+cmdclass = {'build_ext' : build_ext }
+
if sphinx:
from sphinx.setup_command import BuildDoc
@@ -295,42 +349,42 @@ if IPython:
added_path=True
import PyTango.ipython
PyTango.ipython.install(self.ipython_dir, verbose=False)
- except IOError as e:
+ except IOError, ioerr:
self.warn("Unable to install Spock IPython extension. Reason:")
- self.warn(str(e))
- if e.errno == errno.EACCES:
+ self.warn(str(ioerr))
+ if ioerr.errno == errno.EACCES:
self.warn("Probably you don't have enough previledges to install spock as an ipython extension.")
self.warn("Try executing setup.py with sudo or otherwise give '--ipython-local' parameter to")
- self.warn("setup.py to install spock as a current user ipython profile")
+ self.warn("setup.py to install spock as a current user ipython profile.")
self.warn("type: setup.py --help build_spock for more information")
- except Exception as e:
+ except Exception, e:
self.warn("Unable to install Spock IPython extension. Reason:")
self.warn(str(e))
- finally:
- if added_path:
- sys.path.pop(0)
+ if added_path:
+ sys.path.pop(0)
cmdclass['build_spock'] = build_spock
-setup(name = 'PyTango',
- version = Release.version,
- description = Release.description,
- long_description = Release.long_description,
- author = author[0],
- author_email = author[1],
- url = Release.url,
- download_url = Release.download_url,
- platforms = Release.platform,
- license = Release.license,
- packages = packages,
- package_dir = { 'PyTango' : 'PyTango', 'PyTango3' : 'PyTango3' },
- classifiers = classifiers,
- package_data = package_data,
- data_files = data_files,
- provides = provides,
- keywords = Release.keywords,
- requires = requires,
- ext_package = 'PyTango',
- ext_modules = [_pytango],
- cmdclass = cmdclass)
+dist = setup(
+ name = 'PyTango',
+ version = Release.version,
+ description = Release.description,
+ long_description = Release.long_description,
+ author = author[0],
+ author_email = author[1],
+ url = Release.url,
+ download_url = Release.download_url,
+ platforms = Release.platform,
+ license = Release.license,
+ packages = packages,
+ package_dir = { 'PyTango' : 'PyTango', 'PyTango3' : 'PyTango3' },
+ classifiers = classifiers,
+ package_data = package_data,
+ data_files = data_files,
+ provides = provides,
+ keywords = Release.keywords,
+ requires = requires,
+ ext_package = 'PyTango',
+ ext_modules = [_pytango],
+ cmdclass = cmdclass)
diff --git a/src/Jamfile b/src/Jamfile
deleted file mode 100644
index 7f4496b..0000000
--- a/src/Jamfile
+++ /dev/null
@@ -1,87 +0,0 @@
-# Specify the path to the Boost project. If you move this project,
-# adjust this path to refer to the Boost root directory.
-
-import python ;
-import os ;
-
-local TANGO_ROOT = [ os.environ TANGO_ROOT ] ;
-local OMNI_ROOT = [ os.environ OMNI_ROOT ] ;
-
-# Declare the three extension modules. You can specify multiple
-# source files after the colon separated by spaces.
-
-python-extension _PyTango
-
- : # sources
- archive_event_info.cpp
- attr_conf_event_data.cpp
- attribute_alarm_info.cpp
- attribute_dimension.cpp
- attribute_event_info.cpp
- attribute_info.cpp
- attribute_info_ex.cpp
- attribute_proxy.cpp
- base_types.cpp
- callback.cpp
- change_event_info.cpp
- command_info.cpp
- connection.cpp
- constants.cpp
- data_ready_event_data.cpp
- database.cpp
- db.cpp
- db_datum.cpp
- db_dev_export_info.cpp
- db_dev_import_info.cpp
- db_dev_info.cpp
- db_history.cpp
- db_server_info.cpp
- dev_command_info.cpp
- dev_error.cpp
- device_attribute.cpp
- device_attribute_config.cpp
- device_attribute_history.cpp
- device_data.cpp
- device_data_history.cpp
- device_info.cpp
- device_proxy.cpp
- enums.cpp
- event_data.cpp
- exception.cpp
- group.cpp
- group_element.cpp
- group_reply.cpp
- group_reply_list.cpp
- locker_info.cpp
- locking_thread.cpp
- periodic_event_info.cpp
- poll_device.cpp
- pytango.cpp
- pytgutils.cpp
- time_val.cpp
- version.cpp
- server/attr.cpp
- server/attribute.cpp
- server/class_factory.cpp
- server/command.cpp
- server/device_class.cpp
- server/device_impl.cpp
- server/dserver.cpp
- server/log4tango.cpp
- server/multi_attribute.cpp
- server/tango_util.cpp
- server/user_default_attr_prop.cpp
-
- : # dependencies
- <threading>multi
- <include>.
- <include>$(PYTHON_INCLUDES)
- <include>$(OMNI_ROOT)/include
- <include>$(TANGO_ROOT)/include
- <library-file>$(OMNI_ROOT)/lib/libomniORB4.so
- <library-file>$(OMNI_ROOT)/lib/libomniDynamic4.so
- <library-file>$(OMNI_ROOT)/lib/libomnithread.so
- <library-file>$(OMNI_ROOT)/lib/libCOS4.so
- <library-file>$(TANGO_ROOT)/lib/libtango.so
- <library-file>$(TANGO_ROOT)/lib/liblog4tango.so
- ;
diff --git a/src/api_util.cpp b/src/api_util.cpp
new file mode 100644
index 0000000..7f6dfc8
--- /dev/null
+++ b/src/api_util.cpp
@@ -0,0 +1,54 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
+#include <boost/python.hpp>
+#include <boost/python/return_value_policy.hpp>
+#include <tango.h>
+
+#include "pyutils.h"
+
+using namespace boost::python;
+
+void (Tango::ApiUtil::*get_asynch_replies1)() = &Tango::ApiUtil::get_asynch_replies;
+void (Tango::ApiUtil::*get_asynch_replies2)(long) = &Tango::ApiUtil::get_asynch_replies;
+
+bool (Tango::ApiUtil::*in_server1)() = &Tango::ApiUtil::in_server;
+void (Tango::ApiUtil::*in_server2)(bool) = &Tango::ApiUtil::in_server;
+
+void export_api_util()
+{
+ class_<Tango::ApiUtil, boost::noncopyable>("ApiUtil", no_init)
+
+ .def("instance", &Tango::ApiUtil::instance,
+ return_value_policy<reference_existing_object>())
+ .staticmethod("instance")
+
+ .def("pending_asynch_call", &Tango::ApiUtil::pending_asynch_call)
+
+ .def("get_asynch_replies", get_asynch_replies1)
+ .def("get_asynch_replies", get_asynch_replies2)
+
+ .def("set_asynch_cb_sub_model", &Tango::ApiUtil::set_asynch_cb_sub_model)
+ .def("get_asynch_cb_sub_model", &Tango::ApiUtil::get_asynch_cb_sub_model)
+ ;
+}
\ No newline at end of file
diff --git a/src/archive_event_info.cpp b/src/archive_event_info.cpp
index ca66fb9..45c99b8 100644
--- a/src/archive_event_info.cpp
+++ b/src/archive_event_info.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/attr_conf_event_data.cpp b/src/attr_conf_event_data.cpp
index f66f33c..d938c9d 100644
--- a/src/attr_conf_event_data.cpp
+++ b/src/attr_conf_event_data.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/attribute_alarm_info.cpp b/src/attribute_alarm_info.cpp
index 9e61213..ef5a18e 100644
--- a/src/attribute_alarm_info.cpp
+++ b/src/attribute_alarm_info.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/attribute_dimension.cpp b/src/attribute_dimension.cpp
index 167afcd..d180094 100644
--- a/src/attribute_dimension.cpp
+++ b/src/attribute_dimension.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/attribute_event_info.cpp b/src/attribute_event_info.cpp
index 1724013..d51da67 100644
--- a/src/attribute_event_info.cpp
+++ b/src/attribute_event_info.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/attribute_info.cpp b/src/attribute_info.cpp
index 7996114..5e77cf7 100644
--- a/src/attribute_info.cpp
+++ b/src/attribute_info.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/attribute_info_ex.cpp b/src/attribute_info_ex.cpp
index 99effda..e8cf698 100644
--- a/src/attribute_info_ex.cpp
+++ b/src/attribute_info_ex.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/attribute_proxy.cpp b/src/attribute_proxy.cpp
index 7f78149..dc3f3e4 100644
--- a/src/attribute_proxy.cpp
+++ b/src/attribute_proxy.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <boost/python/return_value_policy.hpp>
#include <tango.h>
@@ -20,7 +43,7 @@ namespace PyAttributeProxy
{
Tango::DeviceProxy* dev = self.get_device_proxy();
- std:string ret = dev->get_db_host() + ":" + dev->get_db_port() +
+ std::string ret = dev->get_db_host() + ":" + dev->get_db_port() +
"/" + dev->dev_name() + "/" + self.name();
return make_tuple(ret);
}
diff --git a/src/base_types.cpp b/src/base_types.cpp
index 33dd791..b384de0 100644
--- a/src/base_types.cpp
+++ b/src/base_types.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <tango.h>
diff --git a/src/base_types_numpy.hpp b/src/base_types_numpy.hpp
index 44fdf6b..375f70e 100644
--- a/src/base_types_numpy.hpp
+++ b/src/base_types_numpy.hpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#pragma once
#ifdef DISABLE_PYTANGO_NUMPY
diff --git a/src/callback.cpp b/src/callback.cpp
index 569a937..36c3421 100644
--- a/src/callback.cpp
+++ b/src/callback.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
#include "pytgutils.h"
diff --git a/src/callback.h b/src/callback.h
index 55c6155..50f3059 100644
--- a/src/callback.h
+++ b/src/callback.h
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#pragma once
#include <map>
diff --git a/src/change_event_info.cpp b/src/change_event_info.cpp
index b9f5d79..dbdd364 100644
--- a/src/change_event_info.cpp
+++ b/src/change_event_info.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/command_info.cpp b/src/command_info.cpp
index 80950c7..7a0d64a 100644
--- a/src/command_info.cpp
+++ b/src/command_info.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/connection.cpp b/src/connection.cpp
index 3cb5d6e..18ae606 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/copy_non_const_reference.hpp>
#include <tango.h>
diff --git a/src/constants.cpp b/src/constants.cpp
index 0da5465..638f909 100644
--- a/src/constants.cpp
+++ b/src/constants.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/data_ready_event_data.cpp b/src/data_ready_event_data.cpp
index fd369cc..a45cce3 100644
--- a/src/data_ready_event_data.cpp
+++ b/src/data_ready_event_data.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/database.cpp b/src/database.cpp
index 2248edb..bb4868d 100644
--- a/src/database.cpp
+++ b/src/database.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <boost/python/return_value_policy.hpp>
#include <tango.h>
diff --git a/src/db.cpp b/src/db.cpp
index 5364e7d..ca7589d 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/defs.h b/src/defs.h
index 1be893a..53408c5 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#pragma once
#include <string>
diff --git a/src/dev_command_info.cpp b/src/dev_command_info.cpp
index b2f1508..b34735f 100644
--- a/src/dev_command_info.cpp
+++ b/src/dev_command_info.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/dev_error.cpp b/src/dev_error.cpp
index 6992b85..50946aa 100644
--- a/src/dev_error.cpp
+++ b/src/dev_error.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/device_attribute.cpp b/src/device_attribute.cpp
index 0f961ff..5e3ecc3 100644
--- a/src/device_attribute.cpp
+++ b/src/device_attribute.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
#include <iostream>
diff --git a/src/device_attribute.h b/src/device_attribute.h
index 84cba39..6b94c2b 100644
--- a/src/device_attribute.h
+++ b/src/device_attribute.h
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#pragma once
#include <boost/python.hpp>
diff --git a/src/device_attribute_config.cpp b/src/device_attribute_config.cpp
index 1adefab..dd07798 100644
--- a/src/device_attribute_config.cpp
+++ b/src/device_attribute_config.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/device_attribute_history.cpp b/src/device_attribute_history.cpp
index 58f5450..4089909 100644
--- a/src/device_attribute_history.cpp
+++ b/src/device_attribute_history.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/device_attribute_numpy.hpp b/src/device_attribute_numpy.hpp
index 96039a6..2f2aba3 100644
--- a/src/device_attribute_numpy.hpp
+++ b/src/device_attribute_numpy.hpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
// This header file is just some template functions moved apart from
// device_attribute.cpp, and should only be included there.
diff --git a/src/device_data.cpp b/src/device_data.cpp
index c7186ba..8757a8d 100644
--- a/src/device_data.cpp
+++ b/src/device_data.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <boost/mpl/if.hpp>
#include <tango.h>
diff --git a/src/device_data_history.cpp b/src/device_data_history.cpp
index c2f2bc2..ffcbe30 100644
--- a/src/device_data_history.cpp
+++ b/src/device_data_history.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/device_info.cpp b/src/device_info.cpp
index eb96836..ee16d18 100644
--- a/src/device_info.cpp
+++ b/src/device_info.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/device_proxy.cpp b/src/device_proxy.cpp
index 1b66437..654e887 100644
--- a/src/device_proxy.cpp
+++ b/src/device_proxy.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <boost/python/return_value_policy.hpp>
#include <tango.h>
@@ -25,7 +48,7 @@ namespace PyDeviceProxy
{
static tuple getinitargs(Tango::DeviceProxy& self)
{
- std:string ret = self.get_db_host() + ":" + self.get_db_port() + "/" + self.dev_name();
+ std::string ret = self.get_db_host() + ":" + self.get_db_port() + "/" + self.dev_name();
return make_tuple(ret);
}
};
diff --git a/src/enums.cpp b/src/enums.cpp
index bbb6f8b..4ae21cf 100644
--- a/src/enums.cpp
+++ b/src/enums.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/event_data.cpp b/src/event_data.cpp
index 844e52b..b0fb084 100644
--- a/src/event_data.cpp
+++ b/src/event_data.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/exception.cpp b/src/exception.cpp
index b8acc1c..0090959 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <tango.h>
diff --git a/src/exception.h b/src/exception.h
index 936c522..cad258c 100644
--- a/src/exception.h
+++ b/src/exception.h
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#pragma once
#include <boost/python.hpp>
diff --git a/src/fast_from_py.h b/src/fast_from_py.h
index 2996226..6e66ccb 100644
--- a/src/fast_from_py.h
+++ b/src/fast_from_py.h
@@ -1,3 +1,25 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
#pragma once
@@ -243,7 +265,7 @@ inline typename TANGO_const2type(tangoTypeConst)*
long dim_x;
long dim_y = 0;
- long len = PySequence_Size(py_val);;
+ long len = PySequence_Size(py_val);
bool expectFlatSource;
if (isImage) {
@@ -328,7 +350,7 @@ inline typename TANGO_const2type(tangoTypeConst)*
py_el = PySequence_ITEM(py_val, idx);
if (!py_el)
boost::python::throw_error_already_set();
-
+
from_py<tangoTypeConst>::convert(py_el, tg_scalar);
tg_ptr[idx] = tg_scalar;
@@ -370,6 +392,140 @@ inline typename TANGO_const2type(tangoTypeConst)*
return tg_ptr;
}
+/*
+template<>
+inline Tango::DevString*
+ fast_python_to_tango_buffer_sequence<Tango::DEV_STRING>(PyObject* py_val, long* pdim_x, long *pdim_y, const std::string &fname, bool isImage, long& res_dim_x, long& res_dim_y)
+{
+ long dim_x;
+ long dim_y = 0;
+ long len = PySequence_Size(py_val);
+ bool expectFlatSource;
+
+ if (isImage) {
+ if (pdim_y) {
+ expectFlatSource = true;
+ dim_x = *pdim_x;
+ dim_y = *pdim_y;
+ long len2 = dim_x*dim_y;
+ if (len2 < len)
+ len = len2;
+ } else {
+ expectFlatSource = false;
+
+ if (len > 0) {
+ PyObject* py_row0 = PySequence_ITEM(py_val, 0);
+ if (!py_row0 || !PySequence_Check(py_row0)) {
+ Py_XDECREF(py_row0);
+ Tango::Except::throw_exception(
+ "PyDs_WrongParameters",
+ "Expecting a sequence of sequences.",
+ fname + "()");
+ }
+
+ dim_y = len;
+ dim_x = PySequence_Size(py_row0);
+ Py_XDECREF(py_row0);
+ } else {
+ dim_x = 0;
+ }
+ }
+ len = dim_x*dim_y;
+ } else {
+ expectFlatSource = true;
+ if (pdim_x) {
+ if (*pdim_x > len)
+ Tango::Except::throw_exception(
+ "PyDs_WrongParameters",
+ "Specified dim_x is larger than the sequence size",
+ fname + "()");
+ len = *pdim_x;
+ }
+ if (pdim_y && (*pdim_y!=0))
+ Tango::Except::throw_exception(
+ "PyDs_WrongParameters",
+ "You should not specify dim_y for an spectrum attribute!",
+ fname + "()");
+ dim_x = len;
+ }
+
+ res_dim_x = dim_x;
+ res_dim_y = dim_y;
+
+ if (!PySequence_Check(py_val))
+ Tango::Except::throw_exception(
+ "PyDs_WrongParameters",
+ "Expecting a sequence!",
+ fname + "()");
+
+ /// @bug Why not TangoArrayType::allocbuf(len)? Because
+ /// I will use it in set_value(tg_ptr,...,release=true).
+ /// Tango API makes delete[] tg_ptr instead of freebuf(tg_ptr).
+ /// This is usually the same, but for Tango::DevStringArray the
+ /// behaviour seems different and causes weirdtroubles..
+ Tango::DevString *tg_ptr;
+ tg_ptr = new Tango::DevString[len];
+
+ // The boost extract could be used:
+ // TangoScalarType val = boost::python::extract<TangoScalarType>(elt_ptr);
+ // instead of the code below.
+ // the problem is that extract is considerably slower than our
+ // convert function which only has to deal with the specific tango
+ // data types
+
+ PyObject * py_el = 0;
+ PyObject * py_row = 0;
+ Tango::DevString tg_scalar;
+ long idx = 0;
+ try {
+ if (expectFlatSource) {
+ for (idx = 0; idx < len; ++idx)
+ {
+ py_el = PySequence_ITEM(py_val, idx);
+ if (!py_el)
+ boost::python::throw_error_already_set();
+
+ tg_scalar = PyString_AsString(py_el);
+ tg_ptr[idx] = tg_scalar;
+
+ Py_DECREF(py_el);
+ py_el = 0;
+ }
+ } else {
+ for (long y=0; y < dim_y; ++y) {
+ py_row = PySequence_ITEM(py_val, y);
+ if (!py_row)
+ boost::python::throw_error_already_set();
+ if (!PySequence_Check(py_row)) {
+ Tango::Except::throw_exception(
+ "PyDs_WrongParameters",
+ "Expecting a sequence of sequences!",
+ fname + "()");
+ }
+ for (long x=0; x < dim_x; ++x, ++idx) {
+ py_el = PySequence_ITEM(py_row, x);
+ if (!py_el)
+ boost::python::throw_error_already_set();
+
+ tg_scalar = PyString_AsString(py_el);
+ tg_ptr[x + y*dim_x] = tg_scalar;
+
+ Py_DECREF(py_el);
+ py_el = 0;
+ }
+ Py_DECREF(py_row);
+ py_row = 0;
+ }
+ }
+ } catch(...) {
+ Py_XDECREF(py_el);
+ Py_XDECREF(py_row);
+ fast_python_to_tango_buffer_deleter__<Tango::DEV_STRING>(tg_ptr, idx);
+ throw;
+ }
+ return tg_ptr;
+}
+*/
template<long tangoArrayTypeConst>
inline typename TANGO_const2scalartype(tangoArrayTypeConst)*
diff --git a/src/fast_from_py_numpy.hpp b/src/fast_from_py_numpy.hpp
index 2d07bc6..a5e3fd3 100644
--- a/src/fast_from_py_numpy.hpp
+++ b/src/fast_from_py_numpy.hpp
@@ -1,3 +1,25 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
// This header file is just some template functions moved apart from
// attribute.cpp, and should only be included there.
diff --git a/src/from_py.cpp b/src/from_py.cpp
index 2b7546d..e7b8bc4 100644
--- a/src/from_py.cpp
+++ b/src/from_py.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include "from_py.h"
using namespace boost::python;
diff --git a/src/from_py.h b/src/from_py.h
index 7bf0a52..3a40e1a 100644
--- a/src/from_py.h
+++ b/src/from_py.h
@@ -1,6 +1,33 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#pragma once
#include <boost/python.hpp>
+#include <boost/version.hpp>
+#if BOOST_VERSION < 103400
+#include <boost/python/detail/api_placeholder.hpp>
+#endif
#include <tango.h>
#include "defs.h"
diff --git a/src/group.cpp b/src/group.cpp
index 3dccbaf..fa4438c 100644
--- a/src/group.cpp
+++ b/src/group.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/copy_non_const_reference.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
diff --git a/src/group_element.cpp b/src/group_element.cpp
index b1eb152..ccf4099 100644
--- a/src/group_element.cpp
+++ b/src/group_element.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/copy_non_const_reference.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
diff --git a/src/group_reply.cpp b/src/group_reply.cpp
index 02f5ce9..ce3765f 100644
--- a/src/group_reply.cpp
+++ b/src/group_reply.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/copy_non_const_reference.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
diff --git a/src/group_reply_list.cpp b/src/group_reply_list.cpp
index b817271..83ee745 100644
--- a/src/group_reply_list.cpp
+++ b/src/group_reply_list.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/copy_non_const_reference.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
diff --git a/src/locker_info.cpp b/src/locker_info.cpp
index b2084bf..7b32ae8 100644
--- a/src/locker_info.cpp
+++ b/src/locker_info.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/locking_thread.cpp b/src/locking_thread.cpp
index 2f2b8e9..de19964 100644
--- a/src/locking_thread.cpp
+++ b/src/locking_thread.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/periodic_event_info.cpp b/src/periodic_event_info.cpp
index 458b461..e1767b5 100644
--- a/src/periodic_event_info.cpp
+++ b/src/periodic_event_info.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/poll_device.cpp b/src/poll_device.cpp
index 01badfd..388f936 100644
--- a/src/poll_device.cpp
+++ b/src/poll_device.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/precompiled_header.hpp b/src/precompiled_header.hpp
index 08be414..78ef84d 100644
--- a/src/precompiled_header.hpp
+++ b/src/precompiled_header.hpp
@@ -1,3 +1,25 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
#pragma once
diff --git a/src/pytango.cpp b/src/pytango.cpp
index a706dec..35210a7 100644
--- a/src/pytango.cpp
+++ b/src/pytango.cpp
@@ -1,4 +1,31 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
+#include <boost/version.hpp>
+#if BOOST_VERSION < 103400
+#define DISABLE_BOOST_DOCSTRING_OPTIONS
+#endif
#ifndef DISABLE_PYTANGO_NUMPY
# define PY_ARRAY_UNIQUE_SYMBOL pytango_ARRAY_API
@@ -19,6 +46,7 @@ void export_event_data();
void export_attr_conf_event_data();
void export_data_ready_event_data();
void export_exceptions();
+void export_api_util();
void export_connection();
void export_device_proxy();
void export_attribute_proxy();
@@ -39,12 +67,15 @@ void export_log4tango();
BOOST_PYTHON_MODULE(_PyTango)
{
+
+#ifndef DISABLE_BOOST_DOCSTRING_OPTIONS
// Configure generated docstrings
const bool show_user_defined = false;
const bool show_py_signatures = false;
docstring_options doc_opts(show_user_defined,
show_py_signatures);
+#endif
// specify that this module is actually a package
boost::python::object package = boost::python::scope();
@@ -66,6 +97,7 @@ BOOST_PYTHON_MODULE(_PyTango)
export_attr_conf_event_data();
export_data_ready_event_data();
export_exceptions();
+ export_api_util();
export_connection();
export_device_proxy();
export_attribute_proxy();
diff --git a/src/pytgutils.cpp b/src/pytgutils.cpp
index 9214dd2..a9c1c82 100644
--- a/src/pytgutils.cpp
+++ b/src/pytgutils.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/pytgutils.h b/src/pytgutils.h
index f5a6add..4029f13 100644
--- a/src/pytgutils.h
+++ b/src/pytgutils.h
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#pragma once
#include <boost/python.hpp>
diff --git a/src/pyutils.cpp b/src/pyutils.cpp
index 5ed77a3..fda94aa 100644
--- a/src/pyutils.cpp
+++ b/src/pyutils.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include "defs.h"
diff --git a/src/pyutils.h b/src/pyutils.h
index 365c1d9..560b8b1 100644
--- a/src/pyutils.h
+++ b/src/pyutils.h
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#pragma once
#include <boost/python.hpp>
diff --git a/src/server/attribute.cpp b/src/server/attribute.cpp
index b2add85..e15ea7c 100644
--- a/src/server/attribute.cpp
+++ b/src/server/attribute.cpp
@@ -77,6 +77,34 @@ namespace PyAttribute
att.set_value(cpp_val.release(), 1, 0, true);
}
+ /**
+ * ATTENTION: this template specialization is done to close a memory leak
+ * that exists up to tango 7.1.1 for string read_write attributes
+ *
+ * Tango Attribute set_value wrapper for scalar string attributes
+ *
+ * @param att attribute reference
+ * @param value new attribute value
+ */
+ /*
+ template<>
+ inline void __set_value_scalar<Tango::DEV_STRING>(Tango::Attribute &att,
+ boost::python::object &value)
+ {
+ Tango::DevString *v = new Tango::DevString;
+
+ if (att.get_writable() == Tango::READ)
+ { // No memory leak here. Do the standard thing
+ from_py<Tango::DEV_STRING>::convert(value, *v);
+ }
+ else
+ { // MEMORY LEAK: use the python string directly instead of creating a
+ // string
+ v[0] = PyString_AsString(value.ptr());
+ }
+ att.set_value(v, 1, 0, true);
+ }
+ */
/**
* Tango Attribute set_value wrapper for DevEncoded attributes
@@ -139,6 +167,38 @@ namespace PyAttribute
/**
+ * ATTENTION: this template specialization is done to close a memory leak
+ * that exists up to tango 7.1.1 for string read_write attributes
+ *
+ * Tango Attribute set_value_date_quality wrapper for scalar string attributes
+ *
+ * @param att attribute reference
+ * @param value new attribute value
+ * @param t timestamp
+ * @param quality attribute quality
+ */
+ /*
+ template<>
+ inline void __set_value_date_quality_scalar<Tango::DEV_STRING>(Tango::Attribute &att,
+ boost::python::object &value,
+ double t, Tango::AttrQuality quality)
+ {
+ PYTG_NEW_TIME_FROM_DOUBLE(t, tv);
+
+ Tango::DevString *v = new Tango::DevString;
+ if (att.get_writable() == Tango::READ)
+ { // No memory leak here. Do the standard thing
+ from_py<Tango::DEV_STRING>::convert(value, *v);
+ }
+ else
+ { // MEMORY LEAK: use the python string directly instead of creating a string
+ v[0] = PyString_AsString(value.ptr());
+ }
+ att.set_value_date_quality(v, tv, quality, 1, 0, true);
+ }
+ */
+
+ /**
* Tango Attribute set_value_date_quality wrapper for DevEncoded attributes
*
* @param att attribute reference
diff --git a/src/server/attribute.cpp~ b/src/server/attribute.cpp~
deleted file mode 100644
index b8a77ef..0000000
--- a/src/server/attribute.cpp~
+++ /dev/null
@@ -1,803 +0,0 @@
-#include <string>
-#include <boost/python.hpp>
-#include <boost/python/return_value_policy.hpp>
-#include <tango.h>
-
-#include "defs.h"
-#include "pytgutils.h"
-#include "tango_extra.h"
-#include "attribute.h"
-
-using namespace boost::python;
-
-# ifdef WIN32
-# define PYTG_TIME_FROM_DOUBLE(dbl, tv) \
- if (true) { \
- tv.time = (time_t)floor(dbl); \
- tv.millitm = (unsigned short)((dbl - tv.time)*1.0e3); \
- } else (void)0
-# define PYTG_NEW_TIME_FROM_DOUBLE(dbl, tv) \
- struct _timeb tv; PYTG_TIME_FROM_DOUBLE(dbl, tv)
-# else
-# define PYTG_TIME_FROM_DOUBLE(dbl, tv) double2timeval(tv, dbl);
-# define PYTG_NEW_TIME_FROM_DOUBLE(dbl, tv) \
- struct timeval tv; PYTG_TIME_FROM_DOUBLE(dbl, tv)
-#endif
-
-inline void throw_wrong_python_data_type(const std::string &att_name,
- const char *method)
-{
- TangoSys_OMemStream o;
- o << "Wrong Python type for attribute " << att_name << ends;
- Tango::Except::throw_exception(
- (const char *)"PyDs_WrongPythonDataTypeForAttribute",
- o.str(), method);
-}
-
-inline void throw_wrong_python_data_type_in_array(const std::string &att_name,
- long idx,
- const char *method)
-{
- TangoSys_OMemStream o;
- o << "Wrong Python type for attribute " << att_name
- << ".\nElement with index " << idx << " in sequence does not "
- << "have a correct type." << ends;
-
- Tango::Except::throw_exception(
- (const char *)"PyDs_WrongPythonDataTypeForAttribute",
- o.str(), method);
-}
-
-namespace PyAttribute
-{
- /**
- * Tango Attribute set_value wrapper for scalar attributes
- *
- * @param att attribute reference
- * @param value new attribute value
- */
- template<long tangoTypeConst>
- inline void __set_value_scalar(Tango::Attribute &att,
- boost::python::object &value)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
- extract<TangoScalarType> val(value.ptr());
- if (!val.check())
- {
- throw_wrong_python_data_type(att.get_name(), "set_value()");
- }
- TangoScalarType cpp_val = val;
- att.set_value(&cpp_val);
- }
-
- /**
- * Tango Attribute set_value wrapper for DevEncoded attributes
- *
- * @param att attribute reference
- * @param data_str new attribute data string
- * @param data new attribute data
- */
- inline void __set_value(Tango::Attribute &att,
- boost::python::str &data_str,
- boost::python::str &data)
- {
- extract<Tango::DevString> val_str(data_str.ptr());
- if (!val_str.check())
- {
- throw_wrong_python_data_type(att.get_name(), "set_value()");
- }
- extract<Tango::DevUChar*> val(data.ptr());
- if (!val.check())
- {
- throw_wrong_python_data_type(att.get_name(), "set_value()");
- }
-
- Tango::DevString val_str_real = val_str;
- Tango::DevUChar *val_real = val;
- att.set_value(&val_str_real, val_real, (long)len(data));
- }
-
- /**
- * Tango Attribute set_value_date_quality wrapper for scalar attributes
- *
- * @param att attribute reference
- * @param value new attribute value
- * @param t timestamp
- * @param quality attribute quality
- */
- template<long tangoTypeConst>
- inline void __set_value_date_quality_scalar(Tango::Attribute &att,
- boost::python::object &value,
- double t, Tango::AttrQuality quality)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
-
- extract<TangoScalarType> val(value.ptr());
- if (!val.check())
- {
- throw_wrong_python_data_type(att.get_name(), "set_value_data_quality()");
- }
- TangoScalarType cpp_val = val;
- PYTG_NEW_TIME_FROM_DOUBLE(t, tv);
-// att.set_value_date_quality(&cpp_val, tv, quality);
- att.set_value_date_quality(new TangoScalarType(cpp_val), tv, quality);
- }
-
- /**
- * Tango Attribute set_value_date_quality wrapper for DevEncoded attributes
- *
- * @param att attribute reference
- * @param data_str new attribute data string
- * @param data new attribute data
- * @param t timestamp
- * @param quality attribute quality
- */
- inline void __set_value_date_quality(Tango::Attribute &att,
- boost::python::str &data_str,
- boost::python::str &data,
- double t, Tango::AttrQuality quality)
- {
- extract<Tango::DevString> val_str(data_str.ptr());
- if (!val_str.check())
- {
- throw_wrong_python_data_type(att.get_name(), "set_value()");
- }
- extract<Tango::DevUChar*> val(data.ptr());
- if (!val.check())
- {
- throw_wrong_python_data_type(att.get_name(), "set_value()");
- }
-
- PYTG_NEW_TIME_FROM_DOUBLE(t, tv);
- Tango::DevString val_str_real = val_str;
- Tango::DevUChar *val_real = val;
- att.set_value_date_quality(&val_str_real, val_real, (long)len(data), tv, quality);
- }
-
- template<long tangoTypeConst>
- inline typename TANGO_const2type(tangoTypeConst)*
- __pyvalue_to_array(boost::python::object &seq, long x_dim, long y_dim, const std::string &)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
- typedef typename TANGO_const2arraytype(tangoTypeConst) TangoArrayType;
-
- PyObject *seq_ptr = seq.ptr();
- long len = (long) PySequence_Size(seq_ptr);
- twod2oned(len, x_dim, y_dim);
-
- TangoScalarType *tg_ptr = TangoArrayType::allocbuf(len);
-
- for (long idx = 0; idx < len; ++idx)
- {
- PyObject *elt_ptr = PySequence_GetItem(seq_ptr, idx);
-
- // The boost extract could be used:
- // TangoScalarType val = boost::python::extract<TangoScalarType>(elt_ptr);
- // instead of the code below.
- // the problem is that extract is considerably slower than our
- // convert function which only has to deal with the specific tango
- // data types
- try
- {
- TangoScalarType tg_scalar;
- from_py<tangoTypeConst>::convert(elt_ptr, tg_scalar);
- tg_ptr[idx] = tg_scalar;
- Py_DECREF(elt_ptr);
- }
- catch(...)
- {
- Py_DECREF(elt_ptr);
- TangoArrayType::freebuf(tg_ptr);
- throw;
- }
- }
- return tg_ptr;
- }
-
- template<>
- inline TANGO_const2type(Tango::DEV_ENCODED)*
- __pyvalue_to_array<Tango::DEV_ENCODED>(boost::python::object &, long, long, const std::string & fname)
- {
- TangoSys_OMemStream o;
- o << "DevEncoded is only supported for SCALAR attributes." << ends;
- Tango::Except::throw_exception(
- (const char *)"PyDs_WrongPythonDataTypeForAttribute",
- o.str(), fname + "()");
- return 0;
- }
-
- inline void __set_value(const std::string & fname, Tango::Attribute &att, boost::python::object &value, long* x, long *y, double t = 0.0, Tango::AttrQuality* quality = 0)
- {
- long type = att.get_data_type();
- Tango::AttrDataFormat format = att.get_data_format();
-
- if (format == Tango::SCALAR)
- {
- if ((x && ((*x) > 1)) || (y && (*y) > 0)) {
- TangoSys_OMemStream o;
- o << "Cannot call " << fname;
- if (y)
- o << "(data, dim_x) on scalar attribute ";
- else
- o << "(data, dim_x, dim_y) on scalar attribute ";
-
- if (quality)
- o << att.get_name() << ". Use set_value_date_quality(data) instead" << ends;
- else
- o << att.get_name() << ". Use set_value(data) instead" << ends;
-
- Tango::Except::throw_exception(
- "PyDs_WrongPythonDataTypeForAttribute",
- o.str(),
- fname + "()");
- } else {
- if (quality)
- TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE(type, __set_value_date_quality_scalar, att, value, t, *quality);
- else
- TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE(type, __set_value_scalar, att, value);
- }
- }
- else
- {
- if (!PySequence_Check(value.ptr()))
- {
- TangoSys_OMemStream o;
- o << "Wrong Python type for attribute " << att.get_name()
- << "of type " << Tango::CmdArgTypeName[type]
- << ". Expected a sequence." << ends;
-
- Tango::Except::throw_exception(
- "PyDs_WrongPythonDataTypeForAttribute",
- o.str(),
- fname + "()");
- }
- long dim_x = PySequence_Size(value.ptr()), dim_y = 0;
- if (x)
- dim_x = *x;
- if (y)
- dim_y = *y;
-
- if (quality) {
- //TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE(type, __set_value_date_quality_array, att, value, t, *quality, dim_x, dim_y);
- PYTG_NEW_TIME_FROM_DOUBLE(t, tv);
- TANGO_DO_ON_ATTRIBUTE_DATA_TYPE(type,
- att.set_value_date_quality(__pyvalue_to_array<tangoTypeConst>(value, dim_x, dim_y, fname), tv, *quality, dim_x, dim_y, true);
- );
- } else {
- //TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE(type, __set_value_array, att, value, dim_x, dim_y);
- TANGO_DO_ON_ATTRIBUTE_DATA_TYPE(type,
- att.set_value(__pyvalue_to_array<tangoTypeConst>(value, dim_x, dim_y, fname), dim_x, dim_y);
- );
- }
- }
- }
-
- inline void __set_value(const std::string & fname, Tango::Attribute &att, boost::python::str &data_str, boost::python::str &data, double t = 0.0, Tango::AttrQuality* quality = 0)
- {
- if (quality)
- __set_value_date_quality(att, data_str, data, t, *quality);
- else
- __set_value(att, data_str, data);
- }
-
- inline void set_value(Tango::Attribute &att, boost::python::object &value)
- { __set_value("set_value", att, value, 0, 0); }
-
- inline void set_value(Tango::Attribute &att, boost::python::str &data_str, boost::python::str &data)
- { __set_value("set_value", att, data_str, data); }
-
- inline void set_value(Tango::Attribute &att, boost::python::object &value, long x)
- { __set_value("set_value", att, value, &x, 0); }
-
- inline void set_value(Tango::Attribute &att, boost::python::object &value, long x, long y)
- { __set_value("set_value", att, value, &x, &y); }
-
- inline void set_value_date_quality(Tango::Attribute &att,
- boost::python::object &value, double t,
- Tango::AttrQuality quality)
- { __set_value("set_value_date_quality", att, value, 0, 0, t, &quality); }
-
- inline void set_value_date_quality(Tango::Attribute &att,
- boost::python::str &data_str,
- boost::python::str &data,
- double t,
- Tango::AttrQuality quality)
- { __set_value("set_value_date_quality", att, data_str, data, t, &quality); }
-
- inline void set_value_date_quality(Tango::Attribute &att,
- boost::python::object &value,
- double t, Tango::AttrQuality quality,
- long x)
- { __set_value("set_value_date_quality", att, value, &x, 0, t, &quality); }
-
- inline void set_value_date_quality(Tango::Attribute &att,
- boost::python::object &value,
- double t, Tango::AttrQuality quality,
- long x, long y)
- { __set_value("set_value_date_quality", att, value, &x, &y, t, &quality); }
-};
-
-namespace PyWAttribute
-{
- template<long tangoTypeConst>
- PyObject* __get_min_value(Tango::WAttribute &att)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
-
- TangoScalarType tg_val;
- att.get_min_value(tg_val);
- boost::python::object py_value(tg_val);
-
- return boost::python::incref(py_value.ptr());
- }
-
- PyObject *get_min_value(Tango::WAttribute &att)
- {
- long type = att.get_data_type();
-
- TANGO_DO_ON_NUMERICAL_ATTRIBUTE_DATA_TYPE(type,
- return __get_min_value<tangoTypeConst>(att)
- );
- return 0;
- }
-
- template<long tangoTypeConst>
- PyObject* __get_max_value(Tango::WAttribute &att)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
-
- TangoScalarType tg_val;
- att.get_max_value(tg_val);
- boost::python::object py_value(tg_val);
- return boost::python::incref(py_value.ptr());
- }
-
- PyObject *get_max_value(Tango::WAttribute &att)
- {
- long type = att.get_data_type();
-
- TANGO_DO_ON_NUMERICAL_ATTRIBUTE_DATA_TYPE(type,
- return __get_max_value<tangoTypeConst>(att)
- );
- return 0;
- }
-
- template<long tangoTypeConst>
- void __set_min_value(Tango::WAttribute &att, boost::python::object &v)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
-
- TangoScalarType tg_val = boost::python::extract<TangoScalarType>(v);
-
- att.set_min_value(tg_val);
- }
-
- void set_min_value(Tango::WAttribute &att, boost::python::object &v)
- {
- long type = att.get_data_type();
- TANGO_CALL_ON_NUMERICAL_ATTRIBUTE_DATA_TYPE(type, __set_min_value, att, v);
- }
-
- template<long tangoTypeConst>
- void __set_max_value(Tango::WAttribute &att, boost::python::object &v)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
-
- TangoScalarType tg_val = boost::python::extract<TangoScalarType>(v);
-
- att.set_max_value(tg_val);
- }
-
- void set_max_value(Tango::WAttribute &att, boost::python::object &v)
- {
- long type = att.get_data_type();
- TANGO_CALL_ON_NUMERICAL_ATTRIBUTE_DATA_TYPE(type, __set_max_value, att, v);
- }
-
- template<long tangoTypeConst>
- inline void __set_write_value_scalar(Tango::WAttribute &att,
- boost::python::object &value)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
- extract<TangoScalarType> val(value.ptr());
- if (!val.check())
- {
- throw_wrong_python_data_type(att.get_name(), "set_write_value()");
- }
- TangoScalarType cpp_val = val;
- att.set_write_value(cpp_val);
- }
-
- template<>
- inline void __set_write_value_scalar<Tango::DEV_ENCODED>(Tango::WAttribute &att,
- boost::python::object &value)
- {
- Tango::Except::throw_exception(
- (const char *)"PyDs_WrongPythonDataTypeForAttribute",
- (const char *)"set_write_value is not supported for DEV_ENCODED attributes.",
- (const char *)"set_write_value()");
- }
-
- template<long tangoTypeConst>
- inline void __set_write_value_array(Tango::WAttribute &att,
- boost::python::object &seq,
- long x_dim, long y_dim)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
- typedef typename TANGO_const2arraytype(tangoTypeConst) TangoArrayType;
-
- PyObject *seq_ptr = seq.ptr();
- long len = (long) PySequence_Size(seq_ptr);
- twod2oned(len, x_dim, y_dim);
-
- TangoScalarType *tg_ptr = TangoArrayType::allocbuf(len);
-
- for (long idx = 0; idx < len; ++idx)
- {
- PyObject *elt_ptr = PySequence_GetItem(seq_ptr, idx);
-
- // The boost extract could be used:
- // TangoScalarType val = boost::python::extract<TangoScalarType>(elt_ptr);
- // instead of the code below.
- // the problem is that extract is considerably slower than our
- // convert function which only has to deal with the specific tango
- // data types
- try
- {
- TangoScalarType tg_scalar;
- from_py<tangoTypeConst>::convert(elt_ptr, tg_scalar);
- tg_ptr[idx] = tg_scalar;
- Py_DECREF(elt_ptr);
- }
- catch(...)
- {
- Py_DECREF(elt_ptr);
- delete [] tg_ptr;
- throw;
- }
- }
-
- try
- {
- att.set_write_value(tg_ptr, x_dim, y_dim);
- delete [] tg_ptr;
- }
- catch(...)
- {
- delete [] tg_ptr;
- throw;
- }
- }
-
- template<>
- inline void __set_write_value_array<Tango::DEV_ENCODED>(Tango::WAttribute &att,
- boost::python::object &seq,
- long x_dim, long y_dim)
- {
- Tango::Except::throw_exception(
- (const char *)"PyDs_WrongPythonDataTypeForAttribute",
- (const char *)"set_write_value is not supported for DEV_ENCODED attributes.",
- (const char *)"set_write_value()");
- }
-
- inline void set_write_value(Tango::WAttribute &att, boost::python::object &value)
- {
- long type = att.get_data_type();
- Tango::AttrDataFormat format = att.get_data_format();
-
- if (format == Tango::SCALAR)
- {
- TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE(type, __set_write_value_scalar,
- att, value);
- }
- else
- {
- if (!PySequence_Check(value.ptr()))
- {
- TangoSys_OMemStream o;
- o << "Wrong Python type for attribute " << att.get_name()
- << "of type " << Tango::CmdArgTypeName[type]
- << ". Expected a sequence." << ends;
-
- Tango::Except::throw_exception(
- (const char *)"PyDs_WrongPythonDataTypeForAttribute",
- o.str(),
- (const char *)"set_value()");
- }
- TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE(type, __set_write_value_array,
- att, value,
- PySequence_Size(value.ptr()), 0);
- }
- }
-
- inline void set_write_value(Tango::WAttribute &att,
- boost::python::object &value,
- long x)
- {
- long type = att.get_data_type();
- Tango::AttrDataFormat format = att.get_data_format();
-
- if (format == Tango::SCALAR)
- {
- TangoSys_OMemStream o;
- o << "Cannot call set_value(data, dim_x) on scalar attribute "
- << att.get_name() << ". Use set_write_value(data) instead"
- << ends;
-
- Tango::Except::throw_exception(
- (const char *)"PyDs_WrongPythonDataTypeForAttribute",
- o.str(),
- (const char *)"set_write_value()");
- }
- else
- {
- if (!PySequence_Check(value.ptr()))
- {
- TangoSys_OMemStream o;
- o << "Wrong Python type for attribute " << att.get_name()
- << "of type " << Tango::CmdArgTypeName[type]
- << ". Expected a sequence" << ends;
-
- Tango::Except::throw_exception(
- (const char *)"PyDs_WrongPythonDataTypeForAttribute",
- o.str(),
- (const char *)"set_write_value()");
- }
- TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE(type, __set_write_value_array,
- att, value, x, 0);
- }
- }
-
- inline void set_write_value(Tango::WAttribute &att,
- boost::python::object &value,
- long x, long y)
- {
- long type = att.get_data_type();
- Tango::AttrDataFormat format = att.get_data_format();
-
- if (format == Tango::SCALAR)
- {
- TangoSys_OMemStream o;
- o << "Cannot call set_write_value(data, dim_x, dim_y) "
- << "on scalar attribute " << att.get_name()
- << ". Use set_write_value(data) instead" << ends;
-
- Tango::Except::throw_exception(
- (const char *)"PyDs_WrongPythonDataTypeForAttribute",
- o.str(),
- (const char *)"set_write_value()");
- }
- else
- {
- if (!PySequence_Check(value.ptr()))
- {
- TangoSys_OMemStream o;
- o << "Wrong Python type for attribute " << att.get_name()
- << "of type " << Tango::CmdArgTypeName[type]
- << ". Expected a sequence" << ends;
-
- Tango::Except::throw_exception(
- (const char *)"PyDs_WrongPythonDataTypeForAttribute",
- o.str(),
- (const char *)"set_write_value()");
- }
- TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE(type, __set_write_value_array,
- att, value, x, y);
- }
- }
-
- template<long tangoTypeConst>
- void __get_write_value(Tango::WAttribute &att, boost::python::list &seq)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
-
- const TangoScalarType *ptr;
-
- long length = att.get_write_value_length();
-
- att.get_write_value(ptr);
-
- for (long l = 0; l < length; ++l)
- {
- seq.append(ptr[l]);
- }
- }
-
- template<>
- void __get_write_value<Tango::DEV_STRING>(Tango::WAttribute &att,
- boost::python::list &seq)
- {
- const Tango::ConstDevString *ptr;
-
- long length = att.get_write_value_length();
-
- att.get_write_value(ptr);
-
- for (long l = 0; l < length; ++l)
- {
- seq.append(ptr[l]);
- }
- }
-
- inline void get_write_value(Tango::WAttribute &att,
- boost::python::list &value)
- {
- long type = att.get_data_type();
- TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE(type, __get_write_value, att, value);
- }
-
- template<long tangoTypeConst>
- void __get_write_value(Tango::WAttribute &att, PyObject **obj)
- {
- typedef typename TANGO_const2type(tangoTypeConst) TangoScalarType;
-
- Tango::AttrDataFormat fmt = att.get_data_format();
-
- if (fmt == Tango::SCALAR)
- {
- TangoScalarType v;
- att.get_write_value(v);
- boost::python::object o(v);
- PyObject *o_ptr = o.ptr();
- boost::python::incref(o_ptr);
- *obj = o_ptr;
- }
- else
- {
- const TangoScalarType *ptr;
- long length = att.get_write_value_length();
- att.get_write_value(ptr);
- boost::python::list o;
- for (long l = 0; l < length; ++l)
- o.append(ptr[l]);
- PyObject *o_ptr = o.ptr();
- boost::python::incref(o_ptr);
- *obj = o_ptr;
- }
- }
-
- template<>
- void __get_write_value<Tango::DEV_STRING>(Tango::WAttribute &att, PyObject **obj)
- {
- Tango::AttrDataFormat fmt = att.get_data_format();
- if (fmt == Tango::SCALAR)
- {
- Tango::DevString v = NULL;
- att.get_write_value(v);
- boost::python::object o(v);
- PyObject *o_ptr = o.ptr();
- boost::python::incref(o_ptr);
- *obj = o_ptr;
- }
- else
- {
- const Tango::ConstDevString *ptr;
- long length = att.get_write_value_length();
- att.get_write_value(ptr);
- boost::python::list o;
- for (long l = 0; l < length; ++l)
- o.append(ptr[l]);
- PyObject *o_ptr = o.ptr();
- boost::python::incref(o_ptr);
- *obj = o_ptr;
- }
- }
-
- inline PyObject* get_write_value(Tango::WAttribute &att)
- {
- long type = att.get_data_type();
- PyObject *value = NULL;
- TANGO_CALL_ON_ATTRIBUTE_DATA_TYPE(type, __get_write_value, att, &value);
- return value;
- }
-};
-
-BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(set_quality_overloads,
- Tango::Attribute::set_quality, 1, 2);
-
-void export_attribute()
-{
- enum_<Tango::Attribute::alarm_flags>("alarm_flags",
- "an enumerated for the alarm flags")
- .value("min_level", Tango::Attribute::min_level)
- .value("max_level", Tango::Attribute::max_level)
- .value("rds", Tango::Attribute::rds)
- .value("min_warn", Tango::Attribute::min_warn)
- .value("max_warn", Tango::Attribute::max_warn)
- .value("numFlags", Tango::Attribute::numFlags)
- ;
-
- class_<Tango::Attribute>("Attribute", no_init)
- .def("is_write_associated", &Tango::Attribute::is_writ_associated)
- .def("is_min_alarm", &Tango::Attribute::is_min_alarm)
- .def("is_max_alarm", &Tango::Attribute::is_max_alarm)
- .def("is_min_warning", &Tango::Attribute::is_min_warning)
- .def("is_max_warning", &Tango::Attribute::is_max_warning)
- .def("is_rds_alarm", &Tango::Attribute::is_rds_alarm)
- //TODO .def("is_alarmed", &Tango::Attribute::is_alarmed)
- .def("is_polled", &Tango::Attribute::is_polled)
- .def("check_alarm", &Tango::Attribute::check_alarm)
- .def("get_writable", &Tango::Attribute::get_writable)
- .def("get_name", &Tango::Attribute::get_name, return_value_policy<copy_non_const_reference>())
- .def("get_data_type", &Tango::Attribute::get_data_type)
- .def("get_data_format", &Tango::Attribute::get_data_format)
- .def("get_assoc_name", &Tango::Attribute::get_assoc_name, return_value_policy<copy_non_const_reference>())
- .def("get_assoc_ind", &Tango::Attribute::get_assoc_ind)
- .def("set_assoc_ind", &Tango::Attribute::set_assoc_ind)
- .def("get_date", &Tango::Attribute::get_date, return_internal_reference<>())
- .def("set_date",
- (void (Tango::Attribute::*) (Tango::TimeVal &))
- &Tango::Attribute::set_date)
- .def("get_label", &Tango::Attribute::get_label, return_value_policy<copy_non_const_reference>())
- .def("get_quality", &Tango::Attribute::get_quality, return_value_policy<copy_non_const_reference>())
- .def("set_quality", &Tango::Attribute::set_quality, set_quality_overloads())
- .def("get_data_size", &Tango::Attribute::get_data_size)
- .def("get_x", &Tango::Attribute::get_x)
- .def("get_max_dim_x", &Tango::Attribute::get_max_dim_x)
- .def("get_y", &Tango::Attribute::get_y)
- .def("get_max_dim_y", &Tango::Attribute::get_max_dim_y)
- .def("get_polling_period", &Tango::Attribute::get_polling_period)
- //TODO .def("get_properties", &Tango::Attribute::get_properties)
- //TODO .def("get_properties_2", &Tango::Attribute::get_properties_2)
- //TODO .def("get_properties_3", &Tango::Attribute::get_properties_3)
-
- .def("set_value",
- (void (*) (Tango::Attribute &, boost::python::object &))
- &PyAttribute::set_value)
- .def("set_value",
- (void (*) (Tango::Attribute &, boost::python::str &, boost::python::str &))
- &PyAttribute::set_value)
- .def("set_value",
- (void (*) (Tango::Attribute &, boost::python::object &, long))
- &PyAttribute::set_value)
- .def("set_value",
- (void (*) (Tango::Attribute &, boost::python::object &, long, long))
- &PyAttribute::set_value)
- .def("set_value_date_quality",
- (void (*) (Tango::Attribute &, boost::python::object &, double t, Tango::AttrQuality quality))
- &PyAttribute::set_value_date_quality)
- .def("set_value_date_quality",
- (void (*) (Tango::Attribute &, boost::python::str &, boost::python::str &, double t, Tango::AttrQuality quality))
- &PyAttribute::set_value_date_quality)
- .def("set_value_date_quality",
- (void (*) (Tango::Attribute &, boost::python::object &, double t, Tango::AttrQuality quality, long))
- &PyAttribute::set_value_date_quality)
- .def("set_value_date_quality",
- (void (*) (Tango::Attribute &, boost::python::object &, double t, Tango::AttrQuality quality, long, long))
- &PyAttribute::set_value_date_quality)
- ;
-
- class_<Tango::WAttribute, bases<Tango::Attribute> >("WAttribute", no_init)
- .def("get_min_value",
- (PyObject* (*) (Tango::WAttribute &))
- &PyWAttribute::get_min_value)
- .def("get_max_value",
- (PyObject* (*) (Tango::WAttribute &))
- &PyWAttribute::get_max_value)
- .def("set_min_value", &PyWAttribute::set_min_value)
- .def("set_max_value", &PyWAttribute::set_min_value)
- .def("is_min_value", &Tango::WAttribute::is_min_value)
- .def("is_max_value", &Tango::WAttribute::is_max_value)
- .def("get_write_value_length",&Tango::WAttribute::get_write_value_length)
- .def("set_write_value",
- (void (*) (Tango::WAttribute &, boost::python::object &))
- &PyWAttribute::set_write_value)
- .def("set_write_value",
- (void (*) (Tango::WAttribute &, boost::python::object &, long))
- &PyWAttribute::set_write_value)
- .def("set_write_value",
- (void (*) (Tango::WAttribute &, boost::python::object &, long, long))
- &PyWAttribute::set_write_value)
-
- // old style get_write_value
- .def("get_write_value",
- (void (*) (Tango::WAttribute &, boost::python::list &))
- &PyWAttribute::get_write_value)
-
- // new style get_write_value
- .def("get_write_value",
- (PyObject* (*) (Tango::WAttribute &))
- &PyWAttribute::get_write_value)
- ;
-
-}
diff --git a/src/server/command.cpp b/src/server/command.cpp
index 5977e6e..ffdfe9a 100644
--- a/src/server/command.cpp
+++ b/src/server/command.cpp
@@ -1,3 +1,5 @@
+#include <boost/python.hpp>
+#include <boost/python/return_value_policy.hpp>
#include <tango.h>
#include "exception.h"
diff --git a/src/server/device_impl.cpp b/src/server/device_impl.cpp
index 6731980..f52e0f6 100644
--- a/src/server/device_impl.cpp
+++ b/src/server/device_impl.cpp
@@ -970,7 +970,24 @@ Tango::ConstDevString Device_4ImplWrap::default_dev_status()
void Device_4ImplWrap::signal_handler(long signo)
{
- CALL_DEVICE_METHOD_VARGS(Device_4Impl, signal_handler, signo)
+ try
+ {
+ CALL_DEVICE_METHOD_VARGS(Device_4Impl, signal_handler, signo)
+ }
+ catch(Tango::DevFailed &df)
+ {
+ long nb_err = df.errors.length();
+ df.errors.length(nb_err + 1);
+
+ df.errors[nb_err].reason = CORBA::string_dup(
+ "PyDs_UnmanagedSignalHandlerException");
+ df.errors[nb_err].desc = CORBA::string_dup(
+ "An unmanaged Tango::DevFailed exception occurred in signal_handler");
+ df.errors[nb_err].origin = CORBA::string_dup("Device_4Impl.signal_handler");
+ df.errors[nb_err].severity = Tango::ERR;
+
+ Tango::Except::print_exception(df);
+ }
}
void Device_4ImplWrap::default_signal_handler(long signo)
diff --git a/src/server/tango_util.cpp b/src/server/tango_util.cpp
index 7cddd63..e82cbe1 100644
--- a/src/server/tango_util.cpp
+++ b/src/server/tango_util.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
#include <iostream>
diff --git a/src/tango_numpy.h b/src/tango_numpy.h
index 3355160..9651514 100644
--- a/src/tango_numpy.h
+++ b/src/tango_numpy.h
@@ -1,3 +1,25 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
#pragma once
diff --git a/src/tgutils.h b/src/tgutils.h
index 913e32e..4070418 100644
--- a/src/tgutils.h
+++ b/src/tgutils.h
@@ -1,3 +1,25 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
#pragma once
diff --git a/src/time_val.cpp b/src/time_val.cpp
index d792f50..8aa6958 100644
--- a/src/time_val.cpp
+++ b/src/time_val.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
diff --git a/src/to_py.cpp b/src/to_py.cpp
index 5d6a267..a7e6cc3 100644
--- a/src/to_py.cpp
+++ b/src/to_py.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include "defs.h"
diff --git a/src/to_py.h b/src/to_py.h
index 852ef76..8494751 100644
--- a/src/to_py.h
+++ b/src/to_py.h
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#pragma once
#include <boost/python.hpp>
diff --git a/src/to_py_numpy.hpp b/src/to_py_numpy.hpp
index b0fcc36..e7a0358 100644
--- a/src/to_py_numpy.hpp
+++ b/src/to_py_numpy.hpp
@@ -1,3 +1,25 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
#pragma once
diff --git a/src/version.cpp b/src/version.cpp
index 58f5d27..2afd411 100644
--- a/src/version.cpp
+++ b/src/version.cpp
@@ -1,3 +1,26 @@
+/*******************************************************************************
+
+ This file is part of PyTango, a python binding for Tango
+
+ http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+
+ (copyleft) CELLS / ALBA Synchrotron, Bellaterra, Spain
+
+ This is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
#include <boost/python.hpp>
#include <tango.h>
--
Packaging for pytango
More information about the debian-science-commits
mailing list