From 003c5c901e4ad18132b79c93e22ccaac7adb6db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Wed, 23 Aug 2023 15:39:57 +0200 Subject: [PATCH] add data in POST and process event --- XFTGenerator.py | 7 ++++--- templates/file.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/XFTGenerator.py b/XFTGenerator.py index 2e9ace2..ed17840 100644 --- a/XFTGenerator.py +++ b/XFTGenerator.py @@ -223,8 +223,8 @@ def main(): events_emits_def = [] emit_def = "" - emit_def += "void {filename}_emit{Event}({filename}* me, uint16_t t) {\n" - emit_def += " POST(me, &{filename}_processEvent, ev{fn}{event}, t, 0);\n" + emit_def += "void {filename}_emit{Event}({filename}* me, uint16_t t, int64_t data) {\n" + emit_def += " POST(me, &{filename}_processEvent, ev{fn}{event}, t, data);\n" emit_def += "}" emit_def = emit_def.replace("{filename}", fn_uc).replace("{fn}", variables["fn"]) @@ -241,8 +241,9 @@ def main(): emit_dec += " * Emit the {event} event\n" emit_dec += " * @param me the {filename} itself\n" emit_dec += " * @param t time to wait in ms before triggering event\n" + emit_dec += " * @param data data to put on the event for XF\n" emit_dec += " */\n" - emit_dec += "void {filename}_emit{Event}({filename}* me, uint16_t t);" + emit_dec += "void {filename}_emit{Event}({filename}* me, uint16_t t, int64_t data);" emit_dec = emit_dec.replace("{filename}", fn_uc) for event in events[1:]: diff --git a/templates/file.c b/templates/file.c index 08eceb8..785ef0d 100644 --- a/templates/file.c +++ b/templates/file.c @@ -22,6 +22,7 @@ bool ${filename}_processEvent(Event* ev) { ${filename}* me = (${filename}*)Event_getTarget(ev); ${filename}_STATES oldState = me->state; evIDT evid = Event_getId(ev); + uint64_t data = Event_getData(ev); switch (me->state) { // onState case ST${fn}_INIT: