增加拍照日志

serial
BlueMatthew 1 year ago
parent fa8775add0
commit 882226ae7d

@ -760,7 +760,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
mCamera = NULL;
}
ALOGI("TAKE_PHOTO: CH=%u PR=%u PHOTOID=%u\n", (unsigned int)photoInfo.channel, (unsigned int)photoInfo.preset, photoInfo.photoId);
XYLOG(XYLOG_SEVERITY_INFO, "TAKE_PHOTO: CH=%u PR=%u PHOTOID=%u\n", (unsigned int)photoInfo.channel, (unsigned int)photoInfo.preset, photoInfo.photoId);
mPhotoInfo = photoInfo;
mPath = path;
mOsds = osds;
@ -797,9 +797,11 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
mCamera = new CPhoneCamera(this, photoInfo.width, photoInfo.height, params);
if (mCamera->open(to_string(mPhotoInfo.cameraId)) == 0)
{
XYLOG(XYLOG_SEVERITY_DEBUG, "TP: Succeeded to OpenCamera CH=%u PR=%u PHOTOID=%u\n", (unsigned int)photoInfo.channel, (unsigned int)photoInfo.preset, photoInfo.photoId);
}
else
{
XYLOG(XYLOG_SEVERITY_DEBUG, "TP: Failed to OpenCamera CH=%u PR=%u PHOTOID=%u\n", (unsigned int)photoInfo.channel, (unsigned int)photoInfo.preset, photoInfo.photoId);
delete mCamera;
mCamera = NULL;
res = false;
@ -831,8 +833,10 @@ bool CPhoneDevice::CloseCamera()
return true;
}
void CPhoneDevice::CloseCamera2(CPhoneDevice::CPhoneCamera* camera, bool turnOffOtg)
void CPhoneDevice::CloseCamera2(CPhoneDevice::CPhoneCamera* camera, unsigned int photoId, bool turnOffOtg)
{
XYLOG(XYLOG_SEVERITY_DEBUG, "TP: CloseCamera PHOTOID=%u", photoId);
// std::this_thread::sleep_for(std::chrono::milliseconds(16));
if (camera != NULL)
{
@ -1066,7 +1070,7 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat)
mCamera = NULL;
bool turnOffOtg = (mPhotoInfo.usbCamera != 0);
std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, turnOffOtg);
std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, turnOffOtg);
closeThread.detach();
return res;
@ -1086,7 +1090,7 @@ bool CPhoneDevice::OnVideoReady(bool result, const char* path, unsigned int phot
TakePhotoCb(result, mPhotoInfo, fullPath, time(NULL), objs);
bool turnOffOtg = (mPhotoInfo.usbCamera != 0);
std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, turnOffOtg);
std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, turnOffOtg);
closeThread.detach();
return result;
@ -1094,14 +1098,12 @@ bool CPhoneDevice::OnVideoReady(bool result, const char* path, unsigned int phot
void CPhoneDevice::onError(const std::string& msg)
{
// XFLOG(XFLOG_SEVERITY_ERROR, "Failed to Take Photo: %s", msg.c_str());
if (mCamera == NULL)
{
int aa = 0;
return;
}
ALOGE("Failed to Take Photo: %s", msg.c_str());
XYLOG(XYLOG_SEVERITY_ERROR, "Failed to Take Photo (IMGID=%u): %s", mPhotoInfo.photoId, msg.c_str());
CPhoneCamera* pCamera = mCamera;
mCamera = NULL;
@ -1109,7 +1111,7 @@ void CPhoneDevice::onError(const std::string& msg)
TakePhotoCb(false, mPhotoInfo, mPath, 0);
bool turnOffOtg = (mPhotoInfo.usbCamera != 0);
std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, turnOffOtg);
std::thread closeThread(&CPhoneDevice::CloseCamera2, this, pCamera, mPhotoInfo.photoId, turnOffOtg);
closeThread.detach();
}

@ -232,7 +232,7 @@ protected:
bool OnImageReady(cv::Mat& mat);
void onError(const std::string& msg);
void CloseCamera2(CPhoneCamera* camera, bool turnOffOtg);
void CloseCamera2(CPhoneCamera* camera, unsigned int photoId, bool turnOffOtg);
void TurnOnCameraPower(JNIEnv* env);
void TurnOffCameraPower(JNIEnv* env);

Loading…
Cancel
Save