mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-25 17:45:06 +03:00
controls: Add boolean constructors for ControlInfo
It would be convenient to be able to iterate over available boolean values, for example for controls that designate if some function can be enabled/disabled. The current min/max/def constructor is insufficient, as .values() is empty, so the values cannot be easily iterated over, and creating a Span of booleans does not work for the values constructor. Add new constructors to ControlInfo that takes a set of booleans (if both booleans are valid values) plus a default, and another that takes only one boolean (if only one boolean is a valid value). Update the ControlInfo test accordingly. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
fba85e6901
commit
10cdc914da
3 changed files with 65 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
#define __LIBCAMERA_CONTROLS_H__
|
||||
|
||||
#include <assert.h>
|
||||
#include <set>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
@ -272,6 +273,8 @@ public:
|
|||
const ControlValue &def = 0);
|
||||
explicit ControlInfo(Span<const ControlValue> values,
|
||||
const ControlValue &def = {});
|
||||
explicit ControlInfo(std::set<bool> values, bool def);
|
||||
explicit ControlInfo(bool value);
|
||||
|
||||
const ControlValue &min() const { return min_; }
|
||||
const ControlValue &max() const { return max_; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue