Add SerialPort.sendBreak()
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/core/jni/android_hardware_SerialPort.cpp b/core/jni/android_hardware_SerialPort.cpp
index e67153b..d5caade 100644
--- a/core/jni/android_hardware_SerialPort.cpp
+++ b/core/jni/android_hardware_SerialPort.cpp
@@ -234,6 +234,13 @@
jniThrowException(env, "java/io/IOException", NULL);
}
+static void
+android_hardware_SerialPort_send_break(JNIEnv *env, jobject thiz)
+{
+ int fd = env->GetIntField(thiz, field_context);
+ tcsendbreak(fd, 0);
+}
+
static JNINativeMethod method_table[] = {
{"native_open", "(Ljava/io/FileDescriptor;I)V",
(void *)android_hardware_SerialPort_open},
@@ -246,6 +253,7 @@
(void *)android_hardware_SerialPort_write_array},
{"native_write_direct", "(Ljava/nio/ByteBuffer;I)V",
(void *)android_hardware_SerialPort_write_direct},
+ {"native_send_break", "()V", (void *)android_hardware_SerialPort_send_break},
};
int register_android_hardware_SerialPort(JNIEnv *env)