#ifndef __IKONKE_MODULE_OTA_H_______________________
#define __IKONKE_MODULE_OTA_H_______________________
#include "tl_common.h"


#define OTA_UPGRADE__CONTINUE_MAX_TIME_MS   (16*60*1000)

#define OTA_GPIO_RESTORE_MAXN	8


typedef enum{OTA_NORMAL=0, OTA_START,OTA_DOWNLOAD_DONE, OTA_VERITY_SUCCEED, OTA_FAILED}OTAStatusEnum;
typedef enum{OTA_GPIO_OFF=0, OAT_GPIO_ON}OTAGpioEnum;

#pragma pack(1)  //按1字节对齐
typedef  struct {
  	uint32_t pin;
  	bool bStatus; // on/off
  }OTAGpioListSt;
#pragma pack()    //取消自定义字节对齐方式

#pragma pack(1)  //按1字节对齐
  typedef struct {
	bool bIsValid;
  	uint8_t gpioNum;
  	OTAGpioListSt gpio[OTA_GPIO_RESTORE_MAXN];
  }OTAGpioStatusST;
#pragma pack()    //取消自定义字节对齐方式


//OTA操作函数，一般操作用来操作led
typedef void (*pOTACallback)(OTAStatusEnum status);

//获取当前产测状态
OTAStatusEnum kGetOTAStatus(void);
void kSetOTAStatus(OTAStatusEnum status);

void kOTAMoudleInit(pOTACallback callback, uint8_t led_id);

void kOTAMoudleCallback(OTAStatusEnum status);

#endif

