![]() |
m2mb API docs
25.30.003
m2mb API sets documentation
|
Header file for m2mb_fota APIs. More...
Go to the source code of this file.
Data Structures | |
| struct | M2MB_FOTA_HTTP_SESSION_CFG_T |
| struct | M2MB_FOTA_FTP_SESSION_CFG_T |
| struct | M2MB_FOTA_SOCKET_CFG_T |
| struct | M2MB_FOTA_FTP_CFG_T |
| struct | M2MB_FOTA_CB_RESP_DELTA_TRANSFER_END_T |
Macros | |
| #define | M2MB_LOAD_UPDATED_APPS 0xAABB |
| #define | M2MB_SKIP_BACKUP_RESTORE_PARAM 0xCCDD |
| #define | M2MB_DEFAULT_LOAD_UPDATED_APPS 0xFFFF |
| #define | M2MB_PARAM_LEN (255+1) |
Typedefs | |
| typedef void * | M2MB_FOTA_HANDLE |
| typedef void(* | m2mb_fota_ind_callback) (M2MB_FOTA_HANDLE h, M2MB_FOTA_IND_E fota_event, UINT16 resp_size, void *resp_struct, void *userdata) |
Functions | |
| M2MB_RESULT_E | m2mb_fota_init (M2MB_FOTA_HANDLE *pHandle, m2mb_fota_ind_callback callback, void *userdata) |
| FOTA system open. More... | |
| M2MB_RESULT_E | m2mb_fota_deinit (M2MB_FOTA_HANDLE handle) |
| FOTA system close. More... | |
| M2MB_RESULT_E | m2mb_fota_get_delta (M2MB_FOTA_HANDLE handle, M2MB_FOTA_DOWNLOAD_TYPE_E type, void *settings) |
| Get FOTA delta. More... | |
| M2MB_RESULT_E | m2mb_fota_reset (M2MB_FOTA_HANDLE handle) |
| Base FOTA system initialization. More... | |
| M2MB_RESULT_E | m2mb_fota_result_code_get (M2MB_FOTA_HANDLE handle, M2MB_FOTA_RESULT_CODE_E *pResultCode) |
| Get last FOTA result code. More... | |
| M2MB_RESULT_E | m2mb_fota_config_set (M2MB_FOTA_HANDLE handle, M2MB_FOTA_TRACE_VERBOSE_LEVEL_E TraceVerboseLevel, M2MB_FOTA_TRACE_SPEED_E TraceSpeed) |
| Set FOTA configuration. More... | |
| M2MB_RESULT_E | m2mb_fota_config_get (M2MB_FOTA_HANDLE handle, M2MB_FOTA_TRACE_VERBOSE_LEVEL_E *pTraceVerboseLevel, M2MB_FOTA_TRACE_SPEED_E *pTraceSpeed) |
| Get FOTA configuration. More... | |
| M2MB_RESULT_E | m2mb_fota_update_package_info_get (M2MB_FOTA_HANDLE handle, UINT32 *pBlockSize, UINT32 *pPartitionSize) |
| Get FOTA update package partition info. More... | |
| M2MB_RESULT_E | m2mb_fota_update_package_write (M2MB_FOTA_HANDLE handle, UINT32 BlockAddress, UINT8 *pBuffer) |
| Write update package data to flash. More... | |
| M2MB_RESULT_E | m2mb_fota_update_package_check_setup (M2MB_FOTA_HANDLE handle, M2MB_FOTA_CHECK_SETUP_E Action) |
| Check update package integrity, applicability and prepare for FOTA update. More... | |
| M2MB_RESULT_E | m2mb_fota_start (M2MB_FOTA_HANDLE handle) |
| Start FOTA process. More... | |
| M2MB_RESULT_E | m2mb_fota_end (M2MB_FOTA_HANDLE handle) |
| End FOTA process. More... | |
| M2MB_RESULT_E | m2mb_fota_state_get (M2MB_FOTA_HANDLE handle, M2MB_FOTA_STATE_E *pState) |
| Get FOTA process state. More... | |
Header file for m2mb_fota APIs.
m2m/m2m_generic/common/m2mb_inc/m2mb_fota.h
@notes Dependencies: stdarg.h, m2mb_types.h
| M2MB_RESULT_E m2mb_fota_config_get | ( | M2MB_FOTA_HANDLE | handle, |
| M2MB_FOTA_TRACE_VERBOSE_LEVEL_E * | pTraceVerboseLevel, | ||
| M2MB_FOTA_TRACE_SPEED_E * | pTraceSpeed | ||
| ) |
Get FOTA configuration.
This function gets trace verbose level and speed. Default values are M2MB_FOTA_TRACE_VERBOSE_LEVEL_0 for verbose level and M2MB_FOTA_TRACE_SPEED_115200 for speed
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
| [out] | pTraceVerboseLevel | Returned trace verbose level defined in M2MB_FOTA_TRACE_VERBOSE_LEVEL_E |
| [out] | pTraceSpeed | Returned trace speed defined in M2MB_FOTA_TRACE_SPEED_E |
Example
| M2MB_RESULT_E m2mb_fota_config_set | ( | M2MB_FOTA_HANDLE | handle, |
| M2MB_FOTA_TRACE_VERBOSE_LEVEL_E | TraceVerboseLevel, | ||
| M2MB_FOTA_TRACE_SPEED_E | TraceSpeed | ||
| ) |
Set FOTA configuration.
This function sets trace verbose level and, if UART is available for FOTA tracing, trace speed. With M2MB_FOTA_VERBOSE_LEVEL_NO_CHANGE and/or M2MB_FOTA_TRACE_SPEED_NO_CHANGE the specific parameter remains unchanged
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
| [in] | TraceVerboseLevel | Trace verbose level defined in M2MB_FOTA_TRACE_VERBOSE_LEVEL_E |
| [in] | TraceSpeed | Trace speed defined in M2MB_FOTA_TRACE_SPEED_E |
Example
| M2MB_RESULT_E m2mb_fota_deinit | ( | M2MB_FOTA_HANDLE | handle | ) |
FOTA system close.
This function closes base FOTA system
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
Example
| M2MB_RESULT_E m2mb_fota_end | ( | M2MB_FOTA_HANDLE | handle | ) |
End FOTA process.
After FOTA process in completed this API has to be called to change state from M2MB_FOTA_STATE_UDPATED to M2MB_FOTA_STATE_IDLE. This step is necessary to logically finish the FOTA process In recent SW versions there is no more need to use this API, after the reboot: the state will be changed automatically.
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
Example
| M2MB_RESULT_E m2mb_fota_get_delta | ( | M2MB_FOTA_HANDLE | handle, |
| M2MB_FOTA_DOWNLOAD_TYPE_E | type, | ||
| void * | settings | ||
| ) |
Get FOTA delta.
This function gets FOTA delta
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
| [in] | type | Type of protocol used for download the FOTA delta. Defined in M2MB_FOTA_DOWNLOAD_TYPE_E. |
| [in] | settings | Pointer to a configuration structure, relative to the protocol "type" used for the download: M2MB_FOTA_FTP_CFG_T in case of FTP protocol. M2MB_FOTA_HTTP_SESSION_CFG_T in case of HTTP protocol. |
Example
| M2MB_RESULT_E m2mb_fota_init | ( | M2MB_FOTA_HANDLE * | pHandle, |
| m2mb_fota_ind_callback | callback, | ||
| void * | userdata | ||
| ) |
FOTA system open.
This function opens base FOTA system
| [in] | *pHandle | Pointer to the handle of the FOTA system, that will be initialized by the function. |
| [in] | callback | Callback that will be called if an event or a response happens. |
| [in] | userdata | Pointer to generic user data that will be returned as it is in the callback. |
@notes Normal FOTA process should be: m2mb_fota_init m2mb_fota_reset m2mb_fota_state_get if M2MB_FOTA_STATE_IDLE m2mb_fota_get_delta m2mb_fota_update_package_check_setup m2mb_fota_start reboot (m2mb_power_reboot) ... m2mb_fota_deinit
Example
| M2MB_RESULT_E m2mb_fota_reset | ( | M2MB_FOTA_HANDLE | handle | ) |
Base FOTA system initialization.
This function initializes base FOTA system
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
Example
| M2MB_RESULT_E m2mb_fota_result_code_get | ( | M2MB_FOTA_HANDLE | handle, |
| M2MB_FOTA_RESULT_CODE_E * | pResultCode | ||
| ) |
Get last FOTA result code.
This function returns result code of the last FOTA function called
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
| [out] | pResultCode | Specific FOTA result code is defined in M2MB_FOTA_RESULT_CODE_E |
Example
| M2MB_RESULT_E m2mb_fota_start | ( | M2MB_FOTA_HANDLE | handle | ) |
Start FOTA process.
Prepares everything to start FOTA process. A reboot is necessary to start the process
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
Example
| M2MB_RESULT_E m2mb_fota_state_get | ( | M2MB_FOTA_HANDLE | handle, |
| M2MB_FOTA_STATE_E * | pState | ||
| ) |
Get FOTA process state.
This function gets the FOTA process state
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
| [out] | pState | Refer to M2MB_FOTA_STATE_E |
Example
| M2MB_RESULT_E m2mb_fota_update_package_check_setup | ( | M2MB_FOTA_HANDLE | handle, |
| M2MB_FOTA_CHECK_SETUP_E | Action | ||
| ) |
Check update package integrity, applicability and prepare for FOTA update.
This function verifies update package integrity and applicability. If everything OK the functions prepares all the necessary stuff for a FW update.
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
| [in] | Action | Refer to M2MB_FOTA_CHECK_SETUP_E. Use always M2MB_FOTA_CHECK_SETUP_SOURCE |
Example
| M2MB_RESULT_E m2mb_fota_update_package_info_get | ( | M2MB_FOTA_HANDLE | handle, |
| UINT32 * | pBlockSize, | ||
| UINT32 * | pPartitionSize | ||
| ) |
Get FOTA update package partition info.
This function gets the erasable block size and the overall partition size of the partition used to save update package
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
| [out] | pBlockSize | Returned block size in bytes |
| [out] | pPartitionSize | Returned overall partition size in bytes |
Example
| M2MB_RESULT_E m2mb_fota_update_package_write | ( | M2MB_FOTA_HANDLE | handle, |
| UINT32 | BlockAddress, | ||
| UINT8 * | pBuffer | ||
| ) |
Write update package data to flash.
This function writes blocks of update package to flash. Writes are intended block by block. The block is the minimum erasable region of the flash.
| [in] | handle | Handle of the FOTA system, previously initialized by the m2mb_fota_init function. |
| [in] | BlockAddress | Address of the block to be written. |
| [in] | pBuffer | Pointer to a buffer that contains data to be written. Size of the buffer comes from m2mb_fota_update_package_info_get pBlockSize parameter. |
Example