--- /dev/null
+package AccessXmlDb;
+
+use Storable qw(lock_store lock_retrieve);
+
+sub new {
+ my $class = shift;
+ my %options = @_;
+ my $self = {
+ entityFile => '/dev/null',
+ %options
+ };
+ bless($self, $class);
+ $self->{entity} = lock_retrieve($self->{entityFile});
+ die "cannot open xml-db entity file ".$self->{entityFile}."\n" unless defined $self->{entity};
+ return $self;
+}
+
+sub channelParm {
+ my $self = shift;
+ my $chip = shift;
+ my $channel = shift;
+
+ my $parm;
+ %{$parm}= %{$self->{entity}->{$channel."D"}};
+
+ die "entry $channel does not exist for chip=".$chip."\n" if ($chip ge $parm->{repeat});
+
+ $parm->{address} += $chip * $parm->{stepsize};
+ return $parm;
+}
+
+# returns a hash ref to the following contents (example);
+#
+# $VAR1 = {
+# 'mode' => 'r',
+# 'purpose' => 'status',
+# 'description' => 'Current on the digital power supply.',
+# 'unit' => 'mA',
+# 'format' => 'unsigned',
+# 'scale' => '0.0038147',
+# 'repeat' => '2',
+# 'type' => 'field',
+# 'bits' => '16',
+# 'address' => 49424,
+# 'stepsize' => 16,
+# 'start' => '0'
+# };
+
+1;
\ No newline at end of file
# use CGI::Carp qw(fatalsToBrowser);
# use HTML::Entities;
# use Widgets;
-
+use Data::Dumper;
use PlotScheduler;
+use AccessXmlDb;
+use Storable qw(lock_store lock_retrieve);
# use HPlot;
-my $ps = PlotScheduler->new( shm => "/dev/shm/DQ55_88", timeout=> 3 );
+
+my $ps = PlotScheduler->new( shm => "/dev/shm/DQ55_88" );
# $ps->addRequest( FPGA => "0xd882", CB => "0", chip => "1", channel => "TEMP");
# $ps->storeRequests();
$ps->startPlotService() unless $ps->plotServiceRunning();
while(1){
-$ps->retrieveRequests();
-$ps->addRequest( FPGA => "0xd882", CB => "0", chip => "1", channel => "VDDA");
-$ps->listRequests();
-$ps->storeRequests();
-sleep 1;
+ $ps->retrieveRequests();
+ $ps->addRequest( FPGA => "0xd882", CB => "0", chip => "1", channel => "VDDA");
+ $ps->listRequests();
+ $ps->storeRequests();
+ sleep 1;
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
my $verbose = 1;
my $suicideTimeout = 5;
+
use strict;
use warnings;
use POSIX;
use HADES::TrbNet;
use HPlot;
use Getopt::Long;
+use Time::HiRes;
require Common;
use PlotScheduler;
+
use FindBin;
use lib "$FindBin::Bin/..";
my $timeout = 10;
my $suicideTimer = time();
+
Getopt::Long::Configure(qw(gnu_getopt));
GetOptions(
'shm=s' => \$shm,
'timeout=s' => \$timeout,
);
+
+
+PlotJob::initXmlDb("/local.1/htdocs/daqtools/xml-db/cache/CbController.entity");
+
+
+
+
+
+# my $testJob = PlotJob->new(requestString => "0xd882-0-0-CurrentDigital");
+#
+# print Dumper $testJob;
+#
+# exit;
+
+
+
+
+
+
my $ps = PlotScheduler->new( shm => $shm, timeout => $timeout);
$ps->createShm(); # create empty shm
exit;
}
}
-}
\ No newline at end of file
+}
+
+package PlotJob;
+
+use HPlot;
+use HADES::TrbNet;
+use AccessXmlDb;
+
+my $xmldb;
+
+sub initXmlDb {
+ my $entityFile = shift;
+
+ $xmldb = AccessXmlDb->new( entityFile => $entityFile );
+
+}
+
+
+sub new {
+ my $class = shift;
+ my %options = @_;
+ my $self = {
+ requestString => '',
+ %options
+ };
+ bless($self, $class);
+
+ ($self->{FPGA},$self->{CB},$self->{chip},$self->{channel}) = split("-",$self->{requestString});
+ $self = { %$self, %{$xmldb->channelParm($self->{chip},$self->{channel}) } };
+
+
+
+ return $self;
+}
+
+
+1;
\ No newline at end of file