mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Rename Type to Kind.
This commit is contained in:
@@ -87,7 +87,7 @@ public class CameraServerJNI {
|
||||
//
|
||||
// Property Functions
|
||||
//
|
||||
public static native int getPropertyType(int property);
|
||||
public static native int getPropertyKind(int property);
|
||||
public static native String getPropertyName(int property);
|
||||
public static native int getProperty(int property);
|
||||
public static native void setProperty(int property, int value);
|
||||
@@ -110,7 +110,7 @@ public class CameraServerJNI {
|
||||
//
|
||||
// Source Functions
|
||||
//
|
||||
public static native int getSourceType(int source);
|
||||
public static native int getSourceKind(int source);
|
||||
public static native String getSourceName(int source);
|
||||
public static native String getSourceDescription(int source);
|
||||
public static native long getSourceLastFrameTime(int source);
|
||||
@@ -134,7 +134,7 @@ public class CameraServerJNI {
|
||||
public static native void notifySourceError(int source, String msg);
|
||||
public static native void setSourceConnected(int source, boolean connected);
|
||||
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 createSourceProperty(int source, String name, int kind, int minimum, int maximum, int step, int defaultValue, int value);
|
||||
public static native void setSourceEnumPropertyChoices(int source, int property, String[] choices);
|
||||
|
||||
//
|
||||
@@ -148,7 +148,7 @@ public class CameraServerJNI {
|
||||
//
|
||||
// Sink Functions
|
||||
//
|
||||
public static native int getSinkType(int sink);
|
||||
public static native int getSinkKind(int sink);
|
||||
public static native String getSinkName(int sink);
|
||||
public static native String getSinkDescription(int sink);
|
||||
public static native void setSinkSource(int sink, int source);
|
||||
|
||||
@@ -54,21 +54,21 @@ public class CvSource extends VideoSource {
|
||||
|
||||
/// Create a property.
|
||||
/// @param name Property name
|
||||
/// @param type Property type
|
||||
/// @param kind Property kind
|
||||
/// @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, int minimum, int maximum, int step, int defaultValue, int value) {
|
||||
public VideoProperty createProperty(String name, VideoProperty.Kind kind, int minimum, int maximum, int step, int defaultValue, int value) {
|
||||
return new VideoProperty(
|
||||
CameraServerJNI.createSourceProperty(m_handle, name, type.getValue(), minimum, maximum, step, defaultValue, value));
|
||||
CameraServerJNI.createSourceProperty(m_handle, name, kind.getValue(), minimum, maximum, step, defaultValue, value));
|
||||
}
|
||||
|
||||
/// Create a property with a change callback.
|
||||
/// @param name Property name
|
||||
/// @param type Property type
|
||||
/// @param kind Property kind
|
||||
/// @param minimum Minimum value
|
||||
/// @param maximum Maximum value
|
||||
/// @param step Step value
|
||||
@@ -77,7 +77,7 @@ public class CvSource extends VideoSource {
|
||||
/// @param onChange Callback to call when the property value changes
|
||||
/// @return Property
|
||||
//public VideoProperty createProperty(
|
||||
// String name, VideoProperty.Type type, int minimum, int maximum, int step, int defaultValue, int value,
|
||||
// String name, VideoProperty.Kind kind, int minimum, int maximum, int step, int defaultValue, int value,
|
||||
// std::function<void(VideoProperty property)>
|
||||
// onChange);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ package edu.wpi.cscore;
|
||||
|
||||
/// Video event
|
||||
public class VideoEvent {
|
||||
public enum Type {
|
||||
public enum Kind {
|
||||
kSourceCreated(0x0001),
|
||||
kSourceDestroyed(0x0002),
|
||||
kSourceConnected(0x0004),
|
||||
@@ -27,7 +27,7 @@ public class VideoEvent {
|
||||
|
||||
private int value;
|
||||
|
||||
private Type(int value) {
|
||||
private Kind(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -35,23 +35,23 @@ public class VideoEvent {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
private static final Type[] m_typeValues = Type.values();
|
||||
private static final Kind[] m_kindValues = Kind.values();
|
||||
|
||||
VideoEvent(int type, int source, int sink, String name, int pixelFormat,
|
||||
int width, int height, int fps, int property, int propertyType,
|
||||
VideoEvent(int kind, int source, int sink, String name, int pixelFormat,
|
||||
int width, int height, int fps, int property, int propertyKind,
|
||||
int value, String valueStr) {
|
||||
this.type = m_typeValues[type];
|
||||
this.kind = m_kindValues[kind];
|
||||
this.sourceHandle = source;
|
||||
this.sinkHandle = sink;
|
||||
this.name = name;
|
||||
this.mode = new VideoMode(pixelFormat, width, height, fps);
|
||||
this.propertyHandle = property;
|
||||
this.propertyType = VideoProperty.m_typeValues[propertyType];
|
||||
this.propertyKind = VideoProperty.m_kindValues[propertyKind];
|
||||
this.value = value;
|
||||
this.valueStr = valueStr;
|
||||
}
|
||||
|
||||
public Type type;
|
||||
public Kind kind;
|
||||
|
||||
// Valid for kSource* and kSink* respectively
|
||||
private int sourceHandle;
|
||||
@@ -65,7 +65,7 @@ public class VideoEvent {
|
||||
|
||||
// Fields for kSourceProperty* events
|
||||
private int propertyHandle;
|
||||
public VideoProperty.Type propertyType;
|
||||
public VideoProperty.Kind propertyKind;
|
||||
public int value;
|
||||
public String valueStr;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class VideoEvent {
|
||||
}
|
||||
|
||||
public VideoProperty getProperty() {
|
||||
return new VideoProperty(propertyHandle, propertyType);
|
||||
return new VideoProperty(propertyHandle, propertyKind);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
package edu.wpi.cscore;
|
||||
|
||||
public class VideoProperty {
|
||||
public enum Type {
|
||||
public enum Kind {
|
||||
kNone(0), kBoolean(1), kInteger(2), kString(4), kEnum(8);
|
||||
private int value;
|
||||
|
||||
private Type(int value) {
|
||||
private Kind(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -20,35 +20,35 @@ public class VideoProperty {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
static final Type[] m_typeValues = Type.values();
|
||||
static final Kind[] m_kindValues = Kind.values();
|
||||
|
||||
public String getName() {
|
||||
return CameraServerJNI.getPropertyName(m_handle);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return m_type;
|
||||
public Kind getKind() {
|
||||
return m_kind;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return m_type != Type.kNone;
|
||||
return m_kind != Kind.kNone;
|
||||
}
|
||||
|
||||
// Type checkers
|
||||
// Kind checkers
|
||||
public boolean isBoolean() {
|
||||
return m_type == Type.kBoolean;
|
||||
return m_kind == Kind.kBoolean;
|
||||
}
|
||||
|
||||
public boolean isInteger() {
|
||||
return m_type == Type.kInteger;
|
||||
return m_kind == Kind.kInteger;
|
||||
}
|
||||
|
||||
public boolean isString() {
|
||||
return m_type == Type.kString;
|
||||
return m_kind == Kind.kString;
|
||||
}
|
||||
|
||||
public boolean isEnum() {
|
||||
return m_type == Type.kEnum;
|
||||
return m_kind == Kind.kEnum;
|
||||
}
|
||||
|
||||
public int get() {
|
||||
@@ -91,14 +91,14 @@ public class VideoProperty {
|
||||
|
||||
VideoProperty(int handle) {
|
||||
m_handle = handle;
|
||||
m_type = m_typeValues[CameraServerJNI.getPropertyType(handle)];
|
||||
m_kind = m_kindValues[CameraServerJNI.getPropertyKind(handle)];
|
||||
}
|
||||
|
||||
VideoProperty(int handle, Type type) {
|
||||
VideoProperty(int handle, Kind kind) {
|
||||
m_handle = handle;
|
||||
m_type = type;
|
||||
m_kind = kind;
|
||||
}
|
||||
|
||||
int m_handle;
|
||||
private Type m_type;
|
||||
private Kind m_kind;
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@ package edu.wpi.cscore;
|
||||
/// consist of multiple images (e.g. from a stereo or depth camera); these
|
||||
/// are called channels.
|
||||
public class VideoSink {
|
||||
public enum Type {
|
||||
public enum Kind {
|
||||
kUnknown(0), kMJPEG(2), kCv(4);
|
||||
private int value;
|
||||
|
||||
private Type(int value) {
|
||||
private Kind(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class VideoSink {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
static final Type[] m_typeValues = Type.values();
|
||||
static final Kind[] m_kindValues = Kind.values();
|
||||
|
||||
protected VideoSink(int handle) {
|
||||
m_handle = handle;
|
||||
@@ -56,9 +56,9 @@ public class VideoSink {
|
||||
return m_handle;
|
||||
}
|
||||
|
||||
/// Get the type of the sink.
|
||||
public Type getType() {
|
||||
return m_typeValues[CameraServerJNI.getSinkType(m_handle)];
|
||||
/// Get the kind of the sink.
|
||||
public Kind getKind() {
|
||||
return m_kindValues[CameraServerJNI.getSinkKind(m_handle)];
|
||||
}
|
||||
|
||||
/// Get the name of the sink. The name is an arbitrary identifier
|
||||
@@ -67,7 +67,7 @@ public class VideoSink {
|
||||
return CameraServerJNI.getSinkName(m_handle);
|
||||
}
|
||||
|
||||
/// Get the sink description. This is sink-type specific.
|
||||
/// Get the sink description. This is sink-kind specific.
|
||||
public String getDescription() {
|
||||
return CameraServerJNI.getSinkDescription(m_handle);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class VideoSink {
|
||||
|
||||
/// Get a property of the associated source.
|
||||
/// @param name Property name
|
||||
/// @return Property (type Property::kNone if no property with
|
||||
/// @return Property (kind Property::kNone if no property with
|
||||
/// the given name exists or no source connected)
|
||||
public VideoProperty getSourceProperty(String name) {
|
||||
return new VideoProperty(
|
||||
|
||||
@@ -11,11 +11,11 @@ package edu.wpi.cscore;
|
||||
/// consist of multiple images (e.g. from a stereo or depth camera); these
|
||||
/// are called channels.
|
||||
public class VideoSource {
|
||||
public enum Type {
|
||||
public enum Kind {
|
||||
kUnknown(0), kUSB(1), kHTTP(2), kCv(4);
|
||||
private int value;
|
||||
|
||||
private Type(int value) {
|
||||
private Kind(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class VideoSource {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
static final Type[] m_typeValues = Type.values();
|
||||
static final Kind[] m_kindValues = Kind.values();
|
||||
|
||||
protected VideoSource(int handle) {
|
||||
m_handle = handle;
|
||||
@@ -56,9 +56,9 @@ public class VideoSource {
|
||||
return m_handle;
|
||||
}
|
||||
|
||||
/// Get the type of the source.
|
||||
public Type getType() {
|
||||
return m_typeValues[CameraServerJNI.getSourceType(m_handle)];
|
||||
/// Get the kind of the source.
|
||||
public Kind getKind() {
|
||||
return m_kindValues[CameraServerJNI.getSourceKind(m_handle)];
|
||||
}
|
||||
|
||||
/// Get the name of the source. The name is an arbitrary identifier
|
||||
@@ -67,7 +67,7 @@ public class VideoSource {
|
||||
return CameraServerJNI.getSourceName(m_handle);
|
||||
}
|
||||
|
||||
/// Get the source description. This is source-type specific.
|
||||
/// Get the source description. This is source-kind specific.
|
||||
public String getDescription() {
|
||||
return CameraServerJNI.getSourceDescription(m_handle);
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class VideoSource {
|
||||
|
||||
/// Get a property.
|
||||
/// @param name Property name
|
||||
/// @return Property contents (of type Property::kNone if no property with
|
||||
/// @return Property contents (of kind Property::kNone if no property with
|
||||
/// the given name exists)
|
||||
public VideoProperty getProperty(String name) {
|
||||
return new VideoProperty(CameraServerJNI.getSourceProperty(m_handle, name));
|
||||
|
||||
Reference in New Issue
Block a user