From: Frank Mori Hess Date: Fri, 12 Oct 2007 21:22:05 +0000 (+0000) Subject: Added default constructor for comedi::subdevice, and added missing wrapper X-Git-Tag: r0_8_1~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bdbd1ab792b39486e35c01cf4d0d5cf69c538c36;p=comedilib.git Added default constructor for comedi::subdevice, and added missing wrapper for comedi_cancel(). --- 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;