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

Committer:
ashleymills
Date:
Tue Sep 18 09:24:41 2012 +0000
Revision:
4:6971bded3ebd
Parent:
2:8cc63f7a24cf
Child:
9:578003606ccc
Added support for line-based consoles.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 0:6c831cc49d22 1 #include "mbed.h"
ashleymills 0:6c831cc49d22 2 #include "rtos.h"
ashleymills 0:6c831cc49d22 3 #include "ATConsole.h"
ashleymills 2:8cc63f7a24cf 4 #include "VodafoneUSBModem.h"
ashleymills 0:6c831cc49d22 5
ashleymills 0:6c831cc49d22 6 DigitalOut myled(LED1);
ashleymills 0:6c831cc49d22 7
ashleymills 0:6c831cc49d22 8 void atConsoleWork(void const*) {
ashleymills 0:6c831cc49d22 9 // create serial
ashleymills 0:6c831cc49d22 10 Serial term(USBTX, USBRX);
ashleymills 0:6c831cc49d22 11 term.baud(115200);
ashleymills 0:6c831cc49d22 12
ashleymills 0:6c831cc49d22 13 // create vodafone dongle interface
ashleymills 2:8cc63f7a24cf 14 VodafoneUSBModem modem;
ashleymills 1:719c0f047c34 15 // force init
ashleymills 1:719c0f047c34 16 size_t smCount;
ashleymills 1:719c0f047c34 17 modem.getSMCount(&smCount);
ashleymills 0:6c831cc49d22 18
ashleymills 0:6c831cc49d22 19 // create AT console
ashleymills 4:6971bded3ebd 20 int lineLength = 79;
ashleymills 4:6971bded3ebd 21 int numLines = 5;
ashleymills 4:6971bded3ebd 22 bool characterBased = true;
ashleymills 4:6971bded3ebd 23 ATConsole atCons(&term,lineLength,numLines,characterBased,modem.getATCommandsInterface());
ashleymills 0:6c831cc49d22 24 while(1) {
ashleymills 0:6c831cc49d22 25 atCons.update();
ashleymills 0:6c831cc49d22 26 Thread::wait(1);
ashleymills 0:6c831cc49d22 27 }
ashleymills 0:6c831cc49d22 28 }
ashleymills 0:6c831cc49d22 29
ashleymills 0:6c831cc49d22 30 int main() {
ashleymills 0:6c831cc49d22 31 DBG_INIT();
ashleymills 0:6c831cc49d22 32 DBG_SET_NEWLINE("\r\n");
ashleymills 0:6c831cc49d22 33
ashleymills 0:6c831cc49d22 34 Thread atConsoleTask(atConsoleWork, NULL, osPriorityNormal, 1024*6);
ashleymills 0:6c831cc49d22 35 while(1) { Thread::wait(10000); }
ashleymills 0:6c831cc49d22 36 }