차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
|
ko:bs2_getallauthgroup [2017/06/28 11:33] 127.0.0.1 바깥 편집 |
ko:bs2_getallauthgroup [2022/06/27 15:02] (현재) mark [함께 보기] |
||
|---|---|---|---|
| 줄 31: | 줄 31: | ||
| ==== 함께 보기 ==== | ==== 함께 보기 ==== | ||
| [[BS2_GetAuthGroup]]\\ [[BS2_SetAuthGroup]]\\ [[BS2_RemoveAuthGroup]]\\ [[BS2_RemoveAllAuthGroup]] | [[BS2_GetAuthGroup]]\\ [[BS2_SetAuthGroup]]\\ [[BS2_RemoveAuthGroup]]\\ [[BS2_RemoveAllAuthGroup]] | ||
| + | |||
| + | ==== 샘플코드 ==== | ||
| + | C# | ||
| + | <code cpp> | ||
| + | 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); | ||
| + | </code> | ||