SMSLib 3.5.3

org.smslib.helper
Class CommPortIdentifier

java.lang.Object
  extended by org.smslib.helper.CommPortIdentifier

public class CommPortIdentifier
extends java.lang.Object

Communications port management.

Please note: This is a wrapper around javax.comm.CommPortIdentifier (and so gnu.io.CommPortIdentifier). The API definition is taken from Sun. So honor them!

CommPortIdentifier is the central class for controlling access to communications ports. It includes methods for:

An application first uses methods in CommPortIdentifier to negotiate with the driver to discover which communication ports are available and then select a port for opening. It then uses methods in other classes like CommPort, ParallelPort and SerialPort to communicate through the port.

*

Author:
gwellisch

Field Summary
static int PORT_SERIAL
           
 
Method Summary
 java.lang.String getName()
          Returns the name of the port.
static CommPortIdentifier getPortIdentifier(java.lang.String portName)
          Obtains a CommPortIdentifier object by using a port name.
static java.util.Enumeration<CommPortIdentifier> getPortIdentifiers()
          Obtains an enumeration object that contains a CommPortIdentifier object for each port in the system.
 int getPortType()
          Returns the port type.
 SerialPort open(java.lang.String appname, int timeout)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PORT_SERIAL

public static final int PORT_SERIAL
Method Detail

getPortType

public int getPortType()
Returns the port type.

Returns:
portType - PORT_SERIAL or PORT_PARALLEL

getName

public java.lang.String getName()
Returns the name of the port.

Returns:
the name of the port

open

public SerialPort open(java.lang.String appname,
                       int timeout)

getPortIdentifiers

public static java.util.Enumeration<CommPortIdentifier> getPortIdentifiers()
Obtains an enumeration object that contains a CommPortIdentifier object for each port in the system.

Returns:
Enumeration that can be used to enumerate all the ports known to the system

getPortIdentifier

public static CommPortIdentifier getPortIdentifier(java.lang.String portName)
Obtains a CommPortIdentifier object by using a port name. The port name may have been stored in persistent storage by the application.

Parameters:
portName - name of the port to open
Returns:
CommPortIdentifier object
Throws:
java.lang.RuntimeException - (wrapping a NoSuchPortException) if the port does not exist

SMSLib 3.5.3

(c) 2002-2011, http://smslib.org