00001
00008 #ifndef _Q_NI_DIGITAL_CONTROLLER_HH_
00009 #define _Q_NI_DIGITAL_CONTROLLER_HH_
00010
00011 #ifdef __NI_HARDWARE__
00012 #include <NIDAQmx.h>
00013 #endif
00014
00015 #include <vector>
00016
00017 class QNiDigitalController {
00018 public:
00019
00024 QNiDigitalController(unsigned short nPorts);
00025
00027 virtual ~QNiDigitalController();
00028
00035 virtual bool SetupPort(const unsigned short& portId,
00036 const unsigned char& word);
00037
00043 virtual bool SetupPorts(const std::vector<unsigned char>& words);
00044
00049 virtual bool Write();
00050
00055 virtual bool ClearPorts();
00056
00061 virtual bool ClearPort(unsigned short portId);
00062
00063 protected:
00064
00065 #ifdef __NI_HARDWARE__
00066 TaskHandle fTaskHandle;
00067 #endif
00068 const unsigned short fPorts;
00069 unsigned long fWords;
00070
00082 int HandleNiError(int niErrCode);
00083
00085 void ClearTask();
00086
00088 bool InitTask();
00089 };
00090 #endif