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

hdrplus
Matthew 12 months ago
parent 97f031a55f
commit 03aabf66d5

@ -373,7 +373,8 @@ Java_com_xypower_mpapp_MicroPhotoService_notifyToTakePhoto(
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) {
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)
{
@ -412,10 +413,10 @@ Java_com_xypower_mpapp_MicroPhotoService_takePhoto(
osds[2].alignment = IDevice::OSD_ALIGNMENT_BOTTOM_RIGHT;
osds[3].alignment = IDevice::OSD_ALIGNMENT_BOTTOM_LEFT;
osds[0].text = FormatLocalDateTime();
#ifdef OUTPUT_CAMERA_DBG_INFO
// osds[1].text = "V: %%V%%";
#endif
osds[0].text = jstring2string(env, leftTopOsd);
osds[1].text = jstring2string(env, rightTopOsd);
osds[2].text = jstring2string(env, rightBottomOsd);
osds[3].text = jstring2string(env, leftBottomOsd);
const char* pathStr = env->GetStringUTFChars(path, 0);

@ -95,6 +95,11 @@ public class BridgeActivity extends AppCompatActivity {
boolean usb = intent.getBooleanExtra("usb", false);
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);
if (file.exists()) {
file.delete();
@ -102,7 +107,7 @@ public class BridgeActivity extends AppCompatActivity {
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)) {
String path = intent.getStringExtra("path");
@ -136,13 +141,15 @@ public class BridgeActivity extends AppCompatActivity {
}
}
final Activity activity = this;
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
activity.finish();
}
}, 2000);
if (mAutoClose) {
final Activity activity = this;
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
activity.finish();
}
}, 2000);
}
}
@Override
@ -159,7 +166,7 @@ public class BridgeActivity extends AppCompatActivity {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_RECORDING) {
if (mVideoFilePath != null) {
if (mVideoFilePath != null && data != null) {
String path = data.getStringExtra("path");
if (path != null) {
File file = new File(path);

@ -582,7 +582,11 @@ public class MainActivity extends AppCompatActivity {
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 {
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,
leftTopOsd, rightTopOsd, rightBottomOsd, leftBottomOsd);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
@ -503,7 +505,7 @@ public class MicroPhotoService extends Service {
intent.putExtra("rightBottomOsd", rightBottomOsd);
intent.putExtra("leftBottomOsd", leftBottomOsd);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return intent;
}
@ -1159,7 +1161,7 @@ cellSignalStrengthGsm.getDbm();
protected native void updatePosition(long handler, double lon, double lat, double radius, long ts);
protected native boolean uninit(long handler);
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 infoLog(String log);
public static native void setOtgState(boolean enabled);

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

Loading…
Cancel
Save