设备OTA开发

主动获取 OTA

设备主动上报本地固件版本,云端若有新版本便会马上下发。

IotOtaCallback_t callback = {
    .cbReceivedUpgrade = cbReceivedUpgrade,
    .cbUpgradeProgress = cbUpgradeProgress,
    .cbUpgradeStatus = cbUpgradeStatus,
    .cbNoticeUpgrade = cbNoticeUpgrade,
    .cbVersionResponse = cbVersionResponse,
    .cbStatusResponse = cbStatusResponse
};

// 开启OTA
IotOta_Init(true, false, "./", callback);

IotOta_UploadFirmwareVersion(pVersion);

主动上报升级状态

接收到云端下发的 OTA 固件相关信息后,上报当前升级的进度和状态。

IotOta_UploadUpgradeStatus(IOT_OTA_STATUS_ON, "正在升级");

升级完成后,再次上报版本

IotOta_UploadFirmwareVersion(pVersion);

results matching ""

    No results matching ""