PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
modem.h
Go to the documentation of this file.
1 /*
2 * modem.h
3 *
4 * AT command set modem on asynchonous port class.
5 *
6 * Portable Windows Library
7 *
8 * Copyright (c) 1993-2002 Equivalence Pty. Ltd.
9 *
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
14 *
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * The Original Code is Portable Windows Library.
21 *
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23 *
24 * Contributor(s): ______________________________________.
25 *
26 * $Revision: 24177 $
27 * $Author: rjongbloed $
28 * $Date: 2010-04-05 21:52:04 +1000 (Mon, 05 Apr 2010) $
29 */
30
31 #ifndef PTLIB_MODEM_H
32 #define PTLIB_MODEM_H
33
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
37
38 #include <ptlib.h>
39
40 #include <ptlib/serchan.h>
41
42
61 class PModem : public PSerialChannel
62 {
63 PCLASSINFO(PModem, PSerialChannel)
64
65 public:
72 PModem();
73 PModem(
74 const PString & port,
75 DWORD speed = 0,
76 BYTE data = 0,
77 Parity parity = DefaultParity,
78 BYTE stop = 0,
79 FlowControl inputFlow = DefaultFlowControl,
80 FlowControl outputFlow = DefaultFlowControl
81 );
82
83 #if P_CONFIG_FILE
84
88 PModem(
89 PConfig & cfg
90 );
91 #endif // P_CONFIG_FILE
92
93
94 // Overrides from class PChannel
95 virtual PBoolean Close();
96 // Close the modem serial port channel.
97
98
99 // Overrides from class PSerialChannel
108 virtual PBoolean Open(
109 const PString & port,
110 DWORD speed = 0,
111 BYTE data = 0,
112 Parity parity = DefaultParity,
113 BYTE stop = 0,
114 FlowControl inputFlow = DefaultFlowControl,
115 FlowControl outputFlow = DefaultFlowControl
116 );
117
118 #if P_CONFIG_FILE
119
126 virtual PBoolean Open(
127 PConfig & cfg
128 );
129
130 virtual void SaveSettings(
131 PConfig & cfg
132 );
133 // Save the current modem serial port settings into the configuration file.
134 #endif // P_CONFIG_FILE
135
136
137 // New member functions
145 void SetInitString(
146 const PString & str
147 );
148
157 PString GetInitString() const;
158
164 PBoolean CanInitialise() const;
165
175 PBoolean Initialise();
176
184 void SetDeinitString(
185 const PString & str
186 );
187
196 PString GetDeinitString() const;
197
203 PBoolean CanDeinitialise() const;
204
214 PBoolean Deinitialise();
215
223 void SetPreDialString(
224 const PString & str
225 );
226
235 PString GetPreDialString() const;
236
245 void SetPostDialString(
246 const PString & str
247 );
248
257 PString GetPostDialString() const;
258
268 void SetBusyString(
269 const PString & str
270 );
271
280 PString GetBusyString() const;
281
291 void SetNoCarrierString(
292 const PString & str
293 );
294
303 PString GetNoCarrierString() const;
304
314 void SetConnectString(
315 const PString & str
316 );
317
326 PString GetConnectString() const;
327
333 PBoolean CanDial() const;
334
348 PBoolean Dial(const PString & number);
349
357 void SetHangUpString(
358 const PString & str
359 );
360
369 PString GetHangUpString() const;
370
376 PBoolean CanHangUp() const;
377
387 PBoolean HangUp();
388
394 PBoolean CanSendUser() const;
395
404 PBoolean SendUser(
405 const PString & str
406 );
407
408 void Abort();
409 // Abort the current meta-string command operation eg dial, hang up etc.
410
419 PBoolean CanRead() const;
420
421 enum Status {
422 Unopened,
423 Uninitialised,
424 Initialising,
425 Initialised,
426 InitialiseFailed,
427 Dialling,
428 DialFailed,
429 AwaitingResponse,
430 LineBusy,
431 NoCarrier,
432 Connected,
433 HangingUp,
434 HangUpFailed,
435 Deinitialising,
436 DeinitialiseFailed,
437 SendingUserCommand,
438 NumStatuses
439 };
440 // Modem object states.
441
447 Status GetStatus() const;
448
449
450 protected:
451 // Member variables
452 PString initCmd, deinitCmd, preDialCmd, postDialCmd,
453 busyReply, noCarrierReply, connectReply, hangUpCmd;
454 // Modem command meta-strings.
455
456 Status status;
457 // Current modem status
458 };
459
460
461 #endif // PTLIB_MODEM_H
462
463
464 // End Of File ///////////////////////////////////////////////////////////////