Skip to content

Commit 8d6fa72

Browse files
committedJan 23, 2019
Removing fixed fields in BoardPort
1 parent d7143d6 commit 8d6fa72

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
@@ -2392,9 +2392,9 @@ private void handleBoardInfo() {
23922392
for (BoardPort port : ports) {
23932393
if (port.getAddress().equals(selectedPort)) {
23942394
label = port.getBoardName();
2395-
vid = port.getVID();
2396-
pid = port.getPID();
2397-
iserial = port.getISerial();
2395+
vid = port.getPrefs().get("vid");
2396+
pid = port.getPrefs().get("pid");
2397+
iserial = port.getPrefs().get("iserial");
23982398
protocol = port.getProtocol();
23992399
found = true;
24002400
break;

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

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -104,41 +104,9 @@ public boolean isOnline() {
104104
return online;
105105
}
106106

107-
public void setVIDPID(String vid, String pid) {
108-
if (vid == null) {
109-
prefs.remove("vendorId");
110-
} else {
111-
prefs.put("vendorId", vid);
112-
}
113-
if (pid == null) {
114-
prefs.remove("productId");
115-
} else {
116-
prefs.put("productId", pid);
117-
}
118-
}
119-
120-
public String getVID() {
121-
return prefs.get("vendorId");
122-
}
123-
124-
public String getPID() {
125-
return prefs.get("productId");
126-
}
127-
128-
public void setISerial(String iserial) {
129-
if (iserial == null) {
130-
prefs.remove("serialNumber");
131-
} else {
132-
prefs.put("serialNumber", iserial);
133-
}
134-
}
135-
public String getISerial() {
136-
return prefs.get("serialNumber");
137-
}
138-
139107
@Override
140108
public String toString() {
141-
return this.address+"_"+getVID()+"_"+getPID();
109+
return this.address;
142110
}
143111

144112
// 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");
@@ -158,12 +155,14 @@ public synchronized void retriggerDiscovery(boolean polled) {
158155
}
159156
} else {
160157
if (!parts[1].equals("0000")) {
161-
boardPort.setVIDPID(parts[1], parts[2]);
158+
boardPort.getPrefs().put("vid", parts[1]);
159+
boardPort.getPrefs().put("pid", parts[2]);
162160
// ask Cloud API to match the board with known VID/PID pair
163161
platform.getBoardWithMatchingVidPidFromCloud(parts[1], parts[2]);
164162
} else {
165-
boardPort.setVIDPID("0000", "0000");
166-
boardPort.setISerial("");
163+
boardPort.getPrefs().put("vid", "0000");
164+
boardPort.getPrefs().put("pid", "0000");
165+
boardPort.getPrefs().put("iserial", "");
167166
}
168167
}
169168

0 commit comments

Comments
 (0)
Please sign in to comment.