COMM-DRV/Lib: ModemGetCarrierSpeed() Returns carrier speed

Description-

Returns the carrier speed at which the modem last connected(baud rate between the two modems over the telephone line). The speed returned by this function is only valid if a previous call to ModemConnect() was successful.

Syntax-

speed =ModemGetCarrierSpeed(port);

On Entry-

int port;

Port previously opened with InitializePort() or OpenComPort().

On Exit-

long speed;

The actual carrier speed that was returned by the modem the last time it successfully connected to another modem. This value is a positive decimal value. If a -1 is returned then the port was not initialized.

See Also-

Dial()
ModemAnswerMode()
ModemAttention()
ModemConnect()
ModemGetConnectSpeed()
ModemHangup()
ModemInit()
ModemModifyString()

Example-

#include "comm.h"
int port=0;
int stat;
int mode=1;
long speed;
char *telephone="1-713-568-6401";
if ((stat = ModemInit(port)) == -1)
 {
 printf("Error getting modem's attention.\n");
/* Take remedial action */
 }
if ((stat = Dial(port,mode,telephone)) == -1)
 {
 printf("Modem not responding\n");
 /* Take remedial action */
 }
if ((stat = ModemConnect(port)) != 0)
 {
 printf("Error connecting to modem\n");
/* Take remedial action */
 }
if ((speed = ModemGetCarrierSpeed(port)) != -1L)
 {
 switch(speed)
   {
   case 2400:
   SetBaud(port,BAUD2400);
   break;
   :
   :
   case 9600:
   SetBaud(port,BAUD9600);
   break;
  default:
  break;
  }
/* Continue with application */
}