Commit eb12b7dd authored by Matteo DB's avatar Matteo DB
Browse files

controllo failure status durign activate

parent 80ae39e2
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -12,8 +12,8 @@
                "_UNICODE"
                "_UNICODE"
            ],
            ],
            "windowsSdkVersion": "10.0.17763.0",
            "windowsSdkVersion": "10.0.17763.0",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe",
            "cStandard": "c11",
            "cStandard": "c99",
            "cppStandard": "c++03"
            "cppStandard": "c++03"
        }
        }
    ],
    ],
+2 −1
Original line number Original line Diff line number Diff line
@@ -3,5 +3,6 @@
        "*.idl": "cpp",
        "*.idl": "cpp",
        "ira": "cpp",
        "ira": "cpp",
        "map": "cpp"
        "map": "cpp"
    }
    },
    "C_Cpp.errorSquiggles": "Enabled"
}
}
 No newline at end of file
+16 −4
Original line number Original line Diff line number Diff line
@@ -7,6 +7,7 @@ _IRA_LOGFILTER_IMPORT;


// speed of light in meters per second
// speed of light in meters per second
#define LIGHTSPEED 299792458.0
#define LIGHTSPEED 299792458.0
using namespace IRA;


CComponentCore::CComponentCore():
CComponentCore::CComponentCore():
    m_mixer()
    m_mixer()
@@ -43,6 +44,7 @@ CConfiguration const * const CComponentCore::execute() throw (ComponentErrors::
     * This Call sets default Recevier Configuration at CCC_Normal 
     * This Call sets default Recevier Configuration at CCC_Normal 
     * User has to call for Activate() and setupMode() to be more specific about receiver conf
     * User has to call for Activate() and setupMode() to be more specific about receiver conf
     */
     */
    m_componentStatus=Management::MNG_OK;
    m_configuration.init(m_services);  //throw (ComponentErrors::CDBAccessExImpl);    
    m_configuration.init(m_services);  //throw (ComponentErrors::CDBAccessExImpl);    
    try {
    try {
    	MED_TRACE_MSG(" Receiver new ");    	  
    	MED_TRACE_MSG(" Receiver new ");    	  
@@ -57,10 +59,14 @@ CConfiguration const * const CComponentCore::execute() throw (ComponentErrors::
		MED_TRACE_MSG(" Receiver new done");
		MED_TRACE_MSG(" Receiver new done");
    }
    }
    catch (std::bad_alloc& ex) {
    catch (std::bad_alloc& ex) {
        setComponentStatus(Management::MNG_FAILURE);
        _IRA_LOGFILTER_LOG(LM_CRITICAL,"CComponentCore::execute()","ReceiverControl allocation error");
        _EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"CComponentCore::execute()");
        _EXCPT(ComponentErrors::MemoryAllocationExImpl,dummy,"CComponentCore::execute()");
        throw dummy;
        throw dummy;
    }
    }
    catch (IRA::ReceiverControlEx& ex) {
    catch (IRA::ReceiverControlEx& ex) {
        setComponentStatus(Management::MNG_FAILURE);
        _IRA_LOGFILTER_LOG(LM_CRITICAL,"CComponentCore::execute()","ReceiverControl init error");
        _EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CComponentCore::execute()");
        _EXCPT(ComponentErrors::SocketErrorExImpl,dummy,"CComponentCore::execute()");
        throw dummy;
        throw dummy;
    }
    }
@@ -87,10 +93,16 @@ void CComponentCore::activate(const char *mode) throw (ReceiversErrors::ModeErro
	MED_TRACE_MSG(" IN ");
	MED_TRACE_MSG(" IN ");
    /* activate mode */
    /* activate mode */
    baci::ThreadSyncGuard guard(&m_mutex);
    baci::ThreadSyncGuard guard(&m_mutex);
    bool l_res= m_configuration.m_conf_hnd.setConfiguration(mode);
    /* Check component status */
    if(m_componentStatus!= Management::MNG_OK){
        MED_TRACE_MSG(" Cannot Activate with component status marked as FAILURE! ");
        _EXCPT(ReceiversErrors::ModeErrorExImpl,impl,"CComponentErrors::acitvate()");
        throw impl;
    }        
    bool l_res= m_configuration.m_conf_hnd.setConfiguration(IRA::CString(mode));
    if (! l_res){
    if (! l_res){
    		MED_TRACE_MSG(" EXC set mode");
    	MED_TRACE_MSG(" Activate, setMode failed");
        _EXCPT(ReceiversErrors::ModeErrorExImpl,impl,"CComponentErrors::setMode()");
        _EXCPT(ReceiversErrors::ModeErrorExImpl,impl,"CComponentErrors::activate()");
        throw impl;
        throw impl;
    }    
    }    
    guard.release();
    guard.release();