SWUpdate library to be used with RPC.

Fork of SWUpdate by David Smart

Revision:
17:1d318666246c
Parent:
16:de99e872fc9d
Child:
18:5f7667d63a27
diff -r de99e872fc9d -r 1d318666246c SWUpdate.h
--- a/SWUpdate.h	Sat Jul 05 16:06:55 2014 +0000
+++ b/SWUpdate.h	Sat Jul 05 22:27:09 2014 +0000
@@ -99,11 +99,13 @@
 /// close FT;
 /// @endcode
 ///
-#include "mbed.h"
 
 #ifndef SWUPDATE_H
 #define SWUPDATE_H
 
+#include "mbed.h"
+#include "HTTPClient.h"
+
 // This defines the maximum string length for a fully qualified
 // filename. Usually, this will be pretty short 
 // (e.g. "/local/myprog.bin"), which should be 19 max with 8.3 filename.
@@ -122,16 +124,18 @@
 /// Bit-Field return codes from the SoftwareUpdate API.
 ///
 /// Various things can go wrong in the software update process. The return
-/// value is a bit-field that flags the possibilities.
+/// value is a bit-field that flags the possibilities, although usually there
+/// will only be a single bit set.
+///
 typedef enum {
     SWUP_OK               = 0x00,   ///< Software Update succeeded as planned.
     SWUP_SAME_VER         = 0x01,   ///< Online version is the same as the installed version.
-    SWUP_BAD_URL          = 0x02,   ///< Bad URL provided, File missing on server, etc.
-    SWUP_OLD_STUCK        = 0x04,   ///< Old file could not be removed,
+    SWUP_HTTP_BIN         = 0x02,   ///< HTTP get returned an error while trying to fetch the bin file.
+    SWUP_OLD_STUCK        = 0x04,   ///< Old file could not be removed.
     SWUP_VER_STUCK        = 0x08,   ///< Old version number could not be updated.
     SWUP_VWRITE_FAILED    = 0x10,   ///< Can't open for write the version tracking file.
     SWUP_INTEGRITY_FAILED = 0x20,   ///< Integrity check of downloaded file failed.
-    SWUP_HTTP_ERR         = 0x40,   ///< HTTP get returned an error
+    SWUP_HTTP_VER         = 0x40,   ///< HTTP get returned an error while trying to fetch the version file.
 } SWUpdate_T;
 
 
@@ -172,4 +176,15 @@
 ///
 SWUpdate_T SoftwareUpdate(const char *url, const char * name, Reboot_T action = AUTO_REBOOT);
 
+/// Get the HTTP transaction return code.
+///
+/// If something goes wrong with the communications with the server, SoftwareUpdate will
+/// respond with an SWUP_HTTP_VER or SWUP_HTTP_BIN return value. To learn more about 
+/// what went wrong, this API will provide the actual return code from the HTTP transaction.
+///
+/// @returns @ref HTTPResult code from the server transaction.
+///
+HTTPResult SoftwareUpdateGetHTTPErrorCode(void);
+
+
 #endif // SWUPDATE_H