차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
ko:bs2_getcustomcardconfig [2023/08/09 15:58] mashin 만듦 |
ko:bs2_getcustomcardconfig [2023/08/31 21:36] (현재) kkshin [샘플코드(C++)] |
||
---|---|---|---|
줄 27: | 줄 27: | ||
<file cpp sample_getcustomcardconfig.cpp> | <file cpp sample_getcustomcardconfig.cpp> | ||
- | int sdkResult = BS2_GetCustomCardConfig(context_, id, &config); | + | ConfigControl cc(context); |
+ | DeviceControl dc(context); | ||
+ | BS2DeviceCapabilities capabilies = { 0, }; | ||
+ | BS2CustomCardConfig config = { 0, }; | ||
+ | |||
+ | BS2_DEVICE_ID id = Utility::getSelectedDeviceID(device); | ||
+ | |||
+ | int sdkResult = dc.getDeviceCapabilities(id, capabilies); | ||
if (BS_SDK_SUCCESS != sdkResult) | if (BS_SDK_SUCCESS != sdkResult) | ||
- | printf("BS2_GetCustomCardConfig call failed: %d", sdkResult); | + | return sdkResult; |
+ | |||
+ | if (!capabilies.customSmartCardSupported) | ||
+ | { | ||
+ | TRACE("Not supported function."); | ||
+ | return BS_SDK_ERROR_NOT_SUPPORTED; | ||
+ | } | ||
+ | |||
+ | sdkResult = cc.getCustomCardConfig(id, config); | ||
+ | if (BS_SDK_SUCCESS == sdkResult) | ||
+ | ConfigControl::print(config); | ||
+ | else | ||
+ | return sdkResult; | ||
+ | |||
+ | if (Utility::isYes("Do you want to scan card test?")) | ||
+ | { | ||
+ | UserControl uc(context); | ||
+ | BS2Card cardID; | ||
+ | |||
+ | sdkResult = uc.scanCard(id, &cardID); | ||
+ | if (BS_SDK_SUCCESS == sdkResult) | ||
+ | UserControl::print(cardID); | ||
+ | } | ||
return sdkResult; | return sdkResult; | ||
</file> | </file> | ||
줄 35: | 줄 65: | ||
==== 샘플코드(C#) ==== | ==== 샘플코드(C#) ==== | ||
<file csharp sample_getcustomcardconfig.cs> | <file csharp sample_getcustomcardconfig.cs> | ||
- | BS2ErrorCode result = (BS2ErrorCode)API.BS2_GetCustomCardConfig(sdkContext, deviceID, out config); | + | BS2DeviceCapabilities capa; |
- | if (result != BS2ErrorCode.BS_SDK_SUCCESS) | + | if (!CommonControl.getDeviceCapabilities(sdkContext, deviceID, out capa)) |
- | Console.WriteLine("Got error({0}).", result); | + | return; |
- | else | + | |
- | Console.WriteLine("Call success."); | + | if (!Convert.ToBoolean(capa.functionExSupported & (byte)BS2CapabilityFunctionExSupport.FUNCTIONEX_SUPPORT_CUSTOMSMARTCARD)) |
- | return result; | + | { |
+ | Console.WriteLine("Not supported function."); | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | BS2CustomCardConfig config; | ||
+ | Console.WriteLine("Trying to get CustomCardConfig"); | ||
+ | BS2ErrorCode result = (BS2ErrorCode)API.BS2_GetCustomCardConfig(sdkContext, deviceID, out config); | ||
+ | if (result != BS2ErrorCode.BS_SDK_SUCCESS) | ||
+ | { | ||
+ | Console.WriteLine("Got error({0}).", result); | ||
+ | return; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | print(config); | ||
+ | } | ||
</file> | </file> |