CC3X00 Simplelink OTA Extlib API User's Guide: OTA

CC3X00 Simplelink OTA Extlib API

CC3X00 Simplelink OTA Extlib API User's Guide  1.1.0

Functions

void * sl_extLib_OtaInit (_i32 runMode, FlcCb_t *pFlcHostCb)
 Initialize OTA application. More...
 
_i32 sl_extLib_OtaRun (void *pvOtaApp)
 Run the OTA App state machine. More...
 
_i32 sl_extLib_OtaSet (void *pvOtaApp, _i32 Option, _i32 OptionLen, _u8 *pOptionVal)
 Set OTA command/parameter. More...
 
_i32 sl_extLib_OtaGet (void *pvOtaApp, _i32 Option, _i32 *OptionLen, _u8 *pOptionVal)
 Get the current OTA status. More...
 

Variables

_i32 ip_address
 
_i32 secured_connection
 
_u8 server_domain [MAX_SERVER_NAME]
 
_u8 rest_update_chk [MAX_PATH_PREFIX]
 
_u8 rest_rsrc_metadata [MAX_PATH_PREFIX]
 
_u8 rest_hdr [MAX_REST_HDRS_SIZE]
 
_u8 rest_hdr_val [MAX_REST_HDRS_SIZE]
 
_u8 user_name [MAX_USER_NAME_STR]
 
_u8 user_pass [MAX_USER_PASS_STR]
 
_u8 ca_cert_filename [MAX_CERT_STR]
 
_u8 client_cert_filename [MAX_CERT_STR]
 
_u8 privatekey_filename [MAX_KEY_STR]
 
_u8 log_server_name [MAX_SERVER_NAME]
 
_u8 rest_files_put [MAX_REST_HDRS_SIZE]
 
_u8 log_mac_address [6]
 
OpenFileCB pOpenFile
 
WriteFileCB pWriteFile
 
ReadFileCB pReadFile
 
CloseFileCB pCloseFile
 
AbortFileCB pAbortFile
 
_u8 cdn_url [256]
 
_i32 flags
 
_u8 rsrc_file_name [256]
 
_u8 * p_file_name
 
_i32 sflash_file_size
 
_u8 cert1_filename [64]
 
_u8 cert2_filename [64]
 
_u8 * p_cert_filename
 
_u8 signature_filename [64]
 
_u8 * p_signature
 
_u8 signature [256]
 
_i32 signature_len
 

Detailed Description

Function Documentation

_i32 sl_extLib_OtaGet ( void *  pvOtaApp,
_i32  Option,
_i32 *  OptionLen,
_u8 *  pOptionVal 
)

Get the current OTA status.

Parameters
[in]pvOtaAppOTA control block pointer
[in]OptionSelects the option
[in]OptionLenoption structure length
[in]pOptionValpointer to the option structure

This function gets the current OTA of active or Idle. The parameter option, could be one of the following:

EXTLIB_OTA_GET_OPT_IS_ACTIVE - Check if OTA process is active or idle
Value at pOptionVal will be set to 1 if OTA process is active, 0 if Idle

EXTLIB_OTA_GET_OPT_PRINT_STAT - Prints statistics

Returns
Return 0 on success, -1 otherwise.
See also
Note
Warning
Example:
For example: Get OTA running status
sl_extLib_OtaGet(pvOtaApp, EXTLIB_OTA_GET_OPT_IS_ACTIVE, &ProcActiveLen, (_u8 *)&ProcActive);
void * sl_extLib_OtaInit ( _i32  runMode,
FlcCb_t pFlcHostCb 
)

Initialize OTA application.

Parameters
[in]RunModeIs the run mode for the application
[in]pFlcHostCbPointer to file commit call back functions

This function initializes the OTA application and modules. The parameter RunMode configure the OTA lib to run with OS or noneOS, use blocking or noneBlocking calls. It can be logical OR combination of following:

-RUN_MODE_OS
-RUN_MODE_NONE_OS
-RUN_MODE_BLOCKING
-RUN_MODE_NONE_BLOCKING
The parameter pFlcHostCb is a pointer to FlcCb_t structure containing callback function to download files to storage other than SFLASH.

Returns
OTA control block pointer
See also
Note
Currently OTA supports only NON-OS Blocking mode and pFlcHostCb should be set to NULL.
Warning
Example:
For example: To initialize OTA from host invoke
pvOtaApp = sl_extLib_OtaInit(RUN_MODE_NONE_OS | RUN_MODE_BLOCKING, NULL);
_i32 sl_extLib_OtaRun ( void *  pvOtaApp)

Run the OTA App state machine.

Parameters
[in]pvOtaAppPointer to OTA application pointer

Run one step from the OTA application state machine. Host should repeat calling this function and examine the return value in order to check if OTA completed or got error or just need to be continued. This pattern is useful in host with NON-OS. In host with OS, host should start OTA task and continuously calling this function till OTA completed.

Returns
Return zero or +ve bitmap number on success, -ve otherwise.

-RUN_STAT_CONTINUE - Host should continue calling sl_extLib_OtaRun
-RUN_STAT_NO_UPDATES - No updates for now, host can retry
-RUN_STAT_DOWNLOAD_DONE - Current OTA update completed, host should test bit 2,3 to reset the MCU/NWP
-RUN_STAT_ERROR_CONTINUOUS_ACCESS_FAILURES - Fatal access error, OTA try more than 10 times to reach the OTA server and failed, it is recommended to reset the NWP.

Other negative value - OTA error, OTA can recover from this failue, host should continue calling sl_extLib_OtaRun.

See also
Note
Warning
Example:
For example: Run OTA from host
pvOtaApp = sl_extLib_OtaRun(pvOtaApp);
_i32 sl_extLib_OtaSet ( void *  pvOtaApp,
_i32  Option,
_i32  OptionLen,
_u8 *  pOptionVal 
)

Set OTA command/parameter.

Parameters
[in]pvOtaAppOTA control block pointer
[in]OptionSelect the option
[in]OptionLenOption structure length
[in]pOptionValpointer to the option structure

This function sets OTA command/parameter. The parameter Option can be one of the following:

EXTLIB_OTA_SET_OPT_SERVER_INFO - Set the Server information
EXTLIB_OTA_SET_OPT_VENDOR_ID - Set the Vendor ID string
EXTLIB_OTA_SET_OPT_COMMITED - Commit the last OTA update & move to idle

Returns
On success, zero is returned. On error, -1 is returned
See also
Note
Warning
Example:
For example: Set OTA server info from host
sl_extLib_OtaSet(pvOtaApp, EXTLIB_OTA_SET_OPT_SERVER_INFO,sizeof(g_otaOptServerInfo), (_u8 *)&g_otaOptServerInfo);
Generated on Wed Mar 4 2015 15:37:50 for CC3X00 Simplelink OTA Extlib API User's Guide by   doxygen 1.8.7