Alcatel-Lucent IoT Development / MTS-Cellular

Dependents:   mtsas

Fork of MTS-Cellular by MultiTech

Files at this revision

API Documentation at this revision

Comitter:
Vanger
Date:
Tue Nov 11 17:54:06 2014 +0000
Parent:
68:66f4126100b5
Child:
70:c0c621f88330
Commit message:
Added support for LE910-NAG under the EasyIP class, the Cellular class, and the CellularFactory class.; Added enumeration for all 3 types of LE910 radio, but only implemented the LE910-NAG type.

Changed in this revision

Cellular/Cellular.cpp Show annotated file Show diff for this revision Revisions of this file
Cellular/Cellular.h Show annotated file Show diff for this revision Revisions of this file
Cellular/CellularFactory.cpp Show annotated file Show diff for this revision Revisions of this file
Cellular/EasyIP.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Cellular/Cellular.cpp	Tue Oct 21 21:14:13 2014 +0000
+++ b/Cellular/Cellular.cpp	Tue Nov 11 17:54:06 2014 +0000
@@ -71,6 +71,12 @@
             return "MTSMC-EV3-IP";
         case MTSMC_C2_IP:
             return "MTSMC-C2-IP";
+        case MTSMC_LAT1:
+            return "MTSMC_LAT1";
+        case MTSMC_LEU1:
+            return "MTSMC_LEU";
+        case MTSMC_VW2:
+            return "MTSMC_VW2";
         default:
             return "UNKNOWN ENUM";
     }
@@ -217,7 +223,7 @@
                     done = true;
                 }
                 
-                if(type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_EV3 || type == MTSMC_C2) {
+                if(type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_EV3 || type == MTSMC_C2 || type == MTSMC_LAT1) {
                     if (result.find("CONNECT\r\n") != std::string::npos) {
                         done = true;
                     } 
@@ -249,7 +255,7 @@
 {
     string csmp;
     
-    if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3) {
+    if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1) {
         csmp = "AT+CSMP=17,167,0,0";
     } else if (type == MTSMC_EV3_IP || type == MTSMC_EV3 || type == MTSMC_C2_IP || type == MTSMC_C2) {
         csmp = "AT+CSMP=,4098,0,2";
@@ -320,7 +326,7 @@
         }
         //Start of SMS message
         std::vector<std::string> vSmsParts = Text::split(line, ',');
-        if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3) {
+        if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1) {
             /* format for H5 and H5-IP radios
              * <index>, <status>, <oa>, <alpha>, <scts>
              * scts contains a comma, so splitting on commas should give us 6 items
--- a/Cellular/Cellular.h	Tue Oct 21 21:14:13 2014 +0000
+++ b/Cellular/Cellular.h	Tue Nov 11 17:54:06 2014 +0000
@@ -245,7 +245,7 @@
 
     /// Enumeration for different cellular radio types.
     enum Radio {
-        NA, MTSMC_H5, MTSMC_EV3, MTSMC_G3, MTSMC_C2, MTSMC_H5_IP, MTSMC_EV3_IP, MTSMC_C2_IP
+        NA, MTSMC_H5, MTSMC_EV3, MTSMC_G3, MTSMC_C2, MTSMC_H5_IP, MTSMC_EV3_IP, MTSMC_C2_IP, MTSMC_LAT1, MTSMC_VW2, MTSMC_LEU1
     };
 
     /// An enumeration of radio registration states with a cell tower.
--- a/Cellular/CellularFactory.cpp	Tue Oct 21 21:14:13 2014 +0000
+++ b/Cellular/CellularFactory.cpp	Tue Nov 11 17:54:06 2014 +0000
@@ -72,6 +72,9 @@
             } else if (model.find("GE910") != string::npos) {
                 type = Cellular::MTSMC_G3;
                 mNumber = "GE910";
+            } else if (model.find("LE910-NAG") != string::npos) {
+                type = Cellular::MTSMC_LAT1;
+                mNumber = "LE910-NAG";
             }
             if (type != Cellular::NA) {
                 cell = new EasyIP(type);
--- a/Cellular/EasyIP.cpp	Tue Oct 21 21:14:13 2014 +0000
+++ b/Cellular/EasyIP.cpp	Tue Nov 11 17:54:06 2014 +0000
@@ -52,7 +52,7 @@
 bool EasyIP::connect()
 {
     //Check if APN is not set, if it is not, connect will not work.
-    if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3) {
+    if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1) {
         if(apn.size() == 0) {
             logDebug("APN is not set");
             return false;
@@ -96,7 +96,7 @@
     } while(tmr.read() < 30);
 
     //Make PPP connection
-    if (type == MTSMC_H5 || type == MTSMC_G3) {
+    if (type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1) {
         logDebug("Making PPP Connection Attempt. APN[%s]", apn.c_str());
     } else {
         logDebug("Making PPP Connection Attempt");
@@ -172,7 +172,7 @@
     bool signal = false, regist = false, active = false;
     
     //1) Check if APN was set if we're on an HSPA radio
-    if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3) {
+    if (type == MTSMC_H5_IP || type == MTSMC_H5 || type == MTSMC_G3 || type == MTSMC_LAT1) {
         if(apn.size() == 0) {
             logDebug("APN is not set");
             return false;
@@ -299,6 +299,11 @@
             logDebug("Local port set to 1, port 0 not supported for MTSMC_EV3");
             local_port = 1;
         }
+    } else if (type == MTSMC_LAT1) {
+        if(!local_port) {
+            logDebug("Local port set to 1, port 0 not supported for MTSMC_LAT1");
+            local_port = 1;
+        }
     }
 
     //3) Check PPP connection
@@ -332,7 +337,7 @@
     }
     
     //5) Open Socket  
-    sprintf(sOpenSocketCmd, "AT#SD=1,%d,%d,%s,%d,%d,0", typeSocket, port, address.c_str(),closeType , local_port);
+    sprintf(sOpenSocketCmd, "AT#SD=1,%d,%d,\"%s\",%d,%d,0", typeSocket, port, address.c_str(), closeType, local_port);
     std::string response = sendCommand(sOpenSocketCmd, 60000);
     
     if(response.find("CONNECT") != std::string::npos) {
@@ -505,6 +510,14 @@
         }
         this->apn = apn;
         return code;
+    } else if (type == MTSMC_LAT1) {
+         //CGDCONT has options: IP,PPP,IPv6
+        Code code = sendBasicCommand("AT+CGDCONT=1,\"IP\",\"" + apn + "\"", 1000);
+        if (code != MTS_SUCCESS) {
+            return code;
+        }
+        this->apn = apn;
+        return code;
     } else {
         logInfo("CDMA radios don't need an APN");
         return MTS_SUCCESS;