clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: Ib7af6345a7b9e858700bd81645fe87d9d7e9d0fb
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/src/sensor.hpp b/src/sensor.hpp
index 7d22160..82798dc 100644
--- a/src/sensor.hpp
+++ b/src/sensor.hpp
@@ -267,8 +267,8 @@
sensorInterface->register_property("MinValue", minValue);
sensorInterface->register_property(
"Value", value, [this](const double& newValue, double& oldValue) {
- return setSensorValue(newValue, oldValue);
- });
+ return setSensorValue(newValue, oldValue);
+ });
fillMissingThresholds();
@@ -288,36 +288,36 @@
continue;
}
- std::string level = propertyLevel(threshold.level,
- threshold.direction);
- std::string alarm = propertyAlarm(threshold.level,
- threshold.direction);
+ std::string level =
+ propertyLevel(threshold.level, threshold.direction);
+ std::string alarm =
+ propertyAlarm(threshold.level, threshold.direction);
if ((level.empty()) || (alarm.empty()))
{
continue;
}
- size_t thresSize = label.empty() ? thresholds.size()
- : thresholdSize;
+ size_t thresSize =
+ label.empty() ? thresholds.size() : thresholdSize;
iface->register_property(
level, threshold.value,
[&, label, thresSize](const double& request, double& oldValue) {
- oldValue = request; // todo, just let the config do this?
- threshold.value = request;
- thresholds::persistThreshold(configurationPath, configInterface,
- threshold, dbusConnection,
- thresSize, label);
- // Invalidate previously remembered value,
- // so new thresholds will be checked during next update,
- // even if sensor reading remains unchanged.
- value = std::numeric_limits<double>::quiet_NaN();
+ oldValue = request; // todo, just let the config do this?
+ threshold.value = request;
+ thresholds::persistThreshold(
+ configurationPath, configInterface, threshold,
+ dbusConnection, thresSize, label);
+ // Invalidate previously remembered value,
+ // so new thresholds will be checked during next update,
+ // even if sensor reading remains unchanged.
+ value = std::numeric_limits<double>::quiet_NaN();
- // Although tempting, don't call checkThresholds() from here
- // directly. Let the regular sensor monitor call the same
- // using updateValue(), which can check conditions like
- // poweron, etc., before raising any event.
- return 1;
- });
+ // Although tempting, don't call checkThresholds() from here
+ // directly. Let the regular sensor monitor call the same
+ // using updateValue(), which can check conditions like
+ // poweron, etc., before raising any event.
+ return 1;
+ });
iface->register_property(alarm, false);
}
if (!sensorInterface->initialize())
@@ -359,17 +359,17 @@
availableInterfaceName);
availableInterface->register_property(
"Available", true, [this](const bool propIn, bool& old) {
- if (propIn == old)
- {
+ if (propIn == old)
+ {
+ return 1;
+ }
+ old = propIn;
+ if (!propIn)
+ {
+ updateValue(std::numeric_limits<double>::quiet_NaN());
+ }
return 1;
- }
- old = propIn;
- if (!propIn)
- {
- updateValue(std::numeric_limits<double>::quiet_NaN());
- }
- return 1;
- });
+ });
availableInterface->initialize();
}
if (!operationalInterface)