Collapse boolean/double/enum properties into just integer.

This commit is contained in:
Peter Johnson
2016-09-20 22:17:12 -07:00
parent 8fbc23b1fa
commit d5e5755ff4
13 changed files with 123 additions and 357 deletions

View File

@@ -77,18 +77,14 @@ public class CameraServerJNI {
//
public static native int getPropertyType(int property);
public static native String getPropertyName(int property);
public static native boolean getBooleanProperty(int property);
public static native void setBooleanProperty(int property, boolean value);
public static native double getDoubleProperty(int property);
public static native void setDoubleProperty(int property, double value);
public static native double getPropertyMin(int property);
public static native double getPropertyMax(int property);
public static native double getPropertyStep(int property);
public static native double getPropertyDefault(int property);
public static native int getProperty(int property);
public static native void setProperty(int property, int value);
public static native int getPropertyMin(int property);
public static native int getPropertyMax(int property);
public static native int getPropertyStep(int property);
public static native int getPropertyDefault(int property);
public static native String getStringProperty(int property);
public static native void setStringProperty(int property, String value);
public static native int getEnumProperty(int property);
public static native void setEnumProperty(int property, int value);
public static native String[] getEnumPropertyChoices(int property);
//

View File

@@ -9,7 +9,7 @@ package edu.wpi.cameraserver;
public class VideoProperty {
public enum Type {
kNone(0), kBoolean(1), kDouble(2), kString(3), kEnum(4);
kNone(0), kBoolean(1), kInteger(2), kString(4), kEnum(8);
private int value;
private Type(int value) {
@@ -39,8 +39,8 @@ public class VideoProperty {
return m_type == Type.kBoolean;
}
public boolean isDouble() {
return m_type == Type.kDouble;
public boolean isInteger() {
return m_type == Type.kInteger;
}
public boolean isString() {
@@ -51,37 +51,27 @@ public class VideoProperty {
return m_type == Type.kEnum;
}
// Boolean-specific functions
public boolean getBoolean() {
return CameraServerJNI.getBooleanProperty(m_handle);
public int get() {
return CameraServerJNI.getProperty(m_handle);
}
public void setBoolean(boolean value) {
CameraServerJNI.setBooleanProperty(m_handle, value);
public void set(int value) {
CameraServerJNI.setProperty(m_handle, value);
}
// Double-specific functions
public double getDouble() {
return CameraServerJNI.getDoubleProperty(m_handle);
}
public void setDouble(double value) {
CameraServerJNI.setDoubleProperty(m_handle, value);
}
public double getMin() {
public int getMin() {
return CameraServerJNI.getPropertyMin(m_handle);
}
public double getMax() {
public int getMax() {
return CameraServerJNI.getPropertyMax(m_handle);
}
public double getStep() {
public int getStep() {
return CameraServerJNI.getPropertyStep(m_handle);
}
public double getDefault() {
public int getDefault() {
return CameraServerJNI.getPropertyDefault(m_handle);
}
@@ -95,14 +85,6 @@ public class VideoProperty {
}
// Enum-specific functions
public int getEnum() {
return CameraServerJNI.getEnumProperty(m_handle);
}
public void setEnum(int value) {
CameraServerJNI.setEnumProperty(m_handle, value);
}
public String[] getChoices() {
return CameraServerJNI.getEnumPropertyChoices(m_handle);
}