차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
ko:bs2_startmonitoringlogex [2020/08/21 14:01]
kkshin 만듦
ko:bs2_startmonitoringlogex [2021/12/30 12:47] (현재)
mark [반환값]
줄 18: 줄 18:
 ==== 반환값 ==== ==== 반환값 ====
 성공적으로 수행될 경우 ''​BS_SDK_SUCCESS''​를 반환하고,​ 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. 성공적으로 수행될 경우 ''​BS_SDK_SUCCESS''​를 반환하고,​ 에러가 발생할 경우 상응하는 에러 코드를 반환합니다.
 +
 +==== 샘플코드 ====
 +C++
 +<code cpp>
 +static DeviceInfo deviceInfo = { 0, 0, 0, 51211, 0 };
 +static void* sdkContext = NULL;
 +sdkContext = BS2Context::​getInstance()->​getContext();​
 +
 +void onLogReceivedEx(BS2_DEVICE_ID id, const BS2Event* event, BS2_TEMPERATURE temperature)
 +{
 + if (deviceInfo.id_ == id)
 + {
 + int32_t timezone = deviceInfo.timezone_;​
 + cout << Utility::​getEventStringWithThermal(id,​ *event, timezone, temperature) << endl;
 + }
 +}
 +
 +sdkResult = BS2_StartMonitoringLogEx(sdkContext,​ deviceInfo.id_,​ onLogReceivedEx);​
 +if (BS_SDK_SUCCESS != sdkResult)
 + TRACE("​BS2_StartMonitoringLog call failed: %d", sdkResult);
 +
 +</​code>​
 +
 +C#
 +<code cpp>
 +private API.OnLogReceived cbOnLogReceived = null; //To prevent garbage collection
 +
 +BS2ErrorCode result = (BS2ErrorCode)API.BS2_StartMonitoringLogEx(sdkContext,​ deviceID, cbOnLogReceivedEx);​
 +if (result != BS2ErrorCode.BS_SDK_SUCCESS)
 +{
 +    Console.WriteLine("​Got error({0}).",​ result);
 +}
 +
 +</​code>​
 ==== 함께 보기 ==== ==== 함께 보기 ====
 [[BS2_StopMonitoringLog]] [[BS2_StopMonitoringLog]]