shjung 1 jaar geleden
bovenliggende
commit
3ef1356e77

+ 10 - 0
src/main/java/com/its/app/common/utils/SysUtils.java

@@ -168,4 +168,14 @@ public class SysUtils {
 
         return sb.toString();
     }
+
+    public static String subString(String str, int start, int end) {
+        if (str == null || "".equals(str)) {
+            return "";
+        }
+        if (start >= end) {
+            return "";
+        }
+        return str.substring(start, Math.min(end, str.length()));
+    }
 }

+ 2 - 2
src/main/java/com/its/rota/server/xnet/server/process/response/LoginResponse.java

@@ -44,8 +44,8 @@ public class LoginResponse implements ItsAsnResponse {
             }
 
             Login login = loginPdUs.getLogin();
-            String datexSenderTxt      = new String(login.getDatexSenderTxt().value);
-            String datexDestinationTxt  = new String(login.getDatexDestinationTxt().value);
+//            String datexSenderTxt      = new String(login.getDatexSenderTxt().value);
+//            String datexDestinationTxt  = new String(login.getDatexDestinationTxt().value);
             String datexLoginUserNameTxt       = new String(login.getDatexLoginUserNameTxt().value);
             String datexLoginPasswordTxt       = new String(login.getDatexLoginPasswordTxt().value);
             BigInteger datexLoginHeartbeatDurationMaxQty  = login.getDatexLoginHeartbeatDurationMaxQty().value;

+ 3 - 11
src/main/java/com/its/rota/server/xnet/server/process/response/SubscriptionResponse.java

@@ -8,9 +8,6 @@ import com.beanit.utils.ItsAsnUtils;
 import com.its.rota.server.dto.CenterDto;
 import com.its.rota.server.xnet.server.process.request.AiAccept;
 import com.its.rota.server.xnet.server.process.request.AiReject;
-import com.its.rota.server.xnet.server.process.service.SubscriptionService;
-import com.its.rota.server.xnet.server.process.service.impl.SubscriptionRegisterService;
-import com.its.rota.server.xnet.server.process.service.impl.SubscriptionSingleService;
 import lombok.extern.slf4j.Slf4j;
 import org.slf4j.MDC;
 
