Add route to download firmware on device

This commit is contained in:
2024-10-05 20:00:57 +02:00
parent 37844ae5fa
commit aa262879f0
4 changed files with 35 additions and 1 deletions

View File

@ -25,6 +25,12 @@ pub fn save_update(
Ok(())
}
/// Get the content of an OTA update
pub fn get_ota_update(platform: OTAPlatform, version: &semver::Version) -> anyhow::Result<Vec<u8>> {
let path = AppConfig::get().path_ota_update(platform, version);
Ok(std::fs::read(path)?)
}
/// Get the list of OTA software updates for a platform
pub fn get_ota_updates_for_platform(platform: OTAPlatform) -> anyhow::Result<Vec<OTAUpdate>> {
let ota_path = AppConfig::get().ota_platform_dir(platform);