New cellular update

Dependencies:  

Fork of ublox-at-cellular-interface-ext by u-blox

Files at this revision

API Documentation at this revision

Comitter:
fahim.alavi@u-blox.com
Date:
Mon Feb 18 11:47:02 2019 +0500
Parent:
16:a9ffebec6523
Parent:
21:ee06f3b2b078
Commit message:
Sync fork from master

Changed in this revision

TESTS/unit_tests/cell-locate/template_mbed_app.txt Show diff for this revision Revisions of this file
TESTS/unit_tests/ftp/template_mbed_app.txt Show diff for this revision Revisions of this file
UbloxATCellularInterfaceExt.cpp Show annotated file Show diff for this revision Revisions of this file
UbloxATCellularInterfaceExt.h Show annotated file Show diff for this revision Revisions of this file
ublox-at-cellular-interface.lib Show annotated file Show diff for this revision Revisions of this file
--- a/TESTS/unit_tests/cell-locate/template_mbed_app.txt	Thu Jun 21 15:51:37 2018 +0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-{
-    "config": {
-        "cell-locate-mga-token": {
-            "help": "Your Cell Locate MGA token, required for TCP testing.  A tokane can be obtained from https://www.u-blox.com/en/assistnow-service-registration-form",
-            "value": "\"mymgatoken\""
-        },
-        "run-cell-locate-tcp-server-test": {
-            "help": "Set to true to run tests over TCP as well as over UDP",
-            "value": 1
-        }
-     },
-    "target_overrides": {
-        "*": {
-            "target.features_add": ["COMMON_PAL"],
-            "platform.stdio-convert-newlines": true
-        }
-    }
-}
-
--- a/TESTS/unit_tests/ftp/template_mbed_app.txt	Thu Jun 21 15:51:37 2018 +0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-{
-    "config": {
-        "ftp-server": {
-            "help": "An FTP server to use when running the FTP tests",
-            "value": "\"test.rebex.net\""
-        },
-        "ftp-username": {
-            "help": "The user name for the FTP server account",
-            "value": "\"demo\""
-        },
-        "ftp-password": {
-            "help": "The password for the FTP server account",
-            "value": "\"password\""
-        },
-        "ftp-use-passive": {
-            "help": "Set to true to use passive mode, otherwise false (defaults to true, since this is needed for most cases)",
-            "value": true
-        },
-        "ftp-server-supports-write": {
-            "help": "Set to true if the FTP server supports PUT, rename, MKDIR and delete, otherwise set to false",
-            "value": false
-        },
-        "ftp-filename": {
-            "help": "A filename to use during FTP tests.  This file must already exist on the server if the server does not support write",
-            "value": "\"readme.txt\""
-        },
-        "ftp-dirname": {
-            "help": "A directory name to use during FTP tests.  This directory must already exist on the server if the server does not support write. If the server does support write, this must not be a substring of ftp-filename.  ",
-            "value": "\"pub\""
-        }
-     },
-    "target_overrides": {
-        "*": {
-            "target.features_add": ["COMMON_PAL"],
-            "platform.stdio-convert-newlines": true
-        }
-    }
-}
-
--- a/TESTS/unit_tests/http/main.cpp	Thu Jun 21 15:51:37 2018 +0500
+++ b/TESTS/unit_tests/http/main.cpp	Mon Feb 18 11:47:02 2019 +0500
@@ -54,7 +54,11 @@
 #endif
 
 // The time to wait for a HTTP command to complete
+#ifndef MBED_CONF_APP_HTTP_TIMEOUT
 #define HTTP_TIMEOUT  10000
+#else
+#define HTTP_TIMEOUT  MBED_CONF_APP_HTTP_TIMEOUT
+#endif
 
 // The HTTP echo server, as described in the
 // first answer here:
@@ -83,7 +87,7 @@
                                        MBED_CONF_UBLOX_CELL_BAUD_RATE,
                                        MBED_CONF_APP_DEBUG_ON);
 // A few buffers for general use
-static char buf[1024];
+static char buf[2048];
 static char buf1[sizeof(buf)];
 
 // ----------------------------------------------------------------
