1 // common/SerialPort.hh
2 // This file is part of AnyTerm; see http://anyterm.org/
3 // (C) 2006 Philip Endecott
4 
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef SerialPort_hh
20 #define SerialPort_hh
21 
22 #include "Activity.hh"
23 
24 #include <string>
25 
26 #include "SerialPort.hh"
27 
28 
29 // This base class is just so that sp can be initialised before being Activity.
30 struct SerialPortActivity_base {
31   pbe::SerialPort sp;
SerialPortActivity_baseSerialPortActivity_base32   SerialPortActivity_base(std::string fn, pbe::FileDescriptor::open_mode_t open_mode,
33                           int baudrate, bool raw=true):
34     sp(fn,open_mode,baudrate,raw)
35   {}
36 };
37 
38 
39 class SerialPortActivity: private SerialPortActivity_base, public Activity {
40 public:
41   SerialPortActivity(Activity::onOutput_t onOutput,
42                      Activity::onError_t onError,
43                      std::string fn, int baudrate);
44 
~SerialPortActivity()45   ~SerialPortActivity() {};
46 };
47 
48 
49 #endif
50