Commit d5a4949f authored by Fabio Vitello's avatar Fabio Vitello
Browse files

#595 added ifdist local commands for Noto Station

parent 22edc2f3
Loading
Loading
Loading
Loading
+225 −206
Original line number Diff line number Diff line
@@ -12,8 +12,7 @@ _IRA_LOGFILTER_IMPORT;

#define SCHED_EXECUTOR_NAME "SCHED_THREAD"

CCore::CCore(ContainerServices *service,CConfiguration *conf,DiscosLocals::StationConfig* stConfig) : 
	m_config(conf), m_stationConf(stConfig), m_services(service)
CCore::CCore(ContainerServices *service, CConfiguration *conf, DiscosLocals::StationConfig *stConfig) : m_config(conf), m_stationConf(stConfig), m_services(service)
{
}

@@ -35,20 +34,24 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
{
	Antenna::TSiteInformation_var site;
	Antenna::Observatory_var observatory = Antenna::Observatory::_nil();
	try {
	try
	{
		observatory = m_services->getDefaultComponent<Antenna::Observatory>((const char *)m_config->getObservatoryComponent());
	}
	catch (maciErrType::CannotGetComponentExImpl& ex) {
	catch (maciErrType::CannotGetComponentExImpl &ex)
	{
		_ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl, Impl, ex, "CCore::execute()");
		Impl.setComponentName((const char *)m_config->getObservatoryComponent());
		throw Impl;
	}
	catch (maciErrType::NoPermissionExImpl& ex) {
	catch (maciErrType::NoPermissionExImpl &ex)
	{
		_ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl, Impl, ex, "CCore::execute()");
		Impl.setComponentName((const char *)m_config->getObservatoryComponent());
		throw Impl;
	}
	catch (maciErrType::NoDefaultComponentExImpl& ex) {
	catch (maciErrType::NoDefaultComponentExImpl &ex)
	{
		_ADD_BACKTRACE(ComponentErrors::CouldntGetComponentExImpl, Impl, ex, "CCore::execute()");
		Impl.setComponentName((const char *)m_config->getObservatoryComponent());
		throw Impl;
@@ -56,10 +59,12 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	/*catch (...) {
	}*/
	ACS_LOG(LM_FULL_INFO, "CCore::execute()", (LM_INFO, "OBSERVATORY_LOCATED"));
	try	{	
	try
	{
		site = observatory->getSiteSummary(); //throw CORBA::SYSTEMEXCEPTION
	}
	catch (CORBA::SystemException& ex)	{
	catch (CORBA::SystemException &ex)
	{
		_EXCPT(ComponentErrors::CORBAProblemExImpl, __dummy, "CCore::updateSite()");
		__dummy.setName(ex._name());
		__dummy.setMinor(ex.minor());
@@ -68,10 +73,12 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	m_site = IRA::CSite(site.out());
	m_dut1 = site->DUT1;
	ACS_LOG(LM_FULL_INFO, "CCore::execute()", (LM_INFO, "SITE_INITIALIZED"));
	try {
	try
	{
		m_services->releaseComponent((const char *)observatory->name());
	}
	catch  (maciErrType::CannotReleaseComponentExImpl& ex) {
	catch (maciErrType::CannotReleaseComponentExImpl &ex)
	{
		_ADD_BACKTRACE(ComponentErrors::CouldntReleaseComponentExImpl, Impl, ex, "CCore::execute()");
		Impl.setComponentName((const char *)observatory->name());
		throw Impl;
@@ -81,25 +88,30 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	RESOURCE_EXEC;

	// spawn schedule executor thread........
	try {
	try
	{
		CCore *tmp = this;
		m_schedExecuter = m_services->getThreadManager()->create<CScheduleExecutor, CCore *>(SCHED_EXECUTOR_NAME, tmp);
	}
	catch (acsthreadErrType::acsthreadErrTypeExImpl& ex) {
	catch (acsthreadErrType::acsthreadErrTypeExImpl &ex)
	{
		_ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl, _dummy, ex, "CCore::execute()");
		throw _dummy;
	}
	catch (...) {
	catch (...)
	{
		_THROW_EXCPT(ComponentErrors::UnexpectedExImpl, "CCore::execute()");
	}
	m_schedExecuter->initialize(m_services, m_dut1, m_site, m_config); // throw (ComponentErrors::TimerErrorExImpl)
	ACS::TimeInterval sleepTime = m_config->getScheduleExecutorSleepTime() * 10;
	m_schedExecuter->setSleepTime(sleepTime);

   try {
		m_parser=new CParser<CCore>(this,10,true);\
	try
	{
		m_parser = new CParser<CCore>(this, 10, true);
	}
	catch (...) {
	catch (...)
	{
		_EXCPT(ComponentErrors::MemoryAllocationExImpl, dummy, "CCore::execute()");
		throw dummy;
	}
@@ -117,8 +129,7 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	m_parser->add("device", new function1<CCore, non_constant, void_type, I<long_type> >(this, &CCore::_setDevice), 1);
	m_parser->add("chooseBackend", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_chooseDefaultBackend), 1);
	m_parser->add("chooseRecorder", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_chooseDefaultDataRecorder), 1);
	m_parser->add("crossScan",new function3<CCore,non_constant,void_type,I<enum_type<AntennaFrame2String,Antenna::TCoordinateFrame > >,I<angleOffset_type<rad> >,
			I<interval_type> >(this,&CCore::crossScan),3);
	m_parser->add("crossScan", new function3<CCore, non_constant, void_type, I<enum_type<AntennaFrame2String, Antenna::TCoordinateFrame> >, I<angleOffset_type<rad> >, I<interval_type> >(this, &CCore::crossScan), 3);
	m_parser->add("peakerScan", new function3<CCore, non_constant, void_type, I<string_type>, I<double_type>, I<interval_type> >(this, &CCore::peakerScan), 3);
	m_parser->add("log", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_changeLogFile), 1);
	m_parser->add("logMessage", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_logMessage), 1);
@@ -130,6 +141,8 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	// m_parser->add("ifd","_ifd",1,"SRT");
	m_parser->add("calmux", "_calmux", 1);
	m_parser->add("dmed", "_dmed", 1, "Medicina");
	m_parser->add("ifdist", "_ifdist", 1, "Noto");

	m_parser->add("restFrequency", new function1<CCore, non_constant, void_type, I<doubleSeq_type> >(this, &CCore::_setRestFrequency), 1);
	m_parser->add("fTrack", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_fTrack), 1);
	m_parser->add("peaker", new function3<CCore, non_constant, void_type, I<string_type>, I<double_type>, I<interval_type> >(this, &CCore::_peaker), 3);
@@ -137,9 +150,7 @@ void CCore::execute() throw (ComponentErrors::TimerErrorExImpl,ComponentErrors::
	m_parser->add("latOTF", new function3<CCore, non_constant, void_type, I<enum_type<AntennaFrame2String, Antenna::TCoordinateFrame> >, I<angleOffset_type<rad> >, I<interval_type> >(this, &CCore::_latOTF), 3);
	m_parser->add("skydipOTF", new function3<CCore, non_constant, void_type, I<elevation_type<rad, false> >, I<elevation_type<rad, false> >, I<interval_type> >(this, &CCore::_skydipOTF), 3);
	m_parser->add("moon", new function0<CCore, non_constant, void_type>(this, &CCore::_moon), 0);
	m_parser->add("sidereal",new function5<CCore,non_constant,void_type,I<string_type>,I<rightAscension_type<rad,true> >,
			I<declination_type<rad,true> >,I<enum_type<AntennaEquinox2String,Antenna::TSystemEquinox > >,
			I<enum_type<AntennaSection2String,Antenna::TSections> > >(this,&CCore::_sidereal),5);
	m_parser->add("sidereal", new function5<CCore, non_constant, void_type, I<string_type>, I<rightAscension_type<rad, true> >, I<declination_type<rad, true> >, I<enum_type<AntennaEquinox2String, Antenna::TSystemEquinox> >, I<enum_type<AntennaSection2String, Antenna::TSections> > >(this, &CCore::_sidereal), 5);
	m_parser->add("track", new function1<CCore, non_constant, void_type, I<string_type> >(this, &CCore::_track), 1);
	m_parser->add("goTo", new function2<CCore, non_constant, void_type, I<azimuth_type<rad, false> >, I<elevation_type<rad, false> > >(this, &CCore::_goTo), 2);
	m_parser->add("abort", new function0<CCore, non_constant, void_type>(this, &CCore::_abort), 0);
@@ -229,7 +240,8 @@ void CCore::cleanUp()
	unloadWeatherStation(m_weatherStation);
	unloadDefaultBackend();
	unloadDefaultDataReceiver();
	if (m_schedExecuter!=NULL) m_schedExecuter->suspend();
	if (m_schedExecuter != NULL)
		m_schedExecuter->suspend();
	m_services->getThreadManager()->destroy(m_schedExecuter);
	ACS_LOG(LM_FULL_INFO, "CCore::cleanUp()", (LM_INFO, "THREAD_DESTROYED"));
}
@@ -243,8 +255,10 @@ void CCore::skydip(const double& el1,const double& el2,const ACS::TimeInterval&
	ManagementErrors::RecordingAlreadyActiveExImpl, ManagementErrors::CloseTelescopeScanErrorExImpl)
{
	//no need to get the mutex, because it is already done inside the executor object
	if (m_schedExecuter) {
		if (m_schedExecuter->isScheduleActive()) {
	if (m_schedExecuter)
	{
		if (m_schedExecuter->isScheduleActive())
		{
			_THROW_EXCPT(ManagementErrors::NotAllowedDuringScheduleExImpl, "CCore::skydip()");
		}
	}
@@ -393,8 +407,10 @@ void CCore::peakerScan(const char *axis,const double& span,const ACS::TimeInterv
																									  ComponentErrors::ValidationErrorExImpl, ManagementErrors::TelescopeSubScanErrorExImpl)
{
	//no need to get the mutex, because it is already done inside the executor object
	if (m_schedExecuter) {
		if (m_schedExecuter->isScheduleActive()) {
	if (m_schedExecuter)
	{
		if (m_schedExecuter->isScheduleActive())
		{
			_THROW_EXCPT(ManagementErrors::NotAllowedDuringScheduleExImpl, "CCore::peakerScan()");
		}
	}
@@ -423,8 +439,10 @@ void CCore::crossScan(const Antenna::TCoordinateFrame& scanFrame,const double& s
	ManagementErrors::RecordingAlreadyActiveExImpl, ManagementErrors::CloseTelescopeScanErrorExImpl)
{
	//no need to get the mutex, because it is already done inside the executor object
	if (m_schedExecuter) {
		if (m_schedExecuter->isScheduleActive()) {
	if (m_schedExecuter)
	{
		if (m_schedExecuter->isScheduleActive())
		{
			_THROW_EXCPT(ManagementErrors::NotAllowedDuringScheduleExImpl, "CCore::crossScan()");
		}
	}
@@ -465,14 +483,17 @@ void CCore::clearStatus()

bool CCore::command(const IRA::CString &cmd, IRA::CString &answer)
{
	try {
	try
	{
		m_parser->run(cmd, answer); //parser is already thread safe.....
		return true;
	}
	catch (ParserErrors::ParserErrorsExImpl &ex) {
	catch (ParserErrors::ParserErrorsExImpl &ex)
	{
		return false;
	}
	catch (ACSErr::ACSbaseExImpl& ex) {
	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.
		return false;
	}
@@ -484,7 +505,6 @@ bool CCore::command(const IRA::CString& cmd,IRA::CString& answer)

/////// PRIVATES


#include "Core_Common.i"

#include "Core_Resource.i"
@@ -492,4 +512,3 @@ bool CCore::command(const IRA::CString& cmd,IRA::CString& answer)
#include "Core_Extra.i"

#include "Core_Basic.i"