]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
modified power supply reader to run on modified httpi and normal httpi servers
authorJan Michel <j.michel@gsi.de>
Thu, 22 Oct 2015 17:10:34 +0000 (19:10 +0200)
committerJan Michel <j.michel@gsi.de>
Thu, 22 Oct 2015 17:10:34 +0000 (19:10 +0200)
web/htdocs/tools/pwr/build_index.pl
web/htdocs/tools/pwr/pwr.pl
web/htdocs/tools/pwr/read_conf.pl
web/htdocs/tools/pwr/save_conf.pl

index 3c29691b9f6c62676f20db35c744a837f6602c73..c5ea77aefaa986b2d8d230e4febbf2fed9c414a8 100755 (executable)
@@ -1,7 +1,13 @@
 #!/usr/bin/perl -w
 use Cwd;
+
+if ($ENV{'SERVER_SOFTWARE'} =~ /HTTP-?i/i) {
+  &htsponse(200, "OK");
+  }
 print "Content-type: text/html\n\n";
 
+
+
 my $pwd = &Cwd::cwd();
 
 my $file = "pwr.conf";
@@ -10,7 +16,6 @@ if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) {
   }
 
 
-
 open(LESEN,$file)
   or die "Fehler beim oeffnen von : $!\n";
 
index 8a57692a9d230aff4b964a1a16c81a8abba718bd..2e3807e055201a61602955f3dd0f96bdefe028c0 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) {
+if ($ENV{'SERVER_SOFTWARE'} =~ /HTTP-?i/i) {
   &htsponse(200, "OK");
   }
 print "Content-type: text/html\n\n";
@@ -106,7 +106,7 @@ sub receive_answer {
 
   # do polling for 5 seconds, break polling as soon as answer was received
   my $i;
-  for ($i = 0; ($i<500) ;$i++) {
+  for ($i = 0; ($i<100) ;$i++) {
     my $a = $port->lookfor;
                #print $a."\n"; # debug output
                if ($a =~ m/V(\d\d\.\d\d)A(\d\.\d\d\d)W(\d\d\d\.\d)U(\d\d)I(\d\.\d\d)P(\d\d\d)F(\d\d\d\d\d\d)/) {
@@ -150,7 +150,7 @@ sub receive_answer {
                        last;
        
                } else {
-      usleep 1E4; # 10 ms delay
+      usleep 5E4; # 50 ms delay
                }
        }
 }
@@ -169,13 +169,13 @@ sub receive_answer_HMP {
     usleep(20000) if $ser_type eq "PST";
     if($command =~ m/\?/) {
 #       print "waiting...\n";
-      READBACK: for (my $i = 0; ($i<500) ;$i++) {
+      READBACK: for (my $i = 0; ($i<100) ;$i++) {
         $a = $port->lookfor(3);
         if (defined $a and $a ne "" and $a =~ m/\d/) {
           print $a."&";
           last READBACK;
           }
-        usleep(1000);
+        usleep(5000);
        usleep(20000) if $ser_type eq "PST";
         }
       }
index 3b9f5a060b5edec074725b6da4c8d87a7bcd2fea..acf4909378de51d85544debf8ca6b885015b8743 100755 (executable)
@@ -1,8 +1,12 @@
 #!/usr/bin/perl -w
-print "Content-type: text/html\r\n\r\n";
-
 use Cwd;
 
+if ($ENV{'SERVER_SOFTWARE'} =~ /HTTP-?i/i) {
+  &htsponse(200, "OK");
+  }
+print "Content-type: text/html\n\n";
+
+
 my $pwd = &Cwd::cwd();
 
 my $file = "pwr.conf";
index 3834987883db1b5c6e2a85a6b97fb5e28d4373a9..8fb553c2b8bf303f036ce0314bf8b9ff51d009ac 100755 (executable)
@@ -1,5 +1,10 @@
 #!/usr/bin/perl -w
-print "Content-type: text/html\r\n\r\n";
+
+if ($ENV{'SERVER_SOFTWARE'} =~ /HTTP-?i/i) {
+  &htsponse(200, "OK");
+  }
+print "Content-type: text/html\n\n";
+
 
 my $envstring = $ENV{'QUERY_STRING'};
 $envstring =~ s/%20/ /g;