Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:bs2_getcustomcardconfig [2023/08/16 15:32]
mashin created
en:bs2_getcustomcardconfig [2023/08/31 21:36] (current)
kkshin [Sample Code(C++)]
Line 27: Line 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>​
Line 35: Line 65:
 ==== Sample Code(C#) ==== ==== Sample Code(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>​