Ejemplo n.º 1
0
        /// <summary>
        /// 升级前检查,需要用户实现
        /// </summary>
        /// <param name="otaPackage">升级包</param>
        /// <returns>如果允许升级,返回0;返回非0表示不允许升级</returns>
        public int PreCheck(OTAPackage otaPackage)
        {
            // todo 对版本号、剩余空间、剩余电量、信号质量等进行检查,如果不允许升级,上报OTAService中定义的错误码或者自定义错误码,返回-1

            ////otaService.reportOtaStatus(OTAService.OTA_CODE_NO_NEED, 0, null);

            return(0);
        }
Ejemplo n.º 2
0
        public void OnNewPackage(OTAPackage otaPackage)
        {
            this.otaPackage = otaPackage;
            Log.Info("otaPackage = " + otaPackage.ToString());

            if (PreCheck(otaPackage) != 0)
            {
                Log.Error("preCheck failed");
                return;
            }

            DownloadPackage();
        }