[{"id":2759,"web_url":"https://patchwork.libcamera.org/comment/2759/","msgid":"<20191003194442.GN1322@bigcity.dyn.berto.se>","date":"2019-10-03T19:44:42","subject":"Re: [libcamera-devel] [PATCH v2 11/13] libcamera: Add\n\tControlValidator","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2019-09-29 22:02:52 +0300, Laurent Pinchart wrote:\n> The new abstract ControlValidator class defines an interface that will\n> be used by the ControlList class to validate controls. This will allow\n> controls to the validated against different object types, such as Camera\n> and V4L2Device.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\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\n> \n> diff --git a/src/libcamera/control_validator.cpp b/src/libcamera/control_validator.cpp\n> new file mode 100644\n> index 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 */\n> diff --git a/src/libcamera/include/control_validator.h b/src/libcamera/include/control_validator.h\n> new file mode 100644\n> index 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__ */\n> diff --git a/src/libcamera/include/meson.build b/src/libcamera/include/meson.build\n> index 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',\n> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> index 6df48365266d..c8a66cfc93d5 100644\n> --- a/src/libcamera/meson.build\n> +++ b/src/libcamera/meson.build\n> @@ -5,6 +5,7 @@ libcamera_sources = files([\n>      'camera_manager.cpp',\n>      'camera_sensor.cpp',\n>      'controls.cpp',\n> +    'control_validator.cpp',\n>      'device_enumerator.cpp',\n>      'device_enumerator_sysfs.cpp',\n>      'event_dispatcher.cpp',\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x243.google.com (mail-lj1-x243.google.com\n\t[IPv6:2a00:1450:4864:20::243])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 85BF360BE8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Oct 2019 21:44:44 +0200 (CEST)","by mail-lj1-x243.google.com with SMTP id v24so4094241ljj.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 03 Oct 2019 12:44:44 -0700 (PDT)","from localhost (h-93-159.A463.priv.bahnhof.se. [46.59.93.159])\n\tby smtp.gmail.com with ESMTPSA id c4sm620860lfm.4.2019.10.03.12.44.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 03 Oct 2019 12:44:43 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=Xsy+b3JzjHWAuxUPt15QHPPN0qkOwB0ScLh74hC83H0=;\n\tb=IyHnWg4+lp9D2EBPyU0BUC88B+Lsyhm20t7SixvC7q6kHpMRHMvkwXZ1ZLEq6TpRZv\n\twulaZbtZcrQuO/PfrOXu+VeeMxxesUPXG06TnZcHjfvKfcWuxYNUWiNm+Z2/jrDxhglJ\n\tIjTNPqh3+3AGEqwMry4I5VCqg5dMfMxefz82Zdyzlud1Zr5Y3UB4Hk5qmTxjBMDcZdOA\n\tVgFhmKvpJQX7qySaQqJOfLSOVdxS3W4yH3kxZeB9X2dIjliNyz+z9ozE+4xg66NKL0Cm\n\t6yTsIhAz9/KMk5Zhwxv/+yJkaSbDjFAkxh1QOlYk5HeJoPkgPlQwwqaw4Xa71N5GrWBL\n\tyTBw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=Xsy+b3JzjHWAuxUPt15QHPPN0qkOwB0ScLh74hC83H0=;\n\tb=VrUBe/mxyo8Xor3Huf9EbcQmvYnByZtwHtDOKiwP7L244YOlyUw95TBLalSi8NI3X1\n\t+waarR64cJ2vgWWJNpEXI9ZKKtlYm/2WpBc+rTed2c6KAQP9hkbzHpEeYTXG4/jbM9C9\n\tNb0QajTIJ675fKr8fT2ER9v7k8HV34rtvvaxKuZ3EL85cKvzLkAUGcPHdjXd02v5Gvc+\n\tPId4hfw1OHaBlPq/VjOK4vJcRqZc8rKosqjiq6ycKBc0lnhPjo2YoC50fZmT/R59Jx5c\n\tHNA0mGkrMYdmVDhV7QyPHDpPX8l8S2Dz1mMwfI9kxWek6i0p/CD0Ls5TUvJEE6IX8+9O\n\tu1Wg==","X-Gm-Message-State":"APjAAAVJj4WdAV6vv6V/Tio3SXkO4rXNnx0usgj/4w3RPsOOS+b3egio\n\tDJeFFMkCgWzfbc+SB7XQtzxFOg==","X-Google-Smtp-Source":"APXvYqw5GU1zm6/jW53283uoU8XHXvJI4zHnxTRayT3lLniNIKItB7buF7RnZ9OwfdL+1q8Sg8ZIlQ==","X-Received":"by 2002:a2e:530d:: with SMTP id\n\th13mr7118721ljb.109.1570131883927; \n\tThu, 03 Oct 2019 12:44:43 -0700 (PDT)","Date":"Thu, 3 Oct 2019 21:44:42 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20191003194442.GN1322@bigcity.dyn.berto.se>","References":"<20190929190254.18920-1-laurent.pinchart@ideasonboard.com>\n\t<20190929190254.18920-12-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190929190254.18920-12-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v2 11/13] libcamera: Add\n\tControlValidator","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":"Thu, 03 Oct 2019 19:44:44 -0000"}}]