077ffa5e575a36ecf10084524b643c99b29dca11.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Diagnostics;
  5. using System.Data;
  6. namespace FPER
  7. {
  8. //통신명령정보 [UI<----->Tprotocol간 ]
  9. public class CmdInfo
  10. {
  11. private prt_cmd_define cmd_define;
  12. private prt_res_define res_define;
  13. private int ReceiverID = 0; //수신기ID
  14. private int commId = 1; //1-front 2-back,3-io,4-keypad
  15. private int LoopNo = 0; //LoopNo
  16. private int BoardNo = 0; //BoardNo
  17. private int RepeaterNo = 0; //중계기No
  18. //private int RepeaterType = 0; //중계기Type 0-없음,1-2회로,2-4회로,3-아나로그연감지기,4-아나로그열감지기
  19. private int InvorkNo = 0; //명령ID
  20. private object commandData = null; //설정및쓰기 데이터
  21. private string devicetype = "C"; //회로 IN/OUT 타입
  22. private int deviceId = 0; //회로ID
  23. //CC-누적카운트, CV-전압
  24. private string commandType = null; //명령타입 2문자
  25. private string subType = "*"; //회로타입(회로타입차단용)
  26. private string applyRange = "A"; //차단레벨(회로타입차단용) A-All,C-Comm,B-Board,L-Loop,R-중계기,D-회로,I-입력회로,O-출력회로
  27. private int status = 0; //ON/OFF
  28. // cyim 2015.6.29 아날로그감지기 레벨값 쓰기 명령 프로토콜 추가
  29. private byte analogDetecterFault = 0x00;
  30. private byte analogDetecterPreFire = 0x00;
  31. private byte analogDetecterFireNight = 0x00;
  32. private byte analogDetecterFireDay = 0x00;
  33. //응답을 위한 설정.
  34. private Boolean response = false; //응답여부
  35. private Boolean errResponse = false; //에러여부
  36. private object responseData = null; //응답데이터
  37. private String errMessage = ""; //에러메세지
  38. private int timeOut = 3000; //타임아웃 3초
  39. private DateTime cmdDate;
  40. private Delegate devent;
  41. public CmdInfo(prt_cmd_define cmd_define, int receiverID)
  42. {
  43. try
  44. {
  45. this.cmd_define = cmd_define;
  46. this.ReceiverID = receiverID;
  47. this.devent = null;
  48. init();
  49. }
  50. catch (Exception ex)
  51. {
  52. Util.UErrorMessage(ex, 0, 0);
  53. }
  54. }
  55. public CmdInfo(prt_res_define res_define, int receiverID, int loopNo, int boardNo, int repeaterNo)
  56. {
  57. try
  58. {
  59. this.res_define = res_define;
  60. this.ReceiverID = receiverID;
  61. this.commId = 1;
  62. this.LoopNo = loopNo;
  63. this.BoardNo = boardNo;
  64. this.RepeaterNo = repeaterNo;
  65. this.devent = null;
  66. init();
  67. }
  68. catch (Exception ex)
  69. {
  70. Util.UErrorMessage(ex, 0, 0);
  71. }
  72. }
  73. public CmdInfo(prt_cmd_define cmd_define, int receiverID, int commId, int loopNo, int boardNo, int repeaterNo, Delegate dele)
  74. {
  75. try
  76. {
  77. this.cmd_define = cmd_define;
  78. this.ReceiverID = receiverID;
  79. this.commId = commId;
  80. this.LoopNo = loopNo;
  81. this.BoardNo = boardNo;
  82. this.RepeaterNo = repeaterNo;
  83. this.devent = dele;
  84. init();
  85. }
  86. catch (Exception ex)
  87. {
  88. Util.UErrorMessage(ex, 0, 0);
  89. }
  90. }
  91. public CmdInfo(prt_cmd_define cmd_define, int receiverID, int commId, int loopNo, int boardNo, Delegate dele)
  92. {
  93. try
  94. {
  95. this.cmd_define = cmd_define;
  96. this.ReceiverID = receiverID;
  97. this.commId = commId;
  98. this.LoopNo = loopNo;
  99. this.BoardNo = boardNo;
  100. this.devent = dele;
  101. init();
  102. }
  103. catch (Exception ex)
  104. {
  105. Util.UErrorMessage(ex, 0, 0);
  106. }
  107. }
  108. private void init()
  109. {
  110. try
  111. {
  112. this.response = false;
  113. this.cmdDate = DateTime.Now;
  114. }
  115. catch (Exception ex)
  116. {
  117. Util.UErrorMessage(ex, 0, 0);
  118. }
  119. }
  120. ////중계기번호 & 중계기 타입값 넣기..
  121. //public void setRepeaterInfo(int repeaterNo,bool CutFlag, int repeaterType)
  122. //{
  123. // this.RepeaterNo = repeaterNo;
  124. // this.RepeaterType = repeaterType;
  125. // //Set_Info_Data
  126. //}
  127. public prt_cmd_define Command { get { return cmd_define; } }
  128. public prt_res_define ResCommand { get { return res_define; } set { this.res_define = value; } }
  129. public int TimeOut { get { return this.timeOut; } }
  130. public Boolean Response { get { return this.response; } set { this.response = value; } }
  131. public int receiverID { get { return this.ReceiverID; } set { this.ReceiverID = value; } }
  132. public int CommId { get { return this.commId; } set { this.commId = value; } }
  133. public int loopNo { get { return this.LoopNo; } set { this.LoopNo = value; } }
  134. public int boardNo { get { return this.BoardNo; } set { this.BoardNo = value; } }
  135. public int repeaterNo { get { return this.RepeaterNo; } set { this.RepeaterNo = value; } }
  136. public int invorkNo { get { return this.InvorkNo; } }
  137. public Delegate dEvent { get { return this.devent; } set { this.devent = value; } }
  138. //public int repeaterType { get { return this.RepeaterType; } }
  139. public object CommandData { get { return this.commandData; } set { this.commandData = value; } }
  140. public object ResponseData { get { return responseData; } set { responseData = value; response = true; } }
  141. public object ErrResponseData { get { return this.responseData; } set { this.responseData = value; this.errResponse = true; } }
  142. public Boolean ErrResponse { get { return this.errResponse; } }
  143. public String ErrMessage { get { return this.errMessage; } }
  144. public String Devicetype { get { return this.devicetype; } set { this.devicetype = value; } }
  145. public int DeviceId { get { return this.deviceId; } set { this.deviceId = value; } }
  146. public String CommandType { get { return this.commandType; } set { this.commandType = value; } }
  147. public String SubType { get { return this.subType; } set { this.subType = value; } }
  148. public String ApplyRange { get { return this.applyRange; } set { this.applyRange = value; } }
  149. public int Status { get { return this.status; } set { this.status = value; } }
  150. // cyim 2015.6.29 아날로그감지기 레벨값 쓰기 명령 프로토콜 추가
  151. public byte AnalogDetecterFault { get { return this.analogDetecterFault; } set { this.analogDetecterFault = value; } }
  152. public byte AnalogDetecterPreFire { get { return this.analogDetecterPreFire; } set { this.analogDetecterPreFire = value; } }
  153. public byte AnalogDetecterFireNight { get { return this.analogDetecterFireNight; } set { this.analogDetecterFireNight = value; } }
  154. public byte AnalogDetecterFireDay { get { return this.analogDetecterFireDay; } set { this.analogDetecterFireDay = value; } }
  155. }
  156. //이벤트로그
  157. public class EventLogInfo : IDisposable // cyim 2017.01.02 : Memory leak
  158. {
  159. public bool updated = false;
  160. public String eventId;
  161. public DateTime eventTime;
  162. private String eventType;
  163. private String eventTypeName;
  164. private MappingStatus eventStatus = MappingStatus.Normal;
  165. private int receiverID = 0; //수신기ID
  166. private int commId = 1; //1-front 2-back,3-io,4-keypad
  167. private int loopNo = 0; //LoopNo
  168. private int boardNo = 0; //BoardNo
  169. private int repeaterNo = 0; //중계기No
  170. private string inoutType = ""; //회로 IN/OUT 타입
  171. private int deviceId = 0; //회로ID
  172. private string deviceMessage = ""; //회로 IN/OUT 타입
  173. private string message = ""; //회로 IN/OUT 타입
  174. private int dataValue = 0;
  175. private bool liveMsgFlag = false;
  176. // cyim 2017.01.02 : Memory leak
  177. public void Dispose()
  178. {
  179. updated = false;
  180. eventId = "";
  181. //eventTime
  182. eventType = "";
  183. eventTypeName = "";
  184. eventStatus = MappingStatus.Normal;
  185. receiverID = 0; //수신기ID
  186. commId = 1; //1-front 2-back,3-io,4-keypad
  187. loopNo = 0; //LoopNo
  188. boardNo = 0; //BoardNo
  189. repeaterNo = 0; //중계기No
  190. inoutType = ""; //회로 IN/OUT 타입
  191. deviceId = 0; //회로ID
  192. deviceMessage = ""; //회로 IN/OUT 타입
  193. message = ""; //회로 IN/OUT 타입
  194. dataValue = 0;
  195. liveMsgFlag = false;
  196. }
  197. public EventLogInfo(string eventId)
  198. {
  199. try
  200. {
  201. this.eventId = eventId;
  202. //this.Confirm_flag = "N";
  203. this.eventType = eventId.Substring(19, 2);
  204. }
  205. catch (Exception ex)
  206. {
  207. Util.UErrorMessage(ex, 0, 0);
  208. }
  209. }
  210. public void UpdateEventLogID(string eventId)
  211. {
  212. this.eventId = eventId;
  213. }
  214. public String EventId { get { return this.eventId; } }
  215. public DateTime EventTime { get { return this.eventTime; } set { this.eventTime = value; } }
  216. public String EventType { get { return this.eventType; } set { this.eventType = value; } }
  217. public String EventTypeName { get { return this.eventTypeName; } set { this.eventTypeName = value; } }
  218. public MappingStatus EventStatus { get { return this.eventStatus; } set { this.eventStatus = value; } }
  219. public String DeviceMessage { get { return this.deviceMessage; } set { this.deviceMessage = value; } }
  220. public String Message { get { return this.message; } set { this.message = value; } }
  221. public int ReceiverID { get { return this.receiverID; } set { this.receiverID = value; } }
  222. public int CommId { get { return this.commId; } set { this.commId = value; } }
  223. public int LoopNo { get { return this.loopNo; } set { this.loopNo = value; } }
  224. public int BoardNo { get { return this.boardNo; } set { this.boardNo = value; } }
  225. public int RepeaterNo { get { return this.repeaterNo; } set { this.repeaterNo = value; } }
  226. public String InoutType { get { return this.inoutType; } set { this.inoutType = value; } }
  227. public int DeviceId { get { return this.deviceId; } set { this.deviceId = value; } }
  228. public int DataValue { get { return this.dataValue; } set { this.dataValue = value; } }
  229. //public String Confirm_remark { get { return this.confirm_remark; } set { this.confirm_remark = value; } }
  230. //public String Confirm_flag { get { return this.confirm_flag; } set { this.confirm_flag = value; } }
  231. //public String Confirm_person { get { return this.confirm_person; } set { this.confirm_person = value; } }
  232. //public DateTime Confirm_time { get { return this.confirm_time; } set { this.confirm_time = value; } }
  233. public bool LiveMsgFlag { get { return this.liveMsgFlag; } set { this.liveMsgFlag = value; } }
  234. //public bool CommandLogFlag { get { return this.commandLogFlag; } set { this.commandLogFlag = value; } }
  235. }
  236. }