From b18e19bee517d70d36c00f5561a075d46b0c20bd Mon Sep 17 00:00:00 2001 From: masterm Date: Thu, 22 Feb 2007 23:37:00 +0000 Subject: +++ implemented command handler --- .../modules/interpreter/command_handler.c | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 source/Concept/Framework/modules/interpreter/command_handler.c (limited to 'source/Concept/Framework/modules/interpreter/command_handler.c') diff --git a/source/Concept/Framework/modules/interpreter/command_handler.c b/source/Concept/Framework/modules/interpreter/command_handler.c new file mode 100644 index 0000000..dcd97b2 --- /dev/null +++ b/source/Concept/Framework/modules/interpreter/command_handler.c @@ -0,0 +1,45 @@ +#include "command_handler.h" + +//----------------------------------------------------------------------------- +void Command_Handler::Update() +{ + Keyboard* ourKeyboard = parent->GetModule(IO_KEYBOARD_MAIN); + + uint8 curInput = ourKeyboard->GetInput(); + + + while(curInput != 0xEE && curInput != 0xFF) + { + if(curInput == 10) + { + ExecuteCommand(); + } + else if(curInput == 11) + { + if(this->currentCommandLength > 0) + { + this->currentCommandLength--; + this->buffer[currentCommandLength] = NULL; + } + } + else if(curInput >= 0 && curInput <= 9) + { + if(this->currentCommandLength < COMMAND_BUFFER_SIZE) + { + this->buffer[this->currentCommandLength] = '0' + curInput; + this->currentCommandLength++; + } + } + + curInput = ourKeyboard->GetInput(); + } +} + +//----------------------------------------------------------------------------- +void Command_Handler::ExecuteCommand() +{ + if(this->buffer[0] == '5') + { + this->displayDistanceSensors = true; + } +} -- cgit v1.2.3