Remote Update to Release #1845
This commit is contained in:
parent
07eacf366a
commit
c96c94f188
|
@ -1,4 +1,8 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# broadcast.sh
|
||||
# this file is part of rusEFI
|
||||
#
|
||||
while true
|
||||
do
|
||||
java -jar console/rusefi_console.jar network_connector
|
||||
|
|
|
@ -33,9 +33,14 @@ import static com.rusefi.binaryprotocol.BinaryProtocol.sleep;
|
|||
* see NetworkConnectorStartup
|
||||
*/
|
||||
public class NetworkConnector implements Closeable {
|
||||
/**
|
||||
* @see NetworkConnectorContext
|
||||
* See broadcash.sh
|
||||
*/
|
||||
public static final byte DISCONNECT = 14;
|
||||
public static final byte UPDATE_CONNECTOR_SOFTWARE = 15;
|
||||
public static final byte UPDATE_CONNECTOR_SOFTWARE_LATEST = 15;
|
||||
public static final byte UPDATE_FIRMWARE = 16;
|
||||
public static final byte UPDATE_CONNECTOR_SOFTWARE_RELEASE = 17;
|
||||
private final static Logging log = Logging.getLogging(NetworkConnector.class);
|
||||
private boolean isClosed;
|
||||
|
||||
|
@ -138,8 +143,10 @@ public class NetworkConnector implements Closeable {
|
|||
if (command == Fields.TS_ONLINE_PROTOCOL) {
|
||||
byte connectorCommand = packet.getPacket()[1];
|
||||
log.info("Got connector command " + packet.getPacket());
|
||||
if (connectorCommand == NetworkConnector.UPDATE_CONNECTOR_SOFTWARE) {
|
||||
context.onConnectorSoftwareUpdateRequest();
|
||||
if (connectorCommand == NetworkConnector.UPDATE_CONNECTOR_SOFTWARE_LATEST) {
|
||||
context.onConnectorSoftwareUpdateToLatestRequest();
|
||||
} else if (connectorCommand == NetworkConnector.UPDATE_CONNECTOR_SOFTWARE_RELEASE) {
|
||||
context.onConnectorSoftwareUpdateToReleaseRequest();
|
||||
} else if (connectorCommand == NetworkConnector.UPDATE_FIRMWARE) {
|
||||
context.onFirmwareUpdateRequest();
|
||||
}
|
||||
|
|
|
@ -9,8 +9,9 @@ import static com.devexperts.logging.Logging.getLogging;
|
|||
|
||||
public class NetworkConnectorContext {
|
||||
private static final Logging log = getLogging(NetworkConnectorContext.class);
|
||||
private static final int UPDATE_SBC_EXIT_CODE = 15;
|
||||
private static final int UPDATE_LATEST_SBC_EXIT_CODE = 15;
|
||||
public static final int UPDATE_FIRMWARE_EXIT_CODE = 16;
|
||||
private static final int UPDATE_RELEASE_SBC_EXIT_CODE = 17;
|
||||
|
||||
public int reconnectDelay() {
|
||||
return 15; // this one is seconds
|
||||
|
@ -33,9 +34,14 @@ public class NetworkConnectorContext {
|
|||
return ProxyClient.SERVER_PORT_FOR_CONTROLLERS;
|
||||
}
|
||||
|
||||
public void onConnectorSoftwareUpdateRequest() {
|
||||
log.info("onConnectorSoftwareUpdateRequest");
|
||||
System.exit(UPDATE_SBC_EXIT_CODE);
|
||||
public void onConnectorSoftwareUpdateToLatestRequest() {
|
||||
log.info("onConnectorSoftwareUpdateToLatestRequest");
|
||||
System.exit(UPDATE_LATEST_SBC_EXIT_CODE);
|
||||
}
|
||||
|
||||
public void onConnectorSoftwareUpdateToReleaseRequest() {
|
||||
log.info("onConnectorSoftwareUpdateToReleaseRequest");
|
||||
System.exit(UPDATE_RELEASE_SBC_EXIT_CODE);
|
||||
}
|
||||
|
||||
public void onFirmwareUpdateRequest() {
|
||||
|
|
|
@ -2,5 +2,6 @@ package com.rusefi.proxy.client;
|
|||
|
||||
public enum UpdateType {
|
||||
CONTROLLER,
|
||||
FIRMWARE
|
||||
FIRMWARE,
|
||||
CONTROLLER_RELEASE,
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class FullServerTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onConnectorSoftwareUpdateRequest() {
|
||||
public void onConnectorSoftwareUpdateToLatestRequest() {
|
||||
softwareUpdateRequest.countDown();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -51,8 +51,10 @@ public class UpdateRequestHandler implements Take {
|
|||
try {
|
||||
if (type.equals(UpdateType.FIRMWARE.name())) {
|
||||
state.invokeOnlineCommand(NetworkConnector.UPDATE_FIRMWARE);
|
||||
} else if (type.equals(UpdateType.CONTROLLER_RELEASE.name())) {
|
||||
state.invokeOnlineCommand(NetworkConnector.UPDATE_FIRMWARE);
|
||||
} else {
|
||||
state.invokeOnlineCommand(NetworkConnector.UPDATE_CONNECTOR_SOFTWARE);
|
||||
state.invokeOnlineCommand(NetworkConnector.UPDATE_CONNECTOR_SOFTWARE_LATEST);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
|
|
|
@ -48,10 +48,11 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
public class RemoteTab {
|
||||
private static final String APPLICATION_PORT = "application_port";
|
||||
public static final String HOWTO_REMOTE_TUNING = "https://github.com/rusefi/rusefi/wiki/HOWTO-Remote-Tuning";
|
||||
private static final String UPDATE_ECU_FIRMWARE = "Update ECU firmware";
|
||||
private static final String UPDATE_REMOTE_CONNECTOR_SOFTWARE = "Update Remote Connector Software";
|
||||
private final JComponent content = new JPanel(new BorderLayout());
|
||||
private final JScrollPane scroll = new JScrollPane(content, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
|
||||
|
||||
private final JPanel list = new JPanel(new VerticalFlowLayout());
|
||||
private final JTextField oneTimePasswordControl = new JTextField("0") {
|
||||
@Override
|
||||
|
@ -184,7 +185,7 @@ public class RemoteTab {
|
|||
|
||||
if (publicSession.getImplementation().equals(NetworkConnector.Implementation.SBC.name())) {
|
||||
|
||||
JButton updateSoftware = new JButton("Update Remote Connector Software");
|
||||
JButton updateSoftware = new JButton(UPDATE_REMOTE_CONNECTOR_SOFTWARE);
|
||||
updateSoftware.addActionListener(new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -194,7 +195,7 @@ public class RemoteTab {
|
|||
bottomPanel.add(updateSoftware);
|
||||
}
|
||||
|
||||
JButton updateFirmware = new JButton("Update ECU firmware");
|
||||
JButton updateFirmware = new JButton(UPDATE_ECU_FIRMWARE);
|
||||
updateFirmware.addActionListener(new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
|
Loading…
Reference in New Issue