문서의 이전 판입니다!


User Management API > BS2_EnrolUser


새로운 사용자를 등록합니다.

도움말
FaceStation F2로 사용자 전송을 위해서는 BS2_EnrollUserFaceEx를 사용해 주십시오.


함수

#include "BS_API.h"
 
int BS2_EnrolUser(void* context, uint32_t deviceId, BS2UserBlob* userBlob, uint32_t userCount, uint8_t overwrite);

파라미터

  • [In] context : Context
  • [In] deviceId : 장치 식별자
  • [In] userBlob : 등록하고자 하는 사용자 정보
  • [In] userCount : 사용자 개수
  • [In] overwrite : 중복된 사용자 덮어쓰기 여부

반환값

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

C++

sdkResult = BS2_EnrolUser(context_, id, &userBlob, 1, 1);
if (BS_SDK_SUCCESS != sdkResult)
TRACE("BS2_EnrolUser call failed: %d", sdkResult);

C#

public void insertUserIntoDevice(IntPtr sdkContext, UInt32 deviceID, bool isMasterDevice)
{
    List<BS2User> userList = new List<BS2User>();
    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]);
            }
 
            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_EnrolUser(sdkContext, deviceID, userBlob, 1, 1);
                        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.");
        }
    }
    else
    {
        Console.WriteLine("An error occurred while attempting to retrieve user list.");
    }
}                          

함께 보기