home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / developmen / dial / dial.opl
Text File  |  1995-03-15  |  2KB  |  68 lines

  1. /*
  2.  * Example of dialing the Series 3 from OPL
  3.  *
  4.  * This code should be translated using HHTRAN from the S3 disk.  If this code
  5.  * must be translated on the S3, the following changes must be made:  C style
  6.  * comments should be change to REMs, #defines should be substituted manually
  7.  * into the rest of the code.
  8.  */
  9.  
  10.  
  11. #define CHKERR if err% : raise err% : endif
  12. #define E_FDIAL 10
  13.  
  14.  
  15.  
  16. PROC test:
  17.  
  18.    print "Dialing...";
  19.  
  20.    dial:( "0123456789,ABCDEF,*#", 4, 4, 16 )
  21.  
  22.    print "done."
  23.    get
  24.  
  25. ENDP
  26.  
  27.  
  28. /*
  29.  * ============================================================================
  30.  * Routine:  dial
  31.  * Purpose:  Emit DTMF tones from the speaker on the S3.
  32.  *
  33.  *  Author:  Russ Beinder
  34.  * Created:  92.12.16
  35.  *
  36.  * Asumptions:  dial$ with not be longer than 254 characters
  37.  *              tonelen% and delay% will not be greater than 255
  38.  *              no explicit error checking is performed
  39.  *
  40.  *   Parms:  dial$ - string of valid DTMF characters
  41.  *           tonelen% - length of each tone in 1/32 sec
  42.  *           delay% - inter-tone delay in 1/32 sec
  43.  *           pause% - length of a pause in 1/32 sec
  44.  * Returns:  none
  45.  * ============================================================================
  46.  */
  47. PROC dial:( dial$, tonelen%, delay%, pause% )
  48.  
  49.    local h%          /* File handle */
  50.    local err%        /* Error return code */
  51.    local dial%(2)    /* E_DIAL structure */
  52.    local ldial$(255) /* local copy of dial string */
  53.  
  54.  
  55.    ldial$ = dial$ + chr$(0)
  56.  
  57.  
  58.    dial%(1) = tonelen% * 256 + delay%
  59.    dial%(2) = pause%
  60.  
  61.    err% = IOOPEN( h%, "SND:", 0 ) : CHKERR
  62.  
  63.    err% = IOW( h%, E_FDIAL, #(addr( ldial$ ) + 1), dial%() ) : CHKERR
  64.  
  65.    err% = IOCLOSE( h% ) : CHKERR
  66.  
  67. ENDP
  68.