00001 #ifndef SCTCALIBRATIONCONTROLLER_RXTHRESHOLDBASEDONCONFIGREGISTERTEST_H
00002 #define SCTCALIBRATIONCONTROLLER_RXTHRESHOLDBASEDONCONFIGREGISTERTEST_H
00003
00004 #include "../ipc/TestRequest.h"
00005 #include "../ipc/CalibrationController.h"
00006 #include "../ipc/ScanLibrary.h"
00007 #include "../ipc/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 RxThresholdBasedOnConfigRegisterTest : public TestRequestImpl {
00028 private:
00029 static const bool registeredInTestLibrary;
00030
00031 public:
00032 static Sct_CalibrationController::TestRequest_ptr instance() {
00033 static RxThresholdBasedOnConfigRegisterTest rt;
00034 return rt._this();
00035 }
00036
00037 virtual void startTestRealImpl(Sct_SctApi::SctApiIPC_ptr the_api, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) {
00038 this->api = Sct_SctApi::SctApiIPC::_duplicate(the_api);
00039
00040 name = "RxThresholdBasedOnConfigRegisterTest";
00041 testVariable = ST_ELAPSED;
00042 nScans = 1;
00043 testPoints.push_back(nTriggers);
00044 }
00045
00046 virtual Sct_CalibrationController::ScanRequest_ptr getNextScanRealImpl(unsigned long index) {
00047 Sct_CalibrationController::ScanLibrary_var sl = CalibrationControllerImpl::instance()->getScanLibrary();
00048 const bool issueSoftReset = true;
00049 Sct_CalibrationController::ScanRequest_ptr request = sl->rawScan(nTriggers, issueSoftReset);
00050 Sct_SctApi::Scan_var scan = request->getScanCorba();
00051
00052 const int bitsToRead = 256;
00053 request->setWidthCorba(bitsToRead);
00054
00055
00056
00057
00058
00059
00060 APICALL(scan, setOption(Sct_SctApi::Scan::enableDataMode, 0), "Failed to disable dataMode (failed to enable SendConfRegIDMode)")
00061
00062 APICALL(scan, configure(ST_RX_THRESHOLD, 0, 255, 5), "Failed to set Scan information")
00063 return request;
00064 }
00065
00066 virtual bool canFeedbackRealImpl() {
00067 return true;
00068 }
00069
00070 virtual void endTestRealImpl() {
00071 api = Sct_SctApi::SctApiIPC::_nil();
00072 }
00073
00074 private:
00075 RxThresholdBasedOnConfigRegisterTest() {}
00076 Sct_SctApi::SctApiIPC_var api;
00077 static const int nTriggers = 10;
00078 };
00079 }
00080 }
00081 #endif //SCTCALIBRATIONCONTROLLER_RXTHRESHOLDBASEDONCONFIGREGISTERTEST_H