00001 /* 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 1997-2002 Net Integration Technologies, Inc. 00004 * Copyright (C) 1999 Red Hat, Inc. 00005 * 00006 * Definition of the WvModemBase and WvModem classes. Inherit from WvFile, 00007 * but do various important details related to modems, like setting baud 00008 * rates and dropping DTR and the like. 00009 * 00010 */ 00011 00012 #ifndef __WVMODEM_H 00013 #define __WVMODEM_H 00014 00015 #include "wvlockfile.h" 00016 #include "wvfile.h" 00017 #include <termios.h> 00018 00019 #ifndef IUCLC 00020 #define IUCLC 0 00021 #endif 00022 00023 #ifndef OLCUC 00024 #define OLCUC 0 00025 #endif 00026 00027 #ifndef XCASE 00028 #define XCASE 0 00029 #endif 00030 00037 class WvModemBase : public WvFile 00038 { 00039 protected: 00040 struct termios t; 00041 int baud; 00042 00043 WvModemBase() { } 00044 00045 int get_real_speed(); 00046 00047 public: 00048 bool die_fast; 00049 00050 WvModemBase(int _fd); 00051 virtual ~WvModemBase(); 00052 00056 virtual void close(); 00057 00061 virtual bool carrier(); 00062 00066 virtual int speed(int _baud); 00067 00071 int getspeed() 00072 { return baud; } 00073 00077 virtual void hangup(); 00078 }; 00079 00080 00085 class WvModem : public WvModemBase 00086 { 00087 private: 00088 WvLockFile lock; 00089 struct termios old_t; 00090 bool closing; 00091 00096 void setup_modem( bool rtscts ); 00097 00101 int getstatus(); 00102 00103 public: 00104 WvModem( const char * filename, int _baud, bool rtscts = true ); 00105 virtual ~WvModem(); 00106 00110 virtual void close(); 00111 00115 virtual bool carrier(); 00116 00121 virtual int speed(int _baud); 00122 }; 00123 00124 #endif