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 Sep 25 08:43:19 2013 +0000
Revision:
14:3f5fd1d95f5f
Parent:
11:76ecb8799b0d
Updated dependencies.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 10:b2c5a4b21bd8 1 /* ATConsole.h */
ashleymills 10:b2c5a4b21bd8 2 /* Copyright (C) 2012 Ashley Mills, MIT License
ashleymills 10:b2c5a4b21bd8 3 *
ashleymills 10:b2c5a4b21bd8 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
ashleymills 10:b2c5a4b21bd8 5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
ashleymills 10:b2c5a4b21bd8 6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
ashleymills 10:b2c5a4b21bd8 7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
ashleymills 10:b2c5a4b21bd8 8 * furnished to do so, subject to the following conditions:
ashleymills 10:b2c5a4b21bd8 9 *
ashleymills 10:b2c5a4b21bd8 10 * The above copyright notice and this permission notice shall be included in all copies or
ashleymills 10:b2c5a4b21bd8 11 * substantial portions of the Software.
ashleymills 10:b2c5a4b21bd8 12 *
ashleymills 10:b2c5a4b21bd8 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
ashleymills 10:b2c5a4b21bd8 14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
ashleymills 10:b2c5a4b21bd8 15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
ashleymills 10:b2c5a4b21bd8 16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
ashleymills 10:b2c5a4b21bd8 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ashleymills 10:b2c5a4b21bd8 18 */
ashleymills 10:b2c5a4b21bd8 19
ashleymills 1:719c0f047c34 20 #pragma once
ashleymills 1:719c0f047c34 21 #include "Console.h"
ashleymills 2:8cc63f7a24cf 22 #include "VodafoneUSBModem.h"
ashleymills 10:b2c5a4b21bd8 23 /** Console for interacting with Vodafone USB (K3770/K3772-Z) dongles.
ashleymills 10:b2c5a4b21bd8 24 */
ashleymills 4:6971bded3ebd 25 class ATConsole : public Console, public IATCommandsProcessor, protected IATEventsHandler {
ashleymills 1:719c0f047c34 26 public:
ashleymills 4:6971bded3ebd 27
ashleymills 4:6971bded3ebd 28 /** Constructor
ashleymills 10:b2c5a4b21bd8 29 * @param terminal Console interface to the driving computer.
ashleymills 10:b2c5a4b21bd8 30 * @param lineLength The maximum length of line supported (character console only).
ashleymills 10:b2c5a4b21bd8 31 * @param numLines Number of lines of history to keep (character console only).
ashleymills 10:b2c5a4b21bd8 32 * @param characterBased true if the driving console is character based, false if line based.
ashleymills 10:b2c5a4b21bd8 33 * @param atInterface A Pointer to the ATInterface of the modem.
ashleymills 10:b2c5a4b21bd8 34 * @return An ATConsole
ashleymills 4:6971bded3ebd 35 */
ashleymills 4:6971bded3ebd 36 ATConsole(
ashleymills 4:6971bded3ebd 37 Serial *terminal,
ashleymills 4:6971bded3ebd 38 int lineLength,
ashleymills 4:6971bded3ebd 39 int numLines,
ashleymills 4:6971bded3ebd 40 bool characterBased,
ashleymills 4:6971bded3ebd 41 ATCommandsInterface* atInterface
ashleymills 4:6971bded3ebd 42 );
ashleymills 1:719c0f047c34 43 ~ATConsole();
ashleymills 2:8cc63f7a24cf 44 virtual void update();
ashleymills 1:719c0f047c34 45
ashleymills 2:8cc63f7a24cf 46 private:
ashleymills 1:719c0f047c34 47 ATCommandsInterface *_atInterface;
ashleymills 1:719c0f047c34 48 ATCommandsInterface::ATResult _cmdResult;
ashleymills 2:8cc63f7a24cf 49 virtual void processCommand();
ashleymills 1:719c0f047c34 50 virtual int onNewATResponseLine(ATCommandsInterface* pInst, const char* line);
ashleymills 1:719c0f047c34 51 virtual int onNewEntryPrompt(ATCommandsInterface* pInst);
ashleymills 4:6971bded3ebd 52 bool _gettingSMSData;
ashleymills 4:6971bded3ebd 53 char _smsMessage[256];
ashleymills 4:6971bded3ebd 54
ashleymills 4:6971bded3ebd 55 protected:
ashleymills 2:8cc63f7a24cf 56 virtual void onEvent(const char* atCode, const char* evt);
ashleymills 2:8cc63f7a24cf 57 virtual void onDispatchStart();
ashleymills 2:8cc63f7a24cf 58 virtual void onDispatchStop();
ashleymills 2:8cc63f7a24cf 59 virtual bool isATCodeHandled(const char* atCode);
ashleymills 11:76ecb8799b0d 60 virtual char* getEventsEnableCommand();
ashleymills 11:76ecb8799b0d 61 virtual char* getEventsDisableCommand();
ashleymills 4:6971bded3ebd 62
ashleymills 0:6c831cc49d22 63 };