From bdbd1ab792b39486e35c01cf4d0d5cf69c538c36 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Fri, 12 Oct 2007 21:22:05 +0000 Subject: [PATCH] Added default constructor for comedi::subdevice, and added missing wrapper for comedi_cancel(). --- c++/include/comedilib.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/c++/include/comedilib.hpp b/c++/include/comedilib.hpp index 4bce827..0df1f95 100644 --- a/c++/include/comedilib.hpp +++ b/c++/include/comedilib.hpp @@ -167,6 +167,8 @@ namespace comedi class subdevice { public: + subdevice(): _index(-1) + {} subdevice(const device &dev, unsigned subdevice_index): _device(dev), _index(subdevice_index) { @@ -191,6 +193,18 @@ namespace comedi } return retval; } + void cancel() + { + int retval = comedi_cancel(comedi_handle(), index()); + if(retval < 0) + { + std::ostringstream message; + message << __PRETTY_FUNCTION__ << ": comedi_cancel() failed, return value=" << retval << " ."; + std::cerr << message.str() << std::endl; + comedi_perror("comedi_cancel"); + throw std::runtime_error(message.str()); + } + } lsampl_t data_read(unsigned channel, unsigned range, unsigned aref) const { lsampl_t value; -- 2.26.2