Commit 9ed7c82a authored by Andrea Orlat's avatar Andrea Orlat
Browse files

receivers boss client has new look to fit some displays from DewarPositioner

parent a448f253
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
/* Add the component skeleton header file */
/* ************************************* */
#include <ReceiversBossC.h>
#include <DewarPositionerC.h>
/* ************************************* */

/* Add the component errors header file */
@@ -58,7 +59,7 @@
/* define the main frame dimension */
/* ******************************* */
#define WINDOW_WIDTH 60     /*columns */
#define WINDOW_HEIGHT 15     /* rows */
#define WINDOW_HEIGHT 22     /* rows */
/* ******************************* */

/* define the routine name here, to be used for logging */
@@ -77,9 +78,12 @@
/* ********************************** */
#define COMPONENT_NAME "RECEIVERS/Boss"              /* the name of the instantiation of the component */
#define COMPONENT_INTERFACE_TPYE "IDL:alma/Receivers/ReceiversBoss:1.0"  /* the type of the interface */
#define DEWAR_INTERFACE_TPYE "IDL:alma/Receivers/DewarPositioner:1.0"
#define COMPONENT_IDL_MODULE Receivers	/* the IDL module that contains the component interface */
#define COMPONENT_IDL_INTERFACE ReceiversBoss  /* the IDL interface of the component */
#define DEWAR_IDL_INTERFACE DewarPositioner
#define COMPONENT_SMARTPOINTER ReceiversBoss_var /* the component type */
#define DEWAR_SMARTPOINTER DewarPositioner_var
/* ********************************** */

/* define user input command style */
+2 −2
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@ EXECUTABLES_L =
_tui_ReceiversBossTextClient_OBJECTS   = ReceiversBossTextClient
#xxxxx_LDFLAGS   =
_tui_ReceiversBossTextClient_LIBS      = ReceiversBossStubs CommonReceiverInterfaceStubs ReceiversDefinitionsStubs IRALibrary ManagmentDefinitionsStubs \
         TextWindowLibrary ClientErrors ComponentErrors ManagementErrors ReceiversErrors acsnc AntennaDefinitionsStubs

         TextWindowLibrary ClientErrors ComponentErrors ManagementErrors ReceiversErrors acsnc AntennaDefinitionsStubs \
         DewarPositionerStubs DewarPositionerDefinitionsStubs 

SCRIPTS         = receiversBossTui

+56 −17
Original line number Diff line number Diff line
@@ -63,8 +63,20 @@
		impl.log(); \
	}

IRA::CLogGuard guard(GUARDINTERVAL*1000);
TW::CLabel* extraLabel1;
TW::CLabel* extraLabel2;
TW::CLabel* extraLabel3;
TW::CLabel* extraLabel4;
TW::CLabel* extraLabel5;
TW::CLabel* extraLabel6;

#define COMPONENT_INTERFACE COMPONENT_IDL_MODULE::COMPONENT_IDL_INTERFACE
#define COMPONENT_DECLARATION COMPONENT_IDL_MODULE::COMPONENT_SMARTPOINTER
#define DEWAR_INTERFACE COMPONENT_IDL_MODULE::DEWAR_IDL_INTERFACE
#define DEWAR_DECLARATION COMPONENT_IDL_MODULE::DEWAR_SMARTPOINTER

#include "updateDewar.i"

using namespace TW;

