diff --git a/app/src/main/cpp/MicroPhoto.cpp b/app/src/main/cpp/MicroPhoto.cpp index 73e1c3c5..1e902041 100644 --- a/app/src/main/cpp/MicroPhoto.cpp +++ b/app/src/main/cpp/MicroPhoto.cpp @@ -1462,4 +1462,17 @@ Java_com_xypower_mpapp_MicroPhotoService_getCustomAppId(JNIEnv *env, jobject thi #else return 0; #endif -} \ No newline at end of file +} + +extern "C" JNIEXPORT void JNICALL +Java_com_xypower_mpapp_MicroPhotoService_sendCameraCtrl( + JNIEnv* env, jobject pThis, jlong handle, jint channel, jint preset, jint cmd) { + + CTerminal* pTerminal = reinterpret_cast(handle); + if (pTerminal == NULL) + { + return; + } + + pTerminal->SendCameraCtrl(channel, preset, cmd); +} diff --git a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java index bf0634b3..3e0ecf03 100644 --- a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java +++ b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java @@ -128,6 +128,9 @@ public class MicroPhotoService extends Service { private static final String ACTION_IMP_PUBKRY = "com.xypower.mpapp.ACT_IMP_PUBKEY"; private static final String ACTION_TAKE_PHOTO_MANUALLY = "com.xypower.mpapp.ACT_TP_M"; + + private static final String ACTION_CAMERA_CTRL = "com.xypower.mpapp.ACT_CAM_CTRL"; + private static final String ACTION_HEARTBEAT_MANUALLY = "com.xypower.mpapp.ACT_HB_M"; private static final String ACTION_UPDATE_CONFIGS = "com.xypower.mpapp.ACT_UPD_CFG"; public static final String ACTION_VIDEO_FINISHED = "com.xypower.mpapp.ACT_V_FINISHED"; @@ -325,6 +328,7 @@ public class MicroPhotoService extends Service { intentFilter.addAction(ACTION_UPDATE_CONFIGS); intentFilter.addAction(ACTION_IMP_PUBKRY); intentFilter.addAction(ACTION_TAKE_PHOTO_MANUALLY); + intentFilter.addAction(ACTION_CAMERA_CTRL); intentFilter.addAction(ACTION_HEARTBEAT_MANUALLY); intentFilter.addAction(ACTION_GPS_TIMEOUT); intentFilter.addAction(ACTION_RESTART); @@ -559,6 +563,11 @@ public class MicroPhotoService extends Service { Log.i(TAG, "Take Photo CH=" + channel + " PR=" + preset + " Mannually"); mService.notifyToTakePhoto(mService.mNativeHandle, channel, preset, 0, url, mediaType); + } else if (TextUtils.equals(ACTION_CAMERA_CTRL, action)) { + int channel = intent.getIntExtra("channel", 0); + int preset = intent.getIntExtra("preset", 0); + int cmd = intent.getIntExtra("cmd", 0); + mService.sendCameraCtrl(mService.mNativeHandle, channel, preset, cmd); } else if (TextUtils.equals(ACTION_UPDATE_CONFIGS, action)) { int restart = intent.getIntExtra("restart", 0); Log.i(TAG, "UPD CFG Fired ACTION=" + action + " restart=" + restart); @@ -1635,6 +1644,9 @@ cellSignalStrengthGsm.getDbm(); protected native void burstCaptureFinished(long handler, boolean result, int numberOfCaptures, String pathsJoinedByTab, boolean frontCamera, int rotation, long photoId); public static native long takePhoto(int channel, int preset, boolean photoOrVideo, String configFilePath, String path); + + protected native void sendCameraCtrl(long handler, int channel, int preset, int cmd); + public static native void releaseDeviceHandle(long deviceHandle); public static native boolean sendExternalPhoto(long deviceHandle, String path, long photoInfo); public static native void infoLog(String log);