TwoWaySerialComm2.java 文件源码

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

项目:ATCommandTester 作者:
public String listPorts() {
    List<String> port_name = new ArrayList<String>();
    String tmp = "";

    // int i = 0;
    @SuppressWarnings("unchecked")
    Enumeration<CommPortIdentifier> portEnum = CommPortIdentifier
            .getPortIdentifiers();

    // Enumeration portList = CommPortIdentifier.getPortIdentifiers();
    while (portEnum.hasMoreElements()) {
        CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum
                .nextElement();
        if (getPortTypeName(portIdentifier.getPortType()) == "Serial") {
            port_name.add(portIdentifier.getName());
            String tmp2 = portIdentifier.getName() + "#";

            tmp = tmp + tmp2;
        }
        System.out.println(portIdentifier.getName() + " - "
                + getPortTypeName(portIdentifier.getPortType()));
    }
    // i = port_name.size();

    return tmp;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号