00001 #ifndef SCTCALIBRATIONCONTROLLER_RXTHRESHOLDTEST_H
00002 #define SCTCALIBRATIONCONTROLLER_RXTHRESHOLDTEST_H
00003
00004 #include "../ipc/TestRequest.h"
00005 #include "../ipc/CalibrationController.h"
00006 #include "../ipc/ScanLibrary.h"
00007 #include "../ipc/Sct_CalibrationController.hh"
00008
00009 #include "../SctApiAccessException.h"
00010 #include "../SctApiCall.h"
00011 #include "../CalibrationControllerImpl.h"
00012 #include "Sct/LogicErrors.h"
00013 #include "SctApi/extraScans.h"
00014
00015 #include <CommonWithDsp/ABCD/ABCDscans.h>
00016 #include <iostream>
00017 #include <vector>
00018
00019 using namespace Sct;
00020 using namespace std;
00021 using namespace SctCalibrationController::Ipc;
00022 using namespace SctCalibrationController;
00023
00024 namespace SctCalibrationController {
00025 namespace Scripts {
00026
00027 class RxThresholdTest : public TestRequestImpl {
00028 public:
00029 static RxThresholdTest& instance() {
00030 static RxThresholdTest rc;
00031 return rc;
00032 }
00033
00034 virtual void startTest(Sct_SctApi_T_SctApi& the_api, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) {
00035 this->api = &the_api;
00036
00037 name = "RxThresholdTest";
00038 testVariable = ST_ELAPSED;
00039 nScans = 1;
00040
00041 APICALL(api, modifyABCDVar(&st, ST_FEEDTHROUGH, 0), "RxThresholdTest::startTest");
00042 testPoints.push_back(nTriggers);
00043 }
00044
00045 virtual ScanRequest* getNextScan(unsigned long index) {
00046 ScanLibrary& sl = CalibrationControllerImpl::instance().getScanLibrary();
00047 ScanRequest& request = sl.rawScan(nTriggers);
00048 Sct_SctApi_T_Scan* scan = request.getScan();
00049
00050 APICALL(scan, configure(&st, ST_RX_THRESHOLD, 0, 255, 5), "Failed to set Scan information")
00051 return &request;
00052 }
00053
00054 virtual bool canFeedback() {
00055 return true;
00056 }
00057
00058 virtual void endTest() {
00059
00060 APICALL(api, modifyABCDVar(&st, ST_FEEDTHROUGH, 1), "RxThresholdTest::startTest");
00061 api = 0;
00062 }
00063
00064 private:
00065 RxThresholdTest() {}
00066 Sct_SctApi_T_SctApi* api;
00067 static const int nTriggers = 10;
00068 };
00069 }
00070 }
00071 #endif //SCTCALIBRATIONCONTROLLER_RXTHRESHOLDTEST_H