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

gr_oscope_guts.h

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

Generated on Sat Jul 8 17:04:51 2006 for GNU Radio 2.x by  doxygen 1.4.1