home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: OtherApp / OtherApp.zip / am4pmsrc.zip / am4pm.h < prev    next >
C/C++ Source or Header  |  1994-02-27  |  7KB  |  242 lines

  1. // Thomas Answering machine for PM
  2.  
  3. // File:          AM4PMR.h
  4. // Description:   Header file
  5.  
  6. // History
  7. // 930206 TO      Now it exists...
  8.  
  9.  
  10. #define MAXHAYESMSG     80       // Maximum length of hayes message
  11. #define RECBUFFLEN      64       // Number of characters to receive at the same time
  12. #define RECFBUFFLEN     1000     // Number of characters to write to disk at the same time
  13. #define SENDBUFFLEN     1000     // Number of characters to receive at the same time
  14. #define MAXWAITDCE      60000l
  15. #define SENDTO          3        // Timeout when sending
  16. #define READTO          5        // Timeout when receiving
  17. #define RSTACKSIZE      8192     // Stack size of other threads
  18. #define MAXCMD          5        // Maximum length of command string incl null
  19. #define WAITRETRYCOM    10000l   // Time retries to open COM port
  20. #define MAXRINGDELAY    9000l    // Max delay between rings for same call
  21. #define MAXDESCR        80       // Max length of description text
  22. #define DLECODES        50       // Max number of different DLE codes
  23.  
  24. // Values of usGlobalState
  25. #define GS_START        0        // Initializing
  26. #define GS_READY        1        // Waiting for call
  27. #define GS_ENDING       2        // Ending
  28. #define GS_INITREC      3        // Starting to record. Waiting for CONNECT.
  29. #define GS_RECORDING    4        // Saving to file
  30. #define GS_DONE         5        // Recording or playback finnished
  31. #define GS_INITPLAY     6        // Starting to play.
  32.  
  33. // Types of internal messages
  34. #define IM_CMDFLAG      0x80000000l       // Flag to indicate command
  35. #define IM_NULL         0l                // No message
  36. #define IM_DOWN         (1l+IM_CMDFLAG)   // The thread should be shut down
  37. #define IM_DLEFROMDCE   2l                // DLE code from DCE
  38. #define IM_STRFROMDCE   4l                // String from DCE
  39. #define IM_XOFF         8l                // Stop sending to DCE
  40. #define IM_XON          16l               // Start sending to DCE
  41. #define IM_ABORT        32l               // bAbortCmd is set
  42. #define IM_PLAY         (64l+IM_CMDFLAG)  // Play file found in list
  43. #define IM_DELETE       (128l+IM_CMDFLAG) // Delete file
  44. #define IM_RELEASE      (256l+IM_CMDFLAG) // Release COM port
  45. #define IM_STARTAMC     (512l+IM_CMDFLAG) // Start AMC script
  46. #define IM_INICHANGED   (1024l+IM_CMDFLAG) // Start AMC script
  47. #define IM_RECORD       (2048l+IM_CMDFLAG) // Start recording
  48. #define IM_STOP         (4096l)           // Stop recording
  49. #define IM_EXTUSER      (8192l)           // External user message
  50.  
  51.  
  52. // Messages to the client window
  53. #define  WMU_THREADSUP     (WM_USER+0)
  54. #define  WMU_THREADSDOWN   (WM_USER+1)
  55. #define  WMU_STATE         (WM_USER+2)
  56. #define  WMU_LASTDCE       (WM_USER+3)
  57. #define  WMU_IDLECMD       (WM_USER+4)
  58. #define  WMU_BUSYCMD       (WM_USER+5)
  59. #define  WMU_UPDLIST       (WM_USER+6)
  60. // #define WMU_ADDLIST     (WM_USER+7)
  61. #define  WMU_NOCOM         (WM_USER+8)
  62. #define  WM_CREATED        (WM_USER+9)
  63.  
  64.  
  65. // Return codes from RING.AM
  66. #define AMR_NORMAL               0  // Normal. Only AT+VLS=0 is done before waiting
  67. #define AMR_REINIT               1  // Full init. Reinit COM-port and everything.
  68. #define AMR_EXIT                 2  // Terminate AM4PM.
  69.  
  70. // Event codes for the external queue
  71. #define EQ_RELCOM                0  // Release the COM port for 30s
  72. #define EQ_STARTAMC              1  // Start AMC script
  73. #define EQ_USER                  2  // User defined message
  74.  
  75. // Compression types used by ZyXEL
  76. #define ZCOMP_CELP      1
  77. #define ZCOMP_ADPCM2    2
  78. #define ZCOMP_ADPCM3    3
  79.  
  80.  
  81. // Types
  82. typedef struct // Parameters
  83. {
  84.    ULONG fsFlags;                // Flags of type PF_*
  85.    PCHAR szCom;                  // Com device
  86.    ULONG ulBaud;                 // Baud rate
  87.    ULONG ulRings;                // Rings before answer
  88.    ULONG ulLastFileID;           // Number of last file
  89.    BOOL fTitles;                 // If titles in container should be displayed
  90.    PCHAR szFileMode;             // Z(yXEL) or G(eneric)
  91.    PCHAR szMessagePattern;       // Message file pattern
  92.    PCHAR szFileExtension;        // Message file extension
  93.    PCHAR szATHangUp;
  94.    PCHAR szATVoiceMode;
  95.    PCHAR szATVoiceTX;
  96.    PCHAR szATVoiceRX;
  97.    PCHAR szATVoiceEndTX;
  98.    PCHAR szATVoiceCancelTX;
  99. } PARAMETERBLOCK;
  100.  
  101.  
  102. #pragma pack(1)
  103. typedef struct
  104. {
  105.    USHORT usWTime, usRTime;
  106.    UCHAR chFlag1, chFlag2, chFlag3, chErr, chBreak, chXON, chXOFF;
  107. } DCBTYPE;
  108.  
  109. typedef struct
  110. {
  111.    CHAR achTitle[5]; // Must be 'ZyXEL'
  112.    CHAR chTwo;       // Must be 2
  113.    USHORT usRes1;
  114.    USHORT usRes2;
  115.    USHORT usType;    // ZCOMP_* - 1
  116.    USHORT usRes3;
  117.    USHORT usRes4;
  118. } ZYXHEAD;
  119. #pragma pack()
  120.  
  121.  
  122. // Functions
  123. void WriteModemThread(PVOID lpVar);
  124. void QueueData
  125. (
  126.    ULONG ulMsg,   // Constant of type IM_*
  127.    PVOID pData,
  128.    ULONG ulLen
  129. );
  130. void ReadModem(PVOID lpVar);
  131. USHORT SendIt(void * str, USHORT antal);
  132.  
  133. void dprintf
  134. (
  135.    PCHAR szStr,
  136.    ...
  137. );
  138.  
  139. USHORT ShowMessage
  140. (
  141.    USHORT usMsgNr,
  142.    HWND hwnd,
  143.    USHORT flStyle,
  144.    USHORT idHelp,
  145.    ...
  146. );
  147.  
  148. void InitDebug(void);
  149.  
  150. void LogMessage
  151. (
  152.    USHORT usMsgNr,
  153.    ...
  154. );
  155.  
  156. void LogDosMessage
  157. (
  158.    USHORT usDosErr,
  159.    USHORT usMsgNr,
  160.    ...
  161. );
  162.  
  163. void LogNumMessage
  164. (
  165.    USHORT usMsgNr,
  166.    USHORT usNum,
  167.    ...
  168. );
  169.  
  170. void PrintRxSIO(PCHAR pszStr);
  171.  
  172. void GetIniFile(void);
  173. void WriteState2IniFile(void);
  174. BOOL IniPutSZ
  175. (
  176.    CHAR * szKey,
  177.    CHAR * szStr
  178. );
  179.  
  180. PCHAR IniGetSZ
  181. (
  182.    CHAR * szKey,
  183.    CHAR * szDefault
  184. );
  185.  
  186. BOOL IniPutBool
  187. (
  188.    CHAR * szKey,
  189.    BOOL bValue
  190. );
  191.  
  192. BOOL IniGetBool
  193. (
  194.    CHAR * szKey
  195. );
  196.  
  197. BOOL IniPutL
  198. (
  199.    CHAR * szKey,
  200.    LONG lValue
  201. );
  202.  
  203. LONG IniGetL
  204. (
  205.    CHAR * szKey,
  206.    LONG lDefault
  207. );
  208.  
  209. ULONG GetSysMSecs(void);
  210.  
  211. APIRET16 APIENTRY16 RPORT(USHORT);
  212. void APIENTRY16 WPORT(USHORT,USHORT);
  213. APIRET16 APIENTRY16 Dos16PortAccess(USHORT,USHORT,USHORT,USHORT);
  214.  
  215. // External variables
  216. extern HAB hab;
  217. extern HWND hwndFrame;
  218. extern HEV semStopRead;
  219. extern HEV semStopedReading;
  220. extern HEV semGoOnRead;
  221. extern HFILE hCom;
  222. extern HFILE hRec;
  223. extern volatile PARAMETERBLOCK ParamBlock;
  224. extern volatile USHORT usGlobalState;
  225. extern volatile BOOL fDebug, fWarnings, fAbortCmd;
  226. extern CHAR szMsgFile[];
  227. extern CHAR szAppName[];
  228. extern CHAR szVersion[];
  229. extern CHAR szIniFile[];
  230. extern CHAR szIniAm4Pm[];
  231. extern PCHAR pszDCEVer;
  232. extern volatile ULONG ulRecTime;
  233. extern const CHAR szEALen[];
  234. extern const CHAR szEAType[];
  235. extern CHAR szOurEAType[];
  236. extern volatile ULONG ulRecMessages;
  237. extern volatile BOOL bDLEConv;
  238. extern volatile CHAR * pchSendBuff;
  239. extern volatile ULONG ulSendBuffLen;
  240. extern volatile CHAR szActiveDLECodes[DLECODES];   // "" means all
  241.  
  242.