@yoda/ota

Methods

(inner) runInCurrentContext(callback)

Run OTA procedure in current process context.

  1. check if prop 'persist.sys.rokid.noota' is set to truthy value
  2. lock program to prevent from concurrent multiple OTA processes;
  3. make working directory;
  4. fetch OTA info;
  5. check if new version available;
  6. check if local pending update exists;
  7. check if local image exists;
  • if image exists:
    • if image hash matches, exit 0;
    • if image hash does not match, download image;
  • if image not exists, download image;
  1. write download status to info file on local disk.
Parameters:
Name Type Description
callback module:@yoda/ota~OtaInfoCallback

(inner) runInBackground()

Run OTA procedure in background process.

(inner) getAvailableInfo(callback)

Fetch OTA info. If update available, return local stored OTA info if possible or newly fetch otherwise.

Parameters:
Name Type Description
callback module:@yoda/ota~OtaInfoCallback

(inner) getInfoIfFirstUpgradedBoot(callback)

Check if it is the first boot after an upgrade, return ota info if is, null otherwise.

Parameters:
Name Type Description
callback module:@yoda/ota~OtaInfoCallback

(inner) getInfoOfPendingUpgrade(callback)

Check if there is a pending update, return ota info if is, null otherwise.

Parameters:
Name Type Description
callback module:@yoda/ota~OtaInfoCallback

(inner) getImageDownloadProgress(info, callback)

Get download progress of given info.

Parameters:
Name Type Description
info module:@yoda/ota~OtaInfo
callback function

(inner) getMqttOtaReport(callback)

Get a report for apps presenting current OTA informations.

Parameters:
Name Type Description
callback function

Type Definitions

OtaInfo

Properties:
Name Type Description
imageUrl string

fetched from cloudgw

authorize string

fetched from cloudgw

changelog string

fetched from cloudgw

checksum string

fetched from cloudgw

isForceUpdate boolean

fetched from cloudgw

version string

fetched from cloudgw

imagePath string

generated field

status string

generated field, enum for downloaded, downloading

OtaInfoCallback(error, info)

Parameters:
Name Type Description
error Error
info module:@yoda/ota~OtaInfo