AppGlobalF.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. //---------------------------------------------------------------------------
  2. #ifndef AppGlobalFH
  3. #define AppGlobalFH
  4. //---------------------------------------------------------------------------
  5. #include <vcl.h>
  6. #include <assert.h>
  7. #include <stdio.h>
  8. #include <inifiles.hpp>
  9. //---------------------------------------------------------------------------
  10. #include "ITSLogF.h"
  11. #include "ITSCommF.h"
  12. #include "SysGlobalF.h"
  13. #include "TVmsCtlrF.h"
  14. #include "TVmsImageF.h"
  15. #include "TCDSFormF.h"
  16. #include "TVmsIfscF.h"
  17. #include "VitzroCommF.h"
  18. #include "VMSProtocol.h"
  19. #include "WVMSProtocol.h"
  20. #include "ProtocolF.h"
  21. //---------------------------------------------------------------------------
  22. /*
  23. ******************************************************************************
  24. * User Define
  25. ******************************************************************************
  26. */
  27. //---------------------------------------------------------------------------
  28. #define LINFO(args...) LogWrite(eLOG_INFO, ##args)
  29. #define LDATA(args...) LogWrite(eLOG_DATA, ##args)
  30. #define LERROR(args...) LogWrite(eLOG_ERROR, ##args)
  31. #define LWARN(args...) LogWrite(eLOG_WARNING, ##args)
  32. #define LDEBUG(args...) LogWrite(eLOG_DEBUG, ##args)
  33. #define LDETAIL(args...) LogWrite(eLOG_DETAIL, ##args)
  34. #define SINFO(args...) SysLogWrite(eLOG_INFO, ##args)
  35. #define SDATA(args...) SysLogWrite(eLOG_DATA, ##args)
  36. #define SERROR(args...) SysLogWrite(eLOG_ERROR, ##args)
  37. #define SWARN(args...) SysLogWrite(eLOG_WARNING, ##args)
  38. #define SDEBUG(args...) SysLogWrite(eLOG_DEBUG, ##args)
  39. #define SDETAIL(args...) SysLogWrite(eLOG_DETAIL, ##args)
  40. #define WM_THREAD_TERMINATE (WM_USER+0x92) /* Thread 종료 메시지 */
  41. #define WM_PROCESS_STATE (WM_USER+0xA4) /* 프로세스 상태 입력 */
  42. //---------------------------------------------------------------------------
  43. #define MAX_SENDER_SIZE 20
  44. typedef struct tagIpcLogMessage
  45. {
  46. int Kind;
  47. int Flag;
  48. int Len;
  49. TDateTime Tm;
  50. char Type;
  51. char Msg[MAX_LOG_BUFFER];
  52. void *Obj;
  53. } IPC_LOG_MESSAGE;
  54. typedef struct tagCommConfig
  55. {
  56. int nCenterPort; // center udp port
  57. int nListenPort; // vms listen port
  58. AnsiString sLocalDomain; // vms server domain
  59. int nClientPort; // vms controller connect port
  60. AnsiString sLoginUser; // vms controller login id
  61. AnsiString sLoginPswd; // vms controller login pswd
  62. int nConnectWait;
  63. int nCmdTimeOut;
  64. int nWatchDogTime;
  65. int nPollingTime;
  66. void Clear()
  67. {
  68. }
  69. } COMM_CONFIG;
  70. typedef struct tagAppConfig
  71. {
  72. String sConfigFile;
  73. bool bAppClose;
  74. bool bAppLoad;
  75. bool bThrExit;
  76. String sTitle;
  77. long lMainWinHandle; /* Main Window Handle */
  78. String sManagerApp;
  79. AnsiString sProcessId; /* Process ID */
  80. int nProcessId;
  81. int nProcessPort;
  82. AnsiString sSystemId; /* System ID */
  83. AnsiString sLogDay;
  84. int nTrafficCycleTime;
  85. int nTrafficBasisTime;
  86. int nSaveFormType;
  87. int nDefaultFillColor;
  88. int nMaxLogLines;
  89. int MaxMemory; /* Max Memory size Mbyte */
  90. int MaxHandle; /* Max Handle count */
  91. int MaxThread; /* Max Thread count */
  92. int MaxGdi; /* Max Gdi count */
  93. bool RcRestart; /* 리소스 오류시 재기동 여부 */
  94. bool DownloadBitmap;
  95. //THREAD_INFO thrDb; /* DB Thread */
  96. DATABASE_INFO db;
  97. COMM_CONFIG comm;
  98. int nCenterCommLogLevel;
  99. bool bSendCenterComm;
  100. public:
  101. void Clear()
  102. {
  103. bThrExit = false;
  104. bAppClose = false;
  105. bAppLoad = false;
  106. sTitle = "";
  107. lMainWinHandle = 0;
  108. sProcessId = "";
  109. sLogDay = "";
  110. MaxMemory = 0;
  111. MaxHandle = 0;
  112. MaxThread = 0;
  113. MaxGdi = 0;
  114. //thrDb.Clear();
  115. db.Clear();
  116. comm.Clear();
  117. bSendCenterComm = false;
  118. }
  119. } APP_CONFIG;
  120. // system state
  121. typedef struct tagSystemState
  122. {
  123. BYTE Action; /* 동작 상태 */
  124. BYTE Comm; /* 통신 상태 */
  125. BYTE DB; /* DB 상태 */
  126. HANDLE hFinishEvent; /* finish event */
  127. DWORD CommThreadID; /* 통신 데이터 처리 스레드 ID */
  128. } SYSTEM_STATE;
  129. // system informations
  130. typedef struct tagSystemInformation
  131. {
  132. SYSTEM_STATE State; /* system state */
  133. } SYSTEM_INFORMATION;
  134. /*
  135. ******************************************************************************
  136. * Global variable definitions
  137. ******************************************************************************
  138. */
  139. extern APP_CONFIG g_AppCfg;
  140. extern LOG_INFO g_LogCfg;
  141. extern TITSLog *ITSLog;
  142. extern TITSLog *FDbLog;
  143. extern bool LOGIN_CHECK;
  144. extern bool LOAD_DB;
  145. extern bool APP_EXIT;
  146. extern SYSTEM_INFORMATION *g_SysInfo;
  147. #define USE_Q 0
  148. /*
  149. ******************************************************************************
  150. * Global function definitios
  151. ******************************************************************************
  152. */
  153. bool APP_LoadConfigInfo();
  154. int ITSUtil_Trace(const char *lpszFormat, ...);
  155. #endif