open_protocol/messages/
tool.rs

1use chrono::{DateTime, Local};
2use open_protocol_codec_proc_macro::{OpenProtocolDecode, OpenProtocolEncode, OpenProtocolMessage};
3
4#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
5#[open_protocol_message(MID = 40, revision = 6)]
6pub struct MID0040rev6 {
7    /// The tool number for which the data is being requested
8    #[open_protocol_field(length = 4)]
9    pub tool_number: u16,
10}
11
12#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
13#[open_protocol_message(MID = 41, revision = 1)]
14pub struct MID0041rev1 {
15    /// The serial number of the tool
16    #[open_protocol_field(length = 14)]
17    pub tool_serial_number: String,
18
19    /// The number of tightenings performed with this tool
20    #[open_protocol_field(length = 10)]
21    pub number_of_tightenings: u32,
22
23    /// The date of the last calibration of the tool
24    #[open_protocol_field(length = 19)]
25    pub last_calibration_date: DateTime<Local>,
26
27    /// The serial number of the controller or RBU type
28    #[open_protocol_field(length = 10)]
29    pub controller_serial_number: String,
30}
31
32#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
33#[open_protocol_message(MID = 41, revision = 2)]
34pub struct MID0041rev2 {
35    /// The serial number of the tool
36    #[open_protocol_field(length = 14)]
37    pub tool_serial_number: String,
38
39    /// The number of tightenings performed with this tool
40    #[open_protocol_field(length = 10)]
41    pub number_of_tightenings: u32,
42
43    /// The date of the last calibration of the tool
44    #[open_protocol_field(length = 19)]
45    pub last_calibration_date: DateTime<Local>,
46
47    /// The serial number of the controller or RBU type
48    #[open_protocol_field(length = 10)]
49    pub controller_serial_number: String,
50
51    /// Calibration value of the tool
52    #[open_protocol_field(length = 6)]
53    pub calibration_value: u32,
54
55    /// Date of the last service for the tool
56    #[open_protocol_field(length = 19)]
57    pub last_service_date: DateTime<Local>,
58
59    /// Number of tightenings since the last service
60    #[open_protocol_field(length = 10)]
61    pub tightenings_since_service: u32,
62
63    /// Type of tool
64    #[open_protocol_field(length = 2)]
65    pub tool_type: u8,
66}
67
68#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
69#[open_protocol_message(MID = 42, revision = 2)]
70pub struct MID0042rev2 {
71    /// The tool number to disable
72    #[open_protocol_field(length = 4)]
73    pub tool_number: u16,
74
75    /// The type of disable action
76    #[open_protocol_field(length = 2)]
77    pub disable_type: u8,
78}
79
80#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
81#[open_protocol_message(MID = 43, revision = 2)]
82pub struct MID0043rev2 {
83    /// The tool number to enable
84    #[open_protocol_field(length = 4)]
85    pub tool_number: u16,
86}
87
88#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
89#[open_protocol_message(MID = 44, revision = 1)]
90pub struct MID0044rev1 {
91    // Request to allow the tool to be disconnected
92}
93
94#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
95#[open_protocol_message(MID = 45, revision = 1)]
96pub struct MID0045rev1 {
97    /// The unit of the calibration value
98    #[open_protocol_field(length = 1)]
99    pub calibration_value_unit: u8,
100
101    /// The calibration value to set
102    #[open_protocol_field(length = 6)]
103    pub calibration_value: u32,
104}
105
106#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
107#[open_protocol_message(MID = 45, revision = 2)]
108pub struct MID0045rev2 {
109    /// The unit of the calibration value
110    #[open_protocol_field(length = 1)]
111    pub calibration_value_unit: u8,
112
113    /// The calibration value to set
114    #[open_protocol_field(length = 6)]
115    pub calibration_value: u32,
116
117    /// The channel number for calibration
118    #[open_protocol_field(length = 2)]
119    pub channel_number: u8,
120}
121
122#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
123#[open_protocol_message(MID = 46, revision = 1)]
124pub struct MID0046rev1 {
125    /// The tool to be set as the primary tool
126    #[open_protocol_field(length = 2)]
127    pub primary_tool: u8,
128}
129
130#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
131#[open_protocol_message(MID = 47, revision = 1)]
132pub struct MID0047rev1 {
133    /// Type of pairing handling action
134    #[open_protocol_field(length = 2)]
135    pub pairing_handling_type: u8,
136}
137
138#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
139#[open_protocol_message(MID = 48, revision = 1)]
140pub struct MID0048rev1 {
141    /// Current status of the tool pairing
142    #[open_protocol_field(length = 2)]
143    pub pairing_status: u8,
144
145    /// Timestamp of the status change
146    #[open_protocol_field(length = 19)]
147    pub timestamp: DateTime<Local>,
148}