Show a patch.

GET /api/1.1/patches/1722/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1722,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/1722/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1722/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20190801155420.24694-2-jacopo@jmondi.org>",
    "date": "2019-08-01T15:54:16",
    "name": "[libcamera-devel,1/5] libcamera: camera: Make camera state accessible",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2f0b523fd1994ec9bea757e7fc143823d1101036",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1722/mbox/",
    "series": [
        {
            "id": 444,
            "url": "https://patchwork.libcamera.org/api/1.1/series/444/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=444",
            "date": "2019-08-01T15:54:15",
            "name": "android: Add initial Camera HAL implementation",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/444/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1722/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1722/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3BFDC615DF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  1 Aug 2019 17:53:05 +0200 (CEST)",
            "from uno.homenet.telecomitalia.it\n\t(host211-19-dynamic.58-82-r.retail.telecomitalia.it [82.58.19.211])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 96B9EE0009;\n\tThu,  1 Aug 2019 15:53:04 +0000 (UTC)"
        ],
        "X-Originating-IP": "82.58.19.211",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  1 Aug 2019 17:54:16 +0200",
        "Message-Id": "<20190801155420.24694-2-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.22.0",
        "In-Reply-To": "<20190801155420.24694-1-jacopo@jmondi.org>",
        "References": "<20190801155420.24694-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 1/5] libcamera: camera: Make camera state\n\taccessible",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "X-List-Received-Date": "Thu, 01 Aug 2019 15:53:05 -0000"
    },
    "content": "Make the Camera state accessible by providing an accessor operation and\nmoving the State enumeration definition in the public scope.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/camera.h | 16 +++++++++-------\n src/libcamera/camera.cpp   | 33 +++++++++++++++++++++++++++------\n 2 files changed, 36 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 21fac550f412..6e627943b3f1 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -66,6 +66,14 @@ protected:\n \tstd::vector<StreamConfiguration> config_;\n };\n \n+enum State {\n+\tCameraAvailable,\n+\tCameraAcquired,\n+\tCameraConfigured,\n+\tCameraPrepared,\n+\tCameraRunning,\n+};\n+\n class Camera final : public std::enable_shared_from_this<Camera>\n {\n public:\n@@ -77,6 +85,7 @@ public:\n \tCamera &operator=(const Camera &) = delete;\n \n \tconst std::string &name() const;\n+\tState state() const { return state_; }\n \n \tSignal<Request *, Buffer *> bufferCompleted;\n \tSignal<Request *, const std::map<Stream *, Buffer *> &> requestCompleted;\n@@ -101,13 +110,6 @@ public:\n \tint stop();\n \n private:\n-\tenum State {\n-\t\tCameraAvailable,\n-\t\tCameraAcquired,\n-\t\tCameraConfigured,\n-\t\tCameraPrepared,\n-\t\tCameraRunning,\n-\t};\n \n \tCamera(PipelineHandler *pipe, const std::string &name);\n \t~Camera();\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 76c737cb9381..e924c2085816 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -253,6 +253,21 @@ std::size_t CameraConfiguration::size() const\n  * \\brief The vector of stream configurations\n  */\n \n+/**\n+ * \\enum State\n+ * \\brief Describe the Camera state as defined in \\ref camera_states\n+ * \\var State::CameraAvailable\n+ * See \\ref camera_available\n+ * \\var State::CameraAcquired\n+ * See \\ref camera_acquired\n+ * \\var State::CameraConfigured\n+ * See \\ref camera_configured\n+ * \\var State::CameraPrepared\n+ * See \\ref camera_prepared\n+ * \\var State::CameraRunning\n+ * See \\ref camera_running\n+ */\n+\n /**\n  * \\class Camera\n  * \\brief Camera device\n@@ -284,7 +299,7 @@ std::size_t CameraConfiguration::size() const\n  * not released. The camera may also be reconfigured provided that all\n  * resources allocated are freed prior to the reconfiguration.\n  *\n- * \\subsection Camera States\n+ * \\subsection camera_states Camera States\n  *\n  * To help manage the sequence of operations needed to control the camera a set\n  * of states are defined. Each state describes which operations may be performed\n@@ -318,27 +333,27 @@ std::size_t CameraConfiguration::size() const\n  * }\n  * \\enddot\n  *\n- * \\subsubsection Available\n+ * \\subsubsection camera_available Available\n  * The base state of a camera, an application can inspect the properties of the\n  * camera to determine if it wishes to use it. If an application wishes to use\n  * a camera it should acquire() it to proceed to the Acquired state.\n  *\n- * \\subsubsection Acquired\n+ * \\subsubsection camera_acquired Acquired\n  * In the acquired state an application has exclusive access to the camera and\n  * may modify the camera's parameters to configure it and proceed to the\n  * Configured state.\n  *\n- * \\subsubsection Configured\n+ * \\subsubsection camera_configured Configured\n  * The camera is configured and ready for the application to prepare it with\n  * resources. The camera may be reconfigured multiple times until resources\n  * are provided and the state progresses to Prepared.\n  *\n- * \\subsubsection Prepared\n+ * \\subsubsection camera_prepared Prepared\n  * The camera has been configured and provided with resources and is ready to be\n  * started. The application may free the camera's resources to get back to the\n  * Configured state or start() it to progress to the Running state.\n  *\n- * \\subsubsection Running\n+ * \\subsubsection camera_running Running\n  * The camera is running and ready to process requests queued by the\n  * application. The camera remains in this state until it is stopped and moved\n  * to the Prepared state.\n@@ -380,6 +395,12 @@ const std::string &Camera::name() const\n \treturn name_;\n }\n \n+/**\n+ * \\fn Camera::state()\n+ * \\brief Retrieve the current camera state as defined in \\ref camera_states\n+ * \\return The current camera state\n+ */\n+\n /**\n  * \\var Camera::bufferCompleted\n  * \\brief Signal emitted when a buffer for a request queued to the camera has\n",
    "prefixes": [
        "libcamera-devel",
        "1/5"
    ]
}