3.2.6.8.3 OTA Services Interface

OTA Service Enum

typedef enum
{  
    SYS_RNWF_OTA_ENABLE,                /**<Connected to MQTT broker event */
    SYS_RNWF_OTA_DISABLE,               /**<Connected to MQTT broker event */
    SYS_RNWF_OTA_REQUEST,                /**<Connected to MQTT broker event */
    SYS_RNWF_OTA_SET_CALLBACK,          /**<Register OTA application callback*/
    SYS_RNWF_OTA_SET_SRVC_CALLBACK,
    SYS_RNWF_OTA_AUTO_MODE,             /**<OTA Auto mode, triggered reqularly*/
    SYS_RNWF_OTA_DFU_INIT,           /**<OTA Trigger, Actual programming start*/
    SYS_RNWF_OTA_DFU_WRITE,             /**<OTA Write, Writes the FW max 4096 bytes*/
    SYS_RNWF_OTA_DFU_ERASE,             /**<OTA Erase, Erases the given size*/
    SYS_RNWF_OTA_DFU_ERROR,
    SYS_RNWF_OTA_DFU_IDLE,
}SYS_RNWF_OTA_SERVICE_t;

RNWF OTA Event Enum

OTA Service Event list.
typedef enum
{
    SYS_RNWF_EVENT_MAKE_UART,   /**<Change to UART mode */
    SYS_RNWF_EVENT_DWLD_START,  /**<FW Download complete */
    SYS_RNWF_EVENT_DWLD_DONE,   /**<FW Download complete */
     
}SYS_RNWF_OTA_EVENT_t;

RNWF OTA Modes Enum

typedef enum
{
    SYS_RNWF_OTA_EVENT_MAKE_UART,       /**<Change to UART mode */
    SYS_RNWF_OTA_EVENT_IMAGE_INFO,      /**<Inform Image details */
    SYS_RNWF_OTA_EVENT_FILE_CHUNK,      /**<FW Downloaded file chunk */
    SYS_RNWF_OTA_EVENT_DWLD_START,      /**<FW Download complete */
    SYS_RNWF_OTA_EVENT_DWLD_DONE,       /**<FW Download done */
    SYS_RNWF_OTA_EVENT_DOWNLOAD_FAIL,
    SYS_RNWF_OTA_EVENT_CONFIG_INFO,
}SYS_RNWF_OTA_EVENT_t;

OTA Chunk Header Struct

OTA Chunk struct:
typedef struct
{
    uint32_t chunk_addr; 
    uint32_t chunk_size;    
    uint8_t  *chunk_ptr;    
}SYS_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;  
}SYS_RNWF_OTA_HDR_t;

OTA Configuration Parameters Enum

typedef enum
{
    SYS_RNWF_OTA_CFG_PARAM_PORT,
    SYS_RNWF_OTA_CFG_PARAM_SERVER,
    SYS_RNWF_OTA_CFG_PARAM_FILE,
    SYS_RNWF_OTA_CFG_PARAM_TYPE,
    SYS_RNWF_OTA_CFG_PARAM_MAX,
}SYS_RNWF_OTA_CFG_PARAM_t;

OTA Configuration Struct

typedef struct
{
    SYS_RNWF_NET_SOCKET_t socket;               /**<Socket handler for HTTP link*/
    SYS_RNWF_OTA_MODES_t mode;                  /**<Active OTA mode */
    SYS_RNWF_OTA_IMAGE_t type;                  /**<Image type */
    const char      *file;                  /**<Image File Name */
    const char      *certificate;
}SYS_RNWF_OTA_CFG_t;

OTA Image Enum

typedef enum
{
    SYS_RNWF_OTA_LOW_FW,        /**<FW at lower slot */
    SYS_RNWF_OTA_HIGH_FW,       /**<FW at higher slot */
    SYS_RNWF_OTA_FILESYSTEM,    /**<Files system slot*/
}SYS_RNWF_OTA_IMAGE_t;