WvStreams
wvmodem.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * Copyright (C) 1999 Red Hat, Inc.
6  *
7  * Definition of the WvModemBase and WvModem classes. Inherit from WvFile,
8  * but do various important details related to modems, like setting baud
9  * rates and dropping DTR and the like.
10  *
11  */
12 
13 #ifndef __WVMODEM_H
14 #define __WVMODEM_H
15 
16 #include "wvlockdev.h"
17 #include "wvfile.h"
18 #include "wvlog.h"
19 #include <termios.h>
20 
21 #ifndef IUCLC
22 #define IUCLC 0
23 #endif
24 
25 #ifndef OLCUC
26 #define OLCUC 0
27 #endif
28 
29 #ifndef XCASE
30 #define XCASE 0
31 #endif
32 
39 class WvModemBase : public WvFile
40 {
41 protected:
42  struct termios t;
43  int baud;
44 
45  WvModemBase() { }
46 
47  int get_real_speed();
48 
49 public:
50  bool die_fast;
51 
52  WvModemBase(int _fd);
53  virtual ~WvModemBase();
54 
56  virtual void close();
57 
59  virtual bool carrier();
60 
62  virtual int speed(int _baud);
63 
65  int getspeed()
66  { return baud; }
67 
69  virtual void hangup();
70 
71 public:
72  const char *wstype() const { return "WvModemBase"; }
73 };
74 
75 
80 class WvModem : public WvModemBase
81 {
82 private:
83  WvLockDev lock;
84  WvLog log;
85  bool have_old_t;
86  struct termios old_t;
87  bool closing;
88  bool no_reset;
89 
94  void setup_modem(bool rtscts);
95 
97  int getstatus();
98 
99 public:
100  WvModem(WvStringParm filename, int _baud, bool rtscts = true,
101  bool _no_reset = false);
102  virtual ~WvModem();
103 
105  virtual void close();
106 
108  virtual bool carrier();
109 
114  virtual int speed(int _baud);
115 
116 public:
117  const char *wstype() const { return "WvModem"; }
118 };
119 
120 #endif
WvModemBase::close
virtual void close()
do-nothing method that is not needed in WvModemBase
Definition: wvmodem.cc:88
WvModem::close
virtual void close()
Close the connection to the modem.
Definition: wvmodem.cc:256
WvModem::speed
virtual int speed(int _baud)
_baud is the desired speed, that you wish the modem to communicate with, and this method returns the ...
Definition: wvmodem.cc:288
WvFile
WvFile implements a stream connected to a file or Unix device.
Definition: wvfile.h:28
WvLockDev
Class to handle Lock files - useful for WvDial and other places where we need to guarantee exclusive ...
Definition: wvlockdev.h:17
WvLog
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
Definition: wvlog.h:56
WvModem
WvModem implements a named modem that really needs to be opened, closed, and manipulated in lots of w...
Definition: wvmodem.h:80
WvModemBase
WvModemBase provides the methods used to control a modem, but without real implementation for most of...
Definition: wvmodem.h:39
WvModem::carrier
virtual bool carrier()
Is there a carrier present?
Definition: wvmodem.cc:318
WvModemBase::hangup
virtual void hangup()
may need to hangup for redial reasons
Definition: wvmodem.cc:106
WvModemBase::speed
virtual int speed(int _baud)
do-nothing method that is not needed in WvModemBase
Definition: wvmodem.cc:100
WvModemBase::getspeed
int getspeed()
this one really is needed
Definition: wvmodem.h:65
WvModemBase::carrier
virtual bool carrier()
do-nothing method that is not needed in WvModemBase
Definition: wvmodem.cc:94