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

Example client in python:

import xmlrpclib
s = xmlrpclib.Server('http://localhost:8080')
s.set_freq(5000)
	</doc>
</block>