Commit 7e665099 authored by mfioren's avatar mfioren
Browse files

Component updated

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

<SRTDBESM xmlns="urn:schemas-cosylab-com:SRT_DBESM: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="192.168.60.107" DBESM_Port="5002" >
<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" />	   	
   	<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" />	
+7 −6
Original line number Diff line number Diff line
@@ -4,9 +4,9 @@
-->

<xs:schema 
  targetNamespace="urn:schemas-cosylab-com:SRT_DBESM:1.0"
  targetNamespace="urn:schemas-cosylab-com:SRTDBESM:1.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns="urn:schemas-cosylab-com:SRT_DBESM:1.0"
  xmlns="urn:schemas-cosylab-com:SRTDBESM:1.0"
  xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" 
  xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:import namespace="urn:schemas-cosylab-com:CDB:1.0" schemaLocation="CDB.xsd"/>
@@ -16,6 +16,7 @@
   <xs:complexContent>
    <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" />
@@ -45,10 +46,10 @@
	   	 <xs:element name="temps_3" type="baci:ROdoubleSeq" />
	   	 <xs:element name="temps_4" type="baci:ROdoubleSeq" />
      </xs:sequence>
       <xs:element name="addr_1" type="xs:short" use="required"/>
	    <xs:element name="addr_2" type="xs:short" use="required"/>
	    <xs:element name="addr_3" type="xs:short" use="required"/>
	    <xs:element name="addr_4" type="xs:short" use="required"/>
       <xs:attribute name="addr_1" type="xs:long" use="required"/>
	    <xs:attribute name="addr_2" type="xs:long" use="required"/>
	    <xs:attribute name="addr_3" type="xs:long" use="required"/>
	    <xs:attribute name="addr_4" type="xs:long" use="required"/>
      <xs:attribute name="DBESM_IPAddress" type="xs:string" use="required"/>
	  <xs:attribute name="DBESM_Port" type="xs:unsignedInt" use="required"/>
    </xs:extension>
+29 −46
Original line number Diff line number Diff line
@@ -12,17 +12,15 @@
*/

module Backends { 
	/**
	/*
	<h2>DBE Switch Matrix Interface </h2>
	@
	*/
	interface SRTDBESM: ACS::CharacteristicComponent {
	/**
	/*

	 DBESM boards addresses and components values

	*/
        attribute short addr_1, addr_2, addr_3, addr_4;
        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;
@@ -31,48 +29,41 @@ module Backends {
	attribute ACS::ROdoubleSeq volts_1, volts_2, volts_3, volts_4;
	attribute ACS::ROdoubleSeq temps_1, temps_2, temps_3, temps_4;
	
        
	/**
	 set whole DBESM configuration 
	 
    * @throw ReceiversErrors::ReceiversErrorsEx
    * @throw CORBA::SystemExcpetion 
        */
        readonly attribute ACS::ROlong addr_1; 

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

	/**
	 set single DBESM board configuration 

	*/
	
	void set_mode(in short b_addr, in string cfg_name) raises (BackendsErrors::BackendsErrorsEx);

	/**
	 set a single DBESM attenuator based on which output to attenuate
	void set_att(in short b_addr, in short out_ch, in double att_val) raises (BackendsErrors::BackendsErrorsEx);

	*/
	void store_allmode(in string cfg_name) raises (BackendsErrors::BackendsErrorsEx);

	void set_att(in short b_addr, in short out_ch, in double att_val) raises (BackendsErrors::BackendsErrorsEx);
	void clr_mode(in string cfg_name) raises (BackendsErrors::BackendsErrorsEx);

	/**
	 store whole DBESM configuration

	/**
	 set whole DBESM configuration 
	*/     
   	
	void store_allmode(in string cfg_name) raises (BackendsErrors::BackendsErrorsEx);
	/**
	 set single DBESM board configuration 
        */
	
	/**
	 delete DBESM configuration

        */
	
	void clr_mode(in string cfg_name) raises (BackendsErrors::BackendsErrorsEx);
	/**
	 set a single DBESM attenuator based on which output to attenuate
        */

	/**
	 store whole DBESM configuration	
	*/
	/**
	 set the DBESM amplifliers 
	
	
	void set_amp(in short b_addr, in short amp_ch, in double amp_val) raises (BackendsErrors::BackendsErrorsEx);
	
	
@@ -96,48 +87,41 @@ module Backends {
	 
    * @throw ReceiversErrors::ReceiversErrorsEx
    * @throw CORBA::SystemExcpetion 
	*/
	
	ACS::uLongSeq get_reg_val(in short b_addr, in short reg_val) raises (BackendsErrors::BackendsErrorsEx);

	ACS::uLongSeq get_reg_val(in short b_addr, out long reg_val) raises (BackendsErrors::BackendsErrorsEx);
	
	/**
	 get single DBESM board attenuators values 

	*/
	
	ACS::doubleSeq get_att(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);
	
	/**
	 get single DBESM board amps values 

	*/
	
	ACS::uLongSeq get_amp(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);
	/**
	 get single DBESM board eqs values 

	*/
	
	ACS::uLongSeq get_eq(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);
	/**
	 get single DBESM board bpfs values 

	*/
	
	ACS::uLongSeq get_bpf(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);

	/**
	 get single DBESM board voltages 

	*/
	
	ACS::doubleSeq get_voltage(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);

	/**
	 get single DBESM board temperature 

	*/
	
	ACS::doubleSeq get_temp(in short b_addr) raises (BackendsErrors::BackendsErrorsEx);


@@ -149,32 +133,31 @@ module Backends {
	/**
	 get single DBESM board status: registers and attenuators values

	*/
	
	
	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);
	
	string get_diag_all() raises (BackendsErrors::BackendsErrorsEx);
	
*/
	
};

+49 −39
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
#include "Configuration.h"
#include "DBESMprotocol.h"


using namespace std;
/**
 * This class is inherited from the IRA::CSocket class. It takes charge of the management of the socket used to command the SRT ACU via the remote interface. 
  * if the remote side disconnects or a problem affects the comunication line, this class try to reconnect to the ACU until the communication is up again..
@@ -56,8 +56,17 @@ 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=0) 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_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 store_allmode(const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);
	
	void clr_mode(const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);
			
protected:
	/**
@@ -82,59 +91,60 @@ private:
	};

	CConfiguration * m_pConfiguration;
	IRA::CSecureArea<CDBESMCommand> * m_pData;
	
	CDBESMCommand m_dbesm_command;

	bool m_bTimedout;
		
	/**
	 * This mutex is used to sync external calls to the public methods of the class. The requirements is that just one call at the time must be served if the methos requires to
	 * send a message to the ACU. the reason for that is that we need to wait to known the result of the previous command to the ACU that comes form the status socket.
	 */
	ACE_Recursive_Thread_Mutex m_syncMutex;
	
	
	/**
    * This member function is called to send a buffer to the ACU.
	 * @param Msg pointer to the byte buffer that contains the message for the ACU
    * This member function is called to send a buffer to the DBESM.
	 * @param Msg pointer to the byte buffer that contains the message for the DBESM
	 * @param Len length of the buffer
	 * @param error It will contain the error description in case the operation fails.
	 * @return SUCCESS if the buffer was sent correctly, WOULDBLOCK if the send would block, FAIL in case of error, the parameter error is set accordingly.
	*/
	OperationResult sendBuffer(std::string Msg,CError& error);

