#include <modem.h>
Inheritance diagram for PModem:
Public Types | |
Unopened | |
Has not been opened yet. | |
Uninitialised | |
Is open but has not yet been initialised. | |
Initialising | |
Is currently initialising the modem. | |
Initialised | |
Has been initialised but is not connected. | |
InitialiseFailed | |
Initialisation sequence failed. | |
Dialling | |
Is currently dialling. | |
DialFailed | |
Dial failed. | |
AwaitingResponse | |
Dialling in progress, awaiting connection. | |
LineBusy | |
Dial failed due to line busy. | |
NoCarrier | |
Dial failed due to no carrier. | |
Connected | |
Dial was successful and modem has connected. | |
HangingUp | |
Is currently hanging up the modem. | |
HangUpFailed | |
The hang up failed. | |
Deinitialising | |
is currently de-initialising the modem | |
DeinitialiseFailed | |
The de-initialisation failed. | |
SendingUserCommand | |
Is currently sending a user command. | |
NumStatuses | |
enum | Status { Unopened, Uninitialised, Initialising, Initialised, InitialiseFailed, Dialling, DialFailed, AwaitingResponse, LineBusy, NoCarrier, Connected, HangingUp, HangUpFailed, Deinitialising, DeinitialiseFailed, SendingUserCommand, NumStatuses } |
Public Member Functions | |
PModem () | |
PModem (const PString &port, DWORD speed=0, BYTE data=0, Parity parity=DefaultParity, BYTE stop=0, FlowControl inputFlow=DefaultFlowControl, FlowControl outputFlow=DefaultFlowControl) | |
virtual PBoolean | Close () |
virtual PBoolean | Open (const PString &port, DWORD speed=0, BYTE data=0, Parity parity=DefaultParity, BYTE stop=0, FlowControl inputFlow=DefaultFlowControl, FlowControl outputFlow=DefaultFlowControl) |
void | SetInitString (const PString &str) |
PString | GetInitString () const |
PBoolean | CanInitialise () const |
PBoolean | Initialise () |
void | SetDeinitString (const PString &str) |
PString | GetDeinitString () const |
PBoolean | CanDeinitialise () const |
PBoolean | Deinitialise () |
void | SetPreDialString (const PString &str) |
PString | GetPreDialString () const |
void | SetPostDialString (const PString &str) |
PString | GetPostDialString () const |
void | SetBusyString (const PString &str) |
PString | GetBusyString () const |
void | SetNoCarrierString (const PString &str) |
PString | GetNoCarrierString () const |
void | SetConnectString (const PString &str) |
PString | GetConnectString () const |
PBoolean | CanDial () const |
PBoolean | Dial (const PString &number) |
void | SetHangUpString (const PString &str) |
PString | GetHangUpString () const |
PBoolean | CanHangUp () const |
PBoolean | HangUp () |
PBoolean | CanSendUser () const |
PBoolean | SendUser (const PString &str) |
void | Abort () |
PBoolean | CanRead () const |
Status | GetStatus () const |
Protected Attributes | |
PString | initCmd |
PString | deinitCmd |
PString | preDialCmd |
PString | postDialCmd |
PString | busyReply |
PString | noCarrierReply |
PString | connectReply |
PString | hangUpCmd |
Status | status |
A modem object is always in a particular state. This state determines what operations are allowed which then move the object to other states. The operations are the exchange of strings in "chat" script.
The following defaults are used for command strings: initialise ATZ
deinitialise +++
pre-dial ATDT
post-dial busy reply
BUSY
no carrier reply NO CARRIER
connect reply CONNECT
hang up +++
enum PModem::Status |
PModem::PModem | ( | ) |
Create a modem object on the serial port specified. If no port was specified do not open it. It does not initially have a valid port name.
See the PSerialChannel class for more information on the parameters.
PModem::PModem | ( | const PString & | port, | |
DWORD | speed = 0 , |
|||
BYTE | data = 0 , |
|||
Parity | parity = DefaultParity , |
|||
BYTE | stop = 0 , |
|||
FlowControl | inputFlow = DefaultFlowControl , |
|||
FlowControl | outputFlow = DefaultFlowControl | |||
) |
port | Serial port name to open. |
speed | Speed of serial port. |
data | Number of data bits for serial port. |
parity | Parity for serial port. |
stop | Number of stop bits for serial port. |
inputFlow | Input flow control. |
outputFlow | Output flow control. |
void PModem::Abort | ( | ) |
PBoolean PModem::CanDeinitialise | ( | ) | const |
The modem is in a state that allows the de-initialise to start.
PBoolean PModem::CanDial | ( | ) | const |
The modem is in a state that allows the dial to start.
PBoolean PModem::CanHangUp | ( | ) | const |
The modem is in a state that allows the hang up to start.
PBoolean PModem::CanInitialise | ( | ) | const |
The modem is in a state that allows the initialise to start.
PBoolean PModem::CanRead | ( | ) | const |
The modem is in a state that allows the user application to read from the channel. Reading while this is PTrue can interfere with the operation of the meta-string processing. This function is only usefull when multi-threading is used.
PBoolean PModem::CanSendUser | ( | ) | const |
The modem is in a state that allows the user command to start.
virtual PBoolean PModem::Close | ( | ) | [virtual] |
Close the channel, shutting down the link to the data source.
Reimplemented from PSerialChannel.
PBoolean PModem::Deinitialise | ( | ) |
Send the de-initialisation meta-command string to the modem. The return value indicates that the conditions for the operation to start were met, ie the serial port was open etc and the command was successfully sent with all replies met.
Send the dial meta-command strings to the modem. The return value indicates that the conditions for the operation to start were met, ie the serial port was open etc and the command was successfully sent with all replies met.
The string sent to the modem is the concatenation of the pre-dial string, a , the
number
parameter and the post-dial string.
PString PModem::GetBusyString | ( | ) | const |
Get the modem busy response meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
PString PModem::GetConnectString | ( | ) | const |
Get the modem connect response meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
PString PModem::GetDeinitString | ( | ) | const |
Get the modem de-initialisation meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
PString PModem::GetHangUpString | ( | ) | const |
Get the modem hang up meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
PString PModem::GetInitString | ( | ) | const |
Get the modem initialisation meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
PString PModem::GetNoCarrierString | ( | ) | const |
Get the modem no carrier response meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
PString PModem::GetPostDialString | ( | ) | const |
Get the modem post-dial meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
PString PModem::GetPreDialString | ( | ) | const |
Get the modem pre-dial meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
Status PModem::GetStatus | ( | ) | const |
Get the modem objects current state.
PBoolean PModem::HangUp | ( | ) |
Send the hang up meta-command string to the modem. The return value indicates that the conditions for the operation to start were met, ie the serial port was open etc and the command was successfully sent with all replies met.
PBoolean PModem::Initialise | ( | ) |
Send the initialisation meta-command string to the modem. The return value indicates that the conditions for the operation to start were met, ie the serial port was open etc and the command was successfully sent with all replies met.
virtual PBoolean PModem::Open | ( | const PString & | port, | |
DWORD | speed = 0 , |
|||
BYTE | data = 0 , |
|||
Parity | parity = DefaultParity , |
|||
BYTE | stop = 0 , |
|||
FlowControl | inputFlow = DefaultFlowControl , |
|||
FlowControl | outputFlow = DefaultFlowControl | |||
) | [virtual] |
Open the modem serial channel on the specified port.
See the PSerialChannel class for more information on the parameters.
port | Serial port name to open. |
speed | Speed of serial port. |
data | Number of data bits for serial port. |
parity | Parity for serial port. |
stop | Number of stop bits for serial port. |
inputFlow | Input flow control. |
outputFlow | Output flow control. |
Send an arbitrary user meta-command string to the modem. The return value indicates that the conditions for the operation to start were met, ie the serial port was open etc and the command was successfully sent with all replies met.
str | User command string to send. |
void PModem::SetBusyString | ( | const PString & | str | ) |
Set the modem busy response meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
Note there is an implied before the string. Also the
and
commands do not operate and will simply terminate the string match.
str | New busy response command string. |
void PModem::SetConnectString | ( | const PString & | str | ) |
Set the modem connect response meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
Note there is an implied before the string. Also the
and
commands do not operate and will simply terminate the string match.
str | New connect response command string. |
void PModem::SetDeinitString | ( | const PString & | str | ) |
Set the modem de-initialisation meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
Note there is an implied before the string.
str | New de-initialisation command string. |
void PModem::SetHangUpString | ( | const PString & | str | ) |
Set the modem hang up meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
Note there is an implied before the string.
str | New hang up command string. |
void PModem::SetInitString | ( | const PString & | str | ) |
Set the modem initialisation meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
Note there is an implied before the string.
str | New initialisation command string. |
void PModem::SetNoCarrierString | ( | const PString & | str | ) |
Set the modem no carrier response meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
Note there is an implied before the string. Also the
and
commands do not operate and will simply terminate the string match.
str | New no carrier response command string. |
void PModem::SetPostDialString | ( | const PString & | str | ) |
Set the modem post-dial meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
Note there is not an implied before the string, unlike the pre-dial string.
str | New post-dial command string. |
void PModem::SetPreDialString | ( | const PString & | str | ) |
Set the modem pre-dial meta-command string.
See the PChannel::SendCommandString() function for more information on the format of the command string.
Note there is an implied before the string.
str | New pre-dial command string. |
PString PModem::busyReply [protected] |
PString PModem::connectReply [protected] |
PString PModem::deinitCmd [protected] |
PString PModem::hangUpCmd [protected] |
PString PModem::initCmd [protected] |
PString PModem::noCarrierReply [protected] |
PString PModem::postDialCmd [protected] |
PString PModem::preDialCmd [protected] |
Status PModem::status [protected] |