Listing 1

#ifndef CHANNEL_HPP
#define CHANNEL_HPP

extern "C" {
   #include    "d40.h"
   #include    "d40lib.h"
   #include    <stdlib.h>
   #include    <bios.h>
   #include    <dos.h>
   #include    <io.h>
   #include    <fcntl.h>
   #include    <stdio.h>
   #include    <string.h>
   #include    <sys\stat.h>
}


// maximum number of touchtones to get
#define MAXDIGITS       8
// output extension for voice files
#define SPEECH_EXT      ".VOX"
// used to store user recordings
#define RECORD_FNAME    "OUTPUT"

class CHANNEL {
   private:
      int lineno;
      char msgname[9];    // message filename
      
      // buffer for keypad digits
      unsigned char digits[MAXDIGITS+1];
      RWB rwb;      // speech card read/write block
      
      // begin and end function pointers for state
      // transition processing
      int (CHANNEL::*begin_func)();
      void (CHANNEL::*end_func)(int evtcode);
   
   public:
      void prep(int line);
      int play();
      
      int begin_state();
      void cmplt_state(int evtcode);
      
      // the states used in sample application
      int wait_for_ring();
      void wait_complete(int evtcode);
      int offhook();
      void offhook_cmplt(int evtcode);
      int onhook();
      void onhook_cmplt(int evtcode);
      int hello();
      void hello_cmplt(int evtcode);
      int get_digits();
      void get_digits_cmplt(int evtcode);
      int product_info();
      void product_info_cmplt(int evtcode);
      int playback();
      void playback_cmplt(int evtcode);
      int invalid();
      void invalid_cmplt(int evtcode);
      int rec_msg();
      void rec_msg_cmplt(int evtcode);
      int goodbye();
      void goodbye_cmplt(int evtcode);
};

// typedefs used for accessing function pointers
typedef int  (CHANNEL::*INTPROC)();
typedef void (CHANNEL::*VOIDPROC)(int);


#endif

// End of File