基于安装工具调整接口和实现

hdrplus
Matthew 12 months ago
parent 97f031a55f
commit 03aabf66d5

@ -373,7 +373,8 @@ Java_com_xypower_mpapp_MicroPhotoService_notifyToTakePhoto(
extern "C" JNIEXPORT jlong JNICALL extern "C" JNIEXPORT jlong JNICALL
Java_com_xypower_mpapp_MicroPhotoService_takePhoto( Java_com_xypower_mpapp_MicroPhotoService_takePhoto(
JNIEnv* env, JNIEnv* env,
jclass cls, jint channel, jint preset, jint cameraId, jboolean usb, jstring path) { jclass cls, jint channel, jint preset, jint cameraId, jboolean usb, jstring path,
jstring leftTopOsd, jstring rightTopOsd, jstring rightBottomOsd, jstring leftBottomOsd) {
if (channel < 1 || channel > 0xFF) if (channel < 1 || channel > 0xFF)
{ {
@ -412,10 +413,10 @@ Java_com_xypower_mpapp_MicroPhotoService_takePhoto(
osds[2].alignment = IDevice::OSD_ALIGNMENT_BOTTOM_RIGHT; osds[2].alignment = IDevice::OSD_ALIGNMENT_BOTTOM_RIGHT;
osds[3].alignment = IDevice::OSD_ALIGNMENT_BOTTOM_LEFT; osds[3].alignment = IDevice::OSD_ALIGNMENT_BOTTOM_LEFT;
osds[0].text = FormatLocalDateTime(); osds[0].text = jstring2string(env, leftTopOsd);
#ifdef OUTPUT_CAMERA_DBG_INFO osds[1].text = jstring2string(env, rightTopOsd);
// osds[1].text = "V: %%V%%"; osds[2].text = jstring2string(env, rightBottomOsd);
#endif osds[3].text = jstring2string(env, leftBottomOsd);
const char* pathStr = env->GetStringUTFChars(path, 0); const char* pathStr = env->GetStringUTFChars(path, 0);

@ -95,6 +95,11 @@ public class BridgeActivity extends AppCompatActivity {
boolean usb = intent.getBooleanExtra("usb", false); boolean usb = intent.getBooleanExtra("usb", false);
int cameraId = intent.getIntExtra("cameraId", -1); int cameraId = intent.getIntExtra("cameraId", -1);
String leftTopOsd = intent.getStringExtra("leftTopOsd");
String rightTopOsd = intent.getStringExtra("rightTopOsd");
String rightBottomOsd = intent.getStringExtra("rightBottomOsd");
String leftBottomOsd = intent.getStringExtra("leftBottomOsd");
File file = new File(path); File file = new File(path);
if (file.exists()) { if (file.exists()) {
file.delete(); file.delete();
@ -102,7 +107,7 @@ public class BridgeActivity extends AppCompatActivity {
FileUtils.ensureParentDirectoryExisted(path); FileUtils.ensureParentDirectoryExisted(path);
} }
MicroPhotoService.takePhoto(channel, preset, cameraId, usb, path); MicroPhotoService.takePhoto(channel, preset, cameraId, usb, path, leftTopOsd, rightTopOsd, rightBottomOsd, leftBottomOsd);
} else if (TextUtils.equals(action, ACTION_RECORDING)) { } else if (TextUtils.equals(action, ACTION_RECORDING)) {
String path = intent.getStringExtra("path"); String path = intent.getStringExtra("path");
@ -136,6 +141,7 @@ public class BridgeActivity extends AppCompatActivity {
} }
} }
if (mAutoClose) {
final Activity activity = this; final Activity activity = this;
mHandler.postDelayed(new Runnable() { mHandler.postDelayed(new Runnable() {
@Override @Override
@ -144,6 +150,7 @@ public class BridgeActivity extends AppCompatActivity {
} }
}, 2000); }, 2000);
} }
}
@Override @Override
protected void onDestroy() { protected void onDestroy() {
@ -159,7 +166,7 @@ public class BridgeActivity extends AppCompatActivity {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_RECORDING) { if (requestCode == REQUEST_CODE_RECORDING) {
if (mVideoFilePath != null) { if (mVideoFilePath != null && data != null) {
String path = data.getStringExtra("path"); String path = data.getStringExtra("path");
if (path != null) { if (path != null) {
File file = new File(path); File file = new File(path);

@ -582,7 +582,11 @@ public class MainActivity extends AppCompatActivity {
photoFile.delete(); photoFile.delete();
} }
MicroPhotoService.takePhoto(channel, preset, channel - 1, (channel == 4), photoFile.getAbsolutePath()); SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date dt = new Date();
String leftTopOsd = simpleDateFormat2.format(dt);
MicroPhotoService.takePhoto(channel, preset, channel - 1, (channel == 4), photoFile.getAbsolutePath(), leftTopOsd, null, null, null);
} else { } else {
MicroPhotoService.takePhoto(this.getApplicationContext(), channel, preset, photoOrVideo); MicroPhotoService.takePhoto(this.getApplicationContext(), channel, preset, photoOrVideo);
} }

@ -484,6 +484,8 @@ public class MicroPhotoService extends Service {
Intent intent = makeRecordingIntent(context, cameraId, videoId, duration, width, height, quality, orientation, Intent intent = makeRecordingIntent(context, cameraId, videoId, duration, width, height, quality, orientation,
leftTopOsd, rightTopOsd, rightBottomOsd, leftBottomOsd); leftTopOsd, rightTopOsd, rightBottomOsd, leftBottomOsd);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
} }
@ -503,7 +505,7 @@ public class MicroPhotoService extends Service {
intent.putExtra("rightBottomOsd", rightBottomOsd); intent.putExtra("rightBottomOsd", rightBottomOsd);
intent.putExtra("leftBottomOsd", leftBottomOsd); intent.putExtra("leftBottomOsd", leftBottomOsd);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return intent; return intent;
} }
@ -1159,7 +1161,7 @@ cellSignalStrengthGsm.getDbm();
protected native void updatePosition(long handler, double lon, double lat, double radius, long ts); protected native void updatePosition(long handler, double lon, double lat, double radius, long ts);
protected native boolean uninit(long handler); protected native boolean uninit(long handler);
protected native void recordingFinished(long handler, boolean result, String path, long videoId); protected native void recordingFinished(long handler, boolean result, String path, long videoId);
public static native long takePhoto(int channel, int preset, int cameraId, boolean usb, String path); public static native long takePhoto(int channel, int preset, int cameraId, boolean usb, String path, String leftTopOsd, String rightTopOsd, String rightBottomOsd, String leftBottomOsd);
public static native void releaseDeviceHandle(long deviceHandle); public static native void releaseDeviceHandle(long deviceHandle);
public static native void infoLog(String log); public static native void infoLog(String log);
public static native void setOtgState(boolean enabled); public static native void setOtgState(boolean enabled);

@ -845,7 +845,7 @@ public class Camera2VideoActivity extends AppCompatActivity {
// intent.setComponent(new ComponentName(packageName, receiverName)); // intent.setComponent(new ComponentName(packageName, receiverName));
if (mActivityResult) { if (mActivityResult) {
setResult(REQUEST_CODE_RECORDING, intent); setResult(RESULT_OK, intent);
} else { } else {
// Log.i(TAG, "Notify recording videoId=" + Long.toString(mVideoId) + " " + path); // Log.i(TAG, "Notify recording videoId=" + Long.toString(mVideoId) + " " + path);
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(getApplicationContext()); LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(getApplicationContext());

Loading…
Cancel
Save