summaryrefslogtreecommitdiffstats
path: root/control/zone.cpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-06-02 16:29:09 -0500
committerMatthew Barth <msbarth@us.ibm.com>2017-06-26 09:19:56 -0500
commit9e741ed099a77ed2638b852027e751b90f67450d (patch)
tree30045f61eb643611f58b7337ee96655751414327 /control/zone.cpp
parentcec5ab766709af9b713f94576b6f05bf63fc0718 (diff)
downloadphosphor-fan-presence-9e741ed099a77ed2638b852027e751b90f67450d.tar.gz
phosphor-fan-presence-9e741ed099a77ed2638b852027e751b90f67450d.zip
Properties stored of different types
Allow properties stored for processing events to be of types other than bool Change-Id: Ie1dde5aca562c9958bdff6fa3d1b19d3154b2c6d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/zone.cpp')
-rw-r--r--control/zone.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/control/zone.cpp b/control/zone.cpp
index 7a61c77..a57174d 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -51,16 +51,16 @@ Zone::Zone(Mode mode,
{
try
{
- bool value = false;
+ PropertyVariantType property;
getProperty(_bus,
entry.first,
std::get<intfPos>(entry.second),
std::get<propPos>(entry.second),
- value);
+ property);
setPropertyValue(entry.first.c_str(),
std::get<intfPos>(entry.second).c_str(),
std::get<propPos>(entry.second).c_str(),
- value);
+ property);
}
catch (const std::exception& e)
{
@@ -119,14 +119,12 @@ void Zone::setActiveAllow(const Group* group, bool isActiveAllow)
}
}
-template <typename T>
void Zone::getProperty(sdbusplus::bus::bus& bus,
const std::string& path,
const std::string& iface,
const std::string& prop,
- T& value)
+ PropertyVariantType& value)
{
- sdbusplus::message::variant<T> property;
auto serv = phosphor::fan::util::getService(path, iface, bus);
auto hostCall = bus.new_method_call(serv.c_str(),
path.c_str(),
@@ -140,8 +138,7 @@ void Zone::getProperty(sdbusplus::bus::bus& bus,
throw std::runtime_error(
"Error in host call response for retrieving property");
}
- hostResponseMsg.read(property);
- value = sdbusplus::message::variant_ns::get<T>(property);
+ hostResponseMsg.read(value);
}
void Zone::handleEvent(sdbusplus::message::message& msg,
OpenPOWER on IntegriCloud