#!/usr/bin/perl
#
# 2004/11/09 Created by Keiichi Matsuzaki
#   release 0.1
# 2004/11/11 Modified by KM
#   release 0.2
#

require("xrteStatus.pl");

for($i=0;$i<17;$i++){ $buf[$i] = 0xff; }
for($j=0;$j<=17*8;$j++){
  $_ = pack("CCCCCCCCCCCCCCCCCfd", $buf[0],$buf[1],$buf[2],$buf[3],$buf[4],$buf[5],$buf[6],$buf[7],$buf[8],$buf[9],$buf[10],$buf[11],$buf[12],$buf[13],$buf[14],$buf[15],$buf[16],$j,$j); 
  &xrteRead::parse($_);
  for($i=17-1;$i>0;$i--){
    $buf[$i] = int($buf[$i]/2) + 0x80 * ($buf[$i-1]%2);
  }
  $buf[$i] = int($buf[$i]/2);
}

sub xrteRead::recievedStatus {
  printf "%x ", $xrteRead::CAL_INFO;
  printf "%x ", $xrteRead::CHIP_SUM;
  printf "%02x ", $xrteRead::ROI_H_STA_POS;
  printf "%02x ", $xrteRead::ROI_V_STA_POS;
  printf "%02x ", $xrteRead::ROI_H_SIZE;
  printf "%02x ", $xrteRead::ROI_V_SIZE;
  printf "%+1d ", $xrteRead::CCD_READ_PORT;
  printf "%02x ", $xrteRead::CCD_TEMP;
  printf "%x ", $xrteRead::CCD_OPE_STS1;
  printf "%x ", $xrteRead::CCD_OPE_STS2;
  printf "%x ", $xrteRead::CCD_OPE_STS3;
  printf "%x ", $xrteRead::CCD_OPE_STS4;
  printf "%x ", $xrteRead::CCD_OPE_STS5;
  printf "%x ", $xrteRead::CCD_OPE_STS6;
  printf "%x ", $xrteRead::CCD_OPE_STS7;
  printf "%x ", $xrteRead::CCD_OPE_STS8;
  printf "%04x ", $xrteRead::EXP_STA_TIME;
  printf "%04x ", $xrteRead::EXP_END_TIME;
  printf "%04x ", $xrteRead::READ_END_TIME;
  printf "%04x ", $xrteRead::TIMER_COUNTER;
  printf "%g ", $xrteRead::floatData;
  printf "%g ", $xrteRead::doubleData;
  printf "\n";
}
