initial commit
This commit is contained in:
55
templates/file.c
Normal file
55
templates/file.c
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
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);
|
||||
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}
|
||||
}
|
||||
|
||||
processed = true;
|
||||
}
|
||||
return processed;
|
||||
}
|
||||
|
||||
/************
|
||||
* EMITTERS *
|
||||
************/
|
||||
|
||||
${EVENTS_EMITS_DEF}
|
49
templates/file.h
Normal file
49
templates/file.h
Normal file
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @author ${author}
|
||||
* @version 1.0.0
|
||||
* @date ${date}
|
||||
* @file ${filename_lc}.h
|
||||
*/
|
||||
#ifndef ${filename}_H
|
||||
#define ${filename}_H
|
||||
|
||||
#include "../xf/xf.h"
|
||||
|
||||
typedef enum {
|
||||
${STATES_ENUM}
|
||||
} ${filename}_STATES;
|
||||
|
||||
typedef enum {
|
||||
${EVENTS_ENUM}
|
||||
} ${filename}_EVENTS;
|
||||
|
||||
typedef struct {
|
||||
${filename}_STATES state;
|
||||
} ${filename};
|
||||
|
||||
/**
|
||||
* Initialize the ${filename}
|
||||
* @param me the ${filename} itself
|
||||
*/
|
||||
void ${filename}_init(${filename}* me);
|
||||
|
||||
/**
|
||||
* Start the ${filename} state machine
|
||||
* @param me the ${filename} itself
|
||||
*/
|
||||
void ${filename}_startBehaviour(${filename}* me);
|
||||
|
||||
/**
|
||||
* Process the event
|
||||
* @param ev the event to process
|
||||
* @return true if the event is processed
|
||||
*/
|
||||
bool ${filename}_processEvent(Event* ev);
|
||||
|
||||
/************
|
||||
* EMITTERS *
|
||||
************/
|
||||
|
||||
${EVENTS_EMITS_DEC}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user