From patchwork Tue Jan 15 15:18:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 234 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9550C60C85 for ; Tue, 15 Jan 2019 16:18:53 +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 D63AC4F8 for ; Tue, 15 Jan 2019 16:18:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547565533; bh=PvkPS50fI1Ol84OE9MuOboJ5l+cRC6A2bdw/QI26BS4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MGNdMV0NeYO/rUZ+CZrps+BjkFH5D6MskxrOedwvxN50pM5ZYaYedg+BSIRHWc6U1 u0tJQthuaKhsWXGfp4NwaulVaf2X0GEadfwst5S3AwlbbHWzpsdLcM3YVA0t1x5DfK NJUVs5OFRBqhpIRGmua/vPRDbwC4S3JkJQNfiu6c= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Tue, 15 Jan 2019 17:18:43 +0200 Message-Id: <20190115151849.1547-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190115151849.1547-1-laurent.pinchart@ideasonboard.com> References: <20190115151849.1547-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/8] 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: Tue, 15 Jan 2019 15:18:53 -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 Reviewed-by: Niklas Söderlund --- 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 91ef6753f405..4313994e97c8 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() { @@ -102,7 +114,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