public final class SerialComDBRelease extends Object
Provides methods to release COM ports assigned by Windows operating system to dynamically when a serial device is inserted into system (installation).
In Windows, the system-supplied COM port database arbitrates the use of COM port numbers by COM ports that are installed on the system. Microsoft Windows provides this component to facilitate installing COM ports and, in particular, to ensure that each port number is assigned, at most, to one port. The component consists of the database and a library containing functions that the installation software calls to access the database. All system-supplied installers for COM ports use the COM port database to obtain a COM port number. Although not a Plug and Play requirement, all vendor-supplied installers should also use the COM port database to obtain a COM port number.
| Constructor and Description |
|---|
SerialComDBRelease(SerialComDBReleaseJNIBridge mSerialComDBReleaseJNIBridge)
Construct and allocates a new SerialComDBRelease object with given details.
|
| Modifier and Type | Method and Description |
|---|---|
String[] |
getComPortNumbersInUse()
Provides an array containing all COM ports which are marked as "(in use)" by Windows operating
system.
|
int |
getCurrentComDBDatabaseSize()
Provides the current size of COM port database.
|
boolean |
releaseAllComPorts(String[] excludeList)
Free all the COM port number in database of Windows of operating system so that other
serial devices can use that port number.
|
boolean |
releaseComPort(String comPortName)
Free the COM port number in database of Windows of operating system so that other
serial devices can use that port number.
|
boolean |
resizeComDBDatabase(int newSize)
It resizes database to arbitrate give number of serial ports.
|
boolean |
startSerialComDBReleaseSerive()
Starts the service on demand.
|
boolean |
stopSerialComDBReleaseSerive()
Stops the service on demand.
|
public SerialComDBRelease(SerialComDBReleaseJNIBridge mSerialComDBReleaseJNIBridge)
Construct and allocates a new SerialComDBRelease object with given details.
mSerialComDBReleaseJNIBridge - interface class to native library for calling platform
specific routines.com.serialpundit.core.SerialComException - if the object can not be constructed.public boolean startSerialComDBReleaseSerive()
throws com.serialpundit.core.SerialComException
Starts the service on demand. This method gives more control to application to manage the service as and when needed.
com.serialpundit.core.SerialComException - if an error occurs.public boolean stopSerialComDBReleaseSerive()
throws com.serialpundit.core.SerialComException
Stops the service on demand. This method gives more control to application to manage the service as and when needed.
com.serialpundit.core.SerialComException - if an error occurs.public boolean releaseComPort(String comPortName) throws com.serialpundit.core.SerialComException
Free the COM port number in database of Windows of operating system so that other serial devices can use that port number.
comPortName - COM port to be released for example COM32 etc.com.serialpundit.core.SerialComException - if given COM port can not be released or an error occurs.public boolean releaseAllComPorts(String[] excludeList) throws com.serialpundit.core.SerialComException
Free all the COM port number in database of Windows of operating system so that other serial devices can use that port number. Typically, if there are serial devices that will be always present in system for example Bluetooth modem on serial interface on computer's motherboard, than you may not want to release COM port number assigned to this device. Add this COM port in excludeList and this library will not remove it from database.
excludeList - list of COM ports that should not be released.com.serialpundit.core.SerialComException - if COM ports can not be released or an error occurs.public String[] getComPortNumbersInUse() throws com.serialpundit.core.SerialComException
Provides an array containing all COM ports which are marked as "(in use)" by Windows operating system.
com.serialpundit.core.SerialComException - if an error occurs.public int getCurrentComDBDatabaseSize()
throws com.serialpundit.core.SerialComException
Provides the current size of COM port database.
com.serialpundit.core.SerialComException - if an error occurs.public boolean resizeComDBDatabase(int newSize)
throws com.serialpundit.core.SerialComException
It resizes database to arbitrate give number of serial ports.
newSize - number of port numbers to be arbitrated in the database.com.serialpundit.core.SerialComException - if COM ports can not be released or an error occurs.Copyright © 2017. All rights reserved.