shjung 2 жил өмнө
parent
commit
c54cc6731f
34 өөрчлөгдсөн 1065 нэмэгдсэн , 247 устгасан
  1. 87 0
      src/main/java/com/its/app/utils/crc/AlgoParams.java
  2. 57 0
      src/main/java/com/its/app/utils/crc/Crc16.java
  3. 20 0
      src/main/java/com/its/app/utils/crc/Crc32.java
  4. 12 0
      src/main/java/com/its/app/utils/crc/Crc64.java
  5. 21 0
      src/main/java/com/its/app/utils/crc/Crc8.java
  6. 91 0
      src/main/java/com/its/app/utils/crc/CrcCalculator.java
  7. 20 0
      src/main/java/com/its/app/utils/crc/CrcHelper.java
  8. 42 0
      src/main/java/com/its/app/utils/crc/Main.java
  9. 3 3
      src/main/java/com/its/vms/dto/TbVmsCtlrDto.java
  10. 2 0
      src/main/java/com/its/vms/service/VmsManageService.java
  11. 191 125
      src/main/java/com/its/vms/ui/SubUI.java
  12. 17 9
      src/main/java/com/its/vms/xnettcp/vms/process/TcpServerRecvDataProcess.java
  13. 44 0
      src/main/java/com/its/vms/xnettcp/vms/protocol/enums/eVmsProtocolVersion.java
  14. 12 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqBlank.java
  15. 13 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDataDownload.java
  16. 13 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDataUpload.java
  17. 12 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDisplayDefaultForm.java
  18. 21 9
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDisplayFromId.java
  19. 12 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDisplayModuleStatus.java
  20. 12 4
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDownloadForm.java
  21. 13 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDownloadFormSchedule.java
  22. 20 7
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqFormDataDisplay.java
  23. 12 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqParameter.java
  24. 12 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqPowerModuleStatus.java
  25. 12 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqStatus.java
  26. 12 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqStatusControl.java
  27. 21 9
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqStopImage.java
  28. 12 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqUploadCurrentDisplayForm.java
  29. 12 3
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqUploadFormSchedule.java
  30. 184 0
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/dle/Crc16.java
  31. 8 13
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/dle/VmsDleFrameHead.java
  32. 16 22
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/dle/VmsDleFramePacket.java
  33. 14 10
      src/main/java/com/its/vms/xnettcp/vms/protocol/impl/std/VmsStdFrameHead.java
  34. 15 0
      src/test/java/com/its/app/VmsCommServerApplicationTests.java

+ 87 - 0
src/main/java/com/its/app/utils/crc/AlgoParams.java

@@ -0,0 +1,87 @@
+package com.its.app.utils.crc;
+
+/**
+ * Created by anthony on 11.05.2017.
+ */
+    public class AlgoParams
+    {
+
+    public AlgoParams(String name, int hashSize, long poly, long init, boolean refIn, boolean refOut, long xorOut, long check)
+    {
+        Name = name;
+        Check = check;
+        Init = init;
+        Poly = poly;
+        RefIn = refIn;
+        RefOut = refOut;
+        XorOut = xorOut;
+        HashSize = hashSize;
+    }
+
+    /// <summary>
+    /// This field is not strictly part of the definition, and, in
+    /// the event of an inconsistency between this field and the other
+    /// field, the other fields take precedence.This field is a check
+    /// value that can be used as a weak validator of implementations of
+    /// the algorithm.The field contains the checksum obtained when the
+    /// ASCII string "123456789" is fed through the specified algorithm
+    /// (i.e. 313233... (hexadecimal)).
+    /// </summary>
+    public long Check;
+
+    /// <summary>
+    /// This is hash size.
+    /// </summary>
+    public int HashSize;
+
+    /// <summary>
+    /// This parameter specifies the initial value of the register
+    /// when the algorithm starts.This is the value that is to be assigned
+    /// to the register in the direct table algorithm. In the table
+    /// algorithm, we may think of the register always commencing with the
+    /// value zero, and this value being XORed into the register after the
+    /// N'th bit iteration. This parameter should be specified as a
+    /// hexadecimal number.
+    /// </summary>
+    public long Init;
+
+    /// <summary>
+    /// This is a name given to the algorithm. A string value.
+    /// </summary>
+    public String Name;
+
+    /// <summary>
+    /// This parameter is the poly. This is a binary value that
+    /// should be specified as a hexadecimal number.The top bit of the
+    /// poly should be omitted.For example, if the poly is 10110, you
+    /// should specify 06. An important aspect of this parameter is that it
+    /// represents the unreflected poly; the bottom bit of this parameter
+    /// is always the LSB of the divisor during the division regardless of
+    /// whether the algorithm being modelled is reflected.
+    /// </summary>
+    public long Poly;
+
+    /// <summary>
+    /// This is a boolean parameter. If it is FALSE, input bytes are
+    /// processed with bit 7 being treated as the most significant bit
+    /// (MSB) and bit 0 being treated as the least significant bit.If this
+    /// parameter is FALSE, each byte is reflected before being processed.
+    /// </summary>
+    public boolean RefIn;
+
+    /// <summary>
+    /// This is a boolean parameter. If it is set to FALSE, the
+    /// final value in the register is fed into the XOROUT stage directly,
+    /// otherwise, if this parameter is TRUE, the final register value is
+    /// reflected first.
+    /// </summary>
+    public boolean RefOut;
+
+    /// <summary>
+    /// This is an W-bit value that should be specified as a
+    /// hexadecimal number.It is XORed to the final register value (after
+    /// the REFOUT) stage before the value is returned as the official
+    /// checksum.
+    /// </summary>
+    public long XorOut;
+}

+ 57 - 0
src/main/java/com/its/app/utils/crc/Crc16.java

@@ -0,0 +1,57 @@
+package com.its.app.utils.crc;
+
+/**
+ * Created by anthony on 15.05.2017.
+ */
+public class Crc16 {
+    public static AlgoParams Crc16CcittFalse = new AlgoParams("CRC-16/CCITT-FALSE", 16, 0x1021, 0xFFFF, false, false, 0x0, 0x29B1);
+    public static AlgoParams Crc16Arc = new AlgoParams("CRC-16/ARC", 16, 0x8005, 0x0, true, true, 0x0, 0xBB3D);
+    public static AlgoParams Crc16AugCcitt = new AlgoParams("CRC-16/AUG-CCITT", 16, 0x1021, 0x1D0F, false, false, 0x0, 0xE5CC);
+    public static AlgoParams Crc16Buypass = new AlgoParams("CRC-16/BUYPASS", 16, 0x8005, 0x0, false, false, 0x0, 0xFEE8);
+    public static AlgoParams Crc16Cdma2000 = new AlgoParams("CRC-16/CDMA2000", 16, 0xC867, 0xFFFF, false, false, 0x0, 0x4C06);
+    public static AlgoParams Crc16Dds110 = new AlgoParams("CRC-16/DDS-110", 16, 0x8005, 0x800D, false, false, 0x0, 0x9ECF);
+    public static AlgoParams Crc16DectR = new AlgoParams("CRC-16/DECT-R", 16, 0x589, 0x0, false, false, 0x1, 0x7E);
+    public static AlgoParams Crc16DectX = new AlgoParams("CRC-16/DECT-X", 16, 0x589, 0x0, false, false, 0x0, 0x7F);
+    public static AlgoParams Crc16Dnp = new AlgoParams("CRC-16/DNP", 16, 0x3D65, 0x0, true, true, 0xFFFF, 0xEA82);
+    public static AlgoParams Crc16En13757 = new AlgoParams("CRC-16/EN-13757", 16, 0x3D65, 0x0, false, false, 0xFFFF, 0xC2B7);
+    public static AlgoParams Crc16Genibus = new AlgoParams("CRC-16/GENIBUS", 16, 0x1021, 0xFFFF, false, false, 0xFFFF, 0xD64E);
+    public static AlgoParams Crc16Maxim = new AlgoParams("CRC-16/MAXIM", 16, 0x8005, 0x0, true, true, 0xFFFF, 0x44C2);
+    public static AlgoParams Crc16Mcrf4Xx = new AlgoParams("CRC-16/MCRF4XX", 16, 0x1021, 0xFFFF, true, true, 0x0, 0x6F91);
+    public static AlgoParams Crc16Riello = new AlgoParams("CRC-16/RIELLO", 16, 0x1021, 0xB2AA, true, true, 0x0, 0x63D0);
+    public static AlgoParams Crc16T10Dif = new AlgoParams("CRC-16/T10-DIF", 16, 0x8BB7, 0x0, false, false, 0x0, 0xD0DB);
+    public static AlgoParams Crc16Teledisk = new AlgoParams("CRC-16/TELEDISK", 16, 0xA097, 0x0, false, false, 0x0, 0xFB3);
+    public static AlgoParams Crc16Tms37157 = new AlgoParams("CRC-16/TMS37157", 16, 0x1021, 0x89EC, true, true, 0x0, 0x26B1);
+    public static AlgoParams Crc16Usb = new AlgoParams("CRC-16/USB", 16, 0x8005, 0xFFFF, true, true, 0xFFFF, 0xB4C8);
+    public static AlgoParams CrcA = new AlgoParams("CRC-A", 16, 0x1021, 0xc6c6, true, true, 0x0, 0xBF05);
+    public static AlgoParams Crc16Kermit = new AlgoParams("CRC-16/KERMIT", 16, 0x1021, 0x0, true, true, 0x0, 0x2189);
+    public static AlgoParams Crc16Modbus = new AlgoParams("CRC-16/MODBUS", 16, 0x8005, 0xFFFF, true, true, 0x0, 0x4B37);
+    public static AlgoParams Crc16X25 = new AlgoParams("CRC-16/X-25", 16, 0x1021, 0xFFFF, true, true, 0xFFFF, 0x906E);
+    public static AlgoParams Crc16Xmodem = new AlgoParams("CRC-16/XMODEM", 16, 0x1021, 0x0, false, false, 0x0, 0x31C3);
+
+    public static final AlgoParams[] Params = new AlgoParams[]
+            {
+                    Crc16CcittFalse,
+                    Crc16Arc,
+                    Crc16AugCcitt,
+                    Crc16Buypass,
+                    Crc16Cdma2000,
+                    Crc16Dds110,
+                    Crc16DectR,
+                    Crc16DectX,
+                    Crc16Dnp,
+                    Crc16En13757,
+                    Crc16Genibus,
+                    Crc16Maxim,
+                    Crc16Mcrf4Xx,
+                    Crc16Riello,
+                    Crc16T10Dif,
+                    Crc16Teledisk,
+                    Crc16Tms37157,
+                    Crc16Usb,
+                    CrcA,
+                    Crc16Kermit,
+                    Crc16Modbus,
+                    Crc16X25,
+                    Crc16Xmodem,
+            };
+}

