|
@@ -1,8 +1,10 @@
|
|
|
package com.sig.comm.server.xnet.server.process.response;
|
|
|
|
|
|
-import com.sig.comm.server.dto.SignalMapInfo;
|
|
|
+import com.sig.comm.server.dto.IntDto;
|
|
|
import com.sig.comm.server.process.dbms.DbmsData;
|
|
|
import com.sig.comm.server.process.dbms.DbmsDataProcess;
|
|
|
+import com.sig.comm.server.xnet.server.process.protocol.SigMapCompress;
|
|
|
+import com.sig.comm.server.xnet.server.process.protocol.SigMapData;
|
|
|
import com.sig.comm.server.xnet.server.process.protocol.SigProtocolConst;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.slf4j.MDC;
|
|
@@ -48,7 +50,8 @@ public class SigSignalMap implements SigCommResponse {
|
|
|
// byte compData[MAX_COMPRESSDATA_SIZE]; /* 압축된 signal map data */
|
|
|
// } pkt_signalmap, *pkt_signalmapp; /* 2 + 1+1+1+1+1 + 255 bytes = 262 */
|
|
|
|
|
|
-
|
|
|
+ int res;
|
|
|
+ SigMapData mapData = new SigMapData();
|
|
|
List<HashMap<String, Object>> typeLists = new ArrayList<>();
|
|
|
List<HashMap<String, Object>> lists = new ArrayList<>();
|
|
|
String regionCd = packet.getCenter().getRegionCd();
|
|
@@ -57,19 +60,75 @@ public class SigSignalMap implements SigCommResponse {
|
|
|
byte[] buffer = packet.getPacket().getBuffer();
|
|
|
for (int ii = 0; ii < packet.getPacket().getCount(); ii++) {
|
|
|
int intNo = ((buffer[idx++] & 0xFF) << 8) | (buffer[idx++] & 0xFF);
|
|
|
- int lcType = (buffer[idx++] & 0xFF); /* SIGNAL Controller protocol type, ESIGMAP_LC_TYPE_2004 or ESIGMAP_LC_TYPE_2010 */
|
|
|
- int ringNo = (buffer[idx++] & 0xFF); /* ring no, 0: Aring, 1: Bring */
|
|
|
- int lampTp = (buffer[idx++] & 0xFF); /* 등화기 유형 */
|
|
|
+ int lcType = (buffer[idx++] & 0xFF); /* 제어기유형(1:2004년형, 2:2010년형) */
|
|
|
+ int ringNo = (buffer[idx++] & 0xFF); /* 링번호(0:A링,1:B링) */
|
|
|
+ int lampTp = (buffer[idx++] & 0xFF); /* 등화기유형(3:3색등화기, 4:4색등화기) */
|
|
|
int planTp = (buffer[idx++] & 0xFF); /* map 계획구분, 0:일반제, 1~5:시차제, 6:보행맵 */
|
|
|
int compSize = (buffer[idx++] & 0xFF);
|
|
|
|
|
|
- if (lcType == SignalMapInfo.ESIGMAP_LC_TYPE_2004) {
|
|
|
+ byte[] compData = new byte[SigMapData.MAX_COMPRESS_DATA_SIZE];
|
|
|
+ byte[] deCompData = new byte[SigMapData.MAX_DECOMPRESS_DATA_SIZE];
|
|
|
+ System.arraycopy(buffer, idx, compData, 0, compData.length);
|
|
|
+
|
|
|
+ mapData.init();
|
|
|
|
|
|
+ if (lcType == SigMapData.ESIGMAP_LC_TYPE_2004) {
|
|
|
+ res = SigMapCompress.signalMapDecompress(compData, idx, compSize, deCompData);
|
|
|
}
|
|
|
else {
|
|
|
+ res = SigMapCompress.signalMapDecompress2010(compData, idx, compSize, deCompData);
|
|
|
+ }
|
|
|
+ idx = idx + SigMapData.MAX_COMPRESS_DATA_SIZE;
|
|
|
+
|
|
|
+ if (res == 0) {
|
|
|
+ log.error("[{}], SigSignalMap.response: Decompress Error. INT_NO: {}, LC_TYPE: {}", packet.getCenter().getLogKey(), intNo, lcType);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ IntDto intDto = packet.getCenter().getIntMap().get(intNo);
|
|
|
+ if (intDto != null) {
|
|
|
+ if (intDto.getIntLcType() != lcType || intDto.getIntLampType() != lampTp) {
|
|
|
+ HashMap<String, Object> intParam = new HashMap<>();
|
|
|
+ intParam.put("REGION_CD", regionCd);
|
|
|
+ intParam.put("INT_NO", intNo);
|
|
|
+ intParam.put("INT_LCTYPE", lcType);
|
|
|
+ intParam.put("INT_LAMP-TYPE", lampTp);
|
|
|
+ typeLists.add(intParam);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int jj = 0; jj < SigMapData.MAX_SIGMAP_STEP; jj++) {
|
|
|
+ HashMap<String, Object> param = new HashMap<>();
|
|
|
+
|
|
|
+ SigMapData.SigMapInfo mapInfo = mapData.getStep()[jj];
|
|
|
+ param.put("REGION_CD", regionCd); /*지역센터코드 */
|
|
|
+ param.put("INT_NO", intNo); /*교차로 번호 */
|
|
|
+ param.put("RING_NO", ringNo); /*링번호(0:A링,1:B링) */
|
|
|
+ param.put("PLAN_TP", planTp); /*계획구분(0:일반제, 1:시차제, 2:시차제, 3:시차제, 4:시차제, 5:시차제, 6:보행맵) */
|
|
|
+ param.put("STEP_NO", jj+1); /*스텝번호(1~32) */
|
|
|
+
|
|
|
+ param.put("CAR1", mapInfo.getLsu()[ 0] & 0xFF); /*차량등 1 (2004-LSU1) */
|
|
|
+ param.put("PED1", mapInfo.getLsu()[ 1] & 0xFF); /*보행등 1 (2004-LSU2) */
|
|
|
+ param.put("CAR2", mapInfo.getLsu()[ 2] & 0xFF);
|
|
|
+ param.put("PED2", mapInfo.getLsu()[ 3] & 0xFF);
|
|
|
+ param.put("CAR3", mapInfo.getLsu()[ 4] & 0xFF);
|
|
|
+ param.put("PED3", mapInfo.getLsu()[ 5] & 0xFF);
|
|
|
+ param.put("CAR4", mapInfo.getLsu()[ 6] & 0xFF);
|
|
|
+ param.put("PED4", mapInfo.getLsu()[ 7] & 0xFF);
|
|
|
+ param.put("CAR5", mapInfo.getLsu()[ 8] & 0xFF);
|
|
|
+ param.put("PED5", mapInfo.getLsu()[ 9] & 0xFF);
|
|
|
+ param.put("CAR6", mapInfo.getLsu()[10] & 0xFF);
|
|
|
+ param.put("PED6", mapInfo.getLsu()[11] & 0xFF);
|
|
|
+ param.put("CAR7", mapInfo.getLsu()[12] & 0xFF);
|
|
|
+ param.put("PED7", mapInfo.getLsu()[13] & 0xFF);
|
|
|
+ param.put("CAR8", mapInfo.getLsu()[14] & 0xFF); /*차량등 8 (2004-LSU15) */
|
|
|
+ param.put("PED8", mapInfo.getLsu()[15] & 0xFF); /*보행등 8 (2004-LSU16) */
|
|
|
+ param.put("MIN_TM", mapInfo.getMinTm() & 0xFF); /*최소시간 */
|
|
|
+ param.put("MAX_TM", mapInfo.getMaxTm() & 0xFF); /*최대시간 */
|
|
|
+ param.put("EOP", mapInfo.getEop() & 0xFF); /*현시종료여부(1:종료) */
|
|
|
|
|
|
+ lists.add(param);
|
|
|
}
|
|
|
- idx = idx + 255;
|
|
|
}
|
|
|
this.dbmsDataProcess.add(new DbmsData(DbmsData.DBMS_DATA_INT_SIGNALMAP, packet.getCenter(), false, lists));
|
|
|
if (!typeLists.isEmpty()) {
|