Face API > BS2_GetAllAuthGroup


BS2_GetAllAuthGroup

모든 인증 그룹을 가져옵니다.

함수

#include "BS_API.h"
 
int BS2_GetAllAuthGroup(void* context, uint32_t deviceId, BS2AuthGroup** authGroupObj, uint32_t* numAuthGroup);

파라미터

참고
authGroupObj 변수는 사용한 뒤 BS2_ReleaseObject 함수를 이용해 시스템에 메모리를 반환해야 합니다.

반환값

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

함께 보기

BS2_GetAuthGroup
BS2_SetAuthGroup
BS2_RemoveAuthGroup
BS2_RemoveAllAuthGroup

샘플코드

C#

if (Util.IsYes())
{
    Console.WriteLine("Trying to get all auth gruops from device.");
    result = (BS2ErrorCode)API.BS2_GetAllAuthGroup(sdkContext, deviceID, out authGroupObj, out numAuthGroup);
}
else
{
    Console.WriteLine("Enter the ID of the access group which you want to get: [ID_1,ID_2 ...]");
    Console.Write(">>>> ");
    char[] delimiterChars = { ' ', ',', '.', ':', '\t' };
    string[] authGroupIDs = Console.ReadLine().Split(delimiterChars);
    List<UInt32> authGroupIDList = new List<UInt32>();
 
    foreach (string authGroupID in authGroupIDs)
    {
        if (authGroupID.Length > 0)
        {
            UInt32 item;
            if (UInt32.TryParse(authGroupID, out item))
            {
                authGroupIDList.Add(item);
            }
        }
    }
 
    if (authGroupIDList.Count > 0)
    {
        IntPtr authGroupIDObj = Marshal.AllocHGlobal(4 * authGroupIDList.Count);
        IntPtr curAuthGroupIDObj = authGroupIDObj;
        foreach (UInt32 item in authGroupIDList)
        {
            Marshal.WriteInt32(curAuthGroupIDObj, (Int32)item);
            curAuthGroupIDObj = (IntPtr)((long)curAuthGroupIDObj + 4);
        }
 
        Console.WriteLine("Trying to get auth gruops from device.");
        result = (BS2ErrorCode)API.BS2_GetAuthGroup(sdkContext, deviceID, authGroupIDObj, (UInt32)authGroupIDList.Count, out authGroupObj, out numAuthGroup);
 
        Marshal.FreeHGlobal(authGroupIDObj);
    }
    else
    {
        Console.WriteLine("Invalid parameter");
    }
}
BS2_ReleaseObject(uidObj);