Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
  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);
    }
  }
Esempio n. 3
0
 /**
  * @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();
 }
Esempio n. 4
0
 public static Map<String, String> getProperties(String portName) {
   return SerialPortList.getPortProperties(portName);
 }
Esempio n. 5
0
 public static List<String> listAvailablePortNames() {
   String[] portNames = SerialPortList.getPortNames();
   return Arrays.asList(portNames);
 }
Esempio n. 6
0
 public static List<String> list() {
   return Arrays.asList(SerialPortList.getPortNames());
 }