From fa3510e8782ddad22f64b818e912ee1a1e9aa0fa Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 20 Aug 2008 15:15:25 +0000 Subject: [PATCH] Added binding for comedi_get/set_routing. --- c++/include/comedilib.hpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/c++/include/comedilib.hpp b/c++/include/comedilib.hpp index 319ee6c..092263e 100644 --- a/c++/include/comedilib.hpp +++ b/c++/include/comedilib.hpp @@ -411,11 +411,25 @@ namespace comedi if(retval < 0) { std::ostringstream message; - message << __PRETTY_FUNCTION__ << ": comedi_set_clock_source() failed."; + message << __PRETTY_FUNCTION__ << ": comedi_get_clock_source() failed."; std::cerr << message.str() << std::endl; - comedi_perror("comedi_set_clock_source"); + comedi_perror("comedi_get_clock_source"); + throw std::runtime_error(message.str()); + } + } + unsigned get_routing(unsigned channel) const + { + unsigned routing = 0; + int retval = comedi_get_routing(comedi_handle(), index(), channel, &routing); + if(retval < 0) + { + std::ostringstream message; + message << __PRETTY_FUNCTION__ << ": comedi_get_routing() failed."; + std::cerr << message.str() << std::endl; + comedi_perror("comedi_get_routing"); throw std::runtime_error(message.str()); } + return routing; } comedi_polynomial_t hardcal_converter(unsigned channel, unsigned range, enum comedi_conversion_direction direction) const @@ -593,6 +607,18 @@ namespace comedi throw std::runtime_error(message.str()); } } + void set_routing(unsigned channel, unsigned routing) + { + int retval = comedi_set_routing(comedi_handle(), index(), channel, routing); + if(retval < 0) + { + std::ostringstream message; + message << __PRETTY_FUNCTION__ << ": comedi_set_routing() failed."; + std::cerr << message.str() << std::endl; + comedi_perror("comedi_set_routing"); + throw std::runtime_error(message.str()); + } + } comedi_polynomial_t softcal_converter(unsigned channel, unsigned range, enum comedi_conversion_direction direction, const calibration &cal) const { -- 2.26.2