<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>GNU Radio 3.2.2 C++ API: gr_oscope_guts.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.2 --> <h1>gr_oscope_guts.h</h1><a href="gr__oscope__guts_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- c++ -*- */</span> <a name="l00002"></a>00002 <span class="comment">/*</span> <a name="l00003"></a>00003 <span class="comment"> * Copyright 2003,2005 Free Software Foundation, Inc.</span> <a name="l00004"></a>00004 <span class="comment"> * </span> <a name="l00005"></a>00005 <span class="comment"> * This file is part of GNU Radio</span> <a name="l00006"></a>00006 <span class="comment"> * </span> <a name="l00007"></a>00007 <span class="comment"> * GNU Radio is free software; you can redistribute it and/or modify</span> <a name="l00008"></a>00008 <span class="comment"> * it under the terms of the GNU General Public License as published by</span> <a name="l00009"></a>00009 <span class="comment"> * the Free Software Foundation; either version 3, or (at your option)</span> <a name="l00010"></a>00010 <span class="comment"> * any later version.</span> <a name="l00011"></a>00011 <span class="comment"> * </span> <a name="l00012"></a>00012 <span class="comment"> * GNU Radio is distributed in the hope that it will be useful,</span> <a name="l00013"></a>00013 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00014"></a>00014 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00015"></a>00015 <span class="comment"> * GNU General Public License for more details.</span> <a name="l00016"></a>00016 <span class="comment"> * </span> <a name="l00017"></a>00017 <span class="comment"> * You should have received a copy of the GNU General Public License</span> <a name="l00018"></a>00018 <span class="comment"> * along with GNU Radio; see the file COPYING. If not, write to</span> <a name="l00019"></a>00019 <span class="comment"> * the Free Software Foundation, Inc., 51 Franklin Street,</span> <a name="l00020"></a>00020 <span class="comment"> * Boston, MA 02110-1301, USA.</span> <a name="l00021"></a>00021 <span class="comment"> */</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="preprocessor">#ifndef INCLUDED_GR_OSCOPE_GUTS_H</span> <a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#define INCLUDED_GR_OSCOPE_GUTS_H</span> <a name="l00026"></a>00026 <span class="preprocessor"></span> <a name="l00027"></a>00027 <span class="preprocessor">#include <<a class="code" href="gr__trigger__mode_8h.html">gr_trigger_mode.h</a>></span> <a name="l00028"></a>00028 <span class="preprocessor">#include <<a class="code" href="gr__msg__queue_8h.html">gr_msg_queue.h</a>></span> <a name="l00029"></a>00029 <span class="comment"></span> <a name="l00030"></a>00030 <span class="comment">/*!</span> <a name="l00031"></a>00031 <span class="comment"> * \brief guts of oscilloscope trigger and buffer module</span> <a name="l00032"></a>00032 <span class="comment"> *</span> <a name="l00033"></a>00033 <span class="comment"> * This module processes sets of samples provided the \p process_sample</span> <a name="l00034"></a>00034 <span class="comment"> * method. When appropriate given the updateRate, sampleRate and</span> <a name="l00035"></a>00035 <span class="comment"> * trigger conditions, process_sample will periodically write output</span> <a name="l00036"></a>00036 <span class="comment"> * records of captured data to output_fd. For each trigger event,</span> <a name="l00037"></a>00037 <span class="comment"> * nchannels records will be written. Each record consists of</span> <a name="l00038"></a>00038 <span class="comment"> * get_samples_per_output_record binary floats. The trigger instant</span> <a name="l00039"></a>00039 <span class="comment"> * occurs at the 1/2 way point in the buffer. Thus, output records</span> <a name="l00040"></a>00040 <span class="comment"> * consist of 50% pre-trigger data and 50% post-trigger data.</span> <a name="l00041"></a>00041 <span class="comment"> */</span> <a name="l00042"></a>00042 <a name="l00043"></a><a class="code" href="classgr__oscope__guts.html">00043</a> <span class="keyword">class </span><a class="code" href="classgr__oscope__guts.html" title="guts of oscilloscope trigger and buffer module">gr_oscope_guts</a> { <a name="l00044"></a>00044 <span class="keyword">public</span>: <a name="l00045"></a><a class="code" href="classgr__oscope__guts.html#aca17048bc6e1b7b02431d665396bca99">00045</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classgr__oscope__guts.html#aca17048bc6e1b7b02431d665396bca99">MAX_CHANNELS</a> = 8; <a name="l00046"></a>00046 <span class="keyword">private</span>: <a name="l00047"></a>00047 <span class="keyword">enum</span> scope_state { HOLD_OFF, LOOK_FOR_TRIGGER, POST_TRIGGER }; <a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="keywordtype">int</span> d_nchannels; <span class="comment">// how many channels</span> <a name="l00050"></a>00050 <a class="code" href="classboost_1_1shared__ptr.html" title="shared_ptr documentation stub">gr_msg_queue_sptr</a> d_msgq; <span class="comment">// message queue we stuff output records into</span> <a name="l00051"></a>00051 <a class="code" href="gr__trigger__mode_8h.html#a7e65c0684a01d162cca66feca6af3701">gr_trigger_mode</a> d_trigger_mode; <a name="l00052"></a>00052 <a class="code" href="gr__trigger__mode_8h.html#ac6b9bf75f9495085c9364ee6af1a82cf">gr_trigger_slope</a> d_trigger_slope; <a name="l00053"></a>00053 <span class="keywordtype">int</span> d_trigger_channel; <span class="comment">// which channel to watch for trigger condition</span> <a name="l00054"></a>00054 <span class="keywordtype">double</span> d_sample_rate; <span class="comment">// input sample rate in Hz</span> <a name="l00055"></a>00055 <span class="keywordtype">double</span> d_update_rate; <span class="comment">// approx freq to produce an output record (Hz)</span> <a name="l00056"></a>00056 <span class="keywordtype">double</span> d_trigger_level; <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="keywordtype">int</span> d_obi; <span class="comment">// output buffer index </span> <a name="l00059"></a>00059 <span class="keywordtype">float</span> *d_buffer[<a class="code" href="classgr__oscope__guts.html#aca17048bc6e1b7b02431d665396bca99">MAX_CHANNELS</a>]; <a name="l00060"></a>00060 <a name="l00061"></a>00061 scope_state d_state; <a name="l00062"></a>00062 <span class="keywordtype">int</span> d_decimator_count; <a name="l00063"></a>00063 <span class="keywordtype">int</span> d_decimator_count_init; <a name="l00064"></a>00064 <span class="keywordtype">int</span> d_hold_off_count; <a name="l00065"></a>00065 <span class="keywordtype">int</span> d_hold_off_count_init; <a name="l00066"></a>00066 <span class="keywordtype">int</span> d_pre_trigger_count; <a name="l00067"></a>00067 <span class="keywordtype">int</span> d_post_trigger_count; <a name="l00068"></a>00068 <span class="keywordtype">int</span> d_post_trigger_count_init; <a name="l00069"></a>00069 <span class="keywordtype">float</span> d_trigger_off; <span class="comment">//%sample trigger is off</span> <a name="l00070"></a>00070 <a name="l00071"></a>00071 <span class="comment">// NOT IMPLEMENTED</span> <a name="l00072"></a>00072 <a class="code" href="classgr__oscope__guts.html" title="guts of oscilloscope trigger and buffer module">gr_oscope_guts</a> (<span class="keyword">const</span> <a class="code" href="classgr__oscope__guts.html" title="guts of oscilloscope trigger and buffer module">gr_oscope_guts</a> &rhs); <span class="comment">// no copy constructor</span> <a name="l00073"></a>00073 <a class="code" href="classgr__oscope__guts.html" title="guts of oscilloscope trigger and buffer module">gr_oscope_guts</a> &operator= (<span class="keyword">const</span> <a class="code" href="classgr__oscope__guts.html" title="guts of oscilloscope trigger and buffer module">gr_oscope_guts</a> &rhs); <span class="comment">// no assignment operator</span> <a name="l00074"></a>00074 <a name="l00075"></a>00075 <span class="keywordtype">void</span> trigger_changed (); <a name="l00076"></a>00076 <span class="keywordtype">void</span> update_rate_or_decimation_changed (); <a name="l00077"></a>00077 <span class="keywordtype">bool</span> found_trigger (); <span class="comment">// returns true if found</span> <a name="l00078"></a>00078 <span class="keywordtype">void</span> write_output_records (); <a name="l00079"></a>00079 <a name="l00080"></a>00080 <span class="keywordtype">void</span> enter_hold_off (); <span class="comment">// called on state entry</span> <a name="l00081"></a>00081 <span class="keywordtype">void</span> enter_look_for_trigger (); <a name="l00082"></a>00082 <span class="keywordtype">void</span> enter_post_trigger (); <a name="l00083"></a>00083 <a name="l00084"></a>00084 <span class="keyword">public</span>: <a name="l00085"></a>00085 <span class="comment">// CREATORS</span> <a name="l00086"></a>00086 <a class="code" href="classgr__oscope__guts.html" title="guts of oscilloscope trigger and buffer module">gr_oscope_guts</a> (<span class="keywordtype">double</span> <a class="code" href="classgr__oscope__guts.html#ab130f9e5eba44e25b47b5f28656f8834">sample_rate</a>, <a class="code" href="classboost_1_1shared__ptr.html" title="shared_ptr documentation stub">gr_msg_queue_sptr</a> msgq); <a name="l00087"></a>00087 <a class="code" href="classgr__oscope__guts.html#a0a32a61be318c2040ed5657a447c09f7">~gr_oscope_guts</a> (); <a name="l00088"></a>00088 <a name="l00089"></a>00089 <span class="comment">// MANIPULATORS</span> <a name="l00090"></a>00090 <span class="comment"></span> <a name="l00091"></a>00091 <span class="comment"> /*!</span> <a name="l00092"></a>00092 <span class="comment"> * \p channel_data points to nchannels float values. These are the values</span> <a name="l00093"></a>00093 <span class="comment"> * for each channel at this sample time.</span> <a name="l00094"></a>00094 <span class="comment"> */</span> <a name="l00095"></a>00095 <span class="keywordtype">void</span> <a class="code" href="classgr__oscope__guts.html#a36c880bef593417876568a7264bc07c6">process_sample</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> *channel_data); <a name="l00096"></a>00096 <a name="l00097"></a>00097 <span class="keywordtype">bool</span> <a class="code" href="classgr__oscope__guts.html#a6528e5ffc86fb33a5aee6ac531a26a6c">set_update_rate</a> (<span class="keywordtype">double</span> <a class="code" href="classgr__oscope__guts.html#aaef013aa2b95f997249b60dcb6670385">update_rate</a>); <a name="l00098"></a>00098 <span class="keywordtype">bool</span> <a class="code" href="classgr__oscope__guts.html#ae27cbfbaa29983f981294931b416e41a">set_decimation_count</a> (<span class="keywordtype">int</span> decimation_count); <a name="l00099"></a>00099 <span class="keywordtype">bool</span> <a class="code" href="classgr__oscope__guts.html#af0df18aec7ea9aedfd97bacfd90edcb8">set_trigger_channel</a> (<span class="keywordtype">int</span> channel); <a name="l00100"></a>00100 <span class="keywordtype">bool</span> <a class="code" href="classgr__oscope__guts.html#aefd251287cc8553c09442ae73268a75c">set_trigger_mode</a> (<a class="code" href="gr__trigger__mode_8h.html#a7e65c0684a01d162cca66feca6af3701">gr_trigger_mode</a> mode); <a name="l00101"></a>00101 <span class="keywordtype">bool</span> <a class="code" href="classgr__oscope__guts.html#a1ac643187b1ff94b94b0a47d2992b1a7">set_trigger_slope</a> (<a class="code" href="gr__trigger__mode_8h.html#ac6b9bf75f9495085c9364ee6af1a82cf">gr_trigger_slope</a> slope); <a name="l00102"></a>00102 <span class="keywordtype">bool</span> <a class="code" href="classgr__oscope__guts.html#aad4c3e6cda7b9d6402da682731549f09">set_trigger_level</a> (<span class="keywordtype">double</span> trigger_level); <a name="l00103"></a>00103 <span class="keywordtype">bool</span> <a class="code" href="classgr__oscope__guts.html#aabd19352da62644f125a91bd620896d9">set_trigger_level_auto</a> (); <span class="comment">// set to 50% level</span> <a name="l00104"></a>00104 <span class="keywordtype">bool</span> <a class="code" href="classgr__oscope__guts.html#ad38ca8cc8ee7de91a69faa310f4f613e">set_sample_rate</a>(<span class="keywordtype">double</span> <a class="code" href="classgr__oscope__guts.html#ab130f9e5eba44e25b47b5f28656f8834">sample_rate</a>); <a name="l00105"></a>00105 <span class="keywordtype">bool</span> <a class="code" href="classgr__oscope__guts.html#a9654f8b7445c2111771eefd7e1bd73dd">set_num_channels</a>(<span class="keywordtype">int</span> nchannels); <a name="l00106"></a>00106 <a name="l00107"></a>00107 <a name="l00108"></a>00108 <span class="comment">// ACCESSORS</span> <a name="l00109"></a>00109 <span class="keywordtype">int</span> <a class="code" href="classgr__oscope__guts.html#a990e0908fa15f0587f2c54f1ad0280af">num_channels</a> () <span class="keyword">const</span>; <a name="l00110"></a>00110 <span class="keywordtype">double</span> <a class="code" href="classgr__oscope__guts.html#ab130f9e5eba44e25b47b5f28656f8834">sample_rate</a> () <span class="keyword">const</span>; <a name="l00111"></a>00111 <span class="keywordtype">double</span> <a class="code" href="classgr__oscope__guts.html#aaef013aa2b95f997249b60dcb6670385">update_rate</a> () <span class="keyword">const</span>; <a name="l00112"></a>00112 <span class="keywordtype">int</span> <a class="code" href="classgr__oscope__guts.html#a420a6a5a46a04db9ee1dafe0942d97cc">get_decimation_count</a> () <span class="keyword">const</span>; <a name="l00113"></a>00113 <span class="keywordtype">int</span> <a class="code" href="classgr__oscope__guts.html#a61f072bbae310aed24897cff81e2029c">get_trigger_channel</a> () <span class="keyword">const</span>; <a name="l00114"></a>00114 <a class="code" href="gr__trigger__mode_8h.html#a7e65c0684a01d162cca66feca6af3701">gr_trigger_mode</a> <a class="code" href="classgr__oscope__guts.html#ab8e705dc8bab64f3f4fc171310ca4734">get_trigger_mode</a> () <span class="keyword">const</span>; <a name="l00115"></a>00115 <a class="code" href="gr__trigger__mode_8h.html#ac6b9bf75f9495085c9364ee6af1a82cf">gr_trigger_slope</a> <a class="code" href="classgr__oscope__guts.html#afbeaa19d51d7a01ece5af5a4633253d4">get_trigger_slope</a> () <span class="keyword">const</span>; <a name="l00116"></a>00116 <span class="keywordtype">double</span> <a class="code" href="classgr__oscope__guts.html#a591e96e8914d856cea53ae3711824d1e">get_trigger_level</a> () <span class="keyword">const</span>; <a name="l00117"></a>00117 <a name="l00118"></a>00118 <span class="comment">// # of samples written to each output record.</span> <a name="l00119"></a>00119 <span class="keywordtype">int</span> <a class="code" href="classgr__oscope__guts.html#aac1f07a6e125cf5f1e423801e81d5493">get_samples_per_output_record</a> () <span class="keyword">const</span>; <a name="l00120"></a>00120 }; <a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="preprocessor">#endif </span><span class="comment">/* INCLUDED_GR_OSCOPE_GUTS_H */</span> </pre></div></div> <hr size="1"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2 </small></address> </body> </html>