diff options
Diffstat (limited to 'source/Concept/Framework/modules/interpreter/command_handler.c')
-rw-r--r-- | source/Concept/Framework/modules/interpreter/command_handler.c | 45 |
1 files changed, 45 insertions, 0 deletions
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<Keyboard>(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;
+ }
+}
|