diff --git a/Common/Clients/SystemTerminal/src/nuraghe_commands.py b/Common/Clients/SystemTerminal/src/nuraghe_commands.py index 4b1723e379de6c2119aaa1cee93c093b89a9385b..22104b6acce376434400171ea6c531e1f0019c5e 100755 --- a/Common/Clients/SystemTerminal/src/nuraghe_commands.py +++ b/Common/Clients/SystemTerminal/src/nuraghe_commands.py @@ -463,6 +463,12 @@ def integration(): sets the integration time """ +def backendPark(): + """ + backendPark + deprogram all the boards + """ + def log(): """ log=logfilename diff --git a/Common/Interfaces/BackendsInterface/idl/GenericBackend.idl b/Common/Interfaces/BackendsInterface/idl/GenericBackend.idl index 1bff25af170132f49fc9de357191e3ce81eb8018..572d58d0af3863772509610c2ae761a32bf0a4e5 100644 --- a/Common/Interfaces/BackendsInterface/idl/GenericBackend.idl +++ b/Common/Interfaces/BackendsInterface/idl/GenericBackend.idl @@ -302,6 +302,8 @@ module Backends { ACS::doubleSeq getTpi() raises (ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); ACS::doubleSeq getRms() raises (ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); + + void endSchedule() raises (ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); /** * Call this method in order to read the total power from each input when the input are connected directly to the 50 Ohm. diff --git a/Common/Interfaces/BackendsInterface/idl/Sardara.idl b/Common/Interfaces/BackendsInterface/idl/Sardara.idl index 4bf2d36f53d73f0cc969afc30bdf64eed145def4..efba057d5976f364667e87e1e1df5cf318a77498 100644 --- a/Common/Interfaces/BackendsInterface/idl/Sardara.idl +++ b/Common/Interfaces/BackendsInterface/idl/Sardara.idl @@ -128,9 +128,9 @@ module Backends { void initialize(in string configuration) raises (ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); - void getConfiguration(out string configuration); + string getConfiguration(); - void getCommProtVersion(out string version); + string getCommProtVersion(); }; }; diff --git a/Common/Interfaces/BackendsInterface/idl/Skarab.idl b/Common/Interfaces/BackendsInterface/idl/Skarab.idl index 929a04b94701d3259eb1304114ea094ee28f6911..67e7b604d566cbd5909b0a7ab1c37e1dfdc9e397 100644 --- a/Common/Interfaces/BackendsInterface/idl/Skarab.idl +++ b/Common/Interfaces/BackendsInterface/idl/Skarab.idl @@ -128,9 +128,9 @@ module Backends { void initialize(in string configuration) raises (ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); - void getConfiguration(out string configuration); + string getConfiguration(); - void getCommProtVersion(out string version); + string getCommProtVersion(); }; }; diff --git a/Common/Libraries/DiscosBackendProtocol/include/command.hpp b/Common/Libraries/DiscosBackendProtocol/include/command.hpp index 37d5120b0c9c83c725521db8f72e4657a518de9e..049d75a42f1868a93dbc0947bee924c96d76c9ec 100644 --- a/Common/Libraries/DiscosBackendProtocol/include/command.hpp +++ b/Common/Libraries/DiscosBackendProtocol/include/command.hpp @@ -27,7 +27,11 @@ namespace DiscosBackend{ static Message setFilename(string filename); static Message convertData(){return Message(REQUEST, "convert-data");}; static Message getRms(){return Message(REQUEST, "get-rms");}; + static Message getDDCoffset(){return Message(REQUEST, "get-ddcoffset");}; static Message setEnable(int feed1, int feed2); + static Message endSchedule(){return Message(REQUEST, "end-schedule");}; + static Message backendPark(){return Message(REQUEST, "backend-park");}; + static Message setShift(int shift); }; //class Command }; //namespace DiscosBackend diff --git a/Common/Libraries/DiscosBackendProtocol/src/command.cpp b/Common/Libraries/DiscosBackendProtocol/src/command.cpp index 7ed670fd0653803d5472c92db82a7e413cb3bc32..0d820297c0742130dbbdfa33237eb0c429ed2bf2 100644 --- a/Common/Libraries/DiscosBackendProtocol/src/command.cpp +++ b/Common/Libraries/DiscosBackendProtocol/src/command.cpp @@ -18,6 +18,14 @@ Command::setIntegration(int integration) return command; } +Message +Command::setShift(int shift) +{ + Message command(REQUEST, "set-shift"); + command.add_argument<int>(shift); + return command; +} + Message Command::getTpi(double frequency, double bandwidth) { diff --git a/Common/Servers/NoiseGenerator/include/NoiseGeneratorImpl.h b/Common/Servers/NoiseGenerator/include/NoiseGeneratorImpl.h index cff49b18a6fe02b003dea1f6bc16a7041cd08169..89689b5496cf3a863637cec85b8212e09f5fd323 100644 --- a/Common/Servers/NoiseGenerator/include/NoiseGeneratorImpl.h +++ b/Common/Servers/NoiseGenerator/include/NoiseGeneratorImpl.h @@ -236,7 +236,8 @@ public: */ virtual void setTime() throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx, BackendsErrors::BackendsErrorsEx); - + + virtual void endSchedule() throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx, BackendsErrors::BackendsErrorsEx) {AUTO_TRACE("TotalPowerImpl::endSchedule()"); }; /** * Call this function in order to get a total power measure for each input channel. * @thorw CORBA::SystemException diff --git a/Common/Servers/Sardara/include/CommandLine.h b/Common/Servers/Sardara/include/CommandLine.h index 846c9dfa901e83e911fb41c128a422c9aa220098..1c967513c6cdfe4ebb14128a483ab8d2c429b874 100644 --- a/Common/Servers/Sardara/include/CommandLine.h +++ b/Common/Servers/Sardara/include/CommandLine.h @@ -425,6 +425,9 @@ public: */ void setAttenuation(const long&inputId, const double& attenuation) throw (BackendsErrors::BackendBusyExImpl,ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl,BackendsErrors::NakExImpl, ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl); + + void backendPark() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl); /** * Called to configure a range where compute a Tsys. @@ -480,9 +483,9 @@ public: static bool resultingSampleRate(const long& integration,const double& sr,long& result); //int getConfiguration(char* configuration); - void getConfiguration(char* configuration); + char* getConfiguration(); - int getCommProtVersion(CORBA::String_out version); + char* getCommProtVersion(); IRA::CString m_targetFileName; @@ -774,9 +777,15 @@ ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,BackendsErrors::Mal bool m_SK77; bool m_SK00; bool m_SK01; + bool m_SK04; + bool m_SK03; + bool m_SK06; bool m_SK77S; bool m_SK00S; bool m_SK01S; + bool m_SK04S; + bool m_SK03S; + bool m_SK06S; bool m_SC00; bool m_SL00; bool m_SP00; diff --git a/Common/Servers/Sardara/include/SardaraImpl.h b/Common/Servers/Sardara/include/SardaraImpl.h index 9112f1d82ca6205f65081db7eacb4a2fb5bcc374..22df8f23e87e59f8201a8a1649f3ba9f2f65aab3 100644 --- a/Common/Servers/Sardara/include/SardaraImpl.h +++ b/Common/Servers/Sardara/include/SardaraImpl.h @@ -258,9 +258,9 @@ public: */ virtual CORBA::Boolean command(const char *cmd,CORBA::String_out answer) throw (CORBA::SystemException); - virtual void getConfiguration (CORBA::String_out configuration) throw (CORBA::SystemException); + virtual char* getConfiguration () throw (CORBA::SystemException); - virtual void getCommProtVersion (CORBA::String_out version) throw (CORBA::SystemException); + virtual char* getCommProtVersion () throw (CORBA::SystemException); /** * This method is related to the implementation of the genericBackend interface @@ -320,6 +320,8 @@ public: virtual ACS::doubleSeq * getRms () throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); + virtual void endSchedule() throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx, BackendsErrors::BackendsErrorsEx) {AUTO_TRACE("SardaraImpl::endSchedule()"); }; + /** * Call this function in order to get a total power measure for each input channel. The measure is done when the inputs are directly * connected to the 50 Ohm. diff --git a/Common/Servers/Sardara/src/CommandLine.cpp b/Common/Servers/Sardara/src/CommandLine.cpp index 050946a6a2d7b373e35728776801b4e2e61db9a5..b2f65b122b25a12714a1be6e125fa1360b2e9297 100644 --- a/Common/Servers/Sardara/src/CommandLine.cpp +++ b/Common/Servers/Sardara/src/CommandLine.cpp @@ -50,6 +50,10 @@ CCommandLine::CCommandLine(ContainerServices *service): CSocket(), // SRT configurations m_SK00=false; m_SK00S=false; + m_SK01=false; m_SK01S=false; + m_SK04=false; m_SK04S=false; + m_SK03=false; m_SK03S=false; + m_SK06=false; m_SK06S=false; m_SK77=false; m_SK77S=false; m_SCC00=false; m_SCC00S=false; m_SCH00=false; m_SCH00S=false; @@ -206,6 +210,12 @@ void CCommandLine::stopDataAcquisition() throw (BackendsErrors::ConnectionExImpl clearStatusField(CCommandLine::SUSPEND); // unsets the component status to transfer job suspended...... } +void CCommandLine::backendPark() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl) +{ + ACS_LOG(LM_FULL_INFO,"CCommandLine::backendPark()",(LM_NOTICE,"backendPark")); +} + void CCommandLine::stopDataAcquisitionForced() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl) { @@ -369,8 +379,8 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const throw impl; }*/ if (inputId>=0) { //check the section id is in valid ranges - //if (inputId>=m_sectionsNumber) { - if (inputId>m_sectionsNumber) { + if (inputId>=m_sectionsNumber) { + //if (inputId>m_sectionsNumber) { _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setConfiguration()"); impl.setReason("the section identifier is out of range"); throw impl; @@ -519,9 +529,23 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const if (newBW[i]==2300.00) filter=2350.00; if (newBW[i] == 420.00 || newBW[i] == 1500.00 || newBW[i] == 2300.00) { - for (j=0; j<m_inputsNumber; j++) - m_totalPower->setSection(j,-1, filter, -1, -1, -1, -1); - ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"TOTALPOWER_FILTER_CONFIGURED %ld,FILTER=%lf",i,filter)); + if(m_stokes) + { + // Configure the TotalPower sections corresponding to the selected Sardara section (should be equivalent to the feed) + // e.g.: if the selected Sardara section is 0 we will configure TotalPower 0 and 1 sections + // if the selected Sardara section is 1 we will configure TotalPower 2 and 3 sections + // ... + m_totalPower->setSection(i * 2, -1, filter, -1, -1, -1, -1); + ACS_LOG(LM_FULL_INFO, "CCommandLine::setConfiguration()", (LM_NOTICE, "TOTALPOWER_FILTER_CONFIGURED %ld, FILTER=%lf", i*2, filter)); + m_totalPower->setSection((i * 2) + 1, -1, filter, -1, -1, -1, -1); + ACS_LOG(LM_FULL_INFO, "CCommandLine::setConfiguration()", (LM_NOTICE, "TOTALPOWER_FILTER_CONFIGURED %ld, FILTER=%lf", (i*2)+1, filter)); + } + else + { + // Use the same section identifier for TotalPower + m_totalPower->setSection(i, -1, filter, -1, -1, -1, -1); + ACS_LOG(LM_FULL_INFO, "CCommandLine::setConfiguration()", (LM_NOTICE, "TOTALPOWER_FILTER_CONFIGURED %ld, FILTER=%lf", i, filter)); + } } } /*if ((m_SL00==true || m_SL00S==true) && m_stationSRT == true) { @@ -592,10 +616,23 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const if (newBW[i]==2300.00) filter=2350.00; if (newBW[i] == 420.00 || newBW[i] == 1500.00 || newBW[i] == 2300.00) { - for (j=0; j<m_inputsNumber; j++) { - m_totalPower->setSection(j,-1, filter, -1, -1, -1, -1); - ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"TOTALPOWER_FILTER_CONFIGURED %ld,FILTER=%lf",i,filter)); - } + if(m_stokes) + { + // Configure the TotalPower sections corresponding to the selected Sardara section (should be equivalent to the feed) + // e.g.: if the selected Sardara section is 0 we will configure TotalPower 0 and 1 sections + // if the selected Sardara section is 1 we will configure TotalPower 2 and 3 sections + // ... + m_totalPower->setSection(i * 2, -1, filter, -1, -1, -1, -1); + ACS_LOG(LM_FULL_INFO, "CCommandLine::setConfiguration()", (LM_NOTICE, "TOTALPOWER_FILTER_CONFIGURED %ld, FILTER=%lf", i*2, filter)); + m_totalPower->setSection((i * 2) + 1, -1, filter, -1, -1, -1, -1); + ACS_LOG(LM_FULL_INFO, "CCommandLine::setConfiguration()", (LM_NOTICE, "TOTALPOWER_FILTER_CONFIGURED %ld, FILTER=%lf", (i*2)+1, filter)); + } + else + { + // Use the same section identifier for TotalPower + m_totalPower->setSection(i, -1, filter, -1, -1, -1, -1); + ACS_LOG(LM_FULL_INFO, "CCommandLine::setConfiguration()", (LM_NOTICE, "TOTALPOWER_FILTER_CONFIGURED %ld, FILTER=%lf", i, filter)); + } } } } @@ -799,6 +836,10 @@ void CCommandLine::setDefaultConfiguration(const IRA::CString & config) throw (C if (m_stationSRT==true) { m_SK77=m_SK77S=false; m_SK00=m_SK00S=false; + m_SK01=m_SK01S=false; + m_SK04=m_SK04S=false; + m_SK03=m_SK03S=false; + m_SK06=m_SK06S=false; m_SCC00=m_SCC00S=false; m_SCH00=m_SCH00S=false; m_SL00=m_SL00S=false; @@ -817,6 +858,30 @@ void CCommandLine::setDefaultConfiguration(const IRA::CString & config) throw (C m_SK00=true; m_CK=true; } + if (config.Compare("SK01")==0) { + m_filter=1250.0; + m_inputsNumber=m_sectionsNumber; + m_SK01=true; + m_CK=true; + } + if (config.Compare("SK04")==0) { + m_filter=1250.0; + m_inputsNumber=m_sectionsNumber; + m_SK04=true; + m_CK=true; + } + if (config.Compare("SK03")==0) { + m_filter=1250.0; + m_inputsNumber=m_sectionsNumber; + m_SK03=true; + m_CK=true; + } + if (config.Compare("SK06")==0) { + m_filter=1250.0; + m_inputsNumber=m_sectionsNumber; + m_SK06=true; + m_CK=true; + } if (config.Compare("SCC00")==0) { m_filter=1250.0; m_inputsNumber=m_sectionsNumber; @@ -1770,30 +1835,37 @@ CCommandLine::sendBackendCommand(Message request) return reply; } -//int CCommandLine::getConfiguration(char* configuration) -void CCommandLine::getConfiguration(char* configuration) +char* CCommandLine::getConfiguration() { Message request = Command::getConfiguration(); try { Message reply = sendBackendCommand(request); if(reply.is_success_reply()) { - strcpy(configuration, reply.get_argument<string>(0).c_str()); + return CORBA::string_dup(reply.get_argument<string>(0).c_str()); } } catch (...) { - } + + return CORBA::string_dup(""); } -int CCommandLine::getCommProtVersion(CORBA::String_out version) +char* CCommandLine::getCommProtVersion() { Message request = Command::version(); - Message reply = sendBackendCommand(request); - string _version = reply.get_argument<string>(0); - if(reply.is_success_reply()) - strcpy(version, _version.c_str()); - return _version.length(); + try + { + Message reply = sendBackendCommand(request); + if(reply.is_success_reply()) + { + return CORBA::string_dup(reply.get_argument<string>(0).c_str()); + } + } + catch(...) { + } + + return CORBA::string_dup(""); } bool CCommandLine::checkConnection() diff --git a/Common/Servers/Sardara/src/SardaraImpl.cpp b/Common/Servers/Sardara/src/SardaraImpl.cpp index bea435bcb0192b510d7ad2b37cc100ba9e3a872e..9dbad5998d1af0cbe540b45920c633ada9614f4b 100644 --- a/Common/Servers/Sardara/src/SardaraImpl.cpp +++ b/Common/Servers/Sardara/src/SardaraImpl.cpp @@ -138,6 +138,7 @@ void SardaraImpl::initialize() throw (ACSErr::ACSbaseExImpl) m_parser->add("initialize",new function1<CCommandLine,non_constant,void_type,I<string_type> >(line,&CCommandLine::setup),1 ); m_parser->add("getRms",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getRms),0 ); m_parser->add("setTsysRange", new function2<CCommandLine,non_constant,void_type,I<double_type>,I<double_type> >(line,&CCommandLine::setTsysRange),2 ); + m_parser->add("backendPark", new function0<CCommandLine,non_constant, void_type>(line,&CCommandLine::backendPark),0 ); threadPar.sender=this; threadPar.command=m_commandLine; @@ -780,12 +781,12 @@ void SardaraImpl::setIntegration(CORBA::Long Integration) throw (CORBA::SystemEx } } -void SardaraImpl::getConfiguration (CORBA::String_out configuration) throw (CORBA::SystemException) +char* SardaraImpl::getConfiguration() throw (CORBA::SystemException) { AUTO_TRACE("SardaraImpl::getIntegration()"); CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); try { - line->getConfiguration(configuration); + return line->getConfiguration(); } catch (ComponentErrors::ComponentErrorsExImpl& ex) { ex.log(LM_DEBUG); @@ -802,12 +803,12 @@ void SardaraImpl::getConfiguration (CORBA::String_out configuration) throw (CORB } } -void SardaraImpl::getCommProtVersion (CORBA::String_out version) throw (CORBA::SystemException) +char* SardaraImpl::getCommProtVersion() throw (CORBA::SystemException) { AUTO_TRACE("SardaraImpl::getCommProtVersion()"); CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); try { - line->getCommProtVersion(version); + return line->getCommProtVersion(); } catch (ComponentErrors::ComponentErrorsExImpl& ex) { ex.log(LM_DEBUG); diff --git a/Common/Servers/Scheduler/include/Core_Basic.h b/Common/Servers/Scheduler/include/Core_Basic.h index 92ab5ba735db2ab1b6caf9aaf1636cd1e6f605d8..2d0128f6a4051822736920e5be54523026756296 100644 --- a/Common/Servers/Scheduler/include/Core_Basic.h +++ b/Common/Servers/Scheduler/include/Core_Basic.h @@ -99,6 +99,8 @@ static void startDataTansfer(Backends::GenericBackend_ptr backend,bool& backendE static void stopDataTransfer(Backends::GenericBackend_ptr backend,bool& backendError,bool& streamStarted,bool& streamPrepared,bool& streamConnected) throw (ComponentErrors::OperationErrorExImpl, ManagementErrors::BackendNotAvailableExImpl); + static void endSchedule(Backends::GenericBackend_ptr backend,bool& backendError) throw (ComponentErrors::OperationErrorExImpl, ManagementErrors::BackendNotAvailableExImpl); + /** * This static method will call the <i>stopScan()</i> of the DataReceiver interface in order to inform the current data receiver component that a scan has to be finalized. * @param writer reference to the writer or data recorder or data dealer diff --git a/Common/Servers/Scheduler/include/Core_Common.h b/Common/Servers/Scheduler/include/Core_Common.h index 1e8554cbeb60687a07f648a278f174b61b963e4b..748f9dc80b5b49d6d957253707096678cb591baf 100644 --- a/Common/Servers/Scheduler/include/Core_Common.h +++ b/Common/Servers/Scheduler/include/Core_Common.h @@ -166,6 +166,8 @@ void enableDataTransfer() throw (ComponentErrors::OperationErrorExImpl,Component */ void stopDataTransfer() throw (ComponentErrors::OperationErrorExImpl,ManagementErrors::BackendNotAvailableExImpl,ComponentErrors::CouldntGetComponentExImpl); +void endSchedule() throw (ComponentErrors::OperationErrorExImpl,ManagementErrors::BackendNotAvailableExImpl,ComponentErrors::CouldntGetComponentExImpl); + /** * This static method inquiries the DataReceiver to check if the data transfer is still active or not. * @throw ComponentErrors::OperationErrorExImpl diff --git a/Common/Servers/Scheduler/src/Core.cpp b/Common/Servers/Scheduler/src/Core.cpp index 7e8566567964111777f6ae8ebbbc75bc2f20a6ed..a92646ba1dee41905bf25d6a249b771875f2db82 100644 --- a/Common/Servers/Scheduler/src/Core.cpp +++ b/Common/Servers/Scheduler/src/Core.cpp @@ -209,6 +209,7 @@ void CCore::execute() throw(ComponentErrors::TimerErrorExImpl, ComponentErrors:: m_parser->add("calSwitch", "backend", 3, &CCore::remoteCall); m_parser->add("getRms", "backend", 3, &CCore::remoteCall); m_parser->add("setTsysRange","backend",3,&CCore::remoteCall); + m_parser->add("backendPark","backend",3,&CCore::remoteCall); // minor servo m_parser->add("servoSetup", "minorservo", 4, &CCore::remoteCall); diff --git a/Common/Servers/Scheduler/src/Core_Basic.i b/Common/Servers/Scheduler/src/Core_Basic.i index f0d5b9803b9304664d8da34a446509e9bca26cfd..d2203806640e9bf17a6e5c5de397d6fe84c79e23 100644 --- a/Common/Servers/Scheduler/src/Core_Basic.i +++ b/Common/Servers/Scheduler/src/Core_Basic.i @@ -565,6 +565,26 @@ void CCore::stopDataTransfer(Backends::GenericBackend_ptr backend,bool& backendE } } +void CCore::endSchedule(Backends::GenericBackend_ptr backend,bool& backendError) throw (ComponentErrors::OperationErrorExImpl, ManagementErrors::BackendNotAvailableExImpl) +{ + if (!CORBA::is_nil(backend)) { + try { + backend->endSchedule(); + ACS_STATIC_LOG(LM_FULL_INFO,"CCore::endSchedule()",(LM_NOTICE,"COMMAND endSCHEDULE FOR BACKEND")); + } + catch (...) { + _EXCPT(ComponentErrors::OperationErrorExImpl,impl,"CCore::endSchedule()"); + impl.setReason("backend could not stop data acquisition"); + backendError=true; + throw impl; + } + } + else { + _EXCPT(ManagementErrors::BackendNotAvailableExImpl,impl,"CCore::endSchedule()"); + throw impl; + } +} + void CCore::startDataTansfer(Backends::GenericBackend_ptr backend,bool& backendError,const ACS::Time& startTime,bool& streamStarted,bool& streamPrepared,bool& streamConnected) throw ( ComponentErrors::OperationErrorExImpl,ComponentErrors::CORBAProblemExImpl,ComponentErrors::UnexpectedExImpl,ManagementErrors::BackendNotAvailableExImpl,ManagementErrors::DataTransferSetupErrorExImpl) { diff --git a/Common/Servers/Scheduler/src/Core_Common.i b/Common/Servers/Scheduler/src/Core_Common.i index ad91a3414f90c52a9a907f058d99dc082e92b146..66f3a740e8182024aa5c70f6c7f04d744bda63c9 100644 --- a/Common/Servers/Scheduler/src/Core_Common.i +++ b/Common/Servers/Scheduler/src/Core_Common.i @@ -635,6 +635,13 @@ void CCore::stopDataTransfer() throw (ComponentErrors::OperationErrorExImpl,Mana CCore::stopDataTransfer(m_defaultBackend,m_defaultBackendError,m_streamStarted,m_streamPrepared,m_streamConnected); } +void CCore::endSchedule() throw (ComponentErrors::OperationErrorExImpl,ManagementErrors::BackendNotAvailableExImpl,ComponentErrors::CouldntGetComponentExImpl) +{ + baci::ThreadSyncGuard guard(&m_mutex); + loadDefaultBackend();// throw (ComponentErrors::CouldntGetComponentExImpl); + CCore::endSchedule(m_defaultBackend,m_defaultBackendError); +} + bool CCore::checkRecording() throw (ComponentErrors::OperationErrorExImpl,ComponentErrors::UnexpectedExImpl,ComponentErrors::CouldntGetComponentExImpl) { baci::ThreadSyncGuard guard(&m_mutex); diff --git a/Common/Servers/Scheduler/src/ScheduleExecutor.cpp b/Common/Servers/Scheduler/src/ScheduleExecutor.cpp index 2446d35e947da214707f5ed9e0ace7c20fa5c688..94828b7497507107d7ac8c8e6613cddddb9c9fd2 100644 --- a/Common/Servers/Scheduler/src/ScheduleExecutor.cpp +++ b/Common/Servers/Scheduler/src/ScheduleExecutor.cpp @@ -783,6 +783,12 @@ void CScheduleExecutor::cleanSchedule(bool error) //m_scanStarted=false; ex.log(LM_WARNING); } + try { + m_core->endSchedule(); + } + catch (ACSErr::ACSbaseExImpl& ex) { + ex.log(LM_WARNING); + } try { m_core->closeScan(false); } diff --git a/Common/Servers/Skarab/include/CommandLine.h b/Common/Servers/Skarab/include/CommandLine.h index 0afdf2768b7cf7458345ffd92b5bef40d492b8c4..7257d4138ceb9e7bba091cf26d52d7ebf2d39364 100644 --- a/Common/Servers/Skarab/include/CommandLine.h +++ b/Common/Servers/Skarab/include/CommandLine.h @@ -17,6 +17,8 @@ #include <SkarabS.h> #include <TotalPowerS.h> #include <GenericIFDistributorS.h> +#include <ReceiversBossC.h> +#include <SchedulerC.h> #include <string> #include <sstream> #include <DiscosBackendProtocol> @@ -24,6 +26,10 @@ //#include "Protocol.h" #include "Configuration.h" +#define GAVINO "MANAGEMENT/Gavino" +#define PALMIRO "MANAGEMENT/Palmiro" +#define DUCEZIO "MANAGEMENT/Ducezio" + using namespace maci; using namespace DiscosBackend; using namespace std; @@ -224,6 +230,8 @@ public: * @param integration new integration time in milliseconds. A negative value has no effect. */ void setIntegration(const long& integration) throw (BackendsErrors::BackendBusyExImpl, ComponentErrors::ValueOutofRangeExImpl); + + void setShift(const long& shift) throw (BackendsErrors::BackendBusyExImpl); /** * This methos will changes the current value of the <i>m_enabled</i> array. @@ -231,7 +239,7 @@ public: * @param en new values sequence for the <i>m_enabled</i> elements. A value grater than zero correspond to a true, * a zero match to a false, while a negative will keep the things unchanged. */ - void setEnabled(const ACS::longSeq& en) throw (BackendsErrors::BackendBusyExImpl); + void setEnabled(const ACS::longSeq& en) throw (BackendsErrors::BackendBusyExImpl, BackendsErrors::ConfigurationErrorExImpl, ComponentErrors::ValueOutofRangeExImpl); /** * This function can be called in order to load an initial setup for the backend. Some parameter are fixed and cannot be changed during normal @@ -251,6 +259,9 @@ public: void sendTargetFileName() throw (BackendsErrors::BackendBusyExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl); + void endSchedule() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl); + /** * This function can be used to set up an input of the backend. The input is identified by its numeric value. If a configuration * parameter is negative the current value is not changed. Since the backend hardware does not support different sample rates @@ -378,6 +389,8 @@ public: void getRms(ACS::doubleSeq& rms) throw (ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::BackendBusyExImpl); + void getKelvinCountsRatio(ACS::doubleSeq& kcr) const; + /** * This a wrapper function of the <i>getSample()</i> method. In this case the sample correspond the power measurment in each channel with full attenuation. * @throw ComponentErrors::SocketErrorExImpl @@ -442,6 +455,10 @@ public: void setTsysRange(const double& freq, const double& bw) throw (BackendsErrors::BackendBusyExImpl,ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl,BackendsErrors::NakExImpl, ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl); + void backendPark() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl); + + /** * Called by the component to fill the <i>Backends::TMainHeader</i> with the proper informations. * @param bkd the stucture that contains the required information. @@ -480,9 +497,9 @@ public: static bool resultingSampleRate(const long& integration,const double& sr,long& result); //int getConfiguration(char* configuration); - void getConfiguration(char* configuration); + char* getConfiguration(); - int getCommProtVersion(CORBA::String_out version); + char* getCommProtVersion(); IRA::CString m_targetFileName; @@ -503,6 +520,10 @@ private: ContainerServices* m_services; Backends::TotalPower_var m_totalPower; //Receivers::GenericIFDistributor_var m_ifDistributor; + /** This is the reference to the receiver boss component */ + Receivers::ReceiversBoss_var m_receiversBoss; + Management::Scheduler_var m_Scheduler; + char superVisorName[20]; /** * List the fields of the backend status @@ -669,6 +690,7 @@ private: double m_tpiZero[MAX_SECTION_NUMBER]; long m_inputsNumber; + long m_inputsNumberTP; double m_filter; @@ -780,6 +802,11 @@ private: bool m_SKARAB_4S; bool m_SKARAB_5; bool m_SKARAB_5S; + bool m_SKARAB_7; + bool m_SKARAB_11; + bool m_SKARAB_11S; + bool m_SKARAB_12; + bool m_SKARAB_12S; bool m_stationSRT; bool m_stationMED; @@ -787,6 +814,12 @@ private: bool m_SkarabInitialized; bool m_stokes; + + bool m_kkg77; + + IRA::CString m_recstr; + ACS::ROstring_var m_receiverRef; + CORBA::String_var m_receiver; }; diff --git a/Common/Servers/Skarab/include/Common.h b/Common/Servers/Skarab/include/Common.h index a7803b39a57da8d2040a2e19af06dc19be9b1935..6dbc2dfccf9fde1ec994cb1b894648f24a90e9e4 100644 --- a/Common/Servers/Skarab/include/Common.h +++ b/Common/Servers/Skarab/include/Common.h @@ -17,7 +17,7 @@ //#define BKD_DEBUG // some hard coded, hardware dependant constants -#define STARTFREQUENCY 0.0 // this is the start frequency of all IF inputs +#define STARTFREQUENCY 1000.0 // this is the start frequency of all IF inputs #define MIN_FREQUENCY 0.0 // min frequency of all IF inputs #define MAX_FREQUENCY 1500.0 // max frequency of all IF inputs #define BINSNUMBER 1000 diff --git a/Common/Servers/Skarab/include/SkarabImpl.h b/Common/Servers/Skarab/include/SkarabImpl.h index 6a0ddb6f5192d1ff7caaf96bde03aa825de59791..1f35ffb12c082bd28477ed2a320a4ffbb4ae7c33 100644 --- a/Common/Servers/Skarab/include/SkarabImpl.h +++ b/Common/Servers/Skarab/include/SkarabImpl.h @@ -238,6 +238,8 @@ public: virtual void enableChannels(const ACS::longSeq& enable) throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); + virtual void endSchedule() throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx, BackendsErrors::BackendsErrorsEx); + /** * Sets the current integration time. * @throw CORBA::SystemException @@ -245,9 +247,9 @@ public: * @thorw BackendsErrors::BackendsErrorsEx * @param integration new integration value in milliseconds. A zero disables this feature, whilst a negative has not effect. */ - virtual void setIntegration(CORBA::Long Integration) throw (CORBA::SystemException, - ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); + virtual void setIntegration(CORBA::Long Integration) throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); + virtual void setShift(CORBA::Long Shift) throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); /** * This method allows the client to interface the component by sending text commands. The command is parsed and executed according the * defined command syntax and grammar. This method is required to implement the <i>Management::CommandInterpreter</i> interface. @@ -258,9 +260,9 @@ public: */ virtual CORBA::Boolean command(const char *cmd,CORBA::String_out answer) throw (CORBA::SystemException); - virtual void getConfiguration (CORBA::String_out configuration) throw (CORBA::SystemException); + virtual char* getConfiguration() throw (CORBA::SystemException); - virtual void getCommProtVersion (CORBA::String_out version) throw (CORBA::SystemException); + virtual char* getCommProtVersion() throw (CORBA::SystemException); /** * This method is related to the implementation of the genericBackend interface @@ -362,7 +364,7 @@ public: * @param bw bandwidth interval. */ virtual void setTsysRange(CORBA::Double freq,CORBA::Double bw) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); - + /** * In order to get the inputs definition in just one call. The returned argument contains the configuration sequentially, the first element corresponds to the first input and so on. * @throw CORBA::SystemException diff --git a/Common/Servers/Skarab/src/CommandLine.cpp b/Common/Servers/Skarab/src/CommandLine.cpp index eaedc4212890a319f23f918bf8a58f4792ac853d..245f499bc5199187f0b6f9967b95b5422152cf65 100644 --- a/Common/Servers/Skarab/src/CommandLine.cpp +++ b/Common/Servers/Skarab/src/CommandLine.cpp @@ -5,24 +5,23 @@ /****************************************************************************************************************************/ #include <CustomLoggerUtils.h> /****************************************************************************************************************************/ - #define _CHECK_ERRORS(ROUTINE) \ - else if (res==FAIL) { \ - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); \ - dummy.setCode(m_Error.getErrorCode()); \ - dummy.setDescription((const char*)m_Error.getDescription()); \ - m_Error.Reset(); \ - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,ROUTINE); \ - } \ - else if (res==WOULDBLOCK) { \ - _THROW_EXCPT(ComponentErrors::TimeoutExImpl,ROUTINE); \ - } \ - else if (res==DECODE_ERROR) { \ - _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,ROUTINE); \ - } \ - else { \ - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,ROUTINE); \ - } + else if (res==FAIL) { \ + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); \ + dummy.setCode(m_Error.getErrorCode()); \ + dummy.setDescription((const char*)m_Error.getDescription()); \ + m_Error.Reset(); \ + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,ROUTINE); \ + } \ + else if (res==WOULDBLOCK) { \ + _THROW_EXCPT(ComponentErrors::TimeoutExImpl,ROUTINE); \ + } \ + else if (res==DECODE_ERROR) { \ + _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,ROUTINE); \ + } \ + else { \ + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,ROUTINE); \ + } #define DECODE_ERROR -100 @@ -31,23 +30,23 @@ _IRA_LOGFILTER_IMPORT; CCommandLine::CCommandLine(ContainerServices *service): CSocket(), m_services(service) { - AUTO_TRACE("CCommandLine::CCommandLine()"); - m_bTimedout=false; - m_reiniting=false; - ACS::Time init=0; - m_lastUpdate.value(init); - m_Error.Reset(); - m_configuration=NULL; - m_backendStatus=0; - setStatus(NOTCNTD); - m_setTpiIntegration=true; + AUTO_TRACE("CCommandLine::CCommandLine()"); + m_bTimedout=false; + m_reiniting=false; + ACS::Time init=0; + m_lastUpdate.value(init); + m_Error.Reset(); + m_configuration=NULL; + m_backendStatus=0; + setStatus(NOTCNTD); + m_setTpiIntegration=true; m_stationSRT=false; m_stationMED=false; m_sectionsNumber=0; m_inputsNumber=0; m_stokes=false; - m_TsysRange_freq=0.0; - m_TsysRange_bw=0.0; + m_TsysRange_freq=0.0; + m_TsysRange_bw=0.0; m_SKARAB_1=false; m_SKARAB_1S=false; m_SKARAB_2=false; @@ -58,343 +57,404 @@ CCommandLine::CCommandLine(ContainerServices *service): CSocket(), m_SKARAB_4S=false; m_SKARAB_5=false; m_SKARAB_5S=false; + m_SKARAB_7=false; + m_SKARAB_11=false; + m_SKARAB_11S=false; + m_SKARAB_12=false; + m_SKARAB_12S=false; m_SkarabInitialized=false; + + m_kkg77=false; } CCommandLine::~CCommandLine() { - AUTO_TRACE("CCommandLine::~CCommandLine()"); - m_Error.Reset(); - // if the backend is transferring data...make a try to inform the backend before closing the connection - /*if (getIsBusy()) { - WORD len; - char sBuff[SENDBUFFERSIZE]; - len=CProtocol::stopAcquisition(sBuff); // get the buffer - sendBuffer(sBuff,len); - }*/ - Close(m_Error); + AUTO_TRACE("CCommandLine::~CCommandLine()"); + m_Error.Reset(); + // if the backend is transferring data...make a try to inform the backend before closing the connection + /*if (getIsBusy()) { + WORD len; + char sBuff[SENDBUFFERSIZE]; + len=CProtocol::stopAcquisition(sBuff); // get the buffer + sendBuffer(sBuff,len); + }*/ + Close(m_Error); } void CCommandLine::Init(CConfiguration *config) throw (ComponentErrors::SocketErrorExImpl, - ComponentErrors::ValidationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl) + ComponentErrors::ValidationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl) { int res; - //WORD len; - //char sBuff[SENDBUFFERSIZE]; - char rBuff[RECBUFFERSIZE]; - - AUTO_TRACE("CCommandLine::Init()"); - m_configuration=config; - /*if (!initializeConfiguration(m_configuration->getConfiguration())) { // throw (ComponentErrors::CDBAccessExImpl) - IRA::CString msg; - _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::Init()"); - msg.Format("the requested configuration %s is not known",(const char *)m_configuration->getConfiguration()); - impl.setReason((const char *)msg); - throw impl; - }*/ - // this will create the socket in blocking mode..... - if (Create(m_Error,STREAM)==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::Init()"); - } - // the first time, perform a blocking connection.... - if (Connect(m_Error,m_configuration->getAddress(),m_configuration->getPort())==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::Init()"); - } - else { - setStatus(CNTD); - } - // set socket send buffer!!!! - int Val=SENDBUFFERSIZE; - if (setSockOption(m_Error,SO_SNDBUF,&Val,sizeof(int))==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::Init()"); - } - // set socket in non-blocking mode. - if (setSockMode(m_Error,NONBLOCKING)==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::Init()"); - } + //WORD len; + //char sBuff[SENDBUFFERSIZE]; + char rBuff[RECBUFFERSIZE]; + + AUTO_TRACE("CCommandLine::Init()"); + m_configuration=config; + /*if (!initializeConfiguration(m_configuration->getConfiguration())) { // throw (ComponentErrors::CDBAccessExImpl) + IRA::CString msg; + _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::Init()"); + msg.Format("the requested configuration %s is not known",(const char *)m_configuration->getConfiguration()); + impl.setReason((const char *)msg); + throw impl; + }*/ + // this will create the socket in blocking mode..... + if (Create(m_Error,STREAM)==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::Init()"); + } + // the first time, perform a blocking connection.... + if (Connect(m_Error,m_configuration->getAddress(),m_configuration->getPort())==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::Init()"); + } + else { + setStatus(CNTD); + } + // set socket send buffer!!!! + int Val=SENDBUFFERSIZE; + if (setSockOption(m_Error,SO_SNDBUF,&Val,sizeof(int))==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::Init()"); + } + // set socket in non-blocking mode. + if (setSockMode(m_Error,NONBLOCKING)==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::Init()"); + } /* After the first connection, the server send the protocol version string */ res=receiveBuffer(rBuff,RECBUFFERSIZE); - //printf("connect = %s\n", rBuff); m_totalPower = Backends::TotalPower::_nil(); - try { - m_totalPower = m_services->getComponent<Backends::TotalPower>("BACKENDS/TotalPower"); - } - catch (maciErrType::CannotGetComponentExImpl& ex) { - _ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl,Impl,ex,"CCommadLine::Init()"); - Impl.setComponentName("BACKENDS/TotalPower"); - throw Impl; - } - + try { + m_totalPower = m_services->getComponent<Backends::TotalPower>("BACKENDS/TotalPower"); + } + catch (maciErrType::CannotGetComponentExImpl& ex) { + _ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl,Impl,ex,"CCommadLine::Init()"); + Impl.setComponentName("BACKENDS/TotalPower"); + throw Impl; + } + m_receiversBoss = Receivers::ReceiversBoss::_nil(); + try { + m_receiversBoss = m_services->getComponent<Receivers::ReceiversBoss>("RECEIVERS/Boss"); + } + catch (maciErrType::CannotGetComponentExImpl& ex) { + _ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl,Impl,ex,"CCommadLine::Init()"); + Impl.setComponentName("RECEIVERS/Boss"); + throw Impl; + } /*m_ifDistributor = Receivers::GenericIFDistributor::_nil(); try { - m_ifDistributor = m_services->getComponent<Receivers::GenericIFDistributor>("RECEIVERS/SRTIFDistributor"); - } - catch (maciErrType::CannotGetComponentExImpl& ex) { - _ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl,Impl,ex,"CCommadLine::Init()"); - Impl.setComponentName("RECEIVERS/SRTIFDistributor"); - throw Impl; - }*/ + m_ifDistributor = m_services->getComponent<Receivers::GenericIFDistributor>("RECEIVERS/SRTIFDistributor"); + } + catch (maciErrType::CannotGetComponentExImpl& ex) { + _ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl,Impl,ex,"CCommadLine::Init()"); + Impl.setComponentName("RECEIVERS/SRTIFDistributor"); + throw Impl; + }*/ char *Station; IRA::CString cStation; Station = getenv ("STATION"); cStation = IRA::CString (Station); - if((cStation.Compare("SRT")==0)) + if((cStation.Compare("SRT")==0)) { m_stationSRT = true; - if((cStation.Compare("Medicina")==0)) + strcpy (superVisorName, GAVINO); + } + if((cStation.Compare("Medicina")==0)) { m_stationMED = true; + strcpy (superVisorName, PALMIRO); + } + m_Scheduler = Management::Scheduler::_nil (); + try { + m_Scheduler = m_services->getComponent < Management::Scheduler > (superVisorName); + } + catch (maciErrType::CannotGetComponentExImpl & ex) + { + _ADD_BACKTRACE (ComponentErrors::CouldntGetComponentExImpl, Impl, ex, "CommandLine::Init()"); + Impl.setComponentName (superVisorName); + throw Impl; + } +} - /*try { - setup (m_configuration->getConfiguration()); +void CCommandLine::stopDataAcquisition() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl) +{ + AUTO_TRACE("CCommandLine::stopDataAcquisition()"); + /*****************************************************************/ + // since both suspend and stop data acquisition are mapped into Command::stop message to the backend + // It happens (@ the end of a scan) that the backend receives two Command::stop messages. Even if this is not + // an issue for the backend, this leads to an unwanted behviour of the control software. The thrown exception, infact, + // leads to skip the first subscan of the next scan. Temporarly workround if to catch the exception here. A debug messages is sent. + /*****************************************************************/ + try { + Message reply = sendBackendCommand(Command::stop()); } catch (...) { - ACS_LOG(LM_FULL_INFO,"CCommandLine::Init()",(LM_NOTICE,"BACKEND_SKARAB_INITIALIZATION ERROR")); + ACS_LOG(LM_FULL_INFO,"CCommandLine::stopDataAcquisition()",(LM_DEBUG,"backend error while issuing a stop ascquisition")); } + ACS_LOG(LM_FULL_INFO,"CCommandLine::stopDataAcquisition()",(LM_NOTICE,"TRANSFER_JOB_STOPPED")); + clearStatusField(CCommandLine::BUSY); // unsets the component status to busy + clearStatusField(CCommandLine::SUSPEND); // unsets the component status to transfer job suspended...... +} - //Waits a bit so that everything can settle down - IRA::CIRATools::Wait(0,200000);*/ +void CCommandLine::endSchedule() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl) +{ + AUTO_TRACE("CCommandLine::endSchedule()"); + /*****************************************************************/ + // since both suspend and stop data acquisition are mapped into Command::stop message to the backend + // It happens (@ the end of a scan) that the backend receives two Command::stop messages. Even if this is not + // an issue for the backend, this leads to an unwanted behviour of the control software. The thrown exception, infact, + // leads to skip the first subscan of the next scan. Temporarly workround if to catch the exception here. A debug messages is sent. + /*****************************************************************/ + try { + Message reply = sendBackendCommand(Command::endSchedule()); + } + catch (...) { + ACS_LOG(LM_FULL_INFO,"CCommandLine::endSchedule()",(LM_DEBUG,"endSchedule")); + } + ACS_LOG(LM_FULL_INFO,"CCommandLine::endSchedule()",(LM_NOTICE,"endSchedule")); + clearStatusField(CCommandLine::BUSY); // unsets the component status to busy + clearStatusField(CCommandLine::SUSPEND); // unsets the component status to transfer job suspended...... } -void CCommandLine::stopDataAcquisition() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, - ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl) +void CCommandLine::backendPark() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl) { - AUTO_TRACE("CCommandLine::stopDataAcquisition()"); - /*****************************************************************/ - // since both suspend and stop data acquisition are mapped into Command::stop message to the backend - // It happens (@ the end of a scan) that the backend receives two Command::stop messages. Even if this is not - // an issue for the backend, this leads to an unwanted behviour of the control software. The thrown exception, infact, - // leads to skip the first subscan of the next scan. Temporarly workround if to catch the exception here. A debug messages is sent. - /*****************************************************************/ - try { - Message reply = sendBackendCommand(Command::stop()); - } - catch (...) { - ACS_LOG(LM_FULL_INFO,"CCommandLine::stopDataAcquisition()",(LM_DEBUG,"backend error while issuing a stop ascquisition")); - } - ACS_LOG(LM_FULL_INFO,"CCommandLine::stopDataAcquisition()",(LM_NOTICE,"TRANSFER_JOB_STOPPED")); - clearStatusField(CCommandLine::BUSY); // unsets the component status to busy - clearStatusField(CCommandLine::SUSPEND); // unsets the component status to transfer job suspended...... + AUTO_TRACE("CCommandLine::backendPark()"); + try { + Message reply = sendBackendCommand(Command::backendPark()); + } + catch (...) { + ACS_LOG(LM_FULL_INFO,"CCommandLine::backendPark()",(LM_DEBUG,"backendPark")); + } + ACS_LOG(LM_FULL_INFO,"CCommandLine::backendPark()",(LM_NOTICE,"backendPark")); } void CCommandLine::stopDataAcquisitionForced() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, - ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl) + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl) { } void CCommandLine::startDataAcquisition() throw (BackendsErrors::BackendBusyExImpl,BackendsErrors::ConnectionExImpl, - BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl) + BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl) { - AUTO_TRACE("CCommandLine::startDataAcquisition()"); - /* if (getIsBusy()) { - _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::startDataAcquisition()"); - throw impl; - }*/ - //Message reply = sendBackendCommand(Command::start()); - ACS_LOG(LM_FULL_INFO,"CCommandLine::startDataAcquisition()",(LM_NOTICE,"ACQUISTION_STARTED")); - setStatusField(CCommandLine::BUSY); // sets the component status to busy - setStatusField(CCommandLine::SUSPEND); // sets the component status to transfer job suspended...... + AUTO_TRACE("CCommandLine::startDataAcquisition()"); + /* if (getIsBusy()) { + _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::startDataAcquisition()"); + throw impl; + }*/ + //Message reply = sendBackendCommand(Command::start()); + ACS_LOG(LM_FULL_INFO,"CCommandLine::startDataAcquisition()",(LM_NOTICE,"ACQUISTION_STARTED")); + setStatusField(CCommandLine::BUSY); // sets the component status to busy + setStatusField(CCommandLine::SUSPEND); // sets the component status to transfer job suspended...... } ACS::Time CCommandLine::resumeDataAcquisition(const ACS::Time& startT) throw (BackendsErrors::ConnectionExImpl,ComponentErrors::NotAllowedExImpl, - BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::BackendFailExImpl) + BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::BackendFailExImpl) { - TIMEVALUE now; - TIMEVALUE epoch; - long waitSec,waitMicro; - DDWORD diff; - ACS::Time expectedTime; - AUTO_TRACE("CCommandLine::resumeDataAcquisition()"); - /*if ( !(m_backendStatus & (1 << SUSPEND)) || !getIsBusy()) { - _EXCPT(ComponentErrors::NotAllowedExImpl,impl,"CCommandLine::resumeDataAcquisition()"); - impl.setReason("transfer job cannot be resumed in present configuration"); - throw impl; - }*/ - // check that the backend latency in preparing the data transfer is respected...... - if (startT==0) { // immediate start - IRA::CIRATools::getTime(epoch); //...so take the present time - } - else { - epoch.value(startT); - IRA::CIRATools::getTime(now); - if (startT<=now.value().value) { - ACS_LOG(LM_FULL_INFO,"TotalPowerImpl::sendData()",(LM_WARNING,"START_TIME_ALREADY_ELAPSED")); - } - } - diff=IRA::CIRATools::timeDifference(epoch,m_acquisitionStartEpoch); - if (diff<m_configuration->getDataLatency()) { //wait until the latency time is elapsed...... - double waitTime; - waitMicro=m_configuration->getDataLatency()-diff; - waitTime=((double)waitMicro/1000000.0); - waitSec=(long)waitTime; - waitMicro%=1000000; - ACS_LOG(LM_FULL_INFO,"CCommandLine::resumeDataAcquisition()",(LM_WARNING,"BACKEND_LATENCY_NOT_MATCHED,WAITING %3.2lf usec",waitTime)); - IRA::CIRATools::Wait(waitSec,waitMicro); - expectedTime=m_acquisitionStartEpoch.value().value+m_configuration->getDataLatency()*10; - } - else { - expectedTime=epoch.value().value; - } + TIMEVALUE now; + TIMEVALUE epoch; + long waitSec,waitMicro; + DDWORD diff; + ACS::Time expectedTime; + AUTO_TRACE("CCommandLine::resumeDataAcquisition()"); + /*if ( !(m_backendStatus & (1 << SUSPEND)) || !getIsBusy()) { + _EXCPT(ComponentErrors::NotAllowedExImpl,impl,"CCommandLine::resumeDataAcquisition()"); + impl.setReason("transfer job cannot be resumed in present configuration"); + throw impl; + }*/ + // check that the backend latency in preparing the data transfer is respected...... + if (startT==0) { // immediate start + IRA::CIRATools::getTime(epoch); //...so take the present time + } + else { + epoch.value(startT); + IRA::CIRATools::getTime(now); + if (startT<=now.value().value) { + ACS_LOG(LM_FULL_INFO,"TotalPowerImpl::sendData()",(LM_WARNING,"START_TIME_ALREADY_ELAPSED")); + } + } + diff=IRA::CIRATools::timeDifference(epoch,m_acquisitionStartEpoch); + if (diff<m_configuration->getDataLatency()) { //wait until the latency time is elapsed...... + double waitTime; + waitMicro=m_configuration->getDataLatency()-diff; + waitTime=((double)waitMicro/1000000.0); + waitSec=(long)waitTime; + waitMicro%=1000000; + ACS_LOG(LM_FULL_INFO,"CCommandLine::resumeDataAcquisition()",(LM_WARNING,"BACKEND_LATENCY_NOT_MATCHED,WAITING %3.2lf usec",waitTime)); + IRA::CIRATools::Wait(waitSec,waitMicro); + expectedTime=m_acquisitionStartEpoch.value().value+m_configuration->getDataLatency()*10; + } + else { + expectedTime=epoch.value().value; + } Message request = Command::start(); Message reply = sendBackendCommand(request); if(reply.is_success_reply()) { - ACS_LOG(LM_FULL_INFO,"CCommandLine::resumeDataAcquisition()",(LM_NOTICE,"TRANSFER_JOB_RESUMED")); - clearStatusField(SUSPEND); - } - return expectedTime; + ACS_LOG(LM_FULL_INFO,"CCommandLine::resumeDataAcquisition()",(LM_NOTICE,"TRANSFER_JOB_RESUMED")); + clearStatusField(SUSPEND); + } + return expectedTime; } void CCommandLine::suspendDataAcquisition() throw (BackendsErrors::ConnectionExImpl,ComponentErrors::NotAllowedExImpl, - BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::BackendFailExImpl) + BackendsErrors::NakExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::BackendFailExImpl) { - AUTO_TRACE("CCommandLine::suspendDataAcquisition()"); - /*if ((m_backendStatus & (1 << SUSPEND)) || !getIsBusy()) { //not suspended....running - _EXCPT(ComponentErrors::NotAllowedExImpl,impl,"CCommandLine::suspendDataAcquisition()"); - impl.setReason("transfer job cannot be suspended in present configuration"); - throw impl; - }*/ + AUTO_TRACE("CCommandLine::suspendDataAcquisition()"); + /*if ((m_backendStatus & (1 << SUSPEND)) || !getIsBusy()) { //not suspended....running + _EXCPT(ComponentErrors::NotAllowedExImpl,impl,"CCommandLine::suspendDataAcquisition()"); + impl.setReason("transfer job cannot be suspended in present configuration"); + throw impl; + }*/ Message request = Command::stop(); Message reply = sendBackendCommand(request); if(reply.is_success_reply()) { ACS_LOG(LM_FULL_INFO,"CCommandLine::suspendDataAcquisition()",(LM_NOTICE,"TRANSFER_JOB_SUSPENDED")); - setStatusField(SUSPEND); - } + setStatusField(SUSPEND); + } } void CCommandLine::setAttenuation(const long&inputId, const double& attenuation) throw (BackendsErrors::BackendBusyExImpl,ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl,BackendsErrors::NakExImpl, - ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl) + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl) { - AUTO_TRACE("CCommandLine::setAttenuation()"); - double newAtt; - - if ((inputId < 0 ) || (inputId >= MAX_SECTION_NUMBER)) { - /*//if (inputId>=m_sectionsNumber) { - if (inputId>m_inputsNumber) { // TBC !!! - _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setAttenuation()"); - impl.setReason("the input identifier is out of range"); - throw impl; - } - } - else {*/ - _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setAttenuation()"); - impl.setReason("the input identifier is out of range"); - throw impl; - } - if (attenuation>=0) { // // the user ask for a new value - if (attenuation<MIN_ATTENUATION) { - _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setAttenuation()"); - impl.setValueName("attenuation"); - impl.setValueLimit(MIN_ATTENUATION); - throw impl; - } - else if (attenuation>MAX_ATTENUATION) { - _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setAttenuation()"); - impl.setValueName("attenuation"); - impl.setValueLimit(MAX_ATTENUATION); - throw impl; - } - m_attenuation[inputId]=attenuation; + AUTO_TRACE("CCommandLine::setAttenuation()"); + double newAtt; + + if ((inputId < 0 ) || (inputId >= MAX_SECTION_NUMBER)) { + /*//if (inputId>=m_sectionsNumber) { + if (inputId>m_inputsNumber) { // TBC !!! + _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setAttenuation()"); + impl.setReason("the input identifier is out of range"); + throw impl; + } + } + else {*/ + _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setAttenuation()"); + impl.setReason("the input identifier is out of range"); + throw impl; + } + if (attenuation>=0) { // // the user ask for a new value + if (attenuation<MIN_ATTENUATION) { + _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setAttenuation()"); + impl.setValueName("attenuation"); + impl.setValueLimit(MIN_ATTENUATION); + throw impl; + } + else if (attenuation>MAX_ATTENUATION) { + _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setAttenuation()"); + impl.setValueName("attenuation"); + impl.setValueLimit(MAX_ATTENUATION); + throw impl; + } + m_attenuation[inputId]=attenuation; try { m_totalPower->setAttenuation(inputId, attenuation); ACS_LOG(LM_FULL_INFO,"CCommandLine::setAttenuation()",(LM_NOTICE,"TOTALPOWER_ATTENUATION INPUT=%ld,ATTENUATION=%lf",inputId,attenuation)); } catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"CCommandLine::setAttenuation()"); - impl.log(LM_ERROR); - } - } - else { - newAtt=m_attenuation[inputId]; - } + _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"CCommandLine::setAttenuation()"); + impl.log(LM_ERROR); + } + } + else { + newAtt=m_attenuation[inputId]; + } } -void CCommandLine::setTsysRange(const double& freq, const double& bw) throw (BackendsErrors::BackendBusyExImpl,ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl,BackendsErrors::NakExImpl, - ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl) +void CCommandLine::setTsysRange(const double& freq, const double& bw) throw (BackendsErrors::BackendBusyExImpl,ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl) { - AUTO_TRACE("CCommandLine::setTsysRange()"); - m_TsysRange_freq = freq; - m_TsysRange_bw = bw; - ACS_LOG(LM_FULL_INFO,"CCommandLine::setTsysRange()",(LM_NOTICE,"TSYS RANGE FREQUENCY = %lf, BANDWIDTH = %lf",m_TsysRange_freq,m_TsysRange_bw)); + AUTO_TRACE("CCommandLine::setTsysRange()"); + m_TsysRange_freq = freq; + m_TsysRange_bw = bw; + ACS_LOG(LM_FULL_INFO,"CCommandLine::setTsysRange()",(LM_NOTICE,"TSYS RANGE FREQUENCY = %lf, BANDWIDTH = %lf",m_TsysRange_freq,m_TsysRange_bw)); } void CCommandLine::setConfiguration(const long& inputId,const double& freq,const double& bw,const long& feed,const long& pol, const double& sr,const long& bins) throw ( - ComponentErrors::ValidationErrorExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, - ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::ValueOutofRangeExImpl, - BackendsErrors::BackendBusyExImpl) + ComponentErrors::ValidationErrorExImpl,BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::ValueOutofRangeExImpl, + BackendsErrors::BackendBusyExImpl) { - AUTO_TRACE("CCommandLine::setConfiguration()"); - double newBW,newSR,newFreq; + AUTO_TRACE("CCommandLine::setConfiguration()"); + double newBW,newSR,newFreq; long newBins, newFeed, newPol; double filter; - -/* if (getIsBusy()) { - _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setConfiguration()"); - throw impl; - }*/ - if (inputId>=0) { //check the section id is in valid ranges - //if (inputId>=m_sectionsNumber) { - if (inputId>m_sectionsNumber) { - _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setConfiguration()"); - impl.setReason("the section identifier is out of range"); - throw impl; - } - } - else { - _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setConfiguration()"); - impl.setReason("the section identifier is out of range"); - throw impl; - } - if (bw>=0) { // the user ask for a new value - if (bw<MIN_BAND_WIDTH) { - _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); - impl.setValueName("bandWidth"); - impl.setValueLimit(MIN_BAND_WIDTH); - throw impl; - } - else if (bw>MAX_BAND_WIDTH) { - _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); - impl.setValueName("bandWidth"); - impl.setValueLimit(MAX_BAND_WIDTH); - throw impl; - } - newBW=bw; - } - else { // else keep the present value - newBW=m_bandWidth[inputId]; - } - if (sr>=0) {// the user ask for a new value - if ((sr > MAX_SAMPLE_RATE) || (sr != 2*newBW)) { - _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); - impl.setValueName("sampleRate"); - impl.setValueLimit(MAX_SAMPLE_RATE); - throw impl; - } - newSR=sr; - } - else { - newSR=m_sampleRate[inputId]; - } + double ddcoffset; + ACS::doubleSeq_var lo_var; + ACS::ROdoubleSeq_var loRef; + ACS::doubleSeq lo; + ACS::ROlong_var IFNumberRO; + long IFNumber; + ACSErr::Completion_var completion; + + if (m_SkarabInitialized == true) { + +/* if (getIsBusy()) { + _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setConfiguration()"); + throw impl; + }*/ + if (inputId>=0) { //check the section id is in valid ranges + //if (inputId>=m_sectionsNumber) { + if (inputId>m_sectionsNumber) { + _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setConfiguration()"); + impl.setReason("the section identifier is out of range"); + throw impl; + } + } + else { + _EXCPT(ComponentErrors::ValidationErrorExImpl,impl,"CCommandLine::setConfiguration()"); + impl.setReason("the section identifier is out of range"); + throw impl; + } + if (bw>=0) { // the user ask for a new value + if (bw<MIN_BAND_WIDTH) { + _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); + impl.setValueName("bandWidth"); + impl.setValueLimit(MIN_BAND_WIDTH); + throw impl; + } + else if (bw>MAX_BAND_WIDTH) { + _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); + impl.setValueName("bandWidth"); + impl.setValueLimit(MAX_BAND_WIDTH); + throw impl; + } + newBW=bw; + } + else { // else keep the present value + newBW=m_bandWidth[inputId]; + } + if (sr>=0) {// the user ask for a new value + if ((sr > MAX_SAMPLE_RATE) || (sr != 2*newBW)) { + _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); + impl.setValueName("sampleRate"); + impl.setValueLimit(MAX_SAMPLE_RATE); + throw impl; + } + newSR=sr; + } + else { + newSR=m_sampleRate[inputId]; + } if (freq >= 0) { // the user ask for a new value if (freq >= MIN_FREQUENCY && freq <= MAX_FREQUENCY) { @@ -402,8 +462,8 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const } else { _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); - impl.setValueName("freq"); - throw impl; + impl.setValueName("freq"); + throw impl; } } else @@ -412,55 +472,55 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const if (feed >= 0) { // the user ask for a new value if (feed != 0) { // BUT for the moment is it possible to use ONLY feed 0 _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); - impl.setValueName("feed"); - throw impl; + impl.setValueName("feed"); + throw impl; } newFeed = feed; } else newFeed = m_feedNumber[inputId]; - - if (pol >= 0) { // the user ask for a new value - if ((pol == 0) || (pol == 1)) { // LCP or RCP - newPol = pol; - } - if (pol == 2) { // FULL STOKES - newPol = pol; - } - if (pol >= 3) { - _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); - impl.setValueName("pol"); - throw impl; - } + + if (pol >= 0) { // the user ask for a new value + if ((pol == 0) || (pol == 1)) { // LCP or RCP + newPol = pol; + } + if (pol == 2) { // FULL STOKES + newPol = pol; + } + if (pol >= 3) { + _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); + impl.setValueName("pol"); + throw impl; + } newPol = pol; - } - else - newPol = m_polarization[inputId]; + } + else + newPol = m_polarization[inputId]; if (bins>=0) { // the user ask for a new value if (bins < MIN_BINS || bins > MAX_BINS) { - _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); - impl.setValueName("bins"); + _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setConfiguration()"); + impl.setValueName("bins"); /*if (bins != MIN_BINS) - impl.setValue(MIN_BINS); + impl.setValue(MIN_BINS); if (bins != MAX_BINS) - impl.setValue(MAX_BINS);*/ - throw impl; + impl.setValue(MAX_BINS);*/ + throw impl; } newBins=bins; - } + } else newBins = m_bins[inputId]; if (m_stationSRT == true) { - try { + try { Message request = Command::setSection(inputId, newFreq, newBW, newFeed, newPol, newSR, newBins); Message reply = sendBackendCommand(request); if (reply.is_success_reply()) { - for (int j=0;j<m_sectionsNumber;j++) + for (int j=0;j<m_sectionsNumber;j++) m_sampleRate[j]=newSR; //the given sample rate is taken also for all the others - m_commonSampleRate=newSR; + m_commonSampleRate=newSR; if (m_stokes==true) { m_frequency[2*inputId]=newFreq; m_frequency[2*inputId+1]=newFreq; @@ -473,180 +533,30 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const } m_feedNumber[inputId]=newFeed; m_bins[inputId]=newBins; - m_polarization[inputId]=newPol; - IRA::CString temp; - if (m_polarization[inputId]==Backends::BKND_LCP) - temp="LCP"; + m_polarization[inputId]=newPol; + IRA::CString temp; + if (m_polarization[inputId]==Backends::BKND_LCP) + temp="LCP"; else if (m_polarization[inputId]==Backends::BKND_RCP) - temp="RCP"; + temp="RCP"; else - temp="FULL_STOKES"; - ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"SECTION_CONFIGURED %ld,FREQ=%lf,BW=%lf,FEED=%ld,POL=%s,SR=%lf,BINS=%ld",inputId,m_frequency[inputId],newBW,m_feedNumber[inputId], - (const char *)temp,newSR,m_bins[inputId])); - /*if (m_SK00==true || m_SC00==true || m_SK00S==true || m_SC00S==true || m_SK77==true || m_SK77S==true || m_SK03==true || m_SK03S==true || m_SK06==true || m_SK06S==true || m_SK01==true || m_SK01S==true - || m_SK02==true || m_SK02S==true || m_SK04==true || m_SK04S==true || m_SK05==true || m_SK05S==true) { - if (newBW==420.00) - filter=300.00; - if (newBW==1500.00) - filter=1250.00; - if (newBW==2300.00) - filter=2350.00; - if (newBW == 420.00 || newBW == 1500.00 || newBW == 2300.00) { - if (m_SK00S==true || m_SC00S==true || m_SK77S==true) { - m_totalPower->setSection(2*inputId,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(2*inputId+1,-1, filter, -1, -1, -1, -1); - } - else if (m_SK01S==true) { - if (inputId == 0) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+1,-1, filter, -1, -1, -1, -1); - } - if (inputId == 1) { - m_totalPower->setSection(inputId+1,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+2,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK02S==true) { - if (inputId == 0) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+1,-1, filter, -1, -1, -1, -1); - } - if (inputId == 1) { - m_totalPower->setSection(inputId+3,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+4,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK03S==true) { - if (inputId == 0) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+1,-1, filter, -1, -1, -1, -1); - } - if (inputId == 1) { - m_totalPower->setSection(inputId+5,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+6,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK04S==true) { - if (inputId == 0) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+1,-1, filter, -1, -1, -1, -1); - } - if (inputId == 1) { - m_totalPower->setSection(inputId+7,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+8,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK05S==true) { - if (inputId == 0) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+1,-1, filter, -1, -1, -1, -1); - } - if (inputId == 1) { - m_totalPower->setSection(inputId+9,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+10,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK06S==true) { - if (inputId == 0) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+1,-1, filter, -1, -1, -1, -1); - } - if (inputId == 1) { - m_totalPower->setSection(inputId+11,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+12,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK01==true) { - if (inputId == 0 || inputId == 1) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - if (inputId == 2 || inputId == 3) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK02==true) { - if (inputId == 0 || inputId == 1) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - if (inputId == 2 || inputId == 3) { - m_totalPower->setSection(inputId+2,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK03==true) { - if (inputId == 0 || inputId == 1) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - if (inputId == 2 || inputId == 3) { - m_totalPower->setSection(inputId+4,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK04==true) { - if (inputId == 0 || inputId == 1) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - if (inputId == 2 || inputId == 3) { - m_totalPower->setSection(inputId+6,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK01==true) { - if (inputId == 0 || inputId == 1) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - if (inputId == 2 || inputId == 3) { - m_totalPower->setSection(inputId+8,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK06==true) { - if (inputId == 0 || inputId == 1) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - if (inputId == 2 || inputId == 3) { - m_totalPower->setSection(inputId+10,-1, filter, -1, -1, -1, -1); - } - } - else - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"TOTALPOWER_FILTER_CONFIGURED %ld,FILTER=%lf",inputId,filter)); - }*/ - /*if ((m_SL00==true || m_SL00S==true) && m_stationSRT == true) { - try { - if (newBW==128.00) { - m_ifDistributor->setup("BW-NARROW"); - ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"IFDISTRIBUTOR_FILTER_BW-NARROW")); - } - if (newBW==420.00) { - m_ifDistributor->setup("BW-MEDIUM"); - ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"IFDISTRIBUTOR_FILTER_BW-MEDIUM")); - } - if (newBW==500.00) { - m_ifDistributor->setup("BW-WIDE"); - ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"IFDISTRIBUTOR_FILTER_BW-WIDE")); - } - if (newBW==512.00) { - m_ifDistributor->setup("BW-UNFILTERED"); - ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"IFDISTRIBUTOR_FILTER_BW-UNFILTERED")); - } - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"CCommandLine::setAttenuation()"); - impl.log(LM_ERROR); - } - }*/ + temp="FULL_STOKES"; + ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"SECTION_CONFIGURED %ld,FREQ=%lf,BW=%lf,FEED=%ld,POL=%s,SR=%lf,BINS=%ld",inputId,m_frequency[inputId],newBW,m_feedNumber[inputId], + (const char *)temp,newSR,m_bins[inputId])); } - } + } catch (...) { - ACS_LOG(LM_FULL_INFO,"CCommandLine::setSection()",(LM_NOTICE,"BACKEND_SKARAB_SET_SECTION ERROR")); + ACS_LOG(LM_FULL_INFO,"CCommandLine::setSection()",(LM_NOTICE,"BACKEND_SKARAB_SET_SECTION ERROR")); } } if (m_stationMED == true) { - try { + try { Message request = Command::setSection(inputId, newFreq, newBW, newFeed, newPol, newSR, newBins); Message reply = sendBackendCommand(request); if (reply.is_success_reply()) { - for (int j=0;j<m_sectionsNumber;j++) + for (int j=0;j<m_sectionsNumber;j++) m_sampleRate[j]=newSR; //the given sample rate is taken also for all the others - m_commonSampleRate=newSR; + m_commonSampleRate=newSR; if (m_stokes==true) { m_frequency[2*inputId]=newFreq; m_frequency[2*inputId+1]=newFreq; @@ -659,492 +569,269 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const } m_feedNumber[inputId]=newFeed; m_bins[inputId]=newBins; - m_polarization[inputId]=newPol; - IRA::CString temp; - if (m_polarization[inputId]==Backends::BKND_LCP) - temp="LCP"; + m_polarization[inputId]=newPol; + IRA::CString temp; + if (m_polarization[inputId]==Backends::BKND_LCP) + temp="LCP"; else if (m_polarization[inputId]==Backends::BKND_RCP) - temp="RCP"; + temp="RCP"; else - temp="FULL_STOKES"; - ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"SECTION_CONFIGURED %ld,FREQ=%lf,BW=%lf,FEED=%ld,POL=%s,SR=%lf,BINS=%ld",inputId,m_frequency[inputId],newBW,m_feedNumber[inputId], - (const char *)temp,newSR,m_bins[inputId])); - /*if (m_SK00==true || m_SCC00==true || m_SK00S==true || m_SCC00S==true || m_SK01==true || m_SK01S==true || m_SCH00==true || m_SCH00S==true) { - if (newBW==420.00) - filter=300.00; - if (newBW==1500.00) - filter=1250.00; - if (newBW==2300.00) - filter=2350.00; - if (newBW == 420.00 || newBW == 1500.00 || newBW == 2300.00) { - if (m_SK00S==true || m_SCC00S==true || m_SCH00S==true) { - m_totalPower->setSection(2*inputId,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(2*inputId+1,-1, filter, -1, -1, -1, -1); - } - else if (m_SK01S==true) { - if (inputId == 0) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+1,-1, filter, -1, -1, -1, -1); - } - if (inputId == 1) { - m_totalPower->setSection(inputId+1,-1, filter, -1, -1, -1, -1); - m_totalPower->setSection(inputId+2,-1, filter, -1, -1, -1, -1); - } - } - else if (m_SK01==true) { - if (inputId == 0 || inputId == 1) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - if (inputId == 2 || inputId == 3) { - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - } - else - m_totalPower->setSection(inputId,-1, filter, -1, -1, -1, -1); - } - ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"TOTALPOWER_FILTER_CONFIGURED %ld,FILTER=%lf",inputId,filter)); - }*/ + temp="FULL_STOKES"; + ACS_LOG(LM_FULL_INFO,"CCommandLine::setConfiguration()",(LM_NOTICE,"SECTION_CONFIGURED %ld,FREQ=%lf,BW=%lf,FEED=%ld,POL=%s,SR=%lf,BINS=%ld",inputId,m_frequency[inputId],newBW,m_feedNumber[inputId], + (const char *)temp,newSR,m_bins[inputId])); } - } + } catch (...) { - ACS_LOG(LM_FULL_INFO,"CCommandLine::setSection()",(LM_NOTICE,"BACKEND_SKARAB_SET_SECTION ERROR")); + ACS_LOG(LM_FULL_INFO,"CCommandLine::setSection()",(LM_NOTICE,"BACKEND_SKARAB_SET_SECTION ERROR")); } } + //get DDC offset + /* try { + Message reply = sendBackendCommand(Command::getDDCoffset()); + if(reply.is_success_reply()) { + ddcoffset=(double)reply.get_argument<double>(0); + ACS_LOG(LM_FULL_INFO,"CCommandLine::setSection()",(LM_NOTICE,"DDC OFFSET = %f", ddcoffset)); + } + } + catch (...) { + ACS_LOG(LM_FULL_INFO,"CCommandLine::setSection()",(LM_NOTICE,"BACKEND_SKARAB_GET-DDC-OFFSET ERROR")); + } + if (ddcoffset != 0.0) { + loRef = m_receiversBoss->LO (); + lo_var = loRef->get_sync (completion.out ()); + IFNumberRO=m_receiversBoss->IFs(); + IFNumber=IFNumberRO->get_sync(completion.out()); // number of output IFs of the receiver + lo.length(IFNumber); + for (int j=0; j<IFNumber; j++) { + lo[j] = lo_var[j] + ddcoffset; + } + BYTE inBuffer[256]; + sprintf(inBuffer,"setLO=%f\n",lo[0]); + bool ans = false; + char *ret_val; + IRA::CString out; + try { + ans = m_Scheduler->command ((const char *) inBuffer, ret_val); + out = IRA::CString (ret_val); + } + catch (CORBA::SystemException & ex) + { + _EXCPT (ComponentErrors::CORBAProblemExImpl, impl,"CExternalClientsSocketServer::cmdToScheduler()"); + impl.setName (ex._name ()); + impl.setMinor (ex.minor ()); + impl.log (LM_ERROR); + ret_val = "CORBA Error"; + out = IRA::CString (ret_val); + } + catch (...) + { + _EXCPT (ComponentErrors::UnexpectedExImpl, impl,"CExternalClientsSocketServer::cmdToScheduler()"); + impl.log (LM_ERROR); + ret_val = "Unexpected Error"; + out = IRA::CString (ret_val); + } + } */ + } } void CCommandLine::getZeroTPI(DWORD *tpi) throw (ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, - ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,BackendsErrors::MalformedAnswerExImpl, - BackendsErrors::BackendBusyExImpl) + ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,BackendsErrors::MalformedAnswerExImpl, + BackendsErrors::BackendBusyExImpl) { - /*AUTO_TRACE("CCommandLine::getZeroTPI()"); - int res; - WORD len; - char sBuff[SENDBUFFERSIZE]; - char rBuff[RECBUFFERSIZE]; - long integration; - bool busy=getIsBusy(); - long waitTime=0; - if (busy) { - _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::getZeroTPI()"); - throw impl; - } - if (!checkConnection()) { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::getZeroTPI()"); - } - integration=(long)round(1.0/ (m_commonSampleRate*1000.0)); - //res=getConfiguration(); // refresh the m_currentSampleRate.......... - if (res>0) { // load OK - // do nothing - } - _CHECK_ERRORS("CommandLine::getZeroTPI()"); - //if the requested integration is not equal to the current sample rate (given is milliseconds as a sample period) - // or the integration time must be forced...and the backend is not busy. Then set the correct sample rate.... - if ((integration!=m_currentSampleRate) || (m_setTpiIntegration)) { - len=CProtocol::setIntegrationTime(sBuff,integration); // get the buffer - if ((res=sendBuffer(sBuff,len))==SUCCESS) { - res=receiveBuffer(rBuff,RECBUFFERSIZE); - } - if (res>0) { // operation was ok. - if (!CProtocol::isAck(rBuff)) { - _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::getZeroTPI()"); - } - } - else if (res==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::getZeroTPI()"); - } - else if (res==WOULDBLOCK) { - _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::getZeroTPI()"); - } - else { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::getZeroTPI()"); - } - m_setTpiIntegration=false; - waitTime=1000000+integration*2000; // //wait time in microseconds...we should wait 2 seconds plus twice the integration time (which is given in milliseconds). - } - // connect the backend to the 50ohm - len=CProtocol::setZeroInput(sBuff,true); // get the buffer - if ((res=sendBuffer(sBuff,len))==SUCCESS) { - res=receiveBuffer(rBuff,RECBUFFERSIZE); - } - if (res>0) { // operation was ok. - if (!CProtocol::isAck(rBuff)) { - _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::getZeroTPI()"); - } - } - else if (res==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::getZeroTPI()"); - } - else if (res==WOULDBLOCK) { - _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::getZeroTPI()"); - } - else { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::getZeroTPI()"); - } - waitTime+=integration*2000; - if (waitTime>0) IRA::CIRATools::Wait(waitTime); - // now read the total power - len=CProtocol::getSample(sBuff); // get the buffer - if ((res=sendBuffer(sBuff,len))==SUCCESS) { - res=receiveBuffer(rBuff,RECBUFFERSIZE); - } - if (res>0) { // operation was ok. - if (!CProtocol::decodeData(rBuff,tpi,m_configuration->getBoardsNumber(),m_sectionsNumber,m_boards)) { - _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"CCommandLine::getZeroTPI()"); - } - for (int j=0;j<m_sectionsNumber;j++) { - m_tpiZero[j]=(double)tpi[j]/(double)integration; - } - } - else if (res==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::getZeroTPI()"); - } - else if (res==WOULDBLOCK) { - _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::getZeroTPI()"); - } - else { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::getZeroTPI()"); - } - // now return to the default attenuation level - len=CProtocol::setZeroInput(sBuff,false); // get the buffer - if ((res=sendBuffer(sBuff,len))==SUCCESS) { - res=receiveBuffer(rBuff,RECBUFFERSIZE); - } - if (res>0) { // operation was ok. - if (!CProtocol::isAck(rBuff)) { - _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::getZeroTPI()"); - } - } - else if (res==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::getZeroTPI()"); - } - else if (res==WOULDBLOCK) { - _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::getZeroTPI()"); - } - else { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::getZeroTPI()"); - }*/ + /*AUTO_TRACE("CCommandLine::getZeroTPI()"); + int res; + WORD len; + char sBuff[SENDBUFFERSIZE]; + char rBuff[RECBUFFERSIZE]; + long integration; + bool busy=getIsBusy(); + long waitTime=0; + if (busy) { + _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::getZeroTPI()"); + throw impl; + } + if (!checkConnection()) { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::getZeroTPI()"); + } + integration=(long)round(1.0/ (m_commonSampleRate*1000.0)); + //res=getConfiguration(); // refresh the m_currentSampleRate.......... + if (res>0) { // load OK + // do nothing + } + _CHECK_ERRORS("CommandLine::getZeroTPI()"); + //if the requested integration is not equal to the current sample rate (given is milliseconds as a sample period) + // or the integration time must be forced...and the backend is not busy. Then set the correct sample rate.... + if ((integration!=m_currentSampleRate) || (m_setTpiIntegration)) { + len=CProtocol::setIntegrationTime(sBuff,integration); // get the buffer + if ((res=sendBuffer(sBuff,len))==SUCCESS) { + res=receiveBuffer(rBuff,RECBUFFERSIZE); + } + if (res>0) { // operation was ok. + if (!CProtocol::isAck(rBuff)) { + _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::getZeroTPI()"); + } + } + else if (res==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::getZeroTPI()"); + } + else if (res==WOULDBLOCK) { + _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::getZeroTPI()"); + } + else { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::getZeroTPI()"); + } + m_setTpiIntegration=false; + waitTime=1000000+integration*2000; // //wait time in microseconds...we should wait 2 seconds plus twice the integration time (which is given in milliseconds). + } + // connect the backend to the 50ohm + len=CProtocol::setZeroInput(sBuff,true); // get the buffer + if ((res=sendBuffer(sBuff,len))==SUCCESS) { + res=receiveBuffer(rBuff,RECBUFFERSIZE); + } + if (res>0) { // operation was ok. + if (!CProtocol::isAck(rBuff)) { + _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::getZeroTPI()"); + } + } + else if (res==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::getZeroTPI()"); + } + else if (res==WOULDBLOCK) { + _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::getZeroTPI()"); + } + else { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::getZeroTPI()"); + } + waitTime+=integration*2000; + if (waitTime>0) IRA::CIRATools::Wait(waitTime); + // now read the total power + len=CProtocol::getSample(sBuff); // get the buffer + if ((res=sendBuffer(sBuff,len))==SUCCESS) { + res=receiveBuffer(rBuff,RECBUFFERSIZE); + } + if (res>0) { // operation was ok. + if (!CProtocol::decodeData(rBuff,tpi,m_configuration->getBoardsNumber(),m_sectionsNumber,m_boards)) { + _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"CCommandLine::getZeroTPI()"); + } + for (int j=0;j<m_sectionsNumber;j++) { + m_tpiZero[j]=(double)tpi[j]/(double)integration; + } + } + else if (res==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::getZeroTPI()"); + } + else if (res==WOULDBLOCK) { + _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::getZeroTPI()"); + } + else { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::getZeroTPI()"); + } + // now return to the default attenuation level + len=CProtocol::setZeroInput(sBuff,false); // get the buffer + if ((res=sendBuffer(sBuff,len))==SUCCESS) { + res=receiveBuffer(rBuff,RECBUFFERSIZE); + } + if (res>0) { // operation was ok. + if (!CProtocol::isAck(rBuff)) { + _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::getZeroTPI()"); + } + } + else if (res==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::getZeroTPI()"); + } + else if (res==WOULDBLOCK) { + _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::getZeroTPI()"); + } + else { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::getZeroTPI()"); + }*/ } void CCommandLine::getTpi(ACS::doubleSeq& tpi) throw (ComponentErrors::TimeoutExImpl, - BackendsErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl, - BackendsErrors::MalformedAnswerExImpl,BackendsErrors::BackendBusyExImpl) + BackendsErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl, + BackendsErrors::MalformedAnswerExImpl,BackendsErrors::BackendBusyExImpl) { - getSample(tpi,false); + getSample(tpi,false); } void CCommandLine::getZero(ACS::doubleSeq& tpi) throw (ComponentErrors::TimeoutExImpl, - BackendsErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl, - BackendsErrors::MalformedAnswerExImpl,BackendsErrors::BackendBusyExImpl) + BackendsErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl, + BackendsErrors::MalformedAnswerExImpl,BackendsErrors::BackendBusyExImpl) { - getSample(tpi,true); + getSample(tpi,true); } void CCommandLine::getSample(ACS::doubleSeq& tpi,bool zero) throw (ComponentErrors::TimeoutExImpl, - BackendsErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl, - BackendsErrors::MalformedAnswerExImpl,BackendsErrors::BackendBusyExImpl) + BackendsErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl, + BackendsErrors::MalformedAnswerExImpl,BackendsErrors::BackendBusyExImpl) { - AUTO_TRACE("CCommandLine::getSample()"); + AUTO_TRACE("CCommandLine::getSample()"); try { - Message reply = sendBackendCommand(Command::getTpi()); + Message reply = sendBackendCommand(Command::getTpi(m_TsysRange_freq,m_TsysRange_bw)); if(reply.is_success_reply()){ - tpi.length(m_inputsNumber/*m_sectionsNumber*/); - for (int j=0;j<m_inputsNumber/*m_sectionsNumber*/;j++) { - tpi[j]=(double)reply.get_argument<double>(j); - //if (zero) m_tpiZero[j]=tpi[j]/(double)m_integration; // in case of tpiZero we store it...... - if (zero) + tpi.length(m_inputsNumber/*m_sectionsNumber*/); + for (int j=0;j<m_inputsNumber/*m_sectionsNumber*/;j++) { + tpi[j]=(double)reply.get_argument<double>(j); + //if (zero) m_tpiZero[j]=tpi[j]/(double)m_integration; // in case of tpiZero we store it...... + if (zero) m_tpiZero[j]=tpi[j]=0.0; // in case of tpiZero we store it...... - } - } + } + } } catch (...) { ACS_LOG(LM_FULL_INFO,"CCommandLine::getTpi()",(LM_NOTICE,"BACKEND_SKARAB_GET-TPI ERROR")); - } + } } void CCommandLine::getRms(ACS::doubleSeq& rms) throw (ComponentErrors::TimeoutExImpl, - BackendsErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl, - BackendsErrors::MalformedAnswerExImpl,BackendsErrors::BackendBusyExImpl) + BackendsErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl, + BackendsErrors::MalformedAnswerExImpl,BackendsErrors::BackendBusyExImpl) { - AUTO_TRACE("CCommandLine::getRms()"); + AUTO_TRACE("CCommandLine::getRms()"); try { Message reply = sendBackendCommand(Command::getRms()); if(reply.is_success_reply()){ - rms.length(m_inputsNumber/*m_sectionsNumber*/); - for (int j=0;j<m_inputsNumber/*m_sectionsNumber*/;j++) { - rms[j]=(double)reply.get_argument<double>(j); - } - } + rms.length(m_inputsNumber/*m_sectionsNumber*/); + for (int j=0;j<m_inputsNumber/*m_sectionsNumber*/;j++) { + rms[j]=(double)reply.get_argument<double>(j); + } + } } catch (...) { ACS_LOG(LM_FULL_INFO,"CCommandLine::getRms()",(LM_NOTICE,"BACKEND_SKARAB_GET-RMS ERROR")); - } + } } void CCommandLine::setDefaultConfiguration(const IRA::CString & config) throw (ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, - ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ReplyNotValidExImpl,BackendsErrors::BackendFailExImpl) + ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ReplyNotValidExImpl,BackendsErrors::BackendFailExImpl) { - AUTO_TRACE("CCommandLine::setDefaultConfiguration()"); - //if (m_stationSRT==true) { - if (config.Compare("SKARAB_1")==0 || config.Compare("SKARAB_2")==0 || config.Compare("SKARAB_3")==0 || config.Compare("SKARAB_4")==0 || config.Compare("SKARAB_5")==0) { - //m_filter=1250.0; + AUTO_TRACE("CCommandLine::setDefaultConfiguration()"); + if (config.Compare("SKARAB_1")==0 || config.Compare("SKARAB_2")==0 || config.Compare("SKARAB_3")==0 || config.Compare("SKARAB_4")==0 || config.Compare("SKARAB_5")==0 || config.Compare("SKARAB_7")==0 + || config.Compare("SKARAB_11")==0 || config.Compare("SKARAB_12")==0 ) { m_inputsNumber=m_sectionsNumber; - //m_SK77=true; - //m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SK00S=m_SC00S=m_SL00S=m_SP00S=false; } - if (config.Compare("SKARAB_1S")==0 || config.Compare("SKARAB_2S")==0 || config.Compare("SKARAB_3S")==0 || config.Compare("SKARAB_4S")==0 || config.Compare("SKARAB_5S")==0) { - //m_filter=1250.0; + if (config.Compare("SKARAB_1S")==0 || config.Compare("SKARAB_2S")==0 || config.Compare("SKARAB_3S")==0 || config.Compare("SKARAB_4S")==0 || config.Compare("SKARAB_5S")==0 + || config.Compare("SKARAB_11S")==0 || config.Compare("SKARAB_12S")==0 ) { m_inputsNumber=m_sectionsNumber; m_sectionsNumber=m_sectionsNumber/2; m_stokes=true; - //m_SK77=true; - //m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SK00S=m_SC00S=m_SL00S=m_SP00S=false;// - } - /*if (config.Compare("SK00")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SK00=true; - m_SK77=m_SK03=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK03S=m_SK06S=m_SK00S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK01")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SK01=true; - m_SK77=m_SK00=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK02")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SK02=true; - m_SK77=m_SK00=m_SK01=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK03")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SK03=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK04")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SK04=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK05")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SK05=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK06")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SK06=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SC00")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SC00=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SL00")==0) { - m_filter = 2300.0; - m_inputsNumber=m_sectionsNumber; - m_SL00=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - if (m_stationSRT == true) { - m_ifDistributor->setup("BW-UNFILTERED"); - ACS_LOG(LM_FULL_INFO,"CCommandLine::setDefaultConfiguration()",(LM_NOTICE,"IFDISTRIBUTOR_BW-UNFILTERED_CONFIGURED")); - } - } - if (config.Compare("SP00")==0) { - m_filter = 730.0; - m_inputsNumber=m_sectionsNumber; - m_SP00=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK77S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SK77S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK00S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SK00S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK01S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SK01S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK02S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SK02S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK03S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SK03S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK04S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SK04S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK05S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SK05S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK06S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK06S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SK06S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SC00S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SC00S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SL00S")==0) { - m_filter = 2300.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SL00S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SP00S=false; - if (m_stationSRT == true) { - m_ifDistributor->setup("BW-UNFILTERED"); - ACS_LOG(LM_FULL_INFO,"CCommandLine::setDefaultConfiguration()",(LM_NOTICE,"IFDISTRIBUTOR_BW-UNFILTERED_CONFIGURED")); - } - } - if (config.Compare("SP00S")==0) { - m_filter = 730.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SP00S=true; - m_SK77=m_SK00=m_SK01=m_SK02=m_SK03=m_SK04=m_SK05=m_SK06=m_SC00=m_SL00=m_SP00=m_SK77S=m_SK00S=m_SK01S=m_SK02S=m_SK03S=m_SK04S=m_SK05S=m_SK06S=m_SC00S=m_SL00S=false; - }*/ - //} - /*if (m_stationMED==true) { - if (config.Compare("SK01")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SK01=true; - m_SK00=m_SCC00=m_SCH00=m_SL00=m_SP00=m_SK01S=m_SK00S=m_SCC00S=m_SCH00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK00")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SK00=true; - m_SK01=m_SCC00=m_SCH00=m_SL00=m_SP00=m_SK01S=m_SK00S=m_SCC00S=m_SCH00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SCC00")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SCC00=true; - m_SK00=m_SK01=m_SL00=m_SP00=m_SK00S=m_SK01S=m_SCH00=m_SCC00S=m_SCH00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SCH00")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_SCH00=true; - m_SK00=m_SK01=m_SL00=m_SP00=m_SCC00=m_SK00S=m_SK01S=m_SCC00S=m_SCH00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SL00")==0) { - m_filter = 2300.0; - m_inputsNumber=m_sectionsNumber; - m_SL00=true; - m_SK00=m_SK01=m_SCC00=m_SP00=m_SCH00=m_SK00S=m_SK01S=m_SCC00S=m_SCH00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SP00")==0) { - m_filter = 730.0; - m_inputsNumber=m_sectionsNumber; - m_SP00=true; - m_SK00=m_SK01=m_SCC00=m_SCH00=m_SL00=m_SK00S=m_SK01S=m_SCC00S=m_SCH00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK00S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SK00S=true; - m_SK00=m_SK01=m_SCC00=m_SCH00=m_SL00=m_SP00=m_SK01S=m_SCC00S=m_SCH00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SK01S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SK01S=true; - m_SK00=m_SK01=m_SCC00=m_SCH00=m_SL00=m_SP00=m_SK00S=m_SCC00S=m_SCH00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SCC00S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SCC00S=true; - m_SK00=m_SK01=m_SCC00=m_SCH00=m_SL00=m_SP00=m_SK00S=m_SK01S=m_SCH00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SCH00S")==0) { - m_filter=1250.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SCH00S=true; - m_SK00=m_SK01=m_SCC00=m_SCH00=m_SL00=m_SP00=m_SK00S=m_SK01S=m_SCC00S=m_SL00S=m_SP00S=false; - } - if (config.Compare("SL00S")==0) { - m_filter = 2300.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SL00S=true; - m_SK00=m_SK01=m_SCC00=m_SCH00=m_SL00=m_SP00=m_SK00S=m_SK01S=m_SCC00S=m_SCH00S=m_SP00S=false; - if (m_stationSRT == true) { - m_ifDistributor->setup("BW-UNFILTERED"); - ACS_LOG(LM_FULL_INFO,"CCommandLine::setDefaultConfiguration()",(LM_NOTICE,"IFDISTRIBUTOR_BW-UNFILTERED_CONFIGURED")); - } - } - if (config.Compare("SP00S")==0) { - m_filter = 730.0; - m_inputsNumber=m_sectionsNumber; - m_sectionsNumber=m_sectionsNumber/2; - m_SP00S=true; - m_SK00=m_SK01=m_SCC00=m_SCH00=m_SL00=m_SP00=m_SK00S=m_SK01S=m_SCC00S=m_SCH00S=m_SL00S=false; } - }*/ } void CCommandLine::setTargetFileName(const char *conf) @@ -1154,277 +841,319 @@ void CCommandLine::setTargetFileName(const char *conf) void CCommandLine::sendTargetFileName() throw (BackendsErrors::BackendBusyExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl) { - AUTO_TRACE("CCommandLine::sendTargetFileName()"); - int res; - WORD len; - char sBuff[SENDBUFFERSIZE]; - char rBuff[RECBUFFERSIZE]; - // I do not check for backend busy because this is a call done at the initialization and never repeated - if (!checkConnection()) { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::sendTargetFileName()"); - } - strcpy (sBuff,"?set-filename,"); - strcat (sBuff,(const char*)m_targetFileName); - strcat (sBuff,"\r\n"); - len = strlen (sBuff); - - if ((res=sendBuffer(sBuff,len))==SUCCESS) { - res=receiveBuffer(rBuff,RECBUFFERSIZE); + AUTO_TRACE("CCommandLine::sendTargetFileName()"); + int res; + WORD len; + char sBuff[SENDBUFFERSIZE]; + char rBuff[RECBUFFERSIZE]; + // I do not check for backend busy because this is a call done at the initialization and never repeated + if (!checkConnection()) { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::sendTargetFileName()"); + } + strcpy (sBuff,"?set-filename,"); + strcat (sBuff,(const char*)m_targetFileName); + strcat (sBuff,"\r\n"); + len = strlen (sBuff); + + if ((res=sendBuffer(sBuff,len))==SUCCESS) { + res=receiveBuffer(rBuff,RECBUFFERSIZE); //printf("set-filename = %s\n",rBuff); - } - if (res>0) { // operation was ok. - //if (!CProtocol::setConfiguration(rBuff)) { - // _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::setTargetFileName()"); - //} - } - else if (res==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::sendTargetFileName()"); - } - else if (res==WOULDBLOCK) { - _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::sendTargetFileName()"); - } - else { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::sendTargetFileName()"); - } - ACS_LOG(LM_FULL_INFO,"CCommandLine::sendTargetFileName()",(LM_NOTICE,"targetFileName SENT")); + } + if (res>0) { // operation was ok. + //if (!CProtocol::setConfiguration(rBuff)) { + // _THROW_EXCPT(BackendsErrors::NakExImpl,"CCommandLine::setTargetFileName()"); + //} + } + else if (res==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::sendTargetFileName()"); + } + else if (res==WOULDBLOCK) { + _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::sendTargetFileName()"); + } + else { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::sendTargetFileName()"); + } + ACS_LOG(LM_FULL_INFO,"CCommandLine::sendTargetFileName()",(LM_NOTICE,"targetFileName SENT")); } void CCommandLine::setup(const char *conf) throw (BackendsErrors::BackendBusyExImpl,BackendsErrors::ConfigurationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, - ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ReplyNotValidExImpl,BackendsErrors::BackendFailExImpl) + ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ReplyNotValidExImpl,BackendsErrors::BackendFailExImpl) { - AUTO_TRACE("CCommandLine::setup()"); - - /* if (getIsBusy()) { - _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setup()"); - throw impl; - }*/ - - if (!initializeConfiguration(conf)) { - _EXCPT(BackendsErrors::ConfigurationErrorExImpl,impl,"CCommandLine::setup()"); - throw impl; - } + AUTO_TRACE("CCommandLine::setup()"); + + int inputs; + + /* if (getIsBusy()) { + _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setup()"); + throw impl; + }*/ + ACSErr::Completion_var completion; + m_receiverRef = m_receiversBoss->actualSetup (); + m_receiver = m_receiverRef->get_sync (completion.out ()); + m_recstr = IRA::CString (m_receiver); + + if (!initializeConfiguration(conf)) { + _EXCPT(BackendsErrors::ConfigurationErrorExImpl,impl,"CCommandLine::setup()"); + throw impl; + } try { Message request = Command::setConfiguration(string((const char*)conf)); - Message reply = sendBackendCommand(request); - if(reply.is_success_reply()) { + Message reply = sendBackendCommand(request); + if(reply.is_success_reply()) { setDefaultConfiguration(conf); - /*for (int i=0;i<m_inputsNumber;i++) { - if (m_SK02S==true || m_SK02==true) { - if (i == 0 || i == 1) { - m_totalPower->setSection(i,-1, m_filter, -1, -1, -1, -1); - } - if (i == 2 || i == 3) { - m_totalPower->setSection(i+2,-1, m_filter, -1, -1, -1, -1); - } - } - if (m_SK03S==true || m_SK03==true) { - if (i == 0 || i == 1) { - m_totalPower->setSection(i,-1, m_filter, -1, -1, -1, -1); - } - if (i == 2 || i == 3) { - m_totalPower->setSection(i+4,-1, m_filter, -1, -1, -1, -1); - } - } - if (m_SK04S==true || m_SK04==true) { - if (i == 0 || i == 1) { - m_totalPower->setSection(i,-1, m_filter, -1, -1, -1, -1); - } - if (i == 2 || i == 3) { - m_totalPower->setSection(i+6,-1, m_filter, -1, -1, -1, -1); - } - } - if (m_SK05S==true || m_SK03==true) { - if (i == 0 || i == 1) { - m_totalPower->setSection(i,-1, m_filter, -1, -1, -1, -1); - } - if (i == 2 || i == 3) { - m_totalPower->setSection(i+8,-1, m_filter, -1, -1, -1, -1); - } - } - else if (m_SK06S==true || m_SK06==true) { - if (i == 0 || i == 1) { - m_totalPower->setSection(i,-1, m_filter, -1, -1, -1, -1); - } - if (i == 2 || i == 3) { - m_totalPower->setSection(i+10,-1, m_filter, -1, -1, -1, -1); - } - } - else - m_totalPower->setSection(i,-1, m_filter, -1, -1, -1, -1); + if (m_recstr.Compare("KKG")==0) { + inputs=14; + } + if (m_recstr.Compare("CCB")==0) { + inputs=2; + } + if (m_recstr.Compare("CCG")==0) { + inputs=2; + } + m_filter=2350.0; + for (int i=0;i<inputs;i++) { + //for (int i=0;i<m_inputsNumber;i++) { + //for (int i=0;i<2;i++) { + m_totalPower->setSection(i,-1, m_filter, -1, -1, -1, -1); ACS_LOG(LM_FULL_INFO,"CCommandLine::setup()",(LM_NOTICE,"TOTALPOWER_FILTER_CONFIGURED %d,FILTER=%lf",i,m_filter)); - }*/ + } } - ACS_LOG(LM_FULL_INFO,"CCommandLine::setup()",(LM_NOTICE,"BACKEND_SKARAB_INITIALIZED, CONFIGURATION: %s",conf)); + ACS_LOG(LM_FULL_INFO,"CCommandLine::setup()",(LM_NOTICE,"BACKEND_SKARAB_INITIALIZED, CONFIGURATION: %s",conf)); + m_SkarabInitialized = true; + } + catch (...) { + ACS_LOG(LM_FULL_INFO,"CCommandLine::setup()",(LM_NOTICE,"BACKEND_SKARAB_INITIALIZATION ERROR, CONFIGURATION: %s",conf)); } - catch (...) { - ACS_LOG(LM_FULL_INFO,"CCommandLine::setup()",(LM_NOTICE,"BACKEND_SKARAB_INITIALIZATION ERROR, CONFIGURATION: %s",conf)); - } } void CCommandLine::checkTime() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::MalformedAnswerExImpl,ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl) { - if (!checkConnection()) { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::checkTime()"); - } - /*Message request = Command::time(); + if (!checkConnection()) { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::checkTime()"); + } + /*Message request = Command::time(); Message reply = sendBackendCommand(request); string _time = reply.get_argument<string>(0); if(reply.is_success_reply()) strcpy(time, _time.c_str()); return _time.length();*/ - + /*char sBuff[SENDBUFFERSIZE]; - char rBuff[RECBUFFERSIZE]; - WORD len; - int res; - ///the check of th ebusy status is not done because this time chek must be performed also during sampling. - if (!checkConnection()) { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::checkTime()"); - } - len=CProtocol::checkBackendTime(sBuff); // get the buffer - if ((res=sendBuffer(sBuff,len))==SUCCESS) { - res=receiveBuffer(rBuff,RECBUFFERSIZE); - } - if (res>0) { // operation was ok. - bool sync; - if (!CProtocol::checkBackendTime(rBuff,m_configuration->getTimeTollerance(),sync)) { - _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"CCommandLine::checkTime()"); - } else if (!sync) { - _IRA_LOGFILTER_LOG(LM_WARNING,"CCommandLine::checkTime()","BACKEND_CLOCK_NOT_SYNCHRONIZED"); - setStatusField(TIME_SYNC); - } - else { - clearStatusField(TIME_SYNC); - } - } - else if (res==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::checkTime()"); - } - else if (res==WOULDBLOCK) { - _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::checkTime()"); - } - else { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::checkTime()"); - }*/ + char rBuff[RECBUFFERSIZE]; + WORD len; + int res; + ///the check of th ebusy status is not done because this time chek must be performed also during sampling. + if (!checkConnection()) { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::checkTime()"); + } + len=CProtocol::checkBackendTime(sBuff); // get the buffer + if ((res=sendBuffer(sBuff,len))==SUCCESS) { + res=receiveBuffer(rBuff,RECBUFFERSIZE); + } + if (res>0) { // operation was ok. + bool sync; + if (!CProtocol::checkBackendTime(rBuff,m_configuration->getTimeTollerance(),sync)) { + _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"CCommandLine::checkTime()"); + } else if (!sync) { + _IRA_LOGFILTER_LOG(LM_WARNING,"CCommandLine::checkTime()","BACKEND_CLOCK_NOT_SYNCHRONIZED"); + setStatusField(TIME_SYNC); + } + else { + clearStatusField(TIME_SYNC); + } + } + else if (res==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::checkTime()"); + } + else if (res==WOULDBLOCK) { + _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::checkTime()"); + } + else { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::checkTime()"); + }*/ } void CCommandLine::setTime() throw (ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, - ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,BackendsErrors::MalformedAnswerExImpl, - BackendsErrors::BackendBusyExImpl) + ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,BackendsErrors::MalformedAnswerExImpl, + BackendsErrors::BackendBusyExImpl) { - AUTO_TRACE("CCommandLine::setTime()"); - //int res; - //WORD len; - //char sBuff[SENDBUFFERSIZE]; - //char rBuff[RECBUFFERSIZE]; -/* if (getIsBusy()) { - _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setTime()"); - throw impl; - }*/ - /*len=CProtocol::setBackendTime(sBuff); // get the buffer - if ((res=sendBuffer(sBuff,len))==SUCCESS) { - res=receiveBuffer(rBuff,RECBUFFERSIZE); - } - if (res>0) { // operation was ok. - bool sync; - if (!CProtocol::decodeBackendTime(rBuff,sync)) { - _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"CCommandLine::setTime()"); - setStatusField(TIME_SYNC); - } else if (!sync) { - ACS_LOG(LM_FULL_INFO,"CCommandLine::setTime()",(LM_WARNING,"CLOCK_NOT_SYNCHRONIZED")); - setStatusField(TIME_SYNC); - } - else { - clearStatusField(TIME_SYNC); - ACS_LOG(LM_FULL_INFO,"CCommandLine::setTime()",(LM_NOTICE,"TIME_IS_SYNCHRONIZED")); - } - } - else if (res==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::setTime()"); - } - else if (res==WOULDBLOCK) { - _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::setTime()"); - } - else { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setTime()"); - } + AUTO_TRACE("CCommandLine::setTime()"); + //int res; + //WORD len; + //char sBuff[SENDBUFFERSIZE]; + //char rBuff[RECBUFFERSIZE]; +/* if (getIsBusy()) { + _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setTime()"); + throw impl; + }*/ + /*len=CProtocol::setBackendTime(sBuff); // get the buffer + if ((res=sendBuffer(sBuff,len))==SUCCESS) { + res=receiveBuffer(rBuff,RECBUFFERSIZE); + } + if (res>0) { // operation was ok. + bool sync; + if (!CProtocol::decodeBackendTime(rBuff,sync)) { + _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"CCommandLine::setTime()"); + setStatusField(TIME_SYNC); + } else if (!sync) { + ACS_LOG(LM_FULL_INFO,"CCommandLine::setTime()",(LM_WARNING,"CLOCK_NOT_SYNCHRONIZED")); + setStatusField(TIME_SYNC); + } + else { + clearStatusField(TIME_SYNC); + ACS_LOG(LM_FULL_INFO,"CCommandLine::setTime()",(LM_NOTICE,"TIME_IS_SYNCHRONIZED")); + } + } + else if (res==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::setTime()"); + } + else if (res==WOULDBLOCK) { + _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::setTime()"); + } + else { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setTime()"); + } */ } void CCommandLine::activateCalSwitching(const long& interleave) throw (BackendsErrors::BackendBusyExImpl,ComponentErrors::NotAllowedExImpl) { - AUTO_TRACE("CCommandLine::activateCalSwitching()"); - /*int res; - WORD len; - char sBuff[SENDBUFFERSIZE]; - char rBuff[RECBUFFERSIZE];*/ - if (getIsBusy()) { - _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setTime()"); - throw impl; - } - /*if (!checkConnection()) { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setTime()"); - }*/ + AUTO_TRACE("CCommandLine::activateCalSwitching()"); + /*int res; + WORD len; + char sBuff[SENDBUFFERSIZE]; + char rBuff[RECBUFFERSIZE];*/ + if (getIsBusy()) { + _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setTime()"); + throw impl; + } + /*if (!checkConnection()) { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::setTime()"); + }*/ Message request = Command::calOn(interleave); Message reply = sendBackendCommand(request); if(reply.is_success_reply()){ // TBD } - if (!m_calSwitchingEnabled) { - _EXCPT(ComponentErrors::NotAllowedExImpl,impl,"CCommandLine::activateCalSwitching()"); - throw impl; - } - if (interleave>=0) { - m_calPeriod=interleave; - if (m_calPeriod>0) { - ACS_LOG(LM_FULL_INFO,"CCommandLine::activateCalSwitching()",(LM_NOTICE,"CALIBRATION_DIODE_SWITCHING_ON")); - } - else { - ACS_LOG(LM_FULL_INFO,"CCommandLine::activateCalSwitching()",(LM_NOTICE,"CALIBRATION_DIODE_SWITCHING_OFF")); - } - } + if (!m_calSwitchingEnabled) { + _EXCPT(ComponentErrors::NotAllowedExImpl,impl,"CCommandLine::activateCalSwitching()"); + throw impl; + } + if (interleave>=0) { + m_calPeriod=interleave; + if (m_calPeriod>0) { + ACS_LOG(LM_FULL_INFO,"CCommandLine::activateCalSwitching()",(LM_NOTICE,"CALIBRATION_DIODE_SWITCHING_ON")); + } + else { + ACS_LOG(LM_FULL_INFO,"CCommandLine::activateCalSwitching()",(LM_NOTICE,"CALIBRATION_DIODE_SWITCHING_OFF")); + } + } } -void CCommandLine::setEnabled(const ACS::longSeq& en) throw (BackendsErrors::BackendBusyExImpl) +void CCommandLine::setEnabled(const ACS::longSeq& en) throw (BackendsErrors::BackendBusyExImpl, BackendsErrors::ConfigurationErrorExImpl, ComponentErrors::ValueOutofRangeExImpl) { - int bound; - if (getIsBusy()) { - _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setEnabled()"); - throw impl; - } - if ((long)en.length()>=m_sectionsNumber) { - bound=m_sectionsNumber; - } - else { - bound=en.length(); - } - for (int i=0;i<bound;i++) { - if (en[i]>0) m_enabled[i]=true; - else if (en[i]==0) m_enabled[i]=false; - } - ACS_LOG(LM_FULL_INFO,"CCommandLine::setEnabled()",(LM_NOTICE,"CHANGED_ENABLED_CHANNEL")); + int bound; + int i; + long m_en[4]; +// bool kkg77 = false; +// IRA::CString recstr; +// ACS::ROstring_var receiverRef; +// CORBA::String_var receiver; +// ACSErr::Completion_var completion; + + /* if (getIsBusy()) { + _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setEnabled()"); + throw impl; + }*/ + if (m_SkarabInitialized == true) { + if ((long)en.length()!=2/*m_sectionsNumber*/) { + /*errore;*/ + } + /*else { + bound=en.length(); + } + for (int i=0;i<bound;i++) { + if (en[i]>0) m_enabled[i]=true; + else if (en[i]==0) m_enabled[i]=false; + }*/ +// receiverRef = m_receiversBoss->actualSetup (); +// receiver = receiverRef->get_sync (completion.out ()); +// recstr = IRA::CString (receiver); + if ((m_recstr.Compare("KKG")==0) && (en[0]==7 && en[1]==7)) { + m_en[0]=m_en[2]=7; + m_kkg77=true; + } + if (m_kkg77 == false) { + if (m_recstr.Compare("KKG")==0) { + if ((en[0] < 0) || (en[0] > 6)) { + _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setEnabled()"); + impl.setValueName("feed"); + throw impl; + } + if ((en[1] < 0) || (en[1] > 6)) { + _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setEnabled()"); + impl.setValueName("feed"); + throw impl; + } + } + if (en[0] == en[1]) { // central feed + m_inputsNumber = 2; + if (m_stokes == false) + m_sectionsNumber = 2; + if (m_stokes == true) + m_sectionsNumber = 1; + m_beams = 1; // TBC !!! + } + else { // nodding + m_inputsNumber = 4; + if (m_stokes == false) + m_sectionsNumber = 4; + if (m_stokes == true) + m_sectionsNumber = 2; + m_beams = 2; // TBC !!! + } + m_en[0] = en[0]; + m_en[1] = en[0]; + m_en[2] = en[1]; + m_en[3] = en[1]; + for (i=0;i<m_inputsNumber;i++) { + m_feedNumber[i] = m_en[i]; + } + } + Message request = Command::setEnable(m_en[0],m_en[2]); + Message reply = sendBackendCommand(request); + if (reply.is_success_reply()) { + // TBD + ACS_LOG(LM_FULL_INFO,"CCommandLine::setEnabled()",(LM_NOTICE,"NODDING enabled")); + } + } + else { + ACS_LOG(LM_FULL_INFO,"CCommandLine::setEnabled()",(LM_NOTICE,"BCK SKARAB NOT INITIALIZED")); + _EXCPT(BackendsErrors::ConfigurationErrorExImpl,impl,"CCommandLine::setEnabled()"); + throw impl; + } } void CCommandLine::setIntegration(const long& integration) throw (BackendsErrors::BackendBusyExImpl, ComponentErrors::ValueOutofRangeExImpl) { - AUTO_TRACE("CCommandLine::setIntegration()"); - /*if (getIsBusy()) { - _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setIntegration()"); - throw impl; - }*/ - m_integration = integration; + AUTO_TRACE("CCommandLine::setIntegration()"); + /*if (getIsBusy()) { + _EXCPT(BackendsErrors::BackendBusyExImpl,impl,"CCommandLine::setIntegration()"); + throw impl; + }*/ + m_integration = integration; if (m_integration>=MIN_INTEGRATION && m_integration <= MAX_INTEGRATION) { Message request = Command::setIntegration(integration); Message reply = sendBackendCommand(request); @@ -1436,49 +1165,60 @@ void CCommandLine::setIntegration(const long& integration) throw (BackendsError else { _EXCPT(ComponentErrors::ValueOutofRangeExImpl,impl,"CCommandLine::setIntegration()"); impl.setValueName("integration"); - throw impl; + throw impl; + } +} + +void CCommandLine::setShift(const long& shift) throw (BackendsErrors::BackendBusyExImpl) +{ + AUTO_TRACE("CCommandLine::setShift()"); + Message request = Command::setShift(shift); + Message reply = sendBackendCommand(request); + if (reply.is_success_reply()) { + // TBD + ACS_LOG(LM_FULL_INFO,"CCommandLine::setShift()",(LM_NOTICE,"SHIFT is now %ld",shift)); } } void CCommandLine::getAttenuation(ACS::doubleSeq& att) throw (ComponentErrors::SocketErrorExImpl, - ComponentErrors::TimeoutExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ConnectionExImpl) + ComponentErrors::TimeoutExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ConnectionExImpl) { - AUTO_TRACE("CCommandLine::getAttenuation()"); + AUTO_TRACE("CCommandLine::getAttenuation()"); att.length(m_inputsNumber); - for (int i=0;i<m_inputsNumber;i++) { - att[i]=m_attenuation[i]; - } + for (int i=0;i<m_inputsNumber;i++) { + att[i]=m_attenuation[i]; + } } void CCommandLine::getAttenuationAttr(ACS::doubleSeq& att) throw (ComponentErrors::SocketErrorExImpl, - ComponentErrors::TimeoutExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ConnectionExImpl) + ComponentErrors::TimeoutExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ConnectionExImpl) { - AUTO_TRACE("CCommandLine::getAttenuation()"); + AUTO_TRACE("CCommandLine::getAttenuation()"); att.length(m_sectionsNumber); - for (int i=0;i<m_sectionsNumber;i++) { - att[i]=m_attenuation[i]; - } + for (int i=0;i<m_sectionsNumber;i++) { + att[i]=m_attenuation[i]; + } } void CCommandLine::getFrequency(ACS::doubleSeq& freq) const { - freq.length(m_inputsNumber); - for (int i=0;i<m_inputsNumber;i++) { - freq[i]=m_frequency[i]; - } + freq.length(m_inputsNumber); + for (int i=0;i<m_inputsNumber;i++) { + freq[i]=m_frequency[i]; + } } void CCommandLine::getFrequencyAttr(ACS::doubleSeq& freq) const { - freq.length(m_sectionsNumber); - for (int i=0;i<m_sectionsNumber;i++) { - freq[i]=m_frequency[i]; - } + freq.length(m_sectionsNumber); + for (int i=0;i<m_sectionsNumber;i++) { + freq[i]=m_frequency[i]; + } } void CCommandLine::getBackendStatus(DWORD& status) { - AUTO_TRACE("CCommandLine::getBackendStatus()"); + AUTO_TRACE("CCommandLine::getBackendStatus()"); try { Message request = Command::status(); Message reply = sendBackendCommand(request); @@ -1487,117 +1227,107 @@ void CCommandLine::getBackendStatus(DWORD& status) //strcpy(status, _status.c_str()); status=atof(_status.c_str()); if (status == 0) - clearStatusField(BUSY); + clearStatusField(BUSY); if (status == 1) - setStatusField(BUSY); + setStatusField(BUSY); } } catch (...) { ACS_LOG(LM_FULL_INFO,"CCommandLine::getBackendStatus()",(LM_NOTICE,"BACKEND_SKARAB_GET_STATUS_ERROR")); } - //return _status.length(); - return status; + //return _status.length(); + return status; } void CCommandLine::getSampleRate(ACS::doubleSeq& sr) const { - sr.length(m_sectionsNumber); - for (int i=0;i<m_sectionsNumber;i++) { - sr[i]=m_sampleRate[i]; - } + sr.length(m_sectionsNumber); + for (int i=0;i<m_sectionsNumber;i++) { + sr[i]=m_sampleRate[i]; + } } void CCommandLine::getTsys(ACS::doubleSeq& tsys) const { - /*tsys.length(m_sectionsNumber); - for (int i=0;i<m_sectionsNumber;i++) { - tsys[i]=m_tsys[i]; - }*/ - tsys.length(m_inputsNumber); - for (int i=0;i<m_inputsNumber;i++) { - tsys[i]=m_tsys[i]; - } + /*tsys.length(m_sectionsNumber); + for (int i=0;i<m_sectionsNumber;i++) { + tsys[i]=m_tsys[i]; + }*/ + tsys.length(m_inputsNumber); + for (int i=0;i<m_inputsNumber;i++) { + tsys[i]=m_tsys[i]; + } } void CCommandLine::getKCRatio(ACS::doubleSeq& ratio) const { - ratio.length(m_sectionsNumber); - for (int i=0;i<m_sectionsNumber;i++) { - ratio[i]=m_KCratio[i]; - } + ratio.length(m_sectionsNumber); + for (int i=0;i<m_sectionsNumber;i++) { + ratio[i]=m_KCratio[i]; + } +} + +void CCommandLine::getKelvinCountsRatio(ACS::doubleSeq& kcr) const +{ + kcr.length(m_inputsNumber); + for (int i=0;i<m_inputsNumber;i++) { + kcr[i]=m_KCratio[i]; + } } void CCommandLine::getBins(ACS::longSeq& bins) const { - bins.length(m_sectionsNumber); - for (int i=0;i<m_sectionsNumber;i++) { - bins[i]=m_bins[i]; - } + bins.length(m_sectionsNumber); + for (int i=0;i<m_sectionsNumber;i++) { + bins[i]=m_bins[i]; + } } void CCommandLine::getPolarization(ACS::longSeq& pol) const { - pol.length(m_sectionsNumber); - for (int i=0;i<m_sectionsNumber;i++) { + pol.length(m_sectionsNumber); + for (int i=0;i<m_sectionsNumber;i++) { if (m_stokes==true) pol[i]=2; else pol[i]=(long)m_polarization[i]; - } + } } -void CCommandLine::getFeed(ACS::longSeq& feed) const +void CCommandLine::getFeed(ACS::longSeq& feed) const { - feed.length(m_inputsNumber); - for (int i=0;i<m_inputsNumber;i++) { - feed[i]=m_feedNumber[i]; - } + feed.length(m_inputsNumber); + for (int i=0;i<m_inputsNumber;i++) { + feed[i]=m_feedNumber[i]; + } } -void CCommandLine::getFeedAttr(ACS::longSeq& feed) const +void CCommandLine::getFeedAttr(ACS::longSeq& feed) const { - feed.length(m_sectionsNumber); - for (int i=0;i<m_sectionsNumber;i++) { + feed.length(m_sectionsNumber); + for (int i=0;i<m_sectionsNumber;i++) { if (m_stokes == true) - feed[i]=m_feedNumber[2*i]; - /*else if (m_SK01S == true || m_SK02S == true || m_SK03S==true || m_SK04S==true || m_SK05S==true || m_SK06S==true) { - if (i < 1) - feed[i] = 0; - else { - if (m_SK01S == true) - feed[i] = 1; - if (m_SK02S == true) - feed[i] = 2; - if (m_SK03S == true) - feed[i] = 3; - if (m_SK04S == true) - feed[i] = 4; - if (m_SK05S == true) - feed[i] = 5; - if (m_SK06S == true) - feed[i] = 6; - } - }*/ + feed[i]=m_feedNumber[2*i]; else - feed[i]=m_feedNumber[i]; - } + feed[i]=m_feedNumber[i]; + } } void CCommandLine::getIFs(ACS::longSeq& ifs) const { - ifs.length(m_inputsNumber); - for (int i=0;i<m_inputsNumber;i++) { - ifs[i]=m_ifNumber[i]; - } + ifs.length(m_inputsNumber); + for (int i=0;i<m_inputsNumber;i++) { + ifs[i]=m_ifNumber[i]; + } } void CCommandLine::getInputSection(ACS::longSeq& inpSection) const { - inpSection.length(m_inputsNumber); + inpSection.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { - inpSection[i]=m_inputSection[i]; - } + inpSection[i]=m_inputSection[i]; + } } void CCommandLine::getInputSectionAttr(ACS::longSeq& inpSection) const @@ -1610,15 +1340,15 @@ void CCommandLine::getInputSectionAttr(ACS::longSeq& inpSection) const index = m_inputsNumber; inpSection.length(index); - for (int i=0;i<index;i++) { - inpSection[i]=m_inputSection[i]; - } + for (int i=0;i<index;i++) { + inpSection[i]=m_inputSection[i]; + } } void CCommandLine::getBandWidth(ACS::doubleSeq& bw) throw (ComponentErrors::SocketErrorExImpl, - ComponentErrors::TimeoutExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ConnectionExImpl) + ComponentErrors::TimeoutExImpl,BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ConnectionExImpl) { - AUTO_TRACE("CCommandLine::getBandWidth()"); + AUTO_TRACE("CCommandLine::getBandWidth()"); bw.length(m_inputsNumber); for (int i=0;i<m_inputsNumber;i++) { bw[i]=m_bandWidth[i]; @@ -1627,41 +1357,41 @@ void CCommandLine::getBandWidth(ACS::doubleSeq& bw) throw (ComponentErrors::Sock void CCommandLine::getBandWidthAttr(ACS::doubleSeq& bw) const { - AUTO_TRACE("CCommandLine::getBandWidthAttr()"); + AUTO_TRACE("CCommandLine::getBandWidthAttr()"); - bw.length(m_sectionsNumber); - for (int i=0;i<m_sectionsNumber;i++) { - bw[i]=m_bandWidth[i]; - } + bw.length(m_sectionsNumber); + for (int i=0;i<m_sectionsNumber;i++) { + bw[i]=m_bandWidth[i]; + } } void CCommandLine::getTime(ACS::Time& tt) throw (ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl, - BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ConnectionExImpl) + BackendsErrors::MalformedAnswerExImpl,BackendsErrors::ConnectionExImpl) { - AUTO_TRACE("CCommandLine::getTime()"); + AUTO_TRACE("CCommandLine::getTime()"); TIMEDIFFERENCE bkndTime; TIMEVALUE tm; long long seconds; - long second,minute,hour,day; + long second,minute,hour,day; try { Message request = Command::time(); Message reply = sendBackendCommand(request); if(reply.is_success_reply()) { seconds=reply.get_argument<long long>(0); day=seconds/86400; - seconds%=86400; - hour=seconds/3600; - seconds%=3600; - minute=seconds/60; - second=seconds % 60; - bkndTime.day(day); - bkndTime.hour(hour); - bkndTime.minute(minute); - bkndTime.second(second); + seconds%=86400; + hour=seconds/3600; + seconds%=3600; + minute=seconds/60; + second=seconds % 60; + bkndTime.day(day); + bkndTime.hour(hour); + bkndTime.minute(minute); + bkndTime.second(second); tm.reset(); - tm.normalize(true); - tm.year(1970); - tm.month(1); - tm.day(1); + tm.normalize(true); + tm.year(1970); + tm.month(1); + tm.day(1); tm+=bkndTime.value(); tt=tm.value().value; } @@ -1673,421 +1403,430 @@ void CCommandLine::getTime(ACS::Time& tt) throw (ComponentErrors::SocketErrorExI void CCommandLine::fillMainHeader(Backends::TMainHeader& bkd) { - bkd.sections=m_sectionsNumber; - bkd.beams=m_beams; - //resultingSampleRate(m_integration,m_commonSampleRate,intTime); - //bkd.integration=intTime; - bkd.integration=m_integration; - bkd.sampleSize=m_sampleSize; - bkd.noData=true; + bkd.sections=m_sectionsNumber; + bkd.beams=m_beams; + //resultingSampleRate(m_integration,m_commonSampleRate,intTime); + //bkd.integration=intTime; + bkd.integration=m_integration; + bkd.sampleSize=m_sampleSize; + bkd.noData=true; } void CCommandLine::fillChannelHeader(Backends::TSectionHeader *chHr,const long& size) { - long index=0; - for (int i=0;i<m_sectionsNumber;i++) { - //for (int i=0;i<m_inputsNumber;i++) { + long index=0; + for (int i=0;i<m_sectionsNumber;i++) { + //for (int i=0;i<m_inputsNumber;i++) { //printf("i = %d\n", i); - //if (m_enabled[i]) { - // if (index<size) { - chHr[index].id=i; - chHr[index].bins=m_bins[i]; - chHr[index].bandWidth=m_bandWidth[i]; - chHr[index].frequency=m_frequency[i]; - chHr[index].attenuation[0]=m_attenuation[i]; - chHr[index].attenuation[1]=m_attenuation[i]; - chHr[index].sampleRate=/*m_sampleRate[i];*/m_commonSampleRate; + //if (m_enabled[i]) { + // if (index<size) { + chHr[index].id=i; + chHr[index].bins=m_bins[i]; + chHr[index].bandWidth=m_bandWidth[i]; + //m_frequency[i]=m_frequency[i]-m_bandWidth[i]/2.; // TBC !! + chHr[index].frequency=m_frequency[i]; + chHr[index].attenuation[0]=m_attenuation[i]; + chHr[index].attenuation[1]=m_attenuation[i]; + chHr[index].sampleRate=/*m_sampleRate[i];*/m_commonSampleRate; if (m_stokes==true) { chHr[index].inputs=2; - chHr[index].feed=m_feedNumber[2*i]; - chHr[index].polarization=m_polarization[2*i]; - chHr[index].IF[0]=0; - chHr[index].IF[1]=1; + chHr[index].feed=m_feedNumber[2*i]; + chHr[index].polarization=m_polarization[2*i]; + chHr[index].IF[0]=0; + chHr[index].IF[1]=1; } else { chHr[index].inputs=1; - chHr[index].feed=m_feedNumber[i]; - chHr[index].polarization=m_polarization[i]; - chHr[index].IF[0]=m_ifNumber[i]; + chHr[index].feed=m_feedNumber[i]; + chHr[index].polarization=m_polarization[i]; + chHr[index].IF[0]=m_ifNumber[i]; } //printf("feed = %d\n", chHr[index].feed); //printf("pol = %d\n", m_polarization[i]); - index++; - // } - //} - } + index++; + // } + //} + } } void CCommandLine::saveTsys(const ACS::doubleSeq& tsys,const ACS::doubleSeq& ratio) { - /*if (tsys.length()==(unsigned)m_sectionsNumber) { - for (int i=0;i<m_sectionsNumber;i++) { - m_tsys[i]=tsys[i]; - } - } - if (ratio.length()==(unsigned)m_sectionsNumber) { - for (int i=0;i<m_sectionsNumber;i++) { - m_KCratio[i]=ratio[i]; - } - ACS_LOG(LM_FULL_INFO,"CCommandLine::saveTsys()",(LM_NOTICE,"KELVIN_COUNTS_CONVERSION_FACTOR_SET")); - }*/ - if (tsys.length()==(unsigned)m_inputsNumber) { - for (int i=0;i<m_inputsNumber;i++) { - m_tsys[i]=tsys[i]; - } - ACS_LOG(LM_FULL_INFO,"CCommandLine::saveTsys()",(LM_NOTICE,"TSYS_SET")); - } - if (ratio.length()==(unsigned)m_inputsNumber) { - for (int i=0;i<m_inputsNumber;i++) { - m_KCratio[i]=ratio[i]; - } - ACS_LOG(LM_FULL_INFO,"CCommandLine::saveTsys()",(LM_NOTICE,"KELVIN_COUNTS_CONVERSION_FACTOR_SET")); - } + /*if (tsys.length()==(unsigned)m_sectionsNumber) { + for (int i=0;i<m_sectionsNumber;i++) { + m_tsys[i]=tsys[i]; + } + } + if (ratio.length()==(unsigned)m_sectionsNumber) { + for (int i=0;i<m_sectionsNumber;i++) { + m_KCratio[i]=ratio[i]; + } + ACS_LOG(LM_FULL_INFO,"CCommandLine::saveTsys()",(LM_NOTICE,"KELVIN_COUNTS_CONVERSION_FACTOR_SET")); + }*/ + if (tsys.length()==(unsigned)m_inputsNumber) { + for (int i=0;i<m_inputsNumber;i++) { + m_tsys[i]=tsys[i]; + } + ACS_LOG(LM_FULL_INFO,"CCommandLine::saveTsys()",(LM_NOTICE,"TSYS_SET")); + } + if (ratio.length()==(unsigned)m_inputsNumber) { + for (int i=0;i<m_inputsNumber;i++) { + m_KCratio[i]=ratio[i]; + } + ACS_LOG(LM_FULL_INFO,"CCommandLine::saveTsys()",(LM_NOTICE,"KELVIN_COUNTS_CONVERSION_FACTOR_SET")); + } } bool CCommandLine::resultingSampleRate(const long& integration,const double& sr,long& result) { - bool res=false; - long accumulations; - double temp; - temp=(double)integration*1000.0*sr; - accumulations=(long)round(temp); - if (accumulations<1) accumulations=1; - if (((temp-accumulations)>0.0) || ((temp-accumulations)<0.0)) { - res=true; - } - result=(long)round((accumulations/(sr*1000))); - return res; + bool res=false; + long accumulations; + double temp; + temp=(double)integration*1000.0*sr; + accumulations=(long)round(temp); + if (accumulations<1) accumulations=1; + if (((temp-accumulations)>0.0) || ((temp-accumulations)<0.0)) { + res=true; + } + result=(long)round((accumulations/(sr*1000))); + return res; } // Protected Methods void CCommandLine::onConnect(int ErrorCode) { - CError Tmp; - if (getStatus()==CNTDING) { // if the line is connecting....... - if (ErrorCode==0) { - if (EventSelect(Tmp,E_CONNECT,false)==SUCCESS) { - setStatus(CNTD); - CSocket::setStatus(IRA::CSocket::READY); // force the socket status to be ready..... - try { - //stopDataAcquisitionForced(); // ask the backend to exit the data transfering mode...... - } - catch (ACSErr::ACSbaseExImpl& ex) { - - } - clearStatusField(BUSY); - m_reiniting=true; // ask to the datasocket to accept connection again - ACS_LOG(LM_FULL_INFO,"CCommandLine::onConnect()",(LM_NOTICE,"SOCKET_RECONNECTED")); - } - } - else { - setStatus(NOTCNTD); - ACS_DEBUG_PARAM("CCommandLine::onConnect()","Reconnection failed, exit code is %d",ErrorCode); - } - } + CError Tmp; + if (getStatus()==CNTDING) { // if the line is connecting....... + if (ErrorCode==0) { + if (EventSelect(Tmp,E_CONNECT,false)==SUCCESS) { + setStatus(CNTD); + CSocket::setStatus(IRA::CSocket::READY); // force the socket status to be ready..... + try { + //stopDataAcquisitionForced(); // ask the backend to exit the data transfering mode...... + } + catch (ACSErr::ACSbaseExImpl& ex) { + + } + clearStatusField(BUSY); + m_reiniting=true; // ask to the datasocket to accept connection again + ACS_LOG(LM_FULL_INFO,"CCommandLine::onConnect()",(LM_NOTICE,"SOCKET_RECONNECTED")); + } + } + else { + setStatus(NOTCNTD); + ACS_DEBUG_PARAM("CCommandLine::onConnect()","Reconnection failed, exit code is %d",ErrorCode); + } + } } void CCommandLine::onTimeout(WORD EventMask) { - if ((EventMask&E_CONNECT)==E_CONNECT) { - ACS_DEBUG("CCommandLine::onTimeout()","Reconnection timed-out, keep trying...."); - } + if ((EventMask&E_CONNECT)==E_CONNECT) { + ACS_DEBUG("CCommandLine::onTimeout()","Reconnection timed-out, keep trying...."); + } } // private methods IRA::CSocket::OperationResult CCommandLine::sendBuffer(char *Msg,WORD Len) { - int NWrite; - int BytesSent; - BytesSent=0; - while (BytesSent<Len) { - if ((NWrite=Send(m_Error,(const void *)(Msg+BytesSent),Len-BytesSent))<0) { - if (NWrite==WOULDBLOCK) { - setStatus(NOTCNTD); - _IRA_LOGFILTER_LOG(LM_CRITICAL,"CCommandLine::sendBuffer()","SOCKET_DISCONNECTED - remote side shutdown"); - return WOULDBLOCK; - } - else { - setStatus(NOTCNTD); - CString app; - app.Format("SOCKET_DISCONNECTED - %s",(const char *)m_Error.getFullDescription()); - _IRA_LOGFILTER_LOG(LM_CRITICAL,"CCommandLine::sendBuffer()",(const char*)app); - return FAIL; - } - } - else { // success - BytesSent+=NWrite; - } - } - if (BytesSent==Len) { - return SUCCESS; + int NWrite; + int BytesSent; + BytesSent=0; + while (BytesSent<Len) { + if ((NWrite=Send(m_Error,(const void *)(Msg+BytesSent),Len-BytesSent))<0) { + if (NWrite==WOULDBLOCK) { + setStatus(NOTCNTD); + _IRA_LOGFILTER_LOG(LM_CRITICAL,"CCommandLine::sendBuffer()","SOCKET_DISCONNECTED - remote side shutdown"); + return WOULDBLOCK; + } + else { + setStatus(NOTCNTD); + CString app; + app.Format("SOCKET_DISCONNECTED - %s",(const char *)m_Error.getFullDescription()); + _IRA_LOGFILTER_LOG(LM_CRITICAL,"CCommandLine::sendBuffer()",(const char*)app); + return FAIL; + } + } + else { // success + BytesSent+=NWrite; + } + } + if (BytesSent==Len) { + return SUCCESS; } - else { - _SET_ERROR(m_Error,CError::SocketType,CError::SendError,"CCommandLine::SendBuffer()"); - return FAIL; - } + else { + _SET_ERROR(m_Error,CError::SocketType,CError::SendError,"CCommandLine::SendBuffer()"); + return FAIL; + } } int CCommandLine::receiveBuffer(char *Msg,WORD Len) { - char inCh; - int res; - int nRead=0; - TIMEVALUE Now; - TIMEVALUE Start; - CIRATools::getTime(Start); - while(true) { - res=Receive(m_Error,&inCh,1); - if (res==WOULDBLOCK) { - CIRATools::getTime(Now); - if (CIRATools::timeDifference(Start,Now)>m_configuration->getCommandLineTimeout()) { - m_bTimedout=true; - return WOULDBLOCK; - } - else { - CIRATools::Wait(0,20000); - continue; - } - } - else if (res==FAIL) { - setStatus(NOTCNTD); - CString app; - app.Format("SOCKET_DISCONNECTED - %s",(const char *)m_Error.getFullDescription()); - _IRA_LOGFILTER_LOG(LM_CRITICAL,"CCommandLine::receiveBuffer()",(const char*)app); - return res; - } - else if (res==0) { - setStatus(NOTCNTD); - _IRA_LOGFILTER_LOG(LM_CRITICAL,"CCommandLine::receiveBuffer()","SOCKET_DISCONNECTED - remote side shutdown"); - return res; - } - else { - if (inCh!=PROT_TERMINATOR_CH) { - Msg[nRead]=inCh; - nRead++; - } - else { - Msg[nRead]=0; - return nRead; - } - } - } + char inCh; + int res; + int nRead=0; + TIMEVALUE Now; + TIMEVALUE Start; + CIRATools::getTime(Start); + while(true) { + res=Receive(m_Error,&inCh,1); + if (res==WOULDBLOCK) { + CIRATools::getTime(Now); + if (CIRATools::timeDifference(Start,Now)>m_configuration->getCommandLineTimeout()) { + m_bTimedout=true; + return WOULDBLOCK; + } + else { + CIRATools::Wait(0,20000); + continue; + } + } + else if (res==FAIL) { + setStatus(NOTCNTD); + CString app; + app.Format("SOCKET_DISCONNECTED - %s",(const char *)m_Error.getFullDescription()); + _IRA_LOGFILTER_LOG(LM_CRITICAL,"CCommandLine::receiveBuffer()",(const char*)app); + return res; + } + else if (res==0) { + setStatus(NOTCNTD); + _IRA_LOGFILTER_LOG(LM_CRITICAL,"CCommandLine::receiveBuffer()","SOCKET_DISCONNECTED - remote side shutdown"); + return res; + } + else { + if (inCh!=PROT_TERMINATOR_CH) { + Msg[nRead]=inCh; + nRead++; + } + else { + Msg[nRead]=0; + return nRead; + } + } + } } int CCommandLine::sendCommand(char *inBuff,const WORD& inLen,char *outBuff) { - OperationResult Res; - if ((Res=sendBuffer(inBuff,inLen))==SUCCESS) { - int bytes=receiveBuffer(outBuff,RECBUFFERSIZE); - return bytes; - } - else { // send fails....m_Error already set by sendBuffer - return Res; - } + OperationResult Res; + if ((Res=sendBuffer(inBuff,inLen))==SUCCESS) { + int bytes=receiveBuffer(outBuff,RECBUFFERSIZE); + return bytes; + } + else { // send fails....m_Error already set by sendBuffer + return Res; + } } -Message +Message CCommandLine::sendBackendCommand(Message request) { - if (!checkConnection()) { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::sendBackendCommand()"); - } - char sBuff[SENDBUFFERSIZE]; - char rBuff[RECBUFFERSIZE]; - strcpy (sBuff,request.toString(true).c_str()); - int len = strlen (sBuff); - int res = 0; - if ((res=sendBuffer(sBuff,len))==SUCCESS) { - res=receiveBuffer(rBuff,RECBUFFERSIZE); - } - if (res>0) { // operation was ok. - clearStatusField(CCommandLine::BUSY); - setStatusField(SUSPEND); - } - else if (res==FAIL) { - _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); - dummy.setCode(m_Error.getErrorCode()); - dummy.setDescription((const char*)m_Error.getDescription()); - m_Error.Reset(); - _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::sendBackendCommand()"); - } - else if (res==WOULDBLOCK) { - _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::sendBackendCommand()"); - } - else { - _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::sendBackendCommand()"); - } - Message reply(string(rBuff, res), true); - try { - reply.validate(); - } - catch (BackendProtocolError& bpe) { - //TODO: somehow the reply is not valid - //we cannot proceed we need to throw an exception - _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"sendBackendCommand()"); - } - if(!(reply.is_valid_reply_for(request))) - { - //TODO: this answer is not valid for this request, throw exception - _THROW_EXCPT(BackendsErrors::ReplyNotValidExImpl,"sendBackendCommand()"); - } - if(!(reply.is_success_reply())) - { - //TODO: the reply has a FAIL o INVALID code, this must be - //managed - _EXCPT(BackendsErrors::BackendFailExImpl,impl,"sendBackendCommand()"); - //impl.setReason("transfer job cannot be resumed in present configuration"); - impl.setReason(reply.get_argument<string>(0).c_str()); - throw impl; - } - return reply; + if (!checkConnection()) { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::sendBackendCommand()"); + } + char sBuff[SENDBUFFERSIZE]; + char rBuff[RECBUFFERSIZE]; + strcpy (sBuff,request.toString(true).c_str()); + int len = strlen (sBuff); + int res = 0; + if ((res=sendBuffer(sBuff,len))==SUCCESS) { + res=receiveBuffer(rBuff,RECBUFFERSIZE); + } + if (res>0) { // operation was ok. + clearStatusField(CCommandLine::BUSY); + setStatusField(SUSPEND); + } + else if (res==FAIL) { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl,dummy,m_Error); + dummy.setCode(m_Error.getErrorCode()); + dummy.setDescription((const char*)m_Error.getDescription()); + m_Error.Reset(); + _THROW_EXCPT_FROM_EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CCommandLine::sendBackendCommand()"); + } + else if (res==WOULDBLOCK) { + _THROW_EXCPT(ComponentErrors::TimeoutExImpl,"CCommandLine::sendBackendCommand()"); + } + else { + _THROW_EXCPT(BackendsErrors::ConnectionExImpl,"CCommandLine::sendBackendCommand()"); + } + Message reply(string(rBuff, res), true); + try { + reply.validate(); + } + catch (BackendProtocolError& bpe) { + //TODO: somehow the reply is not valid + //we cannot proceed we need to throw an exception + _THROW_EXCPT(BackendsErrors::MalformedAnswerExImpl,"sendBackendCommand()"); + } + if(!(reply.is_valid_reply_for(request))) + { + //TODO: this answer is not valid for this request, throw exception + _THROW_EXCPT(BackendsErrors::ReplyNotValidExImpl,"sendBackendCommand()"); + } + if(!(reply.is_success_reply())) + { + //TODO: the reply has a FAIL o INVALID code, this must be + //managed + _EXCPT(BackendsErrors::BackendFailExImpl,impl,"sendBackendCommand()"); + //impl.setReason("transfer job cannot be resumed in present configuration"); + impl.setReason(reply.get_argument<string>(0).c_str()); + throw impl; + } + return reply; } //int CCommandLine::getConfiguration(char* configuration) -void CCommandLine::getConfiguration(char* configuration) +char* CCommandLine::getConfiguration() { Message request = Command::getConfiguration(); try { Message reply = sendBackendCommand(request); if(reply.is_success_reply()) { - strcpy(configuration, reply.get_argument<string>(0).c_str()); + return CORBA::string_dup(reply.get_argument<string>(0).c_str()); } } catch (...) { - } + + return CORBA::string_dup(""); } -int CCommandLine::getCommProtVersion(CORBA::String_out version) +char* CCommandLine::getCommProtVersion() { Message request = Command::version(); - Message reply = sendBackendCommand(request); - string _version = reply.get_argument<string>(0); - if(reply.is_success_reply()) - strcpy(version, _version.c_str()); - return _version.length(); + try + { + Message reply = sendBackendCommand(request); + if(reply.is_success_reply()) + { + return CORBA::string_dup(reply.get_argument<string>(0).c_str()); + } + } + catch(...) { + } + + return CORBA::string_dup(""); } bool CCommandLine::checkConnection() { - CError Tmp; - char sBuffer[RECBUFFERSIZE]; - int rBytes; - if (m_bTimedout) { // if a previous time out happend....try if the buffer has still to be received - rBytes=receiveBuffer(sBuffer,RECBUFFERSIZE); - if (rBytes==WOULDBLOCK) { // if the operation would have block again.....declare the disconnection - setStatus(NOTCNTD); // another timeout! something has happend - _IRA_LOGFILTER_LOG(LM_CRITICAL,"CCommandLine::checkConnection()","SOCKET_DISCONNECTED - timeout expired"); - } - else if (rBytes==FAIL) { - // Nothing to do, this error will be handled below.... - } - else if (rBytes==0) { - // Nothing to do, this error will be handled below.... - } - else { - m_bTimedout=false; // timeout recovered - } - } - if (getStatus()==CNTD) { - return true; - } - else if (getStatus()==CNTDING) { - return false; - } - else { // socket is not connected.... - // try to close the socket, if it is already closed : never known.... - Close(Tmp); - Tmp.Reset(); - m_bTimedout=false; - // this will create the socket in blocking mode..... - if (Create(Tmp,STREAM)==SUCCESS) { - // Put the socket in non-blocking mode, registers the onconnect event....and allow some seconds to complete! - if (EventSelect(Tmp,E_CONNECT,true,m_configuration->getConnectTimeout())==SUCCESS) { - OperationResult Res; - ACS_DEBUG("CCommandLine::checkConnection()","Trying to reconnect"); - Res=Connect(Tmp,m_configuration->getAddress(),m_configuration->getPort()); - if (Res==WOULDBLOCK) { - setStatus(CNTDING); - } - else if (Res==SUCCESS) { - setStatus(CNTD); - try { - //stopDataAcquisitionForced(); // ask the backend to exit the data transfering mode...... - } - catch (ACSErr::ACSbaseExImpl& ex) { - - } - clearStatusField(BUSY); - m_reiniting=true; - ACS_LOG(LM_FULL_INFO,"CCommandLine::checkConnection()",(LM_NOTICE,"SOCKET_RECONNECTED")); //we do not want to filter this info so no logfilter..... - return true; - } - } - } - return false; - } + CError Tmp; + char sBuffer[RECBUFFERSIZE]; + int rBytes; + if (m_bTimedout) { // if a previous time out happend....try if the buffer has still to be received + rBytes=receiveBuffer(sBuffer,RECBUFFERSIZE); + if (rBytes==WOULDBLOCK) { // if the operation would have block again.....declare the disconnection + setStatus(NOTCNTD); // another timeout! something has happend + _IRA_LOGFILTER_LOG(LM_CRITICAL,"CCommandLine::checkConnection()","SOCKET_DISCONNECTED - timeout expired"); + } + else if (rBytes==FAIL) { + // Nothing to do, this error will be handled below.... + } + else if (rBytes==0) { + // Nothing to do, this error will be handled below.... + } + else { + m_bTimedout=false; // timeout recovered + } + } + if (getStatus()==CNTD) { + return true; + } + else if (getStatus()==CNTDING) { + return false; + } + else { // socket is not connected.... + // try to close the socket, if it is already closed : never known.... + Close(Tmp); + Tmp.Reset(); + m_bTimedout=false; + // this will create the socket in blocking mode..... + if (Create(Tmp,STREAM)==SUCCESS) { + // Put the socket in non-blocking mode, registers the onconnect event....and allow some seconds to complete! + if (EventSelect(Tmp,E_CONNECT,true,m_configuration->getConnectTimeout())==SUCCESS) { + OperationResult Res; + ACS_DEBUG("CCommandLine::checkConnection()","Trying to reconnect"); + Res=Connect(Tmp,m_configuration->getAddress(),m_configuration->getPort()); + if (Res==WOULDBLOCK) { + setStatus(CNTDING); + } + else if (Res==SUCCESS) { + setStatus(CNTD); + try { + //stopDataAcquisitionForced(); // ask the backend to exit the data transfering mode...... + } + catch (ACSErr::ACSbaseExImpl& ex) { + + } + clearStatusField(BUSY); + m_reiniting=true; + ACS_LOG(LM_FULL_INFO,"CCommandLine::checkConnection()",(LM_NOTICE,"SOCKET_RECONNECTED")); //we do not want to filter this info so no logfilter..... + return true; + } + } + } + return false; + } } bool CCommandLine::initializeConfiguration(const IRA::CString & config) throw (ComponentErrors::CDBAccessExImpl) { - int i; - CConfiguration::TBackendSetup setup; - if (m_configuration->getSetupFromID(config,setup)) { // throw (ComponentErrors::CDBAccessExImpl) - m_sectionsNumber=setup.sections; - for (WORD k=0;k<MAX_BOARDS_NUMBER;k++) { - //m_defaultInput[k]=setup.inputPort[k]; - m_sections[k]=-1; - } - m_defaultInputSize=setup.inputPorts; // this should be 1 or the number of installed boards - m_beams=setup.beams; - m_calSwitchingEnabled=setup.calSwitchEnabled; - for (i=0;i<m_sectionsNumber;i++) { - m_boards[i]=setup.section_boards[i]; - m_sections[m_boards[i]]=i; - //m_input[i]=m_defaultInput[m_boards[i]]; - m_polarization[i]=setup.polarizations[i]; + int i; + CConfiguration::TBackendSetup setup; + if (m_configuration->getSetupFromID(config,setup)) { // throw (ComponentErrors::CDBAccessExImpl) + m_sectionsNumber=setup.sections; + for (WORD k=0;k<MAX_BOARDS_NUMBER;k++) { + //m_defaultInput[k]=setup.inputPort[k]; + m_sections[k]=-1; + } + m_defaultInputSize=setup.inputPorts; // this should be 1 or the number of installed boards + m_beams=setup.beams; + m_calSwitchingEnabled=setup.calSwitchEnabled; + for (i=0;i<m_sectionsNumber;i++) { + m_boards[i]=setup.section_boards[i]; + m_sections[m_boards[i]]=i; + //m_input[i]=m_defaultInput[m_boards[i]]; + m_polarization[i]=setup.polarizations[i]; //printf ("m_polarization = %d\n", m_polarization[i]); - m_ifNumber[i]=setup.ifs[i]; - m_feedNumber[i]=setup.feed[i]; - m_inputSection[i]=i; // input 0 belongs to section 0 and so on..... - m_attenuation[i]=setup.attenuation; - m_bandWidth[i]=setup.bandWidth; - m_bins[i]=setup.bins; - } - } - else { - return false; - } - - // Common configurations....... - m_integration=DEFAULT_INTEGRATION; // integration if by default zero...that means the 1/samplerate is the real integration time - m_currentSampleRate=m_integration; // this is given in milliseconds as sample period - m_sampleSize=SAMPLESIZE; - m_commonSampleRate=DEFAULT_SAMPLE_RATE; - m_calPeriod=DEFAULT_DIODE_SWITCH_PERIOD; - for (i=0;i<m_sectionsNumber;i++) { - m_sampleRate[i]=DEFAULT_SAMPLE_RATE; - m_frequency[i]=STARTFREQUENCY; - //m_bins[i]=BINSNUMBER; - m_enabled[i]=true; - m_tsys[i]=0.0; - m_KCratio[i]=1.0; - m_tpiZero[i]=0.0; - } - return true; + m_ifNumber[i]=setup.ifs[i]; + m_feedNumber[i]=setup.feed[i]; + m_inputSection[i]=i; // input 0 belongs to section 0 and so on..... + m_attenuation[i]=setup.attenuation; + m_bandWidth[i]=setup.bandWidth; + m_bins[i]=setup.bins; + } + } + else { + return false; + } + + // Common configurations....... + m_integration=DEFAULT_INTEGRATION; // integration if by default zero...that means the 1/samplerate is the real integration time + m_currentSampleRate=m_integration; // this is given in milliseconds as sample period + m_sampleSize=SAMPLESIZE; + m_commonSampleRate=DEFAULT_SAMPLE_RATE; + m_calPeriod=DEFAULT_DIODE_SWITCH_PERIOD; + for (i=0;i<m_sectionsNumber;i++) { + m_sampleRate[i]=DEFAULT_SAMPLE_RATE; + m_frequency[i]=STARTFREQUENCY-m_bandWidth[i]/2.; + //m_bins[i]=BINSNUMBER; + m_enabled[i]=true; + m_tsys[i]=0.0; + m_KCratio[i]=1.0; + m_tpiZero[i]=0.0; + } + return true; } void CCommandLine::setStatus(TLineStatus sta) { - m_status=sta; - if (m_status!=CNTD) { - setStatusField(CMDLINERROR); - } - else { - clearStatusField(CMDLINERROR); - } + m_status=sta; + if (m_status!=CNTD) { + setStatusField(CMDLINERROR); + } + else { + clearStatusField(CMDLINERROR); + } } diff --git a/Common/Servers/Skarab/src/Makefile b/Common/Servers/Skarab/src/Makefile index 931948bd8a89ac86255b1be9d6b07aec8b363658..63a54b2a0015bbe60da391e6ac79fb72c781a017 100644 --- a/Common/Servers/Skarab/src/Makefile +++ b/Common/Servers/Skarab/src/Makefile @@ -64,7 +64,9 @@ LIBRARIES_L = SkarabImpl_OBJECTS = SkarabImpl Configuration CommandLine SenderThread ControlThread Protocol SkarabImpl_LIBS = IRALibrary GenericBackendStubs SkarabStubs TotalPowerStubs ManagmentDefinitionsStubs ReceiversDefinitionsStubs BackendsDefinitionsStubs bulkDataStubs bulkDataSenderStubs GenericIFDistributorStubs\ bulkDataReceiverStubs ACSBulkDataError ComponentErrors BackendsErrors ParserErrors ManagementErrors \ - DiscosBackendProtocolLib DiscosVersion + DiscosBackendProtocolLib DiscosVersion \ + CommonReceiverInterfaceStubs ReceiversBossStubs GenericReceiverStubs \ + ManagmentDefinitionsStubs SchedulerStubs # # <brief description of lllll library> diff --git a/Common/Servers/Skarab/src/SenderThread.cpp b/Common/Servers/Skarab/src/SenderThread.cpp index e7ab900c64cb5b14a4c6633bc14f21fa2a466bca..46e71cc0aad9418ddf66de9d907bc9e3572621c8 100644 --- a/Common/Servers/Skarab/src/SenderThread.cpp +++ b/Common/Servers/Skarab/src/SenderThread.cpp @@ -61,7 +61,6 @@ void CSenderThread::closeSocket() void CSenderThread::runLoop() { IRA::CError err; - int res; IRA::CSecAreaResourceWrapper<CCommandLine> cmd=m_commandLine->Get(); if (cmd->m_reiniting) { cmd->m_reiniting=false; diff --git a/Common/Servers/Skarab/src/SkarabImpl.cpp b/Common/Servers/Skarab/src/SkarabImpl.cpp index d015b2b03f7b481289b24e3089a98bf4499eb0b8..992164439b7f258d04289f01ab7f208dd5aa3b8c 100644 --- a/Common/Servers/Skarab/src/SkarabImpl.cpp +++ b/Common/Servers/Skarab/src/SkarabImpl.cpp @@ -30,258 +30,260 @@ using namespace SimpleParser; _IRA_LOGFILTER_DECLARE; SkarabImpl::SkarabImpl(const ACE_CString &CompName,maci::ContainerServices *containerServices) : - BulkDataSenderDefaultImpl(CompName,containerServices), - m_ptime(this), - m_pbackendName(this), - m_pbandWidth(this), - m_pfrequency(this), - m_psampleRate(this), - m_pattenuation(this), - m_ppolarization(this), - m_pbins(this), - m_pinputsNumber(this), - m_pintegration(this), - m_pstatus(this), - m_pbusy(this), - m_pfeed(this), - m_ptsys(this), - m_psectionsNumber(this), - m_pinputSection(this) + BulkDataSenderDefaultImpl(CompName,containerServices), + m_ptime(this), + m_pbackendName(this), + m_pbandWidth(this), + m_pfrequency(this), + m_psampleRate(this), + m_pattenuation(this), + m_ppolarization(this), + m_pbins(this), + m_pinputsNumber(this), + m_pintegration(this), + m_pstatus(this), + m_pbusy(this), + m_pfeed(this), + m_ptsys(this), + m_psectionsNumber(this), + m_pinputSection(this) { - AUTO_TRACE("SkarabImpl::SkarabImpl"); - m_initialized=false; - m_senderThread=NULL; - m_controlThread=NULL; + AUTO_TRACE("SkarabImpl::SkarabImpl"); + m_initialized=false; + m_senderThread=NULL; + m_controlThread=NULL; } -SkarabImpl::~SkarabImpl() +SkarabImpl::~SkarabImpl() { - AUTO_TRACE("SkarabImpl::~SkarabImpl()"); - // if the initialization failed...clear everything as well. - // otherwise it is called by the cleanUp procedure. - if (!m_initialized) deleteAll(); + AUTO_TRACE("SkarabImpl::~SkarabImpl()"); + // if the initialization failed...clear everything as well. + // otherwise it is called by the cleanUp procedure. + if (!m_initialized) deleteAll(); } void SkarabImpl::initialize() throw (ACSErr::ACSbaseExImpl) { - CError Err; - CSenderThread::TSenderParameter threadPar; - CCommandLine* line; - //IRA::CString hostName,hostAddress; - AUTO_TRACE("SkarabImpl::initialize()"); - ACS_LOG(LM_FULL_INFO,"SkarabImpl::initialize()",(LM_INFO,"COMPSTATE_INITIALIZING")); - ACS_LOG(LM_FULL_INFO,"SkarabImpl::initialize()",(LM_INFO,"READING_CONFIGURATION")); - // could throw an ComponentErrors::CDBAccessExImpl exception - m_configuration.init(getContainerServices()); - ACS_LOG(LM_FULL_INFO,"SkarabImpl::initialize()",(LM_INFO,"CONFIGURATION_OK")); - ACS_LOG(LM_FULL_INFO,"SkarabImpl::initialize()",(LM_INFO,"INITIALIIZING_COMMUNICATION_LINES")); - _IRA_LOGFILTER_ACTIVATE(m_configuration.getRepetitionCacheTime(),m_configuration.getRepetitionExpireTime()); - try { - line=new CCommandLine(getContainerServices()); - m_commandLine=new CSecureArea<CCommandLine>(line); - } - catch (std::bad_alloc& ex) { - _EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"SkarabImpl::initialize()"); - throw dummy; - } - try { - m_ptime=new ROuLongLong(getContainerServices()->getName()+":time",getComponent(), - new DevIOTime(m_commandLine),true); - m_pbackendName=new ROstring(getContainerServices()->getName()+":backendName",getComponent()); - m_pbandWidth=new ROdoubleSeq(getContainerServices()->getName()+":bandWidth",getComponent(), - new DevIOBandWidth(m_commandLine),true); - m_pfrequency=new ROdoubleSeq(getContainerServices()->getName()+":frequency",getComponent(), - new DevIOFrequency(m_commandLine),true); - m_psampleRate=new ROdoubleSeq(getContainerServices()->getName()+":sampleRate",getComponent(), - new DevIOSampleRate(m_commandLine),true); - m_pattenuation=new ROdoubleSeq(getContainerServices()->getName()+":attenuation",getComponent(), - new DevIOAttenuation(m_commandLine),true); - m_ppolarization=new ROlongSeq(getContainerServices()->getName()+":polarization",getComponent(), - new DevIOPolarization(m_commandLine),true); - m_pinputsNumber=new ROlong(getContainerServices()->getName()+":inputsNumber",getComponent(), - new DevIOInputsNumber(m_commandLine),true); - m_pbins=new ROlongSeq(getContainerServices()->getName()+":bins",getComponent(), - new DevIOBins(m_commandLine),true); - m_pintegration=new ROlong(getContainerServices()->getName()+":integration",getComponent(), - new DevIOIntegration(m_commandLine),false); - m_pstatus=new ROpattern(getContainerServices()->getName()+":status",getComponent(), - new DevIOStatus(m_commandLine),true); - m_pbusy=new ROEnumImpl<ACS_ENUM_T(Management::TBoolean),POA_Management::ROTBoolean> - (getContainerServices()->getName()+":busy",getComponent(), new DevIOBusy(m_commandLine),true); - m_pfeed=new ROlongSeq(getContainerServices()->getName()+":feed",getComponent(),new DevIOFeed(m_commandLine),true); - m_ptsys=new ROdoubleSeq(getContainerServices()->getName()+":systemTemperature",getComponent(),new DevIOTsys(m_commandLine),true); - m_psectionsNumber=new ROlong(getContainerServices()->getName()+":sectionsNumber",getComponent(), - new DevIOSectionsNumber(m_commandLine),true); - m_pinputSection=new ROlongSeq(getContainerServices()->getName()+":inputSection",getComponent(),new DevIOInputSection(m_commandLine),true); - m_parser=new CParser<CCommandLine>(line,10); - } - catch (std::bad_alloc& ex) { - _EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"SkarabImpl::initialize()"); - throw dummy; - } - // command parser configuration - m_parser->add("integration",new function1<CCommandLine,non_constant,void_type,I<long_type> >(line,&CCommandLine::setIntegration),1); - m_parser->add("calSwitch",new function1<CCommandLine,non_constant,void_type,I<long_type> >(line,&CCommandLine::activateCalSwitching),1 ); - m_parser->add("setSection", new function7<CCommandLine,non_constant,void_type,I<long_type>,I<double_type>,I<double_type>,I<long_type>,I<enum_type<PolarizationToString> >,I<double_type>,I<long_type> > - (line,&CCommandLine::setConfiguration),7 ); - m_parser->add("setAttenuation", new function2<CCommandLine,non_constant,void_type,I<long_type>,I<double_type> >(line,&CCommandLine::setAttenuation),2 ); - m_parser->add("enable",new function1<CCommandLine,non_constant,void_type,I<longSeq_type> >(line,&CCommandLine::setEnabled),1 ); - m_parser->add("getIntegration",new function1<CCommandLine,constant,void_type,O<long_type> >(line,&CCommandLine::getIntegration),0 ); - m_parser->add("getFrequency",new function1<CCommandLine,constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getFrequency),0 ); - m_parser->add("getSampleRate",new function1<CCommandLine,constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getSampleRate),0 ); - m_parser->add("getBins",new function1<CCommandLine,constant,void_type,O<longSeq_type> >(line,&CCommandLine::getBins),0 ); - m_parser->add("getPolarization",new function1<CCommandLine,constant,void_type,O<longSeq_type> >(line,&CCommandLine::getPolarization),0 ); - m_parser->add("getBandWidth",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getBandWidth),0 ); - m_parser->add("getAttenuation",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getAttenuation),0 ); - m_parser->add("getTpi",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getTpi),0 ); - m_parser->add("getZero",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getZero),0 ); - m_parser->add("getTime",new function1<CCommandLine,non_constant,void_type,O<time_type> >(line,&CCommandLine::getTime),0 ); - m_parser->add("initialize",new function1<CCommandLine,non_constant,void_type,I<string_type> >(line,&CCommandLine::setup),1 ); - m_parser->add("getRms",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getRms),0 ); - m_parser->add("setTsysRange", new function2<CCommandLine,non_constant,void_type,I<double_type>,I<double_type> >(line,&CCommandLine::setTsysRange),2 ); - - threadPar.sender=this; - threadPar.command=m_commandLine; - threadPar.configuration=&m_configuration; - //threadPar.dataLine=&m_dataLine; - try { - CSenderThread::TSenderParameter *temp=&threadPar; - m_senderThread=getContainerServices()->getThreadManager()->create<CSenderThread,CSenderThread::TSenderParameter*> ( - "DATAPUSHER",temp,m_configuration.getSenderResponseTime()*10,m_configuration.getSenderSleepTime()*10); - m_controlThread=getContainerServices()->getThreadManager()->create<CControlThread,CSecureArea<CCommandLine> * > ( - "SUPERVISOR",m_commandLine,m_configuration.getControlResponseTime()*10,m_configuration.getControlSleepTime()*10); - } - catch (acsthreadErrType::acsthreadErrTypeExImpl& ex) { - _ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl,_dummy,ex,"SkarabImpl::initialize()"); - throw _dummy; - } - catch (...) { - _THROW_EXCPT(ComponentErrors::UnexpectedExImpl,"SkarabImpl::initialize()"); - } - m_initialized=true; - ACS_LOG(LM_FULL_INFO,"SkarabImpl::initialize()",(LM_INFO,"COMPSTATE_INITIALIZED")); + CError Err; + CSenderThread::TSenderParameter threadPar; + CCommandLine* line; + //IRA::CString hostName,hostAddress; + AUTO_TRACE("SkarabImpl::initialize()"); + ACS_LOG(LM_FULL_INFO,"SkarabImpl::initialize()",(LM_INFO,"COMPSTATE_INITIALIZING")); + ACS_LOG(LM_FULL_INFO,"SkarabImpl::initialize()",(LM_INFO,"READING_CONFIGURATION")); + // could throw an ComponentErrors::CDBAccessExImpl exception + m_configuration.init(getContainerServices()); + ACS_LOG(LM_FULL_INFO,"SkarabImpl::initialize()",(LM_INFO,"CONFIGURATION_OK")); + ACS_LOG(LM_FULL_INFO,"SkarabImpl::initialize()",(LM_INFO,"INITIALIIZING_COMMUNICATION_LINES")); + _IRA_LOGFILTER_ACTIVATE(m_configuration.getRepetitionCacheTime(),m_configuration.getRepetitionExpireTime()); + try { + line=new CCommandLine(getContainerServices()); + m_commandLine=new CSecureArea<CCommandLine>(line); + } + catch (std::bad_alloc& ex) { + _EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"SkarabImpl::initialize()"); + throw dummy; + } + try { + m_ptime=new ROuLongLong(getContainerServices()->getName()+":time",getComponent(), + new DevIOTime(m_commandLine),true); + m_pbackendName=new ROstring(getContainerServices()->getName()+":backendName",getComponent()); + m_pbandWidth=new ROdoubleSeq(getContainerServices()->getName()+":bandWidth",getComponent(), + new DevIOBandWidth(m_commandLine),true); + m_pfrequency=new ROdoubleSeq(getContainerServices()->getName()+":frequency",getComponent(), + new DevIOFrequency(m_commandLine),true); + m_psampleRate=new ROdoubleSeq(getContainerServices()->getName()+":sampleRate",getComponent(), + new DevIOSampleRate(m_commandLine),true); + m_pattenuation=new ROdoubleSeq(getContainerServices()->getName()+":attenuation",getComponent(), + new DevIOAttenuation(m_commandLine),true); + m_ppolarization=new ROlongSeq(getContainerServices()->getName()+":polarization",getComponent(), + new DevIOPolarization(m_commandLine),true); + m_pinputsNumber=new ROlong(getContainerServices()->getName()+":inputsNumber",getComponent(), + new DevIOInputsNumber(m_commandLine),true); + m_pbins=new ROlongSeq(getContainerServices()->getName()+":bins",getComponent(), + new DevIOBins(m_commandLine),true); + m_pintegration=new ROlong(getContainerServices()->getName()+":integration",getComponent(), + new DevIOIntegration(m_commandLine),false); + m_pstatus=new ROpattern(getContainerServices()->getName()+":status",getComponent(), + new DevIOStatus(m_commandLine),true); + m_pbusy=new ROEnumImpl<ACS_ENUM_T(Management::TBoolean),POA_Management::ROTBoolean> + (getContainerServices()->getName()+":busy",getComponent(), new DevIOBusy(m_commandLine),true); + m_pfeed=new ROlongSeq(getContainerServices()->getName()+":feed",getComponent(),new DevIOFeed(m_commandLine),true); + m_ptsys=new ROdoubleSeq(getContainerServices()->getName()+":systemTemperature",getComponent(),new DevIOTsys(m_commandLine),true); + m_psectionsNumber=new ROlong(getContainerServices()->getName()+":sectionsNumber",getComponent(), + new DevIOSectionsNumber(m_commandLine),true); + m_pinputSection=new ROlongSeq(getContainerServices()->getName()+":inputSection",getComponent(),new DevIOInputSection(m_commandLine),true); + m_parser=new CParser<CCommandLine>(line,10); + } + catch (std::bad_alloc& ex) { + _EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"SkarabImpl::initialize()"); + throw dummy; + } + // command parser configuration + m_parser->add("integration",new function1<CCommandLine,non_constant,void_type,I<long_type> >(line,&CCommandLine::setIntegration),1); + m_parser->add("calSwitch",new function1<CCommandLine,non_constant,void_type,I<long_type> >(line,&CCommandLine::activateCalSwitching),1 ); + m_parser->add("setSection", new function7<CCommandLine,non_constant,void_type,I<long_type>,I<double_type>,I<double_type>,I<long_type>,I<enum_type<PolarizationToString> >,I<double_type>,I<long_type> > + (line,&CCommandLine::setConfiguration),7 ); + m_parser->add("setAttenuation", new function2<CCommandLine,non_constant,void_type,I<long_type>,I<double_type> >(line,&CCommandLine::setAttenuation),2 ); + m_parser->add("enable",new function1<CCommandLine,non_constant,void_type,I<longSeq_type> >(line,&CCommandLine::setEnabled),1 ); + m_parser->add("getIntegration",new function1<CCommandLine,constant,void_type,O<long_type> >(line,&CCommandLine::getIntegration),0 ); + m_parser->add("getFrequency",new function1<CCommandLine,constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getFrequency),0 ); + m_parser->add("getSampleRate",new function1<CCommandLine,constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getSampleRate),0 ); + m_parser->add("getBins",new function1<CCommandLine,constant,void_type,O<longSeq_type> >(line,&CCommandLine::getBins),0 ); + m_parser->add("getPolarization",new function1<CCommandLine,constant,void_type,O<longSeq_type> >(line,&CCommandLine::getPolarization),0 ); + m_parser->add("getBandWidth",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getBandWidth),0 ); + m_parser->add("getAttenuation",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getAttenuation),0 ); + m_parser->add("getTpi",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getTpi),0 ); + m_parser->add("getZero",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getZero),0 ); + m_parser->add("getTime",new function1<CCommandLine,non_constant,void_type,O<time_type> >(line,&CCommandLine::getTime),0 ); + m_parser->add("initialize",new function1<CCommandLine,non_constant,void_type,I<string_type> >(line,&CCommandLine::setup),1 ); + m_parser->add("getRms",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getRms),0 ); + m_parser->add("setTsysRange", new function2<CCommandLine,non_constant,void_type,I<double_type>,I<double_type> >(line,&CCommandLine::setTsysRange),2 ); + m_parser->add("backendPark", new function0<CCommandLine,non_constant, void_type>(line,&CCommandLine::backendPark),0 ); + m_parser->add("setShift",new function1<CCommandLine,non_constant,void_type,I<long_type> >(line,&CCommandLine::setShift),1); + + threadPar.sender=this; + threadPar.command=m_commandLine; + threadPar.configuration=&m_configuration; + //threadPar.dataLine=&m_dataLine; + try { + CSenderThread::TSenderParameter *temp=&threadPar; + m_senderThread=getContainerServices()->getThreadManager()->create<CSenderThread,CSenderThread::TSenderParameter*> ( + "DATAPUSHER",temp,m_configuration.getSenderResponseTime()*10,m_configuration.getSenderSleepTime()*10); + m_controlThread=getContainerServices()->getThreadManager()->create<CControlThread,CSecureArea<CCommandLine> * > ( + "SUPERVISOR",m_commandLine,m_configuration.getControlResponseTime()*10,m_configuration.getControlSleepTime()*10); + } + catch (acsthreadErrType::acsthreadErrTypeExImpl& ex) { + _ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl,_dummy,ex,"SkarabImpl::initialize()"); + throw _dummy; + } + catch (...) { + _THROW_EXCPT(ComponentErrors::UnexpectedExImpl,"SkarabImpl::initialize()"); + } + m_initialized=true; + ACS_LOG(LM_FULL_INFO,"SkarabImpl::initialize()",(LM_INFO,"COMPSTATE_INITIALIZED")); } void SkarabImpl::execute() throw (ACSErr::ACSbaseExImpl) { - AUTO_TRACE("SkarabImpl::execute()"); - ACS::Time time; - IRA::CError error; - ACS_LOG(LM_FULL_INFO,"SkarabImpl::execute()",(LM_INFO,"BACKEND_INITIAL_CONFIGURATION")); - try { - //sets the property defaults....some of them cannot be changed any more (hardware dependent) - m_pbackendName->getDevIO()->write(getComponent()->getName(),time); - } - catch (ACSErr::ACSbaseExImpl& ex) { - _ADD_BACKTRACE(ComponentErrors::InitializationProblemExImpl,impl,ex,"SkarabImpl::execute()"); - throw impl; - } - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - ACS_LOG(LM_FULL_INFO,"SkarabImpl::execute()",(LM_INFO,"SOCKET_CONNECTING")); - try { - ACS_LOG(LM_FULL_INFO,"SkarabImpl::execute()",(LM_INFO,"HARDWARE_INITIALIZATION")); - line->Init(&m_configuration); // this could throw an ACS exception..... - //line->setTime(); // this could throw ACS exceptions.... - } - catch (ACSErr::ACSbaseExImpl& ex) { - deleteAll(); - throw ex; - } - //resume the threads - //m_senderThread->resume(); - //m_controlThread->resume(); - try { - startPropertiesMonitoring(); - } - catch (acsthreadErrType::CanNotStartThreadExImpl& E) { - _ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl,__dummy,E,"SkarabImpl::execute"); - deleteAll(); - throw __dummy; - } - catch (ACSErrTypeCommon::NullPointerExImpl& E) { - _ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl,__dummy,E,"SkarabImpl::execute"); - deleteAll(); - throw __dummy; - } - ACS_LOG(LM_FULL_INFO,"SkarabImpl::execute()",(LM_INFO,"COMPSTATE_OPERATIONAL")); + AUTO_TRACE("SkarabImpl::execute()"); + ACS::Time time; + IRA::CError error; + ACS_LOG(LM_FULL_INFO,"SkarabImpl::execute()",(LM_INFO,"BACKEND_INITIAL_CONFIGURATION")); + try { + //sets the property defaults....some of them cannot be changed any more (hardware dependent) + m_pbackendName->getDevIO()->write(getComponent()->getName(),time); + } + catch (ACSErr::ACSbaseExImpl& ex) { + _ADD_BACKTRACE(ComponentErrors::InitializationProblemExImpl,impl,ex,"SkarabImpl::execute()"); + throw impl; + } + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + ACS_LOG(LM_FULL_INFO,"SkarabImpl::execute()",(LM_INFO,"SOCKET_CONNECTING")); + try { + ACS_LOG(LM_FULL_INFO,"SkarabImpl::execute()",(LM_INFO,"HARDWARE_INITIALIZATION")); + line->Init(&m_configuration); // this could throw an ACS exception..... + //line->setTime(); // this could throw ACS exceptions.... + } + catch (ACSErr::ACSbaseExImpl& ex) { + deleteAll(); + throw ex; + } + //resume the threads + //m_senderThread->resume(); + //m_controlThread->resume(); + try { + startPropertiesMonitoring(); + } + catch (acsthreadErrType::CanNotStartThreadExImpl& E) { + _ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl,__dummy,E,"SkarabImpl::execute"); + deleteAll(); + throw __dummy; + } + catch (ACSErrTypeCommon::NullPointerExImpl& E) { + _ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl,__dummy,E,"SkarabImpl::execute"); + deleteAll(); + throw __dummy; + } + ACS_LOG(LM_FULL_INFO,"SkarabImpl::execute()",(LM_INFO,"COMPSTATE_OPERATIONAL")); } void SkarabImpl::deleteAll() { - IRA::CError err; - if (m_initialized) { - if (m_senderThread!=NULL) { - m_senderThread->suspend(); - } - if (m_controlThread!=NULL) { - m_controlThread->suspend(); - } - if (m_commandLine) { - delete m_commandLine; - m_commandLine=NULL; - } - if (m_senderThread!=NULL) { - getContainerServices()->getThreadManager()->destroy(m_senderThread); - m_senderThread=NULL; - } - if (m_controlThread!=NULL) { - getContainerServices()->getThreadManager()->destroy(m_controlThread); - m_senderThread=NULL; - } - if (m_parser) { - delete m_parser; - m_parser=NULL; - } - // need to be closed before the thread that makes use of it - // m_dataLine.Close(err); - // ACS_LOG(LM_FULL_INFO,"SkarabImpl::deleteAll()",(LM_INFO,"DATA_LINE_CLOSED")); - _IRA_LOGFILTER_FLUSH; - _IRA_LOGFILTER_DESTROY; - ACS_LOG(LM_FULL_INFO,"SkarabImpl::deleteAll()",(LM_INFO,"LOGS_FLUSHED")); - m_initialized=false; - } + IRA::CError err; + if (m_initialized) { + if (m_senderThread!=NULL) { + m_senderThread->suspend(); + } + if (m_controlThread!=NULL) { + m_controlThread->suspend(); + } + if (m_commandLine) { + delete m_commandLine; + m_commandLine=NULL; + } + if (m_senderThread!=NULL) { + getContainerServices()->getThreadManager()->destroy(m_senderThread); + m_senderThread=NULL; + } + if (m_controlThread!=NULL) { + getContainerServices()->getThreadManager()->destroy(m_controlThread); + m_senderThread=NULL; + } + if (m_parser) { + delete m_parser; + m_parser=NULL; + } + // need to be closed before the thread that makes use of it + // m_dataLine.Close(err); + // ACS_LOG(LM_FULL_INFO,"SkarabImpl::deleteAll()",(LM_INFO,"DATA_LINE_CLOSED")); + _IRA_LOGFILTER_FLUSH; + _IRA_LOGFILTER_DESTROY; + ACS_LOG(LM_FULL_INFO,"SkarabImpl::deleteAll()",(LM_INFO,"LOGS_FLUSHED")); + m_initialized=false; + } } void SkarabImpl::cleanUp() { - AUTO_TRACE("SkarabImpl::cleanUp()"); - stopPropertiesMonitoring(); - deleteAll(); - CharacteristicComponentImpl::cleanUp(); + AUTO_TRACE("SkarabImpl::cleanUp()"); + stopPropertiesMonitoring(); + deleteAll(); + CharacteristicComponentImpl::cleanUp(); } void SkarabImpl::aboutToAbort() { - AUTO_TRACE("SkarabImpl::aboutToAbort()"); - deleteAll(); + AUTO_TRACE("SkarabImpl::aboutToAbort()"); + deleteAll(); } -void SkarabImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, - ComponentErrors::ComponentErrorsEx) +void SkarabImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, + ComponentErrors::ComponentErrorsEx) { - AUTO_TRACE("SkarabImpl::sendHeader()"); - Backends::TMainHeader header; - Backends::TSectionHeader chHeader[MAX_SECTION_NUMBER]; - //DWORD tpi[MAX_SECTION_NUMBER]; - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - line->fillMainHeader(header); - line->fillChannelHeader(chHeader,MAX_SECTION_NUMBER); - /*try { - line->setTime(); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendHeader()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::sendHeader()"); + Backends::TMainHeader header; + Backends::TSectionHeader chHeader[MAX_SECTION_NUMBER]; + //DWORD tpi[MAX_SECTION_NUMBER]; + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + line->fillMainHeader(header); + line->fillChannelHeader(chHeader,MAX_SECTION_NUMBER); + /*try { + line->setTime(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendHeader()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } */ char buffer[sizeof(Backends::TMainHeader)+header.sections*sizeof(Backends::TSectionHeader)]; @@ -289,562 +291,608 @@ void SkarabImpl::sendHeader() throw (CORBA::SystemException, BackendsErrors::Bac memcpy(buffer,(void *)&header,sizeof(Backends::TMainHeader)); memcpy(buffer+sizeof(Backends::TMainHeader),(void *)chHeader,header.sections*sizeof(Backends::TSectionHeader)); - #ifndef BKD_DEBUG - try { - getSender()->startSend(FLOW_NUMBER,(const char*)buffer, - sizeof(Backends::TMainHeader)+header.sections*sizeof(Backends::TSectionHeader)); - } - catch (AVStartSendErrorExImpl& ex) { - _ADD_BACKTRACE(BackendsErrors::TXErrorExImpl,impl,ex,"SkarabImpl::sendHeader()"); - impl.setDetails("main header could not be sent"); - impl.log(LM_DEBUG); - throw impl.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"SkarabImpl::sendHeader()"); - impl.log(LM_DEBUG); - throw impl.getComponentErrorsEx(); - } - #else - /*printf("Sects: %d beams: %d integration: %d sampleSize: %d\n",header.sections,header.beams, - header.integration,header.sampleSize); - for(int h=0;h<header.sections;h++) { - printf("id: %d bins: %d pol: %d bw: %lf freq: %lf att L: %lf att R: %lf sr: %lf feed: %d\n", - chHeader[h].id, - chHeader[h].bins, - chHeader[h].polarization, - chHeader[h].bandWidth, - chHeader[h].frequency, - chHeader[h].attenuation[0], - chHeader[h].attenuation[1], - chHeader[h].sampleRate, - chHeader[h].feed); - }*/ - #endif - ACS_LOG(LM_FULL_INFO,"SkarabImpl::sendHeader()",(LM_INFO,"HEADERS_SENT")); - // inform the sender thread about the configuration...... - m_senderThread->saveDataHeader(&header,chHeader); - // measure the zero tpi - #ifndef BKD_DEBUG - /*try { - //line->getZeroTPI(tpi); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendHeader()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - }*/ - #else - //for(int i=0;i<MAX_INPUT_NUMBER;tpi[i]=0,i++); - #endif - // now comunicate the reading to the sender thread..... - //m_senderThread->saveZero(tpi); - // start the job for the backend..... - try { - line->startDataAcquisition(); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendHeader()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + #ifndef BKD_DEBUG + try { + getSender()->startSend(FLOW_NUMBER,(const char*)buffer, + sizeof(Backends::TMainHeader)+header.sections*sizeof(Backends::TSectionHeader)); + } + catch (AVStartSendErrorExImpl& ex) { + _ADD_BACKTRACE(BackendsErrors::TXErrorExImpl,impl,ex,"SkarabImpl::sendHeader()"); + impl.setDetails("main header could not be sent"); + impl.log(LM_DEBUG); + throw impl.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"SkarabImpl::sendHeader()"); + impl.log(LM_DEBUG); + throw impl.getComponentErrorsEx(); + } + #else + /*printf("Sects: %d beams: %d integration: %d sampleSize: %d\n",header.sections,header.beams, + header.integration,header.sampleSize); + for(int h=0;h<header.sections;h++) { + printf("id: %d bins: %d pol: %d bw: %lf freq: %lf att L: %lf att R: %lf sr: %lf feed: %d\n", + chHeader[h].id, + chHeader[h].bins, + chHeader[h].polarization, + chHeader[h].bandWidth, + chHeader[h].frequency, + chHeader[h].attenuation[0], + chHeader[h].attenuation[1], + chHeader[h].sampleRate, + chHeader[h].feed); + }*/ + #endif + ACS_LOG(LM_FULL_INFO,"SkarabImpl::sendHeader()",(LM_INFO,"HEADERS_SENT")); + // inform the sender thread about the configuration...... + m_senderThread->saveDataHeader(&header,chHeader); + // measure the zero tpi + #ifndef BKD_DEBUG + /*try { + //line->getZeroTPI(tpi); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendHeader()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + }*/ + #else + //for(int i=0;i<MAX_INPUT_NUMBER;tpi[i]=0,i++); + #endif + // now comunicate the reading to the sender thread..... + //m_senderThread->saveZero(tpi); + // start the job for the backend..... + try { + line->startDataAcquisition(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendHeader()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } void SkarabImpl::terminate() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, - ComponentErrors::ComponentErrorsEx) + ComponentErrors::ComponentErrorsEx) { - AUTO_TRACE("SkarabImpl::terminate()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->stopDataAcquisition(); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::terminate()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::terminate()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->stopDataAcquisition(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::terminate()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } +} + +void SkarabImpl::endSchedule() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, + ComponentErrors::ComponentErrorsEx) +{ + AUTO_TRACE("SkarabImpl::endSchedule()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->endSchedule(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::endSchedule()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } void SkarabImpl::sendData(ACS::Time startTime) throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, - ComponentErrors::ComponentErrorsEx) + ComponentErrors::ComponentErrorsEx) { - AUTO_TRACE("SkarabImpl::sendData()"); - - TIMEVALUE now; - ACS::Time expectedStartTime; - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - expectedStartTime=line->resumeDataAcquisition(startTime); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendData()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } - // if the resume succeeds....than set the start time accordingly. - //I explicitly release the mutex before accessing the sender thread because it also make use of the command line...just to make sure to avoid deadlock - line.Release(); - m_senderThread->saveStartTime(expectedStartTime); - //m_senderThread->resumeTransfer(); + AUTO_TRACE("SkarabImpl::sendData()"); + + TIMEVALUE now; + ACS::Time expectedStartTime; + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + expectedStartTime=line->resumeDataAcquisition(startTime); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendData()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } + // if the resume succeeds....than set the start time accordingly. + //I explicitly release the mutex before accessing the sender thread because it also make use of the command line...just to make sure to avoid deadlock + line.Release(); + m_senderThread->saveStartTime(expectedStartTime); + //m_senderThread->resumeTransfer(); } void SkarabImpl::sendStop() throw (CORBA::SystemException, BackendsErrors::BackendsErrorsEx, - ComponentErrors::ComponentErrorsEx) + ComponentErrors::ComponentErrorsEx) { - - AUTO_TRACE("SkarabImpl::sendStop()"); - - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->suspendDataAcquisition(); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendStop()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } - //I explicity release the mutex before accessing the sender thread because it also make use of the command line...just to make sure to avoid deadlock - //line.Release(); - //m_senderThread->suspendTransfer(); - - try { - getSender()->stopSend(FLOW_NUMBER); - } - catch (AVStopSendErrorExImpl& ex) { - _ADD_BACKTRACE(BackendsErrors::TXErrorExImpl,impl,ex,"SkarabImpl::sendStop()"); - impl.setDetails("stop message could not be sent"); - throw impl.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"SkarabImpl::sendStop()"); - throw impl.getComponentErrorsEx(); - } + + AUTO_TRACE("SkarabImpl::sendStop()"); + + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->suspendDataAcquisition(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendStop()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } + //I explicity release the mutex before accessing the sender thread because it also make use of the command line...just to make sure to avoid deadlock + //line.Release(); + //m_senderThread->suspendTransfer(); + + try { + getSender()->stopSend(FLOW_NUMBER); + } + catch (AVStopSendErrorExImpl& ex) { + _ADD_BACKTRACE(BackendsErrors::TXErrorExImpl,impl,ex,"SkarabImpl::sendStop()"); + impl.setDetails("stop message could not be sent"); + throw impl.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,impl,"SkarabImpl::sendStop()"); + throw impl.getComponentErrorsEx(); + } try { - line->sendTargetFileName(); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendStop()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + line->sendTargetFileName(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::sendStop()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } void SkarabImpl::setSection(CORBA::Long input,CORBA::Double freq,CORBA::Double bw,CORBA::Long feed,CORBA::Long pol,CORBA::Double sr,CORBA::Long bins) throw ( - CORBA::SystemException,ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) + CORBA::SystemException,ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::setSection()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->setConfiguration(input,freq,bw,feed,pol,sr,bins); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setSection()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::setSection()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->setConfiguration(input,freq,bw,feed,pol,sr,bins); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setSection()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } void SkarabImpl::setTargetFileName (const char * fileName) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx, - BackendsErrors::BackendsErrorsEx) + BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::setTargetFileName()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + AUTO_TRACE("SkarabImpl::setTargetFileName()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - line->setTargetFileName(fileName); + line->setTargetFileName(fileName); } ACS::doubleSeq *SkarabImpl::getRms() throw (CORBA::SystemException, - ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) + ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::getRms()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - ACS::doubleSeq_var rms=new ACS::doubleSeq; - try { - line->getRms(rms); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::getRms()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } - return rms._retn(); + AUTO_TRACE("SkarabImpl::getRms()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + ACS::doubleSeq_var rms=new ACS::doubleSeq; + try { + line->getRms(rms); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::getRms()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } + return rms._retn(); } ACS::doubleSeq *SkarabImpl::getTpi() throw (CORBA::SystemException, - ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) + ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::getTpi()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - ACS::doubleSeq_var tpi=new ACS::doubleSeq; - try { - line->getSample(tpi,false); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::getTpi()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } - return tpi._retn(); + AUTO_TRACE("SkarabImpl::getTpi()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + ACS::doubleSeq_var tpi=new ACS::doubleSeq; + try { + line->getSample(tpi,false); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::getTpi()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } + return tpi._retn(); } ACS::doubleSeq * SkarabImpl::getZero () throw (CORBA::SystemException, - ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) + ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::getZero()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - ACS::doubleSeq_var tpi=new ACS::doubleSeq; + AUTO_TRACE("SkarabImpl::getZero()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + ACS::doubleSeq_var tpi=new ACS::doubleSeq; //TODO: how many sections???? //tpi->length(2); - try { - line->getSample(tpi,true); + try { + line->getSample(tpi,true); //tpi[0]=0.0; //tpi[1]=0.0; - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::getZero()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } - return tpi._retn(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::getZero()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } + return tpi._retn(); } void SkarabImpl::setKelvinCountsRatio(const ACS::doubleSeq& ratio, const ACS::doubleSeq& tsys) throw (CORBA::SystemException) { - AUTO_TRACE("SkarabImpl::setKelvinCountsRatio()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - line->saveTsys(tsys,ratio); - //if (m_senderThread) { - //m_senderThread->setKelvinCountsRatio(ratio); - //ACS_LOG(LM_FULL_INFO,"SkarabImpl::setKelvinCountsRatio()",(LM_INFO,"KELVIN_COUNTS_CONVERSION_FACTOR_SET")); - //} + AUTO_TRACE("SkarabImpl::setKelvinCountsRatio()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + line->saveTsys(tsys,ratio); + //if (m_senderThread) { + //m_senderThread->setKelvinCountsRatio(ratio); + //ACS_LOG(LM_FULL_INFO,"SkarabImpl::setKelvinCountsRatio()",(LM_INFO,"KELVIN_COUNTS_CONVERSION_FACTOR_SET")); + //} } void SkarabImpl::enableChannels(const ACS::longSeq& enable) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx, - BackendsErrors::BackendsErrorsEx) + BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::enableChannels()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->setEnabled(enable); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::enableChannels()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::enableChannels()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->setEnabled(enable); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::enableChannels()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } void SkarabImpl::setTime() throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx, - BackendsErrors::BackendsErrorsEx) + BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::setTime()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->setTime(); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setTime()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::setTime()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->setTime(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setTime()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } void SkarabImpl::setAttenuation(CORBA::Long input,CORBA::Double att) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::setAttenutation()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->setAttenuation(input,att); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setAttenutation()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::setAttenutation()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->setAttenuation(input,att); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setAttenutation()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } void SkarabImpl::setTsysRange(CORBA::Double freq,CORBA::Double bw) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::setTsysRange()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->setTsysRange(freq,bw); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setTsysRange()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::setTsysRange()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->setTsysRange(freq,bw); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setTsysRange()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } CORBA::Long SkarabImpl::getInputs(ACS::doubleSeq_out freq,ACS::doubleSeq_out bandWidth,ACS::longSeq_out feed,ACS::longSeq_out ifNumber) throw (CORBA::SystemException, - ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) + ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { - long inputs; - ACS::longSeq pol; - AUTO_TRACE("SkarabImpl::getInputs()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - //no need to take care of freeing allocated memory in case of exception because there are no except........ - freq=new ACS::doubleSeq; - bandWidth=new ACS::doubleSeq; - feed=new ACS::longSeq; - ifNumber=new ACS::longSeq; - line->getFeed(*feed); - line->getFrequency(*freq); - line->getInputsNumber(inputs); - line->getBandWidth(*bandWidth); - line->getIFs(*ifNumber); - return inputs; + long inputs; + ACS::longSeq pol; + AUTO_TRACE("SkarabImpl::getInputs()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + //no need to take care of freeing allocated memory in case of exception because there are no except........ + freq=new ACS::doubleSeq; + bandWidth=new ACS::doubleSeq; + feed=new ACS::longSeq; + ifNumber=new ACS::longSeq; + line->getFeed(*feed); + line->getFrequency(*freq); + line->getInputsNumber(inputs); + line->getBandWidth(*bandWidth); + line->getIFs(*ifNumber); + return inputs; } void SkarabImpl::activateNoiseCalibrationSwitching(CORBA::Long interleave) throw (CORBA::SystemException, - ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) + ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::activateNoiseCalibrationSwitching()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->activateCalSwitching(interleave); // NOT YET AVAILABLE - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::activateNoiseCalibrationSwitching()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::activateNoiseCalibrationSwitching()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->activateCalSwitching(interleave); // NOT YET AVAILABLE + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::activateNoiseCalibrationSwitching()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } void SkarabImpl::initialize(const char * configuration) throw (CORBA::SystemException, - ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) + ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::initialize()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->setup(configuration); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::initialize()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::initialize()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->setup(configuration); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::initialize()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } void SkarabImpl::setIntegration(CORBA::Long Integration) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx, - BackendsErrors::BackendsErrorsEx) + BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::setIntegration()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->setIntegration(Integration); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setIntegration()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::setIntegration()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->setIntegration(Integration); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setIntegration()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } -void SkarabImpl::getConfiguration (CORBA::String_out configuration) throw (CORBA::SystemException) +void SkarabImpl::setShift(CORBA::Long Shift) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx, + BackendsErrors::BackendsErrorsEx) { - AUTO_TRACE("SkarabImpl::getIntegration()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->getConfiguration(configuration); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::getConfiguration()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::setShift()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + line->setShift(Shift); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::setShift()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } -void SkarabImpl::getCommProtVersion (CORBA::String_out version) throw (CORBA::SystemException) +char* SkarabImpl::getConfiguration() throw (CORBA::SystemException) { - AUTO_TRACE("SkarabImpl::getCommProtVersion()"); - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - line->getCommProtVersion(version); - } - catch (ComponentErrors::ComponentErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getComponentErrorsEx(); - } - catch (BackendsErrors::BackendsErrorsExImpl& ex) { - ex.log(LM_DEBUG); - throw ex.getBackendsErrorsEx(); - } - catch (...) { - _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::getCommProtVersion()"); - dummy.log(LM_DEBUG); - throw dummy.getComponentErrorsEx(); - } + AUTO_TRACE("SkarabImpl::getIntegration()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + return line->getConfiguration(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::getConfiguration()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } +} + +char* SkarabImpl::getCommProtVersion() throw (CORBA::SystemException) +{ + AUTO_TRACE("SkarabImpl::getCommProtVersion()"); + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + return line->getCommProtVersion(); + } + catch (ComponentErrors::ComponentErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + catch (BackendsErrors::BackendsErrorsExImpl& ex) { + ex.log(LM_DEBUG); + throw ex.getBackendsErrorsEx(); + } + catch (...) { + _EXCPT(ComponentErrors::UnexpectedExImpl,dummy,"SkarabImpl::getCommProtVersion()"); + dummy.log(LM_DEBUG); + throw dummy.getComponentErrorsEx(); + } } CORBA::Boolean SkarabImpl::command(const char *cmd,CORBA::String_out answer) throw (CORBA::SystemException) { - AUTO_TRACE("SkarabImpl::command()"); - IRA::CString out; - bool res; - // this is a cheat....it forces the acquisition of the mutex before the parser. It works only because the parser has no async behaviour configured - CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); - try { - m_parser->run(cmd,out); - res=true; - } - catch (ParserErrors::ParserErrorsExImpl &ex) { - res=false; - } - catch (ACSErr::ACSbaseExImpl& ex) { - ex.log(LM_ERROR); // the errors resulting from the execution are logged here as stated in the documentation of CommandInterpreter interface, while the parser errors are never logged. - res=false; - } - answer=CORBA::string_dup((const char *)out); - return res; + AUTO_TRACE("SkarabImpl::command()"); + IRA::CString out; + bool res; + // this is a cheat....it forces the acquisition of the mutex before the parser. It works only because the parser has no async behaviour configured + CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get(); + try { + m_parser->run(cmd,out); + res=true; + } + catch (ParserErrors::ParserErrorsExImpl &ex) { + res=false; + } + catch (ACSErr::ACSbaseExImpl& ex) { + ex.log(LM_ERROR); // the errors resulting from the execution are logged here as stated in the documentation of CommandInterpreter interface, while the parser errors are never logged. + res=false; + } + answer=CORBA::string_dup((const char *)out); + return res; } _PROPERTY_REFERENCE_CPP(SkarabImpl,ACS::ROuLongLong,m_ptime,time); diff --git a/Common/Servers/TotalPower/include/CommandLine.h b/Common/Servers/TotalPower/include/CommandLine.h index 7fc1de104a2727c43554e30a7817d6ca24c3f5d1..0327a622a2b587299b049511154eee05d40c51b4 100644 --- a/Common/Servers/TotalPower/include/CommandLine.h +++ b/Common/Servers/TotalPower/include/CommandLine.h @@ -427,6 +427,9 @@ public: */ void setAttenuation(const long&inputId, const double& attenuation) throw (BackendsErrors::BackendBusyExImpl,ComponentErrors::ValidationErrorExImpl,ComponentErrors::ValueOutofRangeExImpl,BackendsErrors::NakExImpl, ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl); + + void backendPark() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl); /** * Called by the component to fill the <i>Backends::TMainHeader</i> with the proper informations. diff --git a/Common/Servers/TotalPower/include/TotalPowerImpl.h b/Common/Servers/TotalPower/include/TotalPowerImpl.h index 10adb0b1a029a3f826e037ba677a3007b3b7178c..8a76ef6dd33ae58dae609eeee466e22a7e9b5fc8 100644 --- a/Common/Servers/TotalPower/include/TotalPowerImpl.h +++ b/Common/Servers/TotalPower/include/TotalPowerImpl.h @@ -308,6 +308,8 @@ public: */ virtual void initialize(const char * configuration) throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); + + virtual void endSchedule() throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx, BackendsErrors::BackendsErrorsEx) {AUTO_TRACE("TotalPowerImpl::endSchedule()"); }; /** * Call this function in order to get a total power measure for each input channel. diff --git a/Common/Servers/TotalPower/src/CommandLine.cpp b/Common/Servers/TotalPower/src/CommandLine.cpp index 7ec0519e9482882abbd7566c95a1847bc9dafe99..8b4979864e8c2c7b18a47f05a13cd5ff7af2444c 100644 --- a/Common/Servers/TotalPower/src/CommandLine.cpp +++ b/Common/Servers/TotalPower/src/CommandLine.cpp @@ -167,6 +167,12 @@ void CCommandLine::stopDataAcquisition() throw (BackendsErrors::ConnectionExImpl } } +void CCommandLine::backendPark() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl) +{ + ACS_LOG(LM_FULL_INFO,"CCommandLine::backendPark()",(LM_NOTICE,"backendPark")); +} + void CCommandLine::stopDataAcquisitionForced() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl) { diff --git a/Common/Servers/TotalPower/src/TotalPowerImpl.cpp b/Common/Servers/TotalPower/src/TotalPowerImpl.cpp index 5b2188e450ed47d672a4c1fbdbb27fcf70fc78a6..dadcbca5bc2b6745627f5e5b326a5d2c54807e24 100644 --- a/Common/Servers/TotalPower/src/TotalPowerImpl.cpp +++ b/Common/Servers/TotalPower/src/TotalPowerImpl.cpp @@ -180,6 +180,7 @@ void TotalPowerImpl::initialize() throw (ACSErr::ACSbaseExImpl) m_parser->add("getZero",new function1<CCommandLine,non_constant,void_type,O<doubleSeq_type> >(line,&CCommandLine::getZero),0 ); m_parser->add("getTime",new function1<CCommandLine,non_constant,void_type,O<time_type> >(line,&CCommandLine::getTime),0 ); m_parser->add("initialize",new function1<CCommandLine,non_constant,void_type,I<string_type> >(line,&CCommandLine::setup),1 ); + m_parser->add("backendPark", new function0<CCommandLine,non_constant, void_type>(line,&CCommandLine::backendPark),0 ); threadPar.sender=this; threadPar.command=m_commandLine; diff --git a/Common/Servers/XBackend/include/CommandLine.h b/Common/Servers/XBackend/include/CommandLine.h index 6eecec808ae8af16e4257c6ce643f7cbd4959893..4bfed5c024613be8f18a522eca1d884950650694 100644 --- a/Common/Servers/XBackend/include/CommandLine.h +++ b/Common/Servers/XBackend/include/CommandLine.h @@ -358,6 +358,8 @@ public: BackendsErrors::ConnectionExImpl,ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl, BackendsErrors::MalformedAnswerExImpl,BackendsErrors::BackendBusyExImpl); + void backendPark() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl); /** * Called by the component to fill the <i>Backends::TMainHeader</i> with the proper informations. * @param bkd the stucture that contains the required information. diff --git a/Common/Servers/XBackend/include/XBackendsImpl.h b/Common/Servers/XBackend/include/XBackendsImpl.h index deb87ccec07c98cf18957cf1a85fdc07b4724cf3..848a31c93026032becf04bdfc154722b601509f9 100644 --- a/Common/Servers/XBackend/include/XBackendsImpl.h +++ b/Common/Servers/XBackend/include/XBackendsImpl.h @@ -322,6 +322,7 @@ public: */ virtual void initialize(const char * configuration) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx); + virtual void endSchedule() throw (CORBA::SystemException, ComponentErrors::ComponentErrorsEx, BackendsErrors::BackendsErrorsEx) {AUTO_TRACE("TotalPowerImpl::endSchedule()"); }; /** * @thorw CORBA::SystemException diff --git a/Common/Servers/XBackend/src/CommandLine.cpp b/Common/Servers/XBackend/src/CommandLine.cpp index 0aaa23af8437ec0526e3bdf8e472b7b3cc832f8e..60afc5e000c3f56d0b86fd72da64b473dec0714c 100644 --- a/Common/Servers/XBackend/src/CommandLine.cpp +++ b/Common/Servers/XBackend/src/CommandLine.cpp @@ -99,6 +99,12 @@ void CCommandLine::stopDataAcquisition() throw (BackendsErrors::ConnectionExImpl m_busy=false; } +void CCommandLine::backendPark() throw (BackendsErrors::ConnectionExImpl,BackendsErrors::NakExImpl, + ComponentErrors::SocketErrorExImpl,ComponentErrors::TimeoutExImpl,ComponentErrors::NotAllowedExImpl,BackendsErrors::BackendFailExImpl) +{ + ACS_LOG(LM_FULL_INFO,"CCommandLine::backendPark()",(LM_NOTICE,"backendPark")); +} + void CCommandLine::startDataAcquisition() throw (BackendsErrors::BackendBusyExImpl,BackendsErrors::ConnectionExImpl,XBackendsErrors::NoSettingExImpl) { diff --git a/Common/Servers/XBackend/src/XBackendsImpl.cpp b/Common/Servers/XBackend/src/XBackendsImpl.cpp index c47c82c4369a27eb6afb04f423cf8f2a96c98d0c..5c796540ab4dca6f614a2d4570efc13d39a3e28b 100644 --- a/Common/Servers/XBackend/src/XBackendsImpl.cpp +++ b/Common/Servers/XBackend/src/XBackendsImpl.cpp @@ -167,6 +167,7 @@ void XBackendsImpl::initialize() m_parser->add("getAttenuation",new function1<CCommandLine,constant,void_type,O<doubleSeq_type> >(commandL,&CCommandLine::getAttenuation),0 ); m_parser->add("getTime",new function1<CCommandLine,constant,void_type,O<time_type> >(commandL,&CCommandLine::getTime),0 ); m_parser->add("initialize",new function1<CCommandLine,non_constant,void_type,I<string_type> >(commandL,&CCommandLine::setup),1 ); + m_parser->add("backendPark", new function0<CCommandLine,non_constant, void_type>(commandL,&CCommandLine::backendPark),0 ); m_initialized=true; ACS_LOG(LM_FULL_INFO,"XBackendsImpl::initialize()",(LM_INFO,"COMPSTATE_INITIALIZED")); diff --git a/SRT/CDB/MACI/Components/BACKENDS/Skarab/Skarab.xml b/SRT/CDB/MACI/Components/BACKENDS/Skarab/Skarab.xml new file mode 100644 index 0000000000000000000000000000000000000000..80b5446707aa59d33afdb33f79b8c13d8d96d0d1 --- /dev/null +++ b/SRT/CDB/MACI/Components/BACKENDS/Skarab/Skarab.xml @@ -0,0 +1,17 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + - History: + - +--> +<Component xmlns="urn:schemas-cosylab-com:Component:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + + Name="Skarab" + Code="SkarabImpl" + Type="IDL:alma/Backends/Skarab:1.0" + Container="SkarabContainer" + KeepAliveTime="-1" + ImplLang="cpp" +/> diff --git a/SRT/CDB/MACI/Containers/SkarabContainer/SkarabContainer.xml b/SRT/CDB/MACI/Containers/SkarabContainer/SkarabContainer.xml new file mode 100644 index 0000000000000000000000000000000000000000..2b6f79973dd7344442991d641b9712fd317ab217 --- /dev/null +++ b/SRT/CDB/MACI/Containers/SkarabContainer/SkarabContainer.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<Container + xmlns="urn:schemas-cosylab-com:Container:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" + Timeout="150.0" + UseIFR="true" + ManagerRetry="10" + ImplLang="cpp" + Recovery="false"> + + <Autoload> + <cdb:e string="baci" /> + </Autoload> + + <LoggingConfig + centralizedLogger="Log" + minLogLevel="5" + minLogLevelLocal="5" + dispatchPacketSize="0" + immediateDispatchLevel="8" + flushPeriodSeconds="1" + > + </LoggingConfig> + +</Container> + diff --git a/SRT/CDB/alma/BACKENDS/Skarab/Skarab.xml b/SRT/CDB/alma/BACKENDS/Skarab/Skarab.xml new file mode 100644 index 0000000000000000000000000000000000000000..e7d02a72c5bfdd57582fa556c311c6abb12509c8 --- /dev/null +++ b/SRT/CDB/alma/BACKENDS/Skarab/Skarab.xml @@ -0,0 +1,45 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + - History: + - Wed Apr 13 15:18:03 UTC 2005 modified by Andrea Orlati +--> +<Skarab xmlns="urn:schemas-cosylab-com:Skarab:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + sender_protocols="TCP=${HOST}:14000" + IPAddress="192.167.189.91" + Port="10001" + CommandLineTimeout="100000000" + ConnectTimeout="300000000" + PropertyRefreshTime="1000000" + Configuration="SKARAB_1S" + TimeTollerance="250000" + RepetitionCacheTime="200000000" + RepetitionExpireTime="500000000" + DataPort="6001" + DataIPAddress="192.168.200.200" + DataLatency="3000000" + SenderSleepTime="30000000" + SenderResponseTime="10000000" + ControlSleepTime="90000000" + ControlResponseTime="100000000" + BoardsNumber="14" + DataBufferSize="64"> + <time/> + <backendName/> + <bandWidth/> + <frequency/> + <sampleRate/> + <attenuation/> + <polarization/> + <bins/> + <feed/> + <systemTemperature/> + <inputSection/> + <inputsNumber/> + <sectionsNumber/> + <integration/> + <status/> + <busy/> +</Skarab> diff --git a/SRT/CDB/alma/DataBlock/PointingModel/PointingModel.xml b/SRT/CDB/alma/DataBlock/PointingModel/PointingModel.xml index 39c27d3d2aa52746a3a16c4c8f78f961d5735144..998546dc13d7a78d03bc7c25b099106641f142b5 100644 --- a/SRT/CDB/alma/DataBlock/PointingModel/PointingModel.xml +++ b/SRT/CDB/alma/DataBlock/PointingModel/PointingModel.xml @@ -108,20 +108,20 @@ <Receiver> <receiverCode>XB</receiverCode> <phi>90.0000</phi> - <coefficientNum00>1</coefficientNum00> <coefficientVal00>-2.2955527306</coefficientVal00> + <coefficientNum00>1</coefficientNum00> <coefficientVal00>-2.2917063236</coefficientVal00> <coefficientNum01>0</coefficientNum01> <coefficientVal01>0.0000000000</coefficientVal01> - <coefficientNum02>1</coefficientNum02> <coefficientVal02>-0.0027078437</coefficientVal02> - <coefficientNum03>1</coefficientNum03> <coefficientVal03>0.0173532944</coefficientVal03> - <coefficientNum04>1</coefficientNum04> <coefficientVal04>-0.0008693041</coefficientVal04> - <coefficientNum05>1</coefficientNum05> <coefficientVal05>-0.0019183123</coefficientVal05> - <coefficientNum06>1</coefficientNum06> <coefficientVal06>0.1030814573</coefficientVal06> - <coefficientNum07>1</coefficientNum07> <coefficientVal07>0.0856014490</coefficientVal07> + <coefficientNum02>1</coefficientNum02> <coefficientVal02>-0.0013826370</coefficientVal02> + <coefficientNum03>1</coefficientNum03> <coefficientVal03>0.0097995838</coefficientVal03> + <coefficientNum04>1</coefficientNum04> <coefficientVal04>-0.0005712744</coefficientVal04> + <coefficientNum05>1</coefficientNum05> <coefficientVal05>-0.0014260981</coefficientVal05> + <coefficientNum06>1</coefficientNum06> <coefficientVal06>0.0759423449</coefficientVal06> + <coefficientNum07>1</coefficientNum07> <coefficientVal07>0.1146249696</coefficientVal07> <coefficientNum08>0</coefficientNum08> <coefficientVal08>0.0000000000</coefficientVal08> <coefficientNum09>0</coefficientNum09> <coefficientVal09>0.0000000000</coefficientVal09> - <coefficientNum10>1</coefficientNum10> <coefficientVal10>0.0087973252</coefficientVal10> + <coefficientNum10>1</coefficientNum10> <coefficientVal10>-0.0027263802</coefficientVal10> <coefficientNum11>0</coefficientNum11> <coefficientVal11>0.0000000000</coefficientVal11> - <coefficientNum12>1</coefficientNum12> <coefficientVal12>0.0003481323</coefficientVal12> - <coefficientNum13>1</coefficientNum13> <coefficientVal13>0.0001999680</coefficientVal13> + <coefficientNum12>1</coefficientNum12> <coefficientVal12>0.0002023144</coefficientVal12> + <coefficientNum13>1</coefficientNum13> <coefficientVal13>0.0000791195</coefficientVal13> <coefficientNum14>0</coefficientNum14> <coefficientVal14>0.0000000000</coefficientVal14> <coefficientNum15>0</coefficientNum15> <coefficientVal15>0.0000000000</coefficientVal15> <coefficientNum16>0</coefficientNum16> <coefficientVal16>0.0000000000</coefficientVal16> diff --git a/SRT/CDB/alma/DataBlock/PyCalmux/Mapping/Mapping.xml b/SRT/CDB/alma/DataBlock/PyCalmux/Mapping/Mapping.xml index f083165cbd7761897dcfee5b68578d018c33a76a..61e8f16984c7c7392fa21b89be07698d9ca9b4c1 100755 --- a/SRT/CDB/alma/DataBlock/PyCalmux/Mapping/Mapping.xml +++ b/SRT/CDB/alma/DataBlock/PyCalmux/Mapping/Mapping.xml @@ -7,5 +7,6 @@ <BackendEntry><Backend>DBBC</Backend><Channel>6</Channel><Polarity>0</Polarity></BackendEntry> <BackendEntry><Backend>DFB</Backend><Channel>7</Channel><Polarity>0</Polarity></BackendEntry> +<BackendEntry><Backend>SKARAB</Backend><Channel>8</Channel><Polarity>0</Polarity></BackendEntry> </CalMuxTable> diff --git a/SRT/CDB/alma/DataBlock/Skarab/Skarab.xml b/SRT/CDB/alma/DataBlock/Skarab/Skarab.xml new file mode 100644 index 0000000000000000000000000000000000000000..ab460fb6492b074feef00d1944eec35400b61c79 --- /dev/null +++ b/SRT/CDB/alma/DataBlock/Skarab/Skarab.xml @@ -0,0 +1,158 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> + +<SkarabSetup xmlns="urn:schemas-cosylab-com:SkarabSetup:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + +<Configuration> + <configurationID>SKARAB_1</configurationID> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>1</beams> + <bandWidth>1400.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>L R</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> + <bins>2048</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_1S</configurationID> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>1</beams> + <bandWidth>1400.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3</section_boards> + <polarizations>S S</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> + <bins>2048</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_2</configurationID> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>1</beams> + <bandWidth>187.5</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>L R</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> + <bins>32768</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_2S</configurationID> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>1</beams> + <bandWidth>187.5</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3</section_boards> + <polarizations>S S</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> + <bins>32768</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_3</configurationID> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>1</beams> + <bandWidth>187.5</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>L R</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> + <bins>65536</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_3S</configurationID> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>1</beams> + <bandWidth>187.5</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3</section_boards> + <polarizations>S S</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> + <bins>65536</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_4</configurationID> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>1</beams> + <bandWidth>93.75</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>L R</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> + <bins>32768</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_4S</configurationID> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>1</beams> + <bandWidth>93.75</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3</section_boards> + <polarizations>S S</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> + <bins>32768</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_5</configurationID> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>1</beams> + <bandWidth>93.75</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>L R</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> + <bins>65536</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_5S</configurationID> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>1</beams> + <bandWidth>93.75</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3</section_boards> + <polarizations>S S</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> + <bins>65536</bins> +</Configuration> + +</SkarabSetup> diff --git a/SRT/CDB/alma/Procedures/StationProcedures/StationProcedures.xml b/SRT/CDB/alma/Procedures/StationProcedures/StationProcedures.xml index e93c54bcc65d6d679f0bd32dd9a9ac110a16d3ba..aae9d9ce2106ec4546ce0235471d04bd6b4d5125 100644 --- a/SRT/CDB/alma/Procedures/StationProcedures/StationProcedures.xml +++ b/SRT/CDB/alma/Procedures/StationProcedures/StationProcedures.xml @@ -142,6 +142,7 @@ servoPark asPark receiversPark + backendPark wait=1 antennaPark logMessage=Telescope is now parked diff --git a/SRT/Configuration/CDB/MACI/Components/BACKENDS/Skarab/Skarab.xml b/SRT/Configuration/CDB/MACI/Components/BACKENDS/Skarab/Skarab.xml new file mode 100644 index 0000000000000000000000000000000000000000..80b5446707aa59d33afdb33f79b8c13d8d96d0d1 --- /dev/null +++ b/SRT/Configuration/CDB/MACI/Components/BACKENDS/Skarab/Skarab.xml @@ -0,0 +1,17 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + - History: + - +--> +<Component xmlns="urn:schemas-cosylab-com:Component:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + + Name="Skarab" + Code="SkarabImpl" + Type="IDL:alma/Backends/Skarab:1.0" + Container="SkarabContainer" + KeepAliveTime="-1" + ImplLang="cpp" +/> diff --git a/SRT/Configuration/CDB/MACI/Containers/SkarabContainer/SkarabContainer.xml b/SRT/Configuration/CDB/MACI/Containers/SkarabContainer/SkarabContainer.xml new file mode 100644 index 0000000000000000000000000000000000000000..30af95bb85784aca5a5cffb44bfc18b430bb7bf1 --- /dev/null +++ b/SRT/Configuration/CDB/MACI/Containers/SkarabContainer/SkarabContainer.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<Container + xmlns="urn:schemas-cosylab-com:Container:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" + Timeout="600.0" + UseIFR="true" + ManagerRetry="10" + ImplLang="cpp" + Recovery="false"> + + <Autoload> + <cdb:e string="baci" /> + </Autoload> + + <LoggingConfig + centralizedLogger="Log" + minLogLevel="5" + minLogLevelLocal="5" + dispatchPacketSize="0" + immediateDispatchLevel="8" + flushPeriodSeconds="1" + > + </LoggingConfig> + +</Container> + diff --git a/SRT/Configuration/CDB/alma/AS/set_calibrate.py b/SRT/Configuration/CDB/alma/AS/set_calibrate.py new file mode 100755 index 0000000000000000000000000000000000000000..1bcddca13854939cca0b714b1774a6db91d5db7c --- /dev/null +++ b/SRT/Configuration/CDB/alma/AS/set_calibrate.py @@ -0,0 +1,24 @@ +import os, fnmatch + +path = os.path.dirname(os.path.abspath(__file__)) + +result = [] +for root, dirs, files in os.walk(path): + for name in files: + if fnmatch.fnmatch(name, 'USD*.xml'): + result.append(os.path.join(root, name)) + +counter = 0 + +for filename in result: + counter += 1 + os.rename(filename, filename + '.bak') + original = open(filename + '.bak', 'r') + new = open(filename, 'w') + for fileline in original: + new.write(fileline.replace('calibrate="0"', 'calibrate="1"')) + original.close() + os.remove(filename + '.bak') + new.close() + +print(str(counter) + " files edited.") diff --git a/SRT/Configuration/CDB/alma/BACKENDS/Skarab/Skarab.xml b/SRT/Configuration/CDB/alma/BACKENDS/Skarab/Skarab.xml new file mode 100644 index 0000000000000000000000000000000000000000..d5113f155c00747675d04bf60494dc0db22bc526 --- /dev/null +++ b/SRT/Configuration/CDB/alma/BACKENDS/Skarab/Skarab.xml @@ -0,0 +1,45 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<!-- + - History: + - Wed Apr 13 15:18:03 UTC 2005 modified by Andrea Orlati +--> +<Skarab xmlns="urn:schemas-cosylab-com:Skarab:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + sender_protocols="TCP=${HOST}:14000" + IPAddress="192.168.200.225" + Port="10001" + CommandLineTimeout="900000000" + ConnectTimeout="300000000" + PropertyRefreshTime="1000000" + Configuration="SKARAB_1S" + TimeTollerance="250000" + RepetitionCacheTime="200000000" + RepetitionExpireTime="500000000" + DataPort="6001" + DataIPAddress="192.168.200.200" + DataLatency="3000000" + SenderSleepTime="30000000" + SenderResponseTime="10000000" + ControlSleepTime="90000000" + ControlResponseTime="100000000" + BoardsNumber="14" + DataBufferSize="64"> + <time/> + <backendName/> + <bandWidth/> + <frequency/> + <sampleRate/> + <attenuation/> + <polarization/> + <bins/> + <feed/> + <systemTemperature/> + <inputSection/> + <inputsNumber/> + <sectionsNumber/> + <integration/> + <status/> + <busy/> +</Skarab> diff --git a/SRT/Configuration/CDB/alma/DataBlock/Equipment/Equipment.xml b/SRT/Configuration/CDB/alma/DataBlock/Equipment/Equipment.xml index 4e13421870ddefb224427d9d95918bc04ead8ad4..b5c9923a2a5151533dacf81feb15ab397c2a9a06 100644 --- a/SRT/Configuration/CDB/alma/DataBlock/Equipment/Equipment.xml +++ b/SRT/Configuration/CDB/alma/DataBlock/Equipment/Equipment.xml @@ -24,5 +24,6 @@ <AvailableBackend alias="XArcos" backend="BACKENDS/XBackends" noData="false" dataPath="" /> <AvailableBackend alias="Sardara" backend="BACKENDS/Sardara" noData="true" dataPath="/roach2_nuraghe/data/" /> <AvailableBackend alias="Holograpy" backend="BACKENDS/Holography" noData="true" dataPath="" /> + <AvailableBackend alias="Skarab" backend="BACKENDS/Skarab" noData="true" dataPath="" /> </TelescopeEquipment> diff --git a/SRT/Configuration/CDB/alma/DataBlock/PointingModel/PointingModel.xml b/SRT/Configuration/CDB/alma/DataBlock/PointingModel/PointingModel.xml index 39c27d3d2aa52746a3a16c4c8f78f961d5735144..998546dc13d7a78d03bc7c25b099106641f142b5 100644 --- a/SRT/Configuration/CDB/alma/DataBlock/PointingModel/PointingModel.xml +++ b/SRT/Configuration/CDB/alma/DataBlock/PointingModel/PointingModel.xml @@ -108,20 +108,20 @@ <Receiver> <receiverCode>XB</receiverCode> <phi>90.0000</phi> - <coefficientNum00>1</coefficientNum00> <coefficientVal00>-2.2955527306</coefficientVal00> + <coefficientNum00>1</coefficientNum00> <coefficientVal00>-2.2917063236</coefficientVal00> <coefficientNum01>0</coefficientNum01> <coefficientVal01>0.0000000000</coefficientVal01> - <coefficientNum02>1</coefficientNum02> <coefficientVal02>-0.0027078437</coefficientVal02> - <coefficientNum03>1</coefficientNum03> <coefficientVal03>0.0173532944</coefficientVal03> - <coefficientNum04>1</coefficientNum04> <coefficientVal04>-0.0008693041</coefficientVal04> - <coefficientNum05>1</coefficientNum05> <coefficientVal05>-0.0019183123</coefficientVal05> - <coefficientNum06>1</coefficientNum06> <coefficientVal06>0.1030814573</coefficientVal06> - <coefficientNum07>1</coefficientNum07> <coefficientVal07>0.0856014490</coefficientVal07> + <coefficientNum02>1</coefficientNum02> <coefficientVal02>-0.0013826370</coefficientVal02> + <coefficientNum03>1</coefficientNum03> <coefficientVal03>0.0097995838</coefficientVal03> + <coefficientNum04>1</coefficientNum04> <coefficientVal04>-0.0005712744</coefficientVal04> + <coefficientNum05>1</coefficientNum05> <coefficientVal05>-0.0014260981</coefficientVal05> + <coefficientNum06>1</coefficientNum06> <coefficientVal06>0.0759423449</coefficientVal06> + <coefficientNum07>1</coefficientNum07> <coefficientVal07>0.1146249696</coefficientVal07> <coefficientNum08>0</coefficientNum08> <coefficientVal08>0.0000000000</coefficientVal08> <coefficientNum09>0</coefficientNum09> <coefficientVal09>0.0000000000</coefficientVal09> - <coefficientNum10>1</coefficientNum10> <coefficientVal10>0.0087973252</coefficientVal10> + <coefficientNum10>1</coefficientNum10> <coefficientVal10>-0.0027263802</coefficientVal10> <coefficientNum11>0</coefficientNum11> <coefficientVal11>0.0000000000</coefficientVal11> - <coefficientNum12>1</coefficientNum12> <coefficientVal12>0.0003481323</coefficientVal12> - <coefficientNum13>1</coefficientNum13> <coefficientVal13>0.0001999680</coefficientVal13> + <coefficientNum12>1</coefficientNum12> <coefficientVal12>0.0002023144</coefficientVal12> + <coefficientNum13>1</coefficientNum13> <coefficientVal13>0.0000791195</coefficientVal13> <coefficientNum14>0</coefficientNum14> <coefficientVal14>0.0000000000</coefficientVal14> <coefficientNum15>0</coefficientNum15> <coefficientVal15>0.0000000000</coefficientVal15> <coefficientNum16>0</coefficientNum16> <coefficientVal16>0.0000000000</coefficientVal16> diff --git a/SRT/Configuration/CDB/alma/DataBlock/PyCalmux/Mapping/Mapping.xml b/SRT/Configuration/CDB/alma/DataBlock/PyCalmux/Mapping/Mapping.xml index f083165cbd7761897dcfee5b68578d018c33a76a..61e8f16984c7c7392fa21b89be07698d9ca9b4c1 100755 --- a/SRT/Configuration/CDB/alma/DataBlock/PyCalmux/Mapping/Mapping.xml +++ b/SRT/Configuration/CDB/alma/DataBlock/PyCalmux/Mapping/Mapping.xml @@ -7,5 +7,6 @@ <BackendEntry><Backend>DBBC</Backend><Channel>6</Channel><Polarity>0</Polarity></BackendEntry> <BackendEntry><Backend>DFB</Backend><Channel>7</Channel><Polarity>0</Polarity></BackendEntry> +<BackendEntry><Backend>SKARAB</Backend><Channel>8</Channel><Polarity>0</Polarity></BackendEntry> </CalMuxTable> diff --git a/SRT/Configuration/CDB/alma/DataBlock/Sardara/Sardara.xml b/SRT/Configuration/CDB/alma/DataBlock/Sardara/Sardara.xml index 8f3f0584733dbbd6f52175b0f1eb4c7af6b170aa..f57ce8009e2a60265b11150145008fa0e6b1ace8 100644 --- a/SRT/Configuration/CDB/alma/DataBlock/Sardara/Sardara.xml +++ b/SRT/Configuration/CDB/alma/DataBlock/Sardara/Sardara.xml @@ -7,12 +7,12 @@ <Configuration> <configurationID>SK00</configurationID> - <sections>2</sections> + <sections>2</sections> <calSwitchingEnabled>TRUE</calSwitchingEnabled> <inputPort>GREGORIAN</inputPort> <beams>1</beams> - <bandWidth>1500.0</bandWidth> - <attenuation>7.0</attenuation> + <bandWidth>1500.0</bandWidth> + <attenuation>7.0</attenuation> <section_boards>0 1</section_boards> <polarizations>L R</polarizations> <feed>0 0</feed> @@ -20,14 +20,74 @@ <bins>1024</bins> </Configuration> +<Configuration> + <configurationID>SK01</configurationID> + <sections>4</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>2</beams> + <bandWidth>1500.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3</section_boards> + <polarizations>L R L R</polarizations> + <feed>0 0 1 1</feed> + <IF>0 1 0 1</IF> + <bins>1024</bins> +</Configuration> + +<Configuration> + <configurationID>SK04</configurationID> + <sections>4</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>2</beams> + <bandWidth>1500.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3</section_boards> + <polarizations>L R L R</polarizations> + <feed>0 0 4 4</feed> + <IF>0 1 0 1</IF> + <bins>1024</bins> +</Configuration> + +<Configuration> + <configurationID>SK03</configurationID> + <sections>4</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>2</beams> + <bandWidth>1500.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3</section_boards> + <polarizations>L R L R</polarizations> + <feed>0 0 3 3</feed> + <IF>0 1 0 1</IF> + <bins>1024</bins> +</Configuration> + +<Configuration> + <configurationID>SK06</configurationID> + <sections>4</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>2</beams> + <bandWidth>1500.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3</section_boards> + <polarizations>L R L R</polarizations> + <feed>0 0 6 6</feed> + <IF>0 1 0 1</IF> + <bins>1024</bins> +</Configuration> + <Configuration> <configurationID>SK77</configurationID> <sections>14</sections> <calSwitchingEnabled>TRUE</calSwitchingEnabled> <inputPort>GREGORIAN</inputPort> <beams>7</beams> - <bandWidth>1500.0</bandWidth> - <attenuation>7.0</attenuation> + <bandWidth>1500.0</bandWidth> + <attenuation>7.0</attenuation> <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> <polarizations>L R L R L R L R L R L R L R</polarizations> <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> @@ -37,61 +97,61 @@ <Configuration> <configurationID>SCC00</configurationID> - <sections>2</sections> - <calSwitchingEnabled>TRUE</calSwitchingEnabled> - <inputPort>BWG</inputPort> - <beams>1</beams> - <bandWidth>1500.0</bandWidth> - <attenuation>9.0</attenuation> - <section_boards>0 1</section_boards> - <polarizations>L R</polarizations> - <feed>0 0</feed> - <IF>0 1</IF> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>BWG</inputPort> + <beams>1</beams> + <bandWidth>1500.0</bandWidth> + <attenuation>9.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>L R</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> <bins>1024</bins> </Configuration> <Configuration> <configurationID>SCH00</configurationID> - <sections>2</sections> - <calSwitchingEnabled>TRUE</calSwitchingEnabled> - <inputPort>BWG</inputPort> - <beams>1</beams> - <bandWidth>1500.0</bandWidth> - <attenuation>9.0</attenuation> - <section_boards>0 1</section_boards> - <polarizations>L R</polarizations> - <feed>0 0</feed> - <IF>0 1</IF> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>BWG</inputPort> + <beams>1</beams> + <bandWidth>1500.0</bandWidth> + <attenuation>9.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>L R</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> <bins>1024</bins> </Configuration> <Configuration> <configurationID>SL00</configurationID> - <sections>2</sections> - <calSwitchingEnabled>TRUE</calSwitchingEnabled> - <inputPort>PRIMARY</inputPort> - <beams>1</beams> - <bandWidth>1500.0</bandWidth> - <attenuation>10.0</attenuation> - <section_boards>2 3</section_boards> - <polarizations>L R</polarizations> - <feed>0 0</feed> - <IF>0 1</IF> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>PRIMARY</inputPort> + <beams>1</beams> + <bandWidth>1500.0</bandWidth> + <attenuation>10.0</attenuation> + <section_boards>2 3</section_boards> + <polarizations>L R</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> <bins>1024</bins> </Configuration> <Configuration> <configurationID>SP00</configurationID> - <sections>2</sections> - <calSwitchingEnabled>TRUE</calSwitchingEnabled> - <inputPort>PRIMARY</inputPort> - <beams>1</beams> - <bandWidth>500.0</bandWidth> - <attenuation>10.0</attenuation> - <section_boards>0 1</section_boards> - <polarizations>L R</polarizations> - <feed>0 0</feed> - <IF>0 1</IF> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>PRIMARY</inputPort> + <beams>1</beams> + <bandWidth>500.0</bandWidth> + <attenuation>10.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>L R</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> <bins>1024</bins> </Configuration> @@ -101,8 +161,8 @@ <calSwitchingEnabled>TRUE</calSwitchingEnabled> <inputPort>GREGORIAN</inputPort> <beams>1</beams> - <bandWidth>1500.0</bandWidth> - <attenuation>7.0</attenuation> + <bandWidth>1500.0</bandWidth> + <attenuation>7.0</attenuation> <section_boards>0 1 2 3</section_boards> <polarizations>S S</polarizations> <feed>0 0</feed> @@ -116,8 +176,8 @@ <calSwitchingEnabled>TRUE</calSwitchingEnabled> <inputPort>GREGORIAN</inputPort> <beams>7</beams> - <bandWidth>1500.0</bandWidth> - <attenuation>7.0</attenuation> + <bandWidth>1500.0</bandWidth> + <attenuation>7.0</attenuation> <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> <polarizations>S S S S S S S S S S S S S S</polarizations> <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> @@ -127,61 +187,61 @@ <Configuration> <configurationID>SCC00S</configurationID> - <sections>2</sections> - <calSwitchingEnabled>TRUE</calSwitchingEnabled> - <inputPort>BWG</inputPort> - <beams>1</beams> - <bandWidth>1500.0</bandWidth> - <attenuation>9.0</attenuation> - <section_boards>0 1</section_boards> - <polarizations>S S</polarizations> - <feed>0 0</feed> - <IF>0 1</IF> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>BWG</inputPort> + <beams>1</beams> + <bandWidth>1500.0</bandWidth> + <attenuation>9.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>S S</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> <bins>1024</bins> </Configuration> <Configuration> <configurationID>SCH00S</configurationID> - <sections>2</sections> - <calSwitchingEnabled>TRUE</calSwitchingEnabled> - <inputPort>BWG</inputPort> - <beams>1</beams> - <bandWidth>1500.0</bandWidth> - <attenuation>9.0</attenuation> - <section_boards>0 1</section_boards> - <polarizations>S S</polarizations> - <feed>0 0</feed> - <IF>0 1</IF> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>BWG</inputPort> + <beams>1</beams> + <bandWidth>1500.0</bandWidth> + <attenuation>9.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>S S</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> <bins>1024</bins> </Configuration> <Configuration> <configurationID>SL00S</configurationID> - <sections>2</sections> - <calSwitchingEnabled>TRUE</calSwitchingEnabled> - <inputPort>PRIMARY</inputPort> - <beams>1</beams> - <bandWidth>1500.0</bandWidth> - <attenuation>10.0</attenuation> - <section_boards>2 3</section_boards> - <polarizations>S S</polarizations> - <feed>0 0</feed> - <IF>0 1</IF> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>PRIMARY</inputPort> + <beams>1</beams> + <bandWidth>1500.0</bandWidth> + <attenuation>10.0</attenuation> + <section_boards>2 3</section_boards> + <polarizations>S S</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> <bins>1024</bins> </Configuration> <Configuration> <configurationID>SP00S</configurationID> - <sections>2</sections> - <calSwitchingEnabled>TRUE</calSwitchingEnabled> - <inputPort>PRIMARY</inputPort> - <beams>1</beams> - <bandWidth>500.0</bandWidth> - <attenuation>10.0</attenuation> - <section_boards>0 1</section_boards> - <polarizations>S S</polarizations> - <feed>0 0</feed> - <IF>0 1</IF> + <sections>2</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>PRIMARY</inputPort> + <beams>1</beams> + <bandWidth>500.0</bandWidth> + <attenuation>10.0</attenuation> + <section_boards>0 1</section_boards> + <polarizations>S S</polarizations> + <feed>0 0</feed> + <IF>0 1</IF> <bins>1024</bins> </Configuration> diff --git a/SRT/Configuration/CDB/alma/DataBlock/Skarab/Skarab.xml b/SRT/Configuration/CDB/alma/DataBlock/Skarab/Skarab.xml new file mode 100644 index 0000000000000000000000000000000000000000..3b7d4a6f0201992c183aeac666786e9a85d8a16d --- /dev/null +++ b/SRT/Configuration/CDB/alma/DataBlock/Skarab/Skarab.xml @@ -0,0 +1,233 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> + +<SkarabSetup xmlns="urn:schemas-cosylab-com:SkarabSetup:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + +<Configuration> + <configurationID>SKARAB_1</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>1400.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>L R L R L R L R L R L R L R</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>2048</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_1S</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>1400.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>S S S S S S S S S S S S S S</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>2048</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_2</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>187.5</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>L R L R L R L R L R L R L R</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>32768</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_2S</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>187.5</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>S S S S S S S S S S S S S S</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>32768</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_3</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>187.5</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>L R L R L R L R L R L R L R</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>65536</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_3S</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>187.5</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>S S S S S S S S S S S S S S</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>65536</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_4</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>93.75</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>L R L R L R L R L R L R L R</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>32768</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_4S</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>93.75</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>S S S S S S S S S S S S S S</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>32768</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_5</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>93.75</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>L R L R L R L R L R L R L R</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>65536</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_5S</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>93.75</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>S S S S S S S S S S S S S S</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>65536</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_7</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>16.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>L R L R L R L R L R L R L R</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>65536</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_11</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>375.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>L R L R L R L R L R L R L R</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>1024</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_11S</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>375.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>S S S S S S S S S S S S S S</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>1024</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_12</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>750.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>L R L R L R L R L R L R L R</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>8192</bins> +</Configuration> + +<Configuration> + <configurationID>SKARAB_12S</configurationID> + <sections>14</sections> + <calSwitchingEnabled>TRUE</calSwitchingEnabled> + <inputPort>GREGORIAN</inputPort> + <beams>7</beams> + <bandWidth>750.0</bandWidth> + <attenuation>7.0</attenuation> + <section_boards>0 1 2 3 4 5 6 7 8 9 10 11 12 13</section_boards> + <polarizations>S S S S S S S S S S S S S S</polarizations> + <feed>0 0 1 1 2 2 3 3 4 4 5 5 6 6</feed> + <IF>0 1 0 1 0 1 0 1 0 1 0 1 0 1</IF> + <bins>8192</bins> +</Configuration> + +</SkarabSetup> diff --git a/SRT/Configuration/CDB/alma/Procedures/StationProcedures/StationProcedures.xml b/SRT/Configuration/CDB/alma/Procedures/StationProcedures/StationProcedures.xml index e93c54bcc65d6d679f0bd32dd9a9ac110a16d3ba..aae9d9ce2106ec4546ce0235471d04bd6b4d5125 100644 --- a/SRT/Configuration/CDB/alma/Procedures/StationProcedures/StationProcedures.xml +++ b/SRT/Configuration/CDB/alma/Procedures/StationProcedures/StationProcedures.xml @@ -142,6 +142,7 @@ servoPark asPark receiversPark + backendPark wait=1 antennaPark logMessage=Telescope is now parked diff --git a/SRT/Misc/SRTScripts/app-defaults/discosStartup.xml b/SRT/Misc/SRTScripts/app-defaults/discosStartup.xml index 29c8a78a6c2c36f4492f8224ffc7a7e55447d82b..d6a3d5e8be1f3af0f5f39a77cb13417f3c764175 100644 --- a/SRT/Misc/SRTScripts/app-defaults/discosStartup.xml +++ b/SRT/Misc/SRTScripts/app-defaults/discosStartup.xml @@ -14,7 +14,7 @@ <toolAgainstInterfaceRepository></toolAgainstInterfaceRepository> <toolAgainstNameService></toolAgainstNameService> <containers> - <select>34</select> + <select>32</select> <againstManagerHost></againstManagerHost> <againstManagerPort></againstManagerPort> <againstCDB></againstCDB> @@ -64,7 +64,7 @@ <remoteHost>MASTERHOST</remoteHost> <remoteAccount>discos</remoteAccount> </container> - <container> + <!--container> <name>LocalOscillatorLPContainer</name> <type>py</type> <heapSizeMB></heapSizeMB> @@ -72,7 +72,7 @@ <scriptBase>0</scriptBase> <remoteHost>MASTERHOST</remoteHost> <remoteAccount>discos</remoteAccount> - </container> + </container--> <container> <name>LocalOscillatorCContainer</name> <type>py</type> @@ -164,7 +164,7 @@ <remoteAccount>discos</remoteAccount> </container> <container> - <name>SRT7GHzContainer</name> + <name>SkarabContainer</name> <type>cpp</type> <heapSizeMB></heapSizeMB> <useDedicatedSettings>true</useDedicatedSettings> @@ -173,7 +173,7 @@ <remoteAccount>discos</remoteAccount> </container> <container> - <name>SRT5GHzContainer</name> + <name>SRT7GHzContainer</name> <type>cpp</type> <heapSizeMB></heapSizeMB> <useDedicatedSettings>true</useDedicatedSettings> @@ -182,7 +182,7 @@ <remoteAccount>discos</remoteAccount> </container> <container> - <name>SRTKBandContainer</name> + <name>SRT5GHzContainer</name> <type>cpp</type> <heapSizeMB></heapSizeMB> <useDedicatedSettings>true</useDedicatedSettings> @@ -191,7 +191,7 @@ <remoteAccount>discos</remoteAccount> </container> <container> - <name>SRTLPBandContainer</name> + <name>SRTKBandContainer</name> <type>cpp</type> <heapSizeMB></heapSizeMB> <useDedicatedSettings>true</useDedicatedSettings> @@ -199,17 +199,17 @@ <remoteHost>MASTERHOST</remoteHost> <remoteAccount>discos</remoteAccount> </container> - <container> - <name>TotalPowerContainer</name> + <!--container> + <name>SRTLPBandContainer</name> <type>cpp</type> <heapSizeMB></heapSizeMB> <useDedicatedSettings>true</useDedicatedSettings> <scriptBase>0</scriptBase> <remoteHost>MASTERHOST</remoteHost> <remoteAccount>discos</remoteAccount> - </container> + </container--> <container> - <name>WeatherStationContainer</name> + <name>TotalPowerContainer</name> <type>cpp</type> <heapSizeMB></heapSizeMB> <useDedicatedSettings>true</useDedicatedSettings> @@ -218,7 +218,7 @@ <remoteAccount>discos</remoteAccount> </container> <container> - <name>XContainer</name> + <name>WeatherStationContainer</name> <type>cpp</type> <heapSizeMB></heapSizeMB> <useDedicatedSettings>true</useDedicatedSettings> diff --git a/SystemMake/Makefile b/SystemMake/Makefile index 2dca9aea0f1dbaea76316ef111304214226765d4..bede02f70f42fcffc2f2e921646f0beb5acd1d7d 100644 --- a/SystemMake/Makefile +++ b/SystemMake/Makefile @@ -34,9 +34,9 @@ COMMON_LIBRARIES:=SlaLibrary IRALibrary DiscosVersion TextWindowLibrary ParserLi DiscosBackendProtocol PyTestingLibrary \ COMMON_SERVERS:=AntennaBoss Observatory OTF PointingModel Refraction SkySource \ Moon FitsWriter Scheduler ReceiversBoss ExternalClients \ - CalibrationTool TotalPower NoiseGenerator CustomLogger \ - XBackend PyDewarPositioner Sardara PyLocalOscillator MFKBandBaseReceiver PyCalmux \ - ActiveSurfaceLan ActiveSurfaceUSD + CalibrationTool TotalPower CustomLogger \ + PyDewarPositioner Sardara Skarab PyLocalOscillator MFKBandBaseReceiver PyCalmux \ + ActiveSurfaceLan ActiveSurfaceUSD XBackend COMMON_CLIENTS:=AntennaBossTextClient ObservatoryTextClient \ GenericBackendTextClient ReceiversBossTextClient \ SystemTerminal CaltoolClient CustomLoggingClient \ @@ -77,32 +77,32 @@ ifeq ($(STATION),SRT) #Add all modules included in the SRT system in this sequence #Doc, (Errors, Interfacies, Libraries, Servers, Clients, Misc) MODULES:=SRTDox \ - ClientErrors ComponentErrors AntennaErrors ParserErrors BackendsErrors ManagementErrors ReceiversErrors MetrologyErrors MinorServoErrors XBackendErrors \ + ClientErrors ComponentErrors AntennaErrors ParserErrors BackendsErrors ManagementErrors ReceiversErrors MetrologyErrors MinorServoErrors \ ActiveSurfaceErrors \ - CommonInterface ManagmentInterface AntennaInterface ReceiversInterface BackendsInterface MinorServoInterface WeatherStationInterface ActiveSurfaceInterface XBackendInterface \ + CommonInterface ManagmentInterface AntennaInterface ReceiversInterface BackendsInterface MinorServoInterface WeatherStationInterface ActiveSurfaceInterface \ SRTAntennaInterface SRTActiveSurfaceInterface SRTWeatherStationInterface SRTReceiversInterface \ SlaLibrary IRALibrary TextWindowLibrary ParserLibrary XarcosLibrary SRTMinorServoLibrary ComponentProxy ModbusChannel PyTestingLibrary \ - AntennaBoss Observatory OTF PointingModel Refraction SkySource Moon FitsWriter Scheduler ReceiversBoss ExternalClients CalibrationTool TotalPower NoiseGenerator DBBC CustomLogger XBackend \ + AntennaBoss Observatory OTF PointingModel Refraction SkySource Moon FitsWriter Scheduler ReceiversBoss ExternalClients CalibrationTool TotalPower CustomLogger \ SRTMount SRTActiveSurfaceBoss SRTMinorServo SRTKBandMFReceiver SRTWeatherStation SRT7GHzReceiver SRTLPBandReceiver \ SRT5GHzReceiver PyDewarPositioner \ SRTPyIFDistributor AntennaBossTextClient ObservatoryTextClient GenericBackendTextClient ReceiversBossTextClient SystemTerminal CaltoolClient CustomLoggingClient SchedulerTextClient \ SRTActiveSurfaceGUIClient SRTMountTextClient MinorServoBossTextClient \ - Plotter KStars SRTScripts + Plotter KStars SRTScripts IDL_DOC:=Managment Antenna Backends SRTActiveSurface WeatherStation CPP_DOC:=Libraries AntennaImplementation SRTActiveSurfaceImplementation BackendsImplementation ReceiversImplementation WeatherStationImplementation MinorServoImplementation Managment_MODULES:=ManagmentInterface Antenna_MODULES:=AntennaInterface SRTAntennaInterface - Backends_MODULES:=BackendsInterface XBackendInterface + Backends_MODULES:=BackendsInterface WeatherStation_MODULES:=WeatherStationInterface SRTWeatherStationInterface Receivers_MODULES:=ReceiversInterface MinorServo_MODULES:=MinorServoInterface SRTActiveSurface_MODULES:=SRTActiveSurfaceInterface - Libraries_MODULES:=IRALibrary SlaLibrary TextWindowLibrary ParserLibrary XarcosLibrary SRTMinorServoLibrary PyTestingLibrary + Libraries_MODULES:=IRALibrary SlaLibrary TextWindowLibrary ParserLibrary SRTMinorServoLibrary PyTestingLibrary AntennaImplementation_MODULES:=Observatory SkySource OTF Moon PointingModel Refraction AntennaBoss SRTMount ManagementImplementation_MODULES:=Scheduler CalibrationTool FitsWriter ExternalClients - BackendsImplementation_MODULES:=TotalPower NoiseGenerator XBackend + BackendsImplementation_MODULES:=TotalPower ReceiversImplementation_MODULES:=ReceiversBoss SRTKBandMFReceiver SRT7GHzReceiver SRTLPBandReceiver WeatherStationImplementation_MODULES:=SRTWeatherStation SRTActiveSurfaceImplementation_MODULES:=SRTActiveSurfaceBoss @@ -121,10 +121,10 @@ ifeq ($(STATION),Medicina) SlaLibrary IRALibrary TextWindowLibrary ParserLibrary ComponentProxy ModbusChannel XarcosLibrary \ PyTestingLibrary MedicinaVertexLibrary \ AntennaBoss Observatory OTF PointingModel Refraction SkySource Moon FitsWriter Scheduler ReceiversBoss ExternalClients CalibrationTool \ - TotalPower NoiseGenerator MedicinaMount MedicinaPyLocalOscillator MedicinaPyDMed CustomLogger XBackend MedicinaMinorServo MedicinaActiveSurfaceBoss \ + TotalPower MedicinaMount MedicinaPyLocalOscillator MedicinaPyDMed CustomLogger MedicinaMinorServo MedicinaActiveSurfaceBoss \ AntennaBossTextClient ObservatoryTextClient GenericBackendTextClient ReceiversBossTextClient SystemTerminal CaltoolClient SchedulerTextClient MinorServoBossTextClient\ MedicinaActiveSurfaceGUIClient MedicinaMountTextClient CustomLoggingClient\ - Plotter KStars Scripts MedScripts + Plotter KStars Scripts MedScripts XBackend IDL_DOC:=Managment Antenna Backends WeatherStation Receivers CPP_DOC:=Libraries AntennaImplementation ManagementImplementation BackendsImplementation WeatherStationImplementation @@ -137,7 +137,7 @@ ifeq ($(STATION),Medicina) Libraries_MODULES:=IRALibrary SlaLibrary TextWindowLibrary ParserLibrary PyTestingLibrary AntennaImplementation_MODULES:=Observatory SkySource OTF Moon PointingModel Refraction AntennaBoss MedicinaMount ManagementImplementation_MODULES:=Scheduler CalibrationTool FitsWriter ExternalClients - BackendsImplementation_MODULES:=TotalPower NoiseGenerator XBackend + BackendsImplementation_MODULES:=TotalPower XBackend ReceiversImplementation_MODULES:=ReceiversBoss WeatherStationImplementation_MODULES:=MedWeatherStation Metrology MedicinaActiveSurfaceImplementation_MODULES:=MedicinaActiveSurfaceBoss