re-work ACS

This commit is contained in:
Robin Mueller
2026-03-12 15:54:51 +01:00
parent cfcfabb5e3
commit 2de2898ba4
7 changed files with 216 additions and 124 deletions
+7
View File
@@ -152,11 +152,18 @@ pub trait Message {
fn message_type(&self) -> MessageType;
}
/// Generic device mode which covers the requirements of most devices.
///
/// The states are related both to the physical and the logical state of the device. Some
/// device handlers control the power supply of their own device and an off state might also
/// mean that the device is physically off.
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Eq, Copy, Clone)]
pub enum DeviceMode {
Off = 0,
On = 1,
/// Normal operation mode where periodic polling might be done as well.
Normal = 2,
Unknown = 3,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
+7
View File
@@ -51,10 +51,16 @@ pub mod response {
MgmData(MgmData),
}
#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, Debug)]
pub enum ModeFailure {
Timeout,
}
#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, Debug)]
pub enum Response {
Ok,
Hk(HkResponse),
ModeFailure(ModeFailure),
}
impl Response {
@@ -62,6 +68,7 @@ pub mod response {
match self {
Response::Ok => crate::MessageType::Verification,
Response::Hk(_hk_response) => crate::MessageType::Hk,
Response::ModeFailure(_mode_failure) => crate::MessageType::Mode,
}
}
}