2019-11-26 17:57:51 -05:00
|
|
|
package com.chameleonvision.config;
|
|
|
|
|
|
2019-11-29 14:24:34 -05:00
|
|
|
import com.chameleonvision.vision.VisionProcess;
|
2019-12-01 04:39:21 -05:00
|
|
|
import com.chameleonvision.vision.camera.USBCaptureProperties;
|
2019-11-29 14:24:34 -05:00
|
|
|
import com.chameleonvision.vision.enums.StreamDivisor;
|
2019-11-26 17:57:51 -05:00
|
|
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
|
|
|
|
|
|
public class CameraJsonConfig {
|
|
|
|
|
public final double fov;
|
|
|
|
|
public final String path;
|
|
|
|
|
public final String name;
|
|
|
|
|
public final String nickname;
|
2019-11-29 14:24:34 -05:00
|
|
|
public final int videomode;
|
|
|
|
|
public final StreamDivisor streamDivisor;
|
2019-11-26 17:57:51 -05:00
|
|
|
|
|
|
|
|
@JsonCreator
|
|
|
|
|
public CameraJsonConfig(
|
|
|
|
|
@JsonProperty("fov") double fov,
|
|
|
|
|
@JsonProperty("path") String path,
|
|
|
|
|
@JsonProperty("name") String name,
|
2019-11-29 14:24:34 -05:00
|
|
|
@JsonProperty("nickname") String nickname,
|
|
|
|
|
@JsonProperty("videomode") int videomode,
|
|
|
|
|
@JsonProperty("streamDivisor") StreamDivisor streamDivisor) {
|
2019-11-26 17:57:51 -05:00
|
|
|
this.fov = fov;
|
|
|
|
|
this.path = path;
|
|
|
|
|
this.name = name;
|
|
|
|
|
this.nickname = nickname;
|
2019-11-29 14:24:34 -05:00
|
|
|
this.videomode = videomode;
|
|
|
|
|
this.streamDivisor = streamDivisor;
|
2019-11-26 17:57:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CameraJsonConfig(String path, String name) {
|
2019-12-01 04:39:21 -05:00
|
|
|
this.fov = USBCaptureProperties.DEFAULT_FOV;
|
2019-11-26 17:57:51 -05:00
|
|
|
this.path = path;
|
|
|
|
|
this.name = name;
|
|
|
|
|
this.nickname = name;
|
2019-11-29 14:24:34 -05:00
|
|
|
this.videomode = 0;
|
|
|
|
|
this.streamDivisor = StreamDivisor.NONE;
|
2019-11-26 17:57:51 -05:00
|
|
|
}
|
|
|
|
|
|
2019-11-29 14:24:34 -05:00
|
|
|
public static CameraJsonConfig fromVisionProcess(VisionProcess process) {
|
2019-12-01 04:39:21 -05:00
|
|
|
USBCaptureProperties camProps = process.getCamera().getProperties();
|
2019-11-29 14:24:34 -05:00
|
|
|
int videomode = camProps.getCurrentVideoModeIndex();
|
|
|
|
|
StreamDivisor streamDivisor = process.cameraStreamer.getDivisor();
|
|
|
|
|
return new CameraJsonConfig(camProps.getFOV(), camProps.path, camProps.name, camProps.getNickname(), videomode, streamDivisor);
|
2019-11-26 17:57:51 -05:00
|
|
|
}
|
|
|
|
|
}
|