rsiot/components/cmp_plc/plc/library/drives/motor/
i.rs1use serde::{Deserialize, Serialize};
2
3use super::super::select_mode;
4
5#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
7pub struct I {
8    pub mode_source: bool,
12    pub mode_auto: bool,
14    pub mode_man: bool,
16    pub mode_local: bool,
18    pub mode_oos: bool,
20
21    pub intlock: bool,
23
24    pub hmi_command: IHmiCommand,
26
27    pub auto_start: bool,
29    pub auto_stop: bool,
31}
32
33#[allow(non_camel_case_types)]
35#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize)]
36pub enum IHmiCommand {
37    #[default]
39    no_command,
40
41    man_start,
43    man_stop,
45
46    mode_man,
48    mode_auto,
50    mode_local,
52    mode_oos,
54}
55
56impl From<IHmiCommand> for select_mode::IHmiCommand {
57    fn from(value: IHmiCommand) -> Self {
58        match value {
59            IHmiCommand::no_command => select_mode::IHmiCommand::no_command,
60
61            IHmiCommand::mode_man => select_mode::IHmiCommand::mode_man,
62            IHmiCommand::mode_auto => select_mode::IHmiCommand::mode_auto,
63            IHmiCommand::mode_local => select_mode::IHmiCommand::mode_local,
64            IHmiCommand::mode_oos => select_mode::IHmiCommand::mode_oos,
65
66            _ => select_mode::IHmiCommand::no_command,
67        }
68    }
69}