#!/usr/bin/perl -w
+##############
+## CGI options to this tool
+##############
+
+# adcmon.pl?option1=value1&option2=value2 ...
+#
+# options:
+# DAQOPSERVER = hostname:ports
+# FGPA = FPGA address in hex (with leading 0x)
+# CB = number of ConverterBoard connected to selected FPGA [0,1]
+# chip = number of Sensor connected to selected ConverterBoard [0,1]
+# channel = comma separated list of ADC channels. These channels get
+# preselected in the selection checkbox list.
+
+# Example:
+# http://jspc55/mvdsensorcontrol/tools/adcmon.pl?DAQOPSERVER=jspc55:88&FPGA=0xd882&CB=0&chip=0&channel=CurrentDigital,CurrentAnalog
+
+
my $me = "adcmon.pl";
use strict;
init_html();
my $q = shift;
+print h2 "Converter Board ADC Monitor";
+
+
print '<div id="selectors" class="plasticBox">';
print_selectors($q);
print '</div>';
print_debugStuff($q);
print '</div>';
+
}
sub print_selectors {
my $FPGA = $q->param('FPGA');
my $CB = $q->param('CB');
my $chip = $q->param('chip');
- my $channel = $q->param('channel');
+
print "<div class='header'>Settings</div>";
print "<table id='checkboxTable'>";
- my $xmldb = AccessXmlDb->new( entityFile => $xmldbEntityFile );
- for my $element ( @{$xmldb->channelList()}) {
- print "<tr>";
- print "<td>";
- print "$element";
- print "</td>";
- print "<td>";
- print "<input type='checkbox' class='channelCheckbox' id='checkbox_"
- .$FPGA."-".$CB."-".$chip."-".$element."'>";
- print "</td>";
- print "</tr>";
+ my @channels = split(",",$q->param('channel')) if defined($q->param('channel'));
+ my %channel_hash;
+ for my $channel (@channels){
+ $channel_hash{$channel} = 1;
+ }
+ if(defined($FPGA) && defined($CB) && defined($chip)){
+ my $xmldb = AccessXmlDb->new( entityFile => $xmldbEntityFile );
+ for my $element ( @{$xmldb->channelList()}) {
+ print "<tr>";
+ print "<td>";
+ print "$element";
+ print "</td>";
+ print "<td>";
+ print "<input type='checkbox' class='channelCheckbox' id='checkbox_"
+ .$FPGA."-".$CB."-".$chip."-".$element."' ";
+ print "checked='true'" if ($channel_hash{$element});
+ print ">";
+ print "</td>";
+ print "</tr>";
+ }
}
print "</table>";
print "<div class='header'>Plots</div>";
my $q= shift;
- my @requestStrings = split(",",$q->param('requestStrings'));
+ my @requestStrings = ();
+ @requestStrings = split(",",$q->param('requestStrings')) if defined($q->param('requestStrings'));
return if (@requestStrings == 0);
$ENV{'DAQOPSERVER'} = $q->param('DAQOPSERVER') if defined $q->param('DAQOPSERVER');