CvSource: Update interface functions.

- Add SetDescription
- Supply minimum, maximum, step, defaultValue, and value to CreateProperty
- Add SetEnumPropertyChoices
This commit is contained in:
Peter Johnson
2016-10-23 08:43:06 -07:00
parent 1f6b386325
commit 9142cbb820
9 changed files with 182 additions and 36 deletions

View File

@@ -119,11 +119,12 @@ public class CameraServerJNI {
public static native void putSourceFrame(int source, long imageNativeObj);
public static native void notifySourceError(int source, String msg);
public static native void setSourceConnected(int source, boolean connected);
public static native int createSourceProperty(int source, String name, int type);
public static native void setSourceDescription(int source, String description);
public static native int createSourceProperty(int source, String name, int type, int minimum, int maximum, int step, int defaultValue, int value);
//public static native int createSourcePropertyCallback(int source, String name,
// int type,
// void (*onChange)(String name,
// int property));
// int type, int minimum, int maximum, int step, int defaultValue, int value,
// void (*onChange)(int property));
public static native void setSourceEnumPropertyChoices(int source, int property, String[] choices);
public static native void removeSourceProperty(int source, int property);
public static native void removeSourcePropertyByName(int source, String name);

View File

@@ -46,25 +46,48 @@ public class CvSource extends VideoSource {
CameraServerJNI.setSourceConnected(m_handle, connected);
}
/// Set source description.
/// @param description Description
public void setDescription(String description) {
CameraServerJNI.setSourceDescription(m_handle, description);
}
/// Create a property.
/// @param name Property name
/// @param type Property type
/// @param minimum Minimum value
/// @param maximum Maximum value
/// @param step Step value
/// @param defaultValue Default value
/// @param value Current value
/// @return Property
public VideoProperty createProperty(String name, VideoProperty.Type type) {
public VideoProperty createProperty(String name, VideoProperty.Type type, int minimum, int maximum, int step, int defaultValue, int value) {
return new VideoProperty(
CameraServerJNI.createSourceProperty(m_handle, name, type.getValue()));
CameraServerJNI.createSourceProperty(m_handle, name, type.getValue(), minimum, maximum, step, defaultValue, value));
}
/// Create a property with a change callback.
/// @param name Property name
/// @param type Property type
/// @param minimum Minimum value
/// @param maximum Maximum value
/// @param step Step value
/// @param defaultValue Default value
/// @param value Current value
/// @param onChange Callback to call when the property value changes
/// @return Property
//public VideoProperty createProperty(
// String name, VideoProperty.Type type,
// std::function<void(String name, VideoProperty property)>
// String name, VideoProperty.Type type, int minimum, int maximum, int step, int defaultValue, int value,
// std::function<void(VideoProperty property)>
// onChange);
/// Configure enum property choices.
/// @param property Property
/// @param choices Choices
public void SetEnumPropertyChoices(VideoProperty property, String[] choices) {
CameraServerJNI.setSourceEnumPropertyChoices(m_handle, property.m_handle, choices);
}
/// Remove a property.
/// @param name Property name
public void removeProperty(VideoProperty property) {