MCPcopy
hub / github.com/arduino/Arduino / handleBoardInfo

Method handleBoardInfo

app/src/processing/app/Editor.java:2408–2460  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2406 }
2407
2408 private void handleBoardInfo() {
2409 console.clear();
2410
2411 String selectedPort = PreferencesData.get("serial.port");
2412 List<BoardPort> ports = Base.getDiscoveryManager().discovery();
2413
2414 String label = "";
2415 String vid = "";
2416 String pid = "";
2417 String iserial = "";
2418 String protocol = "";
2419 boolean found = false;
2420
2421 for (BoardPort port : ports) {
2422 if (port.getAddress().equals(selectedPort)) {
2423 label = port.getBoardName();
2424 vid = port.getPrefs().get("vid");
2425 pid = port.getPrefs().get("pid");
2426 iserial = port.getPrefs().get("iserial");
2427 protocol = port.getProtocol();
2428 found = true;
2429 break;
2430 }
2431 }
2432
2433 if (!found) {
2434 statusNotice(tr("Please select a port to obtain board info"));
2435 return;
2436 }
2437
2438 if (protocol.equals("network")) {
2439 statusNotice(tr("Network port, can't obtain info"));
2440 return;
2441 }
2442
2443 if (vid == null || vid.equals("") || vid.equals("0000")) {
2444 statusNotice(tr("Native serial port, can't obtain info"));
2445 return;
2446 }
2447
2448 if (iserial == null || iserial.equals("")) {
2449 iserial = tr("Upload any sketch to obtain it");
2450 }
2451
2452 if (label == null) {
2453 label = tr("Unknown board");
2454 }
2455
2456 String infos = I18n.format("BN: {0}\nVID: {1}\nPID: {2}\nSN: {3}", label, vid, pid, iserial);
2457 JTextArea textArea = new JTextArea(infos);
2458
2459 JOptionPane.showMessageDialog(this, textArea, tr("Board Info"), JOptionPane.PLAIN_MESSAGE);
2460 }
2461
2462 /**
2463 * Handler for File &rarr; Page Setup.

Callers 1

buildToolsMenuMethod · 0.95

Calls 13

getMethod · 0.95
getDiscoveryManagerMethod · 0.95
statusNoticeMethod · 0.95
formatMethod · 0.95
discoveryMethod · 0.80
getAddressMethod · 0.80
getBoardNameMethod · 0.80
getPrefsMethod · 0.80
getProtocolMethod · 0.80
trMethod · 0.80
getMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected