Imported Upstream version 3.2.2
[debian/gnuradio] / grc / blocks / xmlrpc_server.xml
1 <?xml version="1.0"?>
2 <!--
3 ###################################################
4 ##Simple XMLRPC Server
5 ###################################################
6  -->
7 <block>
8         <name>XMLRPC Server</name>
9         <key>xmlrpc_server</key>
10         <import>import SimpleXMLRPCServer</import>
11         <import>import threading</import>
12         <make>SimpleXMLRPCServer.SimpleXMLRPCServer(($addr, $port), allow_none=True)
13 self.$(id).register_instance(self)
14 threading.Thread(target=self.$(id).serve_forever).start()</make>
15         <param>
16                 <name>Address</name>
17                 <key>addr</key>
18                 <value>localhost</value>
19                 <type>string</type>
20         </param>
21         <param>
22                 <name>Port</name>
23                 <key>port</key>
24                 <value>8080</value>
25                 <type>int</type>
26         </param>
27         <doc>
28 This block will start an XMLRPC server. \
29 The server provides access to the run, start, stop, wait functions of the flow graph. \
30 The server also provides access to the variable callbacks in the flow graph. \
31 Ex: If the variable is called freq, the function provided by the server will be called set_freq(new_freq).
32
33 Example client in python:
34
35 import xmlrpclib
36 s = xmlrpclib.Server('http://localhost:8080')
37 s.set_freq(5000)
38         </doc>
39 </block>