From 6e80c1bcf410cca4b0c028dd337a749a50f9bb7a Mon Sep 17 00:00:00 2001 From: Han-Lin Chen Date: Fri, 3 Dec 2021 17:44:24 +0800 Subject: libcamera: camera_lens: Add a new class to model a camera lens The CameraLens class abstracts camera lens and provides helper functions to ease interactions with them. Signed-off-by: Han-Lin Chen Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Umang Jain Signed-off-by: Kieran Bingham --- include/libcamera/internal/camera_lens.h | 45 ++++++++++++++++++++++++++++++++ include/libcamera/internal/meson.build | 1 + 2 files changed, 46 insertions(+) create mode 100644 include/libcamera/internal/camera_lens.h (limited to 'include') diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h new file mode 100644 index 00000000..6f2ea1bc --- /dev/null +++ b/include/libcamera/internal/camera_lens.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Google Inc. + * + * camera_lens.h - A camera lens controller + */ +#pragma once + +#include +#include + +#include +#include + +namespace libcamera { + +class MediaEntity; +class V4L2Subdevice; + +class CameraLens : protected Loggable +{ +public: + explicit CameraLens(const MediaEntity *entity); + ~CameraLens(); + + int init(); + int setFocusPostion(int32_t position); + + const std::string &model() const { return model_; } + +protected: + std::string logPrefix() const override; + +private: + LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraLens) + + int validateLensDriver(); + + const MediaEntity *entity_; + std::unique_ptr subdev_; + + std::string model_; +}; + +} /* namespace libcamera */ diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 665fd6de..a96bbb95 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -14,6 +14,7 @@ libcamera_internal_headers = files([ 'byte_stream_buffer.h', 'camera.h', 'camera_controls.h', + 'camera_lens.h', 'camera_sensor.h', 'camera_sensor_properties.h', 'control_serializer.h', -- cgit v1.2.1