From patchwork Sat Jan 12 14:46:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 218 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 80B4860B2E for ; Sat, 12 Jan 2019 15:46:29 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C1676513 for ; Sat, 12 Jan 2019 15:46:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547304388; bh=w4pW37E5+lvaZ7774b5bFyHQMtHNPdOufp57opoRR7U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SLAOUhwN1Lck7o1+y69MCW2O03qrhQkBuN2Y4KCV4+0P6wECnsLR3d7EuIKFzyD5Z EBbFDIWKtH5NlJ6ZCbxJwnwtDL4eeWhE79Vs3vE9M1bhauWxtDyk8ZMihyKQXy69Zc N9kKY5zUUlTavl034U8d2Qr23uG80yuu/m4kKX5o= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 12 Jan 2019 16:46:18 +0200 Message-Id: <20190112144619.5816-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190112144619.5816-1-laurent.pinchart@ideasonboard.com> References: <20190112144619.5816-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] libcamera: camera_manager: Improve class documentation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jan 2019 14:46:29 -0000 Move documentation from the \file directive to the CameraManager class, as it documents the class, not the file. Improve the documentation to provide a brief overview of how the camera manager operates, and fix a few typos and inconsistencies. The documentation mentions hotplug even though it isn't implement yet, as this is a planned feature. More improvements are needed for the documentation of the CameraManager member functions, and will be added as part of the API improvements in the near future. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/libcamera/camera_manager.cpp | 56 +++++++++++++++++++------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index e4072529fdc4..d91ca72a3802 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -15,30 +15,42 @@ /** * \file camera_manager.h - * \brief Manage all cameras handled by libcamera - * - * The responsibility of the camera manager is to control the lifetime - * management of objects provided by libcamera. - * - * When a user wish to interact with libcamera it creates and starts a - * CameraManager object. Once confirmed the camera manager is running - * the application can list all cameras detected by the library, get - * one or more of the cameras and interact with them. - * - * When the user is done with the camera it should be returned to the - * camera manager. Once all cameras are returned to the camera manager - * the user is free to stop the manager. - * - * \todo Add ability to add and remove media devices based on - * hot-(un)plug events coming from the device enumerator. - * - * \todo Add interface to register a notification callback to the user - * to be able to inform it new cameras have been hot-plugged or - * cameras have been removed due to hot-unplug. + * \brief The camera manager */ namespace libcamera { +/** + * \class CameraManager + * \brief Provide access and manage all cameras in the system + * + * The camera manager is the entry point to libcamera. Ii enumerates devices, + * associates them with pipeline managers, and provides access to the cameras + * in the system to applications. The manager owns all Camera objects and + * handles hot-plugging and hot-unplugging to manage the lifetime of cameras. + * + * To interact with libcamera, an application retrieves the camera manager + * instance with CameraManager::instance(). The manager is initially stopped, + * and shall be configured before being started. In particular a custom event + * dispatcher shall be installed if needed with + * CameraManager::setEventDispatcher(). + * + * Once the camera manager is configured, it shall be started with start(). + * This will enumerate all the cameras present in the system, which can then be + * listed with list() and retrieved with get(). + * + * Cameras are reference-counted, and shall be returned to the camera manager + * with Camera::put() after being used. Once all cameras have been returned to + * the manager, it can be stopped with stop(). + * + * \todo Add ability to add and remove media devices based on hot-(un)plug + * events coming from the device enumerator. + * + * \todo Add interface to register a notification callback to the user to be + * able to inform it new cameras have been hot-plugged or cameras have been + * removed due to hot-unplug. + */ + CameraManager::CameraManager() : enumerator_(nullptr), dispatcher_(nullptr) { @@ -57,7 +69,7 @@ CameraManager::~CameraManager() * interact with cameras in the system until either the camera manager * is stopped or the camera is unplugged from the system. * - * \return true on successful start false otherwise + * \return 0 on successful start, or a negative error code otherwise */ int CameraManager::start() { @@ -100,7 +112,7 @@ int CameraManager::start() /** * \brief Stop the camera manager * - * Before stopping the camera manger the caller is responsible for making + * Before stopping the camera manager the caller is responsible for making * sure all cameras provided by the manager are returned to the manager. * * After the manager has been stopped no resource provided by the camera