Commit e7da716f authored by mfioren's avatar mfioren
Browse files

SRTDBESM updated, error handling

parent 7e665099
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
<?xml version='1.0' encoding='ISO-8859-1'?>

<SRTDBESM xmlns="urn:schemas-cosylab-com:SRTDBESM:1.0" xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" addr_1="15" addr_2="14" addr_3="13" addr_4="12" DBESM_IPAddress="127.0.0.1" DBESM_Port="11111">
    <addr_1 description="values of the 5 double port registers on board 1" />	   	
    <addr_1 description="address of board 1" />	
    <addr_2 description="address of board 2" />
    <addr_3 description="address of board 3" />	
    <addr_4 description="address of board 4" />	     	
   	<regs_1 description="values of the 5 double port registers on board 1" />	
		<regs_2 description="values of the 5 double port registers on board 2" />
  		<regs_3 description="values of the 5 double port registers on board 3" />	
+23 −20
Original line number Diff line number Diff line
@@ -17,34 +17,37 @@
    <xs:extension base="baci:CharacteristicComponent">
      <xs:sequence>
      <xs:element name="addr_1" type="baci:ROlong" />
	    	 <xs:element name="regs_1" type="baci:ROuLongSeq" />
	   	 <xs:element name="regs_2" type="baci:ROuLongSeq" />
	   	 <xs:element name="regs_3" type="baci:ROuLongSeq" />
	   	 <xs:element name="regs_4" type="baci:ROuLongSeq" />
      <xs:element name="addr_2" type="baci:ROlong" />
      <xs:element name="addr_3" type="baci:ROlong" />
      <xs:element name="addr_4" type="baci:ROlong" />
	    	 <xs:element name="regs_1" type="baci:ROlongSeq" />
	   	 <xs:element name="regs_2" type="baci:ROlongSeq" />
	   	 <xs:element name="regs_3" type="baci:ROlongSeq" />
	   	 <xs:element name="regs_4" type="baci:ROlongSeq" />
	    <xs:element name="atts_1" type="baci:ROdoubleSeq" />
	    <xs:element name="atts_2" type="baci:ROdoubleSeq" />
	    <xs:element name="atts_3" type="baci:ROdoubleSeq" />
	    <xs:element name="atts_4" type="baci:ROdoubleSeq" />
	    	 <xs:element name="amps_1" type="baci:ROuLongSeq" />
	   	 <xs:element name="amps_2" type="baci:ROuLongSeq" />
	   	 <xs:element name="amps_3" type="baci:ROuLongSeq" />
	   	 <xs:element name="amps_4" type="baci:ROuLongSeq" />
	    <xs:element name="eqs_1" type="baci:ROuLongSeq" />
	    <xs:element name="eqs_2" type="baci:ROuLongSeq" />
	    <xs:element name="eqs_3" type="baci:ROuLongSeq" />
	    <xs:element name="eqs_4" type="baci:ROuLongSeq" />
	    	 <xs:element name="bpfs_1" type="baci:ROuLongSeq" />
	   	 <xs:element name="bpfs_2" type="baci:ROuLongSeq" />
	   	 <xs:element name="bpfs_3" type="baci:ROuLongSeq" />
	   	 <xs:element name="bpfs_4" type="baci:ROuLongSeq" />
	    	 <xs:element name="amps_1" type="baci:ROlongSeq" />
	   	 <xs:element name="amps_2" type="baci:ROlongSeq" />
	   	 <xs:element name="amps_3" type="baci:ROlongSeq" />
	   	 <xs:element name="amps_4" type="baci:ROlongSeq" />
	    <xs:element name="eqs_1" type="baci:ROlongSeq" />
	    <xs:element name="eqs_2" type="baci:ROlongSeq" />
	    <xs:element name="eqs_3" type="baci:ROlongSeq" />
	    <xs:element name="eqs_4" type="baci:ROlongSeq" />
	    	 <xs:element name="bpfs_1" type="baci:ROlongSeq" />
	   	 <xs:element name="bpfs_2" type="baci:ROlongSeq" />
	   	 <xs:element name="bpfs_3" type="baci:ROlongSeq" />
	   	 <xs:element name="bpfs_4" type="baci:ROlongSeq" />
	    <xs:element name="volts_1" type="baci:ROdoubleSeq" />
	    <xs:element name="volts_2" type="baci:ROdoubleSeq" />
	    <xs:element name="volts_3" type="baci:ROdoubleSeq" />
	    <xs:element name="volts_4" type="baci:ROdoubleSeq" />
	    	 <xs:element name="temps_1" type="baci:ROdoubleSeq" />
	   	 <xs:element name="temps_2" type="baci:ROdoubleSeq" />
	   	 <xs:element name="temps_3" type="baci:ROdoubleSeq" />
	   	 <xs:element name="temps_4" type="baci:ROdoubleSeq" />
	    	 <xs:element name="temps_1" type="baci:ROdouble" />
	   	 <xs:element name="temps_2" type="baci:ROdouble" />
	   	 <xs:element name="temps_3" type="baci:ROdouble" />
	   	 <xs:element name="temps_4" type="baci:ROdouble" />
      </xs:sequence>
       <xs:attribute name="addr_1" type="xs:long" use="required"/>
	    <xs:attribute name="addr_2" type="xs:long" use="required"/>
