Refine BridgeGpio object creation logic
This commit refines BridgeGpio object creation logic by using explicit
std::move to prevent object copy. Also, for cases of rescanning of
ADCSensors, it adjusts timing of destroying for the previous ADCSensor
to avoid double request of a gpio line.
Tested: adcsensor service was started without making a below error
even in case of a recreation sensors caused by rescanning:
Error requesting gpio: P3VBAT_BRIDGE_EN
terminate called after throwing an instance of 'std::system_error'
what(): error setting GPIO line values: Operation not permitted
Change-Id: I26ca059f8fe6eea2c60605f19ec49a3e365dc66f
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
diff --git a/include/ADCSensor.hpp b/include/ADCSensor.hpp
index e061138..331a229 100644
--- a/include/ADCSensor.hpp
+++ b/include/ADCSensor.hpp
@@ -55,7 +55,7 @@
std::vector<thresholds::Threshold>&& thresholds,
const double scaleFactor, PowerState readState,
const std::string& sensorConfiguration,
- std::optional<BridgeGpio> bridgeGpio);
+ std::optional<BridgeGpio>&& bridgeGpio);
~ADCSensor();
private: