gnu.io
Class CommPortIdentifier
java.lang.Object
gnu.io.CommPortIdentifier
- All Implemented Interfaces:
- CommPortIdentifierInterface
public class CommPortIdentifier
- extends java.lang.Object
- implements CommPortIdentifierInterface
- Since:
- JDK1.0
- Version:
- %I%, %G%
- Author:
- Trent Jarvi
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
getPortIdentifier
public static CommPortIdentifierInterface getPortIdentifier(java.lang.String s)
throws NoSuchPortException
- Throws:
NoSuchPortException
getPortIdentifier
public static CommPortIdentifier getPortIdentifier(CommPortInterface p)
throws NoSuchPortException
- Throws:
NoSuchPortException
main
public static void main(java.lang.String[] args)
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 porti
- 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