Create VideoCamera base class and move camera settings functions to it.

This makes them available for both UsbCamera and HttpCamera / AxisCamera.

To avoid virtual functions in the public-facing interface, move the
implementation of the camera settings functions to the core library.
This commit is contained in:
Peter Johnson
2017-01-01 14:24:13 -08:00
parent 23135d7a5a
commit 7ddbf20108
19 changed files with 581 additions and 186 deletions

View File

@@ -0,0 +1,63 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.cscore;
/// A source that represents a video camera.
public class VideoCamera extends VideoSource {
public class WhiteBalance {
public static final int kFixedIndoor = 3000;
public static final int kFixedOutdoor1 = 4000;
public static final int kFixedOutdoor2 = 5000;
public static final int kFixedFluorescent1 = 5100;
public static final int kFixedFlourescent2 = 5200;
}
protected VideoCamera(int handle) {
super(handle);
}
/// Set the brightness, as a percentage (0-100).
public synchronized void setBrightness(int brightness) {
CameraServerJNI.setCameraBrightness(m_handle, brightness);
}
/// Get the brightness, as a percentage (0-100).
public synchronized int getBrightness() {
return CameraServerJNI.getCameraBrightness(m_handle);
}
/// Set the white balance to auto.
public synchronized void setWhiteBalanceAuto() {
CameraServerJNI.setCameraWhiteBalanceAuto(m_handle);
}
/// Set the white balance to hold current.
public synchronized void setWhiteBalanceHoldCurrent() {
CameraServerJNI.setCameraWhiteBalanceHoldCurrent(m_handle);
}
/// Set the white balance to manual, with specified color temperature.
public synchronized void setWhiteBalanceManual(int value) {
CameraServerJNI.setCameraWhiteBalanceManual(m_handle, value);
}
/// Set the exposure to auto aperture.
public synchronized void setExposureAuto() {
CameraServerJNI.setCameraExposureAuto(m_handle);
}
/// Set the exposure to hold current.
public synchronized void setExposureHoldCurrent() {
CameraServerJNI.setCameraExposureHoldCurrent(m_handle);
}
/// Set the exposure to manual, as a percentage (0-100).
public synchronized void setExposureManual(int value) {
CameraServerJNI.setCameraExposureManual(m_handle, value);
}
}