| 1 |
mocchiut |
1.1 |
//where I am |
| 2 |
|
|
#include "R1_FA_State.h" |
| 3 |
|
|
//manager |
| 4 |
|
|
#include "StateManager.h" |
| 5 |
|
|
//home |
| 6 |
|
|
#include "R0_Init_State.h" |
| 7 |
|
|
//a step after |
| 8 |
|
|
#include "R2_FAFE_State.h" |
| 9 |
|
|
|
| 10 |
|
|
|
| 11 |
|
|
|
| 12 |
|
|
namespace PamOffLineSW |
| 13 |
|
|
{ |
| 14 |
|
|
R1_FA_State R1_FA_State::instance; |
| 15 |
|
|
|
| 16 |
|
|
R1_FA_State::R1_FA_State() |
| 17 |
|
|
{ |
| 18 |
|
|
} |
| 19 |
|
|
|
| 20 |
|
|
R1_FA_State::~R1_FA_State() |
| 21 |
|
|
{ |
| 22 |
|
|
} |
| 23 |
|
|
|
| 24 |
|
|
void R1_FA_State::readInput(char inputbyte) |
| 25 |
|
|
{ |
| 26 |
|
|
//the byte before this one is 0xFA, searching byte 0xFE |
| 27 |
|
|
if((unsigned char)inputbyte==CODE_FE) |
| 28 |
|
|
{ |
| 29 |
|
|
|
| 30 |
|
|
//changing state to R2 |
| 31 |
|
|
StateManager::getInstance().changeState(&R2_FAFE_State::getInstance()); |
| 32 |
|
|
} |
| 33 |
|
|
else if((unsigned char)inputbyte==CODE_FA) |
| 34 |
|
|
{ |
| 35 |
|
|
//do nothing remain in the current state |
| 36 |
|
|
} |
| 37 |
|
|
else |
| 38 |
|
|
{ |
| 39 |
|
|
//Return to state R0, restart search |
| 40 |
|
|
StateManager::getInstance().changeState(&R0_Init_State::getInstance()); |
| 41 |
|
|
|
| 42 |
|
|
} |
| 43 |
|
|
} |
| 44 |
|
|
|
| 45 |
|
|
} |