PerlTk is a good way of of implementing panels for deltaFSD.
It's quick, it's easy and there is a lot of good code out there which can be used or developed.
There are four possible approaches:
1, 2 and 3 all suffer the problem that they require deltaFSD to collect the data from any outputs from the panel.
We have samples of options 3 and 4.
Both samples use the same set of utility modules which can be assembled into a grid to form a panel:
There are three components:
The target panel needs to implement Tk:Receive. In the sample the sub implements the default Tcl:Tk behaviour of executing the received string.
sub Tk::Receive { my($mw, $cmd) = @_; return (eval (detaint($cmd))); }
The interface subroutine called from deltaFSD assembles the command string to set the outputs ($set) and get the inputs ($get) and sends it:
return (eval (mainwindow->send('tkPanel', " $set $get ")));
The only complexity here is the need to overcome the tainting security applied by perlTk
To get send/receive to work the target panel must be invoked with -T, eg:
perl -T sendpanel
this means that the packages is uses, the main window and the commands it receives must all be detainted.
The sample panel has two inputs and three outputs so the deltaFSD function needs to be configured to match this - the interface sub name is "sendit".
sendsub.pl sends its command to the application named "tkPanel" - this is the default appname used in sendpanel.pl.
The (potentially) recursive loop through the Perl function means that you need force an update to start the send-process in deltaFSD-receive-process in Perl loop running.
The sample deltaFSD data file is "send" which produces something like:
Here there are just two components:
The target panel implements a simple socket interface and parses the received data to separate the (comma separated) channel, value pairs.
The setit sub in socket.pl is called when a data source has a changed value. This sends the value back to deltaFSD.
The default communication port used by socket.pl is 6739 - matching the default for deltaFSD.
The sample data file is "socket" which produces something like: