diff options
Diffstat (limited to 'gr-blocks/grc/xmlrpc_server.block.yml')
-rw-r--r-- | gr-blocks/grc/xmlrpc_server.block.yml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gr-blocks/grc/xmlrpc_server.block.yml b/gr-blocks/grc/xmlrpc_server.block.yml new file mode 100644 index 0000000000..fb33fa79a8 --- /dev/null +++ b/gr-blocks/grc/xmlrpc_server.block.yml @@ -0,0 +1,34 @@ +id: xmlrpc_server +label: XMLRPC Server + +parameters: +- id: addr + label: Address + dtype: string + default: localhost +- id: port + label: Port + dtype: int + default: '8080' + +templates: + imports: |- + import SimpleXMLRPCServer + import threading + make: |- + SimpleXMLRPCServer.SimpleXMLRPCServer((${addr}, ${port}), allow_none=True) + self.${id}.register_instance(self) + self.${id}_thread = threading.Thread(target=self.${id}.serve_forever) + self.${id}_thread.daemon = True + self.${id}_thread.start() + +documentation: |- + 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) + +file_format: 1 |