Hello
>> To minimize network traffic, the file with the commands could be on the
>> local host rather than on a remote machine; then the only thing that goes
>> over the network is the file name. I also have a small program that allows
>> you to run individual katcp commands but is far more user-friendly than
>> trying to type those commands directly to the server over a telnet
>> connection.
>
> That's a front end to katcpComm, I guess. I'm not sure how I could grow
> from that into a complex interactive graphical program, except very
> painfully using the Motif library or something like that. There is a good
> reason for languages like Python and Matlab.
If your gateware control functions are not particularly complicated
you could use kcpcmd to do the work - so from a program shell out (eg
system("kcpcmd ..."), or from a script invoke it like any other
utility.
Shell example (-p allows more interesting constructs)
#!/bin/sh
if kcpcmd -i -s $ROACHNAME wordread sys_scratchpad 0 | grep -q deadbeef ; then
echo "scratchpad already set to to deadbeef"
exit 0
else
kcpcmd -i -s $ROACHNAME wordwrite sys_scratchpad 0 0xc0cac01a
fi
kcpcmd can be found at github.com/ska-sa/katcp_devel/ - git clone the
tree, do a make and if things work out then you should have an
executable in cmd/kcpcmd [1]
I'll cross-compile it for the roach 2, so that one can run code
locally there too.
Another option, if you wish to talk to a roach without using any
existing tool or library, is to use a trick I saw in troll ftpd long
ago: In C use the normal logic to connect a network socket/fd, and
then use fdopen on it, that allows you to do things such as
fprintf(fp, "?wordread sys_scratchpad 0\n"); It isn't ideal, but will
allow you to talk to a roach without using a library (other than
libc).
regards
marc
[1] You probably don't want to run a "make install" in the full
katcp_devel tree, unless you want to set a correlator control server,
but a "make -C cmd install" is ok.