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:
Wed Aug 15 12:09:49 2012 +0000
Revision:
1:719c0f047c34
Parent:
0:6c831cc49d22
Child:
2:8cc63f7a24cf
Interfaced with the ATCommandsInterface

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 0:6c831cc49d22 1 #include "ATConsole.h"
ashleymills 0:6c831cc49d22 2
ashleymills 1:719c0f047c34 3 ATConsole::ATConsole(Serial *terminal, int lineLength, int numLines, ATCommandsInterface* atInterface)
ashleymills 1:719c0f047c34 4 : Console(terminal,lineLength,numLines), _atInterface(atInterface) {
ashleymills 1:719c0f047c34 5 _atInterface->open();
ashleymills 0:6c831cc49d22 6 }
ashleymills 0:6c831cc49d22 7
ashleymills 0:6c831cc49d22 8 ATConsole::~ATConsole() {
ashleymills 0:6c831cc49d22 9
ashleymills 0:6c831cc49d22 10 }
ashleymills 0:6c831cc49d22 11
ashleymills 0:6c831cc49d22 12 void ATConsole::processCommand() {
ashleymills 0:6c831cc49d22 13 if((strncmp(_lineBuffer,"h",_lineLength)==0)||
ashleymills 0:6c831cc49d22 14 (strncmp(_lineBuffer,"help",_lineLength)==0)) {
ashleymills 1:719c0f047c34 15 _terminal->printf("Help.\r\n");
ashleymills 1:719c0f047c34 16 _terminal->printf(" \"connect\": Connect to 3G network.\r\n");
ashleymills 1:719c0f047c34 17 _terminal->printf(" \"disconnect\": Disconnect from 3G network.\r\n");
ashleymills 0:6c831cc49d22 18 return;
ashleymills 0:6c831cc49d22 19 }
ashleymills 1:719c0f047c34 20 _terminal->printf("\r\ncmd: \"%s\"\r\n",_lineBuffer);
ashleymills 1:719c0f047c34 21 _atInterface->execute(_lineBuffer, this, &_cmdResult, 1000);
ashleymills 1:719c0f047c34 22
ashleymills 0:6c831cc49d22 23 }
ashleymills 0:6c831cc49d22 24
ashleymills 0:6c831cc49d22 25 void ATConsole::update() {
ashleymills 0:6c831cc49d22 26 Console::update();
ashleymills 1:719c0f047c34 27 }
ashleymills 1:719c0f047c34 28
ashleymills 1:719c0f047c34 29 int ATConsole::onNewATResponseLine(ATCommandsInterface* pInst, const char* line) {
ashleymills 1:719c0f047c34 30 _terminal->printf("response: %s\r\n",line);
ashleymills 1:719c0f047c34 31 return OK;
ashleymills 1:719c0f047c34 32 }
ashleymills 1:719c0f047c34 33
ashleymills 1:719c0f047c34 34 int ATConsole::onNewEntryPrompt(ATCommandsInterface* pInst) {
ashleymills 1:719c0f047c34 35 return OK;
ashleymills 0:6c831cc49d22 36 }