Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetNetIf NTPClient_NetServices mbed ConfigFile
FirmwareUpdater Class Reference
#include <FirmwareUpdater.h>
Public Member Functions | |
| FirmwareUpdater (std::string url, std::string name, HTTPClient *pclient, bool log=false) | |
| Create. | |
| ~FirmwareUpdater () | |
| Dispose. | |
| const std::string | getURL () const |
| Get a URL. | |
| const std::string | getName () const |
| Get a name. | |
| int | exist () |
| Checking a new firmware. | |
| int | execute () |
| Execute update. | |
| void | reset () |
| Reset system. | |
Detailed Description
#include "mbed.h" #include "FirmwareUpdater.h" #include "EthernetNetIf.h" EthernetNetIf eth; FirmwareUpdater fwup("http://mbed.org/media/uploads/shintamainjp/", "firm", true); // There are 2 files for the firmware. // 1. firm.txt : firmware version file. // 2. firm.bin : firmware binary file. int main() { eth.setup(); if (fwup.exist() == 0) { printf("Found a new firmware.\n"); if (fwup.execute() == 0) { printf("Update succeed.\n"); printf("Resetting this system...\n\n\n\n\n"); fwup.reset(); } else { printf("Update failed!\n"); } } }
Definition at line 73 of file FirmwareUpdater.h.
Constructor & Destructor Documentation
| FirmwareUpdater | ( | std::string | url, |
| std::string | name, | ||
| HTTPClient * | pclient, | ||
| bool | log = false |
||
| ) |
Create.
- Parameters:
-
url URL for firmware. Do not include a target file name. name An application name. Do not include a extention. log True if logging.
Definition at line 64 of file FirmwareUpdater.cpp.
| ~FirmwareUpdater | ( | ) |
Dispose.
Definition at line 81 of file FirmwareUpdater.cpp.
Member Function Documentation
| int execute | ( | ) |
| int exist | ( | ) |
Checking a new firmware.
Compare versions of the software between local storage on mbed and on webserver.
- Returns:
- Return 0 if a new firmware exists.
Definition at line 108 of file FirmwareUpdater.cpp.
| const std::string getName | ( | ) | const |
| const std::string getURL | ( | ) | const |
| void reset | ( | ) |
Reset system.
Definition at line 264 of file FirmwareUpdater.cpp.
Generated on Tue Jul 12 2022 10:57:43 by
1.7.2