diff options
Diffstat (limited to 'gr-wxgui/include')
-rw-r--r-- | gr-wxgui/include/wxgui/CMakeLists.txt | 32 | ||||
-rw-r--r-- | gr-wxgui/include/wxgui/api.h | 33 | ||||
-rw-r--r-- | gr-wxgui/include/wxgui/histo_sink_f.h | 55 | ||||
-rw-r--r-- | gr-wxgui/include/wxgui/oscope_guts.h | 131 | ||||
-rw-r--r-- | gr-wxgui/include/wxgui/oscope_sink_f.h | 53 | ||||
-rw-r--r-- | gr-wxgui/include/wxgui/oscope_sink_x.h | 91 | ||||
-rw-r--r-- | gr-wxgui/include/wxgui/trigger_mode.h | 44 |
7 files changed, 439 insertions, 0 deletions
diff --git a/gr-wxgui/include/wxgui/CMakeLists.txt b/gr-wxgui/include/wxgui/CMakeLists.txt new file mode 100644 index 0000000000..fad84792e1 --- /dev/null +++ b/gr-wxgui/include/wxgui/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright 2013 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Install header files +######################################################################## +install(FILES + api.h + histo_sink_f.h + oscope_guts.h + oscope_sink_f.h + oscope_sink_x.h + trigger_mode.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/wxgui + COMPONENT "wxgui_devel" +) diff --git a/gr-wxgui/include/wxgui/api.h b/gr-wxgui/include/wxgui/api.h new file mode 100644 index 0000000000..cf9e980a9c --- /dev/null +++ b/gr-wxgui/include/wxgui/api.h @@ -0,0 +1,33 @@ +/* + * Copyright 2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_WXGUI_API_H +#define INCLUDED_WXGUI_API_H + +#include <attributes.h> + +#ifdef gnuradio_wxgui_EXPORTS +# define WXGUI_API __GR_ATTR_EXPORT +#else +# define WXGUI_API __GR_ATTR_IMPORT +#endif + +#endif /* INCLUDED_WXGUI_API_H */ diff --git a/gr-wxgui/include/wxgui/histo_sink_f.h b/gr-wxgui/include/wxgui/histo_sink_f.h new file mode 100644 index 0000000000..f65517ca35 --- /dev/null +++ b/gr-wxgui/include/wxgui/histo_sink_f.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- */ +/* + * Copyright 2009,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_HISTO_SINK_F_H +#define INCLUDED_GR_HISTO_SINK_F_H + +#include <wxgui/api.h> +#include <gr_sync_block.h> +#include <gr_msg_queue.h> + +namespace gr { + namespace wxgui { + + /*! + * \brief Histogram module. + * \ingroup sink_blk + */ + class WXGUI_API histo_sink_f : virtual public gr_sync_block + { + public: + // gr::blocks::histo_sink_f::sptr + typedef boost::shared_ptr<histo_sink_f> sptr; + + static sptr make(gr_msg_queue_sptr msgq); + + virtual unsigned int get_frame_size(void) = 0; + virtual unsigned int get_num_bins(void) = 0; + + virtual void set_frame_size(unsigned int frame_size) = 0; + virtual void set_num_bins(unsigned int num_bins) = 0; + }; + + } /* namespace wxgui */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_HISTO_SINK_F_H */ diff --git a/gr-wxgui/include/wxgui/oscope_guts.h b/gr-wxgui/include/wxgui/oscope_guts.h new file mode 100644 index 0000000000..a6abd81539 --- /dev/null +++ b/gr-wxgui/include/wxgui/oscope_guts.h @@ -0,0 +1,131 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef INCLUDED_GR_OSCOPE_GUTS_H +#define INCLUDED_GR_OSCOPE_GUTS_H + +#include <wxgui/api.h> +#include <wxgui/trigger_mode.h> +#include <gr_msg_queue.h> + +namespace gr { + namespace wxgui { + + /*! + * \brief guts of oscilloscope trigger and buffer module + * + * This module processes sets of samples provided the \p + * process_sample method. When appropriate given the updateRate, + * sampleRate and trigger conditions, process_sample will + * periodically write output records of captured data to + * output_fd. For each trigger event, nchannels records will be + * written. Each record consists of get_samples_per_output_record + * binary floats. The trigger instant occurs at the 1/2 way point + * in the buffer. Thus, output records consist of 50% pre-trigger + * data and 50% post-trigger data. + */ + + class WXGUI_API oscope_guts + { + public: + static const int MAX_CHANNELS = 8; + + private: + enum scope_state { HOLD_OFF, LOOK_FOR_TRIGGER, POST_TRIGGER }; + + int d_nchannels; // how many channels + gr_msg_queue_sptr d_msgq; // message queue we stuff output records into + trigger_mode d_trigger_mode; + trigger_slope d_trigger_slope; + int d_trigger_channel; // which channel to watch for trigger condition + double d_sample_rate; // input sample rate in Hz + double d_update_rate; // approx freq to produce an output record (Hz) + double d_trigger_level; + + int d_obi; // output buffer index + float *d_buffer[MAX_CHANNELS]; + + scope_state d_state; + int d_decimator_count; + int d_decimator_count_init; + int d_hold_off_count; + int d_hold_off_count_init; + int d_pre_trigger_count; + int d_post_trigger_count; + int d_post_trigger_count_init; + float d_trigger_off; //%sample trigger is off + + // NOT IMPLEMENTED + oscope_guts(const oscope_guts &rhs); // no copy constructor + oscope_guts &operator= (const oscope_guts &rhs); // no assignment operator + + void trigger_changed(); + void update_rate_or_decimation_changed(); + bool found_trigger(); // returns true if found + void write_output_records(); + + void enter_hold_off(); // called on state entry + void enter_look_for_trigger(); + void enter_post_trigger(); + + public: + // CREATORS + oscope_guts(double sample_rate, gr_msg_queue_sptr msgq); + ~oscope_guts(); + + // MANIPULATORS + + /*! + * \param channel_data points to nchannels float values. These + * are the values for each channel at this sample time. + */ + void process_sample(const float *channel_data); + + bool set_update_rate(double update_rate); + bool set_decimation_count(int decimation_count); + bool set_trigger_channel(int channel); + bool set_trigger_mode(trigger_mode mode); + bool set_trigger_slope(trigger_slope slope); + bool set_trigger_level(double trigger_level); + bool set_trigger_level_auto(); // set to 50% level + bool set_sample_rate(double sample_rate); + bool set_num_channels(int nchannels); + + // ACCESSORS + int num_channels() const; + double sample_rate() const; + double update_rate() const; + int get_decimation_count() const; + int get_trigger_channel() const; + trigger_mode get_trigger_mode() const; + trigger_slope get_trigger_slope() const; + double get_trigger_level() const; + + // # of samples written to each output record. + int get_samples_per_output_record() const; + }; + + } /* namespace wxgui */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_OSCOPE_GUTS_H */ diff --git a/gr-wxgui/include/wxgui/oscope_sink_f.h b/gr-wxgui/include/wxgui/oscope_sink_f.h new file mode 100644 index 0000000000..a7c7657d40 --- /dev/null +++ b/gr-wxgui/include/wxgui/oscope_sink_f.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003-2005,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_OSCOPE_SINK_F_H +#define INCLUDED_GR_OSCOPE_SINK_F_H + +#include <wxgui/api.h> +#include <wxgui/oscope_sink_x.h> +#include <gr_msg_queue.h> + +namespace gr { + namespace wxgui { + + /*! + * \brief Building block for python oscilloscope module. + * \ingroup sink_blk + * + * Accepts multiple float streams. + */ + class WXGUI_API oscope_sink_f + : virtual public oscope_sink_x + { + public: + // gr::blocks::oscope_sink_f::sptr + typedef boost::shared_ptr<oscope_sink_f> sptr; + + static sptr make(double sampling_rate, gr_msg_queue_sptr msgq); + }; + + } /* namespace wxgui */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_OSCOPE_SINK_F_H */ + diff --git a/gr-wxgui/include/wxgui/oscope_sink_x.h b/gr-wxgui/include/wxgui/oscope_sink_x.h new file mode 100644 index 0000000000..17fa9a0f5a --- /dev/null +++ b/gr-wxgui/include/wxgui/oscope_sink_x.h @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2004,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_OSCOPE_SINK_X_H +#define INCLUDED_GR_OSCOPE_SINK_X_H + +#include <wxgui/api.h> +#include <wxgui/trigger_mode.h> +#include <wxgui/oscope_guts.h> +#include <gr_sync_block.h> + +namespace gr { + namespace wxgui { + + /*! + * \brief Abstract class for python oscilloscope module. + * \ingroup sink_blk + * + * Don't instantiate this. Use gr::blocks::oscope_sink_f instead. + */ + class WXGUI_API oscope_sink_x : public gr_sync_block + { + protected: + double d_sampling_rate; + oscope_guts *d_guts; + + oscope_sink_x() {}; + oscope_sink_x(const std::string name, + gr_io_signature_sptr input_sig, + double sampling_rate); + public: + virtual ~oscope_sink_x(); + + //// gr::blocks::oscope_sink_x::sptr + //typedef boost::shared_ptr<oscope_sink_x> sptr; + // + //static sptr make(const std::string name, + // gr_io_signature_sptr input_sig, + // double sampling_rate); + + bool set_update_rate(double update_rate); + bool set_decimation_count(int decimation_count); + bool set_trigger_channel(int channel); + bool set_trigger_mode(trigger_mode mode); + bool set_trigger_slope(trigger_slope slope); + bool set_trigger_level(double trigger_level); + bool set_trigger_level_auto(); + bool set_sample_rate(double sample_rate); + bool set_num_channels(int nchannels); + + // ACCESSORS + int num_channels() const; + double sample_rate() const; + double update_rate() const; + int get_decimation_count() const; + int get_trigger_channel() const; + trigger_mode get_trigger_mode() const; + trigger_slope get_trigger_slope() const; + double get_trigger_level() const; + + // # of samples written to each output record. + int get_samples_per_output_record() const; + + virtual int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) = 0; + }; + + } /* namespace wxgui */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_OSCOPE_SINK_X_H */ diff --git a/gr-wxgui/include/wxgui/trigger_mode.h b/gr-wxgui/include/wxgui/trigger_mode.h new file mode 100644 index 0000000000..11654ef6c5 --- /dev/null +++ b/gr-wxgui/include/wxgui/trigger_mode.h @@ -0,0 +1,44 @@ +/* -*- c++ -*- */ +/* + * Copyright 2003,2004,2013 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_GR_TRIGGER_MODE_H +#define INCLUDED_GR_TRIGGER_MODE_H + +namespace gr { + namespace wxgui { + + enum trigger_mode { + TRIG_MODE_FREE, + TRIG_MODE_AUTO, + TRIG_MODE_NORM, + TRIG_MODE_STRIPCHART, + }; + + enum trigger_slope { + TRIG_SLOPE_POS, + TRIG_SLOPE_NEG, + }; + + } /* namespace wxgui */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_TRIGGER_MODE_H */ |