+26 −13
Original line number Diff line number Diff line
@@ -20,17 +20,23 @@ module Backends {
	/*

	 DBESM boards addresses and components values
        addr_2, addr_3, addr_4;
	attribute ACS::ROuLongSeq regs_1, regs_2, regs_3, regs_4;
	attribute ACS::ROdoubleSeq atts_1, atts_2, atts_3, atts_4;
	attribute ACS::ROuLongSeq amps_1, amps_2, amps_3, amps_4;
	attribute ACS::ROuLongSeq eqs_1, eqs_2, eqs_3, eqs_4;
	attribute ACS::ROuLongSeq bpfs_1, bpfs_2, bpfs_3, bpfs_4;
	attribute ACS::ROdoubleSeq volts_1, volts_2, volts_3, volts_4;
	attribute ACS::ROdoubleSeq temps_1, temps_2, temps_3, temps_4;
	
        */
        readonly attribute ACS::ROlong addr_1; 
        readonly attribute ACS::ROlong addr_1, addr_2, addr_3, addr_4;
	
        readonly attribute ACS::ROlongSeq regs_1, regs_2, regs_3, regs_4;
	
	readonly attribute ACS::ROdoubleSeq atts_1, atts_2, atts_3, atts_4;

	readonly attribute ACS::ROlongSeq amps_1, amps_2, amps_3, amps_4;

	readonly attribute ACS::ROlongSeq eqs_1, eqs_2, eqs_3, eqs_4;

	readonly attribute ACS::ROlongSeq bpfs_1, bpfs_2, bpfs_3, bpfs_4;

	readonly attribute ACS::ROdoubleSeq volts_1, volts_2, volts_3, volts_4;

	readonly attribute ACS::ROdouble temps_1, temps_2, temps_3, temps_4;

	void set_all(in string cfg_name) raises (BackendsErrors::BackendsErrorsEx);

@@ -42,6 +48,13 @@ module Backends {

	void clr_mode(in string cfg_name) raises (BackendsErrors::BackendsErrorsEx);

	string get_status(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);

	string get_comp(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);

	string get_diag(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);

//	string get_diag_all() raises (BackendsErrors::BackendsErrorsEx);

	/**
	 set whole DBESM configuration 
@@ -135,27 +148,27 @@ module Backends {

	
	
	string get_status(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);
	

	/**
	 get single DBESM board amps, eqs and bpfs values 

	
	string get_comp(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);

	
	/**
	 get single DBESM board voltages and temperatures 


	
	string get_diag(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);

	
	/**
	 get whole DBESM voltages and temperatures 


	
	string get_diag_all() raises (BackendsErrors::BackendsErrorsEx);

	
*/
	
+27 −46
Original line number Diff line number Diff line
@@ -56,17 +56,29 @@ public:
	 * @throw TimeoutExImpl if the operation timeout before completing. 
	 * @thorw SocketErrorExImpl if the connection fails before completing. In that case the status is set to <i>Antenna::ACU_NOTCNTD</i>
	 */
	void sendCommand(std::string cmd,std::string outBuff, int all) throw (ComponentErrors::TimeoutExImpl,ComponentErrors::SocketErrorExImpl);
	void sendCommand(std::string cmd,std::string* outBuff, int all) throw (ComponentErrors::TimeoutExImpl,ComponentErrors::SocketErrorExImpl);
		
	void set_all(const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);
	void set_all(const char * cfg_name); //throw (BackendsErrors::BackendsErrorsEx);
	
	void set_mode(short b_addr, const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);	
	void set_mode(short b_addr, const char * cfg_name); //throw (BackendsErrors::BackendsErrorsEx);	
		
	void set_att(short b_addr, short out_ch, double att_val) throw (BackendsErrors::BackendsErrorsEx);
	void set_att(short b_addr, short out_ch, double att_val); //throw (BackendsErrors::BackendsErrorsEx);

	void store_allmode(const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);
	void store_allmode(const char * cfg_name); //throw (BackendsErrors::BackendsErrorsEx);
	
	void clr_mode(const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);
	void clr_mode(const char * cfg_name); //throw (BackendsErrors::BackendsErrorsEx);
	
	string get_status(short b_addr); //throw (BackendsErrors::BackendsErrorsEx);
	
	string get_comp(short b_addr); //throw (BackendsErrors::BackendsErrorsEx);
	
   string get_diag(short b_addr); //throw (BackendsErrors::BackendsErrorsEx);
			
	void parse_longSeq_response(string status_str, string start, string end, ACS::longSeq* vals); //throw (BackendsErrors::BackendsErrorsEx);
   
   void parse_doubleSeq_response(string status_str, string start, string end, ACS::doubleSeq* vals); //throw (BackendsErrors::BackendsErrorsEx);
   
   void parse_double_response(string status_str, string start, string end, double* val); //throw (BackendsErrors::BackendsErrorsEx);
      
protected:
	/**
@@ -78,18 +90,6 @@ protected:

private:

	template <class X> class autoArray {
	public:
		autoArray(): m_message(NULL) {}
		~autoArray() { if (m_message!=NULL) delete [] m_message; }
		operator X *&() { return m_message; }
		operator const X *() const { return m_message; }
		X operator[](WORD pos) const { return m_message[pos]; }
		X& operator[](WORD pos) { return m_message[pos]; }
	private:
		X* m_message;
	};

	CConfiguration * m_pConfiguration;
	
	CDBESMCommand m_dbesm_command;
@@ -105,45 +105,26 @@ private:
	*/
	OperationResult sendBuffer(std::string Msg,CError& error);

   int receiveBuffer(std::string Msg,CError& error, int all=0);
   int receiveBuffer(std::string *Msg,CError& error, int all=0);
	
	void createSocket() throw (ComponentErrors::SocketErrorExImpl);
	
	ACE_Recursive_Thread_Mutex m_syncMutex;
   
	void set_all_command(const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);
	void set_all_command(const char * cfg_name); //throw (BackendsErrors::BackendsErrorsEx);
	
	void set_mode_command(short b_addr, const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);
	void set_mode_command(short b_addr, const char * cfg_name); //throw (BackendsErrors::BackendsErrorsEx);
	
   void set_att_command(short b_addr, short out_ch, double att_val) throw (BackendsErrors::BackendsErrorsEx);
   void set_att_command(short b_addr, short out_ch, double att_val); //throw (BackendsErrors::BackendsErrorsEx);
	
	void store_allmode_command(const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);
	void store_allmode_command(const char * cfg_name); //throw (BackendsErrors::BackendsErrorsEx);
	
	void clr_mode_command(const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);
	void clr_mode_command(const char * cfg_name); //throw (BackendsErrors::BackendsErrorsEx);
	
   /*
	ACS::uLongSeq get_reg_val(short b_addr, short reg_val) throw (BackendsErrors::BackendsErrorsEx);
	string get_status_command(short b_addr); //throw (BackendsErrors::BackendsErrorsEx);
	
	ACS::doubleSeq get_att(short b_addr) throw (BackendsErrors::BackendsErrorsEx);
   string get_comp_command(short b_addr); //throw (BackendsErrors::BackendsErrorsEx);	
	
	ACS::uLongSeq get_amp(short b_addr) throw (BackendsErrors::BackendsErrorsEx);
	
	ACS::uLongSeq get_eq(short b_addr) throw (BackendsErrors::BackendsErrorsEx);

	ACS::uLongSeq get_bpf(short b_addr) throw (BackendsErrors::BackendsErrorsEx);

	ACS::doubleSeq get_voltage(short b_addr) throw (BackendsErrors::BackendsErrorsEx);

	ACS::doubleSeq get_temp(short b_addr) throw (ComponentErrors::ComponentErrorsEx,BackendsErrors::BackendsErrorsEx);

	string get_status(short b_addr) throw (BackendsErrors::BackendsErrorsEx);

	string get_comp(short b_addr) throw (BackendsErrors::BackendsErrorsEx);

	string get_diag(short b_addr) throw (BackendsErrors::BackendsErrorsEx);

	string get_diag_all() throw (BackendsErrors::BackendsErrorsEx);
	*/
	string get_diag_command(short b_addr); //throw (BackendsErrors::BackendsErrorsEx);
	
};

+72 −30
Original line number Diff line number Diff line
@@ -38,10 +38,45 @@ public:
	/** Gets the socket port to which the LO is listening to commands */
	inline WORD DBESMPort() const { return m_DBESM_Port; }
	
	/*inline ACS::ROlong addr_1() const { return m_addr_1; }
	inline long addr_1() const { return m_addr_1; }
	inline long addr_2() const { return m_addr_2; }
	inline long addr_3() const { return m_addr_3; }
	inline long addr_4() const { return m_addr_4; } */
	inline long addr_4() const { return m_addr_4; }
	
	inline ACS::longSeq& regs_1() { return m_regs_1; }
	inline ACS::longSeq& regs_2() { return m_regs_2; }
	inline ACS::longSeq& regs_3() { return m_regs_3; }
	inline ACS::longSeq& regs_4() { return m_regs_4; }
		  		  
   inline ACS::doubleSeq& atts_1() { return m_atts_1; }
   inline ACS::doubleSeq& atts_2() { return m_atts_2; }
   inline ACS::doubleSeq& atts_3() { return m_atts_3; }
	inline ACS::doubleSeq& atts_4() { return m_atts_4; }
	
	inline ACS::longSeq& amps_1() { return m_amps_1; }
	inline ACS::longSeq& amps_2() { return m_amps_2; }
	inline ACS::longSeq& amps_3() { return m_amps_3; }
	inline ACS::longSeq& amps_4() { return m_amps_4; }
		  
	inline ACS::longSeq& eqs_1() { return m_eqs_1; }
	inline ACS::longSeq& eqs_2() { return m_eqs_2; }
	inline ACS::longSeq& eqs_3() { return m_eqs_3; }
	inline ACS::longSeq& eqs_4() { return m_eqs_4; }
		  
	inline ACS::longSeq& bpfs_1() { return m_bpfs_1; }
	inline ACS::longSeq& bpfs_2() { return m_bpfs_2; }	
	inline ACS::longSeq& bpfs_3() { return m_bpfs_3; }	
	inline ACS::longSeq& bpfs_4() { return m_bpfs_4; }	 	  	  
	     
   inline ACS::doubleSeq& volts_1() { return m_volts_1; }
   inline ACS::doubleSeq& volts_2() { return m_volts_2; }
   inline ACS::doubleSeq& volts_3() { return m_volts_3; }
   inline ACS::doubleSeq& volts_4() { return m_volts_4; }

	inline double temps_1() const { return m_temps_1; }
	inline double temps_2() const { return m_temps_2; }
	inline double temps_3() const { return m_temps_3; }
	inline double temps_4() const { return m_temps_4; }
	                    
private:

@@ -51,34 +86,41 @@ private:
	long m_addr_4;
   CString m_DBESM_IPAddress;
	WORD m_DBESM_Port;
	unsigned long m_regs_1[10];
	unsigned long m_regs_2[10];
	unsigned long m_regs_3[10];
	unsigned long m_regs_4[10];
   double m_atts_1[17];
   double m_atts_2[17];
   double m_atts_3[17];
   double m_atts_4[17];
	unsigned long m_amps_1[10];
	unsigned long m_amps_2[10];
	unsigned long m_amps_3[10];
	unsigned long m_amps_4[10];
	unsigned long m_eqs_1[10];
	unsigned long m_eqs_2[10];
	unsigned long m_eqs_3[10];
	unsigned long m_eqs_4[10];
	unsigned long m_bpfs_1[10];
	unsigned long m_bpfs_2[10];
	unsigned long m_bpfs_3[10];
	unsigned long m_bpfs_4[10];
	double m_volts_1[2];
   double m_volts_2[2];
   double m_volts_3[2];
   double m_volts_4[2];
   double m_temps_1[2];
   double m_temps_2[2];
   double m_temps_3[2];
   double m_temps_4[2];
	
   ACS::longSeq m_regs_1;
	ACS::longSeq m_regs_2;
	ACS::longSeq m_regs_3;
	ACS::longSeq m_regs_4;
	
   ACS::doubleSeq m_atts_1;
   ACS::doubleSeq m_atts_2;
   ACS::doubleSeq m_atts_3;
   ACS::doubleSeq m_atts_4;
     
	ACS::longSeq m_amps_1;
	ACS::longSeq m_amps_2;
	ACS::longSeq m_amps_3;
	ACS::longSeq m_amps_4;
	
	ACS::longSeq m_eqs_1;
	ACS::longSeq m_eqs_2;
	ACS::longSeq m_eqs_3;
	ACS::longSeq m_eqs_4;
	
	ACS::longSeq m_bpfs_1;
	ACS::longSeq m_bpfs_2;
	ACS::longSeq m_bpfs_3;
	ACS::longSeq m_bpfs_4;
   	
	ACS::doubleSeq m_volts_1;
   ACS::doubleSeq m_volts_2;
   ACS::doubleSeq m_volts_3;
   ACS::doubleSeq m_volts_4;
   
   double m_temps_1;
   double m_temps_2;
   double m_temps_3;
   double m_temps_4;

};

Loading