summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2017-01-28 23:25:58 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-02-15 17:43:18 +0000
commit02ca0219c1e20f4f51eba068a9a9e272a60f7385 (patch)
tree57313325f396aa09099e6f3b3790b539782c0a61
parentcda036f7506dc58736c8854319c2e49fd9706677 (diff)
downloadphosphor-inventory-manager-02ca0219c1e20f4f51eba068a9a9e272a60f7385.tar.gz
phosphor-inventory-manager-02ca0219c1e20f4f51eba068a9a9e272a60f7385.zip
setProperty: Allow multiple objects
Allow multiple objects when using the setProperty action. Change-Id: Ie65b9abee6240d6a6541b9778d4bf776010f865d Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
-rw-r--r--actions.hpp13
-rw-r--r--example/events.d/match1.yaml3
-rwxr-xr-xpimgen.py5
3 files changed, 14 insertions, 7 deletions
diff --git a/actions.hpp b/actions.hpp
index 5b13a46..31932b2 100644
--- a/actions.hpp
+++ b/actions.hpp
@@ -64,7 +64,7 @@ inline auto createObjects(
* function that sets the property.
* @tparam V - The property value type.
*
- * @param[in] path - The DBus path on which the property should
+ * @param[in] paths - The DBus paths on which the property should
* be set.
* @param[in] iface - The DBus interface hosting the property.
* @param[in] member - Pointer to sdbusplus server binding member.
@@ -75,18 +75,21 @@ inline auto createObjects(
*/
template <typename T, typename U, typename V>
auto setProperty(
- const char* path, const char* iface,
+ std::vector<const char*>&& paths, const char* iface,
U&& member, V&& value)
{
// The manager is the only parameter passed to actions.
// Bind the path, interface, interface member function pointer,
// and value to a lambda. When it is called, forward the
// path, interface and value on to the manager member function.
- return [path, iface, member,
+ return [paths, iface, member,
value = std::forward<V>(value)](auto&, auto & m)
{
- m.template invokeMethod<T>(
- path, iface, member, value);
+ for (auto p : paths)
+ {
+ m.template invokeMethod<T>(
+ p, iface, member, value);
+ }
};
}
diff --git a/example/events.d/match1.yaml b/example/events.d/match1.yaml
index afc2974..7133271 100644
--- a/example/events.d/match1.yaml
+++ b/example/events.d/match1.yaml
@@ -25,7 +25,8 @@ events:
- name: setProperty
interface: xyz.openbmc_project.Example.Iface1
property: ExampleProperty1
- path: /changeme
+ paths:
+ - /changeme
value:
type: string
value: changed
diff --git a/pimgen.py b/pimgen.py
index 226c5d8..be66bb0 100755
--- a/pimgen.py
+++ b/pimgen.py
@@ -306,7 +306,10 @@ class SetProperty(Action):
member_type = cppTypeName(value['type'])
member_cast = '{0} ({1}::*)({0})'.format(member_type, t.qualified())
- args.append(TrivialArgument(value=kw.pop('path'), type='string'))
+ paths = [{'value': x, 'type': 'string'} for x in kw.pop('paths')]
+ args.append(InitializerList(
+ values=[TrivialArgument(**x) for x in paths]))
+
args.append(TrivialArgument(value=str(iface), type='string'))
args.append(TrivialArgument(
value=member, decorators=[Cast('static', member_cast)]))
OpenPOWER on IntegriCloud