Browse Source

delete oxfordController class.

gsp 3 years ago
parent
commit
3d0b398ea4

+ 2 - 64
OTSCPP/OTSClrInterface/ControlClr/OTSControlFunExport.cpp

@@ -5,70 +5,8 @@
 namespace OTSCLRINTERFACE
 namespace OTSCLRINTERFACE
 {
 {
 
 
-	COTSHardwareMgrPtr g_ControllerMgrPtr = nullptr;
-	CSemBasePtr g_SemBasePtr = nullptr;
-
-	COTSSimuControlClr::COTSSimuControlClr()
-	{
-		g_ControllerMgrPtr = COTSHardwareMgrPtr(new COTSHardwareMgr);
-		g_SemBasePtr = g_ControllerMgrPtr->GetSemControllerMgrPtr();		
-	}
-
-	COTSSimuControlClr::~COTSSimuControlClr()
-	{
-		this->!COTSSimuControlClr();
-	}
-
-	COTSSimuControlClr::!COTSSimuControlClr()
-	{
-		
-	}
-
 	
 	
-	bool COTSSimuControlClr::Connect()
-	{
-		
-		if (nullptr == g_SemBasePtr)
-		{
-			return false;
-		}
-		return g_SemBasePtr->Connect();
-	}
-
-	//bool COTSSimuControlClr::Disconnect()
-	//{
-	//	if (nullptr == g_SemBasePtr)
-	//	{
-	//		return false;
-	//	}
-	//	return g_SemBasePtr->Disconnect();
-	//}
-
-	bool COTSSimuControlClr::SetWorkingDistance(double a_dWorkingDistance)
-	{
-		return g_SemBasePtr->SetWorkingDistance(a_dWorkingDistance);
-	}
-
-	bool COTSSimuControlClr::GetWorkingDistance(double% a_dWorkingDistance)
-	{
-		double WDistance;
-		bool bRev =  g_SemBasePtr->GetWorkingDistance(WDistance);
-		a_dWorkingDistance = WDistance;
-		return bRev;
-	}
-
-	bool COTSSimuControlClr::SetMagnification(double a_dMag)
-	{
-		return g_SemBasePtr->SetMagnification(a_dMag);
-	}
-
-	bool COTSSimuControlClr::GetMagnification(double% a_dMag)
-	{
-		double dMag;
-		bool bRev = g_SemBasePtr->GetMagnification(dMag);
-		a_dMag = dMag;
-		return bRev;
-	}
+	
 	bool COTSControlFunExport::CollectSpectrum(unsigned long a_nMilliseconds, Point a_oPoint, array<unsigned long>^% a_XrayData)
 	bool COTSControlFunExport::CollectSpectrum(unsigned long a_nMilliseconds, Point a_oPoint, array<unsigned long>^% a_XrayData)
 	{
 	{
 
 
@@ -88,6 +26,7 @@ namespace OTSCLRINTERFACE
 		}
 		}
 		return bRet;
 		return bRet;
 	}
 	}
+
 	bool COTSControlFunExport::CollectSpectrum(unsigned long a_nMilliseconds, array<unsigned long>^% a_XrayData, unsigned long a_nBufferSize)
 	bool COTSControlFunExport::CollectSpectrum(unsigned long a_nMilliseconds, array<unsigned long>^% a_XrayData, unsigned long a_nBufferSize)
 	{
 	{
 
 
@@ -604,7 +543,6 @@ namespace OTSCLRINTERFACE
 		}
 		}
 
 
 		return bRet;
 		return bRet;
-		//	return 0;
 
 
 	}
 	}
 
 

+ 18 - 38
OTSCPP/OTSClrInterface/ControlClr/OTSControlFunExport.h

@@ -37,25 +37,6 @@ namespace OTSCLRINTERFACE
 
 
 	
 	
 
 
-
-	public ref class COTSSimuControlClr
-	{
-		public:
-			COTSSimuControlClr();
-			~COTSSimuControlClr();
-			!COTSSimuControlClr();
-			
-	public:
-		bool Connect();
-	
-		bool SetWorkingDistance(double a_dWorkingDistance);
-		bool GetWorkingDistance(double% a_dWorkingDistance);
-		bool SetMagnification(double a_dMag);
-		bool GetMagnification(double% a_dMag);
-	
-		 
-	};
-
 	public ref class COTSControlFunExport
 	public ref class COTSControlFunExport
 	{
 	{
 	public:
 	public:
@@ -90,42 +71,42 @@ namespace OTSCLRINTERFACE
 
 
 
 
 		}
 		}
+	
 
 
-
-		
-
-		//获取当前电镜的ID号
-		int GetSemType()
+		//和电镜建立通讯连接
+		bool ConncetSem()
 		{
 		{
-			int ID = 0;
-			ID = (int)m_pSem->GetType();
 
 
-			return ID;
+			BOOL bRev = m_pSem->Connect();
+			return bRev;
 		}
 		}
+		bool DisconnectSem()
+		{
 
 
+			BOOL bRev = m_pSem->Disconnect();
+			return bRev;
+		}
 		bool IsConnected()
 		bool IsConnected()
 		{
 		{
 
 
 			BOOL bRev = m_pSem->IsConnected();
 			BOOL bRev = m_pSem->IsConnected();
 			return bRev;
 			return bRev;
 		}
 		}
+		
 
 
-		//和电镜建立通讯连接
-		bool ConncetSem()
-		{
-			
-			BOOL bRev = m_pSem->Connect();
-			return bRev;
-		}
-		bool DisconnectSem()
+		//获取当前电镜的ID号
+		int GetSemType()
 		{
 		{
+			int ID = 0;
+			ID = (int)m_pSem->GetType();
 
 
-			BOOL bRev = m_pSem->Disconnect();
-			return bRev;
+			return ID;
 		}
 		}
 
 
 
 
 
 
