Ashley Mills / ATConsole

Dependencies:   mbed-rtos VodafoneUSBModem mbed

Committer:
ashleymills
Date:
Tue Sep 18 09:42:40 2012 +0000
Revision:
5:6841a01b3a69
Parent:
4:6971bded3ebd
Child:
6:93003e18889c
Added proper ms based timeout.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 0:6c831cc49d22 1 #pragma once
ashleymills 0:6c831cc49d22 2 #include "mbed.h"
ashleymills 0:6c831cc49d22 3
ashleymills 5:6841a01b3a69 4 #define BUFFER_WAIT_TIMEOUT_MS 2000
ashleymills 0:6c831cc49d22 5
ashleymills 0:6c831cc49d22 6 class Console {
ashleymills 0:6c831cc49d22 7 private:
ashleymills 0:6c831cc49d22 8 int _currentLine;
ashleymills 0:6c831cc49d22 9 int _usedLines;
ashleymills 0:6c831cc49d22 10
ashleymills 5:6841a01b3a69 11 long _bufferWaitTimeout_ms;
ashleymills 5:6841a01b3a69 12 char **_lines; //< Command history
ashleymills 0:6c831cc49d22 13
ashleymills 0:6c831cc49d22 14 int _linePos;
ashleymills 0:6c831cc49d22 15 int _prevLinePos;
ashleymills 1:719c0f047c34 16
ashleymills 0:6c831cc49d22 17 bool waitForInput();
ashleymills 0:6c831cc49d22 18 void loadPreviousBuffer();
ashleymills 0:6c831cc49d22 19 void loadNextBuffer();
ashleymills 4:6971bded3ebd 20
ashleymills 0:6c831cc49d22 21 void printLineBuffer();
ashleymills 0:6c831cc49d22 22 void printHistory();
ashleymills 0:6c831cc49d22 23 void printBuffer(int index);
ashleymills 0:6c831cc49d22 24 void reprintBuffer();
ashleymills 4:6971bded3ebd 25 void storeBuffer();
ashleymills 4:6971bded3ebd 26 void updateCharacterBased();
ashleymills 4:6971bded3ebd 27 void updateLineBased();
ashleymills 4:6971bded3ebd 28
ashleymills 4:6971bded3ebd 29 virtual void processCommand();
ashleymills 4:6971bded3ebd 30
ashleymills 4:6971bded3ebd 31
ashleymills 0:6c831cc49d22 32
ashleymills 0:6c831cc49d22 33 protected:
ashleymills 0:6c831cc49d22 34 char *_lineBuffer;
ashleymills 0:6c831cc49d22 35 int _lineLength;
ashleymills 0:6c831cc49d22 36 int _numLines;
ashleymills 1:719c0f047c34 37 Serial *_terminal;
ashleymills 2:8cc63f7a24cf 38 void clearBuffer();
ashleymills 4:6971bded3ebd 39 bool _characterBased;
ashleymills 0:6c831cc49d22 40
ashleymills 0:6c831cc49d22 41 public:
ashleymills 4:6971bded3ebd 42 Console(Serial *terminal, int lineLength, int numLines, bool characterBased);
ashleymills 0:6c831cc49d22 43 ~Console();
ashleymills 2:8cc63f7a24cf 44 virtual void update();
ashleymills 0:6c831cc49d22 45
ashleymills 0:6c831cc49d22 46 };