www.pudn.com > faxsource.rar > FAX.HPP


#if !defined(__FAX_HPP__) 
#define __FAX_HPP__ 
#include "comm.hpp" 
#include "faxhead.hpp" 
/* ******************************************************************** * 
 * 
 *  Fax specific variables, structs, etc. 
 * 
 * ******************************************************************** */ 
struct HDLC_msg                             // format of HDLC message 
    { 
    BYTE   addr;                           // address byte (always 0xff) 
    BYTE   ctl_fld;                        // control field 
    BYTE   fax_ctl_fld;                    // FAX control field (FCF) 
    BYTE   data[253];                      // optional data 
    short    len;                            // received frame length 
    }; 
 
/* ******************************************************************** * 
 * 
 *  Fax class definition 
 * 
 * ******************************************************************** */ 
 
class Fax : public Protocol 
    { 
    public: 
	   FaxHeader header; 
	   Fax     (Comm *,                    // Fax instance contstructor 
			  char *,                    //   Comm instance, station ID 
			  short(*)(short,               //   status routine 
					FuncStat *), 
			  void **,DWORD a_speed=19200);                   //   FuncStat parameter 
 
			  ~Fax(void);                // destructor 
 
	   short    Send(char *, char *,BOOL SkipDIS=FALSE); 
	   short	Receive(char *,short status=1);           // receive a fax 
	   char     nameBuffer[30]; 
    private: 
	   char     chk_char; 
	   Comm    *cp;                        // Comm instance 
	   short    Send_CSI(void),             // send optional CSI 
			 HDLC_Mode(short),             // set HDLC tx|rx mode 
			 Data_Mode(short, short),        // set data tx|rx mode 
			 Get_Speeds(void),           // get tx and rx speeds 
			 Get_Line(char *, short),      // get a CR-terminate line 
			 Get_Char(char *, short),      // get a character 
			 Rcv_Hmsg(void),             // receive an HDLC frame 
			 Send_Our_ID(BYTE),         // send our ID to remote 
			 Send_Hmsg(BYTE,BYTE,short), // send an HDLC frame 
			 Send_TSI(void),             // send TSI frame to remote 
			 Send_DIS(void),             // send DIS frame to remote 
			 Send_DCS(void),             // send DCS frame to remote 
			 Init_Modem(short),           // initialize modem 
			 (*stat)(short,                // status routine poshorter 
				    FuncStat *), 
			 connected;                  // HDLC link active 
	   WORD   pbi;                        // page buffer index 
	   long   oldspeed;                   // old commuincations speed 
	   void   Reverse_Bytes(BYTE *, short); 
 
	   void   Display_ID(char *, BYTE *,BOOL); 
	   void   Display_Msg(short); 
	   void   Display_Msg(char *); 
 
	   void	  Reset_Modem(void);          // reset modem and comm parms 
	   WORD   max_sendspeeds,max_recespeeds; 
	   WORD   speeds;                     // speeds supported 
								    // 1... .... 9600 transmit 
								    // .1.. .... 7200 
								    // ..1. .... 4800 
								    // ...1 .... 2400 
								    // .... 1... 9600 receive 
								    // .... .1.. 7200 
								    // .... ..1. 4800 
								    // .... ...1 2400 
	   BYTE 
			*pagebuf,                    // page buffer area 
			 Reverse_Byte(BYTE value);  // reverse bits in a byte 
	   char   *station;                    // our station id 
	   FuncStat fs;                  // fax status structure 
	   union   {                           // accesss HDLC msg as chars 
			 struct  HDLC_msg hmsg;      // HDLC message area 
			 BYTE   cmsg[256];          // .. same as char array 
			 }; 
	   DWORD   n_speed; 
	   char    dis_msg[6]; 
	   char    dcs_msg[6]; 
    }; 
 
#endif