serialPort.rxtx
Class CommPortIdentifier

java.lang.Object
  extended by serialPort.rxtx.CommPortIdentifier
All Implemented Interfaces:
CommPortIdentifierInterface

public class CommPortIdentifier
extends java.lang.Object
implements CommPortIdentifierInterface

Since:
JDK1.0
Version:
%I%, %G%
Author:
Trent Jarvi

Field Summary
static int PORT_I2C
           
static int PORT_PARALLEL
          IEEE 1284 parallel port.
static int PORT_RAW
           
static int PORT_RS485
           
static int PORT_SERIAL
          RS-232 serial port.
 
Method Summary
static void addPortName(java.lang.String s, int type, CommDriver c)
           
 void addPortOwnershipListener(CommPortOwnershipListener c)
          Adds the specified listener to the list of ownership listeners for this port.
 java.lang.String getCurrentOwner()
           
 java.lang.String getName()
           
static CommPortIdentifier getPortIdentifier(CommPortInterface p)
           
static CommPortIdentifier getPortIdentifier(java.lang.String s)
           
static CommPortIdentifier getPortIdentifierNew(java.lang.String s)
           
static java.util.Enumeration getPortIdentifiers()
           
static java.util.Enumeration getPortIdentifiersNew()
           
 int getPortType()
           
 boolean isCurrentlyOwned()
           
static void main(java.lang.String[] args)
           
 CommPortInterface open(java.io.FileDescriptor f)
           
 CommPortInterface open(java.lang.String TheOwner, int i)
           
 void removePortOwnershipListener(CommPortOwnershipListener c)
          Removes the specified listener from the list of ownership listeners for this port.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PORT_SERIAL

public static final int PORT_SERIAL
RS-232 serial port.

See Also:
Constant Field Values

PORT_PARALLEL

public static final int PORT_PARALLEL
IEEE 1284 parallel port.

See Also:
Constant Field Values

PORT_I2C

public static final int PORT_I2C
See Also:
Constant Field Values

PORT_RS485

public static final int PORT_RS485
See Also:
Constant Field Values

PORT_RAW

public static final int PORT_RAW
See Also:
Constant Field Values
Method Detail

addPortName

public static void addPortName(java.lang.String s,
                               int type,
                               CommDriver c)

addPortOwnershipListener

public void addPortOwnershipListener(CommPortOwnershipListener c)
Description copied from interface: CommPortIdentifierInterface
Adds the specified listener to the list of ownership listeners for this port.

Specified by:
addPortOwnershipListener in interface CommPortIdentifierInterface
Parameters:
c - the ownership listener to add

getCurrentOwner

public java.lang.String getCurrentOwner()
Specified by:
getCurrentOwner in interface CommPortIdentifierInterface
Returns:
the current owner of this port.

getName

public java.lang.String getName()
Specified by:
getName in interface CommPortIdentifierInterface
Returns:
the port name, typically an OS-dependent hardware label.

getPortIdentifierNew

public static CommPortIdentifier getPortIdentifierNew(java.lang.String s)
                                               throws NoSuchPortException
Throws:
NoSuchPortException

getPortIdentifier

public static CommPortIdentifier getPortIdentifier(java.lang.String s)
                                            throws NoSuchPortException
Throws:
NoSuchPortException

getPortIdentifier

public static CommPortIdentifier getPortIdentifier(CommPortInterface p)
                                            throws NoSuchPortException
Throws:
NoSuchPortException

getPortIdentifiersNew

public static java.util.Enumeration getPortIdentifiersNew()

getPortIdentifiers

public static java.util.Enumeration getPortIdentifiers()

getPortType

public int getPortType()
Specified by:
getPortType in interface CommPortIdentifierInterface
Returns:
the port type, PORT_SERIAL or PORT_PARALLEL.

isCurrentlyOwned

public boolean isCurrentlyOwned()
Specified by:
isCurrentlyOwned in interface CommPortIdentifierInterface
Returns:
true if this port is currently owned.

open

public CommPortInterface open(java.io.FileDescriptor f)
                       throws UnsupportedCommOperationException
Specified by:
open in interface CommPortIdentifierInterface
Parameters:
f - the file descriptor
Returns:
a port using a file descriptor.
Throws:
UnsupportedCommOperationException - if the platform does not support this functionality

open

public CommPortInterface open(java.lang.String TheOwner,
                              int i)
                       throws PortInUseException
Specified by:
open in interface CommPortIdentifierInterface
Parameters:
TheOwner - the name of the application requesting the port
i - number of miliseconds to wait for the port to open
Returns:
communications port. If the port is in use by another application, it will be notified with a PORT_OWNERSHIP_REQUESTED event. If the current owner closes the port, then this method will succeed. Otherwise a PortInUseException will be thrown.
Throws:
PortInUseException

removePortOwnershipListener

public void removePortOwnershipListener(CommPortOwnershipListener c)
Description copied from interface: CommPortIdentifierInterface
Removes the specified listener from the list of ownership listeners for this port.

Specified by:
removePortOwnershipListener in interface CommPortIdentifierInterface
Parameters:
c - the ownership listener to remove

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)