调整本地照片命名

serial
Matthew 2 years ago
parent c04fa1acbd
commit dd10d364cd

@ -117,7 +117,7 @@ Java_com_xypower_mpapp_MicroPhotoService_init(
device->SetListener(pTerminal);
pTerminal->InitServerInfo(appPathStr, cmdidStr, ipStr, port, udpOrTcp);
pTerminal->SetPacketSize(1 * 1024); // 1K
// pTerminal->SetPacketSize(1 * 1024); // 1K
bool res = pTerminal->Startup(device);
env->ReleaseStringUTFChars(appPath, appPathStr);

@ -19,6 +19,7 @@
#define LOG_TAG "CameraTestHelpers"
#include <AndroidHelper.h>
#include "PhoneDevice.h"
#include <Client/Terminal.h>
#include <Utils.h>
#include <opencv2/opencv.hpp>
@ -552,7 +553,7 @@ IDevice::timer_uid_t CPhoneDevice::RegisterHeartbeat(unsigned int timerType, uns
return uid;
}
bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<OSD_INFO>& osds, const string& path)
bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<OSD_INFO>& osds, const std::string& path)
{
if (mCamera != NULL)
{
@ -599,6 +600,7 @@ void CPhoneDevice::CloseCamera2(CPhoneDevice::CPhoneCamera* camera)
bool CPhoneDevice::OnImageReady(const cv::Mat& mat)
{
mPhotoInfo.photoTime = time(NULL);
int baseline = 0;
cv::Size textSize, textSize2;
double fontScale = 1; // base 1024
@ -651,18 +653,19 @@ bool CPhoneDevice::OnImageReady(const cv::Mat& mat)
compression_params.push_back(mPhotoInfo.quality);
bool res = false;
if (!std::filesystem::exists(std::filesystem::path(mPath)))
std::string fullPath = mPath + CTerminal::BuildPhotoFileName(mPhotoInfo);
if (!std::filesystem::exists(std::filesystem::path(fullPath)))
{
bool res = cv::imwrite(mPath.c_str(), mat, compression_params);
bool res = cv::imwrite(fullPath.c_str(), mat, compression_params);
if (!res)
{
ALOGE("Failed to write photo: %s", mPath.c_str());
ALOGE("Failed to write photo: %s", fullPath.c_str());
}
else
{
ALOGI("Succeeded to write photo: %s", mPath.c_str());
ALOGI("Succeeded to write photo: %s", fullPath.c_str());
}
TakePhotoCb(res, mPhotoInfo, mPath, time(NULL));
TakePhotoCb(res, mPhotoInfo, fullPath, time(NULL));
}
else
{

@ -50,7 +50,7 @@ public:
virtual bool EnableGPS(bool enabled);
virtual bool RequestPosition();
virtual timer_uid_t RegisterHeartbeat(unsigned int timerType, unsigned int timeout);
virtual bool TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<OSD_INFO>& osds, const string& path);
virtual bool TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<OSD_INFO>& osds, const std::string& path);
virtual bool CloseCamera();
virtual timer_uid_t RegisterTimer(unsigned int timerType, unsigned int timeout, unsigned long times = 0);
virtual bool UnregisterTimer(timer_uid_t uid);
@ -113,7 +113,6 @@ protected:
atomic_ulong m_wakelockIdFeed;
std::map<IDevice::timer_uid_t, unsigned long> mTimers;
mutable CPhoneCamera* mCamera;
time_t mHeartbeatStartTime;

Loading…
Cancel
Save