WINC1500 IoT Software APIs: m2m_ota_start_update

WINC1500 IoT Software API

WINC1500 IoT Software APIs  19.5.2
WINC Software API Reference Manual
m2m_ota_start_update

Functions

NMI_API sint8 m2m_ota_start_update (uint8 *u8DownloadUrl)
 
NMI_API sint8 m2m_ota_start_update_crt (uint8 *u8DownloadUrl)
 

Detailed Description

Request OTA start update using the downloaded URL, the OTA module will download the OTA image and ensure integrity of the image, and update the validity of the image in control structure. Switching to that image requires calling m2m_ota_switch_firmware API. As a prerequisite m2m_ota_init should be called before using m2m_ota_start().

Request OTA start for cortus application image using the downloaded URL, the OTA module will download the OTA image and ensure integrity of the image, and update the validity of the image in control structure. Switching to that image requires calling m2m_ota_switch_crt API. As a prerequisite m2m_ota_init should be called before using m2m_ota_start_update_crt().

Function Documentation

◆ m2m_ota_start_update()

NMI_API sint8 m2m_ota_start_update ( uint8 u8DownloadUrl)
Parameters
[in]u8DownloadUrlThe download firmware URL, you get it from device info according to the application server
Warning
Calling this API does not guarantee OTA WINC image update, It depends on the connection with the download server and the validity of the image. If the API response is failure this may invalidate the roll-back image if it was previously valid, since the WINC does not have any internal memory except the flash roll-back image location to validate the downloaded image from
See also
m2m_ota_init tpfOtaUpdateCb
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.

Example

The example shows an example of how the OTA image update is carried out.

static void OtaUpdateCb(uint8 u8OtaUpdateStatusType ,uint8 u8OtaUpdateStatus)
{
if(u8OtaUpdateStatusType == DL_STATUS) {
if(u8OtaUpdateStatus == OTA_STATUS_SUCSESS) {
//switch to the upgraded firmware
}
}
else if(u8OtaUpdateStatusType == SW_STATUS) {
if(u8OtaUpdateStatus == OTA_STATUS_SUCSESS) {
M2M_INFO("Now OTA successfully done");
//start the host SW upgrade then system reset is required (Reinitialize the driver)
}
}
}
void wifi_event_cb(uint8 u8WiFiEvent, void * pvMsg)
{
{
//after successfully connection, start the over air upgrade
}
break;
default:
break;
}
int main (void)
{
tstr1xAuthCredentials gstrCred1x = AUTH_CREDENTIALS;
m2m_memset((uint8*)&param, 0, sizeof(param));
param.pfAppWifiCb = wifi_event_cb;
//Initialize the WINC Driver
ret = m2m_wifi_init(&param);
if (M2M_SUCCESS != ret)
{
M2M_ERR("Driver Init Failed <%d>\n",ret);
while(1);
}
//Initialize the OTA module
m2m_ota_init(OtaUpdateCb,NULL);
//connect to AP that provide connection to the OTA server
while(1)
{
//Handle the app state machine plus the WINC event handler
}
}
}

◆ m2m_ota_start_update_crt()

NMI_API sint8 m2m_ota_start_update_crt ( uint8 u8DownloadUrl)
Parameters
[in]u8DownloadUrlThe cortus application image url.
Warning
Calling this API does not guarantee cortus application image update, It depends on the connection with the download server and the validity of the image. If the API response is failure this may invalidate the roll-back image if it was previously valid, since the WINC does not have any internal memory except the flash roll-back image location to validate the downloaded image from
See also
m2m_ota_init tpfOtaUpdateCb
Returns
The function returns M2M_SUCCESS for successful operations and a negative value otherwise.
Generated on Thu Jan 26 2017 22:15:21 for WINC1500 IoT Software APIs by   doxygen 1.8.13