CenterProtocol.java 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. package com.its.dsrc.xnettcp.center.protocol;
  2. import java.nio.ByteBuffer;
  3. import java.nio.ByteOrder;
  4. public class CenterProtocol {
  5. public static final ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
  6. public static final int HEADER_SIZE = 10;
  7. /*******************************************************************************
  8. * 시스템 ID
  9. *******************************************************************************/
  10. public static final int INT_ID_TRAFFIC_SERVER = 0x01; /* 가공서버 */
  11. public static final int INT_ID_SIGCTL_SERVER = 0x02; /* 신호제어서버 */
  12. public static final int INT_ID_SIGCOM_SERVER = 0x03; /* 신호통신서버 */
  13. public static final int INT_ID_VDS_SERVER = 0x04; /* VDS 서버 */
  14. public static final int INT_ID_AVI_SERVER = 0x05; /* AVI 서버 */
  15. public static final int INT_ID_DSRC_SERVER = 0x06; /* DSRC 서버 */
  16. public static final int INT_ID_VMS_SERVER = 0x07; /* VMS 서버 */
  17. public static final int INT_ID_CCTV_SERVER = 0x08; /* CCTV 서버 */
  18. public static final int INT_ID_WEB_SERVER = 0x09; /* WEB 서버 */
  19. public static final int INT_ID_UTIS_SERVER = 0x0A; /* UTIS 서버 */
  20. public static final int INT_ID_KMA_SERVER = 0x0B; /* 기상청 연계 서버 */
  21. public static final int INT_ID_WCAM_SERVER = 0x0C; /* 웹카메라 연계 서버 */
  22. public static final int INT_ID_FCLT_SERVER = 0x0D; /* 시설물관리 서버 */
  23. public static final int INT_ID_EXT01_SERVER = 0x0E; /* 연계 서버1 */
  24. public static final int INT_ID_EXT02_SERVER = 0x0F; /* 연계 서버2 */
  25. public static final int INT_ID_EXT03_SERVER = 0x10; /* 연계 서버3 */
  26. public static final int INT_ID_CCAM_SERVER = 0x11; /* 교차로감시카메라 연계 서버 */
  27. public static final int INT_ID_PARK_SERVER = 0x12; /* 주차장 연계 서버 */
  28. public static final int INT_ID_RSE_SERVER = 0x13; /* RSE 연계 서버 */
  29. public static final int INT_ID_MAIN_OPER = 0x21; /* 통합운영단말 */
  30. public static final int INT_ID_WALL_OPER = 0x22; /* 상황판운영단말 */
  31. public static final int INT_ID_SIG_OPER = 0x23; /* 신호운영단말 */
  32. public static final int INT_ID_VDS_OPER = 0x24; /* VDS운영단말 */
  33. public static final int INT_ID_AVI_OPER = 0x25; /* AVI운영단말 */
  34. public static final int INT_ID_RSE_OPER = 0x26; /* DSRC운영단말 */
  35. public static final int INT_ID_VMS_OPER = 0x27; /* VMS운영단말 */
  36. public static final int INT_ID_CCTV_OPER = 0x28; /* CCTV운영단말 */
  37. public static final int INT_ID_FMS_OPER = 0x29; /* 시설물관리단말 */
  38. public static final int INT_ID_UTIS_OPER = 0x2A; /* UTIS관리단말 */
  39. public static final int INT_ID_WCAM_OPER = 0x2B; /* WCAM관리단말 */
  40. public static final int INT_ID_OPER_MIN = INT_ID_MAIN_OPER ; /* 운영단말 최소값 */
  41. public static final int INT_ID_OPER_MAX = INT_ID_WCAM_OPER ; /* 운영단말 최대값 */
  42. /*******************************************************************************
  43. * 프로토콜 OP CODE 정의
  44. *******************************************************************************/
  45. public static final int INT_OP_TRAFFIC_CHANGE = 0x10; /* 교통정보가공완료 */
  46. public static final int INT_OP_NODELINK_CHANGE = 0x11; /* 노드링크 기반 정보 변경 */
  47. public static final int INT_OP_FACILITY_CHANGE = 0x12; /* 시설물 기반 정보 변경 */
  48. public static final int INT_OP_PG_STATE_REQ = 0x13; /* 공통사항, 프로그램 동작상태 요청 */
  49. public static final int INT_OP_PG_STATE_RES = 0x14; /* 공통사항, 프로그램 동작상태 응답 */
  50. public static final int INT_OP_CHANGE_EVENT = 0x15; /* 공통사항, 마스터정보 변경 알림 */
  51. public static final int INT_OP_INC_EVENT = 0x16; /* 공통사항, 돌발정보 전송 */
  52. public static final int INT_OP_ACK = 0x17; /* 공통사항, ACK(Acknowledge) */
  53. public static final int INT_OP_NACK = 0x18; /* 공통사항, NACK(Negative Acknowledge) */
  54. public static final int INT_OP_EXTENSION = 0x19; /* 공통사항, EXTENSION 요청/응답 */
  55. /*******************************************************************************
  56. * VMS Protocol OP Code
  57. *******************************************************************************/
  58. public static final int INT_OP_VMS_STATE_REQ = 0x21; /* VMS 통신 서버, VMS 시설물 상태정보 요청 */
  59. public static final int INT_OP_VMS_STATE_RES = 0x22; /* VMS 통신 서버, VMS 시설물 상태정보 전송 */
  60. public static final int INT_OP_VMS_POWER_CTL = 0x23; /* VMS 통신 서버, VMS 전광판 On/Off 제어 */
  61. public static final int INT_OP_VMS_LUMINANCE_CTL = 0x24; /* VMS 통신 서버, VMS 휘도 제어 */
  62. public static final int INT_OP_VMS_PARA_SET = 0x25; /* VMS 통신 서버, VMS 환경설정정보 전송 */
  63. public static final int INT_OP_VMS_PARA_SET2 = 0x26; /* VMS 통신 서버, VMS 환경설정정보 전송(For Pasig) */
  64. public static final int INT_OP_VMS_RESET = 0x27; /* VMS 통신 서버, VMS 제어기 리셋 전송 */
  65. public static final int INT_OP_VMS_MODE = 0x28; /* VMS 통신 서버, VMS 운영모드 변경 */
  66. public static final int INT_OP_VMS_FORM_SAVE = 0x29; /* VMS 통신 서버, 실시간 VMS 제공정보 저장 */
  67. public static final int INT_OP_VMS_FORM_DOWNLOAD = 0x2A; /* VMS 통신 서버, 실시간 VMS 제공정보 저장 */
  68. public static final int INT_OP_VMS_IMAGE_SYMBOL = 0x2B; /* VMS image symbol update */
  69. public static final int INT_OP_VMS_IMAGE_TRAFFIC = 0x2C; /* VMS image traffic update */
  70. public static final int INT_OP_VMS_FORM_UPDATE = 0x2D; /* VMS form update */
  71. public static final int INT_OP_VMS_IFSC_UPDATE = 0x2E; /* VMS ifsc update */
  72. public static final int INT_OP_VMS_PARAM_RES = 0x2F; /* VMS 통신 서버, VMS 시설물 파라미터정보 전송 ==> 목포시 싸인텔레콤 추가 */
  73. public static final int INT_OP_VMS_COMMON = 0x30; /* 신규로 생성될 명령어를 처리하기 위한 OP Code */
  74. public static final int INT_OP_VMS_COMMON_EXT = 0x31; /* 신규로 생성될 명령어를 처리하기 위한 OP Code */
  75. public static final int INT_OP_VMS_IMMEDIATE_SCN_DNLD = 0x32; /* 폼 즉시 다운로드 OP Code */
  76. public static final int INT_OP_VMS_PARAM_REQ = 0x33; /* VMS 파라미터 요청 */
  77. public static final int INT_OP_VMS_DIRECT = 0x34; /* VMS Direct command */
  78. /*******************************************************************************
  79. * VDS Protocol OP Code
  80. *******************************************************************************/
  81. public static final int INT_OP_VDS_STOP_IMAGE_REQ = 0x50; /* VDS 통신 서버, VDS 정지영상 요청 */
  82. public static final int INT_OP_VDS_STOP_IMAGE_RES = 0x51; /* VDS 통신 서버, VDS 정지영상 요청 응답 */
  83. public static final int INT_OP_VDS_STATE_RES = 0x52; /* VDS 통신 서버, VDS 시설물 상태정보 전송 */
  84. public static final int INT_OP_VDS_FAN_CONTROL = 0x54; /* VDS 통신 서버, VDS FAN 제어 */
  85. public static final int INT_OP_VDS_RESET = 0x59; /* VDS 통신 서버, VDS 제어기 리셋 전송 */
  86. public static final int INT_OP_VDS_PARAM_REQ = 0x55; /* VDS 통신 서버, VDS 파라미터 요청 */
  87. public static final int INT_OP_VDS_PARAM_RES = 0x56; /* VDS 통신 서버, VDS 파라미터 요청 응답 */
  88. public static final int INT_OP_VDS_PARAM_SET_REQ = 0x57; /* VDS 통신 서버, VDS 파라미터 설정 요청 */
  89. public static final int INT_OP_VDS_PARAM_SET_RES = 0x58; /* VDS 통신 서버, VDS 파라미터 설정 요청 응답 */
  90. /*******************************************************************************
  91. * DSRC Protocol OP Code
  92. *******************************************************************************/
  93. public static final int INT_OP_DSRC_CONTROL_REQ = 0x60; /* DSRC 통신 서버, DSRC 제어 요청 */
  94. public static final int INT_OP_DSRC_CONTROL_RES = 0x61; /* DSRC 통신 서버, DSRC 제어 요청 응답 */
  95. public static final int INT_OP_DSRC_STATE_RES = 0x62; /* DSRC 통신 서버, DSRC 시설물 상태정보 전송 */
  96. /*******************************************************************************
  97. * WCAM Protocol OP Code
  98. *******************************************************************************/
  99. public static final int INT_OP_WCAM_STATE_RES = 0x70; /* WCAM 통신 서버, WCAM 시설물 상태정보 전송 */
  100. /*******************************************************************************
  101. * CCAM Protocol OP Code
  102. *******************************************************************************/
  103. public static final int INT_OP_CCAM_STATE_RES = 0x71; /* CCAM 통신 서버, CCAM 시설물 상태정보 전송 */
  104. /*******************************************************************************
  105. * PARK Protocol OP Code
  106. *******************************************************************************/
  107. public static final int INT_OP_PARK_STATE_RES = 0x81; /* PARK 통신 서버, PARK 시설물 상태정보 전송 */
  108. /*******************************************************************************
  109. * 프로세스 상태정보 요청/응답
  110. *******************************************************************************/
  111. public static final int INT_MAX_PG_STATE = 146; /* 최대 프로그램 상태정보 */
  112. /*******************************************************************************
  113. * 돌발 발생 통보
  114. *******************************************************************************/
  115. public static final int INT_INC_TIME_SIZE = 14; /* 'YYYYMMDDHH24MISS' */
  116. public static final int INT_INC_ID_SIZE = 12; /* 돌발 ID */
  117. /*******************************************************************************
  118. * VMS
  119. *******************************************************************************/
  120. public static final int INT_VMS_MAX_ID = 15; /* VMS 제어기 ID */
  121. public static final int INT_VMS_MAX_MODULE = 100; /* 최대 VMS 모듈 */
  122. public static final int INT_VMS_MAX_POWER = 10; /* 최대 VMS 전원 */
  123. public static final int INT_VMS_MAX_MODULE_BIT = 100; /* 최대 VMS 모듈 비트*/
  124. public static final int INT_VMS_MAX_POWER_BIT = 10; /* 최대 VMS 전원 비트 */
  125. public static final int INT_VMS_MAX_DATETIME = 14; /* YYYYMMDDHHMMSS */
  126. public static final int INT_VMS_MAX_OPER_ID = 20;
  127. public static final int INT_VMS_MAX_STATE = 80; /* 최대 VMS 시설물 상태정보 */
  128. public static final int INT_VMS_MAX_PARAM = 100; /* 최대 VMS 파라미터 */
  129. public static final int INT_VMS_MAX_PREP = 93; /* 최대 VMS 폼 갯수 정보 */
  130. public static final int INT_VMS_MAX_FORM = 40; /* 최대 VMS 폼 */
  131. public static final int INT_VMS_MAX_OBJECT = 64; /* 최대 VMS 오브젝트 */
  132. public static final int INT_VMS_MAX_STRING_BUF = 64; /* 최대 VMS 문자열 데이터 버퍼 */
  133. public static final int INT_VMS_MAX_FORM_DOWNLOAD = 100; /* 최대 VMS 제공정보 저장 (256개 까지 증가 가능) */
  134. public static final int INT_VMS_MAX_MODE = 100; /* 최대 VMS 모드변경 갯수 */
  135. /*******************************************************************************
  136. * VDS
  137. *******************************************************************************/
  138. public static final int INT_VDS_MAX_DATETIME = 14; /* YYYYMMDDHHMMSS */
  139. public static final int INT_VDS_MAX_OPER_ID = 20;
  140. public static final int INT_VDS_MAX_STATE = 200; /* 최대 VDS 시설물 상태정보 */
  141. public static final int INT_VDS_MAX_STOP_IMAGE = 65535; /* 정지영상 패킷 최대크기 */
  142. /* VDS 정지영상 요청 응답 */
  143. public static final int ERR_VDS_STOP_IMAGE_NORMAL = 0x00;
  144. public static final int ERR_VDS_STOP_IMAGE_NOT_CONNECT = 0x01;
  145. public static final int ERR_VDS_STOP_IMAGE_BUSY = 0x02;
  146. public static final int ERR_VDS_STOP_IMAGE_UNKNOWN_ID = 0x03;
  147. public static final int ERR_VDS_STOP_IMAGE_SIZE = 0x04;
  148. /*******************************************************************************
  149. * DSRC
  150. *******************************************************************************/
  151. public static final int INT_DSRC_MAX_DATETIME = 14; /* YYYYMMDDHHMMSS */
  152. public static final int INT_DSRC_MAX_OPER_ID = 20;
  153. public static final int INT_DSRC_MAX_STATE = 200; /* 최대 DSRC 시설물 상태정보 */
  154. public static byte[] getRequestHead(int sndSystem, int rcvSystem, byte opCode, int length) {
  155. ByteBuffer byteBuffer = ByteBuffer.allocate(10);
  156. byteBuffer.order(ByteOrder.BIG_ENDIAN);
  157. byteBuffer.put((byte)sndSystem); // 송신시스템-운영단말
  158. byteBuffer.put((byte)rcvSystem); // 수신시스템
  159. byteBuffer.put((byte)0x01); // 전체프레임개수
  160. byteBuffer.put((byte)0x01); // 현재프레임번호
  161. byteBuffer.put((byte)0x00); // Reserved
  162. byteBuffer.put(opCode); // OP Code
  163. byteBuffer.putInt(length); // 데이터 길이
  164. //log.error("HEAD: {}", SysUtils.byteArrayToHex(byteBuffer.array()));
  165. return byteBuffer.array();
  166. }
  167. }