Updated FSF address in all files. Fixes ticket:51
[debian/gnuradio] / ezdop / src / host / hunter / src / serial.h
1 /*
2  Copyright 2006 Johnathan Corgan.
3  
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License version 2
6  as published by the Free Software Foundation.
7  
8  This software is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  GNU General Public License for more details.
12  
13  You should have received a copy of the GNU General Public License
14  along with GNU Radio; see the file COPYING.  If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street,
16  Boston, MA 02110-1301, USA.
17 */
18
19 #ifndef __SERIAL_H__
20 #define __SERIAL_H__
21
22 #include <wx/arrstr.h>
23
24 #ifdef __WIN32__
25 #include <windows.h>
26 #else
27 #include <termios.h>
28 #endif
29
30 wxArrayString EnumerateSerialPorts();
31
32 class SerialPort
33 {
34 public:
35     SerialPort(wxString &port);
36     ~SerialPort();
37
38     bool Open(int speed);
39     bool IsOpened() { return m_opened; }
40     void Close();
41     int  RxReady();
42     int  Read(char *buffer, int len);
43             
44 private:
45 #ifdef __WIN32__
46     HANDLE m_handle;
47 #else
48     int m_fd;
49     struct termios m_ttyset_old;
50     struct termios m_ttyset_new;
51 #endif
52     wxString m_port;
53     bool m_opened;
54 };
55
56 #endif // __SERIAL_H__