优化日志控制方式

streaming
Matthew 4 months ago
parent 46bc13a608
commit 600c46f024

@ -14,6 +14,25 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections -Wformat
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
# SET_TARGET_PROPERTIES(microphoto PROPERTIES LINK_FLAGS "-Wl,-s,--gc-sections") # SET_TARGET_PROPERTIES(microphoto PROPERTIES LINK_FLAGS "-Wl,-s,--gc-sections")
add_definitions(-DUSING_ETHERNET)
if(ANDROID_ABI STREQUAL "armeabi-v7a")
add_definitions(-DUSING_N938)
elseif(ANDROID_ABI STREQUAL "arm64-v8a")
# add_definitions(-DUSING_N938)
#add_definitions(-DUSING_PLZ)
endif()
# OUTPUT_DBG_INFO:
add_definitions(-DOUTPUT_DBG_INFO)
# OUTPUT_SOCKET_DBG_INFO Depends ON OUTPUT_DBG_INFO
# TerminalService.cpp
add_definitions(-DOUTPUT_SOCKET_DBG_INFO)
# OUTPUT_DB_DBG_INFO Depends ON OUTPUT_DBG_INFO
# Database.cpp
add_definitions(-DOUTPUT_DB_DBG_INFO)
IF (CMAKE_BUILD_TYPE STREQUAL Debug) IF (CMAKE_BUILD_TYPE STREQUAL Debug)
ADD_DEFINITIONS(-D_DEBUG) ADD_DEFINITIONS(-D_DEBUG)
ELSE() ELSE()
@ -36,8 +55,7 @@ add_definitions(-DHAVE_STRING_H) # for memcpy in md5.c
# add_definitions(-DUSING_NRSEC_VPN) # add_definitions(-DUSING_NRSEC_VPN)
# add_definitions(-DUSING_CERT) # add_definitions(-DUSING_CERT)
# add_definitions(-DUSING_DOWSE) # add_definitions(-DUSING_DOWSE)
# OUTPUT_CAMERA_DBG_INFO: CARERA
# add_definitions(-DOUTPUT_CAMERA_DBG_INFO)
add_definitions(-DALIGN_HB_TIMER_TO_PHOTO) add_definitions(-DALIGN_HB_TIMER_TO_PHOTO)
add_definitions(-DENABLE_3V3_ALWAYS) add_definitions(-DENABLE_3V3_ALWAYS)
add_definitions(-DCURL_STATICLIB) add_definitions(-DCURL_STATICLIB)
@ -46,15 +64,6 @@ add_definitions(-DUSING_HDRPLUS)
add_definitions(-DUSING_EXEC_HDRP=1) add_definitions(-DUSING_EXEC_HDRP=1)
set(USING_EXEC_HDRP 1) set(USING_EXEC_HDRP 1)
add_definitions(-DUSING_ETHERNET)
if(ANDROID_ABI STREQUAL "armeabi-v7a")
add_definitions(-DUSING_N938)
elseif(ANDROID_ABI STREQUAL "arm64-v8a")
# add_definitions(-DUSING_N938)
# add_definitions(-DUSING_PLZ)
endif()
# include_directories(${OpenCV_DIR}/include) # include_directories(${OpenCV_DIR}/include)
# add_library( lib_opencv SHARED IMPORTED ) # add_library( lib_opencv SHARED IMPORTED )
# set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${OpenCV_DIR}/../libs/${ANDROID_ABI}/libopencv_java4.so) # set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${OpenCV_DIR}/../libs/${ANDROID_ABI}/libopencv_java4.so)

