Can get the full list of relays through the API

This commit is contained in:
2024-07-24 23:35:58 +02:00
parent 4d5ba939d1
commit 73163e6e69
5 changed files with 43 additions and 2 deletions

View File

@ -1,6 +1,6 @@
use crate::app_config::AppConfig;
use crate::crypto::pki;
use crate::devices::device::{Device, DeviceGeneralInfo, DeviceId, DeviceInfo};
use crate::devices::device::{Device, DeviceGeneralInfo, DeviceId, DeviceInfo, DeviceRelay};
use crate::utils::time_utils::time_secs;
use openssl::x509::{X509Req, X509};
use std::collections::HashMap;
@ -192,4 +192,12 @@ impl DevicesList {
Ok(())
}
/// Get the full list of relays
pub fn relays_list(&mut self) -> Vec<DeviceRelay> {
self.0
.iter()
.flat_map(|(_id, d)| d.relays.clone())
.collect()
}
}