()
| 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 → Page Setup. |
no test coverage detected