WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
USBCamera Class Reference
Inheritance diagram for USBCamera:
ErrorBase

Public Member Functions

 USBCamera (std::string name, bool useJpeg)
 
void OpenCamera ()
 
void CloseCamera ()
 
void StartCapture ()
 
void StopCapture ()
 
void SetFPS (double fps)
 
void SetSize (unsigned int width, unsigned int height)
 
void UpdateSettings ()
 
void SetBrightness (unsigned int brightness)
 Set the brightness, as a percentage (0-100).
 
unsigned int GetBrightness ()
 Get the brightness, as a percentage (0-100).
 
void SetWhiteBalanceAuto ()
 Set the white balance to auto.
 
void SetWhiteBalanceHoldCurrent ()
 Set the white balance to hold current.
 
void SetWhiteBalanceManual (unsigned int wbValue)
 Set the white balance to manual, with specified color temperature.
 
void SetExposureAuto ()
 Set the exposure to auto exposure.
 
void SetExposureHoldCurrent ()
 Set the exposure to hold current.
 
void SetExposureManual (unsigned int expValue)
 Set the exposure to manual, with a given percentage (0-100)
 
void GetImage (Image *image)
 
unsigned int GetImageData (void *buffer, unsigned int bufferSize)
 
- Public Member Functions inherited from ErrorBase
 ErrorBase (const ErrorBase &)=delete
 
ErrorBaseoperator= (const ErrorBase &)=delete
 
virtual ErrorGetError ()
 Retrieve the current error. More...
 
virtual const ErrorGetError () const
 
virtual void SetErrnoError (llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set error information associated with a C library call that set an error to the "errno" global variable. More...
 
virtual void SetImaqError (int success, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set the current error information associated from the nivision Imaq API. More...
 
virtual void SetError (Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void SetWPIError (llvm::StringRef errorMessage, Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
 Set the current error information associated with this sensor. More...
 
virtual void CloneError (const ErrorBase &rhs) const
 
virtual void ClearError () const
 Clear the current error information associated with this sensor.
 
virtual bool StatusIsFatal () const
 Check if the current error code represents a fatal error. More...
 

Static Public Attributes

static constexpr char const * kDefaultCameraName = "cam0"
 

Protected Member Functions

unsigned int GetJpegSize (void *buffer, unsigned int buffSize)
 Helper function to determine the size of a jpeg. More...
 

Protected Attributes

IMAQdxSession m_id = 0
 
std::string m_name
 
bool m_useJpeg
 
bool m_active = false
 
bool m_open = false
 
priority_recursive_mutex m_mutex
 
unsigned int m_width = 320
 
unsigned int m_height = 240
 
double m_fps = 30
 
std::string m_whiteBalance = AUTO
 
unsigned int m_whiteBalanceValue = 0
 
bool m_whiteBalanceValuePresent = false
 
std::string m_exposure = MANUAL
 
unsigned int m_exposureValue = 50
 
bool m_exposureValuePresent = false
 
unsigned int m_brightness = 80
 
bool m_needSettingsUpdate = true
 
- Protected Attributes inherited from ErrorBase
Error m_error
 

Additional Inherited Members

- Static Public Member Functions inherited from ErrorBase
static void SetGlobalError (Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber)
 
static void SetGlobalWPIError (llvm::StringRef errorMessage, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber)
 
static ErrorGetGlobalError ()
 Retrieve the current global error.
 
- Static Protected Attributes inherited from ErrorBase
static priority_mutex _globalErrorMutex
 
static Error _globalError
 

Member Function Documentation

unsigned int USBCamera::GetJpegSize ( void *  buffer,
unsigned int  buffSize 
)
protected

Helper function to determine the size of a jpeg.

The general structure of how to parse a jpeg for length can be found in this stackoverflow article: http://stackoverflow.com/a/1602428. Be sure to also read the comments for the SOS flag explanation.


The documentation for this class was generated from the following files: