Commit e28bc8ad authored by SRT Operator's avatar SRT Operator
Browse files

Roach integration

parent 0d5d7560
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -231,6 +231,10 @@ public:
	void setup(const char *conf) throw (BackendsErrors::BackendBusyExImpl,BackendsErrors::ConfigurationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,
			ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl);
	
	void setTargetFileName(const char *conf);
	
    void sendTargetFileName() throw (BackendsErrors::BackendBusyExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl, ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl);

	/**
	 * 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
@@ -444,6 +448,8 @@ public:

	int getCommProtVersion(CORBA::String_out version);

    IRA::CString m_targetFileName;

protected:
	/**
	 * Automatically called by the framework as a result of a connection request. See super-class for more details.
+46 −1
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ void CCommandLine::setConfiguration(const long& inputId,const double& freq,const
		throw impl;
	}*/
    if (pol == 2) { // FULL STOKES
        m_sectionsNumber = m_sectionsNumber/2;
        m_sectionsNumber = 1; // TBC!!!!!!!!!!!!!!!!!!!!!!!!
        m_polarization[inputId] = Backends::BKND_FULL_STOKES;
    }
	if (inputId>=0) {  //check the section id is in valid ranges
@@ -917,6 +917,51 @@ void CCommandLine::setDefaultConfiguration(const IRA::CString & config) throw (C
	ACS_LOG(LM_FULL_INFO,"CCommandLine::setDefaultConfiguration()",(LM_INFO,"DEFAULTS_ARE_SET"));
}

void CCommandLine::setTargetFileName(const char *conf)
{
    m_targetFileName = (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);
	}
	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_INFO,"targetFileName SENT"));
}

void CCommandLine::setup(const char *conf) throw (BackendsErrors::BackendBusyExImpl,BackendsErrors::ConfigurationErrorExImpl,ComponentErrors::TimeoutExImpl,BackendsErrors::ConnectionExImpl,
		ComponentErrors::SocketErrorExImpl,BackendsErrors::NakExImpl,ComponentErrors::CDBAccessExImpl)
{
+38 −2
Original line number Diff line number Diff line
@@ -480,7 +480,7 @@ void RoachImpl::sendStop() throw (CORBA::SystemException, BackendsErrors::Backen
		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();
	//line.Release();
	//m_senderThread->suspendTransfer();

	try {
@@ -496,6 +496,22 @@ void RoachImpl::sendStop() throw (CORBA::SystemException, BackendsErrors::Backen
		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,"RoachImpl::sendStop()");
		dummy.log(LM_DEBUG);
		throw dummy.getComponentErrorsEx();
	}
}

/*void RoachImpl::setAllSections(CORBA::Double freq,CORBA::Double bw,CORBA::Long feed,Backends::TPolarization pol,CORBA::Double sr,CORBA::Long bins) throw (
@@ -548,7 +564,27 @@ void RoachImpl::setSection(CORBA::Long input,CORBA::Double freq,CORBA::Double bw
void RoachImpl::setTargetFileName (const char * fileName) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,
		BackendsErrors::BackendsErrorsEx)
{
	// nothing to do
	AUTO_TRACE("RoachImpl::setTargetFileName()");
	CSecAreaResourceWrapper<CCommandLine> line=m_commandLine->Get();

	line->setTargetFileName(fileName);

    /*try {
	}
	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,"RoachImpl::setSection()");
		dummy.log(LM_DEBUG);
		throw dummy.getComponentErrorsEx();
	}*/

}

ACS::doubleSeq *RoachImpl::getTpi() throw (CORBA::SystemException,