summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera_manager.cpp38
-rw-r--r--src/libcamera/pipeline_handler.cpp2
2 files changed, 35 insertions, 5 deletions
diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
index 30827976..f60491d2 100644
--- a/src/libcamera/camera_manager.cpp
+++ b/src/libcamera/camera_manager.cpp
@@ -36,7 +36,7 @@ public:
Private(CameraManager *cm);
int start();
- void addCamera(std::shared_ptr<Camera> &camera,
+ void addCamera(std::shared_ptr<Camera> camera,
const std::vector<dev_t> &devnums);
void removeCamera(Camera *camera);
@@ -171,7 +171,7 @@ void CameraManager::Private::cleanup()
enumerator_.reset(nullptr);
}
-void CameraManager::Private::addCamera(std::shared_ptr<Camera> &camera,
+void CameraManager::Private::addCamera(std::shared_ptr<Camera> camera,
const std::vector<dev_t> &devnums)
{
MutexLocker locker(mutex_);
@@ -375,6 +375,34 @@ std::shared_ptr<Camera> CameraManager::get(dev_t devnum)
}
/**
+ * \var CameraManager::cameraAdded
+ * \brief Notify of a new camera added to the system
+ *
+ * This signal is emitted when a new camera is detected and successfully handled
+ * by the camera manager. The notification occurs alike for cameras detected
+ * when the manager is started with start() or when new cameras are later
+ * connected to the system. When the signal is emitted the new camera is already
+ * available from the list of cameras().
+ *
+ * The signal is emitted from the CameraManager thread. Applications shall
+ * minimize the time spent in the signal handler and shall in particular not
+ * perform any blocking operation.
+ */
+
+/**
+ * \var CameraManager::cameraRemoved
+ * \brief Notify of a new camera removed from the system
+ *
+ * This signal is emitted when a camera is removed from the system. When the
+ * signal is emitted the camera is not available from the list of cameras()
+ * anymore.
+ *
+ * The signal is emitted from the CameraManager thread. Applications shall
+ * minimize the time spent in the signal handler and shall in particular not
+ * perform any blocking operation.
+ */
+
+/**
* \brief Add a camera to the camera manager
* \param[in] camera The camera to be added
* \param[in] devnums The device numbers to associate with \a camera
@@ -394,6 +422,7 @@ void CameraManager::addCamera(std::shared_ptr<Camera> camera,
ASSERT(Thread::current() == p_.get());
p_->addCamera(camera, devnums);
+ cameraAdded.emit(camera);
}
/**
@@ -406,11 +435,12 @@ void CameraManager::addCamera(std::shared_ptr<Camera> camera,
*
* \context This function shall be called from the CameraManager thread.
*/
-void CameraManager::removeCamera(Camera *camera)
+void CameraManager::removeCamera(std::shared_ptr<Camera> camera)
{
ASSERT(Thread::current() == p_.get());
- p_->removeCamera(camera);
+ p_->removeCamera(camera.get());
+ cameraRemoved.emit(camera);
}
/**
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 38c85779..14dfba0b 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -579,7 +579,7 @@ void PipelineHandler::disconnect()
continue;
camera->disconnect();
- manager_->removeCamera(camera.get());
+ manager_->removeCamera(camera);
}
}