| | |
| | | } |
| | | |
| | | if (isBoolean) { |
| | | uniCallbackData(type, null, 0, "写入新驱动文件到内存成功", callback); |
| | | uniCallbackData(type, null, 0, HDLApp.getInstance().getString(R.string.writing_firmware_upgrade_memory_succeeded), callback); |
| | | } else { |
| | | uniCallbackData(type, null, -2, "下载固件升级文件失败", callback); |
| | | uniCallbackData(type, null, -2, HDLApp.getInstance().getString(R.string.download_firmware_upgrade_file_failed), callback); |
| | | } |
| | | } |
| | | }); |
| | |
| | | String firmwarePathFileName = HdlFileLogic.getInstance().getFirmwarePathFileName(oid, imageId, version); |
| | | byte[] data = HdlFileLogic.getInstance().readFileByte(firmwarePathFileName); |
| | | if (data == null || data.length == 0) { |
| | | uniCallbackData(type, null, -2, "本地找不到升级固件文件,请下载好固件文件,再重新升级.", callback); |
| | | uniCallbackData(type, null, -2, HDLApp.getInstance().getString(R.string.found_locally_firmware_upgrade_file), callback); |
| | | return; |
| | | } |
| | | String md5 = HDLMD5Utils.encodeMD5(data);//网关固件需要 |
| | |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | uniCallbackData(type, null, -2, "通知给网关升级固件文件地址失败,无法升级,", callback); |
| | | uniCallbackData(type, null, -2, HDLApp.getInstance().getString(R.string.notify_gateway_firmware_upgrade_failed), callback); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onServiceDisconnected(ComponentName name) { |
| | | uniCallbackData(type, null, -2, "本地服务有异常失败,无法升级,", callback); |
| | | uniCallbackData(type, null, -2, HDLApp.getInstance().getString(R.string.local_service_fails), callback); |
| | | } |
| | | }); |
| | | } else { |
| | |
| | | HdlFileLogic.getInstance().deleteFile(drivePathFileName);//下载失败,删除不完整驱动文件; |
| | | } |
| | | if (isBoolean) { |
| | | uniCallbackData(type, null, 0, "写入新驱动文件到内存成功", callback); |
| | | uniCallbackData(type, null, 0, HDLApp.getInstance().getString(R.string.writing_drive_memory_succeeded), callback); |
| | | } else { |
| | | uniCallbackData(type, null, -2, "下载驱动升级文件失败", callback); |
| | | uniCallbackData(type, null, -2, HDLApp.getInstance().getString(R.string.download_drive_file_failed), callback); |
| | | } |
| | | } |
| | | }); |
| | |
| | | String drivePathFileName = HdlFileLogic.getInstance().getDrivePathFileName(driverCode, version); |
| | | byte[] data = HdlFileLogic.getInstance().readFileByte(drivePathFileName); |
| | | if (data == null || data.length == 0) { |
| | | uniCallbackData(type, null, -2, "本地找不到升级驱动文件,请下载好驱动文件,再重新升级.", callback); |
| | | uniCallbackData(type, null, -2, HDLApp.getInstance().getString(R.string.found_locally_drive_file), callback); |
| | | return; |
| | | } |
| | | String md5 = HDLMD5Utils.encodeMD5(data);//网关驱动需要 |
| | |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | uniCallbackData(type, null, -2, "通知给网关升级驱动文件地址失败,无法升级,", callback); |
| | | uniCallbackData(type, null, -2, HDLApp.getInstance().getString(R.string.notify_gateway_drive_failed), callback); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onServiceDisconnected(ComponentName name) { |
| | | uniCallbackData(type, null, -2, "本地服务有异常失败,无法升级,", callback); |
| | | uniCallbackData(type, null, -2, HDLApp.getInstance().getString(R.string.local_service_fails), callback); |
| | | } |
| | | }); |
| | | } else { |
| | |
| | | */ |
| | | private void uniCancelDownloadingUpgradeFile(String type, Object data, DCUniMPJSCallback callback) { |
| | | HdlOtaLogic.getInstance().stopDownloadUpgradeFile(); |
| | | uniCallbackData(type, null, 0, "取消下载成功.", callback); |
| | | uniCallbackData(type, null, 0, HDLApp.getInstance().getString(R.string.cancel_download_successfully), callback); |
| | | } |
| | | |
| | | /** |