Display the list of OTA updates in the frontend
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
@ -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('"', "");
|
||||
|
Reference in New Issue
Block a user