mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Consistently name property max/min functions and add step/default.
This commit is contained in:
@@ -70,8 +70,10 @@ void CS_SetBooleanProperty(CS_Property property, CS_Bool value,
|
||||
double CS_GetDoubleProperty(CS_Property property, CS_Status* status);
|
||||
void CS_SetDoubleProperty(CS_Property property, double value,
|
||||
CS_Status* status);
|
||||
double CS_GetDoublePropertyMin(CS_Property property, CS_Status* status);
|
||||
double CS_GetDoublePropertyMax(CS_Property property, CS_Status* status);
|
||||
double CS_GetPropertyMin(CS_Property property, CS_Status* status);
|
||||
double CS_GetPropertyMax(CS_Property property, CS_Status* status);
|
||||
double CS_GetPropertyStep(CS_Property property, CS_Status* status);
|
||||
double CS_GetPropertyDefault(CS_Property property, CS_Status* status);
|
||||
char* CS_GetStringProperty(CS_Property property, CS_Status* status);
|
||||
void CS_SetStringProperty(CS_Property property, const char* value,
|
||||
CS_Status* status);
|
||||
|
||||
@@ -55,8 +55,10 @@ bool GetBooleanProperty(CS_Property property, CS_Status* status);
|
||||
void SetBooleanProperty(CS_Property property, bool value, CS_Status* status);
|
||||
double GetDoubleProperty(CS_Property property, CS_Status* status);
|
||||
void SetDoubleProperty(CS_Property property, double value, CS_Status* status);
|
||||
double GetDoublePropertyMin(CS_Property property, CS_Status* status);
|
||||
double GetDoublePropertyMax(CS_Property property, CS_Status* status);
|
||||
double GetPropertyMin(CS_Property property, CS_Status* status);
|
||||
double GetPropertyMax(CS_Property property, CS_Status* status);
|
||||
double GetPropertyStep(CS_Property property, CS_Status* status);
|
||||
double GetPropertyDefault(CS_Property property, CS_Status* status);
|
||||
std::string GetStringProperty(CS_Property property, CS_Status* status);
|
||||
llvm::StringRef GetStringProperty(CS_Property property,
|
||||
llvm::SmallVectorImpl<char>& buf,
|
||||
|
||||
@@ -60,6 +60,8 @@ class VideoProperty {
|
||||
void SetDouble(double value);
|
||||
double GetMin() const;
|
||||
double GetMax() const;
|
||||
double GetStep() const;
|
||||
double GetDefault() const;
|
||||
|
||||
// String-specific functions
|
||||
std::string GetString() const;
|
||||
|
||||
@@ -37,12 +37,22 @@ inline void VideoProperty::SetDouble(double value) {
|
||||
|
||||
inline double VideoProperty::GetMin() const {
|
||||
m_status = 0;
|
||||
return GetDoublePropertyMin(m_handle, &m_status);
|
||||
return GetPropertyMin(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline double VideoProperty::GetMax() const {
|
||||
m_status = 0;
|
||||
return GetDoublePropertyMax(m_handle, &m_status);
|
||||
return GetPropertyMax(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline double VideoProperty::GetStep() const {
|
||||
m_status = 0;
|
||||
return GetPropertyStep(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline double VideoProperty::GetDefault() const {
|
||||
m_status = 0;
|
||||
return GetPropertyDefault(m_handle, &m_status);
|
||||
}
|
||||
|
||||
inline std::string VideoProperty::GetString() const {
|
||||
|
||||
@@ -160,28 +160,56 @@ JNIEXPORT void JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_setDoubleProper
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getDoublePropertyMin
|
||||
* Method: getPropertyMin
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getDoublePropertyMin
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyMin
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
auto val = cs::GetDoublePropertyMin(property, &status);
|
||||
auto val = cs::GetPropertyMin(property, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getDoublePropertyMax
|
||||
* Method: getPropertyMax
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getDoublePropertyMax
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyMax
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
auto val = cs::GetDoublePropertyMax(property, &status);
|
||||
auto val = cs::GetPropertyMax(property, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getPropertyStep
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyStep
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
auto val = cs::GetPropertyStep(property, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_cameraserver_CameraServerJNI
|
||||
* Method: getPropertyDefault
|
||||
* Signature: (I)D
|
||||
*/
|
||||
JNIEXPORT jdouble JNICALL Java_edu_wpi_cameraserver_CameraServerJNI_getPropertyDefault
|
||||
(JNIEnv *env, jclass, jint property)
|
||||
{
|
||||
CS_Status status;
|
||||
auto val = cs::GetPropertyDefault(property, &status);
|
||||
CheckStatus(env, status);
|
||||
return val;
|
||||
}
|
||||
|
||||
@@ -81,8 +81,10 @@ public class CameraServerJNI {
|
||||
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 getDoublePropertyMin(int property);
|
||||
public static native double getDoublePropertyMax(int property);
|
||||
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 String getStringProperty(int property);
|
||||
public static native void setStringProperty(int property, String value);
|
||||
public static native int getEnumProperty(int property);
|
||||
|
||||
@@ -70,11 +70,19 @@ public class VideoProperty {
|
||||
}
|
||||
|
||||
public double getMin() {
|
||||
return CameraServerJNI.getDoublePropertyMin(m_handle);
|
||||
return CameraServerJNI.getPropertyMin(m_handle);
|
||||
}
|
||||
|
||||
public double getMax() {
|
||||
return CameraServerJNI.getDoublePropertyMax(m_handle);
|
||||
return CameraServerJNI.getPropertyMax(m_handle);
|
||||
}
|
||||
|
||||
public double getStep() {
|
||||
return CameraServerJNI.getPropertyStep(m_handle);
|
||||
}
|
||||
|
||||
public double getDefault() {
|
||||
return CameraServerJNI.getPropertyDefault(m_handle);
|
||||
}
|
||||
|
||||
// String-specific functions
|
||||
|
||||
@@ -90,6 +90,8 @@ class SourceImpl {
|
||||
virtual void SetDoubleProperty(int property, double value) = 0;
|
||||
virtual double GetPropertyMin(int property) const = 0;
|
||||
virtual double GetPropertyMax(int property) const = 0;
|
||||
virtual double GetPropertyStep(int property) const = 0;
|
||||
virtual double GetPropertyDefault(int property) const = 0;
|
||||
virtual llvm::StringRef GetStringProperty(
|
||||
int property, llvm::SmallVectorImpl<char>& buf) const = 0;
|
||||
virtual void SetStringProperty(int property, llvm::StringRef value) = 0;
|
||||
|
||||
@@ -56,12 +56,20 @@ void CS_SetDoubleProperty(CS_Property property, double value,
|
||||
return cs::SetDoubleProperty(property, value, status);
|
||||
}
|
||||
|
||||
double CS_GetDoublePropertyMin(CS_Property property, CS_Status* status) {
|
||||
return cs::GetDoublePropertyMin(property, status);
|
||||
double CS_GetPropertyMin(CS_Property property, CS_Status* status) {
|
||||
return cs::GetPropertyMin(property, status);
|
||||
}
|
||||
|
||||
double CS_GetDoublePropertyMax(CS_Property property, CS_Status* status) {
|
||||
return cs::GetDoublePropertyMax(property, status);
|
||||
double CS_GetPropertyMax(CS_Property property, CS_Status* status) {
|
||||
return cs::GetPropertyMax(property, status);
|
||||
}
|
||||
|
||||
double CS_GetPropertyStep(CS_Property property, CS_Status* status) {
|
||||
return cs::GetPropertyStep(property, status);
|
||||
}
|
||||
|
||||
double CS_GetPropertyDefault(CS_Property property, CS_Status* status) {
|
||||
return cs::GetPropertyDefault(property, status);
|
||||
}
|
||||
|
||||
char* CS_GetStringProperty(CS_Property property, CS_Status* status) {
|
||||
|
||||
@@ -92,20 +92,34 @@ void SetDoubleProperty(CS_Property property, double value, CS_Status* status) {
|
||||
source->SetDoubleProperty(propertyIndex, value);
|
||||
}
|
||||
|
||||
double GetDoublePropertyMin(CS_Property property, CS_Status* status) {
|
||||
double GetPropertyMin(CS_Property property, CS_Status* status) {
|
||||
int propertyIndex;
|
||||
auto source = GetPropertySource(property, &propertyIndex, status);
|
||||
if (!source) return 0.0;
|
||||
return source->GetPropertyMin(propertyIndex);
|
||||
}
|
||||
|
||||
double GetDoublePropertyMax(CS_Property property, CS_Status* status) {
|
||||
double GetPropertyMax(CS_Property property, CS_Status* status) {
|
||||
int propertyIndex;
|
||||
auto source = GetPropertySource(property, &propertyIndex, status);
|
||||
if (!source) return 0.0;
|
||||
return source->GetPropertyMax(propertyIndex);
|
||||
}
|
||||
|
||||
double GetPropertyStep(CS_Property property, CS_Status* status) {
|
||||
int propertyIndex;
|
||||
auto source = GetPropertySource(property, &propertyIndex, status);
|
||||
if (!source) return 0.0;
|
||||
return source->GetPropertyStep(propertyIndex);
|
||||
}
|
||||
|
||||
double GetPropertyDefault(CS_Property property, CS_Status* status) {
|
||||
int propertyIndex;
|
||||
auto source = GetPropertySource(property, &propertyIndex, status);
|
||||
if (!source) return 0.0;
|
||||
return source->GetPropertyDefault(propertyIndex);
|
||||
}
|
||||
|
||||
std::string GetStringProperty(CS_Property property, CS_Status* status) {
|
||||
llvm::SmallString<128> value;
|
||||
int propertyIndex;
|
||||
|
||||
Reference in New Issue
Block a user