차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
ko:bs2_getfilteredlog [2021/12/30 11:03] mark [샘플코드] |
ko:bs2_getfilteredlog [2024/02/27 14:08] |
||
---|---|---|---|
줄 1: | 줄 1: | ||
- | ~~NOTOC~~ | ||
- | [[log_management_api]] > [[BS2_GetFilteredLog]] | ||
- | ---- | ||
- | |||
- | ===== BS2_GetFilteredLog ===== | ||
- | 주어진 조건을 만족하는 모든 로그 레코드를 가져옵니다. | ||
- | ==== 함수 ==== | ||
- | <code cpp> | ||
- | #include "BS_API.h" | ||
- | |||
- | int BS2_GetFilteredLog(void* context, uint32_t deviceId, char* uid, uint16_t eventCode, uint32_t start, uint32_t end, uint8_t tnakey, BS2Event** logsObj, uint32_t* numLog); | ||
- | </code> | ||
- | |||
- | <callout type="info"> | ||
- | [[Log_Management_API#BS2Event|BS2Event 구조체 보기]] | ||
- | </callout> | ||
- | ==== 파라미터 ==== | ||
- | * [In] ''//context//'' : Context | ||
- | * [In] ''//deviceId//'' : 장치 식별자 | ||
- | * [In] ''//uid//'' : 사용자 식별자이며 NULL일 경우 모든 사용자를 의미합니다. | ||
- | * [In] ''//eventCode//'' : 로그 이벤트 코드이며 0일 경우 모든 이벤트를 의미합니다. | ||
- | * [In] ''//start//'' : 조건 검색의 시작 시간이며 0일 경우 제한이 없음을 의미합니다. | ||
- | * [In] ''//end//'' : 조건 검색의 마지막 시간이며 0일 경우 제한이 없음을 의미합니다. | ||
- | * [In] ''//tnakey//'' : TNA key이며 0일 경우 모든 TNA key를 의미합니다. | ||
- | * [Out] ''//logsObj//'' : 로그 레코드의 주소를 저장할 포인터 | ||
- | * [Out] ''//numLog//'' : 로그 레코드의 갯수 | ||
- | <WRAP indent> | ||
- | <WRAP info 70%> | ||
- | **참고**\\ | ||
- | logsObj 변수는 사용 후 [[BS2_ReleaseObject]] 함수를 통해 시스템에 메모리를 반환해야 합니다. | ||
- | </WRAP> | ||
- | </WRAP> | ||
- | ==== 반환값 ==== | ||
- | 성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | ||
- | ==== 샘플코드 ==== | ||
- | C# | ||
- | <code cpp> | ||
- | |||
- | |||
- | 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]] |