-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDTCClassPanel.java
291 lines (248 loc) · 10.7 KB
/
DTCClassPanel.java
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
package DTCController;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class DTCClassPanel extends JDialog implements ActionListener {
private JComboBox mil; // Mode for MIL activation
private JComboBox tflc; // Trigger type for fault validation debouncing
private JTextField flc; // Number of trigger events for fault validation debouncing (->MIL on)
private JComboBox thlc; // Trigger type for fault healing (->MIL off)
private JTextField hlc; // Number of trigger events for fault healing (->MIL off)
private JComboBox scatt; // Fault is visible for OBD Scan tool tester (SCATT) if value = 1
private JComboBox tdlcpen; // Trigger type for delete debouncing of pending faults
private JTextField dlcpen; // Number of trigger events to delete pending faults
private JComboBox tdlc; // Trigger type for delete debouncing
private JTextField dlckd; // Number of trigger events to delete faults in status service specific
private JTextField dlc; // Number of trigger events to delete fault code memory entries
private JTextField prio; // Priority of fault code memory entry for displacement an freeze frame assignment
private JComboBox syslamp; // Mode of System Lamp activation
private JComboBox reserf; // Behaviour of fault flags at reset and canceled afterrun
private JCheckBox readinessEGR; // Readiness: EGR system monitoring
private JCheckBox readinessCatalyst; // Readiness: catalyst monitoring
private JCheckBox readinessMisfire; // Readiness: misfire monitoring
private JCheckBox readinessFuel; // Readiness: catalyst monitoring
private JCheckBox readinessComprehensive; // Readiness: comprehensive components
private JCheckBox readinessOxygenSensor; // Readiness: Oxygen sensor
private JCheckBox readinessOxygenSensorHeater; // Readiness: Oxygen sensor heater
private JButton applyButton;
private JButton cancelButton;
private DTCClass dtcClass;
public DTCClassPanel(DTCClass dtcClass) {
this.dtcClass = dtcClass;
JPanel innerPanel = new JPanel();
innerPanel.setLayout(null);
innerPanel.setPreferredSize(new Dimension(320,605));
int y = 10;
JLabel milLabel = new JLabel("MIL");
milLabel.setBounds(10,y,150,25);
innerPanel.add(milLabel);
mil = new JComboBox(DTCClass.LAMP_MODE);
mil.setToolTipText("Mode for Malfunction Indication Lamp activation");
mil.setBounds(160,y,150,25);
mil.setSelectedIndex(dtcClass.mil);
innerPanel.add(mil);
y+=30;
JLabel tflcLabel = new JLabel("Trigger FLC");
tflcLabel.setBounds(10,y,150,25);
innerPanel.add(tflcLabel);
tflc = new JComboBox(DTCClass.TRIGGER);
tflc.setToolTipText("Trigger type for fault validation debouncing");
tflc.setBounds(160,y,150,25);
tflc.setSelectedIndex(dtcClass.tflc);
innerPanel.add(tflc);
y+=30;
JLabel flcLabel = new JLabel("FLC");
flcLabel.setBounds(10,y,150,25);
innerPanel.add(flcLabel);
flc = new JTextField();
flc.setToolTipText("Number of trigger events for fault validation debouncing (->MIL on)");
flc.setBounds(160,y,150,25);
flc.setText(Integer.toString(dtcClass.flc));
innerPanel.add(flc);
y+=30;
JLabel thlcLabel = new JLabel("Trigger HLC");
thlcLabel.setBounds(10,y,150,25);
innerPanel.add(thlcLabel);
thlc = new JComboBox(DTCClass.TRIGGER);
thlc.setToolTipText("Trigger type for fault healing (->MIL off)");
thlc.setBounds(160,y,150,25);
thlc.setSelectedIndex(dtcClass.thlc);
innerPanel.add(thlc);
y+=30;
JLabel hlcLabel = new JLabel("HLC");
hlcLabel.setBounds(10,y,150,25);
innerPanel.add(hlcLabel);
hlc = new JTextField();
hlc.setToolTipText("Number of trigger events for fault healing (->MIL off)");
hlc.setBounds(160,y,150,25);
hlc.setText(Integer.toString(dtcClass.hlc));
innerPanel.add(hlc);
y+=30;
JLabel scattLabel = new JLabel("OBD");
scattLabel.setBounds(10,y,150,25);
innerPanel.add(scattLabel);
scatt = new JComboBox(DTCClass.SCATT);
scatt.setToolTipText("Fault is visible for OBD Scan tool tester (SCATT) if value = 1");
scatt.setBounds(160,y,150,25);
scatt.setSelectedIndex(dtcClass.scatt);
innerPanel.add(scatt);
y+=30;
JLabel tdlcpenLabel = new JLabel("Trigger DLC Pending");
tdlcpenLabel.setBounds(10,y,150,25);
innerPanel.add(tdlcpenLabel);
tdlcpen = new JComboBox(DTCClass.TRIGGER_TDLC);
tdlcpen.setToolTipText("Trigger type for delete debouncing of pending faults");
tdlcpen.setBounds(160,y,150,25);
tdlcpen.setSelectedIndex(dtcClass.tdlcpen);
innerPanel.add(tdlcpen);
y+=30;
JLabel tdlcPenLabel = new JLabel("DLC Pending");
tdlcPenLabel.setBounds(10,y,150,25);
innerPanel.add(tdlcPenLabel);
dlcpen = new JTextField();
dlcpen.setToolTipText("Number of trigger events to delete pending faults");
dlcpen.setBounds(160,y,150,25);
dlcpen.setText(Integer.toString(dtcClass.dlcpen));
innerPanel.add(dlcpen);
y+=30;
JLabel tdlcLabel = new JLabel("Trigger DLC");
tdlcLabel.setBounds(10,y,150,25);
innerPanel.add(tdlcLabel);
tdlc = new JComboBox(DTCClass.TRIGGER_TDLC);
tdlc.setToolTipText("Trigger type for delete debouncing");
tdlc.setBounds(160,y,150,25);
tdlc.setSelectedIndex(dtcClass.tdlc);
innerPanel.add(tdlc);
y+=30;
JLabel dlckdLabel = new JLabel("DLCkd");
dlckdLabel.setBounds(10,y,150,25);
innerPanel.add(dlckdLabel);
dlckd = new JTextField();
dlckd.setToolTipText("Number of trigger events to delete faults in status service specific");
dlckd.setBounds(160,y,150,25);
dlckd.setText(Integer.toString(dtcClass.dlckd));
innerPanel.add(dlckd);
y+=30;
JLabel dlcLabel = new JLabel("DLC");
dlcLabel.setBounds(10,y,150,25);
innerPanel.add(dlcLabel);
dlc = new JTextField();
dlc.setToolTipText("Number of trigger events to delete fault code memory entries");
dlc.setBounds(160,y,150,25);
dlc.setText(Integer.toString(dtcClass.dlc));
innerPanel.add(dlc);
y+=30;
JLabel prioLabel = new JLabel("Priority");
prioLabel.setBounds(10,y,150,25);
innerPanel.add(prioLabel);
prio = new JTextField();
prio.setToolTipText("Priority of fault code memory entry for displacement an freeze frame assignment");
prio.setBounds(160,y,150,25);
prio.setText(Integer.toString(dtcClass.prio));
innerPanel.add(prio);
y+=30;
JLabel sysLampLabel = new JLabel("SYSLamp");
sysLampLabel.setBounds(10,y,150,25);
innerPanel.add(sysLampLabel);
syslamp = new JComboBox(DTCClass.LAMP_MODE);
syslamp.setToolTipText("Mode for System Lamp activation");
syslamp.setBounds(160,y,150,25);
syslamp.setSelectedIndex(dtcClass.syslamp);
innerPanel.add(syslamp);
y+=30;
JLabel resetLabel = new JLabel("Reset");
resetLabel.setBounds(10,y,150,25);
innerPanel.add(resetLabel);
reserf = new JComboBox(DTCClass.RES_ERF);
reserf.setToolTipText("Behaviour of fault flags at reset and canceled afterrun");
reserf.setBounds(160,y,150,25);
reserf.setSelectedIndex(dtcClass.reserf);
innerPanel.add(reserf);
y+=30;
JPanel readinessPanel = new JPanel();
readinessPanel.setLayout(null);
readinessPanel.setBorder(BorderFactory.createTitledBorder("Readiness"));
readinessPanel.setBounds(5,y,310,140);
y=20;
readinessEGR = new JCheckBox("EGR");
readinessEGR.setSelected( (dtcClass.readiness & 0x01)!=0 );
readinessEGR.setBounds(10,y,150,25);
readinessPanel.add(readinessEGR);
readinessCatalyst = new JCheckBox("Catalyst");
readinessCatalyst.setSelected( (dtcClass.readiness & 0x02)!=0 );
readinessCatalyst.setBounds(160,y,140,25);
readinessPanel.add(readinessCatalyst);
y+=30;
readinessMisfire = new JCheckBox("Misfire");
readinessMisfire.setSelected( (dtcClass.readiness & 0x04)!=0 );
readinessMisfire.setBounds(10,y,150,25);
readinessPanel.add(readinessMisfire);
readinessFuel = new JCheckBox("Fuel");
readinessFuel.setSelected( (dtcClass.readiness & 0x08)!=0 );
readinessFuel.setBounds(160,y,140,25);
readinessPanel.add(readinessFuel);
y+=30;
readinessComprehensive = new JCheckBox("C.Components");
readinessComprehensive.setSelected( (dtcClass.readiness & 0x10)!=0 );
readinessComprehensive.setBounds(10,y,150,25);
readinessPanel.add(readinessComprehensive);
readinessOxygenSensor = new JCheckBox("O2 Sensor");
readinessOxygenSensor.setSelected( (dtcClass.readiness & 0x20)!=0 );
readinessOxygenSensor.setBounds(160,y,140,25);
readinessPanel.add(readinessOxygenSensor);
y+=30;
readinessOxygenSensorHeater = new JCheckBox("O2 SensorHeater");
readinessOxygenSensorHeater.setSelected( (dtcClass.readiness & 0x40)!=0 );
readinessOxygenSensorHeater.setBounds(10,y,150,25);
readinessPanel.add(readinessOxygenSensorHeater);
innerPanel.add(readinessPanel);
y = 575;
applyButton = new JButton("Apply");
applyButton.addActionListener(this);
applyButton.setBounds( 105,y,100,25 );
innerPanel.add(applyButton);
cancelButton = new JButton("Cancel");
cancelButton.addActionListener(this);
cancelButton.setBounds( 210,y,100,25 );
innerPanel.add(cancelButton);
setContentPane(innerPanel);
setTitle("Class #" + dtcClass.classId + String.format("[0x%06X]",dtcClass.getAddr()));
pack();
setLocationRelativeTo(null);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==cancelButton) {
dispose();
setVisible(false);
} else if(e.getSource()==applyButton) {
int readiness =
(readinessEGR.isSelected()?1:0) +
(readinessCatalyst.isSelected()?2:0) +
(readinessMisfire.isSelected()?4:0) +
(readinessFuel.isSelected()?8:0) +
(readinessComprehensive.isSelected()?16:0) +
(readinessOxygenSensor.isSelected()?32:0) +
(readinessOxygenSensorHeater.isSelected()?64:0);
dtcClass.apply(
mil.getSelectedIndex(),
tflc.getSelectedIndex(),
Integer.parseInt(flc.getText()),
thlc.getSelectedIndex(),
Integer.parseInt(hlc.getText()),
scatt.getSelectedIndex(),
tdlcpen.getSelectedIndex(),
Integer.parseInt(dlcpen.getText()),
tdlc.getSelectedIndex(),
Integer.parseInt(dlckd.getText()),
Integer.parseInt(dlc.getText()),
Integer.parseInt(prio.getText()),
syslamp.getSelectedIndex(),
reserf.getSelectedIndex(),
readiness
);
}
}
}