2026-01-30 11:47:32 +08:00
|
|
|
|
package com.aros.apron.manager;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.aros.apron.tools.Utils.getIDJIErrorMsg;
|
|
|
|
|
|
import static dji.sdk.keyvalue.key.KeyTools.createKey;
|
|
|
|
|
|
|
|
|
|
|
|
import android.os.Handler;
|
2026-02-10 20:46:40 +08:00
|
|
|
|
import android.os.Looper;
|
|
|
|
|
|
import android.util.Log;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
|
|
|
|
|
|
|
import com.aros.apron.base.BaseManager;
|
|
|
|
|
|
import com.aros.apron.entity.MessageDown;
|
|
|
|
|
|
import com.aros.apron.entity.Movement;
|
|
|
|
|
|
import com.aros.apron.tools.LogUtil;
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
|
|
|
|
|
|
|
import dji.sdk.keyvalue.key.CameraKey;
|
2026-03-12 14:57:34 +08:00
|
|
|
|
import dji.sdk.keyvalue.key.FlightControllerKey;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
import dji.sdk.keyvalue.key.KeyTools;
|
|
|
|
|
|
import dji.sdk.keyvalue.key.ProductKey;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraExposureCompensation;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraExposureMode;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraFocusMode;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraFocusState;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraISO;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraMode;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraShutterSpeed;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraStorageInfo;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraStorageInfos;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraStorageLocation;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraThermalPalette;
|
2026-02-10 20:46:40 +08:00
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraType;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
import dji.sdk.keyvalue.value.camera.CameraVideoStreamSourceType;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.LaserMeasureInformation;
|
2026-02-10 20:46:40 +08:00
|
|
|
|
import dji.sdk.keyvalue.value.camera.PanoramaExitStatus;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.PhotoPanoStichingState;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
import dji.sdk.keyvalue.value.camera.PhotoState;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.RecordingState;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.TapZoomMode;
|
2026-02-10 20:46:40 +08:00
|
|
|
|
import dji.sdk.keyvalue.value.camera.ThermalDigitalZoomFactor;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
import dji.sdk.keyvalue.value.camera.ThermalDisplayMode;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.ThermalGainMode;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.ThermalTemperatureMeasureMode;
|
2026-02-10 20:46:40 +08:00
|
|
|
|
import dji.sdk.keyvalue.value.camera.VideoRecordingStatus;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.camera.VisionPhotoPanoramaMissionState;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
import dji.sdk.keyvalue.value.camera.ZoomTargetPointInfo;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.common.CameraLensType;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.common.ComponentIndexType;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.common.DoublePoint2D;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.common.EmptyMsg;
|
|
|
|
|
|
import dji.sdk.keyvalue.value.product.ProductType;
|
|
|
|
|
|
import dji.v5.common.callback.CommonCallbacks;
|
|
|
|
|
|
import dji.v5.common.error.IDJIError;
|
|
|
|
|
|
import dji.v5.manager.KeyManager;
|
|
|
|
|
|
|
|
|
|
|
|
public class CameraManager extends BaseManager {
|
2026-02-10 20:46:40 +08:00
|
|
|
|
private Handler panoHandler = new Handler(Looper.getMainLooper());
|
|
|
|
|
|
private Runnable panoRunnable;
|
|
|
|
|
|
private boolean isPanoRunning = false;
|
|
|
|
|
|
private static final long INTERVAL = 1000; // 1秒
|
|
|
|
|
|
private void startReport() {
|
|
|
|
|
|
if (isPanoRunning) return; // 已开启则忽略
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
isPanoRunning = true;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
panoRunnable = new Runnable() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
if (!isPanoRunning) return;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
sendCameraPhotoTakeProgress2Server(); // 你的方法
|
|
|
|
|
|
|
|
|
|
|
|
panoHandler.postDelayed(this, INTERVAL); // 1秒后循环
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
panoHandler.post(panoRunnable); // 立即执行
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
private void stopReport() {
|
|
|
|
|
|
if (!isPanoRunning) return;
|
|
|
|
|
|
|
|
|
|
|
|
isPanoRunning = false;
|
|
|
|
|
|
panoHandler.removeCallbacks(panoRunnable);
|
|
|
|
|
|
|
|
|
|
|
|
sendCameraPhotoTakeProgress2Server(); // 最后报一次
|
2026-04-08 13:43:50 +08:00
|
|
|
|
Movement.getInstance().setMode_code(3);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private CameraManager() {
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static class CameraHolder {
|
|
|
|
|
|
private static final CameraManager INSTANCE = new CameraManager();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static CameraManager getInstance() {
|
|
|
|
|
|
return CameraHolder.INSTANCE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void initCameraInfo() {
|
2026-03-12 14:57:34 +08:00
|
|
|
|
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(createKey(FlightControllerKey.KeyConnection));
|
|
|
|
|
|
LogUtil.log(TAG,"isConnect"+isConnect);
|
2026-02-10 20:46:40 +08:00
|
|
|
|
if (isConnect != null && isConnect) {
|
|
|
|
|
|
//全局画面中测量的最高温度
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalGlobalMinTemperature,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), this, new CommonCallbacks.KeyListener<Double>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Double aDouble, @Nullable Double t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setThermal_global_temperature_min(t1);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//全景任务状态
|
|
|
|
|
|
KeyManager.getInstance().listen(createKey(CameraKey.KeyVisionPhotoPanoramaMissionState, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<VisionPhotoPanoramaMissionState>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable VisionPhotoPanoramaMissionState visionPhotoPanoramaMissionState, @Nullable VisionPhotoPanoramaMissionState t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
if (t1 == VisionPhotoPanoramaMissionState.IDLE) {
|
|
|
|
|
|
Movement.getInstance().setPhoto_current_step(3000);
|
|
|
|
|
|
} else if (t1 == VisionPhotoPanoramaMissionState.RELEASE) {
|
|
|
|
|
|
// Movement.getInstance().setPhoto_result(0);
|
|
|
|
|
|
// Movement.getInstance().setPhoto_status("ok");
|
|
|
|
|
|
// Movement.getInstance().setCameraMode(3);
|
|
|
|
|
|
// stopReport();
|
|
|
|
|
|
} else if (t1 == VisionPhotoPanoramaMissionState.RUNNING) {
|
|
|
|
|
|
Movement.getInstance().setPhoto_status("in_progress");
|
|
|
|
|
|
Movement.getInstance().setPhoto_current_step(3002);
|
|
|
|
|
|
} else if (t1 == VisionPhotoPanoramaMissionState.UNKNOWN) {
|
|
|
|
|
|
// Movement.getInstance().setPhoto_result(1);
|
|
|
|
|
|
// Movement.getInstance().setPhoto_current_step(3000);
|
|
|
|
|
|
// Movement.getInstance().setPhoto_status("fail");
|
|
|
|
|
|
} else if (t1 == VisionPhotoPanoramaMissionState.PROCESSING) {
|
|
|
|
|
|
Movement.getInstance().setPhoto_current_step(3005);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-04-08 13:43:50 +08:00
|
|
|
|
// else if (t1 == VisionPhotoPanoramaMissionState.FORBIDDEN) {
|
|
|
|
|
|
// Movement.getInstance().setPhoto_result(1);
|
|
|
|
|
|
// Movement.getInstance().setPhoto_current_step(3000);
|
|
|
|
|
|
// Movement.getInstance().setPhoto_status("fail");
|
|
|
|
|
|
// }
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//全景退出
|
|
|
|
|
|
KeyManager.getInstance().listen(createKey(CameraKey.KeyPanoramaExitStatus, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<PanoramaExitStatus>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable PanoramaExitStatus panoramaExitStatus, @Nullable PanoramaExitStatus t1) {
|
|
|
|
|
|
if(t1!=null){
|
|
|
|
|
|
LogUtil.log(TAG,t1.toString());
|
|
|
|
|
|
if(t1==PanoramaExitStatus.SUCCESSFUL){
|
|
|
|
|
|
Movement.getInstance().setPhoto_current_step(3000);
|
|
|
|
|
|
Movement.getInstance().setPhoto_result(0);
|
|
|
|
|
|
Movement.getInstance().setPhoto_status("ok");
|
|
|
|
|
|
Movement.getInstance().setCameraMode(3);
|
|
|
|
|
|
Movement.getInstance().setMode_code(3);
|
|
|
|
|
|
stopReport();
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
KeyManager.getInstance().listen(createKey(CameraKey.KeyPanoramaProgressInPercent, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer integer, @Nullable Integer t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setPhoto_percent(t1);
|
|
|
|
|
|
if(t1==100){
|
|
|
|
|
|
Movement.getInstance().setPhoto_current_step(3000);
|
|
|
|
|
|
Movement.getInstance().setPhoto_result(0);
|
|
|
|
|
|
Movement.getInstance().setPhoto_status("ok");
|
|
|
|
|
|
Movement.getInstance().setCameraMode(3);
|
|
|
|
|
|
Movement.getInstance().setMode_code(3);
|
|
|
|
|
|
stopReport();
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//是否正在拍全景
|
|
|
|
|
|
KeyManager.getInstance().listen(createKey(CameraKey.KeyIsShootingPhotoPanorama, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<Boolean>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Boolean aBoolean, @Nullable Boolean t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
if (t1 == true) {
|
|
|
|
|
|
startReport();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
stopReport();
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//激光测距信息
|
|
|
|
|
|
KeyManager.getInstance().listen(createKey(CameraKey.KeyLaserMeasureInformation, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<LaserMeasureInformation>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable LaserMeasureInformation laserMeasureInformation, @Nullable LaserMeasureInformation t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
if (t1.getLocation3D() != null) {
|
|
|
|
|
|
Movement.getInstance().setMeasure_target_altitude(t1.getLocation3D().getAltitude());
|
|
|
|
|
|
Movement.getInstance().setMeasure_target_latitude(t1.getLocation3D().getLatitude());
|
|
|
|
|
|
Movement.getInstance().setMeasure_target_longitude(t1.getLocation3D().getLongitude());
|
|
|
|
|
|
Movement.getInstance().setMeasure_target_distance(t1.getDistance().intValue());
|
|
|
|
|
|
Movement.getInstance().setMeasure_target_error_state(t1.getLaserMeasureState().value());
|
|
|
|
|
|
Movement.getInstance().setPayload_index("53-0-0");
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//调色盘样式。{"0":"白热","1":"黑热","2":"描红","3":"医疗","5":"彩虹 1","6":"铁红","8":"北极","11":"熔岩","12":"热铁","13":"彩虹 2"}
|
|
|
|
|
|
KeyManager.getInstance().listen(createKey(CameraKey.KeyThermalPalette, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<CameraThermalPalette>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraThermalPalette cameraThermalPalette, @Nullable CameraThermalPalette t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setThermal_current_palette_style(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//增益模式。{"0":"自动","1":"低增益, 测温范围0°C-500°C","2":"高增益, 测温范围-20°C-150°C"}
|
|
|
|
|
|
KeyManager.getInstance().listen(createKey(CameraKey.KeyThermalGainMode, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<ThermalGainMode>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable ThermalGainMode thermalGainMode, @Nullable ThermalGainMode t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setThermal_gain_mode(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//全局画面中测量的最高温度
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalGlobalMaxTemperature,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), this, new CommonCallbacks.KeyListener<Double>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Double aDouble, @Nullable Double t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setThermal_global_temperature_max(t1);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//等温线最高值。较低和中等等温线阈值之间的温度值将以调色板中的128-175色显示。
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalIsothermUpperValue,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer integer, @Nullable Integer t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setThermal_isotherm_upper_limit(t1);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//等温线最低值。较低和中等等温线阈值之间的温度值将以调色板中的128-175色显示。
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalIsothermLowerValue,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer integer, @Nullable Integer t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setThermal_isotherm_lower_limit(t1);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//是否开启等温线
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalIsothermEnabled,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), this, new CommonCallbacks.KeyListener<Boolean>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Boolean aBoolean, @Nullable Boolean t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setThermal_isotherm_state(t1 ? 1 : 0);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//相机模式
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyCameraMode, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<CameraMode>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraMode oldValue, @Nullable CameraMode newValue) {
|
|
|
|
|
|
if (newValue != null) {
|
|
|
|
|
|
//Movement.getInstance().setCamera_mode(newValue.value());
|
|
|
|
|
|
// LogUtil.log(TAG, "相机模式:" + newValue + "old" + oldValue);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//当前测温模式
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalTemperatureMeasureMode,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), this, new CommonCallbacks.KeyListener<ThermalTemperatureMeasureMode>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable ThermalTemperatureMeasureMode thermalTemperatureMeasureMode, @Nullable ThermalTemperatureMeasureMode t1) {
|
|
|
|
|
|
if (t1 != null && thermalTemperatureMeasureMode != null) {
|
|
|
|
|
|
Movement.getInstance().setIr_metering_mode(thermalTemperatureMeasureMode.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//当前测温的点的位置
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalSpotMetersurePoint,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), this, new CommonCallbacks.KeyListener<DoublePoint2D>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable DoublePoint2D doublePoint2D, @Nullable DoublePoint2D t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setX(t1.getX());
|
|
|
|
|
|
Movement.getInstance().setX(t1.getY());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//当前测温的点的温度
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalSpotMetersureTemperature,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), this, new CommonCallbacks.KeyListener<Double>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Double aDouble, @Nullable Double t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setTemperature(t1.intValue());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//当前红外变焦倍率
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalZoomRatios,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), this, new CommonCallbacks.KeyListener<Double>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Double aDouble, @Nullable Double t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setIr_zoom_factor(t1.intValue());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//拍照状态
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createKey(CameraKey.KeyPhotoState,
|
|
|
|
|
|
ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<PhotoState>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable PhotoState photoState, @Nullable PhotoState t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setPhoto_state(t1.value());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//视频录制时长
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyRecordingTime, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer oldValue, @Nullable Integer newValue) {
|
|
|
|
|
|
if (newValue != null) {
|
|
|
|
|
|
Movement.getInstance().setRecord_time(newValue);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//视频录制状态
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyRecordingState, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<RecordingState>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable RecordingState recordingState, @Nullable RecordingState t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setRecording_state(t1.value() == 0 ? 0 : 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//剩余照片数
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeySDCardAvailablePhotoCount, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer integer, @Nullable Integer t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
//LogUtil.log(TAG, "剩余拍照数setRemain_photo_num" + t1 + "old" + integer);
|
|
|
|
|
|
if (t1 != 0) {
|
2026-01-30 11:47:32 +08:00
|
|
|
|
Movement.getInstance().setRemain_photo_num(t1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//视频录制时长
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createKey(CameraKey.KeyRecordingTime, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer integer, @Nullable Integer t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setRecord_time(t1);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//是否在录像
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createKey(CameraKey.KeyVideoRecordingStatus, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<VideoRecordingStatus>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable VideoRecordingStatus videoRecordingStatus, @Nullable VideoRecordingStatus t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Boolean recording = t1.getIsRecording();
|
|
|
|
|
|
if (recording != null && recording) {
|
|
|
|
|
|
Movement.getInstance().setRecording_state(1); // 正在录
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Movement.getInstance().setRecording_state(0); // 未录或未知
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//分屏是否使能
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalDisplayMode,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), this, new CommonCallbacks.KeyListener<ThermalDisplayMode>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable ThermalDisplayMode thermalDisplayMode, @Nullable ThermalDisplayMode t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setScreen_split_enable(t1.value() == 2 ? true : false);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//广角镜头曝光模式
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyExposureMode,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_WIDE), this, new CommonCallbacks.KeyListener<CameraExposureMode>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraExposureMode cameraExposureMode, @Nullable CameraExposureMode t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
//LogUtil.log(TAG, "监听曝光模式:" + t1.name());
|
|
|
|
|
|
Movement.getInstance().setWide_exposure_mode(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//广角镜头曝光值
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyExposureCompensation,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_WIDE), this, new CommonCallbacks.KeyListener<CameraExposureCompensation>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraExposureCompensation cameraExposureCompensation, @Nullable CameraExposureCompensation t1) {
|
2026-03-12 14:57:34 +08:00
|
|
|
|
if (t1!= null) {
|
|
|
|
|
|
LogUtil.log(TAG, "监听曝光范围:" + t1.value());
|
|
|
|
|
|
Movement.getInstance().setWide_exposure_value(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//广角镜头感光度
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyISO,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_WIDE), this, new CommonCallbacks.KeyListener<CameraISO>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraISO cameraISO, @Nullable CameraISO t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setWide_iso(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//广角镜头快门速度
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyShutterSpeed,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_WIDE), this, new CommonCallbacks.KeyListener<CameraShutterSpeed>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraShutterSpeed cameraShutterSpeed, @Nullable CameraShutterSpeed t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setWide_shutter_speed(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头标定的最远对焦值
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyCameraFocusRingMaxValue,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer integer, @Nullable Integer t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_calibrate_farthest_focus_value(t1);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头标定的最近对焦值
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyCameraFocusRingMinValue,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer integer, @Nullable Integer t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_calibrate_farthest_focus_value(t1);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头曝光模式
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyExposureMode,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<CameraExposureMode>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraExposureMode cameraExposureMode, @Nullable CameraExposureMode t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_exposure_mode(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头感光度
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyExposureCompensation,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<CameraExposureCompensation>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraExposureCompensation cameraExposureCompensation, @Nullable CameraExposureCompensation t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_exposure_value(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头感光度
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyExposureCompensation,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<CameraExposureCompensation>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraExposureCompensation cameraExposureCompensation, @Nullable CameraExposureCompensation t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_exposure_value(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyThermalZoomRatios,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<Double>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Double aDouble, @Nullable Double t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_factor(t1);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//变焦倍数
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyCameraZoomRatios,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<Double>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Double aDouble, @Nullable Double t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_factor(t1);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头对焦模式
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyCameraFocusMode,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<CameraFocusMode>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraFocusMode cameraFocusMode, @Nullable CameraFocusMode t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_focus_mode(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头对焦状态
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyCameraFocusState,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<CameraFocusState>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraFocusState cameraFocusState, @Nullable CameraFocusState t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_focus_state(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头对焦值
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyCameraFocusRingValue,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer integer, @Nullable Integer t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_focus_value(t1);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头感光度
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyISO,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<CameraISO>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraISO cameraISO, @Nullable CameraISO t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_iso(t1.value());
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头最大对焦值
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyCameraFocusRingMaxValue,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer integer, @Nullable Integer t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_max_focus_value(t1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头最小对焦值
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyCameraFocusRingMinValue,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<Integer>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable Integer integer, @Nullable Integer t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_min_focus_value(t1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//变焦镜头快门速度
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createCameraKey(CameraKey.KeyShutterSpeed,
|
|
|
|
|
|
ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM), this, new CommonCallbacks.KeyListener<CameraShutterSpeed>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraShutterSpeed cameraShutterSpeed, @Nullable CameraShutterSpeed t1) {
|
|
|
|
|
|
if (t1 != null) {
|
|
|
|
|
|
Movement.getInstance().setZoom_shutter_speed(t1.value());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
//SD卡容量
|
|
|
|
|
|
KeyManager.getInstance().listen(KeyTools.createKey(CameraKey.KeyCameraStorageInfos, ComponentIndexType.PORT_1), this, new CommonCallbacks.KeyListener<CameraStorageInfos>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onValueChange(@Nullable CameraStorageInfos cameraStorageInfos, @Nullable CameraStorageInfos t1) {
|
|
|
|
|
|
if (t1 != null) {
|
2026-02-11 10:06:54 +08:00
|
|
|
|
// LogUtil.log(TAG,"剩余时间"+t1.getCurrentCameraStorageInfo().getAvailableVideoDuration());
|
|
|
|
|
|
//剩余录像时间
|
|
|
|
|
|
Movement.getInstance().setRemain_record_duration(t1.getCurrentCameraStorageInfo().getAvailableVideoDuration());
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
CameraStorageInfo cameraStorageInfoByLocation = t1.getCameraStorageInfoByLocation(CameraStorageLocation.SDCARD);
|
|
|
|
|
|
if (cameraStorageInfoByLocation != null) {
|
2026-01-30 11:47:32 +08:00
|
|
|
|
// //剩余可以拍照张数
|
|
|
|
|
|
// int pitcurenum = cameraStorageInfoByLocation.getAvailablePhotoCount();
|
|
|
|
|
|
// Movement.getInstance().setRemain_photo_num(pitcurenum);
|
|
|
|
|
|
// LogUtil.log(TAG, "//剩余可以拍照张数" + pitcurenum);
|
2026-02-10 20:46:40 +08:00
|
|
|
|
Movement.getInstance().setTotal(cameraStorageInfoByLocation.getStorageCapacity() * 1024);
|
|
|
|
|
|
Movement.getInstance().setUsed((cameraStorageInfoByLocation.getStorageCapacity() * 1024)
|
|
|
|
|
|
- (cameraStorageInfoByLocation.getStorageLeftCapacity()));
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//切换相机拍照录像模式
|
|
|
|
|
|
public void setCameraMode(MessageDown message) {
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyConnection, ComponentIndexType.PORT_1));
|
|
|
|
|
|
if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
if (message != null) {
|
|
|
|
|
|
|
|
|
|
|
|
int cameraMode = message.getData().getCamera_mode();
|
|
|
|
|
|
// 新增:如果当前已经是该模式,直接返回成功
|
|
|
|
|
|
if (cameraMode == Movement.getInstance().getCamera_mode()) {
|
|
|
|
|
|
LogUtil.log(TAG, "相机模式已是" + cameraMode + ",无需切换");
|
|
|
|
|
|
sendMsg2Server(message);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
ProductType productType = KeyManager.getInstance().getValue(KeyTools.createKey(ProductKey.KeyProductType));
|
|
|
|
|
|
if (productType != null) {
|
|
|
|
|
|
int cameraModevalue = 0;
|
|
|
|
|
|
if (cameraMode == 1) {
|
|
|
|
|
|
cameraModevalue = 1;
|
|
|
|
|
|
} else if (cameraMode == 2) {
|
|
|
|
|
|
cameraModevalue = 11;
|
|
|
|
|
|
} else if (cameraMode == 3) {
|
|
|
|
|
|
cameraModevalue = 12;
|
|
|
|
|
|
}
|
2026-04-08 13:43:50 +08:00
|
|
|
|
// if(cameraMode == 3){
|
|
|
|
|
|
// //退出回放模式
|
|
|
|
|
|
// MediaManager.getInstance().disablePlayback();
|
|
|
|
|
|
// }
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
KeyManager.getInstance().setValue(KeyTools.createKey(CameraKey.KeyCameraMode, ComponentIndexType.PORT_1),
|
|
|
|
|
|
CameraMode.find(cameraModevalue),
|
|
|
|
|
|
new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess() {
|
|
|
|
|
|
//设置相机模式
|
|
|
|
|
|
Movement.getInstance().setCamera_mode(cameraMode);
|
|
|
|
|
|
LogUtil.log(TAG, "切换成功" + Movement.getInstance().getCamera_mode());
|
|
|
|
|
|
OSDManager.getInstance().pushFlightAttitude();
|
|
|
|
|
|
sendMsg2Server(message);
|
|
|
|
|
|
}
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
sendFailMsg2Server(message, "相机模式切换失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
sendFailMsg2Server(message, "切换失败:当前状态相机禁止操作");
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
sendFailMsg2Server(message, "当前状态相机禁止操作");
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
//框选变焦
|
|
|
|
|
|
public void camera_frame_zoom(MessageDown message) {
|
|
|
|
|
|
//这个locked参数没有处理
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
//使用aim转过去
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(
|
|
|
|
|
|
CameraKey.KeyConnection, ComponentIndexType.PORT_1));
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
if (isConnect == null || !isConnect || !getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
LogUtil.log(TAG, "指点对焦失败:相机未连接或禁止操作");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
CameraLensType type = parseLensType1(message.getData().getCamera_type());
|
|
|
|
|
|
if (type == null) {
|
|
|
|
|
|
sendFailMsg2Server(message, "不支持的相机类型");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
KeyManager.getInstance().setValue(
|
|
|
|
|
|
KeyTools.createCameraKey(CameraKey.KeyTapZoomEnable,
|
|
|
|
|
|
ComponentIndexType.PORT_1, type),
|
|
|
|
|
|
true,
|
|
|
|
|
|
new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess() {
|
|
|
|
|
|
LogUtil.log(TAG, "设置使能指点成功");
|
|
|
|
|
|
//使用aim 加变焦
|
|
|
|
|
|
camera_frame_zoom_and_bianjiao(message, type);
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
LogUtil.log(TAG, "设置使能指点失败:" + new Gson().toJson(error));
|
|
|
|
|
|
sendFailMsg2Server(message, "设置使能指点失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private CameraLensType parseLensType1(String cameraType) {
|
|
|
|
|
|
if (cameraType == null) return null;
|
|
|
|
|
|
if ("ir".equals(cameraType)) {
|
|
|
|
|
|
return CameraLensType.CAMERA_LENS_THERMAL;
|
|
|
|
|
|
} else if ("wide".equals(cameraType)) {
|
|
|
|
|
|
return CameraLensType.CAMERA_LENS_ZOOM;
|
|
|
|
|
|
} else if ("zoom".equals(cameraType)) {
|
|
|
|
|
|
return CameraLensType.CAMERA_LENS_ZOOM;
|
2026-02-01 14:34:23 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
private void camera_frame_zoom_and_bianjiao(MessageDown message, CameraLensType type) {
|
|
|
|
|
|
ZoomTargetPointInfo info = new ZoomTargetPointInfo();
|
|
|
|
|
|
info.setX(Double.valueOf(message.getData().getX()));
|
|
|
|
|
|
info.setY(Double.valueOf(message.getData().getY()));
|
|
|
|
|
|
info.setTapZoomModeEnable(true);
|
|
|
|
|
|
|
|
|
|
|
|
double width = message.getData().getWidth();
|
|
|
|
|
|
double height = message.getData().getHeight();
|
|
|
|
|
|
|
|
|
|
|
|
double zoomRatio = calculateZoomRatio(width, height);
|
|
|
|
|
|
|
|
|
|
|
|
//没有对lock判断
|
|
|
|
|
|
info.setMode(TapZoomMode.GIMBAL_FOLLOW); // 或 TAP_ZOOM模式,看需求
|
|
|
|
|
|
|
|
|
|
|
|
KeyManager.getInstance().performAction(
|
|
|
|
|
|
KeyTools.createCameraKey(CameraKey.KeyTapZoomAtTarget,
|
|
|
|
|
|
ComponentIndexType.PORT_1, type),
|
|
|
|
|
|
info,
|
|
|
|
|
|
new CommonCallbacks.CompletionCallbackWithParam<EmptyMsg>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess(EmptyMsg emptyMsg) {
|
|
|
|
|
|
//开始变焦
|
|
|
|
|
|
KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyCameraZoomRatios,
|
|
|
|
|
|
ComponentIndexType.PORT_1, type),
|
|
|
|
|
|
Double.valueOf(zoomRatio), new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess() {
|
|
|
|
|
|
LogUtil.log(TAG, "变焦成功");
|
|
|
|
|
|
sendMsg2Server(message);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError idjiError) {
|
|
|
|
|
|
sendFailMsg2Server(message, "变焦失败:" + getIDJIErrorMsg(idjiError));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
sendFailMsg2Server(message, "aim操作失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
//设置变焦倍率
|
|
|
|
|
|
public static double calculateZoomRatio(double width, double height) {
|
|
|
|
|
|
// 防呆:如果传入 0 或负数,返回 1 倍(不 zoom)
|
|
|
|
|
|
if (width <= 0 || height <= 0) {
|
|
|
|
|
|
return 1.0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 取宽高中的大值(保证框能装下)
|
|
|
|
|
|
double maxDimension = Math.max(width, height);
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
// 反比计算:框越小,zoom 越大
|
|
|
|
|
|
// 例:max=1.0(全画面)→ zoom=1.0
|
|
|
|
|
|
// max=0.5(半屏) → zoom=2.0
|
|
|
|
|
|
// max=0.005(很小) → zoom=200.0
|
|
|
|
|
|
double zoom = 1.0 / maxDimension;
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
// 限制在你的相机范围内 1x ~ 200x
|
|
|
|
|
|
return Math.max(1.0, Math.min(200.0, zoom));
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
//开始拍照
|
|
|
|
|
|
public void startShootPhoto(MessageDown message) {
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyConnection, ComponentIndexType.PORT_1));
|
|
|
|
|
|
if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
KeyManager.getInstance().performAction(KeyTools.createKey(CameraKey.KeyStartShootPhoto,
|
|
|
|
|
|
ComponentIndexType.PORT_1),
|
2026-02-01 14:34:23 +08:00
|
|
|
|
new CommonCallbacks.CompletionCallbackWithParam<EmptyMsg>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess(EmptyMsg emptyMsg) {
|
2026-02-10 20:46:40 +08:00
|
|
|
|
LogUtil.log(TAG,"拍照成功");
|
|
|
|
|
|
sendMsg2Server(message);
|
2026-02-01 14:34:23 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
|
2026-02-01 14:34:23 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
2026-02-10 20:46:40 +08:00
|
|
|
|
LogUtil.log(TAG, "拍照失败:" + new Gson().toJson(error));
|
|
|
|
|
|
sendFailMsg2Server(message, "拍照失败:" + getIDJIErrorMsg(error));
|
2026-02-01 14:34:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2026-02-10 20:46:40 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
sendFailMsg2Server(message, "当前状态相机禁止操作");
|
2026-02-01 14:34:23 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//结束拍照
|
|
|
|
|
|
public void stopShootPhoto(MessageDown message) {
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyConnection, ComponentIndexType.PORT_1));
|
|
|
|
|
|
if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
KeyManager.getInstance().performAction(KeyTools.createKey(CameraKey.KeyStopShootPhoto,
|
|
|
|
|
|
ComponentIndexType.PORT_1), new CommonCallbacks.CompletionCallbackWithParam<EmptyMsg>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess(EmptyMsg emptyMsg) {
|
|
|
|
|
|
sendMsg2Server(message);
|
|
|
|
|
|
}
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
LogUtil.log(TAG, "停止拍照失败:" + new Gson().toJson(error));
|
|
|
|
|
|
sendFailMsg2Server(message, "停止拍照失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
sendFailMsg2Server(message, "当前状态相机禁止操作");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//开始录像
|
|
|
|
|
|
public void startRecordVideo(MessageDown message) {
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyConnection, ComponentIndexType.PORT_1));
|
|
|
|
|
|
if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
KeyManager.getInstance().performAction(KeyTools.createKey(CameraKey.KeyStartRecord,
|
|
|
|
|
|
ComponentIndexType.PORT_1), new CommonCallbacks.CompletionCallbackWithParam<EmptyMsg>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess(EmptyMsg emptyMsg) {
|
|
|
|
|
|
sendMsg2Server(message);
|
|
|
|
|
|
}
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
sendFailMsg2Server(message, "开始录像失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
sendFailMsg2Server(message, "当前状态相机禁止操作");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//停止录像
|
|
|
|
|
|
public void stopRecordVideo(MessageDown message) {
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyConnection, ComponentIndexType.PORT_1));
|
|
|
|
|
|
if (isConnect != null && isConnect) {
|
|
|
|
|
|
KeyManager.getInstance().performAction(KeyTools.createKey(CameraKey.KeyStopRecord,
|
|
|
|
|
|
ComponentIndexType.PORT_1), new CommonCallbacks.CompletionCallbackWithParam<EmptyMsg>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess(EmptyMsg emptyMsg) {
|
|
|
|
|
|
LogUtil.log(TAG, "停止录像成功");
|
2026-04-03 20:41:05 +08:00
|
|
|
|
sendMsg2Server(message);
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
2026-02-01 14:34:23 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
sendFailMsg2Server(message, "停止录像失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
sendFailMsg2Server(message, "当前状态相机禁止操作");
|
2026-02-01 14:34:23 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
|
|
|
|
|
|
// 设置变焦倍率
|
|
|
|
|
|
public void setCameraZoomRatios(MessageDown message) {
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyConnection, ComponentIndexType.PORT_1));
|
|
|
|
|
|
if (isConnect == null || !isConnect || !getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
sendFailMsg2Server(message, "当前状态相机禁止操作");
|
|
|
|
|
|
return;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
if (message == null) return;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
String cameraType = message.getData().getCamera_type();
|
|
|
|
|
|
double zoomFactor = message.getData().getZoom_factor();
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
// 检查是否有红外(H30T)
|
|
|
|
|
|
CameraType cameraTypeEnum = KeyManager.getInstance().getValue(
|
|
|
|
|
|
KeyTools.createKey(CameraKey.KeyCameraType, ComponentIndexType.PORT_1));
|
|
|
|
|
|
boolean hasThermal = (cameraTypeEnum == CameraType.ZENMUSE_H30T);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
// 1. 映射视频流类型和镜头类型
|
|
|
|
|
|
CameraVideoStreamSourceType streamSource;
|
|
|
|
|
|
CameraLensType lensType;
|
|
|
|
|
|
double minZoom, maxZoom;
|
|
|
|
|
|
final boolean isWide;
|
|
|
|
|
|
final boolean isIr;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
switch (cameraType) {
|
|
|
|
|
|
case "ir":
|
|
|
|
|
|
if (!hasThermal) {
|
|
|
|
|
|
sendFailMsg2Server(message, "当前负载无红外功能,仅H30T支持");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
streamSource = CameraVideoStreamSourceType.INFRARED_CAMERA;
|
|
|
|
|
|
lensType = CameraLensType.CAMERA_LENS_THERMAL;
|
|
|
|
|
|
minZoom = 2;
|
|
|
|
|
|
maxZoom = 20; // 红外 2-20倍
|
|
|
|
|
|
isWide = false;
|
|
|
|
|
|
isIr = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "wide":
|
|
|
|
|
|
streamSource = CameraVideoStreamSourceType.WIDE_CAMERA;
|
|
|
|
|
|
lensType = CameraLensType.CAMERA_LENS_WIDE;
|
|
|
|
|
|
minZoom = 1;
|
|
|
|
|
|
maxZoom = 1;
|
|
|
|
|
|
isWide = true;
|
|
|
|
|
|
isIr = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "zoom":
|
|
|
|
|
|
streamSource = CameraVideoStreamSourceType.ZOOM_CAMERA;
|
|
|
|
|
|
lensType = CameraLensType.CAMERA_LENS_ZOOM;
|
|
|
|
|
|
minZoom = 2;
|
|
|
|
|
|
maxZoom = 200;
|
|
|
|
|
|
isWide = false;
|
|
|
|
|
|
isIr = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
streamSource = CameraVideoStreamSourceType.DEFAULT_CAMERA;
|
|
|
|
|
|
lensType = CameraLensType.CAMERA_LENS_ZOOM;
|
|
|
|
|
|
minZoom = 2;
|
|
|
|
|
|
maxZoom = 200;
|
|
|
|
|
|
isWide = false;
|
|
|
|
|
|
isIr = false;
|
|
|
|
|
|
break;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
// 2. 切换视频流
|
|
|
|
|
|
final double finalMinZoom = minZoom;
|
|
|
|
|
|
final double finalMaxZoom = maxZoom;
|
|
|
|
|
|
|
|
|
|
|
|
KeyManager.getInstance().setValue(
|
|
|
|
|
|
KeyTools.createKey(CameraKey.KeyCameraVideoStreamSource, ComponentIndexType.PORT_1),
|
|
|
|
|
|
streamSource,
|
|
|
|
|
|
new CommonCallbacks.CompletionCallback() {
|
2026-01-30 11:47:32 +08:00
|
|
|
|
@Override
|
2026-02-10 20:46:40 +08:00
|
|
|
|
public void onSuccess() {
|
|
|
|
|
|
// 广角不设置变焦
|
|
|
|
|
|
if (isWide) {
|
|
|
|
|
|
LogUtil.log(TAG, "广角切换成功,无需设置变焦");
|
|
|
|
|
|
Movement.getInstance().setZoom_factor(1);
|
|
|
|
|
|
sendMsg2Server(message);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 强制截断变焦范围
|
|
|
|
|
|
final double validZoom = Math.max(finalMinZoom, Math.min(finalMaxZoom, zoomFactor));
|
|
|
|
|
|
|
|
|
|
|
|
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
|
|
|
|
|
if (isIr) {
|
|
|
|
|
|
KeyManager.getInstance().setValue(
|
|
|
|
|
|
KeyTools.createCameraKey(CameraKey.KeyThermalZoomRatios,
|
|
|
|
|
|
ComponentIndexType.PORT_1, lensType),
|
|
|
|
|
|
validZoom,
|
|
|
|
|
|
new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess() {
|
|
|
|
|
|
LogUtil.log(TAG, "红外变焦成功: " + validZoom);
|
|
|
|
|
|
Movement.getInstance().setZoom_factor((int) validZoom);
|
|
|
|
|
|
sendMsg2Server(message);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
sendFailMsg2Server(message, "红外变焦失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 可见光变焦
|
|
|
|
|
|
KeyManager.getInstance().setValue(
|
|
|
|
|
|
KeyTools.createCameraKey(CameraKey.KeyCameraZoomRatios,
|
|
|
|
|
|
ComponentIndexType.PORT_1, lensType),
|
|
|
|
|
|
validZoom,
|
|
|
|
|
|
new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess() {
|
|
|
|
|
|
LogUtil.log(TAG, "变焦成功: " + cameraType + "=" + validZoom);
|
|
|
|
|
|
Movement.getInstance().setZoom_factor((int) validZoom);
|
|
|
|
|
|
sendMsg2Server(message);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
sendFailMsg2Server(message, "设置变焦倍率失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 200);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
2026-02-10 20:46:40 +08:00
|
|
|
|
sendFailMsg2Server(message, "切换相机视频流失败:" + getIDJIErrorMsg(error));
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// private void setstepThermalZoomRatios(){
|
|
|
|
|
|
// KeyManager.getInstance().setValue(
|
|
|
|
|
|
// KeyTools.createKey(CameraKey.KeyThermalDigitalZoomFactor, ComponentIndexType.PORT_1),
|
|
|
|
|
|
// ThermalDigitalZoomFactor.FACTOR_X2,
|
|
|
|
|
|
// new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// //
|
|
|
|
|
|
// LogUtil.log(TAG,"设置红外步长为2x");
|
|
|
|
|
|
// }
|
2026-01-30 11:47:32 +08:00
|
|
|
|
//
|
2026-02-10 20:46:40 +08:00
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError idjiError) {
|
|
|
|
|
|
// LogUtil.log(TAG,"设置红外步长为1x失败"+idjiError);
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// );
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
2026-01-30 11:47:32 +08:00
|
|
|
|
// //设置红外变焦倍率(支持1x、2x、4x、8x变焦倍率)
|
|
|
|
|
|
// public void setThermalZoomRatios(MQMessage message) {
|
|
|
|
|
|
// Boolean isConnect =KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
// if (message != null) {
|
|
|
|
|
|
// int type = message.getThermalZoomRatios();
|
|
|
|
|
|
// KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyThermalZoomRatios,
|
|
|
|
|
|
// ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), Double.valueOf(type),
|
|
|
|
|
|
// new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// sendMsg2Server(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"设置红外变焦倍率失败:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "设置红外变焦倍率失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// sendMsg2Server(message, "当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
//切换广角变焦红外
|
|
|
|
|
|
public void setCameraVideoStreamSource(MessageDown message) {
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyConnection, ComponentIndexType.PORT_1));
|
|
|
|
|
|
if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
if (message != null) {
|
|
|
|
|
|
int type = 1;
|
|
|
|
|
|
switch (message.getData().getVideo_type()) {
|
|
|
|
|
|
case "ir":
|
|
|
|
|
|
type = 3;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "normal":
|
|
|
|
|
|
type = 0;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "wide":
|
|
|
|
|
|
type = 1;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "zoom":
|
|
|
|
|
|
type = 2;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
KeyManager.getInstance().setValue(KeyTools.createKey(CameraKey.KeyCameraVideoStreamSource,
|
|
|
|
|
|
ComponentIndexType.PORT_1)
|
|
|
|
|
|
, CameraVideoStreamSourceType.find(type),
|
|
|
|
|
|
new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess() {
|
|
|
|
|
|
sendMsg2Server(message);
|
|
|
|
|
|
}
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
sendFailMsg2Server(message, "切换相机视频流失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2026-01-30 11:47:32 +08:00
|
|
|
|
// if (type == 3) {
|
|
|
|
|
|
// KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyThermalDisplayMode,
|
|
|
|
|
|
// ComponentIndexType.PORT_1,
|
|
|
|
|
|
// CameraLensType.CAMERA_LENS_THERMAL),
|
|
|
|
|
|
// ThermalDisplayMode.THERMAL_ONLY, new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
//// setThermalPIPPosition(mqttAndroidClient, message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"红外镜头的显示模式设置失败:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "红外镜头的显示模式设置失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
sendFailMsg2Server(message, "当前状态相机禁止操作");
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-30 11:47:32 +08:00
|
|
|
|
// //设置红外镜头的显示模式
|
|
|
|
|
|
// public void setThermalDisplayMode(MQMessage message) {
|
|
|
|
|
|
// Boolean isConnect =KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
// KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyThermalDisplayMode,
|
|
|
|
|
|
// ComponentIndexType.PORT_1,
|
|
|
|
|
|
// CameraLensType.CAMERA_LENS_THERMAL),
|
|
|
|
|
|
// ThermalDisplayMode.PIP, new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// setThermalPIPPosition(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"红外镜头的显示模式设置失败:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "红外镜头的显示模式设置失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// sendMsg2Server(message, "当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //设置红外镜头分屏显示位置
|
|
|
|
|
|
// public void setThermalPIPPosition(MQMessage message) {
|
|
|
|
|
|
// Boolean isConnect =KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
// KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyThermalPIPPosition,
|
|
|
|
|
|
// ComponentIndexType.PORT_1,
|
|
|
|
|
|
// CameraLensType.CAMERA_LENS_THERMAL),
|
|
|
|
|
|
// ThermalPIPPosition.SIDE_BY_SIDE,
|
|
|
|
|
|
// new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// sendMsg2Server(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"分屏的显示位置设置失败:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "分屏的显示位置设置失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// sendMsg2Server(message, "当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
//
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
/// /设置对焦模式
|
2026-01-30 11:47:32 +08:00
|
|
|
|
//public void setCameraFocusMode(MQMessage message) {
|
|
|
|
|
|
// Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
// if (message != null) {
|
|
|
|
|
|
// KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyCameraFocusMode,
|
|
|
|
|
|
// ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM),
|
|
|
|
|
|
// CameraFocusMode.find(message.getCameraFocusMode()), new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// sendMsg2Server(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"设置对焦模式失败:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "设置对焦模式失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// sendMsg2Server(message, "设置对焦模式失败:参数有误");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// sendMsg2Server(message, "当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//
|
2026-02-10 20:46:40 +08:00
|
|
|
|
//格式化SD卡
|
|
|
|
|
|
public void formatStorage(MessageDown message) {
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyConnection, ComponentIndexType.PORT_1));
|
|
|
|
|
|
if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
KeyManager.getInstance().performAction(KeyTools.createKey(CameraKey.KeyFormatStorage, ComponentIndexType.PORT_1), CameraStorageLocation.SDCARD, new CommonCallbacks.CompletionCallbackWithParam<EmptyMsg>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess(EmptyMsg emptyMsg) {
|
|
|
|
|
|
if (message != null) {
|
|
|
|
|
|
sendMsg2Server(message);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
LogUtil.log(TAG, "sd卡已格式化");
|
|
|
|
|
|
}
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
if (message != null) {
|
|
|
|
|
|
sendFailMsg2Server(message, "SD卡格式化失败:" + getIDJIErrorMsg(error));
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
LogUtil.log(TAG, "sd卡格式化失败:" + new Gson().toJson(error));
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (message != null) {
|
|
|
|
|
|
sendFailMsg2Server(message, "当前状态相机禁止操作");
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
LogUtil.log(TAG, "当前状态相机禁止操作");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2026-01-30 11:47:32 +08:00
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
////
|
|
|
|
|
|
//
|
|
|
|
|
|
// //设置曝光模式
|
|
|
|
|
|
// public void setExposureMode(MQMessage message) {
|
|
|
|
|
|
// Boolean isConnect =KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
// KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyExposureMode,
|
|
|
|
|
|
// ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM),
|
|
|
|
|
|
// CameraExposureMode.find(message.getCameraExposureMode()), new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// LogUtil.log(TAG, "曝光模式切换成功");
|
|
|
|
|
|
// sendMsg2Server(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"切换曝光模式失败:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "切换曝光模式失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
//
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// LogUtil.log(TAG, "切换曝光失败:当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //设置曝光补偿数值
|
|
|
|
|
|
// public void setExposureCompensation(MQMessage message) {
|
|
|
|
|
|
// Boolean isConnect =KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
// KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyExposureCompensation,
|
|
|
|
|
|
// ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_ZOOM),
|
|
|
|
|
|
// CameraExposureCompensation.find(message.getCameraExposureCompensation()), new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// sendMsg2Server(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"设置曝光补偿数值失败:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "设置曝光补偿数值失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// LogUtil.log(TAG, "设置曝光补偿数值失败:当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
////重置相机参数
|
|
|
|
|
|
//public void resetCameraSetting(MQMessage message) {
|
|
|
|
|
|
// Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection));
|
|
|
|
|
|
// if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
// KeyManager.getInstance().performAction(KeyTools.createKey(CameraKey.KeyResetCameraSetting,
|
|
|
|
|
|
// ComponentIndexType.PORT_1), new CommonCallbacks.CompletionCallbackWithParam<EmptyMsg>() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess(EmptyMsg emptyMsg) {
|
|
|
|
|
|
// sendMsg2Server(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"重置相机参数失败:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "重置相机参数失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// sendMsg2Server(message, "当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//指点对焦
|
|
|
|
|
|
public void tapZoomAtTarget(MessageDown message) {
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(
|
|
|
|
|
|
CameraKey.KeyConnection, ComponentIndexType.PORT_1));
|
|
|
|
|
|
//
|
|
|
|
|
|
LogUtil.log(TAG, "双击回中" + message.toString());
|
|
|
|
|
|
if (isConnect == null || !isConnect || !getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
LogUtil.log(TAG, "指点对焦失败:相机未连接或禁止操作");
|
|
|
|
|
|
return;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
CameraLensType type = parseLensType(message.getData().getCamera_type());
|
|
|
|
|
|
if (type == null) {
|
|
|
|
|
|
sendFailMsg2Server(message, "不支持的相机类型");
|
|
|
|
|
|
return;
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
KeyManager.getInstance().setValue(
|
|
|
|
|
|
KeyTools.createCameraKey(CameraKey.KeyTapZoomEnable,
|
|
|
|
|
|
ComponentIndexType.PORT_1, type),
|
|
|
|
|
|
true,
|
|
|
|
|
|
new CommonCallbacks.CompletionCallback() {
|
2026-01-30 11:47:32 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess() {
|
2026-02-10 20:46:40 +08:00
|
|
|
|
LogUtil.log(TAG, "设置使能指点成功");
|
|
|
|
|
|
performTapZoom(message, type);
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
2026-02-10 20:46:40 +08:00
|
|
|
|
LogUtil.log(TAG, "设置使能指点失败:" + new Gson().toJson(error));
|
|
|
|
|
|
sendFailMsg2Server(message, "设置使能指点失败:" + getIDJIErrorMsg(error));
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void performTapZoom(MessageDown message, CameraLensType type) {
|
|
|
|
|
|
ZoomTargetPointInfo info = new ZoomTargetPointInfo();
|
|
|
|
|
|
info.setX(Double.valueOf(message.getData().getX()));
|
|
|
|
|
|
info.setY(Double.valueOf(message.getData().getY()));
|
|
|
|
|
|
info.setTapZoomModeEnable(true);
|
|
|
|
|
|
//没有对lock判断
|
|
|
|
|
|
info.setMode(TapZoomMode.GIMBAL_FOLLOW); // 或 TAP_ZOOM模式,看需求
|
|
|
|
|
|
|
|
|
|
|
|
KeyManager.getInstance().performAction(
|
|
|
|
|
|
KeyTools.createCameraKey(CameraKey.KeyTapZoomAtTarget,
|
|
|
|
|
|
ComponentIndexType.PORT_1, type),
|
|
|
|
|
|
info,
|
|
|
|
|
|
new CommonCallbacks.CompletionCallbackWithParam<EmptyMsg>() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess(EmptyMsg emptyMsg) {
|
|
|
|
|
|
sendMsg2Server(message);
|
|
|
|
|
|
}
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
2026-02-10 20:46:40 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
sendFailMsg2Server(message, "指点变焦失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private CameraLensType parseLensType(String cameraType) {
|
|
|
|
|
|
if (cameraType == null) return null;
|
|
|
|
|
|
if ("ir".equals(cameraType)) {
|
|
|
|
|
|
return CameraLensType.CAMERA_LENS_THERMAL;
|
|
|
|
|
|
} else if ("wide".equals(cameraType)) {
|
|
|
|
|
|
return CameraLensType.CAMERA_LENS_WIDE;
|
|
|
|
|
|
} else if ("zoom".equals(cameraType)) {
|
|
|
|
|
|
return CameraLensType.CAMERA_LENS_ZOOM;
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//切换为广角镜头,降低曝光率
|
|
|
|
|
|
public void resumeLensToWideISOManual() {
|
|
|
|
|
|
Boolean isConnect = KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
KeyConnection, ComponentIndexType.PORT_1));
|
|
|
|
|
|
if (isConnect != null && isConnect) {
|
|
|
|
|
|
//切换成广角镜头
|
|
|
|
|
|
KeyManager.getInstance().setValue(KeyTools.createKey(CameraKey.KeyCameraVideoStreamSource,
|
|
|
|
|
|
ComponentIndexType.PORT_1), CameraVideoStreamSourceType.WIDE_CAMERA, new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onSuccess() {
|
|
|
|
|
|
LogUtil.log(TAG, "返航时将镜头切为广角");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
LogUtil.log(TAG, "返航切换广角失败:" + new Gson().toJson(error));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
LogUtil.log(TAG, "降落切换广角失败:当前状态相机禁止操作");
|
2026-01-30 11:47:32 +08:00
|
|
|
|
}
|
2026-02-10 20:46:40 +08:00
|
|
|
|
}
|
2026-01-30 11:47:32 +08:00
|
|
|
|
|
|
|
|
|
|
// //设置自定义文件后缀
|
|
|
|
|
|
// public void setCustomExpandNameSetting() {
|
|
|
|
|
|
// Boolean isConnect =KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect) {
|
|
|
|
|
|
// CustomExpandNameSettings customExpandNameSettings = new CustomExpandNameSettings();
|
|
|
|
|
|
// customExpandNameSettings.setEncodingType(EnCodingType.UTF8);
|
|
|
|
|
|
// customExpandNameSettings.setForceCreateFolder(false);
|
|
|
|
|
|
// customExpandNameSettings.setRelativePosition(RelativePosition.POSITION_END);
|
|
|
|
|
|
// customExpandNameSettings.setPriority(0);
|
|
|
|
|
|
// customExpandNameSettings.setCustomContent("flightId111" + PreferenceUtils.getInstance().getFlightId());
|
|
|
|
|
|
// KeyManager.getInstance().setValue(DJIKey.create(CameraKey.KeyCustomExpandFileNameSettings), customExpandNameSettings, new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// LogUtil.log(TAG, "设置文件后缀success");
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError idjiError) {
|
|
|
|
|
|
// LogUtil.log(TAG, "设置自定义文件后缀失败:" + new Gson().toJson(idjiError));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// LogUtil.log(TAG, "设置自定义文件后缀失败:当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// //切换为广角镜头,恢复曝光
|
|
|
|
|
|
// public void resumeLensToWideISOProgram() {
|
|
|
|
|
|
// Boolean isConnect =KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect) {
|
|
|
|
|
|
//
|
|
|
|
|
|
// KeyManager.getInstance().setValue(DJIKey.create(CameraKey.KeyExposureMode),
|
|
|
|
|
|
// CameraExposureMode.PROGRAM, new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// LogUtil.log(TAG, "降落后切换曝光模式为自动成功");
|
|
|
|
|
|
//
|
|
|
|
|
|
// KeyManager.getInstance().setValue(DJIKey.create(CameraKey.KeyExposureCompensation),
|
|
|
|
|
|
// CameraExposureCompensation.POS_1P0EV, new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// LogUtil.log(TAG, "降落后设置曝光补偿数值成功");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError idjiError) {
|
|
|
|
|
|
// LogUtil.log(TAG, "降落后设置曝光补偿数值失败");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError idjiError) {
|
|
|
|
|
|
// LogUtil.log(TAG, "降落后切换曝光模式为自动失败:" + new Gson().toJson(idjiError));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// LogUtil.log(TAG, "降落后降落完成切换曝光失败:当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// //设置测温模式
|
|
|
|
|
|
// public void setThermalTemperatureMeasureMode(MQMessage message) {
|
|
|
|
|
|
// Boolean isConnect =KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
// KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyThermalTemperatureMeasureMode,
|
|
|
|
|
|
// ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL),
|
|
|
|
|
|
// ThermalTemperatureMeasureMode.find(message.getThermalTemperatureMeasureMode()), new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// sendMsg2Server(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"设置测温模式:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "设置测温模式:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// LogUtil.log(TAG, "设置测温模式失败:当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //设置需要测温的点的位置
|
|
|
|
|
|
// public void setThermalSpotMetersurePoint(MQMessage message) {
|
|
|
|
|
|
// Boolean isConnect =KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect && getGimbalAndCameraEnabled()) {
|
|
|
|
|
|
// DoublePoint2D doublePoint2D = new DoublePoint2D();
|
|
|
|
|
|
// doublePoint2D.setX(Double.parseDouble(message.getMetersurePointX()));
|
|
|
|
|
|
// doublePoint2D.setY(Double.parseDouble(message.getMetersurePointY()));
|
|
|
|
|
|
// KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyThermalSpotMetersurePoint,
|
|
|
|
|
|
// ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), doublePoint2D, new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// sendMsg2Server(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"设置点测温失败:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "设置点测温失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
//
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// LogUtil.log(TAG, "测温点设置失败:当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// //设置需要测温的区域位置
|
|
|
|
|
|
// public void setThermalRegionMetersureArea(MQMessage message) {
|
|
|
|
|
|
// Boolean isConnect =KeyManager.getInstance().getValue(KeyTools.createKey(CameraKey.
|
|
|
|
|
|
// KeyConnection,ComponentIndexType.PORT_1));
|
|
|
|
|
|
// if (isConnect != null && isConnect) {
|
|
|
|
|
|
// DoubleRect doubleRect = new DoubleRect();
|
|
|
|
|
|
// doubleRect.setX(Double.parseDouble(message.getMetersureAreaX()));
|
|
|
|
|
|
// doubleRect.setY(Double.parseDouble(message.getMetersureAreaY()));
|
|
|
|
|
|
// doubleRect.setHeight(Double.parseDouble(message.getMetersureAreaHeight()));
|
|
|
|
|
|
// doubleRect.setWidth(Double.parseDouble(message.getMetersureAreaWidth()));
|
|
|
|
|
|
// KeyManager.getInstance().setValue(KeyTools.createCameraKey(CameraKey.KeyThermalRegionMetersureArea,
|
|
|
|
|
|
// ComponentIndexType.PORT_1, CameraLensType.CAMERA_LENS_THERMAL), doubleRect, new CommonCallbacks.CompletionCallback() {
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onSuccess() {
|
|
|
|
|
|
// sendMsg2Server(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public void onFailure(@NonNull IDJIError error) {
|
|
|
|
|
|
// LogUtil.log(TAG,"设置区域测温失败:"+new Gson().toJson(error));
|
|
|
|
|
|
// sendMsg2Server(message, "设置区域测温失败:" + getIDJIErrorMsg(error));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// LogUtil.log(TAG, "测温区域设置失败:当前状态相机禁止操作");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|