1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
//! Lengths of various messages (full-byte length, not data length).
/// Reset Command full message length.
pub const RESET_COMMAND: usize = 6;
/// SetInhibits Command full message length.
///
/// Because SetInhibits command messages are variable, set the static length to the maximum valid
/// number of channel bytes:
///
/// ```no_build,no_run
/// 3 header bytes + 1 command byte + 8 channel bytes + 2 footer bytes
/// ```
pub const SET_INHIBITS_COMMAND: usize = 14;
/// SetInhibits Response full message length.
pub const SET_INHIBITS_RESPONSE: usize = 6;
/// EncryptionReset Command full message length.
pub const ENCRYPTION_RESET_COMMAND: usize = 6;
/// EncryptionReset Response full message length.
pub const ENCRYPTION_RESET_RESPONSE: usize = 6;
/// GetBarcodeInhibit Command full message length.
pub const GET_BARCODE_INHIBIT_COMMAND: usize = 6;
/// GetBarcodeInhibit Response full message length.
pub const GET_BARCODE_INHIBIT_RESPONSE: usize = 7;
/// GetBarcodeData Command full message length.
pub const GET_BARCODE_DATA_COMMAND: usize = 6;
/// GetBarcodeData Response full message length.
pub const GET_BARCODE_DATA_RESPONSE: usize = MAX_MESSAGE;
/// SetBarcodeInhibit Command full message length.
pub const SET_BARCODE_INHIBIT_COMMAND: usize = 7;
/// SetBarcodeInhibit Response full message length.
pub const SET_BARCODE_INHIBIT_RESPONSE: usize = 6;
/// GetBarcodeReaderConfiguration Command full message length.
pub const GET_BARCODE_READER_CONFIGURATION_COMMAND: usize = 6;
/// GetBarcodeReaderConfiguration Response full message length.
pub const GET_BARCODE_READER_CONFIGURATION_RESPONSE: usize = 10;
/// SetBarcodeReaderConfiguration Command full message length.
pub const SET_BARCODE_READER_CONFIGURATION_COMMAND: usize = 9;
/// SetBarcodeReaderConfiguration Response full message length.
pub const SET_BARCODE_READER_CONFIGURATION_RESPONSE: usize = 10;
/// Hold Command full message length.
pub const HOLD_COMMAND: usize = 6;
/// Hold Response full message length.
pub const HOLD_RESPONSE: usize = 6;
/// Host Protocol Version Command full message length.
pub const HOST_PROTOCOL_VERSION_COMMAND: usize = 7;
/// Host Protocol Version Response full message length.
pub const HOST_PROTOCOL_VERSION_RESPONSE: usize = 6;
/// Sync Command full message length.
pub const SYNC_COMMAND: usize = 6;
/// Sync Response full message length.
pub const SYNC_RESPONSE: usize = 6;
/// Display On Command full message length.
pub const DISPLAY_ON_COMMAND: usize = 6;
/// Display On Response full message length.
pub const DISPLAY_ON_RESPONSE: usize = 6;
/// Display Off Command full message length.
pub const DISPLAY_OFF_COMMAND: usize = 6;
/// Display Off Response full message length.
pub const DISPLAY_OFF_RESPONSE: usize = 6;
/// Reject Command full message length.
pub const REJECT_COMMAND: usize = 6;
/// Reject Response full message length.
pub const REJECT_RESPONSE: usize = 6;
/// Poll Command full message length.
pub const POLL_COMMAND: usize = 6;
/// Poll Response maximum full message length.
///
/// Because poll messages have variable response lengths, set the static length to maximum
/// possible. Actual length is determined by reading the LEN field.
pub const POLL_RESPONSE: usize = MAX_MESSAGE;
/// Disable Command full message length.
pub const DISABLE_COMMAND: usize = 6;
/// Disable Response full message length.
pub const DISABLE_RESPONSE: usize = 6;
/// Enable Command full message length.
pub const ENABLE_COMMAND: usize = 6;
/// Enable Response full message length.
pub const ENABLE_RESPONSE: usize = 6;
/// Dataset Version Command full message length.
pub const DATASET_VERSION_COMMAND: usize = 6;
/// Dataset Version Response full message length.
pub const DATASET_VERSION_RESPONSE: usize = MAX_MESSAGE;
/// Empty Command full message length.
pub const EMPTY_COMMAND: usize = 6;
/// Empty Response full message length.
pub const EMPTY_RESPONSE: usize = 6;
/// SmartEmpty Command full message length.
pub const SMART_EMPTY_COMMAND: usize = 6;
/// SmartEmpty Response full message length.
pub const SMART_EMPTY_RESPONSE: usize = 6;
/// Serial Number Command full message length.
pub const SERIAL_NUMBER_COMMAND: usize = 6;
/// Serial Number Response full message length.
pub const SERIAL_NUMBER_RESPONSE: usize = 10;
/// Unit Data Command full message length.
pub const UNIT_DATA_COMMAND: usize = 6;
/// Unit Data Response full message length.
pub const UNIT_DATA_RESPONSE: usize = 18;
/// Channel Value Data Command full message length.
pub const CHANNEL_VALUE_DATA_COMMAND: usize = 6;
/// Channel Value Data Response full message length.
///
/// Because channel value data messages have variable response lengths, set the static length to maximum
/// possible. Actual length is determined by reading the LEN field.
pub const CHANNEL_VALUE_DATA_RESPONSE: usize = MAX_MESSAGE;
/// Setup Request Command full message length.
pub const SETUP_REQUEST_COMMAND: usize = 6;
/// Setup Request Response full message length.
///
/// Because setup request messages have variable response lengths, set the static length to maximum
/// possible. Actual length is determined by reading the LEN field.
pub const SETUP_REQUEST_RESPONSE: usize = MAX_MESSAGE;
/// LastRejectCode Command full message length.
pub const LAST_REJECT_CODE_COMMAND: usize = 6;
/// LastRejectCode Response full message length.
pub const LAST_REJECT_CODE_RESPONSE: usize = 7;
/// ConfigureBezel Command full message length.
pub const CONFIGURE_BEZEL_COMMAND: usize = 10;
/// ConfigureBezel Response full message length.
pub const CONFIGURE_BEZEL_RESPONSE: usize = 6;
/// PollWithAck Command full message length.
pub const POLL_WITH_ACK_COMMAND: usize = 6;
/// PollWithAck Response maximum full message length.
///
/// Because poll messages have variable response lengths, set the static length to maximum
/// possible. Actual length is determined by reading the LEN field.
pub const POLL_WITH_ACK_RESPONSE: usize = MAX_MESSAGE;
/// EventAck Command full message length.
pub const EVENT_ACK_COMMAND: usize = 6;
/// EventAck Response full message length.
pub const EVENT_ACK_RESPONSE: usize = 6;
/// SetEncryptionKey Command full message length.
pub const SET_ENCRYPTION_KEY_COMMAND: usize = 14;
/// SetEncryptionKey Response full message length.
pub const SET_ENCRYPTION_KEY_RESPONSE: usize = 6;
/// SetGenerator Command full message length.
pub const SET_GENERATOR_COMMAND: usize = 14;
/// SetGenerator Response full message length.
pub const SET_GENERATOR_RESPONSE: usize = 6;
/// SetModulus Command full message length.
pub const SET_MODULUS_COMMAND: usize = 14;
/// SetModulus Response full message length.
pub const SET_MODULUS_RESPONSE: usize = 6;
/// RequestKeyExchange Command full message length.
pub const REQUEST_KEY_EXCHANGE_COMMAND: usize = 14;
/// RequestKeyExchange Response full message length.
pub const REQUEST_KEY_EXCHANGE_RESPONSE: usize = 14;
/// PayoutByDenomination Command maximum full message length.
///
/// Because payout messages have variable lengths, set the static length to maximum
/// possible. Actual length is determined by reading the LEN field.
pub const PAYOUT_BY_DENOMINATION_COMMAND: usize = MAX_MESSAGE;
/// PayoutByDenomination Response full message length.
pub const PAYOUT_BY_DENOMINATION_RESPONSE: usize = 6;
/// Length of a serialized [PayoutDenomination](crate::PayoutDenomination).
pub const PAYOUT_BLOCK: usize = 9;
/// EnablePayout Command full message length.
pub const ENABLE_PAYOUT_COMMAND: usize = 7;
/// EnablePayout Response full message length.
pub const ENABLE_PAYOUT_RESPONSE: usize = 6;
/// DisablePayout Command full message length.
pub const DISABLE_PAYOUT_COMMAND: usize = 6;
/// DisablePayout Response full message length.
pub const DISABLE_PAYOUT_RESPONSE: usize = 6;
/// ProgramFirmware Command full message length.
pub const PROGRAM_FIRMWARE_COMMAND: usize = 7;
/// ProgramFirmware Response full message length.
pub const PROGRAM_FIRMWARE_RESPONSE: usize = 8;
/// FirmwareHeader Command full message length.
pub const FIRMWARE_HEADER_COMMAND: usize = 133;
/// FirmwareHeader Response full message length.
pub const FIRMWARE_HEADER_RESPONSE: usize = 6;
/// Encrypted Command full message length.
///
/// Because encrypted messages have variable lengths, set the static length to maximum
/// possible. Actual length is determined by reading the LEN field.
pub const ENCRYPTED_COMMAND: usize = MAX_ENCRYPTED_MESSAGE;
/// Encrypted Response full message length.
///
/// Because encrypted messages have variable lengths, set the static length to maximum
/// possible. Actual length is determined by reading the LEN field.
pub const ENCRYPTED_RESPONSE: usize = MAX_ENCRYPTED_MESSAGE;
/// Wrapped Encrypted Message full message length.
///
/// Because encrypted messages have variable lengths, set the static length to maximum
/// possible. Actual length is determined by reading the LEN field.
pub const WRAPPED_ENCRYPTED_MESSAGE: usize = MAX_MESSAGE;
/// Header: `STX/STEX/STEXN | SEQID | LEN`
pub const HEADER: usize = 3;
/// Footer: CRC-16
pub const FOOTER: usize = 2;
/// Number of bytes in the header and footer of messages:
///
/// ```no_build,no_run
/// STX/STEX/STEXN | SEQID | LEN | ... | CRC_L | CRC_H
/// ```
pub const METADATA: usize = HEADER + FOOTER;
/// Length of metadata in encrypted messages.
///
/// ```no_build,no_run
/// STEX(1) | LEN(1) | COUNT(4) | ... | CRC_L(1) | CRC_H(1)
/// ```
pub const ENCRYPTED_METADATA: usize = 8;
/// Maximum data length for a message.
pub const MAX_DATA: usize = 255;
/// Maximum data length for an encrypted message.
///
/// Because encrypted messages must be wrapped in a standard SSP message, the full message must be
/// able to fit inside a standard SSP data field.
pub const MAX_ENCRYPTED_DATA: usize = MAX_DATA - ENCRYPTED_METADATA;
/// Maximum full length for a message.
pub const MAX_MESSAGE: usize = METADATA + MAX_DATA;
/// Maximum full length for an encrypted message.
pub const MAX_ENCRYPTED_MESSAGE: usize = MAX_DATA;
/// 24-bit number length in bytes.
pub const U24: usize = 3;
/// Length of [FirmwareVersion](crate::FirmwareVersion) data field.
pub const FIRMWARE_VERSION: usize = 4;
/// The size of an AES-128 block.
pub const AES: usize = 16;
/// The size of an AES-128 key.
pub const AES_KEY: usize = 16;
/// Gets the length of additional data needed to be a multiple of the AES block length.