|
|
|
@ -369,6 +369,65 @@ Java_com_xypower_mpapp_MicroPhotoService_notifyToTakePhoto(
|
|
|
|
|
return JNI_TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" JNIEXPORT jlong JNICALL
|
|
|
|
|
Java_com_xypower_mpapp_MicroPhotoService_takePhoto(
|
|
|
|
|
JNIEnv* env,
|
|
|
|
|
jclass cls, jint channel, jint preset, jint cameraId, jboolean usb, jstring path) {
|
|
|
|
|
|
|
|
|
|
if (channel < 1 || channel > 0xFF)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JavaVM* vm = NULL;
|
|
|
|
|
jint ret = env->GetJavaVM(&vm);
|
|
|
|
|
|
|
|
|
|
CPhoneDevice* device = new CPhoneDevice(vm, NULL, "", NETID_UNSET, 0);
|
|
|
|
|
// device->SetListener(pTerminal);
|
|
|
|
|
|
|
|
|
|
if (usb == JNI_TRUE)
|
|
|
|
|
{
|
|
|
|
|
device->TurnOnOtg(NULL);
|
|
|
|
|
}
|
|
|
|
|
device->TurnOnCameraPower(NULL);
|
|
|
|
|
|
|
|
|
|
int32_t width = 1920;
|
|
|
|
|
int32_t height = 1080;
|
|
|
|
|
NdkCamera::CAMERA_PARAMS params = { 0 };
|
|
|
|
|
|
|
|
|
|
NdkCamera camera(0, 0, params);
|
|
|
|
|
int res = camera.selfTest(std::to_string(cameraId), width, height);
|
|
|
|
|
|
|
|
|
|
// const IDevice::PHOTO_INFO& photoInfo, const vector<OSD_INFO>& osds, const std::string& path
|
|
|
|
|
IDevice::PHOTO_INFO photoInfo(channel, preset);
|
|
|
|
|
photoInfo.usbCamera = (usb == JNI_TRUE) ? 1 : 0;
|
|
|
|
|
photoInfo.width = width;
|
|
|
|
|
photoInfo.height = height;
|
|
|
|
|
photoInfo.cameraId = cameraId;
|
|
|
|
|
|
|
|
|
|
std::vector<IDevice::OSD_INFO> osds;
|
|
|
|
|
|
|
|
|
|
const char* pathStr = env->GetStringUTFChars(path, 0);
|
|
|
|
|
|
|
|
|
|
device->TakePhoto(photoInfo, osds, MakeString(pathStr));
|
|
|
|
|
|
|
|
|
|
env->ReleaseStringUTFChars(path, pathStr);
|
|
|
|
|
|
|
|
|
|
return reinterpret_cast<jlong>(device);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern "C" JNIEXPORT void JNICALL
|
|
|
|
|
Java_com_xypower_mpapp_MicroPhotoService_releaseDeviceHandle(
|
|
|
|
|
JNIEnv* env,
|
|
|
|
|
jclass cls, jlong deviceHandle) {
|
|
|
|
|
if (deviceHandle != 0)
|
|
|
|
|
{
|
|
|
|
|
CPhoneDevice* pDevice = reinterpret_cast<CPhoneDevice*>(deviceHandle);
|
|
|
|
|
delete pDevice;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern "C" JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_com_xypower_mpapp_MicroPhotoService_sendHeartbeat(
|
|
|
|
|
JNIEnv* env,
|
|
|
|
|