Skip to content

Commit a6da7a2

Browse files
cmagliefacchinm
authored andcommitted
Removing fixed fields in BoardPort
1 parent 570f047 commit a6da7a2

File tree

4 files changed

+10
-43
lines changed

4 files changed

+10
-43
lines changed

app/src/processing/app/Editor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,9 +2448,9 @@ private void handleBoardInfo() {
24482448
for (BoardPort port : ports) {
24492449
if (port.getAddress().equals(selectedPort)) {
24502450
label = port.getBoardName();
2451-
vid = port.getVID();
2452-
pid = port.getPID();
2453-
iserial = port.getISerial();
2451+
vid = port.getPrefs().get("vid");
2452+
pid = port.getPrefs().get("pid");
2453+
iserial = port.getPrefs().get("iserial");
24542454
protocol = port.getProtocol();
24552455
found = true;
24562456
break;

arduino-core/src/cc/arduino/packages/BoardPort.java

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -113,41 +113,9 @@ public boolean isOnline() {
113113
return online;
114114
}
115115

116-
public void setVIDPID(String vid, String pid) {
117-
if (vid == null) {
118-
prefs.remove("vendorId");
119-
} else {
120-
prefs.put("vendorId", vid);
121-
}
122-
if (pid == null) {
123-
prefs.remove("productId");
124-
} else {
125-
prefs.put("productId", pid);
126-
}
127-
}
128-
129-
public String getVID() {
130-
return prefs.get("vendorId");
131-
}
132-
133-
public String getPID() {
134-
return prefs.get("productId");
135-
}
136-
137-
public void setISerial(String iserial) {
138-
if (iserial == null) {
139-
prefs.remove("serialNumber");
140-
} else {
141-
prefs.put("serialNumber", iserial);
142-
}
143-
}
144-
public String getISerial() {
145-
return prefs.get("serialNumber");
146-
}
147-
148116
@Override
149117
public String toString() {
150-
return this.address+"_"+getVID()+"_"+getPID();
118+
return this.address;
151119
}
152120

153121
// Search for the board which matches identificationPrefs.

arduino-core/src/cc/arduino/packages/discoverers/PluggableDiscovery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void run() {
7878
while (program != null && program.isAlive()) {
7979
PluggableDiscoveryMessage msg = mapper.readValue(parser, PluggableDiscoveryMessage.class);
8080
if (msg != null) {
81-
System.out.println(discoveryName + ": received json: vid=" + msg.getVID() + ", pid=" + msg.getPID() + ", sernum=" + msg.getISerial());
81+
System.out.println(discoveryName + ": received json: " + msg.getPrefs());
8282
String event = msg.getEventType();
8383
if (event != null) {
8484
if (event.equals("Error: START_SYNC not supported")) {

arduino-core/src/cc/arduino/packages/discoverers/serial/SerialBoardsLister.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,13 @@ public synchronized void retriggerDiscovery(boolean polled) {
136136
if (boardData != null) {
137137
boardPort.getPrefs().put("vid", boardData.get("vid").toString());
138138
boardPort.getPrefs().put("pid", boardData.get("pid").toString());
139-
boardPort.setVIDPID(parts[1], parts[2]);
140139

141140
String iserial = boardData.get("iserial").toString();
142141
if (iserial.length() >= 10) {
143142
boardPort.getPrefs().put("iserial", iserial);
144-
boardPort.setISerial(iserial);
145143
}
146144
if (uploadInProgress && oldUploadBoardPort!=null) {
147145
oldUploadBoardPort.getPrefs().put("iserial", iserial);
148-
oldUploadBoardPort.setISerial(iserial);
149146
}
150147

151148
TargetBoard board = (TargetBoard) boardData.get("board");
@@ -159,12 +156,14 @@ public synchronized void retriggerDiscovery(boolean polled) {
159156
}
160157
} else {
161158
if (!parts[1].equals("0000")) {
162-
boardPort.setVIDPID(parts[1], parts[2]);
159+
boardPort.getPrefs().put("vid", parts[1]);
160+
boardPort.getPrefs().put("pid", parts[2]);
163161
// ask Cloud API to match the board with known VID/PID pair
164162
platform.getBoardWithMatchingVidPidFromCloud(parts[1], parts[2]);
165163
} else {
166-
boardPort.setVIDPID("0000", "0000");
167-
boardPort.setISerial("");
164+
boardPort.getPrefs().put("vid", "0000");
165+
boardPort.getPrefs().put("pid", "0000");
166+
boardPort.getPrefs().put("iserial", "");
168167
}
169168
}
170169

0 commit comments

Comments
 (0)