This class adds HTTP, FTP and CellLocate client support for u-blox modules for the C027 and C030 boards (excepting the C030 N2xx flavour) from mbed 5.5 onwards. The HTTP, FTP and CellLocate operations are all hosted on the module, minimizing RAM consumption in the mbed MCU. It also sub-classes ublox-cellular-driver-gen to bring in SMS, USSD and modem file system support if you need to use these functions at the same time as the cellular interface.

Dependencies:   ublox-at-cellular-interface

Dependents:   example-ublox-at-cellular-interface-ext HelloMQTT ublox_new_driver_test example-ublox-at-cellular-interface-ext ... more

Revision:
11:3631f62bb359
Parent:
5:9fd89567f769
Child:
15:6f0a1ecc8cec
--- a/UbloxATCellularInterfaceExt.h	Tue Jun 13 10:46:08 2017 +0100
+++ b/UbloxATCellularInterfaceExt.h	Fri Jun 16 00:55:19 2017 +0100
@@ -157,7 +157,8 @@
      * HTTP_AUTH_TYPE      "0" for no authentication, "1" for username/password
      *                     authentication (the default is 0)
      * HTTP_SERVER_PORT    "81" (default is port 80)
-     * HTTP_SECURE         "0" for no security, "1" for TLS (the default is 0)
+     * HTTP_SECURE         "0" for no security, "1" for TLS (the default is 0),
+     *                     not all modems support this parameter
      *
      * @param httpProfile the HTTP profile identifier.
      * @param httpOpCode  the HTTP operation code.
@@ -257,10 +258,8 @@
     bool ftpSetTimeout(int timeout);
 
     /** Reset the FTP configuration back to defaults.
-     *
-     * @return   true if successful, false otherwise.
      */
-    bool ftpResetPar();
+    void ftpResetPar();
     
     /** Set FTP parameters.
      *
@@ -295,19 +294,19 @@
      * See section 27.2 of u-blox-ATCommands_Manual(UBX-13002752).pdf
      * for full details.  By example, it works like this:
      *
-     * ftpCmd               file1      file2     offset    buf     len
-     * FTP_LOGOUT            N/A        N/A       N/A      N/A     N/A 
-     * FTP_LOGIN             N/A        N/A       N/A      N/A     N/A 
-     * FTP_DELETE_FILE   "the_file"     N/A       N/A      N/A     N/A 
-     * FTP_RENAME_FILE   "old_name"  "new_name"   N/A      N/A     N/A 
-     * FTP_GET_FILE      "the_file"    Note 1  0 - 65535   N/A     N/A (Notes 2)
-     * FTP_PUT_FILE      "the_file"    Note 1  0 - 65535   N/A     N/A (Note 2)
-     * FTP_CD            "dir1\dir2"    N/A       N/A      N/A     N/A 
-     * FTP_MKDIR         "newdir"       N/A       N/A      N/A     N/A 
-     * FTP_RMDIR         "dir"          N/A       N/A      N/A     N/A 
-     * FTP_FILE_INFO     "the_path"     N/A       N/A         Note 3
-     * FTP_LS            "the_path"     N/A       N/A         Note 3
-     * FTP_FOTA_FILE     "the_file"     N/A       N/A         Note 4
+     * ftpCmd               file1      file2    buf     len  offset
+     * FTP_LOGOUT            N/A        N/A     N/A     N/A    N/A 
+     * FTP_LOGIN             N/A        N/A     N/A     N/A    N/A 
+     * FTP_DELETE_FILE   "the_file"     N/A     N/A     N/A    N/A
+     * FTP_RENAME_FILE   "old_name"  "new_name" N/A     N/A    N/A 
+     * FTP_GET_FILE      "the_file"    Note 1   N/A     N/A   0 - 1    (Notes 2 & 3)
+     * FTP_PUT_FILE      "the_file"    Note 1   N/A     N/A  0 - 65535 (Notes 2 & 4 & 5)
+     * FTP_CD            "dir1\dir2"    N/A     N/A     N/A    N/A 
+     * FTP_MKDIR         "newdir"       N/A     N/A     N/A    N/A 
+     * FTP_RMDIR         "dir"          N/A     N/A     N/A    N/A 
+     * FTP_FILE_INFO     "the_path"     N/A        Note 6      N/A
+     * FTP_LS            "the_path"     N/A        Note 6      N/A
+     * FTP_FOTA_FILE     "the_file"     N/A        Note 7      N/A
      *
      * Note 1: for this case, file2 is the name that the file should be
      * given when it arrives (in the modem file system for a GET, at the FTP
@@ -315,30 +314,37 @@
      * Note 2: the file will placed into the modem file system for the
      * GET case (and can be read with readFile()), or must already be in the
      * modem file system, (can be written using writeFile()) for the PUT case.
-     * Note 3: buf should point to the location where the file info
+     * Note 3: if offset is 1 then, where supported, the FTP GET
+     * will be continued from the point it previously stopped.
+     * Note 4: if the file already exists in the modem file system some
+     * modems will return an error.  It is up to the caller to ensure that
+     * the file does not exist before the FTP PUT operation.
+     * Note 5: where supported, offset is the position in the file to continue
+     * the FTP PUT from.
+     * Note 6: buf should point to the location where the file info
      * or directory listing is to be stored and len should be the maximum
      * length that can be stored.
-     * Note 4: a hex string representing the MD5 sum of the FOTA file will be
+     * Note 7: a hex string representing the MD5 sum of the FOTA file will be
      * stored at buf; len must be at least 32 as an MD5 sum is 16 bytes.
      * FTP_FOTA_FILE is not supported on SARA-U2.
-     * Note 5: FTP_GET_DIRECT and FTP_PUT_DIRECT are not supported by
+     * Note 8: FTP_GET_DIRECT and FTP_PUT_DIRECT are not supported by
      * this driver.
      *
      * @param ftpCmd     the FTP command.
      * @param file1      the first file name if required (NULL otherwise).
      * @param file2      the second file name if required (NULL otherwise).
-     * @param offset     the offset (in bytes) at which to begin the get
-     *                   or put operation within the file.
      * @param buf        pointer to a buffer, required for FTP_DIRECT mode
      *                   and FTP_LS only.
      * @param len        the size of buf.
+     * @param continue   if true then attempt to continue a download that
+     *                   was previously interrupted.
      * @return           NULL if successful, otherwise a pointer to
      *                   a Error struct containing the error class and error
      *                   code, see section Appendix A.B of
      *                   u-blox-ATCommands_Manual(UBX-13002752).pdf for details.
      */
     Error *ftpCommand(FtpCmd ftpCmd, const char* file1 = NULL, const char* file2 = NULL,
-                      int offset = 0, char* buf = NULL, int len = 0);
+                      char* buf = NULL, int len = 0, int offset = 0);
 
     /**********************************************************************
      * PUBLIC: Cell Locate