@ -2272,7 +2272,7 @@ bool CPhoneDevice::onOneCapture(std::shared_ptr<ACameraMetadata> characteristics
cameraInfo = str; cameraInfo = str;
} }
#ifdef OUTPUT_CAMERA_DBG_INFO #ifdef OUTPUT_DBG_INFO
#if 0 #if 0
bool shouldRetry = false; bool shouldRetry = false;
if (ldr != ~0) if (ldr != ~0)
@ -2309,7 +2309,7 @@ bool CPhoneDevice::onOneCapture(std::shared_ptr<ACameraMetadata> characteristics
} }
} }
#endif // 0 #endif // 0
#endif // OUTPUT_CAMERA_DBG_INFO #endif // OUTPUT_DBG_INFO
// Notify to take next photo // Notify to take next photo
XYLOG(XYLOG_SEVERITY_INFO, "TP: Notofy to Take Next CUR Info: CH=%u PR=%u PHOTOID=%u", (uint32_t)photoInfo.channel, (uint32_t)photoInfo.preset, (uint32_t)photoInfo.photoId); XYLOG(XYLOG_SEVERITY_INFO, "TP: Notofy to Take Next CUR Info: CH=%u PR=%u PHOTOID=%u", (uint32_t)photoInfo.channel, (uint32_t)photoInfo.preset, (uint32_t)photoInfo.photoId);
@ -2414,7 +2414,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
} }
} }
#ifdef OUTPUT_CAMERA_DBG_INFO #ifdef OUTPUT_DBG_INFO
#if 0 #if 0
bool shouldRetry = false; bool shouldRetry = false;
if (ldr != ~0) if (ldr != ~0)
@ -2451,7 +2451,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
} }
} }
#endif // 0 #endif // 0
#endif // OUTPUT_CAMERA_DBG_INFO #endif // OUTPUT_DBG_INFO
// Notify to take next photo // Notify to take next photo
pThis->TakePhotoCb(1, photoInfo, "", takingTime); pThis->TakePhotoCb(1, photoInfo, "", takingTime);
@ -2911,7 +2911,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
} }
} }
#ifdef OUTPUT_CAMERA_DBG_INFO #ifdef OUTPUT_DBG_INFO
#if 0 #if 0
bool shouldRetry = false; bool shouldRetry = false;
if (ldr != ~0) if (ldr != ~0)
@ -2948,7 +2948,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr<ACameraMetadata> characteristi
} }
} }
#endif // 0 #endif // 0
#endif // OUTPUT_CAMERA_DBG_INFO #endif // OUTPUT_DBG_INFO
// Notify to take next photo // Notify to take next photo
pThis->TakePhotoCb(1, photoInfo, "", takingTime); pThis->TakePhotoCb(1, photoInfo, "", takingTime);
@ -3189,7 +3189,7 @@ bool CPhoneDevice::OnImageReady(cv::Mat mat)
pt.x = it->x + it->w - textSize.width; pt.x = it->x + it->w - textSize.width;
} }
#ifdef OUTPUT_CAMERA_DBG_INFO #ifdef OUTPUT_DBG_INFO
char buf[128]; char buf[128];
snprintf(buf, sizeof(buf), "AI: %d=%s (%f,%f)-(%f,%f) Text:(%d,%d)-(%d,%d)", snprintf(buf, sizeof(buf), "AI: %d=%s (%f,%f)-(%f,%f) Text:(%d,%d)-(%d,%d)",
it->label, item.name.c_str(), it->x, it->y, it->w, it->h, pt.x, pt.y, textSize.width, textSize.height); it->label, item.name.c_str(), it->x, it->y, it->w, it->h, pt.x, pt.y, textSize.width, textSize.height);
@ -3206,7 +3206,7 @@ bool CPhoneDevice::OnImageReady(cv::Mat mat)
XYLOG(XYLOG_SEVERITY_WARNING, "Channel AI Disabled"); XYLOG(XYLOG_SEVERITY_WARNING, "Channel AI Disabled");
} }
// #ifdef OUTPUT_CAMERA_DBG_INFO // #ifdef OUTPUT_DBG_INFO
if (mCamera != NULL) if (mCamera != NULL)
{ {
@ -3242,7 +3242,7 @@ bool CPhoneDevice::OnImageReady(cv::Mat mat)
// DrawOutlineText(ft2, mat, str, cv::Point(0, mat.rows - fs - 20 * ratio), fs, scalarWhite, 1); // DrawOutlineText(ft2, mat, str, cv::Point(0, mat.rows - fs - 20 * ratio), fs, scalarWhite, 1);
} }
} }
// #endif // OUTPUT_CAMERA_DBG_INFO // #endif // OUTPUT_DBG_INFO
for (vector<OSD_INFO>::const_iterator it = mOsds.cbegin(); it != mOsds.cend(); ++it) for (vector<OSD_INFO>::const_iterator it = mOsds.cbegin(); it != mOsds.cend(); ++it)
{ {
@ -3294,7 +3294,7 @@ bool CPhoneDevice::OnImageReady(cv::Mat mat)
bool res = false; bool res = false;
std::string fullPath = endsWith(mPath, ".jpg") ? mPath : (mPath + CTerminal::BuildPhotoFileName(mPhotoInfo)); std::string fullPath = endsWith(mPath, ".jpg") ? mPath : (mPath + CTerminal::BuildPhotoFileName(mPhotoInfo));
#ifdef OUTPUT_CAMERA_DBG_INFO #ifdef OUTPUT_DBG_INFO
bool shouldRetry = false; bool shouldRetry = false;
#if 0 #if 0
@ -3334,7 +3334,7 @@ bool CPhoneDevice::OnImageReady(cv::Mat mat)
} }
#endif #endif
#endif // OUTPUT_CAMERA_DBG_INFO #endif // OUTPUT_DBG_INFO
if (!std::filesystem::exists(std::filesystem::path(fullPath)) || getFileSize(fullPath) == 0) if (!std::filesystem::exists(std::filesystem::path(fullPath)) || getFileSize(fullPath) == 0)
{ {
@ -3347,7 +3347,7 @@ bool CPhoneDevice::OnImageReady(cv::Mat mat)
{ {
XYLOG(XYLOG_SEVERITY_INFO, "Succeeded to write photo: %s", fullPath.c_str()); XYLOG(XYLOG_SEVERITY_INFO, "Succeeded to write photo: %s", fullPath.c_str());
} }
#ifdef OUTPUT_CAMERA_DBG_INFO #ifdef OUTPUT_DBG_INFO
if (shouldRetry) if (shouldRetry)
{ {
TakePhotoCb(0, mPhotoInfo, fullPath, takingTime, objs); TakePhotoCb(0, mPhotoInfo, fullPath, takingTime, objs);
@ -3479,7 +3479,7 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vector<ID
pt.x = it->x + it->w - textSize.width; pt.x = it->x + it->w - textSize.width;
} }
#ifdef OUTPUT_CAMERA_DBG_INFO #ifdef OUTPUT_DBG_INFO
char buf[128]; char buf[128];
snprintf(buf, sizeof(buf), "AI: %d=%s (%f,%f)-(%f,%f) Text:(%d,%d)-(%d,%d)", snprintf(buf, sizeof(buf), "AI: %d=%s (%f,%f)-(%f,%f) Text:(%d,%d)-(%d,%d)",
it->label, item.name.c_str(), it->x, it->y, it->w, it->h, pt.x, pt.y, textSize.width, textSize.height); it->label, item.name.c_str(), it->x, it->y, it->w, it->h, pt.x, pt.y, textSize.width, textSize.height);
@ -3496,7 +3496,7 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vector<ID
XYLOG(XYLOG_SEVERITY_WARNING, "Channel AI Disabled"); XYLOG(XYLOG_SEVERITY_WARNING, "Channel AI Disabled");
} }
// #ifdef OUTPUT_CAMERA_DBG_INFO // #ifdef OUTPUT_DBG_INFO
if (!cameraInfo.empty()) if (!cameraInfo.empty())
{ {
@ -3533,7 +3533,7 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vector<ID
// DrawOutlineText(ft2, mat, str, cv::Point(0, mat.rows - fs - 20 * ratio), fs, scalarWhite, 1); // DrawOutlineText(ft2, mat, str, cv::Point(0, mat.rows - fs - 20 * ratio), fs, scalarWhite, 1);
} }
} }
// #endif // OUTPUT_CAMERA_DBG_INFO // #endif // OUTPUT_DBG_INFO
for (vector<OSD_INFO>::const_iterator it = osds.cbegin(); it != osds.cend(); ++it) for (vector<OSD_INFO>::const_iterator it = osds.cbegin(); it != osds.cend(); ++it)
{ {

Loading…
Cancel
Save