+ 20 - 0
src/main/java/com/its/app/utils/crc/Crc32.java

@@ -0,0 +1,20 @@
+package com.its.app.utils.crc;
+
+/**
+ * Created by anthony on 15.05.2017.
+ */
+public class Crc32 {
+    public static AlgoParams Crc32 = new AlgoParams("CRC-32", 32, 0x04C11DB7L, 0xFFFFFFFFL, true, true, 0xFFFFFFFFL, 0xCBF43926L);
+    public static AlgoParams Crc32Bzip2 = new AlgoParams("CRC-32/BZIP2", 32, 0x04C11DB7L, 0xFFFFFFFFL, false, false, 0xFFFFFFFFL, 0xFC891918L);
+    public static AlgoParams Crc32C = new AlgoParams("CRC-32C", 32, 0x1EDC6F41L, 0xFFFFFFFFL, true, true, 0xFFFFFFFFL, 0xE3069283L);
+    public static AlgoParams Crc32D = new AlgoParams("CRC-32D", 32, 0xA833982BL, 0xFFFFFFFFL, true, true, 0xFFFFFFFFL, 0x87315576L);
+    public static AlgoParams Crc32Jamcrc = new AlgoParams("CRC-32/JAMCRC", 32, 0x04C11DB7L, 0xFFFFFFFFL, true, true, 0x00000000L, 0x340BC6D9L);
+    public static AlgoParams Crc32Mpeg2 = new AlgoParams("CRC-32/MPEG-2", 32, 0x04C11DB7L, 0xFFFFFFFFL, false, false, 0x00000000L, 0x0376E6E7L);
+    public static AlgoParams Crc32Posix = new AlgoParams("CRC-32/POSIX", 32, 0x04C11DB7L, 0x00000000L, false, false, 0xFFFFFFFFL, 0x765E7680L);
+    public static AlgoParams Crc32Q = new AlgoParams("CRC-32Q", 32, 0x814141ABL, 0x00000000L, false, false, 0x00000000L, 0x3010BF7FL);
+    public static AlgoParams Crc32Xfer = new AlgoParams("CRC-32/XFER", 32, 0x000000AFL, 0x00000000L, false, false, 0x00000000L, 0xBD0BE338L);
+
+    public static final AlgoParams[] Params = new AlgoParams[]{
+            Crc32, Crc32Bzip2, Crc32C, Crc32D, Crc32Jamcrc, Crc32Mpeg2, Crc32Posix, Crc32Q, Crc32Xfer
+    };
+}

+ 12 - 0
src/main/java/com/its/app/utils/crc/Crc64.java

@@ -0,0 +1,12 @@
+package com.its.app.utils.crc;
+
+public class Crc64 {
+    public static AlgoParams Crc64 = new AlgoParams("CRC-64",64, 0x42F0E1EBA9EA3693L, 0x00000000L, false, false, 0x00000000L, 0x6C40DF5F0B497347L);
+    public static AlgoParams Crc64We = new AlgoParams("CRC-64/WE", 64, 0x42F0E1EBA9EA3693L, 0xFFFFFFFFFFFFFFFFL, false, false, 0xFFFFFFFFFFFFFFFFL,0x62EC59E3F1A4F00AL);
+    public static AlgoParams Crc64Xz = new AlgoParams("CRC-64/XZ", 64, 0x42F0E1EBA9EA3693L, 0xFFFFFFFFFFFFFFFFL, true, true, 0xFFFFFFFFFFFFFFFFL,0x995DC9BBDF1939FAL);
+
+
+    public static final AlgoParams[] Params = new AlgoParams[]{
+            Crc64, Crc64We, Crc64Xz
+    };
+}

+ 21 - 0
src/main/java/com/its/app/utils/crc/Crc8.java

@@ -0,0 +1,21 @@
+package com.its.app.utils.crc;
+
+/**
+ * Created by anthony on 15.05.2017.
+ */
+public class Crc8 {
+    public static AlgoParams Crc8 = new AlgoParams("CRC-8", 8, 0x7, 0x0, false, false, 0x0, 0xF4);
+    public static AlgoParams Crc8Cdma2000 = new AlgoParams("CRC-8/CDMA2000", 8, 0x9B, 0xFF, false, false, 0x0, 0xDA);
+    public static AlgoParams Crc8Darc = new AlgoParams("CRC-8/DARC", 8, 0x39, 0x0, true, true, 0x0, 0x15);
+    public static AlgoParams Crc8DvbS2 = new AlgoParams("CRC-8/DVB-S2", 8, 0xD5, 0x0, false, false, 0x0, 0xBC);
+    public static AlgoParams Crc8Ebu = new AlgoParams("CRC-8/EBU", 8, 0x1D, 0xFF, true, true, 0x0, 0x97);
+    public static AlgoParams Crc8ICode = new AlgoParams("CRC-8/I-CODE", 8, 0x1D, 0xFD, false, false, 0x0, 0x7E);
+    public static AlgoParams Crc8Itu = new AlgoParams("CRC-8/ITU", 8, 0x7, 0x0, false, false, 0x55, 0xA1);
+    public static AlgoParams Crc8Maxim = new AlgoParams("CRC-8/MAXIM", 8, 0x31, 0x0, true, true, 0x0, 0xA1);
+    public static AlgoParams Crc8Rohc = new AlgoParams("CRC-8/ROHC", 8, 0x7, 0xFF, true, true, 0x0, 0xD0);
+    public static AlgoParams Crc8Wcdma = new AlgoParams("CRC-8/WCDMA", 8, 0x9B, 0x0, true, true, 0x0, 0x25);
+
+    public static final AlgoParams[] Params = new AlgoParams[]{
+            Crc8, Crc8Cdma2000, Crc8Darc, Crc8DvbS2, Crc8Ebu, Crc8ICode, Crc8Itu, Crc8Maxim, Crc8Rohc, Crc8Wcdma
+    };
+}

+ 91 - 0
src/main/java/com/its/app/utils/crc/CrcCalculator.java

@@ -0,0 +1,91 @@
+package com.its.app.utils.crc;
+
+/**
+ * Created by anthony on 11.05.2017.
+ */
+public class CrcCalculator {
+
+    public AlgoParams Parameters;
+    public byte HashSize = 8;
+    private long _mask = 0xFFFFFFFFFFFFFFFFL;
+    private long[] _table = new long[256];
+
+    public static final byte[] TestBytes = new byte[]{49,50,51,52,53,54,55,56,57};
+
+    public CrcCalculator(AlgoParams params)
+    {
+        Parameters = params;
+
+        HashSize = (byte) params.HashSize;
+        if (HashSize < 64)
+        {
+            _mask = (1L << HashSize) - 1;
+        }
+
+        CreateTable();
+    }
+
+    public long Calc(byte[] data, int offset, int length)
+    {
+        long init = Parameters.RefOut ? CrcHelper.ReverseBits(Parameters.Init, HashSize) : Parameters.Init;
+        long hash = ComputeCrc(init, data, offset, length);
+        return (hash ^ Parameters.XorOut) & _mask;
+    }
+
+    private long ComputeCrc(long init, byte[] data, int offset, int length)
+    {
+        long crc = init;
+
+        if (Parameters.RefOut)
+        {
+            for (int i = offset; i < offset + length; i++)
+            {
+                crc = (_table[(int)((crc ^ data[i]) & 0xFF)] ^ (crc >>> 8));
+                crc &= _mask;
+            }
+        }
+        else
+        {
+            int toRight = (HashSize - 8);
+            toRight = toRight < 0 ? 0 : toRight;
+            for (int i = offset; i < offset + length; i++)
+            {
+                crc = (_table[(int)(((crc >> toRight) ^ data[i]) & 0xFF)] ^ (crc << 8));
+                crc &= _mask;
+            }
+        }
+
+        return crc;
+    }
+
+    private void CreateTable()
+    {
+        for (int i = 0; i < _table.length; i++)
+            _table[i] = CreateTableEntry(i);
+    }
+
+    private long CreateTableEntry(int index)
+    {
+        long r = (long)index;
+
+        if (Parameters.RefIn)
+            r = CrcHelper.ReverseBits(r, HashSize);
+        else if (HashSize > 8)
+            r <<= (HashSize - 8);
+
+        long lastBit = (1L << (HashSize - 1));
+
+        for (int i = 0; i < 8; i++)
+        {
+            if ((r & lastBit) != 0)
+                r = ((r << 1) ^ Parameters.Poly);
+            else
+                r <<= 1;
+        }
+
+        if (Parameters.RefOut)
+            r = CrcHelper.ReverseBits(r, HashSize);
+
+        return r & _mask;
+    }
+}

+ 20 - 0
src/main/java/com/its/app/utils/crc/CrcHelper.java

