]> git.mxchange.org Git - simgear.git/blobdiff - simgear/serial/serial.cxx
Add a function which might return whether a texture is in video memory, delete the...
[simgear.git] / simgear / serial / serial.cxx
index 2c707b18d0897d5852c069d58e2d2136af62b090..aca930a6136e25a03821a5a943fc89b4c7cdd416 100644 (file)
 // $Id$
 
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
 #include <simgear/compiler.h>
 
+#include STL_IOSTREAM
+
 #ifdef SG_HAVE_STD_INCLUDE
 #  include <cerrno>
 #else
 
 #include "serial.hxx"
 
-
-FGSerialPort::FGSerialPort()
+SGSerialPort::SGSerialPort()
     : dev_open(false)
 {
     // empty
 }
 
-FGSerialPort::FGSerialPort(const string& device, int baud) {
+SGSerialPort::SGSerialPort(const string& device, int baud) {
     open_port(device);
     
     if ( dev_open ) {
@@ -63,13 +60,13 @@ FGSerialPort::FGSerialPort(const string& device, int baud) {
     }
 }
 
-FGSerialPort::~FGSerialPort() {
+SGSerialPort::~SGSerialPort() {
     // closing the port here screws us up because if we would even so
-    // much as make a copy of an FGSerialPort object and then delete it,
+    // much as make a copy of an SGSerialPort object and then delete it,
     // the file descriptor gets closed.  Doh!!!
 }
 
-bool FGSerialPort::open_port(const string& device) {
+bool SGSerialPort::open_port(const string& device) {
 
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
 
@@ -108,7 +105,7 @@ bool FGSerialPort::open_port(const string& device) {
     struct termios config;
 
     fd = open(device.c_str(), O_RDWR | O_NONBLOCK);
-    cout << "Serial fd created = " << fd << endl;
+    SG_LOG( SG_EVENT, SG_DEBUG, "Serial fd created = " << fd);
 
     if ( fd  == -1 ) {
        SG_LOG( SG_IO, SG_ALERT, "Cannot open " << device
@@ -151,7 +148,7 @@ bool FGSerialPort::open_port(const string& device) {
 }
 
 
-bool FGSerialPort::close_port() {
+bool SGSerialPort::close_port() {
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
     CloseHandle( fd );
 #else
@@ -164,7 +161,7 @@ bool FGSerialPort::close_port() {
 }
 
 
-bool FGSerialPort::set_baud(int baud) {
+bool SGSerialPort::set_baud(int baud) {
 
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
 
@@ -228,7 +225,7 @@ bool FGSerialPort::set_baud(int baud) {
 
 }
 
-string FGSerialPort::read_port() {
+string SGSerialPort::read_port() {
 
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
 
@@ -264,7 +261,7 @@ string FGSerialPort::read_port() {
 
 }
 
-int FGSerialPort::read_port(char *buf, int len) {
+int SGSerialPort::read_port(char *buf, int len) {
 
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
 
@@ -298,7 +295,7 @@ int FGSerialPort::read_port(char *buf, int len) {
 }
 
 
-int FGSerialPort::write_port(const string& value) {
+int SGSerialPort::write_port(const string& value) {
 
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
 
@@ -374,7 +371,7 @@ int FGSerialPort::write_port(const string& value) {
 }
 
 
-int FGSerialPort::write_port(const char* buf, int len) {
+int SGSerialPort::write_port(const char* buf, int len) {
 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
 
     LPCVOID lpBuffer = buf;