]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/fg_serial.hxx
UIUC flight model contribution. This is based on LaRCsim, but can read
[flightgear.git] / src / Network / fg_serial.hxx
index 34075f76206dcb6354bba6971686faf9d84b0f72..f95b813d1b990e018f56e6c2c0114f11adc0748f 100644 (file)
@@ -29,7 +29,7 @@
 # error This library requires C++
 #endif
 
-#include "Include/compiler.h"
+#include <simgear/compiler.h>
 
 #include <string>
 
@@ -39,7 +39,7 @@
 // #  include <time.h>
 // #endif
 
-#include <Serial/serial.hxx>
+#include <simgear/serial/serial.hxx>
 
 #include "iochannel.hxx"
 #include "protocol.hxx"
@@ -53,6 +53,9 @@ class FGSerial : public FGIOChannel {
     string baud;
     FGSerialPort port;
 
+    char save_buf[ 2 * FG_MAX_MSG_SIZE ];
+    int save_len;
+
 public:
 
     FGSerial();
@@ -61,11 +64,17 @@ public:
     // open the serial port based on specified direction
     bool open( FGProtocol::fgProtocolDir dir );
 
-    // read data from port
-    bool read( char *buf, int *length );
+    // read a block of data of specified size
+    int read( char *buf, int length );
+
+    // read a line of data, length is max size of input buffer
+    int readline( char *buf, int length );
 
     // write data to port
-    bool write( char *buf, int length );
+    int write( char *buf, int length );
+
+    // write null terminated string to port
+    int writestring( char *str );
 
     // close port
     bool close();