aboutsummaryrefslogtreecommitdiff
path: root/flow-native
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2013-06-30 12:00:00 +0200
committerJakob Odersky <jodersky@gmail.com>2013-06-30 12:00:00 +0200
commitc68bedee9717853a4e07b9b7000966ee9e9cca09 (patch)
tree89cda244d382fec76332764fe026af7cb0137853 /flow-native
parent94a0ee545ab71c6779f15a5192745bedddfdb4d4 (diff)
downloadakka-serial-c68bedee9717853a4e07b9b7000966ee9e9cca09.tar.gz
akka-serial-c68bedee9717853a4e07b9b7000966ee9e9cca09.tar.bz2
akka-serial-c68bedee9717853a4e07b9b7000966ee9e9cca09.zip
move structure details to source file
Diffstat (limited to 'flow-native')
-rw-r--r--flow-native/include/flow.h13
-rw-r--r--flow-native/unix/src/flow.c12
2 files changed, 14 insertions, 11 deletions
diff --git a/flow-native/include/flow.h b/flow-native/include/flow.h
index 3b6df24..eacc783 100644
--- a/flow-native/include/flow.h
+++ b/flow-native/include/flow.h
@@ -11,17 +11,8 @@
#define E_INTERRUPT -5 // not really an error, function call aborted because port is closed
#define E_NO_PORT -6
-//contains file descriptors used in managing a serial port
-struct serial_config {
-
- int port_fd; // file descriptor of serial port
-
- /* a pipe is used to abort a serial read by writing something into the
- * write end of the pipe */
- int pipe_read_fd; // file descriptor, read end of pipe
- int pipe_write_fd; // file descriptor, write end of pipe
-
-};
+/** Represents an open serial port. */
+struct serial_config;
/**Opens a serial port and allocates memory for storing configuration. Note: if this function fails,
* any internally allocated resources will be freed.
diff --git a/flow-native/unix/src/flow.c b/flow-native/unix/src/flow.c
index 174e9c0..8aae2b7 100644
--- a/flow-native/unix/src/flow.c
+++ b/flow-native/unix/src/flow.c
@@ -46,6 +46,18 @@ void serial_debug(bool value) {
debug = value;
}
+//contains file descriptors used in managing a serial port
+struct serial_config {
+
+ int port_fd; // file descriptor of serial port
+
+ /* a pipe is used to abort a serial read by writing something into the
+ * write end of the pipe */
+ int pipe_read_fd; // file descriptor, read end of pipe
+ int pipe_write_fd; // file descriptor, write end of pipe
+
+};
+
int serial_open(const char* port_name, int baud, struct serial_config** serial) {
int fd = open(port_name, O_RDWR | O_NOCTTY | O_NONBLOCK);