1use open_protocol_codec_proc_macro::{OpenProtocolDecode, OpenProtocolEncode};
2use thiserror::Error;
3
4#[derive(Debug, Default, Clone, Eq, PartialEq, OpenProtocolEncode, OpenProtocolDecode, Error)]
5pub enum ErrorCode {
6 #[default]
7 #[error("No Error")]
8 #[open_protocol_value(number = 0)]
9 NoError,
10
11 #[error("Invalid data")]
12 #[open_protocol_value(number = 1)]
13 InvalidData,
14
15 #[error("Parameter set ID not present")]
16 #[open_protocol_value(number = 2)]
17 ParameterSetIdNotPresent,
18
19 #[error("Parameter set cannot be set")]
20 #[open_protocol_value(number = 3)]
21 ParameterSetCannotBeSet,
22
23 #[error("Parameter set not running")]
24 #[open_protocol_value(number = 4)]
25 ParameterSetNotRunning,
26
27 #[error("VIN upload subscription already exists")]
28 #[open_protocol_value(number = 6)]
29 VinUploadSubscriptionExists,
30
31 #[error("VIN upload subscription does not exist")]
32 #[open_protocol_value(number = 7)]
33 VinUploadSubscriptionDoesNotExist,
34
35 #[error("VIN input source not granted")]
36 #[open_protocol_value(number = 8)]
37 VinInputSourceNotGranted,
38
39 #[error("Last tightening result subscription already exists")]
40 #[open_protocol_value(number = 9)]
41 LastTighteningResultSubscriptionExists,
42
43 #[error("Last tightening result subscription does not exist")]
44 #[open_protocol_value(number = 10)]
45 LastTighteningResultSubscriptionDoesNotExist,
46
47 #[error("Alarm subscription already exists")]
48 #[open_protocol_value(number = 11)]
49 AlarmSubscriptionExists,
50
51 #[error("Alarm subscription does not exist")]
52 #[open_protocol_value(number = 12)]
53 AlarmSubscriptionDoesNotExist,
54
55 #[error("Parameter set selection subscription already exists")]
56 #[open_protocol_value(number = 13)]
57 ParameterSetSelectionSubscriptionExists,
58
59 #[error("Parameter set selection subscription does not exist")]
60 #[open_protocol_value(number = 14)]
61 ParameterSetSelectionSubscriptionDoesNotExist,
62
63 #[error("Tightening ID requested not found")]
64 #[open_protocol_value(number = 15)]
65 TighteningIdNotFound,
66
67 #[error("Connection rejected: protocol busy")]
68 #[open_protocol_value(number = 16)]
69 ConnectionRejectedProtocolBusy,
70
71 #[error("Job ID not present")]
72 #[open_protocol_value(number = 17)]
73 JobIdNotPresent,
74
75 #[error("Job info subscription already exists")]
76 #[open_protocol_value(number = 18)]
77 JobInfoSubscriptionExists,
78
79 #[error("Job info subscription does not exist")]
80 #[open_protocol_value(number = 19)]
81 JobInfoSubscriptionDoesNotExist,
82
83 #[error("Job cannot be set")]
84 #[open_protocol_value(number = 20)]
85 JobCannotBeSet,
86
87 #[error("Job not running")]
88 #[open_protocol_value(number = 21)]
89 JobNotRunning,
90
91 #[error("Not possible to execute dynamic Job request")]
92 #[open_protocol_value(number = 22)]
93 DynamicJobRequestNotPossible,
94
95 #[error("Job batch decrement failed")]
96 #[open_protocol_value(number = 23)]
97 JobBatchDecrementFailed,
98
99 #[error("Not possible to create Pset")]
100 #[open_protocol_value(number = 24)]
101 CreatePsetNotPossible,
102
103 #[error("Programming control not granted")]
104 #[open_protocol_value(number = 25)]
105 ProgrammingControlNotGranted,
106
107 #[error("Wrong tool type for Pset download")]
108 #[open_protocol_value(number = 26)]
109 WrongToolTypeForPsetDownload,
110
111 #[error("Tool is inaccessible")]
112 #[open_protocol_value(number = 27)]
113 ToolInaccessible,
114
115 #[error("Job abortion is in progress")]
116 #[open_protocol_value(number = 28)]
117 JobAbortionInProgress,
118
119 #[error("Tool does not exist")]
120 #[open_protocol_value(number = 29)]
121 ToolDoesNotExist,
122
123 #[error("Controller is not a sync Master/station controller")]
124 #[open_protocol_value(number = 30)]
125 NotSyncMasterOrStationController,
126
127 #[error("Multi-spindle status subscription already exists")]
128 #[open_protocol_value(number = 31)]
129 MultiSpindleStatusSubscriptionExists,
130
131 #[error("Multi-spindle status subscription does not exist")]
132 #[open_protocol_value(number = 32)]
133 MultiSpindleStatusSubscriptionDoesNotExist,
134
135 #[error("Multi-spindle result subscription already exists")]
136 #[open_protocol_value(number = 33)]
137 MultiSpindleResultSubscriptionExists,
138
139 #[error("Multi-spindle result subscription does not exist")]
140 #[open_protocol_value(number = 34)]
141 MultiSpindleResultSubscriptionDoesNotExist,
142
143 #[error("Other master client already connected")]
144 #[open_protocol_value(number = 35)]
145 OtherMasterClientAlreadyConnected,
146
147 #[error("Lock type not supported")]
148 #[open_protocol_value(number = 36)]
149 LockTypeNotSupported,
150
151 #[error("Job line control info subscription already exists")]
152 #[open_protocol_value(number = 40)]
153 JobLineControlSubscriptionExists,
154
155 #[error("Job line control info subscription does not exist")]
156 #[open_protocol_value(number = 41)]
157 JobLineControlSubscriptionDoesNotExist,
158
159 #[error("Identifier input source not granted")]
160 #[open_protocol_value(number = 42)]
161 IdentifierInputSourceNotGranted,
162
163 #[error("Multiple identifiers work order subscription already exists")]
164 #[open_protocol_value(number = 43)]
165 MultipleIdentifiersWorkOrderSubscriptionExists,
166
167 #[error("Multiple identifiers work order subscription does not exist")]
168 #[open_protocol_value(number = 44)]
169 MultipleIdentifiersWorkOrderSubscriptionDoesNotExist,
170
171 #[error("Status external monitored inputs subscription already exists")]
172 #[open_protocol_value(number = 50)]
173 StatusExternalMonitoredInputsSubscriptionExists,
174
175 #[error("Status external monitored inputs subscription does not exist")]
176 #[open_protocol_value(number = 51)]
177 StatusExternalMonitoredInputsSubscriptionDoesNotExist,
178
179 #[error("IO device not connected")]
180 #[open_protocol_value(number = 52)]
181 IoDeviceNotConnected,
182
183 #[error("Faulty IO device ID")]
184 #[open_protocol_value(number = 53)]
185 FaultyIoDeviceId,
186
187 #[error("Tool Tag ID unknown")]
188 #[open_protocol_value(number = 54)]
189 ToolTagIdUnknown,
190
191 #[error("Tool Tag ID subscription already exists")]
192 #[open_protocol_value(number = 55)]
193 ToolTagIdSubscriptionExists,
194
195 #[error("Tool Tag ID subscription does not exist")]
196 #[open_protocol_value(number = 56)]
197 ToolTagIdSubscriptionDoesNotExist,
198
199 #[error("Tool motor tuning failed")]
200 #[open_protocol_value(number = 57)]
201 ToolMotorTuningFailed,
202
203 #[error("No alarm present")]
204 #[open_protocol_value(number = 58)]
205 NoAlarmPresent,
206
207 #[error("Tool currently in use")]
208 #[open_protocol_value(number = 59)]
209 ToolCurrentlyInUse,
210
211 #[error("No histogram available")]
212 #[open_protocol_value(number = 60)]
213 NoHistogramAvailable,
214
215 #[error("Pairing failed")]
216 #[open_protocol_value(number = 61)]
217 PairingFailed,
218
219 #[error("Pairing denied")]
220 #[open_protocol_value(number = 62)]
221 PairingDenied,
222
223 #[error("Pairing or pairing abortion attempt on wrong tool type")]
224 #[open_protocol_value(number = 63)]
225 PairingWrongToolType,
226
227 #[error("Pairing abortion denied")]
228 #[open_protocol_value(number = 64)]
229 PairingAbortionDenied,
230
231 #[error("Pairing abortion failed")]
232 #[open_protocol_value(number = 65)]
233 PairingAbortionFailed,
234
235 #[error("Pairing disconnection failed")]
236 #[open_protocol_value(number = 66)]
237 PairingDisconnectionFailed,
238
239 #[error("Pairing in progress or already done")]
240 #[open_protocol_value(number = 67)]
241 PairingInProgress,
242
243 #[error("Pairing denied, no program control")]
244 #[open_protocol_value(number = 68)]
245 PairingDeniedNoProgramControl,
246
247 #[error("Unsupported extra data revision")]
248 #[open_protocol_value(number = 69)]
249 UnsupportedExtraDataRevision,
250
251 #[error("Calibration failed")]
252 #[open_protocol_value(number = 70)]
253 CalibrationFailed,
254
255 #[error("Subscription already exists")]
256 #[open_protocol_value(number = 71)]
257 SubscriptionAlreadyExists,
258
259 #[error("Subscription does not exist")]
260 #[open_protocol_value(number = 72)]
261 SubscriptionDoesNotExist,
262
263 #[error("Subscribed MID unsupported (trying to subscribe on a non-existing MID)")]
264 #[open_protocol_value(number = 73)]
265 SubscribedMIDUnsupported,
266
267 #[error("Subscribed MID revision unsupported (trying to subscribe to an unsupported MID revision)")]
268 #[open_protocol_value(number = 74)]
269 SubscribedMIDRevisionUnsupported,
270
271 #[error("Requested MID unsupported (trying to request a non-existing MID)")]
272 #[open_protocol_value(number = 75)]
273 RequestedMIDUnsupported,
274
275 #[error("Requested MID revision unsupported (trying to request an unsupported MID revision)")]
276 #[open_protocol_value(number = 76)]
277 RequestedMIDRevisionUnsupported,
278
279 #[error("Requested specific data not supported (trying to request data that is not supported)")]
280 #[open_protocol_value(number = 77)]
281 RequestedSpecificDataNotSupported,
282
283 #[error("Subscription on specific data not supported (trying to subscribe for unsupported data)")]
284 #[open_protocol_value(number = 78)]
285 SubscriptionSpecificDataNotSupported,
286
287 #[error("Command failed")]
288 #[open_protocol_value(number = 79)]
289 CommandFailed,
290
291 #[error("Audi emergency status subscription exists")]
292 #[open_protocol_value(number = 80)]
293 AudiEmergencyStatusSubscriptionExists,
294
295 #[error("Audi emergency status subscription does not exist")]
296 #[open_protocol_value(number = 81)]
297 AudiEmergencyStatusSubscriptionDoesNotExist,
298
299 #[error("Automatic/Manual mode subscription already exists")]
300 #[open_protocol_value(number = 82)]
301 AutomaticManualModeSubscriptionExists,
302
303 #[error("Automatic/Manual mode subscription does not exist")]
304 #[open_protocol_value(number = 83)]
305 AutomaticManualModeSubscriptionDoesNotExist,
306
307 #[error("The relay function subscription already exists")]
308 #[open_protocol_value(number = 84)]
309 RelayFunctionSubscriptionExists,
310
311 #[error("The relay function subscription does not exist")]
312 #[open_protocol_value(number = 85)]
313 RelayFunctionSubscriptionDoesNotExist,
314
315 #[error("The selector socket info subscription already exists")]
316 #[open_protocol_value(number = 86)]
317 SelectorSocketInfoSubscriptionExists,
318
319 #[error("The selector socket info subscription does not exist")]
320 #[open_protocol_value(number = 87)]
321 SelectorSocketInfoSubscriptionDoesNotExist,
322
323 #[error("The digital input info subscription already exists")]
324 #[open_protocol_value(number = 88)]
325 DigitalInputSubscriptionExists,
326
327 #[error("The digital input info subscription does not exist")]
328 #[open_protocol_value(number = 89)]
329 DigitalInputSubscriptionDoesNotExist,
330
331 #[error("Lock at batch done subscription already exists")]
332 #[open_protocol_value(number = 90)]
333 LockAtBatchDoneSubscriptionExists,
334
335 #[error("Lock at batch done subscription does not exist")]
336 #[open_protocol_value(number = 91)]
337 LockAtBatchDoneSubscriptionDoesNotExist,
338
339 #[error("Open protocol commands disabled")]
340 #[open_protocol_value(number = 92)]
341 OpenProtocolCommandsDisabled,
342
343 #[error("Open protocol commands disabled subscription already exists")]
344 #[open_protocol_value(number = 93)]
345 OpenProtocolCommandsDisabledSubscriptionExists,
346
347 #[error("Open protocol commands disabled subscription does not exist")]
348 #[open_protocol_value(number = 94)]
349 OpenProtocolCommandsDisabledSubscriptionDoesNotExist,
350
351 #[error("Reject request, PowerMACS is in manual mode")]
352 #[open_protocol_value(number = 95)]
353 RejectRequestPowerMACSManualMode,
354
355 #[error("Reject connection, client already connected")]
356 #[open_protocol_value(number = 96)]
357 RejectConnectionClientAlreadyConnected,
358
359 #[error("MID revision unsupported")]
360 #[open_protocol_value(number = 97)]
361 MIDRevisionUnsupported,
362
363 #[error("Controller internal request timeout")]
364 #[open_protocol_value(number = 98)]
365 ControllerInternalRequestTimeout,
366
367 #[error("Unknown MID")]
368 #[open_protocol_value(number = 99)]
369 UnknownMID,
370
371 #[error("Illegal PID")]
372 #[open_protocol_value(number = 100)]
373 IllegalPID,
374
375 #[error("Tightening in progress")]
376 #[open_protocol_value(number = 101)]
377 TighteningInProgress,
378
379 #[error("Delete of object not possible")]
380 #[open_protocol_value(number = 102)]
381 DeleteOfObjectNotPossible,
382
383 #[error("Illegal program ID")]
384 #[open_protocol_value(number = 103)]
385 IllegalProgramID,
386
387 #[error("Illegal node type")]
388 #[open_protocol_value(number = 104)]
389 IllegalNodeType,
390
391 #[error("Application specific error code {0}")]
392 #[open_protocol_value(number_range = "900-999")]
393 ApplicationSpecificErrorCode(u16),
394
395 #[error("Unknown error with code {0}")]
396 #[open_protocol_value(other)]
397 UnknownError(u16)
398}