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