5#ifndef CSCORE_CSCORE_CPP_H_
6#define CSCORE_CSCORE_CPP_H_
25#pragma warning(disable : 26495)
209 std::span<const std::string> urls,
307 int step,
int defaultValue,
int value,
310 std::span<const std::string> choices,
324 std::function<
void(uint64_t time)> processFrame,
387 int eventMask,
bool immediateNotify,
CS_Status* status);
394 bool immediateNotify,
CS_Status* status);
419using LogFunc = std::function<void(
unsigned int level,
const char*
file,
420 unsigned int line,
const char* msg)>;
@ WPI_PIXFMT_YUYV
Definition: RawFrame.h:52
@ WPI_PIXFMT_Y16
Definition: RawFrame.h:56
@ WPI_PIXFMT_UYVY
Definition: RawFrame.h:57
@ WPI_PIXFMT_MJPEG
Definition: RawFrame.h:51
@ WPI_PIXFMT_GRAY
Definition: RawFrame.h:55
@ WPI_PIXFMT_RGB565
Definition: RawFrame.h:53
@ WPI_PIXFMT_BGR
Definition: RawFrame.h:54
@ WPI_PIXFMT_UNKNOWN
Definition: RawFrame.h:50
This file defines the SmallVector class.
then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file
Definition: ThirdPartyNotices.txt:192
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation source
Definition: ThirdPartyNotices.txt:111
basic_string_view< char > string_view
Definition: core.h:501
CS_ConnectionStrategy
Connection strategy.
Definition: cscore_c.h:176
CS_HttpCameraKind
HTTP Camera kinds.
Definition: cscore_c.h:124
CS_PropertyKind
Property kinds.
Definition: cscore_c.h:102
CS_TelemetryKind
Telemetry kinds.
Definition: cscore_c.h:170
CS_SinkKind
Sink kinds.
Definition: cscore_c.h:134
CS_SourceKind
Source kinds.
Definition: cscore_c.h:113
@ CS_SOURCE_PROPERTY_CREATED
Definition: cscore_c.h:151
@ CS_SOURCE_VIDEOMODES_UPDATED
Definition: cscore_c.h:149
@ CS_SINK_PROPERTY_VALUE_UPDATED
Definition: cscore_c.h:162
@ CS_SOURCE_CONNECTED
Definition: cscore_c.h:147
@ CS_TELEMETRY_UPDATED
Definition: cscore_c.h:160
@ CS_SINK_ENABLED
Definition: cscore_c.h:157
@ CS_USB_CAMERAS_CHANGED
Definition: cscore_c.h:164
@ CS_SOURCE_CREATED
Definition: cscore_c.h:145
@ CS_SINK_DESTROYED
Definition: cscore_c.h:156
@ CS_SINK_PROPERTY_CREATED
Definition: cscore_c.h:161
@ CS_SINK_PROPERTY_CHOICES_UPDATED
Definition: cscore_c.h:163
@ CS_NETWORK_INTERFACES_CHANGED
Definition: cscore_c.h:159
@ CS_SOURCE_VIDEOMODE_CHANGED
Definition: cscore_c.h:150
@ CS_SINK_SOURCE_CHANGED
Definition: cscore_c.h:154
@ CS_SOURCE_PROPERTY_VALUE_UPDATED
Definition: cscore_c.h:152
@ CS_SOURCE_DISCONNECTED
Definition: cscore_c.h:148
@ CS_SOURCE_DESTROYED
Definition: cscore_c.h:146
@ CS_SINK_CREATED
Definition: cscore_c.h:155
@ CS_SOURCE_PROPERTY_CHOICES_UPDATED
Definition: cscore_c.h:153
@ CS_SINK_DISABLED
Definition: cscore_c.h:158
@ CS_INVALID_HANDLE
Definition: cscore_c.h:62
int GetCameraBrightness(CS_Source source, CS_Status *status)
void SetCameraExposureManual(CS_Source source, int value, CS_Status *status)
void SetCameraExposureAuto(CS_Source source, CS_Status *status)
void SetCameraWhiteBalanceManual(CS_Source source, int value, CS_Status *status)
void SetCameraBrightness(CS_Source source, int brightness, CS_Status *status)
void SetCameraWhiteBalanceHoldCurrent(CS_Source source, CS_Status *status)
void SetCameraWhiteBalanceAuto(CS_Source source, CS_Status *status)
void SetCameraExposureHoldCurrent(CS_Source source, CS_Status *status)
std::vector< std::string > GetHttpCameraUrls(CS_Source source, CS_Status *status)
void SetHttpCameraUrls(CS_Source source, std::span< const std::string > urls, CS_Status *status)
CS_HttpCameraKind GetHttpCameraKind(CS_Source source, CS_Status *status)
CS_ListenerPoller CreateListenerPoller()
CS_Listener AddListener(std::function< void(const RawEvent &event)> callback, int eventMask, bool immediateNotify, CS_Status *status)
std::vector< RawEvent > PollListener(CS_ListenerPoller poller)
void CancelPollListener(CS_ListenerPoller poller)
CS_Listener AddPolledListener(CS_ListenerPoller poller, int eventMask, bool immediateNotify, CS_Status *status)
void SetListenerOnExit(std::function< void()> onExit)
void SetListenerOnStart(std::function< void()> onStart)
void RemoveListener(CS_Listener handle, CS_Status *status)
void DestroyListenerPoller(CS_ListenerPoller poller)
void SetDefaultLogger(unsigned int min_level)
std::function< void(unsigned int level, const char *file, unsigned int line, const char *msg)> LogFunc
Definition: cscore_cpp.h:420
void SetLogger(LogFunc func, unsigned int min_level)
int GetMjpegServerPort(CS_Sink sink, CS_Status *status)
std::string GetMjpegServerListenAddress(CS_Sink sink, CS_Status *status)
void SetSinkEnabled(CS_Sink sink, bool enabled, CS_Status *status)
void SetSinkDescription(CS_Sink sink, std::string_view description, CS_Status *status)
std::string GetSinkError(CS_Sink sink, CS_Status *status)
void SetSourceEnumPropertyChoices(CS_Source source, CS_Property property, std::span< const std::string > choices, CS_Status *status)
void SetSourceConnected(CS_Source source, bool connected, CS_Status *status)
void SetSourceDescription(CS_Source source, std::string_view description, CS_Status *status)
CS_Property CreateSourceProperty(CS_Source source, std::string_view name, CS_PropertyKind kind, int minimum, int maximum, int step, int defaultValue, int value, CS_Status *status)
void NotifySourceError(CS_Source source, std::string_view msg, CS_Status *status)
int GetPropertyMin(CS_Property property, CS_Status *status)
void SetProperty(CS_Property property, int value, CS_Status *status)
void SetStringProperty(CS_Property property, std::string_view value, CS_Status *status)
CS_PropertyKind GetPropertyKind(CS_Property property, CS_Status *status)
int GetPropertyDefault(CS_Property property, CS_Status *status)
int GetPropertyMax(CS_Property property, CS_Status *status)
int GetProperty(CS_Property property, CS_Status *status)
int GetPropertyStep(CS_Property property, CS_Status *status)
std::string GetStringProperty(CS_Property property, CS_Status *status)
std::vector< std::string > GetEnumPropertyChoices(CS_Property property, CS_Status *status)
std::string GetPropertyName(CS_Property property, CS_Status *status)
CS_Sink CreateCvSinkCallback(std::string_view name, VideoMode::PixelFormat pixelFormat, std::function< void(uint64_t time)> processFrame, CS_Status *status)
CS_Sink CreateCvSink(std::string_view name, VideoMode::PixelFormat pixelFormat, CS_Status *status)
CS_Sink CreateMjpegServer(std::string_view name, std::string_view listenAddress, int port, CS_Status *status)
bool SetSinkConfigJson(CS_Sink sink, std::string_view config, CS_Status *status)
CS_Source GetSinkSource(CS_Sink sink, CS_Status *status)
CS_Sink CopySink(CS_Sink sink, CS_Status *status)
wpi::json GetSinkConfigJsonObject(CS_Sink sink, CS_Status *status)
void SetSinkSource(CS_Sink sink, CS_Source source, CS_Status *status)
CS_Property GetSinkSourceProperty(CS_Sink sink, std::string_view name, CS_Status *status)
void ReleaseSink(CS_Sink sink, CS_Status *status)
std::span< CS_Property > EnumerateSinkProperties(CS_Sink sink, wpi::SmallVectorImpl< CS_Property > &vec, CS_Status *status)
std::string GetSinkDescription(CS_Sink sink, CS_Status *status)
std::string GetSinkName(CS_Sink sink, CS_Status *status)
std::string GetSinkConfigJson(CS_Sink sink, CS_Status *status)
CS_SinkKind GetSinkKind(CS_Sink sink, CS_Status *status)
CS_Property GetSinkProperty(CS_Sink sink, std::string_view name, CS_Status *status)
CS_Source CreateUsbCameraPath(std::string_view name, std::string_view path, CS_Status *status)
CS_Source CreateHttpCamera(std::string_view name, std::string_view url, CS_HttpCameraKind kind, CS_Status *status)
CS_Source CreateUsbCameraDev(std::string_view name, int dev, CS_Status *status)
CS_Source CreateCvSource(std::string_view name, const VideoMode &mode, CS_Status *status)
void ReleaseSource(CS_Source source, CS_Status *status)
bool IsSourceConnected(CS_Source source, CS_Status *status)
uint64_t GetSourceLastFrameTime(CS_Source source, CS_Status *status)
bool SetSourceResolution(CS_Source source, int width, int height, CS_Status *status)
CS_Property GetSourceProperty(CS_Source source, std::string_view name, CS_Status *status)
bool SetSourceConfigJson(CS_Source source, std::string_view config, CS_Status *status)
bool SetSourcePixelFormat(CS_Source source, VideoMode::PixelFormat pixelFormat, CS_Status *status)
std::string GetSourceConfigJson(CS_Source source, CS_Status *status)
wpi::json GetSourceConfigJsonObject(CS_Source source, CS_Status *status)
void SetSourceConnectionStrategy(CS_Source source, CS_ConnectionStrategy strategy, CS_Status *status)
VideoMode GetSourceVideoMode(CS_Source source, CS_Status *status)
CS_Source CopySource(CS_Source source, CS_Status *status)
bool IsSourceEnabled(CS_Source source, CS_Status *status)
std::span< CS_Property > EnumerateSourceProperties(CS_Source source, wpi::SmallVectorImpl< CS_Property > &vec, CS_Status *status)
std::vector< VideoMode > EnumerateSourceVideoModes(CS_Source source, CS_Status *status)
CS_SourceKind GetSourceKind(CS_Source source, CS_Status *status)
std::string GetSourceName(CS_Source source, CS_Status *status)
std::string GetSourceDescription(CS_Source source, CS_Status *status)
bool SetSourceVideoMode(CS_Source source, const VideoMode &mode, CS_Status *status)
bool SetSourceFPS(CS_Source source, int fps, CS_Status *status)
std::span< CS_Sink > EnumerateSourceSinks(CS_Source source, wpi::SmallVectorImpl< CS_Sink > &vec, CS_Status *status)
int64_t GetTelemetryValue(CS_Handle handle, CS_TelemetryKind kind, CS_Status *status)
double GetTelemetryElapsedTime()
double GetTelemetryAverageValue(CS_Handle handle, CS_TelemetryKind kind, CS_Status *status)
void SetTelemetryPeriod(double seconds)
CS_Handle CS_Source
Definition: cscore_c.h:53
int CS_Status
Definition: cscore_c.h:46
CS_Handle CS_ListenerPoller
Definition: cscore_c.h:51
CS_Handle CS_Property
Definition: cscore_c.h:49
CS_Handle CS_Sink
Definition: cscore_c.h:52
int CS_Handle
Definition: cscore_c.h:48
CS_Handle CS_Listener
Definition: cscore_c.h:50
UsbCameraInfo GetUsbCameraInfo(CS_Source source, CS_Status *status)
std::string GetUsbCameraPath(CS_Source source, CS_Status *status)
void SetUsbCameraPath(CS_Source, std::string_view path, CS_Status *status)
std::string GetHostname()
std::vector< UsbCameraInfo > EnumerateUsbCameras(CS_Status *status)
std::span< CS_Sink > EnumerateSinkHandles(wpi::SmallVectorImpl< CS_Sink > &vec, CS_Status *status)
std::span< CS_Source > EnumerateSourceHandles(wpi::SmallVectorImpl< CS_Source > &vec, CS_Status *status)
std::vector< std::string > GetNetworkInterfaces()
CameraServer (cscore) namespace.
Definition: cscore_oo.inc:16
fps
Definition: velocity.h:46
Video mode.
Definition: cscore_c.h:92
int width
Definition: cscore_c.h:94
int pixelFormat
Definition: cscore_c.h:93
int fps
Definition: cscore_c.h:96
int height
Definition: cscore_c.h:95
Listener event.
Definition: cscore_cpp.h:101
VideoMode mode
Definition: cscore_cpp.h:162
CS_Sink sinkHandle
Definition: cscore_cpp.h:156
int value
Definition: cscore_cpp.h:167
std::string name
Definition: cscore_cpp.h:159
Kind kind
Definition: cscore_cpp.h:152
CS_Property propertyHandle
Definition: cscore_cpp.h:165
RawEvent(std::string_view name_, CS_Source source_, RawEvent::Kind kind_, CS_Property property_, CS_PropertyKind propertyKind_, int value_, std::string_view valueStr_)
Definition: cscore_cpp.h:141
CS_Source sourceHandle
Definition: cscore_cpp.h:155
std::string valueStr
Definition: cscore_cpp.h:168
RawEvent(RawEvent::Kind kind_)
Definition: cscore_cpp.h:126
RawEvent(std::string_view name_, CS_Source source_, const VideoMode &mode_)
Definition: cscore_cpp.h:136
CS_Listener listener
Definition: cscore_cpp.h:171
RawEvent(std::string_view name_, CS_Handle handle_, RawEvent::Kind kind_)
Definition: cscore_cpp.h:127
CS_PropertyKind propertyKind
Definition: cscore_cpp.h:166
Kind
Definition: cscore_cpp.h:102
@ kTelemetryUpdated
Definition: cscore_cpp.h:118
@ kUsbCamerasChanged
Definition: cscore_cpp.h:122
@ kSinkSourceChanged
Definition: cscore_cpp.h:112
@ kSourcePropertyCreated
Definition: cscore_cpp.h:109
@ kSinkEnabled
Definition: cscore_cpp.h:115
@ kSinkPropertyCreated
Definition: cscore_cpp.h:119
@ kSourceVideoModeChanged
Definition: cscore_cpp.h:108
@ kSinkDisabled
Definition: cscore_cpp.h:116
@ kSourcePropertyValueUpdated
Definition: cscore_cpp.h:110
@ kSinkPropertyValueUpdated
Definition: cscore_cpp.h:120
@ kSinkPropertyChoicesUpdated
Definition: cscore_cpp.h:121
@ kSinkCreated
Definition: cscore_cpp.h:113
@ kSourceCreated
Definition: cscore_cpp.h:103
@ kSourceDisconnected
Definition: cscore_cpp.h:106
@ kNetworkInterfacesChanged
Definition: cscore_cpp.h:117
@ kSinkDestroyed
Definition: cscore_cpp.h:114
@ kSourcePropertyChoicesUpdated
Definition: cscore_cpp.h:111
@ kSourceDestroyed
Definition: cscore_cpp.h:104
@ kSourceVideoModesUpdated
Definition: cscore_cpp.h:107
@ kSourceConnected
Definition: cscore_cpp.h:105
USB camera information.
Definition: cscore_cpp.h:44
int dev
Device number (e.g.
Definition: cscore_cpp.h:46
std::string name
Vendor/model name of the camera as provided by the USB driver.
Definition: cscore_cpp.h:50
int productId
USB Product Id.
Definition: cscore_cpp.h:56
int vendorId
USB Vendor Id.
Definition: cscore_cpp.h:54
std::string path
Path to device if available (e.g.
Definition: cscore_cpp.h:48
std::vector< std::string > otherPaths
Other path aliases to device (e.g.
Definition: cscore_cpp.h:52
Video mode.
Definition: cscore_cpp.h:62
VideoMode(PixelFormat pixelFormat_, int width_, int height_, int fps_)
Definition: cscore_cpp.h:79
VideoMode()
Definition: cscore_cpp.h:73
bool CompareWithoutFps(const VideoMode &other) const
Definition: cscore_cpp.h:92
bool operator==(const VideoMode &other) const
Definition: cscore_cpp.h:87
PixelFormat
Definition: cscore_cpp.h:63
@ kYUYV
Definition: cscore_cpp.h:66
@ kUnknown
Definition: cscore_cpp.h:64
@ kGray
Definition: cscore_cpp.h:69
@ kBGR
Definition: cscore_cpp.h:68
@ kMJPEG
Definition: cscore_cpp.h:65
@ kY16
Definition: cscore_cpp.h:70
@ kUYVY
Definition: cscore_cpp.h:71
@ kRGB565
Definition: cscore_cpp.h:67