This tool is used during the intake process for donated computers at PCs for People. It is packaged into a custom Linux Mint ISO that can be loaded over PXE and will transmit the machine's hardware specification to the organization's CRM after a PID (internal computer identification number) has been assigned. The following classes have been altered to exclude any proprietary information.
package GUI;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
/**
* This class holds the Main Frame of the Discovery Graphical User InterfaceAddress
*
* @author Stefani Monson
*/
public class MainFrame extends JFrame {
private InfoPanel infoPanel;
public MainFrame() {
super("Discovery");
infoPanel = new InfoPanel();
setLayout(new BorderLayout());
setMinimumSize(new Dimension(750, 400));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
add(infoPanel);
}
}
package GUI;
import javax.swing.JLabel;
import javax.swing.JPanel;
import model.ComputerStats;
import controller.GetComputerstats;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
/**
* This class holds the Panel that displays the computer stats
* @author Stefani Monson
*/
public class InfoPanel extends JPanel {
private final JLabel lblProcLabel;
private final JLabel lblCPUSpeedLabel;
private final JLabel lblDisplayLabel;
private final JLabel lblAudioLabel;
private JLabel lblProc;
private JLabel lblCPUSpeed;
private JLabel lblDisplay;
private JLabel lblAudio;
private ComputerStats stats;
public InfoPanel(){
lblProcLabel = new JLabel("Processor: ");
lblCPUSpeedLabel = new JLabel("CPU Speed: ");
lblDisplayLabel = new JLabel("Display Adapter: ");
lblAudioLabel = new JLabel("Audio Controller: ");
loadStats();
setLayout(new GridBagLayout());
GridBagConstraints gc = new GridBagConstraints();
gc.gridx = 0;
gc.gridy = 0;
gc.anchor= GridBagConstraints.FIRST_LINE_START;
add(lblProcLabel, gc);
gc.gridx++;
add(lblProc, gc);
gc.gridx = 0;
gc.gridy++;
add(lblCPUSpeedLabel, gc);
gc.gridx++;
add(lblCPUSpeed, gc);
}
private void loadStats(){
GetComputerstats get = new GetComputerstats();
stats = get.load();
lblProc = new JLabel(stats.getProcessor());
lblCPUSpeed = new JLabel(stats.getCpuspeed());
}
package controller;
import java.io.File;
import model.ComputerStats;
/**
* This class runs various linux commands to gather hardware information from the computer.
*
* @author Stefani Monson
*/
public class GetComputerstats {
private ComputerStats stats;
private String singlecommand;
private String[] command;
private CommandReader executeCommand;
private FileReader filename;
private File file;
public GetComputerstats() {
stats = new ComputerStats();
}
public ComputerStats load(){
try {
filename = new FileReader("/proc/cpuinfo");
stats.setProcessor(filename.printLinesWhichContain("model name").substring(13).trim());
} catch (Exception e){
stats.setProcessor("N/A");
}
try {
singlecommand = "";
} catch (Exception e){
stats.setDisplay("N/A");
}
return stats;
}
}