/** * Returns the first available port * * @return If none is available returns NULL */ public static String getFirstAvailable() { String[] portNames = SerialPortList.getPortNames(); if (portNames != null && portNames.length > 0) { for (String port : portNames) { if (!port.contains("rfcomm0")) { return port; } } return null; } return null; }
public void refreshSerialPortList() { String[] serialPortList = SerialPortList.getPortNames(); portMenu.removeAll(); portMenu.add(refreshItem); JMenuItem menuItem; for (String serialPort : serialPortList) { menuItem = new JMenuItem(serialPort); menuItem.addActionListener(e -> onSerialPortClicked(e.getActionCommand())); portMenu.add(menuItem); } }
/** * @generate Serial_list.xml * @webref serial * @usage web_application */ public static String[] list() { // returns list sorted alphabetically, thus cu.* comes before tty.* // this was different with RXTX return SerialPortList.getPortNames(); }
public static Map<String, String> getProperties(String portName) { return SerialPortList.getPortProperties(portName); }
public static List<String> listAvailablePortNames() { String[] portNames = SerialPortList.getPortNames(); return Arrays.asList(portNames); }
public static List<String> list() { return Arrays.asList(SerialPortList.getPortNames()); }