00001 // Copyright (c) James Percent and Unlock contributors. 00002 // All rights reserved. 00003 // Redistribution and use in source and binary forms, with or without modification, 00004 // are permitted provided that the following conditions are met: 00005 // 00006 // 1. Redistributions of source code must retain the above copyright notice, 00007 // this list of conditions and the following disclaimer. 00008 // 00009 // 2. Redistributions in binary form must reproduce the above copyright 00010 // notice, this list of conditions and the following disclaimer in the 00011 // documentation and/or other materials provided with the distribution. 00012 // 00013 // 3. Neither the name of Unlock nor the names of its contributors may be used 00014 // to endorse or promote products derived from this software without 00015 // specific prior written permission. 00016 00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00018 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00019 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00020 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 00021 // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00024 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 00028 #ifndef NIDAQ_SIGNAL_HPP 00029 #define NIDAQ_SIGNAL_HPP 00030 00031 #include <stdint.h> 00032 #include <cstddef> 00033 #include <NIDAQmx.h> 00034 #include "ISignal.hpp" 00035 #include "Portability.hpp" 00036 #include "ITimer.hpp" 00037 00038 class DllExport NidaqSignal : public ISignal 00039 { 00040 public: 00041 00042 NidaqSignal(ITimer* pTimer); 00043 virtual ~NidaqSignal(); 00044 virtual bool open(uint8_t* mac); 00045 virtual bool init(size_t channels); 00046 virtual size_t channels(); 00047 virtual bool start(); 00048 virtual size_t acquire(); 00049 virtual void getdata(uint32_t* buffer, size_t samples); 00050 virtual uint64_t timestamp(); 00051 virtual bool stop(); 00052 virtual bool close(); 00053 00054 private: 00055 ITimer* mpTimer; 00056 TaskHandle mTaskHandle; 00057 float64* mpDataBuffer; 00058 int32_t mChannels; 00059 int32_t mSamplesPerChannelPerBatch; 00060 }; 00061 00062 #endif