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 EKGSOURCE_H 00023 #define EKGSOURCE_H 00024 00025 #include <fcntl.h> 00026 #include <sys/types.h> 00027 #include <sys/stat.h> 00028 #include <termios.h> 00029 #include <unistd.h> 00030 #include <pthread.h> 00031 00032 #include <string> 00033 #include <sstream> 00034 #include <iostream> 00035 00036 #include "EKGdevice.h" 00037 #include "calibrate.h" 00038 using namespace std; 00039 00055 class EKGsource 00056 { 00057 public: 00058 EKGsource() : sending(false), nextDevice(NULL) {} 00059 ~EKGsource(); 00061 void serialOpen( const char * pathname ); 00065 void start(); 00069 void stop(); 00074 void timer( int t ); 00080 void raw(); 00085 void connectTo( EKGdevice * d ); 00086 private: 00087 // ---------------------------------------------------------------------- 00088 // Serielle Schnittstelle 00089 // ---------------------------------------------------------------------- 00090 00094 int SerialPort; 00098 termios SerialIOs; 00103 int readByte(); 00104 00105 // ---------------------------------------------------------------------- 00106 // Datenstrom 00107 // ---------------------------------------------------------------------- 00108 00114 void synchronise(); 00120 void flush(); 00126 void fillBasket(); 00127 00128 00129 // ---------------------------------------------------------------------- 00130 // Sender 00131 // ---------------------------------------------------------------------- 00132 00136 pthread_t senderID; 00140 bool sending; 00144 float dataBasket[3]; 00148 EKGdevice * nextDevice; 00156 static void * Sender( void * Me ); 00157 }; 00158 00159 #endif 00160