X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fserial%2Fserial.cxx;h=3fa85bdc1b7f9fd4508fdae46872dd5038838c75;hb=e2b4c0787a4398199ef2d35e05963acd58b7a04c;hp=a46570d240b6a89d6f202f7733f5ffc05cd63d85;hpb=d498199e8ae54cda37b20965ef5b69bdde464977;p=simgear.git diff --git a/simgear/serial/serial.cxx b/simgear/serial/serial.cxx index a46570d2..3fa85bdc 100644 --- a/simgear/serial/serial.cxx +++ b/simgear/serial/serial.cxx @@ -22,10 +22,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #ifdef SG_HAVE_STD_INCLUDE @@ -94,7 +90,7 @@ bool FGSerialPort::open_port(const string& device) { 0, NULL ); - FG_LOG( FG_IO, FG_ALERT, "Error opening serial device \"" + SG_LOG( SG_IO, SG_ALERT, "Error opening serial device \"" << device << "\" " << (const char*) lpMsgBuf ); LocalFree( lpMsgBuf ); return false; @@ -111,7 +107,7 @@ bool FGSerialPort::open_port(const string& device) { cout << "Serial fd created = " << fd << endl; if ( fd == -1 ) { - FG_LOG( FG_IO, FG_ALERT, "Cannot open " << device + SG_LOG( SG_IO, SG_ALERT, "Cannot open " << device << " for serial I/O" ); return false; } else { @@ -120,7 +116,7 @@ bool FGSerialPort::open_port(const string& device) { // set required port parameters if ( tcgetattr( fd, &config ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Unable to poll port settings" ); + SG_LOG( SG_IO, SG_ALERT, "Unable to poll port settings" ); return false; } @@ -142,7 +138,7 @@ bool FGSerialPort::open_port(const string& device) { // cout << "config.c_iflag = " << config.c_iflag << endl; if ( tcsetattr( fd, TCSANOW, &config ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Unable to update port settings" ); + SG_LOG( SG_IO, SG_ALERT, "Unable to update port settings" ); return false; } @@ -176,7 +172,7 @@ bool FGSerialPort::set_baud(int baud) { speed_t speed = B9600; if ( tcgetattr( fd, &config ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Unable to poll port settings" ); + SG_LOG( SG_IO, SG_ALERT, "Unable to poll port settings" ); return false; } @@ -203,22 +199,22 @@ bool FGSerialPort::set_baud(int baud) { speed = B230400; #endif } else { - FG_LOG( FG_IO, FG_ALERT, "Unsupported baud rate " << baud ); + SG_LOG( SG_IO, SG_ALERT, "Unsupported baud rate " << baud ); return false; } if ( cfsetispeed( &config, speed ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Problem setting input baud rate" ); + SG_LOG( SG_IO, SG_ALERT, "Problem setting input baud rate" ); return false; } if ( cfsetospeed( &config, speed ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Problem setting output baud rate" ); + SG_LOG( SG_IO, SG_ALERT, "Problem setting output baud rate" ); return false; } if ( tcsetattr( fd, TCSANOW, &config ) != 0 ) { - FG_LOG( FG_IO, FG_ALERT, "Unable to update port settings" ); + SG_LOG( SG_IO, SG_ALERT, "Unable to update port settings" ); return false; } @@ -248,7 +244,7 @@ string FGSerialPort::read_port() { if ( count < 0 ) { // error condition if ( errno != EAGAIN ) { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Serial I/O on read, error number = " << errno ); } @@ -281,7 +277,7 @@ int FGSerialPort::read_port(char *buf, int len) { if ( count < 0 ) { // error condition if ( errno != EAGAIN ) { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Serial I/O on read, error number = " << errno ); } @@ -325,7 +321,7 @@ int FGSerialPort::write_port(const string& value) { 0, NULL ); - FG_LOG( FG_IO, FG_ALERT, "Serial I/O write error: " + SG_LOG( SG_IO, SG_ALERT, "Serial I/O write error: " << (const char*) lpMsgBuf ); LocalFree( lpMsgBuf ); return int(lpNumberOfBytesWritten); @@ -339,7 +335,7 @@ int FGSerialPort::write_port(const string& value) { int count; if ( error ) { - FG_LOG( FG_IO, FG_ALERT, "attempting serial write error recovery" ); + SG_LOG( SG_IO, SG_ALERT, "attempting serial write error recovery" ); // attempt some sort of error recovery count = write(fd, "\n", 1); if ( count == 1 ) { @@ -362,7 +358,7 @@ int FGSerialPort::write_port(const string& value) { error = false; } else { error = true; - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Serial I/O on write, error number = " << errno ); } } @@ -400,7 +396,7 @@ int FGSerialPort::write_port(const char* buf, int len) { 0, NULL ); - FG_LOG( FG_IO, FG_ALERT, "Serial I/O write error: " + SG_LOG( SG_IO, SG_ALERT, "Serial I/O write error: " << (const char*) lpMsgBuf ); LocalFree( lpMsgBuf ); return int(lpNumberOfBytesWritten); @@ -435,7 +431,7 @@ int FGSerialPort::write_port(const char* buf, int len) { // ok ... in our context we don't really care if we can't // write a string, we'll just get it the next time around } else { - FG_LOG( FG_IO, FG_ALERT, + SG_LOG( SG_IO, SG_ALERT, "Serial I/O on write, error number = " << errno ); } }