Quellcode durchsuchen

Merge branch 'master' of http://192.168.1.123:10080/SDD1/HOZ

# Conflicts:
#	SmartSEMControl/SmartSEM.cs
HaoShuang vor 5 Jahren
Ursprung
Commit
537480b372
2 geänderte Dateien mit 59 neuen und 22 gelöschten Zeilen
  1. 9 0
      SmartSEMControl/HardwareInterface.cs
  2. 50 22
      SmartSEMControl/SmartSEM.cs

+ 9 - 0
SmartSEMControl/HardwareInterface.cs

@@ -131,6 +131,15 @@ namespace SmartSEMControl
         //执行宏文件
         Boolean CMDMCFFilename(String filename);
 
+        //样品台状态
+        float GetStageIs();
+
+        //自动函数状态
+        float GetAutoFunction();
+
+        //连接状态
+        Boolean ConnectStatus();
+
         //清除控件
         Boolean Dispose();
 

+ 50 - 22
SmartSEMControl/SmartSEM.cs

@@ -82,8 +82,11 @@ namespace SmartSEMControl
         private String DP_DETECTOR_TYPE = "DP_DETECTOR_TYPE";
         //图像大小
         private String DP_IMAGE_STORE = "DP_IMAGE_STORE";
-        //自动处理状态查询
-        #endregion
+
+        //样品台状态
+        private String DP_STAGE_IS = "DP_STAGE_IS";
+        //自动函数状态
+        private String DP_AUTO_FUNCTION = "DP_AUTO_FUNCTION";        #endregion
 
         #region 命令
         //开启电压
@@ -104,9 +107,7 @@ namespace SmartSEMControl
 
         #region APILib
         private Api CZEMApi = new Api();
-        //设备初始化完成标志,true,表示设备已连接,可以控制
         private Boolean m_bInitialised = false;
-        private long lrt = 0; //命名??为什么是全局变量??
         #endregion
 
         #region 构造函数
@@ -123,6 +124,7 @@ namespace SmartSEMControl
         /// <returns>return:true or false</returns>
         public Boolean Init()
         {
+            long lrt = 0;
             #if ROMOTE
                 lrt = CZEMApi.InitialiseRemoting();
             #else
@@ -148,7 +150,7 @@ namespace SmartSEMControl
         /// <returns>return:true or false</returns>
         public Boolean InitRemoting()
         {
-            lrt = CZEMApi.InitialiseRemoting();
+            long lrt = CZEMApi.InitialiseRemoting();
             if (lrt != 0)
             {
                 m_bInitialised = false;
@@ -162,6 +164,13 @@ namespace SmartSEMControl
         }
         #endregion
 
+        #region 连接状态
+        public Boolean ConnectStatus()
+        {
+            return m_bInitialised;
+        }
+        #endregion
+
         #region 关闭设备
         /// <summary>
         /// 关闭设备
@@ -171,7 +180,7 @@ namespace SmartSEMControl
         {
             if (m_bInitialised)
             {
-                lrt = CZEMApi.ClosingControl();
+                long lrt = CZEMApi.ClosingControl();
                 if (lrt != 0)
                 {
                     return false;
@@ -195,7 +204,7 @@ namespace SmartSEMControl
             if (m_bInitialised)
             {
                 object varfloat = new VariantWrapper((float)0.0f);
-                lrt = CZEMApi.Get(str_param, ref varfloat);
+                long lrt = CZEMApi.Get(str_param, ref varfloat);
                 if (lrt != 0)
                 {
                     return false;
@@ -221,7 +230,7 @@ namespace SmartSEMControl
                 //先取范围
                 object varMin = new VariantWrapper((float)0.0f);
                 object varMax = new VariantWrapper((float)0.0f);
-                lrt = CZEMApi.GetLimits(str_param, ref varMin, ref varMax);
+                long lrt = CZEMApi.GetLimits(str_param, ref varMin, ref varMax);
                 if (lrt != 0)
                 {
                     return false;
@@ -235,17 +244,6 @@ namespace SmartSEMControl
                         return false;
                     }
                     return true;
-                    //这里是写入后读取判断值是否写入,也可以在事件1中捕获返回值
-                    //object varfloat = new VariantWrapper((float)0.0f);
-                    ////object varStr = new VariantWrapper("");
-                    //lrt = CZEMApi.Get(strPara, ref varfloat);
-
-                    //if (lrt != 0)
-                    //{
-                    //    ReportError(lrt, "Set Value", strPara);
-                    //    return;
-                    //}
-                    //lblgetValue.Text = Convert.ToDecimal(varfloat).ToString();
                 }
                 else
                 {
@@ -265,7 +263,7 @@ namespace SmartSEMControl
             if (m_bInitialised)
             {
                 object varFloat = new VariantWrapper(value);
-                lrt = CZEMApi.Set(str_param, ref varFloat);// set value
+                long lrt = CZEMApi.Set(str_param, ref varFloat);// set value
                 if (lrt != 0)
                 {
                     return false;
@@ -284,7 +282,7 @@ namespace SmartSEMControl
         {
             if (m_bInitialised)
             {
-                lrt = CZEMApi.Execute(cmd);// execute command
+                long lrt = CZEMApi.Execute(cmd);// execute command
                 if (lrt != 0)
                 {
                     return false;
@@ -694,7 +692,7 @@ namespace SmartSEMControl
         {
             if (m_bInitialised)
             {
-                lrt = CZEMApi.Grab(xoff, yoff, width, height, type, filename);
+                long lrt = CZEMApi.Grab(xoff, yoff, width, height, type, filename);
                 if (lrt != 0)
                 {
                     return false;
@@ -1122,5 +1120,35 @@ namespace SmartSEMControl
             return ExecuteCmd(CMDMCF);
         }
         #endregion
+
+        #region 读取样品台状态
+        public float GetStageIs()
+        {
+            float ret = 0;
+            if (ReadParams(DP_STAGE_IS, ref ret))
+            {
+                return ret;
+            }
+            else
+            {
+                return float.NaN;
+            }
+        }
+        #endregion
+
+        #region 读取自动函数的状态
+        public float GetAutoFunction()
+        {
+            float ret = 0;
+            if (ReadParams(DP_AUTO_FUNCTION, ref ret))
+            {
+                return ret;
+            }
+            else
+            {
+                return float.NaN;
+            }
+        }
+        #endregion
     }
 }