diff --git a/central_backend/src/app_config.rs b/central_backend/src/app_config.rs index f443418..b2a21e8 100644 --- a/central_backend/src/app_config.rs +++ b/central_backend/src/app_config.rs @@ -293,6 +293,16 @@ impl AppConfig { pub fn log_of_day(&self, day: u64) -> PathBuf { self.logs_dir().join(format!("{day}.log")) } + + /// Get the directory that will store OTA updates + pub fn ota_dir(&self) -> PathBuf { + self.logs_dir().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) + } } #[cfg(test)] diff --git a/central_backend/src/main.rs b/central_backend/src/main.rs index 23fbac9..76de370 100644 --- a/central_backend/src/main.rs +++ b/central_backend/src/main.rs @@ -20,6 +20,7 @@ async fn main() -> std::io::Result<()> { create_directory_if_missing(AppConfig::get().relays_runtime_stats_storage_path()).unwrap(); create_directory_if_missing(AppConfig::get().energy_consumption_history()).unwrap(); create_directory_if_missing(AppConfig::get().logs_dir()).unwrap(); + create_directory_if_missing(AppConfig::get().ota_dir()).unwrap(); // Initialize PKI pki::initialize_root_ca().expect("Failed to initialize Root CA!"); diff --git a/central_backend/src/server/servers.rs b/central_backend/src/server/servers.rs index 44b0a6d..39ba213 100644 --- a/central_backend/src/server/servers.rs +++ b/central_backend/src/server/servers.rs @@ -180,6 +180,13 @@ pub async fn secure_server(energy_actor: EnergyActorAddr) -> anyhow::Result<()> "/web_api/device/{id}", web::delete().to(devices_controller::delete_device), ) + // OTA API + // TODO : list supported platform references + // TODO : upload a new software update + // TODO : list ota software update per platform + // TODO : download a OTA file + // TODO : delete an OTA file + // TODO : deploy an update to a device // Logging controller API .route( "/web_api/logging/logs",