차이

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

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
ko:bs2_enrollusersmall [2021/12/29 10:39]
mark [반환값]
ko:bs2_enrollusersmall [2021/12/29 15:10] (현재)
mark [샘플코드]
줄 35: 줄 35:
 C# C#
 <code cpp> <code cpp>
-  ​if (dbHandler.GetUserList(ref deviceInfo, ref userList)) + if (dbHandler.GetUserBlobEx(ref deviceInfo, ref user, ref userBlob[0])) 
-            { +
-                if (userList.Count > 0) +     ​Console.WriteLine("​Trying to enroll user."​);​ 
-                { +     ​BS2ErrorCode result = (BS2ErrorCode)API.BS2_EnrollUserSmall(sdkContext,​ deviceID, userBlob, 1, 1); 
-                    for (int idx = 0; idx < userList.Count;​ ++idx) +     ​if (result != BS2ErrorCode.BS_SDK_SUCCESS) 
-                    { +     ​
-                        Console.Write("​[{0:​000}] ==> ", idx); +         ​Console.WriteLine("​Got error({0}).",​ result); 
-                        print(userList[idx]);​ +     ​
-                    } +  
-                    Console.WriteLine("​Please,​ choose the index of the user which you want to enroll."​);​ +     ​if (userBlob[0].cardObjs != IntPtr.Zero) 
-                    Console.Write(">>>>​ "); +     ​
- +          Marshal.FreeHGlobal(userBlob[0].cardObjs);​ 
-                    Int32 selection = Util.GetInput();​ +     ​
-                    if (selection >= 0) +     ​if (userBlob[0].fingerObjs != IntPtr.Zero) 
-                    { +     ​
-                        if (selection < userList.Count) +          Marshal.FreeHGlobal(userBlob[0].fingerObjs);​ 
-                        { +     ​
-                            BS2User user = userList[selection];​ +     ​if (userBlob[0].faceObjs != IntPtr.Zero) 
-                            BS2UserSmallBlob[] userBlob = Util.AllocateStructureArray<​BS2UserSmallBlob>​(1);​ +     ​
-                            if (dbHandler.GetUserBlob(ref deviceInfo, ref user, ref userBlob[0])) +          Marshal.FreeHGlobal(userBlob[0].faceObjs);​ 
-                            +     ​
-                                Console.WriteLine("​Trying to enroll user."​);​ +     ​if (userBlob[0].user_photo_obj != IntPtr.Zero) 
-                                //​BS2ErrorCode result = (BS2ErrorCode)API.BS2_EnrolUser(sdkContext,​ deviceID, userBlob, 1, 1); +     ​
-                                ​BS2ErrorCode result = (BS2ErrorCode)API.BS2_EnrollUserSmall(sdkContext,​ deviceID, userBlob, 1, 1); +          Marshal.FreeHGlobal(userBlob[0].user_photo_obj);​ 
-                                if (result != BS2ErrorCode.BS_SDK_SUCCESS) +     ​
-                                +
-                                    Console.WriteLine("​Got error({0}).",​ result); +
-                                +
- +
-                                if (userBlob[0].cardObjs != IntPtr.Zero) +
-                                +
-                                    Marshal.FreeHGlobal(userBlob[0].cardObjs);​ +
-                                +
- +
-                                ​if (userBlob[0].fingerObjs != IntPtr.Zero) +
-                                +
-                                    Marshal.FreeHGlobal(userBlob[0].fingerObjs);​ +
-                                +
- +
-                                ​if (userBlob[0].faceObjs != IntPtr.Zero) +
-                                +
-                                    Marshal.FreeHGlobal(userBlob[0].faceObjs);​ +
-                                +
- +
-                                ​if (userBlob[0].user_photo_obj != IntPtr.Zero) +
-                                +
-                                    Marshal.FreeHGlobal(userBlob[0].user_photo_obj);​ +
-                                +
-                            } +
-                        } +
-                        else +
-                        { +
-                            Console.WriteLine("​Invalid selection[{0}]",​ selection);​ +
-                        } +
-                    } +
-                    else +
-                    { +
-                        Console.WriteLine("​Invalid user index"​);​ +
-                    } +
-                } +
-                else +
-                { +
-                    Console.WriteLine("​There is no user."​);​ +
-                ​}+
 </​code>​ </​code>​