[pytango] 04/98: Implement DeviceProxy get_command_list() and get_command_config()
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:17:39 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 e1538e2c9597c605b0b9c270cd9734130c1d7e9b
Author: Jose Tiago Coutinho Macara <tiago.coutinho at esrf.fr>
Date: Tue Dec 1 10:28:21 2015 +0100
Implement DeviceProxy get_command_list() and get_command_config()
---
src/boost/cpp/device_proxy.cpp | 26 ++++++++++++++-----
src/boost/python/device_proxy.py | 56 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+), 6 deletions(-)
diff --git a/src/boost/cpp/device_proxy.cpp b/src/boost/cpp/device_proxy.cpp
index 1a72b33..a60f1f0 100644
--- a/src/boost/cpp/device_proxy.cpp
+++ b/src/boost/cpp/device_proxy.cpp
@@ -33,7 +33,7 @@ namespace PyDeviceProxy
return bopy::make_tuple(ret);
}
};
-
+
static inline Tango::DevState state(Tango::DeviceProxy& self)
{
AutoPythonAllowThreads guard;
@@ -453,7 +453,7 @@ void export_device_proxy()
// general methods
//
.def("dev_name", &Tango::DeviceProxy::dev_name)
-
+
.def("info", &Tango::DeviceProxy::info,
( arg_("self") ),
bopy::return_internal_reference<1>() )
@@ -480,19 +480,33 @@ void export_device_proxy()
( arg_("self") ) )
.def("get_tango_lib_version", &Tango::DeviceProxy::get_tango_lib_version,
- ( arg_("self") ) )
+ ( arg_("self") ) )
.def("_ping", &PyDeviceProxy::ping,
( arg_("self") ) )
-
+
.def("black_box", &Tango::DeviceProxy::black_box,
( arg_("self"), arg_("n") ),
bopy::return_value_policy<bopy::manage_new_object>() )
//
- // device methods
+ // command methods
//
+ .def("get_command_list", &Tango::DeviceProxy::get_command_list,
+ ( arg_("self") ),
+ bopy::return_value_policy<bopy::manage_new_object>() )
+
+ .def("_get_command_config",
+ (Tango::CommandInfoList* (Tango::DeviceProxy::*)(StdStringVector &))
+ &Tango::DeviceProxy::get_command_config,
+ ( arg_("self"), arg_("attr_names") ),
+ bopy::return_value_policy<bopy::manage_new_object>() )
+
+ .def("_get_command_config",
+ (Tango::CommandInfo (Tango::DeviceProxy::*)(const std::string&))
+ &Tango::DeviceProxy::get_command_config,
+ ( arg_("self"), arg_("attr_name") ) )
.def("command_query", &Tango::DeviceProxy::command_query,
( arg_("self"), arg_("command") ) )
@@ -716,7 +730,7 @@ void export_device_proxy()
(void (*) (bopy::object, bopy::object, bopy::object))
&PyDeviceProxy::write_attributes_asynch,
( arg_("self"), arg_("values"), arg_("callback") ) )
-
+
//
// Logging administration methods
//
diff --git a/src/boost/python/device_proxy.py b/src/boost/python/device_proxy.py
index b9b3dcf..44f9b51 100644
--- a/src/boost/python/device_proxy.py
+++ b/src/boost/python/device_proxy.py
@@ -692,6 +692,49 @@ def __DeviceProxy__get_attribute_config_ex(self, value):
raise TypeError('value must be a string or a sequence<string>')
+def __DeviceProxy__get_command_config(self, value=(constants.AllCmd,)):
+ """
+ get_command_config( self) -> CommandInfoList
+
+ Return the command configuration for all commands.
+
+ Return : (CommandInfoList) Object containing the commands
+ information
+
+ Throws : ConnectionFailed, CommunicationFailed,
+ DevFailed from device
+
+ get_command_config( self, name) -> CommandInfo
+
+ Return the command configuration for a single command.
+
+ Parameters :
+ - name : (str) command name
+ Return : (CommandInfo) Object containing the command
+ information
+
+ Throws : ConnectionFailed, CommunicationFailed,
+ DevFailed from device
+
+ get_command_config( self, names) -> CommandInfoList
+
+ Return the command configuration for the list of specified commands.
+
+ Parameters :
+ - names : (sequence<str>) command names
+ Return : (CommandInfoList) Object containing the commands
+ information
+
+ Throws : ConnectionFailed, CommunicationFailed,
+ DevFailed from device
+ """
+ if isinstance(value, StdStringVector) or is_pure_str(value):
+ return self._get_command_config(value)
+ elif isinstance(value, collections.Sequence):
+ v = seq_2_StdStringVector(value)
+ return self._get_command_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
@@ -1119,6 +1162,7 @@ def __init_DeviceProxy():
DeviceProxy.get_attribute_config_ex = __DeviceProxy__get_attribute_config_ex
DeviceProxy.set_attribute_config = __DeviceProxy__set_attribute_config
+ DeviceProxy.get_command_config = __DeviceProxy__get_command_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)
@@ -1300,6 +1344,18 @@ def __doc_DeviceProxy():
# Device methods
#-------------------------------------
+ document_method("get_command_list", """
+ get_command_list(self) -> sequence<str>
+
+ Return the names of all commands implemented for this device.
+
+ Parameters : None
+ Return : sequence<str>
+
+ Throws : ConnectionFailed, CommunicationFailed,
+ DevFailed from device
+ """)
+
document_method("command_query", """
command_query(self, command) -> CommandInfo
--
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