Add a route to upload update to the platform

This commit is contained in:
2024-10-05 15:50:46 +02:00
parent e1a94acdcb
commit 2f971c0055
10 changed files with 211 additions and 5 deletions

View File

@ -1,4 +1,5 @@
use crate::devices::device::{DeviceId, DeviceRelayID};
use crate::ota::ota_update::OTAPlatform;
use clap::{Parser, Subcommand};
use std::path::{Path, PathBuf};
@ -296,12 +297,14 @@ impl AppConfig {
/// Get the directory that will store OTA updates
pub fn ota_dir(&self) -> PathBuf {
self.logs_dir().join("ota")
self.storage_path().join("ota")
}
/// Get the directory that will store OTA updates of a given device reference
pub fn ota_of_device(&self, dev_ref: &str) -> PathBuf {
self.ota_dir().join(dev_ref)
/// Get the path to the file that will contain an OTA update
pub fn path_ota_update(&self, platform: OTAPlatform, version: &semver::Version) -> PathBuf {
self.ota_dir()
.join(platform.to_string())
.join(version.to_string())
}
}