Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

wvmodem.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*- 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 1997-2002 Net Integration Technologies, Inc. 00004 * 00005 * Copyright (C) 1999 Red Hat, Inc. 00006 * 00007 * Definition of the WvModemBase and WvModem classes. Inherit from WvFile, 00008 * but do various important details related to modems, like setting baud 00009 * rates and dropping DTR and the like. 00010 * 00011 */ 00012 00013 #ifndef __WVMODEM_H 00014 #define __WVMODEM_H 00015 00016 #include "wvlockdev.h" 00017 #include "wvfile.h" 00018 #include <termios.h> 00019 00020 #ifndef IUCLC 00021 #define IUCLC 0 00022 #endif 00023 00024 #ifndef OLCUC 00025 #define OLCUC 0 00026 #endif 00027 00028 #ifndef XCASE 00029 #define XCASE 0 00030 #endif 00031 00032 /** 00033 * WvModemBase provides the methods used to control a modem, but 00034 * without real implementation for most of them, so that they can 00035 * be used in contexts where modem control is undesirable without 00036 * reimplementing calling code for such uses. 00037 */ 00038 class WvModemBase : public WvFile 00039 { 00040 protected: 00041 struct termios t; 00042 int baud; 00043 00044 WvModemBase() { } 00045 00046 int get_real_speed(); 00047 00048 public: 00049 bool die_fast; 00050 00051 WvModemBase(int _fd); 00052 virtual ~WvModemBase(); 00053 00054 /** do-nothing method that is not needed in WvModemBase */ 00055 virtual void close(); 00056 00057 /** do-nothing method that is not needed in WvModemBase */ 00058 virtual bool carrier(); 00059 00060 /** do-nothing method that is not needed in WvModemBase */ 00061 virtual int speed(int _baud); 00062 00063 /** this one really is needed */ 00064 int getspeed() 00065 { return baud; } 00066 00067 /** may need to hangup for redial reasons */ 00068 virtual void hangup(); 00069 }; 00070 00071 00072 /** 00073 * WvModem implements a named modem that really needs to be opened, 00074 * closed, and manipulated in lots of ways 00075 */ 00076 class WvModem : public WvModemBase 00077 { 00078 private: 00079 WvLockDev lock; 00080 struct termios old_t; 00081 bool closing; 00082 00083 /** 00084 * Setup all of the terminal characteristics, and leave the modem in CLOCAL 00085 * mode to make sure that we can communicate easily with the modem later. 00086 */ 00087 void setup_modem( bool rtscts ); 00088 00089 /** Check the status of the modem */ 00090 int getstatus(); 00091 00092 public: 00093 WvModem( const char * filename, int _baud, bool rtscts = true ); 00094 virtual ~WvModem(); 00095 00096 /** Close the connection to the modem */ 00097 virtual void close(); 00098 00099 /** Is there a carrier present? */ 00100 virtual bool carrier(); 00101 00102 /** 00103 * _baud is the desired speed, that you wish the modem to communicate with, 00104 * and this method returns the actual speed that the modem managed to achieve. 00105 */ 00106 virtual int speed(int _baud); 00107 }; 00108 00109 #endif

Generated on Tue Oct 5 01:09:20 2004 for WvStreams by doxygen 1.3.7