XFTGenerator/templates/file.c

74 lines
1.3 KiB
C
Raw Permalink Normal View History

2023-07-11 13:10:15 +00:00
/**
* @author ${author}
* @version 1.0.0
* @date ${date}
* @file ${filename_lc}.c
*/
#include "${filename_lc}.h"
void ${filename}_init(${filename}* me){
me->state = ST${fn}_INIT;
2023-07-11 13:47:07 +00:00
${VARS_INIT}
2023-07-11 21:40:12 +00:00
${STATES_CBS_INIT}
2023-07-11 13:10:15 +00:00
}
void ${filename}_startBehaviour(${filename}* me){
POST(me, &${filename}_processEvent, ev${fn}init, 0, 0);
}
bool ${filename}_processEvent(Event* ev) {
bool processed = false;
${filename}* me = (${filename}*)Event_getTarget(ev);
2023-07-11 17:00:15 +00:00
${filename}_STATES oldState = me->state;
evIDT evid = Event_getId(ev);
2023-08-23 13:39:57 +00:00
uint64_t data = Event_getData(ev);
2023-07-11 17:00:15 +00:00
2023-07-11 13:10:15 +00:00
switch (me->state) { // onState
case ST${fn}_INIT:
if (ev->id == ev${fn}init) {
}
break;
${STATES_CASES}
}
if(oldState != me->state){
switch (oldState) { // onExit
case ST${fn}_INIT:
break;
${STATES_CASES}
}
switch (me->state) { // onEntry
case ST${fn}_INIT:
break;
2023-07-11 21:40:12 +00:00
${STATES_CASES_ENTRY}
2023-07-11 13:10:15 +00:00
}
processed = true;
}
return processed;
}
2023-07-11 21:40:12 +00:00
/*************
* Callbacks *
*************/
${CALLBACKS_DEF}
2023-07-11 13:10:15 +00:00
/************
* EMITTERS *
************/
2023-07-11 13:47:07 +00:00
${EVENTS_EMITS_DEF}
/***********
* SETTERS *
***********/
2023-07-11 17:00:15 +00:00
${VARS_SETTERS_DEF}