StreamCommand.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:jaer 作者:
/**
  * gets a list of all available serial port names
  *
  * @return a platform dependent list of strings representing all the
  *      available serial ports -- it is the application's responsibility
  *      to identify the right port to which the device is actually connected
  */
 public String[] getPortNames()
 {
     ArrayList<String> ret= new ArrayList<String>();
     Enumeration<CommPortIdentifier> portsEnum= CommPortIdentifier.getPortIdentifiers();

     while(portsEnum.hasMoreElements())
     {
         CommPortIdentifier pid= portsEnum.nextElement();
         if (pid.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    ret.add(pid.getName());
}
     }

     return ret.toArray(new String[ret.size()]);
 }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号