public final class SerialComPortJNIBridge extends Object
This class is an interface between java and native shared library. The native library is found in 'lib-tty' folder in 'scm-x.x.x.jar' file.
| 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() |
int |
destroyBlockingIOContext(long context) |
int |
destroyDataLooperThread(long handle) |
int |
destroyEventLooperThread(long handle) |
String[] |
findComPortFromUSBAttribute(int usbVidToMatch,
int usbPidToMatch,
String serialNumber) |
String[] |
findComPortFromUSBAttributes(int usbVidToMatch,
int usbPidToMatch,
String serialNumber) |
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) |
String[] |
getCDCUSBDevPowerInfo(String portNameVal) |
int[] |
getCurrentConfigurationU(long handle) |
String[] |
getCurrentConfigurationW(long handle) |
String[] |
getFirmwareRevisionNumber(int vid,
int pid,
String serialNumber) |
int[] |
getInterruptCount(long handle) |
int |
getLatencyTimer(String comPort) |
int[] |
getLinesStatus(long handle) |
String |
getNativeLibraryVersion() |
int |
initNativeLib() |
long |
ioctlExecuteOperation(long handle,
long operationCode) |
long |
ioctlGetValue(long handle,
long operationCode) |
long |
ioctlSetValue(long handle,
long operationCode,
long value) |
long |
ioctlSetValueCharArray(long handle,
long operationCode,
byte[] values) |
long |
ioctlSetValueIntArray(long handle,
long operationCode,
int[] values) |
int |
isUSBDevConnected(int vendorID,
int productID,
String serialNumber) |
String[] |
listAvailableComPorts() |
String[] |
listBTSPPDevNodesWithInfo() |
String[] |
listUSBdevicesWithInfo(int vendorFilter) |
static boolean |
loadNativeLibrary(String directoryPath,
String loadedLibName,
SerialComSystemProperty serialComSystemProperty,
int osType,
int cpuArch,
int javaABIType)
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) |
int |
registerUSBHotPlugEventListener(ISerialComUSBHotPlugListener hotPlugListener,
int filterVID,
int filterPID,
String serialNumber) |
int |
rescanUSBDevicesHW() |
int |
resumeListeningEvents(long handle) |
int |
sendBreak(long handle,
int duration) |
int |
setDTR(long handle,
boolean enabled) |
int |
setLatencyTimer(String comPort,
byte timerValue) |
int |
setRTS(long handle,
boolean enabled) |
int |
setUpDataLooperThread(long handle,
SerialComLooper looper) |
int |
setUpEventLooperThread(long handle,
SerialComLooper looper) |
int |
unblockBlockingIOOperation(long context) |
int |
unregisterUSBHotPlugEventListener(int index) |
int |
writeBytes(long handle,
byte[] buffer,
int delay) |
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, SerialComSystemProperty serialComSystemProperty, int osType, int cpuArch, int javaABIType) throws SecurityException, SerialComUnexpectedException, SerialComLoadException, UnsatisfiedLinkError
Extract native library from jar in a working directory, load and link it. The 'lib-tty' folder in 'scm-x.x.x.jar' file is searched for the required native library for serial port communication.
directoryPath - null for default directory or user supplied directory pathloadedLibName - null for default name or user supplied name of loaded libraryserialComSystemProperty - instance of SerialComSystemProperty to get required java propertiescpuArch - architecture of CPU this library is running onosType - operating system this library is running onjavaABIType - binary application interface type to correctly linkSecurityException - if java system properties can not be accessedSerialComUnexpectedException - if java system property is nullSerialComLoadException - if any file system related issue occursUnsatisfiedLinkError - if loading/linking shared library failspublic 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)
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 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 registerUSBHotPlugEventListener(ISerialComUSBHotPlugListener hotPlugListener, int filterVID, int filterPID, String serialNumber)
public int unregisterUSBHotPlugEventListener(int index)
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 long ioctlExecuteOperation(long handle,
long operationCode)
public long ioctlSetValue(long handle,
long operationCode,
long value)
public long ioctlGetValue(long handle,
long operationCode)
public long ioctlSetValueIntArray(long handle,
long operationCode,
int[] values)
public long ioctlSetValueCharArray(long handle,
long operationCode,
byte[] values)
public String[] listUSBdevicesWithInfo(int vendorFilter)
public int isUSBDevConnected(int vendorID,
int productID,
String serialNumber)
public int setLatencyTimer(String comPort, byte timerValue)
public int getLatencyTimer(String comPort)
public int rescanUSBDevicesHW()
public String[] getFirmwareRevisionNumber(int vid, int pid, String serialNumber)
public String[] findComPortFromUSBAttributes(int usbVidToMatch, int usbPidToMatch, String serialNumber)
public String[] findComPortFromUSBAttribute(int usbVidToMatch, int usbPidToMatch, String serialNumber)
public String[] listBTSPPDevNodesWithInfo()
Copyright © 2016. All rights reserved.