|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcomm.CommPortIdentifier
public class CommPortIdentifier
A handle for obtaining a communications port.
Method Summary | |
---|---|
static void |
addPortName(java.lang.String portName,
int portType,
CommDriver driver)
Adds the specified port name to the list of available ports. |
void |
addPortOwnershipListener(CommPortOwnershipListener listener)
Adds the specified listener to the list of ownership listeners for this port. |
java.lang.String |
getCurrentOwner()
Returns the current owner of this port. |
java.lang.String |
getName()
Returns the port name, typically an OS-dependent hardware label. |
static CommPortIdentifier |
getPortIdentifier(CommPortInterface portInterface)
Returns the port identifier for the specified port. |
static CommPortIdentifierInterface |
getPortIdentifier(java.lang.String portName)
Returns the port identifier for the specified name. |
static java.util.Enumeration |
getPortIdentifiers()
Returns an enumeration of all port identifiers in the system. |
int |
getPortType()
Returns the port type, PORT_SERIAL or PORT_PARALLEL. |
boolean |
isCurrentlyOwned()
Indicates whether this port is currently owned. |
CommPortInterface |
open(java.io.FileDescriptor fd)
Opens this port using a file descriptor. |
CommPortInterface |
open(java.lang.String appName,
int timeout)
Opens this communications port. |
void |
removePortOwnershipListener(CommPortOwnershipListener listener)
Removes the specified listener from the list of ownership listeners for this port. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.util.Enumeration getPortIdentifiers()
public static CommPortIdentifierInterface getPortIdentifier(java.lang.String portName) throws NoSuchPortException
portName
- the name of the port
NoSuchPortException
- if the specified port does not existpublic static CommPortIdentifier getPortIdentifier(CommPortInterface portInterface) throws NoSuchPortException
portInterface
- the open port
NoSuchPortException
- if the specified port is invalidpublic static void addPortName(java.lang.String portName, int portType, CommDriver driver)
portName
- the port nameportType
- PORT_SERIAL or PORT_PARALLELdriver
- the driver controlling the specified portpublic java.lang.String getName()
getName
in interface CommPortIdentifierInterface
public int getPortType()
getPortType
in interface CommPortIdentifierInterface
public java.lang.String getCurrentOwner()
getCurrentOwner
in interface CommPortIdentifierInterface
public boolean isCurrentlyOwned()
isCurrentlyOwned
in interface CommPortIdentifierInterface
public CommPortInterface open(java.lang.String appName, int timeout) throws PortInUseException
open
in interface CommPortIdentifierInterface
appName
- the name of the application requesting the porttimeout
- number of miliseconds to wait for the port to open
PortInUseException
public CommPortInterface open(java.io.FileDescriptor fd) throws UnsupportedCommOperationException
open
in interface CommPortIdentifierInterface
fd
- the file descriptor
UnsupportedCommOperationException
- if the platform does not
support this functionalitypublic void addPortOwnershipListener(CommPortOwnershipListener listener)
addPortOwnershipListener
in interface CommPortIdentifierInterface
listener
- the ownership listener to addpublic void removePortOwnershipListener(CommPortOwnershipListener listener)
removePortOwnershipListener
in interface CommPortIdentifierInterface
listener
- the ownership listener to remove
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |