[pytango] 24/98: Implement pipe config (client side)

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:17:41 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to tag v9.2.0
in repository pytango.

commit 0139714ba6a76593390543c33745bdcdaac8bf06
Author: Jose Tiago Coutinho Macara <tiago.coutinho at esrf.fr>
Date:   Wed Dec 2 13:18:09 2015 +0100

    Implement pipe config (client side)
---
 Makefile                          |  1 -
 src/boost/cpp/base_types.cpp      |  2 --
 src/boost/cpp/device_proxy.cpp    |  3 ---
 src/boost/cpp/from_py.h           |  3 +++
 src/boost/cpp/to_py.cpp           | 29 ++++++++++++++++++++
 src/boost/cpp/to_py.h             |  6 +++++
 src/boost/python/device_proxy.py  | 56 +++++++++++++++++++++++++++++++++++++++
 src/boost/python/device_server.py | 12 +++++++++
 8 files changed, 106 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 5f43395..64133b6 100644
--- a/Makefile
+++ b/Makefile
@@ -154,7 +154,6 @@ $(OBJS_DIR)/attribute_dimension.o \
 $(OBJS_DIR)/attribute_event_info.o \
 $(OBJS_DIR)/attribute_info.o \
 $(OBJS_DIR)/attribute_info_ex.o \
-$(OBJS_DIR)/device_pipe.o \
 $(OBJS_DIR)/pipe_info.o \
 $(OBJS_DIR)/attribute_proxy.o \
 $(OBJS_DIR)/base_types.o \
diff --git a/src/boost/cpp/base_types.cpp b/src/boost/cpp/base_types.cpp
index 35d2d23..e9f2bf7 100644
--- a/src/boost/cpp/base_types.cpp
+++ b/src/boost/cpp/base_types.cpp
@@ -39,7 +39,6 @@ void export_device_data();
 void export_device_attribute();
 void export_device_data_history();
 void export_device_attribute_history();
-void export_device_pipe();
 void export_pipe_info();
 
 void export_dev_error();
@@ -420,7 +419,6 @@ void export_base_types()
     export_device_attribute();
     export_device_data_history();
     export_device_attribute_history();
-    export_device_pipe();
     export_pipe_info();
 
     export_dev_error();
diff --git a/src/boost/cpp/device_proxy.cpp b/src/boost/cpp/device_proxy.cpp
index 28f0689..6f1b2b2 100644
--- a/src/boost/cpp/device_proxy.cpp
+++ b/src/boost/cpp/device_proxy.cpp
@@ -586,9 +586,6 @@ void export_device_proxy()
 	     &Tango::DeviceProxy::set_pipe_config,
 	     ( arg_("self"), arg_("seq") ) )
 
-	.def("__read_pipe", &PyDeviceProxy::read_pipe,
-	     ( arg_("self"), arg_("pipe_name") ) )
-
         //
         // attribute methods
         //
diff --git a/src/boost/cpp/from_py.h b/src/boost/cpp/from_py.h
index efe33a5..d86cd65 100644
--- a/src/boost/cpp/from_py.h
+++ b/src/boost/cpp/from_py.h
@@ -701,3 +701,6 @@ void from_py_object(bopy::object &, Tango::AttributeConfigList &);
 void from_py_object(bopy::object &, Tango::AttributeConfigList_2 &);
 void from_py_object(bopy::object &, Tango::AttributeConfigList_3 &);
 void from_py_object(bopy::object &, Tango::AttributeConfigList_5 &);
+
+void from_py_object(bopy::object &, Tango::PipeConfig &);
+void from_py_object(bopy::object &, Tango::PipeConfigList &);
diff --git a/src/boost/cpp/to_py.cpp b/src/boost/cpp/to_py.cpp
index ea57a03..66eff51 100644
--- a/src/boost/cpp/to_py.cpp
+++ b/src/boost/cpp/to_py.cpp
@@ -257,3 +257,32 @@ boost::python::list to_py(const Tango::AttributeConfigList_5 &attr_conf_list)
     }
     return py_attr_conf_list;
 }
+
+object to_py(const Tango::PipeConfig &pipe_conf, object py_pipe_conf)
+{
+    if(py_pipe_conf.ptr() == Py_None)
+    {
+        PYTANGO_MOD
+        py_pipe_conf = pytango.attr("PipeConfig")();
+    }
+
+    py_pipe_conf.attr("name") = str(pipe_conf.name.in());
+    py_pipe_conf.attr("description") = str(pipe_conf.description.in());
+    py_pipe_conf.attr("label") = str(pipe_conf.label.in());
+    py_pipe_conf.attr("level") = pipe_conf.level;
+    py_pipe_conf.attr("writable") = pipe_conf.writable;
+    py_pipe_conf.attr("extensions") = CORBA_sequence_to_list<Tango::DevVarStringArray>::to_list(pipe_conf.extensions);
+    return py_pipe_conf;
+}
+
+boost::python::list to_py(const Tango::PipeConfigList &pipe_conf_list)
+{
+    boost::python::list py_pipe_conf_list;
+    boost::python::object none;
+    for(unsigned long index = 0; index < pipe_conf_list.length(); ++index)
+    {
+        const Tango::PipeConfig &pipe_conf = pipe_conf_list[index];
+        py_pipe_conf_list.append(to_py(pipe_conf, none));
+    }
+    return py_pipe_conf_list;
+}
diff --git a/src/boost/cpp/to_py.h b/src/boost/cpp/to_py.h
index 0fdd1cb..d04bb63 100644
--- a/src/boost/cpp/to_py.h
+++ b/src/boost/cpp/to_py.h
@@ -361,6 +361,12 @@ boost::python::list to_py(const Tango::AttributeConfigList_2 &);
 boost::python::list to_py(const Tango::AttributeConfigList_3 &);
 boost::python::list to_py(const Tango::AttributeConfigList_5 &);
 
+boost::python::object to_py(const Tango::PipeConfig &,
+                            boost::python::object);
+
+boost::python::object to_py(const Tango::PipeConfigList &,
+                            boost::python::object);
+
 template<class T>
 inline boost::python::object to_py_list(const T *seq)
 {
diff --git a/src/boost/python/device_proxy.py b/src/boost/python/device_proxy.py
index 95731a5..b30a6d2 100644
--- a/src/boost/python/device_proxy.py
+++ b/src/boost/python/device_proxy.py
@@ -778,6 +778,58 @@ def __DeviceProxy__get_command_config(self, value=(constants.AllCmd,)):
         return self._get_command_config(v)
 
     raise TypeError('value must be a string or a sequence<string>')
+
+def __DeviceProxy__get_pipe_config(self, value=None):
+    """
+    get_pipe_config( self) -> PipeInfoList
+
+            Return the pipe configuration for all pipes.
+
+        Return     : (PipeInfoList) Object containing the pipes
+                     information
+
+        Throws     : ConnectionFailed, CommunicationFailed,
+                     DevFailed from device
+
+    get_pipe_config( self, name) -> PipeInfo
+
+            Return the pipe configuration for a single pipe.
+
+        Parameters :
+                - name : (str) pipe name
+
+        Return     : (PipeInfo) Object containing the pipe
+                     information
+
+        Throws     : ConnectionFailed, CommunicationFailed,
+                     DevFailed from device
+
+    get_pipe_config( self, names) -> PipeInfoList
+
+            Return the pipe configuration for the list of specified pipes. To get all the
+            pipes pass a sequence containing the constant PyTango.constants.AllPipe
+
+        Parameters :
+                - names : (sequence<str>) pipe names
+
+        Return     : (PipeInfoList) Object containing the pipes
+                     information
+
+        Throws     : ConnectionFailed, CommunicationFailed,
+                     DevFailed from device
+
+        New in PyTango 9.0.0
+    """
+    if value is None:
+        value = [constants.AllPipe]
+    if isinstance(value, StdStringVector) or is_pure_str(value):
+        return self._get_pipe_config(value)
+    elif isinstance(value, collections.Sequence):
+        v = seq_2_StdStringVector(value)
+        return self._get_pipe_config(v)
+
+    raise TypeError('value must be a string or a sequence<string>')
+
 def __DeviceProxy__set_attribute_config(self, value):
     """
     set_attribute_config( self, attr_info) -> None
@@ -1262,6 +1314,10 @@ def __init_DeviceProxy():
     DeviceProxy.set_attribute_config = __DeviceProxy__set_attribute_config
 
     DeviceProxy.get_command_config = __DeviceProxy__get_command_config
+
+    DeviceProxy.get_pipe_config = __DeviceProxy__get_pipe_config
+    DeviceProxy.set_pipe_config = __DeviceProxy__set_pipe_config
+
     DeviceProxy.__get_event_map = __DeviceProxy__get_event_map
     DeviceProxy.__get_event_map_lock = __DeviceProxy__get_event_map_lock
     DeviceProxy.subscribe_event = green(__DeviceProxy__subscribe_event)
diff --git a/src/boost/python/device_server.py b/src/boost/python/device_server.py
index 88e12f9..1ecaf0b 100644
--- a/src/boost/python/device_server.py
+++ b/src/boost/python/device_server.py
@@ -177,6 +177,18 @@ class AttributeConfig_5(object):
         self.event_prop = EventProperties()
         self.sys_extensions = []
 
+class PipeConfig(object):
+    """
+    This class represents the python interface for the Tango IDL
+    object PipeConfig."""
+
+    def __init__(self):
+        self.name = ''
+        self.description = ''
+        self.label = ''
+        self.level = PipeWriteType.PIPE_READ
+        self.extensions = []
+
 def __Attribute__get_properties(self, attr_cfg = None):
     """get_properties(self, attr_cfg = None) -> AttributeConfig
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list