SWUpdate library to be used with RPC.
Fork of SWUpdate by
SWUpdate.h@1:208de08b1a19, 2014-06-14 (annotated)
- Committer:
- WiredHome
- Date:
- Sat Jun 14 15:59:02 2014 +0000
- Revision:
- 1:208de08b1a19
- Parent:
- 0:e221363f7942
- Child:
- 2:ef2ac9627546
Unconditionally try to remove the old bin file when a new one has been downloaded.; Add a few more warning messages.; Provide a placeholder for an integrity check of the new download.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WiredHome | 0:e221363f7942 | 1 | |
WiredHome | 0:e221363f7942 | 2 | #include "mbed.h" |
WiredHome | 0:e221363f7942 | 3 | |
WiredHome | 0:e221363f7942 | 4 | #ifndef SWUPDATE_H |
WiredHome | 0:e221363f7942 | 5 | #define SWUPDATE_H |
WiredHome | 0:e221363f7942 | 6 | |
WiredHome | 1:208de08b1a19 | 7 | /// After downloading, the user can choose what happens next. |
WiredHome | 0:e221363f7942 | 8 | typedef enum { |
WiredHome | 0:e221363f7942 | 9 | DEFER_REBOOT, |
WiredHome | 0:e221363f7942 | 10 | AUTO_REBOOT |
WiredHome | 0:e221363f7942 | 11 | } Reboot_T; |
WiredHome | 0:e221363f7942 | 12 | |
WiredHome | 1:208de08b1a19 | 13 | /// This API performs some processing to see if a web server |
WiredHome | 1:208de08b1a19 | 14 | /// has an updated version of software. If it does, then it |
WiredHome | 1:208de08b1a19 | 15 | /// will try to download it. If that succeeds, then it can |
WiredHome | 1:208de08b1a19 | 16 | /// optionally reboot to activate the new software. |
WiredHome | 1:208de08b1a19 | 17 | /// |
WiredHome | 1:208de08b1a19 | 18 | /// @todo check the freshly downloaded sw integrity. Since we have |
WiredHome | 1:208de08b1a19 | 19 | /// to remove the old .bin file before the new one will execute, |
WiredHome | 1:208de08b1a19 | 20 | /// it is in the device' best interest to ensure that new one |
WiredHome | 1:208de08b1a19 | 21 | /// is a good one. |
WiredHome | 1:208de08b1a19 | 22 | /// |
WiredHome | 1:208de08b1a19 | 23 | /// @param url is a pointer to a text string of the url from which to download. |
WiredHome | 1:208de08b1a19 | 24 | /// @param name is the base filename of the binary file. |
WiredHome | 1:208de08b1a19 | 25 | /// @param reboot determines whether to automatically reboot to activate the new bin. |
WiredHome | 1:208de08b1a19 | 26 | /// |
WiredHome | 0:e221363f7942 | 27 | bool SoftwareUpdate(const char *url, const char * name, Reboot_T reboot = DEFER_REBOOT); |
WiredHome | 0:e221363f7942 | 28 | |
WiredHome | 0:e221363f7942 | 29 | #endif // SWUPDATE_H |