@@ -161,7 +165,7 @@
     memset(buf, 0, sizeof (buf));
     TEST_ASSERT(pDriver->httpCommand(profile, UbloxATCellularInterfaceExt::HTTP_POST_DATA,
                                      "/post",
-                                     NULL, NULL, 0, NULL,
+                                     NULL, "formData=0123456789", 0, NULL,
                                      buf, sizeof (buf)) == NULL);
     tr_debug("Received: %s", buf);
     TEST_ASSERT(strstr(buf, "\"http://httpbin.org/post\"") != NULL);
@@ -231,7 +235,7 @@
                                      buf, sizeof (buf)) == NULL);
     tr_debug("Received: %s", buf);
     // This is what amazon.com returns if TLS is set
-    TEST_ASSERT(strstr(buf, "302 MovedTemporarily") != NULL);
+    TEST_ASSERT(strstr(buf, "503 Service Temporarily Unavailable") != NULL);
 
     // Reset the profile and check that this now fails
     TEST_ASSERT(pDriver->httpResetProfile(profile));
@@ -261,16 +265,17 @@
     // Allocate first profile and use it
     profiles[0] = pDriver->httpAllocProfile();
     TEST_ASSERT(profiles[0] >= 0);
-    TEST_ASSERT(pDriver->httpSetPar(profiles[0], UbloxATCellularInterfaceExt::HTTP_SERVER_NAME, "developer.mbed.org"));
+    TEST_ASSERT(pDriver->httpSetPar(profiles[0], UbloxATCellularInterfaceExt::HTTP_SERVER_NAME, "raw.githubusercontent.com"));
+    TEST_ASSERT(pDriver->httpSetPar(profiles[0], UbloxATCellularInterfaceExt::HTTP_SECURE, "1"));
 
     // Check HTTP get request
     memset(buf, 0, sizeof (buf));
     TEST_ASSERT(pDriver->httpCommand(profiles[0], UbloxATCellularInterfaceExt::HTTP_GET,
-                                     "/media/uploads/mbed_official/hello.txt",
+                                     "/u-blox/mbed-os/master/features/cellular/mbed_lib.json",
                                      NULL, NULL, 0, NULL,
                                      buf, sizeof (buf)) == NULL);
     tr_debug("Received: %s", buf);
