firmware update from USB stick, does not work properly. If someone can get it work, please inform me.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

FirmwareUpdater Class Reference

FirmwareUpdater Class Reference

#include <FirmwareUpdater.h>

Public Member Functions

 FirmwareUpdater (std::string src_name, std::string dest_name, bool log=false)
 Create.
 ~FirmwareUpdater ()
 Dispose.
const std::string get_src_name () const
 Get a URL.
const std::string get_dest_name () 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/", "firmware", true);

 // There are 2 files for the firmware.
 //  1. firmware.txt : firmware version file.
 //  2. firmware.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 63 of file FirmwareUpdater.h.


Constructor & Destructor Documentation

FirmwareUpdater ( std::string  src_name,
std::string  dest_name,
bool  log = false 
)

Create.

Parameters:
urlURL for firmware. Do not include a target file name.
nameAn application name. Do not include a extention.
logTrue if logging.
src_name,:An application name on USB Stick. Do not include a extention.
dest_nameAn application name on MBED. Do not include a extention.
logTrue if logging.

Definition at line 50 of file FirmwareUpdater.cpp.

Dispose.

Definition at line 58 of file FirmwareUpdater.cpp.


Member Function Documentation

int execute (  )

Execute update.

Returns:
Return 0 if it succeed.

Definition at line 133 of file FirmwareUpdater.cpp.

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 86 of file FirmwareUpdater.cpp.

const std::string get_dest_name (  ) const

Get a name.

Get the dest_name.

Returns:
name.
_destname.

Definition at line 75 of file FirmwareUpdater.cpp.

const std::string get_src_name (  ) const

Get a URL.

Get the source_name.

Returns:
URL.
src_name.

Definition at line 66 of file FirmwareUpdater.cpp.

void reset (  )

Reset system.

Definition at line 176 of file FirmwareUpdater.cpp.