@@ -0,0 +1,20 @@
+package com.its.app.utils.crc;
+
+/**
+ * Created by anthony on 13.05.2017.
+ */
+public class CrcHelper {
+
+    static long ReverseBits(long ul, int valueLength)
+    {
+        long newValue = 0;
+
+        for (int i = valueLength - 1; i >= 0; i--)
+        {
+            newValue |= (ul & 1) << i;
+            ul >>= 1;
+        }
+
+        return newValue;
+    }
+}

+ 42 - 0
src/main/java/com/its/app/utils/crc/Main.java

@@ -0,0 +1,42 @@
+package com.its.app.utils.crc;
+
+import static java.lang.System.out;
+
+public class Main {
+
+    public static void main(String[] args) {
+        boolean allRight = true;
+
+        out.println("Checking CRC-8...");
+        allRight &= Check(Crc8.Params);
+
+        out.println("Checking CRC-16...");
+        allRight &= Check(Crc16.Params);
+
+        out.println("Checking CRC-32...");
+        allRight &= Check(Crc32.Params);
+
+        out.println("Checking CRC-64...");
+        allRight &= Check(Crc64.Params);
+
+        if (allRight)
+            out.println("All right!");
+    }
+
+    private static boolean Check(AlgoParams[] params)
+    {
+        out.println(params.length + " algos");
+        boolean allRight = true;
+        for (int i = 0; i < params.length; i++) {
+            CrcCalculator calculator = new CrcCalculator(params[i]);
+            long result = calculator.Calc(CrcCalculator.TestBytes, 0, CrcCalculator.TestBytes.length);
+            if (result != calculator.Parameters.Check){
+                out.println(calculator.Parameters.Name + " - BAD ALGO!!! " + Long.toHexString(result).toUpperCase());
+                allRight = false;
+            }
+        }
+        out.println("done");
+        out.println();
+        return allRight;
+    }
+}

+ 3 - 3
src/main/java/com/its/vms/dto/TbVmsCtlrDto.java

