open_protocol/messages/
powermacs_result.rs

1use chrono::{DateTime, Local};
2use open_protocol_codec_proc_macro::{OpenProtocolDecode, OpenProtocolEncode, OpenProtocolMessage};
3
4/// Subscribe to the last PowerMACS tightening result data.
5#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
6#[open_protocol_message(MID = 105, revision = 1)]
7pub struct MID0105rev1 {
8    // No additional fields for this MID.
9}
10
11/// The last PowerMACS tightening result station data.
12/// This contains summary information about the tightening station.
13#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
14#[open_protocol_message(MID = 106, revision = 1)]
15pub struct MID0106rev1 {
16    /// The station number where the tightening occurred.
17    #[open_protocol_field(length = 4)]
18    pub station_number: u16,
19
20    /// The name of the station.
21    #[open_protocol_field(length = 25)]
22    pub station_name: String,
23
24    /// The batch size for this station.
25    #[open_protocol_field(length = 4)]
26    pub batch_size: u16,
27
28    /// The current batch counter.
29    #[open_protocol_field(length = 4)]
30    pub batch_counter: u16,
31
32    /// The timestamp when the batch started.
33    #[open_protocol_field(length = 19)]
34    pub batch_start_time: DateTime<Local>,
35
36    /// The batch status (0=NOK, 1=OK, 2=Not used, 3=Running).
37    #[open_protocol_field(length = 1)]
38    pub batch_status: u8,
39
40    /// The tightening ID of the last operation.
41    #[open_protocol_field(length = 10)]
42    pub tightening_id: u32,
43}
44
45/// The last PowerMACS tightening result bolt data.
46/// This contains details about the individual bolts involved in the tightening.
47#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
48#[open_protocol_message(MID = 107, revision = 1)]
49pub struct MID0107rev1 {
50    /// The number of bolts included in the tightening operation.
51    #[open_protocol_field(length = 3)]
52    pub number_of_bolts: u16,
53
54    /// Data for each bolt in the tightening.
55    #[open_protocol_field(list, amount = "number_of_bolts", length = 10)]
56    pub bolt_data: Vec<BoltData>,
57}
58
59/// Details of an individual bolt in the tightening result.
60#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode)]
61pub struct BoltData {
62    /// The bolt number.
63    #[open_protocol_field(length = 4)]
64    pub bolt_number: u32,
65
66    /// The torque applied to the bolt.
67    #[open_protocol_field(length = 6)]
68    pub bolt_torque: u32,
69
70    /// The angle applied to the bolt.
71    #[open_protocol_field(length = 5)]
72    pub bolt_angle: u16,
73}
74
75/// Acknowledge receipt of PowerMACS tightening result data.
76#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
77#[open_protocol_message(MID = 108, revision = 1)]
78pub struct MID0108rev1 {
79    // No additional fields for this MID.
80}
81
82/// Unsubscribe from the PowerMACS tightening result data.
83#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
84#[open_protocol_message(MID = 109, revision = 1)]
85pub struct MID0109rev1 {
86    // No additional fields for this MID.
87}