00001 00002 /* 00003 * This file is part of EKG/gEKG, a software package to record EKG. 00004 * Copyright © 2003 Lars Stollenwerk 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU General Public License as published by the 00008 * Free Software Foundation; either version 2 of the License, or (at your 00009 * option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00022 #ifndef EKGFREQ_H 00023 #define EKGFREQ_H 00024 00025 #include <sys/time.h> 00026 #include <cmath> 00027 #include <iostream> 00028 #include <string> 00029 #include "EKGdevice.h" 00030 #include "calibrate.h" 00031 using namespace std; 00032 00040 class EKGfreq : public EKGdevice 00041 { 00042 public: 00046 EKGfreq() : beepFlag(false), freqFlag(false), freq(0), lastQRS(0), 00047 Pthreshold(0), Nthreshold(0), Zthreshold(0), QRS(false) 00048 { setDecay(1.0); } 00054 bool setBeep( bool x ); 00060 bool setFreq( bool x ); 00066 float setDecay( float x ); 00071 virtual void input( float * d ); 00072 protected: 00076 bool beepFlag; 00080 bool freqFlag; 00084 int freq; 00089 double lastQRS; 00093 virtual void handleQRS(); 00098 void beep(){ if ( beepFlag ) cerr << '\a'; } 00103 void printFreq(){ if ( freqFlag ) cerr << "Pulse : " << freq << " \r"; } 00109 void calcFreq(); 00110 // ---------------------------------------------------------------------- 00111 // QRS-Komplex Detektor 00112 // ---------------------------------------------------------------------- 00116 float Pthreshold; 00120 float Nthreshold; 00125 float Zthreshold; 00131 float decay; 00137 float zdecay; 00141 bool QRS; 00149 bool aboveThreshold( const float x ); 00150 }; 00151 00152 #endif