-    TEST_ASSERT(strstr(buf, "Hello world!") != NULL);
+    TEST_ASSERT(strstr(buf, "Radio access technology to use. Value in integer: GSM=0, GSM_COMPACT=1, UTRAN=2, EGPRS=3, HSDPA=4, HSUPA=5, HSDPA_HSUPA=6, E_UTRAN=7, CATM1=8 ,NB1=9") != NULL);
 
     // Check that we stop being able to get profiles at the max number
     for (int x = 1; x < sizeof (profiles) / sizeof (profiles[0]); x++) {
@@ -296,11 +301,11 @@
     // Check HTTP get request on first profile once more
     memset(buf, 0, sizeof (buf));
     TEST_ASSERT(pDriver->httpCommand(profiles[0], UbloxATCellularInterfaceExt::HTTP_GET,
-                                     "/media/uploads/mbed_official/hello.txt",
+                                     "/u-blox/mbed-os/master/features/cellular/mbed_lib.json",
                                      NULL, NULL, 0, NULL,
                                      buf, sizeof (buf)) == NULL);
     tr_debug("Received: %s", buf);
-    TEST_ASSERT(strstr(buf, "Hello world!") != NULL);
+    TEST_ASSERT(strstr(buf, "Radio access technology to use. Value in integer: GSM=0, GSM_COMPACT=1, UTRAN=2, EGPRS=3, HSDPA=4, HSUPA=5, HSDPA_HSUPA=6, E_UTRAN=7, CATM1=8 ,NB1=9") != NULL);
 
     // Free the profiles again
     for (int x = 0; x < sizeof (profiles) / sizeof (profiles[0]); x++) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TESTS/unit_tests/template_mbed_app.txt	Mon Feb 18 11:47:02 2019 +0500
@@ -0,0 +1,54 @@
+{
+    "config": {
+        "ftp-server": {
+            "help": "An FTP server to use when running the FTP tests",
+            "value": "\"test.rebex.net\""
+        },
+        "ftp-username": {
+            "help": "The user name for the FTP server account",
+            "value": "\"demo\""
+        },
+        "ftp-password": {
+            "help": "The password for the FTP server account",
+            "value": "\"password\""
+        },
+        "ftp-use-passive": {
+            "help": "Set to true to use passive mode, otherwise false (defaults to true, since this is needed for most cases)",
+            "value": true
+        },
+        "ftp-server-supports-write": {
+            "help": "Set to true if the FTP server supports PUT, rename, MKDIR and delete, otherwise set to false",
+            "value": false
+        },
+        "ftp-filename": {
+            "help": "A filename to use during FTP tests.  This file must already exist on the server if the server does not support write",
+            "value": "\"readme.txt\""
+        },
+        "ftp-dirname": {
+            "help": "A directory name to use during FTP tests.  This directory must already exist on the server if the server does not support write. If the server does support write, this must not be a substring of ftp-filename.  ",
+            "value": "\"pub\""
+        },
+		"cell-locate-mga-token": {
+            "help": "Your Cell Locate MGA token, required for TCP testing.  A tokane can be obtained from https://www.u-blox.com/en/assistnow-service-registration-form",
+            "value": "\"mymgatoken\""
+        },
+        "run-cell-locate-tcp-server-test": {
+            "help": "Set to true to run tests over TCP as well as over UDP",
+            "value": 1
+        },
+        "http-timeout": {
+            "help": "Set http request timeout default value in ms",
+            "value": 30000
+        },
+        "debug-on": {
+            "help": "Set to true to get AT interface debug",
+            "value": true
+        }
+     },
+    "target_overrides": {
+        "*": {
+            "platform.stdio-convert-newlines": true
+        }
+    }
+}
+
--- a/UbloxATCellularInterfaceExt.cpp	Thu Jun 21 15:51:37 2018 +0500
+++ b/UbloxATCellularInterfaceExt.cpp	Mon Feb 18 11:47:02 2019 +0500
@@ -439,8 +439,9 @@
 UbloxATCellularInterfaceExt::UbloxATCellularInterfaceExt(PinName tx,
                                                          PinName rx,
                                                          int baud,
-                                                         bool debugOn):
-                             UbloxATCellularInterface(tx, rx, baud, debugOn)
+                                                         bool debugOn,
+                                                         osPriority priority):
+                             UbloxATCellularInterface(tx, rx, baud, debugOn, priority)
 {
     // Zero HTTP stuff
     memset(_httpProfiles, 0, sizeof(_httpProfiles));
--- a/UbloxATCellularInterfaceExt.h	Thu Jun 21 15:51:37 2018 +0500
+++ b/UbloxATCellularInterfaceExt.h	Mon Feb 18 11:47:02 2019 +0500
@@ -43,7 +43,8 @@
     UbloxATCellularInterfaceExt(PinName tx = MDMTXD,
                                 PinName rx = MDMRXD,
                                 int baud = MBED_CONF_UBLOX_CELL_BAUD_RATE,
-                                bool debugOn = false);
+                                bool debugOn = false,
+                                osPriority priority = osPriorityNormal);
 
      /* Destructor.
       */
@@ -202,7 +203,7 @@
      * @param httpCustomPar   the parameter for a user defined HTTP Content-Type.
      * @param buf             the buffer to read into.
      * @param len             the size of the buffer to read into.
-     * @param read_size		  Zero initialized variable address
+     * @param read_size       Zero initialized variable address
      * @return                NULL if successful, otherwise a pointer to
      *                        a Error struct containing the error class and error
      *                        code, see section Appendix A.B of
--- a/ublox-at-cellular-interface.lib	Thu Jun 21 15:51:37 2018 +0500
+++ b/ublox-at-cellular-interface.lib	Mon Feb 18 11:47:02 2019 +0500
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/fahimalavi/code/ublox-at-cellular-interface/
+https://os.mbed.com/users/fahimalavi/code/ublox-at-cellular-interface/