mirror of https://github.com/FOME-Tech/fome-fw.git
console refactoring
This commit is contained in:
parent
baa9bc3cfc
commit
4b2f01016f
|
@ -163,12 +163,6 @@ public class StartupFrame {
|
|||
setFrameIcon(frame);
|
||||
frame.setVisible(true);
|
||||
UiUtils.centerWindow(frame);
|
||||
|
||||
KeyListener hwTestEasterEgg = functionalTestEasterEgg();
|
||||
|
||||
for (Component component : getAllComponents(frame)) {
|
||||
component.addKeyListener(hwTestEasterEgg);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyKnownPorts(SerialPortScanner.AvailableHardware currentHardware) {
|
||||
|
@ -232,36 +226,6 @@ public class StartupFrame {
|
|||
new ConsoleUI(selectedPort.port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Here we listen to keystrokes while console start-up frame is being displayed and if magic "test" word is typed
|
||||
* we launch a functional test on real hardware, same as Jenkins runs within continuous integration
|
||||
*/
|
||||
@NotNull
|
||||
private KeyListener functionalTestEasterEgg() {
|
||||
return new KeyAdapter() {
|
||||
private final static String TEST = "test";
|
||||
private String recentKeyStrokes = "";
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
recentKeyStrokes = recentKeyStrokes + e.getKeyChar();
|
||||
if (recentKeyStrokes.toLowerCase().endsWith(TEST) && showTestConfirmation()) {
|
||||
runFunctionalHardwareTest();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean showTestConfirmation() {
|
||||
return JOptionPane.showConfirmDialog(StartupFrame.this.frame, "Want to run functional test? This would freeze UI for the duration of the test",
|
||||
"Better do not run while connected to vehicle!!!", YES_NO_OPTION) == JOptionPane.YES_OPTION;
|
||||
}
|
||||
|
||||
private void runFunctionalHardwareTest() {
|
||||
boolean isSuccess = HwCiF4Discovery.runHardwareTest();
|
||||
JOptionPane.showMessageDialog(null, "Function test passed: " + isSuccess + "\nSee log folder for details.");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void disposeFrameAndProceed() {
|
||||
isProceeding = true;
|
||||
frame.dispose();
|
||||
|
|
|
@ -46,7 +46,6 @@ public class ConsoleTools {
|
|||
registerTool("headless", ConsoleTools::runHeadless, "Connect to rusEFI controller and start saving logs.");
|
||||
|
||||
registerTool("ptrace_enums", ConsoleTools::runPerfTraceTool, "NOT A USER TOOL. Development tool to process performance trace enums");
|
||||
registerTool("functional_test", ConsoleTools::runFunctionalTest, "NOT A USER TOOL. Development tool related to functional testing");
|
||||
registerTool("convert_binary_configuration_to_xml", ConsoleTools::convertBinaryToXml, "NOT A USER TOOL. Development tool to convert binary configuration into XML form.");
|
||||
|
||||
registerTool("get_image_tune_crc", ConsoleTools::calcBinaryImageTuneCrc, "Calculate tune CRC for given binary tune");
|
||||
|
@ -129,12 +128,6 @@ public class ConsoleTools {
|
|||
PerfTraceTool.readPerfTrace(args[1], args[2], args[3], args[4]);
|
||||
}
|
||||
|
||||
private static void runFunctionalTest(String[] args) throws InterruptedException {
|
||||
// passing port argument if it was specified
|
||||
String[] toolArgs = args.length == 1 ? new String[0] : new String[]{args[1]};
|
||||
HwCiF4Discovery.main(toolArgs);
|
||||
}
|
||||
|
||||
private static void runHeadless(String[] args) {
|
||||
String onConnectedCallback = args.length > 1 ? args[1] : null;
|
||||
String onDisconnectedCallback = args.length > 2 ? args[2] : null;
|
||||
|
|
Loading…
Reference in New Issue