mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Collapse boolean/double/enum properties into just integer.
This commit is contained in:
@@ -106,64 +106,37 @@ JNIEXPORT jstring JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyN
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getBooleanProperty
|
||||
* Signature: (I)Z
|
||||
* Method: getProperty
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getBooleanProperty
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getProperty
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
auto val = cs::GetBooleanProperty(property, &status);
|
||||
auto val = cs::GetProperty(property, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: setBooleanProperty
|
||||
* Signature: (IZ)V
|
||||
* Method: setProperty
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_setBooleanProperty
|
||||
(JNIEnv *env, jclass, jint property, jboolean value)
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_setProperty
|
||||
(JNIEnv *env, jclass, jint property, jint value)
|
||||
{
|
||||
CS_Status status;
|
||||
cs::SetBooleanProperty(property, value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getDoubleProperty
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getDoubleProperty
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
auto val = cs::GetDoubleProperty(property, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: setDoubleProperty
|
||||
* Signature: (ID)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_setDoubleProperty
|
||||
(JNIEnv *env, jclass, jint property, jdouble value)
|
||||
{
|
||||
CS_Status status;
|
||||
cs::SetDoubleProperty(property, value, &status);
|
||||
cs::SetProperty(property, value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getPropertyMin
|
||||
* Signature: (I)D
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyMin
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyMin
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
@@ -175,9 +148,9 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyM
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getPropertyMax
|
||||
* Signature: (I)D
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyMax
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyMax
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
@@ -189,9 +162,9 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyM
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getPropertyStep
|
||||
* Signature: (I)D
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyStep
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyStep
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
@@ -203,9 +176,9 @@ JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyS
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getPropertyDefault
|
||||
* Signature: (I)D
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyDefault
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyDefault
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
@@ -242,33 +215,6 @@ JNIEXPORT void JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_setStringProper
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getEnumProperty
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getEnumProperty
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
auto val = cs::GetEnumProperty(property, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: setEnumProperty
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_setEnumProperty
|
||||
(JNIEnv *env, jclass, jint property, jint value)
|
||||
{
|
||||
CS_Status status;
|
||||
cs::SetEnumProperty(property, value, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getEnumPropertyChoices
|
||||
|
||||
@@ -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);
|
||||
|
||||
//
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user