00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GEKGDISPLAY_H
00023 #define GEKGDISPLAY_H
00024
00025 #include <gtk--/drawingarea.h>
00026 #include <gtk--/main.h>
00027 #include <unistd.h>
00028 #include "calibrate.h"
00029 #include "EKGdevice.h"
00030 #include "EKGbuffer.h"
00031 #include "EKGtools.h"
00032 using namespace std;
00033
00034
00041 class gEKGdisplay : public EKGdevice, public Gtk::DrawingArea
00042 {
00043 public:
00045 gEKGdisplay();
00047 ~gEKGdisplay();
00052 virtual gint configure_event_impl(GdkEventConfigure* p0);
00056 virtual gint expose_event_impl(GdkEventExpose* p0);
00061 virtual void input( float * d );
00065 void reset();
00069 const EKGbuffer & getValues() const { return Values; }
00070 private:
00071
00072
00073
00078 EKGbuffer Values;
00079
00080
00081
00090 gint Plast;
00099 static const int GapWidth = 20;
00104 static const int MinWidth = 100;
00108 Gdk_Color BGcolor;
00112 Gdk_Color FGcolor;
00117 Gdk_Window win;
00122 Gdk_GC gc;
00129 void drawRealtime( gint fd, GdkInputCondition );
00130
00131
00132
00138 gint zeroPos[6];
00146 float mVmax;
00153 gint scaleY( float y, int n );
00160 void scaleY( float * y, gint * Y );
00165 gint addX( gint a, gint b );
00166
00167
00168
00174 int Pipe[2];
00179 static const int dsize = 3 * sizeof(float);
00180 };
00181
00182
00183
00184
00185
00186
00187 inline gint gEKGdisplay::addX( gint a, gint b )
00188 {
00189 gint c = a + b;
00190 if ( c >= width() )
00191 c -= width();
00192 return c;
00193 };
00194
00195
00196
00197 inline gint gEKGdisplay::scaleY( float y, int n )
00198 {
00199 return static_cast<gint>( -y / mVmax * height() / 6 ) + zeroPos[n] ;
00200 };
00201 #endif
00202