PWLib
1.10.10
|
00001 /* 00002 * modem.h 00003 * 00004 * AT command set modem on asynchonous port class. 00005 * 00006 * Portable Windows Library 00007 * 00008 * Copyright (c) 1993-2002 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Contributor(s): ______________________________________. 00025 * 00026 * $Log: modem.h,v $ 00027 * Revision 1.16 2005/11/30 12:47:37 csoutheren 00028 * Removed tabs, reformatted some code, and changed tags for Doxygen 00029 * 00030 * Revision 1.15 2004/11/11 07:34:50 csoutheren 00031 * Added #include <ptlib.h> 00032 * 00033 * Revision 1.14 2002/11/06 22:47:24 robertj 00034 * Fixed header comment (copyright etc) 00035 * 00036 * Revision 1.13 2002/09/16 01:08:59 robertj 00037 * Added #define so can select if #pragma interface/implementation is used on 00038 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00039 * 00040 * Revision 1.12 1999/03/09 08:01:46 robertj 00041 * Changed comments for doc++ support (more to come). 00042 * 00043 * Revision 1.11 1999/02/16 08:07:10 robertj 00044 * MSVC 6.0 compatibility changes. 00045 * 00046 * Revision 1.10 1998/12/02 03:51:39 robertj 00047 * Unix compatibility changes 00048 * 00049 * Revision 1.9 1998/09/23 06:20:53 robertj 00050 * Added open source copyright license. 00051 * 00052 * Revision 1.8 1995/06/17 11:12:46 robertj 00053 * Documentation update. 00054 * 00055 * Revision 1.7 1995/03/14 12:41:51 robertj 00056 * Updated documentation to use HTML codes. 00057 * 00058 * Revision 1.6 1995/01/06 10:31:02 robertj 00059 * Documentation. 00060 * 00061 * Revision 1.5 1994/08/23 11:32:52 robertj 00062 * Oops 00063 * 00064 * Revision 1.4 1994/08/22 00:46:48 robertj 00065 * Added pragma fro GNU C++ compiler. 00066 * 00067 * Revision 1.3 1994/08/21 23:43:02 robertj 00068 * Moved meta-string transmitter from PModem to PChannel. 00069 * 00070 * Revision 1.2 1994/07/25 03:32:29 robertj 00071 * Fixed bug in GCC with enums. 00072 * 00073 * Revision 1.1 1994/06/25 11:55:15 robertj 00074 * Initial revision 00075 * 00076 */ 00077 00078 00079 #define _PMODEM 00080 00081 #ifdef P_USE_PRAGMA 00082 #pragma interface 00083 #endif 00084 00085 #include <ptlib.h> 00086 00087 #ifndef _PSERIALCHANNEL 00088 #include <ptlib/serchan.h> 00089 #endif 00090 00091 00110 class PModem : public PSerialChannel 00111 { 00112 PCLASSINFO(PModem, PSerialChannel) 00113 00114 public: 00121 PModem(); 00122 PModem( 00123 const PString & port, 00124 DWORD speed = 0, 00125 BYTE data = 0, 00126 Parity parity = DefaultParity, 00127 BYTE stop = 0, 00128 FlowControl inputFlow = DefaultFlowControl, 00129 FlowControl outputFlow = DefaultFlowControl 00130 ); 00131 00136 PModem( 00137 PConfig & cfg 00138 ); 00139 00140 00141 // Overrides from class PChannel 00142 virtual BOOL Close(); 00143 // Close the modem serial port channel. 00144 00145 00146 // Overrides from class PSerialChannel 00155 virtual BOOL Open( 00156 const PString & port, 00157 DWORD speed = 0, 00158 BYTE data = 0, 00159 Parity parity = DefaultParity, 00160 BYTE stop = 0, 00161 FlowControl inputFlow = DefaultFlowControl, 00162 FlowControl outputFlow = DefaultFlowControl 00163 ); 00164 00172 virtual BOOL Open( 00173 PConfig & cfg 00174 ); 00175 00176 virtual void SaveSettings( 00177 PConfig & cfg 00178 ); 00179 // Save the current modem serial port settings into the configuration file. 00180 00181 00182 // New member functions 00190 void SetInitString( 00191 const PString & str 00192 ); 00193 00202 PString GetInitString() const; 00203 00209 BOOL CanInitialise() const; 00210 00220 BOOL Initialise(); 00221 00229 void SetDeinitString( 00230 const PString & str 00231 ); 00232 00241 PString GetDeinitString() const; 00242 00248 BOOL CanDeinitialise() const; 00249 00259 BOOL Deinitialise(); 00260 00268 void SetPreDialString( 00269 const PString & str 00270 ); 00271 00280 PString GetPreDialString() const; 00281 00290 void SetPostDialString( 00291 const PString & str 00292 ); 00293 00302 PString GetPostDialString() const; 00303 00313 void SetBusyString( 00314 const PString & str 00315 ); 00316 00325 PString GetBusyString() const; 00326 00336 void SetNoCarrierString( 00337 const PString & str 00338 ); 00339 00348 PString GetNoCarrierString() const; 00349 00359 void SetConnectString( 00360 const PString & str 00361 ); 00362 00371 PString GetConnectString() const; 00372 00378 BOOL CanDial() const; 00379 00393 BOOL Dial(const PString & number); 00394 00402 void SetHangUpString( 00403 const PString & str 00404 ); 00405 00414 PString GetHangUpString() const; 00415 00421 BOOL CanHangUp() const; 00422 00432 BOOL HangUp(); 00433 00439 BOOL CanSendUser() const; 00440 00449 BOOL SendUser( 00450 const PString & str 00451 ); 00452 00453 void Abort(); 00454 // Abort the current meta-string command operation eg dial, hang up etc. 00455 00464 BOOL CanRead() const; 00465 00466 enum Status { 00467 Unopened, 00468 Uninitialised, 00469 Initialising, 00470 Initialised, 00471 InitialiseFailed, 00472 Dialling, 00473 DialFailed, 00474 AwaitingResponse, 00475 LineBusy, 00476 NoCarrier, 00477 Connected, 00478 HangingUp, 00479 HangUpFailed, 00480 Deinitialising, 00481 DeinitialiseFailed, 00482 SendingUserCommand, 00483 NumStatuses 00484 }; 00485 // Modem object states. 00486 00492 Status GetStatus() const; 00493 00494 00495 protected: 00496 // Member variables 00497 PString initCmd, deinitCmd, preDialCmd, postDialCmd, 00498 busyReply, noCarrierReply, connectReply, hangUpCmd; 00499 // Modem command meta-strings. 00500 00501 Status status; 00502 // Current modem status 00503 }; 00504 00505 00506 // End Of File ///////////////////////////////////////////////////////////////