libcamera: include/libcamera/camera_manager.h Source File

libcamera v0.7.2 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
camera_manager.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2018, Google Inc.
4 *
5 * Camera management
6 */
7
8#pragma once
9
10#include <memory>
11#include <string>
12#include <string_view>
13#include <sys/types.h>
14#include <vector>
15
16#include <libcamera/base/class.h>
17#include <libcamera/base/object.h>
18#include <libcamera/base/signal.h>
19
20namespace libcamera {
21
22class Camera;
23
24 class CameraManager : public Object, public Extensible
25{
26 LIBCAMERA_DECLARE_PRIVATE()
27public:
28 CameraManager();
29 ~CameraManager();
30
31 int start();
32 void stop();
33
34 std::vector<std::shared_ptr<Camera>> cameras() const;
35 std::shared_ptr<Camera> get(std::string_view id);
36
37 static const std::string &version() { return version_; }
38
39 Signal<std::shared_ptr<Camera>> cameraAdded;
40 Signal<std::shared_ptr<Camera>> cameraRemoved;
41
42private:
43 LIBCAMERA_DISABLE_COPY(CameraManager)
44
45 static const std::string version_;
46 static CameraManager *self_;
47};
48
49} /* namespace libcamera */
class.h
Utilities to help constructing class interfaces.
LIBCAMERA_DECLARE_PRIVATE
#define LIBCAMERA_DECLARE_PRIVATE()
Declare private data for a public class.
Definition class.h:56
LIBCAMERA_DISABLE_COPY
#define LIBCAMERA_DISABLE_COPY(klass)
Disable copy construction and assignment of the klass.
Definition class.h:27
libcamera::CameraManager::get
std::shared_ptr< Camera > get(std::string_view id)
Get a camera based on ID.
Definition camera_manager.cpp:398
libcamera::CameraManager::cameras
std::vector< std::shared_ptr< Camera > > cameras() const
Retrieve all available cameras.
Definition camera_manager.cpp:378
libcamera::CameraManager::start
int start()
Start the camera manager.
Definition camera_manager.cpp:338
libcamera::CameraManager::version
static const std::string & version()
Retrieve the libcamera version string.
Definition camera_manager.h:37
libcamera::CameraManager::stop
void stop()
Stop the camera manager.
Definition camera_manager.cpp:360
libcamera::CameraManager::cameraAdded
Signal< std::shared_ptr< Camera > > cameraAdded
Notify of a new camera added to the system.
Definition camera_manager.h:39
libcamera::CameraManager::cameraRemoved
Signal< std::shared_ptr< Camera > > cameraRemoved
Notify of a new camera removed from the system.
Definition camera_manager.h:40
libcamera::CameraManager::~CameraManager
~CameraManager()
Destroy the camera manager.
Definition camera_manager.cpp:321
libcamera::Camera
Camera device.
Definition camera.h:116
libcamera::Extensible::Extensible
Extensible(std::unique_ptr< Private > d)
Construct an instance of an Extensible class.
Definition class.cpp:154
libcamera::Object::Object
Object(Object *parent=nullptr)
Construct an Object instance.
Definition object.cpp:69
libcamera::Signal
Generic signal and slot communication mechanism.
Definition signal.h:39
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17
object.h
Base object to support automatic signal disconnection.
signal.h
Signal & slot implementation.