use chrono::{DateTime, Local};
use open_protocol_codec_proc_macro::{OpenProtocolDecode, OpenProtocolEncode, OpenProtocolMessage};
use crate::types::datafield::DataField;
use crate::types::trace::TraceSample;
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode)]
pub enum TraceType {
#[default]
#[open_protocol_value(number = 1)]
Angle,
#[open_protocol_value(number = 2)]
Torque,
#[open_protocol_value(number = 3)]
Current,
#[open_protocol_value(number = 4)]
Gradient,
#[open_protocol_value(number = 5)]
Stroke,
#[open_protocol_value(number = 6)]
Force
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode)]
pub enum ObjectType {
#[default]
#[open_protocol_value(number = 1)]
DualReading,
#[open_protocol_value(number = 2)]
TighteningProduction,
#[open_protocol_value(number = 3)]
TighteningSimulation,
#[open_protocol_value(number = 4)]
JointCheck,
#[open_protocol_value(number = 5)]
Dimensional,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0060, revision = 1)]
pub struct MID0060rev1 {
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0061, revision = 1)]
pub struct MID0061rev1 {
#[open_protocol_field(number = 1, length = 4)]
pub cell_id: u16,
#[open_protocol_field(number = 2, length = 2)]
pub channel_id: u8,
#[open_protocol_field(number = 3, length = 25)]
pub controller_name: String,
#[open_protocol_field(number = 4, length = 25)]
pub vin_number: String,
#[open_protocol_field(number = 5, length = 2)]
pub job_id: u8,
#[open_protocol_field(number = 6, length = 3)]
pub parameter_set_id: u16,
#[open_protocol_field(number = 7, length = 4)]
pub batch_size: u16,
#[open_protocol_field(number = 8, length = 4)]
pub batch_counter: u16,
#[open_protocol_field(number = 9, length = 1)]
pub tightening_status: u8,
#[open_protocol_field(number = 10, length = 1)]
pub torque_status: u8,
#[open_protocol_field(number = 11, length = 1)]
pub angle_status: u8,
#[open_protocol_field(number = 12, length = 6)]
pub torque_min_limit: u32,
#[open_protocol_field(number = 13, length = 6)]
pub torque_max_limit: u32,
#[open_protocol_field(number = 14, length = 6)]
pub torque_final_target: u32,
#[open_protocol_field(number = 15, length = 6)]
pub torque: u32,
#[open_protocol_field(number = 16, length = 5)]
pub angle_min_limit: u16,
#[open_protocol_field(number = 17, length = 5)]
pub angle_max_limit: u16,
#[open_protocol_field(number = 18, length = 5)]
pub angle_final_target: u16,
#[open_protocol_field(number = 19, length = 5)]
pub angle: u16,
#[open_protocol_field(number = 20, length = 19)]
pub timestamp: DateTime<Local>,
#[open_protocol_field(number = 21, length = 19)]
pub last_parameter_set_change: DateTime<Local>,
#[open_protocol_field(number = 22, length = 1)]
pub batch_status: u8,
#[open_protocol_field(number = 23, length = 10)]
pub tightening_id: u32,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0061, revision = 2)]
pub struct MID0061rev2 {
#[open_protocol_field(number = 1, length = 4)]
pub cell_id: u16,
#[open_protocol_field(number = 2, length = 2)]
pub channel_id: u8,
#[open_protocol_field(number = 3, length = 25)]
pub controller_name: String,
#[open_protocol_field(number = 4, length = 25)]
pub vin_number: String,
#[open_protocol_field(number = 5, length = 4)]
pub job_id: u16,
#[open_protocol_field(number = 6, length = 3)]
pub parameter_set_id: u16,
#[open_protocol_field(number = 7, length = 2)]
pub strategy: u8,
#[open_protocol_field(number = 8, length = 5)]
pub strategy_options: u32,
#[open_protocol_field(number = 9, length = 4)]
pub batch_size: u16,
#[open_protocol_field(number = 10, length = 4)]
pub batch_counter: u16,
#[open_protocol_field(number = 11, length = 1)]
pub tightening_status: u8,
#[open_protocol_field(number = 12, length = 1)]
pub batch_status: u8,
#[open_protocol_field(number = 13, length = 1)]
pub torque_status: u8,
#[open_protocol_field(number = 14, length = 1)]
pub angle_status: u8,
#[open_protocol_field(number = 15, length = 1)]
pub rundown_angle_status: u8,
#[open_protocol_field(number = 16, length = 1)]
pub current_monitoring_status: u8,
#[open_protocol_field(number = 17, length = 1)]
pub self_tap_status: u8,
#[open_protocol_field(number = 18, length = 1)]
pub prevail_torque_monitoring_status: u8,
#[open_protocol_field(number = 19, length = 1)]
pub prevail_torque_compensate_status: u8,
#[open_protocol_field(number = 20, length = 10)]
pub tightening_error_status: String,
#[open_protocol_field(number = 21, length = 6)]
pub torque_min_limit: u32,
#[open_protocol_field(number = 22, length = 6)]
pub torque_max_limit: u32,
#[open_protocol_field(number = 23, length = 6)]
pub torque_final_target: u32,
#[open_protocol_field(number = 24, length = 6)]
pub torque: u32,
#[open_protocol_field(number = 25, length = 5)]
pub angle_min_limit: u16,
#[open_protocol_field(number = 26, length = 5)]
pub angle_max_limit: u16,
#[open_protocol_field(number = 27, length = 5)]
pub angle_final_target: u16,
#[open_protocol_field(number = 28, length = 5)]
pub angle: u16,
#[open_protocol_field(number = 29, length = 5)]
pub rundown_angle_min: u16,
#[open_protocol_field(number = 30, length = 5)]
pub rundown_angle_max: u16,
#[open_protocol_field(number = 31, length = 5)]
pub rundown_angle: u16,
#[open_protocol_field(number = 32, length = 3)]
pub current_monitoring_min: u16,
#[open_protocol_field(number = 33, length = 3)]
pub current_monitoring_max: u16,
#[open_protocol_field(number = 34, length = 3)]
pub current_monitoring_value: u16,
#[open_protocol_field(number = 35, length = 6)]
pub self_tap_torque_min: u32,
#[open_protocol_field(number = 36, length = 6)]
pub self_tap_torque_max: u32,
#[open_protocol_field(number = 37, length = 6)]
pub self_tap_torque: u32,
#[open_protocol_field(number = 38, length = 6)]
pub prevail_torque_min: u32,
#[open_protocol_field(number = 39, length = 6)]
pub prevail_torque_max: u32,
#[open_protocol_field(number = 40, length = 6)]
pub prevail_torque: u32,
#[open_protocol_field(number = 41, length = 10)]
pub tightening_id: u32,
#[open_protocol_field(number = 42, length = 5)]
pub job_sequence_number: u16,
#[open_protocol_field(number = 43, length = 5)]
pub sync_tightening_id: u16,
#[open_protocol_field(number = 44, length = 14)]
pub tool_serial_number: String,
#[open_protocol_field(number = 45, length = 19)]
pub timestamp: DateTime<Local>,
#[open_protocol_field(number = 46, length = 19)]
pub last_parameter_set_change: DateTime<Local>,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0061, revision = 3)]
pub struct MID0061rev3 {
#[open_protocol_field(number = 47, length = 25)]
pub parameter_set_name: String,
#[open_protocol_field(number = 48, length = 1)]
pub torque_unit: u8,
#[open_protocol_field(number = 49, length = 2)]
pub result_type: u8,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0062, revision = 1)]
pub struct MID0062rev1 {
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0063, revision = 1)]
pub struct MID0063rev1 {
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0064, revision = 1)]
pub struct MID0064rev1 {
#[open_protocol_field(number = 1, length = 10)]
pub tightening_id: u32,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0065, revision = 1)]
pub struct MID0065rev1 {
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0066, revision = 1)]
pub struct MID0066rev1 {
#[open_protocol_field(number = 1, length = 2)]
pub number_of_offline_results: u8,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0066, revision = 2)]
pub struct MID0066rev2 {
#[open_protocol_field(number = 1, length = 3)]
pub number_of_offline_results: u16,
#[open_protocol_field(number = 2, length = 3)]
pub number_of_offline_curves: u16,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0067, revision = 1)]
pub struct MID0067rev1 {
#[open_protocol_field(number = 1, length = 10)]
pub start_index: u32,
#[open_protocol_field(number = 2, length = 3)]
pub count: u16,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0900, revision = 1)]
pub struct MID0900rev1 {
#[open_protocol_field(length = 10)]
pub result_data_id: u32,
#[open_protocol_field(length = 19)]
pub timestamp: DateTime<Local>,
#[open_protocol_field(length = 3)]
pub number_of_pids: u16,
#[open_protocol_field(list, amount = "number_of_pids")]
pub data_fields: Vec<DataField>,
#[open_protocol_field(length = 2)]
pub trace_type: TraceType,
#[open_protocol_field(length = 2)]
pub transducer_type: u8,
#[open_protocol_field(length = 3)]
pub unit: u16,
#[open_protocol_field(length = 3)]
pub number_of_parameter_fields: u16,
#[open_protocol_field(list, amount = "number_of_parameter_fields")]
pub parameter_fields: Vec<DataField>,
#[open_protocol_field(length = 3)]
pub number_of_resolution_fields: u16,
#[open_protocol_field(list, amount = "number_of_resolution_fields")]
pub resolution_fields: Vec<DataField>,
#[open_protocol_field(length = 5)]
pub number_of_trace_samples: u32,
#[open_protocol_field(length = 1)]
pub nul_character: u8,
#[open_protocol_field(list, amount = "number_of_trace_samples", length = 2)]
pub trace_samples: Vec<TraceSample>,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0900, revision = 2)]
pub struct MID0900rev2 {
#[open_protocol_field(length = 10)]
pub result_data_id: u32,
#[open_protocol_field(length = 19)]
pub timestamp: DateTime<Local>,
#[open_protocol_field(length = 3)]
pub number_of_pids: u16,
#[open_protocol_field(list, amount = "number_of_pids")]
pub data_fields: Vec<DataField>,
#[open_protocol_field(length = 2)]
pub trace_type: TraceType,
#[open_protocol_field(length = 2)]
pub transducer_type: u8,
#[open_protocol_field(length = 3)]
pub unit: u16,
#[open_protocol_field(length = 4)]
pub request_mid: u16,
#[open_protocol_field(length = 3)]
pub number_of_parameter_fields: u16,
#[open_protocol_field(list, amount = "number_of_parameter_fields")]
pub parameter_fields: Vec<DataField>,
#[open_protocol_field(length = 3)]
pub number_of_resolution_fields: u16,
#[open_protocol_field(list, amount = "number_of_resolution_fields")]
pub resolution_fields: Vec<DataField>,
#[open_protocol_field(length = 5)]
pub number_of_trace_samples: u32,
#[open_protocol_field(length = 1)]
pub nul_character: u8,
#[open_protocol_field(list, amount = "number_of_trace_samples", length = 2)]
pub trace_samples: Vec<TraceSample>,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0900, revision = 3)]
pub struct MID0900rev3 {
#[open_protocol_field(length = 10)]
pub result_data_id: u32,
#[open_protocol_field(length = 19)]
pub timestamp: DateTime<Local>,
#[open_protocol_field(length = 4)]
pub object_id: u16,
#[open_protocol_field(length = 1)]
pub object_type: ObjectType,
#[open_protocol_field(length = 4)]
pub reference_object_id: u16,
#[open_protocol_field(length = 3)]
pub number_of_pids: u16,
#[open_protocol_field(list, amount = "number_of_pids")]
pub data_fields: Vec<DataField>,
#[open_protocol_field(length = 2)]
pub trace_type: TraceType,
#[open_protocol_field(length = 2)]
pub transducer_type: u8,
#[open_protocol_field(length = 3)]
pub unit: u16,
#[open_protocol_field(length = 4)]
pub request_mid: u16,
#[open_protocol_field(length = 3)]
pub number_of_parameter_fields: u16,
#[open_protocol_field(list, amount = "number_of_parameter_fields")]
pub parameter_fields: Vec<DataField>,
#[open_protocol_field(length = 3)]
pub number_of_resolution_fields: u16,
#[open_protocol_field(list, amount = "number_of_resolution_fields")]
pub resolution_fields: Vec<DataField>,
#[open_protocol_field(length = 5)]
pub number_of_trace_samples: u32,
#[open_protocol_field(length = 1)]
pub nul_character: u8,
#[open_protocol_field(list, amount = "number_of_trace_samples", length = 2)]
pub trace_samples: Vec<TraceSample>,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode)]
pub struct MID0900RequestExtraData {
#[open_protocol_field(length = 10)]
pub index: u64,
#[open_protocol_field(length = 3)]
pub trace_type: TraceType,
#[open_protocol_field(length = 4)]
pub tool_number: u16,
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode)]
pub struct MID0900SubscribeExtraData {
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode)]
pub struct MID0900UnsubscribeExtraData {
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0901, revision = 1)]
pub struct MID0901rev1 {
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0901, revision = 2)]
pub struct MID0901rev2 {
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0901, revision = 3)]
pub struct MID0901rev3 {
}
#[derive(Debug, Default, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, OpenProtocolMessage)]
#[open_protocol_message(MID = 0902, revision = 1)]
pub struct MID0902rev1 {
#[open_protocol_field(length = 10)]
pub capacity: u64,
#[open_protocol_field(length = 10)]
pub oldest_sequence_number: u64,
#[open_protocol_field(length = 19)]
pub oldest_time: DateTime<Local>,
#[open_protocol_field(length = 10)]
pub newest_sequence_number: u64,
#[open_protocol_field(length = 19)]
pub newest_time: DateTime<Local>,
#[open_protocol_field(length = 3)]
pub number_of_pids: u16,
#[open_protocol_field(list, amount = "number_of_pids")]
pub data_fields: Vec<DataField>,
}