update connector button progress
This commit is contained in:
parent
23a9c490bf
commit
8970f0d417
|
@ -77,7 +77,6 @@ public class SessionDetails {
|
||||||
String authToken = (String) jsonObject.get(AUTH_TOKEN);
|
String authToken = (String) jsonObject.get(AUTH_TOKEN);
|
||||||
long oneTimeCode = (Long) jsonObject.get(VEHICLE_TOKEN);
|
long oneTimeCode = (Long) jsonObject.get(VEHICLE_TOKEN);
|
||||||
long connectorVersion = (long) jsonObject.get(CONNECTOR_VERSION);
|
long connectorVersion = (long) jsonObject.get(CONNECTOR_VERSION);
|
||||||
String age = (String) jsonObject.get(AGE);
|
|
||||||
NetworkConnector.Implementation implementation = NetworkConnector.Implementation.find((String) jsonObject.get(IMPLEMENTATION));
|
NetworkConnector.Implementation implementation = NetworkConnector.Implementation.find((String) jsonObject.get(IMPLEMENTATION));
|
||||||
|
|
||||||
ControllerInfo controllerInfo = ControllerInfo.valueOf((String) jsonObject.get(CONTROLLER));
|
ControllerInfo controllerInfo = ControllerInfo.valueOf((String) jsonObject.get(CONTROLLER));
|
||||||
|
|
|
@ -56,7 +56,8 @@ public class ProxyClient {
|
||||||
boolean isUsed = (Boolean) element.get(IS_USED);
|
boolean isUsed = (Boolean) element.get(IS_USED);
|
||||||
String ownerName = (String) element.get(OWNER);
|
String ownerName = (String) element.get(OWNER);
|
||||||
String age = (String) element.get(SessionDetails.AGE);
|
String age = (String) element.get(SessionDetails.AGE);
|
||||||
userLists.add(new PublicSession(vehicleOwner, ci, isUsed, ownerName, age));
|
String implementation = (String) element.get(SessionDetails.IMPLEMENTATION);
|
||||||
|
userLists.add(new PublicSession(vehicleOwner, ci, isUsed, ownerName, age, implementation));
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("object=" + array);
|
System.out.println("object=" + array);
|
||||||
|
|
|
@ -15,13 +15,19 @@ public class PublicSession {
|
||||||
*/
|
*/
|
||||||
private final String tunerName;
|
private final String tunerName;
|
||||||
private final String age;
|
private final String age;
|
||||||
|
private final String implementation;
|
||||||
|
|
||||||
public PublicSession(UserDetails vehicleOwner, ControllerInfo controllerInfo, boolean isUsed, String tunerName, String age) {
|
public PublicSession(UserDetails vehicleOwner, ControllerInfo controllerInfo, boolean isUsed, String tunerName, String age, String implementation) {
|
||||||
this.vehicleOwner = vehicleOwner;
|
this.vehicleOwner = vehicleOwner;
|
||||||
this.controllerInfo = controllerInfo;
|
this.controllerInfo = controllerInfo;
|
||||||
this.isUsed = isUsed;
|
this.isUsed = isUsed;
|
||||||
this.tunerName = tunerName;
|
this.tunerName = tunerName;
|
||||||
this.age = age;
|
this.age = age;
|
||||||
|
this.implementation = implementation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImplementation() {
|
||||||
|
return implementation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAge() {
|
public String getAge() {
|
||||||
|
|
|
@ -173,18 +173,22 @@ public class RemoteTab {
|
||||||
if (publicSession.isUsed()) {
|
if (publicSession.isUsed()) {
|
||||||
bottomPanel.add(new JLabel(" Used by " + publicSession.getTunerName()));
|
bottomPanel.add(new JLabel(" Used by " + publicSession.getTunerName()));
|
||||||
} else {
|
} else {
|
||||||
JButton connect = new JButton("Connect to " + publicSession.getVehicleOwner().getUserName());
|
JButton connect = new JButton("Connect to " + publicSession.getVehicleOwner().getUserName() + " ECU");
|
||||||
connect.addActionListener(event -> connectToProxy(publicSession));
|
connect.addActionListener(event -> connectToProxy(publicSession));
|
||||||
bottomPanel.add(connect);
|
bottomPanel.add(connect);
|
||||||
|
|
||||||
if (InstanceAuthContext.isOurController(publicSession.getVehicleOwner().getUserId())) {
|
if (InstanceAuthContext.isOurController(publicSession.getVehicleOwner().getUserId())) {
|
||||||
JButton updateSoftware = new JButton("Update Connector");
|
|
||||||
|
if (publicSession.getImplementation().equals(NetworkConnector.Implementation.SBC.name())) {
|
||||||
|
|
||||||
|
JButton updateSoftware = new JButton("Update Remote Connector Software");
|
||||||
updateSoftware.addActionListener(new AbstractAction() {
|
updateSoftware.addActionListener(new AbstractAction() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
try {
|
||||||
LocalApplicationProxy.requestSoftwareUpdate(HttpUtil.PROXY_JSON_API_HTTP_PORT,
|
LocalApplicationProxy.requestSoftwareUpdate(HttpUtil.PROXY_JSON_API_HTTP_PORT,
|
||||||
getApplicationRequest(publicSession));
|
getApplicationRequest(publicSession));
|
||||||
|
updateSoftware.setText("Update requested");
|
||||||
} catch (IOException ioException) {
|
} catch (IOException ioException) {
|
||||||
ioException.printStackTrace();
|
ioException.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -192,17 +196,15 @@ public class RemoteTab {
|
||||||
});
|
});
|
||||||
bottomPanel.add(updateSoftware);
|
bottomPanel.add(updateSoftware);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JPanel userPanel = new JPanel(new BorderLayout());
|
JPanel userPanel = new JPanel(new BorderLayout());
|
||||||
|
|
||||||
|
|
||||||
JPanel infoLine = new JPanel(new FlowLayout());
|
JPanel infoLine = new JPanel(new FlowLayout());
|
||||||
infoLine.add(new JLabel("Age " + publicSession.getAge()));
|
infoLine.add(new JLabel("Age " + publicSession.getAge()));
|
||||||
infoLine.add(getSignatureDownload(controllerInfo));
|
infoLine.add(getSignatureDownload(controllerInfo));
|
||||||
|
|
||||||
|
|
||||||
userPanel.add(topLine, BorderLayout.NORTH);
|
userPanel.add(topLine, BorderLayout.NORTH);
|
||||||
userPanel.add(infoLine, BorderLayout.CENTER);
|
userPanel.add(infoLine, BorderLayout.CENTER);
|
||||||
userPanel.add(bottomPanel, BorderLayout.SOUTH);
|
userPanel.add(bottomPanel, BorderLayout.SOUTH);
|
||||||
|
|
Loading…
Reference in New Issue