Added "bytes awaiting write" functionality
This commit is contained in:
parent
3957c116fb
commit
b30504e5b2
|
@ -143,6 +143,14 @@ JNIEXPORT jint JNICALL Java_com_fazecast_jSerialComm_SerialPort_waitForEvent
|
||||||
JNIEXPORT jint JNICALL Java_com_fazecast_jSerialComm_SerialPort_bytesAvailable
|
JNIEXPORT jint JNICALL Java_com_fazecast_jSerialComm_SerialPort_bytesAvailable
|
||||||
(JNIEnv *, jobject, jlong);
|
(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_fazecast_jSerialComm_SerialPort
|
||||||
|
* Method: bytesAwaitingWrite
|
||||||
|
* Signature: (J)I
|
||||||
|
*/
|
||||||
|
JNIEXPORT jint JNICALL Java_com_fazecast_jSerialComm_SerialPort_bytesAwaitingWrite
|
||||||
|
(JNIEnv *, jobject, jlong);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: com_fazecast_jSerialComm_SerialPort
|
* Class: com_fazecast_jSerialComm_SerialPort
|
||||||
* Method: readBytes
|
* Method: readBytes
|
||||||
|
|
|
@ -378,6 +378,15 @@ JNIEXPORT jint JNICALL Java_com_fazecast_jSerialComm_SerialPort_bytesAvailable(J
|
||||||
return numBytesAvailable;
|
return numBytesAvailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL Java_com_fazecast_jSerialComm_SerialPort_bytesAwaitingWrite(JNIEnv *env, jobject obj, jlong serialPortFD)
|
||||||
|
{
|
||||||
|
int numBytesToWrite = -1;
|
||||||
|
if (serialPortFD > 0)
|
||||||
|
ioctl(serialPortFD, TIOCOUTQ, &numBytesToWrite);
|
||||||
|
|
||||||
|
return numBytesToWrite;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_com_fazecast_jSerialComm_SerialPort_readBytes(JNIEnv *env, jobject obj, jlong serialPortFD, jbyteArray buffer, jlong bytesToRead)
|
JNIEXPORT jint JNICALL Java_com_fazecast_jSerialComm_SerialPort_readBytes(JNIEnv *env, jobject obj, jlong serialPortFD, jbyteArray buffer, jlong bytesToRead)
|
||||||
{
|
{
|
||||||
// Get port handle and read timeout from Java class
|
// Get port handle and read timeout from Java class
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue