This is a console for interacting with Vodafone dongles.
Dependencies: mbed-rtos VodafoneUSBModem mbed
This is a bridge between a serial driven console and a serial driven cellular modem or modem interface. This was written to complement our collaboration with mbed: See https://mbed.org/users/mbed_official/code/VodafoneUSBModem/ for further information.
For example, one can use GNU screen or PuTTY (two popular consoles) to interact with a Vodafone K3770 USB dongle. In the image below I used the UNIX version of PuTTY:
Support is provided for line-based consoles, which send one line at a time, and for character based consoles.
For character based consoles, the following line-editing features are provided:
- In-line editing (deletion, left/right arrow keys, insertion)
- Command history (via up/down arrow keys)
Line buffer length, and command history depth, are compile-time options.
--
How to use:
Compile and save to mbed.
Connect PuTTY or GNU screen to serial port.
If you use GNU screen you probably already know what you are doing.
If you use PuTTY, you need to set the options to specify the serial device and, set the baud rate, and set the "Connection Type" to "Serial":
You need to set the keyboard to send Control-H for backspace, and use "Linux" function keys and keypad:
Console.h@2:8cc63f7a24cf, 2012-08-24 (annotated)
- Committer:
- ashleymills
- Date:
- Fri Aug 24 15:45:35 2012 +0000
- Revision:
- 2:8cc63f7a24cf
- Parent:
- 1:719c0f047c34
- Child:
- 4:6971bded3ebd
Added eventlistener capability
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ashleymills | 0:6c831cc49d22 | 1 | #pragma once |
ashleymills | 0:6c831cc49d22 | 2 | #include "mbed.h" |
ashleymills | 0:6c831cc49d22 | 3 | |
ashleymills | 0:6c831cc49d22 | 4 | #define BUFFER_WAIT_TIMEOUT 1000000 |
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 | 0:6c831cc49d22 | 11 | int _bufferWaitTimeout; |
ashleymills | 0:6c831cc49d22 | 12 | char **_lines; |
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 | 2:8cc63f7a24cf | 20 | virtual void processCommand(); |
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 | 2:8cc63f7a24cf | 25 | void storeBuffer(); |
ashleymills | 0:6c831cc49d22 | 26 | |
ashleymills | 0:6c831cc49d22 | 27 | protected: |
ashleymills | 0:6c831cc49d22 | 28 | char *_lineBuffer; |
ashleymills | 0:6c831cc49d22 | 29 | int _lineLength; |
ashleymills | 0:6c831cc49d22 | 30 | int _numLines; |
ashleymills | 1:719c0f047c34 | 31 | Serial *_terminal; |
ashleymills | 2:8cc63f7a24cf | 32 | void clearBuffer(); |
ashleymills | 0:6c831cc49d22 | 33 | |
ashleymills | 0:6c831cc49d22 | 34 | public: |
ashleymills | 0:6c831cc49d22 | 35 | Console(Serial *terminal, int lineLength, int numLines); |
ashleymills | 0:6c831cc49d22 | 36 | ~Console(); |
ashleymills | 2:8cc63f7a24cf | 37 | virtual void update(); |
ashleymills | 0:6c831cc49d22 | 38 | |
ashleymills | 0:6c831cc49d22 | 39 | }; |