Firmware OTA API

Firmware over-the-air update API.

Example Usage

#include <fota.h>

/* Initialize fota and add fota command to console */
fota_init();

/* to programatically start fota */
fota_start("http://url/to/fota/firmware");

/* To register fota using Logicrom Device management console */
/*
 * First parameter is application firmware code, a unique code
 * registered on server.
 *
 * Second parameter is current version of application firmware
 */
logicrom_fota_register("FWCODE", "1.0.0");

API Reference

Header File

Source: include/fota.h

#include <fota.h>

Functions

int fota_init(void)

Add fota command to CLI

Usage: fota=[url]

Returns

returns 0

int fota_start(const char *in_url)

Start Firmware Update

Parameters

in_url – [in] HTTP URL to download firmware

Returns

0 on success, negative value on error

int fota_in_progress(void)

Get OTA status

Returns

Return 1 if FOTA in progress, 0 otherwise

int logicrom_fota_register(const char *code, const char *ver)

Register with Logicrom FOTA server for automatic firmware updates via Device management console. Automatic firmware update is checked once a day on server.

This function also add additional options in “fota” command

To check update on server

fota=check

To force download firmware

fota=download

To manually update firmware

fota=update

Parameters
  • code – Firmware code to identify application

  • ver – current firmware version

Returns

return 0 on success, negative value on failure