Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Modules | Data Structures | Typedefs | Functions
Update

Updating a Soletta based app may vary depending on Soletta environment and configuration. More...

Modules

 Update modules
 

Data Structures

struct  sol_update_info
 Contains update info got via sol_update_check call. More...
 

Typedefs

typedef struct sol_update_handle sol_update_handle
 Handle returned by some sol_update* calls, so they can be cancelled appropriately. More...
 
typedef struct sol_update_info sol_update_info
 Contains update info got via sol_update_check call. More...
 

Functions

bool sol_update_cancel (struct sol_update_handle *handle)
 Cancel an ongoing check, fetch or install task. More...
 
struct sol_update_handlesol_update_check (void(*cb)(void *data, int status, const struct sol_update_info *response), const void *data)
 Check if there's an update to get. More...
 
struct sol_update_handlesol_update_fetch (void(*cb)(void *data, int status), const void *data, bool resume)
 Fetch update, so it can be installed later wit sol_update_install. More...
 
int sol_update_get_progress (struct sol_update_handle *handle)
 Get progress of given update task. More...
 
struct sol_update_handlesol_update_install (void(*cb)(void *data, int status), const void *data)
 Install update. More...
 

Detailed Description

Updating a Soletta based app may vary depending on Soletta environment and configuration.

For instance, updating a static Linux Micro (PID 1) Soletta based app is only a matter of replacing app file, but when using shared libs, may involve update/install newer versions of used libs. So, Soletta provides different update modules to update Soletta based apps on different scenarios. Soletta will try to use the first module it can use, but if having different modules to be loaded, environment variable SOL_UPDATE_MODULE can be used to define a specific one, like SOL_UPDATE_MODULE=linux-micro-efi-update.

When Soletta update module cheks for update, it should get version and size of new file to fill sol_update_info.

Each update module is free to decide how to check, fetch and install the update. Check update module documentation to understand how it works. Note also that comparing obtained version with app current version and deciding to fetch update file is up to user/developer.

Typedef Documentation

Handle returned by some sol_update* calls, so they can be cancelled appropriately.

Contains update info got via sol_update_check call.

See Also
sol_update_check

Function Documentation

bool sol_update_cancel ( struct sol_update_handle handle)

Cancel an ongoing check, fetch or install task.

Note that cancelling the task may not be possible at any moment, depending on update module being used.

Parameters
handlehandle of update task to be cancelled.
Returns
true if current task was successfully cancelled.
Note
If cancel was successful, then handle becomes invalid. If not, task callback shall still be called.
struct sol_update_handle* sol_update_check ( void(*)(void *data, int status, const struct sol_update_info *response)  cb,
const void *  data 
)

Check if there's an update to get.

Module must return a sol_update_info containing update size and version.

Parameters
cbcallback that will be called to return update information. If status < 0, then something went wrong with check and response is undefined. If status == 0, check went OK and response argument shall contain obtained update information.
datauser defined data to be sent to callback cb
Returns
handle of this update task, or NULL if couldn't start the task. Note that handle will be invalid after cb is called, or if it was cancelled.
See Also
sol_update_cancel
struct sol_update_handle* sol_update_fetch ( void(*)(void *data, int status)  cb,
const void *  data,
bool  resume 
)

Fetch update, so it can be installed later wit sol_update_install.

Fetch will get the update. Update module should check its hash and signature before informing that task was completed successfully. If everything is OK, callback cb will be called with status == 0.

Parameters
cbcallback called to inform fetch completion or failure. If status < 0, then something went wrong. If status == 0, fetch went OK and sol_update_install can be used to install the update.
datauser specified data to be sent to callback cb
resumeNOT IMPLEMENTED. If false, any previous data downloaded shall be discarded. Otherwise, will resume a previous cancelled fetch.
Returns
handle of this update task, or NULL if couldn't start the task. Note that handle will be invalid after cb is called, or if it was cancelled.
See Also
sol_update_cancel
int sol_update_get_progress ( struct sol_update_handle handle)

Get progress of given update task.

Note that getting the progress may not work for all tasks, depending on update module being used.

Parameters
handlehandle of update task to get current progress.
Returns
current progress of task between 0 and 100, or -1 if couldn't get progress.
struct sol_update_handle* sol_update_install ( void(*)(void *data, int status)  cb,
const void *  data 
)

Install update.

Install process vary depending on update module being used, but all shall give feedback of success or not on cb callback.

Parameters
cbcallback called to inform installation success or failure. If status < 0, then something went wrong. If status == 0, installation completed successfully.
datauser defined data to be passed to callback cb
Returns
handle of this update task, or NULL if couldn't start the task. Note that handle will be invalid after cb is called, or if it was cancelled.
See Also
sol_update_cancel