차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
ko:bs2_getusersmalldatas [2021/12/29 15:26] mark [샘플코드] |
ko:bs2_getusersmalldatas [2021/12/30 10:52] (현재) mark [샘플코드] |
||
|---|---|---|---|
| 줄 53: | 줄 53: | ||
| C# | C# | ||
| <code cpp> | <code cpp> | ||
| - | IntPtr curUidObjs = outUidObjs; | + | if (numUserIds > 0) |
| - | BS2UserSmallBlob[] userBlobs = new BS2UserSmallBlob[USER_PAGE_SIZE]; | + | |
| - | + | ||
| - | Console.WriteLine("Number of users : ({0}).", numUserIds); | + | |
| - | for (UInt32 idx = 0; idx < numUserIds; ) | + | |
| { | { | ||
| - | UInt32 available = numUserIds - idx; | + | IntPtr curUidObjs = outUidObjs; |
| - | if (available > USER_PAGE_SIZE) | + | BS2UserSmallBlob[] userBlobs = new BS2UserSmallBlob[USER_PAGE_SIZE]; |
| - | { | + | |
| - | available = USER_PAGE_SIZE; | + | |
| - | } | + | |
| - | result = (BS2ErrorCode)API.BS2_GetUserSmallDatas(sdkContext, deviceID, curUidObjs, available, userBlobs, (UInt32)BS2UserMaskEnum.ALL); | + | Console.WriteLine("Number of users : ({0}).", numUserIds); |
| - | if (result == BS2ErrorCode.BS_SDK_SUCCESS) | + | for (UInt32 idx = 0; idx < numUserIds; ) |
| - | { | + | { |
| - | for (UInt32 loop = 0; loop < available; ++loop) | + | UInt32 available = numUserIds - idx; |
| - | { | + | if (available > USER_PAGE_SIZE) |
| - | print(userBlobs[loop].user); | + | { |
| - | // don't need to release cardObj, FingerObj, FaceObj because we get only BS2User | + | available = USER_PAGE_SIZE; |
| - | if (userBlobs[loop].cardObjs != IntPtr.Zero) | + | } |
| - | API.BS2_ReleaseObject(userBlobs[loop].cardObjs); | + | result = (BS2ErrorCode)API.BS2_GetUserSmallDatas(sdkContext, deviceID, curUidObjs, available, userBlobs, |
| - | if (userBlobs[loop].fingerObjs != IntPtr.Zero) | + | (UInt32)BS2UserMaskEnum.ALL); |
| - | API.BS2_ReleaseObject(userBlobs[loop].fingerObjs); | + | if (result == BS2ErrorCode.BS_SDK_SUCCESS) |
| - | if (userBlobs[loop].faceObjs != IntPtr.Zero) | + | { |
| - | API.BS2_ReleaseObject(userBlobs[loop].faceObjs); | + | for (UInt32 loop = 0; loop < available; ++loop) |
| - | if (userBlobs[loop].user_photo_obj != IntPtr.Zero) | + | { |
| - | API.BS2_ReleaseObject(userBlobs[loop].user_photo_obj); | + | print(userBlobs[loop].user); |
| + | // don't need to release cardObj, FingerObj, FaceObj because we get only BS2User | ||
| + | if (userBlobs[loop].cardObjs != IntPtr.Zero) | ||
| + | API.BS2_ReleaseObject(userBlobs[loop].cardObjs); | ||
| + | if (userBlobs[loop].fingerObjs != IntPtr.Zero) | ||
| + | API.BS2_ReleaseObject(userBlobs[loop].fingerObjs); | ||
| + | if (userBlobs[loop].faceObjs != IntPtr.Zero) | ||
| + | API.BS2_ReleaseObject(userBlobs[loop].faceObjs); | ||
| + | if (userBlobs[loop].user_photo_obj != IntPtr.Zero) | ||
| + | API.BS2_ReleaseObject(userBlobs[loop].user_photo_obj); | ||
| + | } | ||
| + | |||
| + | idx += available; | ||
| + | curUidObjs += (int)available * BS2Environment.BS2_USER_ID_SIZE; | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | Console.WriteLine("Got error({0}).", result); | ||
| + | break; | ||
| + | } | ||
| } | } | ||
| - | idx += available; | + | API.BS2_ReleaseObject(outUidObjs); |
| - | curUidObjs += (int)available * BS2Environment.BS2_USER_ID_SIZE; | + | |
| } | } | ||
| </code> | </code> | ||