Generate functor to read a property
Given the dbus member class for an interface and property hosted by
inventory manager, generate the getProperty functor for retrieving that
property from inventory. This ability is only supported when using the
`PropertyIs` functor to compare a property within inventory to a given
value before triggering an action.
Example yaml:
filters:
- name: propertyIs
service: xyz.openbmc_project.Inventory.Manager
path: /system/chassis
interface: xyz.openbmc_project.Inventory.Decorator.CoolingType
property: WaterCooled
value:
value: true
type: boolean
dbusMember: "sdbusplus::xyz::openbmc_project::Inventory::\
Decorator::server::CoolingType"
Generates:
make_filter(functor::propertyIs(
"/system/chassis",
"xyz.openbmc_project.Inventory.Decorator.CoolingType",
"WaterCooled",
true,
"xyz.openbmc_project.Inventory.Manager",
make_get_property<>
(
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:
Code generated as expected with service name given
Code generated as expected without service name given
Resolves: openbmc/phosphor-inventory-manager#1
Change-Id: I5600854a1b0b9ce3e1511d3bcd9a452d6b1107ba
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/Makefile.am b/Makefile.am
index 94600cc..27885d3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,11 +43,12 @@
generated.cpp:
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/pimgen.py $(PIMGEN_ARGS) -d \
- $(base_yamldir) -o $(builddir) generate-cpp
+ $(base_yamldir) -o $(builddir) -b $(BUSNAME) generate-cpp
gen_serialization.hpp:
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/pimgen.py $(PIMGEN_ARGS) -d \
- $(base_yamldir) -o $(builddir) generate-serialization
+ $(base_yamldir) -o $(builddir) -b $(BUSNAME) \
+ generate-serialization
SUBDIRS = . test