YARP
Yet Another Robot Platform
IFrameGrabberControls.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef YARP_DEV_IFRAMEGRABBERCONTROLS_H
8 #define YARP_DEV_IFRAMEGRABBERCONTROLS_H
9 
10 #include <yarp/dev/api.h>
11 
12 #include <string>
13 
14 
15 typedef enum {
18  BUS_USB
20 
21 typedef enum {
24  MODE_AUTO
26 
27 typedef struct {
29  std::string deviceDescription;
31 
32 typedef enum {
57  YARP_FEATURE_NUMBER_OF // this has to be the last one
59 
60 namespace yarp {
61 namespace dev {
62 
69 {
70 public:
75 
76 #ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
77 // set
83  YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_BRIGHTNESS, v) instead")
84  virtual bool setBrightness(double v) { return false; }
90  YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_EXPOSURE, v) instead")
91  virtual bool setExposure(double v) { return false; }
97  YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_SHARPNESS, v) instead")
98  virtual bool setSharpness(double v) { return false; }
105  YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_WHITE_BALANCE, blue, red) instead")
106  virtual bool setWhiteBalance(double blue, double red) { return false; }
112  YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_HUE, v) instead")
113  virtual bool setHue(double v) { return false; }
119  YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_SATURATION, v) instead")
120  virtual bool setSaturation(double v) { return false; }
126  YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_GAMMA, v) instead")
127  virtual bool setGamma(double v) { return false; }
133  YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_SHUTTER, v) instead")
134  virtual bool setShutter(double v) { return false; }
140  YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_GAIN, v) instead")
141  virtual bool setGain(double v) { return false; }
147  YARP_DEPRECATED_MSG("Use setFeature(YARP_FEATURE_IRIS, v) instead")
148  virtual bool setIris(double v) { return false; }
149 
150 // get
155  YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_BRIGHTNESS, v) instead")
156  virtual double getBrightness() { return -1.0; }
161  YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_EXPOSURE, v) instead")
162  virtual double getExposure() { return -1.0; }
167  YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_SHARPNESS, v) instead")
168  virtual double getSharpness() { return -1.0; }
175  YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_WHITE_BALANCE, blue, red) instead")
176  virtual bool getWhiteBalance(double &blue, double &red) { return false; }
181  YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_HUE, v) instead")
182  virtual double getHue() { return -1.0; }
187  YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_SATURATION, v) instead")
188  virtual double getSaturation() { return -1.0; }
193  YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_GAMMA, v) instead")
194  virtual double getGamma() { return -1.0; }
199  YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_SHUTTER, v) instead")
200  virtual double getShutter() { return -1.0; }
205  YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_GAIN, v) instead")
206  virtual double getGain() { return -1.0; }
211  YARP_DEPRECATED_MSG("Use getFeature(YARP_FEATURE_IRIS, v) instead")
212  virtual double getIris() { return -1.0; }
213 #endif
214 
215  std::string busType2String(BusType type)
216  {
217  switch (type) {
218  case BUS_FIREWIRE:
219  return "FireWire";
220  break;
221 
222  case BUS_USB:
223  return "USB";
224  break;
225 
226  default:
227  return "bus type undefined";
228  break;
229  }
230  }
231 
232  inline FeatureMode toFeatureMode(bool _auto)
233  {
234  return _auto ? MODE_AUTO : MODE_MANUAL;
235  }
242  virtual bool getCameraDescription(CameraDescriptor *camera)=0;
243 
250  virtual bool hasFeature(int feature, bool *hasFeature)=0;
251 
258  virtual bool setFeature(int feature, double value)=0;
259 
266  virtual bool getFeature(int feature, double *value)=0;
267 
276  virtual bool setFeature(int feature, double value1, double value2)=0;
277 
285  virtual bool getFeature(int feature, double *value1, double *value2)=0;
286 
293  virtual bool hasOnOff(int feature, bool *HasOnOff)=0;
294 
301  virtual bool setActive(int feature, bool onoff)=0;
302 
309  virtual bool getActive(int feature, bool *isActive)=0;
310 
317  virtual bool hasAuto(int feature, bool *hasAuto)=0;
318 
325  virtual bool hasManual(int feature, bool *hasManual)=0;
326 
333  virtual bool hasOnePush(int feature, bool *hasOnePush)=0;
334 
341  virtual bool setMode(int feature, FeatureMode mode)=0;
342 
349  virtual bool getMode(int feature, FeatureMode *mode)=0;
350 
357  virtual bool setOnePush(int feature)=0;
358 };
359 
360 } // namespace dev
361 } // namespace yarp
362 
363 #endif // YARP_DEV_IFRAMEGRABBERCONTROLS_H
@ BUS_FIREWIRE
@ BUS_UNKNOWN
cameraFeature_id_t
@ YARP_FEATURE_NUMBER_OF
@ YARP_FEATURE_CAPTURE_SIZE
@ YARP_FEATURE_SHARPNESS
@ YARP_FEATURE_FRAME_RATE
@ YARP_FEATURE_BRIGHTNESS
@ YARP_FEATURE_TRIGGER
@ YARP_FEATURE_HUE
@ YARP_FEATURE_WHITE_BALANCE
@ YARP_FEATURE_GAMMA
@ YARP_FEATURE_TILT
@ YARP_FEATURE_EXPOSURE
@ YARP_FEATURE_CAPTURE_QUALITY
@ YARP_FEATURE_INVALID
@ YARP_FEATURE_TRIGGER_DELAY
@ YARP_FEATURE_IRIS
@ YARP_FEATURE_MIRROR
@ YARP_FEATURE_SATURATION
@ YARP_FEATURE_WHITE_SHADING
@ YARP_FEATURE_FOCUS
@ YARP_FEATURE_SHUTTER
@ YARP_FEATURE_TEMPERATURE
@ YARP_FEATURE_GAIN
@ YARP_FEATURE_PAN
@ YARP_FEATURE_OPTICAL_FILTER
@ YARP_FEATURE_ZOOM
@ MODE_MANUAL
@ MODE_UNKNOWN
Control interface for frame grabber devices.
virtual bool setFeature(int feature, double value)=0
Set the requested feature to a value (saturation, brightness ...
virtual ~IFrameGrabberControls()
Destructor.
virtual bool setOnePush(int feature)=0
Set the requested feature to a value (saturation, brightness ...
virtual bool getFeature(int feature, double *value)=0
Get the current value for the requested feature.
virtual bool setFeature(int feature, double value1, double value2)=0
Set the requested feature to a value using 2 params (like white balance)
virtual bool hasManual(int feature, bool *hasManual)=0
Check if the requested feature has the 'manual' mode.
virtual bool setMode(int feature, FeatureMode mode)=0
Set the requested mode for the feature.
std::string busType2String(BusType type)
virtual bool hasOnOff(int feature, bool *HasOnOff)=0
Check if the camera has the ability to turn on/off the requested feature.
virtual bool hasAuto(int feature, bool *hasAuto)=0
Check if the requested feature has the 'auto' mode.
virtual bool getMode(int feature, FeatureMode *mode)=0
Get the current mode for the feature.
virtual bool getFeature(int feature, double *value1, double *value2)=0
Get the current value for the requested feature.
virtual bool getCameraDescription(CameraDescriptor *camera)=0
Get a basic description of the camera hw.
virtual bool getActive(int feature, bool *isActive)=0
Get the current status of the feature, on or off.
virtual bool setActive(int feature, bool onoff)=0
Set the requested feature on or off.
virtual bool hasFeature(int feature, bool *hasFeature)=0
Check if camera has the requested feature (saturation, brightness ...
virtual bool hasOnePush(int feature, bool *hasOnePush)=0
Check if the requested feature has the 'onePush' mode.
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2885
The main, catch-all namespace for YARP.
Definition: dirs.h:16
std::string deviceDescription
#define YARP_dev_API
Definition: api.h:18