public final class SerialComPortJNIBridge extends Object
This class is an interface between java and native shared library. The native library is found in the root of 'sp-tty.jar' file.
In Linux/Windows/Solaris it is possible to run 32 bit JVM on 64 bit OS, while perhaps in mac os x JVM must match with underlying OS architecture. Whether 32 or 64 bit sp-dll/so file is to be loaded, is decided by arch of JVM this process is running on. SerialPundit includes both 32 and 64 bit dll/so and therefore 32 bit application using this library with 32 JVM can be run on a 64 bit OS system.
| Constructor and Description |
|---|
SerialComPortJNIBridge()
Allocates a new SerialComPortJNIBridge object.
|
| Modifier and Type | Method and Description |
|---|---|
int |
clearPortIOBuffers(long handle,
boolean rxPortbuf,
boolean txPortbuf) |
int |
closeComPort(long handle) |
int |
configureComPortControl(long handle,
int flowctrl,
byte xonCh,
byte xoffCh,
boolean ParFraError,
boolean overFlowErr) |
int |
configureComPortData(long handle,
int dataBits,
int stopBits,
int parity,
int baudRateTranslated,
int custBaudTranslated) |
long |
createBlockingIOContext() |
String[] |
createCustomLoopBackDevice(int deviceIndex,
int rtsMap,
int dtrMap,
boolean setDTRatOpen) |
String[] |
createCustomNullModemPair(int idx1,
int rtsMap1,
int dtrMap1,
boolean setDTRatOpen1,
int idx2,
int rtsMap2,
int dtrMap2,
boolean setDTRatOpen2) |
String[] |
createStandardLoopBackDevice(int deviceIndex) |
String[] |
createStandardNullModemPair(int deviceIndex1,
int deviceIndex2) |
int |
destroyAllCreatedLoopbackDevices() |
int |
destroyAllCreatedNullModemPairs() |
int |
destroyAllCreatedVirtualDevices() |
int |
destroyBlockingIOContext(long context) |
int |
destroyDataLooperThread(long handle) |
int |
destroyEventLooperThread(long handle) |
int |
destroyGivenVirtualDevice(String device) |
Object |
emulateFaultyCable(String deviceNode,
boolean state) |
int |
emulateLineRingingEvent(String devNode,
boolean state) |
int |
emulateSerialEvent(String devNode,
int error) |
String |
findDriverServingComPort(String comPortName) |
String |
findIRQnumberForComPort(long handle) |
int |
fineTuneRead(long handle,
int vmin,
int vtime,
int rit,
int rttm,
int rttc) |
int[] |
getByteCount(long handle) |
int[] |
getCurrentConfigurationU(long handle) |
String[] |
getCurrentConfigurationW(long handle) |
int[] |
getInterruptCount(long handle) |
String[] |
getLastLoopBackDeviceNode() |
String[] |
getLastNullModemPairNodes() |
int[] |
getLinesStatus(long handle) |
String |
getNativeLibraryVersion() |
String[] |
getStatsForGivenDevice(String deviceNode) |
int |
initNativeLib() |
String[] |
listAllExistingPorts() |
String[] |
listAllExistingPortsWithInfo() |
String[] |
listAvailableComPorts() |
String[] |
listExistingCustomLoopbackPorts() |
String[] |
listExistingCustomNullModemPorts() |
String[] |
listExistingStandardLoopbackPorts() |
String[] |
listExistingStandardNullModemPorts() |
String[] |
listNextAvailablePorts() |
static boolean |
loadNativeLibrary(String directoryPath,
String loadedLibName,
com.serialpundit.core.SerialComSystemProperty serialComSystemProperty,
int osType,
int cpuArch,
int abiType,
boolean hotDeploy)
Extract native library from jar in a working directory, load and link it.
|
long |
openComPort(String portName,
boolean enableRead,
boolean enableWrite,
boolean exclusiveOwner) |
int |
pauseListeningEvents(long handle) |
byte[] |
readBytes(long handle,
int byteCount) |
byte[] |
readBytesBlocking(long handle,
int byteCount,
long context) |
int |
readBytesDirect(long handle,
ByteBuffer buffer,
int offset,
int length) |
int |
readBytesP(long handle,
byte[] buffer,
int offset,
int length,
long context,
SerialComLineErrors lineErr) |
int |
registerTTY2COMHotPlugEventListener(Itty2comHotPlugListener hotPlugListener,
String deviceNode) |
int |
resumeListeningEvents(long handle) |
int |
sendBreak(long handle,
int duration) |
int |
setDTR(long handle,
boolean enabled) |
int |
setRTS(long handle,
boolean enabled) |
int |
setUpDataLooperThread(long handle,
SerialComLooper looper) |
int |
setUpEventLooperThread(long handle,
SerialComLooper looper) |
int |
setuptty2com() |
int |
unblockBlockingIOOperation(long context) |
int |
unregisterTTY2COMHotPlugEventListener(int opaqueHandle) |
int |
unsetuptty2com() |
int |
writeBytes(long handle,
byte[] buffer,
int delay) |
int |
writeBytesBlocking(long handle,
byte[] buffer,
long context) |
int |
writeBytesDirect(long handle,
ByteBuffer buffer,
int offset,
int length) |
int |
writeSingleByte(long handle,
byte dataByte) |
public SerialComPortJNIBridge()
Allocates a new SerialComPortJNIBridge object.
public static boolean loadNativeLibrary(String directoryPath, String loadedLibName, com.serialpundit.core.SerialComSystemProperty serialComSystemProperty, int osType, int cpuArch, int abiType, boolean hotDeploy) throws com.serialpundit.core.SerialComException
Extract native library from jar in a working directory, load and link it. The native library is found in the root of 'sp-tty.jar' file.
directoryPath - null for default directory or user supplied directory path.loadedLibName - null for default name or user supplied name of loaded library.serialComSystemProperty - instance of SerialComSystemProperty to get required java properties.cpuArch - architecture of CPU this library is running on.osType - operating system this library is running on.abiType - binary application interface type to correctly link.hotDeploy - true if tomcat hot deployment is needed otherwise false.com.serialpundit.core.SerialComException - if java system properties can not be accessed or required files can not be
accessed, if shared library is not found, it can not be loaded, linked and initialized etc.public int initNativeLib()
public String getNativeLibraryVersion()
public String[] listAvailableComPorts()
public int setUpDataLooperThread(long handle,
SerialComLooper looper)
public int setUpEventLooperThread(long handle,
SerialComLooper looper)
public int destroyDataLooperThread(long handle)
public int destroyEventLooperThread(long handle)
public int pauseListeningEvents(long handle)
public int resumeListeningEvents(long handle)
public long openComPort(String portName, boolean enableRead, boolean enableWrite, boolean exclusiveOwner)
public int closeComPort(long handle)
public byte[] readBytes(long handle,
int byteCount)
public int readBytesP(long handle,
byte[] buffer,
int offset,
int length,
long context,
SerialComLineErrors lineErr)
public byte[] readBytesBlocking(long handle,
int byteCount,
long context)
public int readBytesDirect(long handle,
ByteBuffer buffer,
int offset,
int length)
public int writeBytes(long handle,
byte[] buffer,
int delay)
public int writeBytesDirect(long handle,
ByteBuffer buffer,
int offset,
int length)
public int writeSingleByte(long handle,
byte dataByte)
public int writeBytesBlocking(long handle,
byte[] buffer,
long context)
public long createBlockingIOContext()
public int unblockBlockingIOOperation(long context)
public int destroyBlockingIOContext(long context)
public int setRTS(long handle,
boolean enabled)
public int setDTR(long handle,
boolean enabled)
public int[] getLinesStatus(long handle)
public int[] getInterruptCount(long handle)
public String findIRQnumberForComPort(long handle)
public int sendBreak(long handle,
int duration)
public int[] getByteCount(long handle)
public int clearPortIOBuffers(long handle,
boolean rxPortbuf,
boolean txPortbuf)
public int configureComPortData(long handle,
int dataBits,
int stopBits,
int parity,
int baudRateTranslated,
int custBaudTranslated)
public int configureComPortControl(long handle,
int flowctrl,
byte xonCh,
byte xoffCh,
boolean ParFraError,
boolean overFlowErr)
public int[] getCurrentConfigurationU(long handle)
public String[] getCurrentConfigurationW(long handle)
public int fineTuneRead(long handle,
int vmin,
int vtime,
int rit,
int rttm,
int rttc)
public int setuptty2com()
public int unsetuptty2com()
public String[] listNextAvailablePorts()
public String[] listExistingStandardNullModemPorts()
public String[] listExistingCustomNullModemPorts()
public String[] listExistingStandardLoopbackPorts()
public String[] listExistingCustomLoopbackPorts()
public String[] listAllExistingPorts()
public String[] listAllExistingPortsWithInfo()
public String[] createStandardNullModemPair(int deviceIndex1, int deviceIndex2)
public String[] createCustomNullModemPair(int idx1, int rtsMap1, int dtrMap1, boolean setDTRatOpen1, int idx2, int rtsMap2, int dtrMap2, boolean setDTRatOpen2)
public String[] createStandardLoopBackDevice(int deviceIndex)
public String[] createCustomLoopBackDevice(int deviceIndex, int rtsMap, int dtrMap, boolean setDTRatOpen)
public int destroyAllCreatedVirtualDevices()
public int destroyAllCreatedNullModemPairs()
public int destroyAllCreatedLoopbackDevices()
public int destroyGivenVirtualDevice(String device)
public String[] getLastLoopBackDeviceNode()
public String[] getLastNullModemPairNodes()
public int emulateSerialEvent(String devNode, int error)
public int emulateLineRingingEvent(String devNode, boolean state)
public int registerTTY2COMHotPlugEventListener(Itty2comHotPlugListener hotPlugListener, String deviceNode)
public int unregisterTTY2COMHotPlugEventListener(int opaqueHandle)
Copyright © 2017. All rights reserved.