Show a patch.

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

{
    "id": 2052,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/2052/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2052/",
    "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": "<20190928152238.23752-11-laurent.pinchart@ideasonboard.com>",
    "date": "2019-09-28T15:22:36",
    "name": "[libcamera-devel,10/12] libcamera: Add ControlValidator",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "9c122446d05b056562da016acc9c3e87eeb2cc1e",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2052/mbox/",
    "series": [
        {
            "id": 511,
            "url": "https://patchwork.libcamera.org/api/1.1/series/511/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=511",
            "date": "2019-09-28T15:22:26",
            "name": "Improve the application-facing controls API",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/511/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2052/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2052/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 828E861922\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 28 Sep 2019 17:23:00 +0200 (CEST)",
            "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EBF23593\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 28 Sep 2019 17:22:59 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1569684180;\n\tbh=vao5iALY/vN1YmzjFMh1vippKydG18ciC8Arig9X120=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=gesKac9kMX31yuCrQ9pQMJXhCSIJknnJyFt4uERtDFcadnbK/HciS1jUz5wDMbgW6\n\txgp7f7nkeD3/xaKOi29nk2ub+rfzjcEzLL1Sd7w1NXw6giYDg2XX8w8xS4z6iz3CU/\n\tpPaPsKAvwZ5Hych+Wm0b4p6CJ2+6J5L0pMtx9k2A=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 28 Sep 2019 18:22:36 +0300",
        "Message-Id": "<20190928152238.23752-11-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20190928152238.23752-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20190928152238.23752-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 10/12] libcamera: Add ControlValidator",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "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": "Sat, 28 Sep 2019 15:23:01 -0000"
    },
    "content": "The new abstract ControlValidator class defines an interface that will\nbe used by the ControlList class to validate controls. This will allow\ncontrols to the validated against different object types, such as Camera\nand V4L2Device.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/control_validator.cpp       | 45 +++++++++++++++++++++++\n src/libcamera/include/control_validator.h | 27 ++++++++++++++\n src/libcamera/include/meson.build         |  1 +\n src/libcamera/meson.build                 |  1 +\n 4 files changed, 74 insertions(+)\n create mode 100644 src/libcamera/control_validator.cpp\n create mode 100644 src/libcamera/include/control_validator.h",
    "diff": "diff --git a/src/libcamera/control_validator.cpp b/src/libcamera/control_validator.cpp\nnew file mode 100644\nindex 000000000000..8e5cf3c3e3ee\n--- /dev/null\n+++ b/src/libcamera/control_validator.cpp\n@@ -0,0 +1,45 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * control_validator.cpp - Control validator\n+ */\n+\n+#include \"control_validator.h\"\n+\n+/**\n+ * \\file control_validator.h\n+ * \\brief Abstract control validator\n+ */\n+\n+namespace libcamera {\n+\n+/**\n+ * \\class ControlValidator\n+ * \\brief Interface for the control validator\n+ *\n+ * The ControlValidator class is used by the ControlList class to validate\n+ * controls added to the list. It is an abstract class providing an interface\n+ * for object-specific control validation, such a Camera controls and V4L2\n+ * controls.\n+ */\n+\n+/**\n+ * \\fn ControlValidator::name()\n+ * \\brief Retrieve the name of the object associated with the validator\n+ * \\return The name of the object associated with the validator\n+ */\n+\n+/**\n+ * \\fn ControlValidator::validate()\n+ * \\brief Validate a control\n+ * \\param[in] id The control ID\n+ *\n+ * This method validates the control \\a id against the object corresponding to\n+ * the validator. It shall at least validate that the control is applicable to\n+ * the object instance, and may perform additional checks.\n+ *\n+ * \\return True if the control is valid, false otherwise\n+ */\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/include/control_validator.h b/src/libcamera/include/control_validator.h\nnew file mode 100644\nindex 000000000000..3598b18f2f26\n--- /dev/null\n+++ b/src/libcamera/include/control_validator.h\n@@ -0,0 +1,27 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * control_validator.h - Control validator\n+ */\n+#ifndef __LIBCAMERA_CONTROL_VALIDATOR_H__\n+#define __LIBCAMERA_CONTROL_VALIDATOR_H__\n+\n+#include <string>\n+\n+namespace libcamera {\n+\n+class ControlId;\n+\n+class ControlValidator\n+{\n+public:\n+\tvirtual ~ControlValidator() {}\n+\n+\tvirtual const std::string &name() const = 0;\n+\tvirtual bool validate(const ControlId &id) const = 0;\n+};\n+\n+} /* namespace libcamera */\n+\n+#endif /* __LIBCAMERA_CONTROL_VALIDATOR_H__ */\ndiff --git a/src/libcamera/include/meson.build b/src/libcamera/include/meson.build\nindex 933be8543a8d..1cf47204f2b5 100644\n--- a/src/libcamera/include/meson.build\n+++ b/src/libcamera/include/meson.build\n@@ -1,5 +1,6 @@\n libcamera_headers = files([\n     'camera_sensor.h',\n+    'control_validator.h',\n     'device_enumerator.h',\n     'device_enumerator_sysfs.h',\n     'device_enumerator_udev.h',\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 8123d1d5bee9..984cb9985f49 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -6,6 +6,7 @@ libcamera_sources = files([\n     'camera_sensor.cpp',\n     'controls.cpp',\n     'control_ids.cpp',\n+    'control_validator.cpp',\n     'device_enumerator.cpp',\n     'device_enumerator_sysfs.cpp',\n     'event_dispatcher.cpp',\n",
    "prefixes": [
        "libcamera-devel",
        "10/12"
    ]
}