00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #define _PMODEM
00033
00034 #ifdef P_USE_PRAGMA
00035 #pragma interface
00036 #endif
00037
00038 #include <ptlib.h>
00039
00040 #ifndef _PSERIALCHANNEL
00041 #include <ptlib/serchan.h>
00042 #endif
00043
00044
00063 class PModem : public PSerialChannel
00064 {
00065 PCLASSINFO(PModem, PSerialChannel)
00066
00067 public:
00074 PModem();
00075 PModem(
00076 const PString & port,
00077 DWORD speed = 0,
00078 BYTE data = 0,
00079 Parity parity = DefaultParity,
00080 BYTE stop = 0,
00081 FlowControl inputFlow = DefaultFlowControl,
00082 FlowControl outputFlow = DefaultFlowControl
00083 );
00084
00089 PModem(
00090 PConfig & cfg
00091 );
00092
00093
00094
00095 virtual PBoolean Close();
00096
00097
00098
00099
00108 virtual PBoolean Open(
00109 const PString & port,
00110 DWORD speed = 0,
00111 BYTE data = 0,
00112 Parity parity = DefaultParity,
00113 BYTE stop = 0,
00114 FlowControl inputFlow = DefaultFlowControl,
00115 FlowControl outputFlow = DefaultFlowControl
00116 );
00117
00125 virtual PBoolean Open(
00126 PConfig & cfg
00127 );
00128
00129 virtual void SaveSettings(
00130 PConfig & cfg
00131 );
00132
00133
00134
00135
00143 void SetInitString(
00144 const PString & str
00145 );
00146
00155 PString GetInitString() const;
00156
00162 PBoolean CanInitialise() const;
00163
00173 PBoolean Initialise();
00174
00182 void SetDeinitString(
00183 const PString & str
00184 );
00185
00194 PString GetDeinitString() const;
00195
00201 PBoolean CanDeinitialise() const;
00202
00212 PBoolean Deinitialise();
00213
00221 void SetPreDialString(
00222 const PString & str
00223 );
00224
00233 PString GetPreDialString() const;
00234
00243 void SetPostDialString(
00244 const PString & str
00245 );
00246
00255 PString GetPostDialString() const;
00256
00266 void SetBusyString(
00267 const PString & str
00268 );
00269
00278 PString GetBusyString() const;
00279
00289 void SetNoCarrierString(
00290 const PString & str
00291 );
00292
00301 PString GetNoCarrierString() const;
00302
00312 void SetConnectString(
00313 const PString & str
00314 );
00315
00324 PString GetConnectString() const;
00325
00331 PBoolean CanDial() const;
00332
00346 PBoolean Dial(const PString & number);
00347
00355 void SetHangUpString(
00356 const PString & str
00357 );
00358
00367 PString GetHangUpString() const;
00368
00374 PBoolean CanHangUp() const;
00375
00385 PBoolean HangUp();
00386
00392 PBoolean CanSendUser() const;
00393
00402 PBoolean SendUser(
00403 const PString & str
00404 );
00405
00406 void Abort();
00407
00408
00417 PBoolean CanRead() const;
00418
00419 enum Status {
00420 Unopened,
00421 Uninitialised,
00422 Initialising,
00423 Initialised,
00424 InitialiseFailed,
00425 Dialling,
00426 DialFailed,
00427 AwaitingResponse,
00428 LineBusy,
00429 NoCarrier,
00430 Connected,
00431 HangingUp,
00432 HangUpFailed,
00433 Deinitialising,
00434 DeinitialiseFailed,
00435 SendingUserCommand,
00436 NumStatuses
00437 };
00438
00439
00445 Status GetStatus() const;
00446
00447
00448 protected:
00449
00450 PString initCmd, deinitCmd, preDialCmd, postDialCmd,
00451 busyReply, noCarrierReply, connectReply, hangUpCmd;
00452
00453
00454 Status status;
00455
00456 };
00457
00458
00459