summaryrefslogtreecommitdiff
path: root/src/libcamera/controls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcamera/controls.cpp')
-rw-r--r--src/libcamera/controls.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
index 76230a05..e5131880 100644
--- a/src/libcamera/controls.cpp
+++ b/src/libcamera/controls.cpp
@@ -47,6 +47,17 @@ namespace libcamera {
LOG_DEFINE_CATEGORY(Controls)
+namespace {
+
+static constexpr size_t ControlValueSize[] = {
+ [ControlTypeNone] = 1,
+ [ControlTypeBool] = sizeof(bool),
+ [ControlTypeInteger32] = sizeof(int32_t),
+ [ControlTypeInteger64] = sizeof(int64_t),
+};
+
+} /* namespace */
+
/**
* \enum ControlType
* \brief Define the data type of a Control
@@ -92,6 +103,18 @@ ControlValue::ControlValue()
*/
/**
+ * \brief Retrieve the raw data of a control value
+ * \return The raw data of the control value as a span of uint8_t
+ */
+Span<const uint8_t> ControlValue::data() const
+{
+ return {
+ reinterpret_cast<const uint8_t *>(&bool_),
+ ControlValueSize[type_]
+ };
+}
+
+/**
* \brief Assemble and return a string describing the value
* \return A string describing the ControlValue
*/