From d52c462e5fd3eae7d00505a64a013e811d43234c Mon Sep 17 00:00:00 2001 From: jcorgan Date: Sat, 23 Aug 2008 02:26:15 +0000 Subject: Merged changeset r9285:9377 from jblum/grc into trunk, with distcheck fixes and local modifications. Integrates previously separate GNU Radio Companion into top-level component 'grc'. (Josh Blum) git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9378 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/examples/Makefile.am | 28 ++ grc/examples/audio/Makefile.am | 26 ++ grc/examples/audio/dial_tone.grc | 375 +++++++++++++++ grc/examples/simple/Makefile.am | 26 ++ grc/examples/simple/ber_simulation.grc | 540 +++++++++++++++++++++ grc/examples/usrp/Makefile.am | 28 ++ grc/examples/usrp/usrp_two_tone_loopback.grc | 675 +++++++++++++++++++++++++++ grc/examples/usrp/usrp_wbfm_receive.grc | 454 ++++++++++++++++++ grc/examples/xmlrpc/Makefile.am | 30 ++ grc/examples/xmlrpc/readme.txt | 18 + grc/examples/xmlrpc/xmlrpc_client.grc | 312 +++++++++++++ grc/examples/xmlrpc/xmlrpc_client_script.py | 23 + grc/examples/xmlrpc/xmlrpc_server.grc | 384 +++++++++++++++ 13 files changed, 2919 insertions(+) create mode 100644 grc/examples/Makefile.am create mode 100644 grc/examples/audio/Makefile.am create mode 100644 grc/examples/audio/dial_tone.grc create mode 100644 grc/examples/simple/Makefile.am create mode 100644 grc/examples/simple/ber_simulation.grc create mode 100644 grc/examples/usrp/Makefile.am create mode 100644 grc/examples/usrp/usrp_two_tone_loopback.grc create mode 100644 grc/examples/usrp/usrp_wbfm_receive.grc create mode 100644 grc/examples/xmlrpc/Makefile.am create mode 100644 grc/examples/xmlrpc/readme.txt create mode 100644 grc/examples/xmlrpc/xmlrpc_client.grc create mode 100644 grc/examples/xmlrpc/xmlrpc_client_script.py create mode 100644 grc/examples/xmlrpc/xmlrpc_server.grc (limited to 'grc/examples') diff --git a/grc/examples/Makefile.am b/grc/examples/Makefile.am new file mode 100644 index 000000000..9bba14bc9 --- /dev/null +++ b/grc/examples/Makefile.am @@ -0,0 +1,28 @@ +# +# Copyright 2008 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. +# + +include $(top_srcdir)/grc/Makefile.common + +SUBDIRS = \ + audio \ + simple \ + usrp \ + xmlrpc diff --git a/grc/examples/audio/Makefile.am b/grc/examples/audio/Makefile.am new file mode 100644 index 000000000..78800edcc --- /dev/null +++ b/grc/examples/audio/Makefile.am @@ -0,0 +1,26 @@ +# +# Copyright 2008 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. +# + +include $(top_srcdir)/grc/Makefile.common + +datadir = $(grc_examples_prefix)/audio + +EXTRA_DIST = dial_tone.grc diff --git a/grc/examples/audio/dial_tone.grc b/grc/examples/audio/dial_tone.grc new file mode 100644 index 000000000..6f96d9748 --- /dev/null +++ b/grc/examples/audio/dial_tone.grc @@ -0,0 +1,375 @@ + + + Thu Jul 24 14:27:48 2008 + + options + + id + dial_tone + + + _enabled + True + + + title + Dial Tone + + + author + Example + + + description + example flow graph + + + window_size + 1280, 1024 + + + generate_options + wx_gui + + + category + Custom + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + gr_add_vxx + + id + gr_add_vxx + + + _enabled + True + + + type + float + + + num_inputs + 3 + + + vlen + 1 + + + _coordinate + (513, 277) + + + _rotation + 0 + + + + audio_sink + + id + audio_sink + + + _enabled + True + + + samp_rate + 32000 + + + device_name + + + + ok_to_block + True + + + num_inputs + 1 + + + _coordinate + (699, 112) + + + _rotation + 0 + + + + gr_noise_source_x + + id + gr_noise_source_x + + + _enabled + True + + + type + float + + + noise_type + gr.GR_GAUSSIAN + + + amp + noise + + + seed + 42 + + + _coordinate + (238, 380) + + + _rotation + 0 + + + + gr_sig_source_x + + id + gr_sig_source_x + + + _enabled + True + + + type + float + + + samp_rate + samp_rate + + + waveform + gr.GR_COS_WAVE + + + freq + 440 + + + amp + ampl + + + offset + 0 + + + _coordinate + (240, 208) + + + _rotation + 0 + + + + gr_sig_source_x + + id + gr_sig_source_x0 + + + _enabled + True + + + type + float + + + samp_rate + samp_rate + + + waveform + gr.GR_COS_WAVE + + + freq + 350 + + + amp + ampl + + + offset + 0 + + + _coordinate + (240, 38) + + + _rotation + 0 + + + + variable_slider + + id + ampl + + + _enabled + True + + + label + Volume + + + value + .4 + + + min + 0 + + + max + .5 + + + num_steps + 100 + + + slider_type + horizontal + + + grid_pos + 0, 0, 1, 2 + + + _coordinate + (634, 413) + + + _rotation + 0 + + + + variable_slider + + id + noise + + + _enabled + True + + + label + Noise + + + value + .005 + + + min + 0 + + + max + .2 + + + num_steps + 100 + + + slider_type + horizontal + + + grid_pos + 1, 0, 1, 2 + + + _coordinate + (443, 412) + + + _rotation + 0 + + + + variable + + id + samp_rate + + + _enabled + True + + + value + 32000 + + + _coordinate + (11, 171) + + + _rotation + 0 + + + + gr_sig_source_x0 + gr_add_vxx + 0 + 0 + + + gr_sig_source_x + gr_add_vxx + 0 + 1 + + + gr_noise_source_x + gr_add_vxx + 0 + 2 + + + gr_add_vxx + audio_sink + 0 + 0 + + \ No newline at end of file diff --git a/grc/examples/simple/Makefile.am b/grc/examples/simple/Makefile.am new file mode 100644 index 000000000..a2fcd614e --- /dev/null +++ b/grc/examples/simple/Makefile.am @@ -0,0 +1,26 @@ +# +# Copyright 2008 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. +# + +include $(top_srcdir)/grc/Makefile.common + +datadir = $(grc_examples_prefix)/simple + +EXTRA_DIST = ber_simulation.grc diff --git a/grc/examples/simple/ber_simulation.grc b/grc/examples/simple/ber_simulation.grc new file mode 100644 index 000000000..0e4ce64ed --- /dev/null +++ b/grc/examples/simple/ber_simulation.grc @@ -0,0 +1,540 @@ + + + Thu Jul 24 14:28:06 2008 + + options + + id + ber_sim + + + _enabled + True + + + title + BER Simulation + + + author + Example + + + description + Adjust the noise and constellation... see what happens! + + + window_size + 1280, 1024 + + + generate_options + wx_gui + + + category + Custom + + + _coordinate + (16, 10) + + + _rotation + 0 + + + + gr_add_vxx + + id + gr_add_vxx + + + _enabled + True + + + type + complex + + + num_inputs + 2 + + + vlen + 1 + + + _coordinate + (652, 395) + + + _rotation + 0 + + + + wxgui_constellationsink2 + + id + wxgui_constellationsink2 + + + _enabled + True + + + title + "Constellation: "+str(const) + + + samp_rate + samp_rate + + + frame_decim + 15 + + + marker + set_format_plus + + + grid_pos + 2, 0, 1, 1 + + + _coordinate + (907, 334) + + + _rotation + 0 + + + + gr_noise_source_x + + id + gr_noise_source_x + + + _enabled + True + + + type + complex + + + noise_type + gr.GR_GAUSSIAN + + + amp + noise + + + seed + 42 + + + _coordinate + (235, 379) + + + _rotation + 0 + + + + gr_chunks_to_symbols_xx + + id + gr_chunks_to_symbols_xx + + + _enabled + True + + + in_type + byte + + + out_type + complex + + + symbol_table + const + + + dimension + 1 + + + _coordinate + (360, 237) + + + _rotation + 0 + + + + wxgui_numbersink2 + + id + wxgui_numbersink2 + + + _enabled + True + + + type + float + + + title + BER + + + units + % + + + samp_rate + samp_rate + + + base_value + 0.0 + + + min_value + 0.0 + + + max_value + 1.0 + + + factor + 100 + + + decimal_places + 4 + + + ref_level + 0 + + + number_rate + 15 + + + avg_alpha + 0 + + + options + none + + + show_gauge + False + + + grid_pos + 1, 0, 1, 1 + + + _coordinate + (1062, 11) + + + _rotation + 0 + + + + gr_throttle + + id + gr_throttle + + + _enabled + True + + + type + byte + + + samples_per_second + samp_rate + + + vlen + 1 + + + _coordinate + (397, 27) + + + _rotation + 0 + + + + blks2_error_rate + + id + blks2_error_rate + + + _enabled + True + + + type + "BER" + + + win_size + 1000000 + + + bits_per_symbol + int(math.log(len(const))/math.log(2)) + + + _coordinate + (670, 41) + + + _rotation + 0 + + + + gr_constellation_decoder_cb + + id + gr_constellation_decoder_cb + + + _enabled + True + + + sym_position + const + + + sym_value_out + range(len(const)) + + + _coordinate + (708, 224) + + + _rotation + 0 + + + + random_source_x + + id + random_source_x + + + _enabled + True + + + type + byte + + + min + 0 + + + max + len(const) + + + num_samps + 1000000 + + + repeat + False + + + _coordinate + (15, 244) + + + _rotation + 0 + + + + variable + + id + noise + + + _enabled + True + + + value + .25 + + + _coordinate + (18, 386) + + + _rotation + 0 + + + + variable + + id + const + + + _enabled + True + + + value + 1+1j, 1-1j, -1-1j, -1+1j + + + _coordinate + (16, 461) + + + _rotation + 0 + + + + variable + + id + samp_rate + + + _enabled + True + + + value + 50e3 + + + _coordinate + (20, 168) + + + _rotation + 0 + + + + import + + id + import + + + _enabled + True + + + import + import math + + + _coordinate + (138, 168) + + + _rotation + 0 + + + + blks2_error_rate + wxgui_numbersink2 + 0 + 0 + + + gr_throttle + blks2_error_rate + 0 + 0 + + + gr_constellation_decoder_cb + blks2_error_rate + 0 + 1 + + + gr_add_vxx + gr_constellation_decoder_cb + 0 + 0 + + + gr_chunks_to_symbols_xx + gr_add_vxx + 0 + 0 + + + gr_noise_source_x + gr_add_vxx + 0 + 1 + + + gr_add_vxx + wxgui_constellationsink2 + 0 + 0 + + + random_source_x + gr_throttle + 0 + 0 + + + random_source_x + gr_chunks_to_symbols_xx + 0 + 0 + + \ No newline at end of file diff --git a/grc/examples/usrp/Makefile.am b/grc/examples/usrp/Makefile.am new file mode 100644 index 000000000..9ad96c915 --- /dev/null +++ b/grc/examples/usrp/Makefile.am @@ -0,0 +1,28 @@ +# +# Copyright 2008 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. +# + +include $(top_srcdir)/grc/Makefile.common + +datadir = $(grc_examples_prefix)/usrp + +EXTRA_DIST = \ + usrp_two_tone_loopback.grc \ + usrp_wbfm_receive.grc diff --git a/grc/examples/usrp/usrp_two_tone_loopback.grc b/grc/examples/usrp/usrp_two_tone_loopback.grc new file mode 100644 index 000000000..ccbe190ec --- /dev/null +++ b/grc/examples/usrp/usrp_two_tone_loopback.grc @@ -0,0 +1,675 @@ + + + Thu Jul 24 14:27:46 2008 + + options + + id + top_block + + + _enabled + True + + + title + USRP Loopback - 2 Tone + + + author + Example + + + description + Loopback test with basic rx and basic tx + + + window_size + 1280, 1024 + + + generate_options + wx_gui + + + category + Custom + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + usrp_simple_source_x + + id + usrp_simple_source_x + + + _enabled + True + + + type + complex + + + number + 0 + + + subdev_spec + None + + + frequency + tun_freq + + + decimation + 200 + + + gain + 20 + + + mux + 0x0 + + + auto_tr + None + + + rx_ant + None + + + _coordinate + (578, 319) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + wxgui_fftsink2 + + + _enabled + True + + + type + complex + + + title + FFT Plot + + + samp_rate + samp_rate + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 8 + + + ref_level + 100 + + + fft_size + 512*2 + + + fft_rate + 15 + + + avg_alpha + 0 + + + average + False + + + peak_hold + False + + + grid_pos + 1, 2, 2, 4 + + + _coordinate + (845, 228) + + + _rotation + 0 + + + + variable_slider + + id + tone2 + + + _enabled + True + + + label + Tone 2 + + + value + 75e3 + + + min + 0 + + + max + 150000 + + + num_steps + 100 + + + slider_type + horizontal + + + grid_pos + 0, 4, 1, 2 + + + _coordinate + (397, 478) + + + _rotation + 0 + + + + variable_slider + + id + tone1 + + + _enabled + True + + + label + Tone 1 + + + value + 50e3 + + + min + 0 + + + max + 150000 + + + num_steps + 100 + + + slider_type + horizontal + + + grid_pos + 0, 2, 1, 2 + + + _coordinate + (220, 475) + + + _rotation + 0 + + + + variable_slider + + id + noise_ampl + + + _enabled + True + + + label + Noise Ampl + + + value + 2000 + + + min + 0 + + + max + 5000 + + + num_steps + 100 + + + slider_type + vertical + + + grid_pos + 1, 1, 2, 1 + + + _coordinate + (20, 243) + + + _rotation + 0 + + + + variable_slider + + id + tone_ampl + + + _enabled + True + + + label + Tone Ampl + + + value + 5000 + + + min + 0 + + + max + 5000 + + + num_steps + 100 + + + slider_type + vertical + + + grid_pos + 1, 0, 2, 1 + + + _coordinate + (21, 422) + + + _rotation + 0 + + + + usrp_simple_sink_x + + id + usrp_simple_sink_x + + + _enabled + True + + + type + complex + + + number + 0 + + + subdev_spec + None + + + frequency + tun_freq + + + interpolation + 400 + + + gain + 0 + + + mux + 0x0 + + + auto_tr + None + + + tx_enb + None + + + _coordinate + (835, 5) + + + _rotation + 0 + + + + gr_float_to_complex + + id + gr_float_to_complex + + + _enabled + True + + + _coordinate + (634, 226) + + + _rotation + 0 + + + + gr_add_vxx + + id + gr_add_vxx + + + _enabled + True + + + type + float + + + num_inputs + 3 + + + vlen + 1 + + + _coordinate + (528, 78) + + + _rotation + 0 + + + + gr_sig_source_x + + id + gr_sig_source_x + + + _enabled + True + + + type + float + + + samp_rate + samp_rate + + + waveform + gr.GR_COS_WAVE + + + freq + tone1 + + + amp + tone_ampl + + + offset + 0 + + + _coordinate + (258, 20) + + + _rotation + 0 + + + + gr_sig_source_x + + id + gr_sig_source_x0 + + + _enabled + True + + + type + float + + + samp_rate + samp_rate + + + waveform + gr.GR_COS_WAVE + + + freq + tone2 + + + amp + tone_ampl + + + offset + 0 + + + _coordinate + (255, 179) + + + _rotation + 0 + + + + gr_noise_source_x + + id + gr_noise_source_x + + + _enabled + True + + + type + float + + + noise_type + gr.GR_GAUSSIAN + + + amp + noise_ampl + + + seed + 42 + + + _coordinate + (257, 337) + + + _rotation + 0 + + + + variable + + id + samp_rate + + + _enabled + True + + + value + 64e6/200 + + + _coordinate + (9, 166) + + + _rotation + 0 + + + + variable + + id + tun_freq + + + _enabled + True + + + value + int(100e6) + + + _coordinate + (116, 166) + + + _rotation + 0 + + + + gr_sig_source_x + gr_add_vxx + 0 + 0 + + + gr_sig_source_x0 + gr_add_vxx + 0 + 1 + + + gr_noise_source_x + gr_add_vxx + 0 + 2 + + + usrp_simple_source_x + wxgui_fftsink2 + 0 + 0 + + + gr_float_to_complex + usrp_simple_sink_x + 0 + 0 + + + gr_add_vxx + gr_float_to_complex + 0 + 0 + + + gr_add_vxx + gr_float_to_complex + 0 + 1 + + \ No newline at end of file diff --git a/grc/examples/usrp/usrp_wbfm_receive.grc b/grc/examples/usrp/usrp_wbfm_receive.grc new file mode 100644 index 000000000..7fb621241 --- /dev/null +++ b/grc/examples/usrp/usrp_wbfm_receive.grc @@ -0,0 +1,454 @@ + + + Thu Jul 24 14:27:45 2008 + + options + + id + top_block + + + _enabled + True + + + title + USRP WBFM Receive + + + author + Example + + + description + WBFM Receive with Basic RX or TV RX + + + window_size + 1280, 1024 + + + generate_options + wx_gui + + + category + Custom + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + usrp_simple_source_x + + id + usrp_simple_source_x + + + _enabled + True + + + type + complex + + + number + 0 + + + subdev_spec + None + + + frequency + (freq+fine)*1e6 + + + decimation + decim + + + gain + 20 + + + mux + 0x0 + + + auto_tr + None + + + rx_ant + None + + + _coordinate + (277, 29) + + + _rotation + 0 + + + + variable_slider + + id + fine + + + _enabled + True + + + label + Fine Freq + + + value + 0 + + + min + -.1 + + + max + .1 + + + num_steps + 100 + + + slider_type + horizontal + + + grid_pos + 0, 2, 1, 2 + + + _coordinate + (275, 246) + + + _rotation + 0 + + + + blks2_wfm_rcv + + id + blks2_wfm_rcv + + + _enabled + True + + + quad_rate + 64e6/decim + + + audio_decimation + 10 + + + _coordinate + (510, 37) + + + _rotation + 0 + + + + audio_sink + + id + audio_sink + + + _enabled + True + + + samp_rate + 32000 + + + device_name + + + + ok_to_block + True + + + num_inputs + 1 + + + _coordinate + (703, 241) + + + _rotation + 180 + + + + gr_multiply_const_vxx + + id + gr_multiply_const_vxx + + + _enabled + True + + + type + float + + + const + volume + + + vlen + 1 + + + _coordinate + (764, 55) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + wxgui_fftsink2 + + + _enabled + True + + + type + complex + + + title + FFT Plot + + + samp_rate + 64e6/decim + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 8 + + + ref_level + 50 + + + fft_size + 512 + + + fft_rate + 15 + + + avg_alpha + 0 + + + average + False + + + peak_hold + False + + + grid_pos + 2, 0, 2, 4 + + + _coordinate + (512, 191) + + + _rotation + 0 + + + + variable_slider + + id + volume + + + _enabled + True + + + label + Volume + + + value + 1 + + + min + 0 + + + max + 10 + + + num_steps + 100 + + + slider_type + horizontal + + + grid_pos + 1, 1, 1, 2 + + + _coordinate + (991, 40) + + + _rotation + 0 + + + + variable_slider + + id + freq + + + _enabled + True + + + label + Frequency + + + value + 100 + + + min + 87.5 + + + max + 108.0 + + + num_steps + 1000 + + + slider_type + horizontal + + + grid_pos + 0, 0, 1, 2 + + + _coordinate + (104, 243) + + + _rotation + 0 + + + + variable + + id + decim + + + _enabled + True + + + value + 200 + + + _coordinate + (14, 173) + + + _rotation + 0 + + + + usrp_simple_source_x + blks2_wfm_rcv + 0 + 0 + + + usrp_simple_source_x + wxgui_fftsink2 + 0 + 0 + + + blks2_wfm_rcv + gr_multiply_const_vxx + 0 + 0 + + + gr_multiply_const_vxx + audio_sink + 0 + 0 + + \ No newline at end of file diff --git a/grc/examples/xmlrpc/Makefile.am b/grc/examples/xmlrpc/Makefile.am new file mode 100644 index 000000000..68ecbdd9b --- /dev/null +++ b/grc/examples/xmlrpc/Makefile.am @@ -0,0 +1,30 @@ +# +# Copyright 2008 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. +# + +include $(top_srcdir)/grc/Makefile.common + +datadir = $(grc_examples_prefix)/xmlrpc + +EXTRA_DIST = \ + readme.txt \ + xmlrpc_client.grc \ + xmlrpc_client_script.py\ + xmlrpc_server.grc diff --git a/grc/examples/xmlrpc/readme.txt b/grc/examples/xmlrpc/readme.txt new file mode 100644 index 000000000..c1f87c1cb --- /dev/null +++ b/grc/examples/xmlrpc/readme.txt @@ -0,0 +1,18 @@ +################################################## +# XMLRPC example +################################################## + +XMLRPC allows software to make remote function calls over http. +In the case of GRC, one can use XMLRPC to modify variables in a running flow graph. +See http://www.xmlrpc.com/ + +--- Server Example --- +Place an "XMLRPC Server" block inside of any flow graph. +The server will provide set functions for every variable in the flow graph. +If a variable is called "freq", the server will provide a function set_freq(new_freq). +Run the server example and experiment with the example client script. + +-- Client Example -- +The "XMLRPC Client" block will give a variable control over one remove function. +In the example client, there is one client block and gui control per variable. +This technique can be used to remotely control a flow graph, perhaps running on a non-gui machine. diff --git a/grc/examples/xmlrpc/xmlrpc_client.grc b/grc/examples/xmlrpc/xmlrpc_client.grc new file mode 100644 index 000000000..3bb4e7ed3 --- /dev/null +++ b/grc/examples/xmlrpc/xmlrpc_client.grc @@ -0,0 +1,312 @@ + + + Thu Jul 24 14:27:44 2008 + + options + + id + client_block + + + _enabled + True + + + title + XMLRPC Client + + + author + Example + + + description + example flow graph + + + window_size + 1280, 1024 + + + generate_options + wx_gui + + + category + Custom + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + xmlrpc_client + + id + xmlrpc_client0 + + + _enabled + True + + + addr + localhost + + + port + 1234 + + + callback + set_ampl + + + variable + ampl + + + _coordinate + (409, 35) + + + _rotation + 0 + + + + xmlrpc_client + + id + xmlrpc_client + + + _enabled + True + + + addr + localhost + + + port + 1234 + + + callback + set_freq + + + variable + freq + + + _coordinate + (222, 34) + + + _rotation + 0 + + + + variable_slider + + id + freq + + + _enabled + True + + + label + Frequency (Hz) + + + value + 1000 + + + min + 0 + + + max + 5000 + + + num_steps + 100 + + + slider_type + horizontal + + + grid_pos + 0, 0, 1, 2 + + + _coordinate + (207, 162) + + + _rotation + 0 + + + + variable_slider + + id + ampl + + + _enabled + True + + + label + Amplitude + + + value + 1 + + + min + 0 + + + max + 2 + + + num_steps + 100 + + + slider_type + horizontal + + + grid_pos + 1, 0, 1, 2 + + + _coordinate + (397, 167) + + + _rotation + 0 + + + + variable_chooser + + id + offset + + + _enabled + True + + + label + Offset + + + value_index + 1 + + + choices + [-1, 0, 1] + + + labels + ["neg", "zero", "pos"] + + + chooser_type + radio_buttons_horizontal + + + grid_pos + 2, 0, 1, 2 + + + _coordinate + (596, 177) + + + _rotation + 0 + + + + xmlrpc_client + + id + xmlrpc_client1 + + + _enabled + True + + + addr + localhost + + + port + 1234 + + + callback + set_offset + + + variable + offset*ampl + + + _coordinate + (608, 39) + + + _rotation + 0 + + + + variable + + id + samp_rate + + + _enabled + True + + + value + 32000 + + + _coordinate + (13, 172) + + + _rotation + 0 + + + \ No newline at end of file diff --git a/grc/examples/xmlrpc/xmlrpc_client_script.py b/grc/examples/xmlrpc/xmlrpc_client_script.py new file mode 100644 index 000000000..956fa07fb --- /dev/null +++ b/grc/examples/xmlrpc/xmlrpc_client_script.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import time +import random +import xmlrpclib + +#create server object +s = xmlrpclib.Server("http://localhost:1234") + +#randomly change parameters of the sinusoid +for i in range(10): + #generate random values + new_freq = random.uniform(0, 5000) + new_ampl = random.uniform(0, 2) + new_offset = random.uniform(-1, 1) + #set new values + time.sleep(1) + s.set_freq(new_freq) + time.sleep(1) + s.set_ampl(new_ampl) + time.sleep(1) + s.set_offset(new_offset) + diff --git a/grc/examples/xmlrpc/xmlrpc_server.grc b/grc/examples/xmlrpc/xmlrpc_server.grc new file mode 100644 index 000000000..dc539ef1b --- /dev/null +++ b/grc/examples/xmlrpc/xmlrpc_server.grc @@ -0,0 +1,384 @@ + + + Thu Jul 24 14:27:42 2008 + + options + + id + server_block + + + _enabled + True + + + title + XMLRPC Server + + + author + Example + + + description + example flow graph + + + window_size + 1280, 1024 + + + generate_options + wx_gui + + + category + Custom + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + gr_sig_source_x + + id + gr_sig_source_x + + + _enabled + True + + + type + float + + + samp_rate + samp_rate + + + waveform + gr.GR_COS_WAVE + + + freq + freq + + + amp + ampl + + + offset + offset + + + _coordinate + (162, 200) + + + _rotation + 0 + + + + variable + + id + offset + + + _enabled + True + + + value + 0 + + + _coordinate + (12, 390) + + + _rotation + 0 + + + + xmlrpc_server + + id + xmlrpc_server + + + _enabled + True + + + addr + localhost + + + port + 1234 + + + _coordinate + (395, 240) + + + _rotation + 0 + + + + gr_throttle + + id + gr_throttle + + + _enabled + True + + + type + float + + + samples_per_second + samp_rate + + + vlen + 1 + + + _coordinate + (386, 93) + + + _rotation + 0 + + + + wxgui_scopesink2 + + id + wxgui_scopesink2 + + + _enabled + True + + + type + float + + + title + Scope Plot + + + samp_rate + samp_rate + + + frame_decim + 15 + + + v_scale + 0 + + + t_scale + .001 + + + marker + set_format_line + + + num_inputs + 1 + + + grid_pos + 0, 0, 2, 4 + + + _coordinate + (623, 28) + + + _rotation + 0 + + + + wxgui_fftsink2 + + id + wxgui_fftsink2 + + + _enabled + True + + + type + float + + + title + FFT Plot + + + samp_rate + samp_rate + + + baseband_freq + 0 + + + y_per_div + 10 + + + y_divs + 8 + + + ref_level + 50 + + + fft_size + 512 + + + fft_rate + 15 + + + avg_alpha + 0 + + + average + False + + + peak_hold + False + + + grid_pos + 2, 0, 2, 4 + + + _coordinate + (630, 233) + + + _rotation + 0 + + + + variable + + id + samp_rate + + + _enabled + True + + + value + 32000 + + + _coordinate + (11, 160) + + + _rotation + 0 + + + + variable + + id + freq + + + _enabled + True + + + value + 1000 + + + _coordinate + (11, 237) + + + _rotation + 0 + + + + variable + + id + ampl + + + _enabled + True + + + value + 1 + + + _coordinate + (13, 315) + + + _rotation + 0 + + + + gr_sig_source_x + gr_throttle + 0 + 0 + + + gr_throttle + wxgui_scopesink2 + 0 + 0 + + + gr_throttle + wxgui_fftsink2 + 0 + 0 + + \ No newline at end of file -- cgit