A library for talking to Multi-Tech's Cellular SocketModem Devices.

Dependents:   M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more

Revision:
36:bb6b293c7495
Parent:
34:60682c702c3f
Child:
40:14342c4de476
--- a/cellular/Cellular.h	Wed Dec 18 23:05:31 2013 +0000
+++ b/cellular/Cellular.h	Thu Dec 19 16:47:26 2013 +0000
@@ -21,44 +21,44 @@
 //const string RegistrationNames[] = {"NOT_REGISTERED", "REGISTERED", "SEARCHING", "DENIED", "UNKNOWN", "ROAMING"};
 
 
-/** This is a class for communicating with a Multi-Tech Systems SocketModem iCell. The 
+/** This is a class for communicating with a Multi-Tech Systems SocketModem iCell. The
 * SocketModem iCell is a family of carrier certified embedded cellular radio modules with
 * a common hardware footprint and AT command set for built in IP-stack functionality.
-* This class supports three main types of cellular radio interactions including: 
+* This class supports three main types of cellular radio interactions including:
 * configuration and status AT command processing, SMS processing, and TCP/UDP Socket
-* data connections. It should be noted that the radio can not process commands or 
+* data connections. It should be noted that the radio can not process commands or
 * SMS messages while having an open data connection at the same time. The concurrent
 * capability may be added in a future release. This class also inherits from IPStack
 * providing a common set of commands for communication devices that have an onboard
 * IP Stack. It is also integrated with the standard Mbed Sockets package and can therefore
 * be used seamlessly with clients and services built on top of this interface already within
 * the Mbed library.
-* 
+*
 * All of the following examples use the Pin Names for the Freedom KL46Z board coupled with
-* the SocketModem Shield Arduino compatible board. Please chage Pin Names accordingly to 
+* the SocketModem Shield Arduino compatible board. Please chage Pin Names accordingly to
 * match your hardware configuration. It also assumes the use of RTS/CTS hardware handshaking
 * using GPIOs. To disable this you will need to change settings on the radio module and
 * and use the MTSSerial class instead of MTSSerialFlowControl. The default baud rate for the
 * cellular radio is 115200 bps.
-* 
+*
 * The following set of example code demonstrates how to send and receive configuration and
 * status AT commands with the radio:
 * @code
 * #include "mbed.h"
 * #include "Cellular.h"
 * #include "MTSSerialFlowControl.h"
-* 
+*
 * main() {
 *   //Wait for radio to boot up
 *   wait(15);
-* 
+*
 *   //Setup serial interface to radio
 *   MTSSerialFlowControl* serial = new MTSSerialFlowControl(PTD3, PTD2, PTA12, PTC8);
 *   serial->baud(115200);
 *
 *   //Setup Cellular class
 *   Cellular* cellular = Cellular::getInstance(serial);
-*   
+*
 *   //Run status and configuration commands
 *   printf("Start Status and Configuration Example\n\r");
 *   printf("test: %s\n\r", CodeNames[cellular->test()]);
@@ -66,9 +66,9 @@
 *   printf("Signal Strength: %d\n\r", cellular->getSignalStrength());
 *   printf("Registration State: %s\n\r", RegistrationNames[cellular->getRegistration()]);
 *   printf("Send Basic Command (AT): %s\n\r", CodeNames[cellular->sendBasicCommand("AT", 1000)]);
-*   printf("Send Command (AT+CSQ): %s\n\r", sendCommand("AT+CSQ", 1000));  
-* 
-*   printf("End Program\n\r"); 
+*   printf("Send Command (AT+CSQ): %s\n\r", sendCommand("AT+CSQ", 1000));
+*
+*   printf("End Program\n\r");
 * }
 * @endcode
 *
@@ -83,37 +83,37 @@
 * #include "mbed.h"
 * #include "Cellular.h"
 * #include "MTSSerialFlowControl.h"
-* 
+*
 * main() {
 *   //Wait for radio to boot up
 *   wait(20);
-* 
+*
 *   //Setup serial interface to radio
 *   MTSSerialFlowControl* serial = new MTSSerialFlowControl(PTD3, PTD2, PTA12, PTC8);
 *   serial->baud(115200);
 *
 *   //Setup Cellular class
 *   Cellular* cellular = Cellular::getInstance(serial);
-*   
+*
 *   //Start Test
 *   printf("Start Network Connectivity Example\n\r");
 *   printf("test: %s\n\r", CodeNames[cellular->test()]);
 *   printf("Set APN: %s\n\r", CodeNames[cellular->setApn("wap.cingular")]) //Use APN from service provider!!!
-* 
+*
 *   //Setup a data connection
 *   printf("Attempting to Connect\n\r");
 *   while (cellular->connect()) {
 *       wait(1);
 *   }
 *   printf("Connected to Network!\n\r");
-* 
+*
 *   //Try pinging default server "8.8.8.8"
 *   printf("Ping Valid: %s\n\r", cellular->ping() ? "true" : "false");
-* 
+*
 *   printf("End Program\n\r");
 * }
 * @endcode
-* 
+*
 * The following set of example code demonstrates how to setup and use a TCP socket connection
 * using the native commands from this class:
 * @code
@@ -158,6 +158,7 @@
     static Cellular* getInstance();
     static Cellular* getInstance(MTSBufferedIO* io);
 
+    // Radio link related commands
     /** This method establishes a data connection on the cellular radio.
     * Note that before calling you must have an activated radio and if
     * using a SIM card set the APN using the setApn method. The APN can
@@ -178,8 +179,9 @@
     * @returns true if a data connection exists, otherwise false.
     */
     virtual bool isConnected();
