From 6affa72e8960fb352b98f55f9cf202c2a30dc79e Mon Sep 17 00:00:00 2001
From: Giuseppe Carboni <giuseppecarboni89@live.com>
Date: Wed, 9 Apr 2025 16:08:30 +0000
Subject: [PATCH] Issue #885, some KQWReceiver related fixes

---
 .../KQWReceiver/include/ComponentCore.h       |  4 ++--
 .../Servers/KQWReceiver/src/ComponentCore.cpp | 24 +++++++++----------
 .../Synthesizer_K.xml}                        |  0
 .../Synthesizer_Q/Synthesizer_Q.xml           | 24 +++++++++++++++++++
 .../Synthesizer_WHIGH/Synthesizer_WHIGH.xml   | 24 +++++++++++++++++++
 .../Synthesizer_WLOW/Synthesizer_WLOW.xml     | 24 +++++++++++++++++++
 .../KQWBandReceiver/KQWBandReceiver.xml       |  8 +++----
 .../KQWBandReceiver/KQWBandReceiver.xml       |  8 +++----
 8 files changed, 93 insertions(+), 23 deletions(-)
 rename SRT/CDB/alma/DataBlock/KQWReceiver/{Synthesizer/Synthesizer.xml => Synthesizer_K/Synthesizer_K.xml} (100%)
 create mode 100644 SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_Q/Synthesizer_Q.xml
 create mode 100644 SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_WHIGH/Synthesizer_WHIGH.xml
 create mode 100644 SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_WLOW/Synthesizer_WLOW.xml

diff --git a/Common/Servers/KQWReceiver/include/ComponentCore.h b/Common/Servers/KQWReceiver/include/ComponentCore.h
index 289f27d96..dadd51cf9 100644
--- a/Common/Servers/KQWReceiver/include/ComponentCore.h
+++ b/Common/Servers/KQWReceiver/include/ComponentCore.h
@@ -467,11 +467,11 @@ protected:
     /** Obtain a valid reference to the local oscillator device
 	  * @throw ComponentErrors::CouldntGetComponentExImpl   
      */
-    void loadLocalOscillator(Receivers::LocalOscillator_ptr device,bool &fault,const IRA::CString& name);
+    void loadLocalOscillator(Receivers::LocalOscillator_var& device,bool &fault,const IRA::CString& name);
 
 
     /** Used to free the reference to the local oscillator device */
-    void unloadLocalOscillator(Receivers::LocalOscillator_ptr device,const IRA::CString& name);
+    void unloadLocalOscillator(Receivers::LocalOscillator_var& device,const IRA::CString& name);
 
 
     /************************ CONVERSION FUNCTIONS **************************/
diff --git a/Common/Servers/KQWReceiver/src/ComponentCore.cpp b/Common/Servers/KQWReceiver/src/ComponentCore.cpp
index 07eabb4eb..9a626062f 100644
--- a/Common/Servers/KQWReceiver/src/ComponentCore.cpp
+++ b/Common/Servers/KQWReceiver/src/ComponentCore.cpp
@@ -80,10 +80,10 @@ void CComponentCore::cleanup()
         m_control->closeConnection();
         delete m_control;
     }
-    unloadLocalOscillator(m_localOscillatorDevice_K.out(),m_configuration.getLocalOscillatorInstance_K());
-    unloadLocalOscillator(m_localOscillatorDevice_Q.out(),m_configuration.getLocalOscillatorInstance_Q());
-    unloadLocalOscillator(m_localOscillatorDevice_WL.out(),m_configuration.getLocalOscillatorInstance_WL());
-    unloadLocalOscillator(m_localOscillatorDevice_WH.out(),m_configuration.getLocalOscillatorInstance_WH());
+    unloadLocalOscillator(m_localOscillatorDevice_K,m_configuration.getLocalOscillatorInstance_K());
+    unloadLocalOscillator(m_localOscillatorDevice_Q,m_configuration.getLocalOscillatorInstance_Q());
+    unloadLocalOscillator(m_localOscillatorDevice_WL,m_configuration.getLocalOscillatorInstance_WL());
+    unloadLocalOscillator(m_localOscillatorDevice_WH,m_configuration.getLocalOscillatorInstance_WH());
 }
 
 const IRA::CString& CComponentCore::getActualMode()