@@ -35,7 +32,6 @@ public class SubscriptionResponse implements ItsAsnResponse {
 
             int dataPacketNmbr = this.c2c.getDatexDataPacketNumber().intValue();
             int objectId = 0;
-            SubscriptionService subscriptionService = null;
             C2CAuthenticatedMessage c2c = null;
             PDUs pdUs = this.c2c.getPdu();
             Subscription subscription = pdUs.getSubscription();
@@ -67,13 +63,13 @@ public class SubscriptionResponse implements ItsAsnResponse {
                                 // subscriptionMode = single, event-driven, periodic
                                 if (subscriptionMode.getSingle() != null) {
                                     log.info("SubscriptionResponse.response: [{}, {}]. subscriptionMode-Single.", this.center.getLogKey(), this.center.getIpAddress());
-                                    subscriptionService = SubscriptionSingleService.getInstance();
+                                    //subscriptionService = SubscriptionSingleService.getInstance();
                                 } else if (subscriptionMode.getEventDriven() != null) {
                                     log.info("SubscriptionResponse.response: [{}, {}]. subscriptionMode-EventDriven.", this.center.getLogKey(), this.center.getIpAddress());
-                                    subscriptionService = SubscriptionRegisterService.getInstance();
+                                    //subscriptionService = SubscriptionRegisterService.getInstance();
                                 } else if (subscriptionMode.getPeriodic() != null) {
                                     log.info("SubscriptionResponse.response: [{}, {}]. subscriptionMode-Periodic.", this.center.getLogKey(), this.center.getIpAddress());
-                                    subscriptionService = SubscriptionRegisterService.getInstance();
+                                    //subscriptionService = SubscriptionRegisterService.getInstance();
                                 }
                                 if (guaranteeBool) {
                                     c2c = AiAccept.makeMessage(this.center, this.c2c);
@@ -93,10 +89,6 @@ public class SubscriptionResponse implements ItsAsnResponse {
                 }
             }
 
-            if (subscriptionService != null) {
-//                subscriptionService.response(this.obj, this.ctx.channel(), objectId, subscription);
-            }
-
             if (c2c != null) {
                 String sendMsg = accepted ? "AI_Subscription-AI_Accept" : "AI_Subscription-AI_Reject";
                 result = this.center.sendData(c2c, sendMsg);

+ 0 - 911
src/main/java/com/its/rota/server/xnet/server/process/service/ControlDeviceService.java

@@ -1,911 +0,0 @@
-package com.its.rota.server.xnet.server.process.service;
-
-import com.beanit.asn1bean.ber.types.BerInteger;
-import com.beanit.asn1bean.ber.types.BerOctetString;
-import com.beanit.its.C2CAuthenticatedMessage;
-import com.beanit.its.PDUs;
-import com.beanit.its.Terminate;
-import com.its.rota.server.dto.CenterDto;
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelFuture;
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.concurrent.ConcurrentHashMap;
-
-@Slf4j
-public class ControlDeviceService {
-    private static ControlDeviceService _instance = null;
-
-    public static ControlDeviceService getInstance() {
-        if (_instance == null) {
-            synchronized (ControlDeviceService.class) {
-                if (_instance == null)
-                    _instance = new ControlDeviceService();
-            }
-        }
-        return _instance;
-    }
-    public ConcurrentHashMap<Integer, Integer> rxSenseMap = null;
-    public ConcurrentHashMap<Integer, Integer> txPowerMap = null;
-
-    public ControlDeviceService() {
-        this.rxSenseMap = new ConcurrentHashMap<>();
-        this.txPowerMap = new ConcurrentHashMap<>();
-
-        this.rxSenseMap.put(0x85, 81);
-        this.rxSenseMap.put(0xA0, 80);
-        this.rxSenseMap.put(0xA4, 79);
-        this.rxSenseMap.put(0xA8, 78);
-        this.rxSenseMap.put(0xAC, 77);
-        this.rxSenseMap.put(0xAF, 76);
-        this.rxSenseMap.put(0xB2, 75);
-        this.rxSenseMap.put(0xB5, 74);
-        this.rxSenseMap.put(0xB8, 73);
-        this.rxSenseMap.put(0xBB, 72);
-        this.rxSenseMap.put(0xBE, 71);
-        this.rxSenseMap.put(0xC1, 70);
-        this.rxSenseMap.put(0xC4, 69);
-        this.rxSenseMap.put(0xC7, 68);
-        this.rxSenseMap.put(0xCC, 67);
-        this.rxSenseMap.put(0xCF, 66);
-        this.rxSenseMap.put(0xD3, 65);
-        this.rxSenseMap.put(0xD7, 64);
-        this.rxSenseMap.put(0xDB, 63);
-        this.rxSenseMap.put(0xDF, 62);
-        this.rxSenseMap.put(0xE2, 61);
-        this.rxSenseMap.put(0xE5, 60);
-        this.rxSenseMap.put(0xE8, 59);
-
-        this.txPowerMap.put(0xFF, 93);
-        this.txPowerMap.put(0xDF, 93);
-        this.txPowerMap.put(0xC8, 93);
-        this.txPowerMap.put(0xB7, 93);
-        this.txPowerMap.put(0xA7, 93);
-        this.txPowerMap.put(0x9A, 93);
-        this.txPowerMap.put(0x8F, 93);
-        this.txPowerMap.put(0x85, 93);
-        this.txPowerMap.put(0x7C, 92);
-        this.txPowerMap.put(0x75, 92);
-        this.txPowerMap.put(0x6E, 91);
-        this.txPowerMap.put(0x68, 91);
-        this.txPowerMap.put(0x62, 90);
-
-    }
-
-    /*
-    *  AI_Publication 메시지로 수신한 데이터중 RSE 상태정보에 대한 데이터 Decoding
-    *  decoding 한 RSE 상태정보를 데이터베이스에 업데이트 한다.
-    *  IT Telecom/AIR Point
-     */
-//    public boolean decoding_ControlDevice_Status_ITTelecom(CenterDto obj, ControlDevice controlDevice) {
-//        try {
-//            StatusOfDeviceInfo deviceInfo = new StatusOfDeviceInfo();
-//            ByteArrayInputStream deviceStream = new ByteArrayInputStream(controlDevice.getVpbdControlDeviceData().value);
-//            deviceInfo.decode(deviceStream);
-//            log.info("ControlDeviceService.decoding_ControlDevice_Status: controlDevice{}, deviceInfo: {}", controlDevice, deviceInfo);
-//
-//            obj.getStts().initNormal();    // 상태정보 업데이트
-//            byte devStts[] = deviceInfo.getStatusInfo().value;
-//            if (devStts != null && devStts.length >= 3) {
-//                int temperature = ((devStts[0] & 0x80) != 0 ? (devStts[0] & 0x80) * -1 : devStts[0]);
-//                int humidity    = devStts[1];
-//                int frontDoor   = ((devStts[2] & 0x01) != 0 ?  1 : 0);
-//                int backDoor    = ((devStts[2] & 0x02) != 0 ?  1 : 0);
-//                int fan         = ((devStts[2] & 0x04) != 0 ?  1 : 0);
-//                int heater      = ((devStts[2] & 0x08) != 0 ?  1 : 0);
-//                int rtu         = ((devStts[2] & 0x10) != 0 ?  1 : 0);
-//                obj.getStts().setStts(frontDoor, backDoor, fan, heater, rtu, temperature, humidity);
-//                log.info("{}, STTS: {}/{}/{}/{}/{}/{}/{}", obj.getRSE_CTLR_NMBR(), temperature, humidity, frontDoor, backDoor, fan, heater, rtu);
-//            }
-//
-//            // 현장 데이터가 들어오는것 보고 아래 내용과 확인하여 상태정보 자세히 업데이트 해야함
-//            if (deviceInfo.getDataOfBeaconInfoList() != null) {
-//                StatusOfDeviceInfo.DataOfBeaconInfoList beacon = deviceInfo.getDataOfBeaconInfoList();
-//                List<BeaconInfo> bList = beacon.getBeaconInfo();
-//                int beaconCount = bList.size();
-//                for (int ii = 0; ii < bList.size(); ii++) {
-//                    BeaconInfo bInfo = bList.get(ii);
-//
-//                    String beaconId = String.format("%04X0%08X0", bInfo.getBeaconID().getManufacturerid().value.longValue(), bInfo.getBeaconID().getIndividualid().value.longValue());
-//                    int updateVer = bInfo.getUpdateVer().intValue();
-//                    int workMode = bInfo.getWorkMode().intValue();
-//                    int roadStationType = bInfo.getRoadStationType().intValue();
-//                    int status = bInfo.getStatus().intValue();
-//
-//                    int beaconState = ((status & 0xFF000000) > 0) ? 1 : 0;
-//                    int outputPutGain = status & 0x0FF;
-//                    int txPowerSt = ((status >> 8) & 0x0FF);
-//                    int rxSenseSt = ((status >>16) & 0x0FF);
-//                    Integer txPowerVal = ControlDeviceService.getInstance().txPowerMap.get(txPowerSt);
-//                    Integer rxSenseVal = ControlDeviceService.getInstance().rxSenseMap.get(rxSenseSt);
-//                    int txPower = txPowerVal == null ? 0 : txPowerVal;
-//                    int rxSense = rxSenseVal == null ? 0 : rxSenseVal;
-//
-//                    log.info("{}, BEACON({}): {}/{}/{}/{}/{}/{}/{}/{}/{}", obj.getRSE_CTLR_NMBR(), ii, beaconId, updateVer, workMode, roadStationType, status, beaconState, outputPutGain, txPower, rxSense);
-//                }
-//            }
-//            DbmsDataProcess dbmsDataProcess = (DbmsDataProcess) AppUtils.getBean(DbmsDataProcess.class);
-//            dbmsDataProcess.add(new DbmsData(DbmsDataType.DBMS_DATA_CTLR_STTS, false, obj.getStts()));
-//
-//            log.info("ControlDeviceService.decoding_ControlDevice_Status: {}", obj.getStts().toString());
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.decoding_ControlDevice_Status: {}", e.toString());
-//        }
-//        return true;
-//    }
-
-//    public boolean decoding_ControlDevice_Status_AirPoint(CenterDto obj, ControlDevice controlDevice) {
-//        try {
-//            StatusOfDeviceInfo deviceInfo = new StatusOfDeviceInfo();
-//            ByteArrayInputStream deviceStream = new ByteArrayInputStream(controlDevice.getVpbdControlDeviceData().value);
-//            deviceInfo.decode(deviceStream);
-//            log.debug("ControlDeviceService.decoding_ControlDevice_Status: controlDevice{}, deviceInfo: {}", controlDevice.toString(), deviceInfo.toString());
-///*
-//	roadStationID: 00003039000000000000000000,
-//	statusInfo: 00000000,
-//	dataOfBeaconInfoList: {
-//        {
-//            beaconID: {
-//                manufacturerid: 3,
-//                individualid: 12345
-//            },
-//            updateVer: 100100,
-//            status: 0,
-//            workMode: 1,
-//            roadStationType: 104
-//        }
-//	}
-// */
-//            obj.getStts().initNormal();    // 상태정보 업데이트
-//
-//            //String stationId = deviceInfo.getRoadStationID().value.toString();
-//            //String stts = deviceInfo.getStatusInfo().value.toString();
-//            //String roadStationID = new String(deviceInfo.getRoadStationID().value);
-//            // FOR AIR POINT
-//            String statusInfo = new String(deviceInfo.getStatusInfo().value);
-//            String CNTL_DEVC_STTS = "0";
-//            try {
-//                int statusVal = Integer.valueOf(statusInfo).intValue();
-//                CNTL_DEVC_STTS = String.valueOf(statusVal);
-//            }
-//            catch (Exception e) {
-//            }
-//            obj.getStts().setCNTL_DEVC_STTS(CNTL_DEVC_STTS);
-//            /*주1) roadStationID : 사업자 정의 ID.
-//              주2) statusInfo : 제어부 상태를 나타내며, 상태정보는 사업자별로 정의 할 수 있다.
-//                    예) 0 : 정상, 1 : 문열림, 2 : 팬동작, 3 : 내부온도이상, 4 ~ 255 : reserved
-//              주3) dataOfInfoVerList : 제어부 기초정보의 버전 정보
-//              주4) dataOfBeaconInfoList : 제어부 상태정보
-//             */
-//
-//            // 현장 데이터가 들어오는것 보고 아래 내용과 확인하여 상태정보 자세히 업데이트 해야함
-//            // AIR POINT 개발자: 상태정보는 일체형인 경우 하나만 사용, 본체, 안테나 같이 사용함
-//            if (deviceInfo.getDataOfBeaconInfoList() != null) {
-//                StatusOfDeviceInfo.DataOfBeaconInfoList beacon = deviceInfo.getDataOfBeaconInfoList();
-//                List<BeaconInfo> bList = beacon.getBeaconInfo();
-//                for (int ii = 0; ii < bList.size(); ii++) {
-//                    /* 0x00 안테나 정상
-//                       0x01 안테나 이상
-//                       0x04 안테나 통신 두절
-//                     */
-//                    /* 0x00 송출종료
-//                       0x01 송출개시
-//                       0x02 유지보수 근무개시
-//                       0x03 정보 없음
-//                     */
-//
-//                    BeaconInfo bInfo = bList.get(ii);
-//                    String antennaStatus = bInfo.getStatus().intValue() != 0 ? "1" : "0";
-//                    String antennaMode = bInfo.getWorkMode().value.toString();
-//                    switch (ii) {
-//                        case 0: obj.getStts().setATN_1_STTS(antennaStatus); obj.getStts().setATN_1_MTNS(antennaMode); break;
-//                        case 1: obj.getStts().setATN_2_STTS(antennaStatus); obj.getStts().setATN_2_MTNS(antennaMode); break;
-//                        case 2: obj.getStts().setATN_3_STTS(antennaStatus); obj.getStts().setATN_3_MTNS(antennaMode); break;
-//                        case 3: obj.getStts().setATN_4_STTS(antennaStatus); obj.getStts().setATN_4_MTNS(antennaMode); break;
-//                    }
-//                }
-//            }
-//            DbmsDataProcess dbmsDataProcess = (DbmsDataProcess) AppUtils.getBean(DbmsDataProcess.class);
-//            dbmsDataProcess.add(new DbmsData(DbmsDataType.DBMS_DATA_CTLR_STTS, false, obj.getStts()));
-//
-//            log.info("ControlDeviceService.decoding_ControlDevice_Status: {}", obj.getStts().toString());
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.decoding_ControlDevice_Status: {}", e.toString());
-//        }
-//        return true;
-//    }
-//
-//    public boolean requestSubscriptionDeviceCommand(boolean fromOperator, CenterDto obj, Channel channel, int controlDeviceId, int commandType, TbRseCtrlHs cntl)
-//    {
-//        log.info("ControlDeviceService.requestSubscriptionDeviceCommand: {}, {}, operator: {}, controlDeviceId: {}, commandType: {}", obj.getID(), obj.getRSE_ID(), fromOperator, controlDeviceId, commandType);
-//        try {
-//            if (obj.getChannel() == null  || obj.getNetState() != NET.LOGINED || !obj.getChannel().isActive()) {
-//                log.error("ControlDeviceService.requestSubscriptionDeviceCommand: {}, {}, operator: {}, is not active", obj.getID(), obj.getRSE_ID(), fromOperator);
-//                return false;
-//            }
-//
-//            int[] messageId = {1, 0, 15784, 4, 0, 7};
-//            byte[] controlId = { (byte) eControlDevice.Control_Command.getValue() };
-//            int subscribeSerialNbr = obj.getSeq().nextValue();
-//
-//            DITSRoadStationCommandInfo commandInfo = new DITSRoadStationCommandInfo();
-//            if (commandType == eControlCommand.ControlCommand_Wireless_Start.getValue()) {
-//                // 무선 송출/중단 시에는 WorkMode 를 제어하도록 한다. 그래야 상태정보에서 무선 상태정보를 확인할 수 있다.
-//                WorkMode workMode = new WorkMode(eWorkMode.WorkMode_Start.getValue());
-//                commandInfo.setWorkMode(workMode);
-//            }
-//            else if (commandType == eControlCommand.ControlCommand_Wireless_Stop.getValue()) {
-//                WorkMode workMode = new WorkMode(eWorkMode.WorkMode_Stop.getValue());
-//                commandInfo.setWorkMode(workMode);
-//            }
-//            else {
-//                DITSRoadStationCommandInfo.DeviceCommandList commandList = new DITSRoadStationCommandInfo.DeviceCommandList();
-//                DeviceCommand deviceCommand = new DeviceCommand();
-//                deviceCommand.setDeviceID(new BerInteger(controlDeviceId));
-//                deviceCommand.setCommand(new BerInteger(commandType));
-//                commandList.getDeviceCommand().add(deviceCommand);
-//                commandInfo.setDeviceCommandList(commandList);
-//            }
-//
-//            // 3. ControlDevice set
-//            ReverseByteArrayOutputStream deviceBuff = new ReverseByteArrayOutputStream(2048);
-//            commandInfo.encode(deviceBuff);
-//
-//            ControlDevice controlDevice = new ControlDevice();
-//            controlDevice.setVpbdControlID(new BerOctetString(controlId));
-//            controlDevice.setVpbdControlDeviceData(new BerOctetString(deviceBuff.getArray()));
-//
-//            // 4. ControlDeviceList set
-//            ReverseByteArrayOutputStream deviceListBuff = new ReverseByteArrayOutputStream(2048);
-//            ControlDeviceList controlDeviceList = new ControlDeviceList();
-//            controlDeviceList.getControlDevice().add(controlDevice);
-//            controlDeviceList.encode(deviceListBuff);
-//
-//            // 5. EndApplicationMessage set
-//            EndApplicationMessage endApplicationMessage =  new EndApplicationMessage();
-//            endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//            endApplicationMessage.setEndApplicationMessageMsg(new BerAny(deviceListBuff.getArray()));
-//
-//            // 6. Publication
-//            PublicationType publicationType = new PublicationType();
-//            publicationType.setDatexPublishData(endApplicationMessage);
-//
-//            PublicationData publicationData = new PublicationData();
-//            publicationData.setDatexPublishSubscribeSerialNbr(new BerInteger(subscribeSerialNbr));
-//            publicationData.setDatexPublishSerialNbr(new BerInteger(subscribeSerialNbr));
-//            publicationData.setDatexPublishLatePublicationFlag(new BerBoolean(true));
-//            publicationData.setDatexPublishType(publicationType);
-//
-//            PublishFormat.DatexPublishData publishData = new PublishFormat.DatexPublishData();
-//            publishData.getPublicationData().add(publicationData);
-//
-//            PublishFormat publishFormat = new PublishFormat();
-//            publishFormat.setDatexPublishData(publishData);
-//
-//            Publication publication = new Publication();
-//            publication.setDatexPublishFormat(publishFormat);
-//            publication.setDatexPublishGuaranteedBool(new BerBoolean(true));
-//
-//            PDUs pdus = new PDUs();
-//            pdus.setPublication(publication);
-//            byte[] auth = {(byte) eAuthInfo.AI_Publication.getValue() };
-//            C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-//            c2c.setDatexDataPacketNumber(new BerInteger(subscribeSerialNbr));
-//            c2c.setDatexDataPacketPriorityNumber(new BerInteger(1));
-//            c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//            c2c.setOptions(DsrcAsn1Utils.swapHeaderOptions(obj.getHeaderOptions()));
-//            c2c.setPdu(pdus);
-//
-//            ChannelFuture f = channel.writeAndFlush(c2c);
-//            f.awaitUninterruptibly();
-//            if (f.isDone() || f.isSuccess()) {
-//                log.info("ControlDeviceService.requestSubscriptionDeviceCommand: {}, {}, operator: {}, send ok", obj.getID(), obj.getRSE_ID(), fromOperator);
-//                if (fromOperator) {
-//                    // TODO: 리셋 명령은 응답을 안 받으므로 타임아웃 체크를 하지 않는다.
-//                    //obj.addUserCommands(cntl.getCtrlSeq(), cntl);
-//                }
-//            } else {
-//                log.error("ControlDeviceService.requestSubscriptionDeviceCommand: {}, {}, operator: {}, send failed.", obj.getID(), obj.getRSE_ID(), fromOperator);
-//                return false;
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.requestSubscriptionDeviceCommand: {}, {}, operator: {}, Exception: {}", obj.getID(), obj.getRSE_ID(), fromOperator, e.toString());
-//            return false;
-//        }
-//        return true;
-//    }
-
-    /**
-     * 제어기 리셋
-     * @param fromOperator
-     * @param obj
-     * @param channel
-     * @return
-     */
-    public boolean requestResetCommand(boolean fromOperator, CenterDto obj, Channel channel)
-    {
-        int controlDeviceId = 0;    // Controller
-        int commandType = 1;        // Reset
-
-//        log.info("ControlDeviceService.requestResetCommand: {}, {}, operator: {}, controlDeviceId: {}, commandType: {}", obj.getID(), obj.getRSE_ID(), fromOperator, controlDeviceId, commandType);
-//        try {
-//            if (obj.getChannel() == null  || obj.getNetState() != NET.LOGINED || !obj.getChannel().isActive()) {
-//                log.error("ControlDeviceService.requestResetCommand: {}, {}, operator: {}, is not active", obj.getID(), obj.getRSE_ID(), fromOperator);
-//                return false;
-//            }
-//
-//            int[] messageId = {1, 0, 15784, 4, 0, 7};
-//            byte[] controlId = { (byte) eControlDevice.Control_Command.getValue() };
-//            int subscribeSerialNbr = obj.getSeq().nextValue();
-//
-//            DITSRoadStationCommandInfo commandInfo = new DITSRoadStationCommandInfo();
-//            DITSRoadStationCommandInfo.DeviceCommandList commandList = new DITSRoadStationCommandInfo.DeviceCommandList();
-//            DeviceCommand deviceCommand = new DeviceCommand();
-//            deviceCommand.setDeviceID(new BerInteger(controlDeviceId));
-//            deviceCommand.setCommand(new BerInteger(commandType));
-//            commandList.getDeviceCommand().add(deviceCommand);
-//            commandInfo.setDeviceCommandList(commandList);
-//
-//            // 3. ControlDevice set
-//            ReverseByteArrayOutputStream deviceBuff = new ReverseByteArrayOutputStream(2048);
-//            commandInfo.encode(deviceBuff);
-//
-//            ControlDevice controlDevice = new ControlDevice();
-//            controlDevice.setVpbdControlID(new BerOctetString(controlId));
-//            controlDevice.setVpbdControlDeviceData(new BerOctetString(deviceBuff.getArray()));
-//
-//            // 4. ControlDeviceList set
-//            ReverseByteArrayOutputStream deviceListBuff = new ReverseByteArrayOutputStream(2048);
-//            ControlDeviceList controlDeviceList = new ControlDeviceList();
-//            controlDeviceList.getControlDevice().add(controlDevice);
-//            controlDeviceList.encode(deviceListBuff);
-//
-//            // 5. EndApplicationMessage set
-//            EndApplicationMessage endApplicationMessage =  new EndApplicationMessage();
-//            endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//            endApplicationMessage.setEndApplicationMessageMsg(new BerAny(deviceListBuff.getArray()));
-//
-//            // 6. Publication
-//            PublicationType publicationType = new PublicationType();
-//            publicationType.setDatexPublishData(endApplicationMessage);
-//
-//            PublicationData publicationData = new PublicationData();
-//            publicationData.setDatexPublishSubscribeSerialNbr(new BerInteger(subscribeSerialNbr));
-//            publicationData.setDatexPublishSerialNbr(new BerInteger(subscribeSerialNbr));
-//            publicationData.setDatexPublishLatePublicationFlag(new BerBoolean(true));
-//            publicationData.setDatexPublishType(publicationType);
-//
-//            PublishFormat.DatexPublishData publishData = new PublishFormat.DatexPublishData();
-//            publishData.getPublicationData().add(publicationData);
-//
-//            PublishFormat publishFormat = new PublishFormat();
-//            publishFormat.setDatexPublishData(publishData);
-//
-//            Publication publication = new Publication();
-//            publication.setDatexPublishFormat(publishFormat);
-//            publication.setDatexPublishGuaranteedBool(new BerBoolean(true));
-//
-//            PDUs pdus = new PDUs();
-//            pdus.setPublication(publication);
-//            byte[] auth = {(byte) eAuthInfo.AI_Publication.getValue() };
-//            C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-//            c2c.setDatexDataPacketNumber(new BerInteger(subscribeSerialNbr));
-//            c2c.setDatexDataPacketPriorityNumber(new BerInteger(1));
-//            c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//            c2c.setOptions(DsrcAsn1Utils.swapHeaderOptions(obj.getHeaderOptions()));
-//            c2c.setPdu(pdus);
-//
-//            ChannelFuture f = channel.writeAndFlush(c2c);
-//            f.awaitUninterruptibly();
-//            if (f.isDone() || f.isSuccess()) {
-//                log.info("ControlDeviceService.requestResetCommand: {}, {}, operator: {}, send ok", obj.getID(), obj.getRSE_ID(), fromOperator);
-//                if (fromOperator) {
-//                    // TODO: 리셋 명령은 응답을 안 받으므로 타임아웃 체크를 하지 않는다.
-//                    //obj.addUserCommands(cntl.getCtrlSeq(), cntl);
-//                }
-//            } else {
-//                log.error("ControlDeviceService.requestResetCommand: {}, {}, operator: {}, send failed.", obj.getID(), obj.getRSE_ID(), fromOperator);
-//                return false;
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.requestResetCommand: {}, {}, operator: {}, Exception: {}", obj.getID(), obj.getRSE_ID(), fromOperator, e.toString());
-//            return false;
-//        }
-        return true;
-    }
-
-//    public ControlDevice makeControlDevice_BasicBaseInfo(CenterDto obj, eControlRequest type) {
-//        // ControlDevice.vpbd-ControlID  : 기초정보(0x02)
-//        //
-//        // BasicBaseInfo.roadStationID   : 주1) 사업자 정의 ID. MCU ID임
-//        // BasicBaseInfo.roadStationType : 주2) 제어부 위치 정보
-//        //                                      101 고속국도
-//        //                                      102 도시고속국도
-//        //                                      103 일반국도
-//        //                                      104 특별․광역시도
-//        //                                      105 국가지원지방도
-//        //                                      106 지방도
-//        //                                      107 시․군도
-//        //                                      108 기타
-//        // BasicBaseInfo.dataOfNonCryptoObuList	DataOfNonCryptoObu
-//        //주3) infoID
-//        //1 : DataOfCollectionPointInfo (가상 수집지점 정보)
-//        //2 : DirectionDecisionInfo (방향 판단 정보)
-//        //3 : DataOfNonCryptoObu (비 암호화 단말기 정보)
-//
-//        ControlDevice device = null;
-//        BasicBaseInfo info = null;
-//        byte[] controlId = { (byte)eControlDevice.Control_BasicInfo.getValue() };
-//        String roadStationId = obj.getRSE_MCU_ID();//obj.getROAD_SPOT_ID();
-//        if (roadStationId == null || roadStationId.equals("")) {
-//            return null;
-//        }
-//
-//        try {
-//            int updateNo = 0;
-//            byte[] operCode = { 0x00 };  // 0x00(추가), 0x01(삭제)
-//            switch(type) {
-//                case Request_BasicInfo:
-//                case Request_BasicInfo_Collect:
-//                case Request_BasicInfo_Direction:
-//                    info = new BasicBaseInfo();
-//                    info.setRoadStationID(new BerOctetString(roadStationId.getBytes()));
-//                    info.setRoadStationType(new BerInteger(104));   //시․군도
-//                    BasicBaseInfo.DataOfDirectionDecisionInfoList data = new BasicBaseInfo.DataOfDirectionDecisionInfoList();
-//                    DirectionDecisionInfo decisionInfo = new DirectionDecisionInfo();
-//                    decisionInfo.setInfoID(new BerInteger(eControlRequest.Request_BasicInfo_Direction.getValue()));
-//                    decisionInfo.setUpdateNo(new BerInteger(updateNo));
-//                    decisionInfo.setGenerationTime(new BerGeneralizedTime(SysUtils.getSysTime()));                   // 주5) generationTime : 해당 정보의 생성 일자 시간
-//                    BeaconID beaconID = new BeaconID();
-//                    beaconID.setManufacturerid(new BerInteger(obj.getManufacturerid()));
-//                    beaconID.setIndividualid(new BerInteger(obj.getIndividualid()));
-//                    decisionInfo.setTargetBeaconID(beaconID);
-//                    decisionInfo.setInCommingDirectionEnterBaseInfo(null);
-//                    List<TbRseOffrDrct> list = AppRepository.getInstance().getRseOffrDrctList(obj.getRSE_ID());
-//                    if (list == null || list.size() == 0) {
-//                        decisionInfo.setInCommingDirectionBeaconInfo(null);
-//                    }
-//                    else {
-//                        DirectionDecisionInfo.InCommingDirectionBeaconInfo beacons = new DirectionDecisionInfo.InCommingDirectionBeaconInfo();
-//                        for (TbRseOffrDrct vo : list) {
-//                            DirectionBeaconInfo directionBeaconInfo = new DirectionBeaconInfo();
-//                            directionBeaconInfo.setDirectionInfo(new BerInteger(Long.parseLong(vo.getOBU_ENTR_DRCT_NMBR())));
-//                            BeaconID beaconID1 = new BeaconID();
-//                            TbRseCtlr rseObj = AppRepository.getInstance().getCtlrMap().get(vo.getPRE_RSE_CTLR_NMBR());
-//                            if (rseObj != null) {
-//                                beaconID1.setManufacturerid(new BerInteger(rseObj.getManufacturerid()));
-//                                beaconID1.setIndividualid(new BerInteger(rseObj.getIndividualid()));
-//                                directionBeaconInfo.getPreviousBeaconID().getBeaconID().add(beaconID1);
-//                                beacons.getDirectionBeaconInfo().add(directionBeaconInfo);
-//                            }
-//                        }
-//                        decisionInfo.setInCommingDirectionBeaconInfo(beacons);
-//                    }
-//                    data.getDirectionDecisionInfo().add(decisionInfo);
-//                    info.setDataOfDirectionDecisionInfoList(data);
-//                    break;
-//                case Request_BasicInfo_NonCrypt:    // 최초 로그인 후 NonCryptObu 정보 요청
-//                    DataOfNonCryptoObu dataObu = new DataOfNonCryptoObu();
-//                    DataOfNonCryptoObu.CryptObuList obuList = new DataOfNonCryptoObu.CryptObuList();
-//
-//                    for (TbRseObuNonCrypt vo : AppRepository.getInstance().rseObuNonCryptList) {
-//                        CryptObu obu = new CryptObu();
-//                        obu.setOperCode(new BerOctetString(operCode));  // 주7) operCode : 비암호 단말기 리스트의 추가삭제 정보
-//                        // 0x00 : 추가 , 0x01: 삭제
-//                        obu.setObuID(new BerOctetString(vo.getOBU_ID().getBytes()));
-//                        obuList.getCryptObu().add(obu);
-//                    }
-//                    dataObu.setInfoID(new BerInteger(eControlRequest.Request_BasicInfo_NonCrypt.getValue()));   // 주3) infoID
-//                    //    1 : DataOfCollectionPointInfo (가상 수집지점 정보)
-//                    //    2 : DirectionDecisionInfo (방향 판단 정보)
-//                    //    3 : DataOfNonCryptoObu (비 암호화 단말기 정보)
-//                    dataObu.setUpdateNo(new BerInteger(updateNo));                                                // 주4) updateNo : 해당정보의 변경이력 번호
-//                    dataObu.setGenerationTime(new BerGeneralizedTime(SysUtils.getSysTime()));                   // 주5) generationTime : 해당 정보의 생성 일자 시간
-//                    dataObu.setCryptObuList(obuList);
-//
-//                    info = new BasicBaseInfo();
-//                    info.setRoadStationID(new BerOctetString(roadStationId.getBytes()));
-//                    info.setRoadStationType(new BerInteger(107));   //시․군도
-//                    info.setDataOfNonCryptoObuList(dataObu);
-//                    break;
-//            }
-//
-//            if (info != null) {
-//                ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//                info.encode(msgBuff);
-//                device = new ControlDevice();
-//                device.setVpbdControlID(new BerOctetString(controlId));
-//                device.setVpbdControlDeviceData(new BerOctetString(msgBuff.getArray()));
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.makeControlDevice_BasicBaseInfo: {}, eControlType: {}, Exception: {}", obj.getID(), type, e);
-//            return null;
-//        }
-//        //log.debug("ControlDeviceService.makeControlDevice_BasicBaseInfo: {}, eControlType: {}, ControlDevice: {}", obj.getID(), type, device);
-//        return device;
-//    }
-
-    /*
-    *  제어 또는 상태정보를 요청하기 위하여 사용한다.
-     */
-//    public ControlDevice makeControlDevice_DeviceCommand(CenterDto obj, eControlCommand command, eControlDeviceId deviceId) {
-//
-//        ControlDevice controlDevice = null;
-//        DITSRoadStationCommandInfo commandInfo = null;
-//        WorkMode workMode = new WorkMode(1);
-//        byte[] controlId = { (byte)eControlDevice.Control_Command.getValue() };
-//
-//        log.info("ControlDeviceService.makeControlDevice_DeviceCommand: {}, {}, {}", obj.getID(), command.toString(), deviceId.toString());
-//
-//        try {
-//            switch(command) {
-//                case ControlCommand_Status_Request://       (0x00, "ControlCommand_Status_Request"),
-//                case ControlCommand_Reset://                (0x01, "ControlCommand_Reset"),
-//                case ControlCommand_Push_Broadcast_Delete://(0x02, "ControlCommand_Push_Broadcast_Delete"),
-//                case ControlCommand_Broadcast_Delete://     (0x03, "ControlCommand_Broadcast_Delete"),
-//                case ControlCommand_Wireless_Stop://        (0x04, "ControlCommand_Wireless_Stop"),
-//                case ControlCommand_Wireless_Start://       (0x05, "ControlCommand_Wireless_Start");
-//                    commandInfo = new DITSRoadStationCommandInfo();
-//                    DITSRoadStationCommandInfo.DeviceCommandList commandList = new DITSRoadStationCommandInfo.DeviceCommandList();
-//                    DeviceCommand deviceCommand = new DeviceCommand();
-//                    deviceCommand.setDeviceID(new BerInteger(deviceId.getValue()));
-//                    deviceCommand.setCommand(new BerInteger(command.getValue()));
-//                    commandList.getDeviceCommand().add(deviceCommand);
-//                    commandInfo.setWorkMode(workMode);
-//                    commandInfo.setDeviceCommandList(commandList);
-//                    //log.error("deviceCommand: {}", deviceCommand.toString());
-//                    //log.error("commandList: {}", commandList.toString());
-//                    //log.error("commandInfo: {}", commandInfo.toString());
-//
-//                    if (command.getValue() == eControlCommand.ControlCommand_Wireless_Stop.getValue()) {
-//                        commandInfo.setWorkMode(new WorkMode(eWorkMode.WorkMode_Stop.getValue()));
-//                    }
-//                    else if (command.getValue() == eControlCommand.ControlCommand_Wireless_Stop.getValue()) {
-//                        commandInfo.setWorkMode(new WorkMode(eWorkMode.WorkMode_Start.getValue()));
-//                    }
-//                    break;
-//            }
-//
-//            if (commandInfo != null) {
-//                ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//                commandInfo.encode(msgBuff);
-//                controlDevice = new ControlDevice();
-//                controlDevice.setVpbdControlID(new BerOctetString(controlId));
-//                controlDevice.setVpbdControlDeviceData(new BerOctetString(msgBuff.getArray()));
-//                //log.error("controlDevice: {}", controlDevice.toString());
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.makeControlDevice_DeviceCommand: {}, eControlCommand: {}, eControlDeviceId: {}, Exception: {}", obj.getID(), command, deviceId, e);
-//            return null;
-//        }
-//        //log.debug("ControlDeviceService.makeControlDevice_DeviceCommand: {}, eControlCommand: {}, eControlDeviceId: {}, ControlDevice: {}", obj.getID(), command, deviceId, device);
-//        return controlDevice;
-//    }
-//
-//    public EndApplicationMessage makeEndApplicationMessage_BasicBaseInfo(CenterDto obj, eControlRequest type) {
-//
-//        EndApplicationMessage endApplicationMessage = null;
-//
-//        try {
-//            switch(type) {
-//                case Request_BasicInfo://           (0x00, "Request_BasicInfo"),            //기초정보(수집지점정보,방향판단정보,비암호화 단말정보) 요청
-//                case Request_BasicInfo_Collect://   (0x01, "Request_BasicInfo_Collect"),    //기초정보(수집지점정보) 요청
-//                case Request_BasicInfo_Direction:// (0x02, "Request_BasicInfo_Direction"),  //기초정보(방향판단정보) 요청
-//                case Request_BasicInfo_NonCrypt://  (0x03, "Request_BasicInfo_NonCrypt"),   //기초정보(비암호화 단말정보) 요청, 최초 로그인 후 NonCryptObu 정보 요청
-//                    ControlDevice device = makeControlDevice_BasicBaseInfo(obj, type);
-//                    if (device != null) {
-//                        int[] messageId = {1, 0, 15784, 4, 0, 7};
-//                        ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//                        device.encode(msgBuff);
-//                        endApplicationMessage = new EndApplicationMessage();
-//                        endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//                        endApplicationMessage.setEndApplicationMessageMsg(new BerAny(msgBuff.getArray()));
-//                    }
-//                    break;
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.makeEndApplicationMessage_BasicBaseInfo: {}, eControlType: {}, Exception: {}", obj.getID(), type, e);
-//            return null;
-//        }
-//        //log.debug("ControlDeviceService.makeEndApplicationMessage_BasicBaseInfo: {}, eControlType: {}, EndApplicationMessage: {}", obj.getID(), type, endApplicationMessage);
-//        return endApplicationMessage;
-//    }
-
-    /*
-    *  운영단말로 부터 수신한 제어메시지에 대한 메시지 생성
-     */
-//    public EndApplicationMessage makeEndApplicationMessage_DeviceCommandInfo(CenterDto obj, eControlCommand command, eControlDeviceId deviceId) {
-//
-//        EndApplicationMessage endApplicationMessage = null;
-//
-//        try {
-//            switch(command) {
-//                case ControlCommand_Status_Request://       (0x00, "ControlCommand_Status_Request"),
-//                case ControlCommand_Reset://                (0x01, "ControlCommand_Reset"),
-//                case ControlCommand_Push_Broadcast_Delete://(0x02, "ControlCommand_Push_Broadcast_Delete"),
-//                case ControlCommand_Broadcast_Delete://     (0x03, "ControlCommand_Broadcast_Delete"),
-//                case ControlCommand_Wireless_Stop://        (0x04, "ControlCommand_Wireless_Stop"),
-//                case ControlCommand_Wireless_Start://       (0x05, "ControlCommand_Wireless_Start");
-//                    ControlDevice device = makeControlDevice_DeviceCommand(obj, command, deviceId);
-//                    if (device != null) {
-//                        int[] messageId = {1, 0, 15784, 4, 0, 7};
-//                        ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//                        device.encode(msgBuff);
-//                        endApplicationMessage = new EndApplicationMessage();
-//                        endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//                        endApplicationMessage.setEndApplicationMessageMsg(new BerAny(msgBuff.getArray()));
-//                    }
-//                    break;
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.makeEndApplicationMessage_DeviceCommandInfo: {}, eControlCommand: {}, eControlDeviceId: {}, Exception: {}", obj.getID(), command, deviceId, e);
-//            return null;
-//        }
-//        //log.debug("ControlDeviceService.makeEndApplicationMessage_DeviceCommandInfo: {}, eControlCommand: {}, eControlDeviceId: {}, EndApplicationMessage: {}", obj.getID(), command, deviceId, endApplicationMessage);
-//        return endApplicationMessage;
-//    }
-
-    /*
-     *  DSRC 상태정보를 요청하기 위하여 사용한다.
-     */
-//    public ControlDevice makeControlDevice_DSRCTrafficInfoRequest(CenterDto obj, eControlRequest request) {
-//
-//        ControlDevice device = null;
-//        DSRCTrafficInfoRequest infoRequest = null;
-//        //byte[] controlId = { (byte)eControlDevice.Control_InfoRequest.getValue() };
-//        byte[] controlId = { (byte)4 };
-//
-//        try {
-//            switch(request) {
-//                case Request_BasicInfo://           (0x00, "Request_BasicInfo"),            //      -- 기초정보(수집지점정보,방향판단정보,비암호화 단말정보) 요청
-//                case Request_BasicInfo_Collect://   (0x01, "Request_BasicInfo_Collect"),    //      -- 기초정보(수집지점정보) 요청
-//                case Request_BasicInfo_Direction:// (0x02, "Request_BasicInfo_Direction"),  //      -- 기초정보(방향판단정보) 요청
-//                case Request_BasicInfo_NonCrypt://  (0x03, "Request_BasicInfo_NonCrypt"),   //      -- 기초정보(비암호화 단말정보) 요청
-//                case Request_MulticastInfo://       (0x04, "Request_MulticastInfo"),        //      -- Broadcast 교통정보 요청
-//                case Request_ObuRequestInfo://      (0x05, "Request_ObuRequestInfo"),       //      -- OBU 1:1 교통정보 요청
-//                case Request_ObuPushInfo://         (0x06, "Request_ObuPushInfo"),          //      -- OBU Push 방송정보 요청
-//                case Request_TrafficInfo://         (0x07, "Request_TrafficInfo"),          //주3), -- 교통수집정보 요청
-//                case Request_ObuEndConnect://       (0x08, "Request_ObuEndConnect"),        //주4), -- 단말 접속종료정보 요청
-//                case Request_ObuEnterDirect://      (0x09, "Request_ObuEnterDirect"),       //주5), -- 단말 진입방향정보 요청
-//                    infoRequest = new DSRCTrafficInfoRequest();
-//                    infoRequest.setQueryType(new BerEnum(request.getValue()));
-//                    if (request.getValue() == eControlRequest.Request_TrafficInfo.getValue()) {
-//                        BeaconID beaconID = new BeaconID();
-//                        beaconID.setManufacturerid(new BerInteger(obj.getManufacturerid()));
-//                        beaconID.setIndividualid(new BerInteger(obj.getIndividualid()));
-////                        beaconID.setIndividualid(new BerInteger(Long.valueOf(obj.getID()).longValue()));
-////                        beaconID.setManufacturerid(new BerInteger(Long.valueOf(obj.getMNFC_CMPY_CD()).longValue()));
-//                        //infoRequest.setRoadStationID(new BerOctetString(obj.getROAD_SPOT_ID().getBytes()));
-//                        infoRequest.setBeaconID(beaconID);
-//                    }
-//                    break;
-//            }
-//
-//            if (infoRequest != null) {
-//                ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//                infoRequest.encode(msgBuff);
-//                device = new ControlDevice();
-//                device.setVpbdControlID(new BerOctetString(controlId));
-//                device.setVpbdControlDeviceData(new BerOctetString(msgBuff.getArray()));
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.makeControlDevice_DSRCTrafficInfoRequest: {}, eControlRequest: {}, Exception: {}", obj.getID(), request, e);
-//            return null;
-//        }
-//        //log.debug("ControlDeviceService.makeControlDevice_DSRCTrafficInfoRequest: {}, eControlRequest: {}, ControlDevice: {}", obj.getID(), request, device);
-//        return device;
-//    }
-
-//    public EndApplicationMessage makeEndApplicationMessage(CenterDto obj, ControlDevice controlDevice) {
-//
-//        EndApplicationMessage endApplicationMessage = null;
-//
-//        try {
-//            if (controlDevice != null) {
-//                int[] messageId = {1, 0, 15784, 4, 0, 7};
-//                ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//                controlDevice.encode(msgBuff);
-//                endApplicationMessage = new EndApplicationMessage();
-//                endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//                endApplicationMessage.setEndApplicationMessageMsg(new BerAny(msgBuff.getArray()));
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.makeEndApplicationMessage: {}, ControlDevice: {}, Exception: {}", obj.getID(), controlDevice, e);
-//            return null;
-//        }
-//        log.debug("ControlDeviceService.makeEndApplicationMessage: {}, ControlDevice: {}, EndApplicationMessage: {}", obj.getID(), controlDevice, endApplicationMessage);
-//         return endApplicationMessage;
-//    }
-//    public EndApplicationMessage makeEndApplicationMessageList(CenterDto obj, ControlDevice controlDevice) {
-//
-//        EndApplicationMessage endApplicationMessage = null;
-//
-//        try {
-//            if (controlDevice != null) {
-//                int[] messageId = {1, 0, 15784, 4, 0, 7};
-//                ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//                ControlDeviceList controlDeviceList = new ControlDeviceList();
-//                controlDeviceList.getControlDevice().add(controlDevice);
-//                controlDeviceList.encode(msgBuff);
-//                endApplicationMessage = new EndApplicationMessage();
-//                endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//                endApplicationMessage.setEndApplicationMessageMsg(new BerAny(msgBuff.getArray()));
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.makeEndApplicationMessage: {}, ControlDevice: {}, Exception: {}", obj.getID(), controlDevice, e);
-//            return null;
-//        }
-//        log.debug("ControlDeviceService.makeEndApplicationMessage: {}, ControlDevice: {}, EndApplicationMessage: {}", obj.getID(), controlDevice, endApplicationMessage);
-//        return endApplicationMessage;
-//    }
-
-//    public ControlDeviceList controlDevice_BasicBaseInfo(CenterDto obj, eControlRequest type) {
-//        // ControlDevice.vpbd-ControlID  : 기초정보(0x02)
-//        //
-//        // BasicBaseInfo.roadStationID   : 주1) 사업자 정의 ID. MCU ID임
-//        // BasicBaseInfo.roadStationType : 주2) 제어부 위치 정보
-//        //                                      101 고속국도
-//        //                                      102 도시고속국도
-//        //                                      103 일반국도
-//        //                                      104 특별․광역시도
-//        //                                      105 국가지원지방도
-//        //                                      106 지방도
-//        //                                      107 시․군도
-//        //                                      108 기타
-//        // BasicBaseInfo.dataOfNonCryptoObuList	DataOfNonCryptoObu
-//        //주3) infoID
-//        //1 : DataOfCollectionPointInfo (가상 수집지점 정보)
-//        //2 : DirectionDecisionInfo (방향 판단 정보)
-//        //3 : DataOfNonCryptoObu (비 암호화 단말기 정보)
-//
-//        ControlDeviceList controlDeviceList = null;
-//        ControlDevice device = null;
-//        BasicBaseInfo info = null;
-//        byte[] controlId = { (byte)eControlDevice.Control_BasicInfo.getValue() };
-//        String roadStationId = obj.getRSE_MCU_ID();//obj.getROAD_SPOT_ID();
-//        if (roadStationId == null || roadStationId.equals("")) {
-//            return null;
-//        }
-//
-//        try {
-//            int updateNo = 0;
-//            byte[] operCode = { 0x00 };  // 0x00(추가), 0x01(삭제)
-//            switch(type) {
-//                case Request_BasicInfo:
-//                case Request_BasicInfo_Collect:
-//                case Request_BasicInfo_Direction:
-//                    info = new BasicBaseInfo();
-//                    info.setRoadStationID(new BerOctetString(roadStationId.getBytes()));
-//                    info.setRoadStationType(new BerInteger(104));   //시․군도
-//                    BasicBaseInfo.DataOfDirectionDecisionInfoList data = new BasicBaseInfo.DataOfDirectionDecisionInfoList();
-//                    DirectionDecisionInfo decisionInfo = new DirectionDecisionInfo();
-//                    decisionInfo.setInfoID(new BerInteger(eControlRequest.Request_BasicInfo_Direction.getValue()));
-//                    decisionInfo.setUpdateNo(new BerInteger(updateNo));
-//                    decisionInfo.setGenerationTime(new BerGeneralizedTime(SysUtils.getSysTime()));                   // 주5) generationTime : 해당 정보의 생성 일자 시간
-//                    BeaconID beaconID = new BeaconID();
-//                    beaconID.setManufacturerid(new BerInteger(Long.valueOf(obj.getMNFC_CMPY_CD()).longValue()));
-//                    beaconID.setIndividualid(new BerInteger(Long.valueOf(obj.getRSE_ID()).longValue()));
-//                    decisionInfo.setTargetBeaconID(beaconID);
-//                    decisionInfo.setInCommingDirectionEnterBaseInfo(null);
-//                    List<TbRseOffrDrct> list = AppRepository.getInstance().getRseOffrDrctList(obj.getRSE_ID());
-//                    if (list == null || list.size() == 0) {
-//                        decisionInfo.setInCommingDirectionBeaconInfo(null);
-//                    }
-//                    else {
-//                        DirectionDecisionInfo.InCommingDirectionBeaconInfo beacons = new DirectionDecisionInfo.InCommingDirectionBeaconInfo();
-//                        for (TbRseOffrDrct vo : list) {
-//                            DirectionBeaconInfo directionBeaconInfo = new DirectionBeaconInfo();
-//                            directionBeaconInfo.setDirectionInfo(new BerInteger(Long.valueOf(vo.getOBU_ENTR_DRCT_NMBR()).longValue()));
-//                            BeaconID beaconID1 = new BeaconID();
-//                            TbRseCtlr rseObj = AppRepository.getInstance().getCtlrMap().get(vo.getPRE_RSE_CTLR_NMBR());
-//                            if (rseObj != null) {
-//                                beaconID1.setIndividualid(new BerInteger(Long.valueOf(rseObj.getRSE_ID()).longValue()));
-//                                beaconID1.setManufacturerid(new BerInteger(Long.valueOf(rseObj.getMNFC_CMPY_CD()).longValue()));
-//                                directionBeaconInfo.getPreviousBeaconID().getBeaconID().add(beaconID1);
-//                                beacons.getDirectionBeaconInfo().add(directionBeaconInfo);
-//                            }
-//                        }
-//                        decisionInfo.setInCommingDirectionBeaconInfo(beacons);
-//                    }
-//                    data.getDirectionDecisionInfo().add(decisionInfo);
-//                    info.setDataOfDirectionDecisionInfoList(data);
-//                    break;
-//                case Request_BasicInfo_NonCrypt:    // 최초 로그인 후 NonCryptObu 정보 요청
-//                    DataOfNonCryptoObu dataObu = new DataOfNonCryptoObu();
-//                    DataOfNonCryptoObu.CryptObuList obuList = new DataOfNonCryptoObu.CryptObuList();
-//
-//                    for (TbRseObuNonCrypt vo : AppRepository.getInstance().rseObuNonCryptList) {
-//                        CryptObu obu = new CryptObu();
-//                        obu.setOperCode(new BerOctetString(operCode));  // 주7) operCode : 비암호 단말기 리스트의 추가삭제 정보
-//                        // 0x00 : 추가 , 0x01: 삭제
-//                        obu.setObuID(new BerOctetString(vo.getOBU_ID().getBytes()));
-//                        obuList.getCryptObu().add(obu);
-//                    }
-//                    dataObu.setInfoID(new BerInteger(eControlRequest.Request_BasicInfo_NonCrypt.getValue()));   // 주3) infoID
-//                    //    1 : DataOfCollectionPointInfo (가상 수집지점 정보)
-//                    //    2 : DirectionDecisionInfo (방향 판단 정보)
-//                    //    3 : DataOfNonCryptoObu (비 암호화 단말기 정보)
-//                    dataObu.setUpdateNo(new BerInteger(updateNo));                                                // 주4) updateNo : 해당정보의 변경이력 번호
-//                    dataObu.setGenerationTime(new BerGeneralizedTime(SysUtils.getSysTime()));                   // 주5) generationTime : 해당 정보의 생성 일자 시간
-//                    dataObu.setCryptObuList(obuList);
-//
-//                    info = new BasicBaseInfo();
-//                    info.setRoadStationID(new BerOctetString(roadStationId.getBytes()));
-//                    info.setRoadStationType(new BerInteger(107));   //시․군도
-//                    info.setDataOfNonCryptoObuList(dataObu);
-//                    break;
-//            }
-//
-//            if (info != null) {
-//                ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//                info.encode(msgBuff);
-//                device = new ControlDevice();
-//                device.setVpbdControlID(new BerOctetString(controlId));
-//                device.setVpbdControlDeviceData(new BerOctetString(msgBuff.getArray()));
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("ControlDeviceService.makeControlDevice_BasicBaseInfo: {}, eControlType: {}, Exception: {}", obj.getID(), type, e);
-//            return null;
-//        }
-//        //log.debug("ControlDeviceService.makeControlDevice_BasicBaseInfo: {}, eControlType: {}, ControlDevice: {}", obj.getID(), type, device);
-//        return controlDeviceList;
-//    }
-
-    public boolean sendTerminate(CenterDto obj, Channel channel, int reason)
-    {
-        if (obj == null) {
-            log.info("ControlDeviceService.sendTerminate: reason: {}, DSRC Object null...", reason);
-            return false;
-        }
-
-//        log.info("ControlDeviceService.sendTerminate: {}, {}, reason: {}", obj.getID(), obj.getRSE_ID(), reason);
-        try {
-//            if (obj.getChannel() == null || !obj.getChannel().isOpen() || !obj.getChannel().isActive()) {
-////                log.error("ControlDeviceService.sendTerminate: {}, {}, reason: {}, is not active", obj.getID(), obj.getRSE_ID(), reason);
-//                return false;
-//            }
-
-            int subscribeSerialNbr = 0;//obj.getSeq().nextValue();
-
-            // Terminate
-            Terminate terminate = new Terminate(reason);
-
-            PDUs pdus = new PDUs();
-            pdus.setTerminate(terminate);
-            byte[] auth = null;//{(byte) eAuthInfo.AI_Terminate.getValue() };
-            C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-            c2c.setDatexDataPacketNumber(new BerInteger(subscribeSerialNbr));
-            c2c.setDatexDataPacketPriorityNumber(new BerInteger(1));
-            c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//            c2c.setOptions(DsrcAsn1Utils.swapHeaderOptions(obj.getHeaderOptions()));
-            c2c.setPdu(pdus);
-
-            ChannelFuture f = channel.writeAndFlush(c2c);
-            f.awaitUninterruptibly();
-//            if (f.isDone() || f.isSuccess()) {
-//                log.info("ControlDeviceService.sendTerminate: {}, {}, reason: {}, send ok", obj.getID(), obj.getRSE_ID(), reason);
-//            } else {
-//                log.error("ControlDeviceService.sendTerminate: {}, {}, reason: {}, send failed.", obj.getID(), obj.getRSE_ID(), reason);
-//                return false;
-//            }
-        }
-        catch(Exception e) {
-//            log.error("ControlDeviceService.sendTerminate: {}, {}, reason: {}, Exception: {}", obj.getID(), obj.getRSE_ID(), reason, e.getMessage());
-            return false;
-        }
-        return true;
-    }
-
-}

+ 0 - 586
src/main/java/com/its/rota/server/xnet/server/process/service/LoginDeviceService.java

@@ -1,586 +0,0 @@
-package com.its.rota.server.xnet.server.process.service;
-
-import com.beanit.asn1bean.ber.ReverseByteArrayOutputStream;
-import com.its.app.common.utils.NettyUtils;
-import com.its.rota.server.config.ApplicationConfig;
-import com.its.rota.server.dto.CenterDto;
-import io.netty.channel.Channel;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class LoginDeviceService {
-    private static LoginDeviceService _instance = null;
-
-    public static LoginDeviceService getInstance() {
-        if (_instance == null) {
-            synchronized (LoginDeviceService.class) {
-                if (_instance == null)
-                    _instance = new LoginDeviceService();
-            }
-        }
-        return _instance;
-    }
-
-    public LoginDeviceService() {
-    }
-
-    public boolean initLoginDevice(CenterDto obj, Channel channel, boolean isObuNonCrypt, boolean isDsrcStatus, boolean isTraffic, int subscriptionStatusCycle, int antennaCnt) {
-
-        log.info("LoginResponse.initLoginDevice");
-
-        // OBU Non Crypt 데이터 요청 Subscription
-        if (isObuNonCrypt) {
-//            log.info("initLoginDevice.isObuNonCrypt. {}, {}, {}", obj.getCenterId(), obj.getRSE_CTLR_IP(), obj.getRSE_MCU_ID());
-            //requestPublicationNonCryptObu(obj, channel);
-        }
-
-        // DSRC 상태정보 요청 Subscription
-        if (isDsrcStatus) {
-//            log.info("initLoginDevice.isDsrcStatus. {}, {}, {}", obj.getRSE_CTLR_NMBR(), obj.getRSE_CTLR_IP(), obj.getRSE_MCU_ID());
-            //requestSubscriptions(obj, channel, subscriptionStatusCycle, 1);
-        }
-
-        // OBU 교통정보 요청 Subscription
-        if (isTraffic) {
-//            log.info("initLoginDevice.isTraffic. {}, {}, {}", obj.getRSE_CTLR_NMBR(), obj.getRSE_CTLR_IP(), obj.getRSE_MCU_ID());
-            requestSubscriptions(obj, channel, 0, 2);
-        }
-
-        // DSRC Antenna enable Publication
-//        if (antennaCnt > 0) {
-//            for (int antennaId = 1; antennaId <= antennaCnt; antennaId++) {
-//                requestSubscriptionDeviceCommand(obj, channel, antennaId, eControlCommand.ControlCommand_Wireless_Start.getValue());
-//            }
-//        }
-        return true;
-    }
-
-    /*
-     *  RSE 로 부터 최초 로그인 요청 수신시 안테나 활성화
-     */
-    public boolean requestSubscriptionDeviceCommand(CenterDto obj, Channel channel, int controlDeviceId, int commandType)
-    {
-        return false;
-//        return ControlDeviceService.getInstance().requestSubscriptionDeviceCommand(false, obj, channel, controlDeviceId, commandType, null);
-    }
-
-    /*
-     *  RSE 로 부터 최초 로그인 요청 수신시 Subscription 정보를 요청한다.
-     */
-    public boolean requestSubscriptions(CenterDto obj, Channel channel, int registeredUpdateDelayQty, int subscriptionsType) {
-
-        String ipAddress = NettyUtils.getRemoteIpAddress(channel);
-//        log.info("LoginDeviceService.requestSubscriptions: {}, {}, registeredUpdateDelayQty: {}, subscriptionsType: {}", obj.getID(), obj.getRSE_ID(), registeredUpdateDelayQty, subscriptionsType);
-
-        int[] messageId = {1, 0, 15784, 4, 0, 7};
-//        pObject->numids = 6;
-//        pObject->subid[0] = 1;
-//        pObject->subid[1] = 0;
-//        pObject->subid[2] = 15784;
-//        switch (id)
-//        {
-//            case itMultimediaData: pObject->subid[3] = 5; pObject->subid[4] = 0; pObject->subid[5] = 1; break;
-//            case itControlDevice: pObject->subid[3] = 4; pObject->subid[4] = 0; pObject->subid[5] = 7; break;
-//            case itObuGatherInfo: pObject->subid[3] = 8; pObject->subid[4] = 0; pObject->subid[5] = 8; break;
-//            default: break;
-//        }
-//        int subscribeSerialNbr = obj.getSeq().nextValue();
-
-        try {
-            registeredUpdateDelayQty = 0;
-
-//            ControlDevice controlDevice = null;
-//            Registered registered = new Registered();
-//            Registered.Continuous continuous = new Registered.Continuous();
-//            SubscriptionMode subscriptionMode = new SubscriptionMode();
-//
-//            if (subscriptionsType == 1) {
-//                // DSRC 상태정보 요청
-//                controlDevice = ControlDeviceService.getInstance().makeControlDevice_DeviceCommand(obj, eControlCommand.ControlCommand_Status_Request, eControlDeviceId.ControlDeviceId_Controller);
-//                continuous.setDatexRegisteredUpdateDelayQty(new BerInteger(registeredUpdateDelayQty));
-//                continuous.setDatexRegisteredStartTime(DsrcAsn1Utils.getRegisterStartTime());
-//                continuous.setDatexRegisteredEndTime(DsrcAsn1Utils.getRegisterEndTime());
-//                registered.setContinuous(continuous);
-//                subscriptionMode.setPeriodic(registered);
-//                log.info("LoginDeviceService.requestSubscriptions: {}, DSRC Status_Request, subscribeSerialNbr: {}", ipAddress, subscribeSerialNbr);
-//            }
-//            else if (subscriptionsType == 2) {
-//                // OBU 교통정보 요청
-//                controlDevice = ControlDeviceService.getInstance().makeControlDevice_DSRCTrafficInfoRequest(obj, eControlRequest.Request_TrafficInfo);
-//                continuous.setDatexRegisteredUpdateDelayQty(new BerInteger(registeredUpdateDelayQty));
-//                continuous.setDatexRegisteredStartTime(DsrcAsn1Utils.getRegisterStartTime());
-//                continuous.setDatexRegisteredEndTime(DsrcAsn1Utils.getRegisterEndTime());
-//                registered.setContinuous(continuous);
-//                subscriptionMode.setEventDriven(registered);
-//                log.info("LoginDeviceService.requestSubscriptions: {}, DSRC OBU TrafficInfo_Request, subscribeSerialNbr: {}", ipAddress, subscribeSerialNbr);
-//            }
-//
-//            if (controlDevice == null) {
-//                return false;
-//            }
-
-            // ControlDeviceList set
-            ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//            ControlDeviceList controlDeviceList = new ControlDeviceList();
-//            controlDeviceList.getControlDevice().add(controlDevice);
-//            controlDeviceList.encode(msgBuff);
-//
-//            // EndApplicationMessage set
-//            EndApplicationMessage endApplicationMessage =  new EndApplicationMessage();
-//            endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//            endApplicationMessage.setEndApplicationMessageMsg(new BerAny(msgBuff.getArray()));
-//
-//            SubscriptionData subscriptionData = new SubscriptionData();
-//            subscriptionData.setDatexSubscribePersistentBool(new BerBoolean(false));
-//            subscriptionData.setDatexSubscribeStatusCd(new BerEnum(0));         // 0: New, 1: Update
-//            subscriptionData.setDatexSubscribeMode(subscriptionMode);
-//            subscriptionData.setDatexSubscribePublishFormatCd(new BerEnum(3));  // 0: other, 1: ftp, 2: tftp, 3: dataPacket
-//            //subscriptionData.setDatexSubscriptionPriorityNbr(new BerInteger(1));
-//            subscriptionData.setDatexSubscriptionPriorityNbr(new BerInteger(10));
-//            subscriptionData.setDatexSubscribeGuaranteeBool(new BerBoolean(true));
-//            subscriptionData.setDatexSubscribePdu(endApplicationMessage);
-//
-//            SubscriptionType subscriptionType = new SubscriptionType();
-//            subscriptionType.setSubscription(subscriptionData);
-//
-//            Subscription subscription = new Subscription();
-//            subscription.setDatexSubscribeSerialNbr(new BerInteger(subscribeSerialNbr));
-//            subscription.setDatexSubscribeType(subscriptionType);
-//
-//            PDUs pdus = new PDUs();
-//            pdus.setSubscription(subscription);
-//            byte[] auth = { (byte) eAuthInfo.AI_Subscription.getValue() };
-//            C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-//            c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//            c2c.setDatexDataPacketNumber(new BerInteger(subscribeSerialNbr));
-//            c2c.setDatexDataPacketPriorityNumber(new BerInteger(1));
-//            c2c.setOptions(DsrcAsn1Utils.swapHeaderOptions(obj.getHeaderOptions()));
-//            c2c.setPdu(pdus);
-//
-//            ChannelFuture f = channel.writeAndFlush(c2c);
-//            f.awaitUninterruptibly();
-//            if (f.isDone() || f.isSuccess()) {
-//                log.info("LoginDeviceService.requestSubscriptions: {}, {}, subscriptionsType: {}, send ok", obj.getID(), obj.getRSE_ID(), subscriptionsType);
-//            }
-//            else {
-//                log.error("LoginDeviceService.requestSubscriptions: {}, {}, subscriptionsType: {}, send failed.", obj.getID(), obj.getRSE_ID(), subscriptionsType);
-//            }
-        }
-        catch(Exception e) {
-//            log.error("LoginDeviceService.requestSubscriptions: {}, {}, subscriptionsType: {}, Exception: {}", obj.getID(), obj.getRSE_ID(), subscriptionsType, e.toString());
-        }
-        return true;
-    }
-
-    /*
-     *  RSE 로 부터 최초 로그인 요청 수신시 NonCryptObu 정보를 요청한다.
-     */
-    public boolean requestPublicationNonCryptObu(CenterDto obj, Channel channel) {
-
-//        log.info("LoginDeviceService.requestPublicationNonCryptObu: {}, {}", obj.getID(), obj.getRSE_ID());
-//        int obuCnt = AppRepository.getInstance().rseObuNonCryptList.size();
-//        if (obuCnt == 0) {
-//            log.info("LoginDeviceService.requestPublicationNonCryptObu: {}, {}, No Data...", obj.getID(), obj.getRSE_ID());
-//            return true;
-//        }
-//
-//        int subscribeSerialNbr = obj.getSeq().nextValue();
-//        int[] messageId = {1, 0, 15784, 4, 0, 7};
-//        byte[] controlId = { (byte) eControlDevice.Control_BasicInfo.getValue() };
-//        byte[] operCode = {0x00};  // 0x00(추가), 0x01(삭제)
-//        String roadStationId = obj.getRSE_MCU_ID();//obj.getROAD_SPOT_ID();
-//        int updateNo = 0;
-//
-//        try {
-//            // 1. OUB Non Crypt Data encoding
-//            DataOfNonCryptoObu dataObu = new DataOfNonCryptoObu();
-//            DataOfNonCryptoObu.CryptObuList obuList = new DataOfNonCryptoObu.CryptObuList();
-//
-//            for (TbRseObuNonCrypt vo : AppRepository.getInstance().rseObuNonCryptList) {
-//                // 프로토콜 문서상 OBU ID는 최대 8자리임
-//                String fullObuId = vo.getOBU_ID();
-//                int len = fullObuId.length() / 2;
-//                byte[] obuId = new byte[8];
-//                for (int ii = 0; ii < len; ii++) {
-//                    String temp = fullObuId.substring(ii * 2, ii * 2 + 2);   // 2자리씩 잘라냄
-//                    byte tempId[] = new BigInteger(temp, 16).toByteArray();
-//                    obuId[ii] = tempId[tempId.length - 1];
-//                }
-//
-//                CryptObu obu = new CryptObu();
-//                obu.setOperCode(new BerOctetString(operCode));          // 0x00 : 추가 , 0x01: 삭제
-//                obu.setObuID(new BerOctetString(obuId));
-//                obuList.getCryptObu().add(obu);
-//            }
-//            // 주3) infoID
-//            //    1 : DataOfCollectionPointInfo (가상 수집지점 정보)
-//            //    2 : DirectionDecisionInfo (방향 판단 정보)
-//            //    3 : DataOfNonCryptoObu (비 암호화 단말기 정보)
-//            dataObu.setInfoID(new BerInteger(eControlRequest.Request_BasicInfo_NonCrypt.getValue()));
-//            dataObu.setUpdateNo(new BerInteger(updateNo));                              // 주4) updateNo : 해당정보의 변경이력 번호
-//            dataObu.setGenerationTime(new BerGeneralizedTime(SysUtils.getSysTime()));   // 주5) generationTime : 해당 정보의 생성 일자 시간
-//            dataObu.setCryptObuList(obuList);                                           // CryptObuList
-//
-//            // 2. BasicBaseInfo set
-//            BasicBaseInfo basicBaseInfo = new BasicBaseInfo();
-//            basicBaseInfo.setRoadStationID(new BerOctetString(roadStationId.getBytes()));    // roadStationId, 최소 13, 최대 20
-//            basicBaseInfo.setRoadStationType(new BerInteger(107));                      // stationType
-//            basicBaseInfo.setDataOfNonCryptoObuList(dataObu);                                // NonCryptoObuList
-//
-//            // 3. ControlDevice set
-//            ReverseByteArrayOutputStream deviceBuff = new ReverseByteArrayOutputStream(2048);
-//            basicBaseInfo.encode(deviceBuff);
-//
-//            ControlDevice controlDevice = new ControlDevice();
-//            controlDevice.setVpbdControlID(new BerOctetString(controlId));
-//            controlDevice.setVpbdControlDeviceData(new BerOctetString(deviceBuff.getArray()));
-//
-//            // 4. ControlDeviceList set
-//            ReverseByteArrayOutputStream deviceListBuff = new ReverseByteArrayOutputStream(2048);
-//            ControlDeviceList controlDeviceList = new ControlDeviceList();
-//            controlDeviceList.getControlDevice().add(controlDevice);
-//            controlDeviceList.encode(deviceListBuff);
-//
-//            // 5. EndApplicationMessage set
-//            EndApplicationMessage endApplicationMessage =  new EndApplicationMessage();
-//            endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//            endApplicationMessage.setEndApplicationMessageMsg(new BerAny(deviceListBuff.getArray()));
-//
-//            // 6. Publication
-//            PublicationType publicationType = new PublicationType();
-//            publicationType.setDatexPublishData(endApplicationMessage);
-//
-//            PublicationData publicationData = new PublicationData();
-//            publicationData.setDatexPublishSubscribeSerialNbr(new BerInteger(subscribeSerialNbr));
-//            publicationData.setDatexPublishSerialNbr(new BerInteger(subscribeSerialNbr));
-//            publicationData.setDatexPublishLatePublicationFlag(new BerBoolean(true));
-//            publicationData.setDatexPublishType(publicationType);
-//
-//            PublishFormat.DatexPublishData publishData = new PublishFormat.DatexPublishData();
-//            publishData.getPublicationData().add(publicationData);
-//
-//            PublishFormat publishFormat = new PublishFormat();
-//            publishFormat.setDatexPublishData(publishData);
-//
-//            Publication publication = new Publication();
-//            publication.setDatexPublishFormat(publishFormat);
-//            publication.setDatexPublishGuaranteedBool(new BerBoolean(true));
-//
-//            PDUs pdus = new PDUs();
-//            pdus.setPublication(publication);
-//            byte[] auth = {(byte) eAuthInfo.AI_Publication.getValue() };
-//            C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-//            c2c.setDatexDataPacketNumber(new BerInteger(subscribeSerialNbr));
-//            c2c.setDatexDataPacketPriorityNumber(new BerInteger(1));
-//            c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//            c2c.setOptions(DsrcAsn1Utils.swapHeaderOptions(obj.getHeaderOptions()));
-//            c2c.setPdu(pdus);
-//
-//            ChannelFuture f = channel.writeAndFlush(c2c);
-//            f.awaitUninterruptibly();
-//            if (f.isDone() || f.isSuccess()) {
-//                log.info("LoginDeviceService.requestPublicationNonCryptObu: {}, {}, send ok", obj.getID(), obj.getRSE_ID());
-//            } else {
-//                log.error("LoginDeviceService.requestPublicationNonCryptObu: {}, {}, send failed.", obj.getID(), obj.getRSE_ID());
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("LoginDeviceService.requestPublicationNonCryptObu: {}, {}, Exception: {}", obj.getID(), obj.getRSE_ID(), e.toString());
-//        }
-        return true;
-    }
-
-    /**
-     * 클라이언트 모드로 동작시 Initiate 수신시 로그인 정보를 전송한다.
-     * @param obj
-     * @param channel
-     * @param runningConfig
-     * @return
-     */
-    public boolean requestLogin(CenterDto obj, Channel channel, ApplicationConfig config) {
-
-//        log.info("LoginResponse.requestLogin: {}, {}, {}", obj.getRSE_CTLR_NMBR(), obj.getRSE_CTLR_IP(), obj.getRSE_MCU_ID());
-//
-//        int dataPacketNumber = 0;           //obj.getSeq().nextValue()
-//        int dataPacketPriorityNumber = 0;
-//        String serverDomainName = runningConfig.getServerDomainName();
-//        String destinationTxt = obj.getRSE_MCU_ID();
-//        String loginUserNameTxt = "";
-//        String loginPasswordTxt = "";
-//
-//        Login login = new Login();
-//        login.setDatexSenderTxt(new BerUTF8String(serverDomainName));
-//        login.setDatexDestinationTxt(new BerUTF8String(destinationTxt));
-//        login.setDatexLoginUserNameTxt(new BerUTF8String(loginUserNameTxt));
-//        login.setDatexLoginPasswordTxt(new BerUTF8String(loginPasswordTxt));
-//        login.setDatexLoginHeartbeatDurationMaxQty(new BerInteger(120));
-//        login.setDatexLoginResponseTimeOutQty(new BerInteger(30));
-//        login.setDatexLoginInitiatorCd(new BerEnum(1));
-//        login.setDatexLoginDatagramSizeQty(new BerInteger(2048));
-//        int[] encodingRules = {2, 1};
-//        Login.DatexLoginEncodingRulesId loginEncodingRulesId = new Login.DatexLoginEncodingRulesId();
-//        loginEncodingRulesId.getBerObjectIdentifier().add(new BerObjectIdentifier(encodingRules));
-//        login.setDatexLoginEncodingRulesId(loginEncodingRulesId);
-//
-//        byte[] auth = {(byte) eAuthInfo.AI_Login.getValue() };
-//        PDUs loginPdu = new PDUs();
-//        loginPdu.setLogin(login);
-//
-//        HeaderOptions headerOptions = new HeaderOptions();
-//        Time tm = new Time();
-//        Time.TimeSecondFractions tmFac = new Time.TimeSecondFractions();
-//        Time.TimeTimezone        tmZon = new Time.TimeTimezone();
-//        Calendar currTm = Calendar.getInstance();
-//        tm.setTimeYearQty(new BerInteger(currTm.get(Calendar.YEAR)));
-//        tm.setTimeMonthQty(new BerInteger(currTm.get(Calendar.MONTH)+1));
-//        tm.setTimeDayQty(new BerInteger(currTm.get(Calendar.DATE)));
-//        tm.setTimeHourQty(new BerInteger(currTm.get(Calendar.HOUR_OF_DAY)));
-//        tm.setTimeMinuteQty(new BerInteger(currTm.get(Calendar.MINUTE)));
-//        tm.setTimeSecondQty(new BerInteger(currTm.get(Calendar.SECOND)));
-//        tmFac.setMilliseconds(new BerInteger(currTm.get(Calendar.MILLISECOND)));
-//        tm.setTimeSecondFractions(tmFac);
-//        headerOptions.setDatexDataPacketTime(tm);
-//
-//        C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-//        c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//        c2c.setDatexDataPacketNumber(new BerInteger(dataPacketNumber));
-//        c2c.setDatexDataPacketPriorityNumber(new BerInteger(dataPacketPriorityNumber));
-//        c2c.setOptions(headerOptions);
-//        c2c.setPdu(loginPdu);
-//
-//        ChannelFuture f = channel.writeAndFlush(c2c);
-//        f.awaitUninterruptibly();
-//        if (f.isDone() || f.isSuccess()) {
-//            obj.setHeaderOptions(DsrcAsn1Utils.swapHeaderOptions(headerOptions));
-//            obj.setLogin(login);
-//            log.info("LoginResponse.requestLogin: {}, {}, {}, send ok.", obj.getRSE_CTLR_NMBR(), obj.getRSE_CTLR_IP(), obj.getRSE_MCU_ID());
-//        } else {
-//            log.error("LoginDeviceService.requestLogin: {}, {}, send failed.", obj.getID(), obj.getRSE_ID());
-//        }
-        return true;
-    }
-
-//    public boolean requestLogin2(CenterDto obj, Channel channel, ApplicationConfig config) {
-//
-//        log.info("LoginResponse.requestLogin: {}, {}, {}", obj.getRSE_CTLR_NMBR(), obj.getRSE_CTLR_IP(), obj.getRSE_MCU_ID());
-//
-//        int dataPacketNumber = 0;           //obj.getSeq().nextValue()
-//        int dataPacketPriorityNumber = 0;
-//
-//        Login login = new Login();
-//        login.setDatexSenderTxt(new BerUTF8String(runningConfig.getServerDomainName()));
-//        login.setDatexDestinationTxt(new BerUTF8String(obj.getRSE_MCU_ID()));
-//        login.setDatexLoginUserNameTxt(new BerUTF8String(runningConfig.getServerAuthUser()));
-//        login.setDatexLoginPasswordTxt(new BerUTF8String(runningConfig.getServerAuthPassword()));
-//        login.setDatexLoginHeartbeatDurationMaxQty(new BerInteger(120));
-//        login.setDatexLoginResponseTimeOutQty(new BerInteger(30));
-//        login.setDatexLoginInitiatorCd(new BerEnum(1));
-//        login.setDatexLoginDatagramSizeQty(new BerInteger(2048));
-//        int[] encodingRules = {2, 1, 1};
-//        Login.DatexLoginEncodingRulesId loginEncodingRulesId = new Login.DatexLoginEncodingRulesId();
-//        loginEncodingRulesId.getBerObjectIdentifier().add(new BerObjectIdentifier(encodingRules));
-//        login.setDatexLoginEncodingRulesId(loginEncodingRulesId);
-//
-//        byte[] auth = {(byte) eAuthInfo.AI_Login.getValue() };
-//        PDUs loginPdu = new PDUs();
-//        loginPdu.setLogin(login);
-//
-//        HeaderOptions headerOptions = DsrcAsn1Utils.getDefaultOptions();
-//        C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-//        c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//        c2c.setDatexDataPacketNumber(new BerInteger(dataPacketNumber));
-//        c2c.setDatexDataPacketPriorityNumber(new BerInteger(dataPacketPriorityNumber));
-//        c2c.setOptions(headerOptions);
-//        c2c.setPdu(loginPdu);
-//
-//        ChannelFuture f = channel.writeAndFlush(c2c);
-//        f.awaitUninterruptibly();
-//        if (f.isDone() || f.isSuccess()) {
-//            obj.setHeaderOptions(DsrcAsn1Utils.swapHeaderOptions(headerOptions));
-//            obj.setLogin(login);
-//            log.info("LoginResponse.requestLogin: {}, {}, {}, send ok.", obj.getRSE_CTLR_NMBR(), obj.getRSE_CTLR_IP(), obj.getRSE_MCU_ID());
-//        } else {
-//            log.error("LoginDeviceService.requestLogin: {}, {}, send failed.", obj.getID(), obj.getRSE_ID());
-//        }
-//        return true;
-//    }
-
-    /**
-     * OBU 수집 정보 요청 등록(이벤트 방식)
-     * @param obj
-     * @param channel
-     * @return
-     */
-    public boolean requestObuGatherInfo(CenterDto obj, Channel channel) {
-
-//        log.info("LoginDeviceService.requestObuGatherInfo: {}, {}", obj.getID(), obj.getRSE_ID());
-
-        int[] messageId = {1, 0, 15784, 8, 0, 8};
-        int dataPacketNumber = 1;           //obj.getSeq().nextValue()
-        int dataPacketPriorityNumber = 0;
-        int datexSubscriptionPriorityNbr = 10;
-        int subscribeSerialNbr = 0;
-        try {
-            byte[] obuIdNumber = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-            byte[] vehicleType = {0};
-            byte[] obuType = {0};
-            byte[] generationDate = {0,0,0,0};
-            byte[] generationTime = {0,0,0};
-
-//            OBUGatherInfoList lists = new OBUGatherInfoList();
-//            OBUGatherInfo gatherInfo = new OBUGatherInfo();
-//            gatherInfo.setObuIdNumber(new BerOctetString(obuIdNumber));
-//            BeaconID beaconID = new BeaconID();
-//            beaconID.setManufacturerid(new BerInteger(obj.getManufacturerid()));
-//            beaconID.setIndividualid(new BerInteger(obj.getIndividualid()));
-//            gatherInfo.setRseIDNumber(beaconID);
-//            gatherInfo.setVehicleType(new BerOctetString(vehicleType));
-//            gatherInfo.setObuType(new BerOctetString(obuType));
-//            gatherInfo.setGenerationDate(new BerOctetString(generationDate));
-//            gatherInfo.setGenerationTime(new BerOctetString(generationTime));
-//            lists.getOBUGatherInfo().add(gatherInfo);
-//
-//            byte[] controlId = { (byte)4 };
-//            ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//            lists.encode(msgBuff);
-//            ControlDevice controlDevice = new ControlDevice();
-//            controlDevice.setVpbdControlID(new BerOctetString(controlId));
-//            controlDevice.setVpbdControlDeviceData(new BerOctetString(msgBuff.getArray()));
-//
-//            Registered registered = new Registered();
-//            Registered.Continuous continuous = new Registered.Continuous();
-//            SubscriptionMode subscriptionMode = new SubscriptionMode();
-//
-//            continuous.setDatexRegisteredUpdateDelayQty(new BerInteger(0));
-//            continuous.setDatexRegisteredStartTime(DsrcAsn1Utils.getRegisterStartTime());
-//            continuous.setDatexRegisteredEndTime(DsrcAsn1Utils.getRegisterEndTime());
-//            registered.setContinuous(continuous);
-//            subscriptionMode.setEventDriven(registered);
-//
-//            // EndApplicationMessage set
-//            EndApplicationMessage endApplicationMessage =  new EndApplicationMessage();
-//            endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//            endApplicationMessage.setEndApplicationMessageMsg(new BerAny(msgBuff.getArray()));
-//
-//            SubscriptionData subscriptionData = new SubscriptionData();
-//            subscriptionData.setDatexSubscribePersistentBool(new BerBoolean(false));
-//            subscriptionData.setDatexSubscribeStatusCd(new BerEnum(0));         // 0: New, 1: Update
-//            subscriptionData.setDatexSubscribeMode(subscriptionMode);
-//            subscriptionData.setDatexSubscribePublishFormatCd(new BerEnum(3));  // 0: other, 1: ftp, 2: tftp, 3: dataPacket
-//            subscriptionData.setDatexSubscriptionPriorityNbr(new BerInteger(datexSubscriptionPriorityNbr));
-//            subscriptionData.setDatexSubscribeGuaranteeBool(new BerBoolean(true));
-//            subscriptionData.setDatexSubscribePdu(endApplicationMessage);
-//
-//            SubscriptionType subscriptionType = new SubscriptionType();
-//            subscriptionType.setSubscription(subscriptionData);
-//
-//            Subscription subscription = new Subscription();
-//            //subscription.setDatexSubscribeSerialNbr(new BerInteger(subscribeSerialNbr));
-//            subscription.setDatexSubscribeSerialNbr(new BerInteger(subscribeSerialNbr));
-//            subscription.setDatexSubscribeType(subscriptionType);
-//
-//            PDUs pdus = new PDUs();
-//            pdus.setSubscription(subscription);
-//            byte[] auth = { (byte) eAuthInfo.AI_Subscription.getValue() };
-//            C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-//            c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//            c2c.setDatexDataPacketNumber(new BerInteger(dataPacketNumber));
-//            c2c.setDatexDataPacketPriorityNumber(new BerInteger(dataPacketPriorityNumber));
-//            c2c.setOptions(new HeaderOptions());
-//            c2c.setPdu(pdus);
-//
-//            ChannelFuture f = channel.writeAndFlush(c2c);
-//            f.awaitUninterruptibly();
-//            if (f.isDone() || f.isSuccess()) {
-//                log.info("LoginDeviceService.requestObuGatherInfo: {}, {}, send ok", obj.getID(), obj.getRSE_ID());
-//            }
-//            else {
-//                log.error("LoginDeviceService.requestObuGatherInfo: {}, {}, send failed.", obj.getID(), obj.getRSE_ID());
-//            }
-        }
-        catch(Exception e) {
-//            log.error("LoginDeviceService.requestObuGatherInfo: {}, {}, Exception: {}", obj.getID(), obj.getRSE_ID(), e.toString());
-        }
-        return true;
-    }
-
-    public boolean requestObuStatusInfo(CenterDto obj, Channel channel) {
-
-        int updateDelayQty = 30;
-        String ipAddress = NettyUtils.getRemoteIpAddress(channel);
-//        log.info("LoginDeviceService.requestObuStatusInfo: {}, {}, {}", obj.getID(), obj.getMcuID(), updateDelayQty);
-
-        int[] messageId = {1, 0, 15784, 4, 0, 7};
-        int dataPacketNumber = 2;           //obj.getSeq().nextValue()
-        int dataPacketPriorityNumber = 0;
-        int datexSubscriptionPriorityNbr = 10;
-        int subscribeSerialNbr = 1;
-        try {
-            byte[] controlId = {3};
-            byte[] controlData = {};
-//            ControlDevice controlDevice = new ControlDevice();
-//            controlDevice.setVpbdControlID(new BerOctetString(controlId));
-//            controlDevice.setVpbdControlDeviceData(new BerOctetString(controlData));
-//            Registered registered = new Registered();
-//            Registered.Continuous continuous = new Registered.Continuous();
-//            SubscriptionMode subscriptionMode = new SubscriptionMode();
-//
-//            continuous.setDatexRegisteredUpdateDelayQty(new BerInteger(updateDelayQty));
-//            continuous.setDatexRegisteredStartTime(DsrcAsn1Utils.getRegisterStartTime());
-//            continuous.setDatexRegisteredEndTime(DsrcAsn1Utils.getRegisterEndTime());
-//            registered.setContinuous(continuous);
-//            subscriptionMode.setPeriodic(registered);
-//
-//            // ControlDeviceList set
-//            ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(1024);
-//            ControlDeviceList controlDeviceList = new ControlDeviceList();
-//            controlDeviceList.getControlDevice().add(controlDevice);
-//            controlDeviceList.encode(msgBuff);
-//
-//            // EndApplicationMessage set
-//            EndApplicationMessage endApplicationMessage =  new EndApplicationMessage();
-//            endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//            endApplicationMessage.setEndApplicationMessageMsg(new BerAny(msgBuff.getArray()));
-//
-//            SubscriptionData subscriptionData = new SubscriptionData();
-//            subscriptionData.setDatexSubscribePersistentBool(new BerBoolean(false));
-//            subscriptionData.setDatexSubscribeStatusCd(new BerEnum(0));         // 0: New, 1: Update
-//            subscriptionData.setDatexSubscribeMode(subscriptionMode);
-//            subscriptionData.setDatexSubscribePublishFormatCd(new BerEnum(3));  // 0: other, 1: ftp, 2: tftp, 3: dataPacket
-//            subscriptionData.setDatexSubscriptionPriorityNbr(new BerInteger(datexSubscriptionPriorityNbr));
-//            subscriptionData.setDatexSubscribeGuaranteeBool(new BerBoolean(true));
-//            subscriptionData.setDatexSubscribePdu(endApplicationMessage);
-//
-//            SubscriptionType subscriptionType = new SubscriptionType();
-//            subscriptionType.setSubscription(subscriptionData);
-//
-//            Subscription subscription = new Subscription();
-//            subscription.setDatexSubscribeSerialNbr(new BerInteger(subscribeSerialNbr));
-//            subscription.setDatexSubscribeType(subscriptionType);
-//
-//            PDUs pdus = new PDUs();
-//            pdus.setSubscription(subscription);
-//            byte[] auth = { (byte) eAuthInfo.AI_Subscription.getValue() };
-//            C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-//            c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//            c2c.setDatexDataPacketNumber(new BerInteger(dataPacketNumber));
-//            c2c.setDatexDataPacketPriorityNumber(new BerInteger(dataPacketPriorityNumber));
-//            c2c.setOptions(new HeaderOptions());
-//            c2c.setPdu(pdus);
-//
-//            ChannelFuture f = channel.writeAndFlush(c2c);
-//            f.awaitUninterruptibly();
-//            if (f.isDone() || f.isSuccess()) {
-//                log.info("LoginDeviceService.requestObuStatusInfo: {}, {}, {}, send ok", obj.getID(), obj.getMcuID(), updateDelayQty);
-//            }
-//            else {
-//                log.error("LoginDeviceService.requestObuStatusInfo: {}, {}, {}, send failed.", obj.getID(), obj.getMcuID(), updateDelayQty);
-//            }
-        }
-        catch(Exception e) {
-//            log.error("LoginDeviceService.requestObuStatusInfo: {}, {}, {}, Exception: {}", obj.getID(), obj.getMcuID(), updateDelayQty, e);
-        }
-        return true;
-    }
-
-}

+ 0 - 239
src/main/java/com/its/rota/server/xnet/server/process/service/MultiMediaDataService.java

@@ -1,239 +0,0 @@
-package com.its.rota.server.xnet.server.process.service;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class MultiMediaDataService {
-
-//    private RseOffrSectMapper rseOffrSectMapper;
-//    private ConcurrentHashMap<String, TbRseOffrSect> offrSectInfoMap = null;
-//    private ConcurrentHashMap<String, voDsrcOffrSectTraf> offrSectTrafMap = null;
-//    private List<TbRseOffrSectTraf> offrInfrHsList = null;
-
-    private static MultiMediaDataService _instance = null;
-
-    public static MultiMediaDataService getInstance() {
-        if (_instance == null) {
-            synchronized (MultiMediaDataService.class) {
-                if (_instance == null)
-                    _instance = new MultiMediaDataService();
-            }
-        }
-        return _instance;
-    }
-
-    public MultiMediaDataService() {
-//        this.rseOffrSectMapper = (RseOffrSectMapper) AppUtils.getBean(RseOffrSectMapper.class);
-//        this.offrSectInfoMap = new ConcurrentHashMap<String, TbRseOffrSect>();
-//        this.offrSectTrafMap = new ConcurrentHashMap<String, voDsrcOffrSectTraf>();
-//        this.offrInfrHsList = Collections.synchronizedList(new ArrayList<>());
-    }
-
-    /*
-    *  DSRC 제공구간 정보를 조회하고 DSRC 제어기에 설정한다.
-    *  기존에 존재하는 설정정보를 삭제하고 다시 설정
-    *  (데이터가 너무 많아 Delay 가 생길경우 최초에 한번만 실행하고 주기적으로 업데이트 하는 방법으로 수정가능)
-     */
-    private boolean loadOffrSectInfo() {
-        // DSRC 제공구간 목록을 조회해서 DSRC 제어기에 설정한다.
-        // 기존 제어기의 목록을 삭제한다.
-//        for (Map.Entry<String, TbRseCtlr> obj : AppRepository.getInstance().getCtlrMap().entrySet()) {
-//            obj.getValue().getOffrSectMap().clear();    // 제공구간 목록 초기화
-//            this.offrInfrHsList.clear();                // 제공이력 목록 삭제
-//        }
-//        try {
-//            List<TbRseOffrSect> list = this.rseOffrSectMapper.selectRseOffrSectAll();
-//            this.offrSectInfoMap.clear();
-//            for (TbRseOffrSect vo : list) {
-//                this.offrSectInfoMap.put(vo.getOFFR_SECT_ID(), vo);
-//                TbRseCtlr obj = AppRepository.getInstance().getCtlrMap().get(vo.getRSE_CTLR_NMBR());
-//                if (obj == null) {
-//                    log.error("MultiMediaDataService.loadOffrSectInfo: DSRC Not Found: {}", vo.getRSE_CTLR_NMBR());
-//                }
-//                else {
-//                    obj.getOffrSectMap().put(vo.getOFFR_SECT_ID(), vo);
-//                }
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("MultiMediaDataService.loadOffrSectInfo: Exception: {}", e.toString());
-//        }
-//        log.info("MultiMediaDataService.loadOffrSectInfo: {} EA.", this.offrSectInfoMap.size());
-        return true;
-    }
-
-    /*
-    *  DSRC 제공구간 소통정보를 조회한다.
-     */
-    private boolean loadOffrSectTraf() {
-        try {
-//            List<voDsrcOffrSectTraf> list = this.rseOffrSectMapper.selectRseOffrSectTraf();
-//            this.offrSectTrafMap.clear();
-//            for (voDsrcOffrSectTraf vo : list) {
-//                this.offrSectTrafMap.put(vo.getOFFR_SECT_ID(), vo);
-//            }
-        }
-        catch(Exception e) {
-            log.error("MultiMediaDataService.loadOffrSectTraf: Exception: {}", e.toString());
-        }
-//        log.info("MultiMediaDataService.loadOffrSectTraf: {} EA.", this.offrSectTrafMap.size());
-        return true;
-    }
-
-    public void makeMultimediaData() {
-
-        // DSRC 정보제공구간 목록 조회
-        loadOffrSectInfo();
-
-        // DSRC 정보제공구간 소통정보 조회
-        // DSRC 제공구간정보에 포함된 기본정보를 소통정보 조회하면서 함께 조회하기 때문에
-        // DSRC 정보제공구간정보는 조회하지 않는다.
-        loadOffrSectTraf();
-
-        String logKey = "x";
-
-        // 제어기별 Multimedia packet 생성
-//        for (Map.Entry<String, TbRseCtlr> entry : AppRepository.getInstance().getCtlrMap().entrySet()) {
-//            TbRseCtlr obj = entry.getValue();
-//            if (!logKey.equals("x")) {
-//                MDC.remove(logKey);
-//                MDC.clear();
-//            }
-//            logKey = obj.getLogKey();
-//            MDC.put("id", logKey);
-//            if (obj.getChannel() == null || obj.getNetState() != NET.LOGINED || !obj.getChannel().isActive()) {
-//                log.warn("MultiMediaDataService.makeMultimediaData: {}, {}, is not connected.", obj.getID(), obj.getRSE_ID());
-//                continue;
-//            }
-//
-//            if (obj.getOffrSectMap().size() == 0) {
-//                log.warn("MultiMediaDataService.makeMultimediaData: {}, {}, multimedia data not found.", obj.getID(), obj.getRSE_ID());
-//                continue;
-//            }
-//
-//            MultiMediaDataList multiMediaDataList = null;
-//            for (Map.Entry<String, TbRseOffrSect> sectEntry : obj.getOffrSectMap().entrySet()) {
-//                TbRseOffrSect sectInfo = sectEntry.getValue();
-//                voDsrcOffrSectTraf traf = this.offrSectTrafMap.get(sectInfo.getOFFR_SECT_ID());
-//                if (traf == null) {
-//                    continue;
-//                }
-//
-//                if (multiMediaDataList == null) {
-//                    multiMediaDataList = new MultiMediaDataList();
-//                }
-//
-//                String offrDt = SysUtils.getSysTime();
-//                String offrCont = traf.getOFFR_DRCT_NM() + " 방향 " + traf.getCMTR_GRAD_NM();
-//                byte[] infoTypeid = { 0x01 };
-//
-//                //0x00 : 정의 없음
-//                //0x01 : 소통정보
-//                //0x02 : 돌발/통제/도로상태/유고 정보
-//                //0x03 : 공지사항
-//                //0x04 : 정지영상
-//
-//                MultiMediaData multiMediaData = new MultiMediaData();
-//                MultiMediaData.LinkLinkIDNumber linkIDNumber = new MultiMediaData.LinkLinkIDNumber();
-//                linkIDNumber.getBerUTF8String().add(new BerUTF8String(traf.getOFFR_SECT_ID()));
-//
-//                multiMediaData.setDirectionID(new BerOctetString(traf.getOBU_ENTR_DRCT_NMBR().getBytes())); // directionID
-//                multiMediaData.setTrntMessageCreativeGeneralizedTime(new BerVisibleString(offrDt));         // trnt-MessageCreativeGeneralizedTime\
-//                multiMediaData.setLinkLinkIDNumber(linkIDNumber);                                           // link-LinkIDNumber
-//                multiMediaData.setInfoTypeID(new BerOctetString(infoTypeid));                               // infoTypeID
-//
-//                MultiMediaData.DataType dataType = new MultiMediaData.DataType();
-//                dataType.setMmdCharData(new CharObjectData(offrCont.getBytes()));
-//                multiMediaData.setDataType(dataType);                                                       // dataType
-//
-//                multiMediaDataList.getMultiMediaData().add(multiMediaData);
-//
-//                this.offrInfrHsList.add(new TbRseOffrSectTraf(traf.getOFFR_SECT_ID(), offrDt, offrCont));
-//            }
-//
-//            if (multiMediaDataList == null) {
-//                log.warn("MultiMediaDataService.makeMultimediaData: {}, {}, multimedia traffic data not found.", obj.getID(), obj.getRSE_ID());
-//                continue;
-//            }
-//
-//            EndApplicationMessage endMsg = makeEndApplicationMessage(obj, multiMediaDataList);
-//            if (endMsg == null) {
-//                continue;
-//            }
-//
-//            byte[] auth = { (byte) eAuthInfo.AI_Multimedia.getValue() };
-//            int packetNmbr = obj.getSeq().nextValue();
-//
-//            PublicationType publicationType = new PublicationType();
-//            publicationType.setDatexPublishData(endMsg);
-//
-//            PublicationData publicationData = new PublicationData();
-//            publicationData.setDatexPublishSubscribeSerialNbr(new BerInteger(packetNmbr));          // 요청 serial nmbr
-//            publicationData.setDatexPublishSerialNbr(new BerInteger(packetNmbr));     // 생성 serial nmbr
-//            publicationData.setDatexPublishLatePublicationFlag(new BerBoolean(true));
-//            publicationData.setDatexPublishType(publicationType);
-//
-//            PublishFormat.DatexPublishData publishData = new PublishFormat.DatexPublishData();
-//            publishData.getPublicationData().add(publicationData);
-//
-//            PublishFormat publishFormat = new PublishFormat();
-//            publishFormat.setDatexPublishData(publishData);
-//
-//            Publication publication = new Publication();
-//            publication.setDatexPublishFormat(publishFormat);
-//            publication.setDatexPublishGuaranteedBool(new BerBoolean(true));
-//
-//            C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-//            PDUs pdus = new PDUs();
-//            pdus.setPublication(publication);
-//            c2c.setDatexDataPacketNumber(new BerInteger(packetNmbr));
-//            c2c.setDatexDataPacketPriorityNumber(new BerInteger(1));
-//            c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//            c2c.setOptions(DsrcAsn1Utils.swapHeaderOptions(obj.getHeaderOptions()));
-//            c2c.setPdu(pdus);
-//
-//            ChannelFuture f = obj.getChannel().writeAndFlush(c2c);
-//            f.awaitUninterruptibly();
-//            if (f.isDone() || f.isSuccess()) {
-//                log.info("MultiMediaDataService.makeMultimediaData: {}, {}, multimedia data: {} EA, send ok", obj.getID(), obj.getRSE_ID(), multiMediaDataList.getMultiMediaData().size());
-//                //obj.putRegisteredCommands(c2c);
-//            } else {
-//                log.error("MultiMediaDataService.makeMultimediaData: {}, {}, multimedia data: {} EA, send failed. isDone: {}, isSuccess: {}",
-//                        obj.getID(), obj.getRSE_ID(), multiMediaDataList.getMultiMediaData().size(), f.isDone(), f.isSuccess());
-//            }
-//        }
-//        if (!logKey.equals("x")) {
-//            MDC.remove(logKey);
-//            MDC.clear();
-//        }
-//        // DSRC 제공구간 제공이력을 이력테이블에 저장한다.
-//        DbmsDataProcess dbmsDataProcess = (DbmsDataProcess) AppUtils.getBean(DbmsDataProcess.class);
-//        dbmsDataProcess.add(new DbmsData(DbmsDataType.DBMS_DATA_MULTIMEDIA_HS, false, this.offrInfrHsList));
-    }
-
-//    public EndApplicationMessage makeEndApplicationMessage(CenterDto obj, MultiMediaDataList multiMediaDataList) {
-//
-//        EndApplicationMessage endApplicationMessage = null;
-//        MDC.put("id", obj.getLogKey());
-//        try {
-//            if (multiMediaDataList != null) {
-//                int[] messageId = {1, 0, 15784, 5, 0, 1};
-//                ReverseByteArrayOutputStream msgBuff = new ReverseByteArrayOutputStream(2048);
-//                multiMediaDataList.encode(msgBuff);
-//
-//                endApplicationMessage = new EndApplicationMessage();
-//                endApplicationMessage.setEndApplicationMessageId(new BerObjectIdentifier(messageId));
-//                endApplicationMessage.setEndApplicationMessageMsg(new BerAny(msgBuff.getArray()));
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("MultiMediaDataService.makeEndApplicationMessage: {}, MultiMediaDataList: {}, Exception: {}", obj.getID(), multiMediaDataList, e);
-//            return null;
-//        }
-//        log.debug("MultiMediaDataService.makeEndApplicationMessage: {}, MultiMediaDataList: {}, EndApplicationMessage: {}", obj.getID(), multiMediaDataList, endApplicationMessage);
-//        MDC.remove(obj.getLogKey());
-//        MDC.clear();
-//        return endApplicationMessage;
-//    }
-
-}

+ 0 - 143
src/main/java/com/its/rota/server/xnet/server/process/service/OBUGatherInfoService.java

@@ -1,143 +0,0 @@
-package com.its.rota.server.xnet.server.process.service;
-
-import com.its.rota.server.common.SpringUtils;
-import com.its.rota.server.process.dbms.DbmsDataProcess;
-import lombok.Getter;
-import lombok.extern.slf4j.Slf4j;
-
-@Getter
-@Slf4j
-public class OBUGatherInfoService {
-
-//    private RseSectService rseSectService;
-    private DbmsDataProcess dbmsDataProcess;
-
-    private static OBUGatherInfoService _instance = null;
-
-    public static OBUGatherInfoService getInstance() {
-        if (_instance == null) {
-            synchronized (OBUGatherInfoService.class) {
-                if (_instance == null)
-                    _instance = new OBUGatherInfoService();
-            }
-        }
-        return _instance;
-    }
-
-    public OBUGatherInfoService() {
-        this.dbmsDataProcess = SpringUtils.getBean(DbmsDataProcess.class);
-//        this.rseSectService = (RseSectService) AppUtils.getBean(RseSectService.class);
-    }
-
-    /*
-     *  AI_Publication 메시지로 수신한 데이터중 OBU 수집 정보에 대한 데이터 Decoding
-     *  decoding 한 OBU 수집 정보를 데이터베이스에 저장하고,
-     *  OBU 가 지나온 RSE 를 이용하여 RSE 구간 소통정보를 생성한다.
-     */
-//    public boolean decoding_OBUGatherInfo(CenterDto obj, List<OBUGatherInfo> list) {
-//
-//        List<TbRseObuClct> obuGatherInfos = Collections.synchronizedList(new ArrayList<>());
-//
-//        log.debug("OBUGatherInfoService.decoding_OBUGatherInfo: {}, {}, {} EA", obj.getID(), obj.getRSE_ID(), list.size());
-//
-//        String dsrcId = obj.getID();
-//        try {
-//            for (OBUGatherInfo obuGatherInfo : list) {
-//                String individualId = "";
-//                String manufacturerId = "";
-//                if (obuGatherInfo.getRseIDNumber().getIndividualid() == null) {
-//                    log.warn("{}, ObuGatherInfo.getIndividualid NULL", obj.getID());
-//                    return false;
-//                }
-//                if (obuGatherInfo.getRseIDNumber().getManufacturerid() == null) {
-//                    log.warn("{}, ObuGatherInfo.getManufacturerid NULL", obj.getID());
-//                }
-//
-//                individualId = obuGatherInfo.getRseIDNumber().getIndividualid().toString();
-//                manufacturerId = obuGatherInfo.getRseIDNumber().getManufacturerid().toString();
-//
-//                // individualid == rseId
-//                String obuType = "0";
-//                String vehicleType = "0";
-//                String obuIdNumber = "0";
-//                String generationDate = "0";
-//                String generationTime = "0";
-//                if (obuGatherInfo.getObuType() != null) {
-//                    obuType = obuGatherInfo.getObuType().toString();
-//                }
-//                if (obuGatherInfo.getVehicleType() != null) {
-//                    vehicleType = obuGatherInfo.getVehicleType().toString();
-//                }
-//                if (obuGatherInfo.getObuIdNumber() != null) {
-//                    obuIdNumber = obuGatherInfo.getObuIdNumber().toString();
-//                }
-//                if (obuGatherInfo.getGenerationDate() != null) {
-//                    generationDate = obuGatherInfo.getGenerationDate().toString();
-//                }
-//                if (obuGatherInfo.getGenerationTime() != null) {
-//                    generationTime = obuGatherInfo.getGenerationTime().toString();
-//                }
-//
-//                // 이전 통과 RSE 를 찾는다
-//                //
-//
-//                String generationTm = generationDate+generationTime;
-//                TbRseObuClct voObu = new TbRseObuClct(obj.getID(), generationTm, obuIdNumber, vehicleType, obuType);
-//                obuGatherInfos.add(voObu);
-//
-//                log.debug("OBUGatherInfoService.decoding_OBUGatherInfo: {}, {}, {}, {}, voObu: {}",
-//                        obj.getID(), obj.getRSE_ID(), generationDate, generationTime, voObu.toString());
-//
-//                // 시작 RSE 에 해당하는 모든 구간에 대하여
-//                Iterator<String> startDsrcSectIds = AppRepository.getInstance().rseSectStartMap.get(dsrcId).iterator();
-//                synchronized (this.rseSectService.getDsrcObuPassMap()) {
-//                    while (startDsrcSectIds.hasNext()) {
-//                        String startDsrcSectId = startDsrcSectIds.next();
-//                        if (startDsrcSectId == null || startDsrcSectId.equals("")) {
-//                            continue;
-//                        }
-//                        // 모든 SECT_ID에 대하여 무조건 추가한다.
-//                        voDsrcObuPassInfo obuStartPassInfo = new voDsrcObuPassInfo();
-//                        obuStartPassInfo.setObuId(obuIdNumber);
-//                        obuStartPassInfo.setStartDsrcPassTm(generationTm);
-//                        this.rseSectService.getDsrcObuPassMap().get(startDsrcSectId).put(obuIdNumber, obuStartPassInfo);
-//                    }
-//                }
-//
-//                // 종료 RSE 에 해당하는 모든 구간에 대하여
-//                Iterator<String> endDsrcSectIds = AppRepository.getInstance().rseSectEndMap.get(dsrcId).iterator();
-//                synchronized (this.rseSectService.getDsrcObuPassMap()) {
-//                    while (endDsrcSectIds.hasNext()) {
-//                        String endDsrcSectId = endDsrcSectIds.next();
-//                        if (endDsrcSectId == null || endDsrcSectId.equals("")) {
-//                            continue;
-//                        }
-//                        // 종료 SECT_ID에 대하여 이전 통과정보가 존재하지 않으면 추가, 존재하면 통과종료시각 업데이트
-//                        Map<String, voDsrcObuPassInfo> passInfo = this.rseSectService.getDsrcObuPassMap().get(endDsrcSectId);
-//                        if (passInfo == null || !passInfo.containsKey(obuIdNumber)) {
-//                            // 존재하지 않으면 추가한다.
-//                            voDsrcObuPassInfo obuEndPassInfo = new voDsrcObuPassInfo();
-//                            obuEndPassInfo.setObuId(obuIdNumber);
-//                            obuEndPassInfo.setEndDsrcPassTm(generationTm);
-//                            this.rseSectService.getDsrcObuPassMap().get(endDsrcSectId).put(obuIdNumber, obuEndPassInfo);
-//                            continue;
-//                        }
-//
-//                        // 존재하면 종료 DSRC 통과시각을 업데이트 한다.
-//                        passInfo.get(obuIdNumber).setEndDsrcPassTm(generationTm);
-//                    }
-//                }
-//            }
-//        }
-//        catch(Exception e) {
-//            log.error("{}", e.toString());
-//        }
-//
-//        if (obuGatherInfos.size() > 0) {
-//            // OBU 수집정보를 데이터베이스에 저장
-//            this.dbmsDataProcess.add(new DbmsData(DbmsDataType.DBMS_DATA_OBU_GATHER_LOG, false, (Object)obuGatherInfos));
-//        }
-//        return true;
-//    }
-
-}

+ 0 - 9
src/main/java/com/its/rota/server/xnet/server/process/service/SubscriptionService.java

@@ -1,9 +0,0 @@
-package com.its.rota.server.xnet.server.process.service;
-
-import com.beanit.its.Subscription;
-import com.its.rota.server.dto.CenterDto;
-import io.netty.channel.Channel;
-
-public interface SubscriptionService {
-    boolean response(CenterDto obj, Channel channel, int objectId, Subscription subscription);
-}

+ 0 - 22
src/main/java/com/its/rota/server/xnet/server/process/service/UserCommandService.java

@@ -1,22 +0,0 @@
-package com.its.rota.server.xnet.server.process.service;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class UserCommandService {
-    private static UserCommandService _instance = null;
-
-    public static UserCommandService getInstance() {
-        if (_instance == null) {
-            synchronized (UserCommandService.class) {
-                if (_instance == null)
-                    _instance = new UserCommandService();
-            }
-        }
-        return _instance;
-    }
-
-    public UserCommandService() {
-    }
-
-}

+ 0 - 137
src/main/java/com/its/rota/server/xnet/server/process/service/impl/SubscriptionRegisterService.java

@@ -1,137 +0,0 @@
-package com.its.rota.server.xnet.server.process.service.impl;
-
-import com.beanit.its.Registered;
-import com.beanit.its.Subscription;
-import com.beanit.its.SubscriptionData;
-import com.its.app.common.utils.NettyUtils;
-import com.its.rota.server.dto.CenterDto;
-import com.its.rota.server.xnet.server.process.service.SubscriptionService;
-import io.netty.channel.Channel;
-import lombok.extern.slf4j.Slf4j;
-
-import java.io.ByteArrayInputStream;
-
-@Slf4j
-public class SubscriptionRegisterService implements SubscriptionService {
-    private static SubscriptionRegisterService _instance = null;
-
-    public static SubscriptionRegisterService getInstance() {
-        if (_instance == null) {
-            synchronized (SubscriptionRegisterService.class) {
-                if (_instance == null)
-                    _instance = new SubscriptionRegisterService();
-            }
-        }
-        return _instance;
-    }
-
-    public SubscriptionRegisterService() {
-    }
-
-    @Override
-    public boolean response(CenterDto obj, Channel channel, int objectId, Subscription subscription) {
-        /*
-         *  SubscriptionResponse 에서 호출
-         */
-        String ipAddress = NettyUtils.getRemoteIpAddress(channel);
-        //log.info("SubscriptionRegisterService.response: {}. ObjectId: {}", ipAddress, objectId);
-
-//        if (objectId == eObjectId.OBJ_MultiMediaData.getValue()) {
-//            return multiMediaDataResponse(obj, channel, objectId, subscription);
-//        }
-//
-//        if (objectId != eObjectId.OBJ_ControlDevice.getValue()) {
-//            log.error("SubscriptionRegisterService.response: {}, Unknown ObjectId: {}, Subscription: {}", ipAddress, objectId, subscription.toString());
-//            return false;
-//        }
-
-        try {
-            Registered registered = null;
-            int subscribeSerialNbr = subscription.getDatexSubscribeSerialNbr().value.intValue();
-            SubscriptionData subscriptionData = subscription.getDatexSubscribeType().getSubscription();
-
-            if (subscriptionData.getDatexSubscribeMode().getEventDriven() != null) {
-                registered = subscriptionData.getDatexSubscribeMode().getEventDriven();
-                log.info("SubscriptionRegisterService.response: {}. EventDriven. subscribeSerialNbr: {}", ipAddress, subscribeSerialNbr);
-            }
-            else if (subscriptionData.getDatexSubscribeMode().getPeriodic() != null) {
-                registered = subscriptionData.getDatexSubscribeMode().getPeriodic();
-                log.info("SubscriptionRegisterService.response: {}. Periodic. subscribeSerialNbr: {}", ipAddress, subscribeSerialNbr);
-            }
-
-            if (registered != null) {
-                // 필요하면 목록에 저장하고 있다가 스케쥴러에 의해 수행될수 있도록 하자.
-                // 서버 모드에서는 특별히 처리할 게 없다.
-                ByteArrayInputStream berInputStream = new ByteArrayInputStream(subscriptionData.getDatexSubscribePdu().getEndApplicationMessageMsg().value);
-//                ControlDeviceList devices = new ControlDeviceList();
-//                devices.decode(berInputStream);
-//                List<ControlDevice> list = devices.getControlDevice();
-//                for (ControlDevice controlDevice : list) {
-//                    if (controlDevice.getVpbdControlDeviceData() != null) {
-//                        eControlDevice e = eControlDevice.getByValue(controlDevice.getVpbdControlID().value[0]);
-//                        log.info("SubscriptionRegisterService.response: {}", e.toString());
-//                        switch(e) {
-//                            case Control_Command:        //(0x01, "Control_Command"),
-//                                break;
-//                            case Control_BasicInfo:      //(0x02, "Control_BasicInfo"),
-//                                break;
-//                            case Control_StatusRequest:  //(0x03, "Control_StatusRequest"),
-//                                ControlDeviceService.getInstance().decoding_ControlDevice_Status_ITTelecom(obj, controlDevice);
-//                                break;
-//                            case Control_InfoRequest:    //(0x04, "Control_InfoRequest"),
-//                                DSRCTrafficInfoRequest dsrcTrafficInfoRequest = new DSRCTrafficInfoRequest();
-//                                ByteArrayInputStream deviceStream = new ByteArrayInputStream(controlDevice.getVpbdControlDeviceData().value);
-//                                dsrcTrafficInfoRequest.decode(deviceStream);
-//                                log.info("SubscriptionRegisterService.response: {}", dsrcTrafficInfoRequest.toString());
-//                                break;
-//                            case Control_EnterDirInfo:   //(0x05, "Control_EnterDirInfo"),
-//                                break;
-//                            case Control_DisconnectInfo: //(0x06, "Control_DisconnectInfo");
-//                                break;
-//                        }
-//                    }
-//                }
-            }
-        }
-        catch(Exception e) {
-            log.error("SubscriptionRegisterService.response: {}, Exception: {}", ipAddress, e.toString());
-        }
-        return true;
-    }
-
-    private boolean multiMediaDataResponse(CenterDto obj, Channel channel, int objectId, Subscription subscription) {
-        String ipAddress = NettyUtils.getRemoteIpAddress(channel);
-//        if (objectId != eObjectId.OBJ_MultiMediaData.getValue()) {
-//            log.error("SubscriptionRegisterService.multiMediaDataResponse: {}, OBJ_MultiMediaData ObjectId: {}, Subscription: {}", ipAddress, objectId, subscription.toString());
-//            return false;
-//        }
-        try {
-            Registered registered = null;
-            int subscribeSerialNbr = subscription.getDatexSubscribeSerialNbr().value.intValue();
-            SubscriptionData subscriptionData = subscription.getDatexSubscribeType().getSubscription();
-
-            if (subscriptionData.getDatexSubscribeMode().getEventDriven() != null) {
-                registered = subscriptionData.getDatexSubscribeMode().getEventDriven();
-                //log.info("SubscriptionRegisterService.multiMediaDataResponse: {}. EventDriven. subscribeSerialNbr: {}", ipAddress, subscribeSerialNbr);
-            }
-            else if (subscriptionData.getDatexSubscribeMode().getPeriodic() != null) {
-                registered = subscriptionData.getDatexSubscribeMode().getPeriodic();
-                //log.info("SubscriptionRegisterService.multiMediaDataResponse: {}. Periodic. subscribeSerialNbr: {}", ipAddress, subscribeSerialNbr);
-            }
-
-            if (registered != null) {
-//                ByteArrayInputStream berInputStream = new ByteArrayInputStream(subscriptionData.getDatexSubscribePdu().getEndApplicationMessageMsg().value);
-//                MultiMediaDataList dataOrg = new MultiMediaDataList();
-//                dataOrg.decode(berInputStream);
-//                List<MultiMediaData> dataLists = dataOrg.getMultiMediaData();
-//                for (MultiMediaData media : dataLists) {
-//                    log.info("{}", media);
-//                }
-            }
-        }
-        catch(Exception e) {
-            log.error("SubscriptionRegisterService.multiMediaDataResponse: {}, Exception: {}", ipAddress, e.toString());
-        }
-        return true;
-    }
-}

+ 0 - 132
src/main/java/com/its/rota/server/xnet/server/process/service/impl/SubscriptionSingleService.java

@@ -1,132 +0,0 @@
-package com.its.rota.server.xnet.server.process.service.impl;
-
-import com.beanit.asn1bean.ber.types.BerInteger;
-import com.beanit.asn1bean.ber.types.BerOctetString;
-import com.beanit.its.*;
-import com.its.app.common.utils.NettyUtils;
-import com.its.rota.server.dto.CenterDto;
-import com.its.rota.server.xnet.server.process.service.SubscriptionService;
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelFuture;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class SubscriptionSingleService implements SubscriptionService {
-    private static SubscriptionSingleService _instance = null;
-
-    public static SubscriptionSingleService getInstance() {
-        if (_instance == null) {
-            synchronized (SubscriptionSingleService.class) {
-                if (_instance == null)
-                    _instance = new SubscriptionSingleService();
-            }
-        }
-        return _instance;
-    }
-
-    public SubscriptionSingleService() {
-    }
-
-    @Override
-    public boolean response(CenterDto obj, Channel channel, int objectId, Subscription subscription) {
-        /*
-        *  SubscriptionResponse 에서 호출
-         */
-        String ipAddress = NettyUtils.getRemoteIpAddress(channel);
-        log.info("SubscriptionSingleService.response: {}. SubscriptionSingleService: ObjectId: {}, Subscription: {}", ipAddress, objectId, subscription.toString());
-
-//        if (objectId != eObjectId.OBJ_ControlDevice.getValue()) {
-//            log.error("{}. SubscriptionSingleService.response: unknown ObjectId: {}, Subscription: {}", ipAddress, objectId, subscription.toString());
-//            return false;
-//        }
-
-        boolean isMultimedia = false;
-        Publication publication = null;
-        int serialNmbr = subscription.getDatexSubscribeSerialNbr().value.intValue();
-        byte[] auth = null;//{ (byte) eAuthInfo.AI_NonCryptObu.getValue() };
-
-        try {
-            SubscriptionData subscriptionData = subscription.getDatexSubscribeType().getSubscription();
-//            ControlDeviceList list = new ControlDeviceList();
-//            byte[] inBytes = subscriptionData.getDatexSubscribePdu().getEndApplicationMessageMsg().value;
-//            list.decode(new ByteArrayInputStream(inBytes, 0, inBytes.length));
-//            List<ControlDevice> objs = list.getControlDevice();
-//            for (ControlDevice device : objs) {
-//                eControlDevice requestType = eControlDevice.getByValue(device.getVpbdControlID().value[0]);
-//                if (requestType == null || requestType.getValue() != eControlDevice.Control_InfoRequest.getValue())
-//                    continue;
-//
-//                try {
-//                    DSRCTrafficInfoRequest request = new DSRCTrafficInfoRequest();
-//                    byte[] datas = device.getVpbdControlDeviceData().value;
-//                    request.decode(new ByteArrayInputStream(datas, 0, datas.length));
-//                    eControlRequest queryType = eControlRequest.getByValue(request.getQueryType().value.intValue());
-//                    ControlDevice resDevice = ControlDeviceService.getInstance().makeControlDevice_BasicBaseInfo(obj, queryType);
-//                    EndApplicationMessage endMsg = ControlDeviceService.getInstance().makeEndApplicationMessage(obj, resDevice);
-//                    if (endMsg == null) {
-//                        log.error("{}. SubscriptionSingleService: EndApplicationMessage error, DSRCTrafficInfoRequest: {}", ipAddress, request.toString());
-//                        continue;
-//                    }
-//
-//                    PublicationType publicationType = new PublicationType();
-//                    publicationType.setDatexPublishData(endMsg);
-//
-//                    PublicationData publicationData = new PublicationData();
-//                    publicationData.setDatexPublishSubscribeSerialNbr(new BerInteger(serialNmbr));          // 요청 serial nmbr
-//                    publicationData.setDatexPublishSerialNbr(new BerInteger(obj.getSeq().nextValue()));     // 생성 serial nmbr
-//                    publicationData.setDatexPublishLatePublicationFlag(new BerBoolean(true));
-//                    publicationData.setDatexPublishType(publicationType);
-//
-//                    PublishFormat.DatexPublishData publishData = new PublishFormat.DatexPublishData();
-//                    publishData.getPublicationData().add(publicationData);
-//
-//                    PublishFormat publishFormat = new PublishFormat();
-//                    publishFormat.setDatexPublishData(publishData);
-//
-//                    publication = new Publication();
-//                    publication.setDatexPublishFormat(publishFormat);
-//                    publication.setDatexPublishGuaranteedBool(new BerBoolean(true));
-//                    if (queryType.getValue() == eControlRequest.Request_MulticastInfo.getValue()) {
-//                        auth[0] = (byte)eAuthInfo.AI_Multimedia.getValue();
-//                        isMultimedia = true;
-//                    }
-//                }
-//                catch (Exception e) {
-//                    log.error("{}. SubscriptionSingleService: SubscriptionData: {}, ControlDevice: {}, Exception: {}", ipAddress, subscriptionData.toString(),  device.toString(), e);
-//                }
-//            }
-        } catch (Exception e) {
-            log.error("{}. SubscriptionSingleService: Subscription: {}, Exception: {}", ipAddress, subscription.toString(), e);
-        }
-        if (publication == null) {
-            return false;
-        }
-
-        int packetNmbr = 0;//obj.getSeq().nextValue();
-        C2CAuthenticatedMessage c2c = new C2CAuthenticatedMessage();
-        PDUs pdus = new PDUs();
-        pdus.setPublication(publication);
-        c2c.setDatexDataPacketNumber(new BerInteger(packetNmbr));
-        c2c.setDatexDataPacketPriorityNumber(new BerInteger(0));
-        c2c.setDatexAuthenticationInfoText(new BerOctetString(auth));
-//        c2c.setOptions(DsrcAsn1Utils.swapHeaderOptions(obj.getHeaderOptions()));
-        c2c.setPdu(pdus);
-
-//        log.info("SubscriptionSingleService: {}, C2CAuth: {}", obj.getID(), c2c);
-
-        ChannelFuture f = channel.writeAndFlush(c2c);
-        if (f.isSuccess()) {
-//            obj.putRegisteredCommands(c2c);
-        } else {
-//            log.error("SubscriptionSingleService: {}, Exception: {}", obj.getID(), c2c);
-        }
-
-        if (isMultimedia) {
-            // TODO: Multimedia 정보 내려보낸 내용을 이력으로 저장한다.
-            //DsrcAsn1ServerDataProcess dsrcAsn1ServerDataProcess  = (DsrcAsn1ServerDataProcess) BeanUtils.getBean(DsrcAsn1ServerDataProcess.class);
-            //dsrcAsn1ServerDataProcess.add(new DsrcAsn1ServerData(DsrcAsn1ServerData.DATA_TYPE_MULTIMEDIA_HS, obj, null, (Object) command));
-        }
-        return true;
-    }
-
-}

+ 3 - 5
src/test/java/com/its/rota/server/ItsRotaServerApplicationTests.java

@@ -4,6 +4,7 @@ import com.beanit.asn1bean.ber.types.BerOctetString;
 import com.beanit.its.C2CAuthenticatedMessage;
 import com.beanit.its.DatexDataPacket;
 import com.its.app.common.utils.ByteUtils;
+import com.its.app.common.utils.SysUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.jupiter.api.Test;
 
@@ -44,11 +45,8 @@ public class ItsRotaServerApplicationTests {
 
     @Test
     public void test() {
-        //1720599437901
-        //1720599437
-        //106844625303900
-        long start = System.currentTimeMillis();
-        log.error("[{}, {}, {}]", start, TimeUnit.SECONDS.convert(start, TimeUnit.MILLISECONDS), System.nanoTime());
+        String linkId = "12345";
+        log.error("[{}]", SysUtils.subString(linkId, 1, 4));
     }
     @Test
     public void test1() {