00001 // PTF - Psychological Test Framework 00002 // http://ptf.sourceforge.net 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Library General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 #include <ptf/input/simulatedinputdevice.hpp> 00019 #include <ptf/core/ptfcore.hpp> 00020 #include <ptf/core/timeinterval.hpp> 00021 00025 SimulatedInputDevice::SimulatedInputDevice() { 00026 // nothing to do here 00027 } 00028 00032 SimulatedInputDevice::~SimulatedInputDevice() { 00033 // nothing to do here 00034 } 00035 00040 void SimulatedInputDevice::run(){ 00041 while (active) { 00042 sleep(2000); 00043 TimeInterval* time = new TimeInterval(); 00044 time->measureA(); 00045 sleep(15); 00046 time->measureB(); 00047 vector<bool>* buttons = new vector<bool>(); 00048 buttons->push_back(true); 00049 ReactionRecord* test = new ReactionRecord(time, buttons); 00050 PtfCore::getSingleton().getReactionRecordsMutex().enterMutex(); 00051 PtfCore::getSingleton().getReactionRecords().push_back(test); 00052 PtfCore::getSingleton().getReactionRecordsMutex().leaveMutex(); 00053 } 00054 }