@@ -195,6 +207,7 @@ int main(int argc, char *argv[]) {
	CORBA::Object_var obj;
	// Component declaration 
	COMPONENT_DECLARATION component;
	DEWAR_DECLARATION dewar;
		

	/* Add frame controls declaration */
@@ -299,6 +312,20 @@ int main(int argc, char *argv[]) {
	component=COMPONENT_INTERFACE::_narrow(obj.in());
	ACS_LOG(LM_FULL_INFO,MODULE_NAME"::Main()",(LM_DEBUG,"OK, reference is: %d",component.ptr()));
	ACE_OS::sleep(1);

	try {
		info=client.manager()->get_default_component(client.handle(),DEWAR_INTERFACE_TPYE);
		obj=info->reference;
		if (CORBA::is_nil(obj.in())) {
			ACS_LOG(LM_FULL_INFO,MODULE_NAME"::Main()",(LM_NOTICE,"Dewar positioner not available"));
		}
	}
	catch(...) {
		ACS_LOG(LM_FULL_INFO,MODULE_NAME"::Main()",(LM_NOTICE,"Dewar positioner not available"));
	}
	dewar=DEWAR_INTERFACE::_narrow(obj.in());
	ACS_LOG(LM_FULL_INFO,MODULE_NAME"::Main()",(LM_DEBUG,"OK, reference is: %d",dewar.ptr()));
	ACE_OS::sleep(1);
	try {
		/* Add all component properties here */
		_GET_ACS_PROPERTY(ACS::ROlong,IFs);
@@ -325,6 +352,13 @@ int main(int argc, char *argv[]) {
		LO_text=new CCustomPropertyText<_TW_SEQPROPERTYCOMPONENT_T_RO(double)>(LO.in());
		polarization_text=new CCustomPropertyText<_TW_SEQPROPERTYCOMPONENT_T_RO(long)>(polarization.in());
		tracking_display=new TW::CLedDisplay(1);
		extraLabel1=new CLabel("");
		extraLabel2=new CLabel("");
		extraLabel3=new CLabel("");
		extraLabel4=new CLabel("");
		extraLabel5=new CLabel("");
		extraLabel6=new CLabel("");

		/* ************************ */
		#if USE_OUTPUT_FIELD >=1 
			output_label=new TW::CLabel("");
@@ -370,6 +404,14 @@ int main(int argc, char *argv[]) {
		tracking_display->setOrientation(TW::CLedDisplay::HORIZONTAL);
		tracking_display->setLedStyle(0,TW::CStyle(CColorPair::GREEN_BLACK,0),TW::CStyle(CColorPair::RED_BLACK,0));

		// extra labels..........
		extraLabel1->setWidth(WINDOW_WIDTH-2); extraLabel1->setHeight(1); extraLabel1->setPosition(TW::CPoint(0,10));
		extraLabel2->setWidth(WINDOW_WIDTH-2); extraLabel2->setHeight(1); extraLabel2->setPosition(TW::CPoint(0,11));
		extraLabel3->setWidth(WINDOW_WIDTH-2); extraLabel3->setHeight(1); extraLabel3->setPosition(TW::CPoint(0,12));
		extraLabel4->setWidth(WINDOW_WIDTH-2); extraLabel4->setHeight(1); extraLabel4->setPosition(TW::CPoint(0,13));
		extraLabel5->setWidth(WINDOW_WIDTH-2); extraLabel5->setHeight(1); extraLabel5->setPosition(TW::CPoint(0,14));
		extraLabel6->setWidth(WINDOW_WIDTH-2); extraLabel6->setHeight(1); extraLabel6->setPosition(TW::CPoint(0,15));

		/* ****************************************************************** */
		_TW_SET_COMPONENT(userInput,0,WINDOW_HEIGHT-6,WINDOW_WIDTH-1,1,USER_INPUT_COLOR_PAIR,USER_INPUT_STYLE,NULL);
		#if USE_OUTPUT_FIELD >=1 
@@ -413,6 +455,8 @@ int main(int argc, char *argv[]) {
		_TW_ADD_LABEL("Bandwidth       :",0,7,17,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window);
		_TW_ADD_LABEL("Polarization    :",0,8,17,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window);
		_TW_ADD_LABEL("Dewar          :",31,2,17,1,CColorPair::WHITE_BLACK,CStyle::UNDERLINE,window);
		_TW_ADD_LABEL(" ____________________Dewar Positioner_____________________",0,9,WINDOW_WIDTH-2,1,CColorPair::GREEN_BLACK,CStyle::BOLD,window);

		/* ************************* */
		
		/** Add all required association: components/Frame */
@@ -426,6 +470,13 @@ int main(int argc, char *argv[]) {
		window.addComponent((CFrameComponent*)LO_text);
		window.addComponent((CFrameComponent*)polarization_text);
		window.addComponent((CFrameComponent*)tracking_display);
		window.addComponent((CFrameComponent*)extraLabel1);
		window.addComponent((CFrameComponent*)extraLabel2);
		window.addComponent((CFrameComponent*)extraLabel3);
		window.addComponent((CFrameComponent*)extraLabel4);
		window.addComponent((CFrameComponent*)extraLabel5);
		window.addComponent((CFrameComponent*)extraLabel6);

		/* ********************************************** */
		window.addComponent((CFrameComponent*)userInput);		
		#if USE_OUTPUT_FIELD >=1 
@@ -486,27 +537,12 @@ int main(int argc, char *argv[]) {
				output_label->Refresh();
			}
		}
		// automatic update of some controls.
		updateDewar(dewar.out());
		//sleep for the required ammount of time
		tv.set(0,MAINTHREADSLEEPTIME*1000);
		client.run(tv);
	}

	/*for(;;)	{
		if ((fieldCounter=userInput->parseCommand(fields,MAXFIELDNUMBER))>0) {
			fields[0].MakeUpper();
			if (fields[0]=="EXIT") break;
			else {
				#if USE_OUTPUT_FIELD >=1 
					IRA::CString Message("Unknown command");
					output_label->setValue(Message);
					output_label->Refresh();
				#endif
			}
		}
		client.run(tv);
		tv.set(0,MAINTHREADSLEEPTIME*1000);		
	}*/
		
	window.closeFrame();
	
	ACS_LOG(LM_FULL_INFO,MODULE_NAME"::Main()",(LM_INFO,MODULE_NAME"::RELEASING"));
@@ -522,6 +558,9 @@ CloseLabel:
	ACE_OS::sleep(1);	
	try {
		client.releaseComponent(COMPONENT_NAME);
		if (!CORBA::is_nil(dewar)) {
			client.releaseComponent(dewar->name());
		}
	}
	catch (maciErrType::CannotReleaseComponentExImpl& E) {
		E.log();
+1 −1
Original line number Diff line number Diff line
@@ -8,4 +8,4 @@
# Andrea Orlati(aorlati@ira.inaf.it) 19/09/2011      Creation                                  
#************************************************************************

xterm -geometry 60x15+200+200 +sb -title Receivers -e /bin/bash --login -c "_tui_ReceiversBossTextClient $1" &
xterm -geometry 60x22+200+200 +sb -title Receivers -e /bin/bash --login -c "_tui_ReceiversBossTextClient $1" &
+91 −0
Original line number Diff line number Diff line


#ifndef _UPDATEDEWAR_I_
#define _UPDATEDEWAR_I_

void updateDewar(Receivers::DewarPositioner_ptr& dewar);

void updateDewar(Receivers::DewarPositioner_ptr& dewar)
{
	char *corbaStr;
	IRA::CString configuration;
	bool isRewRequired;
	double position,iStaticPos,iParPos,dParPos;
	bool isReady;
	Receivers::TDewarPositionerScanInfo_var info;
	IRA::CString outString,format;
	if (CORBA::is_nil(dewar)) {
		outString="                 ----- Not Available ----- ";
		extraLabel3->setValue(outString);
		extraLabel3->setStyle(TW::CStyle(TW::CColorPair::GREEN_BLACK,0));
		extraLabel3->Refresh();
		return;
	}
	try {
		if (dewar->isConfigured()) {
			corbaStr=dewar->getConfiguration();
			configuration=corbaStr;
			CORBA::string_free(corbaStr);
			isRewRequired=dewar->isRewindingRequired();
			position=dewar->getPosition();
			isReady=dewar->isReady();
			info=dewar->getScanInfo();
			iStaticPos=info->iStaticPos;
			iParPos=info->iParallacticPos;
			dParPos=info->dParallacticPos;
		}
		else {
			configuration="none";
			isRewRequired=false;
			position=0.0;
			isReady=true;
			iStaticPos=iParPos=dParPos=0;
		}
	}
	catch (...) {
		_EXCPT(ClientErrors::UnknownExImpl,impl,"::Main()");
		_IRA_LOGGUARD_LOG_EXCEPTION(guard,impl,LM_ERROR);
		return;
	}
	outString="Configuration: "+configuration;
	extraLabel1->setValue(outString);
	extraLabel1->setStyle(TW::CStyle(TW::CColorPair::WHITE_BLACK,0));
	extraLabel1->Refresh();
	if (isReady) {
		outString="Dewar is ready";
		extraLabel2->setValue(outString);
		extraLabel2->setStyle(TW::CStyle(TW::CColorPair::GREEN_BLACK,0));
		extraLabel2->Refresh();
	}
	else {
		outString="Dewar not ready";
		extraLabel2->setValue(outString);
		extraLabel2->setStyle(TW::CStyle(TW::CColorPair::RED_BLACK,0));
		extraLabel2->Refresh();
	}
	format.Format("%05.1lf",position);
	outString="Derotator Position: "+format;
	extraLabel3->setValue(outString);
	extraLabel3->setStyle(TW::CStyle(TW::CColorPair::WHITE_BLACK,0));
	extraLabel3->Refresh();
	format.Format("%05.1lf / %05.1lf / %05.1lf",iStaticPos,iParPos,dParPos);
	outString="Dewar Position: "+format;
	extraLabel4->setValue(outString);
	extraLabel4->setStyle(TW::CStyle(TW::CColorPair::WHITE_BLACK,0));
	extraLabel4->Refresh();
	if (isRewRequired) {
		outString="Rewinding required";
		extraLabel5->setValue(outString);
		extraLabel5->setStyle(TW::CStyle(TW::CColorPair::RED_BLACK,0));
		extraLabel5->Refresh();
	}
	else {
		outString="Rewinding not required";
		extraLabel5->setValue(outString);
		extraLabel5->setStyle(TW::CStyle(TW::CColorPair::GREEN_BLACK,0));
		extraLabel5->Refresh();
	}
}

#endif