차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
ko:bs2_getfilteredlog [2016/07/12 08:49] 127.0.0.1 바깥 편집 |
ko:bs2_getfilteredlog [2021/12/30 11:05] mark [샘플코드] |
||
---|---|---|---|
줄 34: | 줄 34: | ||
==== 반환값 ==== | ==== 반환값 ==== | ||
성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | 성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | ||
+ | ==== 샘플코드 ==== | ||
+ | C# | ||
+ | <code cpp> | ||
+ | Type structureType = typeof(BS2Event); | ||
+ | int structSize = Marshal.SizeOf(structureType); | ||
+ | IntPtr uid = IntPtr.Zero; | ||
+ | UInt16 eventCode = 0; | ||
+ | UInt32 start = 0; | ||
+ | UInt32 end = 0; | ||
+ | byte tnaKey = 0; | ||
+ | IntPtr outEventLogObjs = IntPtr.Zero; | ||
+ | UInt32 outNumEventLogs = 0; | ||
+ | |||
+ | BS2ErrorCode result = (BS2ErrorCode)API.BS2_GetFilteredLog(sdkContext, deviceID, uid, eventCode, start, end, tnaKey, out outEventLogObjs, out outNumEventLogs); | ||
+ | if (result != BS2ErrorCode.BS_SDK_SUCCESS) | ||
+ | { | ||
+ | Console.WriteLine("Got error({0}).", result); | ||
+ | } | ||
+ | else if (outNumEventLogs > 0) | ||
+ | { | ||
+ | IntPtr curEventLogObjs = outEventLogObjs; | ||
+ | for (int idx = 0; idx < outNumEventLogs; idx++) | ||
+ | { | ||
+ | BS2Event eventLog = (BS2Event)Marshal.PtrToStructure(curEventLogObjs, structureType); | ||
+ | Console.WriteLine(Util.GetLogMsg(eventLog)); | ||
+ | curEventLogObjs = (IntPtr)((long)curEventLogObjs + structSize); | ||
+ | } | ||
+ | |||
+ | API.BS2_ReleaseObject(outEventLogObjs); | ||
+ | } | ||
+ | |||
+ | </code> | ||
==== 함께 보기 ==== | ==== 함께 보기 ==== | ||
[[BS2_GetLog]]\\ [[BS2_ClearLog]] | [[BS2_GetLog]]\\ [[BS2_ClearLog]] |