204 lines
7.7 KiB
Java
204 lines
7.7 KiB
Java
/*
|
|
* (C) Copyright 2015 by fr3ts0n <erwin.scheuch-heilig@gmx.at>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation; either version 2 of
|
|
* the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
* MA 02111-1307 USA
|
|
*/
|
|
|
|
package com.fr3ts0n.ecu.gui.application;
|
|
|
|
/**
|
|
* Fault code propertiy panel
|
|
*
|
|
* @author erwin
|
|
*/
|
|
public class VagCodeStatPanel extends javax.swing.JPanel
|
|
{
|
|
public static final long serialVersionUID = 1L;
|
|
|
|
/** DFC symptoms to display */
|
|
private static final String[] Symptoms =
|
|
{
|
|
"No display",
|
|
"Value above MAX",
|
|
"Value below MIN",
|
|
"Mechanical fault",
|
|
"No signal / no communication",
|
|
"Base adjustment / adaption",
|
|
"Shortcut to battery",
|
|
"Shortcut to ground",
|
|
"Signal plausibility",
|
|
"Open load / Shortcut to ground",
|
|
"Open load / Shortcut to battery",
|
|
"Open load",
|
|
"Electric fault ",
|
|
"Please read fault codes",
|
|
"Defect",
|
|
"Currently not checkable",
|
|
};
|
|
|
|
/** Creates new form VagCodeStatPanel */
|
|
public VagCodeStatPanel()
|
|
{
|
|
initComponents();
|
|
}
|
|
|
|
/**
|
|
* This method is called from within the constructor to
|
|
* initialize the form.
|
|
* WARNING: Do NOT modify this code. The content of this method is
|
|
* always regenerated by the Form Editor.
|
|
*/
|
|
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
private void initComponents()
|
|
{
|
|
java.awt.GridBagConstraints gridBagConstraints;
|
|
|
|
javax.swing.JPanel jPanel1 = new javax.swing.JPanel();
|
|
javax.swing.JPanel panStatus = new javax.swing.JPanel();
|
|
javax.swing.JPanel panMilStatus = new javax.swing.JPanel();
|
|
cbMilStatus = new javax.swing.JCheckBox();
|
|
javax.swing.JPanel panTestStatus = new javax.swing.JPanel();
|
|
cbTestComplete = new javax.swing.JCheckBox();
|
|
javax.swing.JPanel panFaultStatus = new javax.swing.JPanel();
|
|
cbSporadic = new javax.swing.JCheckBox();
|
|
cbShortTerm = new javax.swing.JCheckBox();
|
|
cbStatic = new javax.swing.JCheckBox();
|
|
javax.swing.JPanel panSymptom = new javax.swing.JPanel();
|
|
lblSymptom = new javax.swing.JLabel();
|
|
|
|
setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N
|
|
setLayout(new java.awt.BorderLayout());
|
|
|
|
jPanel1.setLayout(new java.awt.GridBagLayout());
|
|
|
|
panStatus.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Status", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 10))); // NOI18N
|
|
panStatus.setLayout(new java.awt.GridBagLayout());
|
|
|
|
panMilStatus
|
|
.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "MIL status", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 10))); // NOI18N
|
|
panMilStatus.setEnabled(false);
|
|
panMilStatus.setLayout(new java.awt.BorderLayout());
|
|
|
|
cbMilStatus.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N
|
|
cbMilStatus.setText("MIL on");
|
|
cbMilStatus.setEnabled(false);
|
|
panMilStatus.add(cbMilStatus, java.awt.BorderLayout.CENTER);
|
|
|
|
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
gridBagConstraints.gridx = 0;
|
|
gridBagConstraints.gridy = 0;
|
|
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
|
gridBagConstraints.weightx = 1.0;
|
|
panStatus.add(panMilStatus, gridBagConstraints);
|
|
|
|
panTestStatus.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DTC com.fr3ts0n.test status", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 10))); // NOI18N
|
|
panTestStatus.setEnabled(false);
|
|
panTestStatus.setLayout(new java.awt.BorderLayout());
|
|
|
|
cbTestComplete.setFont(new java.awt.Font("Dialog", 0, 10)); // NOI18N
|
|
cbTestComplete.setText("DTC com.fr3ts0n.test complete");
|
|
cbTestComplete.setEnabled(false);
|
|
panTestStatus.add(cbTestComplete, java.awt.BorderLayout.CENTER);
|
|
|
|
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
|
gridBagConstraints.weightx = 1.0;
|
|
panStatus.add(panTestStatus, gridBagConstraints);
|
|
|
|
panFaultStatus
|
|
.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Fault status", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 10))); // NOI18N
|
|
panFaultStatus.setEnabled(false);
|
|
panFaultStatus.setLayout(new java.awt.GridLayout(0, 3));
|
|
|
|
cbSporadic.setFont(new java.awt.Font("Dialog", 0, 10));
|
|
cbSporadic.setText("sporadic");
|
|
cbSporadic.setEnabled(false);
|
|
panFaultStatus.add(cbSporadic);
|
|
|
|
cbShortTerm.setFont(new java.awt.Font("Dialog", 0, 10));
|
|
cbShortTerm.setText("short term");
|
|
cbShortTerm.setEnabled(false);
|
|
panFaultStatus.add(cbShortTerm);
|
|
|
|
cbStatic.setFont(new java.awt.Font("Dialog", 0, 10));
|
|
cbStatic.setText("static");
|
|
cbStatic.setEnabled(false);
|
|
panFaultStatus.add(cbStatic);
|
|
|
|
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
|
gridBagConstraints.weightx = 1.0;
|
|
panStatus.add(panFaultStatus, gridBagConstraints);
|
|
|
|
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
gridBagConstraints.gridx = 0;
|
|
gridBagConstraints.gridy = 0;
|
|
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
|
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
|
|
gridBagConstraints.weightx = 1.0;
|
|
jPanel1.add(panStatus, gridBagConstraints);
|
|
|
|
panSymptom.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Symptom", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 10))); // NOI18N
|
|
panSymptom.setLayout(new java.awt.BorderLayout());
|
|
|
|
lblSymptom.setText("Symptom");
|
|
lblSymptom.setEnabled(false);
|
|
panSymptom.add(lblSymptom, java.awt.BorderLayout.CENTER);
|
|
|
|
gridBagConstraints = new java.awt.GridBagConstraints();
|
|
gridBagConstraints.gridx = 0;
|
|
gridBagConstraints.gridy = 1;
|
|
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
|
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
|
|
gridBagConstraints.weightx = 1.0;
|
|
gridBagConstraints.weighty = 1.0;
|
|
jPanel1.add(panSymptom, gridBagConstraints);
|
|
|
|
add(jPanel1, java.awt.BorderLayout.CENTER);
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
/**
|
|
* set all status flags from status integer
|
|
*
|
|
* @param newStatus DFC status
|
|
*/
|
|
public void setStatusFlags(int newStatus)
|
|
{
|
|
int symptom = newStatus & 0x0F;
|
|
boolean testComplete = (newStatus & 0x10) == 0x10;
|
|
boolean sporadic = (newStatus & 0x60) == 0x20;
|
|
boolean shortTerm = (newStatus & 0x60) == 0x40;
|
|
boolean staticFault = (newStatus & 0x60) == 0x60;
|
|
boolean milStatus = (newStatus & 0x80) == 0x80;
|
|
lblSymptom.setText(Symptoms[symptom]);
|
|
cbTestComplete.setSelected(testComplete);
|
|
cbSporadic.setSelected(sporadic);
|
|
cbShortTerm.setSelected(shortTerm);
|
|
cbStatic.setSelected(staticFault);
|
|
cbMilStatus.setSelected(milStatus);
|
|
}
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
private javax.swing.JCheckBox cbMilStatus;
|
|
private javax.swing.JCheckBox cbShortTerm;
|
|
private javax.swing.JCheckBox cbSporadic;
|
|
private javax.swing.JCheckBox cbStatic;
|
|
private javax.swing.JCheckBox cbTestComplete;
|
|
private javax.swing.JLabel lblSymptom;
|
|
// End of variables declaration//GEN-END:variables
|
|
|
|
}
|