	/**
	 * This methos will cycle to check is the ACU responded to the last command sent. There three possible scenarios:
	 * @arg the ACU responded and the operation was succesfull
	 * @arg the ACU did not responded yet (in that case a timeout policy is implemented)
	 * @arg the ACU responded but the operation was not completed correctly.
	 * @param commandTime marks the epoch the command message was sent to the ACU, used to apply the timeout mechanism.
	 * @throw AntennaErrors::NakExImpl if an error was repoerted by the ACU
	 * @throw TimeoutExImpl if the ACU does not report back the answer within the expected time
	 */
	void waitAck(const ACS::Time& commandTime) throw (BackendsErrors::NakExImpl,ComponentErrors::TimeoutExImpl);
   int receiveBuffer(std::string Msg,CError& error, int all=0);
	
  int CCommandSocket::receiveBuffer(std::string Msg,CError& error, int all=0);
	void createSocket() throw (ComponentErrors::SocketErrorExImpl);
	
	/**
	 * This function checks if the connection is ok. 
	 * @return true if the connection is ok, false is the connection is not available.
	 */
	bool checkConnection();
	ACE_Recursive_Thread_Mutex m_syncMutex;
   
	/**
	 * This method check if the Antenna is busy with long jobs and could not accept new commands.
	 * @return true if the antenna is busy
	 */
	bool checkIsBusy();
	void set_all_command(const char * cfg_name) throw (BackendsErrors::BackendsErrorsEx);
	
	void createSocket() throw (ComponentErrors::SocketErrorExImpl);
	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 store_allmode_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);
	
	ACS::doubleSeq get_att(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);
	*/
	
};

#endif /*COMMANDSOCKET_H_*/
 No newline at end of file
+16 −12
Original line number Diff line number Diff line
#ifndef _CONFIGURATION_H_
#define _CONFIGURATION_H_
#ifndef CCONFIGURATION_H
#define CCONFIGURATION_H

#include <IRA>
#include <maciContainerServices.h>
#include <ComponentErrors.h>

//#include <baci.idl>

using namespace IRA;

/**
@@ -38,14 +36,21 @@ public:
	inline CString DBESMAddress() const { return m_DBESM_IPAddress; }
		
	/** Gets the socket port to which the LO is listening to commands */
	inline long DBESMPort() const { return m_DBESM_Port; }/** Gets W band LO ip address */
	inline WORD DBESMPort() const { return m_DBESM_Port; }
	
	/*inline ACS::ROlong 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; } */
	
private:

	short m_addr_1;
	short m_addr_2;
	short m_addr_3;
	short m_addr_4;
	long m_addr_1;
	long m_addr_2;
	long m_addr_3;
	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];
@@ -74,8 +79,7 @@ private:
   double m_temps_2[2];
   double m_temps_3[2];
   double m_temps_4[2];
	CString m_DBESM_IPAddress;
	long m_DBESM_Port;

};

#endif /*CONFIGURATION_H_*/
Loading