@@ -415,7 +415,6 @@ throw (
 */
 void CComponentCore::setLO(const ACS::doubleSeq& lo) 
 {
-	
     double trueValue,amp;
     double *freq=NULL;
     double *power=NULL;
@@ -470,18 +469,18 @@ void CComponentCore::setLO(const ACS::doubleSeq& lo)
     		// make sure the synthesizer component is available
 
 			if (m_configuration.getArrayIndex(k)==CConfiguration<maci::ContainerServices>::KBAND) {
-    			loadLocalOscillator(m_localOscillatorDevice_K.out(),m_localOscillatorFault_K,
+				loadLocalOscillator(m_localOscillatorDevice_K,m_localOscillatorFault_K,
     			m_configuration.getLocalOscillatorInstance_K()); 	 // throw (ComponentErrors::CouldntGetComponentExImpl)
     		} else if (m_configuration.getArrayIndex(k)==CConfiguration<maci::ContainerServices>::QBAND) {
-    			loadLocalOscillator(m_localOscillatorDevice_Q.out(),m_localOscillatorFault_Q,
+				loadLocalOscillator(m_localOscillatorDevice_Q,m_localOscillatorFault_Q,
     			m_configuration.getLocalOscillatorInstance_Q()); // throw (ComponentErrors::CouldntGetComponentExImpl)
     		} else if (m_configuration.getArrayIndex(k)==CConfiguration<maci::ContainerServices>::WLBAND) {
-    			loadLocalOscillator(m_localOscillatorDevice_WL.out(),m_localOscillatorFault_WL,
+				loadLocalOscillator(m_localOscillatorDevice_WL,m_localOscillatorFault_WL,
     			m_configuration.getLocalOscillatorInstance_WL()); // throw (ComponentErrors::CouldntGetComponentExImpl)
     		}
     		else { //WHBAND
-    			loadLocalOscillator(m_localOscillatorDevice_WL.out(),m_localOscillatorFault_WL,
-    			m_configuration.getLocalOscillatorInstance_WL()); // throw (ComponentErrors::CouldntGetComponentExImpl)
+				loadLocalOscillator(m_localOscillatorDevice_WH,m_localOscillatorFault_WH,
+				m_configuration.getLocalOscillatorInstance_WH()); // throw (ComponentErrors::CouldntGetComponentExImpl)
     		}
    			try {
    				if (m_configuration.getArrayIndex(k)==CConfiguration<maci::ContainerServices>::KBAND) {
@@ -510,7 +509,6 @@ void CComponentCore::setLO(const ACS::doubleSeq& lo)
         		throw impl;
     		}
     		m_configuration.setCurrentLOValue(lo[k],k);
-    					
     	}
     }
 }
@@ -1179,7 +1177,7 @@ void CComponentCore::updateVertexTemperature()
 }
 
 //throw (ComponentErrors::CouldntGetComponentExImpl)
-void CComponentCore::loadLocalOscillator(Receivers::LocalOscillator_ptr device,bool &fault,const IRA::CString& name)
+void CComponentCore::loadLocalOscillator(Receivers::LocalOscillator_var& device,bool &fault,const IRA::CString& name)
 {
     // If reference was already taken, but an error was found....dispose the reference
     if ((!CORBA::is_nil(device)) && (fault)) { 
@@ -1217,7 +1215,7 @@ void CComponentCore::loadLocalOscillator(Receivers::LocalOscillator_ptr device,b
     }
 }
 
-void CComponentCore::unloadLocalOscillator(Receivers::LocalOscillator_ptr device,const IRA::CString& name)
+void CComponentCore::unloadLocalOscillator(Receivers::LocalOscillator_var& device,const IRA::CString& name)
 {
     if (!CORBA::is_nil(device)) {
         try {
diff --git a/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer/Synthesizer.xml b/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_K/Synthesizer_K.xml
similarity index 100%
rename from SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer/Synthesizer.xml
rename to SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_K/Synthesizer_K.xml
diff --git a/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_Q/Synthesizer_Q.xml b/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_Q/Synthesizer_Q.xml
new file mode 100644
index 000000000..a01801c56
--- /dev/null
+++ b/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_Q/Synthesizer_Q.xml
@@ -0,0 +1,24 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<!--Values are dummies here, to be replaced with real ones -->
+
+<LocalOscillatorLookUpTable xmlns="urn:schemas-cosylab-com:LocalOscillatorLookUpTable: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">
+
+<SynthesizerEntry><Frequency>350.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>400.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>800.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>1200.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>1600.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>2000.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>2400.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+</LocalOscillatorLookUpTable>
diff --git a/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_WHIGH/Synthesizer_WHIGH.xml b/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_WHIGH/Synthesizer_WHIGH.xml
new file mode 100644
index 000000000..a01801c56
--- /dev/null
+++ b/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_WHIGH/Synthesizer_WHIGH.xml
@@ -0,0 +1,24 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<!--Values are dummies here, to be replaced with real ones -->
+
+<LocalOscillatorLookUpTable xmlns="urn:schemas-cosylab-com:LocalOscillatorLookUpTable: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">
+
+<SynthesizerEntry><Frequency>350.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>400.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>800.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>1200.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>1600.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>2000.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>2400.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+</LocalOscillatorLookUpTable>
diff --git a/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_WLOW/Synthesizer_WLOW.xml b/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_WLOW/Synthesizer_WLOW.xml
new file mode 100644
index 000000000..a01801c56
--- /dev/null
+++ b/SRT/CDB/alma/DataBlock/KQWReceiver/Synthesizer_WLOW/Synthesizer_WLOW.xml
@@ -0,0 +1,24 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+
+<!--Values are dummies here, to be replaced with real ones -->
+
+<LocalOscillatorLookUpTable xmlns="urn:schemas-cosylab-com:LocalOscillatorLookUpTable: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">
+
+<SynthesizerEntry><Frequency>350.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>400.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>800.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>1200.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>1600.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>2000.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+<SynthesizerEntry><Frequency>2400.0</Frequency><OutputPower>19.0</OutputPower></SynthesizerEntry>
+
+</LocalOscillatorLookUpTable>
diff --git a/SRT/CDB/alma/RECEIVERS/KQWBandReceiver/KQWBandReceiver.xml b/SRT/CDB/alma/RECEIVERS/KQWBandReceiver/KQWBandReceiver.xml
index debddb619..b2673fd32 100644
--- a/SRT/CDB/alma/RECEIVERS/KQWBandReceiver/KQWBandReceiver.xml
+++ b/SRT/CDB/alma/RECEIVERS/KQWBandReceiver/KQWBandReceiver.xml
@@ -25,10 +25,10 @@
     RepetitionExpireTime="10000000"
     ReceiverName="KQWBand"
     DefaultMode="Normal"
-    LocalOscillator_K_Instance="LO_KBAND"
-    LocalOscillator_Q_Instance="LO_KQW_Q"
-    LocalOscillator_W1_Instance="LO_KQW_WLOW"
-    LocalOscillator_W2_Instance="LO_KQW_WHIGH"
+    LocalOscillator_K_Instance="RECEIVERS/LO_KBAND"
+    LocalOscillator_Q_Instance="RECEIVERS/LO_KQW_Q"
+    LocalOscillator_W1_Instance="RECEIVERS/LO_KQW_WLOW"
+    LocalOscillator_W2_Instance="RECEIVERS/LO_KQW_WHIGH"
 >
     <LO description="Sequence of local oscillator values for each IF chain" />
     <feeds description="Number of feeds of the receiver" />
diff --git a/SRT/Configuration/CDB/alma/RECEIVERS/KQWBandReceiver/KQWBandReceiver.xml b/SRT/Configuration/CDB/alma/RECEIVERS/KQWBandReceiver/KQWBandReceiver.xml
index 18bfd602c..a011596d2 100644
--- a/SRT/Configuration/CDB/alma/RECEIVERS/KQWBandReceiver/KQWBandReceiver.xml
+++ b/SRT/Configuration/CDB/alma/RECEIVERS/KQWBandReceiver/KQWBandReceiver.xml
@@ -25,10 +25,10 @@
     RepetitionExpireTime="10000000"
     ReceiverName="KQWBand"
     DefaultMode="Normal"
-    LocalOscillator_K_Instance="LO_KBAND"
-    LocalOscillator_Q_Instance="LO_KQW_Q"
-    LocalOscillator_W1_Instance="LO_KQW_WLOW"
-    LocalOscillator_W2_Instance="LO_KQW_WHIGH"
+    LocalOscillator_K_Instance="RECEIVERS/LO_KBAND"
+    LocalOscillator_Q_Instance="RECEIVERS/LO_KQW_Q"
+    LocalOscillator_W1_Instance="RECEIVERS/LO_KQW_WLOW"
+    LocalOscillator_W2_Instance="RECEIVERS/LO_KQW_WHIGH"
 >
     <LO description="Sequence of local oscillator values for each IF chain" />
     <feeds description="Number of feeds of the receiver" />
-- 
GitLab