Discovering comm ports

From Rxtx

(Difference between revisions)
Jump to: navigation, search
(http://zelgetgo.0lx.net/new56.htm)
Line 1: Line 1:
-
[http://zelgetgo.0lx.net/new56.htm aint funny it jennifer lopez lyric remix] [http://sakonze.qsh.eu/dronsan-83.html jerry springer video clip] [http://chifire.strefa.pl/news-1418.html edison movie trailer] [http://golxando.0lx.net/sitemap.html http] [http://fademon.0lx.net/article-1576.htm anal fireman fucking gay stud video]
 
-
chililaorboc
 
This code snippet shows how to find out the available comms ports on your computer.:
This code snippet shows how to find out the available comms ports on your computer.:

Revision as of 18:36, 8 January 2009

This code snippet shows how to find out the available comms ports on your computer.:

    static void listPorts()
    {
        java.util.Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();
        while ( portEnum.hasMoreElements() ) 
        {
            CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement();
            System.out.println(portIdentifier.getName()  +  " - " +  getPortTypeName(portIdentifier.getPortType()) );
        }        
    }
    
    static String getPortTypeName ( int portType )
    {
        switch ( portType )
        {
            case CommPortIdentifier.PORT_I2C:
                return "I2C";
            case CommPortIdentifier.PORT_PARALLEL:
                return "Parallel";
            case CommPortIdentifier.PORT_RAW:
                return "Raw";
            case CommPortIdentifier.PORT_RS485:
                return "RS485";
            case CommPortIdentifier.PORT_SERIAL:
                return "Serial";
            default:
                return "unknown type";
        }
    }
Personal tools