aboutsummaryrefslogtreecommitdiff
path: root/flow-native/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'flow-native/src/include')
-rw-r--r--flow-native/src/include/ch_jodersky_flow_UnsafeSerial.h45
-rw-r--r--flow-native/src/include/ch_jodersky_flow_UnsafeSerial__.h29
-rw-r--r--flow-native/src/include/com_github_jodersky_flow_internal_NativeSerial.h83
-rw-r--r--flow-native/src/include/flow.h79
4 files changed, 120 insertions, 116 deletions
diff --git a/flow-native/src/include/ch_jodersky_flow_UnsafeSerial.h b/flow-native/src/include/ch_jodersky_flow_UnsafeSerial.h
new file mode 100644
index 0000000..f80ada0
--- /dev/null
+++ b/flow-native/src/include/ch_jodersky_flow_UnsafeSerial.h
@@ -0,0 +1,45 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ch_jodersky_flow_UnsafeSerial */
+
+#ifndef _Included_ch_jodersky_flow_UnsafeSerial
+#define _Included_ch_jodersky_flow_UnsafeSerial
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: ch_jodersky_flow_UnsafeSerial
+ * Method: read
+ * Signature: (Ljava/nio/ByteBuffer;)I
+ */
+JNIEXPORT jint JNICALL Java_ch_jodersky_flow_UnsafeSerial_read
+ (JNIEnv *, jobject, jobject);
+
+/*
+ * Class: ch_jodersky_flow_UnsafeSerial
+ * Method: cancelRead
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_ch_jodersky_flow_UnsafeSerial_cancelRead
+ (JNIEnv *, jobject);
+
+/*
+ * Class: ch_jodersky_flow_UnsafeSerial
+ * Method: write
+ * Signature: (Ljava/nio/ByteBuffer;I)I
+ */
+JNIEXPORT jint JNICALL Java_ch_jodersky_flow_UnsafeSerial_write
+ (JNIEnv *, jobject, jobject, jint);
+
+/*
+ * Class: ch_jodersky_flow_UnsafeSerial
+ * Method: close
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_ch_jodersky_flow_UnsafeSerial_close
+ (JNIEnv *, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/flow-native/src/include/ch_jodersky_flow_UnsafeSerial__.h b/flow-native/src/include/ch_jodersky_flow_UnsafeSerial__.h
new file mode 100644
index 0000000..617875f
--- /dev/null
+++ b/flow-native/src/include/ch_jodersky_flow_UnsafeSerial__.h
@@ -0,0 +1,29 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class ch_jodersky_flow_UnsafeSerial__ */
+
+#ifndef _Included_ch_jodersky_flow_UnsafeSerial__
+#define _Included_ch_jodersky_flow_UnsafeSerial__
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: ch_jodersky_flow_UnsafeSerial__
+ * Method: open
+ * Signature: (Ljava/lang/String;IIZI)J
+ */
+JNIEXPORT jlong JNICALL Java_ch_jodersky_flow_UnsafeSerial_00024_open
+ (JNIEnv *, jobject, jstring, jint, jint, jboolean, jint);
+
+/*
+ * Class: ch_jodersky_flow_UnsafeSerial__
+ * Method: debug
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL Java_ch_jodersky_flow_UnsafeSerial_00024_debug
+ (JNIEnv *, jobject, jboolean);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/flow-native/src/include/com_github_jodersky_flow_internal_NativeSerial.h b/flow-native/src/include/com_github_jodersky_flow_internal_NativeSerial.h
deleted file mode 100644
index 04364fb..0000000
--- a/flow-native/src/include/com_github_jodersky_flow_internal_NativeSerial.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class com_github_jodersky_flow_internal_NativeSerial */
-
-#ifndef _Included_com_github_jodersky_flow_internal_NativeSerial
-#define _Included_com_github_jodersky_flow_internal_NativeSerial
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef com_github_jodersky_flow_internal_NativeSerial_PARITY_NONE
-#define com_github_jodersky_flow_internal_NativeSerial_PARITY_NONE 0L
-#undef com_github_jodersky_flow_internal_NativeSerial_PARITY_ODD
-#define com_github_jodersky_flow_internal_NativeSerial_PARITY_ODD 1L
-#undef com_github_jodersky_flow_internal_NativeSerial_PARITY_EVEN
-#define com_github_jodersky_flow_internal_NativeSerial_PARITY_EVEN 2L
-/*
- * Class: com_github_jodersky_flow_internal_NativeSerial
- * Method: open
- * Signature: (Ljava/lang/String;IIZI)J
- */
-JNIEXPORT jlong JNICALL Java_com_github_jodersky_flow_internal_NativeSerial_open
- (JNIEnv *, jclass, jstring, jint, jint, jboolean, jint);
-
-/*
- * Class: com_github_jodersky_flow_internal_NativeSerial
- * Method: readDirect
- * Signature: (JLjava/nio/ByteBuffer;)I
- */
-JNIEXPORT jint JNICALL Java_com_github_jodersky_flow_internal_NativeSerial_readDirect
- (JNIEnv *, jclass, jlong, jobject);
-
-/*
- * Class: com_github_jodersky_flow_internal_NativeSerial
- * Method: read
- * Signature: (J[B)I
- */
-JNIEXPORT jint JNICALL Java_com_github_jodersky_flow_internal_NativeSerial_read
- (JNIEnv *, jclass, jlong, jbyteArray);
-
-/*
- * Class: com_github_jodersky_flow_internal_NativeSerial
- * Method: cancelRead
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_com_github_jodersky_flow_internal_NativeSerial_cancelRead
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: com_github_jodersky_flow_internal_NativeSerial
- * Method: writeDirect
- * Signature: (JLjava/nio/ByteBuffer;I)I
- */
-JNIEXPORT jint JNICALL Java_com_github_jodersky_flow_internal_NativeSerial_writeDirect
- (JNIEnv *, jclass, jlong, jobject, jint);
-
-/*
- * Class: com_github_jodersky_flow_internal_NativeSerial
- * Method: write
- * Signature: (J[BI)I
- */
-JNIEXPORT jint JNICALL Java_com_github_jodersky_flow_internal_NativeSerial_write
- (JNIEnv *, jclass, jlong, jbyteArray, jint);
-
-/*
- * Class: com_github_jodersky_flow_internal_NativeSerial
- * Method: close
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_com_github_jodersky_flow_internal_NativeSerial_close
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: com_github_jodersky_flow_internal_NativeSerial
- * Method: debug
- * Signature: (Z)V
- */
-JNIEXPORT void JNICALL Java_com_github_jodersky_flow_internal_NativeSerial_debug
- (JNIEnv *, jclass, jboolean);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/flow-native/src/include/flow.h b/flow-native/src/include/flow.h
index 44e2a47..e3f33b9 100644
--- a/flow-native/src/include/flow.h
+++ b/flow-native/src/include/flow.h
@@ -8,22 +8,25 @@ extern "C" {
#include <stdbool.h>
#include <stddef.h>
-//general error codes that are returned by functions
-#define E_IO -1 //IO error
-#define E_ACCESS_DENIED -2 //access denied
-#define E_BUSY -3 // port is busy
-#define E_INVALID_SETTINGS -4 // some port settings are invalid
-#define E_INTERRUPT -5 // not really an error, function call aborted because port is closed
-#define E_NO_PORT -6 //requested port does not exist
+// general error codes, whose that are returned by functions
+#define E_IO 1 // IO error
+#define E_ACCESS_DENIED 2 // access denied
+#define E_BUSY 3 // port is busy
+#define E_INVALID_SETTINGS 4 // some port settings are invalid
+#define E_INTERRUPT 5 // not really an error, function call aborted because port is closed
+#define E_NO_PORT 6 // requested port does not exist
#define PARITY_NONE 0
#define PARITY_ODD 1
#define PARITY_EVEN 2
-/** Contains internal configuration of an open serial port. */
+/**
+ * Contains internal configuration of an open serial port.
+ */
struct serial_config;
-/**Opens a serial port and allocates memory for storing configuration. Note: if this function fails,
+/**
+ * Opens a serial port and allocates memory for storing configuration. Note: if this function fails,
* any internally allocated resources will be freed.
* @param port_name name of port
* @param baud baud rate
@@ -32,59 +35,69 @@ struct serial_config;
* @param parity kind of parity checking to use
* @param serial pointer to memory that will be allocated with a serial structure
* @return 0 on success
- * @return E_NO_PORT if the given port does not exist
- * @return E_ACCESS_DENIED if permissions are not sufficient to open port
- * @return E_BUSY if port is already in use
- * @return E_INVALID_SETTINGS if any of the specified settings are invalid
- * @return E_IO on other error */
+ * @return -E_NO_PORT if the given port does not exist
+ * @return -E_ACCESS_DENIED if permissions are not sufficient to open port
+ * @return -E_BUSY if port is already in use
+ * @return -E_INVALID_SETTINGS if any of the specified settings are invalid
+ * @return -E_IO on other error
+ */
int serial_open(
- const char* port_name,
- int baud,
- int char_size,
- bool two_stop_bits,
- int parity,
- struct serial_config** const serial);
+ const char* port_name,
+ int baud,
+ int char_size,
+ bool two_stop_bits,
+ int parity,
+ struct serial_config** const serial);
-/**Closes a previously opened serial port and frees memory containing the configuration. Note: after a call to
+/**
+ * Closes a previously opened serial port and frees memory containing the configuration. Note: after a call to
* this function, the 'serial' pointer will become invalid, make sure you only call it once. This function is NOT
- * thread safe, make sure no read or write is in prgress when this function is called (the reason is that per
- * close manual page, close should not be called on a file descriptor that is in use by another thread).
+ * thread safe, make sure no read or write is in prgress when this function is called (the reason is that per
+ * close manual page, close should not be called on a file descriptor that is in use by another thread).
* @param serial pointer to serial configuration that is to be closed (and freed)
* @return 0 on success
- * @return E_IO on error */
+ * @return -E_IO on error
+ */
int serial_close(struct serial_config* const serial);
-/**Starts a read from a previously opened serial port. The read is blocking, however it may be
+/**
+ * Starts a read from a previously opened serial port. The read is blocking, however it may be
* interrupted by calling 'serial_cancel_read' on the given serial port.
* @param serial pointer to serial configuration from which to read
* @param buffer buffer into which data is read
* @param size maximum buffer size
* @return n>0 the number of bytes read into buffer
- * @return E_INTERRUPT if the call to this function was interrupted
- * @return E_IO on IO error */
+ * @return -E_INTERRUPT if the call to this function was interrupted
+ * @return -E_IO on IO error
+ */
int serial_read(struct serial_config* const serial, char* const buffer, size_t size);
-/**Cancels a blocked read call. This function is thread safe, i.e. it may be called from a thread even
+/**
+ * Cancels a blocked read call. This function is thread safe, i.e. it may be called from a thread even
* while another thread is blocked in a read call.
* @param serial_config the serial port to interrupt
* @return 0 on success
- * @return E_IO on error */
+ * @return -E_IO on error
+ */
int serial_cancel_read(struct serial_config* const serial);
-/**Writes data to a previously opened serial port. Non bocking.
+/**
+ * Writes data to a previously opened serial port. Non bocking.
* @param serial pointer to serial configuration to which to write
* @param data data to write
* @param size number of bytes to write from data
* @return n>0 the number of bytes written
- * @return E_IO on IO error */
+ * @return -E_IO on IO error
+ */
int serial_write(struct serial_config* const serial, char* const data, size_t size);
-/**Sets debugging option. If debugging is enabled, detailed error message are printed from method calls. */
+/**
+ * Sets debugging option. If debugging is enabled, detailed error message are printed from method calls.
+ */
void serial_debug(bool value);
#ifdef __cplusplus
}
#endif
-
#endif /* FLOW_H */