|
@@ -15,6 +15,92 @@ using FileManager;
|
|
|
|
|
|
namespace SmartSEMControl
|
|
|
{
|
|
|
+ public enum ZeissErrorCode
|
|
|
+ {
|
|
|
+ // Failed to translate parameter into an id
|
|
|
+ API_E_GET_TRANSLATE_FAIL = 1000,
|
|
|
+ // Failed to get analogue value
|
|
|
+ API_E_GET_AP_FAIL = 1001,
|
|
|
+ // Failed to get digital value
|
|
|
+ API_E_GET_DP_FAIL = 1002,
|
|
|
+ // Parameter supplied is not analogue nor digital
|
|
|
+ API_E_GET_BAD_PARAMETER = 1003,
|
|
|
+ // Failed to translate parameter into an id
|
|
|
+ API_E_SET_TRANSLATE_FAIL = 1004,
|
|
|
+ // Failed to set a digital state
|
|
|
+ API_E_SET_STATE_FAIL = 1005,
|
|
|
+ // Failed to set a float value
|
|
|
+ API_E_SET_FLOAT_FAIL = 1006,
|
|
|
+ // Value supplied is too low
|
|
|
+ API_E_SET_FLOAT_LIMIT_LOW = 1007,
|
|
|
+ // Value supplied is too high
|
|
|
+ API_E_SET_FLOAT_LIMIT_HIGH = 1008,
|
|
|
+ // Value supplied is is of wrong type
|
|
|
+ API_E_SET_BAD_VALUE = 1009,
|
|
|
+ // Parameter supplied is not analogue nor digital
|
|
|
+ API_E_SET_BAD_PARAMETER = 1010,
|
|
|
+ // Failed to translate command into an id
|
|
|
+ API_E_EXEC_TRANSLATE_FAIL = 1011,
|
|
|
+ // Failed to execute command=
|
|
|
+ API_E_EXEC_CMD_FAIL = 1012,
|
|
|
+ // Failed to execute file macro
|
|
|
+ API_E_EXEC_MCF_FAIL = 1013,
|
|
|
+ // Failed to execute library macro
|
|
|
+ API_E_EXEC_MCL_FAIL = 1014,
|
|
|
+ // Command supplied is not implemented
|
|
|
+ API_E_EXEC_BAD_COMMAND = 1015,
|
|
|
+ // Grab command failed
|
|
|
+ API_E_GRAB_FAIL = 1016,
|
|
|
+ // Get Stage position failed
|
|
|
+ API_E_GET_STAGE_FAIL = 1017,
|
|
|
+ // Move Stage position failed
|
|
|
+ API_E_MOVE_STAGE_FAIL = 1018,
|
|
|
+ // API not initialised
|
|
|
+ API_E_NOT_INITIALISED = 1019,
|
|
|
+ // Failed to translate parameter to an id
|
|
|
+ API_E_NOTIFY_TRANSLATE_FAIL = 1020,
|
|
|
+ // Set notification failed
|
|
|
+ API_E_NOTIFY_SET_FAIL = 1021,
|
|
|
+ // Get limits failed
|
|
|
+ API_E_GET_LIMITS_FAIL = 1022,
|
|
|
+ // Get multiple parameters failed
|
|
|
+ API_E_GET_MULTI_FAIL = 1023,
|
|
|
+ // Set multiple parameters failed
|
|
|
+ API_E_SET_MULTI_FAIL = 1024,
|
|
|
+ // Missing API license
|
|
|
+ API_E_NOT_LICENSED = 1025,
|
|
|
+ // Reserved or not implemented
|
|
|
+ API_E_NOT_IMPLEMENTED = 1026,
|
|
|
+ // Failed to get user name (Remoting Interface only)
|
|
|
+ API_E_GET_USER_NAME_FAIL = 1027,
|
|
|
+ // Failed to get user idle state (Remoting Interface only)
|
|
|
+ API_E_GET_USER_IDLE_FAIL = 1028,
|
|
|
+ // Failed to get the last remoting connection error string (Remoting Interface Only)
|
|
|
+ API_E_GET_LAST_REMOTING_CONNECT_ERROR_FAIL = 1029,
|
|
|
+ // Failed to remotely logon to the EM Server (username and password may be incorrect or EM Server is not running or User is already logged on
|
|
|
+ API_E_EMSERVER_LOGON_FAILED = 1030,
|
|
|
+ // Failed to start the EM Server - this may be because the Server is already running or has an internal error.
|
|
|
+ API_E_EMSERVER_START_FAILED = 1031,
|
|
|
+ // The command or parameter is currently disabled (you cannot execute or set it).
|
|
|
+ API_E_PARAMETER_IS_DISABLED = 1032,
|
|
|
+ // Remoting incorrectly configured, use RConfigure to correct
|
|
|
+ API_E_REMOTING_NOT_CONFIGURED = 2027,
|
|
|
+ // Remoting did not connect to the server
|
|
|
+ API_E_REMOTING_FAILED_TO_CONNECT = 2028,
|
|
|
+ // Remoting could not start (unknown reason)
|
|
|
+ API_E_REMOTING_COULD_NOT_CREATE_INTERFACE = 2029,
|
|
|
+ // Remoting: Remote server is not running currently.
|
|
|
+ API_E_REMOTING_EMSERVER_NOT_RUNNING = 2030,
|
|
|
+ // Remoting: Remote server has no user logged in
|
|
|
+ API_E_REMOTING_NO_USER_LOGGED_IN = 2031,
|
|
|
+
|
|
|
+ // Internal Defines, although they may be useful in your own program. TRS.
|
|
|
+ API_FIRST_REMOTING_ERROR_CODE = API_E_REMOTING_NOT_CONFIGURED,
|
|
|
+ API_LAST_REMOTING_ERROR_CODE = API_E_REMOTING_NO_USER_LOGGED_IN,
|
|
|
+ API_FIRST_ERROR_CODE = API_E_GET_TRANSLATE_FAIL,
|
|
|
+ API_LAST_ERROR_CODE = API_E_REMOTING_NO_USER_LOGGED_IN
|
|
|
+ }
|
|
|
+
|
|
|
//可能遇到的错误提示部分??在log加入之后添加
|
|
|
class SmartSEM : ISEMControl
|
|
|
{
|
|
@@ -179,7 +265,7 @@ namespace SmartSEMControl
|
|
|
#endif
|
|
|
if (lrt != 0)
|
|
|
{
|
|
|
- LogManager.AddHardwareLog("CZEMApi.Initialise Faild!", false);
|
|
|
+ LogManager.AddHardwareLog("CZEMApi.Initialise Faild - " + ErrorToString(lrt), false);
|
|
|
m_bInitialised = false;
|
|
|
return false;
|
|
|
}
|
|
@@ -232,7 +318,7 @@ namespace SmartSEMControl
|
|
|
long lrt = CZEMApi.ClosingControl();
|
|
|
if (lrt != 0)
|
|
|
{
|
|
|
- LogManager.AddHardwareLog("CZEMApi.ClosingControl Faild!", false);
|
|
|
+ LogManager.AddHardwareLog("CZEMApi.ClosingControl Faild - " + ErrorToString(lrt), false);
|
|
|
return false;
|
|
|
}
|
|
|
else
|
|
@@ -258,6 +344,7 @@ namespace SmartSEMControl
|
|
|
long lrt = CZEMApi.Get(str_param, ref varfloat);
|
|
|
if (lrt != 0)
|
|
|
{
|
|
|
+ LogManager.AddHardwareLog("Get " + str_param + " Faild - " + ErrorToString(lrt), false);
|
|
|
return false;
|
|
|
}
|
|
|
else
|
|
@@ -268,6 +355,7 @@ namespace SmartSEMControl
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ LogManager.AddHardwareLog("ReadParams m_bInitialised = false", false);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -284,6 +372,7 @@ namespace SmartSEMControl
|
|
|
long lrt = CZEMApi.GetLimits(str_param, ref varMin, ref varMax);
|
|
|
if (lrt != 0)
|
|
|
{
|
|
|
+ LogManager.AddHardwareLog("GetLimits " + str_param + " Faild - " + ErrorToString(lrt), false);
|
|
|
return false;
|
|
|
}
|
|
|
if (value <= Convert.ToSingle(varMax) && value >= Convert.ToSingle(varMin))
|
|
@@ -292,17 +381,20 @@ namespace SmartSEMControl
|
|
|
lrt = CZEMApi.Set(str_param, ref varFloat);// set value
|
|
|
if (lrt != 0)
|
|
|
{
|
|
|
+ LogManager.AddHardwareLog("Set " + str_param + " Faild - " + ErrorToString(lrt), false);
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ LogManager.AddHardwareLog("Set " + str_param + " Faild - Out to range", false);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ LogManager.AddHardwareLog("ReadParams m_bInitialised = false", false);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -317,12 +409,14 @@ namespace SmartSEMControl
|
|
|
long lrt = CZEMApi.Set(str_param, ref varFloat);// set value
|
|
|
if (lrt != 0)
|
|
|
{
|
|
|
+ LogManager.AddHardwareLog("Set " + str_param + " Faild - " + ErrorToString(lrt), false);
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ LogManager.AddHardwareLog("ReadParams m_bInitialised = false", false);
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -336,6 +430,7 @@ namespace SmartSEMControl
|
|
|
long lrt = CZEMApi.Execute(cmd);// execute command
|
|
|
if (lrt != 0)
|
|
|
{
|
|
|
+ LogManager.AddHardwareLog("ExecuteCmd " + cmd + " Faild - " + ErrorToString(lrt), false);
|
|
|
return false;
|
|
|
}
|
|
|
else
|
|
@@ -1757,17 +1852,132 @@ namespace SmartSEMControl
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
- //PT针插入
|
|
|
- public Boolean InsertPT()
|
|
|
- {
|
|
|
- //插入动作
|
|
|
- //已经插入完成
|
|
|
- return false;
|
|
|
- }
|
|
|
- //PT针退出
|
|
|
- public Boolean OutputPT()
|
|
|
- {
|
|
|
- return false;
|
|
|
+ #region 错误代码转义
|
|
|
+ private String ErrorToString(long lError)
|
|
|
+ {
|
|
|
+ string strError;
|
|
|
+ switch ((ZeissErrorCode)lError)
|
|
|
+ {
|
|
|
+ case 0:
|
|
|
+ strError = "OK";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GET_TRANSLATE_FAIL:
|
|
|
+ strError = "Failed to translate parameter into an ID";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GET_AP_FAIL:
|
|
|
+ strError = "Failed to get analogue value";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GET_DP_FAIL:
|
|
|
+ strError = "Failed to get digital value";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GET_BAD_PARAMETER:
|
|
|
+ strError = "Parameter supplied is neither analogue nor digital";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_SET_TRANSLATE_FAIL:
|
|
|
+ strError = "Failed to translate parameter into an ID";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_SET_STATE_FAIL:
|
|
|
+ strError = "Failed to set a digital state";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_SET_FLOAT_FAIL:
|
|
|
+ strError = "Failed to set a float value";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_SET_FLOAT_LIMIT_LOW:
|
|
|
+ strError = "Value supplied is too low";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_SET_FLOAT_LIMIT_HIGH:
|
|
|
+ strError = "Value supplied is too high";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_SET_BAD_VALUE:
|
|
|
+ strError = "Value supplied is of wrong type";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_SET_BAD_PARAMETER:
|
|
|
+ strError = "Parameter supplied is not analogue nor digital";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_EXEC_TRANSLATE_FAIL:
|
|
|
+ strError = "Failed to translate command into an ID";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_EXEC_CMD_FAIL:
|
|
|
+ strError = "Failed to execute command";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_EXEC_MCF_FAIL:
|
|
|
+ strError = "Failed to execute file macro";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_EXEC_MCL_FAIL:
|
|
|
+ strError = "Failed to execute library macro";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_EXEC_BAD_COMMAND:
|
|
|
+ strError = "Command supplied is not implemented";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GRAB_FAIL:
|
|
|
+ strError = "Grab command failed";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GET_STAGE_FAIL:
|
|
|
+ strError = "Get Stage position failed";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_MOVE_STAGE_FAIL:
|
|
|
+ strError = "Move Stage position failed";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_NOT_INITIALISED:
|
|
|
+ strError = "API not initialised";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_NOTIFY_TRANSLATE_FAIL: // 1020L
|
|
|
+ strError = "Failed to translate parameter to an ID";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_NOTIFY_SET_FAIL:
|
|
|
+ strError = "Set notification failed";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GET_LIMITS_FAIL:
|
|
|
+ strError = "Get limits failed";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GET_MULTI_FAIL:
|
|
|
+ strError = "Get multiple parameters failed";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_SET_MULTI_FAIL:
|
|
|
+ strError = "Set multiple parameters failed";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_NOT_LICENSED:
|
|
|
+ strError = "Missing API license";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_NOT_IMPLEMENTED:
|
|
|
+ strError = "Reserved or not implemented";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GET_USER_NAME_FAIL:
|
|
|
+ strError = "Failed to get user name";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GET_USER_IDLE_FAIL:
|
|
|
+ strError = "Failed to get user idle state";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_GET_LAST_REMOTING_CONNECT_ERROR_FAIL:
|
|
|
+ strError = "Failed to get the last remoting connection error string";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_EMSERVER_LOGON_FAILED:
|
|
|
+ strError = "Failed to remotely logon to the EM Server. Username and password may be incorrect or EM Server is not running or User is already logged on";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_EMSERVER_START_FAILED:
|
|
|
+ strError = "Failed to start the EM Server. This may be because the Server is already running or has an internal error.";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_REMOTING_NOT_CONFIGURED:
|
|
|
+ strError = "Remoting incorrectly configured, use RConfigure to correct";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_REMOTING_FAILED_TO_CONNECT:
|
|
|
+ strError = "Remoting did not connect to the server";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_REMOTING_COULD_NOT_CREATE_INTERFACE:
|
|
|
+ strError = "Remoting could not start (unknown reason)";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_REMOTING_EMSERVER_NOT_RUNNING:
|
|
|
+ strError = "EMServer is not running on the remote machine";
|
|
|
+ break;
|
|
|
+ case ZeissErrorCode.API_E_REMOTING_NO_USER_LOGGED_IN:
|
|
|
+ strError = "No user is logged into EM Server on the remote machine";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ strError = string.Format("Unknown error code {0}", lError);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return strError;
|
|
|
}
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|