Get the list of OTA updates for a given platform
This commit is contained in:
@ -189,7 +189,11 @@ pub async fn secure_server(energy_actor: EnergyActorAddr) -> anyhow::Result<()>
|
||||
"/web_api/ota/{platform}/{version}",
|
||||
web::post().to(ota_controller::upload_firmware),
|
||||
)
|
||||
// TODO : list ota software update per platform
|
||||
// TODO : list all ota software updates
|
||||
.route(
|
||||
"/web_api/ota/{platform}",
|
||||
web::get().to(ota_controller::list_updates_platform),
|
||||
)
|
||||
// TODO : download a OTA file
|
||||
// TODO : delete an OTA file
|
||||
.route(
|
||||
|
@ -53,6 +53,18 @@ pub async fn upload_firmware(
|
||||
Ok(HttpResponse::Accepted().body("OTA update successfully saved."))
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct ListOTAPath {
|
||||
platform: OTAPlatform,
|
||||
}
|
||||
|
||||
/// List OTA software updates for a given platform
|
||||
pub async fn list_updates_platform(path: web::Path<ListOTAPath>) -> HttpResult {
|
||||
let list = ota_manager::get_ota_updates_for_platform(path.platform)?;
|
||||
|
||||
Ok(HttpResponse::Ok().json(list))
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct SetDesiredDeviceVersion {
|
||||
devices: Option<Vec<DeviceId>>,
|
||||
|
Reference in New Issue
Block a user