3.1.7.8.3 OTA Services Interface

OTA Service Enum

typedef enum
{
    RNWF_OTA_ENABLE,                /**<Connected to MQTT broker event */
    RNWF_OTA_DISABLE,               /**<Connected to MQTT broker event */
    RNWF_OTA_REQUEST,                /**<Connected to MQTT broker event */
    RNWF_OTA_SET_CALLBACK,          /**<Register OTA application callback*/
    RNWF_OTA_SET_SRVC_CALLBACK,
    RNWF_OTA_AUTO_MODE,             /**<OTA Auto mode, triggered reqularly*/
    RNWF_OTA_DFU_INIT,           /**<OTA Trigger, Actual programming start*/
    RNWF_OTA_DFU_WRITE,             /**<OTA Write, Writes the FW max 4096 bytes*/
    RNWF_OTA_DFU_ERASE,             /**<OTA Erase, Erases the given size*/
#ifdef RNWF11_SERVICE            
    RNWF_OTA_DFU_RESET,             /**<OTA Reset, Erases the given size*/
#endif
}RNWF_OTA_SERVICE_t;

RNWF OTA Event Enum

OTA Service Event list.
typedef enum
{
    RNWF_EVENT_MAKE_UART,       /**<Change to UART mode */
    RNWF_EVENT_IMAGE_INFO,      /**<Inform Image details */
    RNWF_EVENT_FILE_CHUNK,      /**<FW Downloaded file chunk */
    RNWF_EVENT_DWLD_START,      /**<FW Download complete */
    RNWF_EVENT_DWLD_DONE,       /**<FW Download complete */
    RNWF_EVENT_DWLD_FAIL,       /**<FW Download failed */
    RNWF_EVENT_CONFIG_INFO,
     
}RNWF_OTA_EVENT_t;

RNWF OTA Modes Enum

typedef enum 
{
    RNWF_OTA_MODE_HTTP,     /**<FW file is from HTTP server */
    RNWF_OTA_MODE_USB,      /**<FW file is from Host USB */
    RNWF_OTA_MODE_UART,     /**<FW file is from Host UART*/    
}RNWF_OTA_MODES_t;

OTA Chunk Header Struct

OTA Chunk struct:
typedef struct
{
    uint32_t chunk_addr; 
    uint32_t chunk_size;    
    uint8_t  *chunk_ptr;    
}RNWF_OTA_CHUNK_t;
OTA Header struct:
typedef struct
{
    uint32_t seq_num;
    uint32_t fw_ver;
    uint32_t start_addr;    
    uint32_t img_len;
}RNWF_OTA_HDR_t;

OTA Configuration Parameters Enum

typedef enum
{
    OTA_CFG_PARAM_PORT,
    OTA_CFG_PARAM_SERVER,
    OTA_CFG_PARAM_FILE,
    OTA_CFG_PARAM_TYPE,
    OTA_CFG_PARAM_MAX,
}OTA_CFG_PARAM_t;

OTA Configuration Struct

typedef struct
{
    RNWF_NET_SOCKET_t socket;               /**<Socket handler for HTTP link*/
    RNWF_OTA_MODES_t mode;                  /**<Active OTA mode */
    RNWF_OTA_IMAGE_t type;                  /**<Image type */
    const char      *file;                  /**<Image File Name */
    const char      *certificate;
}RNWF_OTA_CFG_t;