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