@@ -650,13 +650,13 @@ public class TbVmsCtlrDto implements Serializable {
         // 폼아이디를 여기서 설정해 주어야 한다.
         VmsDownloadData.VmsDownloadDataInfo[] units = this.downloadData.getUnits();
         int formId   = units[downloadCnt].getFormNo();
-        int displaySec = units[downloadCnt].getDisplaySec();
+        int displaySec = 1;//units[downloadCnt].getDisplaySec();
         int displayType = units[downloadCnt].getDisplayType();
-        int bitmapId = units[downloadCnt].getBitmapId();
+        int bitmapId = 11;//units[downloadCnt].getBitmapId();
         int formIdx  = units[downloadCnt].getFormIdx();
         int downloadFormCnt = 1;
         VmsForm pForm = this.formManager.getItem(formIdx);
-        int objSize = 7;
+        int objSize = 1;
         int blinking = pForm.getVmsFormDsplMthdCd();
         int posX = 0;
         int posY = 0;

+ 2 - 0
src/main/java/com/its/vms/service/VmsManageService.java

@@ -66,6 +66,7 @@ public class VmsManageService {
      */
     public void loadVmsOnOffTime() {
         Elapsed elapsed = new Elapsed();
+        log.info("VmsManageService.loadVmsOnOffTime: START.");
         int nCurrTime = ItsUtils.parseIntDef(ItsUtils.getSysHourMin(), 0);
         String sysDay = ItsUtils.getSysDay();
 
@@ -114,6 +115,7 @@ public class VmsManageService {
                 vmsObj.addRequestData(new TcpServerSendData(eVmsOpCode.OP_VMS_STATUS_CONTROL, signboardControl));
             }
         });
+        log.info("VmsManageService.loadVmsOnOffTime: ..END. {} ms.", elapsed.milliSeconds());
     }
 
     /**

+ 191 - 125
src/main/java/com/its/vms/ui/SubUI.java

@@ -146,15 +146,32 @@ public abstract class SubUI {
         String message = "";
         String title = "제어기 상태 제어";
         switch (controlType) {
-            case 1: message = "제어기의 상태정보를 요청 하시겠습니까?";          break;
-            case 2: message = "제어기의 파라미터정보를 요청 하시겠습니까?";      break;
-            case 3: message = "제어기의 표출 시나리오를 다운로드 하시겠습니까?"; break;
-            case 4: message = "제어기의 시간 정보를 설정 하시겠습니까?";         break;
-            case 5: message = "제어기의 전광판 전원을 OFF 하시겠습니까?";        break;
-            case 6: message = "제어기의 전광판 전원을 ON 하시겠습니까?";         break;
-            case 7: message = "제어기의 FAN 을 제어 하시겠습니까?";              break;
-            case 8: message = "제어기의 HEATER 를 제어 하시겠습니까?";           break;
-            default: return;
+            case 1:
+                message = "제어기의 상태정보를 요청 하시겠습니까?";
+                break;
+            case 2:
+                message = "제어기의 파라미터정보를 요청 하시겠습니까?";
+                break;
+            case 3:
+                message = "제어기의 표출 시나리오를 다운로드 하시겠습니까?";
+                break;
+            case 4:
+                message = "제어기의 시간 정보를 설정 하시겠습니까?";
+                break;
+            case 5:
+                message = "제어기의 전광판 전원을 OFF 하시겠습니까?";
+                break;
+            case 6:
+                message = "제어기의 전광판 전원을 ON 하시겠습니까?";
+                break;
+            case 7:
+                message = "제어기의 FAN 을 제어 하시겠습니까?";
+                break;
+            case 8:
+                message = "제어기의 HEATER 를 제어 하시겠습니까?";
+                break;
+            default:
+                return;
         }
         if (JOptionPane.showConfirmDialog(getRootPanel(), message, title, JOptionPane.YES_NO_OPTION) != 0) {
             return;
@@ -162,14 +179,30 @@ public abstract class SubUI {
 
         VmsReqStatusControl statusControl = new VmsReqStatusControl(this.selObj);
         switch (controlType) {
-            case 1: this.selObj.addRequestData(new TcpServerSendData(eVmsOpCode.OP_VMS_STATUS_REQ, null));  return;
-            case 2: this.selObj.addRequestData(new TcpServerSendData(eVmsOpCode.OP_VMS_PARAMETER_REQ, null));  return;
-            case 3: this.selObj.downloadForm(false); return;
-            case 4: statusControl.controlSystemTime(); break;
-            case 5: statusControl.controlSignboardPower((byte)0x00); break;
-            case 6: statusControl.controlSignboardPower((byte)0x01); break;
-            case 7: statusControl.controlFan((byte)(cboControl.getSelectedIndex() & 0xff), (byte)((Integer)spControl.getValue() & 0xFF)); break;
-            case 8: statusControl.controlHeater((byte)(cboControl.getSelectedIndex() & 0xff), (byte)((Integer)spControl.getValue() & 0xFF)); break;
+            case 1:
+                this.selObj.addRequestData(new TcpServerSendData(eVmsOpCode.OP_VMS_STATUS_REQ, null));
+                return;
+            case 2:
+                this.selObj.addRequestData(new TcpServerSendData(eVmsOpCode.OP_VMS_PARAMETER_REQ, null));
+                return;
+            case 3:
+                this.selObj.downloadForm(false);
+                return;
+            case 4:
+                statusControl.controlSystemTime();
+                break;
+            case 5:
+                statusControl.controlSignboardPower((byte) 0x00);
+                break;
+            case 6:
+                statusControl.controlSignboardPower((byte) 0x01);
+                break;
+            case 7:
+                statusControl.controlFan((byte) (cboControl.getSelectedIndex() & 0xff), (byte) ((Integer) spControl.getValue() & 0xFF));
+                break;
+            case 8:
+                statusControl.controlHeater((byte) (cboControl.getSelectedIndex() & 0xff), (byte) ((Integer) spControl.getValue() & 0xFF));
+                break;
         }
         this.selObj.addRequestData(new TcpServerSendData(eVmsOpCode.OP_VMS_STATUS_CONTROL, statusControl));
     }
@@ -249,15 +282,15 @@ public abstract class SubUI {
      */
     private void $$$setupUI$$$() {
         rootPanel = new JPanel();
-        rootPanel.setLayout(new GridLayoutManager(3, 1, new Insets(0, 0, 0, 0), -1, -1));
+        rootPanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
         pnlCtlr = new JPanel();
-        pnlCtlr.setLayout(new GridLayoutManager(2, 3, new Insets(10, 4, 0, 4), -1, -1));
-        rootPanel.add(pnlCtlr, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        pnlCtlr.setLayout(new GridLayoutManager(2, 1, new Insets(0, 4, 0, 4), -1, -1));
+        rootPanel.add(pnlCtlr, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         pnlControl = new JPanel();
         pnlControl.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 2), 1, 1));
         pnlCtlr.add(pnlControl, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
         final JPanel panel1 = new JPanel();
-        panel1.setLayout(new GridLayoutManager(5, 8, new Insets(0, 0, 0, 0), -1, -1));
+        panel1.setLayout(new GridLayoutManager(5, 11, new Insets(0, 0, 0, 0), -1, -1));
         pnlControl.add(panel1, new GridConstraints(0, 0, 5, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
         txtName = new JTextField();
         txtName.setEditable(false);
@@ -265,12 +298,12 @@ public abstract class SubUI {
         if (txtNameFont != null) txtName.setFont(txtNameFont);
         txtName.setHorizontalAlignment(2);
         txtName.setText("제어기 명칭");
-        panel1.add(txtName, new GridConstraints(1, 3, 1, 5, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
+        panel1.add(txtName, new GridConstraints(1, 4, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(200, -1), null, 0, false));
         final JLabel label1 = new JLabel();
         Font label1Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label1.getFont());
         if (label1Font != null) label1.setFont(label1Font);
         label1.setText("ㅣ명칭");
-        panel1.add(label1, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel1.add(label1, new GridConstraints(1, 0, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         final JLabel label2 = new JLabel();
         Font label2Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label2.getFont());
         if (label2Font != null) label2.setFont(label2Font);
@@ -281,147 +314,180 @@ public abstract class SubUI {
         if (label3Font != null) label3.setFont(label3Font);
         label3.setText("ㅣ도어");
         panel1.add(label3, new GridConstraints(3, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        txtHeater = new JTextField();
-        txtHeater.setEditable(false);
-        Font txtHeaterFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtHeater.getFont());
-        if (txtHeaterFont != null) txtHeater.setFont(txtHeaterFont);
-        txtHeater.setHorizontalAlignment(0);
-        txtHeater.setText("가동/중지");
-        panel1.add(txtHeater, new GridConstraints(4, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
-        txtTemp = new JTextField();
-        txtTemp.setEditable(false);
-        Font txtTempFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtTemp.getFont());
-        if (txtTempFont != null) txtTemp.setFont(txtTempFont);
-        txtTemp.setHorizontalAlignment(0);
-        txtTemp.setText("34");
-        panel1.add(txtTemp, new GridConstraints(4, 7, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
-        final JLabel label4 = new JLabel();
-        Font label4Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label4.getFont());
-        if (label4Font != null) label4.setFont(label4Font);
-        label4.setText("ㅣ팬");
-        panel1.add(label4, new GridConstraints(3, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JLabel label5 = new JLabel();
-        Font label5Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label5.getFont());
-        if (label5Font != null) label5.setFont(label5Font);
-        label5.setText("ㅣ히터");
-        panel1.add(label5, new GridConstraints(4, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JLabel label6 = new JLabel();
-        Font label6Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label6.getFont());
-        if (label6Font != null) label6.setFont(label6Font);
-        label6.setText("ㅣ함체온도");
-        panel1.add(label6, new GridConstraints(4, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        txtIpAddr = new JTextField();
-        txtIpAddr.setEditable(false);
-        Font txtIpAddrFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtIpAddr.getFont());
-        if (txtIpAddrFont != null) txtIpAddr.setFont(txtIpAddrFont);
-        txtIpAddr.setHorizontalAlignment(0);
-        txtIpAddr.setText("192.168.113.112");
-        panel1.add(txtIpAddr, new GridConstraints(2, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        txtPort = new JTextField();
-        txtPort.setEditable(false);
-        Font txtPortFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtPort.getFont());
-        if (txtPortFont != null) txtPort.setFont(txtPortFont);
-        txtPort.setHorizontalAlignment(0);
-        txtPort.setText("3001");
-        panel1.add(txtPort, new GridConstraints(2, 5, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
         txtDoor = new JTextField();
         txtDoor.setEditable(false);
         Font txtDoorFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtDoor.getFont());
         if (txtDoorFont != null) txtDoor.setFont(txtDoorFont);
         txtDoor.setHorizontalAlignment(0);
         txtDoor.setText("열림/닫힘");
-        panel1.add(txtDoor, new GridConstraints(3, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
-        txtFan = new JTextField();
-        txtFan.setEditable(false);
-        Font txtFanFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtFan.getFont());
-        if (txtFanFont != null) txtFan.setFont(txtFanFont);
-        txtFan.setHorizontalAlignment(0);
-        txtFan.setText("가동/중지");
-        panel1.add(txtFan, new GridConstraints(3, 7, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
+        panel1.add(txtDoor, new GridConstraints(3, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
         txtState = new JTextField();
         txtState.setEditable(false);
         Font txtStateFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtState.getFont());
         if (txtStateFont != null) txtState.setFont(txtStateFont);
         txtState.setHorizontalAlignment(0);
         txtState.setText("통신");
-        panel1.add(txtState, new GridConstraints(0, 6, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
+        panel1.add(txtState, new GridConstraints(0, 8, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
         txtCtlrId = new JTextField();
         txtCtlrId.setEditable(false);
         Font txtCtlrIdFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtCtlrId.getFont());
         if (txtCtlrIdFont != null) txtCtlrId.setFont(txtCtlrIdFont);
         txtCtlrId.setHorizontalAlignment(0);
         txtCtlrId.setText("제어기 ID");
-        panel1.add(txtCtlrId, new GridConstraints(0, 4, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+        panel1.add(txtCtlrId, new GridConstraints(0, 5, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
         txtNmbr = new JTextField();
         txtNmbr.setEditable(false);
         Font txtNmbrFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtNmbr.getFont());
         if (txtNmbrFont != null) txtNmbr.setFont(txtNmbrFont);
         txtNmbr.setHorizontalAlignment(0);
         txtNmbr.setText("관리번호");
-        panel1.add(txtNmbr, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JLabel label7 = new JLabel();
-        Font label7Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label7.getFont());
-        if (label7Font != null) label7.setFont(label7Font);
-        label7.setText("ㅣVMS");
-        panel1.add(label7, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
-        final JPanel panel2 = new JPanel();
-        panel2.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));
-        pnlCtlr.add(panel2, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel1.add(txtNmbr, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label4 = new JLabel();
+        Font label4Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label4.getFont());
+        if (label4Font != null) label4.setFont(label4Font);
+        label4.setText("ㅣVMS");
+        panel1.add(label4, new GridConstraints(0, 0, 1, 4, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        txtFan = new JTextField();
+        txtFan.setEditable(false);
+        Font txtFanFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtFan.getFont());
+        if (txtFanFont != null) txtFan.setFont(txtFanFont);
+        txtFan.setHorizontalAlignment(0);
+        txtFan.setText("가동/중지");
+        panel1.add(txtFan, new GridConstraints(3, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
+        txtPort = new JTextField();
+        txtPort.setEditable(false);
+        Font txtPortFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtPort.getFont());
+        if (txtPortFont != null) txtPort.setFont(txtPortFont);
+        txtPort.setHorizontalAlignment(0);
+        txtPort.setText("3001");
+        panel1.add(txtPort, new GridConstraints(2, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
+        final JLabel label5 = new JLabel();
+        Font label5Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label5.getFont());
+        if (label5Font != null) label5.setFont(label5Font);
+        label5.setText("ㅣ함체온도");
+        panel1.add(label5, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label6 = new JLabel();
+        Font label6Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label6.getFont());
+        if (label6Font != null) label6.setFont(label6Font);
+        label6.setText("ㅣ히터");
+        panel1.add(label6, new GridConstraints(4, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        txtTemp = new JTextField();
+        txtTemp.setEditable(false);
+        Font txtTempFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtTemp.getFont());
+        if (txtTempFont != null) txtTemp.setFont(txtTempFont);
+        txtTemp.setHorizontalAlignment(0);
+        txtTemp.setText("34");
+        panel1.add(txtTemp, new GridConstraints(4, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
+        txtHeater = new JTextField();
+        txtHeater.setEditable(false);
+        Font txtHeaterFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtHeater.getFont());
+        if (txtHeaterFont != null) txtHeater.setFont(txtHeaterFont);
+        txtHeater.setHorizontalAlignment(0);
+        txtHeater.setText("가동/중지");
+        panel1.add(txtHeater, new GridConstraints(4, 6, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(100, -1), new Dimension(100, -1), new Dimension(100, -1), 0, false));
+        txtIpAddr = new JTextField();
+        txtIpAddr.setEditable(false);
+        Font txtIpAddrFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, txtIpAddr.getFont());
+        if (txtIpAddrFont != null) txtIpAddr.setFont(txtIpAddrFont);
+        txtIpAddr.setHorizontalAlignment(0);
+        txtIpAddr.setText("192.168.113.112");
+        panel1.add(txtIpAddr, new GridConstraints(2, 4, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        btnReqStatus = new JButton();
+        Font btnReqStatusFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnReqStatus.getFont());
+        if (btnReqStatusFont != null) btnReqStatus.setFont(btnReqStatusFont);
+        btnReqStatus.setText("상태정보요청");
+        panel1.add(btnReqStatus, new GridConstraints(1, 8, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        btnReqParam = new JButton();
+        Font btnReqParamFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnReqParam.getFont());
+        if (btnReqParamFont != null) btnReqParam.setFont(btnReqParamFont);
+        btnReqParam.setText("파라미터 요청");
+        panel1.add(btnReqParam, new GridConstraints(2, 8, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        btnScnDnld = new JButton();
+        Font btnScnDnldFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnScnDnld.getFont());
+        if (btnScnDnldFont != null) btnScnDnld.setFont(btnScnDnldFont);
+        btnScnDnld.setText("시나리오 다운로드");
+        panel1.add(btnScnDnld, new GridConstraints(3, 8, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        btnTimeSync = new JButton();
+        Font btnTimeSyncFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnTimeSync.getFont());
+        if (btnTimeSyncFont != null) btnTimeSync.setFont(btnTimeSyncFont);
+        btnTimeSync.setText("시간 설정");
+        panel1.add(btnTimeSync, new GridConstraints(4, 8, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         btnSignBoardOff = new JButton();
-        Font btnZoomInFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 14, btnSignBoardOff.getFont());
-        if (btnZoomInFont != null) btnSignBoardOff.setFont(btnZoomInFont);
-        btnSignBoardOff.setText("Zoom (+)");
-        btnSignBoardOff.setToolTipText("ZOOM In");
-        panel2.add(btnSignBoardOff, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        Font btnSignBoardOffFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnSignBoardOff.getFont());
+        if (btnSignBoardOffFont != null) btnSignBoardOff.setFont(btnSignBoardOffFont);
+        btnSignBoardOff.setText("전광판 전원 OFF");
+        btnSignBoardOff.setToolTipText("");
+        panel1.add(btnSignBoardOff, new GridConstraints(1, 9, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         btnSignBoardOn = new JButton();
-        Font btnZoomOutFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 14, btnSignBoardOn.getFont());
-        if (btnZoomOutFont != null) btnSignBoardOn.setFont(btnZoomOutFont);
-        btnSignBoardOn.setText("Zoom (-)");
-        btnSignBoardOn.setToolTipText("ZOOM Out");
-        panel2.add(btnSignBoardOn, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        Font btnSignBoardOnFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnSignBoardOn.getFont());
+        if (btnSignBoardOnFont != null) btnSignBoardOn.setFont(btnSignBoardOnFont);
+        btnSignBoardOn.setText("전광판 전원 ON");
+        btnSignBoardOn.setToolTipText("");
+        panel1.add(btnSignBoardOn, new GridConstraints(1, 10, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         btnReqFan = new JButton();
-        Font btnFocusInFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 14, btnReqFan.getFont());
-        if (btnFocusInFont != null) btnReqFan.setFont(btnFocusInFont);
-        btnReqFan.setText("Focus (+)");
-        btnReqFan.setToolTipText("FOCUS Near");
-        panel2.add(btnReqFan, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        Font btnReqFanFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnReqFan.getFont());
+        if (btnReqFanFont != null) btnReqFan.setFont(btnReqFanFont);
+        btnReqFan.setText("Fan 제어");
+        btnReqFan.setToolTipText("");
+        panel1.add(btnReqFan, new GridConstraints(4, 9, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         btnReqHeater = new JButton();
-        Font btnFocusOutFont = this.$$$getFont$$$("Malgun Gothic", Font.BOLD, 14, btnReqHeater.getFont());
-        if (btnFocusOutFont != null) btnReqHeater.setFont(btnFocusOutFont);
-        btnReqHeater.setText("Focus (-)");
-        btnReqHeater.setToolTipText("FOCUS Far");
-        panel2.add(btnReqHeater, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        Font btnReqHeaterFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnReqHeater.getFont());
+        if (btnReqHeaterFont != null) btnReqHeater.setFont(btnReqHeaterFont);
+        btnReqHeater.setText("Heater 제어");
+        btnReqHeater.setToolTipText("");
+        panel1.add(btnReqHeater, new GridConstraints(4, 10, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        cboControl = new JComboBox();
+        Font cboControlFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, cboControl.getFont());
+        if (cboControlFont != null) cboControl.setFont(cboControlFont);
+        final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
+        defaultComboBoxModel1.addElement("0x00: 꺼짐");
+        defaultComboBoxModel1.addElement("0x01: 켜짐");
+        defaultComboBoxModel1.addElement("0x02: 자동");
+        cboControl.setModel(defaultComboBoxModel1);
+        panel1.add(cboControl, new GridConstraints(3, 9, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label7 = new JLabel();
+        Font label7Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label7.getFont());
+        if (label7Font != null) label7.setFont(label7Font);
+        label7.setText("ㅣ팬");
+        panel1.add(label7, new GridConstraints(3, 5, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label8 = new JLabel();
+        Font label8Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label8.getFont());
+        if (label8Font != null) label8.setFont(label8Font);
+        label8.setText("ㅣ팬/히터 제어 구분");
+        panel1.add(label8, new GridConstraints(2, 9, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JLabel label9 = new JLabel();
+        Font label9Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label9.getFont());
+        if (label9Font != null) label9.setFont(label9Font);
+        label9.setText("ㅣ팬/히터 제어 값");
+        panel1.add(label9, new GridConstraints(2, 10, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        final JPanel panel2 = new JPanel();
+        panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
+        panel1.add(panel2, new GridConstraints(3, 10, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
         spControl = new JSpinner();
         panel2.add(spControl, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         final JPanel panel3 = new JPanel();
-        panel3.setLayout(new GridLayoutManager(3, 3, new Insets(0, 0, 0, 0), -1, -1, true, true));
-        pnlCtlr.add(panel3, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel3.setLayout(new GridLayoutManager(2, 1, new Insets(0, 4, 0, 4), -1, -1));
+        rootPanel.add(panel3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, new Dimension(-1, 200), null, null, 0, false));
         final JPanel panel4 = new JPanel();
-        panel4.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
-        rootPanel.add(panel4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(-1, 5), new Dimension(-1, 5), new Dimension(-1, 5), 0, false));
-        final JPanel panel5 = new JPanel();
-        panel5.setLayout(new GridLayoutManager(2, 1, new Insets(0, 4, 0, 4), -1, -1));
-        rootPanel.add(panel5, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, new Dimension(-1, 200), null, null, 0, false));
-        final JPanel panel6 = new JPanel();
-        panel6.setLayout(new GridLayoutManager(1, 3, new Insets(2, 0, 0, 2), -1, -1));
-        panel5.add(panel6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
-        final JLabel label8 = new JLabel();
-        Font label8Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label8.getFont());
-        if (label8Font != null) label8.setFont(label8Font);
-        label8.setHorizontalAlignment(2);
-        label8.setIcon(new ImageIcon(getClass().getResource("/static/image/logging.png")));
-        label8.setText("제어 로그");
-        panel6.add(label8, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel4.setLayout(new GridLayoutManager(1, 3, new Insets(2, 0, 0, 2), -1, -1));
+        panel3.add(panel4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
+        final JLabel label10 = new JLabel();
+        Font label10Font = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, label10.getFont());
+        if (label10Font != null) label10.setFont(label10Font);
+        label10.setHorizontalAlignment(2);
+        label10.setIcon(new ImageIcon(getClass().getResource("/static/image/logging.png")));
+        label10.setText("제어 로그");
+        panel4.add(label10, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         btnLogClear = new JButton();
         Font btnLogClearFont = this.$$$getFont$$$("Malgun Gothic", Font.PLAIN, 12, btnLogClear.getFont());
         if (btnLogClearFont != null) btnLogClear.setFont(btnLogClearFont);
         btnLogClear.setHorizontalTextPosition(0);
         btnLogClear.setText("지우기");
-        panel6.add(btnLogClear, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+        panel4.add(btnLogClear, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
         final Spacer spacer1 = new Spacer();
-        panel6.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+        panel4.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
         final JScrollPane scrollPane1 = new JScrollPane();
-        panel5.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
+        panel3.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
         taLog = new JTextArea();
         taLog.setBackground(new Color(-16777216));
         taLog.setCaretColor(new Color(-1));

+ 17 - 9
src/main/java/com/its/vms/xnettcp/vms/process/TcpServerRecvDataProcess.java

@@ -3,12 +3,14 @@ package com.its.vms.xnettcp.vms.process;
 import com.its.vms.config.CommunicationConfig;
 import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.handler.VmsServerIdleStateHandler;
-import com.its.vms.xnettcp.vms.process.response.*;
+import com.its.vms.xnettcp.vms.process.response.VmsResponse;
 import com.its.vms.xnettcp.vms.process.response.impl.*;
-import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
-import com.its.vms.xnettcp.vms.protocol.impl.VmsResFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
+import com.its.vms.xnettcp.vms.protocol.impl.VmsResFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 import io.netty.channel.ChannelHandlerContext;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -67,7 +69,10 @@ public class TcpServerRecvDataProcess {
             MDC.put("id", vmsObj.getLogKey());
 
             VmsFramePacket packet;
-            if (vmsObj.getProtocolVer() == 0) {
+            if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+                packet = new VmsStdFramePacket(resFramePacket.getPacket(), resFramePacket.getMsgLen());
+            }
+            else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
                 packet = new VmsDleFramePacket(resFramePacket.getPacket(), resFramePacket.getMsgLen());
             }
             else {
@@ -89,6 +94,12 @@ public class TcpServerRecvDataProcess {
                 case OP_VMS_PARAMETER_REQ:
                     response = new VmsResParameter(vmsObj, packet);
                     break;
+                case OP_VMS_DOWNLOAD_FORM:
+                    response = new VmsResDownloadForm(vmsObj, packet);
+                    break;
+                case OP_VMS_BLANK:
+                    response = new VmsResBlank(vmsObj, packet);
+                    break;
                 case OP_VMS_STOP_IMAGE_REQ:
                     response = new VmsResStopImage(vmsObj, packet);
                     break;
@@ -98,22 +109,19 @@ public class TcpServerRecvDataProcess {
                 case OP_VMS_DISPLAY_DEFAULT_FORM:
                     response = new VmsResDisplayDefaultForm(vmsObj, packet);
                     break;
-                case OP_VMS_BLANK:
-                    response = new VmsResBlank(vmsObj, packet);
-                    break;
                 case OP_VMS_DISPLAY_FORM_ID:
                     response = new VmsResDisplayFormId(vmsObj, packet);
                     break;
                 case OP_VMS_UPLOAD_FORM_SCHEDULE:
                     response = new VmsResUploadFormSchedule(vmsObj, packet);
                 default:
-                    log.warn("TcpServerRecvDataProcess.process: Unknown Op Code Packet: VMS {}, {}", vmsObj.getVmsCtlrNmbr(), packet.getOpCode());
+                    log.warn("TcpServerRecvDataProcess.process: Unknown Op Code Packet: VMS {}, {}", vmsObj.getVmsCtlrNmbr(), String.format("0x%02X", packet.getOpCode()));
                     break;
             }
 
             if (response != null) {
                 if (!response.process()) {
-                    log.error("TcpServerRecvDataProcess.process: response error. VMS {}, will be closed.", vmsObj.getVmsCtlrNmbr());
+                    log.error("TcpServerRecvDataProcess.process: response error. VMS {}, {}, will be closed.", vmsObj.getVmsCtlrNmbr(), String.format("0x%02X", packet.getOpCode()));
                     VmsServerIdleStateHandler.disconnectChannel(vmsObj, ctx.channel());
                 }
             }

+ 44 - 0
src/main/java/com/its/vms/xnettcp/vms/protocol/enums/eVmsProtocolVersion.java

@@ -0,0 +1,44 @@
+package com.its.vms.xnettcp.vms.protocol.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum eVmsProtocolVersion {
+
+    PROTOCOL_EX_FIGURE ( 0, "0.ExpressHighway Figure"),
+    PROTOCOL_EX_TEXT   ( 1, "0.ExpressHighway Text"),
+    PROTOCOL_ANDONG    ( 2, "0.ANDONG");
+
+    private final int value;
+    private final String string;
+
+    private static final Map<Integer, eVmsProtocolVersion> map;
+    static {
+        map = new HashMap<>();
+        for (eVmsProtocolVersion e : values()) {
+            map.put(e.value, e);
+        }
+    }
+
+    public static eVmsProtocolVersion getValue(int value) {
+        return map.get(value);
+    }
+    public static eVmsProtocolVersion getValue(byte value) {
+        int intValue = (value & 0x0F);
+        return map.get(intValue);
+    }
+
+    eVmsProtocolVersion(int value, String string) {
+        this.value  = value;
+        this.string = string;
+    }
+
+    public int getValue() {
+        return this.value;
+    }
+
+    @Override
+    public String toString() {
+        return this.string;
+    }
+}

+ 12 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqBlank.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 
 import java.nio.ByteBuffer;
 
@@ -13,11 +15,18 @@ import java.nio.ByteBuffer;
  */
 public class VmsReqBlank implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqBlank(TbVmsCtlrDto vmsObj) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_BLANK.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_BLANK.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
+        }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
         }
     }
 

+ 13 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDataDownload.java

@@ -5,7 +5,9 @@ import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsFileSaveLocation;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 import lombok.extern.slf4j.Slf4j;
 
 import java.nio.ByteBuffer;
@@ -17,12 +19,20 @@ import java.nio.ByteOrder;
 @Slf4j
 public class VmsReqDataDownload implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqDataDownload(TbVmsCtlrDto vmsObj, eVmsFileSaveLocation saveLoc, String fileName, byte[] data) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_DATA_DOWNLOAD.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_DATA_DOWNLOAD.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
         }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+
         makeBody(saveLoc, fileName, data);
     }
 

+ 13 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDataUpload.java

@@ -5,7 +5,9 @@ import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsFileSaveLocation;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 import lombok.extern.slf4j.Slf4j;
 
 import java.nio.ByteBuffer;
@@ -17,12 +19,20 @@ import java.nio.ByteOrder;
 @Slf4j
 public class VmsReqDataUpload implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqDataUpload(TbVmsCtlrDto vmsObj, eVmsFileSaveLocation saveLoc, String fileName) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_DATA_UPLOAD.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_DATA_UPLOAD.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
         }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+
         makeBody(saveLoc, fileName);
     }
 

+ 12 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDisplayDefaultForm.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 
 import java.nio.ByteBuffer;
 
@@ -13,11 +15,18 @@ import java.nio.ByteBuffer;
  */
 public class VmsReqDisplayDefaultForm implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqDisplayDefaultForm(TbVmsCtlrDto vmsObj) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_DISPLAY_DEFAULT_FORM.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_DISPLAY_DEFAULT_FORM.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
+        }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
         }
     }
 

+ 21 - 9
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDisplayFromId.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 import lombok.extern.slf4j.Slf4j;
 
 import java.nio.ByteBuffer;
@@ -15,18 +17,28 @@ import java.nio.ByteBuffer;
 @Slf4j
 public class VmsReqDisplayFromId implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
-    private short formNo;
     public VmsReqDisplayFromId(TbVmsCtlrDto vmsObj, int formNo) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_DISPLAY_FORM_ID.getValue());
-            this.formNo = (short)formNo;
-            byte[] body = new byte[2];
-            body[0] = (byte)(((this.formNo & 0xFF00) >> 8) & 0xFF);
-            body[1] = (byte)(((this.formNo * 0x00FF)     ) * 0xFF);
-            this.framePacket.setBody(body);
+        byte opCode = (byte)eVmsOpCode.OP_VMS_DISPLAY_FORM_ID.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
         }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+
+        makeBody((short)formNo);
+    }
+
+    public void makeBody(short formNo) {
+        byte[] body = new byte[2];
+        body[0] = (byte)(((formNo & 0xFF00) >> 8) & 0xFF);
+        body[1] = (byte)(((formNo * 0x00FF)     ) * 0xFF);
+        this.framePacket.setBody(body);
     }
 
     @Override

+ 12 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDisplayModuleStatus.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 
 import java.nio.ByteBuffer;
 
@@ -13,11 +15,18 @@ import java.nio.ByteBuffer;
  */
 public class VmsReqDisplayModuleStatus implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqDisplayModuleStatus(TbVmsCtlrDto vmsObj) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_DISPLAY_MODULE_STATUS_REQ.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_DISPLAY_MODULE_STATUS_REQ.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
+        }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
         }
     }
 

+ 12 - 4
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDownloadForm.java

@@ -6,7 +6,9 @@ import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.dto.*;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsFormObjectKind;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 import lombok.extern.slf4j.Slf4j;
 
 import java.nio.ByteBuffer;
@@ -18,12 +20,18 @@ import java.nio.ByteOrder;
 @Slf4j
 public class VmsReqDownloadForm implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqDownloadForm(TbVmsCtlrDto vmsObj, VmsFormDataDto formData) {
-
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_DOWNLOAD_FORM.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_DOWNLOAD_FORM.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
+        }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
         }
 
         makeBody(formData);

+ 13 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqDownloadFormSchedule.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 import lombok.extern.slf4j.Slf4j;
 
 import java.nio.ByteBuffer;
@@ -16,12 +18,20 @@ import java.nio.ByteOrder;
 @Slf4j
 public class VmsReqDownloadFormSchedule implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqDownloadFormSchedule(TbVmsCtlrDto vmsObj, short[] formId, byte[] dispSec) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_DOWNLOAD_FORM_SCHEDULE.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_DOWNLOAD_FORM_SCHEDULE.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
         }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+
         makeBody(formId, dispSec);
     }
 

+ 20 - 7
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqFormDataDisplay.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 import lombok.extern.slf4j.Slf4j;
 
 import java.nio.ByteBuffer;
@@ -15,16 +17,27 @@ import java.nio.ByteBuffer;
 @Slf4j
 public class VmsReqFormDataDisplay implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
-    private byte[] body;
     public VmsReqFormDataDisplay(TbVmsCtlrDto vmsObj, byte[] schedule) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_FORM_DATA_DISPLAY.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_FORM_DATA_DISPLAY.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
         }
-        this.body = new byte[schedule.length];
-        System.arraycopy(schedule, 0, this.body, 0, this.body.length);
-        this.framePacket.setBody(this.body);
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+
+        makeBody(schedule);
+    }
+
+    public void makeBody(byte[] schedule) {
+        byte[] body = new byte[schedule.length];
+        System.arraycopy(schedule, 0, body, 0, body.length);
+        this.framePacket.setBody(body);
     }
 
     @Override

+ 12 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqParameter.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 
 import java.nio.ByteBuffer;
 
@@ -13,11 +15,18 @@ import java.nio.ByteBuffer;
  */
 public class VmsReqParameter implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqParameter(TbVmsCtlrDto vmsObj) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_PARAMETER_REQ.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_PARAMETER_REQ.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
+        }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
         }
     }
 

+ 12 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqPowerModuleStatus.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 
 import java.nio.ByteBuffer;
 
@@ -13,11 +15,18 @@ import java.nio.ByteBuffer;
  */
 public class VmsReqPowerModuleStatus implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqPowerModuleStatus(TbVmsCtlrDto vmsObj) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_POWER_MODULE_STATUS_REQ.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_POWER_MODULE_STATUS_REQ.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
+        }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
         }
     }
 

+ 12 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqStatus.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 
 import java.nio.ByteBuffer;
 
@@ -13,11 +15,18 @@ import java.nio.ByteBuffer;
  */
 public class VmsReqStatus implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqStatus(TbVmsCtlrDto vmsObj) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_STATUS_REQ.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_STATUS_REQ.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
+        }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
         }
     }
 

+ 12 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqStatusControl.java

@@ -5,8 +5,10 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsStatusControl;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 import lombok.extern.slf4j.Slf4j;
 
 import java.nio.ByteBuffer;
@@ -18,12 +20,19 @@ import java.nio.ByteOrder;
 @Slf4j
 public class VmsReqStatusControl implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     private byte[] body;
     public VmsReqStatusControl(TbVmsCtlrDto vmsObj) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_STATUS_CONTROL.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_STATUS_CONTROL.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
+        }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
         }
     }
 

+ 21 - 9
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqStopImage.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 import lombok.extern.slf4j.Slf4j;
 
 import java.nio.ByteBuffer;
@@ -15,18 +17,28 @@ import java.nio.ByteBuffer;
 @Slf4j
 public class VmsReqStopImage implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
-    private short deviceId;
     public VmsReqStopImage(TbVmsCtlrDto vmsObj, int deviceId) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_STOP_IMAGE_REQ.getValue());
-            this.deviceId = (short)deviceId;
-            byte[] body = new byte[2];
-            body[0] = (byte)(((this.deviceId & 0xFF00) >> 8) & 0xFF);
-            body[1] = (byte)(((this.deviceId * 0x00FF)     ) * 0xFF);
-            this.framePacket.setBody(body);
+        byte opCode = (byte)eVmsOpCode.OP_VMS_STOP_IMAGE_REQ.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
         }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+
+        makeBody((short)deviceId);
+    }
+
+    public void makeBody(short deviceId) {
+        byte[] body = new byte[2];
+        body[0] = (byte)(((deviceId & 0xFF00) >> 8) & 0xFF);
+        body[1] = (byte)(((deviceId * 0x00FF)     ) * 0xFF);
+        this.framePacket.setBody(body);
     }
 
     @Override

+ 12 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqUploadCurrentDisplayForm.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 
 import java.nio.ByteBuffer;
 
@@ -13,11 +15,18 @@ import java.nio.ByteBuffer;
  */
 public class VmsReqUploadCurrentDisplayForm implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqUploadCurrentDisplayForm(TbVmsCtlrDto vmsObj) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_UPLOAD_CURRENT_DISPLAY_FORM.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_UPLOAD_CURRENT_DISPLAY_FORM.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
+        }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
         }
     }
 

+ 12 - 3
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/VmsReqUploadFormSchedule.java

@@ -4,7 +4,9 @@ import com.its.vms.dto.TbVmsCtlrDto;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsReqFramePacket;
 import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsProtocolVersion;
 import com.its.vms.xnettcp.vms.protocol.impl.dle.VmsDleFramePacket;
+import com.its.vms.xnettcp.vms.protocol.impl.std.VmsStdFramePacket;
 
 import java.nio.ByteBuffer;
 
@@ -13,11 +15,18 @@ import java.nio.ByteBuffer;
  */
 public class VmsReqUploadFormSchedule implements VmsReqFramePacket {
 
-    private VmsFramePacket framePacket;
+    private final VmsFramePacket framePacket;
 
     public VmsReqUploadFormSchedule(TbVmsCtlrDto vmsObj) {
-        if (vmsObj.getProtocolVer() == 0) {
-            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), (byte)eVmsOpCode.OP_VMS_UPLOAD_FORM_SCHEDULE.getValue());
+        byte opCode = (byte)eVmsOpCode.OP_VMS_UPLOAD_FORM_SCHEDULE.getValue();
+        if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_ANDONG.getValue()) {
+            this.framePacket = new VmsStdFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getVmsCtlrNmbr().intValue(), vmsObj.getSeqNext(), opCode);
+        }
+        else if (vmsObj.getProtocolVer() == eVmsProtocolVersion.PROTOCOL_EX_FIGURE.getValue()) {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
+        }
+        else {
+            this.framePacket = new VmsDleFramePacket(vmsObj.getGroupNo().intValue(), vmsObj.getCtlrLocalNo(), opCode);
         }
     }
 

+ 184 - 0
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/dle/Crc16.java

@@ -0,0 +1,184 @@
+package com.its.vms.xnettcp.vms.protocol.impl.dle;
+
+import com.its.app.utils.crc.AlgoParams;
+import com.its.app.utils.crc.CrcCalculator;
+import lombok.NonNull;
+
+import java.io.Serializable;
+
+public class Crc16  implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private static Crc16 _instance = null;
+
+    public static Crc16 getInstance() {
+        if (_instance == null) {
+            synchronized (Crc16.class) {
+                if (_instance == null)
+                    _instance = new Crc16();
+            }
+        }
+        return _instance;
+    }
+
+    private CrcCalculator calculator;
+
+    private Crc16() {
+        AlgoParams crc16Arc = new AlgoParams("CRC-16/ARC", 16, 0x8005, 0x0, true, true, 0x0, 0xBB3D);
+        this.calculator = new CrcCalculator(crc16Arc);
+    }
+
+    public int calcCrc(byte[] data, int start, int length) {
+        long result = this.calculator.Calc(data, start, length);
+        //if (result != this.calculator.Parameters.Check) {
+        //    println(calculator.Parameters.Name + " - BAD ALGO!!! " + Long.toHexString(result).toUpperCase());
+        //}
+        return (int)(result);
+    }
+    /**
+     * Calculates CRC CCITT (Kermit) over given range of bytes from the block of data.
+     * It is using the 0x1021 polynomial and 0x0000 initial value.
+     * <p>
+     * See: http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.kermit
+     *
+     * @param data   The input data block for computation.
+     * @param offset Offset from where the range starts.
+     * @param length Length of the range in bytes.
+     * @return the CRC-16 CCITT (Kermit).
+     */
+    public static int CCITT_Kermit(@NonNull final byte[] data, final int offset, final int length) {
+        return CRC(0x1021, 0x0000, data, offset, length, true, true, 0x0000);
+    }
+
+    /**
+     * Calculates CRC CCITT-FALSE over given range of bytes from the block of data.
+     * It is using the 0x1021 polynomial and 0xFFFF initial value.
+     * <p>
+     * See: http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.crc-16-ccitt-false
+     * See: http://srecord.sourceforge.net/crc16-ccitt.html
+     *
+     * @param data   The input data block for computation.
+     * @param offset Offset from where the range starts.
+     * @param length Length of the range in bytes.
+     * @return the CRC-16 CCITT-FALSE.
+     */
+    public static int CCITT_FALSE(@NonNull final byte[] data, final int offset, final int length) {
+//		Other implementation of the same algorithm:
+//		int crc = 0xFFFF;
+//
+//		for (int i = offset; i < offset + length && i < data.length; ++i) {
+//			crc = (((crc & 0xFFFF) >> 8) | (crc << 8));
+//			crc ^= data[i];
+//			crc ^= (crc & 0xFF) >> 4;
+//			crc ^= (crc << 8) << 4;
+//			crc ^= ((crc & 0xFF) << 4) << 1;
+//		}
+
+        return CRC(0x1021, 0xFFFF, data, offset, length, false, false, 0x0000);
+    }
+
+    /**
+     * Calculates CRC MCRF4XX over given range of bytes from the block of data.
+     * It is using the 0x1021 polynomial and 0xFFFF initial value.
+     * <p>
+     * This method is used in Bluetooth LE CGMS service E2E-CRC calculation.
+     * <p>
+     * See: http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.crc-16-mcrf4xx<br>
+     * See: http://ww1.microchip.com/downloads/en/AppNotes/00752a.pdf<br>
+     * See: https://www.bluetooth.com/specifications/gatt -> CGMS (1.0.1)
+     *
+     * @param data   The input data block for computation.
+     * @param offset Offset from where the range starts.
+     * @param length Length of the range in bytes.
+     * @return the CRC-16 MCRF4XX.
+     */
+    public static int MCRF4XX(@NonNull final byte[] data, final int offset, final int length) {
+        return CRC(0x1021, 0xFFFF, data, offset, length, true, true, 0x0000);
+    }
+
+    /**
+     * Calculates CRC AUG-CCITT over given range of bytes from the block of data.
+     * It is using the 0x1021 polynomial and 0x1D0F initial value.
+     * <p>
+     * See: http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.crc-16-aug-ccitt
+     * See: http://srecord.sourceforge.net/crc16-ccitt.html
+     *
+     * @param data   The input data block for computation.
+     * @param offset Offset from where the range starts.
+     * @param length Length of the range in bytes.
+     * @return the CRC-16 AUG-CCITT.
+     */
+    public static int AUG_CCITT(@NonNull final byte[] data, final int offset, final int length) {
+        return CRC(0x1021, 0x1D0F, data, offset, length, false, false, 0x0000);
+    }
+
+    /**
+     * Calculates CRC-16 ARC over given range of bytes from the block of data.
+     * It is using the 0x8005 polynomial and 0x0000 initial value.
+     * <p>
+     * Input data and output CRC are reversed.
+     * <p>
+     * See: http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.crc-16-arc
+     *
+     * @param data   The input data block for computation.
+     * @param offset Offset from where the range starts.
+     * @param length Length of the range in bytes.
+     * @return the CRC-16.
+     */
+    public static int ARC(@NonNull final byte[] data, final int offset, final int length) {
+        return CRC(0x8005, 0x0000, data, offset, length, true, true, 0x0000);
+    }
+
+    /**
+     * Calculates CRC-16 MAXIM over given range of bytes from the block of data.
+     * It is using the 0x8005 polynomial and 0x0000 initial value and XORs output with 0xFFFF.
+     * <p>
+     * Input data and output CRC are reversed.
+     * <p>
+     * See: http://reveng.sourceforge.net/crc-catalogue/16.htm#crc.cat.crc-16-maxim
+     *
+     * @param data   The input data block for computation.
+     * @param offset Offset from where the range starts.
+     * @param length Length of the range in bytes.
+     * @return the CRC-16 MAXIM.
+     */
+    public static int MAXIM(@NonNull final byte[] data, final int offset, final int length) {
+        return CRC(0x8005, 0x0000, data, offset, length, true, true, 0xFFFF);
+    }
+
+    /**
+     * Calculates the CRC over given range of bytes from the block of data with given polynomial and initial value.
+     * This method may also reverse input bytes and reverse output CRC.
+     *
+     * See: http://www.zorc.breitbandkatze.de/crc.html
+     *
+     * @param poly   Polynomial used to calculate the CRC16.
+     * @param init   Initial value to feed the buffer.
+     * @param data   The input data block for computation.
+     * @param offset Offset from where the range starts.
+     * @param length Length of the range in bytes.
+     * @param refin  True if the input data should be reversed.
+     * @param refout True if the output data should be reversed.
+     * @return CRC calculated with given parameters.
+     */
+    public static int CRC(final int poly, final int init, @NonNull final byte[] data, final int offset, final int length, final boolean refin, final boolean refout, final int xorout) {
+        int crc = init;
+
+        for (int i = offset; i < offset + length && i < data.length; ++i) {
+            final byte b = data[i];
+            for (int j = 0; j < 8; j++) {
+                final int k = refin ? 7 - j : j;
+                final boolean bit = ((b >> (7 - k) & 1) == 1);
+                final boolean c15 = ((crc >> 15 & 1) == 1);
+                crc <<= 1;
+                if (c15 ^ bit) crc ^= poly;
+            }
+        }
+
+        if (refout) {
+            return (Integer.reverse(crc) >>> 16) ^ xorout;
+        } else {
+            return (crc ^ xorout) & 0xFFFF;
+        }
+    }
+}

+ 8 - 13
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/dle/VmsDleFrameHead.java

@@ -58,22 +58,17 @@ public class VmsDleFrameHead implements VmsFrameHead {
         // HEAD (패킷 분석결과 DLE Stuffing 하지 않음)
         list.add(this.dle);
         list.add(this.stx);
-        list.add((byte)(this.group & 0xFF));
+        list.add((byte)(this.group      & 0xFF));
         list.add((byte)(this.controller & 0xFF));
-        list.add((byte)(this.opCode & 0xFF));
-        list.add((byte)(this.curr & 0xFF));
-        list.add((byte)(this.total & 0xFF));
-
-//        list.add((byte)((this.length & 0xFF000000 >> 24) & 0xFF));
-//        list.add((byte)((this.length & 0x00FF0000 >> 16) & 0xFF));
-//        list.add((byte)((this.length & 0x0000FF00 >>  8) & 0xFF));
-//        list.add((byte)((this.length & 0x000000FF      ) & 0xFF));
+        list.add((byte)(this.opCode     & 0xFF));
+        list.add((byte)(this.curr       & 0xFF));
+        list.add((byte)(this.total      & 0xFF));
 
         // 길이 부분은 Little Endian
-        list.add((byte)((this.length & 0x000000FF      ) & 0xFF));
-        list.add((byte)((this.length & 0x00FF0000 >> 16) & 0xFF));
-        list.add((byte)((this.length & 0x0000FF00 >>  8) & 0xFF));
-        list.add((byte)((this.length & 0xFF000000 >> 24) & 0xFF));
+        list.add((byte)(((this.length & 0x000000FF)      ) & 0xFF));
+        list.add((byte)(((this.length & 0x0000FF00) >>  8) & 0xFF));
+        list.add((byte)(((this.length & 0x00FF0000) >> 16) & 0xFF));
+        list.add((byte)(((this.length & 0xFF000000) >> 24) & 0xFF));
 
         return Bytes.toArray(list);
     }

+ 16 - 22
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/dle/VmsDleFramePacket.java

@@ -4,8 +4,8 @@ import com.google.common.primitives.Bytes;
 import com.its.vms.xnettcp.vms.protocol.VmsFrameHead;
 import com.its.vms.xnettcp.vms.protocol.VmsFramePacket;
 import com.its.vms.xnettcp.vms.protocol.VmsFrameTail;
-import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
 import com.its.vms.xnettcp.vms.protocol.VmsProtocolConst;
+import com.its.vms.xnettcp.vms.protocol.enums.eVmsOpCode;
 import lombok.extern.slf4j.Slf4j;
 
 import java.nio.ByteBuffer;
@@ -55,6 +55,8 @@ public class VmsDleFramePacket implements VmsFramePacket {
             0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040
     };
 
+    //public static AlgoParams Crc16Arc = new AlgoParams("CRC-16/ARC", 16, 0x8005, 0x0, true, true, 0x0, 0xBB3D);
+
     protected VmsDleFrameHead head;
     protected byte[]          body;
     protected VmsDleFrameTail tail;
@@ -137,22 +139,13 @@ public class VmsDleFramePacket implements VmsFramePacket {
         // HEAD (패킷 분석결과 DLE Stuffing 하지 않음)
         list.add(this.head.getDle());
         list.add(this.head.getStx());
-        list.add((byte)(this.head.getGroup() & 0xFF));
-        list.add((byte)(this.head.getController() & 0xFF));
-        list.add((byte)(this.head.getOpCode() & 0xFF));
-        list.add((byte)(this.head.getCurr() & 0xFF));
-        list.add((byte)(this.head.getTotal() & 0xFF));
-
-//        list.add((byte)((this.head.getLength() & 0xFF000000) >> 24));
-//        list.add((byte)((this.head.getLength() & 0x00FF0000) >> 16));
-//        list.add((byte)((this.head.getLength() & 0x0000FF00) >>  8));
-//        list.add((byte)((this.head.getLength() & 0x000000FF)      ));
-
-        // 길이부분은 Little Endian
-        list.add((byte)((this.head.getLength() & 0x000000FF)      ));
-        list.add((byte)((this.head.getLength() & 0x0000FF00) >>  8));
-        list.add((byte)((this.head.getLength() & 0x00FF0000) >> 16));
-        list.add((byte)((this.head.getLength() & 0xFF000000) >> 24));
+        byte[] headArr = this.head.getBuffer();
+        for (byte hb: headArr) {
+            list.add(hb);
+            if (hb == VmsProtocolConst.VMS_DLE) {
+                list.add(hb);
+            }
+        }
 
         // BODY
         if (bodySize > 0) {
@@ -167,8 +160,8 @@ public class VmsDleFramePacket implements VmsFramePacket {
         // TAIL
         list.add(this.tail.getDle());
         list.add(this.tail.getEtx());
-        list.add((byte)((this.tail.getCrc() & 0xFF00) >> 8));
-        list.add((byte)((this.tail.getCrc() & 0x00FF)     ));
+        list.add((byte)(((this.tail.getCrc() & 0xFF00) >> 8) & 0xFF));
+        list.add((byte)(((this.tail.getCrc() & 0x00FF)     ) & 0xFF));
 
         byte[] arr = Bytes.toArray(list);
         ByteBuffer byteBuffer = ByteBuffer.allocate(arr.length);
@@ -184,6 +177,7 @@ public class VmsDleFramePacket implements VmsFramePacket {
         }
 
         this.head.setLength(bodySize);
+
         ByteBuffer byteBuffer = ByteBuffer.allocate(VmsDleFrameHead.HEAD_SIZE + bodySize + VmsDleFrameTail.TAIL_SIZE);
         byteBuffer.order(VmsDleFramePacket.BYTE_ORDER);
 
@@ -207,17 +201,17 @@ public class VmsDleFramePacket implements VmsFramePacket {
 
     /**
      * CRC16-ARC(https://crccalc.com/)
+     * https://github.com/NordicSemiconductor/Android-BLE-Common-Library/blob/master/ble-common/src/main/java/no/nordicsemi/android/ble/common/util/CRC16.java
      * @param data
      * @param start
      * @param length
      * @return
      */
-    public static short getCRC16ARC(byte[] data, int start, int length) {
-        int crc = 0x0000;
+    public short getCRC16ARC(byte[] data, int start, int length) {
+        int crc = 0;
         for (int ii = start; ii < (start+length); ii++) {
             crc = (crc >> 8) ^ crc16_arc[(crc ^ data[ii]) & 0xff];
         }
         return (short)(crc & 0x0000FFFF);
     }
-
 }

+ 14 - 10
src/main/java/com/its/vms/xnettcp/vms/protocol/impl/std/VmsStdFrameHead.java

@@ -54,17 +54,21 @@ public class VmsStdFrameHead implements VmsFrameHead {
 
         list.add(this.kind1);
         list.add(this.kind2);
-        list.add((byte)((this.group      & 0xFF00 >>  8) & 0xFF));
-        list.add((byte)((this.group      & 0x00FF      ) & 0xFF));
-        list.add((byte)((this.controller & 0xFF00 >>  8) & 0xFF));
-        list.add((byte)((this.controller & 0x00FF      ) & 0xFF));
-        list.add((byte)((this.sequence   & 0xFF00 >>  8) & 0xFF));
-        list.add((byte)((this.sequence   & 0x00FF      ) & 0xFF));
+        list.add((byte)(((this.group      & 0xFF00) >>  8) & 0xFF));
+        list.add((byte)(((this.group      & 0x00FF)      ) & 0xFF));
+
+        list.add((byte)(((this.controller & 0xFF00) >>  8) & 0xFF));
+        list.add((byte)(((this.controller & 0x00FF)      ) & 0xFF));
+
+        list.add((byte)(((this.sequence   & 0xFF00) >>  8) & 0xFF));
+        list.add((byte)(((this.sequence   & 0x00FF)      ) & 0xFF));
+
         list.add((byte)(this.opCode & 0xFF));
-        list.add((byte)((this.length & 0xFF000000 >> 24) & 0xFF));
-        list.add((byte)((this.length & 0x00FF0000 >> 16) & 0xFF));
-        list.add((byte)((this.length & 0x0000FF00 >>  8) & 0xFF));
-        list.add((byte)((this.length & 0x000000FF      ) & 0xFF));
+
+        list.add((byte)(((this.length & 0xFF000000) >> 24) & 0xFF));
+        list.add((byte)(((this.length & 0x00FF0000) >> 16) & 0xFF));
+        list.add((byte)(((this.length & 0x0000FF00) >>  8) & 0xFF));
+        list.add((byte)(((this.length & 0x000000FF)      ) & 0xFF));
 
         return Bytes.toArray(list);
     }

+ 15 - 0
src/test/java/com/its/app/VmsCommServerApplicationTests.java

@@ -30,4 +30,19 @@ public class VmsCommServerApplicationTests {
         eVmsOpCode opCode = eVmsOpCode.getValue(b);
         log.info("{}, {}", b, opCode);
     }
+
+    @Test
+    void crc() {
+        //byte[] data = {(byte)0x05, (byte)0x9A, (byte)0x01, (byte)0x01, (byte)0x1A, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x23, (byte)0x28, (byte)0x00, (byte)0x01, (byte)0x23, (byte)0x28, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x00, (byte)0x07, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x20, (byte)0x00, (byte)0xA0, (byte)0x00, (byte)0x00, (byte)0x0B};
+        byte[] data = {(byte)0x10, (byte)0x02,
+                (byte)0x00, (byte)0x05, (byte)0x9A, (byte)0x01, (byte)0x01, (byte)0x1A, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x23,
+                (byte)0x28, (byte)0x00, (byte)0x01, (byte)0x23, (byte)0x28, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x02,
+                (byte)0x00, (byte)0x07, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x20,
+                (byte)0x00, (byte)0xA0, (byte)0x00, (byte)0x00, (byte)0x0B,
+                (byte)0x10, (byte)0x03, (byte)0x00, (byte)0x04};
+//        int arc = Crc16.ARC(data, 2, data.length - 6);
+//        log.info("ARC: {}, {}", arc, String.format("%X", arc));
+//        int arc1 = VmsDleFramePacket.getCRC16ARC(data, 2, data.length - 6);
+//        log.info("ARC: {}, {}", arc1, String.format("%X", arc1));
+    }
 }