summaryrefslogtreecommitdiffstats
path: root/types.hpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2018-09-26 15:06:15 -0500
committerMatthew Barth <msbarth@us.ibm.com>2018-10-23 09:22:59 -0500
commitf094d4428ecad7c2c349287fb811e5d6568644a9 (patch)
tree5e24de8f54aa36d935b354a599551548b6239e20 /types.hpp
parent3bb98f2901d4c5c473755a4cf1d211662bf707a0 (diff)
downloadphosphor-inventory-manager-f094d4428ecad7c2c349287fb811e5d6568644a9.tar.gz
phosphor-inventory-manager-f094d4428ecad7c2c349287fb811e5d6568644a9.zip
Get an inventory property's value
Adds support for inventory manager to retrieve a property's value that it hosts as input to condition tests. Utilizing a provided sdbusplus server binding member function to get a property from the inventory hosted interface, a property can be read from that interface within inventory manager. After the property is read, the condition test is performed and the resulting action(s) occur. The only currently supported condition test for using a property from within inventory manager is the `propertyIs` condition. This is an example of the expected generated source to get a property from within inventory manager: make_filter(functor::propertyIs( "/system/chassis", "xyz.openbmc_project.Inventory.Decorator.CoolingType", "WaterCooled", true, "xyz.openbmc_project.Inventory.Manager", make_get_property<sdbusplus::xyz::openbmc_project::Inventory:: Decorator::server::CoolingType::PropertiesVariant> ( functor::getProperty<sdbusplus::xyz::openbmc_project:: Inventory::Decorator::server::CoolingType> ( "/system/chassis", "xyz.openbmc_project.Inventory.Decorator.CoolingType", &sdbusplus::xyz::openbmc_project::Inventory:: Decorator::server::CoolingType::getPropertyByName, "WaterCooled" ) ) )) Tested: Manually edited generated code to use property within inventory and actions occurred when condition passed Manually edited generated code to use property within inventory and actions did not run when condition failed Actions not run when get property function omitted Change-Id: I094bbacbcdeb239d33cac343b2daeb5f86e0a58a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'types.hpp')
-rw-r--r--types.hpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/types.hpp b/types.hpp
index 503847a..759ad6c 100644
--- a/types.hpp
+++ b/types.hpp
@@ -34,6 +34,8 @@ using Filter = std::function<bool(sdbusplus::bus::bus&,
sdbusplus::message::message&, Manager&)>;
using PathCondition =
std::function<bool(const std::string&, sdbusplus::bus::bus&, Manager&)>;
+template <typename T>
+using GetProperty = std::function<T(Manager&)>;
} // namespace manager
} // namespace inventory
} // namespace phosphor
OpenPOWER on IntegriCloud