mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
Removing fixed fields in BoardPort
This commit is contained in:
parent
d7143d6859
commit
8d6fa72667
@ -2392,9 +2392,9 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
for (BoardPort port : ports) {
|
||||
if (port.getAddress().equals(selectedPort)) {
|
||||
label = port.getBoardName();
|
||||
vid = port.getVID();
|
||||
pid = port.getPID();
|
||||
iserial = port.getISerial();
|
||||
vid = port.getPrefs().get("vid");
|
||||
pid = port.getPrefs().get("pid");
|
||||
iserial = port.getPrefs().get("iserial");
|
||||
protocol = port.getProtocol();
|
||||
found = true;
|
||||
break;
|
||||
|
@ -104,41 +104,9 @@ public class BoardPort {
|
||||
return online;
|
||||
}
|
||||
|
||||
public void setVIDPID(String vid, String pid) {
|
||||
if (vid == null) {
|
||||
prefs.remove("vendorId");
|
||||
} else {
|
||||
prefs.put("vendorId", vid);
|
||||
}
|
||||
if (pid == null) {
|
||||
prefs.remove("productId");
|
||||
} else {
|
||||
prefs.put("productId", pid);
|
||||
}
|
||||
}
|
||||
|
||||
public String getVID() {
|
||||
return prefs.get("vendorId");
|
||||
}
|
||||
|
||||
public String getPID() {
|
||||
return prefs.get("productId");
|
||||
}
|
||||
|
||||
public void setISerial(String iserial) {
|
||||
if (iserial == null) {
|
||||
prefs.remove("serialNumber");
|
||||
} else {
|
||||
prefs.put("serialNumber", iserial);
|
||||
}
|
||||
}
|
||||
public String getISerial() {
|
||||
return prefs.get("serialNumber");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.address+"_"+getVID()+"_"+getPID();
|
||||
return this.address;
|
||||
}
|
||||
|
||||
// Search for the board which matches identificationPrefs.
|
||||
|
@ -78,7 +78,7 @@ public class PluggableDiscovery implements Discovery {
|
||||
while (program != null && program.isAlive()) {
|
||||
PluggableDiscoveryMessage msg = mapper.readValue(parser, PluggableDiscoveryMessage.class);
|
||||
if (msg != null) {
|
||||
System.out.println(discoveryName + ": received json: vid=" + msg.getVID() + ", pid=" + msg.getPID() + ", sernum=" + msg.getISerial());
|
||||
System.out.println(discoveryName + ": received json: " + msg.getPrefs());
|
||||
String event = msg.getEventType();
|
||||
if (event != null) {
|
||||
if (event.equals("Error: START_SYNC not supported")) {
|
||||
|
@ -136,16 +136,13 @@ public class SerialBoardsLister extends TimerTask {
|
||||
if (boardData != null) {
|
||||
boardPort.getPrefs().put("vid", boardData.get("vid").toString());
|
||||
boardPort.getPrefs().put("pid", boardData.get("pid").toString());
|
||||
boardPort.setVIDPID(parts[1], parts[2]);
|
||||
|
||||
String iserial = boardData.get("iserial").toString();
|
||||
if (iserial.length() >= 10) {
|
||||
boardPort.getPrefs().put("iserial", iserial);
|
||||
boardPort.setISerial(iserial);
|
||||
}
|
||||
if (uploadInProgress && oldUploadBoardPort!=null) {
|
||||
oldUploadBoardPort.getPrefs().put("iserial", iserial);
|
||||
oldUploadBoardPort.setISerial(iserial);
|
||||
}
|
||||
|
||||
TargetBoard board = (TargetBoard) boardData.get("board");
|
||||
@ -158,12 +155,14 @@ public class SerialBoardsLister extends TimerTask {
|
||||
}
|
||||
} else {
|
||||
if (!parts[1].equals("0000")) {
|
||||
boardPort.setVIDPID(parts[1], parts[2]);
|
||||
boardPort.getPrefs().put("vid", parts[1]);
|
||||
boardPort.getPrefs().put("pid", parts[2]);
|
||||
// ask Cloud API to match the board with known VID/PID pair
|
||||
platform.getBoardWithMatchingVidPidFromCloud(parts[1], parts[2]);
|
||||
} else {
|
||||
boardPort.setVIDPID("0000", "0000");
|
||||
boardPort.setISerial("");
|
||||
boardPort.getPrefs().put("vid", "0000");
|
||||
boardPort.getPrefs().put("pid", "0000");
|
||||
boardPort.getPrefs().put("iserial", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user