libcamera: include/libcamera/camera_manager.h Source File

libcamera v0.0.4 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_manager.h - Camera management
6 */
7
8#pragma once
9
10#include <memory>
11#include <string>
12#include <sys/types.h>
13#include <vector>
14
15#include <libcamera/base/class.h>
16#include <libcamera/base/object.h>
17#include <libcamera/base/signal.h>
18
19namespace libcamera {
20
21class Camera;
22
23 class CameraManager : public Object, public Extensible
24{
25 LIBCAMERA_DECLARE_PRIVATE()
26public:
27 CameraManager();
28 ~CameraManager();
29
30 int start();
31 void stop();
32
33 std::vector<std::shared_ptr<Camera>> cameras() const;
34 std::shared_ptr<Camera> get(const std::string &id);
35 std::shared_ptr<Camera> get(dev_t devnum);
36
37 void addCamera(std::shared_ptr<Camera> camera,
38 const std::vector<dev_t> &devnums);
39 void removeCamera(std::shared_ptr<Camera> camera);
40
41 static const std::string &version() { return version_; }
42
43 Signal<std::shared_ptr<Camera>> cameraAdded;
44 Signal<std::shared_ptr<Camera>> cameraRemoved;
45
46private:
47 LIBCAMERA_DISABLE_COPY(CameraManager)
48
49 static const std::string version_;
50 static CameraManager *self_;
51};
52
53} /* namespace libcamera */
class.h
Utilities to help constructing class interfaces.
LIBCAMERA_DECLARE_PRIVATE
#define LIBCAMERA_DECLARE_PRIVATE()
Declare private data for a public class.
LIBCAMERA_DISABLE_COPY
#define LIBCAMERA_DISABLE_COPY(klass)
Disable copy construction and assignment of the klass.
libcamera::CameraManager
Provide access and manage all cameras in the system.
Definition: camera_manager.h:24
libcamera::CameraManager::cameras
std::vector< std::shared_ptr< Camera > > cameras() const
Retrieve all available cameras.
Definition: camera_manager.cpp:337
libcamera::CameraManager::version
static const std::string & version()
Retrieve the libcamera version string.
Definition: camera_manager.h:41
libcamera::CameraManager::start
int start()
Start the camera manager.
Definition: camera_manager.cpp:297
libcamera::CameraManager::removeCamera
void removeCamera(std::shared_ptr< Camera > camera)
Remove a camera from the camera manager.
Definition: camera_manager.cpp:463
libcamera::CameraManager::addCamera
void addCamera(std::shared_ptr< Camera > camera, const std::vector< dev_t > &devnums)
Add a camera to the camera manager.
Definition: camera_manager.cpp:442
libcamera::CameraManager::cameraAdded
Signal< std::shared_ptr< Camera > > cameraAdded
Notify of a new camera added to the system.
Definition: camera_manager.h:43
libcamera::CameraManager::cameraRemoved
Signal< std::shared_ptr< Camera > > cameraRemoved
Notify of a new camera removed from the system.
Definition: camera_manager.h:44
libcamera::CameraManager::stop
void stop()
Stop the camera manager.
Definition: camera_manager.cpp:319
libcamera::CameraManager::get
std::shared_ptr< Camera > get(const std::string &id)
Get a camera based on ID.
Definition: camera_manager.cpp:357
libcamera::CameraManager::~CameraManager
~CameraManager()
Destroy the camera manager.
Definition: camera_manager.cpp:280
libcamera::Extensible
Base class to manage private data through a d-pointer.
Definition: class.h:62
libcamera::Object
Base object to support automatic signal disconnection.
Definition: object.h:25
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.