Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PModem::Dial ( const PString number )

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.

TRUE if command string sent successfully and the objects state has changed.

Definition at line 314 of file modem.cxx.

References AwaitingResponse, CanDial(), Connected, DialFailed, Dialling, LineBusy, NoCarrier, PChannel::ReadCharWithTimeout(), and PChannel::SendCommandString().

  if (!CanDial())
    return FALSE;

  status = Dialling;
  if (!SendCommandString(preDialCmd + "\\s" + number + postDialCmd)) {
    status = DialFailed;
    return FALSE;

  status = AwaitingResponse;

  PTimer timeout = 120000;
  PINDEX connectPosition = 0;
  PINDEX busyPosition = 0;
  PINDEX noCarrierPosition = 0;

  for (;;) {
    int nextChar;
    if ((nextChar = ReadCharWithTimeout(timeout)) < 0)
      return FALSE;

    if (ReceiveCommandString(nextChar, connectReply, connectPosition, 0))

    if (ReceiveCommandString(nextChar, busyReply, busyPosition, 0)) {
      status = LineBusy;
      return FALSE;

    if (ReceiveCommandString(nextChar, noCarrierReply, noCarrierPosition, 0)) {
      status = NoCarrier;
      return FALSE;

  status = Connected;
  return TRUE;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index