mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[docs] Build with JavaDoc 17 and add missing docs (#6220)
Co-authored-by: Sam Carlberg <sam.carlberg@gmail.com>
This commit is contained in:
@@ -74,18 +74,62 @@ public class CameraServerCvJNI {
|
||||
libraryLoaded = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a CV source.
|
||||
*
|
||||
* @param name Name.
|
||||
* @param pixelFormat OpenCV pixel format.
|
||||
* @param width Image width.
|
||||
* @param height Image height.
|
||||
* @param fps Frames per second.
|
||||
* @return CV source.
|
||||
*/
|
||||
public static native int createCvSource(
|
||||
String name, int pixelFormat, int width, int height, int fps);
|
||||
|
||||
/**
|
||||
* Put source frame.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param imageNativeObj Image native object handle.
|
||||
*/
|
||||
public static native void putSourceFrame(int source, long imageNativeObj);
|
||||
|
||||
/**
|
||||
* Creates a CV sink.
|
||||
*
|
||||
* @param name Name.
|
||||
* @param pixelFormat OpenCV pixel format.
|
||||
* @return CV sink handle.
|
||||
*/
|
||||
public static native int createCvSink(String name, int pixelFormat);
|
||||
|
||||
// /**
|
||||
// * Creates a CV sink callback.
|
||||
// *
|
||||
// * @param name Name.
|
||||
// * @param processFrame Process frame callback.
|
||||
// */
|
||||
// public static native int createCvSinkCallback(String name,
|
||||
// void (*processFrame)(long time));
|
||||
|
||||
/**
|
||||
* Returns sink frame handle.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @param imageNativeObj Image native object handle.
|
||||
* @return Sink frame handle.
|
||||
*/
|
||||
public static native long grabSinkFrame(int sink, long imageNativeObj);
|
||||
|
||||
/**
|
||||
* Returns sink frame timeout in microseconds.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @param imageNativeObj Image native object handle.
|
||||
* @param timeout Timeout in seconds.
|
||||
* @return Sink frame timeout in microseconds.
|
||||
*/
|
||||
public static native long grabSinkFrameTimeout(int sink, long imageNativeObj, double timeout);
|
||||
|
||||
/** Utility class. */
|
||||
|
||||
@@ -77,140 +77,521 @@ public class CameraServerJNI {
|
||||
//
|
||||
// Property Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns property kind.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @return Property kind.
|
||||
*/
|
||||
public static native int getPropertyKind(int property);
|
||||
|
||||
/**
|
||||
* Returns property name.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @return Property name.
|
||||
*/
|
||||
public static native String getPropertyName(int property);
|
||||
|
||||
/**
|
||||
* Returns property value.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @return Property value.
|
||||
*/
|
||||
public static native int getProperty(int property);
|
||||
|
||||
/**
|
||||
* Sets property value.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @param value Property value.
|
||||
*/
|
||||
public static native void setProperty(int property, int value);
|
||||
|
||||
/**
|
||||
* Returns property minimum.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @return Property minimum.
|
||||
*/
|
||||
public static native int getPropertyMin(int property);
|
||||
|
||||
/**
|
||||
* Returns property maximum.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @return Property maximum.
|
||||
*/
|
||||
public static native int getPropertyMax(int property);
|
||||
|
||||
/**
|
||||
* Returns property step.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @return Property step.
|
||||
*/
|
||||
public static native int getPropertyStep(int property);
|
||||
|
||||
/**
|
||||
* Returns property default value.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @return Property default value.
|
||||
*/
|
||||
public static native int getPropertyDefault(int property);
|
||||
|
||||
/**
|
||||
* Returns property value as a string.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @return Property value as a string.
|
||||
*/
|
||||
public static native String getStringProperty(int property);
|
||||
|
||||
/**
|
||||
* Sets property value to a string.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @param value Property value string.
|
||||
*/
|
||||
public static native void setStringProperty(int property, String value);
|
||||
|
||||
/**
|
||||
* Returns enum of possible property value strings.
|
||||
*
|
||||
* @param property Property handle.
|
||||
* @return Enum of possible property value strings.
|
||||
*/
|
||||
public static native String[] getEnumPropertyChoices(int property);
|
||||
|
||||
//
|
||||
// Source Creation Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Creates a new USB camera by device.
|
||||
*
|
||||
* @param name USB camera name.
|
||||
* @param dev USB camera device number.
|
||||
* @return USB camera handle.
|
||||
*/
|
||||
public static native int createUsbCameraDev(String name, int dev);
|
||||
|
||||
/**
|
||||
* Creates a new USB camera by path.
|
||||
*
|
||||
* @param name USB camera name.
|
||||
* @param path USB camera path.
|
||||
* @return USB camera handle.
|
||||
*/
|
||||
public static native int createUsbCameraPath(String name, String path);
|
||||
|
||||
/**
|
||||
* Creates an HTTP camera.
|
||||
*
|
||||
* @param name HTTP camera name.
|
||||
* @param url HTTP camera stream URL.
|
||||
* @param kind HTTP camera kind.
|
||||
* @return HTTP camera handle.
|
||||
*/
|
||||
public static native int createHttpCamera(String name, String url, int kind);
|
||||
|
||||
/**
|
||||
* Creates an HTTP camera from multiple URLs.
|
||||
*
|
||||
* @param name HTTP camera name.
|
||||
* @param urls HTTP camera stream URLs.
|
||||
* @param kind HTTP camera kind.
|
||||
* @return HTTP camera handle.
|
||||
*/
|
||||
public static native int createHttpCameraMulti(String name, String[] urls, int kind);
|
||||
|
||||
/**
|
||||
* Creates a raw source.
|
||||
*
|
||||
* @param name Source name.
|
||||
* @param pixelFormat Pixel format.
|
||||
* @param width Image width.
|
||||
* @param height Image height.
|
||||
* @param fps Source frames per second.
|
||||
* @return Raw source handle.
|
||||
*/
|
||||
public static native int createRawSource(
|
||||
String name, int pixelFormat, int width, int height, int fps);
|
||||
|
||||
//
|
||||
// Source Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns source kind.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return Source kind.
|
||||
*/
|
||||
public static native int getSourceKind(int source);
|
||||
|
||||
/**
|
||||
* Returns source name.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return Source name.
|
||||
*/
|
||||
public static native String getSourceName(int source);
|
||||
|
||||
/**
|
||||
* Returns source description.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return Source description.
|
||||
*/
|
||||
public static native String getSourceDescription(int source);
|
||||
|
||||
/**
|
||||
* Returns source's last frame time.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return Source's last frame time.
|
||||
*/
|
||||
public static native long getSourceLastFrameTime(int source);
|
||||
|
||||
/**
|
||||
* Sets source connection strategy.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param strategy Connection strategy.
|
||||
*/
|
||||
public static native void setSourceConnectionStrategy(int source, int strategy);
|
||||
|
||||
/**
|
||||
* Returns true if source is connected.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return True if source is connected.
|
||||
*/
|
||||
public static native boolean isSourceConnected(int source);
|
||||
|
||||
/**
|
||||
* Returns true if source is enabled.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return True if source is enabled.
|
||||
*/
|
||||
public static native boolean isSourceEnabled(int source);
|
||||
|
||||
/**
|
||||
* Returns source property.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param name Source property name.
|
||||
* @return Source property.
|
||||
*/
|
||||
public static native int getSourceProperty(int source, String name);
|
||||
|
||||
/**
|
||||
* Returns list of source property handles.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return List of source property handles.
|
||||
*/
|
||||
public static native int[] enumerateSourceProperties(int source);
|
||||
|
||||
/**
|
||||
* Returns source video mode.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return Source video mode.
|
||||
*/
|
||||
public static native VideoMode getSourceVideoMode(int source);
|
||||
|
||||
/**
|
||||
* Sets source video mode.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param pixelFormat Pixel format.
|
||||
* @param width Image width.
|
||||
* @param height Image height.
|
||||
* @param fps Source frames per second.
|
||||
* @return True if set succeeded.
|
||||
*/
|
||||
public static native boolean setSourceVideoMode(
|
||||
int source, int pixelFormat, int width, int height, int fps);
|
||||
|
||||
/**
|
||||
* Sets source pixel format.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param pixelFormat Source pixel format.
|
||||
* @return True if set succeeded.
|
||||
*/
|
||||
public static native boolean setSourcePixelFormat(int source, int pixelFormat);
|
||||
|
||||
/**
|
||||
* Sets source resolution.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param width Image width.
|
||||
* @param height Image height.
|
||||
* @return True if set succeeded.
|
||||
*/
|
||||
public static native boolean setSourceResolution(int source, int width, int height);
|
||||
|
||||
/**
|
||||
* Sets source FPS.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param fps Source frames per second.
|
||||
* @return True if set succeeded.
|
||||
*/
|
||||
public static native boolean setSourceFPS(int source, int fps);
|
||||
|
||||
/**
|
||||
* Sets source configuration JSON.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param config Configuration JSON.
|
||||
* @return True if set succeeded.
|
||||
*/
|
||||
public static native boolean setSourceConfigJson(int source, String config);
|
||||
|
||||
/**
|
||||
* Returns source configuration JSON.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return Source configuration JSON.
|
||||
*/
|
||||
public static native String getSourceConfigJson(int source);
|
||||
|
||||
/**
|
||||
* Returns list of source's supported video modes.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return List of source's supported video modes.
|
||||
*/
|
||||
public static native VideoMode[] enumerateSourceVideoModes(int source);
|
||||
|
||||
/**
|
||||
* Returns list of source sinks.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return List of source sinks.
|
||||
*/
|
||||
public static native int[] enumerateSourceSinks(int source);
|
||||
|
||||
/**
|
||||
* Copies source.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return New source handle.
|
||||
*/
|
||||
public static native int copySource(int source);
|
||||
|
||||
/**
|
||||
* Releases source.
|
||||
*
|
||||
* @param source Source handle.
|
||||
*/
|
||||
public static native void releaseSource(int source);
|
||||
|
||||
//
|
||||
// Camera Source Common Property Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Sets camera brightness.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param brightness Brightness.
|
||||
*/
|
||||
public static native void setCameraBrightness(int source, int brightness);
|
||||
|
||||
/**
|
||||
* Returns camera brightness.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return Camera brightness.
|
||||
*/
|
||||
public static native int getCameraBrightness(int source);
|
||||
|
||||
/**
|
||||
* Sets camera white balance to auto.
|
||||
*
|
||||
* @param source Source handle.
|
||||
*/
|
||||
public static native void setCameraWhiteBalanceAuto(int source);
|
||||
|
||||
/**
|
||||
* Sets camera white balance to "hold current".
|
||||
*
|
||||
* @param source Source handle.
|
||||
*/
|
||||
public static native void setCameraWhiteBalanceHoldCurrent(int source);
|
||||
|
||||
/**
|
||||
* Sets camera white balance to the given value.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param value White balance.
|
||||
*/
|
||||
public static native void setCameraWhiteBalanceManual(int source, int value);
|
||||
|
||||
/**
|
||||
* Sets camera exposure to auto.
|
||||
*
|
||||
* @param source Source handle.
|
||||
*/
|
||||
public static native void setCameraExposureAuto(int source);
|
||||
|
||||
/**
|
||||
* Sets camera exposure to "hold current".
|
||||
*
|
||||
* @param source Source handle.
|
||||
*/
|
||||
public static native void setCameraExposureHoldCurrent(int source);
|
||||
|
||||
/**
|
||||
* Sets camera exposure to the given value.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param value Exposure.
|
||||
*/
|
||||
public static native void setCameraExposureManual(int source, int value);
|
||||
|
||||
//
|
||||
// UsbCamera Source Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Sets USB camera path.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param path USB camera path.
|
||||
*/
|
||||
public static native void setUsbCameraPath(int source, String path);
|
||||
|
||||
/**
|
||||
* Returns USB camera path.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return USB camera path.
|
||||
*/
|
||||
public static native String getUsbCameraPath(int source);
|
||||
|
||||
/**
|
||||
* Returns USB camera info.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return USB camera info.
|
||||
*/
|
||||
public static native UsbCameraInfo getUsbCameraInfo(int source);
|
||||
|
||||
//
|
||||
// HttpCamera Source Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns HTTP camera kind.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return HTTP camera kind.
|
||||
*/
|
||||
public static native int getHttpCameraKind(int source);
|
||||
|
||||
/**
|
||||
* Sets HTTP camera URLs.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param urls HTTP camera URLs.
|
||||
*/
|
||||
public static native void setHttpCameraUrls(int source, String[] urls);
|
||||
|
||||
/**
|
||||
* Returns HTTP camera URLs.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @return HTTP camera URLs.
|
||||
*/
|
||||
public static native String[] getHttpCameraUrls(int source);
|
||||
|
||||
//
|
||||
// Image Source Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Puts raw frame into source.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param frame Frame handle.
|
||||
*/
|
||||
public static native void putRawSourceFrame(int source, long frame);
|
||||
|
||||
/**
|
||||
* Puts raw frame into source.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param data Frame byte buffer.
|
||||
* @param size Frame size.
|
||||
* @param width Frame width.
|
||||
* @param height Frame height.
|
||||
* @param stride Frame stride.
|
||||
* @param pixelFormat Frame pixel format.
|
||||
*/
|
||||
public static native void putRawSourceFrameBB(
|
||||
int source, ByteBuffer data, int size, int width, int height, int stride, int pixelFormat);
|
||||
|
||||
/**
|
||||
* Puts raw frame into source.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param data Frame handle.
|
||||
* @param size Frame size.
|
||||
* @param width Frame width.
|
||||
* @param height Frame height.
|
||||
* @param stride Frame stride.
|
||||
* @param pixelFormat Frame pixel format.
|
||||
*/
|
||||
public static native void putRawSourceFrameData(
|
||||
int source, long data, int size, int width, int height, int stride, int pixelFormat);
|
||||
|
||||
/**
|
||||
* Notify source error.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param msg Error message.
|
||||
*/
|
||||
public static native void notifySourceError(int source, String msg);
|
||||
|
||||
/**
|
||||
* Sets whether source is connected.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param connected True if source is connected.
|
||||
*/
|
||||
public static native void setSourceConnected(int source, boolean connected);
|
||||
|
||||
/**
|
||||
* Sets source description.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param description Source description.
|
||||
*/
|
||||
public static native void setSourceDescription(int source, String description);
|
||||
|
||||
/**
|
||||
* Creates a source property.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param name Property name.
|
||||
* @param kind Property kind.
|
||||
* @param minimum Property minimum.
|
||||
* @param maximum Property maximum.
|
||||
* @param step Property step.
|
||||
* @param defaultValue Property default value.
|
||||
* @param value Property value.
|
||||
* @return Source property handle.
|
||||
*/
|
||||
public static native int createSourceProperty(
|
||||
int source,
|
||||
String name,
|
||||
@@ -221,88 +602,288 @@ public class CameraServerJNI {
|
||||
int defaultValue,
|
||||
int value);
|
||||
|
||||
/**
|
||||
* Sets list of possible property values.
|
||||
*
|
||||
* @param source Source handle.
|
||||
* @param property Property handle.
|
||||
* @param choices List of possible property values.
|
||||
*/
|
||||
public static native void setSourceEnumPropertyChoices(
|
||||
int source, int property, String[] choices);
|
||||
|
||||
//
|
||||
// Sink Creation Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Creates an MJPEG server.
|
||||
*
|
||||
* @param name MJPEG server name.
|
||||
* @param listenAddress IP address at which server should listen.
|
||||
* @param port Port on which server should listen.
|
||||
* @return MJPEG server handle.
|
||||
*/
|
||||
public static native int createMjpegServer(String name, String listenAddress, int port);
|
||||
|
||||
/**
|
||||
* Creates a raw sink.
|
||||
*
|
||||
* @param name Sink name.
|
||||
* @return Raw sink handle.
|
||||
*/
|
||||
public static native int createRawSink(String name);
|
||||
|
||||
//
|
||||
// Sink Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns sink kind.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @return Sink kind.
|
||||
*/
|
||||
public static native int getSinkKind(int sink);
|
||||
|
||||
/**
|
||||
* Returns sink name.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @return Sink name.
|
||||
*/
|
||||
public static native String getSinkName(int sink);
|
||||
|
||||
/**
|
||||
* Returns sink description.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @return Sink description.
|
||||
*/
|
||||
public static native String getSinkDescription(int sink);
|
||||
|
||||
/**
|
||||
* Returns sink property.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @param name Property name.
|
||||
* @return Sink property handle.
|
||||
*/
|
||||
public static native int getSinkProperty(int sink, String name);
|
||||
|
||||
/**
|
||||
* Returns list of sink property handles.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @return List of sink property handles.
|
||||
*/
|
||||
public static native int[] enumerateSinkProperties(int sink);
|
||||
|
||||
/**
|
||||
* Sets sink configuration JSON.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @param config Configuration JSON.
|
||||
* @return True if set succeeded.
|
||||
*/
|
||||
public static native boolean setSinkConfigJson(int sink, String config);
|
||||
|
||||
/**
|
||||
* Returns sink configuration JSON.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @return Sink configuration JSON.
|
||||
*/
|
||||
public static native String getSinkConfigJson(int sink);
|
||||
|
||||
/**
|
||||
* Sets sink source.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @param source Source handle.
|
||||
*/
|
||||
public static native void setSinkSource(int sink, int source);
|
||||
|
||||
/**
|
||||
* Returns sink source property.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @param name Property name.
|
||||
* @return Sink source property handle.
|
||||
*/
|
||||
public static native int getSinkSourceProperty(int sink, String name);
|
||||
|
||||
/**
|
||||
* Returns sink source.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @return Sink source handle.
|
||||
*/
|
||||
public static native int getSinkSource(int sink);
|
||||
|
||||
/**
|
||||
* Copies sink.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @return New sink handle.
|
||||
*/
|
||||
public static native int copySink(int sink);
|
||||
|
||||
/**
|
||||
* Releases sink.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
*/
|
||||
public static native void releaseSink(int sink);
|
||||
|
||||
//
|
||||
// MjpegServer Sink Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns MJPEG server listen address.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @return MJPEG server listen address.
|
||||
*/
|
||||
public static native String getMjpegServerListenAddress(int sink);
|
||||
|
||||
/**
|
||||
* Returns MJPEG server port.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @return MJPEG server port.
|
||||
*/
|
||||
public static native int getMjpegServerPort(int sink);
|
||||
|
||||
//
|
||||
// Image Sink Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Sets sink description.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @param description Sink description.
|
||||
*/
|
||||
public static native void setSinkDescription(int sink, String description);
|
||||
|
||||
/**
|
||||
* Returns raw sink frame.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @param frame Raw frame.
|
||||
* @param nativeObj Native object.
|
||||
* @return Raw sink frame handle.
|
||||
*/
|
||||
public static native long grabRawSinkFrame(int sink, RawFrame frame, long nativeObj);
|
||||
|
||||
/**
|
||||
* Returns raw sink frame timeout.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @param frame Raw frame.
|
||||
* @param nativeObj Native object.
|
||||
* @param timeout Timeout in seconds.
|
||||
* @return Raw sink frame timeout.
|
||||
*/
|
||||
public static native long grabRawSinkFrameTimeout(
|
||||
int sink, RawFrame frame, long nativeObj, double timeout);
|
||||
|
||||
/**
|
||||
* Returns sink error message.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @return Sink error message.
|
||||
*/
|
||||
public static native String getSinkError(int sink);
|
||||
|
||||
/**
|
||||
* Sets sink enable.
|
||||
*
|
||||
* @param sink Sink handle.
|
||||
* @param enabled True if sink should be enabled.
|
||||
*/
|
||||
public static native void setSinkEnabled(int sink, boolean enabled);
|
||||
|
||||
//
|
||||
// Listener Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Adds listener.
|
||||
*
|
||||
* @param listener Video event callback.
|
||||
* @param eventMask Event mask.
|
||||
* @param immediateNotify True to immediately notify on event.
|
||||
* @return Listener handle.
|
||||
*/
|
||||
public static native int addListener(
|
||||
Consumer<VideoEvent> listener, int eventMask, boolean immediateNotify);
|
||||
|
||||
/**
|
||||
* Removes listener.
|
||||
*
|
||||
* @param handle Listener handle.
|
||||
*/
|
||||
public static native void removeListener(int handle);
|
||||
|
||||
/**
|
||||
* Creates listener poller.
|
||||
*
|
||||
* @return Listener poller handle.
|
||||
*/
|
||||
public static native int createListenerPoller();
|
||||
|
||||
/**
|
||||
* Destroys listener poller.
|
||||
*
|
||||
* @param poller Listener poller handle.
|
||||
*/
|
||||
public static native void destroyListenerPoller(int poller);
|
||||
|
||||
/**
|
||||
* Add polled listener.
|
||||
*
|
||||
* @param poller Poller handle.
|
||||
* @param eventMask Event mask.
|
||||
* @param immediateNotify True to immediately notify on event.
|
||||
* @return Polled listener handle.
|
||||
*/
|
||||
public static native int addPolledListener(int poller, int eventMask, boolean immediateNotify);
|
||||
|
||||
/**
|
||||
* Polls listener.
|
||||
*
|
||||
* @param poller Poller handle.
|
||||
* @return List of video events.
|
||||
* @throws InterruptedException if polling was interrupted.
|
||||
*/
|
||||
public static native VideoEvent[] pollListener(int poller) throws InterruptedException;
|
||||
|
||||
/**
|
||||
* Polls listener with timeout.
|
||||
*
|
||||
* @param poller Poller handle.
|
||||
* @param timeout Timeout in seconds.
|
||||
* @return List of video events.
|
||||
* @throws InterruptedException if polling was interrupted.
|
||||
*/
|
||||
public static native VideoEvent[] pollListenerTimeout(int poller, double timeout)
|
||||
throws InterruptedException;
|
||||
|
||||
/**
|
||||
* Cancels poll listener.
|
||||
*
|
||||
* @param poller Poller handle.
|
||||
*/
|
||||
public static native void cancelPollListener(int poller);
|
||||
|
||||
//
|
||||
// Telemetry Functions
|
||||
//
|
||||
|
||||
/** Telemetry kind. */
|
||||
public enum TelemetryKind {
|
||||
/** kSourceBytesReceived. */
|
||||
kSourceBytesReceived(1),
|
||||
@@ -315,23 +896,66 @@ public class CameraServerJNI {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns telemetry kind value.
|
||||
*
|
||||
* @return Telemetry kind value.
|
||||
*/
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets telemetry period.
|
||||
*
|
||||
* @param seconds Telemetry period in seconds.
|
||||
*/
|
||||
public static native void setTelemetryPeriod(double seconds);
|
||||
|
||||
/**
|
||||
* Returns telemetry elapsed time.
|
||||
*
|
||||
* @return Telemetry elapsed time.
|
||||
*/
|
||||
public static native double getTelemetryElapsedTime();
|
||||
|
||||
/**
|
||||
* Returns telemetry value.
|
||||
*
|
||||
* @param handle Telemetry handle.
|
||||
* @param kind Telemetry kind.
|
||||
* @return Telemetry value.
|
||||
*/
|
||||
public static native long getTelemetryValue(int handle, int kind);
|
||||
|
||||
/**
|
||||
* Returns telemetry value.
|
||||
*
|
||||
* @param handle Telemetry handle.
|
||||
* @param kind Telemetry kind.
|
||||
* @return Telemetry value.
|
||||
*/
|
||||
public static long getTelemetryValue(int handle, TelemetryKind kind) {
|
||||
return getTelemetryValue(handle, kind.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns telemetry average value.
|
||||
*
|
||||
* @param handle Telemetry handle.
|
||||
* @param kind Telemetry kind.
|
||||
* @return Telemetry average value.
|
||||
*/
|
||||
public static native double getTelemetryAverageValue(int handle, int kind);
|
||||
|
||||
/**
|
||||
* Returns telemetry average value.
|
||||
*
|
||||
* @param handle Telemetry handle.
|
||||
* @param kind Telemetry kind.
|
||||
* @return Telemetry average value.
|
||||
*/
|
||||
public static double getTelemetryAverageValue(int handle, TelemetryKind kind) {
|
||||
return getTelemetryAverageValue(handle, kind.getValue());
|
||||
}
|
||||
@@ -339,30 +963,80 @@ public class CameraServerJNI {
|
||||
//
|
||||
// Logging Functions
|
||||
//
|
||||
|
||||
/** Logger functional interface. */
|
||||
@FunctionalInterface
|
||||
public interface LoggerFunction {
|
||||
/**
|
||||
* Log a string.
|
||||
*
|
||||
* @param level Log level.
|
||||
* @param file Log file.
|
||||
* @param line Line number.
|
||||
* @param msg Log message.
|
||||
*/
|
||||
void apply(int level, String file, int line, String msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets logger.
|
||||
*
|
||||
* @param func Logger function.
|
||||
* @param minLevel Minimum logging level.
|
||||
*/
|
||||
public static native void setLogger(LoggerFunction func, int minLevel);
|
||||
|
||||
//
|
||||
// Utility Functions
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns list of USB cameras.
|
||||
*
|
||||
* @return List of USB cameras.
|
||||
*/
|
||||
public static native UsbCameraInfo[] enumerateUsbCameras();
|
||||
|
||||
/**
|
||||
* Returns list of sources.
|
||||
*
|
||||
* @return List of sources.
|
||||
*/
|
||||
public static native int[] enumerateSources();
|
||||
|
||||
/**
|
||||
* Returns list of sinks.
|
||||
*
|
||||
* @return List of sinks.
|
||||
*/
|
||||
public static native int[] enumerateSinks();
|
||||
|
||||
/**
|
||||
* Returns hostname.
|
||||
*
|
||||
* @return Hostname.
|
||||
*/
|
||||
public static native String getHostname();
|
||||
|
||||
/**
|
||||
* Returns list of network interfaces.
|
||||
*
|
||||
* @return List of network interfaces.
|
||||
*/
|
||||
public static native String[] getNetworkInterfaces();
|
||||
|
||||
/** Runs main run loop. */
|
||||
public static native void runMainRunLoop();
|
||||
|
||||
/**
|
||||
* Runs main run loop with timeout.
|
||||
*
|
||||
* @param timeoutSeconds Timeout in seconds.
|
||||
* @return 3 on timeout, 2 on signal, 1 on other.
|
||||
*/
|
||||
public static native int runMainRunLoopTimeout(double timeoutSeconds);
|
||||
|
||||
/** Stops main run loop. */
|
||||
public static native void stopMainRunLoop();
|
||||
|
||||
/** Utility class. */
|
||||
|
||||
@@ -6,6 +6,7 @@ package edu.wpi.first.cscore;
|
||||
|
||||
/** A source that represents a MJPEG-over-HTTP (IP) camera. */
|
||||
public class HttpCamera extends VideoCamera {
|
||||
/** HTTP camera kind. */
|
||||
public enum HttpCameraKind {
|
||||
/** Unknown camera kind. */
|
||||
kUnknown(0),
|
||||
@@ -22,6 +23,11 @@ public class HttpCamera extends VideoCamera {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HttpCameraKind value.
|
||||
*
|
||||
* @return HttpCameraKind value.
|
||||
*/
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,13 @@
|
||||
|
||||
package edu.wpi.first.cscore;
|
||||
|
||||
/** A base class for single image reading sinks. */
|
||||
public abstract class ImageSink extends VideoSink {
|
||||
/**
|
||||
* Constructs an ImageSink.
|
||||
*
|
||||
* @param handle The image sink handle.
|
||||
*/
|
||||
protected ImageSink(int handle) {
|
||||
super(handle);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,13 @@
|
||||
|
||||
package edu.wpi.first.cscore;
|
||||
|
||||
/** A base class for single image providing sources. */
|
||||
public abstract class ImageSource extends VideoSource {
|
||||
/**
|
||||
* Constructs an ImageSource.
|
||||
*
|
||||
* @param handle The image source handle.
|
||||
*/
|
||||
protected ImageSource(int handle) {
|
||||
super(handle);
|
||||
}
|
||||
|
||||
@@ -6,17 +6,32 @@ package edu.wpi.first.cscore;
|
||||
|
||||
/** A source that represents a video camera. */
|
||||
public class VideoCamera extends VideoSource {
|
||||
/** White balance. */
|
||||
public static class WhiteBalance {
|
||||
/** Fixed indoor white balance. */
|
||||
public static final int kFixedIndoor = 3000;
|
||||
|
||||
/** Fixed outdoor white balance 1. */
|
||||
public static final int kFixedOutdoor1 = 4000;
|
||||
|
||||
/** Fixed outdoor white balance 2. */
|
||||
public static final int kFixedOutdoor2 = 5000;
|
||||
|
||||
/** Fixed fluorescent white balance 1. */
|
||||
public static final int kFixedFluorescent1 = 5100;
|
||||
|
||||
/** Fixed fluorescent white balance 2. */
|
||||
public static final int kFixedFlourescent2 = 5200;
|
||||
|
||||
/** Default constructor. */
|
||||
public WhiteBalance() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a VideoCamera.
|
||||
*
|
||||
* @param handle The video camera handle.
|
||||
*/
|
||||
protected VideoCamera(int handle) {
|
||||
super(handle);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ package edu.wpi.first.cscore;
|
||||
/** Video event. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class VideoEvent {
|
||||
/** VideoEvent kind. */
|
||||
public enum Kind {
|
||||
/** Unknown video event. */
|
||||
kUnknown(0x0000),
|
||||
@@ -57,6 +58,11 @@ public class VideoEvent {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the kind value.
|
||||
*
|
||||
* @return The kind value.
|
||||
*/
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
@@ -139,39 +145,67 @@ public class VideoEvent {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
/** The video event kind. */
|
||||
public Kind kind;
|
||||
|
||||
// Valid for kSource* and kSink* respectively
|
||||
/**
|
||||
* The source handle.
|
||||
*
|
||||
* <p>Valid for kSource* and kSink* respectively.
|
||||
*/
|
||||
public int sourceHandle;
|
||||
|
||||
/** The sink handle. */
|
||||
public int sinkHandle;
|
||||
|
||||
// Source/sink/property name
|
||||
/** Source/sink/property name. */
|
||||
public String name;
|
||||
|
||||
// Fields for kSourceVideoModeChanged event
|
||||
// Fields for kSourceVideoModeChanged event.
|
||||
|
||||
/** New source video mode. */
|
||||
public VideoMode mode;
|
||||
|
||||
// Fields for kSourceProperty* events
|
||||
// Fields for kSourceProperty* events.
|
||||
|
||||
/** Source property handle. */
|
||||
public int propertyHandle;
|
||||
|
||||
/** Source property kind. */
|
||||
public VideoProperty.Kind propertyKind;
|
||||
|
||||
/** Event value. */
|
||||
public int value;
|
||||
|
||||
/** Event value as a string. */
|
||||
public String valueStr;
|
||||
|
||||
// Listener that was triggered
|
||||
/** Listener that was triggered. */
|
||||
public int listener;
|
||||
|
||||
/**
|
||||
* Returns the source associated with the event (if any).
|
||||
*
|
||||
* @return The source associated with the event (if any).
|
||||
*/
|
||||
public VideoSource getSource() {
|
||||
return new VideoSource(CameraServerJNI.copySource(sourceHandle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sink associated with the event (if any).
|
||||
*
|
||||
* @return The sink associated with the event (if any).
|
||||
*/
|
||||
public VideoSink getSink() {
|
||||
return new VideoSink(CameraServerJNI.copySink(sinkHandle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the property associated with the event (if any).
|
||||
*
|
||||
* @return The property associated with the event (if any).
|
||||
*/
|
||||
public VideoProperty getProperty() {
|
||||
return new VideoProperty(propertyHandle, propertyKind);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,11 @@ package edu.wpi.first.cscore;
|
||||
public class VideoException extends RuntimeException {
|
||||
private static final long serialVersionUID = -9155939328084105145L;
|
||||
|
||||
/**
|
||||
* Constructs the exception with the given message.
|
||||
*
|
||||
* @param msg The exception message.
|
||||
*/
|
||||
public VideoException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ public class VideoListener implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the video listener handle is valid.
|
||||
*
|
||||
* @return True if the video listener handle is valid.
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return m_handle != 0;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ public class VideoProperty {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Kind value.
|
||||
*
|
||||
* @return The Kind value.
|
||||
*/
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
@@ -51,69 +56,152 @@ public class VideoProperty {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns property name.
|
||||
*
|
||||
* @return Property name.
|
||||
*/
|
||||
public String getName() {
|
||||
return CameraServerJNI.getPropertyName(m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns property kind.
|
||||
*
|
||||
* @return Property kind.
|
||||
*/
|
||||
public Kind getKind() {
|
||||
return m_kind;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if property is valid.
|
||||
*
|
||||
* @return True if property is valid.
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return m_kind != Kind.kNone;
|
||||
}
|
||||
|
||||
// Kind checkers
|
||||
/**
|
||||
* Returns true if property is a boolean.
|
||||
*
|
||||
* @return True if property is a boolean.
|
||||
*/
|
||||
public boolean isBoolean() {
|
||||
return m_kind == Kind.kBoolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if property is an integer.
|
||||
*
|
||||
* @return True if property is an integer.
|
||||
*/
|
||||
public boolean isInteger() {
|
||||
return m_kind == Kind.kInteger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if property is a string.
|
||||
*
|
||||
* @return True if property is a string.
|
||||
*/
|
||||
public boolean isString() {
|
||||
return m_kind == Kind.kString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if property is an enum.
|
||||
*
|
||||
* @return True if property is an enum.
|
||||
*/
|
||||
public boolean isEnum() {
|
||||
return m_kind == Kind.kEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns property value.
|
||||
*
|
||||
* @return Property value.
|
||||
*/
|
||||
public int get() {
|
||||
return CameraServerJNI.getProperty(m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets property value.
|
||||
*
|
||||
* @param value Property value.
|
||||
*/
|
||||
public void set(int value) {
|
||||
CameraServerJNI.setProperty(m_handle, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns property minimum value.
|
||||
*
|
||||
* @return Property minimum value.
|
||||
*/
|
||||
public int getMin() {
|
||||
return CameraServerJNI.getPropertyMin(m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns property maximum value.
|
||||
*
|
||||
* @return Property maximum value.
|
||||
*/
|
||||
public int getMax() {
|
||||
return CameraServerJNI.getPropertyMax(m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns property step size.
|
||||
*
|
||||
* @return Property step size.
|
||||
*/
|
||||
public int getStep() {
|
||||
return CameraServerJNI.getPropertyStep(m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns property default value.
|
||||
*
|
||||
* @return Property default value.
|
||||
*/
|
||||
public int getDefault() {
|
||||
return CameraServerJNI.getPropertyDefault(m_handle);
|
||||
}
|
||||
|
||||
// String-specific functions
|
||||
/**
|
||||
* Returns the string property value.
|
||||
*
|
||||
* <p>This function is string-specific.
|
||||
*
|
||||
* @return The string property value.
|
||||
*/
|
||||
public String getString() {
|
||||
return CameraServerJNI.getStringProperty(m_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the string property value.
|
||||
*
|
||||
* <p>This function is string-specific.
|
||||
*
|
||||
* @param value String property value.
|
||||
*/
|
||||
public void setString(String value) {
|
||||
CameraServerJNI.setStringProperty(m_handle, value);
|
||||
}
|
||||
|
||||
// Enum-specific functions
|
||||
/**
|
||||
* Returns the possible values for the enum property value.
|
||||
*
|
||||
* <p>This function is enum-specific.
|
||||
*
|
||||
* @return The possible values for the enum property value.
|
||||
*/
|
||||
public String[] getChoices() {
|
||||
return CameraServerJNI.getEnumPropertyChoices(m_handle);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,11 @@ public class VideoSink implements AutoCloseable {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Kind value.
|
||||
*
|
||||
* @return The Kind value.
|
||||
*/
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
@@ -48,6 +53,11 @@ public class VideoSink implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a VideoSink.
|
||||
*
|
||||
* @param handle The video sink handle.
|
||||
*/
|
||||
protected VideoSink(int handle) {
|
||||
m_handle = handle;
|
||||
}
|
||||
@@ -60,10 +70,20 @@ public class VideoSink implements AutoCloseable {
|
||||
m_handle = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the VideoSink is valid.
|
||||
*
|
||||
* @return True if the VideoSink is valid.
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return m_handle != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the video sink handle.
|
||||
*
|
||||
* @return The video sink handle.
|
||||
*/
|
||||
public int getHandle() {
|
||||
return m_handle;
|
||||
}
|
||||
@@ -222,5 +242,6 @@ public class VideoSink implements AutoCloseable {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/** The VideoSink handle. */
|
||||
protected int m_handle;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import edu.wpi.first.util.PixelFormat;
|
||||
* (e.g. from a stereo or depth camera); these are called channels.
|
||||
*/
|
||||
public class VideoSource implements AutoCloseable {
|
||||
/** Video source kind. */
|
||||
public enum Kind {
|
||||
/** Unknown video source. */
|
||||
kUnknown(0),
|
||||
@@ -29,6 +30,11 @@ public class VideoSource implements AutoCloseable {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Kind value.
|
||||
*
|
||||
* @return The Kind value.
|
||||
*/
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
@@ -56,6 +62,11 @@ public class VideoSource implements AutoCloseable {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ConnectionStrategy value.
|
||||
*
|
||||
* @return The ConnectionStrategy value.
|
||||
*/
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
@@ -80,6 +91,11 @@ public class VideoSource implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a VideoSource.
|
||||
*
|
||||
* @param handle The video source handle.
|
||||
*/
|
||||
protected VideoSource(int handle) {
|
||||
m_handle = handle;
|
||||
}
|
||||
@@ -92,10 +108,20 @@ public class VideoSource implements AutoCloseable {
|
||||
m_handle = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the VideoSource is valid.
|
||||
*
|
||||
* @return True if the VideoSource is valid.
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return m_handle != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the video source handle.
|
||||
*
|
||||
* @return The video source handle.
|
||||
*/
|
||||
public int getHandle() {
|
||||
return m_handle;
|
||||
}
|
||||
@@ -379,5 +405,6 @@ public class VideoSource implements AutoCloseable {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/** Video source handle. */
|
||||
protected int m_handle;
|
||||
}
|
||||
|
||||
@@ -58,33 +58,139 @@ class VideoProperty {
|
||||
|
||||
VideoProperty() = default;
|
||||
|
||||
/**
|
||||
* Returns property name.
|
||||
*
|
||||
* @return Property name.
|
||||
*/
|
||||
std::string GetName() const;
|
||||
|
||||
/**
|
||||
* Returns property kind.
|
||||
*
|
||||
* @return Property kind.
|
||||
*/
|
||||
Kind GetKind() const { return m_kind; }
|
||||
|
||||
/**
|
||||
* Returns true if property is valid.
|
||||
*
|
||||
* @return True if property is valid.
|
||||
*/
|
||||
explicit operator bool() const { return m_kind != kNone; }
|
||||
|
||||
// Kind checkers
|
||||
/**
|
||||
* Returns true if property is a boolean.
|
||||
*
|
||||
* @return True if property is a boolean.
|
||||
*/
|
||||
bool IsBoolean() const { return m_kind == kBoolean; }
|
||||
|
||||
/**
|
||||
* Returns true if property is an integer.
|
||||
*
|
||||
* @return True if property is an integer.
|
||||
*/
|
||||
bool IsInteger() const { return m_kind == kInteger; }
|
||||
|
||||
/**
|
||||
* Returns true if property is a string.
|
||||
*
|
||||
* @return True if property is a string.
|
||||
*/
|
||||
bool IsString() const { return m_kind == kString; }
|
||||
|
||||
/**
|
||||
* Returns true if property is an enum.
|
||||
*
|
||||
* @return True if property is an enum.
|
||||
*/
|
||||
bool IsEnum() const { return m_kind == kEnum; }
|
||||
|
||||
/**
|
||||
* Returns property value.
|
||||
*
|
||||
* @return Property value.
|
||||
*/
|
||||
int Get() const;
|
||||
|
||||
/**
|
||||
* Sets property value.
|
||||
*
|
||||
* @param value Property value.
|
||||
*/
|
||||
void Set(int value);
|
||||
|
||||
/**
|
||||
* Returns property minimum value.
|
||||
*
|
||||
* @return Property minimum value.
|
||||
*/
|
||||
int GetMin() const;
|
||||
|
||||
/**
|
||||
* Returns property maximum value.
|
||||
*
|
||||
* @return Property maximum value.
|
||||
*/
|
||||
int GetMax() const;
|
||||
|
||||
/**
|
||||
* Returns property step size.
|
||||
*
|
||||
* @return Property step size.
|
||||
*/
|
||||
int GetStep() const;
|
||||
|
||||
/**
|
||||
* Returns property default value.
|
||||
*
|
||||
* @return Property default value.
|
||||
*/
|
||||
int GetDefault() const;
|
||||
|
||||
// String-specific functions
|
||||
/**
|
||||
* Returns the string property value.
|
||||
*
|
||||
* <p>This function is string-specific.
|
||||
*
|
||||
* @return The string property value.
|
||||
*/
|
||||
std::string GetString() const;
|
||||
|
||||
/**
|
||||
* Returns the string property value as a reference to the given buffer.
|
||||
*
|
||||
* This function is string-specific.
|
||||
*
|
||||
* @param buf The backing storage to which to write the property value.
|
||||
* @return The string property value as a reference to the given buffer.
|
||||
*/
|
||||
std::string_view GetString(wpi::SmallVectorImpl<char>& buf) const;
|
||||
|
||||
/**
|
||||
* Sets the string property value.
|
||||
*
|
||||
* This function is string-specific.
|
||||
*
|
||||
* @param value String property value.
|
||||
*/
|
||||
void SetString(std::string_view value);
|
||||
|
||||
// Enum-specific functions
|
||||
/**
|
||||
* Returns the possible values for the enum property value.
|
||||
*
|
||||
* This function is enum-specific.
|
||||
*
|
||||
* @return The possible values for the enum property value.
|
||||
*/
|
||||
std::vector<std::string> GetChoices() const;
|
||||
|
||||
/**
|
||||
* Returns the last status.
|
||||
*
|
||||
* @return The last status.
|
||||
*/
|
||||
CS_Status GetLastStatus() const { return m_status; }
|
||||
|
||||
private:
|
||||
@@ -104,6 +210,9 @@ class VideoSource {
|
||||
friend class VideoSink;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Video source kind.
|
||||
*/
|
||||
enum Kind {
|
||||
/// Unknown video source.
|
||||
kUnknown = CS_SOURCE_UNKNOWN,
|
||||
@@ -359,6 +468,8 @@ class VideoSource {
|
||||
explicit VideoSource(CS_Source handle) : m_handle(handle) {}
|
||||
|
||||
mutable CS_Status m_status = 0;
|
||||
|
||||
/// Video source handle.
|
||||
CS_Source m_handle{0};
|
||||
};
|
||||
|
||||
@@ -367,11 +478,19 @@ class VideoSource {
|
||||
*/
|
||||
class VideoCamera : public VideoSource {
|
||||
public:
|
||||
/**
|
||||
* White balance.
|
||||
*/
|
||||
enum WhiteBalance {
|
||||
/// Fixed indoor white balance.
|
||||
kFixedIndoor = 3000,
|
||||
/// Fixed outdoor white balance 1.
|
||||
kFixedOutdoor1 = 4000,
|
||||
/// Fixed outdoor white balance 2.
|
||||
kFixedOutdoor2 = 5000,
|
||||
/// Fixed fluorescent white balance 1.
|
||||
kFixedFluorescent1 = 5100,
|
||||
/// Fixed fluorescent white balance 2.
|
||||
kFixedFlourescent2 = 5200
|
||||
};
|
||||
|
||||
@@ -479,6 +598,9 @@ class UsbCamera : public VideoCamera {
|
||||
*/
|
||||
class HttpCamera : public VideoCamera {
|
||||
public:
|
||||
/**
|
||||
* HTTP camera kind.
|
||||
*/
|
||||
enum HttpCameraKind {
|
||||
/// Unknown camera kind.
|
||||
kUnknown = CS_HTTP_UNKNOWN,
|
||||
@@ -743,8 +865,18 @@ class VideoSink {
|
||||
VideoSink& operator=(VideoSink other) noexcept;
|
||||
~VideoSink();
|
||||
|
||||
/**
|
||||
* Returns true if the VideoSink is valid.
|
||||
*
|
||||
* @return True if the VideoSink is valid.
|
||||
*/
|
||||
explicit operator bool() const { return m_handle != 0; }
|
||||
|
||||
/**
|
||||
* Returns the VideoSink handle.
|
||||
*
|
||||
* @return The VideoSink handle.
|
||||
*/
|
||||
int GetHandle() const { return m_handle; }
|
||||
|
||||
bool operator==(const VideoSink& other) const {
|
||||
@@ -988,17 +1120,23 @@ class ImageSink : public VideoSink {
|
||||
class VideoEvent : public RawEvent {
|
||||
public:
|
||||
/**
|
||||
* Get the source associated with the event (if any).
|
||||
* Returns the source associated with the event (if any).
|
||||
*
|
||||
* @return The source associated with the event (if any).
|
||||
*/
|
||||
VideoSource GetSource() const;
|
||||
|
||||
/**
|
||||
* Get the sink associated with the event (if any).
|
||||
* Returns the sink associated with the event (if any).
|
||||
*
|
||||
* @return The sink associated with the event (if any).
|
||||
*/
|
||||
VideoSink GetSink() const;
|
||||
|
||||
/**
|
||||
* Get the property associated with the event (if any).
|
||||
* Returns the property associated with the event (if any).
|
||||
*
|
||||
* @return The property associated with the event (if any).
|
||||
*/
|
||||
VideoProperty GetProperty() const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user