|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.io.CommPortIdentifier
Communications port management. CommPortIdentifier is the central class for controlling access to communications ports. It includes methods for: - Determining the communications ports made available by the driver. - Opening communications ports for I/O operations. - Determining port ownership. - Resolving port ownership contention. - Managing events that indicate changes in port ownership status. 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.
Field Summary | |
static java.lang.String[] |
PORT_NAMES
|
static int |
PORT_PARALLEL
|
static int |
PORT_SERIAL
|
static int |
TOTAL_PORT_NUMBER
|
Method Summary | |
static void |
addPortName(java.lang.String portName,
int portType,
CommDriver driver)
Adds portName to the list of ports. |
void |
addPortOwnershipListener(CommPortOwnershipListener listener)
|
java.lang.String |
getCurrentOwner()
Returns the owner of the port, that is, the name of the application owning the port. |
java.lang.String |
getName()
Returns the name of the port. |
static CommPortIdentifier |
getPortIdentifier(CommPort port)
|
static CommPortIdentifier |
getPortIdentifier(java.lang.String _portName)
Obtains a CommPortIdentifier object by using a port name. |
static java.util.Enumeration |
getPortIdentifiers()
Obtains an enumeration object that contains a CommPortIdentifier object for each port in the system. |
int |
getPortType()
Returns the port type |
boolean |
isCurrentlyOwned()
|
CommPort |
open(java.io.FileDescriptor fd)
Opens the communications port using a FileDescriptor object on platforms that support this technique. |
CommPort |
open(java.lang.String appname,
int timeout)
Opens the communications port. open obtains exclusive ownership of the port. |
void |
removePortOwnershipListener(CommPortOwnershipListener listener)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static int PORT_SERIAL
public static int PORT_PARALLEL
public static int TOTAL_PORT_NUMBER
public static java.lang.String[] PORT_NAMES
Method Detail |
public static void addPortName(java.lang.String portName, int portType, CommDriver driver)
portName
- - The name of the port being addedportType
- - The type of the port being addeddriver
- - The driver representing the port being addedpublic void addPortOwnershipListener(CommPortOwnershipListener listener)
public java.lang.String getCurrentOwner()
public java.lang.String getName()
public static CommPortIdentifier getPortIdentifier(CommPort port) throws NoSuchPortException
NoSuchPortException
public static CommPortIdentifier getPortIdentifier(java.lang.String _portName) throws NoSuchPortException
_portName
- - name of the port to open
NoSuchPortException
- - if the port does not existpublic static java.util.Enumeration getPortIdentifiers()
public int getPortType()
public boolean isCurrentlyOwned()
public CommPort open(java.io.FileDescriptor fd) throws UnsupportedCommOperationException
fd
- - The FileDescriptor object used to build a CommPort.
UnsupportedCommOperationException
- - is thrown on platforms which
do not support this functionality.public CommPort open(java.lang.String appname, int timeout) throws PortInUseException
appname
- - Name of application making this call. This name will become
the owner of the port. Useful when resolving ownership contention.timeout
- - time in milliseconds to block waiting for port open.
PortInUseException
- - if the port is in use by some other application
that is not willing to relinquish ownershippublic void removePortOwnershipListener(CommPortOwnershipListener listener)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |