Added binding for comedi_get/set_routing.
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 20 Aug 2008 15:15:25 +0000 (15:15 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 20 Aug 2008 15:15:25 +0000 (15:15 +0000)
c++/include/comedilib.hpp

index 319ee6c297575241a8091218e611b911317b8a09..092263e35b3ddf4234d7b9252251849e7aaeed8e 100644 (file)
@@ -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
                {