차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 마지막 판 양쪽 다음 판 | ||
ko:bs2_enrollusersmall [2020/10/22 10:45] kkshin |
ko:bs2_enrollusersmall [2021/12/29 10:39] mark [샘플코드] |
||
---|---|---|---|
줄 8: | 줄 8: | ||
[[user management api#BS2UserBlob]]을 이용하는 [[BS2_EnrollUser]]와의 차이는 \\ | [[user management api#BS2UserBlob]]을 이용하는 [[BS2_EnrollUser]]와의 차이는 \\ | ||
메모리 효율을 위해 3번째 인자 BS2UserSmallBlob 멤버 BS2UserPhoto가 포인터 처리된 것을 제외하고 모두 동일합니다. \\ | 메모리 효율을 위해 3번째 인자 BS2UserSmallBlob 멤버 BS2UserPhoto가 포인터 처리된 것을 제외하고 모두 동일합니다. \\ | ||
- | <WRAP info 70%> | + | <WRAP tip 70%> |
- | **참고**\\ | + | **도움말**\\ |
- | ''FaceStation F2''로 사용자 전송을 위해서는 [[BS2_EnrollUserFaceEx]]를 사용해 주십시오. | + | <wrap em>FaceStation F2</wrap>로 사용자 전송을 위해서는 [[BS2_EnrollUserFaceEx]]를 사용해 주십시오. |
</WRAP> | </WRAP> | ||
==== 함수 ==== | ==== 함수 ==== | ||
줄 31: | 줄 31: | ||
성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | 성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | ||
\\ | \\ | ||
+ | |||
+ | ==== 샘플코드 ==== | ||
+ | C# | ||
+ | <code cpp> | ||
+ | if (dbHandler.GetUserList(ref deviceInfo, ref userList)) | ||
+ | { | ||
+ | if (userList.Count > 0) | ||
+ | { | ||
+ | for (int idx = 0; idx < userList.Count; ++idx) | ||
+ | { | ||
+ | Console.Write("[{0:000}] ==> ", idx); | ||
+ | print(userList[idx]); | ||
+ | } | ||
+ | Console.WriteLine("Please, choose the index of the user which you want to enroll."); | ||
+ | Console.Write(">>>> "); | ||
+ | |||
+ | Int32 selection = Util.GetInput(); | ||
+ | if (selection >= 0) | ||
+ | { | ||
+ | if (selection < userList.Count) | ||
+ | { | ||
+ | BS2User user = userList[selection]; | ||
+ | BS2UserSmallBlob[] userBlob = Util.AllocateStructureArray<BS2UserSmallBlob>(1); | ||
+ | if (dbHandler.GetUserBlob(ref deviceInfo, ref user, ref userBlob[0])) | ||
+ | { | ||
+ | Console.WriteLine("Trying to enroll user."); | ||
+ | BS2ErrorCode result = (BS2ErrorCode)API.BS2_EnrollUserSmall(sdkContext, deviceID, userBlob, 1, 1); | ||
+ | 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> | ||
+ | |||
+ | |||
==== 함께 보기 ==== | ==== 함께 보기 ==== | ||
[[BS2_EnrollUserSmall]]\\ | [[BS2_EnrollUserSmall]]\\ |