Cellular library for MTS Socket Modem Arduino Shield devices from Multi-Tech Systems

Dependents:   mtsas mtsas mtsas mtsas

Revision:
3:04046eebaef5
Parent:
2:10e72dce251d
Child:
7:0ee8e69a3e9c
--- a/Cellular/Cellular.h	Mon May 19 14:40:54 2014 -0500
+++ b/Cellular/Cellular.h	Tue May 20 15:21:06 2014 -0500
@@ -4,7 +4,6 @@
 #include <string>
 #include <vector>
 
-#include "mbed.h"
 #include "IPStack.h"
 #include "MTSBufferedIO.h"
 #include "CellUtils.h"
@@ -160,7 +159,7 @@
 
     /// Enumeration for different cellular radio types.
     enum Radio {
-        NA, E1, G2, EV2, H4, EV3, H5
+        NA, H5, EV3, G3, C2, H5_IP, EV3_IP, C2_IP
     };
 
     /// An enumeration of radio registration states with a cell tower.
@@ -183,10 +182,11 @@
     * interface to use. Note that this function MUST be called before
     * any other calls will function correctly on a Cellular object. Also
     * note that MTSBufferedIO is abstract, so you must use one of
-    * its inherited classes like MTSSerial or MTSSerialFlowControl.
+    * its inherited classes like MTSSerial, MTSSerialFlowControl or write a class
+    * similar to MTSSerialFlowControl which maps the MTSBufferedIO API
+    * to your favorite serial library.
     *
-    * @param io the buffered io interface that is attached to the cellular
-    * radio.
+    * @param io the io interface that is attached to the cellular radio.
     * @param DCD this is the dcd signal from the radio. If attached the
     * the pin must be passed in here for this class to operate correctly.
     * The default is not connected.
@@ -246,7 +246,7 @@
     * @param message the text message to be sent.
     * @returns the standard AT Code enumeration.
     */
-    virtual Code sendSMS(const std::string& phoneNumber, const std::string& message);
+    virtual Code sendSMS(const std::string& phoneNumber, const std::string& message) = 0;
 
     /** 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.
@@ -254,21 +254,21 @@
     * @param sms an Sms struct that contains all SMS transaction information.
     * @returns the standard AT Code enumeration.
     */
-    virtual Code sendSMS(const Sms& sms);
+    virtual Code sendSMS(const Sms& sms) = 0;
 
     /** This method retrieves all of the SMS messages currently available for
     * this phone number.
     *
     * @returns a vector of existing SMS messages each as an Sms struct.
     */
-    virtual std::vector<Cellular::Sms> getReceivedSms();
+    virtual std::vector<Cellular::Sms> getReceivedSms() = 0;
 
     /** This method can be used to remove/delete all received SMS messages
     * even if they have never been retrieved or read.
     *
     * @returns the standard AT Code enumeration.
     */
-    virtual Code deleteAllReceivedSms();
+    virtual Code deleteAllReceivedSms() = 0;
 
     /** This method can be used to remove/delete all received SMS messages
     * that have been retrieved by the user through the getReceivedSms method.
@@ -276,7 +276,7 @@
     *
     * @returns the standard AT Code enumeration.
     */
-    virtual Code deleteOnlyReceivedReadSms();
+    virtual Code deleteOnlyReceivedReadSms() = 0;
 
     //Cellular Radio Specific
     /** A method for sending a generic AT command to the radio. Note that you cannot
@@ -309,6 +309,21 @@
     * @returns the enumeration name as a string.
     */
     static std::string getRegistrationNames(Registration registration);
+
+protected:
+    MTSBufferedIO* io; //IO interface obect that the radio is accessed through.
+    bool echoMode; //Specifies if the echo mode is currently enabled.
+
+    bool pppConnected; //Specifies if a PPP session is currently connected.
+    std::string apn; //A string that holds the APN for the radio.
+
+    Mode mode; //The current socket Mode.
+    bool socketOpened; //Specifies if a Socket is presently opened.
+    bool socketCloseable; //Specifies is a Socket can be closed.
+    unsigned int local_port; //Holds the local port for socket connections.
+    std::string local_address; //Holds the local address for socket connections.
+    unsigned int host_port; //Holds the remote port for socket connections.
+    std::string host_address; //Holds the remote address for socket connections.
 };
 
 }