浏览代码

decompress 2004

shjung 11 月之前
父节点
当前提交
cd50746561

+ 1 - 0
conf/sig-comm-server.pid

@@ -0,0 +1 @@
+14508

+ 10 - 10
src/main/java/com/sig/comm/server/xnet/server/process/protocol/SigMapData.java

@@ -97,7 +97,7 @@ public class SigMapData {
         return (short) ((lrc0 << 8) | (lrc1 & 0xFF));
     }
 
-    public static int signalMapDecompress(byte[] compData, int start, int length, byte[] deCompData) {
+    public static int signalMapDecompress(byte[] compData, int start, int length, SigMapData result) {
         int dp = 0;
         int cop, cp, up;
         int end_src = start + length;
@@ -150,17 +150,17 @@ public class SigMapData {
             for (bitCount = 0; bitCount < 8; bitCount++) {
                 data = compData[sp] & 0xFF;
                 temp = data & (0x0001 << bitCount);
-                if (temp > 0) {
+                if (temp != 0) {
                     inx = compData[cp] & 0xFF;
-                    temp = (inx & (0x03 << inxCount) ) >> inxCount;
-                    switch(temp) {
-                        case CODE_PED_GINX: deCompData[dp] = CODE_PED_GREEN; break;
-                        case CODE_PED_FINX: deCompData[dp] = CODE_PED_FLASH; break;
-                        case CODE_CAR_GINX: deCompData[dp] = CODE_CAR_GREEN; break;
+                    inx = (inx & (0x03 << inxCount) ) >> inxCount;
+                    switch(inx) {
+                        case CODE_PED_GINX: result.step[dp/MAX_CODE_SIZE].code[dp%MAX_CODE_SIZE] = CODE_PED_GREEN; break;
+                        case CODE_PED_FINX: result.step[dp/MAX_CODE_SIZE].code[dp%MAX_CODE_SIZE] = CODE_PED_FLASH; break;
+                        case CODE_CAR_GINX: result.step[dp/MAX_CODE_SIZE].code[dp%MAX_CODE_SIZE] = CODE_CAR_GREEN; break;
                         case CODE_USER_INX:
-                            deCompData[dp] = (byte)(compData[up] & 0xFF);
+                            result.step[dp/MAX_CODE_SIZE].code[dp%MAX_CODE_SIZE] = (byte)(compData[up] & 0xFF);
                             up++;
-                            if ((deCompData[up] & 0xFF) == (byte)0x00) {
+                            if ((result.step[dp/MAX_CODE_SIZE].code[dp%MAX_CODE_SIZE] & 0xFF) == (byte)0x00) {
                                 return byteCount+1;
                             }
                             break;
@@ -173,7 +173,7 @@ public class SigMapData {
                     dp++;
                 }
                 else {
-                    deCompData[dp] = (byte)0x00;
+                    result.step[dp/MAX_CODE_SIZE].code[dp%MAX_CODE_SIZE] = (byte)0x00;
                     dp++;
                 }
                 if (dp >= MAXMAPDATASIZE) {

+ 110 - 230
src/main/java/com/sig/comm/server/xnet/server/process/response/SigSignalMap.java

@@ -1,6 +1,5 @@
 package com.sig.comm.server.xnet.server.process.response;
 
-import com.sig.app.common.utils.SysUtils;
 import com.sig.comm.server.dto.IntDto;
 import com.sig.comm.server.process.dbms.DbmsData;
 import com.sig.comm.server.process.dbms.DbmsDataProcess;
@@ -21,8 +20,8 @@ public class SigSignalMap implements SigCommResponse {
         this.dbmsDataProcess = dbmsDataProcess;
     }
 
-    //@Override
-    public boolean responseB(RecvPacketDto packet) {
+    @Override
+    public boolean response(RecvPacketDto packet) {
         boolean result = true;
         try {
             MDC.put("id", packet.getCenter().getLogKey());
@@ -47,14 +46,15 @@ public class SigSignalMap implements SigCommResponse {
 //            } pkt_signalmap, *pkt_signalmapp; /* 2 + 1+1+1+1+1 + 255 bytes = 262 */
 
             int res;
-//            SigMapData mapData = new SigMapData();
+            SigMapData mapData = new SigMapData();
             List<HashMap<String, Object>> typeLists = new ArrayList<>();
             List<HashMap<String, Object>> lists = new ArrayList<>();
             String regionCd = packet.getCenter().getRegionCd();
-//            String commDt = packet.getPacket().getCommDate();
-            int idx = SigProtocolConst.SIG_HEAD_SIZE;
+            int idx;
             byte[] buffer = packet.getPacket().getBuffer();
             for (int ii = 0; ii < packet.getPacket().getCount(); ii++) {
+                idx = SigProtocolConst.SIG_HEAD_SIZE + (ii * (7 + SigMapData.MAX_COMPRESS_DATA_SIZE));
+
                 int intNo = ((buffer[idx++] & 0xFF) << 8) | (buffer[idx++] & 0xFF);
                 int lcType = (buffer[idx++] & 0xFF);    /* 제어기유형(1:2004년형, 2:2010년형) */
                 int ringNo = (buffer[idx++] & 0xFF);    /* 링번호(0:A링,1:B링) */
@@ -62,24 +62,20 @@ public class SigSignalMap implements SigCommResponse {
                 int planTp = (buffer[idx++] & 0xFF);    /* map 계획구분, 0:일반제, 1~5:시차제, 6:보행맵 */
                 int compSize = (buffer[idx++] & 0xFF);
 
-                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();
+                mapData.init();
 
                 if (lcType == SigMapData.ESIGMAP_LC_TYPE_2004) {
-                    res = SigMapData.signalMapDecompress(compData, idx, compSize, deCompData);
+                    log.info("INT_NO: {}, RING_NO: {}, PLAN_TP: {}", intNo, ringNo, planTp);
+                    res = SigMapData.signalMapDecompress(buffer, idx, compSize, mapData);
                 }
                 else {
-//                    res = SigMapData.signalMapDecompress2010(compData, idx, compSize, deCompData);
+                    res = SigMapData.signalMapDecompress2010(buffer, idx, compSize, mapData);
                 }
-                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;
-//                }
+                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) {
@@ -93,7 +89,6 @@ public class SigSignalMap implements SigCommResponse {
                     }
                 }
 
-                int spIdx = 0;
                 for (int jj = 0; jj < SigMapData.MAX_SIGMAP_STEP; jj++) {
                     HashMap<String, Object> param = new HashMap<>();
 
@@ -103,51 +98,32 @@ public class SigSignalMap implements SigCommResponse {
                     param.put("PLAN_TP",    planTp);                    /*계획구분(0:일반제, 1:시차제, 2:시차제, 3:시차제, 4:시차제, 5:시차제, 6:보행맵) */
                     param.put("STEP_NO",    jj+1);                      /*스텝번호(1~32) */
 
-                    param.put("CAR1",   deCompData[spIdx++] & 0xFF);   /*차량등 1 (2004-LSU1) */
-                    param.put("PED1",   deCompData[spIdx++] & 0xFF);   /*보행등 1 (2004-LSU2) */
-                    param.put("CAR2",   deCompData[spIdx++] & 0xFF);
-                    param.put("PED2",   deCompData[spIdx++] & 0xFF);
-                    param.put("CAR3",   deCompData[spIdx++] & 0xFF);
-                    param.put("PED3",   deCompData[spIdx++] & 0xFF);
-                    param.put("CAR4",   deCompData[spIdx++] & 0xFF);
-                    param.put("PED4",   deCompData[spIdx++] & 0xFF);
-                    param.put("CAR5",   deCompData[spIdx++] & 0xFF);
-                    param.put("PED5",   deCompData[spIdx++] & 0xFF);
-                    param.put("CAR6",   deCompData[spIdx++] & 0xFF);
-                    param.put("PED6",   deCompData[spIdx++] & 0xFF);
-                    param.put("CAR7",   deCompData[spIdx++] & 0xFF);
-                    param.put("PED7",   deCompData[spIdx++] & 0xFF);
-                    param.put("CAR8",   deCompData[spIdx++] & 0xFF);   /*차량등 8 (2004-LSU15) */
-                    param.put("PED8",   deCompData[spIdx++] & 0xFF);   /*보행등 8 (2004-LSU16) */
-                    param.put("MIN_TM", deCompData[spIdx++] & 0xFF);   /*최소시간 */
-                    param.put("MAX_TM", deCompData[spIdx++] & 0xFF);   /*최대시간 */
-                    param.put("EOP",    deCompData[spIdx++] & 0xFF);   /*현시종료여부(1:종료) */
-
-//                    SigMapData.SigMapInfo mapInfo = mapData.getStep()[jj];
-//                    param.put("CAR1",   mapData.step[jj][ 0] & 0xFF);   /*차량등 1 (2004-LSU1) */
-//                    param.put("PED1",   mapData.step[jj][ 1] & 0xFF);   /*보행등 1 (2004-LSU2) */
-//                    param.put("CAR2",   mapData.step[jj][ 2] & 0xFF);
-//                    param.put("PED2",   mapData.step[jj][ 3] & 0xFF);
-//                    param.put("CAR3",   mapData.step[jj][ 4] & 0xFF);
-//                    param.put("PED3",   mapData.step[jj][ 5] & 0xFF);
-//                    param.put("CAR4",   mapData.step[jj][ 6] & 0xFF);
-//                    param.put("PED4",   mapData.step[jj][ 7] & 0xFF);
-//                    param.put("CAR5",   mapData.step[jj][ 8] & 0xFF);
-//                    param.put("PED5",   mapData.step[jj][ 9] & 0xFF);
-//                    param.put("CAR6",   mapData.step[jj][10] & 0xFF);
-//                    param.put("PED6",   mapData.step[jj][11] & 0xFF);
-//                    param.put("CAR7",   mapData.step[jj][12] & 0xFF);
-//                    param.put("PED7",   mapData.step[jj][13] & 0xFF);
-//                    param.put("CAR8",   mapData.step[jj][14] & 0xFF);   /*차량등 8 (2004-LSU15) */
-//                    param.put("PED8",   mapData.step[jj][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:종료) */
+                    param.put("CAR1",   mapData.step[jj].code[ 0] & 0xFF);   /*차량등 1 (2004-LSU1) */
+                    param.put("PED1",   mapData.step[jj].code[ 1] & 0xFF);   /*보행등 1 (2004-LSU2) */
+                    param.put("CAR2",   mapData.step[jj].code[ 2] & 0xFF);
+                    param.put("PED2",   mapData.step[jj].code[ 3] & 0xFF);
+                    param.put("CAR3",   mapData.step[jj].code[ 4] & 0xFF);
+                    param.put("PED3",   mapData.step[jj].code[ 5] & 0xFF);
+                    param.put("CAR4",   mapData.step[jj].code[ 6] & 0xFF);
+                    param.put("PED4",   mapData.step[jj].code[ 7] & 0xFF);
+                    param.put("CAR5",   mapData.step[jj].code[ 8] & 0xFF);
+                    param.put("PED5",   mapData.step[jj].code[ 9] & 0xFF);
+                    param.put("CAR6",   mapData.step[jj].code[10] & 0xFF);
+                    param.put("PED6",   mapData.step[jj].code[11] & 0xFF);
+                    param.put("CAR7",   mapData.step[jj].code[12] & 0xFF);
+                    param.put("PED7",   mapData.step[jj].code[13] & 0xFF);
+                    param.put("CAR8",   mapData.step[jj].code[14] & 0xFF);   /*차량등 8 (2004-LSU15) */
+                    param.put("PED8",   mapData.step[jj].code[15] & 0xFF);   /*보행등 8 (2004-LSU16) */
+                    param.put("MIN_TM", mapData.step[jj].code[16] & 0xFF);   /*최소시간 */
+                    param.put("MAX_TM", mapData.step[jj].code[17] & 0xFF);   /*최대시간 */
+                    param.put("EOP",    mapData.step[jj].code[18] & 0xFF);   /*현시종료여부(1:종료) */
 
                     lists.add(param);
                 }
             }
-            this.dbmsDataProcess.add(new DbmsData(DbmsData.DBMS_DATA_INT_SIGNALMAP, packet.getCenter(), false, lists));
+            if (!lists.isEmpty()) {
+                this.dbmsDataProcess.add(new DbmsData(DbmsData.DBMS_DATA_INT_SIGNALMAP, packet.getCenter(), false, lists));
+            }
             if (!typeLists.isEmpty()) {
                 this.dbmsDataProcess.add(new DbmsData(DbmsData.DBMS_DATA_INT_TYPE, packet.getCenter(), false, typeLists));
             }
@@ -163,35 +139,18 @@ public class SigSignalMap implements SigCommResponse {
         return result;
     }
 
-    @Override
-    public boolean response(RecvPacketDto packet) {
+    public boolean responseTEST(RecvPacketDto packet) {
         boolean result = true;
         try {
-            MDC.put("id", packet.getCenter().getLogKey());
-            log.info("[{}], SigSignalMap.response.", packet.getCenter().getLogKey());
-
             final int recordSize = 262; // 2 + 1+1+1+1+1 + 255 = 262
             if (!packet.getPacket().checkDataLength(recordSize)) {
                 log.error("[{}], SigPhaseChange.response: Data Length Error: Req({}), Cur({}). will be closed.",
                         packet.getCenter().getLogKey(), packet.getPacket().getReqDataLength(recordSize), packet.getPacket().getCurDataLength());
                 return false;
             }
-//            #define MAX_COMPRESSDATA_SIZE   255
-//            typedef struct _pktSignalMap
-//            {
-//                byte int_no  [2];                       /* 교차로 번호 */
-//                byte lcType  [1];                       /* SIGNAL Controller protocol type, ESIGMAP_LC_TYPE_2004 or  ESIGMAP_LC_TYPE_2010 */
-//                byte ringNo  [1];                       /* ring no, 0: Aring, 1: Bring */
-//                byte lampTp  [1];                       /* 등화기 유형 */
-//                byte planTp  [1];                       /* map 계획구분, 0:일반제, 1~5:시차제, 6:보행맵 */
-//                byte compSize[1];                       /* 압축된 signal map data size */
-//                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();
             int idx;
             byte[] buffer = packet.getPacket().getBuffer();
@@ -205,179 +164,100 @@ public class SigSignalMap implements SigCommResponse {
                 int planTp = (buffer[idx++] & 0xFF);    /* map 계획구분, 0:일반제, 1~5:시차제, 6:보행맵 */
                 int compSize = (buffer[idx++] & 0xFF);
 
-//                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) {
                     log.info("INT_NO: {}, RING_NO: {}, PLAN_TP: {}", intNo, ringNo, planTp);
-                    res = SigMapData.signalMapDecompress(buffer, idx, compSize, deCompData);
+                    res = SigMapData.signalMapDecompress(buffer, idx, compSize, mapData);
                 }
                 else {
-                    continue;
-//                    res = SigMapData.signalMapDecompress2010(buffer, idx, compSize, mapData);
+                    res = SigMapData.signalMapDecompress2010(buffer, idx, compSize, mapData);
                 }
 
-                if (res == 0 && res == -999) {
+                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);
-                    }
-                }
-
-                int spIdx = 0;
                 for (int jj = 0; jj < SigMapData.MAX_SIGMAP_STEP; jj++) {
-                    HashMap<String, Object> param = new HashMap<>();
-
-                    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) */
-
-                    if (lcType == SigMapData.ESIGMAP_LC_TYPE_2004) {
-                        param.put("CAR1",   deCompData[spIdx++] & 0xFF);   /*차량등 1 (2004-LSU1) */
-                        param.put("PED1",   deCompData[spIdx++] & 0xFF);   /*보행등 1 (2004-LSU2) */
-                        param.put("CAR2",   deCompData[spIdx++] & 0xFF);
-                        param.put("PED2",   deCompData[spIdx++] & 0xFF);
-                        param.put("CAR3",   deCompData[spIdx++] & 0xFF);
-                        param.put("PED3",   deCompData[spIdx++] & 0xFF);
-                        param.put("CAR4",   deCompData[spIdx++] & 0xFF);
-                        param.put("PED4",   deCompData[spIdx++] & 0xFF);
-                        param.put("CAR5",   deCompData[spIdx++] & 0xFF);
-                        param.put("PED5",   deCompData[spIdx++] & 0xFF);
-                        param.put("CAR6",   deCompData[spIdx++] & 0xFF);
-                        param.put("PED6",   deCompData[spIdx++] & 0xFF);
-                        param.put("CAR7",   deCompData[spIdx++] & 0xFF);
-                        param.put("PED7",   deCompData[spIdx++] & 0xFF);
-                        param.put("CAR8",   deCompData[spIdx++] & 0xFF);   /*차량등 8 (2004-LSU15) */
-                        param.put("PED8",   deCompData[spIdx++] & 0xFF);   /*보행등 8 (2004-LSU16) */
-                        param.put("MIN_TM", deCompData[spIdx++] & 0xFF);   /*최소시간 */
-                        param.put("MAX_TM", deCompData[spIdx++] & 0xFF);   /*최대시간 */
-                        param.put("EOP",    deCompData[spIdx++] & 0xFF);   /*현시종료여부(1:종료) */
-                    }
-                    else {
-                        param.put("CAR1", mapData.step[jj].code[0] & 0xFF);   /*차량등 1 (2004-LSU1) */
-                        param.put("PED1", mapData.step[jj].code[1] & 0xFF);   /*보행등 1 (2004-LSU2) */
-                        param.put("CAR2", mapData.step[jj].code[2] & 0xFF);
-                        param.put("PED2", mapData.step[jj].code[3] & 0xFF);
-                        param.put("CAR3", mapData.step[jj].code[4] & 0xFF);
-                        param.put("PED3", mapData.step[jj].code[5] & 0xFF);
-                        param.put("CAR4", mapData.step[jj].code[6] & 0xFF);
-                        param.put("PED4", mapData.step[jj].code[7] & 0xFF);
-                        param.put("CAR5", mapData.step[jj].code[8] & 0xFF);
-                        param.put("PED5", mapData.step[jj].code[9] & 0xFF);
-                        param.put("CAR6", mapData.step[jj].code[10] & 0xFF);
-                        param.put("PED6", mapData.step[jj].code[11] & 0xFF);
-                        param.put("CAR7", mapData.step[jj].code[12] & 0xFF);
-                        param.put("PED7", mapData.step[jj].code[13] & 0xFF);
-                        param.put("CAR8", mapData.step[jj].code[14] & 0xFF);   /*차량등 8 (2004-LSU15) */
-                        param.put("PED8", mapData.step[jj].code[15] & 0xFF);   /*보행등 8 (2004-LSU16) */
-                        param.put("MIN_TM", mapData.step[jj].code[16] & 0xFF);   /*최소시간 */
-                        param.put("MAX_TM", mapData.step[jj].code[17] & 0xFF);   /*최대시간 */
-                        param.put("EOP", mapData.step[jj].code[18] & 0xFF);   /*현시종료여부(1:종료) */
-                    }
-                    lists.add(param);
+                    log.info("{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}",
+                    regionCd,
+                    intNo,
+                    ringNo,
+                    planTp,
+                    String.format("%2d", jj+1),
+
+                    String.format("%3d", mapData.step[jj].code[0] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[1] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[2] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[3] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[4] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[5] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[6] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[7] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[8] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[9] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[10] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[11] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[12] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[13] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[14] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[15] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[16] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[17] & 0xFF),
+                    String.format("%3d", mapData.step[jj].code[18] & 0xFF));   /*현시종료여부(1:종료) */
                 }
             }
-            if (!lists.isEmpty()) {
-                this.dbmsDataProcess.add(new DbmsData(DbmsData.DBMS_DATA_INT_SIGNALMAP, packet.getCenter(), false, lists));
-            }
-            if (!typeLists.isEmpty()) {
-                this.dbmsDataProcess.add(new DbmsData(DbmsData.DBMS_DATA_INT_TYPE, packet.getCenter(), false, typeLists));
-            }
         }
         catch (Exception e) {
             log.error("[{}], SigSignalMap.response: Exception. will be closed. {}", packet.getCenter().getLogKey(), e.getMessage());
             result = false;
         }
-        finally {
-            MDC.remove(packet.getCenter().getLogKey());
-            MDC.clear();
-        }
         return result;
     }
 
-    public void responseTEST(RecvPacketDto packet) {
-        try {
-            final int recordSize = 262; // 2 + 1+1+1+1+1 + 255 = 262
-            if (!packet.getPacket().checkDataLength(recordSize)) {
-                log.error("[{}], SigPhaseChange.response: Data Length Error: Req({}), Cur({}). will be closed.",
-                        packet.getCenter().getLogKey(), packet.getPacket().getReqDataLength(recordSize), packet.getPacket().getCurDataLength());
-                return;
-            }
-
-            int res;
-            List<HashMap<String, Object>> typeLists = new ArrayList<>();
-            List<HashMap<String, Object>> lists = new ArrayList<>();
-            String regionCd = packet.getCenter().getRegionCd();
-            int idx = SigProtocolConst.SIG_HEAD_SIZE;
-            byte[] buffer = packet.getPacket().getBuffer();
-            for (int ii = 0; ii < packet.getPacket().getCount(); ii++) {
-                idx = SigProtocolConst.SIG_HEAD_SIZE + (ii * (7 + SigMapData.MAX_COMPRESS_DATA_SIZE));
-                int intNo = ((buffer[idx++] & 0xFF) << 8) | (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);
-
-                log.info("{}, {}, {}, {}, {}, {}", intNo, lcType, ringNo, lampTp, planTp, compSize);
-
-                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);
-
-                log.info("{} Bytes. {}", deCompData.length, SysUtils.byteArrayToHex(compData));
-                if (lcType == SigMapData.ESIGMAP_LC_TYPE_2004) {
-                    //res = SigMapData.signalMapDecompress(compData, idx, compSize, deCompData);
-                }
-                else {
-//                    res = SigMapData.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);
-//                }
-
-//                    param.put("CAR1",   deCompData[spIdx++] & 0xFF);   /*차량등 1 (2004-LSU1) */
-//                    param.put("PED1",   deCompData[spIdx++] & 0xFF);   /*보행등 1 (2004-LSU2) */
-//                    param.put("CAR2",   deCompData[spIdx++] & 0xFF);
-//                    param.put("PED2",   deCompData[spIdx++] & 0xFF);
-//                    param.put("CAR3",   deCompData[spIdx++] & 0xFF);
-//                    param.put("PED3",   deCompData[spIdx++] & 0xFF);
-//                    param.put("CAR4",   deCompData[spIdx++] & 0xFF);
-//                    param.put("PED4",   deCompData[spIdx++] & 0xFF);
-//                    param.put("CAR5",   deCompData[spIdx++] & 0xFF);
-//                    param.put("PED5",   deCompData[spIdx++] & 0xFF);
-//                    param.put("CAR6",   deCompData[spIdx++] & 0xFF);
-//                    param.put("PED6",   deCompData[spIdx++] & 0xFF);
-//                    param.put("CAR7",   deCompData[spIdx++] & 0xFF);
-//                    param.put("PED7",   deCompData[spIdx++] & 0xFF);
-//                    param.put("CAR8",   deCompData[spIdx++] & 0xFF);   /*차량등 8 (2004-LSU15) */
-//                    param.put("PED8",   deCompData[spIdx++] & 0xFF);   /*보행등 8 (2004-LSU16) */
-//                    param.put("MIN_TM", deCompData[spIdx++] & 0xFF);   /*최소시간 */
-//                    param.put("MAX_TM", deCompData[spIdx++] & 0xFF);   /*최대시간 */
-//                    param.put("EOP",    deCompData[spIdx++] & 0xFF);   /*현시종료여부(1:종료) */
-
-            }
-        }
-        catch (Exception e) {
-            log.error("[{}], SigSignalMap.response: Exception. will be closed. {}", packet.getCenter().getLogKey(), e.getMessage());
-        }
-    }
-
+//    {
+//        if (lcType == SigMapData.ESIGMAP_LC_TYPE_2004) {
+//            param.put("CAR1",   deCompData[spIdx++] & 0xFF);   /*차량등 1 (2004-LSU1) */
+//            param.put("PED1",   deCompData[spIdx++] & 0xFF);   /*보행등 1 (2004-LSU2) */
+//            param.put("CAR2",   deCompData[spIdx++] & 0xFF);
+//            param.put("PED2",   deCompData[spIdx++] & 0xFF);
+//            param.put("CAR3",   deCompData[spIdx++] & 0xFF);
+//            param.put("PED3",   deCompData[spIdx++] & 0xFF);
+//            param.put("CAR4",   deCompData[spIdx++] & 0xFF);
+//            param.put("PED4",   deCompData[spIdx++] & 0xFF);
+//            param.put("CAR5",   deCompData[spIdx++] & 0xFF);
+//            param.put("PED5",   deCompData[spIdx++] & 0xFF);
+//            param.put("CAR6",   deCompData[spIdx++] & 0xFF);
+//            param.put("PED6",   deCompData[spIdx++] & 0xFF);
+//            param.put("CAR7",   deCompData[spIdx++] & 0xFF);
+//            param.put("PED7",   deCompData[spIdx++] & 0xFF);
+//            param.put("CAR8",   deCompData[spIdx++] & 0xFF);   /*차량등 8 (2004-LSU15) */
+//            param.put("PED8",   deCompData[spIdx++] & 0xFF);   /*보행등 8 (2004-LSU16) */
+//            param.put("MIN_TM", deCompData[spIdx++] & 0xFF);   /*최소시간 */
+//            param.put("MAX_TM", deCompData[spIdx++] & 0xFF);   /*최대시간 */
+//            param.put("EOP",    deCompData[spIdx++] & 0xFF);   /*현시종료여부(1:종료) */
+//        }
+//        else {
+//            param.put("CAR1", mapData.step[jj].code[0] & 0xFF);   /*차량등 1 (2004-LSU1) */
+//            param.put("PED1", mapData.step[jj].code[1] & 0xFF);   /*보행등 1 (2004-LSU2) */
+//            param.put("CAR2", mapData.step[jj].code[2] & 0xFF);
+//            param.put("PED2", mapData.step[jj].code[3] & 0xFF);
+//            param.put("CAR3", mapData.step[jj].code[4] & 0xFF);
+//            param.put("PED3", mapData.step[jj].code[5] & 0xFF);
+//            param.put("CAR4", mapData.step[jj].code[6] & 0xFF);
+//            param.put("PED4", mapData.step[jj].code[7] & 0xFF);
+//            param.put("CAR5", mapData.step[jj].code[8] & 0xFF);
+//            param.put("PED5", mapData.step[jj].code[9] & 0xFF);
+//            param.put("CAR6", mapData.step[jj].code[10] & 0xFF);
+//            param.put("PED6", mapData.step[jj].code[11] & 0xFF);
+//            param.put("CAR7", mapData.step[jj].code[12] & 0xFF);
+//            param.put("PED7", mapData.step[jj].code[13] & 0xFF);
+//            param.put("CAR8", mapData.step[jj].code[14] & 0xFF);   /*차량등 8 (2004-LSU15) */
+//            param.put("PED8", mapData.step[jj].code[15] & 0xFF);   /*보행등 8 (2004-LSU16) */
+//            param.put("MIN_TM", mapData.step[jj].code[16] & 0xFF);   /*최소시간 */
+//            param.put("MAX_TM", mapData.step[jj].code[17] & 0xFF);   /*최대시간 */
+//            param.put("EOP", mapData.step[jj].code[18] & 0xFF);   /*현시종료여부(1:종료) */
+//        }
+//    }
 }

+ 25 - 1
src/test/java/com/sig/comm/server/SigCommServerApplicationTests.java

@@ -43,8 +43,32 @@ public class SigCommServerApplicationTests {
             .intMap(new HashMap<>())
             .dump(false)
             .build();
+
+    @Test
+    void testDecompress() {
+        //ReadableBytes: 113 Bytes
+        String data = "02C518081A01061A11571DB1020C00020003010004006C00001900C800400200140050088040000802A0040021001001408100020C10608000010808A0000000000000000000000000000000000000000000000000000000000000000000000000000001FFC234B7EEAFFBEBB2EDEFFF0C123C030A1E020307140203020C1B320203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003010104006C00008128084441200A0451508882401408A2A0000001001000400102021010808000040820A0000000000000000000000000000000000000000000000000000000000000000000000000000001FF020303030B0C5CEDAFBBFB3BFF0C123C030A1E03071403020C1B32020300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E803";
+        byte[] inBytes = ByteUtils.hexToByteArray(data);
+        log.error("Packet Length: {}", inBytes.length);
+        SigCommPacket sigCommPacket = new SigCommPacket(rCenter, inBytes);
+        RecvPacketDto packet = RecvPacketDto.builder()
+                .recvTime(0)
+                .center(rCenter)
+                .packet(sigCommPacket)
+                .build();
+        SigSignalMap response = new SigSignalMap(null);
+        response.responseTEST(packet);
+    }
+
+
+    @Test
+    void tt() {
+        for (int ii = 0; ii < 608; ii++) {
+            log.info("{}, {}, {}", ii, ii/19, ii%19);
+        }
+    }
     @Test
-    void testPacketRecvData() {
+    void testDecompress2010() {
         //ReadableBytes: 113 Bytes
         String data = "02C518081901061911551DB1020C000200010200030036E04BC31020DDC10105E021C11020E030C80102D8C10105C2C10105E039C8010200555C9C2503000102090F3C090F3C010C1246006C2400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010201030025E041C80102E0B7C80102E021C5102000555C9C2503000102090F3C090F3C01040546003E450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000AB03";
         byte[] inBytes = ByteUtils.hexToByteArray(data);