[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] How do I use the Gnuradio GRC XML RPC client or s
From: |
numeric |
Subject: |
Re: [Discuss-gnuradio] How do I use the Gnuradio GRC XML RPC client or server components? |
Date: |
Fri, 24 Apr 2015 22:52:16 -0700 (MST) |
Thank you Marcus for your reply.
Yes; to answer your question. The Linux version is Freepascal with the
Lazarus IDE. It is very much like Delphi with a useful exception. No BDE
(Borland Database Engine) is required.
You have given me an idea for a plan to solve my question. If the XMLPRC is
a DLL then freepascal can directly import the DLL and gain access to it's
functions. No need to pipe the string to a convertor.
Today my USB drive got messed up. I have to re-load Linux, gnuradio and
Lazarus to continue the effort. A day or two should complete the
restoration; the "BOSS " (not the boss at work) permitting.
Rob
Marcus Müller-3 wrote
> Now, for almost any language out there exist XML-RPC implementations, I
> guess -- however, if that is the case for Pascal (I guess you're using
> freepascal?), I don't know.
>
>
>
> Maybe you'll have to swallow the pill and
> either write a "Pascal-writes-stuff-into-a-pipe" to XML-RPC converter in
> your language of choice (in python, that would be but this much code,
> approximately, untested:
>
> #!/usr/bin/python2
> import xmlrpclib
> s = xmlrpclib.Server('http://localhost:8080')
> commanddict = { "frequency": lambda x: s.set_freq(float(x)) ,
> "gain": lambda x: s.set_gain(float(x)),
> "taps": lambda x:
> s.set_filtertaps(list(map(float,x.split(",")))),
> "stop": lambda x: s.stop()
> }
> inputfile = open("/path/to/the/fifo", "r")
> while True:
> line = inputfile.readline()
> if line.lower().startswith("exit"):
> break
> command, valuestring = line.split(":")
> #now, get command from dictionary and apply it to string
> try:
> commanddict[command](valuestring)
> except: #this happens if the command is not in the dict, or
> something went wrong doing RPC
> pass # don't do anything, just wait for the next command
>
> Now, of you'll need to
> mkfifo /path/to/the/fifo
>
> and have your pascal program write lines of the scheme
>
> gain:34
> taps:1,2,3,4.0
> stop:nowtheflowgraphdiesandthiscommandjustneedsaparameter
> exit
>
> to that filename.
>
> I assume things are equally easy in C++, but I've never tried XML-RPC
> from C++, and all the string-juggling really gets easy in python, imho.
>
> Best regards,
> Marcus
--
View this message in context:
http://gnuradio.4.n7.nabble.com/How-do-I-use-the-Gnuradio-GRC-XML-RPC-client-or-server-components-tp53427p53471.html
Sent from the GnuRadio mailing list archive at Nabble.com.