head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.39; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.56; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.54.03; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.21.59; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# serial.hxx

Go to the documentation of this file.

    00001
    00006 // Written by Curtis Olson, started November 1998.
    00007 //
    00008 // Copyright (C) 1998  Curtis L. Olson - curt@@flightgear.org
    00009 //
    00010 // This library is free software; you can redistribute it and/or
    00011 // modify it under the terms of the GNU Library General Public
    00012 // License as published by the Free Software Foundation; either
    00013 // version 2 of the License, or (at your option) any later version.
    00014 //
    00015 // This library is distributed in the hope that it will be useful,
    00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00018 // Library General Public License for more details.
    00019 //
    00020 // You should have received a copy of the GNU Library General Public
    00021 // License along with this library; if not, write to the
    00022 // Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00023 // Boston, MA  02111-1307, USA.
    00024 //
    00025 // $Id: serial.hxx,v 1.5 2001/05/15 19:26:24 curt Exp $
    00026
    00027
    00028 #ifndef _SERIAL_HXX
    00029 #define _SERIAL_HXX
    00030
    00031
    00032 #ifndef __cplusplus
    00033 # error This library requires C++
    00034 #endif
    00035
    00036 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
    00037 #  include <windows.h>
    00038 #endif
    00039
    00040 #include <simgear/compiler.h>
    00041 #include STL_STRING
    00042 SG_USING_STD(string);
    00043
    00044 // if someone know how to do this all with C++ streams let me know
    00045 // #include <stdio.h>
    00046
    00047
    00051 class FGSerialPort
    00052 {
    00053 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
    00054     typedef HANDLE fd_type;
    00055 #else
    00056     typedef int fd_type;
    00057 #endif
    00058
    00059 private:
    00060
    00061     fd_type fd;
    00062     bool dev_open;
    00063
    00064 public:
    00065
    00067     FGSerialPort();
    00068
    00074     FGSerialPort(const string& device, int baud);
    00075
    00077     ~FGSerialPort();
    00078
    00083     bool open_port(const string& device);
    00084
    00088     bool close_port();
    00089
    00094     bool set_baud(int baud);
    00095
    00099     string read_port();
    00100
    00106     int read_port(char *buf, int len);
    00107
    00112     int write_port(const string& value);
    00113
    00119     int write_port(const char *buf, int len);
    00120
    00122     inline bool is_enabled() { return dev_open; }
    00123 };
    00124
    00125
    00126 #endif // _SERIAL_HXX
    00127
    00128

@ 1.3 log @Oops, try again. @ text @d94 1 a94 1