|
|
@ -168,8 +168,6 @@ CPhoneDevice::CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPa
|
|
|
|
m_signalLevel = 0;
|
|
|
|
m_signalLevel = 0;
|
|
|
|
m_signalLevelUpdateTime = time(NULL);
|
|
|
|
m_signalLevelUpdateTime = time(NULL);
|
|
|
|
|
|
|
|
|
|
|
|
m_sysApiClass = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RegisterHandlerForSignal(SIGUSR2);
|
|
|
|
RegisterHandlerForSignal(SIGUSR2);
|
|
|
|
|
|
|
|
|
|
|
|
m_vm = vm;
|
|
|
|
m_vm = vm;
|
|
|
@ -199,16 +197,6 @@ CPhoneDevice::CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPa
|
|
|
|
|
|
|
|
|
|
|
|
env->DeleteLocalRef(classService);
|
|
|
|
env->DeleteLocalRef(classService);
|
|
|
|
|
|
|
|
|
|
|
|
jclass classSysApi = env->FindClass("com/dev/devapi/api/SysApi");
|
|
|
|
|
|
|
|
if(classSysApi != NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_sysApiClass = (jclass)env->NewGlobalRef(classSysApi);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mTurnOtgMid = env->GetStaticMethodID(classSysApi, "setOtgState", "(Z)V");
|
|
|
|
|
|
|
|
mSetCam3V3EnableMid = env->GetStaticMethodID(classSysApi, "setCam3V3Enable", "(Z)V");
|
|
|
|
|
|
|
|
env->DeleteLocalRef(classSysApi);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (didAttachThread)
|
|
|
|
if (didAttachThread)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
vm->DetachCurrentThread();
|
|
|
|
vm->DetachCurrentThread();
|
|
|
@ -237,16 +225,11 @@ CPhoneDevice::~CPhoneDevice()
|
|
|
|
ALOGE("Failed to get JNI Env");
|
|
|
|
ALOGE("Failed to get JNI Env");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
env->DeleteGlobalRef(m_javaService);
|
|
|
|
env->DeleteGlobalRef(m_javaService);
|
|
|
|
if (m_sysApiClass != NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
env->DeleteGlobalRef(m_sysApiClass);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (didAttachThread)
|
|
|
|
if (didAttachThread)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_vm->DetachCurrentThread();
|
|
|
|
m_vm->DetachCurrentThread();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_javaService = NULL;
|
|
|
|
m_javaService = NULL;
|
|
|
|
m_sysApiClass = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m_pRecognizationCfg != NULL)
|
|
|
|
if (m_pRecognizationCfg != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -326,13 +309,13 @@ bool CPhoneDevice::UpdateSchedules()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (ret == JNI_TRUE);
|
|
|
|
return (ret == JNI_TRUE);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& properties)
|
|
|
|
bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& properties)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char value[PROP_VALUE_MAX] = { 0 };
|
|
|
|
char value[PROP_VALUE_MAX] = { 0 };
|
|
|
|
std::map<std::string, std::string> powerInfo;
|
|
|
|
std::map<std::string, std::string> powerInfo;
|
|
|
|
|
|
|
|
int res = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (std::map<std::string, std::string>::iterator it = properties.begin(); it != properties.end(); ++it)
|
|
|
|
for (std::map<std::string, std::string>::iterator it = properties.begin(); it != properties.end(); ++it)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -558,8 +541,6 @@ bool CPhoneDevice::InstallAPP(const std::string& path, unsigned int delayedTime)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CPhoneDevice::Reboot(int resetType)
|
|
|
|
bool CPhoneDevice::Reboot(int resetType)
|
|
|
@ -607,6 +588,45 @@ bool CPhoneDevice::EnableGPS(bool enabled)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float CPhoneDevice::QueryBattaryVoltage(int timesForAvg, bool* isCharging)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (timesForAvg <= 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 0.0f;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int val = 0;
|
|
|
|
|
|
|
|
int totalVals = 0;
|
|
|
|
|
|
|
|
float chargingBusVoltage = 0.0f;
|
|
|
|
|
|
|
|
for (int idx = 0; idx < timesForAvg; )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
val = GpioControl::getChargingBusVoltage();
|
|
|
|
|
|
|
|
if (val > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
chargingBusVoltage = (float)val / 1000.0;
|
|
|
|
|
|
|
|
idx++;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isCharging != NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
*isCharging = chargingBusVoltage > 10.0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int idx = 0; idx < timesForAvg; )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
val = GpioControl::getBatteryVoltage(); // // BatVol
|
|
|
|
|
|
|
|
if (val > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
totalVals += val > BATTARY_VOLTAGE_MAX ? BATTARY_VOLTAGE_MAX : val;
|
|
|
|
|
|
|
|
idx++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (float)totalVals / 1000.0 / timesForAvg;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CPhoneDevice::RequestPosition()
|
|
|
|
bool CPhoneDevice::RequestPosition()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
JNIEnv* env = NULL;
|
|
|
|
JNIEnv* env = NULL;
|
|
|
@ -858,8 +878,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
|
|
|
|
mOsds = osds;
|
|
|
|
mOsds = osds;
|
|
|
|
|
|
|
|
|
|
|
|
NdkCamera::CAMERA_PARAMS params;
|
|
|
|
NdkCamera::CAMERA_PARAMS params;
|
|
|
|
params.hdrMode = mPhotoInfo.hdrMode;
|
|
|
|
params.sceneMode = mPhotoInfo.sceneMode;
|
|
|
|
params.nightMode = mPhotoInfo.nightMode;
|
|
|
|
|
|
|
|
params.autoFocus = mPhotoInfo.autoFocus;
|
|
|
|
params.autoFocus = mPhotoInfo.autoFocus;
|
|
|
|
params.autoExposure = mPhotoInfo.autoExposure;
|
|
|
|
params.autoExposure = mPhotoInfo.autoExposure;
|
|
|
|
params.focusTimeout = mPhotoInfo.focusTimeout * 1000;
|
|
|
|
params.focusTimeout = mPhotoInfo.focusTimeout * 1000;
|
|
|
@ -1158,7 +1177,7 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat)
|
|
|
|
unsigned int extime = (captureResult.exposureTime >= 1000000) ? ((unsigned int)(captureResult.exposureTime / 1000000)) : ((unsigned int)(captureResult.exposureTime / 1000));
|
|
|
|
unsigned int extime = (captureResult.exposureTime >= 1000000) ? ((unsigned int)(captureResult.exposureTime / 1000000)) : ((unsigned int)(captureResult.exposureTime / 1000));
|
|
|
|
strcpy(extimeunit, (captureResult.exposureTime >= 1000000) ? "ms" : "ns");
|
|
|
|
strcpy(extimeunit, (captureResult.exposureTime >= 1000000) ? "ms" : "ns");
|
|
|
|
char str[128] = { 0 };
|
|
|
|
char str[128] = { 0 };
|
|
|
|
snprintf(str, sizeof(str), "AE=%u EXPS=%u%s ISO=%d AF=%u LDR=%d AFS=%u AES=%u HDR=%d AWB=%u", captureResult.autoExposure,
|
|
|
|
snprintf(str, sizeof(str), "AE=%u EXPS=%u%s ISO=%d AF=%u LDR=%d AFS=%u AES=%u SCENE=%d AWB=%u", captureResult.autoExposure,
|
|
|
|
extime, extimeunit,
|
|
|
|
extime, extimeunit,
|
|
|
|
captureResult.sensitibity,
|
|
|
|
captureResult.sensitibity,
|
|
|
|
captureResult.autoFocus,
|
|
|
|
captureResult.autoFocus,
|
|
|
@ -1166,7 +1185,7 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat)
|
|
|
|
GpioControl::getLightAdc(),
|
|
|
|
GpioControl::getLightAdc(),
|
|
|
|
(unsigned int)captureResult.afState,
|
|
|
|
(unsigned int)captureResult.afState,
|
|
|
|
(unsigned int)captureResult.aeState,
|
|
|
|
(unsigned int)captureResult.aeState,
|
|
|
|
captureResult.hdrMode,
|
|
|
|
captureResult.sceneMode,
|
|
|
|
captureResult.awbState);
|
|
|
|
captureResult.awbState);
|
|
|
|
// cv::putText(mat, str, cv::Point(0, mat.rows - 20), cv::FONT_HERSHEY_COMPLEX, fontScale, scalar, thickness1, cv::LINE_AA);
|
|
|
|
// cv::putText(mat, str, cv::Point(0, mat.rows - 20), cv::FONT_HERSHEY_COMPLEX, fontScale, scalar, thickness1, cv::LINE_AA);
|
|
|
|
|
|
|
|
|
|
|
|