Virgil IoT KIT
|
FLDT for client. More...
#include <virgil/iot/protocols/snap/snap-structs.h>
#include <virgil/iot/status_code/status_code.h>
#include <virgil/iot/update/update.h>
Go to the source code of this file.
Typedefs | |
typedef void(* | vs_fldt_got_file) (vs_update_file_type_t *file_type, const vs_file_version_t *prev_file_ver, const vs_file_version_t *new_file_ver, vs_update_interface_t *update_interface, const vs_mac_addr_t *gateway, bool successfully_updated) |
Got new file callback. More... | |
Functions | |
const vs_snap_service_t * | vs_snap_fldt_client (vs_fldt_got_file got_file_callback) |
FLDT Client SNAP Service implementation. More... | |
vs_status_e | vs_fldt_client_add_file_type (const vs_update_file_type_t *file_type, vs_update_interface_t *update_interface) |
Add file type. More... | |
vs_status_e | vs_fldt_client_request_all_files (void) |
Request all files data. More... | |
FLDT for client.
FLDT service is used to download new file version from gateway to client. This module is used to process client part of FLDT protocol.
Client side downloads new file versions and checks them. vs_fldt_got_file function is called after file upgrading. In most case it used to output new file version information and gateway address.
To successfully file downloading process vs_update_interface_t must be provided for each file type. You can see function vs_firmware_update_file_type for Firmware example and vs_tl_update_file_type for Trust List one.
Here you can see an example of FLDT client initialization :
You can see minimalistic vs_fldt_got_file function example below :
In this example _app_restart() function is called for firmware that has been successfully updated.
typedef void(* vs_fldt_got_file) (vs_update_file_type_t *file_type, const vs_file_version_t *prev_file_ver, const vs_file_version_t *new_file_ver, vs_update_interface_t *update_interface, const vs_mac_addr_t *gateway, bool successfully_updated) |
Got new file callback.
Callback for vs_snap_fldt_client function. This callback is used when new file has been fully loaded. See #fldt_client_usage for details.
[in] | file_type | File type descriptor. Cannot be NULL. |
[in] | prev_file_ver | Current file version before loading new one. Cannot be NULL. |
[in] | new_file_ver | Has been loaded file version. Cannot be NULL. |
[in] | update_interface | Update interface for current file type. Cannot be NULL. |
[in] | gateway | Gateway's MAC address. Cannot be NULL. |
[in] | successfully_updated | True if file has been successfully updated. |
vs_status_e vs_fldt_client_add_file_type | ( | const vs_update_file_type_t * | file_type, |
vs_update_interface_t * | update_interface | ||
) |
Add file type.
FLDT client has the list of file types that it processes. This call adds new file type or update previously added one.
[in] | file_type | File type to be added. Must not be NULL. |
[in] | update_interface | Update interface for current file type. Must not be NULL. |
vs_status_e vs_fldt_client_request_all_files | ( | void | ) |
Request all files data.
Request information about all previously registered files. This function can be executed after gateway restart notification.
const vs_snap_service_t* vs_snap_fldt_client | ( | vs_fldt_got_file | got_file_callback | ) |
FLDT Client SNAP Service implementation.
This call returns FLDT client implementation. It must be called before any FLDT call.
[in] | got_file_callback | Callback. Must not be NULL. |