From f24d83720f0ecd5656699f5013d7b5532e6e72c2 Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Mon, 12 Jul 2021 11:02:04 +0100 Subject: ipa: raspberrypi: Add an operator<< to struct DeviceStatus Add an operator<< overload to log all fields in DeviceStatus, and remove the manual logging statements in the IPA and CamHelper. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/ipa/raspberrypi/controller/device_status.cpp | 20 ++++++++++++++++++++ src/ipa/raspberrypi/controller/device_status.h | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 src/ipa/raspberrypi/controller/device_status.cpp (limited to 'src/ipa/raspberrypi/controller') diff --git a/src/ipa/raspberrypi/controller/device_status.cpp b/src/ipa/raspberrypi/controller/device_status.cpp new file mode 100644 index 00000000..7b8218ca --- /dev/null +++ b/src/ipa/raspberrypi/controller/device_status.cpp @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2021, Raspberry Pi (Trading) Limited + * + * device_status.cpp - device (image sensor) status + */ +#include "device_status.h" + +using namespace libcamera; /* for the Duration operator<< overload */ + +std::ostream &operator<<(std::ostream &out, const DeviceStatus &d) +{ + out << "Exposure: " << d.shutter_speed + << " Gain: " << d.analogue_gain + << " Aperture: " << d.aperture + << " Lens: " << d.lens_position + << " Flash: " << d.flash_intensity; + + return out; +} diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h index 73df7ce2..ec4bbe73 100644 --- a/src/ipa/raspberrypi/controller/device_status.h +++ b/src/ipa/raspberrypi/controller/device_status.h @@ -6,6 +6,8 @@ */ #pragma once +#include + #include /* @@ -20,6 +22,8 @@ struct DeviceStatus { { } + friend std::ostream &operator<<(std::ostream &out, const DeviceStatus &d); + /* time shutter is open */ libcamera::utils::Duration shutter_speed; double analogue_gain; -- cgit v1.2.1