|  | @@ -14,16 +14,16 @@ namespace ServiceInterface
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public SemController()
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            if (hw == null)
 | 
	
		
			
				|  |  | -            {
 | 
	
		
			
				|  |  | -                hw = OTSCLRINTERFACE.COTSControlFunExport.GetControllerInstance();
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +           
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool Connect()
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -          
 | 
	
		
			
				|  |  | +            if (hw == null)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                hw = OTSCLRINTERFACE.COTSControlFunExport.GetControllerInstance();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              if (hw.IsConnected())
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  |                  return true;
 | 
	
	
		
			
				|  | @@ -36,23 +36,34 @@ namespace ServiceInterface
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool DisConnect()
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -         
 | 
	
		
			
				|  |  | -            return hw.DisconnectSem();
 | 
	
		
			
				|  |  | +            if (hw != null)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (hw.IsConnected())
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    return hw.DisconnectSem();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +           
 | 
	
		
			
				|  |  | +            return true;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool GetMagnification(ref double a_dMagnification)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | +            Connect();
 | 
	
		
			
				|  |  |              return hw.GetSemMagnification(ref a_dMagnification);
 | 
	
		
			
				|  |  |               
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool GetScanFieldSize(ref double dScanFieldSizeX, ref double dScanFieldSizeY)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -          return  hw.GetSemScanFieldSize(ref dScanFieldSizeX, ref dScanFieldSizeY);
 | 
	
		
			
				|  |  | +            Connect();
 | 
	
		
			
				|  |  | +            return  hw.GetSemScanFieldSize(ref dScanFieldSizeX, ref dScanFieldSizeY);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool GetSemPositionXY(ref double a_dPositionX, ref double a_dPositionY, ref double a_dPositionR)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | +            Connect();
 | 
	
		
			
				|  |  |              return hw.GetSemPositionXY(ref a_dPositionX, ref a_dPositionY, ref a_dPositionR);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -60,6 +71,7 @@ namespace ServiceInterface
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool GetWorkingDistance(ref double a_distance)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | +            Connect();
 | 
	
		
			
				|  |  |              return hw.GetSemWorkingDistance(ref a_distance);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -71,24 +83,28 @@ namespace ServiceInterface
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool MoveSEMToPoint(Point poi, double rotation)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | +            Connect();
 | 
	
		
			
				|  |  |              return hw.MoveSEMToPoint(poi.X, poi.Y, rotation);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool SetMagnification(double a_dMagnification)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -             //hw.SetMagnification(a_dMagnification);
 | 
	
		
			
				|  |  | +            Connect();
 | 
	
		
			
				|  |  | +            //hw.SetMagnification(a_dMagnification);
 | 
	
		
			
				|  |  |              hw.SetSemMagnification(a_dMagnification);
 | 
	
		
			
				|  |  |              return true;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool SetScanExternal(bool b)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | +            Connect();
 | 
	
		
			
				|  |  |              //int seValue = b ? 1 : 0;
 | 
	
		
			
				|  |  |              return hw.SetSemScanExternal(b);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public bool SetWorkingDistance(double a_distance)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | +            Connect();
 | 
	
		
			
				|  |  |              return hw.SetSemWorkingDistance(a_distance);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 |