libcamera: camera: Add disconnection notification

As camera object have the potential to outlive the hardware they
represent, there is a need to inform the camera that the underlying
device has been disconnected, and in turn to notify applications.

Implement a disconnection notification mechanism that can be used by
pipeline handlers to notify the camera of disconnection. The camera then
block all new API calls and emit the disconnected signal.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2019-01-22 16:58:40 +01:00 committed by Laurent Pinchart
parent 9d29af143b
commit 124aaffde0
2 changed files with 38 additions and 0 deletions

View file

@ -10,6 +10,8 @@
#include <memory>
#include <string>
#include <libcamera/signal.h>
namespace libcamera {
class PipelineHandler;
@ -25,10 +27,15 @@ public:
const std::string &name() const;
Signal<Camera *> disconnected;
private:
Camera(PipelineHandler *pipe, const std::string &name);
~Camera();
friend class PipelineHandler;
void disconnect();
std::shared_ptr<PipelineHandler> pipe_;
std::string name_;
};