open_protocol/messages/
time.rs

1use chrono::{DateTime, Local};
2use open_protocol_codec_proc_macro::{OpenProtocolDecode, OpenProtocolEncode, OpenProtocolMessage};
3
4/// This message requests the current time from the controller.
5#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
6#[open_protocol_message(MID = 80, revision = 1)]
7pub struct MID0080rev1 {
8    // No additional fields for this MID.
9}
10
11/// This message contains the current system time from the controller.
12#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
13#[open_protocol_message(MID = 81, revision = 1)]
14pub struct MID0081rev1 {
15    /// The current system time in the format YYYY-MM-DD:HH:MM:SS.
16    #[open_protocol_field(length = 19)]
17    pub time: DateTime<Local>,
18}
19
20/// This message sets the system time on the controller.
21#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
22#[open_protocol_message(MID = 82, revision = 1)]
23pub struct MID0082rev1 {
24    /// The new system time to be set in the format YYYY-MM-DD:HH:MM:SS.
25    #[open_protocol_field(length = 19)]
26    pub time: DateTime<Local>,
27}