Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

gr_OscopeGuts.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2003 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 
00023 #ifndef _GR_OSCOPEGUTS_H_
00024 #define _GR_OSCOPEGUTS_H_
00025 
00026 #include <gr_TriggerMode.h>
00027 
00041 class gr_OscopeGuts {
00042 private:
00043   static const int      MAX_CHANNELS = 16;
00044   enum ScopeState       { HOLD_OFF, LOOK_FOR_TRIGGER, POST_TRIGGER };
00045 
00046   int                   d_nchannels;            // how many channels
00047   int                   d_output_fd;            // file desc used to write output records
00048   gr_TriggerMode        d_trigger_mode;         
00049   int                   d_trigger_channel;      // which channel to watch for trigger condition
00050   double                d_sample_rate;          // input sample rate in Hz
00051   double                d_update_rate;          // approx freq to produce an output record (Hz)
00052   double                d_trigger_level;
00053 
00054   int                   d_obi;                  // output buffer index 
00055   float                *d_buffer[MAX_CHANNELS];
00056 
00057   ScopeState            d_state;
00058   int                   d_decimator_count;
00059   int                   d_decimator_count_init;
00060   int                   d_hold_off_count;
00061   int                   d_hold_off_count_init;
00062   int                   d_post_trigger_count;
00063   int                   d_post_trigger_count_init;
00064   float                 d_prev_sample;                  // used for trigger checking
00065 
00066   // NOT IMPLEMENTED
00067   gr_OscopeGuts (const gr_OscopeGuts &rhs);             // no copy constructor
00068   gr_OscopeGuts &operator= (const gr_OscopeGuts &rhs);  // no assignment operator
00069 
00070   void triggerChanged ();
00071   void updateRateOrDecimationChanged ();
00072   int  foundTrigger (float sample);     // returns -1, 0, +1
00073   void writeOutputRecords ();
00074 
00075   void enterHoldOff ();                 // called on state entry
00076   void enterLookForTrigger ();
00077   void enterPostTrigger ();
00078 
00079 public:
00080   // CREATORS
00081   gr_OscopeGuts (int nchannels, double sample_rate, int output_fd);
00082   ~gr_OscopeGuts ();
00083 
00084   // MANIPULATORS
00085 
00090   void processSample (const float *channel_data);
00091 
00092   bool setUpdateRate (double update_rate);
00093   bool setDecimationCount (int decimation_count);
00094   bool setTriggerChannel (int channel);
00095   bool setTriggerMode (gr_TriggerMode mode);
00096   bool setTriggerLevel (double trigger_level);
00097   bool setTriggerLevelAuto ();                          // set to 50% level
00098 
00099 
00100   // ACCESSORS
00101   int getNumChannels () const;
00102   double getSamplingRate () const;
00103   double getUpdateRate () const;
00104   int getDecimationCount () const;
00105   int getTriggerChannel () const;
00106   gr_TriggerMode getTriggerMode () const;
00107   double getTriggerLevel () const;
00108 
00109   // # of samples written to each output record.
00110   int getSamplesPerOutputRecord () const;
00111 };
00112 
00113 #endif /* _GR_OSCOPEGUTS_H_ */

Generated on Tue Mar 15 23:46:36 2005 for GNU Radio by  doxygen 1.4.0