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:

/media/uploads/ashleymills/atcons.png

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":

/media/uploads/ashleymills/putty0.png

You need to set the keyboard to send Control-H for backspace, and use "Linux" function keys and keypad:

/media/uploads/ashleymills/putty1.png

Revision:
5:6841a01b3a69
Parent:
4:6971bded3ebd
Child:
6:93003e18889c
--- a/Console.cpp	Tue Sep 18 09:24:41 2012 +0000
+++ b/Console.cpp	Tue Sep 18 09:42:40 2012 +0000
@@ -7,7 +7,7 @@
     _terminal->printf("Console ready!\r\n");
     
     // set the buffer timeout
-    _bufferWaitTimeout = BUFFER_WAIT_TIMEOUT;
+    _bufferWaitTimeout_ms = BUFFER_WAIT_TIMEOUT_MS;
      
     // allocate space for current line
     _lineBuffer = (char*)malloc((_lineLength+1)*sizeof(char));
@@ -109,8 +109,9 @@
 // wait on the console for input, returns false on timeout
 // this is useful for processing escape chars
 bool Console::waitForInput() {
-    long timer = 0;
-    while(!_terminal->readable()&&timer++<_bufferWaitTimeout);
+    Timer timer;
+    timer.start();
+    while(!_terminal->readable()&&timer.read_ms()<_bufferWaitTimeout_ms);
     return _terminal->readable();
 }
 
@@ -131,7 +132,6 @@
 
 
 void Console::reprintBuffer() {
-    //printf("plp: %d, lB: %d\r\n",_prevLinePos,_lineLength);
     _terminal->putc('\r');
     for(int i=0; i<_lineLength; i++) {;
         _terminal->putc(' ');