차이

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

차이 보기로 링크

다음 판
이전 판
platform:ethercat:100_api:20_eg:version_compare [2019/08/14 14:33]
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;+
  
-            //FW - SDK 호환성 결과 + // Firmware Verion 확인 
-            switch ((ec.EEcVerCompatResult)sdkInfo.nFwCompResult) + string ver_Fw = string.Format("{0}.{1}.{2}.{3}", fwInfo.CurVer.MajorVer, fwInfo.CurVer.MinorVer, fwInfo.CurVer.BuildNo, fwInfo.CurVer.RevNo)
-            { +  
-                case ec.EEcVerCompatResult.ecVER_MISMATCH_LOWER: comp_Fw_Lib = "Library version is higher than the Firmware"; break+ string comp_Fw_Drv = string.Empty
-                case ec.EEcVerCompatResult.ecVER_MISMATCH_HIGHER: comp_Fw_Lib = "Library version is lower than the Firmware"; break+ string comp_Fw_Lib = string.Empty
-                case ec.EEcVerCompatResult.ecVER_MATCH: comp_Fw_Lib = "OK"; break+ string comp_Drv_Lib string.Empty;
-                default: comp_Fw_Lib "Firmware Version is invalid"break; +
-            }+
  
-            //FW-WDM 호환성 결과 + //FW - SDK 호환성 결과 
-            switch ((ec.EEcVerCompatResult)driverInfo.nFwCompResult) + switch ((ec.EEcVerCompatResult)sdkInfo.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_Lib = "Library 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_Lib = "Library version is lower than the Firmware"; break; 
-                case ec.EEcVerCompatResult.ecVER_MATCH: comp_Fw_Drv = "OK"; break; + case ec.EEcVerCompatResult.ecVER_MATCH: comp_Fw_Lib = "OK"; break; 
-                default: comp_Fw_Drv = "Firmware Version is invalid"; break; + default: comp_Fw_Lib = "Firmware Version is invalid"; break; 
-            }+ }
  
-            //SDK-WDM + //FW-WDM 호환성 결과 
-            switch ((ec.EEcVerCompatResult)sdkInfo.nWdmCompResult+ switch ((ec.EEcVerCompatResult)driverInfo.nFwCompResult
-            +
-                case ec.EEcVerCompatResult.ecVER_MISMATCH_LOWER: comp_Drv_Lib = "Driver version is lower than the Library"; 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_Drv_Lib = "Library version is lower than the Driver"; break; + case ec.EEcVerCompatResult.ecVER_MISMATCH_HIGHER: comp_Fw_Drv = "Driver version is lower than the Firmware"; break; 
-                case ec.EEcVerCompatResult.ecVER_MATCH: comp_Drv_Lib = "OK"; break; + case ec.EEcVerCompatResult.ecVER_MATCH: comp_Fw_Drv = "OK"; break; 
-                default: comp_Drv_Lib = "Driver Version is invalid"; break; + default: comp_Fw_Drv = "Firmware 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); +
-            return false; +
-        } +
-</code>   +
-</callout> +
- +
- +
- +
- +
-<callout type="info" icon="true" title="Cause"> +
  
 + //SDK-WDM
 + 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_HIGHER: comp_Drv_Lib = "Library version is lower than the Driver"; break;
 + case ec.EEcVerCompatResult.ecVER_MATCH: comp_Drv_Lib = "OK"; 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);
 + return false;
 +}
 +</sxh>  
 </callout> </callout>
  
줄 79: 줄 73:
  
  
-<callout type="successicon="true" title="Solution">  +<callout type="info
 +===C++=== 
 +\\ 
 +<sxh cpp
 +bool IsVersionMatch() 
 +
 + TEcFileVerInfo_SDK SdkVerInfo; 
 + TEcFileVerInfo_WDM WdmVerInfo; 
 + TEcFileVerInfo_FW FwVerInfo; 
 + int nErrCode; 
 +  
 + return ecNet_GetVerInfo(NETID, &SdkVerInfo, &WdmVerInfo, &FwVerInfo, &nErrCode); 
 +}  
 +</sxh>
  
 </callout> </callout>
  
- 
- 
- 
- 
-<button collapse="foo">Category</button>  
-<collapse id="foo" collapsed="true"> 
-<well> 
-{{page>[Platform:EtherCAT]&[footer]}} 
-</well></collapse>