Case

 When  you want to get the user list through BS2_GetUserListUser.  (Device SDK C#)



Information

Function :extern public static int BS2_GetUserList(IntPtr context, UInt32 deviceId, out IntPtr outUidObjs, out UInt32 outNumUids, IsAcceptableUserID cbIsAcceptableUserID)



Order : Call the Function -> BS2_GetUserData function after BS2_GetUserList



Parameter

  • [In] context : Context
  • [In] deviceId: device identifier
  • [In] uids: List of user identifiers to be imported
  • [In] uidCount: number of user identifiers
  • [Out] userBlob: Pointer to save user information
  • [In] userMask: User Mask




valueExplanation
0x0000user identifier
0x0001user data
0x0002user settings
0x0004username
0x0008image
0x0010PIN
0x0020card
0x0040Fingerprint
0x0080Face
0x0100access group
0x0200working code
0x0400personal message
0x0800Face (FaceStation F2)
0x1000Custom (FaceStation F2)
0xFFFFAll user information
Return Message

If successfully done, BS_SDK_SUCCESS will be returned.
If there is an error, the corresponding error code will be returned.


Sample Code
 
public void listUserFromDevice(IntPtr sdkContext, UInt32 deviceID, bool isMasterDevice)
        {
            IntPtr outUidObjs = IntPtr.Zero;
            UInt32 numUserIds = 0;
            API.IsAcceptableUserID cbIsAcceptableUserID = null; // we don't need to user id filtering

            Console.WriteLine("Trying to get user list.");
            BS2ErrorCode result = (BS2ErrorCode)API.BS2_GetUserList(sdkContext, deviceID, out outUidObjs, out numUserIds, cbIsAcceptableUserID);
            if (result == BS2ErrorCode.BS_SDK_SUCCESS)
            {
                if (numUserIds > 0)
                {
                    IntPtr curUidObjs = outUidObjs;
                    BS2UserBlob[] userBlobs = new BS2UserBlob[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_GetUserDatas(sdkContext, deviceID, curUidObjs, available, userBlobs, (UInt32)BS2UserMaskEnum.ALL);
                        if (result == BS2ErrorCode.BS_SDK_SUCCESS)
                        {
                            for (UInt32 loop = 0; loop < available; ++loop)
                            {
                                print(sdkContext, 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);
                            }

                            idx += available;
                            curUidObjs += (int)available * BS2Environment.BS2_USER_ID_SIZE;
                        }
                        else
                        {
                            Console.WriteLine("Got error({0}).", result);
                            break;
                        }
                    }

                    API.BS2_ReleaseObject(outUidObjs);
                }
            }
            else
            {
                Console.WriteLine("Got error({0}).", result);
                return;
            }
        }
Result In SDK