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 >
C/C++ Source or Header  |  1996-11-18  |  1KB  |  55 lines

  1. void hangup()
  2. {
  3. /*
  4.         this subroutine hangs up the modem.
  5.         hayes protocol is used.
  6.         first send a % character to get the distant end to stop
  7.         sending. then put the local modem in the command mode
  8.         and hang it up.
  9.         Note: if manual mode was selected at dialing then we assume
  10.         that we can not hangup the telephone because it is not a Hayes
  11.         compatible.  so send the % character and then return.
  12.  
  13.         this routine is slightly dependent on whether or not BIOS calls
  14.         are used to communicate with the modem.  the non-bios calls are
  15.         faster and different time-out values are needed.
  16. */
  17. #include "getdif.h"
  18. #ifdef IBMPC
  19. int tmo = -80;    /* about 4 seconds */
  20. #endif
  21. #ifdef SUN
  22. int tmo = -5;
  23. #endif
  24. char *ptr;
  25. char ans[400];
  26. char ie1 = 'K';
  27. char ie2 = '+';
  28. char ie3 = '0';
  29. void wrtbuf(),wait1s();
  30. int rdbuf();
  31. int j;
  32.         ptr="%";
  33.         wrtbuf(ptr);
  34.         for(j=0; j<3; j++) wait1s();
  35. /*
  36.         return now if manual mode dialing
  37. */
  38.         if( (number[3] == 'm') || (number[3] == 'M') ) return;
  39.         ptr="+";
  40.         wrtbuf(ptr);
  41.         wait1s();
  42.         wrtbuf(ptr);
  43.         wait1s();
  44.         wrtbuf(ptr);    /* send + + + 1 second apart */
  45.         rdbuf(ans,ie1,ie2,ie3,tmo);
  46.         wait1s();
  47.         ptr="ATH\r";    /*hang up modem */
  48.         wrtbuf(ptr);
  49.         rdbuf(ans,ie1,ie3,ie3,tmo);
  50.     wait1s();
  51.         ptr="ATZ\r";    /* reset modem */
  52.         wrtbuf(ptr);
  53.         rdbuf(ans,ie1,ie3,ie3,tmo);
  54. }
  55.