XFTGenerator/templates/file.c

74 lines
1.3 KiB
C

/**
* @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;
${VARS_INIT}
${STATES_CBS_INIT}
}
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);
${filename}_STATES oldState = me->state;
evIDT evid = Event_getId(ev);
uint64_t data = Event_getData(ev);
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;
${STATES_CASES_ENTRY}
}
processed = true;
}
return processed;
}
/*************
* Callbacks *
*************/
${CALLBACKS_DEF}
/************
* EMITTERS *
************/
${EVENTS_EMITS_DEF}
/***********
* SETTERS *
***********/
${VARS_SETTERS_DEF}