96 gpfOtaUpdateCb(strOtaUpdateStatusResp.u8OtaUpdateStatusType,strOtaUpdateStatusResp.u8OtaUpdateStatus);
101 M2M_ERR(
"Invaild OTA resp %d ?\n",u8OpCode);
128 M2M_ERR(
"Invaild Ota update cb\n");
133 M2M_ERR(
"Invaild Ota notify cb\n");
307 #define M2M_OTA_FILE "../../../m2m_ota.dat" 315 fp = fopen(M2M_OTA_FILE,
"rb");
318 fseek(fp, 0L, SEEK_END);
320 fseek(fp, 0L, SEEK_SET);
325 page = (rand()%1400);
327 if((page<100)||(page>1400)) page = 1400;
339 printf(
"page %d\n", (
int)page);
340 fread(buffer,page,1,fp);
static tpfOtaNotifCb gpfOtaNotifCb
This module contains common APIs declarations.
#define M2M_HIF_BLOCK_VALUE
signed char sint8
Range of values between -128 to 127.
NMI_API sint8 m2m_ota_notif_check_for_update(void)
check for ota update
NMI_API sint8 m2m_ota_notif_sched(uint32 u32Period)
Schedule OTA update.
NMI_API sint8 m2m_ota_start_update(uint8 *u8DownloadUrl)
Request OTA start update using the downloaded url.
NMI_API sint8 m2m_ota_rollback(void)
Request OTA Rollback image.
WINC3400 IoT Application Interface Internal Types.
NMI_API sint8 m2m_ota_notif_set_url(uint8 *u8Url)
Set the OTA url.
unsigned short uint16
Range of values between 0 to 65535.
This struct contains the OTA update information.
WINC3400 IoT Application Interface.
sint8 hif_register_cb(uint8 u8Grp, tpfHifCallBack fn)
void nm_bsp_sleep(uint32 u32TimeMsec)
NMI_API void m2m_memset(uint8 *pBuf, uint8 val, uint32 sz)
Set specified number of data bytes in specified data buffer to specified value.
WINC3400 IoT OTA Interface.
NMI_API uint16 m2m_strlen(uint8 *pcStr)
Returns the string length of a null terminated string buffer.
uint16 u16FirmwareHifInfo
void(* tpfOtaUpdateCb)(uint8 u8OtaUpdateStatusType, uint8 u8OtaUpdateStatus)
A callback to get OTA status update, the callback provides the download status, the switch to the dow...
sint8 hif_send(uint8 u8Gid, uint8 u8Opcode, uint8 *pu8CtrlBuf, uint16 u16CtrlBufSize, uint8 *pu8DataBuf, uint16 u16DataSize, uint16 u16DataOffset)
Send packet using host interface.
NMI_API sint8 m2m_ota_switch_firmware(void)
Switch to the upgraded Firmware.
unsigned long uint32
Range of values between 0 to 4294967295.
static void m2m_ota_cb(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr)
static tpfOtaUpdateCb gpfOtaUpdateCb
void(* tpfOtaNotifCb)(tstrOtaUpdateInfo *pstrOtaUpdateInfo)
A callback to get notification about a potential OTA update.
unsigned char uint8
Range of values between 0 to 255.
This struct contains the OTA update status.
NMI_API sint8 m2m_ota_get_firmware_version(tstrM2mRev *pstrRev)
Synchronous API to obtain the firmware version of the WINC image that is stored in the inactive flash...
This module contains M2M host interface APIs implementation.
NMI_API sint8 m2m_ota_init(tpfOtaUpdateCb pfOtaUpdateCb, tpfOtaNotifCb pfOtaNotifCb)
Initialize the OTA layer.
#define M2M_GET_HIF_BLOCK(hif_info)
Structure holding firmware version parameters and build date/time.
NMI_API sint8 m2m_ota_abort(void)
Request OTA Abort.
sint8 hif_receive(uint32 u32Addr, uint8 *pu8Buf, uint16 u16Sz, uint8 isDone)