Display the list of pending devices in the UI

This commit is contained in:
2024-07-03 19:17:47 +02:00
parent 01ffe085d7
commit 716af6219a
14 changed files with 301 additions and 17 deletions

View File

@ -1,5 +1,5 @@
use crate::constants;
use crate::devices::device::{DeviceId, DeviceInfo};
use crate::devices::device::{Device, DeviceId, DeviceInfo};
use crate::devices::devices_list::DevicesList;
use crate::energy::consumption;
use crate::energy::consumption::EnergyConsumption;
@ -93,3 +93,16 @@ impl Handler<EnrollDevice> for EnergyActor {
self.devices.enroll(&msg.0, &msg.1, &msg.2)
}
}
/// Get the list of devices
#[derive(Message)]
#[rtype(result = "Vec<Device>")]
pub struct GetDeviceLists;
impl Handler<GetDeviceLists> for EnergyActor {
type Result = Vec<Device>;
fn handle(&mut self, _msg: GetDeviceLists, _ctx: &mut Context<Self>) -> Self::Result {
self.devices.full_list()
}
}