차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
platform:ethercat:100_api:20_eg:version_compare [2019/08/14 18:06]
winoars
platform:ethercat:100_api:20_eg:version_compare [2024/07/08 18:23] (현재)
줄 9: 줄 9:
  
  
-=====C#=====+====Code====
  
 <callout type="primary" <callout type="primary"
 ===C#=== ===C#===
-<code>+<sxh csharp> 
 +using ec = ComiLib.EtherCAT.SafeNativeMethods; 
 bool IsVersionMatch(ref string message) bool IsVersionMatch(ref string message)
-        +
-         ec.TEcFileVerInfo_SDK sdkInfo = new ec.TEcFileVerInfo_SDK(); + ec.TEcFileVerInfo_SDK sdkInfo = new ec.TEcFileVerInfo_SDK(); 
-         ec.TEcFileVerInfo_WDM driverInfo = new ec.TEcFileVerInfo_WDM(); + ec.TEcFileVerInfo_WDM driverInfo = new ec.TEcFileVerInfo_WDM(); 
-         ec.TEcFileVerInfo_FW fwInfo = new ec.TEcFileVerInfo_FW(); + ec.TEcFileVerInfo_FW fwInfo = new ec.TEcFileVerInfo_FW();
-  +
-         bool isVersionMatch = ec.ecNet_GetVerInfo(0, ref sdkInfo, ref driverInfo, ref fwInfo, ref errorCode);+
  
-            if (isVersionMatch) + bool isVersionMatch = ec.ecNet_GetVerInfo(0, ref sdkInfo, ref driverInfo, ref fwInfo, ref errorCode);
-            { +
-                message = "OK"; +
-                return true; +
-            }+
  
-            // Firmware Verion 확인 + if (isVersionMatch) 
-            string ver_Fw = string.Format("{0}.{1}.{2}.{3}", fwInfo.CurVer.MajorVer, fwInfo.CurVer.MinorVer, fwInfo.CurVer.BuildNo, fwInfo.CurVer.RevNo); +
-             + message = "OK"; 
-            string comp_Fw_Drv = string.Empty; + return true; 
-            string comp_Fw_Lib = string.Empty; +
-            string comp_Drv_Lib = string.Empty;+ 
 + // Firmware Verion 확인 
 + string ver_Fw = string.Format("{0}.{1}.{2}.{3}", fwInfo.CurVer.MajorVer, fwInfo.CurVer.MinorVer, fwInfo.CurVer.BuildNo, fwInfo.CurVer.RevNo); 
 +  
 + string comp_Fw_Drv = string.Empty; 
 + string comp_Fw_Lib = string.Empty; 
 + string comp_Drv_Lib = string.Empty;
  
-            //FW - SDK 호환성 결과 + //FW - SDK 호환성 결과 
-            switch ((ec.EEcVerCompatResult)sdkInfo.nFwCompResult) + switch ((ec.EEcVerCompatResult)sdkInfo.nFwCompResult) 
-            +
-                case ec.EEcVerCompatResult.ecVER_MISMATCH_LOWER: comp_Fw_Lib = "Library version is higher than the Firmware"; break; + case ec.EEcVerCompatResult.ecVER_MISMATCH_LOWER: comp_Fw_Lib = "Library version is higher than the Firmware"; break; 
-                case ec.EEcVerCompatResult.ecVER_MISMATCH_HIGHER: comp_Fw_Lib = "Library version is lower than the Firmware"; break; + case ec.EEcVerCompatResult.ecVER_MISMATCH_HIGHER: comp_Fw_Lib = "Library version is lower than the Firmware"; break; 
-                case ec.EEcVerCompatResult.ecVER_MATCH: comp_Fw_Lib = "OK"; break; + case ec.EEcVerCompatResult.ecVER_MATCH: comp_Fw_Lib = "OK"; break; 
-                default: comp_Fw_Lib = "Firmware Version is invalid"; break; + default: comp_Fw_Lib = "Firmware Version is invalid"; break; 
-            }+ }
  
-            //FW-WDM 호환성 결과 + //FW-WDM 호환성 결과 
-            switch ((ec.EEcVerCompatResult)driverInfo.nFwCompResult) + switch ((ec.EEcVerCompatResult)driverInfo.nFwCompResult) 
-            +
-                case ec.EEcVerCompatResult.ecVER_MISMATCH_LOWER: comp_Fw_Drv = "Driver version is higher than the Firmware"; break; + case ec.EEcVerCompatResult.ecVER_MISMATCH_LOWER: comp_Fw_Drv = "Driver version is higher than the Firmware"; break; 
-                case ec.EEcVerCompatResult.ecVER_MISMATCH_HIGHER: comp_Fw_Drv = "Driver version is lower than the Firmware"; break; + case ec.EEcVerCompatResult.ecVER_MISMATCH_HIGHER: comp_Fw_Drv = "Driver version is lower than the Firmware"; break; 
-                case ec.EEcVerCompatResult.ecVER_MATCH: comp_Fw_Drv = "OK"; break; + case ec.EEcVerCompatResult.ecVER_MATCH: comp_Fw_Drv = "OK"; break; 
-                default: comp_Fw_Drv = "Firmware Version is invalid"; break; + default: comp_Fw_Drv = "Firmware Version is invalid"; break; 
-            }+ }
  
-            //SDK-WDM + //SDK-WDM 
-            switch ((ec.EEcVerCompatResult)sdkInfo.nWdmCompResult) + switch ((ec.EEcVerCompatResult)sdkInfo.nWdmCompResult) 
-            +
-                case ec.EEcVerCompatResult.ecVER_MISMATCH_LOWER: comp_Drv_Lib = "Driver version is lower than the Library"; break; + case ec.EEcVerCompatResult.ecVER_MISMATCH_LOWER: comp_Drv_Lib = "Driver version is lower than the Library"; break; 
-                case ec.EEcVerCompatResult.ecVER_MISMATCH_HIGHER: comp_Drv_Lib = "Library version is lower than the Driver"; break; + case ec.EEcVerCompatResult.ecVER_MISMATCH_HIGHER: comp_Drv_Lib = "Library version is lower than the Driver"; break; 
-                case ec.EEcVerCompatResult.ecVER_MATCH: comp_Drv_Lib = "OK"; break; + case ec.EEcVerCompatResult.ecVER_MATCH: comp_Drv_Lib = "OK"; break; 
-                default: comp_Drv_Lib = "Driver Version is invalid"; break; + default: comp_Drv_Lib = "Driver Version is invalid"; break; 
-            }+ }
  
-            message = string.Format("FW-WDM : {0}. WDM-DLL : {1}. FW-DLL : {2}", comp_Fw_Drv, comp_Drv_Lib, comp_Fw_Lib); + message = string.Format("FW-WDM : {0}. WDM-DLL : {1}. FW-DLL : {2}", comp_Fw_Drv, comp_Drv_Lib, comp_Fw_Lib); 
-            return false; + return false; 
-        +
-</code>  +</sxh>  
 </callout> </callout>
  
줄 74: 줄 76:
 ===C++=== ===C++===
 \\ \\
-<code>+<sxh cpp>
 bool IsVersionMatch() bool IsVersionMatch()
 { {
줄 84: 줄 86:
  return ecNet_GetVerInfo(NETID, &SdkVerInfo, &WdmVerInfo, &FwVerInfo, &nErrCode);  return ecNet_GetVerInfo(NETID, &SdkVerInfo, &WdmVerInfo, &FwVerInfo, &nErrCode);
  
-</code>+</sxh>
  
 </callout> </callout>