-
-    // Used for TCPSocketConnection & UDPSocketConnection
+    
+    // TCP and UDP Socket related commands
+    // For behavior of the following methods refer to IPStack.h documentation
     virtual bool bind(unsigned int port);
     virtual bool open(const std::string& address, unsigned int port, Mode mode);
     virtual bool isOpen();
@@ -203,7 +205,7 @@
     //Cellular Radio Specific
     /** A method for sending a generic AT command to the radio. Note that you cannot
     * send commands and have a data connection at the same time.
-    * 
+    *
     * @param command the command to send to the radio without the escape character.
     * @param timeoutMillis the time in millis to wait for a response before returning.
     * @param esc escape character to add at the end of the command, defaults to
@@ -211,11 +213,11 @@
     * @returns all data received from the radio after the command as a string.
     */
     std::string sendCommand(std::string command, int timeoutMillis, ESC_CHAR esc = CR);
-    
-    /** A method for sending a basic AT command to the radio. A basic AT command is 
+
+    /** A method for sending a basic AT command to the radio. A basic AT command is
     * one that simply has a response of either OK or ERROR without any other information.
     * Note that you cannot send commands and have a data connection at the same time.
-    * 
+    *
     * @param command the command to send to the radio without the escape character.
     * @param timeoutMillis the time in millis to wait for a response before returning.
     * @param esc escape character to add at the end of the command, defaults to
@@ -240,7 +242,7 @@
     * @returns the standard AT Code enumeration.
     */
     Code echo(bool state);
-    
+
     /** A method for getting the signal strength of the radio. This method allows you to
     * get a value that maps to signal strength in dBm. Here 0-1 is Poor, 2-9 is Marginal,
     * 10-14 is Ok, 15-19 is Good, and 20+ is Excellent.  If you get a result of 99 the
@@ -249,7 +251,7 @@
     * @returns an integer representing the signal strength.
     */
     int getSignalStrength();
-    
+
     /** This method is used to get the phone number of the cellular radio if one exists.
     *
     * @returns the phone number as a string, otherwise "unknown" if it does not exist.
@@ -296,7 +298,7 @@
     * @returns the standard AT Code enumeration.
     */
     Code sendSMS(const std::string& phoneNumber, const std::string& message);
-    
+
     /** This method is used to send an SMS message. Note that you cannot send an
     * SMS message and have a data connection open at the same time.
     *
@@ -304,7 +306,7 @@
     * @returns the standard AT Code enumeration.
     */
     Code sendSMS(const Sms& sms);
-    
+
     /**
     *
     */