+
+
 		//获得扫描区域大小
 		//获得扫描区域大小
 		Size GetSemScanField100()
 		Size GetSemScanField100()
 		{
 		{
@@ -724,7 +705,6 @@ namespace OTSCLRINTERFACE
 		COTSControlFunExport()
 		COTSControlFunExport()
 		{
 		{
 
 
-			
 			m_pHardWareMgr = new COTSHardwareMgr();
 			m_pHardWareMgr = new COTSHardwareMgr();
 			m_pSem = (m_pHardWareMgr->GetSemControllerMgrPtr()).get();
 			m_pSem = (m_pHardWareMgr->GetSemControllerMgrPtr()).get();
 			m_pScan = (m_pHardWareMgr->GetScanControllerPtr()).get();
 			m_pScan = (m_pHardWareMgr->GetScanControllerPtr()).get();

+ 2 - 0
OTSCPP/OTSClrInterface/OTSClrInterface.vcxproj

@@ -220,6 +220,7 @@
     <ClCompile Include="CommonClr\SEMStageDataClr.cpp" />
     <ClCompile Include="CommonClr\SEMStageDataClr.cpp" />
     <ClCompile Include="CommonClr\StageClr.cpp" />
     <ClCompile Include="CommonClr\StageClr.cpp" />
     <ClCompile Include="ControlClr\OTSControlFunExport.cpp" />
     <ClCompile Include="ControlClr\OTSControlFunExport.cpp" />
+    <ClCompile Include="COTSSimuControlClr.cpp" />
     <ClCompile Include="ImageProClr\FieldMgrClr.cpp" />
     <ClCompile Include="ImageProClr\FieldMgrClr.cpp" />
     <ClCompile Include="ImageProClr\ImageProForClr.cpp" />
     <ClCompile Include="ImageProClr\ImageProForClr.cpp" />
     <ClCompile Include="ImageProClr\OTSImgProcPrmClr.cpp" />
     <ClCompile Include="ImageProClr\OTSImgProcPrmClr.cpp" />
@@ -258,6 +259,7 @@
     <ClInclude Include="CommonClr\SEMStageDataClr.h" />
     <ClInclude Include="CommonClr\SEMStageDataClr.h" />
     <ClInclude Include="CommonClr\StageClr.h" />
     <ClInclude Include="CommonClr\StageClr.h" />
     <ClInclude Include="ControlClr\OTSControlFunExport.h" />
     <ClInclude Include="ControlClr\OTSControlFunExport.h" />
+    <ClInclude Include="COTSSimuControlClr.h" />
     <ClInclude Include="ImageProClr\FieldMgrClr.h" />
     <ClInclude Include="ImageProClr\FieldMgrClr.h" />
     <ClInclude Include="ImageProClr\ImageProForClr.h" />
     <ClInclude Include="ImageProClr\ImageProForClr.h" />
     <ClInclude Include="ImageProClr\OTSImgProcPrmClr.h" />
     <ClInclude Include="ImageProClr\OTSImgProcPrmClr.h" />

+ 6 - 0
OTSCPP/OTSClrInterface/OTSClrInterface.vcxproj.filters

@@ -138,6 +138,9 @@
     <ClCompile Include="ReportCalculateClr\SmplMsrResultFileMgrClr.cpp">
     <ClCompile Include="ReportCalculateClr\SmplMsrResultFileMgrClr.cpp">
       <Filter>OTSREPORTCLR</Filter>
       <Filter>OTSREPORTCLR</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="COTSSimuControlClr.cpp">
+      <Filter>ControlClr</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="CommonClr\BSEImgClr.h">
     <ClInclude Include="CommonClr\BSEImgClr.h">
@@ -248,5 +251,8 @@
     <ClInclude Include="ReportCalculateClr\SmplMsrResultFileMgrClr.h">
     <ClInclude Include="ReportCalculateClr\SmplMsrResultFileMgrClr.h">
       <Filter>OTSREPORTCLR</Filter>
       <Filter>OTSREPORTCLR</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="COTSSimuControlClr.h">
+      <Filter>ControlClr</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 1 - 1
OTSCPP/OTSControl/COTSHardwareMgr.cpp

@@ -148,7 +148,7 @@ namespace OTSController {
 				{
 				{
 				
 				
 						m_EDSPtr = COTSEDSBasePtr(new COTSEDSOxford());
 						m_EDSPtr = COTSEDSBasePtr(new COTSEDSOxford());
-						LogInfoTrace(__FILE__, __LINE__, "(COTSHardwareMgr::GetEDSControllerPtr) new COTSEDSSim() ");
+						LogInfoTrace(__FILE__, __LINE__, "(COTSHardwareMgr::GetEDSControllerPtr) new COTSEDSOxford() ");
 				
 				
 
 
 					break;
 					break;

+ 0 - 2
OTSCPP/OTSControl/OTSControl.vcxproj

@@ -346,7 +346,6 @@
     <ClCompile Include="COTSHardwareMgr.cpp" />
     <ClCompile Include="COTSHardwareMgr.cpp" />
     <ClCompile Include="Oxford\OTSSEMOxford.cpp" />
     <ClCompile Include="Oxford\OTSSEMOxford.cpp" />
     <ClCompile Include="Simulate\OTSSemSim.cpp" />
     <ClCompile Include="Simulate\OTSSemSim.cpp" />
-    <ClCompile Include="Oxford\OxfordWrapper\OxfordController.cpp" />
     <ClCompile Include="Oxford\OxfordWrapper\OxfordControllerWrapper.cpp" />
     <ClCompile Include="Oxford\OxfordWrapper\OxfordControllerWrapper.cpp" />
     <ClCompile Include="SEMCommonConst.cpp" />
     <ClCompile Include="SEMCommonConst.cpp" />
     <ClCompile Include="OTSControl.cpp" />
     <ClCompile Include="OTSControl.cpp" />
@@ -380,7 +379,6 @@
     <ClInclude Include="Simulate\OTSSemSim.h" />
     <ClInclude Include="Simulate\OTSSemSim.h" />
     <ClInclude Include="OTSSingleton.h" />
     <ClInclude Include="OTSSingleton.h" />
     <ClInclude Include="Oxford\OxfordImplConst.h" />
     <ClInclude Include="Oxford\OxfordImplConst.h" />
-    <ClInclude Include="Oxford\OxfordWrapper\OxfordController.h" />
     <ClInclude Include="Oxford\OxfordWrapper\OxfordControllerWrapper.h" />
     <ClInclude Include="Oxford\OxfordWrapper\OxfordControllerWrapper.h" />
     <ClInclude Include="SEMCommonConst.h" />
     <ClInclude Include="SEMCommonConst.h" />
     <ClInclude Include="Bruker\OTSBrukerClientDll.h" />
     <ClInclude Include="Bruker\OTSBrukerClientDll.h" />

+ 0 - 6
OTSCPP/OTSControl/OTSControl.vcxproj.filters

@@ -87,9 +87,6 @@
     <ClCompile Include="Simulate\OTSEDSSim.cpp">
     <ClCompile Include="Simulate\OTSEDSSim.cpp">
       <Filter>Source Files</Filter>
       <Filter>Source Files</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="Oxford\OxfordWrapper\OxfordController.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="OTSControl.h">
     <ClInclude Include="OTSControl.h">
@@ -176,9 +173,6 @@
     <ClInclude Include="Simulate\OTSEDSSim.h">
     <ClInclude Include="Simulate\OTSEDSSim.h">
       <Filter>Header Files</Filter>
       <Filter>Header Files</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="Oxford\OxfordWrapper\OxfordController.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <None Include="res\OTSControl.rc2">
     <None Include="res\OTSControl.rc2">

+ 250 - 111
OTSCPP/OTSControl/Oxford/OTSOxfordImpl.cpp

@@ -1,6 +1,6 @@
 #include "stdafx.h"
 #include "stdafx.h"
 #include "OTSOxfordImpl.h"
 #include "OTSOxfordImpl.h"
-#include "../OTSControl/ControllerHelper.h"
+#include "ControllerHelper.h"
 #include "COTSUtilityDllFunExport.h"
 #include "COTSUtilityDllFunExport.h"
 #include "OxfordImplConst.h"
 #include "OxfordImplConst.h"
 
 
@@ -8,6 +8,7 @@
 #ifdef _DEBUG
 #ifdef _DEBUG
 #define new DEBUG_NEW
 #define new DEBUG_NEW
 #endif
 #endif
+#include <Oxford/OxfordWrapper/OxfordControllerWrapper.h>
 
 
  namespace OTSController
  namespace OTSController
 {
 {
@@ -16,38 +17,49 @@
     OxfordImpl::OxfordImpl(void)
     OxfordImpl::OxfordImpl(void)
         : m_bInit(false)
         : m_bInit(false)
     {
     {
-		
+		if (ManagedGlobals::oxfordController == nullptr)
+		{
+			ManagedGlobals::oxfordController = gcnew OxfordControllerWrapper();
+		}
     }
     }
 
 
     OxfordImpl::~OxfordImpl(void)
     OxfordImpl::~OxfordImpl(void)
     {
     {
 		CloseClient();
 		CloseClient();
-		m_oxfordPtr.reset();
+		
     }
     }
-	// Close Client
-// return true if success
+
 	void OxfordImpl::CloseClient(void)
 	void OxfordImpl::CloseClient(void)
 	{
 	{
 
 
-		m_oxfordPtr->CloseClient();
+		ManagedGlobals::oxfordController->CloseClient();
 		
 		
 	}
 	}
 
 
     bool OxfordImpl::Connect()
     bool OxfordImpl::Connect()
     {
     {
 
 
-		if (!m_oxfordPtr)
-        {
-            m_oxfordPtr.reset(new OxfordController);
-
-
-        }
 		if (!m_bInit)
 		if (!m_bInit)
 		{
 		{
-			m_bInit = m_oxfordPtr->CreateController();
+			OxfordWrapperErrorCode r;
+			
+			if (!ManagedGlobals::oxfordController->Init())
+			{
+				 r=OxfordWrapperErrorCode::CONTROLLER_INIT_FAILED;
+				 return false;
+			}
+
+			if (!ManagedGlobals::oxfordController->IsConnected())
+			{
+				r=OxfordWrapperErrorCode::CONTROLLER_NOT_CONNECTED;
+				return false;
+			}
+
+			r=OxfordWrapperErrorCode::SUCCEED;
+			m_bInit = true;
 		}
 		}
           
           
-
+		
 
 
         return m_bInit;
         return m_bInit;
     }
     }
@@ -65,19 +77,37 @@
 
 
     bool OxfordImpl::IsConnected()
     bool OxfordImpl::IsConnected()
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return (bool)m_oxfordPtr->IsConnected();
+
+
+			if (!ManagedGlobals::oxfordController->IsConnected())
+			{
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
+
+
+
     }
     }
 
 
     bool OxfordImpl::GetPositionXY(double& a_dPosX, double& a_dPosY)
     bool OxfordImpl::GetPositionXY(double& a_dPosX, double& a_dPosY)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->GetPositionXY(a_dPosX, a_dPosY);
+			
+
+			if (!ManagedGlobals::oxfordController->GetPositionXY(a_dPosX, a_dPosY))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("GetPositionXY command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -85,9 +115,17 @@
 
 
     bool OxfordImpl::SetPositionXY(double a_dPosX, double a_dPosY)
     bool OxfordImpl::SetPositionXY(double a_dPosX, double a_dPosY)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->SetPositionXY(a_dPosX, a_dPosY);
+			
+
+			if (!ManagedGlobals::oxfordController->SetPositionXY(a_dPosX, a_dPosY))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("SetPositionXY command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -95,9 +133,16 @@
 
 
     bool OxfordImpl::GetWorkingDistance(double& a_dWorkingDistance)
     bool OxfordImpl::GetWorkingDistance(double& a_dWorkingDistance)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if ( m_bInit)
         {
         {
-            return m_oxfordPtr->GetWorkingDistance(a_dWorkingDistance);
+			
+			if (!ManagedGlobals::oxfordController->GetWorkingDistance(a_dWorkingDistance))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("GetWorkingDistance command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -105,9 +150,17 @@
 
 
     bool OxfordImpl::SetWorkingDistance(double a_dWorkingDistance)
     bool OxfordImpl::SetWorkingDistance(double a_dWorkingDistance)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->SetWorkingDistance(a_dWorkingDistance);
+			
+
+			if (!ManagedGlobals::oxfordController->SetWorkingDistance(a_dWorkingDistance))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("SetWorkingDistance command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -115,9 +168,17 @@
 
 
     bool OxfordImpl::GetMagnification(double& a_dMagnification)
     bool OxfordImpl::GetMagnification(double& a_dMagnification)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->GetMagnification(a_dMagnification);
+		
+
+			if (!ManagedGlobals::oxfordController->GetMagnification(a_dMagnification))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("GetMagnification command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -125,9 +186,15 @@
 
 
     bool OxfordImpl::SetMagnification(double a_dMagnification)
     bool OxfordImpl::SetMagnification(double a_dMagnification)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->SetMagnification(a_dMagnification);
+			if (!ManagedGlobals::oxfordController->SetMagnification(a_dMagnification))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("SetMagnification command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -135,9 +202,15 @@
 
 
     bool OxfordImpl::GetHighVoltage(double& a_dHighVoltage)
     bool OxfordImpl::GetHighVoltage(double& a_dHighVoltage)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if ( m_bInit)
         {
         {
-            return m_oxfordPtr->GetHighVoltage(a_dHighVoltage);
+			if (!ManagedGlobals::oxfordController->GetHighVoltage(a_dHighVoltage))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("GetHighVoltage command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -145,9 +218,15 @@
 
 
     bool OxfordImpl::SetHighVoltage(double a_dHighVoltage)
     bool OxfordImpl::SetHighVoltage(double a_dHighVoltage)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->SetHighVoltage(a_dHighVoltage);
+			if (!ManagedGlobals::oxfordController->SetHighVoltage(a_dHighVoltage))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("SetHighVoltage command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -155,9 +234,15 @@
 
 
     bool OxfordImpl::GetBeamOn(bool& a_bBeamOn)
     bool OxfordImpl::GetBeamOn(bool& a_bBeamOn)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->GetBeamOn(a_bBeamOn);
+			if (!ManagedGlobals::oxfordController->GetBeamOn(a_bBeamOn))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("GetBeamOn command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -165,9 +250,15 @@
 
 
     bool OxfordImpl::SetBeamOn(bool a_bBeamOn)
     bool OxfordImpl::SetBeamOn(bool a_bBeamOn)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if ( m_bInit)
         {
         {
-            return m_oxfordPtr->SetBeamOn(a_bBeamOn);
+			if (!ManagedGlobals::oxfordController->SetBeamOn(a_bBeamOn))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("SetBeamOn command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -175,9 +266,15 @@
 
 
     bool OxfordImpl::GetBeamBlank(bool& a_bBeamBlank)
     bool OxfordImpl::GetBeamBlank(bool& a_bBeamBlank)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if ( m_bInit)
         {
         {
-            return m_oxfordPtr->GetBeamBlank(a_bBeamBlank);
+			if (!ManagedGlobals::oxfordController->GetBeamBlank(a_bBeamBlank))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("GetBeamBlank command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -185,9 +282,15 @@
 
 
     bool OxfordImpl::SetBeamBlank(bool a_bBeamBlank)
     bool OxfordImpl::SetBeamBlank(bool a_bBeamBlank)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->SetBeamBlank(a_bBeamBlank);
+			if (!ManagedGlobals::oxfordController->SetBeamBlank(a_bBeamBlank))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("SetBeamBlank command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -195,9 +298,15 @@
 
 
     bool OxfordImpl::GetExternal(bool& a_bExternal)
     bool OxfordImpl::GetExternal(bool& a_bExternal)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->GetExternal(a_bExternal);
+			if (!ManagedGlobals::oxfordController->GetExternalScan(a_bExternal))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("GetExternal command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -205,9 +314,15 @@
 
 
     bool OxfordImpl::SetExternal(bool a_bExternal)
     bool OxfordImpl::SetExternal(bool a_bExternal)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if ( m_bInit)
         {
         {
-            return m_oxfordPtr->SetExternal(a_bExternal);
+			if (!ManagedGlobals::oxfordController->SetExternalScan(a_bExternal))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("SetExternal command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -215,9 +330,15 @@
 
 
     bool OxfordImpl::CollectXrayData(const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize)
     bool OxfordImpl::CollectXrayData(const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->CollectXrayData(a_nAcTime, a_pnCounts, a_nBufferSize);
+			if (!ManagedGlobals::oxfordController->CollectXrayPoint(a_nAcTime, a_pnCounts, a_nBufferSize))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayData command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -225,9 +346,16 @@
 
 
     bool OxfordImpl::CollectXrayDataAtPos(const double a_dPosX, const double a_dPosY, const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize)
     bool OxfordImpl::CollectXrayDataAtPos(const double a_dPosX, const double a_dPosY, const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->CollectXrayDataAtPos(a_dPosX, a_dPosY, a_nAcTime, a_pnCounts, a_nBufferSize);
+
+			if (!ManagedGlobals::oxfordController->CollectXrayPoint(a_dPosX, a_dPosY, a_nAcTime, a_pnCounts, a_nBufferSize))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayDataAtPos command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -239,9 +367,15 @@
 
 
     bool OxfordImpl::SetBeamPosition(const double a_dPosX, const double a_dPosY)
     bool OxfordImpl::SetBeamPosition(const double a_dPosX, const double a_dPosY)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if ( m_bInit)
         {
         {
-            return m_oxfordPtr->SetBeamPosition(a_dPosX, a_dPosY);
+			if (!ManagedGlobals::oxfordController->SetBeamPosition(a_dPosX, a_dPosY))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("SetBeamPosition command failed."));
+				return false;
+			}
+
+			return true;
         }
         }
 
 
         return false;
         return false;
@@ -249,9 +383,15 @@
 
 
     bool OxfordImpl::SetScanSpeed(const long a_nMilliseconds)
     bool OxfordImpl::SetScanSpeed(const long a_nMilliseconds)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->SetScanSpeed(a_nMilliseconds);
+			if (!ManagedGlobals::oxfordController->SetScanSpeed(a_nMilliseconds))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("SetScanSpeed command failed."));
+				return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
+			}
+
+			return (int)OxfordWrapperErrorCode::SUCCEED;
         }
         }
 
 
         return false;
         return false;
@@ -259,9 +399,15 @@
 
 
     bool OxfordImpl::GetImageSize(long& a_nWidth, long& a_nHeight)
     bool OxfordImpl::GetImageSize(long& a_nWidth, long& a_nHeight)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if ( m_bInit)
         {
         {
-            return m_oxfordPtr->GetImageSize(a_nWidth, a_nHeight);
+			if (!ManagedGlobals::oxfordController->GetImageSize(a_nWidth, a_nHeight))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("GetImageSize command failed."));
+				return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
+			}
+
+			return (int)OxfordWrapperErrorCode::SUCCEED;
         }
         }
 
 
         return false;
         return false;
@@ -269,9 +415,16 @@
 
 
     bool OxfordImpl::SetImageSize(const long a_nWidth, const long a_nHeight)
     bool OxfordImpl::SetImageSize(const long a_nWidth, const long a_nHeight)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-            return m_oxfordPtr->SetImageSize(a_nWidth, a_nHeight);
+
+			if (!ManagedGlobals::oxfordController->SetImageSize(a_nWidth, a_nHeight))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("SetImageSize command failed."));
+				return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
+			}
+
+			return (int)OxfordWrapperErrorCode::SUCCEED;
         }
         }
 
 
         return false;
         return false;
@@ -279,10 +432,15 @@
 
 
     bool OxfordImpl::CollectImage(BYTE* a_pImageBits)
     bool OxfordImpl::CollectImage(BYTE* a_pImageBits)
     {
     {
-        if (m_oxfordPtr && m_bInit)
+        if (m_bInit)
         {
         {
-			int i= m_oxfordPtr->CollectImage(a_pImageBits);
-            return i== (int)OxfordWrapperErrorCode::SUCCEED;
+			if (!ManagedGlobals::oxfordController->CollectImage(a_pImageBits))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("CollectImage command failed."));
+				return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
+			}
+
+			return (int)OxfordWrapperErrorCode::SUCCEED;
         }
         }
 
 
         return false;
         return false;
@@ -290,9 +448,15 @@
 
 
 	bool OxfordImpl::QuantifySpectrum(unsigned char* cResult)
 	bool OxfordImpl::QuantifySpectrum(unsigned char* cResult)
 	{
 	{
-		if (m_oxfordPtr && m_bInit)
+		if ( m_bInit)
 		{
 		{
-			return m_oxfordPtr->QuantifySpectrum(cResult);
+			if (!ManagedGlobals::oxfordController->QuantifySpectrum(cResult))
+			{
+				LogErrorTrace(__FILE__, __LINE__, _T("CollectImage command failed."));
+				return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
+			}
+
+			return (int)OxfordWrapperErrorCode::SUCCEED;
 		}
 		}
 
 
 		return false;
 		return false;
@@ -301,17 +465,6 @@
 
 
 	BOOL OxfordImpl::GetXRayByPoints(CPosXraysList& a_listXrayPois, DWORD a_nACTimeMS)
 	BOOL OxfordImpl::GetXRayByPoints(CPosXraysList& a_listXrayPois, DWORD a_nACTimeMS)
 	{
 	{
-		try
-		{
-			// oxford dll handle check
-			ASSERT(m_oxfordPtr);
-			if (!m_oxfordPtr)
-			{
-				// error, invalid m_oxfordDll
-				LogErrorTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: invalid m_oxfordDll."));
-				return FALSE;
-			}
-
 			// do nothing if points list is empty
 			// do nothing if points list is empty
 			if (a_listXrayPois.empty())
 			if (a_listXrayPois.empty())
 			{
 			{
@@ -322,7 +475,6 @@
 
 
 			// create array of BrukerSegment
 			// create array of BrukerSegment
 			long nCollectCount = (long)a_listXrayPois.size();
 			long nCollectCount = (long)a_listXrayPois.size();
-			//boost::scoped_array<OxfordXrayData> segmentArray(new OxfordXrayData[nCollectCount]);
 			OxfordXrayData* segmentArray(new OxfordXrayData[nCollectCount]);
 			OxfordXrayData* segmentArray(new OxfordXrayData[nCollectCount]);
 			
 			
 			for (int i = 0; i < nCollectCount; ++i)
 			for (int i = 0; i < nCollectCount; ++i)
@@ -331,15 +483,16 @@
 				segmentArray[i].m_nPosX = poi.x;
 				segmentArray[i].m_nPosX = poi.x;
 				segmentArray[i].m_nPosY = poi.y;
 				segmentArray[i].m_nPosY = poi.y;
 			}
 			}
-			
-			
 
 
-			if (!m_oxfordPtr->CollectXrayList(a_nACTimeMS, segmentArray, nCollectCount, GENERALXRAYCHANNELS))
+			if (!ManagedGlobals::oxfordController->CollectXrayPoints(a_nACTimeMS, segmentArray, nCollectCount, GENERALXRAYCHANNELS))
 			{
 			{
-				LogTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: poits list is empty."));
-				return false;
+				LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayList command failed."));
+				return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
 			}
 			}
 
 
+
+
+
 			// get the specs for a_vXPoints
 			// get the specs for a_vXPoints
 			for (int i = 0; i < nCollectCount; ++i)
 			for (int i = 0; i < nCollectCount; ++i)
 			{
 			{
@@ -368,11 +521,14 @@
 					// try to redo x-ray collection at the position
 					// try to redo x-ray collection at the position
 					static DWORD nChannelData[GENERALXRAYCHANNELS];
 					static DWORD nChannelData[GENERALXRAYCHANNELS];
 					memset(nChannelData, 0, sizeof(DWORD) * GENERALXRAYCHANNELS);
 					memset(nChannelData, 0, sizeof(DWORD) * GENERALXRAYCHANNELS);
-					if (!m_oxfordPtr->CollectXrayData(a_nACTimeMS, (long*)nChannelData, GENERALXRAYCHANNELS))
+
+				
+
+						if (!ManagedGlobals::oxfordController->CollectXrayPoint(a_nACTimeMS, (long*)nChannelData, GENERALXRAYCHANNELS))
 					{
 					{
 						// error
 						// error
 						CString s;
 						CString s;
-						s.Format(_T("Call CollectOneXRayPoint failed: index = %d(x:%d, y:%d))"), i, poi.x, poi.y);
+						s.Format(_T("Call CollectXRayPoint failed: index = %d(x:%d, y:%d))"), i, poi.x, poi.y);
 						LogErrorTrace(__FILE__,__LINE__,s);
 						LogErrorTrace(__FILE__,__LINE__,s);
 							
 							
 
 
@@ -402,11 +558,7 @@
 			// ok return TRUE
 			// ok return TRUE
 			return TRUE;
 			return TRUE;
 
 
-		}
-		catch (const std::exception e)
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: exception.")+ CString(e.what()));
-		}
+
 
 
 		// error, return false
 		// error, return false
 		return FALSE;
 		return FALSE;
@@ -415,16 +567,8 @@
 
 
 	BOOL OxfordImpl::GetXRayByFeatures(CPosXraysList&a_listXrayPois, std::vector<BrukerFeature>& a_vFeatures, DWORD a_nXRayAQTime)
 	BOOL OxfordImpl::GetXRayByFeatures(CPosXraysList&a_listXrayPois, std::vector<BrukerFeature>& a_vFeatures, DWORD a_nXRayAQTime)
 	{
 	{
-		try
-		{
-			// oxford dll handle check
-			ASSERT(m_oxfordPtr);
-			if (!m_oxfordPtr)
-			{
-				// error, invalid m_oxfordDll
-				LogErrorTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: invalid m_oxfordDll."));
-				return FALSE;
-			}
+		
+
 
 
 			// do nothing if points list is empty
 			// do nothing if points list is empty
 			if (a_listXrayPois.empty())
 			if (a_listXrayPois.empty())
@@ -480,12 +624,14 @@
 			int a_nACTimeMS = a_nXRayAQTime / nTotalNum;
 			int a_nACTimeMS = a_nXRayAQTime / nTotalNum;
 			
 			
 
 
-			if (!m_oxfordPtr->CollectXrayArea(a_nXRayAQTime, features, nCollectCount, GENERALXRAYCHANNELS))
+
+			if (!ManagedGlobals::oxfordController->CollectXrayArea(a_nXRayAQTime, features, nCollectCount, GENERALXRAYCHANNELS))
 			{
 			{
-				LogTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: poits list is empty."));
-				
+				LogTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayArea failed"));
 				return false;
 				return false;
-			}	
+			}
+
+			
 
 
 			// get the specs for a_vXPoints
 			// get the specs for a_vXPoints
 			for (int i = 0; i < nCollectCount; ++i)
 			for (int i = 0; i < nCollectCount; ++i)
@@ -516,13 +662,15 @@
 					// try to redo x-ray collection at the position
 					// try to redo x-ray collection at the position
 					static DWORD nChannelData[GENERALXRAYCHANNELS];
 					static DWORD nChannelData[GENERALXRAYCHANNELS];
 					memset(nChannelData, 0, sizeof(DWORD) * GENERALXRAYCHANNELS);
 					memset(nChannelData, 0, sizeof(DWORD) * GENERALXRAYCHANNELS);
-					if (!m_oxfordPtr->CollectXrayData(a_nXRayAQTime, (long*)nChannelData, GENERALXRAYCHANNELS))
-					{
 
 
 
 
+					if (!ManagedGlobals::oxfordController->CollectXrayPoint(a_nXRayAQTime, (long*)nChannelData, GENERALXRAYCHANNELS))
+					{
+						LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayData command failed."));
 						return false;
 						return false;
 					}
 					}
 
 
+
 					// set spectrum with new spectrum
 					// set spectrum with new spectrum
 					a_listXrayPois[i]->SetXrayData(nChannelData);
 					a_listXrayPois[i]->SetXrayData(nChannelData);
 
 
@@ -541,16 +689,7 @@
 				}
 				}
 			}
 			}
 			delete features;
 			delete features;
-			// ok return TRUE
 			return TRUE;
 			return TRUE;
 
 
-		}
-		catch (const std::exception&)
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("COTSOxfordImpl::GetXRayByPoints: exception."));
-		}
-
-		// error, return false
-		return FALSE;
 	}
 	}
-} // namespace Controller
+}

+ 1 - 6
OTSCPP/OTSControl/Oxford/OTSOxfordImpl.h

@@ -1,16 +1,13 @@
 #pragma once
 #pragma once
 #include "..\OTSControl\OTSSingleton.h"
 #include "..\OTSControl\OTSSingleton.h"
 
 
-// Load ClientDll 
 #include "..\OTSControl\Oxford\OxfordImplConst.h"
 #include "..\OTSControl\Oxford\OxfordImplConst.h"
 #include "otsdataconst.h"
 #include "otsdataconst.h"
 #include "Element.h"
 #include "Element.h"
 #include "BSEImg.h"
 #include "BSEImg.h"
 #include "PosXray.h"
 #include "PosXray.h"
 #include "OTSFeature.h"
 #include "OTSFeature.h"
-//#include "boost\type_traits\is_floating_point.hpp"
 #include "boost\noncopyable.hpp"
 #include "boost\noncopyable.hpp"
-#include "OxfordWrapper\OxfordController.h"
 #include <Bruker\OTSBrukerImpl_const.h>
 #include <Bruker\OTSBrukerImpl_const.h>
 
 
  namespace OTSController
  namespace OTSController
@@ -82,11 +79,9 @@
 
 
     protected:
     protected:
         void CloseClient(void);//there's no need to call from out ,the single instance destruction method will call it automatically.
         void CloseClient(void);//there's no need to call from out ,the single instance destruction method will call it automatically.
-        std::shared_ptr<OxfordController> m_oxfordPtr;
         bool m_bInit;							// initialize flag
         bool m_bInit;							// initialize flag
 
 
 		BOOL m_bDoQuantification;                           // if do x-ray quantification
 		BOOL m_bDoQuantification;                           // if do x-ray quantification
     };
     };
-	//typedef boost::scoped_array<OxfordXrayData> featureData;
 
 
-} // namespace Controller
+} 

+ 0 - 437
OTSCPP/OTSControl/Oxford/OxfordWrapper/OxfordController.cpp

@@ -1,437 +0,0 @@
-#include "stdafx.h"
-
-#include "OxfordController.h"
-#include "OxfordControllerWrapper.h"
-
-
-using namespace OTSController;
- int  OxfordController::CreateController()
-{
-	
-	if (ManagedGlobals::oxfordController == nullptr)
-	{
-		ManagedGlobals::oxfordController = gcnew OxfordControllerWrapper();
-	}
-
-
-
-	if (!ManagedGlobals::oxfordController->Init())
-	{
-		return (int)OxfordWrapperErrorCode::CONTROLLER_INIT_FAILED;
-	}
-
-	if (!ManagedGlobals::oxfordController->IsConnected())
-	{
-		return (int)OxfordWrapperErrorCode::CONTROLLER_NOT_CONNECTED;
-	}
-
-	return (int)OxfordWrapperErrorCode::SUCCEED;
-}
-
-	 int  OxfordController::IsConnected()
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->IsConnected())
-		{
-			return (int)OxfordWrapperErrorCode::CONTROLLER_NOT_CONNECTED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 void  OxfordController::CloseClient()
-	{
-		ManagedGlobals::oxfordController->CloseClient();
-	}
-
-	 int  OxfordController::GetPositionXY(double& a_dPosX, double& a_dPosY)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->GetPositionXY(a_dPosX, a_dPosY))
-		{
-			LogErrorTrace(__FILE__,__LINE__,_T("GetPositionXY command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::SetPositionXY(double a_dPosX, double a_dPosY)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->SetPositionXY(a_dPosX, a_dPosY))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("SetPositionXY command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::GetWorkingDistance(double& a_dWorkingDistance)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->GetWorkingDistance(a_dWorkingDistance))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("GetWorkingDistance command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::SetWorkingDistance(double a_dWorkingDistance)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->SetWorkingDistance(a_dWorkingDistance))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("SetWorkingDistance command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::GetMagnification(double& a_dMagnification)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->GetMagnification(a_dMagnification))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("GetMagnification command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::SetMagnification(double a_dMagnification)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->SetMagnification(a_dMagnification))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("SetMagnification command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::GetHighVoltage(double& a_dHighVoltage)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->GetHighVoltage(a_dHighVoltage))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("GetHighVoltage command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::SetHighVoltage(double a_dHighVoltage)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->SetHighVoltage(a_dHighVoltage))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("SetHighVoltage command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::GetBeamOn(bool& a_bBeamOn)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->GetBeamOn(a_bBeamOn))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("GetBeamOn command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::SetBeamOn(bool a_bBeamOn)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->SetBeamOn(a_bBeamOn))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("SetBeamOn command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::GetBeamBlank(bool& a_bBeamBlank)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->GetBeamBlank(a_bBeamBlank))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("GetBeamBlank command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::SetBeamBlank(bool a_bBeamBlank)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->SetBeamBlank(a_bBeamBlank))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("SetBeamBlank command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::GetExternal(bool& a_bExternal)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->GetExternalScan(a_bExternal))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("GetExternal command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::SetExternal(bool a_bExternal)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->SetExternalScan(a_bExternal))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("SetExternal command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::SetBeamPosition(const double a_dPosX, const double a_dPosY)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->SetBeamPosition(a_dPosX, a_dPosY))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("SetBeamPosition command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::CollectXrayData(const long a_nAcTime, long* a_pnCounts, unsigned long a_nBufferSize)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->CollectXrayPoint(a_nAcTime, a_pnCounts, a_nBufferSize))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayData command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::CollectXrayDataAtPos(const double a_dPosX, const double a_dPosY, const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->CollectXrayPoint(a_dPosX, a_dPosY, a_nAcTime, a_pnCounts, a_nBufferSize))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayDataAtPos command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::CollectXrayList(const long a_nAcTime, OxfordXrayData* a_pXrayDataList, const long a_nXrayDataCount, DWORD a_nBufferSize)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->CollectXrayPoints(a_nAcTime, a_pXrayDataList, a_nXrayDataCount, a_nBufferSize))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayList command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::CollectXrayArea(const long a_nAcTime, OxfordXrayData* a_pXrayDataList, const long a_nXrayDataCount, DWORD a_nBufferSize)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->CollectXrayArea(a_nAcTime, a_pXrayDataList, a_nXrayDataCount, a_nBufferSize))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("CollectXrayList command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::SetScanSpeed(const long a_nMilliseconds)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->SetScanSpeed(a_nMilliseconds))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("SetScanSpeed command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::GetImageSize(long& a_nWidth, long& a_nHeight)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->GetImageSize(a_nWidth, a_nHeight))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("GetImageSize command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::SetImageSize(const long a_nWidth, const long a_nHeight)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->SetImageSize(a_nWidth, a_nHeight))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("SetImageSize command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::CollectImage(unsigned char* a_pImageBits)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->CollectImage(a_pImageBits))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("CollectImage command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-	 int  OxfordController::QuantifySpectrum(unsigned char* cResult)
-	{
-		if (ManagedGlobals::oxfordController == nullptr)
-		{
-			return (int)OxfordWrapperErrorCode::NO_VALID_CONTROLLER;
-		}
-
-		if (!ManagedGlobals::oxfordController->QuantifySpectrum(cResult))
-		{
-			LogErrorTrace(__FILE__, __LINE__, _T("CollectImage command failed."));
-			return (int)OxfordWrapperErrorCode::COMMAND_FAILED;
-		}
-
-		return (int)OxfordWrapperErrorCode::SUCCEED;
-	}
-
-
-
-//}

+ 0 - 60
OTSCPP/OTSControl/Oxford/OxfordWrapper/OxfordController.h

@@ -1,60 +0,0 @@
-
-#pragma once
-
-#include "../OTSControl/Oxford/OxfordImplConst.h"
-#include <wtypes.h>
-using namespace OTSController;
-
- class OxfordController
-{
-public:
-	int  CreateController();
-
-	int  IsConnected();
-
-	 void  CloseClient();
-
-	int  GetPositionXY(double& a_dPosX, double& a_dPosY);
-
-	int  SetPositionXY(double a_dPosX, double a_dPosY);
-
-	int  GetWorkingDistance(double& a_dWorkingDistance);
-
-	int  SetWorkingDistance(double a_dWorkingDistance);
-
-	int  GetMagnification(double& a_dMagnification);
-
-	int  SetMagnification(double a_dMagnification);
-
-	int  GetHighVoltage(double& a_dHighVoltage);
-
-	int  SetHighVoltage(double a_dHighVoltage);
-
-	int  GetBeamOn(bool& a_bBeamOn);
-
-	int  SetBeamOn(bool a_bBeamOn);
-
-	int  GetBeamBlank(bool& a_bBeamBlank);
-
-	int  SetBeamBlank(bool a_bBeamBlank);
-
-	int  GetExternal(bool& a_bExternal);
-
-	int  SetExternal(bool a_bExternal);
-
-	int  SetBeamPosition(const double a_dPosX, const double a_dPosY);
-	int  CollectXrayData(const long a_nAcTime, long* a_pnCounts, unsigned long a_nBufferSize);
-	int  CollectXrayDataAtPos(const double a_dPosX, const double a_dPosY, const long a_nAcTime, long* a_pnCounts, DWORD a_nBufferSize);
-
-	int  CollectXrayList(const long a_nAcTime, OxfordXrayData* a_pXrayDataList, const long a_nXrayDataCount, DWORD a_nBufferSize);
-	int  CollectXrayArea(const long a_nAcTime, OxfordXrayData* a_pXrayDataList, const long a_nXrayDataCount, DWORD a_nBufferSize);
-
-	int  SetScanSpeed(const long a_nMilliseconds);
-	int  GetImageSize(long& a_nWidth, long& a_nHeight);
-	int  SetImageSize(const long a_nWidth, const long a_nHeight);
-	 int  CollectImage(unsigned char* a_pImageBits);
-
-	 int  QuantifySpectrum(unsigned char* cResult);
-private :
-	
-};

+ 9 - 59
OTSCPP/OTSControl/Oxford/OxfordWrapper/OxfordControllerWrapper.cpp

@@ -523,22 +523,7 @@ bool OxfordControllerWrapper::SetPositionXY(const double a_dPosX, const double a
 
 
 
 
 		Application::DoEvents();
 		Application::DoEvents();
-		/*Thread::Sleep(g_nOxfordControllerEventSleepTimerInt);
-
-
-		long nCollectedTimeLimit = g_nStageTimeOutMilliSeconds;
-		nCollectedTime += g_nOxfordControllerEventSleepTimerInt;
-		if (nCollectedTime > nCollectedTimeLimit)
-		{
-
-
-			_oxfordControllerData.m_nState = OxfordControllerState::FAILED;
-
-
-			m_endControllerEvent->Reset();
-
-			break;
-		}*/
+		
 	}
 	}
 
 
 	if (_oxfordControllerData.m_nState == OxfordControllerState::SUCCEEDED)
 	if (_oxfordControllerData.m_nState == OxfordControllerState::SUCCEEDED)
@@ -552,43 +537,7 @@ bool OxfordControllerWrapper::SetPositionXY(const double a_dPosX, const double a
 	}
 	}
 
 
 
 
-	//---------------------------------------------------new method
-
-	//_oxfordControllerData.m_nCommand = OxfordControllerCommand::SET_POSITIONXY;
-
-	//_oxfordControllerData.m_dPositionX = a_dPosX;
-	//_oxfordControllerData.m_dPositionY = a_dPosY;
-	//m_bIsStageUpdated = false;
-
-	//if (SetPositionXYToController(_oxfordControllerData.m_dPositionX, _oxfordControllerData.m_dPositionY))
-	//{
-	//	_oxfordControllerData.m_nState = OxfordControllerState::SUCCEEDED;
-	//}
-	//else
-	//{
-	//	_oxfordControllerData.m_nState = OxfordControllerState::FAILED;
-	//}
-	//double waitTime=0;
-	//while (!m_bIsStageUpdated)//m_bIsStageUpdated will be set by the callback event.
-	//{
-	//	Sleep(100);
-	//	waitTime += 0.1;
-	//	if (waitTime > 10)//prevent the m_bIsStageUpdated won't be set ,we will wait only 10s.
-	//	{
-	//		break;
-	//	}
-	//}
-	//
-
-	//if (_oxfordControllerData.m_nState == OxfordControllerState::SUCCEEDED)
-	//{
-	//	return true;
-	//}
-	//else
-	//{
-
-	//	return false;
-	//}
+	
 
 
 	
 	
 }
 }
@@ -1943,7 +1892,10 @@ IMicroscopeController^ OxfordControllerWrapper::CreateMicroscopeController()
 
 
 	if (_microscopeController == nullptr)
 	if (_microscopeController == nullptr)
 	{
 	{
-		return nullptr;
+		CString sErrorMessage ="";
+		AfxMessageBox(_T("oxford eds cann't work,you can change work mode to offline in the sysMgrApp to run offline mode!\nerror:") + sErrorMessage);
+		LogErrorTrace(__FILE__, __LINE__, sErrorMessage);
+		exit(0);
 	}
 	}
 
 
 	_microscopeController->ColumnChange += gcnew EventHandler<OINA::Extender::MicroscopeControl::ColumnEventArgs^>(this, &OxfordControllerWrapper::OnMicroscopeColumnUpdated);
 	_microscopeController->ColumnChange += gcnew EventHandler<OINA::Extender::MicroscopeControl::ColumnEventArgs^>(this, &OxfordControllerWrapper::OnMicroscopeColumnUpdated);
@@ -1951,20 +1903,18 @@ IMicroscopeController^ OxfordControllerWrapper::CreateMicroscopeController()
 
 
 	m_bIsStageUpdated = false;
 	m_bIsStageUpdated = false;
 
 
-	/*auto nStart = GetTickCount64();
+	auto nStart = GetTickCount64();
 	auto nEnd = nStart;
 	auto nEnd = nStart;
 	do
 	do
 	{
 	{
 		if (IsMicroscopeColumnConnected()
 		if (IsMicroscopeColumnConnected()
-			&& IsMicroscopeStageConnected()
-			&& m_bIsStageUpdated)
+			&& IsMicroscopeStageConnected())
 		{
 		{
 			break;
 			break;
 		}
 		}
 
 
 		nEnd = GetTickCount64();
 		nEnd = GetTickCount64();
-	} while (nEnd >= nStart && nEnd <= (nStart + g_nMicrocopeConnectTimeOutMilliSeconds));*/
-	Sleep(g_nMicrocopeConnectTimeOutMilliSeconds);
+	} while (nEnd >= nStart && nEnd <= (nStart + g_nMicrocopeConnectTimeOutMilliSeconds));
 	return _microscopeController;
 	return _microscopeController;
 }
 }
 
 

+ 1 - 1
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CMeasure.cs

@@ -165,7 +165,7 @@ namespace OTSModelSharp
             MsrMsg.STMThreadStu.csMsrEndTime = timeEnd.ToString("yyyy-MM-dd HH:mm:ss");
             MsrMsg.STMThreadStu.csMsrEndTime = timeEnd.ToString("yyyy-MM-dd HH:mm:ss");
             ProgressEvent(MsrMsg);
             ProgressEvent(MsrMsg);
             //disconnect the semcontroller when we exit this task.
             //disconnect the semcontroller when we exit this task.
-            m_SemController.DisConnect();
+            //m_SemController.DisConnect();
         }
         }
         void ThreadOverWithoutDisConnect()
         void ThreadOverWithoutDisConnect()
         {
         {

+ 0 - 1
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -902,7 +902,6 @@ namespace OTSModelSharp
                     pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
                     pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
 
 
                     ST_MSTMsg MsgFieldStart=new ST_MSTMsg();
                     ST_MSTMsg MsgFieldStart=new ST_MSTMsg();
-                    //memset(&MsgFieldStart, 0, sizeof(ST_MSTMsg));
                     MsgFieldStart.iMsgType = ENUM_MSG_TYPE.MSAMPLERESULT;
                     MsgFieldStart.iMsgType = ENUM_MSG_TYPE.MSAMPLERESULT;
                     MsgFieldStart.STMSampleRetData.iRetDataType = MSAMPLE_RET.START_MSR_FIELD;
                     MsgFieldStart.STMSampleRetData.iRetDataType = MSAMPLE_RET.START_MSR_FIELD;
                     MsgFieldStart.STMSampleRetData.SMsrField.FieldPos = poiFieldCentre;
                     MsgFieldStart.STMSampleRetData.SMsrField.FieldPos = poiFieldCentre;

+ 1 - 5
OTSSysMgrApp/ControllerSettingForm.cs

@@ -24,11 +24,7 @@ namespace OTSSysMgrApp
         #region 全部变量声明
         #region 全部变量声明
         //连接状态
         //连接状态
         bool ConnectionState = false;
         bool ConnectionState = false;
-        // 判断是否是模拟状态 FASE:    不是在模拟环境下  True:    在模拟环境下
-        //bool IsSimulationStatus = false;
-        //获取当前电镜的ID号
-        //int SemType = 0;
-        //获取XML 路径
+
         static string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFilePath"].ConnectionString;
         static string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFilePath"].ConnectionString;
         //日志路径
         //日志路径
         static string LogPath = System.Configuration.ConfigurationManager.ConnectionStrings["LogPath"].ConnectionString;
         static string LogPath = System.Configuration.ConfigurationManager.ConnectionStrings["LogPath"].ConnectionString;

+ 1 - 1
OTSSysMgrApp/OTSSysMgrApp.csproj

@@ -101,7 +101,7 @@
   <ItemGroup>
   <ItemGroup>
     <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
     <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\Bin\Win32\Release\NLog.dll</HintPath>
+      <HintPath>..\OpenDll\Nlog\NLog.dll</HintPath>
     </Reference>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.configuration" />
     <Reference Include="System.configuration" />