|
|
|
@ -1530,28 +1530,20 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
|
|
|
|
|
|
|
|
|
|
bool res = false;
|
|
|
|
|
|
|
|
|
|
if (photoInfo.cameraType == CAM_TYPE_USB || photoInfo.cameraType == CAM_TYPE_NET)
|
|
|
|
|
std::shared_ptr<PowerControl> powerCtrlPtr;
|
|
|
|
|
|
|
|
|
|
if (photoInfo.cameraType == CAM_TYPE_MIPI)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setOtgState(true);
|
|
|
|
|
powerCtrlPtr = std::shared_ptr<PowerControl>(new CameraPowerCtrl(mPhotoInfo.closeDelayTime));
|
|
|
|
|
}
|
|
|
|
|
if (photoInfo.cameraType == CAM_TYPE_NET)
|
|
|
|
|
else if (photoInfo.cameraType == CAM_TYPE_USB)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::set12VEnable(true);
|
|
|
|
|
#ifdef USING_N938
|
|
|
|
|
GpioControl::TurnOn(CMD_SET_NETWORK_POWER_EN);
|
|
|
|
|
GpioControl::TurnOn(CMD_SET_PIC1_POWER);
|
|
|
|
|
GpioControl::TurnOn(CMD_SET_485_EN_STATE);
|
|
|
|
|
#else // USING_N938
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
GpioControl::TurnOn(CMD_SET_PTZ_PWR_ENABLE);
|
|
|
|
|
GpioControl::TurnOn(CMD_SET_100M_ENABLE);
|
|
|
|
|
GpioControl::TurnOn(CMD_SET_100M_SWITCH_PWR_ENABLE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // USING_PLZ
|
|
|
|
|
#endif // USING_N938
|
|
|
|
|
powerCtrlPtr = std::shared_ptr<PowerControl>(new UsbCameraPowerCtrl(mPhotoInfo.closeDelayTime));
|
|
|
|
|
}
|
|
|
|
|
else if (photoInfo.cameraType == CAM_TYPE_NET)
|
|
|
|
|
{
|
|
|
|
|
powerCtrlPtr = std::shared_ptr<PowerControl>(new NetCameraPowerCtrl(mPhotoInfo.closeDelayTime));
|
|
|
|
|
}
|
|
|
|
|
GpioControl::setCam3V3Enable(true);
|
|
|
|
|
|
|
|
|
|
res = true;
|
|
|
|
|
if ((mPhotoInfo.mediaType == 0) && ((mPhotoInfo.cameraType == CAM_TYPE_MIPI) || (mPhotoInfo.cameraType == CAM_TYPE_USB)))
|
|
|
|
@ -1609,6 +1601,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
|
|
|
|
|
// mCamera = new CJpegCamera(this, photoInfo.width, photoInfo.height, mPath, params);
|
|
|
|
|
if (mCamera->open(to_string(mPhotoInfo.cameraId)) == 0)
|
|
|
|
|
{
|
|
|
|
|
m_powerCtrlPtr = powerCtrlPtr;
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_DEBUG, "TP: Succeeded to OpenCamera CH=%u PR=%X PHOTOID=%u", (unsigned int)photoInfo.channel, (unsigned int)photoInfo.preset, photoInfo.photoId);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -1619,10 +1612,9 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
|
|
|
|
|
mCamera = NULL;
|
|
|
|
|
res = false;
|
|
|
|
|
|
|
|
|
|
GpioControl::setCam3V3Enable(false);
|
|
|
|
|
if (photoInfo.usbCamera)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setOtgState(false);
|
|
|
|
|
std::shared_ptr<PowerControl> empty;
|
|
|
|
|
empty.swap(powerCtrlPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (hasFatalError)
|
|
|
|
@ -1643,7 +1635,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
|
|
|
|
|
osds.swap(mOsds);
|
|
|
|
|
IDevice::PHOTO_INFO localPhotoInfo = mPhotoInfo;
|
|
|
|
|
|
|
|
|
|
std::thread t([localPhotoInfo, path, pThis, osds]() mutable
|
|
|
|
|
std::thread t([localPhotoInfo, path, pThis, osds, powerCtrlPtr]() mutable
|
|
|
|
|
{
|
|
|
|
|
// AutoEnv autoEnv(pThis->m_vm);
|
|
|
|
|
uint32_t waitTime = localPhotoInfo.selfTestingTime;
|
|
|
|
@ -1675,19 +1667,6 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
|
|
|
|
|
// timeout
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_ERROR, "Ethernet not existing CH=%u PR=%X PHOTOID=%u", (uint32_t)localPhotoInfo.channel, (uint32_t)localPhotoInfo.preset, localPhotoInfo.photoId);
|
|
|
|
|
pThis->TakePhotoCb(0, localPhotoInfo, "", 0);
|
|
|
|
|
|
|
|
|
|
GpioControl::setOtgState(false);
|
|
|
|
|
GpioControl::set12VEnable(false);
|
|
|
|
|
#ifdef USING_N938
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_NETWORK_POWER_EN);
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_PIC1_POWER);
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_485_EN_STATE);
|
|
|
|
|
#else // USING_N938
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_100M_ENABLE);
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_100M_SWITCH_PWR_ENABLE);
|
|
|
|
|
#endif
|
|
|
|
|
#endif // USING_N938
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -1715,19 +1694,6 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_ERROR, "Vendor(%u) not Supported CH=%u PR=%X PHOTOID=%u", (uint32_t)localPhotoInfo.vendor, (uint32_t)localPhotoInfo.channel, (unsigned int)localPhotoInfo.preset, localPhotoInfo.photoId);
|
|
|
|
|
pThis->TakePhotoCb(0, localPhotoInfo, "", 0);
|
|
|
|
|
|
|
|
|
|
GpioControl::setOtgState(false);
|
|
|
|
|
GpioControl::set12VEnable(false);
|
|
|
|
|
#ifdef USING_N938
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_NETWORK_POWER_EN);
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_PIC1_POWER);
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_485_EN_STATE);
|
|
|
|
|
#else // USING_N938
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_100M_ENABLE);
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_100M_SWITCH_PWR_ENABLE);
|
|
|
|
|
#endif // USING_PLZ
|
|
|
|
|
#endif // USING_N938
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1764,18 +1730,6 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GpioControl::setOtgState(false);
|
|
|
|
|
GpioControl::set12VEnable(false);
|
|
|
|
|
#ifdef USING_N938
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_NETWORK_POWER_EN);
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_PIC1_POWER);
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_485_EN_STATE);
|
|
|
|
|
#else // USING_N938
|
|
|
|
|
#ifdef USING_PLZ
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_100M_ENABLE);
|
|
|
|
|
GpioControl::TurnOff(CMD_SET_100M_SWITCH_PWR_ENABLE);
|
|
|
|
|
#endif // USING_PLZ
|
|
|
|
|
#endif
|
|
|
|
|
if (netCaptureResult)
|
|
|
|
|
{
|
|
|
|
|
time_t takingTime = time(NULL);
|
|
|
|
@ -2037,16 +1991,10 @@ void CPhoneDevice::CloseCamera2(CPhoneDevice::CPhoneCamera* camera, unsigned int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_DEBUG, "TP: Will Turn Off Power PHOTOID=%u", photoId);
|
|
|
|
|
if (cameraType == CAM_TYPE_NET)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::set12VEnable(false);
|
|
|
|
|
std::shared_ptr<PowerControl> empty;
|
|
|
|
|
empty.swap(m_powerCtrlPtr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cameraType == CAM_TYPE_USB || cameraType == CAM_TYPE_NET)
|
|
|
|
|
{
|
|
|
|
|
GpioControl::setOtgState(false);
|
|
|
|
|
}
|
|
|
|
|
GpioControl::setCam3V3Enable(false);
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_DEBUG, "TP: End Turn Off Power PHOTOID=%u", photoId);
|
|
|
|
|
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_DEBUG, "TP: CloseCamera PHOTOID=%u", photoId);
|
|
|
|
|