open_protocol/enums/datatype.rs
1use open_protocol_codec_proc_macro::{OpenProtocolDecode, OpenProtocolEncode};
2
3#[derive(Debug, Default, Eq, PartialEq, Clone, OpenProtocolEncode, OpenProtocolDecode)]
4pub enum DataType {
5 /// **Unsigned Integer (UI)**
6 /// The value is an unsigned integer. The number of digits is defined with the Length parameter.
7 #[default]
8 #[open_protocol_value(number = 1)]
9 UnsignedInteger,
10
11 /// **Signed Integer (I)**
12 /// The value is a signed integer. The number of digits is defined with the Length parameter.
13 #[open_protocol_value(number = 2)]
14 SignedInteger,
15
16 /// **Float (F)**
17 /// The value is sent as a float in a flexible format such as "12.12", "10025.1234", or "-57.5".
18 /// The sender determines the number of decimals to send.
19 #[open_protocol_value(number = 3)]
20 Float,
21
22 /// **String (S)**
23 /// The value is sent as ASCII characters, and the length of the data fits the actual string length.
24 /// Strings may contain spaces (ASCII 0x20).
25 #[open_protocol_value(number = 4)]
26 String,
27
28 /// **Timestamp (T)**
29 /// The value represents a time stamp in the format `YYYY-MM-DD:HH:MM:SS` (19 ASCII characters).
30 #[open_protocol_value(number = 5)]
31 Timestamp,
32
33 /// **Boolean (B)**
34 /// A boolean value represented as one ASCII digit: `0 = FALSE`, `1 = TRUE`.
35 #[open_protocol_value(number = 6)]
36 Boolean,
37
38 /// **Hexadecimal (H)**
39 /// A hexadecimal value sent as ASCII characters, e.g., `"A24CD3"`.
40 #[open_protocol_value(number = 7)]
41 Hexadecimal,
42
43 /// **Plotting Point (PL1)**
44 /// A plotting point consisting of a Float Array (`FA`) of one pair of float values (Y, X).
45 #[open_protocol_value(number = 8)]
46 PlotPointPL1,
47
48 /// **Double Arrow Line (PL2)**
49 /// A plotting point consisting of an `FA` of two pairs of float values (Y, X).
50 #[open_protocol_value(number = 9)]
51 PlotPointPL2,
52
53 /// **Window Plot (PL4)**
54 /// A plotting point consisting of an `FA` of four pairs of float values (Y, X).
55 #[open_protocol_value(number = 10)]
56 PlotPointPL4,
57
58 /// **Float Array (FA)**
59 /// An array of float values, each sent as 8 ASCII characters.
60 /// Negative values start with a `'-'` sign.
61 /// Precision varies, omitting the decimal point for large values.
62 /// Examples: `"-1234567"`, `"001.1205"`, `"-123.789"`.
63 #[open_protocol_value(number = 50)]
64 FloatArray,
65
66 /// **Unsigned Integer Array (UA)**
67 /// An array of unsigned integers, each sent as 8 ASCII characters.
68 /// Examples: `"12345678"`, `"00001234"`, `"00200000"`.
69 #[open_protocol_value(number = 51)]
70 UnsignedIntegerArray,
71
72 /// **Signed Integer Array (IA)**
73 /// An array of signed integers, each sent as 8 ASCII characters.
74 /// Negative values start with a `'-'` sign.
75 /// Examples: `"12345678"`, `"-1234567"`, `"00200000"`, `"10200000"`.
76 #[open_protocol_value(number = 52)]
77 SignedIntegerArray,
78}