diff --git a/CHANGELOG.md b/CHANGELOG.md index d2ffd11ea3416ab2d58594d5918eb3e48a044f98..126aeaa1ed9beb993ea6e43171c6f6d709ffc458 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,4 +90,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/ ## Fixed issue #518 - In case of communication error we set a dummy value (100000) for the temperature properties, and the related timestamp keeps the value of the last communication timestamp. + issue #525 - When in LOCAL mode the receivers can turn on/off the noise mark and LNAs. There is no more MNG_FAILURE logging in case of LOCAL mode: only the LOCAL/REMOTE status (during component activation) and the change of status (LOCAL to REMOTE and viceversa) are written to the logfile. ## Changed diff --git a/Common/Servers/MFKBandBaseReceiver/src/MFKBandBaseCore.cpp b/Common/Servers/MFKBandBaseReceiver/src/MFKBandBaseCore.cpp index 26a8818e5b99c20b0030450a618349eb680f8adc..e6ce2e58fd30f9954bb0ae37a6643f9ea3c5be83 100644 --- a/Common/Servers/MFKBandBaseReceiver/src/MFKBandBaseCore.cpp +++ b/Common/Servers/MFKBandBaseReceiver/src/MFKBandBaseCore.cpp @@ -170,9 +170,27 @@ void CComponentCore::activate() throw ( m_calDiode=false; guard.release(); - lnaOn(); // Throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl) + lnaOn(); // Throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl) externalCalOff(); - + + bool answer; + try { + answer=m_control->isRemoteOn(); + } + catch (IRA::ReceiverControlEx& ex) { + _EXCPT(ReceiversErrors::ReceiverControlBoardErrorExImpl,impl,"CComponentCore::activate()"); + impl.setDetails(ex.what().c_str()); + setStatusBit(CONNECTIONERROR); + throw impl; + } + if (answer) { + _IRA_LOGFILTER_LOG(LM_NOTICE, "CComponentCore::activate()", "RECEIVER_COMMUNICATION_MODE_REMOTE"); + clearStatusBit(LOCAL); + } + else { + _IRA_LOGFILTER_LOG(LM_NOTICE, "CComponentCore::activate()", "RECEIVER_COMMUNICATION_MODE_LOCAL"); + setStatusBit(LOCAL); + } } @@ -188,10 +206,10 @@ void CComponentCore::externalCalOn() throw ( throw impl; } guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOn()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOn()"); + // throw impl; + // } try { m_control->setExtCalibrationOn(); } @@ -227,10 +245,10 @@ void CComponentCore::externalCalOff() throw ( throw impl; } guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOff()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOff()"); + // throw impl; + // } try { m_control->setExtCalibrationOff(); } @@ -277,10 +295,10 @@ void CComponentCore::calOn() throw ( throw impl; } // guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOn()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOn()"); + // throw impl; + // } try { m_control->setCalibrationOn(); m_calDiode=true; @@ -317,10 +335,10 @@ void CComponentCore::calOff() throw ( throw impl; } // guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOff()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOff()"); + // throw impl; + // } try { m_control->setCalibrationOff(); m_calDiode=false; @@ -393,10 +411,10 @@ void CComponentCore::lnaOff() throw ( ReceiversErrors::ReceiverControlBoardErrorExImpl ) { - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOff()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOff()"); + // throw impl; + // } try { m_control-> turnRightLNAsOff(); m_control-> turnLeftLNAsOff(); @@ -416,10 +434,10 @@ void CComponentCore::lnaOn() throw ( ReceiversErrors::ReceiverControlBoardErrorExImpl ) { - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOn()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOn()"); + // throw impl; + // } try { m_control-> turnRightLNAsOn(); m_control-> turnLeftLNAsOn(); @@ -834,10 +852,10 @@ void CComponentCore::updateComponent() { baci::ThreadSyncGuard guard(&m_mutex); m_componentStatus=Management::MNG_OK; - if (checkStatusBit(LOCAL)) { - setComponentStatus(Management::MNG_FAILURE); - _IRA_LOGFILTER_LOG(LM_CRITICAL,"CComponentCore::updateComponent()","RECEVER_NOT_REMOTELY_CONTROLLABLE"); - } + // if (checkStatusBit(LOCAL)) { + // setComponentStatus(Management::MNG_FAILURE); + // _IRA_LOGFILTER_LOG(LM_CRITICAL,"CComponentCore::updateComponent()","RECEIVER_NOT_REMOTELY_CONTROLLABLE"); + // } if (checkStatusBit(VACUUMPUMPFAULT)) { setComponentStatus(Management::MNG_WARNING); _IRA_LOGFILTER_LOG(LM_WARNING,"CComponentCore::updateComponent()","VACUUM_PUMP_FAILURE"); @@ -985,6 +1003,22 @@ void CComponentCore::updateIsRemote() throw (ReceiversErrors::ReceiverControlBoa setStatusBit(CONNECTIONERROR); throw impl; } + + if (checkStatusBit(LOCAL) && answer) { + _IRA_LOGFILTER_LOG( + LM_NOTICE, + "CComponentCore::updateIsRemote()", + "RECEIVER_SWITCHED_FROM_LOCAL_TO_REMOTE" + ); + } + else if (!checkStatusBit(LOCAL) && !answer) { + _IRA_LOGFILTER_LOG( + LM_NOTICE, + "CComponentCore::updateIsRemote()", + "RECEIVER_SWITCHED_FROM_REMOTE_TO_LOCAL" + ); + } + if (!answer) setStatusBit(LOCAL); else clearStatusBit(LOCAL); clearStatusBit(CONNECTIONERROR); // the communication was ok so clear the CONNECTIONERROR bit diff --git a/SRT/Servers/SRT7GHzReceiver/src/ComponentCore.cpp b/SRT/Servers/SRT7GHzReceiver/src/ComponentCore.cpp index 9839a49b37a0512dea01a03c26ee203b212e8502..4e29f8e85b1a1dec2d0b690d9e0f8e977e716adc 100644 --- a/SRT/Servers/SRT7GHzReceiver/src/ComponentCore.cpp +++ b/SRT/Servers/SRT7GHzReceiver/src/ComponentCore.cpp @@ -147,6 +147,25 @@ void CComponentCore::activate() throw (ReceiversErrors::ModeErrorExImpl,Componen guard.release(); lnaOn(); // throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl) externalCalOff(); + + bool answer; + try { + answer=m_control->isRemoteOn(); + } + catch (IRA::ReceiverControlEx& ex) { + _EXCPT(ReceiversErrors::ReceiverControlBoardErrorExImpl,impl,"CComponentCore::activate()"); + impl.setDetails(ex.what().c_str()); + setStatusBit(CONNECTIONERROR); + throw impl; + } + if (answer) { + _IRA_LOGFILTER_LOG(LM_NOTICE, "CComponentCore::activate()", "RECEIVER_COMMUNICATION_MODE_REMOTE"); + clearStatusBit(LOCAL); + } + else { + _IRA_LOGFILTER_LOG(LM_NOTICE, "CComponentCore::activate()", "RECEIVER_COMMUNICATION_MODE_LOCAL"); + setStatusBit(LOCAL); + } } @@ -162,10 +181,10 @@ void CComponentCore::externalCalOn() throw ( throw impl; } guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOn()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOn()"); + // throw impl; + // } try { m_control->setExtCalibrationOn(); } @@ -202,10 +221,10 @@ void CComponentCore::externalCalOff() throw ( throw impl; } guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOff()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOff()"); + // throw impl; + // } try { m_control->setExtCalibrationOff(); } @@ -274,10 +293,10 @@ void CComponentCore::calOn() throw (ReceiversErrors::NoRemoteControlErrorExImpl, throw impl; } // guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOn()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOn()"); + // throw impl; + // } try { m_control->setCalibrationOn(); } @@ -301,10 +320,10 @@ void CComponentCore::calOff() throw (ReceiversErrors::NoRemoteControlErrorExImpl throw impl; } // guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOff()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOff()"); + // throw impl; + // } try { m_control->setCalibrationOff(); } @@ -357,10 +376,10 @@ void CComponentCore::vacuumSensorOn() throw (ReceiversErrors::NoRemoteControlErr void CComponentCore::lnaOff() throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl) { - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOff()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOff()"); + // throw impl; + // } try { m_control-> turnRightLNAsOff(); m_control-> turnLeftLNAsOff(); @@ -376,10 +395,10 @@ void CComponentCore::lnaOff() throw (ReceiversErrors::NoRemoteControlErrorExImpl void CComponentCore::lnaOn() throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl) { - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOn()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOn()"); + // throw impl; + // } try { m_control-> turnRightLNAsOn(); m_control-> turnLeftLNAsOn(); @@ -698,10 +717,10 @@ void CComponentCore::updateComponent() { baci::ThreadSyncGuard guard(&m_mutex); m_componentStatus=Management::MNG_OK; - if (checkStatusBit(LOCAL)) { - setComponentStatus(Management::MNG_FAILURE); - _IRA_LOGFILTER_LOG(LM_CRITICAL,"CComponentCore::updateComponent()","RECEVER_NOT_REMOTELY_CONTROLLABLE"); - } + // if (checkStatusBit(LOCAL)) { + // setComponentStatus(Management::MNG_FAILURE); + // _IRA_LOGFILTER_LOG(LM_CRITICAL,"CComponentCore::updateComponent()","RECEIVER_NOT_REMOTELY_CONTROLLABLE"); + // } if (checkStatusBit(VACUUMPUMPFAULT)) { setComponentStatus(Management::MNG_WARNING); _IRA_LOGFILTER_LOG(LM_WARNING,"CComponentCore::updateComponent()","VACUUM_PUMP_FAILURE"); @@ -837,6 +856,22 @@ void CComponentCore::updateIsRemote() throw (ReceiversErrors::ReceiverControlBoa setStatusBit(CONNECTIONERROR); throw impl; } + + if (checkStatusBit(LOCAL) && answer) { + _IRA_LOGFILTER_LOG( + LM_NOTICE, + "CComponentCore::updateIsRemote()", + "RECEIVER_SWITCHED_FROM_LOCAL_TO_REMOTE" + ); + } + else if (!checkStatusBit(LOCAL) && !answer) { + _IRA_LOGFILTER_LOG( + LM_NOTICE, + "CComponentCore::updateIsRemote()", + "RECEIVER_SWITCHED_FROM_REMOTE_TO_LOCAL" + ); + } + if (!answer) setStatusBit(LOCAL); else clearStatusBit(LOCAL); clearStatusBit(CONNECTIONERROR); // the communication was ok so clear the CONNECTIONERROR bit diff --git a/SRT/Servers/SRTLPBandReceiver/src/ComponentCore.cpp b/SRT/Servers/SRTLPBandReceiver/src/ComponentCore.cpp index 1e38dc13683d13ff09d171938d490c36e2f1e605..4c6a81efd6801324e42741b6bd85eb3cc3be2d73 100755 --- a/SRT/Servers/SRTLPBandReceiver/src/ComponentCore.cpp +++ b/SRT/Servers/SRTLPBandReceiver/src/ComponentCore.cpp @@ -222,6 +222,25 @@ void CComponentCore::activate(const char * setup_mode) throw ( guard.release(); lnaOn(); // Throw (ReceiversErrors::NoRemoteControlErrorExImpl,ReceiversErrors::ReceiverControlBoardErrorExImpl) externalCalOff(); + + bool answer; + try { + answer=m_control->isRemoteOn(); + } + catch (IRA::ReceiverControlEx& ex) { + _EXCPT(ReceiversErrors::ReceiverControlBoardErrorExImpl,impl,"CComponentCore::activate()"); + impl.setDetails(ex.what().c_str()); + setStatusBit(CONNECTIONERROR); + throw impl; + } + if (answer) { + _IRA_LOGFILTER_LOG(LM_NOTICE, "CComponentCore::activate()", "RECEIVER_COMMUNICATION_MODE_REMOTE"); + clearStatusBit(LOCAL); + } + else { + _IRA_LOGFILTER_LOG(LM_NOTICE, "CComponentCore::activate()", "RECEIVER_COMMUNICATION_MODE_LOCAL"); + setStatusBit(LOCAL); + } } @@ -237,10 +256,10 @@ void CComponentCore::externalCalOn() throw ( throw impl; } guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOn()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOn()"); + // throw impl; + // } try { m_control->setExtCalibrationOn(); } @@ -277,10 +296,10 @@ void CComponentCore::externalCalOff() throw ( throw impl; } guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOff()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::externalCalOff()"); + // throw impl; + // } try { m_control->setExtCalibrationOff(); } @@ -324,10 +343,10 @@ void CComponentCore::calOn() throw ( throw impl; } // guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOn()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOn()"); + // throw impl; + // } try { m_control->setCalibrationOn(); m_calDiode=true; @@ -364,10 +383,10 @@ void CComponentCore::calOff() throw ( throw impl; } // guard.release(); - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOff()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::calOff()"); + // throw impl; + // } try { m_control->setCalibrationOff(); m_calDiode=false; @@ -440,10 +459,10 @@ void CComponentCore::lnaOff() throw ( ReceiversErrors::ReceiverControlBoardErrorExImpl ) { - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOff()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOff()"); + // throw impl; + // } try { m_control-> turnRightLNAsOff(); m_control-> turnLeftLNAsOff(); @@ -463,10 +482,10 @@ void CComponentCore::lnaOn() throw ( ReceiversErrors::ReceiverControlBoardErrorExImpl ) { - if (checkStatusBit(LOCAL)) { - _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOn()"); - throw impl; - } + // if (checkStatusBit(LOCAL)) { + // _EXCPT(ReceiversErrors::NoRemoteControlErrorExImpl,impl,"CComponentCore::lnaOn()"); + // throw impl; + // } try { m_control-> turnRightLNAsOn(); m_control-> turnLeftLNAsOn(); @@ -933,10 +952,10 @@ void CComponentCore::updateComponent() { baci::ThreadSyncGuard guard(&m_mutex); m_componentStatus=Management::MNG_OK; - if (checkStatusBit(LOCAL)) { - setComponentStatus(Management::MNG_FAILURE); - _IRA_LOGFILTER_LOG(LM_CRITICAL,"CComponentCore::updateComponent()","RECEVER_NOT_REMOTELY_CONTROLLABLE"); - } + // if (checkStatusBit(LOCAL)) { + // setComponentStatus(Management::MNG_FAILURE); + // _IRA_LOGFILTER_LOG(LM_CRITICAL,"CComponentCore::updateComponent()","RECEIVER_NOT_REMOTELY_CONTROLLABLE"); + // } if (checkStatusBit(VACUUMPUMPFAULT)) { setComponentStatus(Management::MNG_WARNING); _IRA_LOGFILTER_LOG(LM_WARNING,"CComponentCore::updateComponent()","VACUUM_PUMP_FAILURE"); @@ -1082,6 +1101,22 @@ void CComponentCore::updateIsRemote() throw (ReceiversErrors::ReceiverControlBoa setStatusBit(CONNECTIONERROR); throw impl; } + + if (checkStatusBit(LOCAL) && answer) { + _IRA_LOGFILTER_LOG( + LM_NOTICE, + "CComponentCore::updateIsRemote()", + "RECEIVER_SWITCHED_FROM_LOCAL_TO_REMOTE" + ); + } + else if (!checkStatusBit(LOCAL) && !answer) { + _IRA_LOGFILTER_LOG( + LM_NOTICE, + "CComponentCore::updateIsRemote()", + "RECEIVER_SWITCHED_FROM_REMOTE_TO_LOCAL" + ); + } + if (!answer) { setStatusBit(LOCAL); }