Separate handlers for signals and method calls
Signals and method calls have different parameter structures. When the
associated event trigger is chosen, what's generated to retrieve the
dbus data is specific to that trigger event. For signals, the data is
read from the given signal message. A method call is method specific and
is called to be done against all of the members within the event group.
Change-Id: I92cbdbf05852fbaa7f1b56ed518e30278cdf840b
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 23c37b9..30acf47 100755
--- a/control/gen-fan-zone-defs.py
+++ b/control/gen-fan-zone-defs.py
@@ -175,13 +175,13 @@
for s in event['triggers']['signals']:
e += "\tmake_trigger(trigger::signal(\n"
e += "match::" + s['match'] + "(\n"
- for i, mp in enumerate(s['mparams']):
- if (i+1) != len(s['mparams']):
- e += "\"" + mp + "\",\n"
+ for i, mp in enumerate(s['mparams']['params']):
+ if (i+1) != len(s['mparams']['params']):
+ e += "\t\t\t" + s['mparams'][mp] + ",\n"
else:
- e += "\"" + mp + "\"\n"
- e += "),\n"
- e += "make_handler(\n"
+ e += "\t\t\t" + s['mparams'][mp] + "\n"
+ e += "\t\t),\n"
+ e += "\t\tmake_handler<SignalHandler>(\n"
if ('type' in s['sparams']) and (s['sparams']['type'] is not None):
e += s['signal'] + "<" + s['sparams']['type'] + ">(\n"
else:
@@ -199,14 +199,21 @@
else:
e += s['hparams'][hp] + "\n"
e += "))\n"
- e += ")\n"
+ e += "\t\t)\n"
e += "\t)),\n"
if ('init' in event['triggers']):
for i in event['triggers']['init']:
e += "\tmake_trigger(trigger::init(\n"
- if ('handler' in i):
- e += "\t\tmake_handler(\n"
+ if ('method' in i):
+ e += "\t\tmake_handler<MethodHandler>(\n"
+ if ('type' in i['mparams']) and \
+ (i['mparams']['type'] is not None):
+ e += i['method'] + "<" + i['mparams']['type'] + ">(\n"
+ else:
+ e += i['method'] + "(\n"
+ for ip in i['mparams']['params']:
+ e += i['mparams'][ip] + ",\n"
if ('type' in i['hparams']) and \
(i['hparams']['type'] is not None):
e += ("handler::" + i['handler'] +
@@ -218,7 +225,7 @@
e += i['hparams'][hp] + ",\n"
else:
e += i['hparams'][hp] + "\n"
- e += ")\n"
+ e += "))\n"
e += "\t\t)\n"
e += "\t)),\n"