Interface SerialPortIdentifier
@NonNullByDefault
public interface SerialPortIdentifier
Interface of a serial port identifier.
- Author:
- Markus Rathgeb - Initial contribution
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
Returns a textual representation of the current owner of the port.getName()
Gets the name of the port.boolean
Determines whether the associated port is in use by an application (including this application).Opens a serial port for communicating.
-
Method Details
-
getName
String getName()Gets the name of the port.- Returns:
- the port's name
-
open
Opens a serial port for communicating.- Parameters:
owner
- name of the owner that port should be assigned totimeout
- time in milliseconds to block waiting for opening the port- Returns:
- a serial port
- Throws:
PortInUseException
- thrown when the serial port is already in use
-
isCurrentlyOwned
boolean isCurrentlyOwned()Determines whether the associated port is in use by an application (including this application).- Returns:
- true if an application is using the port, false if the port is not currently owned.
-
getCurrentOwner
@Nullable String getCurrentOwner()Returns a textual representation of the current owner of the port. An owner is an application which is currently using the port (in the sense that it opened the port and has not closed it yet). To check if a port is owned use theisCurrentlyOwned
method. Do not rely on this method to return null. It can't be guaranteed that owned ports have a non null owner.- Returns:
- the port owner or null if the port is not currently owned
-