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
39class WvModemBase : public WvFile
40{
41protected:
42 struct termios t;
43 int baud;
44
45 WvModemBase() { }
46
47 int get_real_speed();
48
49public:
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
66 { return baud; }
67
69 virtual void hangup();
70
71public:
72 const char *wstype() const { return "WvModemBase"; }
73};
74
75
80class WvModem : public WvModemBase
81{
82private:
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
99public:
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
116public:
117 const char *wstype() const { return "WvModem"; }
118};
119
120#endif
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Definition wvstring.h:94
WvFile implements a stream connected to a file or Unix device.
Definition wvfile.h:29
Class to handle Lock files - useful for WvDial and other places where we need to guarantee exclusive ...
Definition wvlockdev.h:18
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
Definition wvlog.h:57
WvModemBase provides the methods used to control a modem, but without real implementation for most of...
Definition wvmodem.h:40
virtual int speed(int _baud)
do-nothing method that is not needed in WvModemBase
Definition wvmodem.cc:100
virtual void close()
do-nothing method that is not needed in WvModemBase
Definition wvmodem.cc:88
int getspeed()
this one really is needed
Definition wvmodem.h:65
virtual bool carrier()
do-nothing method that is not needed in WvModemBase
Definition wvmodem.cc:94
virtual void hangup()
may need to hangup for redial reasons
Definition wvmodem.cc:106
WvModem implements a named modem that really needs to be opened, closed, and manipulated in lots of w...
Definition wvmodem.h:81
virtual void close()
Close the connection to the modem.
Definition wvmodem.cc:256
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
virtual bool carrier()
Is there a carrier present?
Definition wvmodem.cc:318