User Management API > BS2_GetUserSmallDatas


[+ 2.6.3] 사용자 식별자에 해당하는 사용자 정보를 가져옵니다.
이때 userMask를 통하여 사용자 정보의 일부를 선별적으로 가져올 수 있습니다.
BS2UserBlob을 이용하는 BS2_GetUserDatas와의 차이는
메모리 효율을 위해 3번째 인자 BS2UserSmallBlob 멤버 BS2UserPhoto가 포인터 처리된 것을 제외하고 모두 동일합니다.

함수

#include "BS_API.h"
 
int BS2_GetUserSmallDatas(void* context, uint32_t deviceId, char* uids, uint32_t uidCount, BS2UserSmallBlob* userBlob, BS2_USER_MASK userMask);

파라미터

  • [In] context : Context
  • [In] deviceId : 장치 식별자
  • [In] uids : 가져오고자 하는 사용자 식별자 리스트
  • [In] uidCount : 사용자 식별자 개수
  • [Out] userBlob : 사용자 정보를 저장할 포인터
  • [In] userMask : 사용자 Mask
설명
0x0000 사용자 식별자
0x0001 사용자 data
0x0002 사용자 설정
0x0004 사용자명
0x0008 이미지
0x0010 PIN
0x0020 카드
0x0040 지문
0x0080 얼굴
0x0100 출입그룹
0x0200 작업코드
0x0400 개인메시지
0x0800 얼굴 (FaceStation F2)
0x1000 사용자설정 (FaceStation F2)
0xFFFF 사용자 정보 전체

반환값

성공적으로 수행될 경우 BS_SDK_SUCCESS를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다.

샘플코드

C#

if (numUserIds > 0)
{
    IntPtr curUidObjs = outUidObjs;
    BS2UserSmallBlob[] userBlobs = new BS2UserSmallBlob[USER_PAGE_SIZE];
 
    Console.WriteLine("Number of users : ({0}).", numUserIds);
    for (UInt32 idx = 0; idx < numUserIds; )
    {
        UInt32 available = numUserIds - idx;
        if (available > USER_PAGE_SIZE)
        {
            available = USER_PAGE_SIZE;
        }
        result = (BS2ErrorCode)API.BS2_GetUserSmallDatas(sdkContext, deviceID, curUidObjs, available, userBlobs, 
        (UInt32)BS2UserMaskEnum.ALL);
        if (result == BS2ErrorCode.BS_SDK_SUCCESS)
        {
        for (UInt32 loop = 0; loop < available; ++loop)
        {
            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;
        }
    }
 
    API.BS2_ReleaseObject(outUidObjs);
}

함께 보기