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/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 ++++++++++++++++++++++++++++
5 files changed, 767 insertions(+)
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/xmlrpc')
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