camera_manager.h
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2018, Google Inc.
*
* camera_manager.h - Camera management
*/
#ifndef __LIBCAMERA_CAMERA_MANAGER_H__
#define __LIBCAMERA_CAMERA_MANAGER_H__
#include <memory>
#include <string>
#include <sys/types.h>
#include <vector>
#include <libcamera/object.h>
#include <libcamera/signal.h>
namespace libcamera {
class Camera;
class EventDispatcher;
class CameraManager : public Object
{
public:
CameraManager();
CameraManager(const CameraManager &) = delete;
CameraManager &operator=(const CameraManager &) = delete;
~CameraManager();
int start();
void stop();
std::vector<std::shared_ptr<Camera>> cameras() const;
std::shared_ptr<Camera> get(const std::string &name);
std::shared_ptr<Camera> get(dev_t devnum);
void addCamera(std::shared_ptr<Camera> camera,
const std::vector<dev_t> &devnums);
void removeCamera(std::shared_ptr<Camera> camera);
static const std::string &version() { return version_; }
void setEventDispatcher(std::unique_ptr<EventDispatcher> dispatcher);
EventDispatcher *eventDispatcher();
Signal<std::shared_ptr<Camera>> cameraAdded;
Signal<std::shared_ptr<Camera>> cameraRemoved;
private:
static const std::string version_;
static CameraManager *self_;
class Private;
std::unique_ptr<Private> p_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_CAMERA_MANAGER_H__ */
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:320
libcamera::CameraManager::version
static const std::string & version()
Retrieve the libcamera version string.
Definition: camera_manager.h:42
libcamera::CameraManager::start
int start()
Start the camera manager.
Definition: camera_manager.cpp:281
libcamera::CameraManager::removeCamera
void removeCamera(std::shared_ptr< Camera > camera)
Remove a camera from the camera manager.
Definition: camera_manager.cpp:438
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:419
libcamera::CameraManager::cameraAdded
Signal< std::shared_ptr< Camera > > cameraAdded
Notify of a new camera added to the system.
Definition: camera_manager.h:47
libcamera::CameraManager::cameraRemoved
Signal< std::shared_ptr< Camera > > cameraRemoved
Notify of a new camera removed from the system.
Definition: camera_manager.h:48
libcamera::CameraManager::get
std::shared_ptr< Camera > get(const std::string &name)
Get a camera based on name.
Definition: camera_manager.cpp:338
libcamera::CameraManager::stop
void stop()
Stop the camera manager.
Definition: camera_manager.cpp:303
libcamera::CameraManager::eventDispatcher
EventDispatcher * eventDispatcher()
Retrieve the event dispatcher.
Definition: camera_manager.cpp:482
libcamera::CameraManager::setEventDispatcher
void setEventDispatcher(std::unique_ptr< EventDispatcher > dispatcher)
Set the event dispatcher.
Definition: camera_manager.cpp:466
libcamera::EventDispatcher
Interface to manage the libcamera events and timers.
Definition: event_dispatcher.h:18
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
object.h
Base object to support automatic signal disconnection.
signal.h
Signal & slot implementation.