00001 #ifndef FULLBYPASSENDCAPTEST_H
00002 #define FULLBYPASSENDCAPTEST_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 "Sct/LogicErrors.h"
00012
00013 #include <CommonWithDsp/ABCD/ABCDscans.h>
00014 #include <iostream>
00015 #include <vector>
00016
00017 using namespace Sct;
00018 using namespace std;
00019 using namespace SctCalibrationController::Ipc;
00020 using namespace SctCalibrationController;
00021
00022 namespace SctCalibrationController {
00023 namespace Scripts {
00024
00025 class FullBypassEndcapTest : public TestRequestImpl {
00026 public:
00027 static FullBypassEndcapTest& instance() {
00028 static FullBypassEndcapTest fb;
00029 return fb;
00030 }
00031
00032 virtual void startTest(Sct_SctApi_T_SctApi& api, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) {
00033 this->api = &api;
00034
00035
00036 APICALL(&api, modifyABCDVar(&st, ST_COMPRESSION, 1), "FullBypassEndcapTest::startTest")
00037
00038
00039 APICALL(&api, modifyABCDVar(&st, ST_EDGE_DETECT, 0), "FullBypassEndcapTest::startTest")
00040
00041
00042 APICALL(&api, modifyABCDVar(&st, ST_MASK, 3), "FullBypassEndcapTest::startTest")
00043
00044
00045 APICALL(&api, modifyABCDVar(&st, ST_SEND_MASK, 1), "FullBypassEndcapTest::startTest")
00046
00047 name = "FullBypassTest";
00048 testVariable = ST_ELAPSED;
00049
00050
00051
00052
00053
00054 vdd.clear();
00055 vdd.push_back(4.0);
00056
00057 testPoints = vdd;
00058 nScans = testPoints.size();
00059 }
00060
00064 virtual ScanRequest* getNextScan(unsigned long index) {
00065 if (api == 0)
00066 throw InvariantViolatedError("Api pointer is 0 in getNextScan!", __FILE__, __LINE__);
00067
00068
00069
00070
00071
00072
00073 ScanLibrary& sl = CalibrationControllerImpl::instance().getScanLibrary();
00074 ScanRequest& srequest = sl.tokenScan();
00075
00076 Sct_SctApi_T_Scan* scan = srequest.getScan();
00077 if (scan) {
00078 APICALL(scan, configure(&st, ST_TOKEN, 0, 61, 1), "Failed to set Scan information") ;
00079 }
00080 return &srequest;
00081 }
00082
00083 virtual bool canFeedback() {
00084 return false;
00085 }
00086
00087 virtual void endTest() {
00088 if (api == 0)
00089 throw InvariantViolatedError("Api pointer is 0 in endTest!", __FILE__, __LINE__);
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 api = 0;
00101 }
00102
00103 private:
00104 FullBypassEndcapTest() {}
00105 Sct_SctApi_T_SctApi* api;
00106 std::vector<double> vdd;
00107 };
00108 }
00109 }
00110 #endif //FULLBYPASSTEST_H