Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

gr_oscope_guts.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 
00024 #ifndef INCLUDED_GR_OSCOPE_GUTS_H
00025 #define INCLUDED_GR_OSCOPE_GUTS_H
00026 
00027 #include <gr_trigger_mode.h>
00028 
00042 class gr_oscope_guts {
00043 private:
00044   static const int      MAX_CHANNELS = 16;
00045   enum scope_state      { HOLD_OFF, LOOK_FOR_TRIGGER, POST_TRIGGER };
00046 
00047   int                   d_nchannels;            // how many channels
00048   int                   d_output_fd;            // file desc used to write output records
00049   gr_trigger_mode       d_trigger_mode;         
00050   int                   d_trigger_channel;      // which channel to watch for trigger condition
00051   double                d_sample_rate;          // input sample rate in Hz
00052   double                d_update_rate;          // approx freq to produce an output record (Hz)
00053   double                d_trigger_level;
00054 
00055   int                   d_obi;                  // output buffer index 
00056   float                *d_buffer[MAX_CHANNELS];
00057 
00058   scope_state           d_state;
00059   int                   d_decimator_count;
00060   int                   d_decimator_count_init;
00061   int                   d_hold_off_count;
00062   int                   d_hold_off_count_init;
00063   int                   d_post_trigger_count;
00064   int                   d_post_trigger_count_init;
00065   float                 d_prev_sample;                  // used for trigger checking
00066 
00067   // NOT IMPLEMENTED
00068   gr_oscope_guts (const gr_oscope_guts &rhs);                   // no copy constructor
00069   gr_oscope_guts &operator= (const gr_oscope_guts &rhs);        // no assignment operator
00070 
00071   void trigger_changed ();
00072   void update_rate_or_decimation_changed ();
00073   int  found_trigger (float sample);    // returns -1, 0, +1
00074   void write_output_records ();
00075 
00076   void enter_hold_off ();                       // called on state entry
00077   void enter_look_for_trigger ();
00078   void enter_post_trigger ();
00079 
00080 public:
00081   // CREATORS
00082   gr_oscope_guts (int nchannels, double sample_rate, int output_fd);
00083   ~gr_oscope_guts ();
00084 
00085   // MANIPULATORS
00086 
00091   void process_sample (const float *channel_data);
00092 
00093   bool set_update_rate (double update_rate);
00094   bool set_decimation_count (int decimation_count);
00095   bool set_trigger_channel (int channel);
00096   bool set_trigger_mode (gr_trigger_mode mode);
00097   bool set_trigger_level (double trigger_level);
00098   bool set_trigger_level_auto ();                               // set to 50% level
00099 
00100 
00101   // ACCESSORS
00102   int num_channels () const;
00103   double sampling_rate () const;
00104   double update_rate () const;
00105   int get_decimation_count () const;
00106   int get_trigger_channel () const;
00107   gr_trigger_mode get_trigger_mode () const;
00108   double get_trigger_level () const;
00109 
00110   // # of samples written to each output record.
00111   int get_samples_per_output_record () const;
00112 };
00113 
00114 #endif /* INCLUDED_GR_OSCOPE_GUTS_H */

Generated on Sun Sep 18 08:21:57 2005 for GNU Radio 2.x by  doxygen 1.4.4