Add object info tuple
The object path, bus connection, and sdbusplus interfaces are
almost always needed together so use a tuple for passing these
around.
Change-Id: I784edae95f03d306633ccf94209faa381b91a596
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index dfda21f..df85f26 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -117,14 +117,15 @@
int val = 0;
read_sysfs(sysfsPath, val);
- Object o;
std::string objectPath{_root};
-
objectPath.append("/");
objectPath.append(i.first.first);
objectPath.append("/");
objectPath.append(label);
+ ObjectInfo info(&_bus, std::move(objectPath), Object());
+ auto& o = std::get<Object>(info);
+
auto iface = std::make_shared<ValueObject>(_bus, objectPath.c_str());
iface->value(val);
@@ -146,7 +147,7 @@
auto value = std::make_tuple(
std::move(i.second),
std::move(label),
- std::move(o));
+ std::move(info));
state[std::move(i.first)] = std::move(value);
}
@@ -177,7 +178,8 @@
hwmon::entry::input),
value);
- auto& obj = std::get<Object>(i.second);
+ auto& objInfo = std::get<ObjectInfo>(i.second);
+ auto& obj = std::get<Object>(objInfo);
auto iface = obj.find(InterfaceType::VALUE);
if (iface != obj.end())