diff --git a/CHANGELOG.md b/CHANGELOG.md index 94fe468832574cb0fade71c23f4a6e3c08dfd20d..51a0a79fe1b6f796648a6b018533a0eaabe53cd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,7 +97,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/ ## [next release] ## Added - issue 655 - ACU Component for Noto and Medicina is now capble to prevent seldom mode changes coming from ACU reset + issue #655 - ACU Component for Noto and Medicina is now capble to prevent seldom mode changes coming from ACU reset + issue #653 - added a couple of scriptsto ease vnc conection from remote a file copying. The scripts support + linux and macos ## Fixed issue #448 - Added Sky Offsets to calibration tool client issue #585 - Fixed misshandled schedule with NULL as backend (Dry Run) diff --git a/Common/Interfaces/CommonInterface/include/AntennaModule.h b/Common/Interfaces/CommonInterface/include/AntennaModule.h index d9952755dda3cef3492ba74c29ef187abd73ffff..e28d86a09057ed53f26848df2968d651638b77b4 100644 --- a/Common/Interfaces/CommonInterface/include/AntennaModule.h +++ b/Common/Interfaces/CommonInterface/include/AntennaModule.h @@ -100,7 +100,7 @@ public: frame=Antenna::ANT_LGROUP; return true; } - else if (strcasecmp(str,"UNDEF")==0) { + else if (strcasecmp(str,"NULL")==0) { frame=Antenna::ANT_UNDEF_FRAME; return true; } @@ -129,7 +129,7 @@ public: return "LGRP"; } else { //if (frame==Antenna::ANT_UNDEF_FRAME) { - return "UNDEF"; + return "NULL"; } }; @@ -146,7 +146,7 @@ public: frame=Antenna::ANT_REDSHIFT; return true; } - else if (strcasecmp(str,"UNDEF")==0) { + else if (strcasecmp(str,"NULL")==0) { frame=Antenna::ANT_UNDEF_DEF; return true; } @@ -166,7 +166,7 @@ public: return "Z"; } else { // if (frame==Antenna::ANT_UNDEF_DEF) { - return "UNDEF"; + return "NULL"; } }; }; diff --git a/Common/Libraries/IRALibrary/src/IRAPy/Connection.py b/Common/Libraries/IRALibrary/src/IRAPy/Connection.py new file mode 100644 index 0000000000000000000000000000000000000000..0294b49907eadc7647932788861f1655f9d62cc5 --- /dev/null +++ b/Common/Libraries/IRALibrary/src/IRAPy/Connection.py @@ -0,0 +1,45 @@ +# Author: +# Giuseppe Carboni, + +import socket +import time +from contextlib import contextmanager + +import ComponentErrorsImpl + + +class Connection(object): + """This class implements a contextmanager for a socket. + Usage example: + + with Connection(('127.0.0.1', 10000)) as s: + s.sendall('COMMAND\n') + answer = s.recv(1024) + + :param: address, a tuple containing IP address and PORT for the socket + :param: timeout, connection timeout, in seconds + """ + + def __init__(self, address, timeout=2): + self.address = address + + def __enter__(self): + self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + connected = 1 + t0 = time.time() + while time.time() - t0 < timeout: + connected = self.s.connect_ex(self.address) + if connected == 0: + break + time.sleep(0.01) + if connected: + reason = 'Could not reach the device!' + from IRAPy import logger + logger.logError(reason) + exc = ComponentErrorsImpl.SocketErrorExImpl() + exc.setData('Reason', reason) + raise exc + return self.s + + def __exit__(self, type, value, traceback): + self.s.close() diff --git a/Common/Libraries/IRALibrary/src/IRAPy/__init__.py b/Common/Libraries/IRALibrary/src/IRAPy/__init__.py index f5b3d9a6aa39b3433f7e69c83fa6beec4f9a4567..dfae5e20669b8890b5dfbcf8b81e1b3348093feb 100644 --- a/Common/Libraries/IRALibrary/src/IRAPy/__init__.py +++ b/Common/Libraries/IRALibrary/src/IRAPy/__init__.py @@ -6,10 +6,12 @@ C{from IRAPy import logger} list of modules: - customlogging: custom logging functionalities to replace standard logging - bsqueue: BoundedSortedQueue class implements a priority queue structure + - Connection: Connection class implements a contextmanager for a socket """ import customlogging import ACSLog +import Connection #Some comments required here. The custom logger mechanism is not working in python. #do the way to separate the system logs to the ones do be shown to the user is to use different diff --git a/Common/Servers/FitsWriter/include/SummarySchema.h b/Common/Servers/FitsWriter/include/SummarySchema.h index a355ca734c7fb232d68d9099901e77158c94c76e..c965a88b7bd9c2c0475a20aafb471d42c728265a 100644 --- a/Common/Servers/FitsWriter/include/SummarySchema.h +++ b/Common/Servers/FitsWriter/include/SummarySchema.h @@ -36,24 +36,24 @@ #define SCHEMA_HEADER_ENTRY21 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"FITSVER","FITS version" ) #define SCHEMA_HEADER_ENTRY22 ( 0, _FILE_LONG_TYPE,_FILE_SINGLE_ENTRY,"NUSEBAND","Number of sections" ) #define SCHEMA_HEADER_ENTRY23 ( 0, _FILE_DOUBLE_TYPE,_FILE_MULTI_ENTRY,"FREQRESOL","Frequency resolution of the Nth section (MHz)" ) -#define SCHEMA_HEADER_ENTRY24 ( 0, _FILE_DOUBLE_TYPE,_FILE_MULTI_ENTRY,"RESTFREQ","Rest frequency of the Nth setcion (MHz)" ) +#define SCHEMA_HEADER_ENTRY24 ( 0, _FILE_DOUBLE_TYPE,_FILE_MULTI_ENTRY,"RESTFREQ","Rest frequency of the Nth section (MHz)" ) #define SCHEMA_HEADER_ENTRY25 ( 0, _FILE_DOUBLE_TYPE,_FILE_MULTI_ENTRY,"FREQ","Start frequency of the Nth section(MHz)" ) #define SCHEMA_HEADER_ENTRY26 ( 0, _FILE_DOUBLE_TYPE,_FILE_MULTI_ENTRY,"BWID","Bandwidth of the Nth section (MHz)" ) #define SCHEMA_HEADER_ENTRY27 ( 0, _FILE_LONG_TYPE,_FILE_MULTI_ENTRY,"FREQBINS","Number of spectral bins of the Nth section" ) #define SCHEMA_HEADER_ENTRY28 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"VRAD","Radial velocity" ) #define SCHEMA_HEADER_ENTRY29 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"VFRAME","Radial velocity reference frame" ) #define SCHEMA_HEADER_ENTRY30 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"VDEF","Radial velocity definition" ) -#define SCHEMA_HEADER_ENTRY31 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"DATE-OBS","Observation time" ) +#define SCHEMA_HEADER_ENTRY31 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"DATE-OBS","Observation time (YYYY-MM-DDThh:mm:ss.sss UT)" ) #define SCHEMA_HEADER_ENTRY32 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"PINAME","Name if the PI of the project" ) #define SCHEMA_HEADER_ENTRY33 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"WCSNAME","Astronomical basis frame" ) #define SCHEMA_HEADER_ENTRY34 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"SCANDIR","(Optional) scan direction" ) #define SCHEMA_HEADER_ENTRY35 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"DUTYCYC","(Optional) On-Off-Cal duty cycle" ) #define SCHEMA_HEADER_ENTRY36 ( 0, _FILE_STRING_TYPE,_FILE_SINGLE_ENTRY,"USRFRAME","Description of the user frame" ) #define SCHEMA_HEADER_ENTRY37 ( 0, _FILE_STRING_TYPE,_FILE_MULTI_ENTRY,"POLATYPE","LCP, RCP, HLP, VLP, stokes type of the Nth section" ) -#define SCHEMA_HEADER_ENTRY38 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"XMINDEG","Scan start x coordinate (degree, optional)") -#define SCHEMA_HEADER_ENTRY39 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"XMAXDEG","Scan end x coordinate (degree, optional)" ) -#define SCHEMA_HEADER_ENTRY40 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"YMINDEG","Scan start y coordinate (degree, optional)" ) -#define SCHEMA_HEADER_ENTRY41 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"YMAXDEG","Scan end y coordinate (degree, optional)" ) +#define SCHEMA_HEADER_ENTRY38 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"XMINDEG","Scan start x coordinate (deg, optional)") +#define SCHEMA_HEADER_ENTRY39 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"XMAXDEG","Scan end x coordinate (deg, optional)" ) +#define SCHEMA_HEADER_ENTRY40 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"YMINDEG","Scan start y coordinate (deg, optional)" ) +#define SCHEMA_HEADER_ENTRY41 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"YMAXDEG","Scan end y coordinate (deg, optional)" ) #define SCHEMA_HEADER_ENTRY42 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"SCANOFF","Scan offset (deg)" ) #define SCHEMA_HEADER_ENTRY43 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"SCANLEN","Scan span (deg)" ) #define SCHEMA_HEADER_ENTRY44 ( 0, _FILE_DOUBLE_TYPE,_FILE_SINGLE_ENTRY,"SCANSTART","Scan start (deg)" ) diff --git a/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py b/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py index c516b9e81886f3364212a83daf4e9b61aac21119..239419977348828a2ba2a3790da24165c4e66512 100644 --- a/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py +++ b/Common/Servers/PyCalmux/src/Calmux/PyCalmuxImpl.py @@ -5,16 +5,16 @@ from Backends__POA import CalMux from Acspy.Servants.CharacteristicComponent import CharacteristicComponent as cc from Acspy.Servants.ContainerServices import ContainerServices as services from Acspy.Servants.ComponentLifecycle import ComponentLifecycle as lcycle -from IRAPy import logger +from IRAPy import logger, Connection from xml.etree import ElementTree from Acspy.Util import ACSCorba -import socket import ComponentErrorsImpl import cdbErrType import time + class PyCalmuxImpl(CalMux, cc, services, lcycle): def __init__(self): @@ -30,6 +30,7 @@ class PyCalmuxImpl(CalMux, cc, services, lcycle): self.attributes['PORT'] = int(self.attributes['PORT']) self.attributes['MAX_CHANNELS'] = int(self.attributes['MAX_CHANNELS']) self.attributes['INTERNAL_CHANNEL'] = int(self.attributes['INTERNAL_CHANNEL']) + self.connection = Connection((self.attributes['IP'], self.attributes['PORT'])) try: self.calOff() @@ -50,8 +51,9 @@ class PyCalmuxImpl(CalMux, cc, services, lcycle): exc = ComponentErrorsImpl.ValueOutofRangeExImpl() exc.setData('Reason', reason) raise exc - self.current_backend = backend_name - self._set_input(channel, polarity) + with self.connection as s: + self._set_input(s, channel, polarity) + self.current_backend = backend_name def getSetup(self): return self.current_backend @@ -59,46 +61,51 @@ class PyCalmuxImpl(CalMux, cc, services, lcycle): def calOn(self): try: channel = self.attributes['INTERNAL_CHANNEL'] - self._set_calibration(1) - self._set_input(channel, 0) - self.current_backend = '' + with self.connection as s: + self._set_calibration(s, 1) + self._set_input(s, channel, 0) + self.current_backend = '' except ComponentErrorsImpl.SocketErrorExImpl, ex: raise ex.getComponentErrorsEx() def calOff(self): try: channel = self.attributes['INTERNAL_CHANNEL'] - self._set_calibration(0) - self._set_input(channel, 0) - self.current_backend = '' + with self.connection as s: + self._set_calibration(s, 0) + self._set_input(s, channel, 0) + self.current_backend = '' except ComponentErrorsImpl.SocketErrorExImpl, ex: raise ex.getComponentErrorsEx() - def _get_status(self): - return self._send_command(b'?\n') + def _get_status(self, s): + return self._send_command(s, b'?\n') def getChannel(self): try: - channel, polarity, status = self._get_status() - return channel + with self.connection as s: + channel, polarity, status = self._get_status(s) + return channel except ComponentErrorsImpl.SocketErrorExImpl, ex: raise ex.getComponentErrorsEx() def getPolarity(self): try: - channel, polarity, status = self._get_status() - return polarity + with self.connection as s: + channel, polarity, status = self._get_status(s) + return polarity except ComponentErrorsImpl.SocketErrorExImpl, ex: raise ex.getComponentErrorsEx() def getCalStatus(self): try: - channel, polarity, status = self._get_status() - return bool(status) + with self.connection as s: + channel, polarity, status = self._get_status(s) + return bool(status) except ComponentErrorsImpl.SocketErrorExImpl, ex: raise ex.getComponentErrorsEx() - def _set_input(self, channel, polarity): + def _set_input(self, s, channel, polarity): if channel not in range(self.attributes['MAX_CHANNELS']): reason = 'Channel out of range!' logger.logError(reason) @@ -112,9 +119,9 @@ class PyCalmuxImpl(CalMux, cc, services, lcycle): exc.setData('Reason', reason) raise exc command = 'I %d %d\n' % (channel, polarity) - return self._send_command(command) + return self._send_command(s, command) - def _set_calibration(self, calon): + def _set_calibration(self, s, calon): if calon not in [0, 1]: reason = 'Calon value must be 0 or 1!' logger.logError(reason) @@ -122,34 +129,19 @@ class PyCalmuxImpl(CalMux, cc, services, lcycle): exc.setData('Reason', reason) raise exc command = 'C %d\n' % calon - return self._send_command(command) + return self._send_command(s, command) - def _send_command(self, command): - """This method opens a socket and send the given command. + def _send_command(self, s, command): + """This method sends the given command and returns an answer. + :param s: the socket on which the command will be sent :param command: the command to be sent to the device. """ - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - connected = 1 - t0 = time.time() - while time.time() - t0 < 2: - connected = s.connect_ex((self.attributes['IP'], self.attributes['PORT'])) - if connected == 0: - break - time.sleep(0.01) - if connected: - reason = 'Could not reach the device!' - logger.logError(reason) - exc = ComponentErrorsImpl.SocketErrorExImpl() - exc.setData('Reason', reason) - raise exc - s.sendall(command) # time.sleep(0.1) response = s.recv(1024) - s.close() response = response.strip().split() if len(response) == 1: response = response[0] diff --git a/Common/Servers/ReceiversBoss/include/RecvBossCore.h b/Common/Servers/ReceiversBoss/include/RecvBossCore.h index 72add2f822b4d4176629ec0a17a090bfca43c75d..10f98bcd0da2ed3a053d02c3cb289ca37daa0d68 100644 --- a/Common/Servers/ReceiversBoss/include/RecvBossCore.h +++ b/Common/Servers/ReceiversBoss/include/RecvBossCore.h @@ -415,7 +415,9 @@ private: void unloadReceiver(); #ifdef COMPILE_TARGET_MED - void setup(const char * code) throw(ComponentErrors::SocketErrorExImpl,ComponentErrors::ValidationErrorExImpl); + void setup(const char * code) throw (ComponentErrors::SocketErrorExImpl,ComponentErrors::ValidationErrorExImpl, + ComponentErrors::CORBAProblemExImpl,ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::UnexpectedExImpl, + ComponentErrors::OperationErrorExImpl); bool sendToRecvControl(const void *buffer,int size); bool sendToFS(const void *buffer,int size); diff --git a/Common/Servers/ReceiversBoss/src/RecvBossCore_mc.i b/Common/Servers/ReceiversBoss/src/RecvBossCore_mc.i index 46bf5c9fa40b4891a08e70fc7d04441a5f911f5c..d071c6858f2e5e70761b36519c76b0f0d0e57d96 100644 --- a/Common/Servers/ReceiversBoss/src/RecvBossCore_mc.i +++ b/Common/Servers/ReceiversBoss/src/RecvBossCore_mc.i @@ -283,7 +283,9 @@ void CRecvBossCore::setLO(const ACS::doubleSeq& lo) throw (ComponentErrors::Vali IRA::CIRATools::Wait(0,500000); //wait half a second to settle things down } -void CRecvBossCore::setup(const char * code) throw (ComponentErrors::SocketErrorExImpl,ComponentErrors::ValidationErrorExImpl) +void CRecvBossCore::setup(const char * code) throw (ComponentErrors::SocketErrorExImpl,ComponentErrors::ValidationErrorExImpl, + ComponentErrors::CORBAProblemExImpl,ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::UnexpectedExImpl, + ComponentErrors::OperationErrorExImpl) { IRA::CError err; IRA::CString rec(code); @@ -369,8 +371,8 @@ void CRecvBossCore::setup(const char * code) throw (ComponentErrors::SocketError m_pols[1]=Receivers::RCV_RCP; m_startFreq[0]=100.0; m_startFreq[1]=100.0; - m_bandWidth[0]=400.0; - m_bandWidth[1]=400.0; + m_bandWidth[0]=800.0; + m_bandWidth[1]=800.0; m_currentRecvCode="CCC"; m_currentOperativeMode="NORMAL"; } @@ -397,8 +399,8 @@ void CRecvBossCore::setup(const char * code) throw (ComponentErrors::SocketError m_pols[1]=Receivers::RCV_RCP; m_startFreq[0]=100.0; m_startFreq[1]=100.0; - m_bandWidth[0]=400.0; - m_bandWidth[1]=400.0; + m_bandWidth[0]=800.0; + m_bandWidth[1]=800.0; m_currentRecvCode="CHC"; m_currentOperativeMode="NORMAL"; } diff --git a/Common/Servers/Scheduler/include/Core_Operations.h b/Common/Servers/Scheduler/include/Core_Operations.h index 54b2cdbf4f9dbf17110bb27ebf2029b28da1c78c..674ff34d575861b4c6d521e30dc150e532700d97 100644 --- a/Common/Servers/Scheduler/include/Core_Operations.h +++ b/Common/Servers/Scheduler/include/Core_Operations.h @@ -178,10 +178,11 @@ void _haltSchedule(); * @throw ManagementErrors::LogFileErrorExImpl * @thorw ManagementErrors::ScheduleNotExistExImpl * @throw ManagementErrors::CannotClosePendingTaskExImpl + * @throw ManagementErrors::ScheduleProjectNotMatchExImpl */ void _startSchedule(const char* scheduleFile,const char * startSubScan) throw (ManagementErrors::ScheduleErrorExImpl,ManagementErrors::AlreadyRunningExImpl, ComponentErrors::MemoryAllocationExImpl,ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::CORBAProblemExImpl, - ManagementErrors::LogFileErrorExImpl,ManagementErrors::ScheduleNotExistExImpl,ManagementErrors::CannotClosePendingTaskExImpl); + ManagementErrors::LogFileErrorExImpl,ManagementErrors::ScheduleNotExistExImpl,ManagementErrors::CannotClosePendingTaskExImpl,ManagementErrors::ScheduleProjectNotMatchExImpl); /** * It allows to change the backend elected as default backend, the default backend is the device used for all operation (for example tsys) when a schedule is not running. diff --git a/Common/Servers/Scheduler/include/ScheduleExecutor.h b/Common/Servers/Scheduler/include/ScheduleExecutor.h index 61122ace4e99270a7897363216205f4265db51c1..a20144e6e0e3ea90729fe8100354aec483a561e9 100644 --- a/Common/Servers/Scheduler/include/ScheduleExecutor.h +++ b/Common/Servers/Scheduler/include/ScheduleExecutor.h @@ -72,11 +72,12 @@ public: * @throw ComponentErrors::CORBAProblemExImpl * @throw ManagementErrors::LogFileErrorExImpl * @thorw ManagementErrors::CannotClosePendingTaskExImpl + * @throw ManagementErrors::ScheduleProjectNotMatchExImpl */ void startSchedule(const char* scheduleFile,const char * subScanidentifier) throw (ManagementErrors::ScheduleErrorExImpl, ManagementErrors::AlreadyRunningExImpl,ComponentErrors::MemoryAllocationExImpl,ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::CORBAProblemExImpl, ManagementErrors::LogFileErrorExImpl,ManagementErrors::ScheduleNotExistExImpl, - ManagementErrors::CannotClosePendingTaskExImpl); + ManagementErrors::CannotClosePendingTaskExImpl,ManagementErrors::ScheduleProjectNotMatchExImpl); /** * initialize the schedule executor. diff --git a/Common/Servers/Scheduler/src/Core_Operations.i b/Common/Servers/Scheduler/src/Core_Operations.i index 84e38722fdc54575c222ed638686a7d3a6eebd96..9893bcdbc8c677101286eaed5e6b9711d3bdc1d1 100644 --- a/Common/Servers/Scheduler/src/Core_Operations.i +++ b/Common/Servers/Scheduler/src/Core_Operations.i @@ -1156,12 +1156,11 @@ void CCore::_haltSchedule() void CCore::_startSchedule(const char* scheduleFile,const char * startSubScan) throw (ManagementErrors::ScheduleErrorExImpl,ManagementErrors::AlreadyRunningExImpl, ComponentErrors::MemoryAllocationExImpl,ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::CORBAProblemExImpl, - ManagementErrors::LogFileErrorExImpl,ManagementErrors::ScheduleNotExistExImpl,ManagementErrors::CannotClosePendingTaskExImpl) + ManagementErrors::LogFileErrorExImpl,ManagementErrors::ScheduleNotExistExImpl,ManagementErrors::CannotClosePendingTaskExImpl, + ManagementErrors::ScheduleProjectNotMatchExImpl) { //no need to get the mutex, because it is already done inside the Schedule Executor thread if (m_schedExecuter) { - //ManagementErrors::ScheduleErrorExImpl, ManagementErrors::AlreadyRunningExImpl,ComponentErrors::MemoryAllocationExImpl,ComponentErrors::CouldntGetComponentExImpl, - //ComponentErrors::CORBAProblemExImpl,ManagementErrors::LogFileErrorExImpl,ManagementErrors::ScheduleNotExistExImpl m_schedExecuter->startSchedule(scheduleFile,startSubScan); } } diff --git a/Common/Servers/Scheduler/src/ScheduleExecutor.cpp b/Common/Servers/Scheduler/src/ScheduleExecutor.cpp index 14de2c323725c3d25493f1dbdf254749de78c0c7..7e01425ae3a284d693289f2f6fe0c2fbe7854bff 100644 --- a/Common/Servers/Scheduler/src/ScheduleExecutor.cpp +++ b/Common/Servers/Scheduler/src/ScheduleExecutor.cpp @@ -556,7 +556,7 @@ void CScheduleExecutor::initialize(maci::ContainerServices *services,const doubl void CScheduleExecutor::startSchedule(const char* scheduleFile,const char * subScanidentifier) throw ( ManagementErrors::ScheduleErrorExImpl, ManagementErrors::AlreadyRunningExImpl,ComponentErrors::MemoryAllocationExImpl,ComponentErrors::CouldntGetComponentExImpl, ComponentErrors::CORBAProblemExImpl,ManagementErrors::LogFileErrorExImpl,ManagementErrors::ScheduleNotExistExImpl, - ManagementErrors::CannotClosePendingTaskExImpl) + ManagementErrors::CannotClosePendingTaskExImpl,ManagementErrors::ScheduleProjectNotMatchExImpl) { baci::ThreadSyncGuard guard(&m_mutex); bool projectChanged; diff --git a/Medicina/CDB/alma/RECEIVERS/KBandDualFReceiver/KBandDualFReceiver.xml b/Medicina/CDB/alma/RECEIVERS/KBandDualFReceiver/KBandDualFReceiver.xml index 19f94869af329dfcb1cf986bf382912edfdefa0d..7b82f66e96da595bc38a4d915798ad1e73297964 100644 --- a/Medicina/CDB/alma/RECEIVERS/KBandDualFReceiver/KBandDualFReceiver.xml +++ b/Medicina/CDB/alma/RECEIVERS/KBandDualFReceiver/KBandDualFReceiver.xml @@ -23,7 +23,7 @@ LNAPort="10001" VertexIPAddress="192.168.51.2" VertexPort="2096" - VertexCommand="proc kkc\n" + VertexCommand="proc kkc" WatchDogResponseTime="10000000" WatchDogSleepTime="10000000" LNASamplingTime="250000" diff --git a/Medicina/Configuration/CDB/alma/RECEIVERS/KBandDualFReceiver/KBandDualFReceiver.xml b/Medicina/Configuration/CDB/alma/RECEIVERS/KBandDualFReceiver/KBandDualFReceiver.xml index 22484033b841f8bb3b30b282eec61e29b6d08dcc..6bf968be04b3c2d8524dec615b8712127eada212 100644 --- a/Medicina/Configuration/CDB/alma/RECEIVERS/KBandDualFReceiver/KBandDualFReceiver.xml +++ b/Medicina/Configuration/CDB/alma/RECEIVERS/KBandDualFReceiver/KBandDualFReceiver.xml @@ -19,7 +19,7 @@ LNAPort="10001" VertexIPAddress="192.168.51.2" VertexPort="2096" - VertexCommand="proc kkc\n" + VertexCommand="proc kkc" WatchDogResponseTime="10000000" WatchDogSleepTime="10000000" LNASamplingTime="25000000" diff --git a/Medicina/Libraries/MedicinaVertexLibrary/include/MedicinaVertex.h b/Medicina/Libraries/MedicinaVertexLibrary/include/MedicinaVertex.h new file mode 100644 index 0000000000000000000000000000000000000000..522d217c2a2024840f5d0ceb5fdef1fecc21beab --- /dev/null +++ b/Medicina/Libraries/MedicinaVertexLibrary/include/MedicinaVertex.h @@ -0,0 +1,33 @@ +#ifndef _MEDICINAVERTEXLIBRARY_H +#define _MEDICINAVERTEXLIBRARY_H + +/* ***************************************************************************************************** */ +/* IRA Istituto di Radioastronomia */ +/* */ +/* This code is under GNU General Public Licence (GPL). */ +/* */ +/* */ +/* Who when What */ +/* Andrea Orlati(aorlati@ira.inaf.it) 22/09/2021 Creation +*/ +#include + +class CMedicinaVertex { +public: + CMedicinaVertex(const IRA::CString& addr,const DWORD& port); + virtual ~CMedicinaVertex(); + inline IRA::CString getLastErrorMessage() const { return m_lastErrorMessage; } + + bool sendTo(const IRA::CString& buffer,int size); + +protected: + IRA::CString m_vertexAddr; + DWORD m_vertexPort; + IRA::CString m_lastErrorMessage; + IRA::CSocket m_sock; + IRA::CError m_err; +}; + + + +#endif diff --git a/Medicina/Libraries/MedicinaVertexLibrary/src/MedicinaVertex.cpp b/Medicina/Libraries/MedicinaVertexLibrary/src/MedicinaVertex.cpp index c5c7fac17cc20a9c5b7a347383911bb047754f23..2099d340970168db4f8bf5573a85246a00cf910c 100644 --- a/Medicina/Libraries/MedicinaVertexLibrary/src/MedicinaVertex.cpp +++ b/Medicina/Libraries/MedicinaVertexLibrary/src/MedicinaVertex.cpp @@ -9,12 +9,17 @@ CMedicinaVertex::~CMedicinaVertex() { } -bool CMedicinaVertex::sendTo(const void *buffer,int size) +bool CMedicinaVertex::sendTo(const IRA::CString& buffer,int size) { int count; char readout[128]; + IRA::CString sendBuffer; + int sendSize; m_err.Reset(); try { + sendBuffer=buffer; + sendBuffer+=" \n"; + sendSize=sendBuffer.GetLength(); if (m_sock.Create(m_err,IRA::CSocket::STREAM)!=IRA::CSocket::SUCCESS) { m_lastErrorMessage.Format("Cannot create socket with error code %d",m_err.getErrorCode()); return false; @@ -23,7 +28,7 @@ bool CMedicinaVertex::sendTo(const void *buffer,int size) m_lastErrorMessage.Format("Cannot connect with error code %d",m_err.getErrorCode()); return false; } - if (m_sock.Send(m_err,buffer,size)!=(int)size) { + if (m_sock.Send(m_err,(const char *)sendBuffer,sendSize)!=(int)sendSize) { m_lastErrorMessage.Format("Error code %d while sending data",m_err.getErrorCode()); return false; } @@ -44,4 +49,4 @@ bool CMedicinaVertex::sendTo(const void *buffer,int size) return false; } return true; -} \ No newline at end of file +} diff --git a/Medicina/Misc/MedScripts/src/Makefile b/Medicina/Misc/MedScripts/src/Makefile index 224bfb1f4f9f9cd7b511976e3788587c37472aca..1f1f60d7da2b5c7fa53ffe7d135b7310faae2ff6 100644 --- a/Medicina/Misc/MedScripts/src/Makefile +++ b/Medicina/Misc/MedScripts/src/Makefile @@ -53,7 +53,7 @@ pppppp_MODULES = # new bootup scripts (discos): SCRIPTS=discosup discosdown discosConsole -SCRIPTS_L = escs escsConsole +SCRIPTS_L = med-vnc med-copy #INSTALL_FILES = ../app-defaults/escsStartup.xml diff --git a/Medicina/Misc/MedScripts/src/med-copy b/Medicina/Misc/MedScripts/src/med-copy new file mode 100644 index 0000000000000000000000000000000000000000..b94aab5e5fe70873e50c0f9d6d8e95ebc8573d3b --- /dev/null +++ b/Medicina/Misc/MedScripts/src/med-copy @@ -0,0 +1,147 @@ +#!/usr/bin/env bash + +print_help() { + echo " " + echo "`basename $0` v1.0" + echo " " + echo "Copy files from and toward the DISCOS system." + echo "Usage: '`basename $0` [-p|--port portnumber] -r|--remote @ -d|--download Source Destination" + echo " '`basename $0` [-p|--port portnumber] -r|--remote @ -u|--upload Source Destination" + echo " '`basename $0` -h|--help'" + echo "-d | --download this allows to download files or folders from DISCOS to your local machine" + echo "-h | --help prints this help message and exit" + echo "-p | --port ssh port, if different from the default one" + echo "-r | --remote provides the credentials to log into DISCOS" + echo " indicates the project for which files are copied." + echo " access point into the observatory lan. This information is provided by local staff." + echo " Use 'local' if already inside the local area network." + echo "-u | --upload this allows to upload files or folders to DISCOS from your local machine" + exit 1 +} + +current_system="LINUX" +upload="" +download="" +ssh_port="22" +project="" +gatein="" +local="FALSE" +src="" +dest="" + +while [[ $# -gt 0 ]] +do +key="$1" +case $key in + -h|--help) + print_help + ;; + -p|--port) + ssh_port=$2 + shift + shift + ;; + -d|--download) + download="TRUE" + shift + ;; + -u|--upload) + upload="TRUE" + shift + ;; + -r|--remote) + if [[ $2 == *"@"* ]]; then + while IFS='@' read -ra ARG; do + if [[ "${#ARG[@]}" -ne 2 ]]; then + echo -e "Please provide a correct @ pair, retry!" + print_help + fi + project=${ARG[0]} + gatein=${ARG[1]} + done <<< "$2" + else + echo "Bad argument format: '$2'!" + print_help + fi + shift + shift + ;; + *) + if [[ "$src" == "" ]] + then + src=$key + elif [[ "$dest" == "" ]] + then + dest=$key + else + echo "Too many arguments provided!" + print_help + fi + shift + ;; +esac +done + +if [[ "$src" == "" || "$dest" == "" ]]; then + echo -e "Inconsistent input, both source and destination should be provided!" + print_help +fi + +if [[ "$gatein" == "" ]]; then + echo -e "Remote credentials must be provided!" + print_help +fi + +if [[ "$gatein" == "local" ]]; then + local="TRUE" +fi + +if [[ "$upload" == "" && "$download" == "" ]]; then + echo -e "Inconsistent input, at least one of '--upload' and '--download' should be provided!" + print_help +fi + +if [[ "$upload" != "" && "$download" != "" ]]; then + echo -e "Inconsistent input, only one of '--upload' and '--download' should be provided!" + print_help +fi + +if [[ "$OSTYPE" == *"linux-gnu"* ]] +then + echo -e "Linux OS is detected..." + current_system="LINUX" +elif [[ "$OSTYPE" == *"darwin"* ]] +then + echo -e "Mac OS is detected..." + current_system="MACOS" +else + echo -e "Not supported OS, some unpredictable results may happen!" +fi + +#echo $local +#echo $project +#echo $gatein +#echo $ssh_port +#echo $files +#echo $upload +#echo $download +#echo $current_system + +proxy="ProxyCommand=ssh -p ""$ssh_port"" -W %h:%p observer@""$gatein" +#echo $proxy + + +if [[ "$local" == "FALSE" ]]; then + if [[ "$upload" == "TRUE" ]]; then + scp -r -P 9922 -o "$proxy" $src "$project"@192.167.189.98:$dest 2> /dev/null + elif [[ "$download" == "TRUE" ]]; then + scp -r -P 9922 -o "$proxy" "$project"@192.167.189.98:$src $dest 2> /dev/null + fi +else + if [[ "$upload" == "TRUE" ]]; then + scp -r -P 9922 $src "$project"@192.167.189.98:$dest 2> /dev/null + elif [[ "$download" == "TRUE" ]]; then + scp -r -P 9922 "$project"@192.167.189.98:$src $dest 2> /dev/null + fi +fi + diff --git a/Medicina/Misc/MedScripts/src/med-vnc b/Medicina/Misc/MedScripts/src/med-vnc new file mode 100644 index 0000000000000000000000000000000000000000..8f1bf2ca809f3ce413735e7d673cdc27c874254d --- /dev/null +++ b/Medicina/Misc/MedScripts/src/med-vnc @@ -0,0 +1,174 @@ +#!/usr/bin/env bash + +print_help() { + echo " " + echo "`basename $0` v1.0" + echo " " + echo "Start a new session toward DISCOS control software" + echo "Usage: '`basename $0` [OPTIONS] [-p|--port portnumber] @'" + echo " '`basename $0` -r|--roles'" + echo " '`basename $0` -h|--help'" + echo " indicates the role (observer or administrative privileges) for which the connection is done" + echo " access point into the observatory LAN. This information is provided by local staff." + echo " Use 'local' if already inside the local area network." + echo "-h | --help prints this help message and exit" + echo "-r | --roles shows all the available roles" + echo "-p | --port ssh port if different from the default one" + echo "Options:" + echo " -v | --viewonly start the vncviewer in view only mode" + exit 1 +} + +vnc_avail="TRUE" +local_connection="FALSE" +ssh_port="22" +viewonly="" +role="" +gatein="" +remote_port=0 +current_system="LINUX" + +remote_sessions=( "discos:9901:15001" "observer:9902:15002" ) + + +while [[ $# -gt 0 ]] +do +key="$1" + +case $key in + -h|--help) + print_help + ;; + -r|--roles) + echo "Available roles are: " + for session in "${remote_sessions[@]}" ; do + echo "${session%%:*}" + done + exit 0 + ;; + -p|--port) + ssh_port=$2 + shift + shift + ;; + -v|--viewonly) + viewonly="-ViewOnly" + shift + ;; + *) + if [[ $1 == *"@"* ]]; then + while IFS='@' read -ra ARG; do + if [[ "${#ARG[@]}" -ne 2 ]]; then + echo "Please provide a correct @ pair, retry!" + print_help + fi + role=${ARG[0]} + gatein=${ARG[1]} + done <<< "$1" + else + echo "Unrecognized option: '$1'!" + print_help + fi + shift + ;; +esac +done + +if [[ "$gatein" == "local" ]]; then + local_connection="TRUE" +fi + +if [[ "$OSTYPE" == *"linux-gnu"* ]] +then + echo -e "Linux OS is detected..." + current_system="LINUX" +elif [[ "$OSTYPE" == *"darwin"* ]] +then + echo -e "Mac OS is detected..." + current_system="MACOS" +else + echo -e "Not supported OS, some unpredictable results may happen!" +fi + +if ! hash vncviewer &>/dev/null; then + echo -e "'vncviewer' is not installed, this script is setting up the connection but won't automatically start vnc.\nA custom client should be manually started." + vnc_avail="FALSE" +fi + +if hash netstat &>/dev/null; then + if [[ "$current_system" == "LINUX" ]]; then + PORTCOMMAND="netstat -tulpn" + else + PORTCOMMAND="netstat -avnp tcp" + fi +else + echo -e "This program requires 'netstat' to be installed.\nThe package to install may vary depending on your operating system.\n" + print_help +fi + +for session in "${remote_sessions[@]}" ; do + role_name="${session%%:*}" + ports="${session#*:}" + rport="${ports%:*}" + lport="${ports#*:}" + if [[ "$role" == "$role_name" ]]; then + if [ "$local_connection" = "TRUE" ]; then + #this is for local area connection when it will enabled + remote_port=$lport + #remote_port=$rport + ssh_port=22 + else + remote_port=$rport + fi + break + fi +done + +if [[ $remote_port -eq 0 ]]; then + echo "Please, provide a correct role, use the switch '--roles' for a complete list of available roles" + print_help +fi + +for i in {0..50} +do + local_port_attempt=$((9000 + i)) + if ! $PORTCOMMAND | grep 127.0.0.1[.:]$local_port_attempt &>/dev/null; then + local_port=$local_port_attempt + break + fi +done + +if [[ -z "$local_port" ]]; then + echo "Could not find an available port in range 9000-9050" + exit 1 +fi + +#echo $local_connection +#echo $role +#echo $remote_port +#echo $local_port +#echo $gatein +#echo $ssh_port +#echo $viewonly +#echo $vnc_avail + +if [[ "$local_connection" = "TRUE" ]]; then + echo "Connecting from local area...." + ssh -N -f -L $local_port:192.168.1.99:$remote_port $role@192.167.189.98 +else + echo "Connecting from wide area....." + ssh -N -f -p $ssh_port -L $local_port:192.167.189.98:$remote_port $role@$gatein +fi +if [[ "$vnc_avail" == "TRUE" ]]; then + echo "Starting vncviewer...." + vncviewer localhost:$local_port $viewonly &>/dev/null +else + echo "Connection is set, please use your preferred vnc client to connect to 'localhost', port "$local_port +fi + + + + + + + diff --git a/Medicina/Servers/MedicinaKBandDualFReceiver/src/MedicinaKBandDualFCore.cpp b/Medicina/Servers/MedicinaKBandDualFReceiver/src/MedicinaKBandDualFCore.cpp index a3908b6727e579a1bac906d44c691f4bc1e20d57..b0be7b241fef0d027c15aa65e2f73f137c522ff9 100644 --- a/Medicina/Servers/MedicinaKBandDualFReceiver/src/MedicinaKBandDualFCore.cpp +++ b/Medicina/Servers/MedicinaKBandDualFReceiver/src/MedicinaKBandDualFCore.cpp @@ -136,7 +136,7 @@ void MedicinaKBandDualFCore::setMode(const char * mode) throw ( setLO(lo); if (m_medConfig.getVertexCommand()!="") { int size=m_medConfig.getVertexCommand().GetLength(); - if (!vertex.sendTo((const char *)m_medConfig.getVertexCommand(),size)) { + if (!vertex.sendTo(m_medConfig.getVertexCommand(),size)) { ACS_LOG(LM_FULL_INFO,"MedicinaKBandDualFCore::setMode()", (LM_ERROR,"Vertex Communication Error: %s",(const char *)vertex.getLastErrorMessage())); CUSTOM_LOG(LM_FULL_INFO,"MedicinaKBandDualFCore::setMode()", diff --git a/SRT/CDB/alma/MANAGEMENT/ExternalClients/ExternalClients.xml b/SRT/CDB/alma/MANAGEMENT/ExternalClients/ExternalClients.xml index 51fe39ba1ecb5e6cd6c10e85c0504705b715214c..f7302517cedb26e2ac42d433473e079f7a9cdf60 100644 --- a/SRT/CDB/alma/MANAGEMENT/ExternalClients/ExternalClients.xml +++ b/SRT/CDB/alma/MANAGEMENT/ExternalClients/ExternalClients.xml @@ -7,7 +7,7 @@ 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" - IPAddress="192.168.200.200" + IPAddress="0.0.0.0" Port="30000" ReceiveTimeout="10000000" ControlThreadPeriod="10000000" diff --git a/SRT/CDB/alma/MANAGEMENT/RFIMonitoring/RFIMonitoring.xml b/SRT/CDB/alma/MANAGEMENT/RFIMonitoring/RFIMonitoring.xml new file mode 100644 index 0000000000000000000000000000000000000000..f868487d0c4fea27d0bf5777902f412ef2905e77 --- /dev/null +++ b/SRT/CDB/alma/MANAGEMENT/RFIMonitoring/RFIMonitoring.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/SRT/Libraries/GAIABoardCommandLibrary/include/GAIABoardCommandLibrary.h b/SRT/Libraries/GAIABoardCommandLibrary/include/GAIABoardCommandLibrary.h new file mode 100644 index 0000000000000000000000000000000000000000..f2a928d4bf6afaceb9be5440d1a5d36dafdc9dfb --- /dev/null +++ b/SRT/Libraries/GAIABoardCommandLibrary/include/GAIABoardCommandLibrary.h @@ -0,0 +1,78 @@ +#ifndef _GAIABOARDCOMMANDLIBRARY_H +#define _GAIABOARDCOMMANDLIBRARY_H + +/** + * GAIABoardCommandLibrary.h + * 2022/02/25 + * Giuseppe Carboni (giuseppe.carboni@inaf.it) + */ + +#include + +#define HEADER "#" +#define TAIL "\n" + +/** + * GAIA Board Command Library + * + * This class features static functions used to build commands to be sent to the GAIA Boards + */ +class GAIABoardCommandLibrary +{ +public: + /** + * Builds the command used to ask some info about the GAIA Board and its firmware + * @return the composed message + */ + static std::string idn(); + + /** + * Builds the command used to turn on the Low Noise Amplifiers + * @param channel the channel the command will be sent to + * @return the composed message + */ + static std::string enable(unsigned int channel); + + /** + * Builds the command used to retrieve the gate tension + * @param channel the channel the command will be sent to + * @return the composed message + */ + static std::string getvg(unsigned int channel); + + /** + * Builds the command used to retrieve the drain tension + * @param channel the channel the command will be sent to + * @return the composed message + */ + static std::string getvd(unsigned int channel); + + /** + * Builds the command used to retrieve the drain current draw + * @param channel the channel the command will be sent to + * @return the composed message + */ + static std::string getid(unsigned int channel); + + /** + * Builds the command used to retrieve the reference tensions + * @param channel the channel the command will be sent to + * @return the composed message + */ + static std::string getref(unsigned int channel); + + /** + * Builds the command used to retrieve the temperature of the analog to digital converter + * @param channel the channel the command will be sent to + * @return the composed message + */ + static std::string getemp(unsigned int channel); + + /** + * Builds the command used to retrieve the name of the GAIA Board + * @return the composed message + */ + static std::string name(); +}; + +#endif diff --git a/SRT/Libraries/GAIABoardCommandLibrary/src/GAIABoardCommandLibrary.cpp b/SRT/Libraries/GAIABoardCommandLibrary/src/GAIABoardCommandLibrary.cpp new file mode 100644 index 0000000000000000000000000000000000000000..583e80abe2d50d314a6fd0a0b6168770acb6da7d --- /dev/null +++ b/SRT/Libraries/GAIABoardCommandLibrary/src/GAIABoardCommandLibrary.cpp @@ -0,0 +1,63 @@ +/** + * GAIABoardCommandLibrary.cpp + * 2022/02/25 + * Giuseppe Carboni (giuseppe.carboni@inaf.it) + */ + +#include "GAIABoardCommandLibrary.h" + +std::string GAIABoardCommandLibrary::idn() +{ + std::stringstream command; + command << HEADER << "IDN?" << TAIL; + return command.str(); +} + +std::string GAIABoardCommandLibrary::enable(unsigned int channel) +{ + std::stringstream command; + command << HEADER << "ENABLE " << channel << TAIL; + return command.str(); +} + +std::string GAIABoardCommandLibrary::getvg(unsigned int channel) +{ + std::stringstream command; + command << HEADER << "GETVG " << channel << TAIL; + return command.str(); +} + +std::string GAIABoardCommandLibrary::getvd(unsigned int channel) +{ + std::stringstream command; + command << HEADER << "GETVD " << channel << TAIL; + return command.str(); +} + +std::string GAIABoardCommandLibrary::getid(unsigned int channel) +{ + std::stringstream command; + command << HEADER << "GETID " << channel << TAIL; + return command.str(); +} + +std::string GAIABoardCommandLibrary::getref(unsigned int channel) +{ + std::stringstream command; + command << HEADER << "GETREF " << channel << TAIL; + return command.str(); +} + +std::string GAIABoardCommandLibrary::getemp(unsigned int channel) +{ + std::stringstream command; + command << HEADER << "GETEMP " << channel << TAIL; + return command.str(); +} + +std::string GAIABoardCommandLibrary::name() +{ + std::stringstream command; + command << HEADER << "NAME?" << TAIL; + return command.str(); +} diff --git a/SRT/Libraries/GAIABoardCommandLibrary/src/Makefile b/SRT/Libraries/GAIABoardCommandLibrary/src/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b9ebdc1a26d8300f3602fdf1c157d39254d81014 --- /dev/null +++ b/SRT/Libraries/GAIABoardCommandLibrary/src/Makefile @@ -0,0 +1,231 @@ + +#******************************************************************************* +# PPPPPPPP +# +# "@(#) $Id$" +# +# Makefile of ........ +# +# who when what +# -------- -------- ---------------------------------------------- +# discos 30/10/20 created +# + +# ALMA - Atacama Large Millimeter Array +# Copyright (c) ESO - European Southern Observatory, 2014 +# (in the framework of the ALMA collaboration). +# All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#******************************************************************************* + +#******************************************************************************* +# This Makefile follows ALMA/ACS Standards (see Makefile(5) for more). +#******************************************************************************* +# REMARKS +# None +#------------------------------------------------------------------------ + +# +# user definable C-compilation flags +#USER_CFLAGS = + +# +# additional include and library search paths +#USER_INC = +#USER_LIB = + +# +# MODULE CODE DESCRIPTION: +# ------------------------ +# As a general rule: public file are "cleaned" and "installed" +# local (_L) are not "installed". + +# +# C programs (public and local) +# ----------------------------- +EXECUTABLES = +EXECUTABLES_L = + +# +# +xxxxx_OBJECTS = +xxxxx_LDFLAGS = +xxxxx_LIBS = + +# +# special compilation flags for single c sources +#yyyyy_CFLAGS = + +# +# Includes (.h) files (public only) +# --------------------------------- +INCLUDES = + +# +# Libraries (public and local) +# ---------------------------- +LIBRARIES = GAIABoardCommandLibrary +LIBRARIES_L = + +# +# +GAIABoardCommandLibrary_OBJECTS = GAIABoardCommandLibrary +GAIABoardCommandLibrary_LIBS = + +# +# Scripts (public and local) +# ---------------------------- +SCRIPTS = +SCRIPTS_L = + +# +# TCL scripts (public and local) +# ------------------------------ +TCL_SCRIPTS = +TCL_SCRIPTS_L = + +# +# Python stuff (public and local) +# ---------------------------- +PY_SCRIPTS = +PY_SCRIPTS_L = + +PY_MODULES = +PY_MODULES_L = + +PY_PACKAGES = +PY_PACKAGES_L = +pppppp_MODULES = + +# +# +tttttt_OBJECTS = +tttttt_TCLSH = +tttttt_LIBS = + +# +# TCL libraries (public and local) +# ------------------------------ +TCL_LIBRARIES = +TCL_LIBRARIES_L = + +# +# +tttlll_OBJECTS = + +# +# Configuration Database Files +# ---------------------------- +CDB_SCHEMAS = + +# +# IDL Files and flags +# +IDL_FILES = +TAO_IDLFLAGS = +USER_IDL = +# +# Jarfiles and their directories +# +JARFILES= +jjj_DIRS= +jjj_EXTRAS= +# For expressing dependencies between jarfiles (parallel builds) +jjj_JLIBS= +# +# java sources in Jarfile on/off +DEBUG= +# +# ACS XmlIdl generation on/off +# +XML_IDL= +# +# Java Component Helper Classes generation on/off +# +COMPONENT_HELPERS= +# +# Java Entity Classes generation on/off +# +XSDBIND= +# +# Schema Config files for the above +# +XSDBIND_INCLUDE= +# man pages to be done +# -------------------- +MANSECTIONS = +MAN1 = +MAN3 = +MAN5 = +MAN7 = +MAN8 = + +# +# local man pages +# --------------- +MANl = + +# +# ASCII file to be converted into Framemaker-MIF +# -------------------- +ASCII_TO_MIF = + +# +# other files to be installed +#---------------------------- +INSTALL_FILES = + +# +# list of all possible C-sources (used to create automatic dependencies) +# ------------------------------ +CSOURCENAMES = \ + $(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \ + $(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \ + $(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS)) + +# +#>>>>> END OF standard rules + +# +# INCLUDE STANDARDS +# ----------------- + +MAKEDIRTMP := $(shell searchFile include/acsMakefile) +ifneq ($(MAKEDIRTMP),\#error\#) + MAKEDIR := $(MAKEDIRTMP)/include + include $(MAKEDIR)/acsMakefile +endif + +# +# TARGETS +# ------- +all: do_all + @echo " . . . 'all' done" + +clean : clean_all + @echo " . . . clean done" + +clean_dist : clean_all clean_dist_all + @echo " . . . clean_dist done" + +man : do_man + @echo " . . . man page(s) done" + +install : install_all + @echo " . . . installation done" + + +#___oOo___ diff --git a/SRT/Libraries/GAIABoardCommandLibrary/tests/.discos b/SRT/Libraries/GAIABoardCommandLibrary/tests/.discos new file mode 100644 index 0000000000000000000000000000000000000000..1ada672a94fe0bc0155145468f693b3e4180735b --- /dev/null +++ b/SRT/Libraries/GAIABoardCommandLibrary/tests/.discos @@ -0,0 +1,5 @@ +This file is here to differentiate between ACS style test directory and discos-style test. + +This is a discos test directory + +DO NOT REMOVE THIS FILE diff --git a/SRT/Libraries/GAIABoardCommandLibrary/tests/Makefile b/SRT/Libraries/GAIABoardCommandLibrary/tests/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..5e06575c78dfabbb1a7392f30f0739c517f68ef4 --- /dev/null +++ b/SRT/Libraries/GAIABoardCommandLibrary/tests/Makefile @@ -0,0 +1,90 @@ +# CPP UNIT TESTING SETUP +#-------------- +GTEST_HOME=/usr/local/include/gtest +GMOCK_HOME=/usr/local/include/gmock +GTEST_LIBS=gtest gtest_main + +USER_INC=-I$(GTEST_HOME) -I$(GMOCK_HOME) +# END OF CPP UNIT TESTING SETUP +#--------------------- + +# DEFINE YOUR CPP UNIT TEST EXECUTABLES HERE as: +# +# EXECTUABLES_L = unittest +# unittest_OBJECTS = unittest +# unittest_LIBS = $(GTEST_LIBS) + +EXECUTABLES_L = unittest +unittest_OBJECTS = unittest +unittest_LIBS = $(GTEST_LIBS) GAIABoardCommandLibrary +unittest_LDFLAGS = -lstdc++ -lpthread + +# END OF CUSTOMIZATION +# do not edit below this line +#---------------------------- + +CSOURCENAMES = \ + $(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \ + $(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \ + $(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS)) + +MAKEDIRTMP := $(shell searchFile include/acsMakefile) +ifneq ($(MAKEDIRTMP),\#error\#) + MAKEDIR := $(MAKEDIRTMP)/include + include $(MAKEDIR)/acsMakefile +endif + +# TEST TARGETS +#TODO: unittest(2) discover pyunit + +do_unit: all + @echo "running cpp unit tests" + ../bin/unittest --gtest_output=xml:results/cppunittest.xml + +do_pyunit: + @echo "running python unit tests" + python -m unittest pyunit + +do_functional: + @echo "running python functional tests" + python -m unittest functional + +do_external: + @echo "running python external tests" + python -m unittest external + +clean_test: + rm -f results/*.xml + rm -f functional/*.pyc + rm -f pyunit/*.pyc + rm -f external/*.pyc + +unit: do_unit + @echo " . . . 'unit' done" + +pyunit: do_pyunit + @echo " . . . 'pyunit' done" + +functional: do_functional + @echo " . . . 'functional' done" + +external: do_external + @echo " . . . 'external' done" + +# TARGETS +# ------- +all: do_all + @echo " . . . 'all' done" + +clean : clean_all clean_test + @echo " . . . clean done" + +clean_dist : clean_all clean_dist_all clean_test + @echo " . . . clean_dist done" + +man : do_man + @echo " . . . man page(s) done" + +install : install_all + @echo " . . . installation done" + diff --git a/SRT/Libraries/GAIABoardCommandLibrary/tests/external/__init__.py b/SRT/Libraries/GAIABoardCommandLibrary/tests/external/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/SRT/Libraries/GAIABoardCommandLibrary/tests/functional/__init__.py b/SRT/Libraries/GAIABoardCommandLibrary/tests/functional/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/SRT/Libraries/GAIABoardCommandLibrary/tests/pyunit/__init__.py b/SRT/Libraries/GAIABoardCommandLibrary/tests/pyunit/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/SRT/Libraries/GAIABoardCommandLibrary/tests/unittest.cpp b/SRT/Libraries/GAIABoardCommandLibrary/tests/unittest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5ba815b7193818c43e158c711534faddc1db6799 --- /dev/null +++ b/SRT/Libraries/GAIABoardCommandLibrary/tests/unittest.cpp @@ -0,0 +1,35 @@ +#include "gtest/gtest.h" +#include "GAIABoardCommandLibrary.h" + +TEST(GAIABoardCommandLibraryTest, idn) +{ + EXPECT_EQ(GAIABoardCommandLibrary::idn(), "#IDN?\n"); +} +TEST(GAIABoardCommandLibraryTest, enable) +{ + EXPECT_EQ(GAIABoardCommandLibrary::enable(0), "#ENABLE 0\n"); +} +TEST(GAIABoardCommandLibraryTest, getvg) +{ + EXPECT_EQ(GAIABoardCommandLibrary::getvg(0), "#GETVG 0\n"); +} +TEST(GAIABoardCommandLibraryTest, getvd) +{ + EXPECT_EQ(GAIABoardCommandLibrary::getvd(0), "#GETVD 0\n"); +} +TEST(GAIABoardCommandLibraryTest, getid) +{ + EXPECT_EQ(GAIABoardCommandLibrary::getid(0), "#GETID 0\n"); +} +TEST(GAIABoardCommandLibraryTest, getref) +{ + EXPECT_EQ(GAIABoardCommandLibrary::getref(0), "#GETREF 0\n"); +} +TEST(GAIABoardCommandLibraryTest, getemp) +{ + EXPECT_EQ(GAIABoardCommandLibrary::getemp(0), "#GETEMP 0\n"); +} +TEST(GAIABoardCommandLibraryTest, name) +{ + EXPECT_EQ(GAIABoardCommandLibrary::name(), "#NAME?\n"); +}