Display the list of OTA updates in the frontend

This commit is contained in:
2024-10-08 21:53:21 +02:00
parent 2924d14281
commit 6cf7c2cae1
8 changed files with 113 additions and 5 deletions

View File

@ -49,3 +49,14 @@ pub fn get_ota_updates_for_platform(platform: OTAPlatform) -> anyhow::Result<Vec
Ok(out)
}
/// Get all the available OTA updates
pub fn get_all_ota_updates() -> anyhow::Result<Vec<OTAUpdate>> {
let mut out = vec![];
for p in OTAPlatform::supported_platforms() {
out.append(&mut get_ota_updates_for_platform(*p)?)
}
Ok(out)
}

View File

@ -7,6 +7,13 @@ pub enum OTAPlatform {
Wt32Eth01,
}
impl OTAPlatform {
/// Get the list of supported platforms
pub fn supported_platforms() -> &'static [Self] {
&[OTAPlatform::Wt32Eth01]
}
}
impl Display for OTAPlatform {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let s = serde_json::to_string(&self).unwrap().replace('"', "");