Add interfacesAdded subscriptions to groups
For each group in an event, subscribe to the interfacesAdded signals in
the case where the member(s) of a group may or may not exist when
initialized.
Additionally, updated to use the propertiesChanged function to remove
repetitive property change subscription lines generated.
Change-Id: I52b0cd839383ebb90e93a81b5bac02ee7c4f44b2
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py
index ea05a0f..45ca774 100755
--- a/control/gen-fan-zone-defs.py
+++ b/control/gen-fan-zone-defs.py
@@ -115,16 +115,27 @@
std::vector<PropertyChange>{
%for s in event['signal']:
PropertyChange{
- interface("org.freedesktop.DBus.Properties") +
- member("PropertiesChanged") +
- type::signal() +
- path("${s['path']}") +
- arg0namespace("${s['interface']}"),
+ interfacesAdded("${s['obj_path']}"),
+ make_handler(objectSignal<${s['type']}>(
+ "${s['path']}",
+ "${s['interface']}",
+ "${s['property']}",
+ handler::setProperty<${s['type']}>(
+ "${s['path']}",
+ "${s['interface']}",
+ "${s['property']}"
+ )
+ ))
+ },
+ PropertyChange{
+ propertiesChanged(
+ "${s['path']}",
+ "${s['interface']}"),
make_handler(propertySignal<${s['type']}>(
"${s['interface']}",
"${s['property']}",
handler::setProperty<${s['type']}>(
- "${s['member']}",
+ "${s['path']}",
"${s['interface']}",
"${s['property']}"
)
@@ -151,11 +162,9 @@
))
},
PropertyChange{
- interface("org.freedesktop.DBus.Properties") +
- member("PropertiesChanged") +
- type::signal() +
- path("${s['path']}") +
- arg0namespace("${s['interface']}"),
+ propertiesChanged(
+ "${s['path']}",
+ "${s['interface']}"),
make_handler(propertySignal<${s['type']}>(
"${s['interface']}",
"${s['property']}",
@@ -293,7 +302,7 @@
if g['name'] == e['group'])
for member in groups['members']:
members = {}
- members['type'] = groups['type']
+ members['obj_path'] = groups['type']
members['name'] = (groups['type'] +
member)
members['interface'] = e['interface']
@@ -333,11 +342,11 @@
signal = []
for path in group:
signals = {}
+ signals['obj_path'] = path['obj_path']
signals['path'] = path['name']
signals['interface'] = e['interface']
signals['property'] = e['property']['name']
signals['type'] = e['property']['type']
- signals['member'] = path['name']
signal.append(signals)
event['signal'] = signal