open_protocol/messages/
multi_spindle_status.rs

1use chrono::{DateTime, Local};
2use open_protocol_codec_proc_macro::{OpenProtocolDecode, OpenProtocolEncode, OpenProtocolMessage};
3
4/// A subscription for the multi-spindle status.
5/// For Power Focus, the subscription must be addressed to the sync Master.
6#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
7#[open_protocol_message(MID = 90, revision = 1)]
8pub struct MID0090rev1 {
9    // No additional fields for this MID.
10}
11
12/// The multi-spindle status is sent after each sync tightening.
13/// It contains both the common status of the multiple and the individual status of each spindle.
14#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
15#[open_protocol_message(MID = 91, revision = 1)]
16pub struct MID0091rev1 {
17    /// The number of spindles in the tightening.
18    #[open_protocol_field(length = 2)]
19    pub number_of_spindles: u8,
20
21    /// The number of spindles currently running in the multiple.
22    #[open_protocol_field(length = 2)]
23    pub spindles_running: u8,
24
25    /// A unique ID for each sync tightening result.
26    #[open_protocol_field(length = 5)]
27    pub sync_tightening_id: u32,
28
29    /// Timestamp for the multi-spindle status (YYYY-MM-DD:HH:MM:SS).
30    #[open_protocol_field(length = 19)]
31    pub timestamp: DateTime<Local>,
32
33    /// The overall status of the sync tightening (1=OK, 0=NOK).
34    #[open_protocol_field(length = 1)]
35    pub sync_overall_status: u8,
36
37    /// The status of each spindle in the multiple.
38    #[open_protocol_field(list, amount = "number_of_spindles", length = 5)]
39    pub spindle_statuses: Vec<SpindleStatus>,
40}
41
42/// Acknowledges receipt of MID 0091 Multi-Spindle Status.
43#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
44#[open_protocol_message(MID = 92, revision = 1)]
45pub struct MID0092rev1 {
46    // No additional fields for this MID.
47}
48
49/// Cancels a previously subscribed multi-spindle status notification.
50#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
51#[open_protocol_message(MID = 93, revision = 1)]
52pub struct MID0093rev1 {
53    // No additional fields for this MID.
54}
55
56/// Status of an individual spindle in a multi-spindle tightening.
57#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode)]
58pub struct SpindleStatus {
59    /// The spindle number within the multiple.
60    #[open_protocol_field(length = 2)]
61    pub spindle_number: u8,
62
63    /// The channel ID of the spindle.
64    #[open_protocol_field(length = 2)]
65    pub channel_id: u8,
66
67    /// The overall status of the tightening for this spindle (0=NOK, 1=OK).
68    #[open_protocol_field(length = 1)]
69    pub overall_status: u8,
70}