Commit 204e91b7 authored by Giuseppe Carboni's avatar Giuseppe Carboni Committed by GitHub
Browse files

Fix #539, parser now supports strings as return. Added a welcome message to the user (SRT). (#543)



* Fix issue #539: parser expanded in order to support strings as return value. logString_type added to types list.
This now should allow to 'project' command to send a wellcome message to the user.

* Fix #539. Added a custom welcome message for the SRT station.

The message reminds the user, whenever the `project` command is issued, to check the status of the telescope in the relative webpage.

* Fix #539, moved the welcomeMessage parameter to DataBlock

Co-authored-by: default avatarAndrea Orlati <a.orlati@ira.inaf.it>
parent a5cdccd6
Loading
Loading
Loading
Loading
+24 −11
Original line number Diff line number Diff line
@@ -133,7 +133,6 @@ def main():
					cmd=raw_input("<%d> "%cmdCounter)
				except IOError:
					cmd='exit'
					pass
			else:
				cmd="version"
			cmdCounter=cmdCounter+1
@@ -157,6 +156,15 @@ def main():
					idx = res.find('\\')
					cmd_name, response = res[:idx+1], res[idx+1:].rstrip('\\')
					if success and response:
						if response.startswith('STR '):
							# We got a formatted string in return, print it
							# without any modification
							response = response[4:]
							lines = response.split('\n')
							print cmd_name
							for line in lines:
								print line
						else:
							groups = response.split(',')
							for group in groups:
								values = group.split(';')
@@ -173,8 +181,13 @@ def main():
					newEx.setAction("command()")
					newEx.setReason(ex.message)
					newEx.log(simpleClient.getLogger(),ACSLog.ACS_LOG_ERROR) 
		except KeyboardInterrupt:
		except EOFError:
			# CTRL + D event: Equivalent to the exit command, we stop the loop
			stopAll=True
		except KeyboardInterrupt:
			# CTRL + C event: Ignore whatever string was written on the
			# terminal and show a new prompt line
			print '^C'
            
	readline.write_history_file(historyFile)            
	simpleClient.releaseComponent(compName)     
+3 −1
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@
	<xs:attribute name="xPolarMotion" type="xs:double" use="required"/>
	<!--  allow to configure the startup geodetic model  -->
	<xs:attribute name="geodeticModel" type="xs:long" use="required"/>
	<!-- The message to be displayed whenever a new 'project' command is issued -->
	<xs:attribute name="welcomeMessage" type="xs:string" use="required" />
	
</xs:complexType>

+3 −2
Original line number Diff line number Diff line
@@ -205,10 +205,11 @@ module Management {
		/**
		 * This method sets the current project code. If the project does not exists an error is thrown.
		 * @param code code of the project, if blank the selected code will be default one
		 * @param message this will returns a wellcome message from the control software
		 * @throw ManagementErrors::ManagementErrorsEx 
		 * @throw CORBA::SystemExcpetion 
		 */
		void setProjectCode(in string code) raises (ManagementErrors::ManagementErrorsEx);
		void setProjectCode(in string code, out string message) raises (ManagementErrors::ManagementErrorsEx);

		/**
		 * It allows to immediately start a scan that involves a primary focus axis or a subreflector axis. The scan is performed of the currently
+13 −0
Original line number Diff line number Diff line
@@ -107,6 +107,19 @@ public:
	}
};

class longString_converter
{
public:
	IRA::CString strToVal(const char * str) throw (ParserErrors::BadTypeFormatExImpl) {
		return IRA::CString(str);
	}
	char *valToStr(const IRA::CString& val) {
		char *c=new char[val.GetLength()+1];
		strcpy(c,(const char*)val);
		return c;
	}
};

template <_sp_symbols OUT> class angle_converter
{
public:
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ typedef basic_type<ACS::Time,time_converter> time_type;
typedef basic_type<ACS::TimeInterval,interval_converter> interval_type;
typedef basic_type<ACS::longSeq,longSeq_converter> longSeq_type;
typedef basic_type<ACS::doubleSeq,doubleSeq_converter> doubleSeq_type;
typedef basic_type<IRA::CString,longString_converter> longString_type;


class string_type: public virtual basic_type<char *,string_converter,_no_wildcard>
Loading