home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
nisttime.carsoncity.k12.mi.us
/
nisttime.carsoncity.k12.mi.us.tar
/
nisttime.carsoncity.k12.mi.us
/
pub
/
lockclock
/
hangup_l.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-11-18
|
1KB
|
55 lines
void hangup()
{
/*
this subroutine hangs up the modem.
hayes protocol is used.
first send a % character to get the distant end to stop
sending. then put the local modem in the command mode
and hang it up.
Note: if manual mode was selected at dialing then we assume
that we can not hangup the telephone because it is not a Hayes
compatible. so send the % character and then return.
this routine is slightly dependent on whether or not BIOS calls
are used to communicate with the modem. the non-bios calls are
faster and different time-out values are needed.
*/
#include "getdif.h"
#ifdef IBMPC
int tmo = -80; /* about 4 seconds */
#endif
#ifdef SUN
int tmo = -5;
#endif
char *ptr;
char ans[400];
char ie1 = 'K';
char ie2 = '+';
char ie3 = '0';
void wrtbuf(),wait1s();
int rdbuf();
int j;
ptr="%";
wrtbuf(ptr);
for(j=0; j<3; j++) wait1s();
/*
return now if manual mode dialing
*/
if( (number[3] == 'm') || (number[3] == 'M') ) return;
ptr="+";
wrtbuf(ptr);
wait1s();
wrtbuf(ptr);
wait1s();
wrtbuf(ptr); /* send + + + 1 second apart */
rdbuf(ans,ie1,ie2,ie3,tmo);
wait1s();
ptr="ATH\r"; /*hang up modem */
wrtbuf(ptr);
rdbuf(ans,ie1,ie3,ie3,tmo);
wait1s();
ptr="ATZ\r"; /* reset modem */
wrtbuf(ptr);
rdbuf(ans,ie1,ie3,ie3,tmo);
}