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 #ifndef MOBILAB_SIGNAL_HPP 00028 #define MOBILAB_SIGNAL_HPP 00029 00030 #include <stdint.h> 00031 #include <string> 00032 #include <Windows.h> 00033 #include "gmobilabplus.h" 00034 #include "ISignal.hpp" 00035 #include "ITimer.hpp" 00036 00037 class MobilabSignal : public ISignal { 00038 public: 00039 MobilabSignal(ITimer* pTimer, int32_t ain, int32_t dio, std::string port); 00040 ~MobilabSignal(); 00041 virtual bool open(uint8_t*); 00042 virtual bool init(size_t channels); 00043 virtual size_t channels(); 00044 virtual bool start(); 00045 virtual size_t acquire(); 00046 virtual void getdata(uint32_t* data, size_t samples); 00047 virtual uint64_t timestamp(); 00048 virtual bool stop(); 00049 virtual bool close(); 00050 private: 00051 ITimer* mpTimer; 00052 HANDLE mpGtec; 00053 int16_t* mpBuffer; 00054 _BUFFER_ST mDatBuffer; 00055 OVERLAPPED mEventHandler; 00056 std::string mPort; 00057 size_t mChannels; 00058 int32_t mAin; 00059 int32_t mDio; 00060 }; 00061 00062 #endif