libcamera  v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
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 <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 
19 namespace libcamera {
20 
21 class Camera;
22 
23 class CameraManager : public Object, public Extensible
24 {
25  LIBCAMERA_DECLARE_PRIVATE()
26 public:
27  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 
36  static const std::string &version() { return version_; }
37 
40 
41 private:
42  LIBCAMERA_DISABLE_COPY(CameraManager)
43 
44  static const std::string version_;
45  static CameraManager *self_;
46 };
47 
48 } /* namespace libcamera */
Top-level libcamera namespace.
Definition: bound_method.h:15
~CameraManager()
Destroy the camera manager.
Definition: camera_manager.cpp:308
static const std::string & version()
Retrieve the libcamera version string.
Definition: camera_manager.h:36
Signal< std::shared_ptr< Camera > > cameraAdded
Notify of a new camera added to the system.
Definition: camera_manager.h:38
Signal & slot implementation.
std::vector< std::shared_ptr< Camera > > cameras() const
Retrieve all available cameras.
Definition: camera_manager.cpp:365
int start()
Start the camera manager.
Definition: camera_manager.cpp:325
Provide access and manage all cameras in the system.
Definition: camera_manager.h:23
void stop()
Stop the camera manager.
Definition: camera_manager.cpp:347
Generic signal and slot communication mechanism.
Definition: signal.h:38
Signal< std::shared_ptr< Camera > > cameraRemoved
Notify of a new camera removed from the system.
Definition: camera_manager.h:39