Browse Source

[update iso15118 after test with VW]

    2020.12.16 / vern.chang

    Actions:
    1. update iso15118 and some issue fixed after VW test
    2. remove ID assign process, ID will be same as GPIO from CSU

    Files:
    1. CCS/Apps/*
    2. CsuComm.c

    Image version: D0.16.S0
    Image checksum: XXXXXXX

    Hardware PWB P/N : XXXXXXX
    Hardware Version : XXXXXXX
vern.chang 4 năm trước cách đây
mục cha
commit
f068fbaf22
100 tập tin đã thay đổi với 35309 bổ sung1818 xóa
  1. 3271 456
      EVSE/Projects/CCS/Apps/CsuComm.c
  2. 98 0
      EVSE/Projects/CCS/Apps/CsuComm.h
  3. 465 0
      EVSE/Projects/CCS/Apps/CsuCommAC.h
  4. 266 39
      EVSE/Projects/CCS/Apps/EventLogging.c
  5. 55 0
      EVSE/Projects/CCS/Apps/EventLogging.h
  6. 57 12
      EVSE/Projects/CCS/Apps/FWMaker.c
  7. 54 0
      EVSE/Projects/CCS/Apps/FWMaker.h
  8. 1344 0
      EVSE/Projects/CCS/Apps/FWUpdate.c
  9. 75 0
      EVSE/Projects/CCS/Apps/FWUpdate.h
  10. 69 53
      EVSE/Projects/CCS/Apps/FactoryConfig.c
  11. 54 0
      EVSE/Projects/CCS/Apps/FactoryConfig.h
  12. 41 17
      EVSE/Projects/CCS/Apps/Makefile
  13. 49 0
      EVSE/Projects/CCS/Apps/NidNmk.c
  14. 55 0
      EVSE/Projects/CCS/Apps/NidNmk.h
  15. 1238 0
      EVSE/Projects/CCS/Apps/PCBATester.c
  16. 66 0
      EVSE/Projects/CCS/Apps/PCBATester.h
  17. BIN
      EVSE/Projects/CCS/Apps/SeccComm
  18. 16353 0
      EVSE/Projects/CCS/Apps/SeccComm.c
  19. 236 0
      EVSE/Projects/CCS/Apps/SeccComm.h
  20. 584 553
      EVSE/Projects/CCS/Apps/define.h
  21. 5076 0
      EVSE/Projects/CCS/Apps/exi_engine/api/api.c
  22. 173 0
      EVSE/Projects/CCS/Apps/exi_engine/api/api.h
  23. 2 1
      EVSE/Projects/CCS/Apps/exi_engine/appHandshake/appHandEXIDatatypes.h
  24. 1 3
      EVSE/Projects/CCS/Apps/exi_engine/codec/EXIHeaderDecoder.c
  25. 0 0
      EVSE/Projects/CCS/Apps/exi_engine/din/dinEXIDatatypesDecoder.c
  26. 1 1
      EVSE/Projects/CCS/Apps/exi_engine/iso1/iso1EXIDatatypes.h
  27. 77 77
      EVSE/Projects/CCS/Apps/exi_engine/iso2/iso2EXIDatatypes.h
  28. 2 2
      EVSE/Projects/CCS/Apps/exi_engine/iso2/iso2EXIDatatypesDecoder.h
  29. 2 2
      EVSE/Projects/CCS/Apps/exi_engine/iso2/iso2EXIDatatypesEncoder.h
  30. 11 3
      EVSE/Projects/CCS/Apps/exi_engine/test/main.c
  31. 175 10
      EVSE/Projects/CCS/Apps/exi_engine/test/main_example.c
  32. 262 136
      EVSE/Projects/CCS/Apps/main.c
  33. 55 0
      EVSE/Projects/CCS/Apps/main.h
  34. 733 0
      EVSE/Projects/CCS/Apps/version.h
  35. BIN
      EVSE/Projects/CCS/Images/MLO
  36. BIN
      EVSE/Projects/CCS/Images/am335x-evm.dtb
  37. BIN
      EVSE/Projects/CCS/Images/ramdisk.gz
  38. BIN
      EVSE/Projects/CCS/Images/u-boot.img
  39. BIN
      EVSE/Projects/CCS/Images/zImage
  40. 3001 0
      EVSE/Projects/CCS/Log/CCS_CAN_log.txt
  41. 29 0
      EVSE/Projects/CCS/Log/CSU_Simulatation_Tx_MSG.list
  42. 150 453
      EVSE/Projects/CCS/Log/Debug_Log.txt
  43. BIN
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra.pcap
  44. 22 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/CableCheckReq.xml
  45. 25 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/CableCheckRes_Invalid.xml
  46. 25 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/CableCheckRes_Valid.xml
  47. 38 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ChargeParameterDiscoveryReq.xml
  48. 76 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ChargeParameterDiscoveryRes.xml
  49. 14 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ContractAuthenticationReq.xml
  50. 19 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ContractAuthenticationRes.xml
  51. 44 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/CurrentDemandReq.xml
  52. 52 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/CurrentDemandRes.xml
  53. 29 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/PowerDeliveryReq.xml
  54. 24 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/PowerDeliveryRes.xml
  55. 32 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/PreChargeReq.xml
  56. 29 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/PreChargeRes.xml
  57. 18 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ServiceDiscoveryReq.xml
  58. 29 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ServiceDiscoveryRes.xml
  59. 23 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ServicePaymentSelectionReq.xml
  60. 18 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ServicePaymentSelectionRes.xml
  61. 18 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/SessionSetupReq.xml
  62. 20 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/SessionSetupRes.xml
  63. 10 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/supportedAppProtocolReq.xml
  64. 5 0
      EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/supportedAppProtocolRes.xml
  65. BIN
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/[D0.30.11.1D][20200401-06_16_27.544378]packets.pcap
  66. 16 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/AuthorizationReq.xml
  67. 19 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/AuthorizationRes.xml
  68. 22 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/CableCheckReq.xml
  69. 25 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/CableCheckRes.xml
  70. 39 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/ChargeParameterDiscoveryReq.xml
  71. 2 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/ChargeParameterDiscoveryRes.xml
  72. 33 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/CurrentDemandReq.xml
  73. 54 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/CurrentDemandRes.xml
  74. 23 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PaymentServiceSelectionReq.xml
  75. 18 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PaymentServiceSelectionRes.xml
  76. 28 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PowerDeliveryReq(End).xml
  77. 28 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PowerDeliveryReq(Start).xml
  78. 24 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PowerDeliveryRes(End).xml
  79. 24 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PowerDeliveryRes(Start).xml
  80. 32 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PreChargeReq.xml
  81. 29 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PreChargeRes.xml
  82. 18 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/ServiceDiscoveryReq.xml
  83. 30 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/ServiceDiscoveryRes.xml
  84. 18 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/SessionSetupReq.xml
  85. 20 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/SessionSetupRes.xml
  86. 18 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/SessionStopReq.xml
  87. 18 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/SessionStopRes.xml
  88. 13 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/supportedAppProtocolReq.xml
  89. 8 0
      EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/supportedAppProtocolRes.xml
  90. BIN
      EVSE/Projects/CCS/doc/CCS module.vsdx
  91. BIN
      EVSE/Projects/CCS/doc/CharIN Implementation Guide to DIN_70121 2014.docx
  92. BIN
      EVSE/Projects/CCS/doc/CharIN_Test_Cases_for_DIN-70121_Implementation_Guide.docx
  93. BIN
      EVSE/Projects/CCS/doc/Define.h.xlsx
  94. BIN
      EVSE/Projects/CCS/doc/Design for FSW.xlsx
  95. BIN
      EVSE/Projects/CCS/doc/EV Board Communication Protocol - flowchart.pdf
  96. BIN
      EVSE/Projects/CCS/doc/EV Board Communication Protocol - flowchart.vsd
  97. BIN
      EVSE/Projects/CCS/doc/EV Board Communication Protocol.docx
  98. BIN
      EVSE/Projects/CCS/doc/EVSE Model Name Naming Rule.xlsx
  99. BIN
      EVSE/Projects/CCS/doc/Firmware Design Specification-CCS module.docx
  100. BIN
      EVSE/Projects/CCS/doc/Firmware Image and Update Behavior.docx

+ 3271 - 456
EVSE/Projects/CCS/Apps/CsuComm.c

@@ -18,157 +18,555 @@
 #include <sys/mman.h>
 #include <linux/sockios.h>
 #include <linux/socket.h>
+#include <linux/can.h>
+#include <linux/can/raw.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/time.h>
 #include <sys/timeb.h>
 #include <math.h>//for pow
 #include <net/if.h>
-#include <linux/can.h>
-#include <linux/can/raw.h>
 #include <unistd.h>
 #include "define.h"
 #include "CsuComm.h"
+#include "SeccComm.h"
+#include "exi_engine/api/api.h"
+
+struct SysConfigAndInfo             *ShmSysConfigAndInfo;
+struct StatusCodeData               *ShmStatusCodeData;
+struct CcsData                      *ShmCcsData;
+struct InternalComm                 *ShmInternalComm;
+struct InternalCommAC               *ShmInternalCommAC;
+
+pid_t PID_CAN_Rx_Task;
+pid_t PID_CsuComm_Error_Monitor_Task;
+int FD_CAN_Socket;
+unsigned char buf_log_csucomm[SIZE_OF_LOG_BUFFER];
+unsigned char buf_log_csucomm_fork1[SIZE_OF_LOG_BUFFER];
+unsigned char buf_log_csucomm_fork2[SIZE_OF_LOG_BUFFER];
 
-//#define Debug
-
-//Protocol format : Dir
-#define SendDirection               0x08000000
-#define RecvDirection               0x00000000
-//Protocol format : Message ID
-#define MsgAddressRequest           0x00000100
-#define MsgAddressAssign            0x00000200
-#define MsgStatusNotification       0x00000300
-#define MsgGetFwVersion             0x00000400
-#define MsgGetHwVersion             0x00000500
-#define MsgChargingPermission       0x00000600
-#define MsgPresentOutputPower       0x00000700
-#define MsgPresentOutputCapacity    0x00000800
-#define MsgGetOutputRequirement     0x00000900
-#define MsgGetEvBatteryInfo         0x00000A00
-#define MsgEvStopEvent              0x00000B00
-#define MsgEvseStopEvent            0x00000C00
-#define MsgGetMiscInfo              0x00000D00
-#define MsgDownloadRequest          0x00000E00
-#define MsgStartBlockTransfer       0x00000F00
-#define MsgDataTransfer             0x00001000
-#define MsgDownloadFinish           0x00001100
-
-struct SysConfigAndInfo     *ShmSysConfigAndInfo;
-struct StatusCodeData       *ShmStatusCodeData;
-struct CcsData              *ShmCcsData;
-struct InternalComm         *ShmInternalComm;
-pid_t CANReceiverPid;
-int CanFd;
-
-#ifdef SystemLogMessage
-    int StoreLogMsg(unsigned char *DataString)
-    {
-        unsigned char Buf[256];
-        time_t CurrentTime;
-        struct tm *tm;
-
-        memset(Buf, 0, sizeof(Buf));
-        CurrentTime = time(NULL);
-        tm = localtime(&CurrentTime);
-        sprintf(Buf, "echo \"%04d.%02d.%02d %02d:%02d:%02d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-                tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
-                DataString,
-                tm->tm_year + 1900, tm->tm_mon + 1);
-        system(Buf);
+/*===========================================================================
+FUNCTION: GetSysTime()
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PrintTimeStamp()
+{
+    //static time_t CurrentTime;
+    //static struct tm *tm;
+    static struct timeval tv;
+    //CurrentTime = time(NULL);
+    //tm = localtime(&CurrentTime);
+    gettimeofday(&tv, NULL); // get microseconds, 10^-6
+    //printf("[%02d:%02d:%02d.%06d]",
+    //        tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec);
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[%05d.%06d]", tv.tv_sec, tv.tv_usec);
+}
 
-        #ifdef Debug
-            printf("%s \n", DataString);
-        #endif
+/*===========================================================================
+FUNCTION: Check_V2G_Flow_Status
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Check_V2G_Flow_Status()
+{
+    unsigned char result = 0;
+
+    switch (ShmCcsData->CommProtocol)
+    {
+        case V2GT_MSG_PROTOCOL_DIN70121:        //0
+        {
+            result = ShmCcsData->V2GMessage_DIN70121.PresentMsgFlowStatus;
+            break;
+        }
+
+        case V2GT_MSG_PROTOCOL_ISO15118_2014:   //1
+        {
+            result = ShmCcsData->V2GMessage_ISO15118_2014.PresentMsgFlowStatus;
+            break;
+        }
+
+        case V2GT_MSG_PROTOCOL_ISO15118_2018:   //2
+        {
+            result = ShmCcsData->V2GMessage_ISO15118_2018.PresentMsgFlowStatus;
+            break;
+        }
+
+        default:
+            break;
     }
+    return result;
+}
+
+
+/*===========================================================================
+FUNCTION: StoreLogMsg
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#if SAVE_SYS_LOG_MSG_CSUCOMM_SWITCH == ENABLE
+int StoreLogMsg(unsigned char *DataString)
+{
+    static unsigned char Buf[256*2];
+    static time_t CurrentTime;
+    static struct tm *tm;
+    static struct timeval tv;
+
+    memset(Buf, 0, sizeof(Buf));
+    CurrentTime = time(NULL);
+    tm = localtime(&CurrentTime);
+    gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][CsuComm][%d][%02d]%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+            tm->tm_year + 1900,
+            tm->tm_mon + 1,
+            tm->tm_mday,
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            EVCOMM_SYS_INFO.CpState,
+            Check_V2G_Flow_Status(),
+            DataString,
+            tm->tm_year + 1900,
+            tm->tm_mon + 1);
+    system(Buf);
+
+    DEBUG_PRINTF_CSUCOMM_SYSTEM_LOG("[%02d:%02d:%02d.%06d][CsuComm][%d][%02d]%s \n",
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            EVCOMM_SYS_INFO.CpState,
+            Check_V2G_Flow_Status(),
+            DataString);
+
+    //Reset the buf_log_csucomm Buffer, i.e. DataString
+    memset(buf_log_csucomm, 0, SIZE_OF_LOG_BUFFER);
+}
 #endif
 
-int DiffTimeb(struct timeb ST, struct timeb ET)
+/*===========================================================================
+FUNCTION: Array_Check_All_Zero
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+    result:
+    (1) TRUE: all zero
+    (2) FALSE: not all zero
+GLOBAL VARIABLES:
+=============================================================================*/
+int Array_Check_All_Zero(unsigned char *ptr, int size)
+{
+    int result = TRUE;
+    int i = 0;
+
+    for (i = 0; i < size; i++)
+    {
+        if (ptr[i] != 0)
+        {
+            result = FALSE;
+            break;
+        }
+    }
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: Array_Compare_Identity
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+    result = FALSE (not identical)
+    result = TRUE  (identical)
+GLOBAL VARIABLES:
+=============================================================================*/
+int Array_Compare_Identity(unsigned char *ptrA, unsigned char *ptrB, int size)
+{
+    int result = TRUE;
+    int i = 0;
+
+    for (i = 0; i < size; i++)
+    {
+        if (ptrA[i] != ptrB[i])
+        {
+            result = FALSE;
+
+            #if 0
+            sprintf(buf_log_evcomm,
+                    "[Array_Compare_Identity]%02X%02X%02X%02X%02X%02X,%02X%02X%02X%02X%02X%02X(%d)\n",
+                    ptrA[0], ptrA[1], ptrA[2], ptrA[3], ptrA[4], ptrA[5],
+                    ptrB[0], ptrB[1], ptrB[2], ptrB[3], ptrB[4], ptrB[5],
+                    result);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            #endif
+            break;
+        }
+    }
+    return result;
+}
+
+
+/*===========================================================================
+FUNCTION: CAN_Tx_MSG
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CAN_Tx_MSG(int Fd, unsigned int MsgId, unsigned char SlaveAddress, unsigned char DataLength, unsigned char *SendData)
+{
+    struct can_frame frame;
+    unsigned int tmp = 0;
+    int nbytes = 0;
+    int i = 0;
+
+    //Protection: To avoid unexpected length for CAN bus payload.
+    if (DataLength > 8)
+    {
+        DataLength = 8;
+    }
+
+    memset(&frame, 0, sizeof(struct can_frame));
+    frame.can_id = 0x80000000 | CAN_SEND_DIRECTION | MsgId | SlaveAddress;  //0x80000000: extension ID format
+    frame.can_dlc = DataLength;
+    memcpy(frame.data, SendData, DataLength);
+    nbytes = write(Fd, &frame, sizeof(struct can_frame));
+
+    #if 0
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][CAN_Tx_MSG] <%X> ", frame.can_id);
+    for (i = 0; i < frame.can_dlc; i++)
+    {
+        DEBUG_PRINTF_CSUCOMM_DETAIL("%02X ", frame.data[i]);
+    }
+    DEBUG_PRINTF_CSUCOMM_DETAIL("(%d Bytes)\n", frame.can_dlc);
+    #endif
+
+    return nbytes;
+}
+
+
+/*===========================================================================
+FUNCTION: Sniffer_Candump
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+    0: accept
+   -1: invalid
+GLOBAL VARIABLES:
+=============================================================================*/
+int Sniffer_Candump(char cmd)
+{
+    #if (CANDUMP_PACKETS_SNIFFER_SWITCH == ENABLE)
+    if (cmd == ENABLE)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("[candump]init");
+        system("cd /mnt/;rm -rf candump/");
+        system("cd /mnt/;mkdir candump");
+        SAVE_SYS_LOG_MSG_CSUCOMM("[candump]on");
+        system("cd /mnt/candump;candump -l can0 &");
+        return 0;
+    }
+    else if (cmd == DISABLE)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("[candump]off");
+        system("killall candump");
+
+        SAVE_SYS_LOG_MSG_CSUCOMM("[candump]save");
+        system("cd /;cp -rfv /mnt/candump /Storage/SystemLog/");
+        return 0;
+    }
+    else
+    {
+        sprintf(buf_log_csucomm, "[candump]unexpected cmd(%d)", cmd);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        return -1;
+    }
+    #endif
+}
+
+/*===========================================================================
+FUNCTION: Checksum_Generator
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Checksum_Generator(unsigned int StartAdress, unsigned int length, unsigned char Data[])
+{
+	unsigned char checksum = 0x00;
+
+	for(unsigned int i = 0; i < length; i++)
+	{
+		//DEBUG_INFO("value = %x \n", Data[StartAdress + i]);
+		checksum ^= Data[StartAdress + i];
+		//DEBUG_INFO("checksum = %x \n", checksum);
+	}
+	return checksum;
+}
+
+
+/*===========================================================================
+FUNCTION: CRC32_Generator
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned int CRC32_Generator(unsigned char *data, unsigned int length)
+{
+    unsigned char i;
+    unsigned int cnt = 0;
+    unsigned int crc = 0xffffffff;  // Initial value
+    while(length--)
+    {
+    	if(cnt > 33 && cnt < 48)
+        {
+    		data++;
+    	}
+        else
+        {
+    		crc ^= *data++;         // crc ^= *data; data++;
+			for (i = 0; i < 8; ++i)
+			{
+				if (crc & 1)
+				{
+                    crc = (crc >> 1) ^ 0xEDB88320;// 0xEDB88320= reverse 0x04C11DB7
+                }
+				else
+				{
+                    crc = (crc >> 1);
+                }
+			}
+    	}
+    	cnt++;
+    }
+    return ~crc;
+}
+
+/*===========================================================================
+FUNCTION: Get_GPIO_Value
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Get_GPIO_Value(unsigned int gpio)
+{
+    int fd;
+    char buf[32];
+    char ch;
+
+    snprintf(buf, sizeof(buf), GPIO_SYS_DIR"/gpio%d/value", gpio);
+
+    fd = open(buf, O_RDONLY);
+
+    if (fd < 0)
+    {
+        perror("gpio/get-value");
+        return fd;
+    }
+
+    read(fd, &ch, 1);
+    close(fd);
+
+    if (ch != '0')
+    {
+        return 1;
+    }
+    else
+    {
+        return 0;
+    }
+}
+
+
+/*===========================================================================
+FUNCTION: DiffTimeb
+DESCRIPTION:
+    1. Data structure of timeb.h
+       The <sys/timeb.h> header defines the timeb structure that includes at least the following members:
+       - time_t          time      the seconds portion of the current time
+       - unsigned short  millitm   the milliseconds portion of the current time
+       - short           timezone  the local timezone in minutes west of Greenwich
+       - short           dstflag   TRUE if Daylight Savings Time is in effect
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+double DiffTimeb(struct timeb ST, struct timeb ET)
+{
+    //return milli-second
+    double StartTime, EndTime;
+    double t_diff;
+
+    StartTime = ((double)ST.time)*1000 + (double)ST.millitm;
+    EndTime = ((double)ET.time)*1000 + (double)ET.millitm;
+    t_diff = EndTime - StartTime;
+
+    //printf("%.02lf - %.02lf = %.02lf\n", EndTime, StartTime, t_diff);
+
+    if (t_diff < 0)
+    {
+        #if 0
+        if (t_diff < -1000)   //1000ms
+        {
+            sprintf(buf_log_csucomm,
+                    "[Warning]StartTime(%.02lf) > EndTime(%.02lf), d(%.02lf)",
+                    StartTime,
+                    EndTime,
+                    t_diff);
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        }
+        #endif
+
+        return -1;
+    }
+    return t_diff;
+}
+
+/*===========================================================================
+FUNCTION: DiffTimeb_CsuComm_fork1
+DESCRIPTION:
+    1. fork1
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+double DiffTimeb_CsuComm_fork1(struct timeb ST, struct timeb ET)
 {
     //return milli-second
-    unsigned int StartTime, StopTime;
+    double StartTime, EndTime;
+    double t_diff;
+
+    StartTime = ((double)ST.time)*1000 + (double)ST.millitm;
+    EndTime = ((double)ET.time)*1000 + (double)ET.millitm;
+    t_diff = EndTime - StartTime;
+
+    if (t_diff < 0)
+    {
+        #if 0
+        if (t_diff < -1000)   //1000ms
+        {
+            sprintf(buf_log_csucomm_fork1,
+                    "[fork1][Warning]StartTime(%.02lf) > EndTime(%.02lf), d(%.02lf)",
+                    StartTime,
+                    EndTime,
+                    t_diff);
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm_fork1);
+        }
+        #endif
 
-    StartTime = (unsigned int)ST.time;
-    StopTime = (unsigned int)ET.time;
-    return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
+        return -1;
+    }
+    return t_diff;
 }
 
-/**************************************************************************************/
-/**************************Init all share memory *********************************/
-/**************************************************************************************/
-int InitShareMemory()
+
+/*===========================================================================
+FUNCTION: ShareMemory_Init
+DESCRIPTION
+        Initialize all share memories.
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int ShareMemory_Init()
 {
     int MeterSMId;
 
-    //creat ShmSysConfigAndInfo
+    //[1/5] create ShmSysConfigAndInfo
     if((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitShareMemory:shmget ShmSysConfigAndInfo NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmSysConfigAndInfo NG");
         return 0;
     }
     else if((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *)-1)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitShareMemory:shmat ShmSysConfigAndInfo NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmSysConfigAndInfo NG");
         return 0;
     }
 
-    //creat ShmStatusCodeData
+    //[2/5] create ShmStatusCodeData
     if((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitShareMemory:shmget ShmStatusCodeData NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmStatusCodeData NG");
         return 0;
     }
     else if((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitShareMemory:shmat ShmStatusCodeData NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmStatusCodeData NG");
         return 0;
     }
 
-    //creat ShmCcsData
+    //[3/5] create ShmCcsData
     if((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData),  0777)) < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitShareMemory:shmget ShmCcsData NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmCcsData NG");
         return 0;
     }
     else if((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitShareMemory:shmat ShmCcsData NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmCcsData NG");
         return 0;
     }
 
-    //creat ShmInternalComm
+    //[4/5] create ShmInternalComm
     if((MeterSMId = shmget(ShmInternalCommKey, sizeof(struct InternalComm),  IPC_CREAT | 0777)) < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitShareMemory:shmget ShmInternalComm NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmInternalComm NG");
         return 0;
     }
     else if((ShmInternalComm = shmat(MeterSMId, NULL, 0)) == (void *)-1)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitShareMemory:shmat ShmInternalComm NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmInternalComm NG");
         return 0;
     }
+    //memset(ShmInternalComm, 0, sizeof(struct InternalComm));
 
-    memset(ShmInternalComm, 0, sizeof(struct InternalComm));
+    //[5/5] create ShmInternalCommAC
+    if((MeterSMId = shmget(ShmInternalCommACKey, sizeof(struct InternalCommAC),  IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmInternalCommAC NG");
+        return 0;
+    }
+    else if((ShmInternalCommAC = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmInternalCommAC NG");
+        return 0;
+    }
+    //memset(ShmInternalCommAC, 0, sizeof(struct InternalCommAC));
     return 1;
 }
 
-int InitCanBus()
+/*===========================================================================
+FUNCTION: CANBus_Init
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CANBus_Init()
 {
     int s0, nbytes;
     struct timeval tv;
@@ -179,33 +577,31 @@ int InitCanBus()
     system("/sbin/ip link set can0 up");
 
     s0 = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+    if (s0 < 0) //added by Joseph (not full implemented)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("[ERROR] Fail on initializing CAN Bus socket");
+    }
 
     tv.tv_sec = 0;
     tv.tv_usec = 10000;
 
     if(setsockopt(s0, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval)) < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitCanBus:Set SO_RCVTIMEO NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("CANBus_Init:Set SO_RCVTIMEO NG");
     }
 
     nbytes = 40960;
 
     if(setsockopt(s0, SOL_SOCKET,  SO_RCVBUF, &nbytes, sizeof(int)) < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitCanBus:Set SO_RCVBUF NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("CANBus_Init:Set SO_RCVBUF NG");
     }
 
     nbytes = 40960;
 
     if(setsockopt(s0, SOL_SOCKET, SO_SNDBUF, &nbytes, sizeof(int)) < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]InitCanBus:Set SO_SNDBUF NG");
-        #endif
+        SAVE_SYS_LOG_MSG_CSUCOMM("CANBus_Init:Set SO_SNDBUF NG");
     }
 
     strcpy(ifr0.ifr_name, "can0" );
@@ -216,521 +612,2940 @@ int InitCanBus()
     return s0;
 }
 
-int SendMsg(int Fd, unsigned int MsgId, unsigned char SlaveAddress, unsigned char DataLength, unsigned char *SendData)
-{
-    struct can_frame frame;
-    struct timeb StartTime, EndTime;
-    unsigned int tmp = 0;
-    int nbytes;
-
-    memset(&frame, 0, sizeof(struct can_frame));
-    frame.can_id = 0x80000000 | SendDirection | MsgId | SlaveAddress;
-    frame.can_dlc = DataLength;
-    memcpy(frame.data, SendData, DataLength);
-    nbytes = write(Fd, &frame, sizeof(struct can_frame));
-    #ifdef Debug
-        printf("[CsuComm]SendMsg => Send to ID=0x%x, nbytes=0x%x, DataLength=0x%x, Data=0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x\n",
-               frame.can_id, nbytes, frame.can_dlc,
-               frame.data[0], frame.data[1], frame.data[2], frame.data[3], frame.data[4], frame.data[5], frame.data[6], frame.data[7]);
-    #endif
-    return nbytes;
-}
-
-int SendFwVersion(int Fd)
-{
-    int nbytes;
-    unsigned char Buffer[4];
-
-    memset(Buffer, 0, sizeof(Buffer));
-    nbytes = FirmwareVersion;
-    memcpy(Buffer, &nbytes, sizeof(int));
-    nbytes = SendMsg(Fd, MsgGetFwVersion, ShmInternalComm->SlaveAddress, sizeof(int), Buffer);
-    return nbytes;
-}
-
-int SendHwVersion(int Fd)
-{
-    int nbytes;
-    unsigned char Buffer[4];
-
-    memset(Buffer, 0, sizeof(Buffer));
-    nbytes = FirmwareVersion;
-    memcpy(Buffer, &nbytes, sizeof(int));
-    nbytes = SendMsg(Fd, MsgGetFwVersion, ShmInternalComm->SlaveAddress, sizeof(int), Buffer);
-    return nbytes;
-}
 
-int SendStatusNotification(int Fd)
+/*===========================================================================
+FUNCTION: Update_EVSE_INFO_to_SHMs
+DESCRIPTION:
+        Updating all corresponding content in each Share Memory.
+        1. I_now
+        2. V_now
+        3. P_now
+        4. I_max
+        5. V_max
+        6. P_max
+
+PRE-CONDITION:
+INPUT:
+        1. ShmInternalComm
+OUTPUT:
+        1. ShmCcsData
+            * PreChargeResponse
+            * CurrentDemandResponse
+            * WeldingDetectionResponse
+
+        2. ShmSysConfigAndInfo
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void Update_EVSE_INFO_to_SHMs()
 {
-    int nbytes;
-    unsigned char Buffer[8];
+    int I_now = 0;  //0.1A
+    int V_now = 0;  //0.1V
+    int P_now = 0;  //0.1KW
 
-    memset(Buffer, 0, sizeof(Buffer));
-    Buffer[0] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].ConnectorPlugIn;
-    Buffer[1] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState;
+    int I_max = 0;  //0.1A
+    int V_max = 0;  //0.1V
+    int P_max = 0;  //0.1KW
 
-    if(strlen(ShmStatusCodeData->PresentStatusCode[0]) > 0)
+    //[CAUTION] Re-initializing process is necessary. (to-be implemented)
+    //----------[1/7] Permission --------
+    if (ShmInternalComm->ChargingPermission_new != ShmInternalComm->ChargingPermission)
     {
-        memcpy(Buffer + 2, ShmStatusCodeData->PresentStatusCode[0], 6);
+        sprintf(buf_log_csucomm, "Permission: %d >> %d",
+                ShmInternalComm->ChargingPermission,
+                ShmInternalComm->ChargingPermission_new
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->ChargingPermission_pre = ShmInternalComm->ChargingPermission;
+        ShmInternalComm->ChargingPermission = ShmInternalComm->ChargingPermission_new;
     }
 
-    nbytes = SendMsg(Fd, MsgStatusNotification, ShmInternalComm->SlaveAddress, 8, Buffer);
-    return nbytes;
-}
-
-float DIN70121PhyValDecode(struct PhysicalValueType_DIN70121 PhysicalData)
-{
-    short DataValue;
-    int DataMultiplier;
-    float Rtn;
-
-    DataValue = PhysicalData.Value;
-    DataMultiplier = PhysicalData.Multiplier;
-
-    switch(PhysicalData.Unit)
+    // -------- [2/7] I_now --------
+    I_now = ShmInternalComm->PresentChargingCurrent;
+    EVCOMM_SYS_INFO.PresentChargingCurrent = I_now / 10.0; //1A
+    if (ShmInternalComm->PresentChargingCurrent_pre != ShmInternalComm->PresentChargingCurrent)
     {
-    case h_DIN70121:
-        Rtn = (DataValue * (10 ^ DataMultiplier) * 60 * 60);
-        return Rtn;
+        //if (abs(ShmInternalComm->PresentChargingCurrent_pre - ShmInternalComm->PresentChargingCurrent) > 10) //10/;1A
+        //{
+            //memset(buf_log_csucomm, 0, sizeof(buf_log_csucomm));
+            sprintf(buf_log_csucomm, "I_now(EVSE): %d >> %d (0.1A, DEC)",
+                    ShmInternalComm->PresentChargingCurrent_pre,
+                    ShmInternalComm->PresentChargingCurrent
+                   );
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        //}
+
+        ShmInternalComm->PresentChargingCurrent_pre = ShmInternalComm->PresentChargingCurrent;
+    }
 
-    case m_DIN70121:
-        Rtn = (DataValue * (10 ^ DataMultiplier) * 60);
-        return Rtn;
+    // -------- [3/7] V_now --------
+    V_now = ShmInternalComm->PresentChargingVoltage;
+    EVCOMM_SYS_INFO.PresentChargingVoltage = V_now / 10.0; //1V
+    if (ShmInternalComm->PresentChargingVoltage_pre != ShmInternalComm->PresentChargingVoltage)
+    {
+        if (abs(ShmInternalComm->PresentChargingVoltage_pre - ShmInternalComm->PresentChargingVoltage) > 10) //10:1V
+        {
+            unsigned char state = 0;
+            state = Check_V2G_Flow_Status();
 
-    case s_DIN70121:
-    case A_DIN70121:
-    case V_DIN70121:
-        Rtn = (DataValue * (10 ^ DataMultiplier));
-        return Rtn;
+            if(state == CableCheckRequest    || state == CableCheckResponse ||      //37, 38
+               state == PreChargeRequest     || state == PreChargeResponse  ||      //39, 40
+               state == CurrentDemandRequest || state == CurrentDemandResponse)     //45, 46
+            {
+                if ((ShmInternalComm->PresentChargingVoltage <= 600) ||  //600:60V
+                    (ShmInternalComm->PresentChargingVoltage >= 1500)    //1500:150V
+                   )
+                {
+                    sprintf(buf_log_csucomm, "V_now(EVSE): %d >> %d (0.1V, DEC)",
+                            ShmInternalComm->PresentChargingVoltage_pre,
+                            ShmInternalComm->PresentChargingVoltage
+                          );
+                    SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+                }
+            }
+            else
+            {
+                sprintf(buf_log_csucomm, "V_now(EVSE): %d >> %d (0.1V, DEC)",
+                        ShmInternalComm->PresentChargingVoltage_pre,
+                        ShmInternalComm->PresentChargingVoltage
+                      );
+                SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+            }
+        }
+        ShmInternalComm->PresentChargingVoltage_pre = ShmInternalComm->PresentChargingVoltage;
+    }
 
-    case Ah_DIN70121:
-        Rtn = (DataValue * (10 ^ DataMultiplier));
-        return Rtn;
 
-    case VA_DIN70121:
-    case W_DIN70121:
-        Rtn = (DataValue * (10 ^ DataMultiplier) / 1000);
-        return Rtn;    //kW
+    // -------- [4/7] P_now --------
+    ShmInternalComm->PresentChargingPower = (int)(((I_now/10) * (V_now/10)) / 100);  //0.1KW
+    P_now = ShmInternalComm->PresentChargingPower;
+    EVCOMM_SYS_INFO.PresentChargingPower = P_now * 10.0;   //1KW
+    if (ShmInternalComm->PresentChargingPower_pre != ShmInternalComm->PresentChargingPower)
+    {
+        sprintf(buf_log_csucomm, "P_now(EVSE): %d >> %d (0.1KW, DEC)",
+                ShmInternalComm->PresentChargingPower_pre,
+                ShmInternalComm->PresentChargingPower);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-    case Wh_DIN70121:
-        Rtn = (DataValue * (10 ^ DataMultiplier) / 1000);
-        return Rtn;    //kWh
+        ShmInternalComm->PresentChargingPower_pre = ShmInternalComm->PresentChargingPower;
     }
-}
 
-float ISO151182014PhyValDecode(struct PhysicalValueType_ISO15118_2014 PhysicalData)
-{
-    short DataValue;
-    int DataMultiplier;
-    float Rtn;
+    // -------- [5/7] I_max --------
+    I_max = ShmInternalComm->AvailableChargingCurrent;
+    EVCOMM_SYS_INFO.AvailableChargingCurrent = I_max / 10.0;   //1A
+    if (ShmInternalComm->AvailableChargingCurrent_pre != ShmInternalComm->AvailableChargingCurrent)
+    {
+        sprintf(buf_log_csucomm, "I_max(EVSE): %d >> %d (0.1A, DEC)",
+                ShmInternalComm->AvailableChargingCurrent_pre,
+                ShmInternalComm->AvailableChargingCurrent);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-    DataValue = PhysicalData.Value;
-    DataMultiplier = PhysicalData.Multiplier;
+        ShmInternalComm->AvailableChargingCurrent_pre = ShmInternalComm->AvailableChargingCurrent;
+    }
 
-    switch(PhysicalData.Unit)
+    // -------- [6/7] V_max --------
+    V_max = ShmInternalComm->MaximumChargingVoltage;
+    EVCOMM_SYS_INFO.MaximumChargingVoltage = V_max / 10.0;   //1V
+    if (ShmInternalComm->MaximumChargingVoltage_pre != ShmInternalComm->MaximumChargingVoltage)
     {
-    case h_ISO15118_2014:
-        Rtn = (DataValue * (10 ^ DataMultiplier) * 60 * 60);
-        return Rtn;
+        sprintf(buf_log_csucomm, "V_max(EVSE): %d >> %d (0.1V, DEC)",
+                ShmInternalComm->MaximumChargingVoltage_pre,
+                ShmInternalComm->MaximumChargingVoltage
+              );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-    case m_ISO15118_2014:
-        Rtn = (DataValue * (10 ^ DataMultiplier) * 60);
-        return Rtn;
-
-    case s_ISO15118_2014:
-    case A_ISO15118_2014:
-    case V_ISO15118_2014:
-        Rtn = (DataValue * (10 ^ DataMultiplier));
-        return Rtn;
+        ShmInternalComm->MaximumChargingVoltage_pre = ShmInternalComm->MaximumChargingVoltage;
+    }
 
-    case W_ISO15118_2014:
-        Rtn = (DataValue * (10 ^ DataMultiplier) / 1000);
-        return Rtn;    //kW
+    // -------- [7/7] P_max --------
+    P_max = ShmInternalComm->AvailableChargingPower;
+    EVCOMM_SYS_INFO.AvailableChargingPower = P_max / 10.0;   //1KW
+    if (ShmInternalComm->AvailableChargingPower_pre != ShmInternalComm->AvailableChargingPower)
+    {
+        sprintf(buf_log_csucomm, "P_max(EVSE): %d >> %d (0.1KW, DEC)",
+                ShmInternalComm->AvailableChargingPower_pre,
+                ShmInternalComm->AvailableChargingPower);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-    case Wh_ISO15118_2014:
-        Rtn = (DataValue * (10 ^ DataMultiplier) / 1000);
-        return Rtn;    //kWh
+        ShmInternalComm->AvailableChargingPower_pre = ShmInternalComm->AvailableChargingPower;
     }
 }
 
-int SendOutputReq(int Fd)
+
+/*===========================================================================
+FUNCTION: Proc_EVBoardStatusRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_EVBoardStatusRes(int Fd)
 {
     int nbytes;
     unsigned char Buffer[8];
-    unsigned short TmpValue;
 
     memset(Buffer, 0, sizeof(Buffer));
 
-    if(ShmCcsData->CommProtocol == 1)
-    {
-        //DIN70121
-        Buffer[0] = ShmCcsData->V2GMessage_DIN70121.PresentMsgFlowStatus;
-        Buffer[1] = ShmCcsData->V2GMessage_DIN70121.CurrentDemandRequest.DC_EVStatus.EVRESSSOC;
+    Buffer[0] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].ConnectorPlugIn;
 
-        TmpValue = DIN70121PhyValDecode(ShmCcsData->V2GMessage_DIN70121.CurrentDemandRequest.EVTargetVoltage) * 10;
-        memcpy(Buffer + 2, &TmpValue, 2);
-        TmpValue = DIN70121PhyValDecode(ShmCcsData->V2GMessage_DIN70121.CurrentDemandRequest.EVTargetCurrent) * 10;
-        memcpy(Buffer + 4, &TmpValue, 2);
-        TmpValue = DIN70121PhyValDecode(ShmCcsData->V2GMessage_DIN70121.CurrentDemandRequest.RemainingTimeToFullSoC);
-        memcpy(Buffer + 6, &TmpValue, 2);
-    }
-    else if(ShmCcsData->CommProtocol == 2)
-    {
-        //ISO15118_2014
-        Buffer[0] = ShmCcsData->V2GMessage_ISO15118_2014.PresentMsgFlowStatus;
-        Buffer[1] = ShmCcsData->V2GMessage_ISO15118_2014.CurrentDemandRequest.DC_EVStatus.EVRESSSOC;
+    Buffer[1] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].CpState;
 
-        TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.CurrentDemandRequest.EVTargetVoltage) * 10;
-        memcpy(Buffer + 2, &TmpValue, 2);
-        TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.CurrentDemandRequest.EVTargetCurrent) * 10;
-        memcpy(Buffer + 4, &TmpValue, 2);
-        TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.CurrentDemandRequest.RemainingTimeToFullSoC);
-        memcpy(Buffer + 6, &TmpValue, 2);
+    /*
+    if(strlen(ShmStatusCodeData->PresentStatusCode[0]) > 0)
+    {
+        memcpy(Buffer + 2, ShmStatusCodeData->PresentStatusCode[0], 6);
     }
+    */
+    Buffer[2] = ShmStatusCodeData->PresentStatusCode[0][0];
+    Buffer[3] = ShmStatusCodeData->PresentStatusCode[0][1];
+    Buffer[4] = ShmStatusCodeData->PresentStatusCode[0][2];
+    Buffer[5] = ShmStatusCodeData->PresentStatusCode[0][3];
+    Buffer[6] = ShmStatusCodeData->PresentStatusCode[0][4];
+    Buffer[7] = ShmStatusCodeData->PresentStatusCode[0][5];
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_EV_BOARD_STATUS, ShmInternalComm->SlaveAddress, 8, Buffer);
+
+    CSUCOMMDC_TASK_FLAG.Send_EVBoardStatus = FALSE;
 
-    nbytes = SendMsg(Fd, MsgStatusNotification, ShmInternalComm->SlaveAddress, 8, Buffer);
     return nbytes;
 }
 
-int SendBatteryInfo(int Fd)
+/*===========================================================================
+FUNCTION: Proc_AddressAssignRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_AddressAssignRes(int Fd)
 {
-    int nbytes;
-    unsigned char Buffer[8];
+
+}
+
+/*===========================================================================
+FUNCTION: Proc_AddressAssignReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_AddressAssignReq(struct can_frame *frame)
+{
+    //[CAUTION] There should not be such message ID here.
+    //          A warning alarm should be recorded.
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][Proc_AddressAssignReq] Unexpected message of address assignment from CSU.\n");
+
+    ShmInternalComm->SlaveAddress = frame->can_id & 0x000000FF;
+    CSUCOMMDC_TASK_FLAG.Got_AssignedAddress = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_GetFirmwareVersionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_GetFirmwareVersionRes(int Fd)
+{
+    int i = 0, j = 0, nbytes = 0;
+    unsigned char str[FIRMWARE_VERSION_LENGTH + 1];
+    unsigned char buf[FIRMWARE_VERSION_LENGTH];
+
+    memset(buf, 0, sizeof(buf));
+    strcpy(str, FIRMWARE_VERSION);
+
+    for(i = 0; i < FIRMWARE_VERSION_LENGTH + 3; i++)
+    {
+        if (str[i] != '_')
+        {
+            buf[j] = str[i];
+            j++;
+        }
+    }
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_GET_FW_VERSION, ShmInternalComm->SlaveAddress, FIRMWARE_VERSION_LENGTH, buf);
+
+    CSUCOMMDC_TASK_FLAG.Got_FWVersionReq = FALSE;
+
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: Proc_GetFirmwareVersionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_GetFirmwareVersionReq(struct can_frame *frame)
+{
+    CSUCOMMDC_TASK_FLAG.Got_FWVersionReq = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_HardwareVersionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_HardwareVersionRes(int Fd)
+{
+    int i = 0, nbytes = 0;
+    unsigned char str[HARDWARE_VERSION_LENGTH + 1];
+    unsigned char buf[HARDWARE_VERSION_LENGTH];
+
+    memset(buf, 0, sizeof(buf));
+    strcpy(str, HARDWARE_VERSION);
+
+    for(i = 0; i < HARDWARE_VERSION_LENGTH; i++)
+    {
+        buf[i] = str[i];
+    }
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_GET_HW_VERSION, ShmInternalComm->SlaveAddress, HARDWARE_VERSION_LENGTH, buf);
+
+    CSUCOMMDC_TASK_FLAG.Got_HWVersionReq = FALSE;
+
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: Proc_HardwareVersionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_HardwareVersionReq(struct can_frame *frame)
+{
+    CSUCOMMDC_TASK_FLAG.Got_HWVersionReq = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_GetMiscellaneousInfoRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_GetMiscellaneousInfoRes(int Fd)
+{
+    //DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][Proc_GetMiscellaneousInfoRes] To-be implemented.\n");
+    int nbytes;
+    unsigned char Buffer[8];
+    unsigned short TmpValue;
+
+    memset(Buffer, 0, sizeof(Buffer));
+
+    Buffer[0] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].ConnectorLocked;
+
+    TmpValue = ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp;
+    memcpy(Buffer + 1, &TmpValue, 2);
+    Buffer[3] = (unsigned char)(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].CpVoltage * 10);
+    Buffer[4] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].CpState;
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_GET_MISC_INFO, ShmInternalComm->SlaveAddress, 7, Buffer);
+    CSUCOMMDC_TASK_FLAG.Got_MiscellaneousInfoReq = FALSE;
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: Proc_GetMiscellaneousInfoReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_GetMiscellaneousInfoReq(struct can_frame *frame)
+{
+    CSUCOMMDC_TASK_FLAG.Got_MiscellaneousInfoReq = TRUE;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_ChargingPermissionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_ChargingPermissionRes(int Fd)
+{
+    //Save into ShmCcsData
+
+    //[1/2] Updating Parameters
+    Update_EVSE_INFO_to_SHMs();
+
+    //[2/2] Check if SECC is in the End_Process or Initial stage
+    if ((EVCOMM_SYS_INFO.End_Process_inused == TRUE) ||
+        (EVCOMM_SYS_INFO.QCA7K_SetKeyDone == FALSE))
+    {
+        if (ShmInternalComm->ChargingPermission == TRUE)
+        {
+            //Update_ShmStatusCode(); //[To-Do] to be implemented
+            //CCS_SECC_Not_Ready_For_Charging (023891)
+            ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+            ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+            ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+            ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+            ShmStatusCodeData->PresentStatusCode[0][4] = 9;
+            ShmStatusCodeData->PresentStatusCode[0][5] = 1;
+            CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+            //This Stop command will be delivered to CSU once SECC receives
+            //one permission as TRUE command.
+        }
+    }
+
+    CSUCOMMDC_TASK_FLAG.Got_ChargingPermission = FALSE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_ChargingPermissionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_ChargingPermissionReq(struct can_frame *frame)
+{
+    ShmInternalComm->ChargingPermission_new = frame->data[0];
+
+    ShmInternalComm->AvailableChargingPower = (unsigned int) ((frame->data[2] << 8) | frame->data[1]);
+    ShmInternalComm->AvailableChargingCurrent = (unsigned int) ((frame->data[4] << 8) | frame->data[3]);
+    ShmInternalComm->MaximumChargingVoltage = (unsigned int) ((frame->data[6] << 8) | frame->data[5]);
+    ShmInternalComm->MaximumAllowedChargingTime = frame->data[7]; //0: unlimited, 0x01: 1 minutes ~ 0xFF: 255 minutes, resolution: 1 minute
+
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][CAN_Rx]\n\
+            \t - AvailableChargingPower   = (%d, %02X, %02X)\n\
+            \t - AvailableChargingCurrent = (%d, %02X, %02X)\n\
+            \t - MaximumChargingVoltage   = (%d, %02X, %02X)\n",
+            ShmInternalComm->AvailableChargingPower,    frame->data[2], frame->data[1],
+            ShmInternalComm->AvailableChargingCurrent,  frame->data[4], frame->data[3],
+            ShmInternalComm->MaximumChargingVoltage,    frame->data[6], frame->data[5]
+          );
+
+    //Update Flag
+    CSUCOMMDC_TASK_FLAG.Got_ChargingPermission = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_EVSEOutputStatusUpdateRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_EVSEOutputStatusUpdateRes(int Fd)
+{
+    Update_EVSE_INFO_to_SHMs();
+
+    //Update Flag
+    CSUCOMMDC_TASK_FLAG.Got_EVSEOutputStatus = FALSE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_EVSEOutputStatusUpdateReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_EVSEOutputStatusUpdateReq(struct can_frame *frame)
+{
+    if(ShmInternalComm->SlaveAddress == 1)
+    {
+        ShmInternalComm->PresentChargingVoltage = ((unsigned int)frame->data[1] << 8 | frame->data[0]);
+        ShmInternalComm->PresentChargingCurrent = ((unsigned int)frame->data[3] << 8 | frame->data[2]);
+    }
+    else
+    {
+        ShmInternalComm->PresentChargingVoltage = ((unsigned int)frame->data[5] << 8 | frame->data[4]);
+        ShmInternalComm->PresentChargingCurrent = ((unsigned int)frame->data[7] << 8 | frame->data[6]);
+    }
+
+    //Update Flag
+    CSUCOMMDC_TASK_FLAG.Got_EVSEOutputStatus = TRUE;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_EVSECapacityUpdateRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_EVSECapacityUpdateRes(int Fd)
+{
+    Update_EVSE_INFO_to_SHMs();
+
+    CSUCOMMDC_TASK_FLAG.Got_EnergyCapacity = FALSE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_EVSECapacityUpdateReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_EVSECapacityUpdateReq(struct can_frame *frame)
+{
+    if(ShmInternalComm->SlaveAddress == 1)
+    {
+        ShmInternalComm->AvailableChargingPower = ((unsigned int)frame->data[1] << 8 | frame->data[0]);
+        ShmInternalComm->AvailableChargingCurrent = ((unsigned int)frame->data[3] << 8 | frame->data[2]);
+    }
+    else
+    {
+        ShmInternalComm->AvailableChargingPower = ((unsigned int)frame->data[5] << 8 | frame->data[4]);
+        ShmInternalComm->AvailableChargingCurrent = ((unsigned int)frame->data[7] << 8 | frame->data[6]);
+    }
+
+    //Update Flag
+    CSUCOMMDC_TASK_FLAG.Got_EnergyCapacity = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_GetEVTargetRes
+DESCRIPTION:
+    #define CAN_CMD_GET_EV_TARGET_INFO                  0x00000900
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_GetEVTargetRes(int Fd)
+{
+    //DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][Proc_GetEVTargetRes] To-be implemented.\n");
+
+    int nbytes;
+    unsigned char Buffer[8];
+    unsigned short TmpValue;
+
+    static struct ChargingInfoData *sys;
+
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    memset(Buffer, 0, sizeof(Buffer));
+
+    Buffer[0] = Check_V2G_Flow_Status();
+
+    //[1/4] SOC
+    if (sys->EvBatterySoc_pre != sys->EvBatterySoc)
+    {
+        //memset(buf_log_csucomm, 0, sizeof(buf_log_csucomm));
+        sprintf(buf_log_csucomm, "SOC = %d >> %d",
+                sys->EvBatterySoc_pre,
+                sys->EvBatterySoc
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        sys->EvBatterySoc_pre = sys->EvBatterySoc;
+    }
+    Buffer[1] = sys->EvBatterySoc;
+
+    //printf("[CsuComm] V_ev_target = %.02f\n", sys->EvBatterytargetVoltage);
+
+    //[2/4] EV Target Voltage
+    if (sys->EvBatterytargetVoltage_pre != sys->EvBatterytargetVoltage)
+    {
+        //memset(buf_log_csucomm, 0, sizeof(buf_log_csucomm));
+        sprintf(buf_log_csucomm, "V_target = %.02f >> %.02f (1V, DEC)",
+                sys->EvBatterytargetVoltage_pre,
+                sys->EvBatterytargetVoltage
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        sys->EvBatterytargetVoltage_pre = sys->EvBatterytargetVoltage;
+    }
+    TmpValue = (unsigned short) (sys->EvBatterytargetVoltage * 10);
+    memcpy(Buffer + 2, &TmpValue, 2);
+
+
+
+    //[3/4] EV Target Current
+    if (sys->EvBatterytargetCurrent_pre != sys->EvBatterytargetCurrent)
+    {
+        //memset(buf_log_csucomm, 0, sizeof(buf_log_csucomm));
+        sprintf(buf_log_csucomm, "I_target = %.02f >> %.02f (1A, DEC)",
+                sys->EvBatterytargetCurrent_pre,
+                sys->EvBatterytargetCurrent
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        sys->EvBatterytargetCurrent_pre = sys->EvBatterytargetCurrent;
+    }
+    TmpValue = (unsigned short) (sys->EvBatterytargetCurrent * 10);
+    memcpy(Buffer + 4, &TmpValue, 2);
+
+
+    //[4/4] Remaining Time
+    TmpValue = (unsigned short) sys->RemainChargingDuration;
+    memcpy(Buffer + 6, &TmpValue, 2);
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_GET_EV_TARGET_INFO, ShmInternalComm->SlaveAddress, 8, Buffer);
+
+    CSUCOMMDC_TASK_FLAG.Got_EVTargetReq = FALSE;
+
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: Proc_GetEVTargetReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_GetEVTargetReq(struct can_frame *frame)
+{
+    CSUCOMMDC_TASK_FLAG.Got_EVTargetReq = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_GetEVBatteryInfoRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_GetEVBatteryInfoRes(int Fd)
+{
+    int nbytes;
+    unsigned char Buffer[8];
     unsigned short TmpValue;
 
-    memset(Buffer, 0, sizeof(Buffer));
+    memset(Buffer, 0, sizeof(Buffer));
+
+    //[To-Do] Adding the consideration of ISO15118_2018
+    if((ShmCcsData->CommProtocol == V2GT_MSG_PROTOCOL_ISO15118_2014) &&
+       (ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.RequestedEnergyTransferMode <= 1))
+    {
+        Buffer[0] = 1;//AC
+    }
+    else
+    {
+        Buffer[0] = 0;//DC
+    }
+
+    if(ShmCcsData->CommProtocol == V2GT_MSG_PROTOCOL_DIN70121)
+    {
+        //DIN70121
+        TmpValue = DIN70121PhyValDecode(ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVEnergyCapacity) * 10;
+        memcpy(Buffer + 1, &TmpValue, 2);
+        TmpValue = DIN70121PhyValDecode(ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVMaximumVoltageLimit) * 10;
+        memcpy(Buffer + 3, &TmpValue, 2);
+        TmpValue = DIN70121PhyValDecode(ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVMaximumCurrentLimit) * 10;
+        memcpy(Buffer + 5, &TmpValue, 2);
+    }
+    else if(ShmCcsData->CommProtocol == V2GT_MSG_PROTOCOL_ISO15118_2014)
+    {
+        //ISO15118_2014
+        if(Buffer[0] == 0)
+        {
+            //DC
+            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVEnergyCapacity) * 10;
+            memcpy(Buffer + 1, &TmpValue, 2);
+            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVMaximumVoltageLimit) * 10;
+            memcpy(Buffer + 3, &TmpValue, 2);
+            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVMaximumCurrentLimit) * 10;
+            memcpy(Buffer + 5, &TmpValue, 2);
+        }
+        else
+        {
+            //AC
+            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.AC_EVChargeParameter.EAmount) * 10;
+            memcpy(Buffer + 1, &TmpValue, 2);
+            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.AC_EVChargeParameter.EVMaxVoltage) * 10;
+            memcpy(Buffer + 3, &TmpValue, 2);
+            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.AC_EVChargeParameter.EVMaxCurrent) * 10;
+            memcpy(Buffer + 5, &TmpValue, 2);
+        }
+    }
+    else if(ShmCcsData->CommProtocol == V2GT_MSG_PROTOCOL_ISO15118_2018)
+    {
+        //to be implemented
+    }
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_GET_EV_BATTERY_INFO, ShmInternalComm->SlaveAddress, 7, Buffer);
+
+    CSUCOMMDC_TASK_FLAG.Got_EVBatteryInfoReq = FALSE;
+
+    return nbytes;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_GetEVBatteryInfoReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_GetEVBatteryInfoReq()
+{
+    CSUCOMMDC_TASK_FLAG.Got_EVBatteryInfoReq = TRUE;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_IsolationStatusAnnounceRes
+DESCRIPTION:
+- ShmInternalComm->IsolationStatus:
+    GFD_Invalid       0     //ongoing
+    GFD_Valid         1
+    GFD_Warning       2
+    GFD_Fault         3
+    GFD_No_IMD        4     //for ISO 15118
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_IsolationStatusAnnounceRes(int Fd)
+{
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][Proc_IsolationStatusAnnounceRes] %d (DEC, 0:ongoing, 1:valid, 2:warning/fault)\n",
+                                ShmInternalComm->IsolationStatus);
+
+    if (ShmInternalComm->IsolationStatus_pre != ShmInternalComm->IsolationStatus)
+    {
+        //memset(buf_log_csucomm, 0, sizeof(buf_log_csucomm));
+        sprintf(buf_log_csucomm, "Isolation: %d >> %d",
+                ShmInternalComm->IsolationStatus_pre,
+                ShmInternalComm->IsolationStatus);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->IsolationStatus_pre = ShmInternalComm->IsolationStatus;
+    }
+
+    //DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid;    //0 (default)
+    //	dinisolationLevelType_Invalid = 0,
+    //	dinisolationLevelType_Valid = 1, (default)
+    //	dinisolationLevelType_Warning = 2,
+    //	dinisolationLevelType_Fault = 3
+
+
+    CSUCOMMDC_TASK_FLAG.Got_IsolationStatus = FALSE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_IsolationStatusAnnounceReq
+DESCRIPTION:
+    - BYTE[0]:
+        GFD_Invalid       0     //ongoing
+        GFD_Valid         1
+        GFD_Warning       2
+        GFD_Fault         3
+        GFD_No_IMD        4     //for ISO 15118
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_IsolationStatusAnnounceReq(struct can_frame *frame)
+{
+    unsigned char gfd_rx = 0;
+    gfd_rx = (unsigned char) frame->data[0];
+
+    if (gfd_rx >= GFD_Invalid && gfd_rx <= GFD_No_IMD)
+    {
+        //Transfer Parameter
+        if (gfd_rx == GFD_Warning)
+        {
+            gfd_rx = GFD_Fault;
+        }
+        else if (gfd_rx == GFD_Fault)
+        {
+            gfd_rx = GFD_Warning;
+        }
+        else
+        {
+            //no modification.
+        }
+
+        ShmInternalComm->IsolationStatus = gfd_rx;
+        EVCOMM_SYS_INFO.IsolationStatus = ShmInternalComm->IsolationStatus;
+
+        CSUCOMMDC_TASK_FLAG.Got_IsolationStatus = TRUE;
+    }
+    else
+    {
+        sprintf(buf_log_csucomm,
+                "[WARNING]unexpected isolation status(%d)",
+                frame->data[0]);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+    }
+}
+
+/*===========================================================================
+FUNCTION: Proc_CCSConnectorTypeSetRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_CCSConnectorTypeSetRes(int Fd)
+{
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][Proc_CCSConnectorTypeSetRes] To-be implemented. (checking for PP or not)\n");
+    CSUCOMMDC_TASK_FLAG.Got_CCSConnectorReq = FALSE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_CCSConnectorTypeSetReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_CCSConnectorTypeSetReq(struct can_frame *frame)
+{
+    ShmInternalComm->CCSConnectorType = (unsigned char) frame->data[0];
+    CSUCOMMDC_TASK_FLAG.Got_CCSConnectorReq = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_RTCSetRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_RTCSetRes(int Fd)
+{
+    int nbytes;
+    unsigned char Buffer[1];
+
+    memset(Buffer, 0, sizeof(Buffer));
+
+    if (ShmInternalComm->RTC != 0)
+    {
+        //[CAUTION] updating RTC time only in IDLE mode
+        //ShmInternalComm->RTC = 1575461829;
+        sprintf(buf_log_csucomm, "[Proc_RTCSetRes] Got RTC Message: %lu (DEC)", ShmInternalComm->RTC);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        system("date");
+        SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_RTCSetRes] RTC is updating...");
+        #if 1
+        time_t rtc_new;
+        rtc_new = ShmInternalComm->RTC; //Epoch time
+        stime(&rtc_new);
+        ftime(&ShmInternalComm->Start_Time);
+        ftime(&ShmInternalComm->End_Time);
+        ftime(&ShmInternalComm->CAN_Rx_Timer_Start);
+        ftime(&ShmInternalComm->CAN_Rx_Timer_End);
+        #else   //verified ok
+        char buf[64];
+        sprintf(buf, "date +%%s -s @%u", ShmInternalComm->RTC);
+        system(buf);
+        ftime(&ShmInternalComm->Start_Time);
+        ftime(&ShmInternalComm->End_Time);
+        ftime(&ShmInternalComm->CAN_Rx_Timer_Start);
+        ftime(&ShmInternalComm->CAN_Rx_Timer_End);
+        #endif
+        system("date");
+        SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_RTCSetRes] RTC is updated.\n");
+        Buffer[0] = 1;  //Accept
+    }
+    else
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_RTCSetRes] Reject.\n");
+        Buffer[0] = 0; //Reject
+    }
+
+    CSUCOMMDC_TASK_FLAG.Got_RTC = FALSE;
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_RTC_INFO, ShmInternalComm->SlaveAddress, 1, Buffer);
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: Proc_RTCSetReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+        1. Epoch time
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_RTCSetReq(struct can_frame *frame)
+{
+    //STEP 1: If the RTC time from CSU is older than CCS default time, ignore it.
+    //(The RTC time of CSU might not be updated.)
+    long int rtc_tmp = 0;
+    memcpy(&rtc_tmp, &frame->data[0], 4);  //Epoch time
+    if (rtc_tmp < RTC_DEFAULT_TIME)
+    {
+        sprintf(buf_log_csucomm,
+                "[WARNING] RTC time from CSU(%lu) is older than CCS(%lu): ignored",
+                rtc_tmp,
+                RTC_DEFAULT_TIME);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        return;
+    }
+
+    //STEP 2: Checking System State and Update RTC
+    if (Check_V2G_Flow_Status() == IDLE &&
+        ShmInternalComm->DownloadImageInfo.active == FALSE &&
+        EVCOMM_SYS_INFO.End_Process_inused == FALSE)
+    {
+        #if 1
+        //4-Byte EPOCH TIME: CAN: BYTE_TIME[0] BYTE_TIME[1] BYTE_TIME[2] BYTE_TIME[3]
+        memcpy(&ShmInternalComm->RTC, &frame->data[0], 4);  //Epoch time
+        #else
+        //4-Byte EPOCH TIME: CAN: BYTE_TIME[3] BYTE_TIME[2] BYTE_TIME[1] BYTE_TIME[0]
+        unsigned char rtc[4], tmp;
+        memcpy(&rtc[0], &frame->data[0], 4);
+        tmp = rtc[0];
+        rtc[0] = rtc[3];
+        rtc[3] = tmp;
+        tmp = rtc[1];
+        rtc[1] = rtc[2];
+        rtc[2] = tmp;
+        memcpy(&ShmInternalComm->RTC, &rtc[0], 4);  //Epoch time
+        #endif
+    }
+    else
+    {
+        ShmInternalComm->RTC = 0;
+    }
+    //printf("\n%X  %X  %X  %X (%X)\n", frame->data[0], frame->data[1], frame->data[2], frame->data[3], ShmInternalComm->RTC);
+    CSUCOMMDC_TASK_FLAG.Got_RTC = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_EVSEPrechargeInfoUpdateRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_EVSEPrechargeInfoUpdateRes(int Fd)
+{
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][Proc_EVSEPrechargeInfoUpdateRes]\n");
+
+    int nbytes;
+    unsigned char Buffer[8];
+    unsigned short TmpValue;
+
+    memset(Buffer, 0, sizeof(Buffer));
+
+    //Buffer[0] = TRUE;
+    Buffer[0] = ShmInternalComm->EVSEPrechargeStatus;
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_EVSE_PRECHARGE_INFO, ShmInternalComm->SlaveAddress, 1, Buffer);
+
+    CSUCOMMDC_TASK_FLAG.Got_EVSE_Precharge_Info = FALSE;
+
+    return nbytes;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_EVSEPrechargeInfoUpdateReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_EVSEPrechargeInfoUpdateReq(struct can_frame *frame)
+{
+    static struct ChargingInfoData *sys;
+
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    ShmInternalComm->EVSEPrechargeStatus = frame->data[0];
+    sys->EVSEPrechargeStatus = ShmInternalComm->EVSEPrechargeStatus;
+
+    if (sys->EVSEPrechargeStatus_pre != sys->EVSEPrechargeStatus)
+    {
+        //memset(buf_log_csucomm, 0, sizeof(buf_log_csucomm));
+        sprintf(buf_log_csucomm, "Precharge Status: %d >> %d",
+                    sys->EVSEPrechargeStatus_pre,
+                    sys->EVSEPrechargeStatus
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        sys->EVSEPrechargeStatus_pre = sys->EVSEPrechargeStatus;
+    }
+
+    CSUCOMMDC_TASK_FLAG.Got_EVSE_Precharge_Info = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_EVCCIDRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_EVCCIDRes(int Fd)
+{
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][Proc_EVCCIDRes]\n");
+
+    int i = 0;
+    int nbytes = 0;
+    unsigned char Buffer[8];
+
+	/*+++ 20200707, vern, reduce 8 digital MAC from BMW i3 +++*/
+	memset(Buffer, 0, sizeof(Buffer));
+	
+	if(EVCOMM_SYS_INFO.EVCCID_length>=8)
+	{
+		EVCOMM_SYS_INFO.EVCCID_length=8;
+		if((EVCOMM_SYS_INFO.EVCCID[0]==0)&&(EVCOMM_SYS_INFO.EVCCID[1]==0))
+			memcpy(EVCOMM_SYS_INFO.EVCCID,EVCOMM_SYS_INFO.EVCCID+2,6);
+		EVCOMM_SYS_INFO.EVCCID_length=6;
+	}
+
+	memcpy(Buffer,EVCOMM_SYS_INFO.EVCCID,EVCOMM_SYS_INFO.EVCCID_length);
+	/*--- 20200707, vern, reduce 8 digital MAC from BMW i3 ---*/
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_EVCCID_REQUEST, ShmInternalComm->SlaveAddress, EVCOMM_SYS_INFO.EVCCID_length, Buffer);
+
+    CSUCOMMDC_TASK_FLAG.Got_EVCCID_Req = FALSE;
+
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: Proc_EVCCIDReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_EVCCIDReq(struct can_frame *frame)
+{
+    CSUCOMMDC_TASK_FLAG.Got_EVCCID_Req = TRUE;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_EVStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_EVStopRes(int Fd)
+{
+    int nbytes;
+    unsigned char Buffer[8];
+
+    memset(Buffer, 0, sizeof(Buffer));
+    if (CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency == TRUE)
+    {
+        Buffer[0] = EV_EMERGENCY_STOP;  //2
+    }
+    else
+    {
+        Buffer[0] = EV_NORMAL_STOP;     //1
+    }
+
+    /*
+    if(strlen(ShmStatusCodeData->PresentStatusCode[0]) > 0)
+    {
+        memcpy(Buffer + 2, ShmStatusCodeData->PresentStatusCode[0], 6);
+    }
+    */
+    Buffer[1] = ShmStatusCodeData->PresentStatusCode[0][0];
+    Buffer[2] = ShmStatusCodeData->PresentStatusCode[0][1];
+    Buffer[3] = ShmStatusCodeData->PresentStatusCode[0][2];
+    Buffer[4] = ShmStatusCodeData->PresentStatusCode[0][3];
+    Buffer[5] = ShmStatusCodeData->PresentStatusCode[0][4];
+    Buffer[6] = ShmStatusCodeData->PresentStatusCode[0][5];
+
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_EV_STOP_EVENT, ShmInternalComm->SlaveAddress, 7, Buffer);
+    //system("echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle"); //for test only
+
+    //system("echo 0 > /sys/class/gpio/gpio89/value");    //for test
+
+    SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_EVStopRes] Sending STOP Command to CSU");
+
+    CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = FALSE;
+
+    return nbytes;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_EVSEStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_EVSEStopRes(int Fd)
+{
+    if (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown &&
+        EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown)
+    {
+        //The above considtion will let this debug message to print once
+        //even though the CSU sends several continuous stop commands.
+        sprintf(buf_log_csucomm,
+                "[Proc_EVSEStopRes] CSU Requests for STOP (Stop by EVSE: %d)",
+                ShmInternalComm->EVSEStopChargingReq.type);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        //Once the stop command is received by CCS, this CAN message cannot
+        //resume it back to normal state unless the End_Process is completed.
+        if (ShmInternalComm->EVSEStopChargingReq.type == 1)
+        {
+            EVCOMM_SYS_INFO.DC_EVSEStatus = EVSE_Shutdown;
+        }
+        else if (ShmInternalComm->EVSEStopChargingReq.type == 2)
+        {
+            EVCOMM_SYS_INFO.DC_EVSEStatus = EVSE_EmergencyShutdown;
+        }
+        else
+        {
+            EVCOMM_SYS_INFO.DC_EVSEStatus = EVSE_Ready;
+        }
+    }
+
+    CSUCOMMDC_TASK_FLAG.Got_EVSEStopReq = FALSE;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_EVSEStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_EVSEStopReq(struct can_frame *frame)
+{
+    ShmInternalComm->EVSEStopChargingReq.type = frame->data[0];
+    memcpy(&ShmInternalComm->EVSEStopChargingReq.alarmcode, &frame->data[1], 6);
+
+    CSUCOMMDC_TASK_FLAG.Got_EVSEStopReq = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Check_DwnldImgParameter
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+        1. Parameter Validation (0: invalid, 1: valid)
+        2. final_canmsg_size
+        3. total_can_packets
+GLOBAL VARIABLES:
+=============================================================================*/
+int Check_DwnldImgParameter()
+{
+    int image_size = 0; //unit: byte
+    int total_can_packets = 0;
+    unsigned char block_quantity = 0;
+    unsigned char block_size_KByte = 0;   //unit: Kbytes
+    unsigned char final_canmsg_size = 0;    //1~7
+
+    image_size = ShmInternalComm->DownloadImageInfo.image_size;
+    block_quantity = ShmInternalComm->DownloadImageInfo.block_quantity;
+    block_size_KByte = ShmInternalComm->DownloadImageInfo.block_size_KByte;
+
+    //Step 1: Caculate final_canmsg_size and total_can_packets
+    final_canmsg_size = image_size % 8; //8: max of CAN bus payload
+    total_can_packets = image_size / 8;
+
+    if (final_canmsg_size != 0)
+    {
+        total_can_packets += 1;
+    }
+
+    ShmInternalComm->DownloadImageInfo.final_canmsg_size = final_canmsg_size;
+    ShmInternalComm->DownloadImageInfo.total_can_packets = total_can_packets;
+
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[Check_DwnldImgParameter]\n");
+    DEBUG_PRINTF_CSUCOMM_DETAIL("\t - final_canmsg_size = %d (DEC)\n\
+                                 \t - total_can_packets = %d (DEC)\n\n",
+                                 ShmInternalComm->DownloadImageInfo.final_canmsg_size,
+                                 ShmInternalComm->DownloadImageInfo.total_can_packets
+                               );
+
+
+    //Step 2: Check Parameter Validation
+    //if ((block_quantity * block_size_KByte * 1024) > image_size)
+    //[CAUTION] To increase type ID, please modify this condition.
+    if (ShmInternalComm->DownloadImageInfo.type <= IMAGE_TYPE_USER_CONFIGURATION)
+    {
+        return TRUE;
+    }
+    else
+    {
+        sprintf(buf_log_csucomm,
+                "[Check_DwnldImgParameter] type(%d) is not allowed, yet.",
+                ShmInternalComm->DownloadImageInfo.type
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM("buf_log_csucomm");
+        return FALSE;
+    }
+}
+
+/*===========================================================================
+FUNCTION: Proc_DownloadImageRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_DownloadImageRes(int Fd)
+{
+    int nbytes;
+    unsigned char Buffer[1];
+    memset(Buffer, 0, sizeof(Buffer));
+
+    if (ShmInternalComm->DownloadImageInfo.active == TRUE)
+    {
+        //[VITAL] Closing unneccesary task to supoort rapid CAN data receving..
+        SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_DownloadImageRes] closing SeccComm...");
+        system("killall SeccComm");
+
+        system("rm -f /Storage/tmp");
+        system("touch /Storage/tmp");
+
+        #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == DISABLE)
+        {
+            SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_DownloadImageRes]sync...");
+            system("sync");
+        }
+        #endif
+
+        Buffer[0] = 1; //Accept
+    }
+    else
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_DownloadImageRes] Fail");
+        Buffer[0] = 0; //Reject
+        //[To-be-implemented][TBD] Sending alarm code or not?
+    }
+
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[Proc_DownloadImageRes] %d (DEC)\n", Buffer[0]);
+
+    CSUCOMMDC_TASK_FLAG.Got_DownloadImageReq = FALSE;
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_DOWNLOAD_REQUEST, ShmInternalComm->SlaveAddress, 1, Buffer);
+    return nbytes;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_DownloadImageReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_DownloadImageReq(struct can_frame *frame)
+{
+    if (Check_V2G_Flow_Status() == IDLE)
+    {
+        ShmInternalComm->DownloadImageInfo.type = frame->data[0];
+        memcpy(&ShmInternalComm->DownloadImageInfo.image_size, &frame->data[1], 4);
+        ShmInternalComm->DownloadImageInfo.image_size_received = 0;
+        ShmInternalComm->DownloadImageInfo.block_quantity = frame->data[5];
+        ShmInternalComm->DownloadImageInfo.block_sequence_number = 0;
+        ShmInternalComm->DownloadImageInfo.block_size_KByte = frame->data[6];
+        ShmInternalComm->DownloadImageInfo.block_sequence_number = 0;
+        ShmInternalComm->DownloadImageInfo.block_checksum = 0;
+        ShmInternalComm->DownloadImageInfo.total_can_packets = 0;
+        ShmInternalComm->DownloadImageInfo.image_rx_cnt = 0;
+        ShmInternalComm->DownloadImageInfo.downlaod_percentage = 0;
+        ShmInternalComm->DownloadImageInfo.downlaod_percentage_pre = 0;
+
+        ShmInternalComm->DownloadImageInfo.active = FALSE;
+        if (ShmInternalComm->DownloadImageInfo.image_size == 0)
+        {
+            SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_DownloadImageReq][Warning] image_size cannot be 0\n");
+        }
+        else if (ShmInternalComm->DownloadImageInfo.block_quantity == 0)
+        {
+            SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_DownloadImageReq][Warning] block_quantity cannot be 0\n");
+        }
+        else if (ShmInternalComm->DownloadImageInfo.block_size_KByte == 0)
+        {
+            SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_DownloadImageReq][Warning] block_size_KByte cannot be 0\n");
+        }
+        else if (Check_DwnldImgParameter() == FALSE)
+        {
+            sprintf(buf_log_csucomm, "[Proc_DownloadImageReq][Warning] nonlogical image_size(%d bytes, DEC), block_quantity(%d, DEC), block_size_KByte(%d, DEC)\n",
+                    ShmInternalComm->DownloadImageInfo.image_size,
+                    ShmInternalComm->DownloadImageInfo.block_quantity,
+                    ShmInternalComm->DownloadImageInfo.block_size_KByte
+                   );
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        }
+        else
+        {
+            ShmInternalComm->DownloadImageInfo.active = TRUE;
+        }
+    }
+    else
+    {
+        ShmInternalComm->DownloadImageInfo.active = FALSE;
+        sprintf(buf_log_csucomm,
+                "[Proc_BlockTransferStartReq] PresentMsgFlowStatus (%d, DEC) is not in IDLE\n",
+                Check_V2G_Flow_Status()
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+    }
+    SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_DownloadImageReq] Got Request from CSU\n");
+    sprintf(buf_log_csucomm, "\t - type = %d (DEC)\n\
+                              \t - image size = %d (DEC, bytes)\n\
+                              \t - block quantity = %d (DEC)\n\
+                              \t - block size = %d (DEC, KBytes)\n\n",
+                              ShmInternalComm->DownloadImageInfo.type,
+                              ShmInternalComm->DownloadImageInfo.image_size,
+                              ShmInternalComm->DownloadImageInfo.block_quantity,
+                              ShmInternalComm->DownloadImageInfo.block_size_KByte
+                             );
+    SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+    CSUCOMMDC_TASK_FLAG.Got_DownloadImageReq = TRUE;
+}
+
+
+
+/*===========================================================================
+FUNCTION: Proc_BlockTransferStartRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_BlockTransferStartRes(int Fd)
+{
+    int nbytes;
+    unsigned char Buffer[1];
+    memset(Buffer, 0, sizeof(Buffer));
+
+    if (ShmInternalComm->DownloadImageInfo.active == TRUE)
+    {
+        Buffer[0] = 1; //Accept
+    }
+    else
+    {
+        fclose(ShmInternalComm->DownloadImageInfo.file);
+        Buffer[0] = 0; //Reject
+        //[To-be-implemented][TBD] Sending alarm code or not?
+    }
+
+    DEBUG_PRINTF_CSUCOMM_DETAIL("[Proc_BlockTransferStartRes] %d (DEC)\n", Buffer[0]);
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_START_BLOCK_TRANSFER, ShmInternalComm->SlaveAddress, 1, Buffer);
+    CSUCOMMDC_TASK_FLAG.Got_BlockTransferStartReq = FALSE;
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: Proc_BlockTransferStartReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_BlockTransferStartReq(struct can_frame *frame)
+{
+    if (Check_V2G_Flow_Status() == IDLE)
+    {
+        ShmInternalComm->DownloadImageInfo.block_sequence_number += 1;  //1~255
+
+        //Check the valid range (1 ~ 255)
+        if (frame->data[0] >= 1 &&
+            frame->data[0] <= 255 &&
+            ShmInternalComm->DownloadImageInfo.block_sequence_number == frame->data[0] &&
+            ShmInternalComm->DownloadImageInfo.block_sequence_number >= 1 &&
+            ShmInternalComm->DownloadImageInfo.block_sequence_number <= 255
+           )
+        {
+            ShmInternalComm->DownloadImageInfo.active = TRUE;
+        }
+        else
+        {
+            sprintf(buf_log_csucomm, "[Proc_BlockTransferStartReq][Warning] Unexpected block_sequence_number (%d, %d, DEC)\n",
+                     frame->data[0],
+                     ShmInternalComm->DownloadImageInfo.block_sequence_number
+                   );
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+            ShmInternalComm->DownloadImageInfo.active = FALSE;
+        }
+
+        ShmInternalComm->DownloadImageInfo.block_checksum = frame->data[1];
+    }
+    else
+    {
+        ShmInternalComm->DownloadImageInfo.active = FALSE;
+        sprintf(buf_log_csucomm,
+                "[Proc_BlockTransferStartReq] PresentMsgFlowStatus (%d, DEC) is not in IDLE\n",
+                Check_V2G_Flow_Status()
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+    }
+    DEBUG_PRINTF_CSUCOMM_DETAIL("\n[Proc_BlockTransferStartReq] Got Request from CSU\n");
+    sprintf(buf_log_csucomm, "\t - block_sequence_number = %d (DEC)\n\
+                              \t - block_checksum = %02X (HEX, bytes)\n\n",
+                              ShmInternalComm->DownloadImageInfo.block_sequence_number,
+                              ShmInternalComm->DownloadImageInfo.block_checksum
+            );
+    DEBUG_PRINTF_CSUCOMM_DETAIL(buf_log_csucomm);
+
+    CSUCOMMDC_TASK_FLAG.Got_BlockTransferStartReq = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_DataTransferRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_DataTransferRes(int Fd)
+{
+    //DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][Proc_DataTransferRes]\n");
+
+    //[To-be-implemented] Check Block Checksum, if fail, we should use this response to ask CSU to resend this block again.
+
+    CSUCOMMDC_TASK_FLAG.Got_DataTransferReq = FALSE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_DataTransferReq
+DESCRIPTION:
+PRE-CONDITION:
+        1. The time interval between each CAN data should be 3ms at least to
+           avoid data loss.
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_DataTransferReq(struct can_frame *frame)
+{
+    if (Check_V2G_Flow_Status() == IDLE &&
+        ShmInternalComm->DownloadImageInfo.active == 1)
+    {
+        if ((ShmInternalComm->DownloadImageInfo.image_rx_cnt + frame->can_dlc) <= ShmInternalComm->DownloadImageInfo.image_size)
+        {
+            //Saving Data
+            FILE *file;
+            file = fopen("/Storage/tmp", "ab+");
+
+            int rlen = 0;
+            DEBUG_PRINTF_CSUCOMM_DETAIL("[Proc_DataTransferReq] saving data... (%d bytes, DEC)\n", frame->can_dlc);
+            //rlen = fwrite(&frame->data[0], sizeof(unsigned char), frame->can_dlc, ShmInternalComm->DownloadImageInfo.file);
+            rlen = fwrite(&frame->data[0], sizeof(unsigned char), frame->can_dlc, file);
+
+            if (rlen == frame->can_dlc)
+            {
+                fflush(ShmInternalComm->DownloadImageInfo.file);
+                DEBUG_PRINTF_CSUCOMM_DETAIL("[Proc_DataTransferReq] fwrite: OK (rlen = %d)\n", rlen);
+                ShmInternalComm->DownloadImageInfo.image_rx_cnt += frame->can_dlc;
+            }
+            else
+            {
+                DEBUG_PRINTF_CSUCOMM_DETAIL("[Proc_DataTransferReq] fwrite: FAIL (rlen = %d)\n", rlen);
+                ShmInternalComm->DownloadImageInfo.active = FALSE;
+            }
+            fflush(file);
+            fclose(file);
+            DEBUG_PRINTF_CSUCOMM_DETAIL("\n", ShmInternalComm->DownloadImageInfo.image_rx_cnt);
+
+            //Caculating the Download Percentage
+            ShmInternalComm->DownloadImageInfo.downlaod_percentage = (ShmInternalComm->DownloadImageInfo.image_rx_cnt*100)/ShmInternalComm->DownloadImageInfo.image_size;
+            if (ShmInternalComm->DownloadImageInfo.downlaod_percentage != ShmInternalComm->DownloadImageInfo.downlaod_percentage_pre)
+            {
+                sprintf(buf_log_csucomm,
+                        "[Proc_DataTransferReq] rx: %d\% (%d of %d bytes)\n", //showing the downlaod percentage
+                        ShmInternalComm->DownloadImageInfo.downlaod_percentage,
+                        ShmInternalComm->DownloadImageInfo.image_rx_cnt,
+                        ShmInternalComm->DownloadImageInfo.image_size
+                       );
+                SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+                ShmInternalComm->DownloadImageInfo.downlaod_percentage_pre = ShmInternalComm->DownloadImageInfo.downlaod_percentage;
+            }
+        }
+        else
+        {
+            ShmInternalComm->DownloadImageInfo.active = FALSE;
+            SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_BlockTransferStartReq] unexpected extra packets\n");
+        }
+    }
+    else
+    {
+        ShmInternalComm->DownloadImageInfo.active = FALSE;
+        sprintf(buf_log_csucomm, "[Proc_BlockTransferStartReq] PresentMsgFlowStatus (%d, DEC) \
+                 is not in IDLE or active flag (%d, DEC) is canceled\n",
+                Check_V2G_Flow_Status(),
+                ShmInternalComm->DownloadImageInfo.active
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        //Sending Stop Request to CSU to abort Data Transfer
+        //CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        //[To-be-implemented] Adding corresponding alarm code
+
+    }
+    CSUCOMMDC_TASK_FLAG.Got_DataTransferReq = TRUE;
+}
+
+/*===========================================================================
+FUNCTION: Proc_DownloadFinishRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_DownloadFinishRes(int Fd)
+{
+    int nbytes;
+    unsigned char Buffer[1];
+    memset(Buffer, 0, sizeof(Buffer));
+
+    //Step 1: Protection for receiving Firmware Update Req in non-IDLE mode
+    if (Check_V2G_Flow_Status() != IDLE)
+    {
+        if (CSUCOMMDC_TASK_FLAG.FW_Update_Task_inused == FALSE)
+        {
+            SAVE_SYS_LOG_MSG_CSUCOMM("[Warning]FW update Req: ignored (only for idle mode)");
+            Buffer[0] = FAIL;
+            nbytes = CAN_Tx_MSG(Fd, CAN_CMD_DOWNLOAD_FINISH, ShmInternalComm->SlaveAddress, 1, Buffer);
+            if (nbytes > 0)
+            {
+                sprintf(buf_log_csucomm, "[Proc_DownloadFinishRes]Tx:ok(%d)", Buffer[0]);
+                SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+            }
+            else
+            {
+                sprintf(buf_log_csucomm, "[Proc_DownloadFinishRes]Tx:fail(%d)", nbytes);
+                SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+            }
+            return FAIL;
+        }
+        else if (CSUCOMMDC_TASK_FLAG.FW_Update_Task_inused == TRUE)
+        {
+            SAVE_SYS_LOG_MSG_CSUCOMM("[Warning]FW update Req: ignored (in used, already)");
+            //not sending response message, since it stands for end of update process.
+            return FAIL;
+        }
+        else
+        {
+            sprintf(buf_log_csucomm,
+                    "[Warning]unexpected FW_Update_Task_inused value(%d)",
+                    CSUCOMMDC_TASK_FLAG.FW_Update_Task_inused
+                    );
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+            return FAIL;
+        }
+    }
+
+    //Step 2: Execute the FW update task
+    if (CSUCOMMDC_TASK_FLAG.FW_Update_Task_inused == FALSE)
+    {
+        CSUCOMMDC_TASK_FLAG.FW_Update_Task_inused = TRUE;
+        //[VITAL] Closing unneccesary task to supoort rapid CAN data receving..
+        SAVE_SYS_LOG_MSG_CSUCOMM("[Proc_DownloadFinishRes] closing SeccComm...");
+        system("killall SeccComm");
+        system("cd /root;./FWUpdate -w &");
+    }
+
+    //Step 3:Sending Response message with result once FW update is done.
+    if (CSUCOMMDC_TASK_FLAG.FW_Update_Done == TRUE)
+    {
+        if (CSUCOMMDC_TASK_FLAG.FW_Update_result == PASS)
+        {
+            Buffer[0] = PASS;
+        }
+        else
+        {
+            Buffer[0] = FAIL;
+        }
+        nbytes = CAN_Tx_MSG(Fd, CAN_CMD_DOWNLOAD_FINISH, ShmInternalComm->SlaveAddress, 1, Buffer);
+        if (nbytes > 0)
+        {
+            sprintf(buf_log_csucomm, "[Proc_DownloadFinishRes]Tx:ok(%d)", Buffer[0]);
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        }
+        else
+        {
+            sprintf(buf_log_csucomm, "[Proc_DownloadFinishRes]Tx:fail(%d)", nbytes);
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        }
+        sleep(2);
+        //system("killall FWUpdate");
+        CSUCOMMDC_TASK_FLAG.Got_DownloadFinishReq = FALSE;
+        return nbytes;
+    }
+}
+
+/*===========================================================================
+FUNCTION: Proc_DownloadFinishReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_DownloadFinishReq(struct can_frame *frame)
+{
+    CSUCOMMDC_TASK_FLAG.Got_DownloadFinishReq = TRUE;
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_CAN_FRAME
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_CAN_FRAME(struct can_frame *frame)
+{
+    if (frame->can_dlc != 0)
+    {
+        int i = 0;
+        DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm] Got CAN Message: \n\
+                \t - Length: %d (Bytes, DEC)\n\
+                \t - ID: %08X\n\
+                \t - Payload: ",
+                frame->can_dlc,
+                frame->can_id
+                );
+        for (i = 0; i< frame->can_dlc; i++)
+        {
+            DEBUG_PRINTF_CSUCOMM_DETAIL("%02X ", frame->data[i]);
+        }
+        DEBUG_PRINTF_CSUCOMM_DETAIL("\n");
+    }
+}
+
+/*===========================================================================
+FUNCTION: CANRxTimeoutDetector
+DESCRIPTION:
+    1. fork1
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CANRxTimeoutHandler()
+{
+    #if (CAN_RX_TIMEOUT_MECHANISM == ENABLE)
+    //#if 1
+    if (CSUCOMMDC_TASK_FLAG.matched == TRUE &&
+        CSUCOMMDC_TASK_FLAG.CAN_Rx_Timeout == FALSE)
+    {
+        long int time_diff = 0;
+        ftime(&ShmInternalComm->CAN_Rx_Timer_End);
+        time_diff = DiffTimeb_CsuComm_fork1(ShmInternalComm->CAN_Rx_Timer_Start, ShmInternalComm->CAN_Rx_Timer_End);
+
+        if(time_diff >= CSUCOMM_CAN_RX_TIMEOUT)   //5 sec
+        {
+            sprintf(buf_log_csucomm_fork1,
+                    "[fork1][Rx]CAN timeout(%ld of %dms) => reboot",
+                    time_diff,
+                    CSUCOMM_CAN_RX_TIMEOUT
+                   );
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm_fork1);
+
+            //Reboot the CCS Board
+            //Update_ShmStatusCode();
+            //CCS module communication fail (012248)
+            ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+            ShmStatusCodeData->PresentStatusCode[0][1] = 1;
+            ShmStatusCodeData->PresentStatusCode[0][2] = 2;
+            ShmStatusCodeData->PresentStatusCode[0][3] = 2;
+            ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+            ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+            CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+            CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+            CSUCOMMDC_TASK_FLAG.CAN_Rx_Timeout = TRUE;
+            Reboot_Process();
+        }
+    }
+    #endif
+}
+
+/*===========================================================================
+FUNCTION: FWUpdateRebootDetector
+DESCRIPTION:
+    1. fork2
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int FWUpdateRebootHandler()
+{
+    if (CSUCOMMDC_TASK_FLAG.FW_Update_Done == TRUE &&
+        CSUCOMMDC_TASK_FLAG.Got_DownloadFinishReq == FALSE &&
+        CSUCOMMDC_TASK_FLAG.FW_Update_Reboot_inused == FALSE)   //wait for CAN Res msg to be sent.
+    {
+        CSUCOMMDC_TASK_FLAG.FW_Update_Reboot_inused = TRUE;
+        sprintf(buf_log_csucomm_fork1,
+                "[fork1]FW Update Done(%d) => End_Process",
+                CSUCOMMDC_TASK_FLAG.Got_DownloadFinishReq);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_csucomm_fork1);
+        Reboot_Process();
+    }
+}
+
+/*===========================================================================
+FUNCTION: Error_Monitor_CsuComm
+DESCRIPTION:
+    1. fork1
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Error_Monitor_CsuComm()
+{
+    pid_t tmp = 0;
+
+    if(PID_CsuComm_Error_Monitor_Task == 0)
+    {
+        tmp = fork();   //fork1
+
+        if(tmp > 0)
+        {
+            PID_CsuComm_Error_Monitor_Task = tmp;
+
+            sprintf(buf_log_csucomm_fork1,
+                    "[fork2][Error_Monitor]created(%d)",
+                    PID_CsuComm_Error_Monitor_Task);
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm_fork1);
+
+            #if 0
+            unsigned char buf[64];
+            memset(buf, 0, sizeof(buf));
+            sprintf(buf, "renice -20 -p %d", tmp);
+            system(buf);
+            #endif
+
+            return;
+        }
+    }
+
+    while(1)
+    {
+        //CAN comm. Timeout Detector
+        CANRxTimeoutHandler();
+
+        //Check for FW Update Reboot Request
+        FWUpdateRebootHandler();
+    }
+}
+
+
+/*===========================================================================
+FUNCTION: CAN_Rx
+DESCRIPTION:
+        1. fork2
+        2. Receiving Task (indivitual process)
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void CAN_Rx(int fd)
+{
+    pid_t tmp = 0;
+    struct can_frame frame;
+    int nbytes;
+
+    if(PID_CAN_Rx_Task == 0)
+    {
+        tmp = fork();   //fork2
+
+        if(tmp > 0)
+        {
+            PID_CAN_Rx_Task = tmp;
+
+            sprintf(buf_log_csucomm_fork2,
+                    "[fork2][Error_Monitor]created(%d)",
+                    PID_CAN_Rx_Task);
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm_fork2);
+
+            #if 0
+            unsigned char buf[64];
+            memset(buf, 0, sizeof(buf));
+            sprintf(buf, "renice -20 -p %d", tmp);
+            system(buf);
+            #endif
+
+            return;
+        }
+    }
+
+    ftime(&ShmInternalComm->CAN_Rx_Timer_Start);    //ID is matched
+
+    while(1)    //Process after Matched
+    {
+        memset(&frame, 0, sizeof(struct can_frame));
+        nbytes = read(fd, &frame, sizeof(struct can_frame));
+
+        //For Test (Print Rx Messages)
+        //PRINT_CAN_FRAME(&frame);
+
+        //Filtering for legal CAN Rx Message
+        if((frame.can_id == 0) ||                   //Null CAN ID
+           ((frame.can_id & 0x08000000) == 1) ||    //Direction
+           (((frame.can_id & 0x000000FF) != ShmInternalComm->SlaveAddress) && ((frame.can_id & 0x000000FF) != 0)))  //allow its SlaveAddress and Broadcasting Packetes (ID = 0x00)
+        {
+            continue;
+        }
+
+        //--------------------- Legal CAN Rx Message Zone ----------------------
+        //CAN comm. Timeout Detector
+        ftime(&ShmInternalComm->CAN_Rx_Timer_Start);
+
+        //Extracting and Parsing Legal CAN Message ID (1-Byte)
+        switch(frame.can_id & 0x0000FF00)
+        {
+            case CAN_CMD_ADDRESS_ASSIGN:            //0x00000200
+            {
+                Proc_AddressAssignReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_GET_FW_VERSION:            //0x00000400
+            {
+                Proc_GetFirmwareVersionReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_GET_HW_VERSION:            //0x00000500
+            {
+                Proc_HardwareVersionReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_CHARGING_PERMISSION:       //0x00000600
+            {
+                Proc_ChargingPermissionReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_EVSE_OUTPUT_STATUS_ANNOUNCEMENT:      //0x00000700
+            {
+                Proc_EVSEOutputStatusUpdateReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_EVSE_CAPACITY_ANNOUNCEMENT:   //0x00000800
+            {
+                Proc_EVSECapacityUpdateReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_GET_EV_TARGET_INFO:    //0x00000900
+            {
+                Proc_GetEVTargetReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_GET_EV_BATTERY_INFO:       //0x00000A00
+            {
+                Proc_GetEVBatteryInfoReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_EVSE_STOP_EVENT:       //0x00000C00
+            {
+                Proc_EVSEStopReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_GET_MISC_INFO:         //0x00000D00
+            {
+                Proc_GetMiscellaneousInfoReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_DOWNLOAD_REQUEST:      //0x00000E00
+            {
+                //Proc_DownloadImageReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_START_BLOCK_TRANSFER:  //0x00000F00
+            {
+                //Proc_BlockTransferStartReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_DATA_TRANSFER:         //0x00001000
+            {
+                //Proc_DataTransferReq(&frame);
+                break;
+            }
+
+            case CAN_CMD_DOWNLOAD_FINISH:       //0x00001100
+            {
+                Proc_DownloadFinishReq(&frame);
+                break;
+            }
+            case CAN_CMD_ISOLATION_STATUS:           //0x00001200
+            {
+                Proc_IsolationStatusAnnounceReq(&frame);
+                break;
+            }
+            case CAN_CMD_CCS_CONNECTOR_INFO:         //0x00001300
+            {
+                Proc_CCSConnectorTypeSetReq(&frame);
+                break;
+            }
+            case CAN_CMD_RTC_INFO:                   //0x00001400
+            {
+                Proc_RTCSetReq(&frame);
+                break;
+            }
+            case CAN_CMD_EVSE_PRECHARGE_INFO:       //0x00001500
+            {
+                Proc_EVSEPrechargeInfoUpdateReq(&frame);
+                break;
+            }
+            case CAN_CMD_EVCCID_REQUEST:
+            {
+                Proc_EVCCIDReq(&frame);
+                break;
+            }
+            default:
+            {
+                sprintf(buf_log_csucomm_fork2,
+                        "[fork2][ERROR]Unexpected CAN Command ID: %d (DEC)",
+                        (frame.can_id & 0x0000FF00));
+                SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm_fork2);
+                break;
+            }
+        }
+    }
+}
+
+
+/*===========================================================================
+FUNCTION: Eth0_PortSetting
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Eth0_PortSetting_Add(unsigned char addr)
+{
+    SAVE_SYS_LOG_MSG_CSUCOMM("[Eth0_PortSetting_Add]start");
+
+    unsigned char cmd[128];
+    if ((addr >= 1) && (addr <= 20))
+    {
+        addr = 20 + addr;
+
+        //Step 0: shutdown eth0
+        #if 0
+        SAVE_SYS_LOG_MSG_CSUCOMM("[Eth0_PortSetting][eth0:0]down");
+        system("/sbin/ifconfig eth0:0 down");
+        sleep(1);
+        #endif
+
+        //Step 1: IP setting
+        sprintf(buf_log_csucomm,
+                "[Eth0_PortSetting_Add][eth0:0]IP >> 192.168.0.%d(up))",
+                addr);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        sprintf(cmd, "/sbin/ifconfig eth0:0 192.168.0.%d netmask 255.255.255.0 up", addr);
+        system(cmd);
+        memset(cmd, 0, sizeof(cmd));
+        sleep(1);
+
+        sprintf(buf_log_csucomm,
+                "[Eth0_PortSetting_Add][eth0:0]done",
+                addr);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        return PASS;
+    }
+    else
+    {
+        sprintf(buf_log_csucomm,
+                "[Eth0_PortSetting_Add][Error]addr(%d) is out of range(1~20)",
+                addr);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        return FAIL;
+    }
+}
+
+/*===========================================================================
+FUNCTION: Reboot_Process
+DESCRIPTION:
+    1. fork1
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Reboot_Process()
+{
+    if (CSUCOMMDC_TASK_FLAG.Reboot_Process_inused == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("[Reboot_Process]entered");
+        CSUCOMMDC_TASK_FLAG.Reboot_Process_inused = TRUE;
+
+        #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == DISABLE)
+        {
+            SAVE_SYS_LOG_MSG_CSUCOMM("[Reboot_Process]sync...");
+            system("sync");
+        }
+        #endif
+        system("sleep 2");
+        system("cd /root;./reboot.sh");
+    }
+}
+
+/*===========================================================================
+FUNCTION: CsuCommAC_GetCcsFirmwareVersion
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CsuCommAC_GetCcsFirmwareVersion(unsigned char *buf)
+{
+    int i = 0, j = 0, err = PASS, leng = 0;
+    unsigned char str[FIRMWARE_VERSION_LENGTH + 1];
+
+    memset(buf, 0, sizeof(buf));
+    strcpy(str, FIRMWARE_VERSION);
+    leng = FIRMWARE_VERSION_LENGTH + 3;
+
+    if (sizeof(buf) < leng)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("[WARNING][CsuCommAC_GetCcsFirmwareVersion]ver size: too long");
+        leng = sizeof(buf);
+    }
+
+    for(i = 0; i < leng; i++)
+    {
+        if (str[i] != '_')
+        {
+            buf[j] = str[i];
+            j++;
+        }
+    }
+
+    return err;
+}
+
+/*===========================================================================
+FUNCTION: CsuCommAC_Init
+DESCRIPTION:
+    1. Set CCS FW Version
+    
+PRE-CONDITION:
+    1. Share Memory should be initialized in advance.
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CsuCommAC_Init()
+{
+    int err = PASS;
+
+    CsuCommAC_GetCcsFirmwareVersion(CSUCOMMAC_SHM.CCSLibRev);
+    memset(CSUCOMMAC_SHM.EVCCID, 0, sizeof(CSUCOMMAC_SHM.EVCCID));
+    CSUCOMMAC_SHM.PresentMsgFlowStatus = IDLE;
+    CSUCOMMAC_SHM.ConnectorLockerStatus = FALSE;
+    CSUCOMMAC_SHM.ConnectorTemperature1 = 0;
+    CSUCOMMAC_SHM.ConnectorTemperature2 = 0;
+    CSUCOMMAC_SHM.TotalBatteryCapacity = 0;
+    CSUCOMMAC_SHM.BatteryMaximumVoltage = 0;
+    CSUCOMMAC_SHM.BatteryMaximumCurrent = 0;
+    CSUCOMMAC_SHM.CCSAlarmStatusCode = 0;
+    CSUCOMMAC_SHM.PaymentOption = 0;
+    CSUCOMMAC_SHM.EVSEMaxCurrent = 0;
+    CSUCOMMAC_SHM.EVSEMinCurrent = 0;
+    CSUCOMMAC_SHM.EVOperation = 0;
+    CSUCOMMAC_SHM.EVChargeProgress = 0;
+    CSUCOMMAC_SHM.CpSetPWMDuty = 0;
+    CSUCOMMAC_SHM.CpSetStateE = 0;
+    CSUCOMMAC_SHM.CcsHeartBeat = 0;
+
+    return err;
+}
+
+/*===========================================================================
+FUNCTION: CsuCommAC_HeartBeat_Handler
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CsuCommAC_HeartBeat_Handler()
+{
+    static unsigned int tmp = 0;
+
+    if (tmp == 0)
+    {
+        tmp = time(NULL);
+    }
+    else 
+    {
+        if ((time(NULL) - tmp) >= 1)    //1 sec
+        {
+            CSUCOMMAC_SHM.CcsHeartBeat++;
+            tmp = 0;
+
+            //sprintf(buf_log_csucomm, "[CcsHeartBeat]%d", CSUCOMMAC_SHM.CcsHeartBeat);
+            //SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+            if (CSUCOMMAC_SHM.CcsHeartBeat >= 60)    //timeout: 60 sec
+            {
+                sprintf(buf_log_csucomm, 
+                        "[WARNING]CSU Comm: Fail(%d)", 
+                        CSUCOMMAC_SHM.CcsHeartBeat);
+                SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+                //[To-Do] Reboot or Send Error Code (TBD)
+            }
+        }
+    }
+}
+
+/*===========================================================================
+FUNCTION: CsuCommAC_SHM_Rx_Update
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CsuCommAC_SHM_Rx_Update()
+{
+    //[CAUTION] Re-initializing process is necessary. (to-be implemented)
+    //----------[1] Permission --------
+    ShmInternalComm->ChargingPermission_new = (unsigned char) CSUCOMMAC_SHM.ChargingPermission;
+    if (ShmInternalComm->ChargingPermission_new != ShmInternalComm->ChargingPermission)
+    {
+        sprintf(buf_log_csucomm, "Permission: %d >> %d",
+                ShmInternalComm->ChargingPermission,
+                ShmInternalComm->ChargingPermission_new
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->ChargingPermission_pre = ShmInternalComm->ChargingPermission;
+        ShmInternalComm->ChargingPermission = ShmInternalComm->ChargingPermission_new;
+    }
 
-    if((ShmCcsData->CommProtocol == 2) && (ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.RequestedEnergyTransferMode <= 1))
+    // -------- [2] CpPresentPWMDuty --------
+    ShmInternalComm->AC_CpPresentPWMDuty = CSUCOMMAC_SHM.CpPresentPWMDuty;       //unit: 1 sec.
+    if (ShmInternalComm->AC_CpPresentPWMDuty_pre != ShmInternalComm->AC_CpPresentPWMDuty)
     {
-        Buffer[0] = 1;//AC
+        sprintf(buf_log_csucomm, "CP Duty(real): %d >> %d (1\%)",
+                ShmInternalComm->AC_CpPresentPWMDuty_pre,
+                ShmInternalComm->AC_CpPresentPWMDuty
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->AC_CpPresentPWMDuty_pre = ShmInternalComm->AC_CpPresentPWMDuty;
     }
-    else
+
+    // -------- [3] CpPresentState --------
+    ShmInternalComm->AC_CpPresentState = CSUCOMMAC_SHM.CpPresentState;       //unit: 1 sec.
+    if (ShmInternalComm->AC_CpPresentState_pre != ShmInternalComm->AC_CpPresentState)
     {
-        Buffer[0] = 0;//DC
+        sprintf(buf_log_csucomm, "CP State: %d >> %d",
+                ShmInternalComm->AC_CpPresentState_pre,
+                ShmInternalComm->AC_CpPresentState
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->AC_CpPresentState_pre = ShmInternalComm->AC_CpPresentState;
     }
 
-    if(ShmCcsData->CommProtocol == 1)
+    
+    // -------- [4] ChargingRemainTime --------
+    ShmInternalComm->AC_ChargingRemainTime = CSUCOMMAC_SHM.ChargingRemainTime;       //unit: 1 sec.
+    if (ShmInternalComm->AC_ChargingRemainTime_pre != ShmInternalComm->AC_ChargingRemainTime)
     {
-        //DIN70121
-        TmpValue = DIN70121PhyValDecode(ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVEnergyCapacity) * 10;
-        memcpy(Buffer + 1, &TmpValue, 2);
-        TmpValue = DIN70121PhyValDecode(ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVMaximumVoltageLimit) * 10;
-        memcpy(Buffer + 3, &TmpValue, 2);
-        TmpValue = DIN70121PhyValDecode(ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVMaximumCurrentLimit) * 10;
-        memcpy(Buffer + 5, &TmpValue, 2);
+        sprintf(buf_log_csucomm, "ChargingRemainTime: %d >> %d (1 sec)",
+                ShmInternalComm->AC_ChargingRemainTime_pre,
+                ShmInternalComm->AC_ChargingRemainTime
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->AC_ChargingRemainTime_pre = ShmInternalComm->AC_ChargingRemainTime;
     }
-    else if(ShmCcsData->CommProtocol == 2)
+
+    // -------- [5] CSUAlarmStatusCode --------
+    ShmInternalComm->AC_CSUAlarmStatusCode = CSUCOMMAC_SHM.CSUAlarmStatusCode;
+    if (ShmInternalComm->AC_CSUAlarmStatusCode_pre != ShmInternalComm->AC_CSUAlarmStatusCode)
     {
-        //ISO15118_2014
-        if(Buffer[0] == 0)
+        sprintf(buf_log_csucomm, "CSUAlarmStatusCode: %X >> %X (1V)",
+                ShmInternalComm->AC_CSUAlarmStatusCode_pre,
+                ShmInternalComm->AC_CSUAlarmStatusCode
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->AC_CSUAlarmStatusCode_pre = ShmInternalComm->AC_CSUAlarmStatusCode;
+    }
+
+    // -------- [6] MeterReadingValue --------
+    ShmInternalComm->AC_MeterReadingValue = CSUCOMMAC_SHM.MeterReadingValue;       //unit: 1WH
+    if (ShmInternalComm->AC_MeterReadingValue_pre != ShmInternalComm->AC_MeterReadingValue)
+    {
+        sprintf(buf_log_csucomm, "MeterReadingValue(Power): %.02f >> %.02f (1V)",
+                ShmInternalComm->AC_MeterReadingValue_pre,
+                ShmInternalComm->AC_MeterReadingValue
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->AC_MeterReadingValue_pre = ShmInternalComm->AC_MeterReadingValue;
+    }
+
+    // -------- [7] CpPositiveVoltage --------
+    ShmInternalComm->AC_CpPositiveVoltage = CSUCOMMAC_SHM.CpPositiveVoltage;       //unit: 1V
+    #if 0   //the modification message will be logged via Check_CP_State_Update_fork1() in SeccComm task.
+    if (ShmInternalComm->AC_CpPositiveVoltage_pre != ShmInternalComm->AC_CpPositiveVoltage)
+    {
+        sprintf(buf_log_csucomm, "CP_v_p: %.02f >> %.02f (1V)",
+                ShmInternalComm->AC_CpPositiveVoltage_pre,
+                ShmInternalComm->AC_CpPositiveVoltage
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->AC_CpPositiveVoltage_pre = ShmInternalComm->AC_CpPositiveVoltage;
+    }
+    #endif
+
+    // -------- [8] CpNegativeVoltage --------
+    ShmInternalComm->AC_CpNegativeVoltage = CSUCOMMAC_SHM.CpNegativeVoltage;       //unit: 1V
+    if (ShmInternalComm->AC_CpNegativeVoltage_pre != ShmInternalComm->AC_CpNegativeVoltage)
+    {
+        sprintf(buf_log_csucomm, "CP_v_n: %.02f >> %.02f (1V)",
+                ShmInternalComm->AC_CpNegativeVoltage_pre,
+                ShmInternalComm->AC_CpNegativeVoltage
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->AC_CpNegativeVoltage_pre = ShmInternalComm->AC_CpNegativeVoltage;
+    }
+
+    // -------- [9] I_now: EVSEPresentCurrent[3] --------
+    memcpy(ShmInternalComm->AC_EVSEPresentCurrent, CSUCOMMAC_SHM.EVSEPresentCurrent, 3);         //unit: 1A
+    EVCOMM_SYS_INFO.PresentChargingCurrent = ShmInternalComm->AC_EVSEPresentCurrent[0];   //unit: 1A (using phase L)
+    ShmInternalComm->PresentChargingCurrent = (int)(ShmInternalComm->AC_EVSEPresentCurrent[0] * 10); //unit: 0.1A
+    if ((ShmInternalComm->AC_EVSEPresentCurrent[0] != ShmInternalComm->AC_EVSEPresentCurrent[0]) ||
+        (ShmInternalComm->AC_EVSEPresentCurrent[1] != ShmInternalComm->AC_EVSEPresentCurrent[1]) ||
+        (ShmInternalComm->AC_EVSEPresentCurrent[2] != ShmInternalComm->AC_EVSEPresentCurrent[2])
+       )
+    {
+        if ((abs(ShmInternalComm->AC_EVSEPresentCurrent_pre[0] - ShmInternalComm->AC_EVSEPresentCurrent[0]) > 10) || //10/;1A
+            (abs(ShmInternalComm->AC_EVSEPresentCurrent_pre[1] - ShmInternalComm->AC_EVSEPresentCurrent[1]) > 10) || //10/;1A
+            (abs(ShmInternalComm->AC_EVSEPresentCurrent_pre[2] - ShmInternalComm->AC_EVSEPresentCurrent[2]) > 10)    //10/;1A
+           )
         {
-            //DC
-            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVEnergyCapacity) * 10;
-            memcpy(Buffer + 1, &TmpValue, 2);
-            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVMaximumVoltageLimit) * 10;
-            memcpy(Buffer + 3, &TmpValue, 2);
-            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.EVMaximumCurrentLimit) * 10;
-            memcpy(Buffer + 5, &TmpValue, 2);
+            sprintf(buf_log_csucomm, "I_now(EVSE): (%.02f,%.02f,%.02f) >> (%.02f,%.02f,%.02f) (1A)",
+                    ShmInternalComm->AC_EVSEPresentCurrent_pre[0],
+                    ShmInternalComm->AC_EVSEPresentCurrent_pre[1],
+                    ShmInternalComm->AC_EVSEPresentCurrent_pre[2],
+                    ShmInternalComm->AC_EVSEPresentCurrent[0],
+                    ShmInternalComm->AC_EVSEPresentCurrent[1],
+                    ShmInternalComm->AC_EVSEPresentCurrent[2]
+                   );
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
         }
-        else
+
+        ShmInternalComm->PresentChargingCurrent_pre = ShmInternalComm->PresentChargingCurrent;
+        memcpy(ShmInternalComm->AC_EVSEPresentCurrent_pre, ShmInternalComm->AC_EVSEPresentCurrent, 3);
+    }
+
+    //-------- [10] OutputRelayStatus --------
+    ShmInternalComm->AC_OutputRelayStatus = CSUCOMMAC_SHM.OutputRelayStatus;    //bool
+    if (ShmInternalComm->AC_OutputRelayStatus_pre != ShmInternalComm->AC_OutputRelayStatus)
+    {
+        sprintf(buf_log_csucomm, "RelayON: %d >> %d",
+                ShmInternalComm->AC_OutputRelayStatus_pre,
+                ShmInternalComm->AC_OutputRelayStatus
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+        ShmInternalComm->AC_OutputRelayStatus_pre = ShmInternalComm->AC_OutputRelayStatus;
+    }
+
+    // -------- [11] GridVoltage (EVSENominalVoltage) --------
+    EVCOMM_SYS_INFO.AC_EVSENominalVoltage = CSUCOMMAC_SHM.GridVoltage[0];        //unit: 1V
+    memcpy(ShmInternalComm->AC_GridVoltage, CSUCOMMAC_SHM.GridVoltage, 3);       //unit: 1V
+    if ((ShmInternalComm->AC_GridVoltage_pre[0] != ShmInternalComm->AC_GridVoltage[0]) ||
+        (ShmInternalComm->AC_GridVoltage_pre[1] != ShmInternalComm->AC_GridVoltage[1]) ||
+        (ShmInternalComm->AC_GridVoltage_pre[2] != ShmInternalComm->AC_GridVoltage[2])
+       )
+    {
+        sprintf(buf_log_csucomm, "V_grid: (%.02f,%.02f,%.02f) >> (%.02f,%.02f,%.02f) (1V)",
+                ShmInternalComm->AC_GridVoltage_pre[0],
+                ShmInternalComm->AC_GridVoltage_pre[1],
+                ShmInternalComm->AC_GridVoltage_pre[2],
+                ShmInternalComm->AC_GridVoltage[0],
+                ShmInternalComm->AC_GridVoltage[1],
+                ShmInternalComm->AC_GridVoltage[2]
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        memcpy(ShmInternalComm->AC_GridVoltage_pre, ShmInternalComm->AC_GridVoltage, 3);
+    }
+
+    // -------- [12] V_now --------
+    if (ShmInternalComm->AC_OutputRelayStatus == ENABLE)
+    {
+        EVCOMM_SYS_INFO.PresentChargingVoltage = ShmInternalComm->AC_GridVoltage[0]; //unit: 1V (using phase 1)
+        ShmInternalComm->PresentChargingVoltage = (int)(ShmInternalComm->AC_GridVoltage[0] * 10); //unit: 0.1V (using phase 1)
+    }
+    else 
+    {
+        EVCOMM_SYS_INFO.PresentChargingVoltage = 0;
+        ShmInternalComm->PresentChargingVoltage = 0;
+    }
+    
+    if (ShmInternalComm->PresentChargingVoltage_pre != ShmInternalComm->PresentChargingVoltage)
+    {
+        if (abs(ShmInternalComm->PresentChargingVoltage_pre - ShmInternalComm->PresentChargingVoltage) > 10) //10:1V
         {
-            //AC
-            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.AC_EVChargeParameter.EAmount) * 10;
-            memcpy(Buffer + 1, &TmpValue, 2);
-            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.AC_EVChargeParameter.EVMaxVoltage) * 10;
-            memcpy(Buffer + 3, &TmpValue, 2);
-            TmpValue = ISO151182014PhyValDecode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.AC_EVChargeParameter.EVMaxCurrent) * 10;
-            memcpy(Buffer + 5, &TmpValue, 2);
+
+            sprintf(buf_log_csucomm, "V_now(EVSE): %d >> %d (0.1V, DEC)",
+                    ShmInternalComm->PresentChargingVoltage_pre,
+                    ShmInternalComm->PresentChargingVoltage
+                    );
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
         }
+        ShmInternalComm->PresentChargingVoltage_pre = ShmInternalComm->PresentChargingVoltage;
     }
 
-    nbytes = SendMsg(Fd, MsgStatusNotification, ShmInternalComm->SlaveAddress, 7, Buffer);
-    return nbytes;
-}
 
-int SendStopEvent(int Fd)
-{
-    int nbytes;
-    unsigned char Buffer[8];
+    // -------- [13] P_now --------
+    EVCOMM_SYS_INFO.PresentChargingPower = (EVCOMM_SYS_INFO.PresentChargingVoltage * EVCOMM_SYS_INFO.PresentChargingCurrent)/1000;   //1KW
+    ShmInternalComm->PresentChargingPower = (int)(EVCOMM_SYS_INFO.PresentChargingPower * 10); //0.1KW
+    if (ShmInternalComm->PresentChargingPower_pre != ShmInternalComm->PresentChargingPower)
+    {
+        sprintf(buf_log_csucomm, "P_now(EVSE): %d >> %d (0.1KW)",
+                ShmInternalComm->PresentChargingPower_pre,
+                ShmInternalComm->PresentChargingPower);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-    memset(Buffer, 0, sizeof(Buffer));
-    Buffer[0] = 0x01;
+        ShmInternalComm->PresentChargingPower_pre = ShmInternalComm->PresentChargingPower;
+    }
 
-    if(strlen(ShmStatusCodeData->PresentStatusCode[0]) > 0)
+    // -------- [14] I_max (EVSE)--------
+    EVCOMM_SYS_INFO.AvailableChargingCurrent = CSUCOMMAC_SHM.EVSEMaxCurrent; //unit: 1A
+    ShmInternalComm->AvailableChargingCurrent = (int)(CSUCOMMAC_SHM.EVSEMaxCurrent *10); //unit: 0.1A
+    if (ShmInternalComm->AvailableChargingCurrent_pre != ShmInternalComm->AvailableChargingCurrent)
     {
-        memcpy(Buffer + 2, ShmStatusCodeData->PresentStatusCode[0], 6);
-    }
+        sprintf(buf_log_csucomm, "I_max(EVSE): %d >> %d (0.1A)",
+                ShmInternalComm->AvailableChargingCurrent_pre,
+                ShmInternalComm->AvailableChargingCurrent);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-    nbytes = SendMsg(Fd, MsgStatusNotification, ShmInternalComm->SlaveAddress, 7, Buffer);
-    return nbytes;
-}
+        ShmInternalComm->AvailableChargingCurrent_pre = ShmInternalComm->AvailableChargingCurrent;
+    }
 
-int SendMiscInfo(int Fd)
-{
-    int nbytes;
-    unsigned char Buffer[8];
-    unsigned short TmpValue;
+    // -------- [15] I_min (EVSE)--------
+    ShmInternalComm->AC_EVSEMinCurrent = CSUCOMMAC_SHM.EVSEMinCurrent; //unit: 1A
+    if (ShmInternalComm->AC_EVSEMinCurrent_pre != ShmInternalComm->AC_EVSEMinCurrent)
+    {
+        sprintf(buf_log_csucomm, "I_min(EVSE): %.02f >> %.02f (1A)",
+                ShmInternalComm->AC_EVSEMinCurrent_pre,
+                ShmInternalComm->AC_EVSEMinCurrent);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-    memset(Buffer, 0, sizeof(Buffer));
-    Buffer[0] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].ConnectorPlugIn;
-    TmpValue = ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp;
-    memcpy(Buffer + 1, &TmpValue, 2);
-    Buffer[3] = (unsigned char)(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotVoltage * 10);
-    Buffer[4] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState;
-    nbytes = SendMsg(Fd, MsgStatusNotification, ShmInternalComm->SlaveAddress, 7, Buffer);
-    return nbytes;
-}
+        ShmInternalComm->AC_EVSEMinCurrent_pre = ShmInternalComm->AC_EVSEMinCurrent;
+    }
 
-/**************************************************************/
-/************** Receiving Task*******************************/
-/*************************************************************/
-void CANReceiver(int fd)
-{
-    pid_t tmp = 0;
-    struct can_frame frame;
-    int nbytes;
-    unsigned char FanspeedGetTime = 0;
 
-    if(CANReceiverPid == 0)
+    // -------- [16] V_max --------
+    EVCOMM_SYS_INFO.MaximumChargingVoltage = CSUCOMMAC_SHM.GridVoltage[0]; //unit: 1V (using phase 1)
+    ShmInternalComm->MaximumChargingVoltage = (int)(CSUCOMMAC_SHM.GridVoltage[0] * 10); //unit: 0.1V (using phase 1)
+    if (ShmInternalComm->MaximumChargingVoltage_pre != ShmInternalComm->MaximumChargingVoltage)
     {
-        tmp = fork();
+        sprintf(buf_log_csucomm, "V_max(EVSE): %d >> %d (0.1V, DEC)",
+                ShmInternalComm->MaximumChargingVoltage_pre,
+                ShmInternalComm->MaximumChargingVoltage
+              );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-        if(tmp > 0)
-        {
-            CANReceiverPid = tmp;
-            {
-                unsigned char buf[64];
-                memset(buf, 0, sizeof(buf));
-                sprintf(buf, "renice -20 -p %d", tmp);
-                system(buf);
-            }
-            return;
-        }
+        ShmInternalComm->MaximumChargingVoltage_pre = ShmInternalComm->MaximumChargingVoltage;
     }
 
-    while(1)
+    // -------- [17] P_max --------
+    ShmInternalComm->AC_AvailableChargingPower = CSUCOMMAC_SHM.AvailableChargingPower; //unit: 1KW
+    EVCOMM_SYS_INFO.AvailableChargingPower = ShmInternalComm->AC_AvailableChargingPower;   //1KW
+    ShmInternalComm->AvailableChargingPower = (int)(ShmInternalComm->AC_AvailableChargingPower * 10);  //unit: 0.1KW
+    if (ShmInternalComm->AvailableChargingPower_pre != ShmInternalComm->AvailableChargingPower)
     {
-        memset(&frame, 0, sizeof(struct can_frame));
-        nbytes = read(fd, &frame, sizeof(struct can_frame));
+        sprintf(buf_log_csucomm, "P_max(EVSE): %d >> %d (0.1KW)",
+                ShmInternalComm->AvailableChargingPower_pre,
+                ShmInternalComm->AvailableChargingPower);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-        if((frame.can_id == 0) || (frame.can_id & 0x08000000) || (((frame.can_id & 0x000000FF) != ShmInternalComm->SlaveAddress) && ((frame.can_id & 0x000000FF) != 0)))
-        {
-            continue;
-        }
+        ShmInternalComm->AvailableChargingPower_pre = ShmInternalComm->AvailableChargingPower;
+    }
 
-        switch(frame.can_id & 0x0000FF00)//Message ID
-        {
-        case MsgGetFwVersion:
-            ShmInternalComm->InternalCommUnion.bits.FwVersion = 1;
-            break;
+    // -------- [18] EVSEID[40] --------
+    memcpy(ShmInternalComm->AC_EVSEID, CSUCOMMAC_SHM.EVSEID, 40);
+    if (Array_Compare_Identity(ShmInternalComm->AC_EVSEID, CSUCOMMAC_SHM.EVSEID, 40) == FALSE)
+    {
+        sprintf(buf_log_csucomm, "EVSEID: [%02X %02X %02X %02X %02X %02X...] >> [%02X %02X %02X %02X %02X %02X...]",
+                ShmInternalComm->AC_EVSEID_pre[0],
+                ShmInternalComm->AC_EVSEID_pre[1],
+                ShmInternalComm->AC_EVSEID_pre[2],
+                ShmInternalComm->AC_EVSEID_pre[3],
+                ShmInternalComm->AC_EVSEID_pre[4],
+                ShmInternalComm->AC_EVSEID_pre[5],
+                ShmInternalComm->AC_EVSEID[0],
+                ShmInternalComm->AC_EVSEID[1],
+                ShmInternalComm->AC_EVSEID[2],
+                ShmInternalComm->AC_EVSEID[3],
+                ShmInternalComm->AC_EVSEID[4],
+                ShmInternalComm->AC_EVSEID[5]
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        memcpy(ShmInternalComm->AC_EVSEID_pre, ShmInternalComm->AC_EVSEID_pre, 40);
+    }
 
-        case MsgGetHwVersion:
-            ShmInternalComm->InternalCommUnion.bits.HwVersion = 1;
-            break;
+    // -------- [19] MeterID[32] --------
+    memcpy(ShmInternalComm->AC_MeterID, CSUCOMMAC_SHM.MeterID, 32);
+    if (Array_Compare_Identity(ShmInternalComm->AC_MeterID, CSUCOMMAC_SHM.MeterID, 32) == FALSE)
+    {
+        sprintf(buf_log_csucomm, "MeterID: [%02X %02X %02X %02X %02X %02X...] >> [%02X %02X %02X %02X %02X %02X...]",
+                ShmInternalComm->AC_MeterID_pre[0],
+                ShmInternalComm->AC_MeterID_pre[1],
+                ShmInternalComm->AC_MeterID_pre[2],
+                ShmInternalComm->AC_MeterID_pre[3],
+                ShmInternalComm->AC_MeterID_pre[4],
+                ShmInternalComm->AC_MeterID_pre[5],
+                ShmInternalComm->AC_MeterID[0],
+                ShmInternalComm->AC_MeterID[1],
+                ShmInternalComm->AC_MeterID[2],
+                ShmInternalComm->AC_MeterID[3],
+                ShmInternalComm->AC_MeterID[4],
+                ShmInternalComm->AC_MeterID[5]
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        memcpy(ShmInternalComm->AC_MeterID_pre, ShmInternalComm->AC_MeterID_pre, 32);
+    }
 
-        case MsgChargingPermission:
-            ShmInternalComm->ChargingPermission = frame.data[0];
-            ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].AvailableChargingPower = (float)((unsigned int)frame.data[2] << 8 | frame.data[1]) / 10;
-            ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].AvailableChargingCurrent = (float)((unsigned int)frame.data[4] << 8 | frame.data[3]) / 10;
-            ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].MaximumChargingVoltage = (float)((unsigned int)frame.data[6] << 8 | frame.data[5]) / 10;
-            break;
+    // -------- [20] EVSEModelName[32] --------
+    memcpy(ShmInternalComm->AC_EVSEModelName, CSUCOMMAC_SHM.EVSEModelName, 32);
+    if (Array_Compare_Identity(ShmInternalComm->AC_EVSEModelName, CSUCOMMAC_SHM.EVSEModelName, 32) == FALSE)
+    {
+        sprintf(buf_log_csucomm, "EVSEModelName: [%02X %02X %02X %02X %02X %02X...] >> [%02X %02X %02X %02X %02X %02X...]",
+                ShmInternalComm->AC_EVSEModelName_pre[0],
+                ShmInternalComm->AC_EVSEModelName_pre[1],
+                ShmInternalComm->AC_EVSEModelName_pre[2],
+                ShmInternalComm->AC_EVSEModelName_pre[3],
+                ShmInternalComm->AC_EVSEModelName_pre[4],
+                ShmInternalComm->AC_EVSEModelName_pre[5],
+                ShmInternalComm->AC_EVSEModelName[0],
+                ShmInternalComm->AC_EVSEModelName[1],
+                ShmInternalComm->AC_EVSEModelName[2],
+                ShmInternalComm->AC_EVSEModelName[3],
+                ShmInternalComm->AC_EVSEModelName[4],
+                ShmInternalComm->AC_EVSEModelName[5]
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        memcpy(ShmInternalComm->AC_EVSEModelName_pre, ShmInternalComm->AC_EVSEModelName_pre, 32);
+    }
 
-        case MsgPresentOutputPower:
+    // -------- [21] BatteryChargeType --------
+    ShmInternalComm->AC_BatteryChargeType = CSUCOMMAC_SHM.BatteryChargeType;
+    if (ShmInternalComm->AC_BatteryChargeType_pre != ShmInternalComm->AC_BatteryChargeType)
+    {
+        sprintf(buf_log_csucomm, "BatteryChargeType: %d >> %d",
+                ShmInternalComm->AC_BatteryChargeType_pre,
+                ShmInternalComm->AC_BatteryChargeType
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-            if(ShmInternalComm->SlaveAddress == 1)
-            {
-                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage = (float)((unsigned int)frame.data[1] << 8 | frame.data[0]) / 10;
-                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent = (float)((unsigned int)frame.data[3] << 8 | frame.data[2]) / 10;
-            }
-            else
-            {
-                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingVoltage = (float)((unsigned int)frame.data[5] << 8 | frame.data[4]) / 10;
-                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PresentChargingCurrent = (float)((unsigned int)frame.data[7] << 8 | frame.data[6]) / 10;
-            }
+        ShmInternalComm->AC_BatteryChargeType_pre = ShmInternalComm->AC_BatteryChargeType;
+    }
 
-            break;
+    // -------- [21] RcdStatus --------
+    ShmInternalComm->AC_RcdStatus = CSUCOMMAC_SHM.RcdStatus;
+    if (ShmInternalComm->AC_RcdStatus_pre != ShmInternalComm->AC_RcdStatus)
+    {
+        sprintf(buf_log_csucomm, "RCDStatus: %d >> %d",
+                ShmInternalComm->AC_RcdStatus_pre,
+                ShmInternalComm->AC_RcdStatus
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-        case MsgPresentOutputCapacity:
+        ShmInternalComm->AC_RcdStatus_pre = ShmInternalComm->AC_RcdStatus;
+    }
 
-            if(ShmInternalComm->SlaveAddress == 1)
-            {
-                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].AvailableChargingPower = (float)((unsigned int)frame.data[1] << 8 | frame.data[0]) / 10;
-                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].AvailableChargingCurrent = (float)((unsigned int)frame.data[3] << 8 | frame.data[2]) / 10;
-            }
-            else
-            {
-                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].AvailableChargingPower = (float)((unsigned int)frame.data[5] << 8 | frame.data[4]) / 10;
-                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].AvailableChargingCurrent = (float)((unsigned int)frame.data[7] << 8 | frame.data[6]) / 10;
-            }
 
-            break;
+    // -------- [22] EVSENotification --------
+    ShmInternalComm->AC_EVSENotification = CSUCOMMAC_SHM.EVSENotification;
+    if (ShmInternalComm->AC_EVSENotification_pre != ShmInternalComm->AC_EVSENotification)
+    {
+        sprintf(buf_log_csucomm, "AC_EVSENotification: %d >> %d",
+                ShmInternalComm->AC_EVSENotification_pre,
+                ShmInternalComm->AC_EVSENotification
+                );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
 
-        case MsgGetOutputRequirement:
-            ShmInternalComm->InternalCommUnion.bits.OutputRequirement = 1;
-            break;
+        ShmInternalComm->AC_EVSENotification_pre = ShmInternalComm->AC_EVSENotification;
+    }
 
-        case MsgGetEvBatteryInfo:
-            ShmInternalComm->InternalCommUnion.bits.EvBatteryInfo = 1;
-            break;
+}
 
-        case MsgEvseStopEvent:
-            break;
+/*===========================================================================
+FUNCTION: CsuCommAC_Error_Monitor
+DESCRIPTION:
+    1. fork1
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void CsuCommAC_Error_Monitor()
+{
+    pid_t tmp = 0;
 
-        case MsgGetMiscInfo:
-            ShmInternalComm->InternalCommUnion.bits.MiscInfo = 1;
-            break;
+    if(PID_CsuComm_Error_Monitor_Task == 0)
+    {
+        tmp = fork();   //fork1
 
-        case MsgDownloadRequest:
-            break;
+        if(tmp > 0)
+        {
+            PID_CsuComm_Error_Monitor_Task = tmp;
 
-        case MsgStartBlockTransfer:
-            break;
+            sprintf(buf_log_csucomm_fork1,
+                    "[fork2][Error_Monitor]created(%d)",
+                    PID_CsuComm_Error_Monitor_Task);
+            SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm_fork1);
 
-        case MsgDataTransfer:
-            break;
+            #if 0
+            unsigned char buf[64];
+            memset(buf, 0, sizeof(buf));
+            sprintf(buf, "renice -20 -p %d", tmp);
+            system(buf);
+            #endif
 
-        case MsgDownloadFinish:
-            break;
+            return;
         }
     }
+
+    while(1)
+    {
+        CsuCommAC_HeartBeat_Handler();  //timeout: 60s
+    }   
 }
 
-/**************************************************************/
-/************** main function***********************************/
-/*************************************************************/
-int main(int argc, char *argv[])
+
+/*===========================================================================
+FUNCTION: CsuCommAC_Proc
+DESCRIPTION:
+PRE-CONDITION:
+    1. Share Memory should be initialized in advance.
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CsuCommAC_Proc()
 {
-    int CanFd;
-    struct can_frame frame;
-    struct timeb StartTime, EndTime;
-    unsigned int TmpValue;
-    unsigned char Buffer[8];
+    CsuCommAC_Init();
+    CsuCommAC_Error_Monitor();  //fork1
 
-    //Initialization
-    if(InitShareMemory() == 0)
+    while(1)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[CsuComm]main:InitShareMemory NG");
+        CsuCommAC_SHM_Rx_Update();
+    }
+}
+
+void CheckID()
+{
+	unsigned char BoardId;
+	unsigned char buf[64];
+	
+	BoardId=(Get_GPIO_Value(GPIO_2_23_AM_IO_1) + 1) & 0x000000FF;//auto detect GPIO
+	if(ShmInternalComm->SlaveAddress == BoardId)
+		return;
+		
+	memset(buf,0,sizeof(buf));
+     	sprintf(buf,"SlaveAddress from %d to %d\n",ShmInternalComm->SlaveAddress,BoardId);
+     	ShmInternalComm->SlaveAddress = BoardId;
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf);
+        CSUCOMMDC_TASK_FLAG.matched = TRUE;
+        
+        //Changing the eth0 to 192.168.1.20 + ID
+        #if (DYNAMIC_ETH0_IP_MECHANISM == ENABLE)
+        Eth0_PortSetting_Add(ShmInternalComm->SlaveAddress);
         #endif
+}
+
+/*===========================================================================
+FUNCTION: main
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+        1. PID_CAN_Rx_Task
+=============================================================================*/
+int main(int argc, char *argv[])
+{
+    // ======== [STEP 1/5] Initialize Share Memory ========
+    if(ShareMemory_Init() == 0)
+    {
+
+        SAVE_SYS_LOG_MSG_CSUCOMM("[main]ShareMemory_Init NG");
+
 
         if(ShmStatusCodeData != NULL)
         {
             ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
         }
-
         sleep(5);
         return 0;
     }
 
-    CanFd = InitCanBus();
-    CANReceiverPid = 0;
+    #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+    {
+        sprintf(buf_log_csucomm, 
+                "========= CCS: AC (%d)=========",
+                CCS_ENERGY_TRANSFER_MODE
+               );
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        CsuCommAC_Proc();
+        
+        while (1)
+        {
+            //null
+        }
+    }
+    #endif
+
+    int FD_CAN_Socket;  //Socket File Descriptor
+    struct can_frame frame;
+    unsigned int value_random;
+    unsigned char can_tx_payload[8];
+
+    // ======== [STEP 2/5] Initialize CAN BUS ========
+    FD_CAN_Socket = CANBus_Init();
+    ShmInternalComm->FD_CAN_Socket = FD_CAN_Socket;
+    PID_CAN_Rx_Task = 0;
+
+    ShmInternalComm->SlaveAddress = 0xFF;   //unmatched
+    CSUCOMMDC_TASK_FLAG.matched = FALSE;
 
-    ShmInternalComm->SlaveAddress = 0xFF;
+    //Sniffering CAN packets
+    Sniffer_Candump(ENABLE);
 
-    //Address Request
+    Error_Monitor_CsuComm();    //fork1
+
+#if 0 //disable ID assignmemt 
+	ftime(&ShmInternalComm->Start_Time);
+        srandom(ShmInternalComm->Start_Time.millitm);
+        value_random = random();
+        value_random &= 0xFFFFFF00;
+        value_random |= 0x000000CC; //adding a specific header for identification of CCS.
+    // ======== [STEP 3/5] Request for A Slave Address ========
     while(ShmInternalComm->SlaveAddress == 0xFF)
     {
-        ftime(&StartTime);
-        ftime(&EndTime);
-        srandom(StartTime.millitm);
-        TmpValue = random();
-        #ifdef Debug
-            printf("[CsuComm]main => TmpValue=%d\n", TmpValue);
+        ftime(&ShmInternalComm->Start_Time);
+      //  srandom(ShmInternalComm->Start_Time.millitm);
+     //  value_random = random();
+     //   value_random &= 0xFFFFFF00;
+      //  value_random |= 0x000000CC; //adding a specific header for identification of CCS.
+        DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][main] value_random = %08X (4 Bytes, HEX)\n", value_random);
+
+        memset(can_tx_payload, 0, sizeof(can_tx_payload));
+        memcpy(can_tx_payload, &value_random, sizeof(int));
+
+        //for test
+        #if (CAN_RAMDOM_MATCHING_ID_MECHANISM == DISABLE)
+        value_random = 0xC3B2A1CC;
+        memset(can_tx_payload, 0, sizeof(can_tx_payload));
+        memcpy(can_tx_payload, &value_random, sizeof(int));
+        //can_tx_payload[0] = 0xA1;
+        //can_tx_payload[1] = 0xB2;
+        //can_tx_payload[2] = 0xC3;
+        //can_tx_payload[3] = 0xD4;
+        DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][main] replaced random number = %02X %02X %02X %02X (4 Bytes, HEX)\n",
+                can_tx_payload[0],
+                can_tx_payload[1],
+                can_tx_payload[2],
+                can_tx_payload[3],
+                can_tx_payload[4]);
         #endif
-        memset(Buffer, 0, sizeof(Buffer));
-        memcpy(Buffer, &TmpValue, sizeof(int));
-        SendMsg(CanFd, MsgAddressRequest, ShmInternalComm->SlaveAddress, 4, Buffer);
 
-        while(DiffTimeb(StartTime, EndTime) < 100)//resend interval: 100ms
+        can_tx_payload[4] = Get_GPIO_Value(GPIO_2_23_AM_IO_1) + 1;   //auto detect GPIO
+        //can_tx_payload[4] = 0x01;   //(to be implemented: auto detect GPIO)
+        //0x01:connector 1
+        //0x02:connector 2
+
+        CAN_Tx_MSG(FD_CAN_Socket, CAN_CMD_ADDRESS_REQUEST, ShmInternalComm->SlaveAddress, 5, can_tx_payload);
+	ftime(&ShmInternalComm->End_Time);
+        //Here is the process after sending the CAN message (t = 0   to   t = 100ms)
+        while(DiffTimeb(ShmInternalComm->Start_Time, ShmInternalComm->End_Time) < 1000)//resend interval: 1000ms
         {
-            unsigned int TmpValue2 = 0;
-            ftime(&EndTime);
+            unsigned int value_random_return = 0; //4 Bytes
+          
             memset(&frame, 0, sizeof(struct can_frame));
-            read(CanFd, &frame, sizeof(struct can_frame));
-
-            if((frame.can_id == 0) || (frame.can_id & 0x08000000) || ((frame.can_id & 0x0000FF00) != MsgAddressAssign) || (frame.can_dlc != 4))
+            read(FD_CAN_Socket, &frame, sizeof(struct can_frame));
+	    ftime(&ShmInternalComm->End_Time);
+            PRINT_CAN_FRAME(&frame);
+
+            if( (frame.can_id == 0) ||          //all zero
+                (frame.can_id & 0x08000000) ||  //to avoid incoreect DIRECTION bit
+                ((frame.can_id & 0x0000FF00) != CAN_CMD_ADDRESS_ASSIGN) ||  //the 1st command ID from Master should be 0x02
+                (frame.can_dlc != 5))           //payload length should be only 5 bytes.
             {
                 continue;
             }
 
-            memcpy(&TmpValue2, frame.data, sizeof(int));
+            memcpy(&value_random_return, frame.data, sizeof(int));    //only copy the previous 4 bytes
+
+            DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][main] ori = %X, return = %X (HEX)\n", value_random, value_random_return);
 
-            if(TmpValue2 == TmpValue)
+            if(value_random_return == value_random)
             {
+                //Getting a legal Slave Address, successfully.
                 ShmInternalComm->SlaveAddress = frame.can_id & 0x000000FF;
-                #ifdef SystemLogMessage
-                    {
-                        unsigned char Buffer[128];
-                        memset(Buffer, 0, sizeof(Buffer));
-                        sprintf(Buffer, "[CsuComm]main: ShmCcsData->SlaveAddres=%d", ShmInternalComm->SlaveAddress);
-                        StoreLogMsg(Buffer);
-                    }
+                CSUCOMMDC_TASK_FLAG.matched = TRUE;
+                #if (SAVE_SYS_LOG_MSG_CSUCOMM_SWITCH == ENABLE)
+                {
+                    SAVE_SYS_LOG_MSG_CSUCOMM("Matched");
+                }
                 #endif
-                #ifdef Debug
-                    printf("[CsuComm]main => ShmCcsData->SlaveAddres=0x%x\n", ShmCcsData->SlaveAddres);
+                DEBUG_PRINTF_CSUCOMM_DETAIL("[CsuComm][main] ShmInternalComm->SlaveAddres = %02X (1 Byte, HEX)\t(Matched NOW.)\n", ShmInternalComm->SlaveAddress);
+
+                //Changing the eth0 to 192.168.1.20 + ID
+                #if (DYNAMIC_ETH0_IP_MECHANISM == ENABLE)
+                Eth0_PortSetting_Add(ShmInternalComm->SlaveAddress);
                 #endif
+
                 break;
             }
         }
     }
+#else    
+	sleep(5);
+	CheckID();
+#endif
+    // ======== [STEP 4/5] CAN RX  ========
+    CAN_Rx(FD_CAN_Socket);  //precondition: matched already
+    //Here is a indivitual process/task which is dealing with all CAN message and commands.
 
-    CANReceiver(CanFd);
+    // ======== [STEP 5/5] CAN TX  ========
     //main loop
-    ftime(&StartTime);
+    ftime(&ShmInternalComm->Start_Time);
 
     while(1)
     {
-        ftime(&EndTime);
+/*
+        //CAN_CMD_ADDRESS_REQUEST              0x00000100
+        if (CSUCOMMDC_TASK_FLAG.matched == TRUE)
+        {
+            //Proc_Match(FD_CAN_Socket);
+            //CSUCOMMDC_TASK_FLAG.matched = FALSE;
+        }
+
+        //CAN_CMD_ADDRESS_ASSIGN               0x00000200
+        if (CSUCOMMDC_TASK_FLAG.Got_AssignedAddress == TRUE)
+        {
+            //Proc_AddressAssignRes(FD_CAN_Socket);
+            CSUCOMMDC_TASK_FLAG.Got_AssignedAddress = FALSE;
+        }
+*/
+        //======================================================================
+
+        // CAN_CMD_EV_BOARD_STATUS         0x00000300
+        ftime(&ShmInternalComm->End_Time);
+        if(DiffTimeb(ShmInternalComm->Start_Time, ShmInternalComm->End_Time) >= 1000)   //ori = 1000ms
+        {
+            //Interval = 1000ms
+            CSUCOMMDC_TASK_FLAG.Send_EVBoardStatus = TRUE;
+            CheckID();
+        }
+
+        if (CSUCOMMDC_TASK_FLAG.Send_EVBoardStatus == TRUE)
+        {
+            //Tx Interval = 1000ms
+            Proc_EVBoardStatusRes(FD_CAN_Socket);
+            ftime(&ShmInternalComm->Start_Time);
+        }
+
+        // CAN_CMD_GET_FW_VERSION               0x00000400
+        if(CSUCOMMDC_TASK_FLAG.Got_FWVersionReq == TRUE)
+        {
+            Proc_GetFirmwareVersionRes(FD_CAN_Socket);
+        }
+
+        // CAN_CMD_GET_HW_VERSION               0x00000500
+        if(CSUCOMMDC_TASK_FLAG.Got_HWVersionReq == TRUE)
+        {
+            Proc_HardwareVersionRes(FD_CAN_Socket);
+        }
+
+         //CAN_CMD_CHARGING_PERMISSION          0x00000600
+        if (CSUCOMMDC_TASK_FLAG.Got_ChargingPermission == TRUE)
+        {
+            Proc_ChargingPermissionRes(FD_CAN_Socket);     //need real-time response
+        }
+
+        // CAN_CMD_EVSE_OUTPUT_STATUS_ANNOUNCEMENT       0x00000700
+        if(CSUCOMMDC_TASK_FLAG.Got_EVSEOutputStatus == TRUE)
+        {
+            Proc_EVSEOutputStatusUpdateRes(FD_CAN_Socket);     //need real-time response
+        }
+
+        // CAN_CMD_EVSE_CAPACITY_ANNOUNCEMENT     0x00000800
+        if (CSUCOMMDC_TASK_FLAG.Got_EnergyCapacity == TRUE)
+        {
+            Proc_EVSECapacityUpdateRes(FD_CAN_Socket);         //need real-time response
+        }
+
+        // CAN_CMD_GET_EV_TARGET_INFO      0x00000900
+        if(CSUCOMMDC_TASK_FLAG.Got_EVTargetReq == TRUE)
+        {
+            Proc_GetEVTargetRes(FD_CAN_Socket);
+        }
+
+        // CAN_CMD_GET_EV_BATTERY_INFO         0x00000A00
+        if(CSUCOMMDC_TASK_FLAG.Got_EVBatteryInfoReq == TRUE)
+        {
+            Proc_GetEVBatteryInfoRes(FD_CAN_Socket);
+        }
+
+        //#define CAN_CMD_EV_STOP_EVENT        0x00000B00
+        if (CSUCOMMDC_TASK_FLAG.Send_EVStopReq == TRUE) //The Request is from SeccComm
+        {
+            Proc_EVStopRes(FD_CAN_Socket);
+        }
+
+        //#define CAN_CMD_EVSE_STOP_EVENT      0x00000C00
+        if (CSUCOMMDC_TASK_FLAG.Got_EVSEStopReq == TRUE)
+        {
+            Proc_EVSEStopRes(FD_CAN_Socket);
+        }
+
+        //#define CAN_CMD_GET_MISC_INFO        0x00000D00
+        if(CSUCOMMDC_TASK_FLAG.Got_MiscellaneousInfoReq == TRUE)
+        {
+            Proc_GetMiscellaneousInfoRes(FD_CAN_Socket);
+        }
 
-        if(DiffTimeb(StartTime, EndTime) >= 1000)
+        //#define CAN_CMD_DOWNLOAD_REQUEST     0x00000E00
+        if (CSUCOMMDC_TASK_FLAG.Got_DownloadImageReq == TRUE)
         {
-            SendStatusNotification(CanFd);
-            ftime(&StartTime);
+            Proc_DownloadImageRes(FD_CAN_Socket);
+
+        }
+
+        //#define CAN_CMD_START_BLOCK_TRANSFER 0x00000F00
+        if (CSUCOMMDC_TASK_FLAG.Got_BlockTransferStartReq == TRUE)
+        {
+            Proc_BlockTransferStartRes(FD_CAN_Socket);
+
+        }
+
+        // CAN_CMD_DATA_TRANSFER               0x00001000
+        if(CSUCOMMDC_TASK_FLAG.Got_DataTransferReq == TRUE)
+        {
+            Proc_DataTransferRes(FD_CAN_Socket);
+
         }
 
-        if(ShmInternalComm->InternalCommUnion.bits.FwVersion == 1)
+        //CAN_CMD_DOWNLOAD_FINISH              0x00001100
+        if (CSUCOMMDC_TASK_FLAG.Got_DownloadFinishReq == TRUE)
         {
-            SendFwVersion(CanFd);
-            ShmInternalComm->InternalCommUnion.bits.FwVersion = 0;
+            Proc_DownloadFinishRes(FD_CAN_Socket);
+
         }
 
-        if(ShmInternalComm->InternalCommUnion.bits.HwVersion == 1)
+        // CAN_CMD_ISOLATION_STATUS            0x00001200
+        if (CSUCOMMDC_TASK_FLAG.Got_IsolationStatus == TRUE)
         {
-            SendHwVersion(CanFd);
-            ShmInternalComm->InternalCommUnion.bits.HwVersion = 0;
+            Proc_IsolationStatusAnnounceRes(FD_CAN_Socket);
+
         }
 
-        if(ShmInternalComm->InternalCommUnion.bits.OutputRequirement == 1)
+        // CAN_CMD_CCS_CONNECTOR_INFO          0x00001300
+        if (CSUCOMMDC_TASK_FLAG.Got_CCSConnectorReq == TRUE)
         {
-            SendOutputReq(CanFd);
-            ShmInternalComm->InternalCommUnion.bits.OutputRequirement = 0;
+            Proc_CCSConnectorTypeSetRes(FD_CAN_Socket);   //to-do
+
         }
 
-        if(ShmInternalComm->InternalCommUnion.bits.EvBatteryInfo == 1)
+        // CAN_CMD_RTC_INFO                    0x00001400
+        if (CSUCOMMDC_TASK_FLAG.Got_RTC == TRUE)
         {
-            SendBatteryInfo(CanFd);
-            ShmInternalComm->InternalCommUnion.bits.EvBatteryInfo = 0;
+            Proc_RTCSetRes(FD_CAN_Socket);   //to-do
+
         }
 
-        if(ShmInternalComm->InternalCommUnion.bits.MiscInfo == 1)
+        //CAN_CMD_EVSE_PRECHARGE_INFO       //0x00001500
+        if (CSUCOMMDC_TASK_FLAG.Got_EVSE_Precharge_Info == TRUE)
         {
-            SendMiscInfo(CanFd);
-            ShmInternalComm->InternalCommUnion.bits.MiscInfo = 0;
+            Proc_EVSEPrechargeInfoUpdateRes(FD_CAN_Socket);
         }
 
+        //CAN_CMD_EVCCID_REQUEST            //0x00001600
+        if (CSUCOMMDC_TASK_FLAG.Got_EVCCID_Req == TRUE)
+        {
+            Proc_EVCCIDRes(FD_CAN_Socket);
+        }
     }
 
 EndProcess:
-
-    if(CANReceiverPid > 0)
+    if(PID_CAN_Rx_Task > 0)
     {
         char Buf[32];
         memset(Buf, 0, 32);
-        sprintf(Buf, "kill %d", CANReceiverPid);
+        sprintf(Buf, "kill %d", PID_CAN_Rx_Task);
         system(Buf);
     }
 
-    close(CanFd);
+    close(FD_CAN_Socket);
     system("/sbin/ip link set can0 down");
     system("/sbin/ip link set can0 type can bitrate 500000 restart-ms 100");
     system("/sbin/ip link set can0 up");

+ 98 - 0
EVSE/Projects/CCS/Apps/CsuComm.h

@@ -5,3 +5,101 @@
                         initiated by Vern, Joseph
                            (since 2019/07/19)
 =============================================================================*/
+#if FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_CSUCOMM_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_CSUCOMM_SHOW               DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_CSUCOMM_BRIEF_SHOW         DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_CSUCOMM_DETAIL_SHOW        DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_CSUCOMM_SYSTEM_LOG_SHOW    DISABLE      //ENABLE, DISABLE
+#else   //debug mode
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_CSUCOMM_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_CSUCOMM_SHOW               ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_CSUCOMM_BRIEF_SHOW         DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_CSUCOMM_DETAIL_SHOW        DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_CSUCOMM_SYSTEM_LOG_SHOW    ENABLE      //ENABLE, DISABLE
+#endif
+
+
+#define CSUCOMM_CAN_RX_TIMEOUT                  5000        //5s, unit: ms
+
+#define CSUCOMM_OPERATION_MODE_SIMULATION       1
+#define CSUCOMM_OPERATION_MODE_NORMAL           2
+
+#define CSUCOMM_OPERATION_MODE                  CSUCOMM_OPERATION_MODE_NORMAL
+
+
+//Protocol format : Dir
+#define CAN_SEND_DIRECTION                          0x08000000
+#define CAN_RECV_DIRECTION                          0x00000000
+
+//Protocol format : Message ID
+#define CAN_CMD_ADDRESS_REQUEST                     0x00000100
+#define CAN_CMD_ADDRESS_ASSIGN                      0x00000200
+#define CAN_CMD_EV_BOARD_STATUS                     0x00000300
+#define CAN_CMD_GET_FW_VERSION                      0x00000400
+#define CAN_CMD_GET_HW_VERSION                      0x00000500
+#define CAN_CMD_CHARGING_PERMISSION                 0x00000600
+#define CAN_CMD_EVSE_OUTPUT_STATUS_ANNOUNCEMENT     0x00000700
+#define CAN_CMD_EVSE_CAPACITY_ANNOUNCEMENT          0x00000800
+#define CAN_CMD_GET_EV_TARGET_INFO                  0x00000900
+#define CAN_CMD_GET_EV_BATTERY_INFO                 0x00000A00
+#define CAN_CMD_EV_STOP_EVENT                       0x00000B00
+#define CAN_CMD_EVSE_STOP_EVENT                     0x00000C00
+#define CAN_CMD_GET_MISC_INFO                       0x00000D00
+#define CAN_CMD_DOWNLOAD_REQUEST                    0x00000E00
+#define CAN_CMD_START_BLOCK_TRANSFER                0x00000F00
+#define CAN_CMD_DATA_TRANSFER                       0x00001000
+#define CAN_CMD_DOWNLOAD_FINISH                     0x00001100
+#define CAN_CMD_ISOLATION_STATUS                    0x00001200
+#define CAN_CMD_CCS_CONNECTOR_INFO                  0x00001300
+#define CAN_CMD_RTC_INFO                            0x00001400
+#define CAN_CMD_EVSE_PRECHARGE_INFO                 0x00001500
+#define CAN_CMD_EVCCID_REQUEST                      0x00001600
+#define CAN_CMD_PCBA_TEST                           0x0000AA00
+
+void PRINT_CAN_FRAME(struct can_frame *frame);
+int Proc_EVSEPrechargeInfoUpdateRes(int Fd);
+void Proc_EVSEPrechargeInfoUpdateReq(struct can_frame *frame);
+int Reboot_Process();
+void Error_Monitor_CsuComm();
+
+//System Log
+#if SAVE_SYS_LOG_MSG_CSUCOMM_SWITCH == ENABLE
+    #define SAVE_SYS_LOG_MSG_CSUCOMM     StoreLogMsg
+#else
+    #define SAVE_SYS_LOG_MSG_CSUCOMM(...)
+#endif
+
+//Debug Message
+#if DEBUG_PRINTF_CSUCOMM_SHOW == ENABLE
+    //Brief Messages
+    #if DEBUG_PRINTF_CSUCOMM_BRIEF_SHOW == ENABLE
+        #define DEBUG_PRINTF_CSUCOMM_BRIEF      printf
+    #else
+        #define DEBUG_PRINTF_CSUCOMM_BRIEF(...)
+    #endif
+
+    //Detail Messages
+    #if DEBUG_PRINTF_CSUCOMM_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_CSUCOMM_DETAIL     printf
+    #else
+        #define DEBUG_PRINTF_CSUCOMM_DETAIL(...)
+    #endif
+
+    //System Log Messages
+    #if DEBUG_PRINTF_CSUCOMM_SYSTEM_LOG_SHOW == ENABLE
+        #define DEBUG_PRINTF_CSUCOMM_SYSTEM_LOG    printf
+    #else
+        #define DEBUG_PRINTF_CSUCOMM_SYSTEM_LOG(...)
+    #endif
+#else
+    #define DEBUG_PRINTF_CSUCOMM_BRIEF(...)
+    #define DEBUG_PRINTF_CSUCOMM_DETAIL(...)
+    #define DEBUG_PRINTF_CSUCOMM_SYSTEM_LOG(...)
+#endif

+ 465 - 0
EVSE/Projects/CCS/Apps/CsuCommAC.h

@@ -0,0 +1,465 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 CsuCommAC.h
+
+                             initiated by Joseph
+                              (since 2020/06/10)
+=============================================================================
+Merged from:
+- GIT Server: https://git.phihong.com.tw:30000/System_Integration/CSU3_AM335x/commits/AW-CCS
+- VERSION SHA: de7e1da3b9d219fbb8babf12d305e9423f1e8d94
+- VERSION Date: 2020-06-12
+=============================================================================*/
+
+typedef struct Verion
+{
+	char Version_FW[32];
+	char Version_HW[32];
+}Ver;
+
+typedef struct PRESENTINPUTVOLTAGE
+{
+	unsigned char inputType;	// 0x00: Line to Line       0x01: Line to Neutral
+	double L1N_L12;
+	double L2N_L23;
+	double L3N_L31;
+}PresentInputVoltage;
+
+typedef struct PRESENTOUTPUTVOLTAGE
+{
+	double behindFuse_Voltage_C1;
+	double behindRelay_Voltage_C1;
+	double behindFuse_Voltage_C2;
+	double behindRelay_Voltage_C2;
+}PresentOutputVoltage;
+
+typedef struct FANSPEED
+{
+	unsigned short int speed[4];
+}FanSpeed;
+
+typedef struct TEMPERATURE
+{
+	unsigned char point[8];
+}Temperature;
+
+typedef struct AUXPOWER
+{
+	unsigned char voltage[8];
+}AuxPower;
+
+typedef struct RELAY
+{
+	unsigned char relay_status[2][8];
+}Relay;
+
+typedef struct GFD
+{
+	unsigned short int adc_value_positive[2];
+	unsigned short int adc_value_negative[2];
+}Gfd;
+
+typedef struct GPIO_IN
+{
+	unsigned char AC_Connector;
+	unsigned char AC_MainBreaker;
+	unsigned char SPD;
+	unsigned char Door_Open;
+	unsigned char GFD[2];
+	unsigned char Button[2];
+	unsigned char Button_Emergency;
+}Gpio_in;
+
+typedef struct GPIO_OUT
+{
+	unsigned char AC_Connector;
+	unsigned char Button_LED[2];
+	unsigned char System_LED[4];
+}Gpio_out;
+
+typedef struct ALARM_LOG
+{
+	unsigned char logArea;
+	unsigned int alarmIndex;
+	unsigned char log[8];
+}Alarm_Log;
+
+typedef struct BLE_CONFIG_DATA
+{
+	unsigned char isLogin:1;
+	unsigned char isRequestStart:1;
+	unsigned char isRequestStop:1;
+}Ble_Config_Data;
+
+typedef struct BLE_LONGIN_CENTRAL_ID
+{
+	unsigned char id[32];
+}Ble_Login_Central_Id;
+
+typedef struct RTC
+{
+	unsigned short int year;
+	unsigned char month;
+	unsigned char day;
+	unsigned char hour;
+	unsigned char min;
+	unsigned char sec;
+}Rtc;
+
+typedef struct PRESENTOUTPUTCURRENT
+{
+	double L1N_L12[2];
+	double L2N_L23[2];
+	double L3N_L31[2];
+}Presentoutputcurrent;
+
+typedef struct AC_PRIMARY_MCU
+{
+	unsigned char cp_state;
+	unsigned int  current_limit;
+	float cp_voltage_positive;
+	float cp_voltage_negtive;
+	unsigned char locker_state;
+	unsigned char relay_state;
+	unsigned char shutter_state;
+	unsigned char meter_state;
+	unsigned char pp_state;
+	unsigned char rating_current;
+	unsigned char rotatory_switch;
+	Relay	relayState;
+}Ac_Primary_Mcu;
+
+typedef struct AC_PRIMARY_MCU_ALARM
+{
+	union
+	{
+		unsigned long InputAlarmCode;
+		struct
+		{
+			unsigned long OVP_L1:1;
+			unsigned long UVP_L1:1;
+			unsigned long OCP_L1:1;
+			unsigned long OTP:1;
+			unsigned long gmi_fault:1;
+			unsigned long cp_fault:1;
+			unsigned long ac_leak:1;
+			unsigned long dc_leak:1;
+			unsigned long mcu_selftest_fail:1;
+			unsigned long handshaking_timeout:1;
+			unsigned long emergency_stop:1;
+			unsigned long relay_welding:1;
+			unsigned long leak_module_fail:1;
+			unsigned long shutter_fault:1;
+			unsigned long locker_fault:1;
+			unsigned long power_drop:1;
+			unsigned long rotate_switch_fault:1;
+			unsigned long short_circuit_L1:1;
+			unsigned long relay_drive_fault:1;
+			unsigned long comm_timeout:1;
+			unsigned long OVP_L2:1;
+			unsigned long UVP_L2:1;
+			unsigned long OCP_L2:1;
+			unsigned long OVP_L3:1;
+			unsigned long UVP_L3:1;
+			unsigned long OCP_L3:1;	
+			unsigned long short_circuit_L2:1;
+			unsigned long short_circuit_L3:1;			
+		}bits;
+	};
+}Ac_Primary_Mcu_Alarm;
+
+typedef struct AC_PRIMARY_MCU_LED
+{
+	unsigned char mode;
+	unsigned long alarm_code;
+}Ac_Primary_Mcu_Led;
+
+typedef struct EVSE_ID
+{
+	unsigned char model_name[14];
+	unsigned char serial_number[12];
+}Evse_Id;
+
+typedef struct AC_PRIMARY_MCU_CP_PWM_DUTY
+{
+	unsigned int max_current;
+}Ac_Primary_Mcu_Cp_Pwm_Duty;
+
+typedef struct LEGACY_REQUEST
+{
+	unsigned char isLegacyRequest:1;
+	uint8_t isRelayOn:1;
+}Legacy_Request;
+
+typedef struct POWER_CONSUMPTION
+{
+	uint32_t power_consumption;
+	uint32_t power_consumption_at_start;
+
+}Power_Consumption;
+
+typedef struct MCU_OP_FLAG
+{
+	unsigned char isSetModePass:1;
+	unsigned char isSetSerialNumberPass:1;
+	unsigned char isSetModelNamePass:1;
+	unsigned char isReadFwVerPass:1;
+	unsigned char isMcuUpgradeReq:1;
+	unsigned char isSetCpPwmDuty:1;
+}Mcu_Op_Flag;
+
+typedef struct SYSTEM_ALARM_CODE
+{
+	unsigned long SystemAlarmCode;
+
+}System_Alarm_Code;
+
+typedef struct OTHER_ALARM_CODE
+{
+	unsigned long isHandshakingTimeOut:1;
+	unsigned long isDcLeakage:1;
+	unsigned long isACLeakage:1;
+}Other_Alarm_Code;
+
+typedef struct PILOT_VOLTAGE
+{
+	float PilotVoltagePositive;
+	float PilotVoltageNegative;
+
+}Pilot_Voltage;
+
+typedef struct FW_UPGRADE_INFO
+{
+	int fwType;
+	char modelName[17];
+	char location[384];
+}Fw_Upgrade_Info;
+
+typedef struct GUN_PLUGIN_TIMES
+{
+	uint32_t GunPluginTimes;
+
+}Gun_Plugin_Times;
+
+typedef struct MCU_RESET_REQUEST
+{
+	unsigned char isMcuResetRequest:1;
+}Mcu_Reset_Request;
+
+typedef struct TIMEOUT_SPEC
+{
+	int Setting_Timeout_Spec;
+	int Present_Timeout_Spec;
+}Timeout_Spec;
+
+typedef struct SET_BREATHE_LED_TIMING
+{
+	uint16_t set_Led_Action_Connected_Fade_In;
+	uint16_t set_Led_Action_Connected_Fade_Out;
+	uint16_t set_Led_Action_Authed_Fade_In;
+	uint16_t set_Led_Action_Authed_Fade_Out;
+	uint16_t Set_Led_Action_Chaging_Fade_In;
+	uint16_t set_Led_Action_Chaging_Fade_Out;
+}Set_Breathe_Led_Timing;
+
+typedef struct SET_LED_BRIGHTNESS
+{
+	uint8_t sector_1;	// 0~1 AM and 1~2 AM
+	uint8_t sector_2;	// 2~3 AM and 3~4 AM
+	uint8_t sector_3;	// 4~5 AM and 5~6 AM
+	uint8_t sector_4;	// 6~7 AM and 7~8 AM
+	uint8_t sector_5;	// 8~9 AM and 9~10 AM
+	uint8_t sector_6;	// 10~11 AM and 11~12 AM
+	uint8_t sector_7;	// 12~13 PM and 13~14 PM
+	uint8_t sector_8;	// 14~15 PM and 15~16 PM
+	uint8_t sector_9;	// 16~17 PM and 17~18 PM
+	uint8_t sector_10;	// 18~19 PM and 19~20 PM
+	uint8_t sector_11;	// 20~21 PM and 21~22 PM
+	uint8_t sector_12;	// 22~23 PM and 23~24 PM
+}Set_Led_Brightness;
+
+typedef struct CCS_INFO
+{
+	uint8_t		BatteryChargeType;				/*0x00: AC charging, 0x01: DC charging*/
+	uint8_t 	PresentMsgFlowStatus;   
+												/*  ISO15118_2018
+												0: Idle(wait B2 state), 
+												1: CM_SLAC_PARM.REQ, 
+												2: CM_SLAC_PARM.CNF, 
+												3: CM_START_ATTEN_CHAR.IND
+												4: CM_MNBC_SOUND.IND, 
+												5: CM_ATTEN_CHAR.IND, 
+												6: CM_ATTEN_CHAR.RSP, 
+												7: CM_VALIDATE.REQ
+												8: CM_VALIDATE.CNF, 
+												9: CM_SLAC_MATCH.REQ, 
+												10: CM_SLAC_MATCH.CNF, 
+												11: CM_AMP_MAP.REQ
+												12: CM_AMP_MAP.CNF, 
+												13: SLACC/SDP/TCP connection,
+												16: SupportedAppProtocolRequest, 
+												17: SupportedAppProtocolResponse, 
+												18: SessionSetupRequest
+												19: SessionSetupResponse, 
+												20: ServiceDiscoveryRequest, 
+												21: ServiceDiscoveryResponse
+												22: ServiceDetailRequest, 
+												23: ServiceDetailResponse
+												24:ServiceAndPaymentSelectionRequest/ServiceSelectionRequest, 
+												25: ServiceAndPaymentSelectionResponse/ServiceSelectionResponse
+												26: PaymentDetailsRequest/IdentificationDetailsRequest;, 
+												27: PaymentDetailsResponse/IdentificationDetailsResponse,
+												28: AuthorizationRequest, 
+												29: AuthorizationResponse,
+												30: CertificateUpdateRequest, 
+												31: CertificateUpdateResponse, 
+												32:CertificateInstallationRequest, 
+												33: CertificateInstallationResponse
+												34: ChargeParameterDiscoveryRequest, 
+												35: ChargeParameterDiscoveryResponse
+												36: CableCheckRequest, 
+												37: CableCheckResponse, 
+												38: PreChargeRequest, 
+												39: PreChargeResponse
+												40: PowerDeliveryRequest start, 
+												41: PowerDeliveryResponse start, 
+												42: ChargingStatusRequest, 
+												43: ChargingStatusResponse
+												44:CurrentDemandRequest, 
+												45:CurrentDemandResponse, 
+												46:MeteringReceiptRequest, 
+												47: MeteringReceiptResponse
+												48: PowerDeliveryRequest end, 
+												49: PowerDeliveryRequest end, 
+												50: WeldingDetectionRequest, 
+												51: WeldingDetectionResponse,
+												52: SessionStopRequest, 
+												53: SessionStopResponse
+												253: Performance Timeout, 
+												254: Sequence Timeout, 
+												255: Fault
+												*/
+
+	float 		ConnectorTemperature1;			/*unit: 1°C*/
+	float 		ConnectorTemperature2;			/*unit: 1°C*/
+	uint16_t	ChargingRemainTime;				/*0x0000: 0 sec ~ 0xFFFF: 65535 sec, unit: 1 second*/
+	float		TotalBatteryCapacity;			/*unit: Wh*/
+	float		BatteryMaximumVoltage;			/*unit: 1 volt*/
+	float		BatteryMaximumCurrent;			/*unit: 1 amp*/
+	uint8_t		EVCCID[8];
+	uint8_t		EVSEID[40];
+	uint8_t		CCSLibRev[32];
+	uint8_t		EVSEModelName[32];
+	uint32_t	CSUAlarmStatusCode;
+	uint16_t	CCSAlarmStatusCode;
+	uint8_t		PaymentOption;					/* 0x00 EIM, 0x01 Pnc */
+	float		EVSEMaxCurrent;					/*unit: 1 amp*/
+	float		EVSEMinCurrent;					/*unit: 1 amp*/
+	float		GridVoltage[3];				    /*unit: 1 volt*/
+	uint8_t		MeterID[32];					/*unit: 1 amp*/
+	float		MeterReadingValue;				/*unit: 1Wh*/
+	uint8_t		EVOperation;					/*0:Charge, 1:Discharge*/
+	uint8_t		EVChargeProgress;				/*0: Stop
+													1: Start
+													2: Renegotiate
+													3: Standby */
+	uint8_t		CpSetPWMDuty;					/*unit: 1%
+													0: 0%
+													5: 5%
+													100: 100%*/
+	uint8_t		CpSetStateE;					/*0:disable, 1:enable*/
+	uint8_t		CpPresentPWMDuty;				/*unit:1%*/
+	uint8_t		CpPresentState;					/*1: A (12V, no PWM)
+													2: B1 (9V, no PWM)
+													3: B2 (9V, with PWM)
+													4: C (6V, with PWM)
+													5: D (3V, with PWM)
+													6: E (0V, no PWM)
+													7: F (-12V, no PWM)
+													8: G (>12V)
+													9: H  (<12V)*/
+	float		CpPositiveVoltage;				/*uint: 1V*/
+	float		CpNegativeVoltage;				/*uint: 1V*/
+	uint32_t	CcsHeartBeat;					/*unit: 1*/
+	float 		EVSEPresentCurrent[3];			//unit: 1A
+	float 		AvailableChargingPower;			//1KW
+	uint8_t		EVSENotification;				//0:none, 1:StopCharging, 2:RenNgotiation
+	uint16_t 	ChargingPermission:1;				/*0x00: Not ready yet, stay in idle mode or go into terminating process.
+												  0x01: start charging process*/
+	uint16_t 	ConnectorLockerStatus:1;			/*0x00: released
+												  0x01: locked*/	
+												 
+	uint16_t	RcdStatus:1;					/* 0x00 no error
+												   0x01 an error */
+	uint16_t	OutputRelayStatus:1;			/*0: OFF
+												1: ON*/
+	uint16_t	TempFlag4:1;
+	uint16_t	TempFlag5:1;
+	uint16_t	TempFlag6:1;
+	uint16_t	TempFlag7:1;
+	uint16_t	TempFlag8:1;
+	uint16_t	TempFlag9:1;
+	uint16_t	TempFlag10:1;
+	uint16_t	TempFlag11:1;
+	uint16_t	TempFlag12:1;
+	uint16_t	TempFlag13:1;
+	uint16_t	TempFlag14:1;
+	uint16_t	TempFlag15:1;
+	
+}Ac_Ccs_Info;
+
+typedef struct GUN_INFO
+{
+	Ver 											ver;
+	PresentInputVoltage 							inputVoltage;
+	Presentoutputcurrent							outputCurrent;
+	Temperature 									temperature;
+	Ble_Config_Data									bleConfigData;
+	Ble_Login_Central_Id							bleLoginCentralId;
+	Rtc												rtc;
+	Ac_Primary_Mcu									primaryMcuState;
+	Ac_Primary_Mcu_Alarm							primaryMcuAlarm;
+	Ac_Primary_Mcu_Led								primaryMcuLed;
+	Mcu_Op_Flag										mcuFlag;
+	Power_Consumption								powerConsumption;
+	Legacy_Request									legacyRequest;
+	System_Alarm_Code								systemAlarmCode;
+	Ac_Primary_Mcu_Cp_Pwm_Duty						primaryMcuCp_Pwn_Duty;
+	Other_Alarm_Code								otherAlarmCode;
+	Pilot_Voltage									PilotVoltage;
+	Gun_Plugin_Times								gunPluginTimes;
+	Mcu_Reset_Request								mcuResetRequest;
+	Set_Breathe_Led_Timing							setBreatheLedTiming;
+	Set_Led_Brightness								setLedBrightness;
+	Ac_Ccs_Info										acCcsInfo;
+	uint8_t											ccsHandshakeState;
+	uint8_t											PreviousEVChargeProgress;	
+	uint8_t											chargingMode;
+	uint16_t										targetCurrent;
+	
+	uint16_t										isAuthPassEnd:1;
+	uint16_t										rfidReq:1;
+	uint16_t										isGunPlugged:1;
+	uint16_t										isInitialPass:1;
+	uint16_t										isSetBreatheLedTiming:1;
+	uint16_t										isSetLedBrightness:1;
+	uint16_t										isUnlockerConnetor:1;
+	uint16_t										isOperactive:1;
+	uint16_t										isCCSWaitChangeDuty:1;
+	uint16_t										isCCSStartTransation:1;
+}Gun_Info;
+
+//struct Charger
+struct InternalCommAC
+{
+	Ver 					ver;
+	Evse_Id					evseId;
+	Gun_Info 				gun_info[2];
+	Fw_Upgrade_Info			fwUpgradeInfo;
+	Timeout_Spec			timeoutSpec;
+	
+	uint8_t					gun_selectd;
+	uint8_t	 				speaker_type;
+	uint8_t					isSpeakerOn:1;
+	uint8_t		 			isUpdateSuccess:1;
+};

+ 266 - 39
EVSE/Projects/CCS/Apps/EventLogging.c

@@ -31,28 +31,241 @@
 
 struct SysConfigAndInfo         *ShmSysConfigAndInfo;
 struct StatusCodeData           *ShmStatusCodeData;
+unsigned char buf_log_eventlogging[SIZE_OF_LOG_BUFFER];
 
+/**************************************************************************************/
+/**************************Alarm Share memory**************************************/
+/***************************************************************************************
+	Status Code	A			B				C									D	E	F
+				0: Issue		1: From EVSE 		1: Fault (unrecoverable)					001 ~ 999 serial number
+			    								e.g., hardware broken, system latch
+				1: Recovered	2: From EV		2: Alarm (recoverable)
+			   								e.g., OTP, OVP
+							3: From Backend	3: Information
+			  								e.g., swipe card to stop charging
+
+according to XXX.Revxx
+***************************************************************************************/
+/**************************************************************************************/
+char FaultStatusCode[32][6]=
+{
+	"011001",	//CHAdeMO output fuse blew
+	"011002",	//CCS output fuse blew
+	"011003",	//GB output fuse blew
+	"011004",	//RCD/CCID self-test fail
+	"011005",	//AC input contactor 1 welding
+	"011006",	//AC input contactor 1 driving fault
+	"011007",	//AC input contactor 2 welding
+	"011008",	//AC input contactor 2 driving fault
+	"011009",	//AC output relay welding
+	"011010",	//AC output relay  driving fault
+	"011011",	//CHAdeMO output relay welding
+	"011012",	//CHAdeMO output relay driving fault
+	"011013",	//CCS output relay welding
+	"011014",	//CCS output relay driving fault
+	"011015",	//GB output relay welding
+	"011016",	//GB output relay driving fault
+	"011017",	//AC connector temperature sensor broken
+	"011018",	//CHAdeMO connector temperature sensor broken
+	"011019",	//CCS connector temperature sensor broken
+	"011020",	//GB connector temperature sensor broken
+	"011021",	//WiFi module broken
+	"011022",	//3G/4G module broken
+	"011023",	//Aux. power module broken
+	"011024",	//Relay control module /smart box broken
+	"011025",	//CHAdeMO connector lock fail
+	"011026",	//GB connector lock fail
+	"011027",	//AC connector lock fail
+	"011028",	//CHAdeMO module broken
+	"011029",	//CCS module broken
+	"011030",	//GBT module broken
+	"011031",	//PSU module broken
+	"011032"	//Reserved
+};
+
+char AlarmStatusCode[64][6]=
+{
+	"012200",	//System L1 input OVP
+	"012201",	//System L2 input OVP
+	"012202",	//System L3 input OVP
+	"012203",	//System L1 input UVP
+	"012204",	//System L2 input UVP
+	"012205",	//System L3 input UVP
+	"012206",	//PSU L1 input OVP
+	"012207",	//PSU L2 input OVP
+	"012208",	//PSU L3 input OVP
+	"012209",	//PSU L1 input UVP
+	"012210",	//PSU L2 input UVP
+	"012211",	//PSU L3 input UVP
+	"012212",	//System L1 input drop
+	"012213",	//System L2 input drop
+	"012214",	//System L3 input drop
+	"012215",	//System AC output OVP
+	"012216",	//System AC output OCP
+	"012217",	//System CHAdeMO output OVP
+	"012218",	//System CHAdeMO output OCP
+	"012219",	//System CCS output OVP
+	"012220",	//System CCS output OCP
+	"012221",	//System GB output OVP
+	"012222",	//System GB output OCP
+	"012223",	//System ambient/inlet OTP
+	"012224",	//System critical point OTP
+	"012225",	//PSU ambient/inlet OTP
+	"012226",	//PSU critical point OTP
+	"012227",	//Aux. power module OTP
+	"012228",	//Relay board/smart box OTP
+	"012229",	//CHAdeMO connector OTP
+	"012230",	//CCS connector OTP
+	"012231",	//GB connector OTP
+	"012232",	//AC connector OTP
+	"012233",	//RCD/CCID trip
+	"012234",	//CHAdeMO GFD trip
+	"012235",	//CCS GFD trip
+	"012236",	//GB GFD trip
+	"012237",	//SPD trip
+	"012238",	//Main power breaker trip
+	"012239",	//Aux. power breaker trip
+	"012240",	//PSU communication fail
+	"012241",	//WiFi module communication fail
+	"012242",	//3G/4G module communication fail
+	"012243",	//RFID module communication fail
+	"012244",	//Bluetooth module communication fail
+	"012245",	//LCM module communication fail
+	"012246",	//Aux. power module communication fail
+	"012247",	//Relay control boaed/smart box communication fail
+	"012248",	//CCS module communication fail
+	"012249",	//CHAdeMO module communication fail
+	"012250",	//GBT module communication fail
+	"012251",	//Emergency stop
+	"012252",	//Door open
+	"012253",	//System fan decay
+	"012254",	//Fail to create share memory
+	"012255",	//CSU initialization failed
+	"012256",	//Reserved
+	"012257",	//Reserved
+	"012258",	//Reserved
+	"012259",	//Reserved
+	"012260",	//Reserved
+	"012261",	//Reserved
+	"012262",	//Reserved
+	"012263"	//Reserved
+};
+
+char InfoStatusCode[64][6]=
+{
+	//Information comes from EVSE
+	"013600",	//Normal stop charging by user
+	"013601",	//Charging Time's up
+	"013602",	//Replace system air filter
+	"013603",	//Reach to CHAdeMO max. plugging times.
+	"013604",	//Reach to CCS max. plugging times.
+	"013605",	//Reach to GB max. plugging times.
+	"013606",	//Reach to AC max. plugging times.
+	"013607",	//CSU fimrware update fail
+	"013608",	//CHAdeMO Module fimrware update fail
+	"013609",	//CCS Module fimrware update fail
+	"013610",	//GB Module fimrware update fail
+	"013611",	//Aux. power module fimrware update fail
+	"013612",	//Relay control module fimrware update fail
+	"013613",	//LCM module fimrware update fail
+	"013614",	//Bluetooth module fimrware update fail
+	"013615",	//WiFi module fimrware update fail
+	"013616",	//3G/4G module fimrware update fail
+	"013617",	//SMR fimrware update fail
+	"013618",	//RFID module fimrware update fail
+	"013619",	//configured by USB flash drive
+	"013620",	//configured by backend
+	"013621",	//configured by webpage
+	"013622",	//disconnected from Internet through Ethernet
+	"013623",	//disconnected from Internet through WiFi
+	"013624",	//disconnected from Internet through 3G/4G
+	"013625",	//disconnected from AP through WiFi
+	"013626",	//disconnected from APN through 3G/4G
+	"013627",	//Reserved
+	"013628",	//Reserved
+	"013629",	//Reserved
+	"013630",	//Reserved
+	"013631",	//Reserved
+	//Information comes from EV
+	"023700",	//CHAdeMO EV communication Fail
+	"023701",	//CCS EV communication Fail
+	"023702",	//GB EV communication Fail
+	"023703",	//AC: pilot fault
+	"023704",	//CHAdeMO:  battery malfunction
+	"023705",	//CHAdeMO:  no charging permission
+	"023706",	//CHAdeMO:  battery incompatibility
+	"023707",	//CHAdeMO:  battery OVP
+	"023708",	//CHAdeMO:  battery UVP
+	"023709",	//CHAdeMO:  battery OTP
+	"023710",	//CHAdeMO:  battery current difference
+	"023711",	//CHAdeMO:  battery voltage difference
+	"023712",	//CHAdeMO:  shift position
+	"023713",	//CHAdeMO:  battery other fault
+	"023714",	//CHAdeMO:  charging system error
+	"023715",	//CHAdeMO:  EV normal stop
+	"023716",	//Reserved
+	"023717",	//Reserved
+	"023718",	//Reserved
+	"023719",	//Reserved
+	"023720",	//Reserved
+	"023721",	//Reserved
+	"023722",	//Reserved
+	"023723",	//Reserved
+	 //Information comes from Backend
+	"033900",	//disconnected from backend through Ethernet
+	"033901",	//disconnected from backend through WiFi
+	"033902",	//disconnected from backend through 3G/4G
+	"033903",	//Remote start charging by backend
+	"033904",	//Remote stop charging by backend
+	"033905",	//Remote reset by backend
+	"033906",	//Reserved
+	"033907",	//Reserved
+};
 
-#ifdef SystemLogMessage
+/*===========================================================================
+FUNCTION: StoreLogMsg
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#if SAVE_SYS_LOG_MSG_EVENTLOG_SWITCH == ENABLE
 int StoreLogMsg(unsigned char *DataString)
 {
-    unsigned char Buf[256];
-    time_t CurrentTime;
-    struct tm *tm;
+    static unsigned char Buf[1024];
+    static time_t CurrentTime;
+    static struct tm *tm;
+    static struct timeval tv;
 
     memset(Buf, 0, sizeof(Buf));
     CurrentTime = time(NULL);
     tm = localtime(&CurrentTime);
-    sprintf(Buf, "echo \"%04d.%02d.%02d %02d:%02d:%02d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
+    gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][EventLogging]%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+            tm->tm_year + 1900,
+            tm->tm_mon + 1,
+            tm->tm_mday,
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
             DataString,
-            tm->tm_year + 1900, tm->tm_mon + 1);
+            tm->tm_year + 1900,
+            tm->tm_mon + 1);
     system(Buf);
 
-    #ifdef Debug
-    printf("%s \n", DataString);
-    #endif
-    }
+    DEBUG_PRINTF_EVENTLOG_SYSTEM_LOG("[%02d:%02d:%02d.%06d][EventLogging]%s \n",
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            DataString);
+
+    //Reset the buf_log_eventlogging Buffer, i.e. DataString
+    memset(buf_log_eventlogging, 0, SIZE_OF_LOG_BUFFER);
+}
 #endif
 
 int StoreEventLogMsg(unsigned char *EventCodeString)
@@ -69,57 +282,73 @@ int StoreEventLogMsg(unsigned char *EventCodeString)
             EventCodeString,
             tm->tm_year + 1900, tm->tm_mon + 1);
     system(Buf);
-    #ifdef Debug
-        printf("%s \n", Buf);
-    #endif
+
+    DEBUG_PRINTF_EVENTLOG_DETAIL("%s \n", Buf);
 }
 
-int DiffTimeb(struct timeb ST, struct timeb ET)
+double DiffTimeb(struct timeb ST, struct timeb ET)
 {
-    //return milli-second
-    unsigned int StartTime, StopTime;
+	//return milli-second
+    double StartTime, EndTime;
+    double t_diff;
+
+    StartTime = ((double)ST.time)*1000 + (double)ST.millitm;
+    EndTime = ((double)ET.time)*1000 + (double)ET.millitm;
+    t_diff = EndTime - StartTime;
 
-    StartTime = (unsigned int)ST.time;
-    StopTime = (unsigned int)ET.time;
-    return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
+    //printf("%.02lf - %.02lf = %.02lf\n", EndTime, StartTime, t_diff);
+
+    if (t_diff < 0)
+    {
+        #if 0
+        if (t_diff < -1000)   //1000ms
+        {
+            sprintf(buf_log_eventlogging,
+                    "[Warning]StartTime(%.02lf) > EndTime(%.02lf), d(%.02lf)",
+                    StartTime,
+                    EndTime,
+                    t_diff);
+            SAVE_SYS_LOG_MSG_EVENTLOG(buf_log_eventlogging);
+        }
+        #endif
+
+        return -1;
+    }
+    return t_diff;
 }
 
 /**************************************************************************************/
 /**************************Init all share memory *********************************/
 /**************************************************************************************/
-int InitShareMemory()
+int ShareMemory_Init()
 {
     int MeterSMId;
 
-    //creat ShmSysConfigAndInfo
+    //create ShmSysConfigAndInfo
     if((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[EventLogging]InitShareMemory:shmget ShmSysConfigAndInfo NG");
-        #endif
+        StoreLogMsg("[EventLogging]ShareMemory_Init:shmget ShmSysConfigAndInfo NG");
+
         return 0;
     }
     else if((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *)-1)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[EventLogging]InitShareMemory:shmat ShmSysConfigAndInfo NG");
-        #endif
+        StoreLogMsg("[EventLogging]ShareMemory_Init:shmat ShmSysConfigAndInfo NG");
+
         return 0;
     }
 
-    //creat ShmStatusCodeData
+    //create ShmStatusCodeData
     if((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[EventLogging]InitShareMemory:shmget ShmStatusCodeData NG");
-        #endif
+        StoreLogMsg("[EventLogging]ShareMemory_Init:shmget ShmStatusCodeData NG");
+
         return 0;
     }
     else if((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[EventLogging]InitShareMemory:shmat ShmStatusCodeData NG");
-        #endif
+        StoreLogMsg("[EventLogging]ShareMemory_Init:shmat ShmStatusCodeData NG");
+
         return 0;
     }
 
@@ -166,11 +395,9 @@ int main(int argc, char *argv[])
     unsigned char tmp, EventCodeTmp[7];
 
     //Initialization
-    if(InitShareMemory() == 0)
+    if(ShareMemory_Init() == 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[EventLogging]main:InitShareMemory NG");
-        #endif
+        StoreLogMsg("[EventLogging]main:ShareMemory_Init NG");
 
         if(ShmStatusCodeData != NULL)
         {

+ 55 - 0
EVSE/Projects/CCS/Apps/EventLogging.h

@@ -5,3 +5,58 @@
                         initiated by Vern, Joseph
                            (since 2019/07/19)
 =============================================================================*/
+
+#if FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_EVENTLOG_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_EVENTLOG_SHOW               DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_EVENTLOG_BRIEF_SHOW         DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_EVENTLOG_DETAIL_SHOW        DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_EVENTLOG_SYSTEM_LOG_SHOW    DISABLE      //ENABLE, DISABLE
+#else //debug mode
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_EVENTLOG_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_EVENTLOG_SHOW               ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_EVENTLOG_BRIEF_SHOW         DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_EVENTLOG_DETAIL_SHOW        DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_EVENTLOG_SYSTEM_LOG_SHOW    ENABLE      //ENABLE, DISABLE
+#endif
+
+//System Log
+#if SAVE_SYS_LOG_MSG_EVENTLOG_SWITCH == ENABLE
+    #define SAVE_SYS_LOG_MSG_EVENTLOG     StoreLogMsg
+#else
+    #define SAVE_SYS_LOG_MSG_EVENTLOG(...)
+#endif
+
+//Debug Message
+#if DEBUG_PRINTF_EVENTLOG_SHOW == ENABLE
+    //Brief Messages
+    #if DEBUG_PRINTF_EVENTLOG_BRIEF_SHOW == ENABLE
+        #define DEBUG_PRINTF_EVENTLOG_BRIEF      printf
+    #else
+        #define DEBUG_PRINTF_EVENTLOG_BRIEF(...)
+    #endif
+
+    //Detail Messages
+    #if DEBUG_PRINTF_EVENTLOG_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_EVENTLOG_DETAIL     printf
+    #else
+        #define DEBUG_PRINTF_EVENTLOG_DETAIL(...)
+    #endif
+
+    //System Log Messages
+    #if DEBUG_PRINTF_EVENTLOG_SYSTEM_LOG_SHOW == ENABLE
+        #define DEBUG_PRINTF_EVENTLOG_SYSTEM_LOG    printf
+    #else
+        #define DEBUG_PRINTF_EVENTLOG_SYSTEM_LOG(...)
+    #endif
+#else
+    #define DEBUG_PRINTF_EVENTLOG_BRIEF(...)
+    #define DEBUG_PRINTF_EVENTLOG_DETAIL(...)
+    #define DEBUG_PRINTF_EVENTLOG_SYSTEM_LOG(...)
+#endif

+ 57 - 12
EVSE/Projects/CCS/Apps/FWMaker.c

@@ -21,6 +21,54 @@
 #include <sys/mman.h>
 #include "FWMaker.h"
 
+unsigned char buf_log_fwmaker[SIZE_OF_LOG_BUFFER];
+
+/*===========================================================================
+FUNCTION: StoreLogMsg
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#if SAVE_SYS_LOG_MSG_FWMAKER_SWITCH == ENABLE
+int StoreLogMsg(unsigned char *DataString)
+{
+    static unsigned char Buf[1024];
+    static time_t CurrentTime;
+    static struct tm *tm;
+    static struct timeval tv;
+
+    memset(Buf, 0, sizeof(Buf));
+    CurrentTime = time(NULL);
+    tm = localtime(&CurrentTime);
+    gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][FWMaker]%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+            tm->tm_year + 1900,
+            tm->tm_mon + 1,
+            tm->tm_mday,
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            DataString,
+            tm->tm_year + 1900,
+            tm->tm_mon + 1);
+    system(Buf);
+
+    DEBUG_PRINTF_FWMAKER_SYSTEM_LOG("[%02d:%02d:%02d.%06d][FWMaker]%s \n",
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            DataString);
+
+    //Reset the buf_log_fwmaker Buffer, i.e. DataString
+    memset(buf_log_fwmaker, 0, SIZE_OF_LOG_BUFFER);
+}
+#endif
+
 //./FWMaker 172.16.24.126
 int main(int argc, char *argv[])
 {
@@ -28,8 +76,6 @@ int main(int argc, char *argv[])
     int fd, rd = 0, wrd = 0, tmp = 0, rd2 = 0;
     unsigned int CheckSum = 0;
 
-
-
     memset(buf, 0, 64);
     sprintf(buf, "tftp -gr uImage -l /mnt/uImage %s", argv[1]);
     system(buf);
@@ -39,7 +85,7 @@ int main(int argc, char *argv[])
 
     if((MemBuf = malloc(0x100000D)) == NULL)
     {
-        printf("Allocate MemBuf memory error\n");
+        DEBUG_PRINTF_FWMAKER_DETAIL("Allocate MemBuf memory error\n");
         return 0;
     }
 
@@ -50,7 +96,7 @@ int main(int argc, char *argv[])
     {
         if((rd = read(fd, MemBuf, 0x100000D)) <= 0)
         {
-            printf("/mnt/uImage read Error\n");
+            DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/uImage read Error\n");
             free(MemBuf);
             close(fd);
             return 0;
@@ -74,18 +120,18 @@ int main(int argc, char *argv[])
 
         if(wrd != (rd + 13))
         {
-            printf("write error wrd=0x%x, rd=0x%x\n", wrd, rd + 13);
+            DEBUG_PRINTF_FWMAKER_DETAIL("write error wrd=0x%x, rd=0x%x\n", wrd, rd + 13);
         }
         else
         {
-            printf("/mnt/DcoKImage OK\n");
+            DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/DcoKImage OK\n");
         }
 
     }
     else
     {
         free(MemBuf);
-        printf("/mnt/uImage open Error\n");
+        DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/uImage open Error\n");
         return 0;
     }
 
@@ -98,7 +144,7 @@ int main(int argc, char *argv[])
     {
         if((rd = read(fd, MemBuf, 0x100000D)) <= 0)
         {
-            printf("/mnt/rootfs_nor.img read Error\n");
+            DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/rootfs_nor.img read Error\n");
             free(MemBuf);
             close(fd);
             return 0;
@@ -122,18 +168,17 @@ int main(int argc, char *argv[])
 
         if(wrd != (rd + 13))
         {
-            printf("write error wrd=0x%x, rd=0x%x\n", wrd, rd + 13);
+            DEBUG_PRINTF_FWMAKER_DETAIL("write error wrd=0x%x, rd=0x%x\n", wrd, rd + 13);
         }
         else
         {
-            printf("/mnt/DcoFImage OK\n");
+            DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/DcoFImage OK\n");
         }
-
     }
     else
     {
         free(MemBuf);
-        printf("/mnt/rootfs_nor.img open Error\n");
+        DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/rootfs_nor.img open Error\n");
         return 0;
     }
 

+ 54 - 0
EVSE/Projects/CCS/Apps/FWMaker.h

@@ -5,3 +5,57 @@
                         initiated by Vern, Joseph
                            (since 2019/07/19)
 =============================================================================*/
+#if FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_FWMAKER_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_FWMAKER_SHOW               DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWMAKER_BRIEF_SHOW         DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWMAKER_DETAIL_SHOW        DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWMAKER_SYSTEM_LOG_SHOW    DISABLE      //ENABLE, DISABLE
+#else   //debug mode
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_FWMAKER_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_FWMAKER_SHOW               ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWMAKER_BRIEF_SHOW         ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWMAKER_DETAIL_SHOW        ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWMAKER_SYSTEM_LOG_SHOW    ENABLE      //ENABLE, DISABLE
+#endif
+
+//System Log
+#if SAVE_SYS_LOG_MSG_FWMAKER_SWITCH == ENABLE
+    #define SAVE_SYS_LOG_MSG_FWMAKER     StoreLogMsg
+#else
+    #define SAVE_SYS_LOG_MSG_FWMAKER(...)
+#endif
+
+//Debug Message
+#if DEBUG_PRINTF_FWMAKER_SHOW == ENABLE
+    //Brief Messages
+    #if DEBUG_PRINTF_FWMAKER_BRIEF_SHOW == ENABLE
+        #define DEBUG_PRINTF_FWMAKER_BRIEF      printf
+    #else
+        #define DEBUG_PRINTF_FWMAKER_BRIEF(...)
+    #endif
+
+    //Detail Messages
+    #if DEBUG_PRINTF_FWMAKER_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_FWMAKER_DETAIL     printf
+    #else
+        #define DEBUG_PRINTF_FWMAKER_DETAIL(...)
+    #endif
+
+    //System Log Messages
+    #if DEBUG_PRINTF_FWMAKER_SYSTEM_LOG_SHOW == ENABLE
+        #define DEBUG_PRINTF_FWMAKER_SYSTEM_LOG    printf
+    #else
+        #define DEBUG_PRINTF_FWMAKER_SYSTEM_LOG(...)
+    #endif
+#else
+    #define DEBUG_PRINTF_FWMAKER_BRIEF(...)
+    #define DEBUG_PRINTF_FWMAKER_DETAIL(...)
+    #define DEBUG_PRINTF_FWMAKER_SYSTEM_LOG(...)
+#endif

+ 1344 - 0
EVSE/Projects/CCS/Apps/FWUpdate.c

@@ -0,0 +1,1344 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                              FWUpdate.c
+
+                        initiated by Vern, Joseph
+                           (since 2019/07/19)
+=============================================================================*/
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/termios.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <stdlib.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/mman.h>
+#include <linux/sockios.h>
+#include <linux/socket.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <sys/time.h>
+#include <sys/timeb.h>
+#include <math.h>//for pow
+#include "define.h"
+#include "FWUpdate.h"
+#include <unistd.h>
+
+struct SysConfigAndInfo             *ShmSysConfigAndInfo;
+struct StatusCodeData               *ShmStatusCodeData;
+struct CcsData                      *ShmCcsData;
+struct InternalComm               *ShmInternalComm;
+struct InternalCommAC               *ShmInternalCommAC;
+
+unsigned char buf_log_fwupdate[SIZE_OF_LOG_BUFFER];
+
+/*===========================================================================
+FUNCTION: Check_V2G_Flow_Status
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Check_V2G_Flow_Status()
+{
+    unsigned char result = 0;
+
+    switch (ShmCcsData->CommProtocol)
+    {
+        case V2GT_MSG_PROTOCOL_DIN70121:        //0
+        {
+            result = ShmCcsData->V2GMessage_DIN70121.PresentMsgFlowStatus;
+            break;
+        }
+
+        case V2GT_MSG_PROTOCOL_ISO15118_2014:   //1
+        {
+            result = ShmCcsData->V2GMessage_ISO15118_2014.PresentMsgFlowStatus;
+            break;
+        }
+
+        case V2GT_MSG_PROTOCOL_ISO15118_2018:   //2
+        {
+            result = ShmCcsData->V2GMessage_ISO15118_2018.PresentMsgFlowStatus;
+            break;
+        }
+
+        default:
+            break;
+    }
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: StoreLogMsg
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#if SAVE_SYS_LOG_MSG_FWUPDATE_SWITCH == ENABLE
+int StoreLogMsg(unsigned char *DataString)
+{
+    static unsigned char Buf[1024];
+    static time_t CurrentTime;
+    static struct tm *tm;
+    static struct timeval tv;
+
+    memset(Buf, 0, sizeof(Buf));
+    CurrentTime = time(NULL);
+    tm = localtime(&CurrentTime);
+    gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][FWUpdate][%d][%02d]%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+            tm->tm_year + 1900,
+            tm->tm_mon + 1,
+            tm->tm_mday,
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            EVCOMM_SYS_INFO.CpState,
+            Check_V2G_Flow_Status(),
+            DataString,
+            tm->tm_year + 1900,
+            tm->tm_mon + 1);
+    system(Buf);
+
+    DEBUG_PRINTF_FWUPDATE_SYSTEM_LOG("[%02d:%02d:%02d.%06d][FWUpdate][%d][%02d]%s \n",
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            EVCOMM_SYS_INFO.CpState,
+            Check_V2G_Flow_Status(),
+            DataString);
+
+    //Reset the buf_log_fwupdate Buffer, i.e. DataString
+    memset(buf_log_fwupdate, 0, SIZE_OF_LOG_BUFFER);
+}
+#endif
+
+/*===========================================================================
+FUNCTION: fsize
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned long fsize(char* filename)
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("[fsize]image size: caculating...");
+    unsigned long length = 0;
+    FILE *file;
+
+    file = fopen(filename, "rb");
+    if (file == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[fsize]fopen: fail");
+        return 0;
+    }
+    else
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[fsize]fopen: OK");
+        fseek(file, 0, SEEK_END);
+        length = (unsigned long) ftell(file);
+    }
+    fclose(file);
+    sprintf(buf_log_fwupdate, "[fsize]image size: %ld bytes", length);
+    SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+    return length;
+}
+
+/*===========================================================================
+FUNCTION: crc32
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+uint32_t crc32(uint8_t *data, unsigned int length)
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("[crc32]ongoing...");
+    uint8_t i;
+    uint32_t cnt = 0;
+    uint32_t crc = 0xffffffff;  // Initial value
+    while(length--)
+    {
+    	if(cnt > 33 && cnt < 48)
+        {
+    		data++;
+    	}
+        else
+        {
+    		crc ^= *data++;         // crc ^= *data; data++;
+			for (i = 0; i < 8; ++i)
+			{
+				if (crc & 1)
+					crc = (crc >> 1) ^ 0xEDB88320;// 0xEDB88320= reverse 0x04C11DB7
+				else
+					crc = (crc >> 1);
+			}
+    	}
+    	cnt++;
+    }
+    return ~crc;
+}
+
+/*===========================================================================
+FUNCTION: ShareMemory_Init
+DESCRIPTION
+        Initialize all share memories.
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int ShareMemory_Init()
+{
+    int MeterSMId;
+
+    //[1/5] create ShmSysConfigAndInfo
+    if((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("ShareMemory_Init:shmget ShmSysConfigAndInfo NG");
+        return 0;
+    }
+    else if((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("ShareMemory_Init:shmat ShmSysConfigAndInfo NG");
+        return 0;
+    }
+
+    //[2/5] create ShmStatusCodeData
+    if((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("ShareMemory_Init:shmget ShmStatusCodeData NG");
+        return 0;
+    }
+    else if((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("ShareMemory_Init:shmat ShmStatusCodeData NG");
+        return 0;
+    }
+
+    //[3/5] create ShmCcsData
+    if((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData),  0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("ShareMemory_Init:shmget ShmCcsData NG");
+        return 0;
+    }
+    else if((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("ShareMemory_Init:shmat ShmCcsData NG");
+        return 0;
+    }
+
+    //[4/5] create ShmInternalComm
+    if((MeterSMId = shmget(ShmInternalCommKey, sizeof(struct InternalComm),  IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("ShareMemory_Init:shmget ShmInternalComm NG");
+        return 0;
+    }
+    else if((ShmInternalComm = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("ShareMemory_Init:shmat ShmInternalComm NG");
+        return 0;
+    }
+
+    //[5/5] create ShmInternalCommAC
+    if((MeterSMId = shmget(ShmInternalCommACKey, sizeof(struct InternalCommAC),  IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("ShareMemory_Init:shmget ShmInternalCommAC NG");
+        return 0;
+    }
+    else if((ShmInternalCommAC = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("ShareMemory_Init:shmat ShmInternalCommAC NG");
+        return 0;
+    }
+
+    return 1;
+}
+
+/*===========================================================================
+FUNCTION: Update_MLO
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Update_MLO()
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("-------- [MLO]start --------");
+
+    unsigned char result = PASS;
+    long int MaxLen = 48*1024*1024;
+    unsigned long file_length = 0;
+    unsigned char *ptr = malloc(MaxLen);
+
+    if(ptr == NULL)
+    {
+        return FAIL;
+    }
+
+    memset(ptr, 0, MaxLen);
+
+    file_length = fsize("/root/MLO");
+
+    int fd = 0;
+    int wrd = 0;
+    FILE *file;
+    fd = open("/dev/mtdblock0", O_RDWR);
+    file = fopen("/root/MLO", "rb");
+
+    if (fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[MLO]Can not open mtdblock0\n");
+        free(ptr);
+        return FAIL;
+    }
+    else if (file == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[MLO]Can not open or find the downloaded image file\n");
+        free(ptr);
+        return FAIL;
+    }
+    else
+    {
+        //[VITAL] Closing unneccesary task to supoort rapid CAN data receving..
+        SAVE_SYS_LOG_MSG_FWUPDATE("[MLO] closing SeccComm...");
+        system("killall SeccComm");
+
+        // Write image to flash
+        SAVE_SYS_LOG_MSG_FWUPDATE("[MLO]Writing image to mtdblock0...");
+        fread(ptr, sizeof(unsigned char), file_length, file);
+        wrd = write(fd, ptr, file_length);
+
+        close(fd);
+        fclose(file);
+        sprintf(buf_log_fwupdate, "[MLO]mtdblock0 - written length: %d bytes\n", wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+        if(wrd != file_length)
+        {
+            free(ptr);
+            return FAIL;
+        }
+    }
+    free(ptr);
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: IMAGE_TYPE_BOOTLOADER_UBOOT
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Update_uboot()
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("-------- [uboot]start --------");
+
+    unsigned char result = PASS;
+    long int MaxLen = 48*1024*1024;
+    unsigned long file_length = 0;
+    unsigned char *ptr = malloc(MaxLen);
+
+    if(ptr == NULL)
+    {
+        return FAIL;
+    }
+
+    memset(ptr, 0, MaxLen);
+
+    file_length = fsize("/root/u-boot.img");
+
+    int fd = 0;
+    int wrd = 0;
+    FILE *file;
+    fd = open("/dev/mtdblock1", O_RDWR);
+    file = fopen("/root/u-boot.img", "rb");
+    if (fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[uboot]Can not open mtdblock1\n");
+        free(ptr);
+        return FAIL;
+    }
+    else if (file == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[uboot]Can not open the downloaded image file\n");
+        free(ptr);
+        return FAIL;
+    }
+    else
+    {
+        //[VITAL] Closing unneccesary task to supoort rapid CAN data receving..
+        SAVE_SYS_LOG_MSG_FWUPDATE("[uboot] closing SeccComm...");
+        system("killall SeccComm");
+
+        // Write image to flash
+        SAVE_SYS_LOG_MSG_FWUPDATE("[uboot]Writing image to mtdblock1...");
+        fread(ptr, sizeof(unsigned char), file_length, file);
+        wrd = write(fd, ptr, file_length);
+
+        close(fd);
+        fclose(file);
+        sprintf(buf_log_fwupdate, "[uboot]mtdblock1 - written length: %d bytes\n", wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+        if(wrd != file_length)
+        {
+            free(ptr);
+            return FAIL;
+        }
+        else
+        {
+            // Open flash target mtdblock
+            fd = open("/dev/mtdblock3", O_RDWR);
+            if (fd < 0)
+            {
+                SAVE_SYS_LOG_MSG_FWUPDATE("[uboot]Can not open mtdblock3\n");
+                free(ptr);
+                return FAIL;
+            }
+            else if (file == NULL)
+            {
+                SAVE_SYS_LOG_MSG_FWUPDATE("[uboot]Can not open the downloaded image file\n");
+                free(ptr);
+                return FAIL;
+            }
+            else
+            {
+                // Write image to flash
+                SAVE_SYS_LOG_MSG_FWUPDATE("[uboot]Writing image to mtdblock3...");
+                wrd = write(fd, ptr, file_length);
+
+                close(fd);
+                sprintf(buf_log_fwupdate, "[uboot]mtdblock3 - written length: %d bytes\n", wrd);
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+                if(wrd != file_length)
+                {
+                    free(ptr);
+                    return FAIL;
+                }
+            }
+        }
+    }
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: Update_DTB
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Update_DTB()
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("-------- [DTB]start --------");
+
+    unsigned char result = PASS;
+    long int MaxLen = 48*1024*1024;
+    unsigned long file_length = 0;
+    unsigned char *ptr = malloc(MaxLen);
+
+    if(ptr == NULL)
+    {
+        return FAIL;
+    }
+
+    memset(ptr, 0, MaxLen);
+
+    file_length = fsize("/root/am335x-evm.dtb");
+
+    int fd = 0;
+    int wrd = 0;
+    FILE *file;
+    fd = open("/dev/mtdblock4", O_RDWR);
+    file = fopen("/root/am335x-evm.dtb", "rb");
+    if (fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[DTB]Can not open mtdblock4\n");
+        free(ptr);
+        return FAIL;
+    }
+    else if (file == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[DTB]Can not open the downloaded image file\n");
+        free(ptr);
+        return FAIL;
+    }
+    else
+    {
+        //[VITAL] Closing unneccesary task to supoort rapid CAN data receving..
+        SAVE_SYS_LOG_MSG_FWUPDATE("[DTB] closing SeccComm...");
+        system("killall SeccComm");
+
+        // Write image to flash
+        SAVE_SYS_LOG_MSG_FWUPDATE("[DTB]Writing image to mtdblock4...");
+        fread(ptr, sizeof(unsigned char), file_length, file);
+        wrd = write(fd, ptr, file_length);
+
+        close(fd);
+        fclose(file);
+        sprintf(buf_log_fwupdate, "[DTB]mtdblock4 - written length: %d bytes\n", wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+        if(wrd != file_length)
+        {
+            free(ptr);
+            return FAIL;
+        }
+        else
+        {
+            // Open flash target mtdblock
+            fd = open("/dev/mtdblock5", O_RDWR);
+            if (fd < 0)
+            {
+                SAVE_SYS_LOG_MSG_FWUPDATE("[DTB]Can not open mtdblock5");
+                free(ptr);
+                return FAIL;
+            }
+            else
+            {
+                // Write image to flash
+                SAVE_SYS_LOG_MSG_FWUPDATE("[DTB]Writing image to mtdblock5...");
+                wrd=write(fd, ptr, file_length);
+                close(fd);
+                sprintf(buf_log_fwupdate, "[DTB]mtdblock5 - written length: %d bytes\n", wrd);
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+                if(wrd != file_length)
+                {
+                    free(ptr);
+                    return FAIL;
+                }
+            }
+        }
+    }
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: Update_zImage
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Update_zImage()
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("-------- [zImage]start --------");
+
+    unsigned char result = PASS;
+    long int MaxLen = 48*1024*1024;
+    unsigned long file_length = 0;
+    unsigned char *ptr = malloc(MaxLen);
+
+    if(ptr == NULL)
+    {
+        return FAIL;
+    }
+
+    memset(ptr, 0, MaxLen);
+
+    file_length = fsize("/root/zImage");
+
+    int fd = 0;
+    int wrd = 0;
+    FILE *file;
+    fd = open("/dev/mtdblock6", O_RDWR);
+    file = fopen("/root/zImage", "rb");
+    if (fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[zImage]Can not open mtdblock6\n");
+        free(ptr);
+        return FAIL;
+    }
+    else if (file == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[zImage]Can not open the downloaded image file\n");
+        free(ptr);
+        return FAIL;
+    }
+    else
+    {
+        //[VITAL] Closing unneccesary task to supoort rapid CAN data receving..
+        SAVE_SYS_LOG_MSG_FWUPDATE("[zImage] closing SeccComm...");
+        system("killall SeccComm");
+
+        // Write image to flash
+        SAVE_SYS_LOG_MSG_FWUPDATE("[zImage]Writing image to mtdblock6...");
+        fread(ptr, sizeof(unsigned char), file_length, file);
+        wrd = write(fd, ptr, file_length);
+
+        close(fd);
+        fclose(file);
+        sprintf(buf_log_fwupdate, "[zImage]mtdblock6 - written length: %d bytes\n", wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+        if(wrd != file_length)
+        {
+            free(ptr);
+            return FAIL;
+        }
+        else
+        {
+            // Open flash target mtdblock
+            fd = open("/dev/mtdblock7", O_RDWR);
+            if (fd < 0)
+            {
+                SAVE_SYS_LOG_MSG_FWUPDATE("[zImage]Can not open mtdblock7");
+                free(ptr);
+                return FAIL;
+            }
+            else
+            {
+                // Write image to flash
+                SAVE_SYS_LOG_MSG_FWUPDATE("[zImage]Writing image to mtdblock7...");
+                wrd = write(fd, ptr, file_length);
+                close(fd);
+                sprintf(buf_log_fwupdate, "[zImage]mtdblock7 - written length: %d bytes\n", wrd);
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+                if(wrd != file_length)
+                {
+                    free(ptr);
+                    return FAIL;
+                }
+            }
+        }
+    }
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: Update_ramdisk
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Update_ramdisk()
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("-------- [ramdisk]start --------");
+
+    unsigned char result = PASS;
+    long int MaxLen = 48*1024*1024;
+    unsigned long file_length = 0;
+    unsigned char *ptr = malloc(MaxLen);
+
+    if(ptr == NULL)
+    {
+        return FAIL;
+    }
+
+    memset(ptr, 0, MaxLen);
+
+    file_length = fsize("/root/ramdisk.gz");
+
+    int fd = 0;
+    int wrd = 0;
+    FILE *file;
+    fd = open("/dev/mtdblock8", O_RDWR);
+    file = fopen("/root/ramdisk.gz", "rb");
+    if(fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[ramdisk]UpdateRootfs NG - can not open rootfs\n");
+        return FAIL;
+    }
+    else if (file == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[ramdisk]Can not open the downloaded image file\n");
+        return FAIL;
+    }
+    else
+    {
+        //[VITAL] Closing unneccesary task to supoort rapid CAN data receving..
+        SAVE_SYS_LOG_MSG_FWUPDATE("[ramdisk] closing SeccComm...");
+        system("killall SeccComm");
+
+        SAVE_SYS_LOG_MSG_FWUPDATE("[ramdisk]Writing image to mtdblock8...");
+        fread(ptr, sizeof(unsigned char), file_length, file);
+        wrd = write(fd, ptr, file_length);
+        close(fd);
+        fclose(file);
+        sprintf(buf_log_fwupdate, "[ramdisk]mtdblock8 - written length: %d bytes\n", wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+        if(wrd != file_length)
+        {
+            free(ptr);
+            return FAIL;
+        }
+        else
+        {
+            fd = open("/dev/mtdblock9", O_RDWR);
+            if(fd < 0)
+            {
+                SAVE_SYS_LOG_MSG_FWUPDATE("[ramdisk]UpdateRootfs NG - can not open rootfs");
+                free(ptr);
+                return FAIL;
+            }
+
+            SAVE_SYS_LOG_MSG_FWUPDATE("[ramdisk]Writing image to mtdblock9...");
+            wrd = write(fd, ptr, file_length);
+
+            close(fd);
+            sprintf(buf_log_fwupdate, "[ramdisk]mtdblock9 - written length: %d bytes\n", wrd);
+            SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+            if(wrd != file_length)
+            {
+                free(ptr);
+                return FAIL;
+            }
+            else
+            {
+                //result = PASS;
+                SAVE_SYS_LOG_MSG_FWUPDATE("[ramdisk]deleting Storage-root files.\n");
+                system("cd /Storage;rm -rf root/*");
+
+                #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == DISABLE)
+                {
+                    SAVE_SYS_LOG_MSG_FWUPDATE("[ramdisk]sync...");
+                    system("sync");
+                }
+                #endif
+            }
+        }
+    }
+    return result;
+}
+
+
+/*===========================================================================
+FUNCTION: Update_user_config
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Update_user_config()
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("-------- [user_config]start --------");
+
+    unsigned char result = PASS;
+    long int MaxLen = 48*1024*1024;
+    unsigned long file_length = 0;
+    unsigned char *ptr = malloc(MaxLen);
+
+    if(ptr == NULL)
+    {
+        return FAIL;
+    }
+
+    memset(ptr, 0, MaxLen);
+
+    file_length = fsize("/root/FactoryConfig.bin");
+
+    // Open flash target mtdblock
+    int fd = 0;
+    int wrd = 0;
+    FILE *file;
+    fd = open("/dev/mtdblock10", O_RDWR);
+    file = fopen("/root/FactoryConfig.bin", "rb");
+    if (fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[user_config]Can not open mtdblock10\n");
+        free(ptr);
+        return FAIL;
+    }
+    else if (file == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[user_config]Can not open the downloaded image file\n");
+        free(ptr);
+        return FAIL;
+    }
+    else
+    {
+        //[VITAL] Closing unneccesary task to supoort rapid CAN data receving..
+        SAVE_SYS_LOG_MSG_FWUPDATE("[user_config] closing SeccComm...");
+        system("killall SeccComm");
+
+        // Write image to flash
+        SAVE_SYS_LOG_MSG_FWUPDATE("[user_config]Writing image to mtdblock10...");
+        fread(ptr, sizeof(unsigned char), file_length, file);
+        wrd = write(fd, ptr, file_length);
+        close(fd);
+        fclose(file);
+        sprintf(buf_log_fwupdate,
+                "[user_config]mtdblock10 - written length: %d bytes\n",
+                wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+        if(wrd != file_length)
+        {
+            free(ptr);
+            return FAIL;
+        }
+        else
+        {
+            // Open flash target mtdblock
+            fd = open("/dev/mtdblock11", O_RDWR);
+            if (fd < 0)
+            {
+                SAVE_SYS_LOG_MSG_FWUPDATE("[user_config]Can not open mtdblock11");
+                free(ptr);
+                return FAIL;
+            }
+            else
+            {
+                // Write image to flash
+                SAVE_SYS_LOG_MSG_FWUPDATE("[user_config]Writing image to mtdblock11...");
+                wrd = write(fd, ptr, file_length);
+                close(fd);
+                sprintf(buf_log_fwupdate,
+                        "[user_config]mtdblock11 - written length: %d bytes\n",
+                        wrd);
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+                if(wrd != file_length)
+                {
+                    free(ptr);
+                    return FAIL;
+                }
+            }
+        }
+    }
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: Update_root_app
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Update_root_app()
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("-------- [root_app]start --------");
+
+    unsigned char result = 0;
+
+    //STEP 1: Unzip tmp (.tar.gz) (also checking the file completion)
+    system("tar -C /Storage/ -zxvf /Storage/tmp");   //.tar.gz
+    //[zip command] tar -zcvf tmp image/
+
+    //STEP 2: Checking File Existance (to-be enhanced)
+    FILE *file;
+    file = fopen("/root/ramdisk_app_type_5.tar.gz", "rb");
+    if (file == NULL)
+    {
+        result = 0;  //Failed on update
+        SAVE_SYS_LOG_MSG_FWUPDATE("[root_app]checking downloaded file: FAIL");
+        system("rm -rf /Storage/image/");
+        return 0;
+    }
+    else
+    {
+        fclose(file);
+        SAVE_SYS_LOG_MSG_FWUPDATE("[root_app]checking downloaded file: OK");
+        SAVE_SYS_LOG_MSG_FWUPDATE("[root_app]updtating...");
+        system("cp -rfv /Storage/image/* /Storage/root/");
+        system("rm -rf /Storage/image/");
+
+        #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == DISABLE)
+        {
+            SAVE_SYS_LOG_MSG_FWUPDATE("[root_app]sync...");
+            system("sync");
+        }
+        #endif
+
+        SAVE_SYS_LOG_MSG_FWUPDATE("[root_app]update: done");
+        result = 1; //Successful on update
+    }
+    return result;
+}
+
+
+/*===========================================================================
+FUNCTION: Update_ALL
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Update_ALL()
+{
+    char result;
+
+    result = FAIL;
+
+    //[VITAL] Closing unneccesary task to supoort rapid CAN data receving..
+    SAVE_SYS_LOG_MSG_FWUPDATE("[Update_ALL] closing SeccComm...");
+    system("killall SeccComm");
+
+    if (Update_MLO() == FAIL)
+    {
+         SAVE_SYS_LOG_MSG_FWUPDATE("[Update]MLO: fail");
+    }
+    else if (Update_uboot() == FAIL)
+    {
+         SAVE_SYS_LOG_MSG_FWUPDATE("[Update]MLO: fail");
+    }
+    else if (Update_DTB() == FAIL)
+    {
+         SAVE_SYS_LOG_MSG_FWUPDATE("[Update]DTB: fail");
+    }
+    else if (Update_zImage() == FAIL)
+    {
+         SAVE_SYS_LOG_MSG_FWUPDATE("[Update]zImage: fail");
+    }
+    else if (Update_ramdisk() == FAIL)
+    {
+         SAVE_SYS_LOG_MSG_FWUPDATE("[Update]ramdisk: fail");
+    }
+    /*
+    else if (Update_user_config() == FAIL)
+    {
+         SAVE_SYS_LOG_MSG_FWUPDATE("[Update]configuration: fail");
+    }
+    */
+    //else if (Update_root_app() == FAIL)
+    //{
+    //}
+    else
+    {
+        result = PASS;
+    }
+
+    SAVE_SYS_LOG_MSG_FWUPDATE("-------------[FW Update Summary]-----------");
+    if (result == FAIL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[ALL]Fail");
+        CSUCOMMDC_TASK_FLAG.FW_Update_result = FAIL;
+    }
+    else if (result == PASS)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[ALL]Pass");
+        CSUCOMMDC_TASK_FLAG.FW_Update_result = PASS;
+    }
+    else
+    {
+        CSUCOMMDC_TASK_FLAG.FW_Update_result = FAIL;
+        sprintf(buf_log_fwupdate, "[ALL]unexpected response content (0x%X)", result);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+    }
+    CSUCOMMDC_TASK_FLAG.FW_Update_Done = TRUE;    //sending CAN Res msg to CSU and reboot
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: FWImage_HeaderParser
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int FWImage_HeaderParser(struct FwImageDataType *image)
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("[HeaderParser]starting...");
+
+    //Step 0: Initialize
+    unsigned char result = 0;
+    long int MaxLen = 48*1024*1024;
+    unsigned char *ptr = malloc(MaxLen);
+    if(ptr == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[HeaderParser]malloc: fail");
+        free(ptr);
+        return FAIL;
+    }
+    else
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[HeaderParser]malloc: OK");
+    }
+
+    memset(ptr, 0, MaxLen);
+
+    FILE *file;
+    file = fopen(image->path, "rb");
+    if (file == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[HeaderParser]fopen: fail");
+        free(ptr);
+        return FAIL;
+    }
+    else
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[HeaderParser]fopen: OK");
+    }
+    fread(ptr, sizeof(unsigned char), image->size, file);
+    fclose(file);
+
+    //Step 1: Check FW Image Type
+    image->type = (((unsigned int)ptr[16])<<24 | ((unsigned int)ptr[17])<<16 | ((unsigned int)ptr[18])<<8 | ((unsigned int)ptr[19]));
+
+    if (image->type != FW_IMAGE_TYPE_CCS_DTB &&
+        image->type != FW_IMAGE_TYPE_CCS_UBOOT &&
+        image->type != FW_IMAGE_TYPE_CCS_ZIMAGE &&
+        image->type != FW_IMAGE_TYPE_CCS_RAMDISK)
+    {
+        sprintf(buf_log_fwupdate,
+                "[HeaderParser]incorrect type (0x%X)",
+                image->type);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+        free(ptr);
+        return FAIL;
+    }
+
+    //Step 2: Check FW Image Length
+    unsigned long size_header = 0;
+    size_header = (((unsigned int)ptr[20])<<24 | ((unsigned int)ptr[21])<<16 | ((unsigned int)ptr[22])<<8 | ((unsigned int)ptr[23]));
+    if(image->size != (size_header + 48))
+    {
+        sprintf(buf_log_fwupdate,
+                "[HeaderParser]image length is not matched (header = %d, calculated = %d, bytes)",
+                size_header,
+                image->size);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+        free(ptr);
+        return FAIL;
+    }
+
+    //Step 3: Check CRC
+    unsigned int crc_cal = 0;
+    image->crc = ((unsigned int)ptr[34])<<24 | ((unsigned int)ptr[35])<<16 | ((unsigned int)ptr[36])<<8 | ((unsigned int)ptr[37]);
+    crc_cal = crc32(ptr, image->size);
+    if(image->crc != crc_cal)
+    {
+        sprintf(buf_log_fwupdate,
+                "[HeaderParser]CRC error (header = 0x%X, calculated = 0x%X)",
+                image->crc,
+                crc_cal);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+        free(ptr);
+        return FAIL;
+    }
+    else
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[HeaderParser]CRC: OK");
+    }
+    free(ptr);
+    return PASS;
+}
+
+/*===========================================================================
+FUNCTION: FWImage_Normalize
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int FWImage_Normalize(struct FwImageDataType *image)
+{
+    //Step 0: Initialize
+    unsigned char result = 0;
+    long int MaxLen = 48*1024*1024;
+    unsigned char *ptr = malloc(MaxLen);
+    if(ptr == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[Normalize] malloc fail");
+        free(ptr);
+        return FAIL;
+    }
+
+    memset(ptr, 0, MaxLen);
+
+    FILE *file;
+    file = fopen(image->path, "rb");
+    if (file == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[Normalize] fopen fail");
+        free(ptr);
+        return FAIL;
+    }
+    fread(ptr, sizeof(unsigned char), image->size, file);
+    fclose(file);
+
+    //Step 1: Delete the original image
+    char buf[64];
+    memset(buf, 0, 64);
+    sprintf(buf, "rm -rf %s", image->path);
+    system(buf);
+
+    //Step 2: Remove header and create a renamed image accoring to its firmware type
+    struct FwImageDataType image_new;
+    switch (image->type)
+    {
+        case FW_IMAGE_TYPE_CCS_UBOOT:       //0x10000007
+        {
+            sprintf(image_new.path, "/root/u-boot.img");
+            break;
+        }
+        case FW_IMAGE_TYPE_CCS_DTB:         //0x10000008
+        {
+            sprintf(image_new.path, "/root/am335x-evm.dtb");
+            break;
+        }
+        case FW_IMAGE_TYPE_CCS_ZIMAGE:      //0x10000009
+        {
+            sprintf(image_new.path, "/root/zImage");
+            break;
+        }
+        case FW_IMAGE_TYPE_CCS_RAMDISK:     //0x1000000A
+        {
+            sprintf(image_new.path, "/root/ramdisk.gz");
+            break;
+        }
+        default:
+        {
+            break;
+        }
+    }
+
+    memset(buf, 0, 64);
+    sprintf(buf, "rm -rf %s", image_new.path);
+    system(buf);
+
+    SAVE_SYS_LOG_MSG_FWUPDATE("[Normalize]creating new image: ongoing...");
+    image_new.size = image->size - 48;
+    file = fopen(image_new.path, "wb+");
+    fwrite(&ptr[48], image_new.size, 1, file); //48: header size
+    fclose(file);
+    free(ptr);
+    SAVE_SYS_LOG_MSG_FWUPDATE("[Normalize]creating new image: done");
+    return PASS;
+}
+
+/*===========================================================================
+FUNCTION: FWImage_Init
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+    1. image file name: "ccs.image"
+OUTPUT:
+    1. type: FW image type
+       - 0:          file is not exist or error occours
+       - 0x10000007: FW_IMAGE_TYPE_CCS_UBOOT
+       - 0x10000008: FW_IMAGE_TYPE_CCS_DTB
+       - 0x10000009: FW_IMAGE_TYPE_CCS_ZIMAGE
+       - 0x1000000A: FW_IMAGE_TYPE_CCS_RAMDISK
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned int FWImage_Init()
+{
+    struct FwImageDataType image;
+    sprintf(image.path, "/root/ccs.image");
+
+    //STEP 1: Check if image exist?
+    image.size = fsize(image.path);
+    if (image.size == 0)
+    {
+        SAVE_SYS_LOG_MSG_FWUPDATE("[Init][Error]image does not exist.");
+        return FAIL;    //FAIL: 0
+    }
+
+    //STEP 2: Check FW image type = ?
+    if (FWImage_HeaderParser(&image) != PASS)
+    {
+        return FAIL;    //FAIL: 0
+    }
+
+    //STEP 4: Remove header and rename the image file accoring to its firmware type
+    if (FWImage_Normalize(&image) != PASS)
+    {
+        return FAIL;    //FAIL: 0
+    }
+
+    //Step 5: return result
+    return image.type;
+}
+
+/*===========================================================================
+FUNCTION: Update_viaWebService
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Update_viaWebService()
+{
+    SAVE_SYS_LOG_MSG_FWUPDATE("-------- [viaWebService]start --------");
+
+    unsigned char result = FAIL;
+    unsigned int type = 0;
+    type = FWImage_Init();
+
+    switch (type)
+    {
+        case FW_IMAGE_TYPE_CCS_UBOOT:
+        {
+            result = Update_uboot();
+            break;
+        }
+        case FW_IMAGE_TYPE_CCS_DTB:
+        {
+            result = Update_DTB();
+            break;
+        }
+        case FW_IMAGE_TYPE_CCS_ZIMAGE:
+        {
+            result = Update_zImage();
+            break;
+        }
+        case FW_IMAGE_TYPE_CCS_RAMDISK:
+        {
+            result = Update_ramdisk();
+            break;
+        }
+        default:
+        {
+            result = FAIL;
+            sprintf(buf_log_fwupdate,
+                    "[Error]undefined FW image type or file not exist.(0x%X)",
+                    type
+                    );
+            SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+            break;
+        }
+    }
+
+    if (result == PASS)
+    {
+        CSUCOMMDC_TASK_FLAG.FW_Update_result = PASS;
+    }
+    else
+    {
+        CSUCOMMDC_TASK_FLAG.FW_Update_result = FAIL;
+    }
+    CSUCOMMDC_TASK_FLAG.FW_Update_Done = TRUE; //sending CAN Res msg to CSU and reboot
+}
+
+/*===========================================================================
+FUNCTION: main
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int main(int argc, char *argv[])
+{
+    // ======== [STEP 1/5] Initialize Share Memory ========
+    if(ShareMemory_Init() == 0)
+    {
+
+        SAVE_SYS_LOG_MSG_FWUPDATE("[main]ShareMemory_Init NG");
+
+
+        if(ShmStatusCodeData != NULL)
+        {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
+        }
+        sleep(5);
+        return 0;
+    }
+
+    //Arguments Parsing for Commands
+    if (argv[1][0] == '-' )
+    {
+        switch (argv[1][1])
+        {
+            case 'h':   //help
+            {
+                sprintf(buf_log_fwupdate,
+                        " ================= [HELP] CCS FW Update ==============");
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+                sprintf(buf_log_fwupdate,
+                        " -h \t :help");
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+                sprintf(buf_log_fwupdate,
+                        " -w \t :image update from WebService (with header, named as ccs.image)");
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+                sprintf(buf_log_fwupdate,
+                        " -a \t :full images update \t(no header, named as original names)");
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+                sprintf(buf_log_fwupdate,
+                        " -m \t :MLO update \t\t(no header, named as MLO)");
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+                sprintf(buf_log_fwupdate,
+                        " -u \t :uboot update \t\t(no header, named as u-boot.img)");
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+                sprintf(buf_log_fwupdate,
+                        " -d \t :dtb update \t\t(no header, named as am335x-evm.dtb)");
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+                sprintf(buf_log_fwupdate,
+                        " -z \t :zImage update \t(no header, named as zImage)");
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+                sprintf(buf_log_fwupdate,
+                        " -r \t :ramdisk update \t(no header, named as ramdisk.gz)");
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+
+                break;
+            }
+            case 'w':   //image update from WebService
+            {
+                Update_viaWebService();
+                break;
+            }
+            case 'a':   //all image update
+            {
+                Update_ALL();
+                break;
+            }
+            case 'm':   //MLO update
+            {
+                Update_MLO();
+                break;
+            }
+            case 'u':   //uboot update
+            {
+                Update_uboot();
+                break;
+            }
+            case 'd':   //dtb update
+            {
+                Update_DTB();
+                break;
+            }
+            case 'z':   //zImage update
+            {
+                Update_zImage();
+                break;
+            }
+            case 'r':   //ramdisk update
+            {
+                Update_ramdisk();
+                break;
+            }
+            default:
+            {
+                sprintf(buf_log_fwupdate, "Unknown option -%c\n\n", argv[1][1]);
+                SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+                break;
+            }
+        }
+    }
+}

+ 75 - 0
EVSE/Projects/CCS/Apps/FWUpdate.h

@@ -0,0 +1,75 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                              FWUpdate.h
+
+                        initiated by Vern, Joseph
+                           (since 2019/07/19)
+=============================================================================*/
+#if FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_FWUPDATE_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_FWUPDATE_SHOW               ENABLE       //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWUPDATE_BRIEF_SHOW         DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWUPDATE_DETAIL_SHOW        DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWUPDATE_SYSTEM_LOG_SHOW    ENABLE       //ENABLE, DISABLE
+#else //debug mode
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_FWUPDATE_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_FWUPDATE_SHOW               ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWUPDATE_BRIEF_SHOW         ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWUPDATE_DETAIL_SHOW        ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FWUPDATE_SYSTEM_LOG_SHOW    ENABLE      //ENABLE, DISABLE
+#endif
+
+
+#define FW_IMAGE_TYPE_CCS_UBOOT    0x10000007  //CCS board bootloader (uboot)
+#define FW_IMAGE_TYPE_CCS_DTB      0x10000008  //CCS board kernel configuration (dtb)
+#define FW_IMAGE_TYPE_CCS_ZIMAGE   0x10000009  //CCS board kernel image (zImage)
+#define FW_IMAGE_TYPE_CCS_RAMDISK  0x1000000A  //CCS board file system (ramdisk.gz)
+
+struct FwImageDataType
+{
+    char path[64];
+    unsigned long size; //unit: byte
+    unsigned int type;  //4 bytes
+    unsigned int crc;
+};
+
+//System Log
+#if SAVE_SYS_LOG_MSG_FWUPDATE_SWITCH == ENABLE
+    #define SAVE_SYS_LOG_MSG_FWUPDATE     StoreLogMsg
+#else
+    #define SAVE_SYS_LOG_MSG_FWUPDATE(...)
+#endif
+
+//Debug Message
+#if DEBUG_PRINTF_FWUPDATE_SHOW == ENABLE
+    //Brief Messages
+    #if DEBUG_PRINTF_FWUPDATE_BRIEF_SHOW == ENABLE
+        #define DEBUG_PRINTF_FWUPDATE_BRIEF      printf
+    #else
+        #define DEBUG_PRINTF_FWUPDATE_BRIEF(...)
+    #endif
+
+    //Detail Messages
+    #if DEBUG_PRINTF_FWUPDATE_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_FWUPDATE_DETAIL     printf
+    #else
+        #define DEBUG_PRINTF_FWUPDATE_DETAIL(...)
+    #endif
+
+    //System Log Messages
+    #if DEBUG_PRINTF_FWUPDATE_SYSTEM_LOG_SHOW == ENABLE
+        #define DEBUG_PRINTF_FWUPDATE_SYSTEM_LOG    printf
+    #else
+        #define DEBUG_PRINTF_FWUPDATE_SYSTEM_LOG(...)
+    #endif
+#else
+    #define DEBUG_PRINTF_FWUPDATE_BRIEF(...)
+    #define DEBUG_PRINTF_FWUPDATE_DETAIL(...)
+    #define DEBUG_PRINTF_FWUPDATE_SYSTEM_LOG(...)
+#endif

+ 69 - 53
EVSE/Projects/CCS/Apps/FactoryConfig.c

@@ -27,25 +27,52 @@
 #include "define.h"
 #include "FactoryConfig.h"
 
-#ifdef SystemLogMessage
-    int StoreLogMsg(unsigned char *DataString)
-    {
-        unsigned char Buf[256];
-        time_t CurrentTime;
-        struct tm *tm;
-
-        memset(Buf, 0, sizeof(Buf));
-        CurrentTime = time(NULL);
-        tm = localtime(&CurrentTime);
-        sprintf(Buf, "echo \"%04d.%02d.%02d %02d:%02d:%02d - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-                tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
-                DataString,
-                tm->tm_year + 1900, tm->tm_mon + 1);
-        system(Buf);
-        #ifdef Debug
-            printf("%s \n", DataString);
-        #endif
-    }
+unsigned char buf_log_factoryconfig[SIZE_OF_LOG_BUFFER];
+
+/*===========================================================================
+FUNCTION: StoreLogMsg
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#if SAVE_SYS_LOG_MSG_FACTORY_CONFIG_SWITCH == ENABLE
+int StoreLogMsg(unsigned char *DataString)
+{
+    static unsigned char Buf[1024];
+    static time_t CurrentTime;
+    static struct tm *tm;
+    static struct timeval tv;
+
+    memset(Buf, 0, sizeof(Buf));
+    CurrentTime = time(NULL);
+    tm = localtime(&CurrentTime);
+    gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][FactoryConfig]%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+            tm->tm_year + 1900,
+            tm->tm_mon + 1,
+            tm->tm_mday,
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            DataString,
+            tm->tm_year + 1900,
+            tm->tm_mon + 1);
+    system(Buf);
+
+    DEBUG_PRINTF_FACTORY_CONFIG_SYSTEM_LOG("[%02d:%02d:%02d.%06d][FactoryConfig]%s \n",
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            DataString);
+
+    //Reset the buf_log_factoryconfig Buffer, i.e. DataString
+    memset(buf_log_factoryconfig, 0, SIZE_OF_LOG_BUFFER);
+}
 #endif
 
 
@@ -65,9 +92,7 @@ int main(int argc, char *argv[])
 
     if(ptr == NULL)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[FactoryConfig]main: malloc for SysConfigData NG");
-        #endif
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: malloc for SysConfigData NG");
         return 0;
     }
 
@@ -75,12 +100,12 @@ int main(int argc, char *argv[])
     memset(&SysConfig, 0, sizeof(struct SysConfigData));
 
     //Set default configuration
-    strcpy(SysConfig.Eth0Interface.EthIpAddress, "192.168.0.10");
+    strcpy(SysConfig.Eth0Interface.EthIpAddress, "192.168.0.11");
     strcpy(SysConfig.Eth0Interface.EthSubmaskAddress, "255.255.255.0");
-    strcpy(SysConfig.Eth0Interface.EthGatewayAddress, "192.168.0.254");
-    strcpy(SysConfig.Eth1Interface.EthIpAddress, "192.168.1.10");
+    strcpy(SysConfig.Eth0Interface.EthGatewayAddress, "192.168.0.1");
+    strcpy(SysConfig.Eth1Interface.EthIpAddress, "192.168.0.20");
     strcpy(SysConfig.Eth1Interface.EthSubmaskAddress, "255.255.255.0");
-    strcpy(SysConfig.Eth1Interface.EthGatewayAddress, "192.168.1.254");
+    strcpy(SysConfig.Eth1Interface.EthGatewayAddress, "192.168.0.1");
     SysConfig.BackendConnTimeout = 300; //300 seconds
 
     //copy default configuration to pointer
@@ -100,9 +125,8 @@ int main(int argc, char *argv[])
 
     if(fd < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[FactoryConfig]main: open /mnt/FactoryDefaultConfig.bin NG");
-        #endif
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: open /mnt/FactoryDefaultConfig.bin NG");
+
         free(ptr);
         return 0;
     }
@@ -112,9 +136,8 @@ int main(int argc, char *argv[])
 
     if(wrd != (sizeof(struct SysConfigData)))
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[FactoryConfig]main: write /mnt/FactoryDefaultConfig.bin NG");
-        #endif
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: write /mnt/FactoryDefaultConfig.bin NG");
+
         free(ptr);
         return 0;
     }
@@ -123,9 +146,8 @@ int main(int argc, char *argv[])
 
     if(fd < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[FactoryConfig]main: open /dev/mtdblock12 NG");
-        #endif
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: open /dev/mtdblock12 NG");
+
         free(ptr);
         return 0;
     }
@@ -135,9 +157,8 @@ int main(int argc, char *argv[])
 
     if(wrd != (sizeof(struct SysConfigData)))
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[FactoryConfig]main: write /dev/mtdblock12 NG");
-        #endif
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: write /dev/mtdblock12 NG");
+
         free(ptr);
         return 0;
     }
@@ -146,9 +167,8 @@ int main(int argc, char *argv[])
 
     if(fd < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[FactoryConfig]main: open /dev/mtdblock11 NG");
-        #endif
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: open /dev/mtdblock11 NG");
+
         free(ptr);
         return 0;
     }
@@ -158,9 +178,8 @@ int main(int argc, char *argv[])
 
     if(wrd != (sizeof(struct SysConfigData)))
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[FactoryConfig]main: write /dev/mtdblock11 NG");
-        #endif
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: write /dev/mtdblock11 NG");
+
         free(ptr);
         return 0;
     }
@@ -169,9 +188,8 @@ int main(int argc, char *argv[])
 
     if(fd < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[FactoryConfig]main: open /dev/mtdblock10 NG");
-        #endif
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: open /dev/mtdblock10 NG");
+
         free(ptr);
         return 0;
     }
@@ -181,15 +199,13 @@ int main(int argc, char *argv[])
 
     if(wrd != (sizeof(struct SysConfigData)))
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[FactoryConfig]main: write /dev/mtdblock10 NG");
-        #endif
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: write /dev/mtdblock10 NG");
+
         free(ptr);
         return 0;
     }
 
     free(ptr);
-    #ifdef SystemLogMessage
-        StoreLogMsg("[FactoryConfig]main: FactoryConfig OK");
-    #endif
+
+    SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: FactoryConfig OK");
 }

+ 54 - 0
EVSE/Projects/CCS/Apps/FactoryConfig.h

@@ -5,3 +5,57 @@
                         initiated by Vern, Joseph
                            (since 2019/07/19)
 =============================================================================*/
+#if FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_FACTORY_CONFIG_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_FACTORY_CONFIG_SHOW               DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FACTORY_CONFIG_BRIEF_SHOW         DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FACTORY_CONFIG_DETAIL_SHOW        DISABLE     //ENABLE, DISABLE
+#define DEBUG_PRINTF_FACTORY_CONFIG_SYSTEM_LOG_SHOW    DISABLE      //ENABLE, DISABLE
+#else //debug mode
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_FACTORY_CONFIG_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_FACTORY_CONFIG_SHOW               ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FACTORY_CONFIG_BRIEF_SHOW         ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_FACTORY_CONFIG_DETAIL_SHOW        DISABLE     //ENABLE, DISABLE
+#define DEBUG_PRINTF_FACTORY_CONFIG_SYSTEM_LOG_SHOW    ENABLE      //ENABLE, DISABLE
+#endif
+
+//System Log
+#if SAVE_SYS_LOG_MSG_FACTORY_CONFIG_SWITCH == ENABLE
+    #define SAVE_SYS_LOG_MSG_FACTORY_CONFIG     StoreLogMsg
+#else
+    #define SAVE_SYS_LOG_MSG_FACTORY_CONFIG(...)
+#endif
+
+//Debug Message
+#if DEBUG_PRINTF_FACTORY_CONFIG_SHOW == ENABLE
+    //Brief Messages
+    #if DEBUG_PRINTF_FACTORY_CONFIG_BRIEF_SHOW == ENABLE
+        #define DEBUG_PRINTF_FACTORY_CONFIG_BRIEF      printf
+    #else
+        #define DEBUG_PRINTF_FACTORY_CONFIG_BRIEF(...)
+    #endif
+
+    //Detail Messages
+    #if DEBUG_PRINTF_FACTORY_CONFIG_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_FACTORY_CONFIG_DETAIL     printf
+    #else
+        #define DEBUG_PRINTF_FACTORY_CONFIG_DETAIL(...)
+    #endif
+
+    //System Log Messages
+    #if DEBUG_PRINTF_FACTORY_CONFIG_SYSTEM_LOG_SHOW == ENABLE
+        #define DEBUG_PRINTF_FACTORY_CONFIG_SYSTEM_LOG    printf
+    #else
+        #define DEBUG_PRINTF_FACTORY_CONFIG_SYSTEM_LOG(...)
+    #endif
+#else
+    #define DEBUG_PRINTF_FACTORY_CONFIG_BRIEF(...)
+    #define DEBUG_PRINTF_FACTORY_CONFIG_DETAIL(...)
+    #define DEBUG_PRINTF_FACTORY_CONFIG_SYSTEM_LOG(...)
+#endif

+ 41 - 17
EVSE/Projects/CCS/Apps/Makefile

@@ -36,10 +36,11 @@ EXI_ENGINE =	exi_engine/api/api.c \
 				exi_engine/xmldsig/xmldsigEXIDatatypesDecoder.c \
 				exi_engine/xmldsig/xmldsigEXIDatatypesEncoder.c
 
-
-all: CopyFile apps
-apps: MainTask EvCommTask
-#apps: MainTask CsuCommTask FactoryConfigTask EvCommTask UpdateRootfsTask FWMakerTask EventLoggingTask
+all: init secc
+#all: init secc zip
+secc: MainTask SeccCommTask CsuCommTask FactoryConfigTask FWUpdateTask PCBATesterTask
+evcc: MainTask EvccCommTask CsuCommTask FactoryConfigTask FWUpdateTask PCBATesterTask
+#secc: MainTask CsuCommTask FactoryConfigTask SeccCommTask FWUpdateTask FWMakerTask EventLoggingTask
 
 MainTask:
 	rm -f main
@@ -49,7 +50,7 @@ MainTask:
 
 CsuCommTask:
 	rm -f CsuComm
-	$(CC) CsuComm.c -lm -o CsuComm
+	$(CC) CsuComm.c ${EXI_ENGINE} -lm -o CsuComm
 	cp -f CsuComm ../Images/root
 	rm -f CsuComm
 
@@ -59,18 +60,23 @@ FactoryConfigTask:
 	cp -f FactoryConfig ../Images/root
 	rm -f FactoryConfig
 
-EvCommTask:
-	rm -f EvComm
-#	$(CC) EvComm.c NidNmk.c ${EXI_ENGINE} -lm -o EvComm
-	$(CC) EvComm.c NidNmk.c -lm -o EvComm
-	cp -f EvComm ../Images/root
-	rm -f EvComm
+SeccCommTask:
+	rm -f SeccComm
+	$(CC) SeccComm.c NidNmk.c ${EXI_ENGINE} -lm -o SeccComm
+	cp -f SeccComm ../Images/root
+#	rm -f SeccComm
+
+EvccCommTask:
+	rm -f EvccComm
+	$(CC) EvccComm.c NidNmk.c ${EXI_ENGINE} -lm -o EvccComm
+	cp -f EvccComm ../Images/root
+	rm -f EvccComm
 
-UpdateRootfsTask:
-	rm -f UpdateRootfs
-	$(CC) UpdateRootfs.c -o UpdateRootfs
-	cp -f UpdateRootfs ../Images/root
-	rm -f UpdateRootfs
+FWUpdateTask:
+	rm -f FWUpdate
+	$(CC) FWUpdate.c -o FWUpdate
+	cp -f FWUpdate ../Images/root
+	rm -f FWUpdate
 
 EventLoggingTask:
 	rm -f EventLogging
@@ -84,6 +90,24 @@ FWMakerTask:
 	cp -f FWMaker ../Images/root
 	rm -f FWMaker
 
-CopyFile:
+PCBATesterTask:
+	rm -f PCBATester
+	$(CC) PCBATester.c -lm -o PCBATester
+	cp -f PCBATester ../Images/root
+	rm -f PCBATester
+
+init:
 	rm -rfv ../Images/root
 	mkdir -p ../Images/root
+#	cp -rfv ../Images/boot/reset_soft.sh ../Images/root/
+#	cp -rfv ../Images/boot/stop.sh ../Images/root/
+#	cp -rfv ../Images/boot/reboot.sh ../Images/root/
+
+zip:
+	mkdir -p ./image/
+	cp -rfv ../Images/root/* ./image/
+	tar -zcvf ramdisk_app_type_5.tar.gz image/
+	cp -rfv ramdisk_app_type_5.tar.gz ../Images/
+	mv -f ramdisk_app_type_5.tar.gz ../Images/
+	rm -rf image/
+	wc -c ../Images/ramdisk_app_type_5.tar.gz

+ 49 - 0
EVSE/Projects/CCS/Apps/NidNmk.c

@@ -6,6 +6,55 @@
                            (since 2019/07/19)
 =============================================================================*/
 #include "NidNmk.h"
+#include "define.h"
+#include <time.h>
+#include<sys/time.h>
+unsigned char buf_log_nidmmk[SIZE_OF_LOG_BUFFER];
+/*===========================================================================
+FUNCTION: StoreLogMsg
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#if SAVE_SYS_LOG_MSG_NIDNMK_SWITCH == ENABLE
+int StoreLogMsg(unsigned char *DataString)
+{
+    static unsigned char Buf[1024];
+    static time_t CurrentTime;
+    static struct tm *tm;
+    static struct timeval tv;
+
+    memset(Buf, 0, sizeof(Buf));
+    CurrentTime = time(NULL);
+    tm = localtime(&CurrentTime);
+    gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][NidNmk]%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+            tm->tm_year + 1900,
+            tm->tm_mon + 1,
+            tm->tm_mday,
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            DataString,
+            tm->tm_year + 1900,
+            tm->tm_mon + 1);
+    system(Buf);
+
+    DEBUG_PRINTF_NIDNMK_SYSTEM_LOG("[%02d:%02d:%02d.%06d][NidNmk]%s \n",
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            DataString);
+
+    //Reset the buf_log_nidmmk Buffer, i.e. DataString
+    memset(buf_log_nidmmk, 0, SIZE_OF_LOG_BUFFER);
+}
+#endif
 
 void HPAVKeyNMK(uint8_t NMK [], const char *string)
 

+ 55 - 0
EVSE/Projects/CCS/Apps/NidNmk.h

@@ -11,6 +11,26 @@
 #include <stdlib.h>
 #include <string.h>
 
+#if FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_NIDNMK_SWITCH         DISABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_NIDNMK_SHOW               DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_NIDNMK_BRIEF_SHOW         DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_NIDNMK_DETAIL_SHOW        DISABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_NIDNMK_SYSTEM_LOG_SHOW    DISABLE      //ENABLE, DISABLE
+#else //debug mode
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_NIDNMK_SWITCH         ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_NIDNMK_SHOW               ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_NIDNMK_BRIEF_SHOW         ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_NIDNMK_DETAIL_SHOW        ENABLE      //ENABLE, DISABLE
+#define DEBUG_PRINTF_NIDNMK_SYSTEM_LOG_SHOW    ENABLE      //ENABLE, DISABLE
+#endif
+
 typedef struct sha256
 {
 
@@ -37,3 +57,38 @@ void SHA256Block(struct sha256 *sha256, void const *memory);
 void SHA256Write(struct sha256 *sha256, void const *memory, uint16_t extent);
 void SHAEncode(uint8_t memory [], uint32_t number);
 void SHA256Fetch(struct sha256 *sha256, uint8_t digest []);
+
+//System Log
+#if SAVE_SYS_LOG_MSG_NIDNMK_SWITCH == ENABLE
+    #define SAVE_SYS_LOG_MSG_NIDNMK     StoreLogMsg
+#else
+    #define SAVE_SYS_LOG_MSG_NIDNMK(...)
+#endif
+
+//Debug Message
+#if DEBUG_PRINTF_NIDNMK_SHOW == ENABLE
+    //Brief Messages
+    #if DEBUG_PRINTF_NIDNMK_BRIEF_SHOW == ENABLE
+        #define DEBUG_PRINTF_NIDNMK_BRIEF      printf
+    #else
+        #define DEBUG_PRINTF_NIDNMK_BRIEF(...)
+    #endif
+
+    //Detail Messages
+    #if DEBUG_PRINTF_NIDNMK_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_NIDNMK_DETAIL     printf
+    #else
+        #define DEBUG_PRINTF_NIDNMK_DETAIL(...)
+    #endif
+
+    //System Log Messages
+    #if DEBUG_PRINTF_NIDNMK_SYSTEM_LOG_SHOW == ENABLE
+        #define DEBUG_PRINTF_NIDNMK_SYSTEM_LOG    printf
+    #else
+        #define DEBUG_PRINTF_NIDNMK_SYSTEM_LOG(...)
+    #endif
+#else
+    #define DEBUG_PRINTF_NIDNMK_BRIEF(...)
+    #define DEBUG_PRINTF_NIDNMK_DETAIL(...)
+    #define DEBUG_PRINTF_NIDNMK_SYSTEM_LOG(...)
+#endif

+ 1238 - 0
EVSE/Projects/CCS/Apps/PCBATester.c

@@ -0,0 +1,1238 @@
+/*===========================================================================
+                     Combined Charging System (CCS): SECC
+                                 PCBATester.c
+
+                             initiated by Joseph
+                              (since 2020/05/19)
+=============================================================================*/
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/termios.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <stdlib.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/mman.h>
+#include <linux/sockios.h>
+#include <linux/socket.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <linux/can.h>
+#include <linux/can/raw.h>
+#include <sys/time.h>
+#include <sys/timeb.h>
+#include <math.h>//for pow
+#include <net/if.h>
+#include <unistd.h>
+#include <netinet/ip.h>
+#include <arpa/inet.h>
+#include <linux/if_packet.h>
+#include <netinet/if_ether.h>
+#include <netinet/ether.h>
+#include <errno.h>
+
+#include "define.h"
+#include "CsuComm.h"
+#include "SeccComm.h"
+#include "PCBATester.h"
+
+#if SAVE_SYS_LOG_MSG_PCBATESTER_SWITCH == ENABLE
+unsigned char buf_log_pcbatstr[SIZE_OF_LOG_BUFFER];
+#endif
+
+unsigned char QcaMac[6];
+unsigned char CsuMac[6] = {0x60, 0x39, 0x1F, 0x01, 0x02, 0x03};
+
+int RawSock = 0;
+unsigned char *V2gtpMsgRxBuf, *V2gtpMsgTxBuf;
+struct sockaddr_ll DestSocketAddress;
+struct ifreq Req;
+
+struct timeb SeqStartTime, SeqEndTime;
+
+/*===========================================================================
+FUNCTION: StoreLogMsg
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#if SAVE_SYS_LOG_MSG_PCBATESTER_SWITCH == ENABLE
+int StoreLogMsg(unsigned char *DataString)
+{
+    static unsigned char Buf[1024];
+    static time_t CurrentTime;
+    static struct tm *tm;
+    static struct timeval tv;
+
+    memset(Buf, 0, sizeof(Buf));
+    CurrentTime = time(NULL);
+    tm = localtime(&CurrentTime);
+    gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][PCBATester]%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+            tm->tm_year + 1900,
+            tm->tm_mon + 1,
+            tm->tm_mday,
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            DataString,
+            tm->tm_year + 1900,
+            tm->tm_mon + 1);
+    system(Buf);
+
+    DEBUG_PRINTF_PCBATESTER_SYSTEM_LOG("[%02d:%02d:%02d.%06d][PCBATester]%s \n",
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            DataString);
+
+    //Reset the buf_log_pcbatstr Buffer, i.e. DataString
+    memset(buf_log_pcbatstr, 0, SIZE_OF_LOG_BUFFER);
+}
+#endif
+
+/*===========================================================================
+FUNCTION: DiffTimeb
+DESCRIPTION:
+    Caculating the time difference in ms precision (milli-second).
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+double DiffTimeb(struct timeb ST, struct timeb ET)
+{
+    //return milli-second
+    double StartTime, EndTime;
+    double t_diff;
+
+    StartTime = ((double)ST.time)*1000 + (double)ST.millitm;
+    EndTime = ((double)ET.time)*1000 + (double)ET.millitm;
+    t_diff = EndTime - StartTime;
+
+    //printf("%.02lf - %.02lf = %.02lf\n", EndTime, StartTime, t_diff);
+
+    if (t_diff < 0)
+    {
+        #if 0
+        if (t_diff < -1000)   //1000ms
+        {
+            sprintf(buf_log_pcbatstr,
+                    "[Warning]StartTime(%.02lf) > EndTime(%.02lf), d(%.02lf)",
+                    StartTime,
+                    EndTime,
+                    t_diff);
+            SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        }
+        #endif
+
+        return -1;
+    }
+    return t_diff;
+}
+
+/*===========================================================================
+FUNCTION: GetQca7kMac
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int GetQca7kMac()
+{
+    int i = 0;
+    struct QcaVendorMmeHeader SendPacket;
+
+    memset(&SendPacket, 0, sizeof(struct QcaVendorMmeHeader));
+    memset(SendPacket.ODA, 0xFF, 6);    //broadcast
+    memcpy(SendPacket.OSA, CsuMac, 6);
+    SendPacket.MTYPE = htons(EtherType_HomePlug);
+    SendPacket.MMV = 0x00;
+    SendPacket.MMTYPE = MMTYPE_VENDOR_VS_NW_INFO;
+    SendPacket.OUI[0] = 0x00;
+    SendPacket.OUI[1] = 0xB0;
+    SendPacket.OUI[2] = 0x52;
+
+    i = sendto(RawSock, &SendPacket, 20, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+
+    DEBUG_PRINTF_EVCOMM_DETAIL("GetQca7kMac: send size =%d\n", i);
+    SAVE_SYS_LOG_MSG_PCBATESTER("[QCA7K][Tx][VENDOR_VS_NW_INFO]Req for QCA7K MacAddr");
+}
+
+
+/*===========================================================================
+FUNCTION: CANBus_Init
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CANBus_Init()
+{
+    int s0, nbytes;
+    struct timeval tv;
+    struct ifreq ifr0;
+    struct sockaddr_can addr0;
+
+    system("/sbin/ip link set can0 type can bitrate 500000 restart-ms 100");
+    system("/sbin/ip link set can0 up");
+
+    s0 = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+    if (s0 < 0) //added by Joseph (not full implemented)
+    {
+        SAVE_SYS_LOG_MSG_PCBATESTER("[ERROR] Fail on initializing CAN Bus socket");
+        return -1;
+    }
+
+    tv.tv_sec = 0;
+    tv.tv_usec = 10000;
+
+    if(setsockopt(s0, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_PCBATESTER("CANBus_Init:Set SO_RCVTIMEO NG");
+    }
+
+    nbytes = 40960;
+
+    if(setsockopt(s0, SOL_SOCKET,  SO_RCVBUF, &nbytes, sizeof(int)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_PCBATESTER("CANBus_Init:Set SO_RCVBUF NG");
+    }
+
+    nbytes = 40960;
+
+    if(setsockopt(s0, SOL_SOCKET, SO_SNDBUF, &nbytes, sizeof(int)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_PCBATESTER("CANBus_Init:Set SO_SNDBUF NG");
+    }
+
+    strcpy(ifr0.ifr_name, "can0" );
+    ioctl(s0, SIOCGIFINDEX, &ifr0); /* ifr.ifr_ifindex gets filled with that device's index */
+    addr0.can_family = AF_CAN;
+    addr0.can_ifindex = ifr0.ifr_ifindex;
+    bind(s0, (struct sockaddr *)&addr0, sizeof(addr0));
+    return s0;
+}
+
+/*===========================================================================
+FUNCTION: CAN_Tx_MSG
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CAN_Tx_MSG(int Fd, unsigned int MsgId, unsigned char SlaveAddress, unsigned char DataLength, unsigned char *SendData)
+{
+    struct can_frame frame;
+    unsigned int tmp = 0;
+    int nbytes = 0;
+    int i = 0;
+
+    //Protection: To avoid unexpected length for CAN bus payload.
+    if (DataLength > 8)
+    {
+        DataLength = 8;
+    }
+
+    memset(&frame, 0, sizeof(struct can_frame));
+    frame.can_id = 0x80000000 | CAN_SEND_DIRECTION | MsgId | SlaveAddress;  //0x80000000: extension ID format
+    frame.can_dlc = DataLength;
+    memcpy(frame.data, SendData, DataLength);
+    nbytes = write(Fd, &frame, sizeof(struct can_frame));
+
+    #if 0
+    DEBUG_PRINTF_PCBATESTER_DETAIL("[CsuComm][CAN_Tx_MSG] <%X> ", frame.can_id);
+    for (i = 0; i < frame.can_dlc; i++)
+    {
+        DEBUG_PRINTF_PCBATESTER_DETAIL("%02X ", frame.data[i]);
+    }
+    DEBUG_PRINTF_PCBATESTER_DETAIL("(%d Bytes)\n", frame.can_dlc);
+    #endif
+
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: PRINT_CAN_FRAME
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_CAN_FRAME(struct can_frame *frame)
+{
+    if (frame->can_dlc != 0)
+    {
+        int i = 0;
+        DEBUG_PRINTF_PCBATESTER_DETAIL("[CsuComm] Got CAN Message: \n\
+                \t - Length: %d (Bytes, DEC)\n\
+                \t - ID: %08X\n\
+                \t - Payload: ",
+                frame->can_dlc,
+                frame->can_id
+                );
+        for (i = 0; i< frame->can_dlc; i++)
+        {
+            DEBUG_PRINTF_PCBATESTER_DETAIL("%02X ", frame->data[i]);
+        }
+        DEBUG_PRINTF_PCBATESTER_DETAIL("\n");
+    }
+}
+
+
+/*===========================================================================
+FUNCTION: System_Init
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int System_Init()
+{
+    system("../root/stop.sh");
+}
+
+/*===========================================================================
+FUNCTION: ReadAdcVolt
+DESCRIPTION:
+    1. fork1
+
+    #define ADC_CHANNEL_AIN0_NTC1   0
+    #define ADC_CHANNEL_AIN1_NTC2   1
+    #define ADC_CHANNEL_AIN2_PP     2
+    #define ADC_CHANNEL_AIN3_CP     3
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+float ReadAdcVolt(unsigned char AdcChannel)
+{
+    //AIN0=CCS GUN Temp 1
+    //AIN1=CCS GUN Temp 2
+    //AIN2=CCS_Proximity/2
+    //AIN3=pilot voltage
+
+    int fd;
+    int AvgTimes = 0;
+    unsigned char SampleBuf[4];
+    float TmpVolt = 0;
+    float AvgSample = 0;
+    float result = 0;
+
+    switch (AdcChannel)
+    {
+        case ADC_CHANNEL_AIN0_NTC1: //0
+        {
+            fd = open("/sys/bus/iio/devices/iio\:device0/in_voltage0_raw", O_RDONLY);
+            break;
+        }
+        case ADC_CHANNEL_AIN1_NTC2: //1
+        {
+            fd = open("/sys/bus/iio/devices/iio\:device0/in_voltage1_raw", O_RDONLY);
+            break;
+        }
+        case ADC_CHANNEL_AIN2_PP:   //2
+        {
+            fd = open("/sys/bus/iio/devices/iio\:device0/in_voltage2_raw", O_RDONLY);
+            break;
+        }
+        case ADC_CHANNEL_AIN3_CP:   //3
+        {
+            fd = open("/sys/bus/iio/devices/iio\:device0/in_voltage3_raw", O_RDONLY);
+            break;
+        }
+        default:
+        {
+            sprintf(buf_log_pcbatstr, "[ReadAdcVolt]unexpected AdcChannel(%d)", AdcChannel);
+            SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+            return -1;
+        }
+    }
+
+    if(fd > 0)
+    {
+        for(AvgTimes = 0; AvgTimes < 5; AvgTimes++) //get 5 samples
+        {
+            read(fd, SampleBuf, 4);
+            TmpVolt = (float)atoi(SampleBuf);
+            lseek(fd, 0, SEEK_SET);
+            AvgSample += TmpVolt;
+        }
+        close(fd);
+        AvgSample /= AvgTimes;
+
+        switch (AdcChannel)
+        {
+            case ADC_CHANNEL_AIN0_NTC1: //0
+            {
+                result = (3.6 * AvgSample) / 4095;
+                //sprintf(buf_log_pcbatstr, "[ReadAdcVolt]AIN0_NTC1 = %.02f", result);
+                //SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+                break;
+            }
+            case ADC_CHANNEL_AIN1_NTC2: //1
+            {
+                result = (3.6 * AvgSample) / 4095;
+                //sprintf(buf_log_pcbatstr, "[ReadAdcVolt]AIN1_NTC2 = %.02f", result);
+                //SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+                break;
+            }
+            case ADC_CHANNEL_AIN2_PP:   //2
+            {
+                result = (3.6 * AvgSample) / 4095;
+                //sprintf(buf_log_pcbatstr, "[ReadAdcVolt]AIN2_PP = %.02f", result);
+                //SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+                break;
+            }
+            case ADC_CHANNEL_AIN3_CP:   //3
+            {
+                result = (0.954-(1.8*AvgSample/4095))/0.06;
+                //sprintf(buf_log_pcbatstr, "[ReadAdcVolt]AIN3_CP = %.02f", result);
+                //SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+                break;
+            }
+            default:
+            {
+                sprintf(buf_log_pcbatstr, "[ReadAdcVolt]unknown AdcChannel(%d)", AdcChannel);
+                SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+                result = -1;
+                break;
+            }
+        }
+        return result;
+    }
+    else
+    {
+        SAVE_SYS_LOG_MSG_PCBATESTER("[ReadAdcVolt]failed on open adc channel");
+        return -1;
+    }
+}
+
+/*===========================================================================
+FUNCTION: PCBATstr_canbus
+DESCRIPTION:
+    1. Tx: AA 55
+    2. Rx: 55 AA (expected)
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int PCBATstr_canbus()
+{
+    int FD_CAN_Socket = 0;
+    int result = PASS;
+    int err_cnt = 0;
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [canbus] start --------");
+    unsigned char can_tx_payload[8];
+    struct can_frame frame;
+
+    //Step 1: CAN Bus
+    FD_CAN_Socket = CANBus_Init();
+    if (FD_CAN_Socket < 0)
+    {
+         return FAIL;
+    }
+
+    while(1)
+    {
+        //Step 2: Tx CAN Message
+        memset(can_tx_payload, 0, sizeof(can_tx_payload));
+        can_tx_payload[0] = 0xAA;
+        can_tx_payload[1] = 0x55;
+
+        CAN_Tx_MSG(FD_CAN_Socket, CAN_CMD_PCBA_TEST, 0, 2, can_tx_payload);
+
+        sleep(1);
+
+        //Step 3: Rx CAN Message
+        memset(&frame, 0, sizeof(struct can_frame));
+        read(FD_CAN_Socket, &frame, sizeof(struct can_frame));
+
+        //PRINT_CAN_FRAME(&frame);
+
+        if( (frame.can_id == 0) ||          //all zero
+            (frame.can_id & 0x08000000) ||  //to avoid incoreect DIRECTION bit
+            ((frame.can_id & 0x0000FF00) != CAN_CMD_PCBA_TEST) ||  //the 1st command ID from Master should be 0x02
+            (frame.can_dlc != 2))           //payload length should be only 5 bytes.
+        {
+            if (err_cnt++ >= 10)
+            {
+                SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_canbus]Rx err_cnt >= 5");
+                result = FAIL;
+                break;
+            }
+            continue;
+        }
+
+        if ((frame.data[0] == 0x55) && (frame.data[1] == 0xAA))
+        {
+            sprintf(buf_log_pcbatstr,
+                    "[PCBATstr_canbus]rx: %02X %02X (PASS)",
+                    frame.data[0],
+                    frame.data[1]);
+            SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+            break;
+        }
+        else
+        {
+            sprintf(buf_log_pcbatstr,
+                    "[PCBATstr_canbus]rx: %02X %02X (FAIL)",
+                    frame.data[0],
+                    frame.data[1]);
+            SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+            result = FAIL;
+            break;
+        }
+    }
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [canbus] end --------");
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: PCBATstr_ethernet
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int PCBATstr_ethernet()
+{
+    int result = PASS;
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [ethernet] --------");
+    system("/sbin/ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up");
+    system("/sbin/route add default gw 192.168.1.1");
+    //system("ping -I eth0 -c 3 192.168.1.1");
+
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: PCBATstr_gpio_ntc
+DESCRIPTION:
+    1. AM_IO_1 <<==>> NTC1 & NTC2
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int PCBATstr_gpio_ntc()
+{
+    int result = PASS;
+    float ntc1 = 0;
+    float ntc2 = 0;
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [ntc] --------");
+
+    //Step 1: AM_IO_1
+    system("echo \"out\" > /sys/class/gpio/gpio87/direction");
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_gpio_ntc]AM_IO_1(ON): read NTC1, NTC2");
+    system("echo 1 > /sys/class/gpio/gpio87/value"); //[AM_IO_1](gpio2_25: output)
+    usleep(100000);
+    ntc1 = ReadAdcVolt(ADC_CHANNEL_AIN0_NTC1);
+    ntc2 = ReadAdcVolt(ADC_CHANNEL_AIN1_NTC2);
+    if (ntc1 > 3.0)
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]ntc1 = %.02fV (PASS, > 3.0)", ntc1);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        if (ntc2 > 3.0)
+        {
+            sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]ntc2 = %.02fV (PASS, > 3.0)", ntc2);
+            SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        }
+        else
+        {
+            sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]ntc2 = %.02fV (FAIL, > 3.0)", ntc2);
+            SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+            result = FAIL;
+        }
+    }
+    else
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]ntc1 = %.02fV (FAIL, > 3.0)", ntc1);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        result = FAIL;
+    }
+
+    //=========================================================================
+    SAVE_SYS_LOG_MSG_PCBATESTER("\n");
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_gpio_ntc]AM_IO_1(OFF): read NTC1, NTC2");
+    system("echo 0 > /sys/class/gpio/gpio87/value"); //[AM_IO_1](gpio2_25: output)
+    usleep(100000);
+    ntc1 = ReadAdcVolt(ADC_CHANNEL_AIN0_NTC1);
+    ntc2 = ReadAdcVolt(ADC_CHANNEL_AIN1_NTC2);
+    if (ntc1 < 0.5)
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]ntc1 = %.02fV (PASS, < 0.5)", ntc1);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        if (ntc2 < 0.5)
+        {
+            sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]ntc2 = %.02fV (PASS, < 0.5)", ntc2);
+            SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        }
+        else
+        {
+            sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]ntc2 = %.02fV (FAIL, < 0.5)", ntc2);
+            SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+            result = FAIL;
+        }
+    }
+    else
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]ntc1 = %.02fV (FAIL, < 0.5)", ntc1);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        result = FAIL;
+    }
+
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: PCBATstr_gpio_pp
+DESCRIPTION:
+    1. AM_IO_2 <<==>> PP
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int PCBATstr_gpio_pp()
+{
+    int result = PASS;
+    float pp = 0;
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [pp] --------");
+
+    system("echo \"out\" > /sys/class/gpio/gpio89/direction");
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_gpio_ntc]PP(ON): read PP");
+    system("echo 1 > /sys/class/gpio/gpio89/value"); //[AM_IO_2](gpio2_25: output)
+    usleep(100000);
+    pp = ReadAdcVolt(ADC_CHANNEL_AIN2_PP);
+    if (pp > 2.0)
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]PP = %.02fV (PASS, > 2.0)", pp);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+    }
+    else
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]PP = %.02fV (FAIL, > 2.0)", pp);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        result = FAIL;
+    }
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_gpio_ntc]PP(OFF): read PP...");
+    system("echo 0 > /sys/class/gpio/gpio89/value"); //[AM_IO_2](gpio2_25: output)
+    usleep(100000);
+    pp = ReadAdcVolt(ADC_CHANNEL_AIN2_PP);
+    if (pp < 0.5)
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]PP = %.02fV (PASS, < 0.5)", pp);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+    }
+    else
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]PP = %.02fV (FAIL, < 0.5)", pp);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        result = FAIL;
+    }
+
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: PCBATstr_cp
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int PCBATstr_cp()
+{
+    int result = PASS;
+    float cp = 0;
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [cp] --------");
+
+    system("echo \"out\" > /sys/class/gpio/gpio89/direction");
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_gpio_ntc]CP(PWM:100%,SetStateE:OFF): read CP");
+    system("echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle");
+    system("echo 0 > /sys/class/gpio/gpio86/value"); //state E
+    usleep(100000);
+
+    cp = ReadAdcVolt(ADC_CHANNEL_AIN3_CP);
+    if (cp > 11.0)
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]CP = %.02fV (PASS, > 11.0)", cp);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+    }
+    else
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]CP = %.02fV (FAIL, > 11.0)", cp);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        result = FAIL;
+    }
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("\n");
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_gpio_ntc]CP(PWM:100%,SetStateE:ON): read CP");
+    system("echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle");
+    system("echo 1 > /sys/class/gpio/gpio86/value"); //state E
+    usleep(100000);
+    cp = ReadAdcVolt(ADC_CHANNEL_AIN3_CP);
+    if (cp < 1.0)
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]CP = %.02fV (PASS, < 1.0V)", cp);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+    }
+    else
+    {
+        sprintf(buf_log_pcbatstr, "[PCBATstr_gpio_ntc]CP = %.02fV (FAIL, < 1.0V)", cp);
+        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+        result = FAIL;
+    }
+
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: PCBATstr_reboot
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int PCBATstr_reboot()
+{
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [reboot] --------");
+    system("reboot -f");
+    sleep(2);
+    system("reboot -f");
+    return PASS;
+}
+
+/*===========================================================================
+FUNCTION: PCBATstr_killtasks
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int PCBATstr_killtasks()
+{
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [killtasks] --------");
+
+    system("../root/stop.sh");
+}
+
+
+/*===========================================================================
+FUNCTION: PCBATstr_qca7k
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int PCBATstr_qca7k()
+{
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [qca7000] --------");
+
+    int state = IDLE;
+    int result = PASS;
+    int packet_size = 0;
+    double t_diff = 0;
+
+    //Step1: Init
+    if(RawSock > 0)
+    {
+        close(RawSock);
+    }
+    RawSock = -1;
+
+    //Init V2G TCP/IPv6 packets buffer
+    V2gtpMsgRxBuf = (unsigned char *)malloc(V2GTP_MSG_RX_BUFFER_SIZE);
+    memset(V2gtpMsgRxBuf, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+
+    V2gtpMsgTxBuf = (unsigned char *)malloc(V2GTP_MSG_TX_BUFFER_SIZE);
+    memset(V2gtpMsgTxBuf, 0, V2GTP_MSG_TX_BUFFER_SIZE);
+
+    while (1)
+    {
+        if(RawSock >= 0)
+        {
+            memset(V2gtpMsgRxBuf, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+            packet_size = recvfrom(RawSock, V2gtpMsgRxBuf, V2GTP_MSG_RX_BUFFER_SIZE, 0, NULL, NULL);
+            if(packet_size > 0)
+            {
+                struct MmeHeader *MmePacket;
+                MmePacket = (struct MmeHeader *)V2gtpMsgRxBuf;
+                switch(MmePacket->MMTYPE)
+                {
+                    case MMTYPE_VENDOR_VS_NW_INFO_CNF:
+                    {
+                        memcpy(QcaMac, MmePacket->OSA, 6);
+
+                        sprintf(buf_log_pcbatstr,
+                                "[QCA7K][Rx][VENDOR_VS_NW_INFO_CNF]Got QCA7K MacAddr:%02X:%02X:%02X:%02X:%02X:%02X (comm:OK)",
+                                 QcaMac[0],  QcaMac[1],  QcaMac[2],  QcaMac[3],  QcaMac[4],  QcaMac[5]);
+                        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+                        return PASS;
+                    }
+
+                    default:
+                    {
+                        break;
+                    }
+
+                }
+            }
+        }
+
+        switch(state)
+        {
+            case IDLE:
+            {
+                if(RawSock < 0)
+                {
+                    RawSock = socket(PF_PACKET, SOCK_RAW, htons(EtherType_HomePlug));
+
+                    sprintf(buf_log_pcbatstr, "[RawSock]opened(%d)", RawSock);
+                    SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+
+                    if(RawSock == -1)
+                    {
+                        SAVE_SYS_LOG_MSG_PCBATESTER("SlacComm:Failed to create socket");
+                        return FAIL;
+                    }
+
+                    if (setsockopt(RawSock, SOL_SOCKET, SO_BINDTODEVICE, QcaInterface, 4) < 0)
+                    {
+                        SAVE_SYS_LOG_MSG_PCBATESTER("SlacComm:Set SO_BINDTODEVICE NG");
+                        return FAIL;
+                    }
+
+                    struct timeval tv;
+                    tv.tv_sec = 0;
+                    tv.tv_usec = 100000;  //100ms (Rx timeout)
+                    if (setsockopt(RawSock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct	timeval)) < 0)
+                    {
+                        SAVE_SYS_LOG_MSG_PCBATESTER("SlacComm:Set SO_RCVTIMEO NG");
+                        return FAIL;
+                    }
+
+                    tv.tv_usec = 100000;  //100ms (Tx timeout)
+                    if (setsockopt(RawSock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct	timeval)) < 0)
+                    {
+                        SAVE_SYS_LOG_MSG_PCBATESTER("SlacComm:Set SO_SNDTIMEO NG");
+                        return FAIL;
+                    }
+
+                    memset(&Req, 0, sizeof(struct ifreq));
+                    strcpy( (char*)Req.ifr_name, QcaInterface);
+
+                    if (ioctl(RawSock, SIOCGIFINDEX, &Req) < 0)
+                    {
+                        SAVE_SYS_LOG_MSG_PCBATESTER("SlacComm: ioctl NG");
+                        return FAIL;
+                    }
+
+                    memset(&DestSocketAddress, 0, sizeof(struct sockaddr_ll));
+                    DestSocketAddress.sll_ifindex = Req.ifr_ifindex;
+                    DestSocketAddress.sll_halen = ETH_ALEN;
+
+                    SAVE_SYS_LOG_MSG_PCBATESTER("[QCA7K]connecting...");
+                    //Get QCA7K MAC address
+                    GetQca7kMac();
+                    ftime(&SeqStartTime);
+                    break;
+                }
+                else   //RawSock: opened
+                {
+                    ftime(&SeqEndTime);
+                    t_diff = DiffTimeb(SeqStartTime, SeqEndTime);
+                    if (t_diff > V2G_SECC_QCA7000_COMM_TIMEOUT)  //10 secs
+                    {
+                        sprintf(buf_log_pcbatstr,
+                                "[QCA7K][Error]comm: fail (%.02lf/%dms)",
+                                t_diff,
+                                V2G_SECC_QCA7000_COMM_TIMEOUT);
+                        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+                        return FAIL;
+                    }
+                    else if (t_diff > V2G_SECC_QCA7000_GET_MAC_ADDR_REQ_RETRY_PERIOD)   //3 secs
+                    {
+                        sprintf(buf_log_pcbatstr,
+                                "[QCA7K]re-try connecting...(%.02lf/%dms)",
+                                t_diff,
+                                V2G_SECC_QCA7000_GET_MAC_ADDR_REQ_RETRY_PERIOD);
+                        SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+
+                        GetQca7kMac(); //re-send req
+                        break;
+                    }
+                    else
+                    {
+                        //null
+                    }
+                }
+                break;
+            }
+
+            default:
+            {
+                break;
+            }
+        }
+    }
+}
+
+/*===========================================================================
+FUNCTION: PCBATstr_sdcard
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int PCBATstr_sdcard()
+{
+    int result = FAIL;
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [sdcard] --------");
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_sdcard]mount SDCard on mnt");
+    system("mount /dev/mmcblk0p1 /mnt");
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_sdcard]delete file.txt");
+    system("rm -rfv /mnt/file.txt");
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_sdcard]creat file.txt in SDCard");
+    system("touch /mnt/file.txt");
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_sdcard]unmount SDCard from mnt");
+    system("umount /mnt");
+    sleep(1);
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_sdcard]mount SDCard on UsbFlash");
+    system("mount /dev/mmcblk0p1 /UsbFlash");
+    FILE *fp;
+    fp = fopen("/UsbFlash/file.txt", "r");
+    if (fp == NULL)
+    {
+        SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_sdcard]file.txt is not found");
+    }
+    else
+    {
+        SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_sdcard]file.txt is found");
+        SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_sdcard]delete file.txt");
+        system("rm -rfv /mnt/file.txt");
+        result = PASS;
+    }
+    fclose(fp);
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("[PCBATstr_sdcard]unmount SDCard from UsbFlash");
+    system("umount /UsbFlash");
+    return result;
+}
+
+
+/*===========================================================================
+FUNCTION: PCBATstr_all
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int PCBATstr_all()
+{
+    int result = PASS;
+
+    SAVE_SYS_LOG_MSG_PCBATESTER("-------- [all] --------");
+
+    //case 'k':   //Kill other tasks
+    if (PCBATstr_killtasks() == PASS)
+    {
+        printf("[kill]PASS\n");
+    }
+    else
+    {
+        printf("[kill]FAIL\n");
+        result = FAIL;
+    }
+
+    //case 'b':   //CAN Bus Test
+    if (PCBATstr_canbus() == PASS)
+    {
+        printf("[can]PASS\n");
+    }
+    else
+    {
+        printf("[can]FAIL\n");
+        result = FAIL;
+    }
+
+
+    //case 'e':   //Ethernet(eth1) Test
+    if (PCBATstr_ethernet() == PASS)
+    {
+        printf("[eth]READY\n");
+    }
+    else
+    {
+        printf("[eth]FAIL\n");
+        result = FAIL;
+    }
+
+
+    //case 'n':   //GPIO(AM_IO_1) and ADC(NTC1,NTC2) Test
+    if (PCBATstr_gpio_ntc() == PASS)
+    {
+        printf("[ntc]PASS\n");
+    }
+    else
+    {
+        printf("[ntc]FAIL\n");
+        result = FAIL;
+    }
+
+
+    //case 'p':   //GPIO(AM_IO_2) and ADC(PP) Test
+    if (PCBATstr_gpio_pp() == PASS)
+    {
+        printf("[pp]PASS\n");
+    }
+    else
+    {
+        printf("[pp]FAIL\n");
+        result = FAIL;
+    }
+
+    //case 'c':   //CP Test
+    if (PCBATstr_cp() == PASS)
+    {
+        printf("[cp]PASS\n");
+    }
+    else
+    {
+        printf("[cp]FAIL\n");
+        result = FAIL;
+    }
+
+
+    //case 'q':   //QCA7000 Test
+    if (PCBATstr_qca7k() == PASS)
+    {
+        printf("[qca]PASS\n");
+    }
+    else
+    {
+        printf("[qca]FAIL\n");
+        result = FAIL;
+    }
+
+    //case 's':   //SD Card Test
+    if (PCBATstr_sdcard() == PASS)
+    {
+        printf("[sd]PASS\n");
+    }
+    else
+    {
+        printf("[sd]FAIL\n");
+        result = FAIL;
+    }
+
+    return result;
+}
+
+
+/*===========================================================================
+FUNCTION: main
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int main(int argc, char *argv[])
+{
+    SAVE_SYS_LOG_MSG_PCBATESTER("PCBATester: on");
+    SAVE_SYS_LOG_MSG_PCBATESTER("---------------------------------------------");
+    SAVE_SYS_LOG_MSG_PCBATESTER("--                PCBATester               --");
+    SAVE_SYS_LOG_MSG_PCBATESTER("---------------------------------------------\n");
+
+    //Initialization
+    //System_Init();
+
+    //Arguments Parsing for Commands
+    if (argv[1][0] == '-' )
+    {
+        switch (argv[1][1])
+        {
+            case 'h':   //help
+            {
+                printf(" ================= [HELP] PCBATester ==============\n");
+                printf(" -h \t :help\n");
+                printf(" -a \t :Auto Run All Test Cases\n");
+                printf(" -b \t :CAN Bus Test\n");
+                printf(" -c \t :CP Test\n");
+                printf(" -e \t :Ethernet(eth1) Test\n");
+                printf(" -k \t :Killall other tasks\n");
+                printf(" -p \t :GPIO(AM_IO_2) and ADC(PP) Test\n");
+                printf(" -n \t :GPIO(AM_IO_1) and ADC(NTC1,NTC2) Test\n");
+                printf(" -q \t :QCA7000 Test\n");
+                printf(" -r \t :Reboot\n");
+                printf(" -s \t :SD Card Test\n");
+                break;
+            }
+            case 'a':   //Auto Run All Test Cases
+            {
+                if (PCBATstr_all() == PASS)
+                {
+                    printf("[all]PASS\n");
+                }
+                else
+                {
+                    printf("[all]FAIL\n");
+                }
+                break;
+            }
+            case 'b':   //CAN Bus Test
+            {
+                if (PCBATstr_canbus() == PASS)
+                {
+                    printf("[can]PASS\n");
+                }
+                else
+                {
+                    printf("[can]FAIL\n");
+                }
+                break;
+            }
+            case 'e':   //Ethernet(eth1) Test
+            {
+                if (PCBATstr_ethernet() == PASS)
+                {
+                    printf("[eth]READY\n");
+                }
+                else
+                {
+                    printf("[eth]FAIL\n");
+                }
+                break;
+            }
+            case 'n':   //GPIO(AM_IO_1) and ADC(NTC1,NTC2) Test
+            {
+                if (PCBATstr_gpio_ntc() == PASS)
+                {
+                    printf("[ntc]PASS\n");
+                }
+                else
+                {
+                    printf("[ntc]FAIL\n");
+                }
+                break;
+            }
+            case 'p':   //GPIO(AM_IO_2) and ADC(PP) Test
+            {
+                if (PCBATstr_gpio_pp() == PASS)
+                {
+                    printf("[pp]PASS\n");
+                }
+                else
+                {
+                    printf("[pp]FAIL\n");
+                }
+                break;
+            }
+            case 'k':   //Kill other tasks
+            {
+                if (PCBATstr_killtasks() == PASS)
+                {
+                    printf("[kill]PASS\n");
+                }
+                else
+                {
+                    printf("[kill]FAIL\n");
+                }
+                break;
+            }
+            case 'c':   //CP Test
+            {
+                if (PCBATstr_cp() == PASS)
+                {
+                    printf("[cp]PASS\n");
+                }
+                else
+                {
+                    printf("[cp]FAIL\n");
+                }
+                break;
+            }
+            case 'q':   //QCA7000 Test
+            {
+                if (PCBATstr_qca7k() == PASS)
+                {
+                    printf("[qca]PASS\n");
+                }
+                else
+                {
+                    printf("[qca]FAIL\n");
+                }
+                break;
+            }
+            case 'r':   //Reboot
+            {
+                if (PCBATstr_reboot() == PASS)
+                {
+                    printf("[reboot]PASS\n");
+                }
+                else
+                {
+                    printf("[reboot]FAIL\n");
+                }
+                break;
+            }
+            case 's':   //SD Card Test
+            {
+                if (PCBATstr_sdcard() == PASS)
+                {
+                    printf("[sd]PASS\n");
+                }
+                else
+                {
+                    printf("[sd]FAIL\n");
+                }
+                break;
+            }
+            default:
+            {
+                sprintf(buf_log_pcbatstr, "Unknown option -%c\n\n", argv[1][1]);
+                SAVE_SYS_LOG_MSG_PCBATESTER(buf_log_pcbatstr);
+                printf("[others]UNSUPPORTED\n");
+                break;
+            }
+        }
+    }
+}

+ 66 - 0
EVSE/Projects/CCS/Apps/PCBATester.h

@@ -0,0 +1,66 @@
+/*===========================================================================
+                     Combined Charging System (CCS): SECC
+                                 PCBATester.h
+
+                              initiated by Joseph
+                               (since 2020/05/19)
+=============================================================================*/
+#if FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE
+    //Saving System Log
+    #define SAVE_SYS_LOG_MSG_PCBATESTER_SWITCH        ENABLE  //ENABLE, DISABLE
+
+    //Configuration for Debug Print Messages
+    #define DEBUG_PRINTF_PCBATESTER_SHOW              DISABLE  //ENABLE, DISABLE
+    #define DEBUG_PRINTF_PCBATESTER_BRIEF_SHOW        DISABLE  //ENABLE, DISABLE
+    #define DEBUG_PRINTF_PCBATESTER_DETAIL_SHOW       DISABLE  //ENABLE, DISABLE
+    #define DEBUG_PRINTF_PCBATESTER_SYSTEM_LOG_SHOW   DISABLE  //ENABLE, DISABLE
+#else   //debug mode
+    //Saving System Log
+    #define SAVE_SYS_LOG_MSG_PCBATESTER_SWITCH        ENABLE  //ENABLE, DISABLE
+
+    //Configuration for Debug Print Messages
+    #define DEBUG_PRINTF_PCBATESTER_SHOW              ENABLE  //ENABLE, DISABLE
+    #define DEBUG_PRINTF_PCBATESTER_BRIEF_SHOW        ENABLE  //ENABLE, DISABLE
+    #define DEBUG_PRINTF_PCBATESTER_DETAIL_SHOW       ENABLE  //ENABLE, DISABLE
+    #define DEBUG_PRINTF_PCBATESTER_SYSTEM_LOG_SHOW   ENABLE  //ENABLE, DISABLE
+#endif
+
+//System Log
+#if SAVE_SYS_LOG_MSG_PCBATESTER_SWITCH == ENABLE
+    #define SAVE_SYS_LOG_MSG_PCBATESTER           StoreLogMsg
+#else
+    #define SAVE_SYS_LOG_MSG_PCBATESTER(...)
+#endif
+
+
+//Debug Message
+#if DEBUG_PRINTF_PCBATESTER_SHOW == ENABLE
+
+    //Brief Messages
+    #if DEBUG_PRINTF_PCBATESTER_BRIEF_SHOW == ENABLE
+        #define DEBUG_PRINTF_PCBATESTER_BRIEF      printf
+    #else
+        #define DEBUG_PRINTF_PCBATESTER_BRIEF(...)
+    #endif
+
+    //Detail Messages
+    #if DEBUG_PRINTF_PCBATESTER_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_PCBATESTER_DETAIL     printf
+    #else
+        #define DEBUG_PRINTF_PCBATESTER_DETAIL(...)
+    #endif
+
+    //System Log Messages
+    #if DEBUG_PRINTF_PCBATESTER_SYSTEM_LOG_SHOW == ENABLE
+        #define DEBUG_PRINTF_PCBATESTER_SYSTEM_LOG    printf
+    #else
+        #define DEBUG_PRINTF_PCBATESTER_SYSTEM_LOG(...)
+    #endif
+
+#else
+
+    #define DEBUG_PRINTF_PCBATESTER_BRIEF(...)
+    #define DEBUG_PRINTF_PCBATESTER_DETAIL(...)
+    #define DEBUG_PRINTF_PCBATESTER_SYSTEM_LOG(...)
+
+#endif

BIN
EVSE/Projects/CCS/Apps/SeccComm


+ 16353 - 0
EVSE/Projects/CCS/Apps/SeccComm.c

@@ -0,0 +1,16353 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 EVComm.c
+
+                        initiated by Vern, Joseph
+                           (since 2019/07/19)
+   =============================================================================*/
+#include <netinet/ip.h>
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/termios.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <stdlib.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/mman.h>
+#include <linux/sockios.h>
+#include <linux/socket.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <sys/time.h>
+#include <sys/timeb.h>
+#include <math.h>//for pow
+#include <unistd.h>
+#include <linux/if_packet.h>
+#include <netinet/if_ether.h>
+#include <net/if.h>
+#include <netinet/ether.h>
+#include <errno.h>
+#include <linux/can.h>
+#include <linux/can/raw.h>
+
+#include "define.h"
+#include "SeccComm.h"
+#include "NidNmk.h"
+#include "SeccComm.h"
+#include "CsuComm.h"
+
+#include "./exi_engine/api/api.h"
+#include "./exi_engine/appHandshake/appHandEXIDatatypes.h"
+#include "./exi_engine/transport/v2gtp.h"
+
+int MeterSMId[8];
+struct SysConfigAndInfo *ShmSysConfigAndInfo;
+struct StatusCodeData *ShmStatusCodeData;
+struct CcsData *ShmCcsData;
+struct InternalComm *ShmInternalComm;
+struct InternalCommAC *ShmInternalCommAC;
+
+struct appHandEXIDocument ccs_handshake;
+struct dinEXIDocument ccs_exi_doc_DIN;
+struct iso1EXIDocument ccs_exi_doc_ISO1;
+struct iso2EXIDocument ccs_exi_doc_ISO2;
+unsigned char V2GTP_Tx_buf[V2GTP_MSG_TX_BUFFER_SIZE];   //64*1024 ﺿ65,536 = 65.5KB
+unsigned char buf_log_evcomm[SIZE_OF_LOG_BUFFER];
+unsigned char buf_log_evcomm_fork1[SIZE_OF_LOG_BUFFER];
+unsigned char buf_log_evcomm_fork2[SIZE_OF_LOG_BUFFER];
+unsigned char buf_log_evcomm_fork3[SIZE_OF_LOG_BUFFER];
+
+pid_t CP_Detection_Pid = 0;
+pid_t PP_Detection_Pid = 0;
+pid_t Error_Monitor_Pid = 0;
+int TcpAcceptFd;
+enum MsgFlowStatus V2gFlowStatus;
+int RawSock,UdpSock,TcpSock;
+unsigned char *V2gtpMsgRxBuf, *V2gtpMsgTxBuf;
+
+unsigned short Aag[64];
+struct MmeHeader SendMmePacket;
+int SendMmePacketSize;
+unsigned char CsuMac[6],QcaMac[6],EvMac[6],SlacRunId[8];
+struct sockaddr_ll DestSocketAddress;
+struct ifreq Req;
+unsigned int PwmStartTime;
+struct timeb SeqStartTime, SeqEndTime;
+unsigned char AagGroupsNum, MnbcSoundNum, AttenProfileCnt;
+unsigned char NewNmkKey[16], Nid[7];
+
+/*===========================================================================
+FUNCTION: Check_V2G_Flow_Status
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Check_V2G_Flow_Status()
+{
+    unsigned char result = 0;
+
+    switch (ShmCcsData->CommProtocol)
+    {
+        case V2GT_MSG_PROTOCOL_DIN70121:        //0
+        {
+            result = ShmCcsData->V2GMessage_DIN70121.PresentMsgFlowStatus;
+            break;
+        }
+
+        case V2GT_MSG_PROTOCOL_ISO15118_2014:   //1
+        {
+            result = ShmCcsData->V2GMessage_ISO15118_2014.PresentMsgFlowStatus;
+            break;
+        }
+
+        case V2GT_MSG_PROTOCOL_ISO15118_2018:   //2
+        {
+            result = ShmCcsData->V2GMessage_ISO15118_2018.PresentMsgFlowStatus;
+            break;
+        }
+
+        default:
+            break;
+    }
+    return result;
+}
+
+
+/*===========================================================================
+FUNCTION: StoreLogMsg
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#if SAVE_SYS_LOG_MSG_EVCOMM_SWITCH == ENABLE
+int StoreLogMsg(unsigned char *DataString)
+{
+    static unsigned char Buf[1024];
+    static time_t CurrentTime;
+    static struct tm *tm;
+    static struct timeval tv;
+
+    memset(Buf, 0, sizeof(Buf));
+    CurrentTime = time(NULL);
+    tm = localtime(&CurrentTime);
+    gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][SECC][%d][%02d]%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+            tm->tm_year + 1900,
+            tm->tm_mon + 1,
+            tm->tm_mday,
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            EVCOMM_SYS_INFO.CpState,
+            Check_V2G_Flow_Status(),
+            DataString,
+            tm->tm_year + 1900,
+            tm->tm_mon + 1);
+    system(Buf);
+
+    DEBUG_PRINTF_EVCOMM_SYSTEM_LOG("[%02d:%02d:%02d.%06d][SECC][%d][%02d]%s \n",
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
+            EVCOMM_SYS_INFO.CpState,
+            Check_V2G_Flow_Status(),
+            DataString);
+
+    //Reset the buf_log_evcomm Buffer, i.e. DataString
+    memset(buf_log_evcomm, 0, SIZE_OF_LOG_BUFFER);
+}
+#endif
+
+/*===========================================================================
+FUNCTION: CAN_Tx_MSG
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CAN_Tx_MSG(int Fd, unsigned int MsgId, unsigned char SlaveAddress, unsigned char DataLength, unsigned char *SendData)
+{
+    struct can_frame frame;
+    struct timeb StartTime, EndTime;
+    unsigned int tmp = 0;
+    int nbytes = 0;
+    int i = 0;
+
+    //Protection: To avoid unexpected length for CAN bus payload.
+    if (DataLength > 8)
+    {
+        DataLength = 8;
+    }
+
+    memset(&frame, 0, sizeof(struct can_frame));
+    frame.can_id = 0x80000000 | CAN_SEND_DIRECTION | MsgId | SlaveAddress;  //0x80000000: extension ID format
+    frame.can_dlc = DataLength;
+    memcpy(frame.data, SendData, DataLength);
+    nbytes = write(Fd, &frame, sizeof(struct can_frame));
+
+    #if 0
+    DEBUG_PRINTF_EVCOMM_DETAIL("[SeccComm][CAN_Tx_MSG] <%X> ", frame.can_id);
+    for (i = 0; i < frame.can_dlc; i++)
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("%02X ", frame.data[i]);
+    }
+    DEBUG_PRINTF_EVCOMM_DETAIL("(%d Bytes)\n", frame.can_dlc);
+    #endif
+
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: Proc_EVStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_EVStopRes(int Fd)
+{
+    int nbytes;
+    unsigned char Buffer[8];
+
+    memset(Buffer, 0, sizeof(Buffer));
+    if (CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency == TRUE)
+    {
+        Buffer[0] = EV_EMERGENCY_STOP;  //2
+    }
+    else
+    {
+        Buffer[0] = EV_NORMAL_STOP;     //1
+    }
+
+    /*
+    if(strlen(ShmStatusCodeData->PresentStatusCode[0]) > 0)
+    {
+        memcpy(Buffer + 2, ShmStatusCodeData->PresentStatusCode[0], 6);
+    }
+    */
+    Buffer[1] = ShmStatusCodeData->PresentStatusCode[0][0];
+    Buffer[2] = ShmStatusCodeData->PresentStatusCode[0][1];
+    Buffer[3] = ShmStatusCodeData->PresentStatusCode[0][2];
+    Buffer[4] = ShmStatusCodeData->PresentStatusCode[0][3];
+    Buffer[5] = ShmStatusCodeData->PresentStatusCode[0][4];
+    Buffer[6] = ShmStatusCodeData->PresentStatusCode[0][5];
+
+
+    nbytes = CAN_Tx_MSG(Fd, CAN_CMD_EV_STOP_EVENT, ShmInternalComm->SlaveAddress, 7, Buffer);
+    //system("echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle"); //for test only
+
+    //system("echo 0 > /sys/class/gpio/gpio89/value");    //for test
+
+    SAVE_SYS_LOG_MSG_EVCOMM("[Proc_EVStopRes] Sending STOP Command to CSU");
+
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = FALSE;
+
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: Sniffer_Candump
+DESCRIPTION:
+    1. Only used in End_Process(), which is in fork2 of SeccComm task.
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+    0: accept
+   -1: invalid
+GLOBAL VARIABLES:
+=============================================================================*/
+int Sniffer_Candump(char cmd)
+{
+    #if (CANDUMP_PACKETS_SNIFFER_SWITCH == ENABLE)
+    if (cmd == ENABLE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[candump]init");
+        system("cd /mnt/;rm -rf candump/");
+        system("cd /mnt/;mkdir candump");
+        SAVE_SYS_LOG_MSG_EVCOMM("[candump]on");
+        system("cd /mnt/candump;candump -l can0 &");
+        return 0;
+    }
+    else if (cmd == DISABLE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[candump]off");
+        system("killall candump");
+
+        SAVE_SYS_LOG_MSG_EVCOMM("[candump]save");
+        system("cd /;cp -rfv /mnt/candump /Storage/SystemLog/");
+        return 0;
+    }
+    else
+    {
+        sprintf(buf_log_evcomm_fork2, "[candump]unexpected cmd(%d)", cmd);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork2);
+        return -1;
+    }
+    #endif
+}
+
+/*===========================================================================
+FUNCTION: Sniffer_Tcpdump
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Sniffer_Tcpdump(char cmd)
+{
+    #if (TCPDUMP_PACKETS_SNIFFER_SWITCH == ENABLE)
+    if (cmd == ENABLE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[tcpdump]init...");
+        system("cd /mnt/;rm -rf tcpdump/");
+        system("cd /mnt/;mkdir tcpdump");
+
+        unsigned char buf[256];
+        time_t CurrentTime;
+        struct tm *tm;
+        struct timeval tv;
+
+        memset(buf, 0, sizeof(buf));
+        CurrentTime = time(NULL);
+        tm = localtime(&CurrentTime);
+        gettimeofday(&tv, NULL); // get microseconds, 10^-6
+        sprintf(buf,
+                "tcpdump -i eth1 -w /mnt/tcpdump/[%s][%04d%02d%02d-%02d:%02d:%02d.%06d]packets.pcap&",
+                FIRMWARE_VERSION,
+                tm->tm_year + 1900,
+                tm->tm_mon + 1,
+                tm->tm_mday,
+                tm->tm_hour,
+                tm->tm_min,
+                tm->tm_sec,
+                tv.tv_usec
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM("[tcpdump]on");
+        system(buf);
+        return 0;
+    }
+    else if (cmd == DISABLE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[tcpdump]off");
+        system("killall tcpdump");
+        SAVE_SYS_LOG_MSG_EVCOMM("[tcpdump]wait: 2s");
+        sleep(1);
+        SAVE_SYS_LOG_MSG_EVCOMM("[tcpdump]wait: 1s");
+        sleep(1);
+        SAVE_SYS_LOG_MSG_EVCOMM("[tcpdump]save");
+        system("cd /;cp -rfv /mnt/tcpdump /Storage/SystemLog/");
+        return 0;
+    }
+    else
+    {
+        sprintf(buf_log_evcomm, "[tcpdump]unexpected cmd(%d)", cmd);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        return -1;
+    }
+    #endif
+}
+
+/*===========================================================================
+FUNCTION: Check_V2G_Flow_Status_pre
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+unsigned char Check_V2G_Flow_Status_pre()
+{
+    unsigned char result = 0;
+
+    switch (ShmCcsData->CommProtocol)
+    {
+        case V2GT_MSG_PROTOCOL_DIN70121:        //0
+        {
+            result = ShmCcsData->V2GMessage_DIN70121.PresentMsgFlowStatus_pre;
+            break;
+        }
+
+        case V2GT_MSG_PROTOCOL_ISO15118_2014:   //1
+        {
+            result = ShmCcsData->V2GMessage_ISO15118_2014.PresentMsgFlowStatus_pre;
+            break;
+        }
+
+        case V2GT_MSG_PROTOCOL_ISO15118_2018:   //2
+        {
+            result = ShmCcsData->V2GMessage_ISO15118_2018.PresentMsgFlowStatus_pre;
+            break;
+        }
+
+        default:
+            break;
+    }
+    return result;
+}
+
+
+/*===========================================================================
+FUNCTION: Update_V2G_Flow_Status
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+        1. V2gFlowStatus
+
+GLOBAL VARIABLES:
+        1. V2gFlowStatus
+=============================================================================*/
+int Update_V2G_Flow_Status(unsigned int state_new)
+{
+    unsigned char state_now;
+    state_now = Check_V2G_Flow_Status();
+
+    if (EVCOMM_SYS_INFO.End_Process_inused == TRUE ||
+        CSUCOMMDC_TASK_FLAG.FW_Update_Task_inused == TRUE)
+    {
+        if (state_now != Performance_Timeout &&     //253
+            state_now != Sequence_Timeout &&        //254
+            state_now != Other_Fault)               //255
+        {
+            sprintf(buf_log_evcomm,
+                    "[Warning]state(%d) change: ignored (End_Process_inused:%d, FW_Update_Task_inused:%d)",
+                    state_new,
+                    EVCOMM_SYS_INFO.End_Process_inused,
+                    CSUCOMMDC_TASK_FLAG.FW_Update_Task_inused
+                    );
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            return -1;
+        }
+    }
+    if (state_now != state_new)
+    {
+        //Step 1: Check if Error Occours
+        if (state_now == Performance_Timeout ||     //253
+            state_now == Sequence_Timeout ||        //254
+            state_now == Other_Fault)               //255
+        {
+            if (state_new != IDLE)
+            {
+                if (EVCOMM_SYS_INFO.State_Change_Ignored_Notice == FALSE)
+                {
+                    EVCOMM_SYS_INFO.State_Change_Ignored_Notice = TRUE;
+                    sprintf(buf_log_evcomm,
+                            "[Warning]state(%d) change: ignored(now in error state)",
+                            state_new,
+                            state_now);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                }
+                return -1;
+            }
+        }
+
+        //Updating the state formally.
+        sprintf(buf_log_evcomm,
+                "[stt]%02d >> %02d",
+                state_now,
+                state_new
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+        V2gFlowStatus = state_new;
+        state_now = state_new;
+
+        switch (ShmCcsData->CommProtocol)
+        {
+            case V2GT_MSG_PROTOCOL_DIN70121:        //0
+            {
+                ShmCcsData->V2GMessage_DIN70121.PresentMsgFlowStatus_pre = ShmCcsData->V2GMessage_DIN70121.PresentMsgFlowStatus;
+                ShmCcsData->V2GMessage_DIN70121.PresentMsgFlowStatus = V2gFlowStatus;
+                //break;
+            }
+
+            case V2GT_MSG_PROTOCOL_ISO15118_2014:   //1
+            {
+                ShmCcsData->V2GMessage_ISO15118_2014.PresentMsgFlowStatus_pre = ShmCcsData->V2GMessage_ISO15118_2014.PresentMsgFlowStatus;
+                ShmCcsData->V2GMessage_ISO15118_2014.PresentMsgFlowStatus = V2gFlowStatus;
+                //break;
+            }
+
+            case V2GT_MSG_PROTOCOL_ISO15118_2018:   //2
+            {
+                ShmCcsData->V2GMessage_ISO15118_2018.PresentMsgFlowStatus_pre = ShmCcsData->V2GMessage_ISO15118_2018.PresentMsgFlowStatus;
+                ShmCcsData->V2GMessage_ISO15118_2018.PresentMsgFlowStatus = V2gFlowStatus;
+                //break;
+            }
+
+            default:
+                break;
+        }
+    }
+}
+
+double DiffTimeb(struct timeb ST, struct timeb ET)
+{
+    //return milli-second
+    double StartTime, EndTime;
+    double t_diff;
+
+    StartTime = ((double)ST.time)*1000 + (double)ST.millitm;
+    EndTime = ((double)ET.time)*1000 + (double)ET.millitm;
+    t_diff = EndTime - StartTime;
+
+    if (t_diff < 0)
+    {
+        #if 0
+        if (t_diff < -1000)   //1000ms
+        {
+            sprintf(buf_log_evcomm,
+                    "[Warning]StartTime(%.02lf) > EndTime(%.02lf), d(%.02lf)",
+                    StartTime,
+                    EndTime,
+                    t_diff);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        }
+        #endif
+
+        return -1;
+    }
+    return t_diff;
+}
+
+double DiffTimeb_fork1_Error_Monitor(struct timeb ST, struct timeb ET)
+{
+    //return milli-second
+    static double StartTime, EndTime;
+    static double t_diff;
+
+    StartTime = ((double)ST.time)*1000 + (double)ST.millitm;
+    EndTime = ((double)ET.time)*1000 + (double)ET.millitm;
+    t_diff = EndTime - StartTime;
+
+    if (t_diff < 0)
+    {
+        #if 0
+        if (t_diff < -1000)   //1000ms
+        {
+            sprintf(buf_log_evcomm_fork2,
+                    "[fork1][Warning]S(%.02lf) > E(%.02lf), d(%.02lf)",
+                    StartTime,
+                    EndTime,
+                    t_diff);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork2);
+        }
+        #endif
+
+        return -1;
+    }
+    return t_diff;
+}
+
+double DiffTimeb_fork2_Error_Monitor(struct timeb ST, struct timeb ET)
+{
+    //return milli-second
+    static double StartTime, EndTime;
+    static double t_diff;
+
+    StartTime = ((double)ST.time)*1000 + (double)ST.millitm;
+    EndTime = ((double)ET.time)*1000 + (double)ET.millitm;
+    t_diff = EndTime - StartTime;
+
+    if (t_diff < 0)
+    {
+        #if 0
+        if (t_diff < -1000)   //1000ms
+        {
+            sprintf(buf_log_evcomm_fork2,
+                    "[fork2][Warning]S(%.02lf) > E(%.02lf), d(%.02lf)",
+                    StartTime,
+                    EndTime,
+                    t_diff);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork2);
+        }
+        #endif
+
+        return -1;
+    }
+    return t_diff;
+}
+
+int CreateShareMemory()
+{
+    int MeterSMId;
+
+    //create ShmSysConfigAndInfo
+    if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[main]CreateShareMemory:shmget ShmSysConfigAndInfo NG");
+        return 0;
+    }
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[main]CreateShareMemory:shmat ShmSysConfigAndInfo NG");
+        return 0;
+    }
+    memset(ShmSysConfigAndInfo,0,sizeof(struct SysConfigAndInfo));
+    //create ShmStatusCodeData
+    if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[main]CreateShareMemory:shmget ShmStatusCodeData NG");
+        return 0;
+    }
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[main]CreateShareMemory:shmat ShmStatusCodeData NG");
+        return 0;
+    }
+    memset(ShmStatusCodeData,0,sizeof(struct StatusCodeData));
+    //create ShmCcsData
+    if ((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData), IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[main]CreateShareMemory:shmget ShmCcsData NG");
+        return 0;
+    }
+    else if ((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[main]CreateShareMemory:shmat ShmCcsData NG");
+        return 0;
+    }
+    memset(ShmCcsData,0,sizeof(struct CcsData));
+    return 1;
+}
+
+void DetachShareMemory()
+{
+	if(MeterSMId[0]>0)
+	{
+    		shmdt(ShmSysConfigAndInfo);
+		shmctl(MeterSMId[0], IPC_RMID, 0);
+    	}
+    	if(MeterSMId[1]>0)
+	{
+    		shmdt(ShmStatusCodeData);
+		shmctl(MeterSMId[1], IPC_RMID, 0);
+    	}
+    	if(MeterSMId[2]>0)
+	{
+    		shmdt(ShmCcsData);
+		shmctl(MeterSMId[2], IPC_RMID, 0);
+    	}
+    	if(MeterSMId[3]>0)
+	{
+    		shmdt(ShmInternalComm);
+		shmctl(MeterSMId[3], IPC_RMID, 0);
+    	}
+    	if(MeterSMId[4]>0)
+	{
+    		shmdt(ShmInternalCommAC);
+		shmctl(MeterSMId[4], IPC_RMID, 0);
+    	}
+}
+
+/*===========================================================================
+FUNCTION: ShareMemory_Init
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int ShareMemory_Init()
+{
+	memset(MeterSMId,0,sizeof(MeterSMId));
+    //create ShmSysConfigAndInfo
+    if ((MeterSMId[0] = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("ShareMemory_Init:shmget ShmSysConfigAndInfo NG");
+        return 0;
+    }
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId[0], NULL, 0)) == (void *) -1)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("ShareMemory_Init:shmat ShmSysConfigAndInfo NG");
+        return 0;
+    }
+
+    //create ShmStatusCodeData
+    if ((MeterSMId[1] = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("ShareMemory_Init:shmget ShmStatusCodeData NG");
+        return 0;
+    }
+    else if ((ShmStatusCodeData = shmat(MeterSMId[1], NULL, 0)) == (void *) -1)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("ShareMemory_Init:shmat ShmStatusCodeData NG");
+        return 0;
+    }
+
+    //create ShmCcsData
+    if ((MeterSMId[2] = shmget(ShmCcsCommKey, sizeof(struct CcsData),  0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("ShareMemory_Init:shmget ShmCcsData NG");
+        return 0;
+    }
+    else if ((ShmCcsData = shmat(MeterSMId[2], NULL, 0)) == (void *) -1)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("ShareMemory_Init:shmat ShmCcsData NG");
+        return 0;
+    }
+
+    //create ShmInternalComm
+    if ((MeterSMId[3] = shmget(ShmInternalCommKey, sizeof(struct InternalComm),   0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("ShareMemory_Init:shmget ShmInternalComm NG");
+        return 0;
+    }
+    else if ((ShmInternalComm = shmat(MeterSMId[3], NULL, 0)) == (void *) -1)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("ShareMemory_Init:shmat ShmInternalComm NG");
+        return 0;
+    }
+
+    //create ShmInternalCommAC
+    if ((MeterSMId[4] = shmget(ShmInternalCommACKey, sizeof(struct InternalCommAC),   0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("ShareMemory_Init:shmget ShmInternalCommAC NG");
+        return 0;
+    }
+    else if ((ShmInternalCommAC = shmat(MeterSMId[4], NULL, 0)) == (void *) -1)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("ShareMemory_Init:shmat ShmInternalCommAC NG");
+        return 0;
+    }
+
+    //[To-Do] The initialization here is reduntant and should be removed partially.
+    //SHM_Init_supportedAppProtocolRes(ShmCcsData);
+    //SHM_Init_din_SessionSetupRes(ShmCcsData);
+    //SHM_Init_din_ServiceDiscoveryRes(ShmCcsData);
+    //SHM_Init_din_ServiceAndPaymentSelectionRes(ShmCcsData);
+    //SHM_Init_din_ContractAuthenticationRes(ShmCcsData);
+    SHM_Init_din_ChargeParameterDiscoveryRes(ShmCcsData);
+    SHM_Init_din_CableCheckRes(ShmCcsData);
+    SHM_Init_din_PreChargeRes(ShmCcsData);
+    SHM_Init_din_PowerDeliveryRes(ShmCcsData);
+    SHM_Init_din_CurrentDemandRes(ShmCcsData);
+    SHM_Init_din_WeldingDetectionRes(ShmCcsData);
+    SHM_Init_din_SessionStopRes(ShmCcsData);
+
+    return 1;
+}
+
+/*===========================================================================
+FUNCTION: GetEthMac
+DESCRIPTION:
+    1. Accessing current CsuMac address, if Eth = eth1
+    2. The address of eth1(for QCA7000) is a random number, which will be modified
+       after each time of booting up system.
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int GetEthMac(unsigned char *Eth, unsigned char *mac)
+{
+    //Parameters:MAC,IP,Mask,Gateway
+    int fd, rd = 0;
+    unsigned char addr[18], Buffer[128];
+
+    memset(Buffer, 0, sizeof(Buffer));
+    sprintf(Buffer, "cat /sys/class/net/%s/address > /mnt/GetEthInfo", Eth);    //CsuMac (Eth = eth1)
+    system(Buffer);
+    fd = open("/mnt/GetEthInfo", O_RDONLY);
+    if(fd < 0)
+    {
+        system("rm -f /mnt/GetEthInfo");
+        SAVE_SYS_LOG_MSG_EVCOMM("GetEthMac: MAC Address open error");
+        return 0;
+    }
+    memset(mac, 0, 6);
+    memset(addr, 0, sizeof(addr));
+    rd = read(fd, addr, 17);
+    close(fd);
+    system("rm -f /mnt/GetEthInfo");
+    sscanf(addr, "%02x:%02x:%02x:%02x:%02x:%02x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);    //CsuMac (Eth = eth1)
+    sprintf(buf_log_evcomm,
+            "[GetEthMac]EVSE MACAddr(CsuMac): %02x:%02x:%02x:%02x:%02x:%02x",
+            mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);    //CsuMac (Eth = eth1)
+    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    return 1;
+}
+
+/*===========================================================================
+FUNCTION: ReadAdcVolt
+DESCRIPTION:
+    1. fork1
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+float ReadAdcVolt(unsigned char AdcChannel)
+{
+    //AIN0=CCS GUN Temp 1
+    //AIN1=CCS GUN Temp 2
+    //AIN2=CCS_Proximity/2
+    //AIN3=pilot voltage
+
+	if(AdcChannel == 3)
+	{
+		int fd,count,AvgTimes;
+		unsigned char SampleBuf[4];
+		float TmpVolt, MinSample, AvgSample = 0;
+
+		fd = open("/sys/bus/iio/devices/iio\:device0/in_voltage3_raw", O_RDONLY);
+	        if(fd > 0)
+	        {
+	            //system("echo 1 > /sys/class/gpio/gpio89/value");    //for test
+	            for(AvgTimes = 0; AvgTimes < 3; AvgTimes++) //period = 60~91 ms(renice -10, , CurrentDemand()) /*+++ 20200909, vern, extend detection time for interference ---*/
+	            {
+	                count = 0;
+	                MinSample = 2306;
+	                //system("echo 1 > /sys/class/gpio/gpio89/value");    //for test
+	                while(count < 40)  //period = 21~42ms  (renice -10, CurrentDemand())/*+++ 20200909, vern, extend detection time for interference ---*/
+	                {
+	                    //re-sampling period = 3~13ms (renice -10, SLAC())
+	                    //system("echo 1 > /sys/class/gpio/gpio89/value");    //for test
+	                    read(fd, SampleBuf, 4); //period = 3.2~10ms (renice -10, SLAC())
+	                    //system("echo 0 > /sys/class/gpio/gpio89/value");    //for test
+	                    TmpVolt = atoi(SampleBuf);
+	
+	                    if((TmpVolt < 2306) && (TmpVolt > 0))//positive voltage
+	                    {
+	                        if(TmpVolt < MinSample)
+	                        {
+	                            MinSample = TmpVolt;
+	                        }
+	                        count++;
+	                    }
+	                    lseek(fd, 0, SEEK_SET);
+	                }
+	                //system("echo 0 > /sys/class/gpio/gpio89/value");    //for test
+	                AvgSample += MinSample;
+	            }
+	            AvgSample /= AvgTimes;
+	            close(fd);
+	            //system("echo 0 > /sys/class/gpio/gpio89/value");    //for test
+	            return ((0.954-(1.8*AvgSample/4095))/0.06);
+	        }
+		else
+		{
+			return -1;
+		}
+	}
+	else
+	{
+		FILE *fp;
+		unsigned char str[64];
+		unsigned char AdcValue[8];
+
+		if(AdcChannel > 7)
+		{
+		    return -1;
+		}
+
+		memset(str,0,sizeof(str));
+		memset(AdcValue,0,sizeof(AdcValue));
+		sprintf(str, "cat /sys/bus/iio/devices/iio\\:device0/in_voltage%d_raw", AdcChannel);
+		fp=popen(str, "r");
+		if(fgets(AdcValue,sizeof(AdcValue),fp) == NULL)
+		{
+		    pclose(fp);
+		    return -1;
+		}
+		pclose(fp);
+		//Vin =  Vref *D / (2^n - 1)
+		return ((float)1.8*(float)atoi(AdcValue))/4095;
+	}
+
+}
+
+/*===========================================================================
+FUNCTION: ReadAdcVolt
+DESCRIPTION:
+    //AIN0=CCS GUN Temp 1
+    //AIN1=CCS GUN Temp 2
+    //AIN2=CCS_Proximity/2
+    //AIN3=pilot voltage
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+float ReadAdcVolt_PP_fork3()
+{
+    int fd, AvgTimes;
+    unsigned char SampleBuf[4];
+    float TmpVolt = 0;
+    float AvgSample = 0;
+    float V_pp = 0;
+
+    fd = open("/sys/bus/iio/devices/iio\:device0/in_voltage2_raw", O_RDONLY); //PP
+    if(fd > 0)
+    {
+        for(AvgTimes = 0; AvgTimes < 5; AvgTimes++) //get 5 samples
+        {
+            read(fd, SampleBuf, 4);
+            TmpVolt = atoi(SampleBuf);
+            lseek(fd, 0, SEEK_SET);
+
+            AvgSample += TmpVolt;
+        }
+        close(fd);
+        AvgSample /= AvgTimes;
+        V_pp = (3.6*AvgSample)/4095;    //PP
+
+        #if 0
+        printf("PP_adc = %.02f, PP_v = %.02f\n", AvgSample, V_pp);
+        usleep(3000000); //300ms
+        #endif
+        usleep(20000);  //20ms
+
+        return V_pp;
+    }
+    else
+    {
+        return -1;
+    }
+}
+
+/*===========================================================================
+FUNCTION: Qca7kPowerReset
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Qca7kPowerReset()
+{
+    //printf("\n[CCS Board]Reset QCA7000...\n");
+    system("echo 1 > /sys/class/gpio/gpio88/value");
+    usleep(500000);
+    system("echo 0 > /sys/class/gpio/gpio88/value");
+}
+
+/*===========================================================================
+FUNCTION: SwitchCpStateE
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int SwitchCpStateE(unsigned char OnOff)
+{
+    if((OnOff != ENABLE) && (OnOff != DISABLE))
+    {
+        return -1;
+    }
+
+    struct ChargingInfoData *ccs;
+    ccs = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    ccs->SwitchCpStateE_status = OnOff;
+
+    //OnOff = 1 => switch State to E
+    //OnOff = 0 => return noraml
+    #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+    {
+        if(OnOff == DISABLE)
+        {
+            //SAVE_SYS_LOG_MSG_EVCOMM("SwitchCpStateE: released\n");
+            CSUCOMMAC_SHM.CpSetStateE = DISABLE;
+        }
+        else
+        {
+            OutputCpPwmDuty(100); //set CP duty as 100, firstly.
+            CSUCOMMAC_SHM.CpSetStateE = ENABLE;
+            //SAVE_SYS_LOG_MSG_EVCOMM("SwitchCpStateE: enabled!\n");
+        }
+    }
+    #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
+    {
+        if(OnOff == DISABLE)
+        {
+            //SAVE_SYS_LOG_MSG_EVCOMM("SwitchCpStateE: released\n");
+            system("echo 0 > /sys/class/gpio/gpio86/value");
+        }
+        else
+        {
+            OutputCpPwmDuty(100); //set CP duty as 100, firstly.
+            system("echo 1 > /sys/class/gpio/gpio86/value");
+            //SAVE_SYS_LOG_MSG_EVCOMM("SwitchCpStateE: enabled!\n");
+        }
+    }
+    #endif
+
+    if (ccs->SwitchCpStateE_status_pre != ccs->SwitchCpStateE_status)
+    {
+        sprintf(buf_log_evcomm,
+                "SwitchCpStateE: %d >> %d",
+                ccs->SwitchCpStateE_status_pre,
+                ccs->SwitchCpStateE_status
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        ccs->SwitchCpStateE_status_pre = ccs->SwitchCpStateE_status;
+    }
+
+
+}
+
+/*===========================================================================
+FUNCTION: OutputCpPwmDuty
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int OutputCpPwmDuty(unsigned char Duty)
+{
+    int DutyInNanoSec;
+    struct ChargingInfoData *ccs;
+    ccs = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    if((Duty < 0)||(Duty > 100))
+    {
+        return -1;
+    }
+
+    #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+    {
+        CSUCOMMAC_SHM.CpSetPWMDuty = Duty;
+    }
+    #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
+    {
+        DutyInNanoSec = 10000 * Duty;
+        sprintf(buf_log_evcomm, "echo %d > /sys/class/pwm/pwmchip0/pwm0/duty_cycle", DutyInNanoSec);//nanoseconds
+        system(buf_log_evcomm);
+    }
+    #endif
+
+    ccs->CpDuty = Duty;
+
+    //CP Duty
+    if (ccs->CpDuty != ccs->CpDuty_pre)
+    {
+        //memset(buf_log_evcomm, 0, sizeof(buf_log_evcomm));
+        sprintf(buf_log_evcomm, "CP Duty: %d\% >> %d\%", ccs->CpDuty_pre, ccs->CpDuty);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+        ccs->CpDuty_pre = ccs->CpDuty;
+    }
+
+    return 0;
+}
+
+/*===========================================================================
+FUNCTION: Check_Plugin_Status_Update_fork1
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+//#if SAVE_SYS_LOG_MSG_EVCOMM_SWITCH == ENABLE
+void Check_Plugin_Status_Update_fork1(struct ChargingInfoData *ccs)
+{
+    if (ccs->ConnectorPlugIn != ccs->ConnectorPlugIn_new)
+    {
+        sprintf(buf_log_evcomm_fork1, "[fork1]Plugin: %d >> %d (CP=%.2fV, PP=%.2fV)",
+                ccs->ConnectorPlugIn,
+                ccs->ConnectorPlugIn_new,
+                ccs->CpVoltage,
+                ccs->PpVoltage
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork1);
+
+        ccs->ConnectorPlugIn_pre = ccs->ConnectorPlugIn;
+        ccs->ConnectorPlugIn = ccs->ConnectorPlugIn_new;
+        //ccs->CpVoltage_pre = ccs->CpVoltage;
+    }
+}
+//#endif
+
+/*===========================================================================
+FUNCTION: ConnectorPlugIn
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CheckConnectorPlugIn()
+{
+    //return 0 => unplug
+    //return 1 => plug-in
+
+    //float TmpProximity;
+    //unsigned char Rtn = 0;
+    static struct ChargingInfoData *ccs;
+    ccs = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    #if (CP_PROTECTION_MECHANISM == ENABLE)
+    return (int)ccs->ConnectorPlugIn;
+    #else
+    return TRUE;
+    #endif
+
+/*
+    // PP Detection
+    TmpProximity = ReadAdcVolt(ADC_CHANNEL_AIN2_PP);
+    //[CAUTION] This function takes a period of time to deal with.
+    //Designers should avoid to call it in main function, repeatly.
+
+    if(((FIRMWARE_VERSION & 0x0000FF00) >> 8) == 0x01)
+    {
+        //UL version: judge with CP and proximity
+        //TmpProximity = ReadAdcVolt(ADC_CHANNEL_AIN2_PP);
+        //SAVE_SYS_LOG_MSG_EVCOMM("Connector: UL");
+        if((ccs->CpState >= 2) &&
+           (ccs->CpState <= 5) &&
+           (TmpProximity >= 0.4) &&
+           (TmpProximity <= 0.9))
+        {
+            Rtn = 1;
+        }
+    }
+    else
+    {
+        //SAVE_SYS_LOG_MSG_EVCOMM("Connector: CE");
+        //CE version: judge with CP only
+        if((ccs->CpState >=2 ) &&
+           (ccs->CpState <=5 ))
+        {
+            Rtn = 1;
+        }
+    }
+*/
+    //CE version: judge with CP only
+    /*
+    if((ccs->CpState >= 2 ) &&
+       (ccs->CpState <= 5 ))
+    {
+        Rtn = TRUE;
+    }
+
+    ccs->ConnectorPlugIn = Rtn;
+    //ccs->PpVoltage = TmpProximity;
+    return Rtn;
+    */
+}
+
+/*===========================================================================
+FUNCTION: Check_CP_State_Error_fork1
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Check_CP_State_Error_fork1(struct ChargingInfoData *ccs)
+{
+    #if (CP_PROTECTION_MECHANISM == DISABLE)
+    {
+        return -1;
+    }
+    #endif
+
+    unsigned char state = 0;
+    double time_diff = 0;
+    state = Check_V2G_Flow_Status();
+
+    //SLAC, SLAAC, SDP, ..., ChargeParameterDiscovery
+    if (state >= CM_SLAC_PARM_CONF &&   //by considering 15118(SLAC first)
+        state < ChargeParameterDiscoveryRequest &&
+        state != IDLE &&
+        state != CM_SET_KEY_REQ &&
+        state != CM_SET_KEY_CNF &&
+        state != CM_VALIDATE_REQ &&
+        state != CM_VALIDATE_CNF)
+    {
+        #if (SLAC_FIRST_RESPONSE_METHOD == SET_5_PWM_ONCE_GET_PERMISSION_IN_AUTHORIZATIONRES)
+        {
+            if((ccs->CpState != 2) && (ccs->CpState != 3))
+            {
+                if (ccs->CpState_err == FALSE)
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[fork1][CP][Error]before CPD");    //CPD: ChargeParameterDiscoveryRequest
+                    //CPD: ChargeParameterDiscovery
+                }
+                ccs->CpState_err = TRUE;
+            }
+        }
+        #else
+        {
+            if(ccs->CpState != 3)
+            {
+                if (ccs->CpState_err == FALSE)
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[fork1][CP][Error]before CPD");    //CPD: ChargeParameterDiscoveryRequest
+                    //CPD: ChargeParameterDiscovery
+                }
+                ccs->CpState_err = TRUE;
+            }
+        }
+        #endif
+    }
+
+    #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+    {
+        //ChargeParameterDiscovery
+        if(state >= ChargeParameterDiscoveryRequest &&        //35
+           state <= ChargeParameterDiscoveryResponse)         //36
+        {
+            if(ccs->CpState != 3)
+            {
+                if (ccs->CpState_err == FALSE)
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[CP][Error]CPD");
+                    //PRC: Precharge
+                    //CUD: CurrentDemand
+                }
+                ccs->CpState_err = TRUE;
+            }
+        }
+
+        //ChargingStatus
+        if(state >= ChargingStatusRequest &&        //43
+           state <= ChargingStatusResponse)         //44
+        {
+            if(ccs->CpState != 4 && ccs->CpState != 5)
+            {
+                if (ccs->CpState_err == FALSE)
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[CP][Error]CGS");
+                    //PRC: Precharge
+                    //CUD: CurrentDemand
+                }
+                ccs->CpState_err = TRUE;
+            }
+        }
+    }
+    #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
+    {
+        //ChargeParameterDiscovery, CableCheck
+        if (state >= ChargeParameterDiscoveryRequest &&     //35
+            state <= CableCheckResponse)                    //38
+        {
+            if(ccs->CableCheckPreCountDownDone == FALSE &&
+            state >= CableCheckRequest)
+            {
+                ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_End);
+                time_diff = DiffTimeb_fork1_Error_Monitor(EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_Start, EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_End);
+                if(time_diff >= V2G_SECC_CP_Timeout_CableCheck)   //2 sec
+                {
+                    sprintf(buf_log_evcomm_fork1,
+                            "[fork1][CP]check C(4),D(5): ON (%.02lf of %dms)",
+                            time_diff,
+                            V2G_SECC_CP_Timeout_CableCheck);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork1);
+                    ccs->CableCheckPreCountDownDone = TRUE;
+                }
+            }
+
+            if(ccs->CableCheckPreCountDownDone == TRUE)
+            {
+                if(ccs->CpState != 4 && ccs->CpState != 5)
+                {
+                    if (ccs->CpState_err == FALSE)
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[CP][Error]CPD and CCK (after CNT)");
+                        //CPD: ChargeParameterDiscovery
+                        //CCK: CableCheck
+                        //CNT: count down
+                    }
+                    ccs->CpState_err = TRUE;
+                }
+            }
+            else
+            {
+                if(ccs->CpState != 3 && ccs->CpState != 4 && ccs->CpState != 5)
+                {
+                    if (ccs->CpState_err == FALSE)
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[CP][Error]CPD and CCK (before CNT)");
+                        //CPD: ChargeParameterDiscovery
+                        //CCK: CableCheck
+                        //CNT: count down
+                    }
+                    ccs->CpState_err = TRUE;
+                }
+            }
+        }
+
+        //Precharge, CurrentDemand
+        if(state >= PreChargeRequest &&      //39
+        state <= CurrentDemandResponse)   //46
+        {
+            if(ccs->CpState != 4 && ccs->CpState != 5)
+            {
+                if (ccs->CpState_err == FALSE)
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[CP][Error]PRC and CUD");
+                    //PRC: Precharge
+                    //CUD: CurrentDemand
+                }
+                ccs->CpState_err = TRUE;
+            }
+        }
+    }
+    #endif
+
+    if(ccs->CpState_err == TRUE && ccs->CpState_err_logged == FALSE)
+    {
+        OutputCpPwmDuty(100);
+        //system("echo 1 > /sys/class/gpio/gpio89/value");    //for test
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_CP_State_Error (023889)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+
+        Proc_EVStopRes(ShmInternalComm->FD_CAN_Socket);
+        sprintf(buf_log_evcomm_fork1, "[fork1][Erorr]CP(%d) Error in state %d(%d)",
+                ccs->CpState,
+                state,
+                ccs->CableCheckPreCountDownDone
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork1);
+        ccs->CpState_err_logged = TRUE;
+    }
+    return 0;
+}
+
+/*===========================================================================
+FUNCTION: Check_CP_State_Update_fork1
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+//#if SAVE_SYS_LOG_MSG_EVCOMM_SWITCH == ENABLE
+void Check_CP_State_Update_fork1(struct ChargingInfoData *ccs)
+{
+    //CP Voltage
+    /*
+    //Issues waiting to debug
+    //[CAUTION] This function shall not be used in charging state.
+    if (((int)(ccs->CpVoltage * 10)) != ((int)(ccs->CpVoltage_pre * 10)))
+    {
+        memset(buf, 0, sizeof(buf));
+        sprintf(buf, "CP Voltage: %.2lf >> %.2lf (%d >> %d)",
+                ccs->CpVoltage_pre,
+                ccs->CpVoltage,
+                (int)(ccs->CpVoltage_pre * 10),
+                (int)(ccs->CpVoltage * 10)
+               );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf);
+
+        ccs->CpVoltage_pre = ccs->CpVoltage;
+    }
+    */
+
+    //CP State
+    if (ccs->CpState != ccs->CpState_pre)
+    {
+        sprintf(buf_log_evcomm_fork1, "[fork1]CP State: %d >> %d (%.2fV)",
+                ccs->CpState_pre,
+                ccs->CpState,
+                ccs->CpVoltage
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork1);
+
+        ccs->CpState_pre = ccs->CpState;
+    }
+}
+//#endif
+
+/*===========================================================================
+FUNCTION: CP_Detection
+DESCRIPTION:
+        1. In order to detect CP in efficient response time, we creat an independent
+           thead for this procedure.
+
+        2. The priority of this thread is set as the same as other tasks.
+
+        3. fork1
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void CP_Detection()
+{
+    pid_t tmp = 0;
+ //   struct timeb StartTime, EndTime;
+    unsigned char Statetmp;
+    float TotalTmpVolt;
+    struct ChargingInfoData *ccs;
+
+    ccs = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    if(CP_Detection_Pid == 0)
+    {
+        tmp = fork();
+        if(tmp > 0)
+        {
+            CP_Detection_Pid = tmp;
+
+            #if 1
+            unsigned char buf[64];
+            memset(buf, 0, sizeof(buf));
+            //sprintf(buf, "renice -20 -p %d", tmp);
+            sprintf(buf, "renice -10 -p %d", tmp);
+            system(buf);
+            #endif
+
+            return;
+        }
+    }
+
+    while(1)
+    {
+        //ADC_Voltage = (1+RE62/RE63)*0.9 - (RE62/RE63)*Pilot_Voltage,  RE62/RE63=0.06
+        //=>Pilot_Voltage=(0.954-ADC_Voltage)/0.06
+
+        #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+        {
+            ccs->CpVoltage = ShmInternalComm->AC_CpPositiveVoltage;
+            ccs->CpState = ShmInternalComm->AC_CpPresentState;
+        }
+        #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
+        {
+            TotalTmpVolt = ReadAdcVolt(3);
+
+            ccs->CpVoltage = TotalTmpVolt;
+
+            if (ccs->CpVoltage_pre != ccs->CpVoltage)
+            {
+                ccs->CpVoltage_pre = ccs->CpVoltage;
+            }
+
+            //printf("TotalTmpVolt = %.02f\n", TotalTmpVolt);
+
+            //If CP voltage is higer than 13.5V
+            if(TotalTmpVolt >= 13.5)
+            {
+                //Pilot Error
+                if((ccs->CpState == 1) &&
+                (TotalTmpVolt < 13.75))
+                {
+                    //V_cp = 13.5 ~ 13.75
+                    Statetmp = 1;
+                }
+                else
+                {
+                    //V_cp = 13.5 ~
+                    Statetmp = 8;
+                }
+            }
+            else if((TotalTmpVolt >= 10.5) && (TotalTmpVolt < 13.5)) //V_cp = 10.5 ~ 13.5
+            {
+                //State A (12V)
+                if((ccs->CpState >= 2) &&
+                (ccs->CpState <= 3) &&
+                (TotalTmpVolt < 10.75))
+                {
+                    if((ccs->CpDuty >= 5) &&
+                    (ccs->CpDuty < 100))
+                    {
+                        Statetmp = 3;
+                    }
+                    else
+                    {
+                        Statetmp = 2;
+                    }
+                }
+                else if((ccs->CpState == 8) &&
+                        (TotalTmpVolt >= 13.25))
+                {
+                    Statetmp = 8;
+                }
+                else
+                {
+                    Statetmp = 1;
+                }
+            }
+            else if((TotalTmpVolt >= 7.5) && (TotalTmpVolt < 10.5))
+            {
+                //State B (9V)
+                if((ccs->CpState == 4) && (TotalTmpVolt < 7.75))
+                {
+                    Statetmp = 4;
+                }
+                else if((ccs->CpState == 1) && (TotalTmpVolt >= 10.25))
+                {
+                    Statetmp = 1;
+                }
+                else
+                {
+                    if((ccs->CpDuty >= 5) && (ccs->CpDuty < 100))
+                    {
+                        Statetmp = 3;
+                    }
+                    else
+                    {
+                        Statetmp = 2;
+                    }
+                }
+            }
+            else if((TotalTmpVolt >= 4.5) && (TotalTmpVolt < 7.5))
+            {
+                //State C (6V)
+                if((ccs->CpState == 5) && (TotalTmpVolt < 4.75))
+                {
+                    Statetmp = 5;
+                }
+                else if((ccs->CpState >= 2) && (ccs->CpState <= 3) && (TotalTmpVolt >= 7.25))
+                {
+                    if((ccs->CpDuty >= 5)&&(ccs->CpDuty < 100))
+                    {
+                        Statetmp = 3;
+                    }
+                    else
+                    {
+                        Statetmp = 2;
+                    }
+                }
+                else
+                {
+                    Statetmp = 4;
+                }
+            }
+            else if((TotalTmpVolt >= 1.5) && (TotalTmpVolt < 4.5))
+            {
+                //State D (3V)
+                if((ccs->CpState == 6)&&(TotalTmpVolt < 1.75))
+                {
+                    Statetmp = 6;
+                }
+                else if((ccs->CpState == 4)&&(TotalTmpVolt >= 4.25))
+                {
+                    Statetmp = 4;
+                }
+                else
+                {
+                    Statetmp = 5;
+                }
+            }
+            else if((TotalTmpVolt >= -1.5) && (TotalTmpVolt < 1.5)) //V_cp = -1.5V ~ 1.5V
+            {
+                //State E (0V)
+                if((ccs->CpState == 8) &&
+                (TotalTmpVolt < -1.25))
+                {
+                    Statetmp = 8;
+                }
+                else if((ccs->CpState == 5) &&
+                        (TotalTmpVolt >= 1.25))
+                {
+                    Statetmp = 5;
+                }
+                else
+                {
+                    Statetmp = 6;
+                }
+            }
+            else if((TotalTmpVolt >= -13.5) && (TotalTmpVolt < -10.5)) //V_cp = -10.5V ~ -13.5V
+            {
+                //State F (-12V)
+                if((ccs->CpState == 8) &&
+                (TotalTmpVolt >= -10.75))
+                {
+                    Statetmp = 8;
+                }
+                else
+                {
+                    Statetmp = 7;
+                }
+            }
+            else
+            {
+                //null
+            }
+
+            ccs->CpState = Statetmp;
+        }
+        #endif
+
+        Check_CP_State_Update_fork1(ccs);
+        Check_CP_State_Error_fork1(ccs);
+
+        //Updating Plugin status
+        #if (PP_PROTECTION_MECHANISM == ENABLE)
+        if((ccs->CpState >= 2 ) && (ccs->CpState <= 5 ) && (ccs->PpVoltage >= 1.0)) //PP >= 1.0V
+        #else
+        if((ccs->CpState >= 2 ) && (ccs->CpState <= 5 ))
+        #endif
+        {
+            ccs->ConnectorPlugIn_new = TRUE;
+        }
+        else
+        {
+            ccs->ConnectorPlugIn_new = FALSE;
+            OutputCpPwmDuty(100);
+        }
+
+        Check_Plugin_Status_Update_fork1(ccs);
+
+        //ftime(&EndTime);
+        //DEBUG_PRINTF_EVCOMM_DETAIL("duration:%.02lf\n", DiffTimeb(StartTime, EndTime));
+    }//while
+}
+
+/*===========================================================================
+FUNCTION: PP_Detection
+DESCRIPTION:
+    0. SeccComm fork3
+    1. In order to detect CP in efficient response time, we creat an independent
+       thead for this procedure.
+
+    2. The priority of this thread is set as the same as other tasks.
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PP_Detection()
+{
+    pid_t tmp = 0;
+ //   struct timeb StartTime, EndTime;
+    unsigned char Statetmp;
+    float TotalTmpVolt;
+
+    if(PP_Detection_Pid == 0)
+    {
+        tmp = fork();
+        if(tmp > 0)
+        {
+            PP_Detection_Pid = tmp;
+
+            #if 0
+            unsigned char buf[64];
+            memset(buf, 0, sizeof(buf));
+            sprintf(buf, "renice -10 -p %d", tmp);
+            system(buf);
+            #endif
+
+            return;
+        }
+    }
+	TotalTmpVolt = ReadAdcVolt_PP_fork3();
+    while(1)
+    {
+        TotalTmpVolt = ReadAdcVolt_PP_fork3();
+	
+        EVCOMM_SYS_INFO.PpVoltage = TotalTmpVolt;
+
+        if (EVCOMM_SYS_INFO.PpVoltage_pre != EVCOMM_SYS_INFO.PpVoltage)
+        {
+            if ((EVCOMM_SYS_INFO.PpVoltage_pre < 0.5 && EVCOMM_SYS_INFO.PpVoltage >= 1.0) ||
+                 (EVCOMM_SYS_INFO.PpVoltage_pre >= 1.0 && EVCOMM_SYS_INFO.PpVoltage < 0.5))
+            {
+            	// plug-in : > 1.0
+            	//unplug : <0.5
+                sprintf(buf_log_evcomm_fork3,
+                        "[fork3]PP(%.2f >> %.2fV)",
+                        EVCOMM_SYS_INFO.PpVoltage_pre,
+                        EVCOMM_SYS_INFO.PpVoltage
+                        );
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork3);
+                EVCOMM_SYS_INFO.PpVoltage_pre = EVCOMM_SYS_INFO.PpVoltage;
+            }
+        }
+
+        #if 0
+        sleep(5);
+        printf("V_pp = %.02f\n", TotalTmpVolt);
+        #endif
+    }//while
+}
+
+/*===========================================================================
+FUNCTION: Error_Monitor
+DESCRIPTION:
+    1. This function only works in SeccComm fork2.
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Error_Monitor()
+{
+    pid_t tmp = 0;
+    double time_diff = 0;
+    unsigned char status = 0;
+    struct ChargingInfoData *ccs;
+    ccs = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    if(Error_Monitor_Pid == 0)
+    {
+        tmp = fork();   //SeccComm fork2
+        if(tmp > 0)
+        {
+            Error_Monitor_Pid = tmp;
+
+            #if 0
+            unsigned char buf[64];
+            memset(buf, 0, sizeof(buf));
+            sprintf(buf, "renice -20 -p %d", tmp);
+            system(buf);
+            #endif
+
+            return;
+        }
+    }
+
+    while(1)
+    {
+        //Step 0
+        if (EVCOMM_SYS_INFO.End_Process_inused == TRUE)
+        {
+            //If the End_Process is in processing, disable Error_Monitor.
+            continue;
+        }
+
+        //Step1 1: Check and Response to Plugin Status
+        if(CheckConnectorPlugIn() == FALSE)
+        {
+            status = Check_V2G_Flow_Status();
+            if (status > IDLE &&
+                status < Performance_Timeout &&
+                status != CM_SET_KEY_REQ &&
+                status != CM_SET_KEY_CNF &&
+                EVCOMM_SYS_INFO.End_Process_inused == FALSE)
+            {
+                #if (CP_PROTECTION_MECHANISM == ENABLE)
+                //SAVE_SYS_LOG_MSG_EVCOMM("[fork2] Emergency Stop (due to Connector is plugged out during communication.)");
+                SAVE_SYS_LOG_MSG_EVCOMM("[fork2]Plug out Error => End_Process");
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_CP_State_Error (023889)
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+                End_Process();
+                #else
+                //SAVE_SYS_LOG_MSG_EVCOMM("CP_PROTECTION_MECHANISM is disabled. Emergency Stop: skipped" );
+                #endif
+            }
+        }
+
+
+        //Step 2: Check for V2G_SECC_Sequence_Timeout
+        //#if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+        #if 1
+        status = Check_V2G_Flow_Status();
+        if (status >= SupportedAppProtocolRequest &&
+            status < SessionStopRequest)
+        {
+            ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_End);
+            time_diff = DiffTimeb_fork2_Error_Monitor(EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start, EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_End);
+            if(time_diff > V2G_SECC_Sequence_Timeout)   //60s
+            {
+                sprintf(buf_log_evcomm_fork2,
+                        "[fork2]V2G_SECC_Sequence_Timeout in state %d - (%.02lf of %d ms)\n",
+                        status,
+                        time_diff,
+                        V2G_SECC_Sequence_Timeout);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork2);
+                Update_V2G_Flow_Status(Sequence_Timeout);
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_V2G_Sequence_Time (023844)
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 4;
+                End_Process();
+                break;
+            }
+            else if (time_diff > 4000) //4s
+            {
+                //Check for CSU command of "Stop by EVSE"
+                if (EVCOMM_SYS_INFO.DC_EVSEStatus == EVSE_Shutdown)
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error_Monitor]EVSE_Shutdown");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                else if (EVCOMM_SYS_INFO.DC_EVSEStatus == EVSE_EmergencyShutdown)
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error_Monitor]EVSE_EmergencyShutdown");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                else if (ShmInternalComm->ChargingPermission == FALSE)
+                {
+                    if (status >= ChargeParameterDiscoveryRequest)  //&& status < SessionStopRequest
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error_Monitor]ChargingPermission = FALSE");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                }
+                else
+                {
+                    //null
+                }
+            }
+            else
+            {
+                //null
+            }
+        }
+        #endif
+
+
+        //Step 3: Check and Response to Error V2gFlowStatus
+        status = Check_V2G_Flow_Status();
+        if (status == Performance_Timeout ||
+            status == Sequence_Timeout ||
+            status == Other_Fault)
+        {
+            sprintf(buf_log_evcomm_fork2,
+                    "[fork2]Timeout or Fault State(%d) => End_Process",
+                    status);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork2);
+            //Normal Stop
+            //alarm and duty to 100%
+            //OutputCpPwmDuty(100);
+            //SwitchCpStateE(ENABLE); //Set CP duty as 100% and set CP state as E (0V).
+            //[Joseph/ To-Do] Set State E (0V) via GPIO setting
+            End_Process();
+        }
+
+
+        //Step 4: Check and Response to CP State Error
+        if(ccs->CpState_err == TRUE)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[fork2]CP Error => End_Process");
+            Update_V2G_Flow_Status(Other_Fault);
+            //Update_ShmStatusCode(); //[To-Do] to be implemented
+            //CCS_SECC_CP_State_Error (023889)
+            ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+            ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+            ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+            ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+            ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+            ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+            CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+            End_Process();
+        }
+
+
+        //Step 5: Check and Response to Shutdown Commnad from CSU
+        if (EVCOMM_SYS_INFO.DC_EVSEStatus == EVSE_Shutdown ||
+            EVCOMM_SYS_INFO.DC_EVSEStatus == EVSE_EmergencyShutdown)
+        {
+            if (Check_V2G_Flow_Status() <= SLACC_SDP_TCP_Connection)
+            {
+                sprintf(buf_log_evcomm_fork2,
+                        "[fork2]EVSE Shutdown(%d) => End_Process",
+                        EVCOMM_SYS_INFO.DC_EVSEStatus);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork2);
+                Update_V2G_Flow_Status(Other_Fault);
+                End_Process();
+            }
+        }
+
+
+        //Step 6: Check and Response to SessionStop
+        status = Check_V2G_Flow_Status();
+        if (status == SessionStopResponse)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[fork2]SessionStopResponse => End_Process");
+            End_Process();
+        }
+
+        //Step 7: Check for ChargingPermission from TRUE to FALSE before V2G Messages
+        /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+        if ((ShmInternalComm->ChargingPermission == FALSE) &&
+            (ShmInternalComm->ChargingPermission_pre >=1) && 
+            (ccs->CpState >= 3) && (ccs->CpState <=5))
+        {
+            if (status >= CM_SLAC_PARM_REQ &&
+                status != CM_SET_KEY_REQ &&
+                status != CM_SET_KEY_CNF &&
+                status <= SLACC_SDP_TCP_Connection)
+            {
+                sprintf(buf_log_evcomm_fork2,
+                        "[fork2]Permission OFF before V2G msg(%d) => End_Process",
+                        ShmInternalComm->ChargingPermission);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork2);
+                Update_V2G_Flow_Status(Other_Fault);
+                End_Process();
+            }
+        }
+
+        //Step 8: DC OVP Protection
+        if (CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED &&
+            status > CableCheckResponse &&
+            status <= SessionStopRequest &&
+            status != ChargingStatusRequest &&
+            status != ChargingStatusResponse &&
+            EVCOMM_SYS_INFO.EvBatteryMaxVoltage != 0)
+        {
+            //Part A: OVP Protection
+            if (EVCOMM_SYS_INFO.PresentChargingVoltage >= (EVCOMM_SYS_INFO.EvBatteryMaxVoltage * 1.02)) // 2%
+            {
+                sprintf(buf_log_evcomm_fork2,
+                        "[fork2][Error]OVP => End_Process (%.02f > %.02f)",
+                        EVCOMM_SYS_INFO.PresentChargingVoltage,
+                        (EVCOMM_SYS_INFO.EvBatteryMaxVoltage * 1.02));
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork2);
+
+                Update_V2G_Flow_Status(Other_Fault);
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //System CCS output OVP (012219)
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+                Proc_EVStopRes(ShmInternalComm->FD_CAN_Socket);
+                End_Process();
+            }
+
+            //Part B: Over Voltage Request Protection
+            if (EVCOMM_SYS_INFO.EvBatterytargetVoltage >= (EVCOMM_SYS_INFO.EvBatteryMaxVoltage * 1.02))
+            {
+                sprintf(buf_log_evcomm_fork2,
+                        "[fork2]Over V Req => End_Process (%.02f > %.02f)",
+                        EVCOMM_SYS_INFO.EvBatterytargetVoltage,
+                        (EVCOMM_SYS_INFO.EvBatteryMaxVoltage * 1.02)
+                        );
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm_fork2);
+
+                Update_V2G_Flow_Status(Other_Fault);
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //System CCS output OVP (012219)
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+                Proc_EVStopRes(ShmInternalComm->FD_CAN_Socket);
+                End_Process();
+            }
+        }
+
+        //Step 9: Check 60V
+        /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+        if (CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED &&
+            ShmInternalComm->ChargingPermission >=1 && 
+            status < CableCheckRequest)
+        {
+            if (EVCOMM_SYS_INFO.PresentChargingVoltage >= 60)  //60V
+            {
+                SAVE_SYS_LOG_MSG_EVCOMM("[fork2]DC Output Voltage is over 60V => End_Process");
+                Update_V2G_Flow_Status(Other_Fault);
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_Unexpected_60V_Before_Charing_Error (023890)
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 9;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 0;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+                //Proc_EVStopRes(ShmInternalComm->FD_CAN_Socket);
+                End_Process();
+            }
+        }
+
+        //Step 10: Check if the connector is unplug from plugin
+        if (EVCOMM_SYS_INFO.ConnectorPlugIn_pre == TRUE && EVCOMM_SYS_INFO.ConnectorPlugIn == FALSE)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[fork2]Unplug Reset => End_Process");
+            Update_V2G_Flow_Status(Other_Fault);
+            End_Process();
+        }
+
+    }//while
+}
+
+
+/*===========================================================================
+FUNCTION: SendSetKey
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int SendSetKey()
+{
+    int i = 0;
+    unsigned char nRandValue = 0x0;
+    unsigned char ConstString[16] = "PhihongKey000000";
+
+    memset(&SendMmePacket,0,sizeof(struct MmeHeader));
+    memcpy(SendMmePacket.ODA,QcaMac,6);
+    memcpy(SendMmePacket.OSA,CsuMac,6);
+    SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+    SendMmePacket.MMV = 0x01;
+    SendMmePacket.MMTYPE = MMTYPE_CM_SET_KEY_REQ;
+    SendMmePacket.FMI[0] = SendMmePacket.FMI[1] = 0;
+    SendMmePacketSize = 0;
+    SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x01;//Fixed value (0x01) to indicate ��NMK��
+    memset(SendMmePacket.MMENTRY+SendMmePacketSize,0,4);//My Nonce, Fixed value(0x00000000), encrypted payload not used
+    SendMmePacketSize+=4;
+    memset(SendMmePacket.MMENTRY+SendMmePacketSize,0,4);//Your Nonce, Fixed value(0x00000000), encrypted payload not used
+    SendMmePacketSize+=4;
+    SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x04;//PID, Fixed value (0x04) to indicate ��HLE protocol��
+    memset(SendMmePacket.MMENTRY+SendMmePacketSize,0,2);//PRN, Fixed value(0x00), encrypted payload not used
+    SendMmePacketSize+=2;
+    SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x00;//PMN, Fixed value(0x00) encrypted payload not used
+    SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x01;//CCo Capablility
+    srand(time(NULL));
+    for (i = 10; i < 16; i++)
+    {
+        nRandValue = (rand()%62) + 1;
+        if((nRandValue>=0)&&(nRandValue<=9))  // 0 ~ 9
+        {
+            ConstString[i]= nRandValue + 0x30;
+        }
+        else if((nRandValue>=10)&&(nRandValue<=35)) // A ~ Z
+        {
+            ConstString[i]= nRandValue -10 + 0x41;
+        }
+        else if((nRandValue>=36)&&(nRandValue<=61)) // a ~ z
+        {
+            ConstString[i]= nRandValue -37 + 0x61;
+        }
+        else
+        {
+            ConstString[i]= 0x30;
+        }
+    }
+    memset(NewNmkKey,0,sizeof(NewNmkKey));
+    memset(Nid,0,sizeof(Nid));
+    HPAVKeyNMK(NewNmkKey, ConstString);
+    HPAVKeyNID(Nid,NewNmkKey,DEFAULT_LEVEL);
+    memcpy(SendMmePacket.MMENTRY+SendMmePacketSize,Nid,sizeof(Nid));    //NID, 54 LSBs contain the NID 2 MSBs = 0b00
+    SendMmePacketSize+=sizeof(Nid);
+    SendMmePacket.MMENTRY[SendMmePacketSize++]=0x01;//NewEKS,Fixed value (0x01)to indicate ��NMK��
+    memcpy(SendMmePacket.MMENTRY+SendMmePacketSize,NewNmkKey,sizeof(NewNmkKey));//NewKey
+    SendMmePacketSize += sizeof(NewNmkKey);
+    SendMmePacketSize += 19;  //the size before MMENTRY
+
+    SAVE_SYS_LOG_MSG_EVCOMM("[QCA7K][Tx]CM_SET_KEY_REQ");
+    i = sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+    Update_V2G_Flow_Status(CM_SET_KEY_REQ);
+    DEBUG_PRINTF_EVCOMM_DETAIL("SendSetKey: send size =%d\n",i);
+}
+
+
+/*===========================================================================
+FUNCTION: GetQca7kMac
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int GetQca7kMac()
+{
+    int i = 0;
+    struct QcaVendorMmeHeader SendPacket;
+
+    memset(&SendPacket, 0, sizeof(struct QcaVendorMmeHeader));
+    memset(SendPacket.ODA, 0xFF, 6);    //broadcast
+    memcpy(SendPacket.OSA, CsuMac, 6);
+    SendPacket.MTYPE = htons(EtherType_HomePlug);
+    SendPacket.MMV = 0x00;
+    SendPacket.MMTYPE = MMTYPE_VENDOR_VS_NW_INFO;
+    SendPacket.OUI[0] = 0x00;
+    SendPacket.OUI[1] = 0xB0;
+    SendPacket.OUI[2] = 0x52;
+
+    i = sendto(RawSock, &SendPacket, 20, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+
+    DEBUG_PRINTF_EVCOMM_DETAIL("GetQca7kMac: send size =%d\n", i);
+    SAVE_SYS_LOG_MSG_EVCOMM("[QCA7K][Tx][VENDOR_VS_NW_INFO]Req for QCA7K MacAddr");
+}
+
+
+
+/*===========================================================================
+FUNCTION: Array_Check_All_Zero
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+    result:
+    (1) TRUE: all zero
+    (2) FALSE: not all zero
+GLOBAL VARIABLES:
+=============================================================================*/
+int Array_Check_All_Zero(unsigned char *ptr, int size)
+{
+    int result = TRUE;
+    int i = 0;
+
+    for (i = 0; i < size; i++)
+    {
+        if (ptr[i] != 0)
+        {
+            result = FALSE;
+            break;
+        }
+    }
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: Array_Compare_Identity
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+    result = FALSE (not identical)
+    result = TRUE  (identical)
+GLOBAL VARIABLES:
+=============================================================================*/
+int Array_Compare_Identity(unsigned char *ptrA, unsigned char *ptrB, int size)
+{
+    int result = TRUE;
+    int i = 0;
+
+    for (i = 0; i < size; i++)
+    {
+        if (ptrA[i] != ptrB[i])
+        {
+            result = FALSE;
+
+            #if 0
+            sprintf(buf_log_evcomm,
+                    "[Array_Compare_Identity]%02X%02X%02X%02X%02X%02X,%02X%02X%02X%02X%02X%02X(%d)\n",
+                    ptrA[0], ptrA[1], ptrA[2], ptrA[3], ptrA[4], ptrA[5],
+                    ptrB[0], ptrB[1], ptrB[2], ptrB[3], ptrB[4], ptrB[5],
+                    result);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            #endif
+            break;
+        }
+    }
+    return result;
+}
+
+
+/*===========================================================================
+FUNCTION: SLAC_DB_Search_EvMac_idx
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+    idx = -1 (not found)
+GLOBAL VARIABLES:
+=============================================================================*/
+int SLAC_DB_Search_EvMac_idx(struct EVCC_SLAC_DATA_TYPE *evcc, unsigned char *EvMac_in)
+{
+    int idx = -1;
+    int i = 0;
+
+    if (evcc->arrayLen == 0)
+    {
+        //printf("[SLAC_DB_Search_EvMac_idx]arrayLen is empty (%d)\n", evcc->arrayLen);
+        //no need to search
+    }
+    else if (evcc->arrayLen > EVCC_SLAC_DATA_ARRAY_TYPE_ARRAY_SIZE)
+    {
+        //error
+        sprintf(buf_log_evcomm,
+                "[ERROR][SLAC_DB_Search_EvMac_idx]DB length(%d) > %d",
+                evcc->arrayLen,
+                EVCC_SLAC_DATA_ARRAY_TYPE_ARRAY_SIZE);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        evcc->arrayLen = 0; //reset
+    }
+    else
+    {
+        //start searching
+        for (i = 0; i < evcc->arrayLen; i++)
+        {
+            //printf("[SLAC_DB_Search_EvMac_idx]checking DB[%d]...\n", i);
+            if (Array_Compare_Identity(evcc->array[i].EvMac, EvMac_in, SLAC_EVMAC_LENGTH) == TRUE)
+            {
+                //printf("[SLAC_DB_Search_EvMac_idx]identical at DB[%d]...\n", i);
+                idx = i;
+                break;
+            }
+        }
+    }
+
+    //printf("[SLAC_DB_Search_EvMac_idx]return = %d\n", idx);
+    return idx;
+}
+
+/*===========================================================================
+FUNCTION: SLAC_DB_Check_EvMac_RunID_Matching
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+    res = FALSE (unmatched)
+    res = TRUE  (matched)
+GLOBAL VARIABLES:
+=============================================================================*/
+int SLAC_DB_Check_EvMac_RunID_Matching(struct EVCC_SLAC_DATA_TYPE *evcc, unsigned char *EvMac_in, unsigned char *RunID_in)
+{
+    int res = FALSE;
+    int idx = -1;
+
+    idx = SLAC_DB_Search_EvMac_idx(evcc, EvMac_in);
+
+    if (idx >= 0)
+    {
+        res = Array_Compare_Identity(evcc->array[idx].RunID, RunID_in, SLAC_RUNID_LENGTH);
+    }
+    else
+    {
+        //not found the EvMac data in DB
+        res = FALSE;
+    }
+
+    return res;
+}
+
+/*===========================================================================
+FUNCTION: SLAC_DB_Add
+DESCRIPTION:
+    1. Saving each CM_SLAC_PARM_REQ data into EVCC database if its
+       EvMac and RunID data are different, respectively.
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+    idx = saved index (must be a positive value)
+GLOBAL VARIABLES:
+=============================================================================*/
+int SLAC_DB_Add(unsigned char *EvMac_in, unsigned char *RunID_in)
+{
+    int idx = -1;
+
+    //Search if this EvMac and RunID already exists
+    idx = SLAC_DB_Search_EvMac_idx(&SLAC_INFO, EvMac_in);
+
+    if (idx < 0)   //not exist, yet.
+    {
+        if (SLAC_INFO.arrayLen < EVCC_SLAC_DATA_ARRAY_TYPE_ARRAY_SIZE)  //20
+        {
+            sprintf(buf_log_evcomm,
+                    "[SLAC_DB_Add]data does not exist => added to %d-th",
+                    SLAC_INFO.arrayLen);
+            DEBUG_PRINTF_EVCOMM_DETAIL(buf_log_evcomm);
+
+            if (SLAC_INFO.arrayLen >= 0)
+            {
+                memset(&SLAC_INFO.array[SLAC_INFO.arrayLen], 0, sizeof(struct EVCC_SLAC_DATA_ARRAY_TYPE));
+                memcpy(SLAC_INFO.array[SLAC_INFO.arrayLen].EvMac, EvMac_in, SLAC_EVMAC_LENGTH);
+                memcpy(SLAC_INFO.array[SLAC_INFO.arrayLen].RunID, RunID_in, SLAC_RUNID_LENGTH);
+                idx = SLAC_INFO.arrayLen;
+                SLAC_INFO.arrayLen++;
+            }
+            else
+            {
+                sprintf(buf_log_evcomm,
+                        "[ERROR][SLAC_DB_Add]arrayLen: unexpected(%d)",
+                        SLAC_INFO.arrayLen);
+                DEBUG_PRINTF_EVCOMM_DETAIL(buf_log_evcomm);
+
+                SLAC_INFO.arrayLen = 0;
+            }
+        }
+        else
+        {
+            //DB is full
+            sprintf(buf_log_evcomm,
+                    "[SLAC_DB_Add]DB is full(%d) => bypass",
+                    SLAC_INFO.arrayLen);
+            DEBUG_PRINTF_EVCOMM_DETAIL(buf_log_evcomm);
+        }
+    }
+    else
+    {
+        #if 0
+        sprintf(buf_log_evcomm,
+                "[SLAC_DB_Add]EvMac: existed (%d)",
+                idx);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #endif
+
+        //Check RunID
+        if (Array_Compare_Identity(SLAC_INFO.array[idx].RunID, RunID_in, SLAC_RUNID_LENGTH) == TRUE)
+        {
+            //RunID is the same
+            //SAVE_SYS_LOG_MSG_EVCOMM("[SLAC_DB_Add]RunID: same");
+        }
+        else
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[SLAC_DB_Add]RunID: diff");
+        }
+
+        //Reset all corresponding parameters
+        #if 0
+        sprintf(buf_log_evcomm,
+                "[SLAC_DB_Add]EvMac: reset para(%d)",
+                idx);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #endif
+
+        memset(&SLAC_INFO.array[idx], 0, sizeof(struct EVCC_SLAC_DATA_ARRAY_TYPE));
+        memcpy(SLAC_INFO.array[idx].EvMac, EvMac_in, SLAC_EVMAC_LENGTH);
+        memcpy(SLAC_INFO.array[idx].RunID, RunID_in, SLAC_RUNID_LENGTH);
+    }
+    return idx;
+}
+
+/*===========================================================================
+FUNCTION: SLAC_DB_Reset
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int SLAC_DB_Reset()
+{
+    memset(&SLAC_INFO, 0, sizeof(struct EVCC_SLAC_DATA_TYPE));
+    SAVE_SYS_LOG_MSG_EVCOMM("[SLAC_DB_Reset]DONE");
+}
+
+
+/*===========================================================================
+FUNCTION: MmeProcess
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int MmeProcess(unsigned char *Buffer, int DataLength)
+{
+	//struct ethhdr	*EthPacket;
+	struct MmeHeader *MmePacket;
+	static unsigned char counter;
+	unsigned char state = 0;
+	unsigned char *EvMac_in;
+	unsigned char *RunID_in;
+	int Rtn = 0;
+	int idx = 0;
+
+	MmePacket = (struct MmeHeader *)Buffer;
+	state = Check_V2G_Flow_Status();
+
+	#if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+	{
+		DEBUG_PRINTF_EVCOMM_DETAIL("\n\n***********************************\n");
+		DEBUG_PRINTF_EVCOMM_DETAIL("***** Received MME Packet *****\n");
+		DEBUG_PRINTF_EVCOMM_DETAIL("***********************************\n");
+		DEBUG_PRINTF_EVCOMM_DETAIL("DataLength=%d\n",DataLength);
+		DEBUG_PRINTF_EVCOMM_DETAIL("ODA: %02x:%02x:%02x:%02x:%02x:%02x\n", //Destination MAC Address
+		MmePacket->ODA[0], MmePacket->ODA[1],
+		MmePacket->ODA[2], MmePacket->ODA[3],
+		MmePacket->ODA[4], MmePacket->ODA[5]);
+		DEBUG_PRINTF_EVCOMM_DETAIL("OSA: %02x:%02x:%02x:%02x:%02x:%02x\n", //Source MAC Address (EV MAC)
+		MmePacket->OSA[0], MmePacket->OSA[1],
+		MmePacket->OSA[2], MmePacket->OSA[3],
+		MmePacket->OSA[4], MmePacket->OSA[5]);
+		DEBUG_PRINTF_EVCOMM_DETAIL("MTYPE: 0x%x\n", htons(MmePacket->MTYPE));
+		DEBUG_PRINTF_EVCOMM_DETAIL("MMV: 0x%x\n", MmePacket->MMV);
+		DEBUG_PRINTF_EVCOMM_DETAIL("MMTYPE: 0x%x\n", MmePacket->MMTYPE);
+		DEBUG_PRINTF_EVCOMM_DETAIL("FMI 0x%x, 0x%x\n",
+		MmePacket->FMI[0],MmePacket->FMI[1]);
+	}
+	#endif
+
+	#if (SLAC_FIRST_RESPONSE_METHOD == SET_NO_PWM_IF_NOT_GET_PERMISSION)
+	{
+		//Check CP as 5%
+		if (EVCOMM_SYS_INFO.CpState != 3 &&
+		EVCOMM_SYS_INFO.CpState != 4 &&
+		MmePacket->MMTYPE != MMTYPE_CM_SET_KEY_CNF &&
+		MmePacket->MMTYPE != MMTYPE_VENDOR_VS_HOST_ACTION &&
+		MmePacket->MMTYPE != MMTYPE_VENDOR_ATTEN_CHAR &&
+		MmePacket->MMTYPE != MMTYPE_VENDOR_VS_NW_INFO_CNF
+		)
+		{
+			//SAVE_SYS_LOG_MSG_EVCOMM("[SLAC]ignored(wrong CP state)");
+			return 0;
+		}
+	}
+	#endif
+
+    	//[To-Do] Adding a pre-check filter mechanism for Source and Destination MAC Address
+
+    	//check if the destination address is broadcast or EVSE itself, it can be ignore if not belong to itself.
+	switch(MmePacket->MMTYPE)
+	{
+	    case MMTYPE_CM_SET_KEY_CNF:
+		{
+	        DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_SET_KEY_CNF ---\n");
+	        DEBUG_PRINTF_EVCOMM_DETAIL("Result: 0x%x\n", MmePacket->MMENTRY[0]);
+	
+	        SAVE_SYS_LOG_MSG_EVCOMM("[QCA7K][Rx]CM_SET_KEY_CNF (SetKey: DONE)");
+	        Update_V2G_Flow_Status(CM_SET_KEY_CNF);
+	        break;
+		}
+	
+	    case MMTYPE_CM_SLAC_PARM_REQ:
+		{
+	        //Check QCA7000 status
+	        if (EVCOMM_SYS_INFO.QCA7K_SetKeyDone == FALSE)
+	        {
+	            //SAVE_SYS_LOG_MSG_EVCOMM("[SLAC][Rx]CM_SLAC_PARM_REQ: ignored(QCA7K init...)");
+	            break;
+	        }
+	
+	        //Check error state
+	        state = Check_V2G_Flow_Status();
+	        if (state == Performance_Timeout ||     //253
+	            state == Sequence_Timeout ||        //254
+	            state == Other_Fault)               //255
+	        {
+	            SAVE_SYS_LOG_MSG_EVCOMM("[SLAC][Rx]CM_SLAC_PARM_REQ: ignored(in error state)");
+				break;
+	        }
+	
+	        //Printing EV MAC Address
+	        SAVE_SYS_LOG_MSG_EVCOMM("[SLAC][Rx]CM_SLAC_PARM_REQ");
+	
+	        //Avoid Coupled SLAC_PARM_REQ
+	        if (CheckConnectorPlugIn() == FALSE)  //12V(State 1)
+	        {
+	            #if 0
+	            sprintf(buf_log_evcomm,
+	                    "[WARNING][SLAC][Rx]CM_SLAC_PARM_REQ: ignored(coupled SLAC,%d)",
+	                    CheckConnectorPlugIn());
+	            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	            #endif
+	            break;
+	        }
+	
+	        //[TC_SECC_VTB_CmSlacParm_003] SECURITY_TYPE needs to be 0x00 (no security)
+	        if (MmePacket->MMENTRY[1] != 0)
+	        {
+	            sprintf(buf_log_evcomm,
+	                    "[WARNING][SLAC][Rx]CM_SLAC_PARM_REQ: ignored(invalid SECURITY_TYPE,%d)", //Source MAC Address (EV MAC)
+	                    MmePacket->MMENTRY[1]);
+	            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	            break;
+	        }
+	
+	        //=================== Legal CM_SLAC_PARM_REQ Zone =================
+	
+	        Update_V2G_Flow_Status(CM_SLAC_PARM_REQ);
+	
+	        #if (SLAC_FIRST_RESPONSE_METHOD == SET_5_PWM_ONCE_RX_CM_SLAC_PARM_REQ)
+	        {
+	            //Once receiving CM_SLAC_PARM_REQ, set PWM as 5%
+	            SwitchCpStateE(DISABLE);
+	            OutputCpPwmDuty(5);
+	        }
+	        #endif
+	
+	        //Checking if this SLAC Req comes before 5% PWM (for 15118)
+	        if(ShmInternalComm->ChargingPermission == FALSE)
+	        {
+	            //Sniffer_Tcpdump(ENABLE);
+	            sprintf(buf_log_evcomm, "Check Permission: %d (SLAC first => START)", ShmInternalComm->ChargingPermission);
+	            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	        }
+	
+	        #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+	        {
+	            DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_SLAC_PARM_REQ ---\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", MmePacket->MMENTRY[0]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", MmePacket->MMENTRY[1]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+	                MmePacket->MMENTRY[2], MmePacket->MMENTRY[3],
+	                MmePacket->MMENTRY[4], MmePacket->MMENTRY[5],
+	                MmePacket->MMENTRY[6], MmePacket->MMENTRY[7],
+	                MmePacket->MMENTRY[8], MmePacket->MMENTRY[9]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("CipherSuiteSetSize: 0x%x\n", MmePacket->MMENTRY[10]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("CipherSuite [1]: 0x%x,0x%x\n",
+	                MmePacket->MMENTRY[11], MmePacket->MMENTRY[12]);
+	        }
+	        #endif
+	
+	        #if (NEW_SLAC_ARCHITECTURE_SWITCH == ENABLE)
+	        {
+	            //Saving each CM_SLAC_PARM_REQ data into EVCC database
+	            EvMac_in = &MmePacket->OSA[0];
+	            RunID_in = &MmePacket->MMENTRY[2];
+	            idx = SLAC_DB_Add(EvMac_in, RunID_in); //(EvMac, RunID)
+	
+	            if (idx < 0)
+	            {
+	                sprintf(buf_log_evcomm,
+	                        "[WARNING][CM_SLAC_PARM_REQ]DB is full or errors occour(%d) => ignore",
+	                        idx);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                break;
+	            }
+	
+	            //Select the 1st EV MAC address
+	            if (SLAC_INFO.arrayLen == 1)   //1st Req
+	            {
+	                #if 1
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][Rx]CM_SLAC_PARM_REQ[%d](%02X:%02X:%02X:%02X:%02X:%02X,%02X%02X%02X%02X%02X%02X%02X%02X):selected",
+	                        (idx + 1),
+	                        MmePacket->OSA[0], MmePacket->OSA[1], MmePacket->OSA[2], MmePacket->OSA[3], MmePacket->OSA[4], MmePacket->OSA[5],
+	                        MmePacket->MMENTRY[2], MmePacket->MMENTRY[3], MmePacket->MMENTRY[4], MmePacket->MMENTRY[5],
+	                        MmePacket->MMENTRY[6], MmePacket->MMENTRY[7], MmePacket->MMENTRY[8], MmePacket->MMENTRY[9]);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                #endif
+	                /*
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][EVMAC][%d-th]%02X:%02X:%02X:%02X:%02X:%02X (selected)", //Source MAC Address (EV MAC)
+	                        SLAC_INFO.arrayLen,
+	                        MmePacket->OSA[0], MmePacket->OSA[1],
+	                        MmePacket->OSA[2], MmePacket->OSA[3],
+	                        MmePacket->OSA[4], MmePacket->OSA[5]);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][RunID][%d-th]%02X%02X%02X%02X%02X%02X%02X%02X (selected)", //RunID (from EVCC)
+	                        SLAC_INFO.arrayLen,
+	                        MmePacket->MMENTRY[2], MmePacket->MMENTRY[3],
+	                        MmePacket->MMENTRY[4], MmePacket->MMENTRY[5],
+	                        MmePacket->MMENTRY[6], MmePacket->MMENTRY[7],
+	                        MmePacket->MMENTRY[8], MmePacket->MMENTRY[9]);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                */
+	            }
+	            else    //2nd Req
+	            {
+	                #if 1
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][Rx]CM_SLAC_PARM_REQ[%d](%02X:%02X:%02X:%02X:%02X:%02X,%02X%02X%02X%02X%02X%02X%02X%02X):not selected",
+	                        (idx + 1),
+	                        MmePacket->OSA[0], MmePacket->OSA[1], MmePacket->OSA[2], MmePacket->OSA[3], MmePacket->OSA[4], MmePacket->OSA[5],
+	                        MmePacket->MMENTRY[2], MmePacket->MMENTRY[3], MmePacket->MMENTRY[4], MmePacket->MMENTRY[5],
+	                        MmePacket->MMENTRY[6], MmePacket->MMENTRY[7], MmePacket->MMENTRY[8], MmePacket->MMENTRY[9]);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                #endif
+	                /*
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][EVMAC][%d-th]%02X:%02X:%02X:%02X:%02X:%02X (not selected)", //Source MAC Address (EV MAC)
+	                        SLAC_INFO.arrayLen,
+	                        MmePacket->OSA[0], MmePacket->OSA[1],
+	                        MmePacket->OSA[2], MmePacket->OSA[3],
+	                        MmePacket->OSA[4], MmePacket->OSA[5]);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][RunID][%d-th]%02X%02X%02X%02X%02X%02X%02X%02X (not selected)", //RunID (from EVCC)
+	                        SLAC_INFO.arrayLen,
+	                        MmePacket->MMENTRY[2], MmePacket->MMENTRY[3],
+	                        MmePacket->MMENTRY[4], MmePacket->MMENTRY[5],
+	                        MmePacket->MMENTRY[6], MmePacket->MMENTRY[7],
+	                        MmePacket->MMENTRY[8], MmePacket->MMENTRY[9]);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                */
+	            }
+	            memcpy(EvMac, MmePacket->OSA, sizeof(EvMac));
+	            memcpy(DestSocketAddress.sll_addr, MmePacket->OSA, SLAC_EVMAC_LENGTH);
+	            memcpy(SlacRunId, MmePacket->MMENTRY + 2, SLAC_RUNID_LENGTH);
+	            memset(&SendMmePacket, 0, sizeof(struct MmeHeader));
+	            memcpy(SendMmePacket.ODA, MmePacket->OSA, 6);
+	            memcpy(SendMmePacket.OSA, CsuMac, 6);
+	            SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+	            SendMmePacket.MMV = MmePacket->MMV;
+	            SendMmePacket.MMTYPE = MMTYPE_CM_SLAC_PARM_CNF;
+	            SendMmePacket.FMI[0] = SendMmePacket.FMI[1] = 0;
+	            SendMmePacketSize = 0;
+	            memset(SendMmePacket.MMENTRY, 0xFF, 6); //M-SOUND_TARGET(6-byte:0xFFFFFFFFFFFF): Fixed value indicating that M-Sounds to be sent as Ethernet broadcast
+	            SendMmePacketSize += 6;
+	            SendMmePacket.MMENTRY[SendMmePacketSize++] = C_EV_match_MNBC; //NUM_SOUNDS(0x0A): Number of M-Sounds to be transmitted by the EV GP Station during the SLAC process
+	            SendMmePacket.MMENTRY[SendMmePacketSize++] = 6; //Time_Out(0x06): unit = 100ms
+	            SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x01; //RESP_TYPE(0x01): Fixed value indicating Other GP station, 0x00 V HLE of the STA, 0x01 V Another GP STA, 0x02 V 0xFF V Reserved
+	            memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, SLAC_INFO.array[idx].EvMac, 6); //FORWARDING_STA(MAC Address of the EV HLE)
+	            SendMmePacketSize += 6;
+	            SendMmePacket.MMENTRY[SendMmePacketSize++] = 0; //APPLICATION_TYPE(0x00): 0x00(PEV-EVSE Association), 0x01-0xFF(Reserved)
+	            SendMmePacket.MMENTRY[SendMmePacketSize++] = 0; //SECURITY_TYPE(0x00): 0x00(No Security), 0x01(Public Key Signature), 0x02-0xFF(Reserved)
+	            memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, SlacRunId, SLAC_RUNID_LENGTH); //RunID (8-byte)
+	            SendMmePacketSize += SLAC_RUNID_LENGTH;
+	            SendMmePacketSize += 19;      //the size before MMENTRY
+	
+	            #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n\n***** Response MME Packet *****\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.ODA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+	                       SendMmePacket.ODA[0],SendMmePacket.ODA[1],SendMmePacket.ODA[2],SendMmePacket.ODA[3],SendMmePacket.ODA[4],SendMmePacket.ODA[5]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.OSA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+	                       SendMmePacket.OSA[0],SendMmePacket.OSA[1],SendMmePacket.OSA[2],SendMmePacket.OSA[3],SendMmePacket.OSA[4],SendMmePacket.OSA[5]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("MTYPE: 0x%x\n", htons(SendMmePacket.MTYPE));
+	                DEBUG_PRINTF_EVCOMM_DETAIL("MMV: 0x%x\n", SendMmePacket.MMV);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("MMTYPE: 0x%x\n", SendMmePacket.MMTYPE);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("FMI 0x%x, 0x%x\n", SendMmePacket.FMI[0],SendMmePacket.FMI[1]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("--- CM_SLAC_PARM_CNF ---\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("M-SOUND_TARGET: %02x:%02x:%02x:%02x:%02x:%02x\n",
+	                       SendMmePacket.MMENTRY[0],SendMmePacket.MMENTRY[1],SendMmePacket.MMENTRY[2],SendMmePacket.MMENTRY[3],
+	                       SendMmePacket.MMENTRY[4],SendMmePacket.MMENTRY[5]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("NUM_SOUNDS: 0x%x\n", SendMmePacket.MMENTRY[6]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("Time_Out: 0x%x\n", SendMmePacket.MMENTRY[7]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("RESP_TYPE: 0x%x\n", SendMmePacket.MMENTRY[8]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("M-FORWARDING_STA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+	                       SendMmePacket.MMENTRY[9],SendMmePacket.MMENTRY[10],SendMmePacket.MMENTRY[11],SendMmePacket.MMENTRY[12],
+	                       SendMmePacket.MMENTRY[13],SendMmePacket.MMENTRY[14]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", SendMmePacket.MMENTRY[15]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", SendMmePacket.MMENTRY[16]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+	                       SendMmePacket.MMENTRY[17],SendMmePacket.MMENTRY[18],SendMmePacket.MMENTRY[19],SendMmePacket.MMENTRY[20],
+	                       SendMmePacket.MMENTRY[21],SendMmePacket.MMENTRY[22],SendMmePacket.MMENTRY[23],SendMmePacket.MMENTRY[24]);
+	            }
+	            #endif
+	
+	            Update_V2G_Flow_Status(CM_SLAC_PARM_CONF);
+	            Rtn = sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+	
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacketSize=%d,Rtn=%d\n",SendMmePacketSize,Rtn);
+	
+	            ftime(&SeqStartTime);
+	            break;
+	        }
+	        #else
+	        {
+	            memcpy(EvMac, MmePacket->OSA, sizeof(EvMac));
+	            memcpy(DestSocketAddress.sll_addr, MmePacket->OSA, sizeof(EvMac));
+	            memcpy(SlacRunId,MmePacket->MMENTRY + 2, sizeof(SlacRunId));
+	            memset(&SendMmePacket, 0, sizeof(struct MmeHeader));
+	            memcpy(SendMmePacket.ODA, MmePacket->OSA, 6);
+	            memcpy(SendMmePacket.OSA, CsuMac, 6);
+	            SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+	            SendMmePacket.MMV = MmePacket->MMV;
+	            SendMmePacket.MMTYPE = MMTYPE_CM_SLAC_PARM_CNF;
+	            SendMmePacket.FMI[0] = SendMmePacket.FMI[1] = 0;
+	            SendMmePacketSize = 0;
+	            memset(SendMmePacket.MMENTRY, 0xFF, 6); //M-SOUND_TARGET(6-byte:0xFFFFFFFFFFFF): Fixed value indicating that M-Sounds to be sent as Ethernet broadcast
+	            SendMmePacketSize += 6;
+	            SendMmePacket.MMENTRY[SendMmePacketSize++] = C_EV_match_MNBC; //NUM_SOUNDS(0x0A): Number of M-Sounds to be transmitted by the EV GP Station during the SLAC process
+	            SendMmePacket.MMENTRY[SendMmePacketSize++] = 6; //Time_Out(0x06): unit = 100ms
+	            SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x01; //RESP_TYPE(0x01): Fixed value indicating Other GP station, 0x00 V HLE of the STA, 0x01 V Another GP STA, 0x02 V 0xFF V Reserved
+	            memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, EvMac, 6); //FORWARDING_STA(MAC Address of the EV HLE)
+	            SendMmePacketSize += 6;
+	            SendMmePacket.MMENTRY[SendMmePacketSize++] = 0; //APPLICATION_TYPE(0x00): 0x00(PEV-EVSE Association), 0x01-0xFF(Reserved)
+	            SendMmePacket.MMENTRY[SendMmePacketSize++] = 0; //SECURITY_TYPE(0x00): 0x00(No Security), 0x01(Public Key Signature), 0x02-0xFF(Reserved)
+	            memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, SlacRunId, sizeof(SlacRunId)); //RunID (8-byte)
+	            SendMmePacketSize += sizeof(SlacRunId);
+	            SendMmePacketSize += 19;      //the size before MMENTRY
+	
+	            #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n\n***** Response MME Packet *****\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.ODA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+	                       SendMmePacket.ODA[0],SendMmePacket.ODA[1],SendMmePacket.ODA[2],SendMmePacket.ODA[3],SendMmePacket.ODA[4],SendMmePacket.ODA[5]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.OSA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+	                       SendMmePacket.OSA[0],SendMmePacket.OSA[1],SendMmePacket.OSA[2],SendMmePacket.OSA[3],SendMmePacket.OSA[4],SendMmePacket.OSA[5]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("MTYPE: 0x%x\n", htons(SendMmePacket.MTYPE));
+	                DEBUG_PRINTF_EVCOMM_DETAIL("MMV: 0x%x\n", SendMmePacket.MMV);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("MMTYPE: 0x%x\n", SendMmePacket.MMTYPE);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("FMI 0x%x, 0x%x\n", SendMmePacket.FMI[0],SendMmePacket.FMI[1]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("--- CM_SLAC_PARM_CNF ---\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("M-SOUND_TARGET: %02x:%02x:%02x:%02x:%02x:%02x\n",
+	                       SendMmePacket.MMENTRY[0],SendMmePacket.MMENTRY[1],SendMmePacket.MMENTRY[2],SendMmePacket.MMENTRY[3],
+	                       SendMmePacket.MMENTRY[4],SendMmePacket.MMENTRY[5]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("NUM_SOUNDS: 0x%x\n", SendMmePacket.MMENTRY[6]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("Time_Out: 0x%x\n", SendMmePacket.MMENTRY[7]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("RESP_TYPE: 0x%x\n", SendMmePacket.MMENTRY[8]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("M-FORWARDING_STA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+	                       SendMmePacket.MMENTRY[9],SendMmePacket.MMENTRY[10],SendMmePacket.MMENTRY[11],SendMmePacket.MMENTRY[12],
+	                       SendMmePacket.MMENTRY[13],SendMmePacket.MMENTRY[14]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", SendMmePacket.MMENTRY[15]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", SendMmePacket.MMENTRY[16]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+	                       SendMmePacket.MMENTRY[17],SendMmePacket.MMENTRY[18],SendMmePacket.MMENTRY[19],SendMmePacket.MMENTRY[20],
+	                       SendMmePacket.MMENTRY[21],SendMmePacket.MMENTRY[22],SendMmePacket.MMENTRY[23],SendMmePacket.MMENTRY[24]);
+	            }
+	            #endif
+	
+	            Rtn = sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+	            Update_V2G_Flow_Status(CM_SLAC_PARM_CONF);
+	
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacketSize=%d,Rtn=%d\n",SendMmePacketSize,Rtn);
+	
+	            ftime(&SeqStartTime);
+	            counter = 0;
+	            break;
+	        }
+	        #endif
+		}
+	
+	    case MMTYPE_CM_START_ATTEN_CHAR_IND:
+		{
+	        if(V2gFlowStatus >= CM_ATTEN_CHAR_IND)
+	        {
+	            SAVE_SYS_LOG_MSG_EVCOMM("[WARNING][SLAC][Rx]CM_START_ATTEN_CHAR_IND: ignored(timeup)");
+	            break;
+	        }
+	
+	        //Avoid Coupled CM_START_ATTEN_CHAR_IND
+	        if (CheckConnectorPlugIn() == FALSE)  //12V(State 1)
+	        {
+	            sprintf(buf_log_evcomm,
+	                    "[WARNING][SLAC][Rx]CM_START_ATTEN_CHAR_IND: ignored(coupled SLAC,%d)",
+	                    CheckConnectorPlugIn());
+	            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	            break;
+	        }
+	
+	        #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+	        {
+	            DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_START_ATTEN_CHAR_IND (counter : %d/3 ) ---\n",counter + 1);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", MmePacket->MMENTRY[0]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", MmePacket->MMENTRY[1]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("NUM_SOUNDS: 0x%x\n", MmePacket->MMENTRY[2]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("Time_Out 0x%x\n", MmePacket->MMENTRY[3]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("RESP_TYPE 0x%x\n", MmePacket->MMENTRY[4]);    //Fixed value (0x01) indicating other Green PHY station
+	            DEBUG_PRINTF_EVCOMM_DETAIL("FORWARDING_STA: %02x:%02x:%02x:%02x:%02x:%02x\n",
+	                   MmePacket->MMENTRY[5],MmePacket->MMENTRY[6],MmePacket->MMENTRY[7],MmePacket->MMENTRY[8],
+	                   MmePacket->MMENTRY[9],MmePacket->MMENTRY[10]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+	                   MmePacket->MMENTRY[11],MmePacket->MMENTRY[12],MmePacket->MMENTRY[13],MmePacket->MMENTRY[14],
+	                   MmePacket->MMENTRY[15],MmePacket->MMENTRY[16],MmePacket->MMENTRY[17],MmePacket->MMENTRY[18]);
+	        }
+	        #endif
+	
+	        //New SLAC architecture designed by Joseph
+	        #if (NEW_SLAC_ARCHITECTURE_SWITCH == ENABLE)
+	        {
+	            EvMac_in = &MmePacket->OSA[0];
+	            RunID_in = &MmePacket->MMENTRY[11];
+	            idx = SLAC_DB_Search_EvMac_idx(&SLAC_INFO, EvMac_in);
+	
+	            if (idx >= 0)
+	            {
+	                Update_V2G_Flow_Status(CM_START_ATTEN_CHAR_IND);
+	
+	                //[TC_SECC_VTB_AttenuationCharacterization_013]
+	                if (MmePacket->MMENTRY[0] != 0) //APPLICATION_TYPE must be 0x00(EV-EVSE Matching)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[WARNING][SLAC][Rx][CM_START_ATTEN_CHAR_IND]APPLICATION_TYPE(%d): invalid => ignore Req",
+	                            MmePacket->MMENTRY[0]);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    break;
+	                }
+	
+	                //[TC_SECC_VTB_AttenuationCharacterization_014]
+	                if (MmePacket->MMENTRY[1] != 0) //SECURITY_TYPE must be 0x00(No Security)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[WARNING][SLAC][Rx][CM_START_ATTEN_CHAR_IND]SECURITY_TYPE(%d): invalid => ignore Req",
+	                            MmePacket->MMENTRY[1]);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    break;
+	                }
+	
+	                //[TC_SECC_VTB_AttenuationCharacterization_017]
+	                if (MmePacket->MMENTRY[4] != 0x01) //RESP_TYPE must be 0x01(Send to another GP STA(EV))
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[WARNING][SLAC][Rx][CM_START_ATTEN_CHAR_IND]RESP_TYPE(%d): invalid => ignore Req",
+	                            MmePacket->MMENTRY[4]);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    break;
+	                }
+	
+	                //[TC_SECC_VTB_AttenuationCharacterization_021]
+	                //FORWARDING_STA: MAC Address of the EV HLE (station which the measurement results shall be sent to)
+	                if (Array_Compare_Identity(EvMac_in, &MmePacket->MMENTRY[5], SLAC_EVMAC_LENGTH) == FALSE)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[WARNING][SLAC][Rx][CM_START_ATTEN_CHAR_IND]FORWARDING_STA(%02X:%02X:%02X:%02X:%02X:%02X): invalid => ignore Req",
+	                            MmePacket->MMENTRY[5], MmePacket->MMENTRY[6],
+	                            MmePacket->MMENTRY[7], MmePacket->MMENTRY[8],
+	                            MmePacket->MMENTRY[9], MmePacket->MMENTRY[10]);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+	                    SLAC_INFO.array[idx].StartAttenCharErr = TRUE;
+	                    break;
+	                }
+	
+	                //Check RunID
+	                if (SLAC_DB_Check_EvMac_RunID_Matching(&SLAC_INFO, EvMac_in, RunID_in) == TRUE)
+	                {
+	                    SLAC_INFO.array[idx].MnbcSoundNum = MmePacket->MMENTRY[2];
+	                    SLAC_INFO.array[idx].StartAttenCharCnt++;
+	
+	                    #if 0
+	                    sprintf(buf_log_evcomm,
+	                            "[SLAC][Rx]CM_START_ATTEN_CHAR_IND[%d]:%d-th",
+	                            (idx + 1),
+	                            SLAC_INFO.array[idx].StartAttenCharCnt);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    #endif
+	
+	                    if (SLAC_INFO.array[idx].StartAttenCharCnt == 1)
+	                    {
+	                        memset(SLAC_INFO.array[idx].AAG, 0, sizeof(SLAC_INFO.array[idx].AAG));
+	                        SLAC_INFO.array[idx].AttenProfileCnt = 0;
+	                        ftime(&SeqStartTime);       //start TT_EVSE_match_MNBC
+	                    }
+	                    else if (SLAC_INFO.array[idx].StartAttenCharCnt >= 3)
+	                    {
+	                        sprintf(buf_log_evcomm,
+	                                "[WARNING][SLAC][Rx][CM_START_ATTEN_CHAR_IND]counter(%d): unexpected",
+	                                SLAC_INFO.array[idx].StartAttenCharCnt);
+	                    }
+	                    else
+	                    {
+	                        //null
+	                    }
+	                }
+	                else
+	                {
+	                    //This RunID is not matched with this EvMac,
+	                    //or this RunID is not found in DB.
+	                    sprintf(buf_log_evcomm,
+	                            "[WARNING][SLAC][Rx][CM_START_ATTEN_CHAR_IND]EvMac-RunID: unmatched => ignore Req");
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+	                    //Response: ignore
+	                }
+	            }
+	            else
+	            {
+	                //this msg source is not in database
+	                //ignore
+	            }
+	            break;
+	        }
+	        #else   //Old SLAC architecture designed by Vern
+	        {
+	            MnbcSoundNum = MmePacket->MMENTRY[2];
+	            Update_V2G_Flow_Status(CM_START_ATTEN_CHAR_IND);
+	            counter++;
+	            if(counter == 1)
+	            {
+	                memset(Aag, 0, sizeof(Aag));
+	                AttenProfileCnt = 0;
+	                ftime(&SeqStartTime);       //start TT_EVSE_match_MNBC
+	            }
+	            else if(counter >= 3)
+	            {
+	                counter = 0;
+	            }
+	            break;
+	        }
+	        #endif
+		}
+	
+	    case MMTYPE_CM_MNBC_SOUND_IND:
+		{
+	        if(V2gFlowStatus >= CM_ATTEN_CHAR_IND)
+	        {
+	            SAVE_SYS_LOG_MSG_EVCOMM("[WARNING][SLAC][Rx]CM_MNBC_SOUND_IND: ignored(timeup)");
+	            break;
+	        }
+	
+	        //Avoid Coupled CM_MNBC_SOUND_IND
+	        if (CheckConnectorPlugIn() == FALSE)  //12V(State 1)
+	        {
+	            sprintf(buf_log_evcomm,
+	                    "[WARNING][SLAC][Rx]CM_MNBC_SOUND_IND: ignored(coupled SLAC,%d)",
+	                    CheckConnectorPlugIn());
+	            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	            break;
+	        }
+	
+	        #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == TRUE)
+	        {
+	            DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_MNBC_SOUND_IND (counter : %d/%d) ---\n",counter + 1 , MnbcSoundNum);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", MmePacket->MMENTRY[0]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", MmePacket->MMENTRY[1]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SenderID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+	                   MmePacket->MMENTRY[2],MmePacket->MMENTRY[3],MmePacket->MMENTRY[4],MmePacket->MMENTRY[5],
+	                   MmePacket->MMENTRY[6],MmePacket->MMENTRY[7],MmePacket->MMENTRY[8],MmePacket->MMENTRY[9],
+	                   MmePacket->MMENTRY[10],MmePacket->MMENTRY[11],MmePacket->MMENTRY[12],MmePacket->MMENTRY[13],
+	                   MmePacket->MMENTRY[14],MmePacket->MMENTRY[15],MmePacket->MMENTRY[16],MmePacket->MMENTRY[17],
+	                   MmePacket->MMENTRY[18]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("Cnt: 0x%x\n", MmePacket->MMENTRY[19]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+	                   MmePacket->MMENTRY[20],MmePacket->MMENTRY[21],MmePacket->MMENTRY[22],MmePacket->MMENTRY[23],
+	                   MmePacket->MMENTRY[24],MmePacket->MMENTRY[25],MmePacket->MMENTRY[26],MmePacket->MMENTRY[27]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("RSVD: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+	                   MmePacket->MMENTRY[28],MmePacket->MMENTRY[29],MmePacket->MMENTRY[30],MmePacket->MMENTRY[31],
+	                   MmePacket->MMENTRY[32],MmePacket->MMENTRY[33],MmePacket->MMENTRY[34],MmePacket->MMENTRY[35]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("Rnd: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+	                   MmePacket->MMENTRY[36],MmePacket->MMENTRY[37],MmePacket->MMENTRY[38],MmePacket->MMENTRY[39],
+	                   MmePacket->MMENTRY[40],MmePacket->MMENTRY[41],MmePacket->MMENTRY[42],MmePacket->MMENTRY[43],
+	                   MmePacket->MMENTRY[44],MmePacket->MMENTRY[45],MmePacket->MMENTRY[46],MmePacket->MMENTRY[47],
+	                   MmePacket->MMENTRY[48],MmePacket->MMENTRY[49],MmePacket->MMENTRY[50],MmePacket->MMENTRY[51]);
+	        }
+	        #endif
+	
+	
+	        //New SLAC architecture designed by Joseph
+	        #if (NEW_SLAC_ARCHITECTURE_SWITCH == ENABLE)
+	        {
+	            EvMac_in = &MmePacket->OSA[0];
+	            RunID_in = &MmePacket->MMENTRY[20];
+	            idx = SLAC_DB_Search_EvMac_idx(&SLAC_INFO, EvMac_in);
+	
+	            if (idx >= 0)
+	            {
+	                Update_V2G_Flow_Status(CM_MNBC_SOUND_IND);
+	
+	                //Check for RunID
+	                if (SLAC_DB_Check_EvMac_RunID_Matching(&SLAC_INFO, EvMac_in, RunID_in) == TRUE)
+	                {
+	                    SLAC_INFO.array[idx].MnbcSoundCnt++;
+	
+	                    /*
+	                    sprintf(buf_log_evcomm,
+	                            "[SLAC][Rx]CM_MNBC_SOUND_IND[%d]:%d-th",
+	                            (idx + 1),
+	                            SLAC_INFO.array[idx].MnbcSoundCnt);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    */
+	                }
+	                else
+	                {
+	                    //RunID is not matched or does not exist.
+	                    sprintf(buf_log_evcomm,
+	                            "[WARNING][SLAC][Rx]CM_MNBC_SOUND_IND]EvMac-RunID: unmatched");
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                }
+	            }
+	            else
+	            {
+	                //ignore
+	                sprintf(buf_log_evcomm,
+	                        "[WARNING][SLAC][Rx]CM_MNBC_SOUND_IND]EvMac does not exist");
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	            }
+	            break;
+	        }
+	        #else   //Old SLAC architecture designed by Vern
+	        {
+	            Update_V2G_Flow_Status(CM_MNBC_SOUND_IND);
+	            counter++;
+	            break;
+	        }
+	        #endif
+		}
+	
+	    case MMTYPE_CM_ATTEN_PROFILE_IND:
+		{
+	        if(V2gFlowStatus >= CM_ATTEN_CHAR_IND)
+	        {
+	            SAVE_SYS_LOG_MSG_EVCOMM("[WARNING][SLAC][Rx]CM_ATTEN_PROFILE_IND: ignore(timeup)");
+				break;
+			}
+	
+	        #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == TRUE)
+	        {
+	            DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_ATTEN_PROFILE_IND (counter : %d/%d) ---\n", counter, MnbcSoundNum);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("EV MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
+	                   MmePacket->MMENTRY[0], MmePacket->MMENTRY[1], MmePacket->MMENTRY[2], MmePacket->MMENTRY[3],
+	                   MmePacket->MMENTRY[4], MmePacket->MMENTRY[5]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("NumGroups: 0x%x\n", MmePacket->MMENTRY[6]);  //NumGroups, Number of AAG Groups (ex: 0x3A = 58)
+	            //NumGroups: Number of OFDM carrier groups used for the SLAC signal characterization.
+	            //AAG[i]: Average Attenuation of Group i (i = 1 ~ 58)
+	            DEBUG_PRINTF_EVCOMM_DETAIL("RSVD: 0x%x\n", MmePacket->MMENTRY[7]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("AAG: \n");
+	
+	            for(Rtn = 0; Rtn < MmePacket->MMENTRY[6]; Rtn++)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",MmePacket->MMENTRY[8 + Rtn]);
+	            }
+	            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	        }
+	        #endif
+	
+	        //New SLAC architecture designed by Joseph
+	        #if (NEW_SLAC_ARCHITECTURE_SWITCH == ENABLE)
+	        {
+	            EvMac_in = &MmePacket->MMENTRY[0]; //[CAUTION] The EvMac address is not &MmePacket->OSA[0]
+	            //[CAUTION] There is no RunID information of CM_ATTEN_PROFILE_IND
+	            //          packet, which means SECC cannot use the RunID to
+	            //          distinguish those SLAC request with identical EvMac
+	            //          but with different RunID.
+	            idx = SLAC_DB_Search_EvMac_idx(&SLAC_INFO, EvMac_in);
+	
+	            /*
+	            printf("%d, %d, %d, %d\n",
+	                    idx,
+	                    SLAC_INFO.array[idx].AagGroupsNum,
+	                    MmePacket->MMENTRY[6],
+	                    SLAC_INFO.array[idx].AttenProfileCnt);
+	            */
+	
+	            if (idx >= 0)
+	            {
+	                SLAC_INFO.array[idx].AttenProfileCnt++;
+	
+	                /*
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][Rx]CM_ATTEN_PROFILE_IND[%d]:%d-th",
+	                        (idx + 1),
+	                        SLAC_INFO.array[idx].AttenProfileCnt);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                */
+	
+	                //printf("%d, %d\n", SLAC_INFO.array[idx].AagGroupsNum, MmePacket->MMENTRY[6]);
+	
+	                SLAC_INFO.array[idx].AagGroupsNum = MmePacket->MMENTRY[6];
+	                ////NumGroups, Number of AAG Groups (ex: 0x3A = 58)
+	
+	                for(Rtn = 0; Rtn < SLAC_INFO.array[idx].AagGroupsNum; Rtn++) //ex:58
+	                {
+	                    SLAC_INFO.array[idx].AAG[Rtn] += MmePacket->MMENTRY[8 + Rtn];
+	                }
+	
+	                Update_V2G_Flow_Status(CM_MNBC_SOUND_IND);
+	                break;
+	            }
+	            else
+	            {
+	                //The EvMac is not in the database
+	                //ignore
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][Rx][CM_ATTEN_PROFILE_IND]EvMac(%02X%02X%02X%02X%02X%02X): not exist => ignore",
+	                        EvMac_in[0], EvMac_in[1], EvMac_in[2], EvMac_in[3], EvMac_in[4], EvMac_in[5]);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                break;
+	            }
+	        }
+	        #else   //Old SLAC architecture designed by Vern
+	        {
+	            AagGroupsNum = MmePacket->MMENTRY[6];
+	            for(Rtn = 0; Rtn < MmePacket->MMENTRY[6]; Rtn++)
+	            {
+	                Aag[Rtn] += MmePacket->MMENTRY[8 + Rtn];
+	            }
+	            AttenProfileCnt++;
+	            Update_V2G_Flow_Status(CM_MNBC_SOUND_IND);
+	            break;
+	        }
+	        #endif
+		}
+	
+	    case MMTYPE_CM_ATTEN_CHAR_RSP:
+		{
+	        #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+	        {
+	            DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_ATTEN_CHAR_RSP ---\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", MmePacket->MMENTRY[0]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", MmePacket->MMENTRY[1]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SOURCE_ADDRESS: %02x:%02x:%02x:%02x:%02x:%02x\n",
+	                   MmePacket->MMENTRY[2],MmePacket->MMENTRY[3],MmePacket->MMENTRY[4],MmePacket->MMENTRY[5],
+	                   MmePacket->MMENTRY[6],MmePacket->MMENTRY[7]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+	                   MmePacket->MMENTRY[8],MmePacket->MMENTRY[9],MmePacket->MMENTRY[10],MmePacket->MMENTRY[11],
+	                   MmePacket->MMENTRY[12],MmePacket->MMENTRY[13],MmePacket->MMENTRY[14],MmePacket->MMENTRY[15]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SOURCE_ID: \n");
+	            for(Rtn = 0; Rtn < 17; Rtn++)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",MmePacket->MMENTRY[16 + Rtn]);
+	            }
+	            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("RESP_ID: \n");
+	            for(Rtn = 0; Rtn < 17; Rtn++)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",MmePacket->MMENTRY[33 + Rtn]);
+	            }
+	            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("Result: 0x%x\n", MmePacket->MMENTRY[50]);    //Fixed value of 0x00 indicates a successful SLAC process
+	        }
+	        #endif
+	
+	        #if (NEW_SLAC_ARCHITECTURE_SWITCH == ENABLE)
+	        {
+	            //Check ODA (Destination Address)
+	            if (Array_Compare_Identity(CsuMac, MmePacket->ODA, SLAC_EVSE_MAC_LENGTH) == FALSE)
+	            {
+	                SAVE_SYS_LOG_MSG_EVCOMM("[SLAC][Rx][CM_ATTEN_CHAR_RSP]wrong ODA: ignore");
+	                break;
+	            }
+	
+	            EvMac_in = &MmePacket->OSA[0];
+	            RunID_in = &MmePacket->MMENTRY[8];
+	            idx = SLAC_DB_Search_EvMac_idx(&SLAC_INFO, EvMac_in);
+	
+	            //Check Parameters
+	            if ((MmePacket->MMENTRY[0] != 0) ||   //[TC_SECC_VTB_AttenuationCharacterization_005] applicationType must be 0x00
+	                (MmePacket->MMENTRY[1] != 0) ||   //[TC_SECC_VTB_AttenuationCharacterization_006] securityType must be 0x00
+	                (SLAC_DB_Search_EvMac_idx(&SLAC_INFO, EvMac_in) < 0) || //[TC_SECC_VTB_AttenuationCharacterization_007] sourceAddress cannot not be all zero
+	                (SLAC_DB_Check_EvMac_RunID_Matching(&SLAC_INFO, EvMac_in, RunID_in) == FALSE) ||    //[TC_SECC_VTB_AttenuationCharacterization_008] check for invalid runID
+	                (Array_Check_All_Zero(&MmePacket->MMENTRY[16], 17) == FALSE) ||  //[TC_SECC_VTB_AttenuationCharacterization_009] SourceID(17 bytes) must be all zero.
+	                (Array_Check_All_Zero(&MmePacket->MMENTRY[33], 17) == FALSE) ||  //[TC_SECC_VTB_AttenuationCharacterization_009] RESP_ID (17 bytes) must be all zero.
+	                (MmePacket->MMENTRY[50] != 0)   //Result:  must be 0x00(Success)
+	                )
+	            {
+	                EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry++;
+	
+	                sprintf(buf_log_evcomm,
+	                        "[WARNING][SLAC][Rx]CM_ATTEN_CHAR_RSP:invalid para(%d,%d,%d,%d,%d) => %d-th retry",
+	                        MmePacket->MMENTRY[0],  //applicationType must be 0x00
+	                        MmePacket->MMENTRY[1],  //securityType must be 0x00
+	                        SLAC_DB_Search_EvMac_idx(&SLAC_INFO, EvMac_in),
+	                        SLAC_DB_Check_EvMac_RunID_Matching(&SLAC_INFO, EvMac_in, RunID_in),
+	                        MmePacket->MMENTRY[50],
+	                        EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry
+	                        );
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+	                if (EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry <= 2)   //limited to 2 retries
+	                {
+	                    Update_V2G_Flow_Status(CM_MNBC_SOUND_IND);
+	                    ftime(&SeqStartTime);
+	                    break;
+	                }
+	                else
+	                {
+	                    SAVE_SYS_LOG_MSG_EVCOMM("[ERROR][SLAC][Rx]CM_ATTEN_CHAR_RSP:invalid para => 2-retry fail => End_Process");
+	                    Update_V2G_Flow_Status(Other_Fault);
+	                    break;
+	                }
+	            }
+	            else
+	            {
+	                //The CM_ATTEN_CHAR_IND is legal
+	                SLAC_INFO.array[idx].AttenCharRspCnt++;
+	
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][Rx]CM_ATTEN_CHAR_RSP[%d]:%d-th",
+	                        (idx + 1),
+	                        SLAC_INFO.array[idx].AttenCharRspCnt);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+	                EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry = 0;
+	                Update_V2G_Flow_Status(CM_ATTEN_CHAR_RSP);
+	                ftime(&SeqStartTime);
+	                break;
+	            }
+	        }
+	        #else
+	        {
+	            //Check Parameters
+	            if ((MmePacket->MMENTRY[0] != 0) ||   //[TC_SECC_VTB_AttenuationCharacterization_005] applicationType must be 0x00
+	                (MmePacket->MMENTRY[1] != 0) ||   //[TC_SECC_VTB_AttenuationCharacterization_006] securityType must be 0x00
+	                (Array_Compare_Identity(SLAC_INFO.array[0].EvMac, &MmePacket->MMENTRY[2], 6) == TRUE) || //[TC_SECC_VTB_AttenuationCharacterization_007] sourceAddress cannot not be all zero
+	                (Array_Compare_Identity(SLAC_INFO.array[0].RunID, &MmePacket->MMENTRY[8], 8) == TRUE)    //[TC_SECC_VTB_AttenuationCharacterization_008] check for invalid runID
+	                )
+	            {
+	                EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry++;
+	
+	                sprintf(buf_log_evcomm,
+	                        "[WARNING][SLAC][Rx]CM_ATTEN_CHAR_RSP: invalid parameters(%d-th)",
+	                        EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+	                if (EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry <= 2)   //limited to 2 retries
+	                {
+	                    Update_V2G_Flow_Status(CM_MNBC_SOUND_IND);
+	                    ftime(&SeqStartTime);
+	                    break;
+	                }
+	                else
+	                {
+	                    SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]CM_ATTEN_CHAR_RSP: invalid parameters => End_Process");
+	                    Update_V2G_Flow_Status(Other_Fault);
+	                    ftime(&SeqStartTime);
+	                    break;
+	                }
+	            }
+	            else
+	            {
+	                EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry = 0;
+	                Update_V2G_Flow_Status(CM_ATTEN_CHAR_RSP);
+	                ftime(&SeqStartTime);
+	                break;
+	            }
+	        }
+	        #endif
+		}
+	
+	    case MMTYPE_CM_VALIDATE_REQ:   //BCB Toggle
+		{
+	        #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+	        {
+	            DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_VALIDATE_REQ ---\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("Signal Type: 0x%x\n", MmePacket->MMENTRY[0]);    //Fixed value (0x00) to indicate ��PEV S2 toggles on control pilot line��
+	            DEBUG_PRINTF_EVCOMM_DETAIL("Timer: 0x%x\n", MmePacket->MMENTRY[1]);    //Fixed value In the first VALIDATE Request-Response exchange, the Timer field shall be set to zero.
+	            DEBUG_PRINTF_EVCOMM_DETAIL("Result: 0x%x\n", MmePacket->MMENTRY[2]);    //Fixed value In the first VALIDATE Request-Response exchange, the Result field shall be set to 0x01 = ��ready��.
+	        }
+	        #endif
+	
+	        #if (NEW_SLAC_ARCHITECTURE_SWITCH == ENABLE)
+	        {
+	            counter = 0;
+	
+	            EvMac_in = &MmePacket->OSA[0];
+	            idx = SLAC_DB_Search_EvMac_idx(&SLAC_INFO, EvMac_in);
+	
+	            if (idx >= 0)
+	            {
+	                Update_V2G_Flow_Status(CM_VALIDATE_CNF);
+	                SLAC_INFO.array[idx].ValidateReqCnt++;
+	
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][Rx]CM_VALIDATE_REQ[%d]:%d-th",
+	                        (idx + 1),
+	                        SLAC_INFO.array[idx].ValidateReqCnt);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+	
+	                //[To-Do] Protection
+	
+	
+	                memset(&SendMmePacket, 0, sizeof(struct MmeHeader));
+	                memcpy(SendMmePacket.ODA, EvMac_in, SLAC_EVMAC_LENGTH);
+	                memcpy(SendMmePacket.OSA, CsuMac, 6);
+	                SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+	                SendMmePacket.MMV = 0x01;
+	                SendMmePacket.MMTYPE = MMTYPE_CM_VALIDATE_CNF;
+	                SendMmePacket.FMI[0] = SendMmePacket.FMI[1] = 0;
+	                SendMmePacketSize = 0;
+	
+	                if(counter == 0)
+	                {
+	                    //The First MMTYPE_CM_VALIDATE_REQ because Unicast
+	                    SendMmePacket.MMENTRY[SendMmePacketSize++] = 0;    //SignalType(0x00): Fixed value to indicate "EV S2 toggles on control pilot line"
+	                    SendMmePacket.MMENTRY[SendMmePacketSize++] = 0;    //ToggleNum(0x00): Fixed value. In the first VALIDATE Request-Response exchange, the ToggleNum field shall be set to zero.
+	
+	                    #if (SUPPORT_BCB_TOGGLE_FUNCTION == ENABLE)
+	                        SendMmePacket.MMENTRY[SendMmePacketSize++] = 1;    //0x01 = Ready
+	                    #else
+	                        SendMmePacket.MMENTRY[SendMmePacketSize++] = 4;    //0x04 = Not Required
+	                    #endif
+	                }
+	                else
+	                {
+	                    //The Second MMTYPE_CM_VALIDATE_REQ because Broadcast
+	                    unsigned char PreStatus = 3;
+	                    unsigned char ToggleNum = 0;
+	                    ftime(&SeqStartTime);
+	                    while(1)
+	                    {
+	                        if((EVCOMM_SYS_INFO.CpState == 4) && (PreStatus == 3))
+	                        {
+	                            ToggleNum++;
+	                            PreStatus = 4;
+	                        }
+	                        else
+	                        {
+	                            PreStatus = 3;
+	                        }
+	
+	                        ftime(&SeqEndTime);
+	                        if(DiffTimeb(SeqStartTime, SeqEndTime) >= (SendMmePacket.MMENTRY[1]*100 + 100))
+	                        {
+	                            SendMmePacket.MMENTRY[SendMmePacketSize++] = 0;    //Fixed value to indicate "PEV S2 toggles on control pilot line"
+	                            SendMmePacket.MMENTRY[SendMmePacketSize++] = ToggleNum;
+	
+	                            #if (SUPPORT_BCB_TOGGLE_FUNCTION == ENABLE)
+	                                SendMmePacket.MMENTRY[SendMmePacketSize++] = 2;    //0x02 = Success
+	                            #else
+	                                SendMmePacket.MMENTRY[SendMmePacketSize++] = 4;    //0x04 = Not Required
+	                            #endif
+	
+	                            break;
+	                        }
+	                    }
+	                }
+	                SendMmePacketSize += 19;      //the size before MMENTRY
+	                Rtn = sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+	                ftime(&SeqStartTime);
+	            }
+	            else
+	            {
+	                //EvMac does not exist.
+	                //ignore
+	            }
+	            break;
+	        }
+	        #else
+	        {
+	            counter = 0;
+	
+	            for(Rtn = 0; Rtn < 6; Rtn++)
+	            {
+	                if(MmePacket->ODA[Rtn] != CsuMac[Rtn])
+	                {
+	                    counter = 1;
+	                    break;
+	                }
+	            }
+	
+	            memset(&SendMmePacket, 0, sizeof(struct MmeHeader));
+	            memcpy(SendMmePacket.ODA, EvMac,6);
+	            memcpy(SendMmePacket.OSA, CsuMac,6);
+	            SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+	            SendMmePacket.MMV = 0x01;
+	            SendMmePacket.MMTYPE = MMTYPE_CM_VALIDATE_CNF;
+	            SendMmePacket.FMI[0] = SendMmePacket.FMI[1] = 0;
+	            SendMmePacketSize = 0;
+	            if(counter == 0)
+	            {
+	                //The First MMTYPE_CM_VALIDATE_REQ because Unicast
+	                SendMmePacket.MMENTRY[SendMmePacketSize++] = 0;    //Fixed value to indicate PEV S2 toggles on control pilot line
+	                SendMmePacket.MMENTRY[SendMmePacketSize++] = 0;    //Fixed value In the first VALIDATE Request-Response exchange, the ToggleNum field shall be set to zero.
+	                #if (SUPPORT_BCB_TOGGLE_FUNCTION == ENABLE)
+	                SendMmePacket.MMENTRY[SendMmePacketSize++] = 1;    //0x01 = Ready
+	                #else
+	                SendMmePacket.MMENTRY[SendMmePacketSize++] = 4;    //0x04 = Not Required
+	                #endif
+	            }
+	            else
+	            {
+	                //The Second MMTYPE_CM_VALIDATE_REQ because Broadcast
+	                unsigned char PreStatus = 3, ToggleNum = 0;
+	                ftime(&SeqStartTime);
+	                while(1)
+	                {
+	                    ftime(&SeqEndTime);
+	                    if((EVCOMM_SYS_INFO.CpState == 4) && (PreStatus == 3))
+	                    {
+	                        ToggleNum++;
+	                        PreStatus = 4;
+	                    }
+	                    else
+	                    {
+	                        PreStatus = 3;
+	                    }
+	                    if(DiffTimeb(SeqStartTime, SeqEndTime) >= (SendMmePacket.MMENTRY[1]*100 + 100))
+	                    {
+	                        SendMmePacket.MMENTRY[SendMmePacketSize++] = 0;    //Fixed value to indicate ��PEV S2 toggles on control pilot line��
+	                        SendMmePacket.MMENTRY[SendMmePacketSize++] = ToggleNum;
+	                        #if (SUPPORT_BCB_TOGGLE_FUNCTION == ENABLE)
+	                        SendMmePacket.MMENTRY[SendMmePacketSize++] = 2;    //0x02 = Success
+	                        #else
+	                        SendMmePacket.MMENTRY[SendMmePacketSize++] = 4;    //0x04 = Not Required
+	                        #endif
+	                        break;
+	                    }
+	                }
+	            }
+	            SendMmePacketSize += 19;      //the size before MMENTRY
+	            Rtn = sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+	            Update_V2G_Flow_Status(CM_VALIDATE_CNF);
+	            ftime(&SeqStartTime);
+	            break;
+	        }
+	        #endif
+		}
+	
+	    case MMTYPE_CM_SLAC_MATCH_REQ:
+		{
+	        #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+	        {
+	            DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_SLAC_MATCH_REQ ---\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", MmePacket->MMENTRY[0]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", MmePacket->MMENTRY[1]);
+	            DEBUG_PRINTF_EVCOMM_DETAIL("MVFLength: 0x%x, 0x%x\n", MmePacket->MMENTRY[2],MmePacket->MMENTRY[3]);    //Fixed value (0x3E) for matching
+	            DEBUG_PRINTF_EVCOMM_DETAIL("PEV ID: \n");
+	            for(Rtn=0; Rtn<17; Rtn++)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",MmePacket->MMENTRY[4+Rtn]);
+	            }
+	            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("PEV MAC: \n");
+	            for(Rtn=0; Rtn<6; Rtn++)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",MmePacket->MMENTRY[21+Rtn]);
+	            }
+	            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("EVSE ID: \n");
+	            for(Rtn=0; Rtn<17; Rtn++)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",MmePacket->MMENTRY[27+Rtn]);
+	            }
+	            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("EVSE MAC: \n");
+	            for(Rtn=0; Rtn<6; Rtn++)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",MmePacket->MMENTRY[44+Rtn]);
+	            }
+	            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("RunID: \n");
+	            for(Rtn=0; Rtn<8; Rtn++)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",MmePacket->MMENTRY[50+Rtn]);
+	            }
+	            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	            DEBUG_PRINTF_EVCOMM_DETAIL("RSVD: \n");
+	            for(Rtn=0; Rtn<8; Rtn++)
+	            {
+	                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",MmePacket->MMENTRY[58+Rtn]);
+	            }
+	            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	        }
+	        #endif
+	
+	        #if (NEW_SLAC_ARCHITECTURE_SWITCH == ENABLE)
+	        {
+	            //SAVE_SYS_LOG_MSG_EVCOMM("[SLAC][Rx]CM_SLAC_MATCH_REQ");
+	
+	            //Check ODA (Destination Address)
+	            if (Array_Compare_Identity(CsuMac, MmePacket->ODA, SLAC_EVSE_MAC_LENGTH) == FALSE)
+	            {
+	                SAVE_SYS_LOG_MSG_EVCOMM("[SLAC][Rx][CM_SLAC_MATCH_REQ]wrong ODA: ignore");
+	                //break; //patch for DEKRA I2SE EVCC (another EVSE MAC Address protection comes as below.)
+	            }
+	
+	            EvMac_in = &MmePacket->OSA[0];
+	            RunID_in = &MmePacket->MMENTRY[50];
+	            idx = SLAC_DB_Search_EvMac_idx(&SLAC_INFO, EvMac_in);
+	
+	            if (idx >= 0)
+	            {
+	                Update_V2G_Flow_Status(CM_SLAC_MATCH_REQ);
+	
+	                SLAC_INFO.array[idx].MatchReqNum++;
+	
+	                sprintf(buf_log_evcomm,
+	                        "[SLAC][Rx]CM_SLAC_MATCH_REQ[%d]:%d-th",
+	                        (idx + 1),
+	                        SLAC_INFO.array[idx].MatchReqNum);
+	                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+	                //[TC_SECC_VTB_CmSlacMatch_007] APPLICATION_TYPE must be 0x00(EV-EVSE Matching)
+	                //[TC_SECC_VTB_CmSlacMatch_008]
+	                if (MmePacket->MMENTRY[0] != 0)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[SLAC][Rx]CM_SLAC_MATCH_REQ[%d]:wrong APPLICATION_TYPE(%d)",
+	                            (idx + 1),
+	                            MmePacket->MMENTRY[0]);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    break;
+	                }
+	
+	                //[TC_SECC_VTB_CmSlacMatch_009] SECURITY_TYPE must be 0x00(No Security)
+	                //[TC_SECC_VTB_CmSlacMatch_010]
+	                if (MmePacket->MMENTRY[1] != 0)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[SLAC][Rx]CM_SLAC_MATCH_REQ[%d]:wrong SECURITY_TYPE(%d)",
+	                            (idx + 1),
+	                            MmePacket->MMENTRY[1]);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    break;
+	                }
+	
+	                //[TC_SECC_VTB_CmSlacMatch_011] MVFLength must be 0x3E(MatchVarField Length)
+	                //[TC_SECC_VTB_CmSlacMatch_012]
+	                if (MmePacket->MMENTRY[2] != 0x3E || MmePacket->MMENTRY[3] != 0x00)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[SLAC][Rx]CM_SLAC_MATCH_REQ[%d]:wrong MVFLength(%d,%d)",
+	                            (idx + 1),
+	                            MmePacket->MMENTRY[2],
+	                            MmePacket->MMENTRY[3]);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    break;
+	                }
+	
+	                //[TC_SECC_VTB_CmSlacMatch_013] EV ID (muxt be all zero)
+	                //[TC_SECC_VTB_CmSlacMatch_014]
+	                if (Array_Check_All_Zero(&MmePacket->MMENTRY[4], 17) == FALSE)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[SLAC][Rx]CM_SLAC_MATCH_REQ[%d]: wrong EV ID",
+	                            (idx + 1));
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    break;
+	                }
+	
+	                //[TC_SECC_VTB_CmSlacMatch_015] EV MAC
+	                //[TC_SECC_VTB_CmSlacMatch_016]
+	                if (Array_Compare_Identity(EvMac_in, &MmePacket->MMENTRY[21], SLAC_EVMAC_LENGTH) == FALSE)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[SLAC][Rx]CM_SLAC_MATCH_REQ[%d]: wrong EV MAC(%02X:%02X:%02X:%02X:%02X:%02X)",
+	                            (idx + 1),
+	                            MmePacket->MMENTRY[21], MmePacket->MMENTRY[22], MmePacket->MMENTRY[23],
+	                            MmePacket->MMENTRY[24], MmePacket->MMENTRY[25], MmePacket->MMENTRY[26]);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    break;
+	                }
+	
+	                //[TC_SECC_VTB_CmSlacMatch_017] EVSE ID should be all zero
+	                //[TC_SECC_VTB_CmSlacMatch_018]
+	                if (Array_Check_All_Zero(&MmePacket->MMENTRY[27], 17) == FALSE)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[SLAC][Rx]CM_SLAC_MATCH_REQ[%d]: wrong EVSE ID",
+	                            (idx + 1));
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    break;
+	                }
+	
+	                //[TC_SECC_VTB_CmSlacMatch_019] EVSE MAC
+	                //[TC_SECC_VTB_CmSlacMatch_020]
+	                if (Array_Compare_Identity(CsuMac, &MmePacket->MMENTRY[44], SLAC_EVSE_MAC_LENGTH) == FALSE)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[SLAC][Rx]CM_SLAC_MATCH_REQ[%d]: wrong EVSE MAC(%02X:%02X:%02X:%02X:%02X:%02X)",
+	                            (idx + 1),
+	                            MmePacket->MMENTRY[44], MmePacket->MMENTRY[45], MmePacket->MMENTRY[46],
+	                            MmePacket->MMENTRY[47], MmePacket->MMENTRY[48], MmePacket->MMENTRY[49]);
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	                    break;
+	                }
+	
+	                //[TC_SECC_VTB_CmSlacMatch_021]runID: Check RunID
+	                //[TC_SECC_VTB_CmSlacMatch_022]
+	                if (SLAC_DB_Check_EvMac_RunID_Matching(&SLAC_INFO, EvMac_in, RunID_in) == TRUE &&
+	                   (idx == 0)) //only setup a successful link establishment with the first SLAC Req instance
+	                {
+	                    memset(&SendMmePacket, 0, sizeof(struct MmeHeader));
+	        	        memcpy(SendMmePacket.ODA, MmePacket->OSA, 6);
+	        	        memcpy(SendMmePacket.OSA, CsuMac, 6);
+	        	        SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+	        	        SendMmePacket.MMV = MmePacket->MMV;
+	        	        SendMmePacket.MMTYPE = MMTYPE_CM_SLAC_MATCH_CNF;
+	        	        SendMmePacket.FMI[0] = SendMmePacket.FMI[1] = 0;
+	        	        SendMmePacketSize = 0;
+	        	        SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x00;    //APPLICATION_TYPE: Fixed value (0x00: EV-EVSE matching)
+	        	        SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x00;    //SECURITY_TYPE: Fixed value (0x00: No Security)
+	        	        SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x56;    //MVFLength: MatchVarField Length (Fixed value: 0x0056)
+	        	        SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x00;    //MVFLength: MatchVarField Length (Fixed value: 0x0056)
+	        	        memset(SendMmePacket.MMENTRY + SendMmePacketSize, 0, 17);         //EV ID
+	        	        SendMmePacketSize += 17;
+	        	        memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, EvMac_in, SLAC_EVMAC_LENGTH); //EV MAC
+	        	        SendMmePacketSize += 6;
+	        	        memset(SendMmePacket.MMENTRY + SendMmePacketSize, 0, 17);         //EVSE ID
+	        	        SendMmePacketSize += 17;
+	        	        memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, CsuMac, 6);     //EVSE MAC
+	        	        SendMmePacketSize += 6;
+	        	        memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, RunID_in, SLAC_RUNID_LENGTH);
+	        	        SendMmePacketSize += SLAC_RUNID_LENGTH;
+	        	        memset(SendMmePacket.MMENTRY + SendMmePacketSize, 0, 8);    //RSVD
+	        	        SendMmePacketSize += 8;
+	        	        memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, Nid, sizeof(Nid));   //NID: Network ID given by the CCo(EVSE)
+	        	        SendMmePacketSize += sizeof(Nid);                                      //NID caculated from the random NMK that will be set.
+	        	        SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x00;          //RSVD
+	        	        memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, NewNmkKey, sizeof(NewNmkKey)); //NMK: Random value
+	        	        SendMmePacketSize += sizeof(NewNmkKey);                                          //NMK: Private NMK of the EVSE (random value)
+	        	        SendMmePacketSize += 19;      //the size before MMENTRY
+	
+	                    #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+	                    {
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("\n\n***** Response MME Packet *****\n");
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.ODA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+	                               SendMmePacket.ODA[0],SendMmePacket.ODA[1],SendMmePacket.ODA[2],SendMmePacket.ODA[3],SendMmePacket.ODA[4],SendMmePacket.ODA[5]);
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.OSA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+	                               SendMmePacket.OSA[0],SendMmePacket.OSA[1],SendMmePacket.OSA[2],SendMmePacket.OSA[3],SendMmePacket.OSA[4],SendMmePacket.OSA[5]);
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("MTYPE: 0x%x\n", htons(SendMmePacket.MTYPE));
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("MMV: 0x%x\n", SendMmePacket.MMV);
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("MMTYPE: 0x%x\n", SendMmePacket.MMTYPE);
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("FMI 0x%x, 0x%x\n", SendMmePacket.FMI[0],SendMmePacket.FMI[1]);
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("--- CM_SLAC_MATCH_CNF ---\n");
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", SendMmePacket.MMENTRY[0]);
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", SendMmePacket.MMENTRY[1]);
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("MVFLength: 0x%x, 0x%x\n", SendMmePacket.MMENTRY[2],SendMmePacket.MMENTRY[3]);
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("PEV ID: \n");
+	                        for(Rtn=0; Rtn<17; Rtn++)
+	                        {
+	                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[4+Rtn]);
+	                        }
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("PEV MAC: \n");
+	                        for(Rtn=0; Rtn<6; Rtn++)
+	                        {
+	                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[21+Rtn]);
+	                        }
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("EVSE ID: \n");
+	                        for(Rtn=0; Rtn<17; Rtn++)
+	                        {
+	                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[27+Rtn]);
+	                        }
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("EVSE MAC: \n");
+	                        for(Rtn=0; Rtn<6; Rtn++)
+	                        {
+	                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[44+Rtn]);
+	                        }
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("RunID: \n");
+	                        for(Rtn=0; Rtn<8; Rtn++)
+	                        {
+	                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[50+Rtn]);
+	                        }
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("RSVD: \n");
+	                        for(Rtn=0; Rtn<8; Rtn++)
+	                        {
+	                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[58+Rtn]);
+	                        }
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("NID: \n");
+	                        for(Rtn=0; Rtn<7; Rtn++)
+	                        {
+	                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[66+Rtn]);
+	                        }
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("RSVD: 0x%x\n", SendMmePacket.MMENTRY[73]);
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("NMK: \n");
+	                        for(Rtn=0; Rtn<16; Rtn++)
+	                        {
+	                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[74+Rtn]);
+	                        }
+	                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                    }
+	                    #endif
+	
+	                    Update_V2G_Flow_Status(CM_SLAC_MATCH_CNF);
+	        	        Rtn = sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+	
+	
+	        	        DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacketSize=%d,Rtn=%d\n",SendMmePacketSize,Rtn);
+	                    sprintf(buf_log_evcomm,
+	                            "[SLAC][Tx]CM_SLAC_MATCH_CNF[%d]",
+	                            (idx + 1));
+	                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+	                    ftime(&SeqStartTime);
+	                }
+	                else
+	                {
+	                    //RunID does not match and it's not the first SLAC request
+	                    //Reset the SLAC database to embrace SLAC retry
+	                    SAVE_SYS_LOG_MSG_EVCOMM("[CM_SLAC_MATCH_REQ]No Real MATCH_REQ");
+	                    SLAC_DB_Reset();
+	                }
+	            }
+	            else
+	            {
+	                //OSA(EvMac) does not exist
+	            }
+	            break;
+	        }
+	        #else
+	        {
+	            Update_V2G_Flow_Status(CM_SLAC_MATCH_REQ);
+	            SAVE_SYS_LOG_MSG_EVCOMM("[SLAC][Rx]CM_SLAC_MATCH_REQ");
+	
+	            memset(&SendMmePacket,0,sizeof(struct MmeHeader));
+	            memcpy(SendMmePacket.ODA,MmePacket->OSA,6);
+	            memcpy(SendMmePacket.OSA,CsuMac,6);
+	            SendMmePacket.MTYPE=htons(EtherType_HomePlug);
+	            SendMmePacket.MMV=MmePacket->MMV;
+	            SendMmePacket.MMTYPE=MMTYPE_CM_SLAC_MATCH_CNF;
+	            SendMmePacket.FMI[0]=SendMmePacket.FMI[1]=0;
+	            SendMmePacketSize=0;
+	            SendMmePacket.MMENTRY[SendMmePacketSize++]=0x00;    //Fixed value (0x00) indicating PEV-EVSE matching
+	            SendMmePacket.MMENTRY[SendMmePacketSize++]=0x00;    //Fixed value (0x00) indicating No Security
+	            SendMmePacket.MMENTRY[SendMmePacketSize++]=0x56;    //Fixed value (0x0056) for matching
+	            SendMmePacket.MMENTRY[SendMmePacketSize++]=0x00;    //Fixed value (0x0056) for matching
+	            memset(SendMmePacket.MMENTRY+SendMmePacketSize,0,17);    //PEV ID
+	            SendMmePacketSize+=17;
+	            memcpy(SendMmePacket.MMENTRY+SendMmePacketSize,EvMac,6);
+	            SendMmePacketSize+=6;
+	            memset(SendMmePacket.MMENTRY+SendMmePacketSize,0,17);    //EVSE ID
+	            SendMmePacketSize+=17;
+	            memcpy(SendMmePacket.MMENTRY+SendMmePacketSize,CsuMac,6);
+	            SendMmePacketSize+=6;
+	            memcpy(SendMmePacket.MMENTRY+SendMmePacketSize,SlacRunId,sizeof(SlacRunId));
+	            SendMmePacketSize+=sizeof(SlacRunId);
+	            memset(SendMmePacket.MMENTRY+SendMmePacketSize,0,8);    //RSVD
+	            SendMmePacketSize+=8;
+	            memcpy(SendMmePacket.MMENTRY+SendMmePacketSize,Nid,sizeof(Nid));
+	            SendMmePacketSize+=sizeof(Nid);
+	            SendMmePacket.MMENTRY[SendMmePacketSize++]=0x00;    //RSVD
+	            memcpy(SendMmePacket.MMENTRY+SendMmePacketSize,NewNmkKey,sizeof(NewNmkKey));
+	            SendMmePacketSize+=sizeof(NewNmkKey);
+	            SendMmePacketSize+=19;      //the size before MMENTRY
+	
+	            #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n\n***** Response MME Packet *****\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.ODA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+	                       SendMmePacket.ODA[0],SendMmePacket.ODA[1],SendMmePacket.ODA[2],SendMmePacket.ODA[3],SendMmePacket.ODA[4],SendMmePacket.ODA[5]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.OSA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+	                       SendMmePacket.OSA[0],SendMmePacket.OSA[1],SendMmePacket.OSA[2],SendMmePacket.OSA[3],SendMmePacket.OSA[4],SendMmePacket.OSA[5]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("MTYPE: 0x%x\n", htons(SendMmePacket.MTYPE));
+	                DEBUG_PRINTF_EVCOMM_DETAIL("MMV: 0x%x\n", SendMmePacket.MMV);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("MMTYPE: 0x%x\n", SendMmePacket.MMTYPE);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("FMI 0x%x, 0x%x\n", SendMmePacket.FMI[0],SendMmePacket.FMI[1]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("--- CM_SLAC_MATCH_CNF ---\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", SendMmePacket.MMENTRY[0]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", SendMmePacket.MMENTRY[1]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("MVFLength: 0x%x, 0x%x\n", SendMmePacket.MMENTRY[2],SendMmePacket.MMENTRY[3]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("PEV ID: \n");
+	                for(Rtn=0; Rtn<17; Rtn++)
+	                {
+	                    DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[4+Rtn]);
+	                }
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("PEV MAC: \n");
+	                for(Rtn=0; Rtn<6; Rtn++)
+	                {
+	                    DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[21+Rtn]);
+	                }
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("EVSE ID: \n");
+	                for(Rtn=0; Rtn<17; Rtn++)
+	                {
+	                    DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[27+Rtn]);
+	                }
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("EVSE MAC: \n");
+	                for(Rtn=0; Rtn<6; Rtn++)
+	                {
+	                    DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[44+Rtn]);
+	                }
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("RunID: \n");
+	                for(Rtn=0; Rtn<8; Rtn++)
+	                {
+	                    DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[50+Rtn]);
+	                }
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("RSVD: \n");
+	                for(Rtn=0; Rtn<8; Rtn++)
+	                {
+	                    DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[58+Rtn]);
+	                }
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("NID: \n");
+	                for(Rtn=0; Rtn<7; Rtn++)
+	                {
+	                    DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[66+Rtn]);
+	                }
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	                DEBUG_PRINTF_EVCOMM_DETAIL("RSVD: 0x%x\n", SendMmePacket.MMENTRY[73]);
+	                DEBUG_PRINTF_EVCOMM_DETAIL("NMK: \n");
+	                for(Rtn=0; Rtn<16; Rtn++)
+	                {
+	                    DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[74+Rtn]);
+	                }
+	                DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+	            #endif
+	
+	            Update_V2G_Flow_Status(CM_SLAC_MATCH_CNF);
+	            Rtn = sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+	
+	
+	            DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacketSize=%d,Rtn=%d\n",SendMmePacketSize,Rtn);
+	            SAVE_SYS_LOG_MSG_EVCOMM("[SLAC][Tx]CM_SLAC_MATCH_CNF");
+	
+	            ftime(&SeqStartTime);
+	            break;
+	        }
+	        #endif
+		}
+	
+	    case MMTYPE_VENDOR_VS_HOST_ACTION:
+	    {
+	        struct QcaVendorMmeHeader *RecvPacket;
+	        RecvPacket = (struct QcaVendorMmeHeader *)Buffer;
+	
+	        DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_VENDOR_VS_HOST_ACTION ---\n");
+	
+	        switch (RecvPacket->MBODY[0])
+	        {
+		        case 0x00:
+		            //Loader (Device Softloader or Bootloader) ready
+		            DEBUG_PRINTF_EVCOMM_DETAIL("QCA7K: Loader Ready\n");
+		            break;
+	
+		        case 0x01:
+		            //Firmware Upgrade Ready
+		            DEBUG_PRINTF_EVCOMM_DETAIL("QCA7K: Firmware Upgrade Ready\n");
+		            break;
+	
+		        case 0x02:
+		            //PIB Update Ready
+		            DEBUG_PRINTF_EVCOMM_DETAIL("QCA7K: PIB Update Ready\n");
+		            break;
+	
+		        case 0x03:
+		            //Firmware Upgrade and PIB Update ready
+		            DEBUG_PRINTF_EVCOMM_DETAIL("QCA7K: Firmware Upgrade and PIB Update ready\n");
+		            break;
+	
+		        case 0x04:
+		            //Loader (Bootloader) ready to receive SDRAM configuration.
+		            DEBUG_PRINTF_EVCOMM_DETAIL("QCA7K: Loader ready to receive SDRAM configuration\n");
+		            break;
+	
+		        case 0x05:
+		            //Reset to Factory Defaults.
+		            DEBUG_PRINTF_EVCOMM_DETAIL("QCA7K: Reset to Factory Defaults\n");
+		            break;
+	
+		        default:
+		            //Reserved
+		            DEBUG_PRINTF_EVCOMM_DETAIL("QCA7K: Reserved\n");
+		            break;
+	        }
+			break;
+	    }
+	
+	    case MMTYPE_VENDOR_ATTEN_CHAR:
+		{
+	        DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_VENDOR_ATTEN_CHAR ---\n");
+	        break;
+		}
+	
+	    case MMTYPE_VENDOR_VS_NW_INFO_CNF:
+		{
+			struct QcaVendorMmeHeader *RecvPacket;
+	        		RecvPacket = (struct QcaVendorMmeHeader *)Buffer;
+	        		memcpy(QcaMac, RecvPacket->OSA, 6);
+	        		sprintf(buf_log_evcomm,
+		                "[QCA7K][Rx][VENDOR_VS_NW_INFO_CNF]Got QCA7K MacAddr:%02X:%02X:%02X:%02X:%02X:%02X (comm:OK)",
+		                 QcaMac[0],  QcaMac[1],  QcaMac[2],  QcaMac[3],  QcaMac[4],  QcaMac[5]);
+	        		SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	
+		        DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_VENDOR_VS_NW_INFO_CNF ---\n");
+		        DEBUG_PRINTF_EVCOMM_DETAIL("QcaMac: %02x:%02x:%02x:%02x:%02x:%02x\n",
+		                QcaMac[0],
+		                QcaMac[1],
+		                QcaMac[2],
+		                QcaMac[3],
+		                QcaMac[4],
+		                QcaMac[5]);
+	
+		        Update_V2G_Flow_Status(CM_SET_KEY_REQ);
+		        ftime(&SeqStartTime);
+	        		break;
+		}
+	case MMTYPE_VENDOR_VS_PL_LNK_STATUS_CNF:
+		{
+			struct QcaVendorMmeHeader *RecvPacket;
+	        		RecvPacket = (struct QcaVendorMmeHeader *)Buffer;
+	        		
+	        		if(RecvPacket->MBODY[1]==0)
+	        		{
+	        			//PLC disconnected
+	        			sprintf(buf_log_evcomm,
+			                "[QCA7K][Rx][MMTYPE_VENDOR_VS_PL_LNK_STATUS_CNF]Got PLC Link Status:%d",
+			                RecvPacket->MBODY[1]);
+	        			SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+	        			Update_V2G_Flow_Status(Other_Fault);
+	        		}
+	        		else	
+		        		Update_V2G_Flow_Status(CM_SET_KEY_REQ);
+		        ftime(&SeqStartTime);
+	        		break;
+		}
+	
+	    default:
+		{
+	       		 break;
+		}
+	}
+}
+
+
+/*===========================================================================
+FUNCTION: SlacComm
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int SlacComm()
+{
+    static unsigned char qca7k_comm_retry = 0;
+    unsigned char *EvMac_in;
+    unsigned char *RunID_in;
+    double t_diff = 0;
+    int packet_size = 0;
+    int count = 0;
+    int idx = 0;
+    int i = 0;
+
+    if(RawSock >= 0)
+    {
+        memset(V2gtpMsgRxBuf, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+        packet_size = recvfrom(RawSock, V2gtpMsgRxBuf, V2GTP_MSG_RX_BUFFER_SIZE, 0, NULL, NULL);
+        if(packet_size > 0)
+        {
+            /*#ifdef Debug
+               DEBUG_PRINTF_EVCOMM_DETAIL("Raw Data: ");
+               for(count=0;count<packet_size;count++)
+                DEBUG_PRINTF_EVCOMM_DETAIL("0x%x, ",V2gtpMsgRxBuf[count]);
+               DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+             #endif*/
+            MmeProcess(V2gtpMsgRxBuf, packet_size);
+        }
+    }
+
+    switch(Check_V2G_Flow_Status())
+    {
+	    case IDLE:
+		{
+	        if(RawSock < 0)
+	        {
+	            RawSock = socket(PF_PACKET, SOCK_RAW, htons(EtherType_HomePlug));
+
+	            sprintf(buf_log_evcomm, "[RawSock]opened(%d)", RawSock);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+	            if(RawSock == -1)
+	            {
+	                SAVE_SYS_LOG_MSG_EVCOMM("SlacComm:Failed to create socket");
+	                Update_V2G_Flow_Status(Other_Fault);
+	                return -1;
+	            }
+
+	            if (setsockopt(RawSock, SOL_SOCKET, SO_BINDTODEVICE, QcaInterface, 4) < 0)
+	            {
+                    SAVE_SYS_LOG_MSG_EVCOMM("SlacComm:Set SO_BINDTODEVICE NG");
+                    Update_V2G_Flow_Status(Other_Fault);
+                    return -1;
+                }
+
+                struct timeval tv;
+	            tv.tv_sec = 0;
+		        tv.tv_usec = 100000;  //100ms (Rx timeout)
+	            if (setsockopt(RawSock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct	timeval)) < 0)
+	            {
+	                SAVE_SYS_LOG_MSG_EVCOMM("SlacComm:Set SO_RCVTIMEO NG");
+	                Update_V2G_Flow_Status(Other_Fault);
+	                return -1;
+	            }
+
+                tv.tv_usec = 100000;  //100ms (Tx timeout)
+                if (setsockopt(RawSock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct	timeval)) < 0)
+	            {
+	                SAVE_SYS_LOG_MSG_EVCOMM("SlacComm:Set SO_SNDTIMEO NG");
+	                Update_V2G_Flow_Status(Other_Fault);
+	                return -1;
+	            }
+
+	            memset(&Req, 0, sizeof(struct ifreq));
+	            strcpy( (char*)Req.ifr_name, QcaInterface);
+
+	            if (ioctl(RawSock, SIOCGIFINDEX, &Req) < 0)
+	            {
+	                SAVE_SYS_LOG_MSG_EVCOMM("SlacComm: ioctl NG");
+	                Update_V2G_Flow_Status(Other_Fault);
+	                return -1;
+	            }
+
+	            memset( &DestSocketAddress, 0, sizeof(struct sockaddr_ll));
+	            DestSocketAddress.sll_ifindex = Req.ifr_ifindex;
+	            DestSocketAddress.sll_halen = ETH_ALEN;
+
+                PwmStartTime = 0;
+
+                EVCOMM_SYS_INFO.QCA7K_SetKeyDone = FALSE;
+                SAVE_SYS_LOG_MSG_EVCOMM("[QCA7K]connecting...");
+                //Get QCA7K MAC address
+                GetQca7kMac();
+                ftime(&SeqStartTime);
+                break;
+	        }
+	        else   //RawSock: opened
+	        {
+                if(EVCOMM_SYS_INFO.QCA7K_SetKeyDone == FALSE)
+                {
+                    ftime(&SeqEndTime);
+                    t_diff = DiffTimeb(SeqStartTime, SeqEndTime);
+
+                    if (t_diff > V2G_SECC_QCA7000_GET_MAC_ADDR_REQ_RETRY_PERIOD)   //3 secs
+                    {
+                        qca7k_comm_retry++;
+                        sprintf(buf_log_evcomm,
+                                "[QCA7K]re-try connecting...(%.02lf/%dms)",
+                                t_diff,
+                                V2G_SECC_QCA7000_GET_MAC_ADDR_REQ_RETRY_PERIOD);
+                        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                        GetQca7kMac(); //re-send req
+                        ftime(&SeqStartTime);
+                        break;
+                    }
+                    else
+                    {
+                        //null
+                    }
+
+                    //Retry by 3 times
+                    if (qca7k_comm_retry >= 3)
+                    {
+                        sprintf(buf_log_evcomm,
+                                "[QCA7K][Error]comm: fail (retry by %d times)",
+                                qca7k_comm_retry);
+                        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                        //Update_ShmStatusCode(); //[To-Do] to be implemented
+                        //CCS_SECCC_TIMEOUT_QCA7000_COMM (023892): The firmware code of QCA7000 may not be installed, yet
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                        ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                        ShmStatusCodeData->PresentStatusCode[0][4] = 9;
+                        ShmStatusCodeData->PresentStatusCode[0][5] = 2;
+                        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+                        Proc_EVStopRes(ShmInternalComm->FD_CAN_Socket);
+
+                        Update_V2G_Flow_Status(Sequence_Timeout);
+                        qca7k_comm_retry = 0;
+                        break;
+                    }
+                }
+                else    //RawSock: opened; Set Key: DONE
+                {
+                	/*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+                    if((CheckConnectorPlugIn() == TRUE) && (ShmInternalComm->ChargingPermission >=1)) 
+                    {
+                        if(PwmStartTime <= 0)
+                        {
+                            //Sniffer_Tcpdump(ENABLE);
+                            //#if (TCPDUMP_PACKETS_SNIFFER_SWITCH == ENABLE)
+                            //sleep(1);   //wait for tcpdump to be ready.
+                            //#endif
+                            SwitchCpStateE(DISABLE);
+                            OutputCpPwmDuty(5);
+                            PwmStartTime = time(NULL);
+                        }
+                        else
+                        {
+                            if((time(NULL) - PwmStartTime) > TT_EVSE_SLAC_init)
+                            {
+                                sprintf(buf_log_evcomm,
+                                        "SlacComm: Wait CM_SLAC_PARM_REQ Timeout - TT_EVSE_SLAC_init, NowTime(%d)-PwmStartTime(%d)>%d (sec)",
+                                        time(NULL),
+                                        PwmStartTime,
+                                        TT_EVSE_SLAC_init);
+                                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                                //CCS_SECC_TIMEOUT_SLAC_TT_EVSE_SLAC_init (023809)
+                                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                                ShmStatusCodeData->PresentStatusCode[0][4] = 0;
+                                ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+                                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+                                Update_V2G_Flow_Status(Sequence_Timeout);
+                                PwmStartTime = 0;
+                                return -1;
+                            }
+                            else
+                            {
+                                //waiting for CM_SLAC_PARM_REQ
+                            }
+                        }
+                    }
+                    else
+                    {
+                        PwmStartTime = 0;
+                    }
+                }
+	        }
+	        break;
+		}
+
+	    case CM_SET_KEY_REQ:   //13
+		{
+	        //CM_SET_KEY_REQ
+            //SAVE_SYS_LOG_MSG_EVCOMM("[QCA7K][Rx]CM_SET_KEY_REQ");
+            ftime(&SeqEndTime);
+            t_diff = DiffTimeb(SeqStartTime, SeqEndTime);
+            if (t_diff > V2G_SECC_QCA7000_COMM_TIMEOUT)   //10 seconds
+            {
+                sprintf(buf_log_evcomm,
+                        "[QCA7K]Failed on SetKey => End_Process (%.02lf/%dms)",
+                        t_diff,
+                        V2G_SECC_QCA7000_COMM_TIMEOUT);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECCC_TIMEOUT_QCA7000_COMM (023892): The firmware code of QCA7000 may not be installed, yet
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 9;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 2;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+                Update_V2G_Flow_Status(Sequence_Timeout);
+            }
+            else if (t_diff > V2G_SECC_QCA7000_SEND_SET_KEY_PERIOD)  //2 seconds
+            {
+                sprintf(buf_log_evcomm,
+                        "[QCA7K]SetKey: proceed (%.02lf/%dms)",
+                        t_diff,
+                        V2G_SECC_QCA7000_SEND_SET_KEY_PERIOD);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                SendSetKey();
+                ftime(&SeqStartTime);
+            }
+            else
+            {
+                //null
+            }
+	        break;
+		}
+
+	    case CM_SET_KEY_CNF:   //14
+		{
+            sprintf(buf_log_evcomm,
+                    "[SECCReady]Wait: plugin(%d), matached(%d), permission(%d)...",
+                    CheckConnectorPlugIn(),
+                    CSUCOMMDC_TASK_FLAG.matched,
+                    ShmInternalComm->ChargingPermission
+                    );
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+            EVCOMM_SYS_INFO.QCA7K_SetKeyDone = TRUE;
+            PwmStartTime = 0;
+            Update_V2G_Flow_Status(IDLE);
+	        break;
+		}
+
+	    case CM_SLAC_PARM_CONF:
+		{
+	        ftime(&SeqEndTime);
+	        if(DiffTimeb(SeqStartTime, SeqEndTime) > TT_match_sequence)
+	        {
+	            sprintf(buf_log_evcomm,
+                        "SlacComm: Wait CM_START_ATTEN_CHAR_IND Timeout - TT_match_sequence (%.02lf of %dms)",
+                        DiffTimeb(SeqStartTime, SeqEndTime),
+                        TT_match_sequence);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_CM_START_ATTEN_CHAR_IND (023811): 
+                //[Possible Reason] CCS Board image might not be updated properly. The 2nd reboot process is not finished.
+                //[Verification Method] By tying reboot command to the terminal and see if it could be executed immediately.
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 1;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+	            Update_V2G_Flow_Status(Sequence_Timeout);
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_START_ATTEN_CHAR_IND:
+		{
+	        ftime(&SeqEndTime);
+	        if(DiffTimeb(SeqStartTime, SeqEndTime) > (TP_EV_batch_msg_interval))    //one more time interval for tolerance
+	        {
+	            sprintf(buf_log_evcomm,
+                        "SlacComm: Wait CM_MNBC_SOUND_IND Timeout - TP_EV_batch_msg_interval (%.02lf of %dms)",
+                        DiffTimeb(SeqStartTime, SeqEndTime),
+                        TP_EV_batch_msg_interval);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_SLAC_CM_MNBC_SOUND_IND (023818): 
+                //[Possible Reason] CCS Board image might not be updated properly. The 2nd reboot process is not finished.
+                //[Verification Method] By tying reboot command to the terminal and see if it could be executed immediately.
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+	            Update_V2G_Flow_Status(Sequence_Timeout);
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_MNBC_SOUND_IND:
+		{
+            #if (NEW_SLAC_ARCHITECTURE_SWITCH == ENABLE)
+            {
+                ftime(&SeqEndTime);
+                t_diff = DiffTimeb(SeqStartTime, SeqEndTime);
+                //printf("time:%.02lf, profilNum:%d\n",DiffTimeb(SeqStartTime, SeqEndTime),AttenProfileCnt);  //added by Vern
+    	        if(t_diff > TT_EVSE_match_MNBC ||
+                  (SLAC_INFO.array[0].AttenProfileCnt >= SLAC_INFO.array[0].MnbcSoundNum) ||
+                  (EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry > 0)) //TC_SECC_VTB_AttenuationCharacterization_003
+                {
+                    //Wait for other SLAC Req sets
+                    if ((SLAC_INFO.arrayLen >= 2) &&
+                        (t_diff < TT_EVSE_match_MNBC) &&
+                        (EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry == 0)) //not a retry
+                    {
+                        break;
+                    }
+
+                    //Check if it is a timeup response
+                    if (t_diff > TT_EVSE_match_MNBC)
+                    {
+                        sprintf(buf_log_evcomm,
+                                "[WARNING][SLAC][Tx]CM_ATTEN_CHAR_IND[%d]: timeup(%.2f/%dms) => send",
+                                (i + 1),
+                                t_diff,
+                                TT_EVSE_match_MNBC);
+                        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    }
+
+                    //Sending all CM_ATTEN_CHAR_IND according to all corresponding SLAC Req sets
+                    for (i = 0; i < SLAC_INFO.arrayLen; i++)
+                    {
+                        if ((SLAC_INFO.array[i].AttenProfileCnt == 0) ||
+                            (SLAC_INFO.array[i].AagGroupsNum == 0) ||
+                            (SLAC_INFO.array[i].StartAttenCharCnt == 0) ||
+                            (SLAC_INFO.array[i].MnbcSoundNum != 10) || //received in CM_START_ATTEN_CHAR_IND
+                            (SLAC_INFO.array[i].StartAttenCharErr == TRUE)
+                           )
+                        {
+                            //Ignoring those SLAC request sets without sending CM_MNBC_SOUND_IND(CM_ATTEN_PROFILE_IND)
+                            sprintf(buf_log_evcomm,
+                                    "[WARNING][SLAC][Tx]CM_ATTEN_CHAR_IND[%d]: para err(%d,%d,%d,%d,%d) => canceled",
+                                    (i + 1),
+                                    SLAC_INFO.array[i].AttenProfileCnt,
+                                    SLAC_INFO.array[i].AagGroupsNum,
+                                    SLAC_INFO.array[i].StartAttenCharCnt,
+                                    SLAC_INFO.array[i].MnbcSoundNum,
+                                    SLAC_INFO.array[i].StartAttenCharErr);
+                            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                            continue;
+                        }
+
+                        //In CM_ATTEN_CHAR_IND retry process, here only re-send this message according to the 1st coming SLAC request
+                        if ((EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry > 0) && (i != 0))
+                        {
+                            sprintf(buf_log_evcomm,
+                                    "[NOTE][SLAC][Tx]CM_ATTEN_CHAR_IND[%d]: canceled",
+                                    (i + 1));
+                            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                            break;
+                        }
+
+                        EvMac_in = SLAC_INFO.array[i].EvMac;
+                        RunID_in = SLAC_INFO.array[i].RunID;
+
+                        memset(&SendMmePacket, 0, sizeof(struct MmeHeader));
+                        memcpy(SendMmePacket.ODA, EvMac_in, SLAC_EVMAC_LENGTH);
+                        memcpy(SendMmePacket.OSA, CsuMac, 6);
+                        SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+                        SendMmePacket.MMV = 0x01;
+                        SendMmePacket.MMTYPE = MMTYPE_CM_ATTEN_CHAR_IND;
+                        SendMmePacket.FMI[0] = SendMmePacket.FMI[1] = 0;
+                        SendMmePacketSize = 0;
+                        SendMmePacket.MMENTRY[SendMmePacketSize++] = 0;    //APPLICATION_TYPE(0x00: EV-EVSE Matching)
+                        SendMmePacket.MMENTRY[SendMmePacketSize++] = 0;    //SECURITY_TYPE(0x00: No Security)
+                        memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, EvMac_in, SLAC_EVMAC_LENGTH); //SOURCE_ADDRESS, MAC address of the EV Host
+                        SendMmePacketSize += SLAC_EVMAC_LENGTH;
+                        memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, RunID_in, SLAC_RUNID_LENGTH);
+                        SendMmePacketSize += SLAC_RUNID_LENGTH;
+                        memset(SendMmePacket.MMENTRY + SendMmePacketSize, 0, 17); //SOURCE_ID(0x00)
+                        SendMmePacketSize += 17;
+                        memset(SendMmePacket.MMENTRY + SendMmePacketSize, 0, 17); //RESP_ID(0x00)
+                        SendMmePacketSize += 17;
+                        SendMmePacket.MMENTRY[SendMmePacketSize++] = SLAC_INFO.array[i].AttenProfileCnt; //NumSounds: Number of M-Sounds used for generation of the ATTEN_PROFILE
+                        SendMmePacket.MMENTRY[SendMmePacketSize++] = SLAC_INFO.array[i].AagGroupsNum;    //NumGroups
+
+                        for(count = 0; count < SLAC_INFO.array[i].AagGroupsNum; count++)
+                        {
+                            unsigned char TmpAag;
+                            TmpAag = ((SLAC_INFO.array[i].AAG[count] / SLAC_INFO.array[i].AttenProfileCnt) & 0xFF);
+                            SLAC_INFO.array[i].AAG_quality_ori += (float) TmpAag;   //original signal quality
+
+                            #if (SUDO_PSD_PARAMETER_MECHANISM == ENABLE)    //default: ENABLE
+                                #if 1
+                                //TC_SECC_VTB_AttenuationCharacterization_019
+                                TmpAag = TmpAag >> 1;   //new method proposed by Joseph (divided by 2)
+                                #else
+                                if(TmpAag >= 39)        //original method proposed by Vern
+                                {
+                                    TmpAag = 37;
+                                }
+                                #endif
+                            #endif
+                            SendMmePacket.MMENTRY[SendMmePacketSize++] = TmpAag;
+                            SLAC_INFO.array[i].AAG_quality_refined += (float) TmpAag;   //refined signal quality
+                        }
+                        SendMmePacketSize += 19;      //the size before MMENTRY
+
+                        #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == TRUE)
+                        {
+                            DEBUG_PRINTF_EVCOMM_DETAIL("\n\n***** Send MME Packet *****\n");
+                            DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.ODA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+                                   SendMmePacket.ODA[0],SendMmePacket.ODA[1],SendMmePacket.ODA[2],SendMmePacket.ODA[3],SendMmePacket.ODA[4],SendMmePacket.ODA[5]);
+                            DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.OSA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+                                   SendMmePacket.OSA[0],SendMmePacket.OSA[1],SendMmePacket.OSA[2],SendMmePacket.OSA[3],SendMmePacket.OSA[4],SendMmePacket.OSA[5]);
+                            DEBUG_PRINTF_EVCOMM_DETAIL("MTYPE: 0x%x\n", htons(SendMmePacket.MTYPE));
+                            DEBUG_PRINTF_EVCOMM_DETAIL("MMV: 0x%x\n", SendMmePacket.MMV);
+                            DEBUG_PRINTF_EVCOMM_DETAIL("MMTYPE: 0x%x\n", SendMmePacket.MMTYPE);
+                            DEBUG_PRINTF_EVCOMM_DETAIL("FMI 0x%x, 0x%x\n", SendMmePacket.FMI[0],SendMmePacket.FMI[1]);
+                            DEBUG_PRINTF_EVCOMM_DETAIL("--- CM_ATTEN_CHAR_IND ---\n");
+                            DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", SendMmePacket.MMENTRY[0]);
+                            DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", SendMmePacket.MMENTRY[1]);
+                            DEBUG_PRINTF_EVCOMM_DETAIL("SOURCE_ADDRESS: %02x:%02x:%02x:%02x:%02x:%02x\n",
+                                   SendMmePacket.MMENTRY[2],SendMmePacket.MMENTRY[3],SendMmePacket.MMENTRY[4],SendMmePacket.MMENTRY[5],
+                                   SendMmePacket.MMENTRY[6],SendMmePacket.MMENTRY[7]);
+                            DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+                                   SendMmePacket.MMENTRY[8],SendMmePacket.MMENTRY[9],SendMmePacket.MMENTRY[10],SendMmePacket.MMENTRY[11],
+                                   SendMmePacket.MMENTRY[12],SendMmePacket.MMENTRY[13],SendMmePacket.MMENTRY[14],SendMmePacket.MMENTRY[15]);
+                            DEBUG_PRINTF_EVCOMM_DETAIL("SOURCE_ID: \n");
+                            for(count=0; count<17; count++)
+                            {
+                                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[16+count]);
+                            }
+                            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+                            DEBUG_PRINTF_EVCOMM_DETAIL("RESP_ID: \n");
+                            for(count=0; count<17; count++)
+                            {
+                                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[33+count]);
+                            }
+                            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+                            DEBUG_PRINTF_EVCOMM_DETAIL("NumSounds: 0x%x\n", SendMmePacket.MMENTRY[50]);
+                            DEBUG_PRINTF_EVCOMM_DETAIL("ATTEN_PROFILE: \n");
+                            for(count=0; count<AagGroupsNum; count++)
+                            {
+                                DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[51+count]);
+                            }
+                            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+                        }
+                        #endif
+
+                        count = sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+
+                        SLAC_INFO.array[i].AAG_quality_ori /= SLAC_INFO.array[i].AagGroupsNum;
+                        SLAC_INFO.array[i].AAG_quality_refined /= SLAC_INFO.array[i].AagGroupsNum;
+
+                        //Print log if this CM_ATTEN_CHAR_IND belongs to RETRY Tx message.
+                        if (EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry > 0)
+                        {
+                            sprintf(buf_log_evcomm,
+                                    "[SLAC][Tx]CM_ATTEN_CHAR_IND[%d]: %d-th resend (Q=%.2f/%.2f)(%d/%d)",
+                                    (i + 1),
+                                    EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry,
+                                    SLAC_INFO.array[i].AAG_quality_refined,
+                                    SLAC_INFO.array[i].AAG_quality_ori,
+                                    SLAC_INFO.array[i].AttenProfileCnt,
+                                    SLAC_INFO.array[i].MnbcSoundNum);
+                            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                        }
+                        else if (EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry == 0)
+                        {
+                            sprintf(buf_log_evcomm,
+                                    "[SLAC][Tx]CM_ATTEN_CHAR_IND[%d]: Q=%.2f/%.2f(%d/%d)",
+                                    (i + 1),
+                                    SLAC_INFO.array[i].AAG_quality_refined,
+                                    SLAC_INFO.array[i].AAG_quality_ori,
+                                    SLAC_INFO.array[i].AttenProfileCnt,
+                                    SLAC_INFO.array[i].MnbcSoundNum);
+                            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                        }
+                        else
+                        {
+                            sprintf(buf_log_evcomm,
+                                    "[SLAC][Tx]CM_ATTEN_CHAR_IND[%d]: unexpected CM_ATTEN_CHAR_IND_retry(%d))",
+                                    i,
+                                    EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry);
+                            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                        }
+
+                        DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacketSize=%d,Rtn=%d\n", SendMmePacketSize,count);
+                    } //end of for loop
+
+                    Update_V2G_Flow_Status(CM_ATTEN_CHAR_IND);
+                    ftime(&SeqStartTime);
+    	        }
+    	        break;
+            }
+            #else
+            {
+                ftime(&SeqEndTime);
+                //printf("time:%.02lf, profilNum:%d\n",DiffTimeb(SeqStartTime, SeqEndTime),AttenProfileCnt);  //added by Vern
+
+    	        if(DiffTimeb(SeqStartTime, SeqEndTime) > TT_EVSE_match_MNBC || (AttenProfileCnt >= MnbcSoundNum) || (EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry > 0))
+                {
+                    memset(&SendMmePacket, 0, sizeof(struct MmeHeader));
+                    memcpy(SendMmePacket.ODA, EvMac, 6);
+                    memcpy(SendMmePacket.OSA, CsuMac, 6);
+                    SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+                    SendMmePacket.MMV = 0x01;
+                    SendMmePacket.MMTYPE = MMTYPE_CM_ATTEN_CHAR_IND;
+                    SendMmePacket.FMI[0] = SendMmePacket.FMI[1] = 0;
+                    SendMmePacketSize = 0;
+                    SendMmePacket.MMENTRY[SendMmePacketSize++] = 0;    //APPLICATION_TYPE(0x00: EV-EVSE Matching)
+                    SendMmePacket.MMENTRY[SendMmePacketSize++] = 0;    //SECURITY_TYPE(0x00: No Security)
+                    memcpy(SendMmePacket.MMENTRY + SendMmePacketSize, EvMac, 6); //SOURCE_ADDRESS, MAC address of the EV Host
+                    SendMmePacketSize += 6;
+                    memcpy(SendMmePacket.MMENTRY+SendMmePacketSize, SlacRunId, sizeof(SlacRunId));
+                    SendMmePacketSize += sizeof(SlacRunId);
+                    memset(SendMmePacket.MMENTRY+SendMmePacketSize, 0, 17);    //SOURCE_ID
+                    SendMmePacketSize += 17;
+                    memset(SendMmePacket.MMENTRY+SendMmePacketSize, 0, 17);    //RESP_ID
+                    SendMmePacketSize += 17;
+                    SendMmePacket.MMENTRY[SendMmePacketSize++] = AttenProfileCnt;    //NumSounds
+                    SendMmePacket.MMENTRY[SendMmePacketSize++] = AagGroupsNum;    //NumGroups
+                    for(count=0; count < AagGroupsNum; count++)
+                    {
+                        unsigned char TmpAag;
+                        TmpAag = ((Aag[count] / AttenProfileCnt) & 0xFF);
+                        #if (SUDO_PSD_PARAMETER_MECHANISM == ENABLE)    //default: ENABLE
+                            #if 1
+                            //TC_SECC_VTB_AttenuationCharacterization_019
+                            TmpAag = TmpAag >> 1;   //new method proposed by Joseph (divided by 2)
+                            #else
+                            if(TmpAag >= 39)        //original method proposed by Vern
+                            {
+                                /*
+                                // [To-do] If this statement is enabled, SLAC will fail due to timeout.
+                                {
+                                    unsigned char TmpBuf[64];
+                                    memset(TmpBuf,0,sizeof(TmpBuf));
+                                    sprintf(TmpBuf,"SlacComm: bad Aag[%d]=%d",count,TmpAag);
+                                    SAVE_SYS_LOG_MSG_EVCOMM(TmpBuf);
+                                }
+                                */
+                                printf("%d,", TmpAag);
+                                TmpAag = 37;
+                            }
+                            #endif
+                        #endif
+                        SendMmePacket.MMENTRY[SendMmePacketSize++] = TmpAag;
+                    }
+                    SendMmePacketSize += 19;      //the size before MMENTRY
+
+                    #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == TRUE)
+                    {
+                        DEBUG_PRINTF_EVCOMM_DETAIL("\n\n***** Send MME Packet *****\n");
+                        DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.ODA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+                               SendMmePacket.ODA[0],SendMmePacket.ODA[1],SendMmePacket.ODA[2],SendMmePacket.ODA[3],SendMmePacket.ODA[4],SendMmePacket.ODA[5]);
+                        DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.OSA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+                               SendMmePacket.OSA[0],SendMmePacket.OSA[1],SendMmePacket.OSA[2],SendMmePacket.OSA[3],SendMmePacket.OSA[4],SendMmePacket.OSA[5]);
+                        DEBUG_PRINTF_EVCOMM_DETAIL("MTYPE: 0x%x\n", htons(SendMmePacket.MTYPE));
+                        DEBUG_PRINTF_EVCOMM_DETAIL("MMV: 0x%x\n", SendMmePacket.MMV);
+                        DEBUG_PRINTF_EVCOMM_DETAIL("MMTYPE: 0x%x\n", SendMmePacket.MMTYPE);
+                        DEBUG_PRINTF_EVCOMM_DETAIL("FMI 0x%x, 0x%x\n", SendMmePacket.FMI[0],SendMmePacket.FMI[1]);
+                        DEBUG_PRINTF_EVCOMM_DETAIL("--- CM_ATTEN_CHAR_IND ---\n");
+                        DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", SendMmePacket.MMENTRY[0]);
+                        DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", SendMmePacket.MMENTRY[1]);
+                        DEBUG_PRINTF_EVCOMM_DETAIL("SOURCE_ADDRESS: %02x:%02x:%02x:%02x:%02x:%02x\n",
+                               SendMmePacket.MMENTRY[2],SendMmePacket.MMENTRY[3],SendMmePacket.MMENTRY[4],SendMmePacket.MMENTRY[5],
+                               SendMmePacket.MMENTRY[6],SendMmePacket.MMENTRY[7]);
+                        DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+                               SendMmePacket.MMENTRY[8],SendMmePacket.MMENTRY[9],SendMmePacket.MMENTRY[10],SendMmePacket.MMENTRY[11],
+                               SendMmePacket.MMENTRY[12],SendMmePacket.MMENTRY[13],SendMmePacket.MMENTRY[14],SendMmePacket.MMENTRY[15]);
+                        DEBUG_PRINTF_EVCOMM_DETAIL("SOURCE_ID: \n");
+                        for(count=0; count<17; count++)
+                        {
+                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[16+count]);
+                        }
+                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+                        DEBUG_PRINTF_EVCOMM_DETAIL("RESP_ID: \n");
+                        for(count=0; count<17; count++)
+                        {
+                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[33+count]);
+                        }
+                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+                        DEBUG_PRINTF_EVCOMM_DETAIL("NumSounds: 0x%x\n", SendMmePacket.MMENTRY[50]);
+                        DEBUG_PRINTF_EVCOMM_DETAIL("ATTEN_PROFILE: \n");
+                        for(count=0; count<AagGroupsNum; count++)
+                        {
+                            DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ",SendMmePacket.MMENTRY[51+count]);
+                        }
+                        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+                    }
+                    #endif
+
+                    Update_V2G_Flow_Status(CM_ATTEN_CHAR_IND);
+                    count = sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+
+                    //Print log if this CM_ATTEN_CHAR_IND belongs to RETRY Tx message.
+                    if (EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry > 0)
+                    {
+                        sprintf(buf_log_evcomm,
+                                "[SLAC][Tx]CM_ATTEN_CHAR_IND: resend(%d-th)",
+                                EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry);
+                        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    }
+
+                    DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacketSize=%d,Rtn=%d\n", SendMmePacketSize,count);
+
+                    ftime(&SeqStartTime);
+    	        }
+    	        break;
+            }
+            #endif
+		}
+
+	    case CM_ATTEN_CHAR_IND:
+		{
+	        ftime(&SeqEndTime);
+	        //if(DiffTimeb(SeqStartTime, SeqEndTime)>TT_match_response)
+	        if(DiffTimeb(SeqStartTime, SeqEndTime) > TT_match_response)     //extended to 400ms due to the response of CM_ATTEN_CHAR.RSP of some EVCC is slower than 200ms.
+	        {
+	            sprintf(buf_log_evcomm,
+                        "SlacComm: Wait CM_ATTEN_CHAR_RSP Timeout - TT_match_response (%.02lf of %dms)",
+                        DiffTimeb(SeqStartTime, SeqEndTime),
+                        TT_match_response);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_SLAC_CM_ATTEN_CHAR_RSP (023814): 
+                //[Possible Reason] Frequent on BMW i3, need to drive the EV a bit.
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 4;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+	            Update_V2G_Flow_Status(Sequence_Timeout);
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_ATTEN_CHAR_RSP:
+		{
+	        ftime(&SeqEndTime);
+	        if(DiffTimeb(SeqStartTime, SeqEndTime) > TT_EVSE_match_session)
+	        {
+	            sprintf(buf_log_evcomm,
+                        "SlacComm: Wait CM_VALIDATE_REQ_1ST or CM_SLAC_MATCH_REQ Timeout - TT_EVSE_match_session (%.02lf of %dms)",
+                        DiffTimeb(SeqStartTime, SeqEndTime),
+                        TT_EVSE_match_session);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_SLAC_CM_VALIDATE_REQ_1ST__CM_SLAC_MATCH_REQ (023815): 
+                //[Possible Reason] Frequent on BMW i3, need to drive the EV a bit.
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 5;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+	            Update_V2G_Flow_Status(Sequence_Timeout);
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_VALIDATE_CNF:
+		{
+	        ftime(&SeqEndTime);
+	        if(DiffTimeb(SeqStartTime, SeqEndTime) > TT_match_sequence)
+	        {
+	            sprintf(buf_log_evcomm,
+                        "SlacComm: Wait CM_VALIDATE_REQ_2ND or CM_SLAC_MATCH_REQ Timeout - TT_match_sequence (%.02lf of %dms)",
+                        DiffTimeb(SeqStartTime, SeqEndTime),
+                        TT_match_sequence);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_SLAC_CM_VALIDATE_REQ_2ND__CM_SLAC_MATCH_REQ (023819): 
+                //[Possible Reason] Frequent on BMW i3, need to drive the EV a bit.
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+	            Update_V2G_Flow_Status(Sequence_Timeout);
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_SLAC_MATCH_CNF:
+		{
+	        if(UdpSock > 0)
+	        {
+	            close(UdpSock);
+	            UdpSock = -1;
+	        }
+	        if(TcpSock > 0)
+	        {
+	            close(TcpSock);
+	            TcpSock = -1;
+	        }
+	        ftime(&SeqStartTime);
+            V2gTcpConnected();
+            Update_V2G_Flow_Status(SLACC_SDP_UDP_Connection);
+            SAVE_SYS_LOG_MSG_EVCOMM("SLAAC,SDP,UDP: connecting...");
+	        break;
+		}
+
+		defaudlt:
+		{
+		    break;
+		}
+    }
+    return 0;
+}
+
+
+/*===========================================================================
+FUNCTION: V2gMsgDecoder
+DESCRIPTION:
+        1. Decode the V2GTP messages inside "msg" and save the decoded
+           messages in ccs_exi_doc_DIN, ccs_exi_doc_ISO1, and ccs_exi_doc_ISO2,
+           respectively.
+
+        2. After decoding, V2gMsg_Process() could then use
+           ccs_exi_doc_DIN, ccs_exi_doc_ISO1, or ccs_exi_doc_ISO2
+           to deal with the corresponding Response messages, respectively.
+
+PRE-CONDITION:
+        1. msg_length > 0
+
+INPUT:
+        1. msg
+        2. msg_length
+
+OUTPUT:
+        1. ccs_exi_doc_DIN     //global variable
+           ccs_exi_doc_ISO1
+           ccs_exi_doc_ISO2
+
+        2. v2g_state            //Status Flag
+                                //indicating the V2gMsg_Process_din to proceed
+                                  the next process.
+        3. return value         // < 0: ERROR
+                                // > 0: Message Type
+
+GLOBAL VARIABLES:
+=============================================================================*/
+int V2gMsgDecoder(unsigned char *msg, unsigned int msg_length, unsigned int v2g_state)
+{
+    int errn = 0;
+
+    //Checking the minimum Header size requirement
+    if(msg_length < V2GTP_MSG_HEADER_LENGTH)   //The minimum requirement should be 8-byte header.
+    {
+        errn = -1;
+        return errn;
+    }
+
+    //Decode the 1st V2GMSG: AppProtocol
+    if(v2g_state == SupportedAppProtocolRequest)   //17
+    {
+        if (errn = API_V2GMSG_EXI_Decoder_AppProtocol(msg, msg_length, &ccs_handshake) < 0)
+        {
+            DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR = %d (DEC)]V2gMsgDecoder: SupportedAppProtocolRequest()\n", errn);
+        }
+        else    //decoded successfully.
+        {
+            //PRINT_XML_DOC_supportedAppProtocolReq(&ccs_handshake);
+        }
+    }
+    //Decode the subsequent V2GMSG (DIN 70121, ISO 15118-2, ISO 15118-20)
+    else if(v2g_state > SupportedAppProtocolRequest && v2g_state <= SessionStopResponse)
+    {
+        //Decoding according to its own protocol
+        switch (ShmCcsData->CommProtocol)
+        {
+            case V2GT_MSG_PROTOCOL_DIN70121:        //0
+            {
+                //DIN
+                if(errn = API_V2GMSG_EXI_Decoder_DIN(msg, msg_length, &ccs_exi_doc_DIN) < 0)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR = %d (DEC)]V2gMsgDecoder: API_V2GMSG_EXI_Decoder_DIN()",
+                            errn);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                }
+                break;
+            }
+
+            case V2GT_MSG_PROTOCOL_ISO15118_2014:   //1
+            {
+                //ISO1
+                if(errn = API_V2GMSG_EXI_Decoder_ISO1(msg, msg_length, &ccs_exi_doc_ISO1) < 0)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR = %d (DEC)]V2gMsgDecoder: API_V2GMSG_EXI_Decoder_ISO1()",
+                            errn);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                }
+                break;
+            }
+
+            case V2GT_MSG_PROTOCOL_ISO15118_2018:   //2
+            {
+                //ISO2
+                if(errn = API_V2GMSG_EXI_Decoder_ISO2(msg, msg_length, &ccs_exi_doc_ISO2) < 0)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR = %d (DEC)]V2gMsgDecoder: API_V2GMSG_EXI_Decoder_ISO2()",
+                            errn);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                }
+                break;
+            }
+
+            default:
+                break;
+        }
+    }
+    else
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR = %d (DEC)]V2gMsgDecoder: Unexpected v2g_state\n", errn);
+        errn = -1;
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: encode_din_V2GTP_stream
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int encode_din_V2GTP_stream(bitstream_t *v2g_tx_stream, struct dinEXIDocument *ccs_exi_doc_DIN)
+{
+    int errn = 0;
+    *v2g_tx_stream->pos = V2GTP_HEADER_LENGTH;
+
+    errn = encode_dinExiDocument(v2g_tx_stream, ccs_exi_doc_DIN);
+    if (errn == 0)
+    {
+        //successfully encoded
+        errn = write_v2gtpHeader(v2g_tx_stream->data, (*v2g_tx_stream->pos) - V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
+        v2g_tx_stream->size = *v2g_tx_stream->pos;	//total length of the encoded V2GMSG.
+
+        if (errn != 0)
+        {
+            DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm][encode_din_V2GTP_stream]write_v2gtpHeader(): %d (DEC)\n", errn);
+        }
+    }
+    else
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm][encode_din_V2GTP_stream]encode_dinExiDocument(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: encode_iso1_V2GTP_stream
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int encode_iso1_V2GTP_stream(bitstream_t *v2g_tx_stream, struct iso1EXIDocument *ccs_exi_doc_ISO1)
+{
+    int errn = 0;
+    *v2g_tx_stream->pos = V2GTP_HEADER_LENGTH;
+
+    errn = encode_iso1ExiDocument(v2g_tx_stream, ccs_exi_doc_ISO1);   
+    if (errn == 0)
+    {
+        //successfully encoded
+        errn = write_v2gtpHeader(v2g_tx_stream->data, (*v2g_tx_stream->pos) - V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
+        v2g_tx_stream->size = *v2g_tx_stream->pos;	//total length of the encoded V2GMSG.
+
+        if (errn != 0)
+        {
+            DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm][encode_iso1_V2GTP_stream]write_v2gtpHeader(): %d (DEC)\n", errn);
+        }
+    }
+    else
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm][encode_iso1_V2GTP_stream]encode_iso1ExiDocument(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: encode_iso2_V2GTP_stream
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int encode_iso2_V2GTP_stream(bitstream_t *v2g_tx_stream, struct iso2EXIDocument *ccs_exi_doc_ISO2)
+{
+    int errn = 0;
+    *v2g_tx_stream->pos = V2GTP_HEADER_LENGTH;
+
+    errn = encode_iso2ExiDocument(v2g_tx_stream, ccs_exi_doc_ISO2);
+    if (errn == 0)
+    {
+        //successfully encoded
+        errn = write_v2gtpHeader(v2g_tx_stream->data, (*v2g_tx_stream->pos) - V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
+        v2g_tx_stream->size = *v2g_tx_stream->pos;	//total length of the encoded V2GMSG.
+
+        if (errn != 0)
+        {
+            DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm][encode_iso2_V2GTP_stream]write_v2gtpHeader(): %d (DEC)\n", errn);
+        }
+    }
+    else
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm][encode_iso2_V2GTP_stream]encode_iso2ExiDocument(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: send_encoded_din_V2GTP_Stream
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int send_encoded_din_V2GTP_Stream(int AcceptFd, bitstream_t *v2g_tx_stream, struct dinEXIDocument *ccs_exi_doc_DIN)
+{
+    int errn = 0;
+
+    // STEP 1: =========== Encoding into EXI and Composing into V2GTP Stream ==========
+    errn = encode_din_V2GTP_stream(v2g_tx_stream, ccs_exi_doc_DIN);
+
+    // STEP 2: =========== Send Response Packet  ===========
+    int rtn = 0;
+    rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+
+	if (rtn == v2g_tx_stream->size)
+    {
+        /*
+        DEBUG_PRINTF_EVCOMM_DETAIL("[SeccComm][send_encoded_din_V2GTP_Stream] Response Message is sent ( %d / %d ). (Bytes, DEC): OK\n",
+                rtn, v2g_tx_stream->size);
+        */
+
+        //Reset all EXI doc Req/Res _isUsed Flags after each Res Tx
+
+    }
+    else if (rtn >= 0)
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm][send_encoded_din_V2GTP_Stream]Imcomplete Tx ( %d / %d ). (Bytes, DEC): FAIL\n",
+                                    rtn, v2g_tx_stream->size);
+    }
+    else
+    {
+        errn = rtn;
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][send_encoded_din_V2GTP_Stream]send(): %d (DEC)\n", errn);
+    }
+
+    //STEP 3: ========= Reset V2G MSG Flags ==========
+    init_dinBodyType(&ccs_exi_doc_DIN->V2G_Message.Body);
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: send_encoded_iso1_V2GTP_Stream
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int send_encoded_iso1_V2GTP_Stream(int AcceptFd, bitstream_t *v2g_tx_stream, struct iso1EXIDocument *ccs_exi_doc_ISO1)
+{
+    int errn = 0;
+
+    // STEP 1: =========== Encoding into EXI and Composing into V2GTP Stream ==========
+    errn = encode_iso1_V2GTP_stream(v2g_tx_stream, ccs_exi_doc_ISO1);
+    // STEP 2: =========== Send Response Packet  ===========
+    int rtn = 0;
+    rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+	if (rtn == v2g_tx_stream->size)
+    {
+        /*
+        DEBUG_PRINTF_EVCOMM_DETAIL("[SeccComm][send_encoded_iso1_V2GTP_Stream] Response Message is sent ( %d / %d ). (Bytes, DEC): OK\n",
+                rtn, v2g_tx_stream->size);
+        */
+
+        //Reset all EXI doc Req/Res _isUsed Flags after each Res Tx
+
+    }
+    else if (rtn >= 0)
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm][send_encoded_iso1_V2GTP_Stream]Imcomplete Tx ( %d / %d ). (Bytes, DEC): FAIL\n",
+                                    rtn, v2g_tx_stream->size);
+    }
+    else
+    {
+        errn = rtn;
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][send_encoded_iso1_V2GTP_Stream]send(): %d (DEC)\n", errn);
+    }
+
+    //STEP 3: ========= Reset V2G MSG Flags ==========
+    init_iso1BodyType(&ccs_exi_doc_ISO1->V2G_Message.Body);
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: send_encoded_iso2_V2GTP_Stream
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int send_encoded_iso2_V2GTP_Stream(int AcceptFd, bitstream_t *v2g_tx_stream, struct iso2EXIDocument *ccs_exi_doc_ISO2)
+{
+    int errn = 0;
+
+    // STEP 1: =========== Encoding into EXI and Composing into V2GTP Stream ==========
+    errn = encode_iso2_V2GTP_stream(v2g_tx_stream, ccs_exi_doc_ISO2);
+
+    // STEP 2: =========== Send Response Packet  ===========
+    int rtn = 0;
+    rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+
+	if (rtn == v2g_tx_stream->size)
+    {
+        /*
+        DEBUG_PRINTF_EVCOMM_DETAIL("[SeccComm][send_encoded_iso2_V2GTP_Stream] Response Message is sent ( %d / %d ). (Bytes, DEC): OK\n",
+                rtn, v2g_tx_stream->size);
+        */
+
+        //Reset all EXI doc Req/Res _isUsed Flags after each Res Tx
+
+    }
+    else if (rtn >= 0)
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm][send_encoded_iso2_V2GTP_Stream]Imcomplete Tx ( %d / %d ). (Bytes, DEC): FAIL\n",
+                                    rtn, v2g_tx_stream->size);
+    }
+    else
+    {
+        errn = rtn;
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][send_encoded_iso2_V2GTP_Stream]send(): %d (DEC)\n", errn);
+    }
+
+    //STEP 3: ========= Reset V2G MSG Flags ==========
+    init_iso2BodyType(&ccs_exi_doc_ISO2->V2G_Message.Body);
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Check_din_V2G_Rx_MSG_SessionID
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Check_din_V2G_Rx_MSG_SessionID(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    int leng = 0;
+    int errn = 0;
+    leng = exi_doc_DIN->V2G_Message.Header.SessionID.bytesLen;
+
+    //Step 1: Check SessionID Length
+    if (leng != 8)  //8-byte
+    {
+        sprintf(buf_log_evcomm, "[ERROR]SessionID: incorrect length(%d)", leng);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        errn = -1;
+    }
+    else
+    {
+        //Step 2-1: Check SessionID content
+        for (i = 0; i < leng; i++)
+        {
+            if (exi_doc_DIN->V2G_Message.Header.SessionID.bytes[i] != EVCOMM_SYS_INFO.SessionID[i])
+            {
+                errn = -2;
+                break;
+            }
+        }
+    }
+
+    //Step 2-2: Print Incorrect ID
+    if (errn == -2) //incorrect ID
+    {
+        sprintf(buf_log_evcomm,
+                "[ERROR]SessionID: incorrect ID(RX:%02X%02X%02X%02X%02X%02X%02X%02X, ORI:%02X%02X%02X%02X%02X%02X%02X%02X)",
+                exi_doc_DIN->V2G_Message.Header.SessionID.bytes[0],
+                exi_doc_DIN->V2G_Message.Header.SessionID.bytes[1],
+                exi_doc_DIN->V2G_Message.Header.SessionID.bytes[2],
+                exi_doc_DIN->V2G_Message.Header.SessionID.bytes[3],
+                exi_doc_DIN->V2G_Message.Header.SessionID.bytes[4],
+                exi_doc_DIN->V2G_Message.Header.SessionID.bytes[5],
+                exi_doc_DIN->V2G_Message.Header.SessionID.bytes[6],
+                exi_doc_DIN->V2G_Message.Header.SessionID.bytes[7],
+                EVCOMM_SYS_INFO.SessionID[0],
+                EVCOMM_SYS_INFO.SessionID[1],
+                EVCOMM_SYS_INFO.SessionID[2],
+                EVCOMM_SYS_INFO.SessionID[3],
+                EVCOMM_SYS_INFO.SessionID[4],
+                EVCOMM_SYS_INFO.SessionID[5],
+                EVCOMM_SYS_INFO.SessionID[6],
+                EVCOMM_SYS_INFO.SessionID[7]
+            );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+
+    //Step 3: Correct SessionID for Res Message
+    if (errn != 0)
+    {
+        exi_doc_DIN->V2G_Message.Header.SessionID.bytesLen = 8;
+        memset(exi_doc_DIN->V2G_Message.Header.SessionID.bytes, 0, 8);
+        memcpy(exi_doc_DIN->V2G_Message.Header.SessionID.bytes, EVCOMM_SYS_INFO.SessionID, 8);
+    }
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Check_iso1_V2G_Rx_MSG_SessionID
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Check_iso1_V2G_Rx_MSG_SessionID(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    int leng = 0;
+    int errn = 0;
+    leng = exi_doc_ISO1->V2G_Message.Header.SessionID.bytesLen;
+
+    //Step 1: Check SessionID Length
+    if (leng != 8)  //8-byte
+    {
+        sprintf(buf_log_evcomm, "[ERROR]SessionID: incorrect length(%d)", leng);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        errn = -1;
+    }
+    else
+    {
+        //Step 2-1: Check SessionID content
+        for (i = 0; i < leng; i++)
+        {
+            if (exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[i] != EVCOMM_SYS_INFO.SessionID[i])
+            {
+                errn = -2;
+                break;
+            }
+        }
+    }
+
+    //Step 2-2: Print Incorrect ID
+    if (errn == -2) //incorrect ID
+    {
+        sprintf(buf_log_evcomm,
+                "[ERROR]SessionID: incorrect ID(RX:%02X%02X%02X%02X%02X%02X%02X%02X, ORI:%02X%02X%02X%02X%02X%02X%02X%02X)",
+                exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[0],
+                exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[1],
+                exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[2],
+                exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[3],
+                exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[4],
+                exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[5],
+                exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[6],
+                exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[7],
+                EVCOMM_SYS_INFO.SessionID[0],
+                EVCOMM_SYS_INFO.SessionID[1],
+                EVCOMM_SYS_INFO.SessionID[2],
+                EVCOMM_SYS_INFO.SessionID[3],
+                EVCOMM_SYS_INFO.SessionID[4],
+                EVCOMM_SYS_INFO.SessionID[5],
+                EVCOMM_SYS_INFO.SessionID[6],
+                EVCOMM_SYS_INFO.SessionID[7]
+            );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+
+    //Step 3: Correct SessionID for Res Message
+    if (errn != 0)
+    {
+        exi_doc_ISO1->V2G_Message.Header.SessionID.bytesLen = 8;
+        memset(exi_doc_ISO1->V2G_Message.Header.SessionID.bytes, 0, 8);
+        memcpy(exi_doc_ISO1->V2G_Message.Header.SessionID.bytes, EVCOMM_SYS_INFO.SessionID, 8);
+    }
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Check_iso2_V2G_Rx_MSG_SessionID
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Check_iso2_V2G_Rx_MSG_SessionID(struct iso2EXIDocument *exi_doc_ISO2)
+{
+    int i = 0;
+    int leng = 0;
+    int errn = 0;
+    leng = exi_doc_ISO2->V2G_Message.Header.SessionID.bytesLen;
+
+    //Step 1: Check SessionID Length
+    if (leng != 8)  //8-byte
+    {
+        sprintf(buf_log_evcomm, "[ERROR]SessionID: incorrect length(%d)", leng);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        errn = -1;
+    }
+    else
+    {
+        //Step 2-1: Check SessionID content
+        for (i = 0; i < leng; i++)
+        {
+            if (exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[i] != EVCOMM_SYS_INFO.SessionID[i])
+            {
+                errn = -2;
+                break;
+            }
+        }
+    }
+
+    //Step 2-2: Print Incorrect ID
+    if (errn == -2) //incorrect ID
+    {
+        sprintf(buf_log_evcomm,
+                "[ERROR]SessionID: incorrect ID(RX:%02X%02X%02X%02X%02X%02X%02X%02X, ORI:%02X%02X%02X%02X%02X%02X%02X%02X)",
+                exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[0],
+                exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[1],
+                exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[2],
+                exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[3],
+                exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[4],
+                exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[5],
+                exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[6],
+                exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[7],
+                EVCOMM_SYS_INFO.SessionID[0],
+                EVCOMM_SYS_INFO.SessionID[1],
+                EVCOMM_SYS_INFO.SessionID[2],
+                EVCOMM_SYS_INFO.SessionID[3],
+                EVCOMM_SYS_INFO.SessionID[4],
+                EVCOMM_SYS_INFO.SessionID[5],
+                EVCOMM_SYS_INFO.SessionID[6],
+                EVCOMM_SYS_INFO.SessionID[7]
+            );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+
+    //Step 3: Correct SessionID for Res Message
+    if (errn != 0)
+    {
+        exi_doc_ISO2->V2G_Message.Header.SessionID.bytesLen = 8;
+        memset(exi_doc_ISO2->V2G_Message.Header.SessionID.bytes, 0, 8);
+        memcpy(exi_doc_ISO2->V2G_Message.Header.SessionID.bytes, EVCOMM_SYS_INFO.SessionID, 8);
+    }
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: GetSchemaID_of_Protocol
+DESCRIPTION:
+    1. Get the SchemaID accroding to the input target
+        *V2GT_MSG_PROTOCOL_DIN70121: choose DIN 70121
+        *V2GT_MSG_PROTOCOL_ISO15118_2014: choose ISO 15118-2 (ed1)
+        *V2GT_MSG_PROTOCOL_ISO15118_2018: choose ISO 15118-20 (ed2)
+        *V2GT_MSG_PROTOCOL_HIGHEST_PRIORITY: choose the one with the highest priority
+
+    2. [To-do] Checking Major and Minor version
+    3. The parsing method will not support those private protocols,
+       such as "usr:tesla...," since "tesla" is 5 bytes but "din" and "iso" are 3 bytes.
+
+    4. [To-do] If the target is selected as DIN," but there is no DIN.
+               However, if EV and EVSE all support ISO, how to use ISO instead?
+
+PRE-CONDITION:
+INPUT:
+    1. target: target protocol
+
+OUTPUT:
+    1. id: SchemaID of selected protocol by EVSE
+    2. ShmCcsData->CommProtocol  (selected protocol)
+    3. SupportedAppProtocol_result
+        (1) appHandresponseCodeType_OK_SuccessfulNegotiation = 0,
+        (2) appHandresponseCodeType_OK_SuccessfulNegotiationWithMinorDeviation = 1,
+        (3) appHandresponseCodeType_Failed_NoNegotiation = 2
+
+GLOBAL VARIABLES:
+    1. ccs_handshake
+    2. ShmCcsData
+=============================================================================*/
+int GetSchemaID_of_Protocol(unsigned char target)
+{
+    int i = 0;
+    int ii = 0;
+    int id = 0;
+    unsigned char tmp = 0;
+    unsigned char pri = 20; //priority = 1(highest)~20(lowerest)
+    char num[10];
+
+    //struct CCS_ProtocolNamespacestructCharacters pro;
+
+    //Choose the 1st protocol as default.
+    //id = CCS_HANDSHAKE_PROTOCOLS.array[0].SchemaID;
+    id = -1;
+    ShmCcsData->CommProtocol = V2GT_MSG_PROTOCOL_DIN70121;
+
+    for(i = 0; i < CCS_HANDSHAKE_PROTOCOLS.arrayLen; i++)
+    {
+        //Checking for <ProtocolNamespace>urn:din:70121:2012:MsgDef</ProtocolNamespace>
+        //[To-Do] Ignoring the priority from EV and force DIN 70121 as our only option. (for temp)
+
+        //[CAUTION] The parsing method will not support those private protocols, such as "usr:tesla..."
+        num[0] = CCS_HANDSHAKE_PROTOCOLS.array[i].ProtocolNamespace.characters[8];
+        num[1] = CCS_HANDSHAKE_PROTOCOLS.array[i].ProtocolNamespace.characters[9];
+        num[2] = CCS_HANDSHAKE_PROTOCOLS.array[i].ProtocolNamespace.characters[10];
+        num[3] = CCS_HANDSHAKE_PROTOCOLS.array[i].ProtocolNamespace.characters[11];
+        num[4] = CCS_HANDSHAKE_PROTOCOLS.array[i].ProtocolNamespace.characters[12];
+        num[5] = '\0';
+
+        if (atoi(num) == 70121)
+        {
+            sprintf(buf_log_evcomm,
+                    "[GetSchemaID_of_Protocol]supported(%d-th/%d): DIN 70121(%d:v%d.%d;id=%d,pri=%d)",
+                    (i+1),
+                    CCS_HANDSHAKE_PROTOCOLS.arrayLen,
+                    atoi(num),
+                    CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor,
+                    CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor,
+                    CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID,
+                    CCS_HANDSHAKE_PROTOCOLS.array[i].Priority);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+            if (target == V2GT_MSG_PROTOCOL_DIN70121)
+            {
+                sprintf(buf_log_evcomm,
+                        "[GetSchemaID_of_Protocol]selected(%d-th/%d): DIN 70121(%d:v%d.%d;id=%d,pri=%d)",
+                        (i+1),
+                        CCS_HANDSHAKE_PROTOCOLS.arrayLen,
+                        atoi(num),
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].Priority);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                if (CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor == DIN_SPEC_70121_2012_VersionNumberMajor)
+                {
+                    if (CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor == DIN_SPEC_70121_2012_VersionNumberMinor)
+                    {
+                        EVCOMM_SYS_INFO.SupportedAppProtocol_result = appHandresponseCodeType_OK_SuccessfulNegotiation;
+                    }
+                    else
+                    {   //[TC_SECC_VTB_SupportedAppProtocol_005]
+                        EVCOMM_SYS_INFO.SupportedAppProtocol_result = appHandresponseCodeType_OK_SuccessfulNegotiationWithMinorDeviation;
+                    }
+                    id = CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID;
+                    ShmCcsData->CommProtocol = V2GT_MSG_PROTOCOL_DIN70121;
+                    return id;
+                }
+                else
+                {
+                    //keep looking for the suitable protocol
+                }
+            }
+            else if (target == V2GT_MSG_PROTOCOL_HIGHEST_PRIORITY)
+            {
+                if (pri > CCS_HANDSHAKE_PROTOCOLS.array[i].Priority)
+                {
+                    ii = i;
+                    id = CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID;
+                    pri = CCS_HANDSHAKE_PROTOCOLS.array[i].Priority;
+                    ShmCcsData->CommProtocol = V2GT_MSG_PROTOCOL_DIN70121;
+                }
+                else
+                {
+                    //not using this SchemaID, and keep looking for that SchemaID with higer priority
+                }
+            }
+            else
+            {
+                //null
+            }
+        }
+        else if (atoi(num) == 15118)
+        {
+            //urn:din:70121:2012:MsgDef
+            //urn:iso:15118:2:2013:MsgDef
+            memset(num, 0, sizeof(num));
+            num[0] = CCS_HANDSHAKE_PROTOCOLS.array[i].ProtocolNamespace.characters[16];
+            num[1] = CCS_HANDSHAKE_PROTOCOLS.array[i].ProtocolNamespace.characters[17];
+            num[2] = CCS_HANDSHAKE_PROTOCOLS.array[i].ProtocolNamespace.characters[18];
+            num[3] = CCS_HANDSHAKE_PROTOCOLS.array[i].ProtocolNamespace.characters[19];
+            num[4] = '\0';
+
+            if (atoi(num) < 2018 && atoi(num) >= 2010)
+            {
+                sprintf(buf_log_evcomm,
+                        "[GetSchemaID_of_Protocol]supported(%d-th/%d): ISO 15118-2(ed1,%d:v%d.%d;id=%d,pri=%d)",
+                        (i+1),
+                        CCS_HANDSHAKE_PROTOCOLS.arrayLen,
+                        atoi(num),
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].Priority);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                if (target == V2GT_MSG_PROTOCOL_ISO15118_2014)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[GetSchemaID_of_Protocol]selected(%d-th/%d): ISO 15118-2,ed1(%d:v%d.%d;id=%d,pri=%d)",
+                            (i+1),
+                            CCS_HANDSHAKE_PROTOCOLS.arrayLen,
+                            atoi(num),
+                            CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor,
+                            CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor,
+                            CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID,
+                            CCS_HANDSHAKE_PROTOCOLS.array[i].Priority);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                    if (CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor == ISO1_15118_2013_VersionNumberMajor)
+                    {
+                        if (CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor == ISO1_15118_2013_VersionNumberMinor)
+                        {
+                            EVCOMM_SYS_INFO.SupportedAppProtocol_result = appHandresponseCodeType_OK_SuccessfulNegotiation;
+                        }
+                        else
+                        {
+                            EVCOMM_SYS_INFO.SupportedAppProtocol_result = appHandresponseCodeType_OK_SuccessfulNegotiationWithMinorDeviation;
+                        }
+                        id = CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID;
+                        ShmCcsData->CommProtocol = V2GT_MSG_PROTOCOL_ISO15118_2014;
+                        return id;
+                    }
+                    else
+                    {
+                        //keep looking for the suitable protocol
+                    }
+                }
+                else if (target == V2GT_MSG_PROTOCOL_HIGHEST_PRIORITY)
+                {
+                    if (pri > CCS_HANDSHAKE_PROTOCOLS.array[i].Priority)
+                    {
+                        ii = i;
+                        id = CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID;
+                        pri = CCS_HANDSHAKE_PROTOCOLS.array[i].Priority;
+                        ShmCcsData->CommProtocol = V2GT_MSG_PROTOCOL_ISO15118_2014;
+                    }
+                    else
+                    {
+                        //not using this SchemaID, and keep looking for that SchemaID with higer priority
+                    }
+                }
+                else
+                {
+                    //null
+                }
+            }
+            else if (atoi(num) >= 2018 && atoi(num) <= 2100)    // >= 2018
+            {
+                sprintf(buf_log_evcomm,
+                        "[GetSchemaID_of_Protocol]supported(%d-th/%d): ISO 15118-20(ed2,%d:v%d.%d;id=%d,pri=%d)",
+                        (i+1),
+                        CCS_HANDSHAKE_PROTOCOLS.arrayLen,
+                        atoi(num),
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].Priority);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                if (target == V2GT_MSG_PROTOCOL_ISO15118_2018)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[GetSchemaID_of_Protocol]selected(%d-th/%d): ISO 15118-20,ed2(%d:v%d.%d;id=%d,pri=%d)",
+                            (i+1),
+                            CCS_HANDSHAKE_PROTOCOLS.arrayLen,
+                            atoi(num),
+                            CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor,
+                            CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor,
+                            CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID,
+                            CCS_HANDSHAKE_PROTOCOLS.array[i].Priority);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                    if (CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor == ISO2_15118_2018_VersionNumberMajor)
+                    {
+                        if (CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor == ISO2_15118_2018_VersionNumberMinor)
+                        {
+                            EVCOMM_SYS_INFO.SupportedAppProtocol_result = appHandresponseCodeType_OK_SuccessfulNegotiation;
+                        }
+                        else
+                        {
+                            EVCOMM_SYS_INFO.SupportedAppProtocol_result = appHandresponseCodeType_OK_SuccessfulNegotiationWithMinorDeviation;
+                        }
+                        id = CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID;
+                        ShmCcsData->CommProtocol = V2GT_MSG_PROTOCOL_ISO15118_2018;
+                        return id;
+                    }
+                    else
+                    {
+                        //keep looking for the suitable protocol
+                    }
+                }
+                else if (target == V2GT_MSG_PROTOCOL_HIGHEST_PRIORITY)
+                {
+                    if (pri > CCS_HANDSHAKE_PROTOCOLS.array[i].Priority)
+                    {
+                        ii = i;
+                        id = CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID;
+                        pri = CCS_HANDSHAKE_PROTOCOLS.array[i].Priority;
+                        ShmCcsData->CommProtocol = V2GT_MSG_PROTOCOL_ISO15118_2018;
+                    }
+                    else
+                    {
+                        //not using this SchemaID, and keep looking for that SchemaID with higer priority
+                    }
+                }
+                else
+                {
+                    //null
+                }
+            }
+            else
+            {
+                //Unexpected Year
+                sprintf(buf_log_evcomm,
+                        "[GetSchemaID_of_Protocol]unsupported(%d-th/%d): ISO 15118-X(unexpected year:%d,v%d.%d),id=%d,pri=%d",
+                        (i+1),
+                        CCS_HANDSHAKE_PROTOCOLS.arrayLen,
+                        atoi(num),
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID,
+                        CCS_HANDSHAKE_PROTOCOLS.array[i].Priority);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                //return -1;
+            }
+        }
+        else
+        {
+            sprintf(buf_log_evcomm,
+                    "[GetSchemaID_of_Protocol]unsupported protocol(%d-th/%d)(%d:v%d.%d;id=%d,pri=%d)",
+                    (i+1),
+                    CCS_HANDSHAKE_PROTOCOLS.arrayLen,
+                    atoi(num),
+                    CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMajor,
+                    CCS_HANDSHAKE_PROTOCOLS.array[i].VersionNumberMinor,
+                    CCS_HANDSHAKE_PROTOCOLS.array[i].SchemaID,
+                    CCS_HANDSHAKE_PROTOCOLS.array[i].Priority);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            //return -1;
+        }
+    }
+
+    //The final result of highest priority protocol
+    sprintf(buf_log_evcomm,
+            "[GetSchemaID_of_Protocol]selected(%d-th/%d): pro=%d(0:DIN,1:ISO1,2:ISO2);id=%d,pri=%d",
+            (ii+1),
+            CCS_HANDSHAKE_PROTOCOLS.arrayLen,
+            ShmCcsData->CommProtocol,
+            id,
+            pri);
+    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+    if (id < 0)
+    {
+        EVCOMM_SYS_INFO.SupportedAppProtocol_result = appHandresponseCodeType_Failed_NoNegotiation;
+    }
+
+    return id;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_supportedAppProtocolRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_supportedAppProtocolRes(int AcceptFd)
+{
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct ChargingInfoData *sys;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    //STEP 1: =========== Setting the Response Message ===========
+	init_appHandEXIDocument(&ccs_handshake);
+    ccs_handshake.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_OK_SuccessfulNegotiation;
+	ccs_handshake.supportedAppProtocolRes_isUsed = 1u;
+
+    //select the 1st one as the default
+    ccs_handshake.supportedAppProtocolRes.SchemaID = CCS_HANDSHAKE_PROTOCOLS.array[0].SchemaID;
+    ccs_handshake.supportedAppProtocolRes.SchemaID_isUsed = 1u;
+    int id = 0;
+    /*+++ 20200808, vern, support both DIN and ISO +++*/
+// id = GetSchemaID_of_Protocol(V2GT_MSG_PROTOCOL_PREFERENCE); //output: EVCOMM_SYS_INFO.SupportedAppProtocol_result
+   id = GetSchemaID_of_Protocol(V2GT_MSG_PROTOCOL_HIGHEST_PRIORITY); //output: EVCOMM_SYS_INFO.SupportedAppProtocol_result
+       /*--- 20200808, vern, support both DIN and ISO ---*/
+    ccs_handshake.supportedAppProtocolRes.ResponseCode = EVCOMM_SYS_INFO.SupportedAppProtocol_result;   //updating the response code
+    if (id < 0)
+    {
+        sprintf(buf_log_evcomm,
+                "[Error]No avalible CCS protocol (id = %d, preference = %d)",
+                id,
+                V2GT_MSG_PROTOCOL_PREFERENCE);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    else
+    {
+        //selected SchemaID
+        ccs_handshake.supportedAppProtocolRes.SchemaID = (unsigned char) id;
+    }
+
+
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_supportedAppProtocolRes]EVSE_Shutdown => End_Process");
+        ccs_handshake.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_Failed_NoNegotiation;
+        errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_supportedAppProtocolRes]EVSE_EmergencyShutdown => End_Process");
+        ccs_handshake.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_Failed_NoNegotiation;
+        errn = -1;
+    }
+    else
+    {
+        //null
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+    if (ShmInternalComm->ChargingPermission_pre >=1 &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][DIN][supportedAppProtocolRes]Permission OFF");
+        ccs_handshake.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_Failed_NoNegotiation;
+        //errn = -1;
+    }
+
+    #if (CP_PROTECTION_MECHANISM == ENABLE)
+    {
+        #if (SLAC_FIRST_RESPONSE_METHOD == SET_5_PWM_ONCE_GET_PERMISSION_IN_AUTHORIZATIONRES)
+        {
+            //Detect for CP State should be 9V with 5% PWM or 100%PWM (State B1, B2)
+            if (sys->CpState != 2 && sys->CpState != 3)  //State B1, B2
+            {
+                ccs_handshake.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_Failed_NoNegotiation;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+                Update_V2G_Flow_Status(Other_Fault);
+                sprintf(buf_log_evcomm,
+                        "[Proc_supportedAppProtocolRes]Emergency Stop by CP Error (%d, %.02f V)\n",
+                        sys->CpState,
+                        sys->CpVoltage);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            }
+        }
+        #else
+        {
+            //Detect for CP State should be 9V (State B)
+            if (sys->CpState != 3)  //B2
+            {
+                ccs_handshake.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_Failed_NoNegotiation;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+                Update_V2G_Flow_Status(Other_Fault);
+                sprintf(buf_log_evcomm,
+                        "[Proc_supportedAppProtocolRes]Emergency Stop by CP Error (%d, %.02f V)\n",
+                        sys->CpState,
+                        sys->CpVoltage);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            }
+        }
+        #endif
+    }
+    #endif
+
+
+    //STEP 2: =========== Encode into EXI ===========
+    if (errn = API_V2GMSG_EXI_Encoder_AppProtocol(&ccs_handshake, &v2g_tx_stream) !=0)
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("\n[Error]API_V2GMSG_EXI_Encoder_AppProtocol\n");
+        return errn;
+    }
+
+    //STEP 3: =========== Send Response Packet ===========
+    int Rtn = 0;
+	Rtn = send(AcceptFd, v2g_tx_stream.data, v2g_tx_stream.size, 0);
+    //Rtn = send(6, v2g_tx_stream.data, v2g_tx_stream.size, 0);
+
+    DEBUG_PRINTF_EVCOMM_DETAIL("Send V2GTP Packet Size = %d, Rtn = %d (Bytes, DEC)\n", v2g_tx_stream.size, Rtn);
+
+    if (Rtn < 0)
+    {
+        return Rtn;
+    }
+
+    //STEP 4: =========== Save into Share Memory =========
+	//[Joseph, To-Do] Adding a mechanism to choose DIN 70121 as our 1st priority. (for multiple protocols)
+
+    //STEP 5: =========== Updating the Flow State Flag =========
+    if (id < 0)
+    {
+        errn = -1;
+    }
+
+    //STEP 6: ===========  Reset Flags ============
+    //Reset all EXI doc Req/Res _isUsed Flags after each Res Tx
+    init_appHandEXIDocument(&ccs_handshake);
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_supportedAppProtocolReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_supportedAppProtocolReq(int AcceptFd)
+{
+    //[Joseph, To-Do] analysis on Req message and choose the prefered protocol
+    //Default: DIN 70121 (find SchemaID)
+    int errn = 0;
+
+    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]supportedAppProtocolReq");
+    SHM_Save_din_supportedAppProtocolReq(ShmCcsData, &ccs_handshake, ShmSysConfigAndInfo);
+
+    errn = Proc_supportedAppProtocolRes(AcceptFd);
+    if (errn == 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Tx]supportedAppProtocolRes");
+    }
+    else
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[Error]Proc_supportedAppProtocolRes(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_din_SessionSetupRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_SessionSetupRes(int AcceptFd)
+{
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct ChargingInfoData *sys;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinSessionSetupResType(&ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes);
+
+
+    // ====== [BODY (1/2) ResponseCode ======
+    ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes_isUsed = 1u;
+    ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = dinresponseCodeType_OK_NewSessionEstablished;
+
+
+    //[HEADER] Assign Res SessionID
+    ccs_exi_doc_DIN.V2G_Message.Header.SessionID.bytesLen = 8;
+    memset(ccs_exi_doc_DIN.V2G_Message.Header.SessionID.bytes, 0, 8);
+    memcpy(ccs_exi_doc_DIN.V2G_Message.Header.SessionID.bytes, EVCOMM_SYS_INFO.SessionID, 8);
+
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = dinresponseCodeType_FAILED_SequenceError;
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //#if PARAMETER_NORMAL_MODE == ENABLE
+    //SHM_Read_din_V2GMSG_Header(&ccs_exi_doc_DIN, ShmCcsData);
+    //#endif
+
+
+    //Detect for CP State should be 9V (State B)
+    if ((sys->CpState != 2) && (sys->CpState != 3))  //State B1, B2
+    {
+	    #if CP_PROTECTION_MECHANISM == ENABLE
+        ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = dinresponseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+        sprintf(buf_log_evcomm,
+                "[Proc_din_SessionSetupRes]Emergency Stop by CP Error (%d)\n",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #else
+        sprintf(buf_log_evcomm,
+                "[Proc_din_SessionSetupRes]Emergency Stop by CP Error (%d): ignored\n",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #endif
+    }
+
+    //Check for shutdown commands from EVSE(DC Main Board)
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = dinresponseCodeType_FAILED;
+        sprintf(buf_log_evcomm, "[Proc_din_SessionSetupRes]Stop by EVSE(%d:normal, %d:emergency): (%d)\n",
+                EVSE_Shutdown,
+                EVSE_EmergencyShutdown,
+                sys->DC_EVSEStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        errn = -1;
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+    if (ShmInternalComm->ChargingPermission_pre >=1 &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][DIN][SessionSetupRes]Permission OFF");
+        ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = dinresponseCodeType_FAILED;
+        errn = -1;
+    }
+
+    // ====== [BODY (2/3) EVSEID ======
+    //EVSEID = all zero
+    memset(ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.EVSEID.bytes, 0, sizeof(ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.EVSEID.bytes));
+    //vern, should be encode  by SN
+    ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.EVSEID.bytesLen = 1;  //max: DIN = 32, ISO1/ISO2 = 37 bytes
+
+    // ====== [BODY (3/3) DateTimeNow ======
+    ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.DateTimeNow_isUsed = 1u;
+    ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.DateTimeNow = (int64_t)time(NULL);   //[Joseph] Format: Unix Time Stamp
+
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ///////////SHM_Read_din_SessionSetupRes(&ccs_exi_doc_DIN, ShmCcsData);
+    #endif
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_SessionSetupRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    return errn;
+
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_SessionSetupRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_SessionSetupRes(int AcceptFd)
+{
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct ChargingInfoData *sys;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1SessionSetupResType(&ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes);
+
+    // ====== [BODY (1/2) ResponseCode ======
+    ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes_isUsed = 1u;
+    ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_OK_NewSessionEstablished;
+
+
+    //[HEADER] Assign Res SessionID
+    ccs_exi_doc_ISO1.V2G_Message.Header.SessionID.bytesLen = 8;
+    memset(ccs_exi_doc_ISO1.V2G_Message.Header.SessionID.bytes, 0, 8);
+    memcpy(ccs_exi_doc_ISO1.V2G_Message.Header.SessionID.bytes, EVCOMM_SYS_INFO.SessionID, 8);
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //#if PARAMETER_NORMAL_MODE == ENABLE
+    //SHM_Read_iso1_V2GMSG_Header(&ccs_exi_doc_ISO1, ShmCcsData);
+    //#endif
+
+    //Detect for CP State should be 9V (State B)
+    if ((sys->CpState != 2) && (sys->CpState != 3))  //State B1, B2
+    {
+        #if CP_PROTECTION_MECHANISM == ENABLE
+        ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+        sprintf(buf_log_evcomm,
+                "[Proc_iso1_SessionSetupRes]Emergency Stop by CP Error (%d)\n",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #else
+        sprintf(buf_log_evcomm,
+                "[Proc_iso1_SessionSetupRes]Emergency Stop by CP Error (%d): ignored\n",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #endif
+    }
+
+    //Check for shutdown commands from EVSE(DC Main Board)
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_FAILED;
+        sprintf(buf_log_evcomm, "[Proc_iso1_SessionSetupRes]Stop by EVSE(%d:normal, %d:emergency): (%d)\n",
+                EVSE_Shutdown,
+                EVSE_EmergencyShutdown,
+                sys->DC_EVSEStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        errn = -1;
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    if (ShmInternalComm->ChargingPermission_pre >=1 &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][ISO1][SessionSetupRes]Permission OFF");
+        ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_FAILED;
+        errn = -1;
+    }
+
+    // ====== [BODY (2/3) EVSEID ======
+    //EVSEID = all zero
+    memset(ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters, 0, sizeof(ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters));
+	/*+++ 20200808, vern, set default EVSEID +++*/
+     //vern, should be encoded  by SN
+	ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[0]='Z';
+	ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[1]='Z';
+	ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[2]='0';
+	ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[3]='0';
+	ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[4]='0';
+	ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[5]='0';
+	ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[6]='0';
+    	ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.charactersLen = 7;  //max: DIN = 32, ISO1/ISO2 = 37 bytes
+    /*--- 20200808, vern, set default EVSEID ---*/
+
+    // ====== [BODY (3/3) DateTimeNow ======
+    ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSETimeStamp_isUsed = 1u;
+    ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.EVSETimeStamp = (int64_t)time(NULL);   //[Joseph] Format: Unix Time Stamp
+
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ///////////SHM_Read_iso1_SessionSetupRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #endif
+
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_SessionSetupRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    return errn;
+
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso2_SessionSetupRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso2_SessionSetupRes(int AcceptFd)
+{
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct ChargingInfoData *sys;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+
+    init_iso2BodyType(&ccs_exi_doc_ISO2.V2G_Message.Body);
+    init_iso2SessionSetupResType(&ccs_exi_doc_ISO2.V2G_Message.Body.SessionSetupRes);
+
+    // ====== [BODY (1/2) ResponseCode ======
+    ccs_exi_doc_ISO2.V2G_Message.Body.SessionSetupRes_isUsed = 1u;
+    ccs_exi_doc_ISO2.V2G_Message.Body.SessionSetupRes.ResponseCode = iso2responseCodeType_OK_NewSessionEstablished;
+
+
+    //[HEADER] Assign Res SessionID
+    ccs_exi_doc_ISO2.V2G_Message.Header.SessionID.bytesLen = 8;
+    memset(ccs_exi_doc_ISO2.V2G_Message.Header.SessionID.bytes, 0, 8);
+    memcpy(ccs_exi_doc_ISO2.V2G_Message.Header.SessionID.bytes, EVCOMM_SYS_INFO.SessionID, 8);
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //#if PARAMETER_NORMAL_MODE == ENABLE
+    //SHM_Read_iso2_V2GMSG_Header(&ccs_exi_doc_ISO2, ShmCcsData);
+    //#endif
+
+    //Detect for CP State should be 9V (State B)
+    if ((sys->CpState != 2) && (sys->CpState != 3))  //State B1, B2
+    {
+        #if CP_PROTECTION_MECHANISM == ENABLE
+        ccs_exi_doc_ISO2.V2G_Message.Body.SessionSetupRes.ResponseCode = iso2responseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+        sprintf(buf_log_evcomm,
+                "[Proc_iso2_SessionSetupRes]Emergency Stop by CP Error (%d)",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #else
+        sprintf(buf_log_evcomm,
+                "[Proc_iso2_SessionSetupRes]Emergency Stop by CP Error (%d): ignored",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #endif
+    }
+
+    //Check for shutdown commands from EVSE(DC Main Board)
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        ccs_exi_doc_ISO2.V2G_Message.Body.SessionSetupRes.ResponseCode = iso2responseCodeType_FAILED;
+        sprintf(buf_log_evcomm, "[Proc_iso2_SessionSetupRes]Stop by EVSE(%d:normal, %d:emergency): (%d)\n",
+                EVSE_Shutdown,
+                EVSE_EmergencyShutdown,
+                sys->DC_EVSEStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        errn = -1;
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+    if (ShmInternalComm->ChargingPermission_pre >=1 &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][ISO2][SessionSetupRes]Permission OFF");
+        ccs_exi_doc_DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = iso2responseCodeType_FAILED;
+        errn = -1;
+    }
+
+    // ====== [BODY (2/3) EVSEID ======
+    //EVSEID = all zero
+    memset(ccs_exi_doc_ISO2.V2G_Message.Body.SessionSetupRes.EVSEID.characters, 0, sizeof(ccs_exi_doc_ISO2.V2G_Message.Body.SessionSetupRes.EVSEID.characters));
+    ccs_exi_doc_ISO2.V2G_Message.Body.SessionSetupRes.EVSEID.charactersLen = 15;  //max: DIN = 32, ISO1/ISO2 = 37 bytes
+
+    // ====== [BODY (3/3) DateTimeNow ======
+    ccs_exi_doc_ISO2.V2G_Message.Body.SessionSetupRes.EVSETimeStamp_isUsed = 1u;
+    ccs_exi_doc_ISO2.V2G_Message.Body.SessionSetupRes.EVSETimeStamp = (int64_t)time(NULL);   //[Joseph] Format: Unix Time Stamp
+
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ///////////SHM_Read_iso2_SessionSetupRes(&ccs_exi_doc_ISO2, ShmCcsData);
+    #endif
+
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_iso2_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO2) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso2_SessionSetupRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    return errn;
+
+}
+
+/*===========================================================================
+FUNCTION: Proc_din_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+        2. ccs_exi_doc_DIN
+=============================================================================*/
+int Proc_din_SessionSetupReq(int AcceptFd)
+{
+    int errn = 0;
+
+    DEBUG_PRINTF_EVCOMM_DETAIL("\n[Proc_din_SessionSetupReq]Got SessionSetupReq\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_SessionSetupReq(&ccs_exi_doc_DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_SessionSetupReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+    errn = Proc_din_SessionSetupRes(AcceptFd);
+    if (errn == 0)
+    {
+    	//successfully send response.
+        SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]SessionSetupRes");
+    }
+    else
+    {
+    	sprintf(buf_log_evcomm,
+                "[Error]Proc_din_SessionSetupRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+        2. ccs_exi_doc_ISO1
+=============================================================================*/
+int Proc_iso1_SessionSetupReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_PRINTF_EVCOMM_DETAIL("\n[Proc_iso1_SessionSetupReq]Got SessionSetupReq\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_SessionSetupReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_SessionSetupReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_SessionSetupRes(AcceptFd);
+    if (errn == 0)
+    {
+        //successfully send response.
+        SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]SessionSetupRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error]Proc_iso1_SessionSetupRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso2_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+        2. ccs_exi_doc_ISO2
+=============================================================================*/
+int Proc_iso2_SessionSetupReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_PRINTF_EVCOMM_DETAIL("\n[Proc_iso2_SessionSetupReq]Got SessionSetupReq\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO2_SessionSetupReq(&ccs_exi_doc_ISO2);
+
+    //Save into Share Memory
+    SHM_Save_iso2_SessionSetupReq(ShmCcsData, &ccs_exi_doc_ISO2, ShmSysConfigAndInfo);
+
+    errn = Proc_iso2_SessionSetupRes(AcceptFd);
+    if (errn == 0)
+    {
+        //successfully send response.
+        SAVE_SYS_LOG_MSG_EVCOMM("[ISO2][V2G][Tx]SessionSetupRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error]Proc_iso2_SessionSetupRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_ServiceDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_ServiceDiscoveryRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct ChargingInfoData *sys;
+    struct ServiceDiscoveryRequest_DIN70121 *req;
+    struct ServiceDiscoveryResponse_DIN70121 *res;
+
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+    req = &ShmCcsData->V2GMessage_DIN70121.ServiceDiscoveryRequest;
+    res = &ShmCcsData->V2GMessage_DIN70121.ServiceDiscoveryResponse;
+
+
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinServiceDiscoveryResType(&ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes);
+
+    //[1/4] Response Code
+    ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes_isUsed = 1u;
+    ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = dinresponseCodeType_OK;
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+
+    //Detect for CP State should be 9V (State B)
+    if ((sys->CpState != 2) && (sys->CpState != 3))  //State B1, B2
+    {
+        #if CP_PROTECTION_MECHANISM == ENABLE
+        ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode =  dinresponseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+	    errn = -1;
+        sprintf(buf_log_evcomm,
+                "[Proc_din_ServiceDiscoveryRes]Emergency Stop by CP Error (%d)",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #else
+        sprintf(buf_log_evcomm,
+                "[Proc_din_ServiceDiscoveryRes]Emergency Stop by CP Error (%d): ignored",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #endif
+    }
+
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = dinresponseCodeType_FAILED;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_ServiceDiscoveryRes]shutdown by EVSE");
+        errn = -1;
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+    if (ShmInternalComm->ChargingPermission_pre >=1 &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][DIN][ServiceDiscoveryRes]Permission OFF");
+        ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = dinresponseCodeType_FAILED;
+        errn = -1;
+    }
+
+    //[2/4] PaymentOptions
+    ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.PaymentOptions.PaymentOption.arrayLen = 1u;
+    ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.PaymentOptions.PaymentOption.array[0] = dinpaymentOptionType_ExternalPayment; //1
+
+    //[3/4] Charge Service
+    res->ChargeService_DIN70121.Services.ServiceTag.ServiceID = 1;
+    ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceTag.ServiceID = (unsigned short) res->ChargeService_DIN70121.Services.ServiceTag.ServiceID;
+    ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceTag.ServiceCategory = dinserviceCategoryType_EVCharging;
+    ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.FreeService = 1; //[Joseph] for test
+    ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.EnergyTransferType = dinEVSESupportedEnergyTransferType_DC_extended;
+
+    //[4/4] Service List (null, not be uesed for now.)
+    //#if PARAMETER_NORMAL_MODE == ENABLE
+    ///////////////SHM_Read_din_ServiceDiscoveryRes(&ccs_exi_doc_DIN, ShmCcsData);
+    //#endif
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        errn = -1;
+    }
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_ServiceDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_ServiceDiscoveryRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct ChargingInfoData *sys;
+    struct ServiceDiscoveryRequest_ISO15118_2014 *req;
+    struct ServiceDiscoveryResponse_ISO15118_2014 *res;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+    req = &ShmCcsData->V2GMessage_ISO15118_2014.ServiceDiscoveryRequest;
+    res = &ShmCcsData->V2GMessage_ISO15118_2014.ServiceDiscoveryResponse;
+
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1ServiceDiscoveryResType(&ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes);
+
+    //[1/4] Response Code
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes_isUsed = 1u;
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_OK;
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+
+    //Detect for CP State should be 9V (State B)
+    if ((sys->CpState != 2) && (sys->CpState != 3))  //State B1, B2
+    {
+        #if CP_PROTECTION_MECHANISM == ENABLE
+        ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+        sprintf(buf_log_evcomm,
+                "[Proc_iso1_ServiceDiscoveryRes]Emergency Stop by CP Error (%d)",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #else
+        sprintf(buf_log_evcomm,
+                "[Proc_iso1_ServiceDiscoveryRes]Emergency Stop by CP Error (%d): ignored",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #endif
+    }
+
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_FAILED;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ServiceDiscoveryRes]shutdown by EVSE");
+        errn = -1;
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+    if (ShmInternalComm->ChargingPermission_pre >=1 &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][ISO1][ServiceDiscoveryRes]Permission OFF");
+        ccs_exi_doc_DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_FAILED;
+        errn = -1;
+    }
+
+    //[2/4] PaymentOptionList
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.PaymentOptionList.PaymentOption.arrayLen = 1u;
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.PaymentOptionList.PaymentOption.array[0] = iso1paymentOptionType_ExternalPayment; //1
+
+    //[3/4] Charge Service
+    res->ChargeService.Services.ServiceID = 1;
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceID = (unsigned short) res->ChargeService.Services.ServiceID;
+    //ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceName_isUsed = 1;   //new in ISO1, not be used, yet.
+    //ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceName.charactersLen = xxx;
+    //ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceName.characters[i] = xxx;
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceCategory = iso1serviceCategoryType_EVCharging;
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.FreeService = 1; //[Joseph] for test
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.arrayLen = 1u;    //[ISO1] max = 6
+
+    switch (ShmCcsData->EnergyTransferMode)
+    {
+        case DC_extended:
+        {
+            ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.array[0] = iso1EnergyTransferModeType_DC_extended;
+            break;
+        }
+
+        case AC_single_phase_core:
+        {
+            ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.array[0] = iso1EnergyTransferModeType_AC_single_phase_core;
+            break;
+        }
+
+        case AC_three_phase_core:
+        {
+            ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.array[0] = iso1EnergyTransferModeType_AC_three_phase_core;
+            break;
+        }
+
+        default:
+        {
+            sprintf(buf_log_evcomm,
+                    "[ISO1][ServiceDiscoveryRes][Warning]unexpected EnergyTransferMode(%d)",
+                    ShmCcsData->EnergyTransferMode);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            break;
+        }
+    }
+
+
+    //[4/4] Service List (null, not be uesed for now.)
+    //#if PARAMETER_NORMAL_MODE == ENABLE
+    ///////////////SHM_Read_iso1_ServiceDiscoveryRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    //#endif
+
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        errn = -1;
+    }
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_din_ServiceDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_ServiceDiscoveryReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_PRINTF_EVCOMM_DETAIL("\n[SeccComm][Proc_din_ServiceDiscoveryReq]Got ServiceDiscoveryReq\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_ServiceDiscoveryReq(&ccs_exi_doc_DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_ServiceDiscoveryReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+    errn = Proc_din_ServiceDiscoveryRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]ServiceDiscoveryRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_din_ServiceDiscoveryReq]Proc_din_ServiceDiscoveryRes(): %d (DEC)",
+                errn
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_ServiceDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_ServiceDiscoveryReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_PRINTF_EVCOMM_DETAIL("\n[SeccComm][Proc_iso1_ServiceDiscoveryReq]Got ServiceDiscoveryReq\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_ServiceDiscoveryReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_ServiceDiscoveryReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_ServiceDiscoveryRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]ServiceDiscoveryRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_iso1_ServiceDiscoveryReq]Proc_iso1_ServiceDiscoveryRes(): %d (DEC)",
+                errn
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_din_ServiceAndPaymentSelectionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_ServiceAndPaymentSelectionRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct ServiceAndPaymentSelectionRequest_DIN70121 *req;
+    struct ServiceAndPaymentSelectionResponse_DIN70121 *res;
+    struct ServiceDiscoveryResponse_DIN70121 *sd_res;
+    struct ChargingInfoData *sys;
+
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    req = &ShmCcsData->V2GMessage_DIN70121.ServiceAndPaymentSelectionRequest;
+    res = &ShmCcsData->V2GMessage_DIN70121.ServiceAndPaymentSelectionResponse;
+    sd_res = &ShmCcsData->V2GMessage_DIN70121.ServiceDiscoveryResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinServicePaymentSelectionResType(&ccs_exi_doc_DIN.V2G_Message.Body.ServicePaymentSelectionRes);
+
+    //[1/1] Response Code
+    ccs_exi_doc_DIN.V2G_Message.Body.ServicePaymentSelectionRes_isUsed = 1u;
+    ccs_exi_doc_DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_OK;
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //Check for SelectedPaymentOption (TC_SECC_VTB_ServicePaymentSelection_007)
+    if (req->SelectedPaymentOption != dinpaymentOptionType_ExternalPayment)  //1
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED_PaymentSelectionInvalid;
+        sprintf(buf_log_evcomm,
+                "[ERROR]unexpected SelectedPaymentOption(%d) => End_Process (EIM only, no PnC, yet.)",
+                req->SelectedPaymentOption);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_Payment SelectionInvalid (023762)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 6;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 2;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+    //Check for ServiceID (TC_SECC_VTB_ServicePaymentSelection_004)
+    if (req->SelectedServiceList.SelectedService[0].ServiceID != sd_res->ChargeService_DIN70121.Services.ServiceTag.ServiceID)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED_ServiceSelectionInvalid;  //8
+        sprintf(buf_log_evcomm,
+                "[ERROR]Wrong selected ServiceID(%d) => End_Process",
+                req->SelectedServiceList.SelectedService[0].ServiceID);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_ServiceSelectionInvalid (023764)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 6;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 4;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+
+    //Detect for CP State should be 9V (State B)
+    if ((sys->CpState != 2) && (sys->CpState != 3))  //State B1, B2
+    {
+        #if CP_PROTECTION_MECHANISM == ENABLE
+        ccs_exi_doc_DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+        sprintf(buf_log_evcomm,
+                "[Proc_din_ServiceAndPaymentSelectionRes]Emergency Stop by CP Error (%d)",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #else
+        sprintf(buf_log_evcomm,
+                "[Proc_din_ServiceAndPaymentSelectionRes]Emergency Stop by CP Error (%d): ignored due to function is disabled",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #endif
+    }
+
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_ServiceAndPaymentSelectionRes]shutdown by EVSE");
+        ccs_exi_doc_DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED;
+        errn = -1;
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+    if (ShmInternalComm->ChargingPermission_pre >=1 &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][DIN][ServicePaymentSelectionRes]Permission OFF");
+        ccs_exi_doc_DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED;
+        errn = -1;
+    }
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_ServiceAndPaymentSelectionRes]Tx encoded msg error");
+        errn = -1;
+    }
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_ServiceAndPaymentSelectionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_ServiceAndPaymentSelectionRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct ServiceAndPaymentSelectionRequest_ISO15118_2014 *req;
+    struct ServiceAndPaymentSelectionResponse_ISO15118_2014 *res;
+    struct ServiceDiscoveryResponse_ISO15118_2014 *sd_res;
+    static struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    req = &ShmCcsData->V2GMessage_ISO15118_2014.ServiceAndPaymentSelectionRequest;
+    res = &ShmCcsData->V2GMessage_ISO15118_2014.ServiceAndPaymentSelectionResponse;
+    sd_res = &ShmCcsData->V2GMessage_ISO15118_2014.ServiceDiscoveryResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1PaymentServiceSelectionResType(&ccs_exi_doc_ISO1.V2G_Message.Body.PaymentServiceSelectionRes);
+
+    //[1/1] Response Code
+    ccs_exi_doc_ISO1.V2G_Message.Body.PaymentServiceSelectionRes_isUsed = 1u;
+    ccs_exi_doc_ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_OK;
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //Check for SelectedPaymentOption (TC_SECC_VTB_ServicePaymentSelection_007)
+    if (req->SelectedPaymentOption != dinpaymentOptionType_ExternalPayment)  //1
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED_PaymentSelectionInvalid;
+        sprintf(buf_log_evcomm,
+                "[ERROR]unexpected SelectedPaymentOption(%d) => End_Process (EIM only, no PnC, yet.)",
+                req->SelectedPaymentOption);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_Payment SelectionInvalid (023762)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 6;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 2;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+
+    //Check for ServiceID (TC_SECC_VTB_ServicePaymentSelection_004)
+    if (req->SelectedServiceList.SelectedService[0].ServiceID != sd_res->ChargeService.Services.ServiceID)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED_ServiceSelectionInvalid;  //8
+        sprintf(buf_log_evcomm,
+                "[ERROR]Wrong selected ServiceID(%d) => End_Process",
+                req->SelectedServiceList.SelectedService[0].ServiceID);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_ServiceSelectionInvalid (023764)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 6;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 4;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+
+    //Detect for CP State should be 9V (State B)
+    if ((sys->CpState != 2) && (sys->CpState != 3))  //State B1, B2
+    {
+        #if CP_PROTECTION_MECHANISM == ENABLE
+        ccs_exi_doc_ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+        sprintf(buf_log_evcomm,
+                "[Proc_iso1_ServiceAndPaymentSelectionRes]Emergency Stop by CP Error (%d)",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #else
+        sprintf(buf_log_evcomm,
+                "[Proc_iso1_ServiceAndPaymentSelectionRes]Emergency Stop by CP Error (%d): ignored due to function is disabled",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #endif
+    }
+
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ServiceAndPaymentSelectionRes]shutdown by EVSE");
+        ccs_exi_doc_ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED;
+        errn = -1;
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+    if (ShmInternalComm->ChargingPermission_pre >=1 &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][ISO1][PaymentServiceSelectionRes]Permission OFF");
+        ccs_exi_doc_ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED;
+        errn = -1;
+    }
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ServiceAndPaymentSelectionRes]Tx encoded msg error");
+        errn = -1;
+    }
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_din_ServiceAndPaymentSelectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_ServiceAndPaymentSelectionReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_PRINTF_EVCOMM_DETAIL("[SeccComm][Proc_din_ServiceAndPaymentSelectionReq]Got ServiceAndPaymentSelectionReq");
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq(&ccs_exi_doc_DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_ServiceAndPaymentSelectionReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+    errn = Proc_din_ServiceAndPaymentSelectionRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]ServiceAndPaymentSelectionRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+        "[Error][Proc_iso1_ServiceAndPaymentSelectionReq]Proc_iso1_ServiceAndPaymentSelectionRes(): %d (DEC)",
+        errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_iso1_ServiceAndPaymentSelectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_ServiceAndPaymentSelectionReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_PRINTF_EVCOMM_DETAIL("[SeccComm][Proc_iso1_ServiceAndPaymentSelectionReq]Got ServiceAndPaymentSelectionReq");
+
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_ServiceAndPaymentSelectionReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_ServiceAndPaymentSelectionRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]ServiceAndPaymentSelectionRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][Proc_iso1_ServiceAndPaymentSelectionReq]Proc_iso1_ServiceAndPaymentSelectionRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_ContractAuthenticationRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_ContractAuthenticationRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct ChargingInfoData *sys;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinContractAuthenticationResType(&ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes);
+
+    ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes_isUsed = 1u;
+
+    //[BODY (1/2)] ResponseCode
+    ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_OK;
+    ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing = dinEVSEProcessingType_Ongoing; //0
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //Detect for CP State should be 9V (State B)
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if ((sys->CpState != 2) && (sys->CpState != 3))  //State B1, B2
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED;
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing =  dinEVSEProcessingType_Finished;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+        sprintf(buf_log_evcomm,
+                "[Proc_din_ContractAuthenticationRes]Emergency Stop by CP Error (%d)",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    #endif
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED;
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing =  dinEVSEProcessingType_Finished;
+        errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED;
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing =  dinEVSEProcessingType_Finished;
+        errn = -1;
+    }
+
+    //[BODY (2/2)] EVSEProcessing
+    if(ShmInternalComm->ChargingPermission == TRUE)
+    {
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing = dinEVSEProcessingType_Finished; //0
+        SAVE_SYS_LOG_MSG_EVCOMM("CSU Permission: OK");
+
+        #if (SLAC_FIRST_RESPONSE_METHOD == SET_5_PWM_ONCE_GET_PERMISSION_IN_AUTHORIZATIONRES)
+        {
+            //Set PWM as 5% (for SLAC first case)
+            SAVE_SYS_LOG_MSG_EVCOMM("Set PWM as 5%%");
+            SwitchCpStateE(DISABLE);
+            OutputCpPwmDuty(5);
+        }
+        #endif
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+    if (ShmInternalComm->ChargingPermission_pre >=1 &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][DIN][ContractAuthenticationRes]Permission OFF");
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED;
+        ccs_exi_doc_DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing =  dinEVSEProcessingType_Finished;
+        errn = -1;
+    }
+
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ////////////SHM_Read_din_ContractAuthenticationRes(&ccs_exi_doc_DIN, ShmCcsData);
+    #endif
+
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_ChargeParameterDiscoveryRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_iso1_AuthorizationRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_AuthorizationRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct ChargingInfoData *sys;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1AuthorizationResType(&ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes);
+
+    ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes_isUsed = 1u;
+
+    //[BODY (1/2)] ResponseCode
+    ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = iso1responseCodeType_OK;
+    /*+++ 20200808, vern, EVSEProcessing should be waiting for Customer during authrization +++*/
+    ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing = iso1EVSEProcessingType_Ongoing_WaitingForCustomerInteraction; //0
+    /*--- 20200808, vern, should be waiting for Customer during authrization ---*/
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+
+    //Detect for CP State should be 9V (State B)
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if ((sys->CpState != 2) && (sys->CpState != 3))  //State B1, B2
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = iso1responseCodeType_FAILED;
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing =  iso1EVSEProcessingType_Finished;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+        sprintf(buf_log_evcomm,
+                "[Proc_iso1_AuthorizationRes]Emergency Stop by CP Error (%d)",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    #endif
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = FAILED_ISO15118_2014;
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing =  iso1EVSEProcessingType_Finished;
+        errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = FAILED_ISO15118_2014;
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing =  iso1EVSEProcessingType_Finished;
+        errn = -1;
+    }
+    //[BODY (2/2)] EVSEProcessing
+    //Check for Permission from CSU
+    if(ShmInternalComm->ChargingPermission == TRUE)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing = iso1EVSEProcessingType_Finished; //0
+        SAVE_SYS_LOG_MSG_EVCOMM("CSU Permission: OK");
+
+        #if (SLAC_FIRST_RESPONSE_METHOD == SET_5_PWM_ONCE_GET_PERMISSION_IN_AUTHORIZATIONRES)
+        {
+            //Set PWM as 5% (for SLAC first case)
+            SAVE_SYS_LOG_MSG_EVCOMM("Set PWM as 5%%");
+            SwitchCpStateE(DISABLE);
+            OutputCpPwmDuty(5);
+        }
+        #endif
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+    if (ShmInternalComm->ChargingPermission_pre >=1 &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][ISO1][AuthorizationRes]Permission OFF");
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = FAILED_ISO15118_2014;
+        ccs_exi_doc_ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing =  iso1EVSEProcessingType_Finished;
+        errn = -1;
+    }
+
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ////////////SHM_Read_iso1_AuthorizationRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #endif
+
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ChargeParameterDiscoveryRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_ContractAuthenticationReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_ContractAuthenticationReq(int AcceptFd)
+{
+    int errn = 0;
+
+        DEBUG_PRINTF_EVCOMM_DETAIL("\n[SeccComm][Proc_din_ContractAuthenticationReq]Got Proc_din_ContractAuthenticationReq\n");
+
+
+        //Print the decoded XML Document
+        PRINT_XML_DOC_DIN_ContractAuthenticationReq(&ccs_exi_doc_DIN);
+
+        //Save into Share Memory
+        SHM_Save_din_ContractAuthenticationReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+        errn = Proc_din_ContractAuthenticationRes(AcceptFd);
+        if (errn == 0)
+        {
+            //send response successfully.
+            //SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]ContractAuthenticationRes");
+        }
+        else
+        {
+            sprintf(buf_log_evcomm,
+                    "[Error][SeccComm][Proc_din_ContractAuthenticationReq]Proc_iso1_AuthenticationRes(): %d (DEC)",
+                    errn);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        }
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_AuthenticationReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_AuthenticationReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_PRINTF_EVCOMM_DETAIL("\n[SeccComm][Proc_iso1_AuthenticationReq]Got AuthorizationReq\n");
+
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_AuthorizationReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_AuthorizationReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_AuthorizationRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]AuthorizationRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_iso1_AuthenticationReq]Proc_iso1_AuthenticationRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+
+/*===========================================================================
+FUNCTION: SHM_Init_dinDC_EVSEStatusType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. in
+OUTPUT:
+		2. out
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Init_dinDC_EVSEStatusType(struct DC_EVSEStatusType_DIN70121 *in)
+{
+	in->EVSEIsolationStatus = dinisolationLevelType_Valid;
+	//	dinisolationLevelType_Invalid = 0,
+	//	dinisolationLevelType_Valid = 1, (default)
+	//	dinisolationLevelType_Warning = 2,
+	//	dinisolationLevelType_Fault = 3
+
+	in->EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+	// dinDC_EVSEStatusCodeType_EVSE_NotReady = 0,
+	// dinDC_EVSEStatusCodeType_EVSE_Ready = 1, (default)
+	// dinDC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+	// dinDC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+	// dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+	// dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+	// dinDC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+	// dinDC_EVSEStatusCodeType_Reserved_8 = 7,
+	// dinDC_EVSEStatusCodeType_Reserved_9 = 8,
+	// dinDC_EVSEStatusCodeType_Reserved_A = 9,
+	// dinDC_EVSEStatusCodeType_Reserved_B = 10,
+	// dinDC_EVSEStatusCodeType_Reserved_C = 11
+
+	in->EVSENotification = dinEVSENotificationType_None;
+	// dinEVSENotificationType_None = 0, (default)
+	// dinEVSENotificationType_StopCharging = 1,
+	// dinEVSENotificationType_ReNegotiation = 2
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_dinPhysicalValueType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_dinPhysicalValueType(struct PhysicalValueType_DIN70121 *obj, short value, int multiplier, unsigned char unit)
+{
+    obj->Value = value;
+    obj->Multiplier = multiplier;
+    obj->Unit =unit;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Init_din_ChargeParameterDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. shm_ccs
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Init_din_ChargeParameterDiscoveryRes(struct CcsData *shm_ccs)
+{
+	struct ChargeParameterDiscoveryResponse_DIN70121 *in;
+
+	in = &shm_ccs->V2GMessage_DIN70121.ChargeParameterDiscoveryResponse;
+
+	//----- [BODY (1/5)] ResponseCode -----
+    in->ResponseCode = dinresponseCodeType_OK;
+
+    //----- [BODY (2/5)] EVSEProcessing -----
+    in->EVSEProcessing = dinEVSEProcessingType_Ongoing;    //0
+    // 	dinEVSEProcessingType_Finished = 0,
+    //	dinEVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/5)] SAScheduleList of SASchedules -----
+	//be fixed in another function.
+
+    //-----  [BODY (4/5)] AC_EVSEChargeParameter of EVSEChargeParameter -----
+    //ignore, since DIN doesn't support AC
+
+    //----- [BODY (5/5)] DC_EVSEChargeParameter of EVSEChargeParameter -----
+	struct DC_EVSEChargeParameterType_DIN70121 *in_para;
+	in_para = &in->DC_EVSEChargeParameter;
+
+    //DC_EVSEStatus
+	SHM_Init_dinDC_EVSEStatusType(&in_para->DC_EVSEStatus);
+    in_para->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid;
+
+    short value = 0; int multiplier = 0; unsigned char unit = 0;
+
+    //EVSEMaximumCurrentLimit
+    value = 600; multiplier = -1; unit = A_DIN70121;    //60A
+	SHM_Save_dinPhysicalValueType(&in_para->EVSEMaximumCurrentLimit, value, multiplier, unit);
+
+    //EVSEMaximumPowerLimit
+    value = 3000; multiplier = 1; unit = W_DIN70121;    //30KW
+	SHM_Save_dinPhysicalValueType(&in_para->EVSEMaximumPowerLimit, value, multiplier, unit);
+
+    //EVSEMaximumVoltageLimit
+    value = 7500; multiplier = -1; unit = V_DIN70121;   //750V
+	SHM_Save_dinPhysicalValueType(&in_para->EVSEMaximumVoltageLimit, value, multiplier, unit);
+
+    //EVSEMinimumVoltageLimit
+    value = 1500; multiplier = -1; unit = V_DIN70121;   //150V
+	SHM_Save_dinPhysicalValueType(&in_para->EVSEMinimumVoltageLimit, value, multiplier, unit);
+
+
+    //EVSEMinimumCurrentLimit
+    value = 10; multiplier = -1; unit = A_DIN70121;     //1A
+	SHM_Save_dinPhysicalValueType(&in_para->EVSEMinimumCurrentLimit, value, multiplier, unit);
+
+    //EVSECurrentRegulationTolerance
+    value = 10; multiplier = -1; unit = A_DIN70121;      //1A
+	SHM_Save_dinPhysicalValueType(&in_para->EVSECurrentRegulationTolerance, value, multiplier, unit);
+
+    //EVSEPeakCurrentRipple
+    value = 2; multiplier = -1; unit = A_DIN70121;      //0.2A
+	SHM_Save_dinPhysicalValueType(&in_para->EVSEPeakCurrentRipple, value, multiplier, unit);
+
+    //EVSEEnergyToBeDelivered (optional)
+    //SHM_Save_dinPhysicalValueType(&out_para->EVSEEnergyToBeDelivered, &in_para->EVSEEnergyToBeDelivered);
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_din_ChargeParameterDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_din_ChargeParameterDiscoveryRes()
+{
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinChargeParameterDiscoveryResType(&ccs_exi_doc_DIN.V2G_Message.Body.ChargeParameterDiscoveryRes);
+
+    ccs_exi_doc_DIN.V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
+
+    //----- [BODY (1/5)] ResponseCode -----
+    struct dinChargeParameterDiscoveryResType *res;
+    res = &ccs_exi_doc_DIN.V2G_Message.Body.ChargeParameterDiscoveryRes;
+    res->ResponseCode = dinresponseCodeType_OK;
+
+    //----- [BODY (2/5)] EVSEProcessing -----
+    res->EVSEProcessing = dinEVSEProcessingType_Finished; //0
+    // 	dinEVSEProcessingType_Finished = 0,
+    //	dinEVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/5)] SAScheduleList of SASchedules -----
+    res->SAScheduleList_isUsed = 1u;
+    struct dinSAScheduleListType *list;
+    list = &res->SAScheduleList;
+    //
+    list->SAScheduleTuple.arrayLen = 1;
+    list->SAScheduleTuple.array[0].SAScheduleTupleID = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleID = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.arrayLen = 1;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval_isUsed = 1u;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.start = 0;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration = xxx
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration_isUsed = 1u;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 0u;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval.xxx
+    //list->SAScheduleTuple.array[0].SalesTariff.xxx
+    //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
+
+
+    //-----  [BODY (4/5)] AC_EVSEChargeParameter of EVSEChargeParameter -----
+    //ignore, since DIN doesn't support AC
+
+    //----- [BODY (5/5)] DC_EVSEChargeParameter of EVSEChargeParameter -----
+    res->DC_EVSEChargeParameter_isUsed = 1u;
+    struct dinDC_EVSEChargeParameterType *para;
+    para = &res->DC_EVSEChargeParameter;
+
+    //DC_EVSEStatus
+    para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    para->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid;
+    //	dinisolationLevelType_Invalid = 0,
+    //	dinisolationLevelType_Valid = 1,
+    //	dinisolationLevelType_Warning = 2,
+    //	dinisolationLevelType_Fault = 3
+
+    para->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+    // dinDC_EVSEStatusCodeType_EVSE_NotReady = 0,
+    // dinDC_EVSEStatusCodeType_EVSE_Ready = 1,
+    // dinDC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+    // dinDC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+    // dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+    // dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+    // dinDC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+    // dinDC_EVSEStatusCodeType_Reserved_8 = 7,
+    // dinDC_EVSEStatusCodeType_Reserved_9 = 8,
+    // dinDC_EVSEStatusCodeType_Reserved_A = 9,
+    // dinDC_EVSEStatusCodeType_Reserved_B = 10,
+    // dinDC_EVSEStatusCodeType_Reserved_C = 11
+
+    para->DC_EVSEStatus.NotificationMaxDelay = 0u;
+
+    para->DC_EVSEStatus.EVSENotification = dinEVSENotificationType_None;
+    // dinEVSENotificationType_None = 0,
+    // dinEVSENotificationType_StopCharging = 1,
+    // dinEVSENotificationType_ReNegotiation = 2
+
+    //EVSEMaximumCurrentLimit
+    para->EVSEMaximumCurrentLimit.Value = 2400;
+    para->EVSEMaximumCurrentLimit.Multiplier = -1;
+    para->EVSEMaximumCurrentLimit.Unit_isUsed = 1u;
+    para->EVSEMaximumCurrentLimit.Unit = dinunitSymbolType_A;
+    //	dinunitSymbolType_h = 0,
+    //	dinunitSymbolType_m = 1,
+    //	dinunitSymbolType_s = 2,
+    //	dinunitSymbolType_A = 3,
+    //	dinunitSymbolType_Ah = 4,
+    //	dinunitSymbolType_V = 5,
+    //	dinunitSymbolType_VA = 6,
+    //	dinunitSymbolType_W = 7,
+    //	dinunitSymbolType_W_s = 8,
+    //	dinunitSymbolType_Wh = 9
+
+    //EVSEMaximumPowerLimit
+    para->EVSEMaximumPowerLimit.Value = 6000;
+    para->EVSEMaximumPowerLimit.Multiplier = 1;
+    para->EVSEMaximumPowerLimit.Unit_isUsed = 1u;
+    para->EVSEMaximumPowerLimit.Unit = dinunitSymbolType_W;
+
+
+    //EVSEMaximumVoltageLimit
+    para->EVSEMaximumVoltageLimit.Value = 7500;
+    para->EVSEMaximumVoltageLimit.Multiplier = -1;
+    para->EVSEMaximumVoltageLimit.Unit_isUsed = 1u;
+    para->EVSEMaximumVoltageLimit.Unit = dinunitSymbolType_V;
+
+    //EVSEMinimumVoltageLimit
+    para->EVSEMinimumVoltageLimit.Value = 1500;
+    para->EVSEMinimumVoltageLimit.Multiplier = -1;
+    para->EVSEMinimumVoltageLimit.Unit_isUsed = 1u;
+    para->EVSEMinimumVoltageLimit.Unit = dinunitSymbolType_V;
+
+
+    //EVSEMinimumCurrentLimit
+    para->EVSEMinimumCurrentLimit.Value = 20;
+    para->EVSEMinimumCurrentLimit.Multiplier = -1;
+    para->EVSEMinimumCurrentLimit.Unit_isUsed = 1u;
+    para->EVSEMinimumCurrentLimit.Unit = dinunitSymbolType_A;
+
+    //EVSECurrentRegulationTolerance_isUsed
+    para->EVSECurrentRegulationTolerance_isUsed = 1u;
+    //EVSECurrentRegulationTolerance
+    para->EVSECurrentRegulationTolerance.Value = 10;
+    para->EVSECurrentRegulationTolerance.Multiplier = -1;
+    para->EVSECurrentRegulationTolerance.Unit_isUsed = 1u;
+    para->EVSECurrentRegulationTolerance.Unit = dinunitSymbolType_A;
+
+
+    //EVSEEnergyToBeDelivered_isUsed
+    para->EVSEEnergyToBeDelivered_isUsed = 1u;
+    //EVSEPeakCurrentRipple
+    para->EVSEPeakCurrentRipple.Value = 2;
+    para->EVSEPeakCurrentRipple.Multiplier = -1;
+    para->EVSEPeakCurrentRipple.Unit_isUsed = 1u;
+    para->EVSEPeakCurrentRipple.Unit = dinunitSymbolType_A;
+
+
+    //EVSEEnergyToBeDelivered (optional)
+    /*
+    para->EVSEEnergyToBeDelivered.Value = 360;
+    para->EVSEEnergyToBeDelivered.Multiplier = 3;
+    para->EVSEEnergyToBeDelivered.Unit_isUsed = 1u;
+    para->EVSEEnergyToBeDelivered.Unit = dinunitSymbolType_Wh;
+    */
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_iso1_ChargeParameterDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_iso1_ChargeParameterDiscoveryRes()
+{
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1ChargeParameterDiscoveryResType(&ccs_exi_doc_ISO1.V2G_Message.Body.ChargeParameterDiscoveryRes);
+
+    ccs_exi_doc_ISO1.V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
+
+    //----- [BODY (1/5)] ResponseCode -----
+    struct iso1ChargeParameterDiscoveryResType *res;
+    res = &ccs_exi_doc_ISO1.V2G_Message.Body.ChargeParameterDiscoveryRes;
+    res->ResponseCode = iso1responseCodeType_OK;
+
+    //----- [BODY (2/5)] EVSEProcessing -----
+    res->EVSEProcessing = iso1EVSEProcessingType_Finished; //0
+    // 	iso1EVSEProcessingType_Finished = 0,
+    //	iso1EVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/5)] SAScheduleList of SASchedules -----
+    res->SAScheduleList_isUsed = 1u;
+    struct iso1SAScheduleListType *list;
+    list = &res->SAScheduleList;
+    //
+    list->SAScheduleTuple.arrayLen = 1;
+    list->SAScheduleTuple.array[0].SAScheduleTupleID = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.arrayLen = 1;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval_isUsed = 1u;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.start = 0;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration = xxx
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration_isUsed = 1u;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 0u;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval.xxx
+    //list->SAScheduleTuple.array[0].SalesTariff.xxx
+    //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
+
+
+    //-----  [BODY (4/5)] AC_EVSEChargeParameter of EVSEChargeParameter -----
+    //ignore, since our ISO1 doesn't support AC, yet
+
+    //----- [BODY (5/5)] DC_EVSEChargeParameter of EVSEChargeParameter -----
+    res->DC_EVSEChargeParameter_isUsed = 1u;
+    struct iso1DC_EVSEChargeParameterType *para;
+    para = &res->DC_EVSEChargeParameter;
+
+    //DC_EVSEStatus
+    para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    para->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Invalid;
+    //	iso1isolationLevelType_Invalid = 0,
+    //	iso1isolationLevelType_Valid = 1,
+    //	iso1isolationLevelType_Warning = 2,
+    //	iso1isolationLevelType_Fault = 3
+
+    para->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+    // iso1DC_EVSEStatusCodeType_EVSE_NotReady = 0,
+    // iso1DC_EVSEStatusCodeType_EVSE_Ready = 1,
+    // iso1DC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+    // iso1DC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+    // iso1DC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+    // iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+    // iso1DC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+    // iso1DC_EVSEStatusCodeType_Reserved_8 = 7,
+    // iso1DC_EVSEStatusCodeType_Reserved_9 = 8,
+    // iso1DC_EVSEStatusCodeType_Reserved_A = 9,
+    // iso1DC_EVSEStatusCodeType_Reserved_B = 10,
+    // iso1DC_EVSEStatusCodeType_Reserved_C = 11
+
+    para->DC_EVSEStatus.NotificationMaxDelay = 0u;
+
+    para->DC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+    // iso1EVSENotificationType_None = 0,
+    // iso1EVSENotificationType_StopCharging = 1,
+    // iso1EVSENotificationType_ReNegotiation = 2
+
+    //EVSEMaximumCurrentLimit
+    para->EVSEMaximumCurrentLimit.Value = 2400;
+    para->EVSEMaximumCurrentLimit.Multiplier = -1;
+    //para->EVSEMaximumCurrentLimit.Unit_isUsed = 1u;
+    para->EVSEMaximumCurrentLimit.Unit = iso1unitSymbolType_A;
+    //iso1unitSymbolType_h = 0,
+	//iso1unitSymbolType_m = 1,
+	//iso1unitSymbolType_s = 2,
+	//iso1unitSymbolType_A = 3,
+	//iso1unitSymbolType_V = 4,
+	//iso1unitSymbolType_W = 5,
+	//iso1unitSymbolType_Wh = 6
+
+    //EVSEMaximumPowerLimit
+    para->EVSEMaximumPowerLimit.Value = 6000;
+    para->EVSEMaximumPowerLimit.Multiplier = 1;
+    //para->EVSEMaximumPowerLimit.Unit_isUsed = 1u;
+    para->EVSEMaximumPowerLimit.Unit = iso1unitSymbolType_W;
+
+
+    //EVSEMaximumVoltageLimit
+    para->EVSEMaximumVoltageLimit.Value = 7500;
+    para->EVSEMaximumVoltageLimit.Multiplier = -1;
+    //para->EVSEMaximumVoltageLimit.Unit_isUsed = 1u;
+    para->EVSEMaximumVoltageLimit.Unit = iso1unitSymbolType_V;
+
+    //EVSEMinimumVoltageLimit
+    para->EVSEMinimumVoltageLimit.Value = 1500;
+    para->EVSEMinimumVoltageLimit.Multiplier = -1;
+    //para->EVSEMinimumVoltageLimit.Unit_isUsed = 1u;
+    para->EVSEMinimumVoltageLimit.Unit = iso1unitSymbolType_V;
+
+
+    //EVSEMinimumCurrentLimit
+    para->EVSEMinimumCurrentLimit.Value = 20;
+    para->EVSEMinimumCurrentLimit.Multiplier = -1;
+    //para->EVSEMinimumCurrentLimit.Unit_isUsed = 1u;
+    para->EVSEMinimumCurrentLimit.Unit = iso1unitSymbolType_A;
+
+    //EVSECurrentRegulationTolerance_isUsed
+    para->EVSECurrentRegulationTolerance_isUsed = 1u;
+    //EVSECurrentRegulationTolerance
+    para->EVSECurrentRegulationTolerance.Value = 10;
+    para->EVSECurrentRegulationTolerance.Multiplier = -1;
+    //para->EVSECurrentRegulationTolerance.Unit_isUsed = 1u;
+    para->EVSECurrentRegulationTolerance.Unit = iso1unitSymbolType_A;
+
+
+    //EVSEEnergyToBeDelivered_isUsed
+    para->EVSEEnergyToBeDelivered_isUsed = 1u;
+    //EVSEPeakCurrentRipple
+    para->EVSEPeakCurrentRipple.Value = 2;
+    para->EVSEPeakCurrentRipple.Multiplier = -1;
+    //para->EVSEPeakCurrentRipple.Unit_isUsed = 1u;
+    para->EVSEPeakCurrentRipple.Unit = iso1unitSymbolType_A;
+
+
+    //EVSEEnergyToBeDelivered (optional)
+    /*
+    para->EVSEEnergyToBeDelivered.Value = 360;
+    para->EVSEEnergyToBeDelivered.Multiplier = 3;
+    para->EVSEEnergyToBeDelivered.Unit_isUsed = 1u;
+    para->EVSEEnergyToBeDelivered.Unit = iso1unitSymbolType_Wh;
+    */
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_ChargeParameterDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_ChargeParameterDiscoveryRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct ChargeParameterDiscoveryResponse_DIN70121 *res;
+    struct ChargeParameterDiscoveryRequest_DIN70121 *req;
+    struct DC_EVSEChargeParameterType_DIN70121 *dc_para;
+    struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    res = &ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryResponse;
+    req = &ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest;
+    dc_para = &ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryResponse.DC_EVSEChargeParameter;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    res->ResponseCode = OK_DIN70121;
+    res->EVSEProcessing =  Ongoing_DIN70121;
+    dc_para->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;    //1
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+
+    //[TC_SECC_VTB_ChargeParameterDiscovery_005]
+      if (	(sys->EvBatteryMaxCurrent < 0) ||
+    	(sys->EvBatteryMaxVoltage<150)
+        )
+    {
+        sprintf(buf_log_evcomm,
+                "[ERROR]EvBatteryMaxCurrent is negative(%.02f) => End_Process",
+                sys->EvBatteryMaxCurrent);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+        res->ResponseCode = dinresponseCodeType_FAILED_WrongChargeParameter;    //16
+        res->EVSEProcessing = Finished_DIN70121;
+        dc_para->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_WrongChargeParameter (023775)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 5;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+
+    //STEP 2: ============ Modify Parameters of ShmCcsData ============
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMaximumPowerLimit, (int) (sys->AvailableChargingPower * 10), W_DIN70121);
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMaximumCurrentLimit, (int) (sys->AvailableChargingCurrent * 10), A_DIN70121);
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMaximumVoltageLimit, (int) (sys->MaximumChargingVoltage * 10), V_DIN70121);
+
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMinimumVoltageLimit, 1500, V_DIN70121); //150V
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMinimumCurrentLimit, 10, A_DIN70121); //1A
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSECurrentRegulationTolerance, 10, A_DIN70121); //1A
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEPeakCurrentRipple, 2, A_DIN70121);   //0.2A
+    //SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEEnergyToBeDelivered, 0, WH_DIN70121); //optional
+
+    #if PATCH_FOR_BMW_I3_BUG_EVSEMAXIMUMVOLTAGELIMIT_599V == ENABLE
+    if (sys->EvBatteryMaxVoltage <= 500)
+    {
+        SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMaximumVoltageLimit, (int) (500 * 10), V_DIN70121);  //500V
+    }
+    #endif
+
+    //for test with Tesla Model 3, 10A
+    //SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMaximumCurrentLimit, (int) (10 * 10), A_DIN70121);   //10A, for testing with Tesla Model 3
+
+
+    //Check for EnergyTransferMode [TC_SECC_VTB_ChargeParameterDiscovery_004]
+    if (req->EVRequestedEnergyTransferType != dinEVSESupportedEnergyTransferType_DC_extended)
+    {
+        sprintf(buf_log_evcomm,
+                "[ERROR]Wrong EVRequestedEnergyTransferType(%d,%d)",
+                req->EVRequestedEnergyTransferType,
+                dinEVSESupportedEnergyTransferType_DC_extended);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        res->ResponseCode = FAILED_WrongEnergyTransferType_DIN70121;
+        res->EVSEProcessing = Finished_DIN70121;
+        dc_para->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_WrongEnergyTransferMode (023774)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 4;
+    }
+
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_ChargeParameterDiscoveryRes]EVSE_Shutdown");
+        res->ResponseCode = FAILED_DIN70121;
+        res->EVSEProcessing = Finished_DIN70121;
+        dc_para->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_ChargeParameterDiscoveryRes]EVSE_EmergencyShutdown");
+        res->ResponseCode = FAILED_DIN70121;
+        res->EVSEProcessing = Finished_DIN70121;
+        dc_para->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        errn = -1;
+    }
+
+    //Detect for CP State should be 9V (State B)
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if (sys->CpState != 3)  //State B1, B2
+    {
+        res->ResponseCode = FAILED_DIN70121;
+        dc_para->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        res->EVSEProcessing = Finished_DIN70121;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+        sprintf(buf_log_evcomm,
+                "[Proc_din_ChargeParameterDiscoveryRes]Emergency Stop by CP Error (%d, %.02f V)\n",
+                sys->CpState,
+                sys->CpVoltage);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    #endif
+
+    //Check for Permission from CSU
+    if (ShmInternalComm->ChargingPermission == TRUE)
+    {
+        res->EVSEProcessing = Finished_DIN70121;
+    }
+
+    //Check for Permission Off
+    if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][DIN][ChargeParameterDiscoveryRes]Permission OFF");
+        res->ResponseCode = FAILED_DIN70121;
+        res->EVSEProcessing = Finished_DIN70121;
+        dc_para->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+    }
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_ChargeParameterDiscoveryRes(&ccs_exi_doc_DIN, ShmCcsData);
+    #else
+    Sudo_Parameter_din_ChargeParameterDiscoveryRes();
+    #endif
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_ChargeParameterDiscoveryRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    //STPE 5: ============ Update Flags ============
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_iso1_ChargeParameterDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_ChargeParameterDiscoveryRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct ChargeParameterDiscoveryResponse_ISO15118_2014 *res;
+    struct ChargeParameterDiscoveryRequest_ISO15118_2014 *req;
+    struct DC_EVSEChargeParameterType_ISO15118_2014 *dc_para;
+    struct AC_EVSEChargeParameterType_ISO15118_2014 *ac_para;
+    struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    res = &ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryResponse;
+    req = &ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest;
+    dc_para = &ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryResponse.DC_EVSEChargeParameter;
+    ac_para = &ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryResponse.AC_EVSEChargeParameter;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    res->ResponseCode = OK_ISO15118_2014;
+    /*+++ 20200808, vern, EVSEProcessing should be on-going during ChargeParameterDiscovery +++*/
+    res->EVSEProcessing =  iso1EVSEProcessingType_Ongoing;
+    /*--- 20200808, vern, EVSEProcessing should be on-going during ChargeParameterDiscovery ---*/
+    dc_para->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;    //1
+    ac_para->AC_EVSEStatus.RCD = ShmInternalComm->AC_RcdStatus; //0:no error, 1:error
+    ac_para->AC_EVSEStatus.NotificationMaxDelay = 0;  //unit: 1s
+    ac_para->AC_EVSEStatus.EVSENotification = ShmInternalComm->AC_EVSENotification; //0:none, 1:StopCharging, 2:RenNgotiation
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+
+    //[TC_SECC_VTB_ChargeParameterDiscovery_005]
+     /*+++ 20200808, vern, should check the voltage and current to see if the range of battery parameter is accepted by charger ---*/
+    if ((sys->EvBatteryMaxCurrent < 0) ||(sys->EvBatteryMaxVoltage<150))
+    {
+        sprintf(buf_log_evcomm,
+                "[ERROR]EvBatteryMaxCurrent is negative(%.02f) => End_Process",
+                sys->EvBatteryMaxCurrent);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+        res->ResponseCode = iso1responseCodeType_FAILED_WrongChargeParameter;   //16
+        res->EVSEProcessing = Finished_ISO15118_2014;
+        dc_para->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        ac_para->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        errn = -1;
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_WrongChargeParameter (023775)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 5;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+
+    //STEP 2: ============ Modify Parameters of ShmCcsData ============
+    //DC
+    SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMaximumPowerLimit, (int) (sys->AvailableChargingPower * 10), W_ISO15118_2014);
+    SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMaximumCurrentLimit, (int) (sys->AvailableChargingCurrent * 10), A_ISO15118_2014);
+    SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMaximumVoltageLimit, (int) (sys->MaximumChargingVoltage * 10), V_ISO15118_2014);
+
+    SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMinimumVoltageLimit, 1500, V_ISO15118_2014); //150V
+    SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMinimumCurrentLimit, 10, A_ISO15118_2014); //1A
+    SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSECurrentRegulationTolerance, 10, A_ISO15118_2014); //1A
+    SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEPeakCurrentRipple, 2, A_ISO15118_2014);   //0.2A
+    //SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEEnergyToBeDelivered, 0, Wh_ISO15118_2014); //optional
+
+    //AC
+    SAVE_PhysicalValueType_ISO15118_2014(&ac_para->EVSENominalVoltage, (int) (sys->AC_EVSENominalVoltage * 10), V_ISO15118_2014);
+    SAVE_PhysicalValueType_ISO15118_2014(&ac_para->EVSEMaxCurrent, (int) (sys->AvailableChargingCurrent * 10), A_ISO15118_2014);
+
+
+    #if PATCH_FOR_BMW_I3_BUG_EVSEMAXIMUMVOLTAGELIMIT_599V == ENABLE
+    if (sys->EvBatteryMaxVoltage <= 500)
+    {
+        SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMaximumVoltageLimit, (int) (500 * 10), V_ISO15118_2014);  //500V
+    }
+    #endif
+
+    //for test with Tesla Model 3, 10A
+    //SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMaximumCurrentLimit, (int) (10 * 10), A_ISO15118_2014);   //10A, for testing with Tesla Model 3
+
+    //Check for EnergyTransferMode
+    if (req->RequestedEnergyTransferMode != ShmCcsData->EnergyTransferMode) //[CAUTION] Their table should be kept as the same.
+    {
+        sprintf(buf_log_evcomm,
+                "[ERROR]Unmatched RequestedEnergyTransferMode(%d,%d)",
+                req->RequestedEnergyTransferMode,
+                ShmCcsData->EnergyTransferMode);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        res->ResponseCode = FAILED_WrongEnergyTransferMode_ISO15118_2014;
+        res->EVSEProcessing = iso1EVSEProcessingType_Finished;
+        dc_para->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        ac_para->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        errn = -1;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_WrongEnergyTransferMode (023774)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 4;
+    }
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ChargeParameterDiscoveryRes]EVSE_Shutdown");
+        res->ResponseCode = FAILED_ISO15118_2014;
+        res->EVSEProcessing = iso1EVSEProcessingType_Finished;
+        dc_para->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        ac_para->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ChargeParameterDiscoveryRes]EVSE_EmergencyShutdown");
+        res->ResponseCode = FAILED_ISO15118_2014;
+        res->EVSEProcessing =  iso1EVSEProcessingType_Finished;
+        dc_para->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        ac_para->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        errn = -1;
+    }
+
+    //Detect for CP State should be 9V (State B)
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if (sys->CpState != 3)  //State B1, B2
+    {
+        res->ResponseCode = FAILED_ISO15118_2014;
+        dc_para->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        ac_para->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        res->EVSEProcessing = iso1EVSEProcessingType_Finished;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+        sprintf(buf_log_evcomm,
+                "[Proc_iso1_ChargeParameterDiscoveryRes]Emergency Stop by CP Error (%d, %.02f V)\n",
+                sys->CpState,
+                sys->CpVoltage);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    #endif
+
+    //Check for Permission from CSU
+    if(ShmInternalComm->ChargingPermission == TRUE)
+    {
+        res->EVSEProcessing = iso1EVSEProcessingType_Finished;
+    }
+
+    //Check for Permission Off
+    if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][ISO1][ChargeParameterDiscoveryRes]Permission OFF");
+        res->ResponseCode = FAILED_ISO15118_2014;
+        res->EVSEProcessing = iso1EVSEProcessingType_Finished;
+        dc_para->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        ac_para->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        errn = -1;
+    }
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_ChargeParameterDiscoveryRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #else
+    Sudo_Parameter_iso1_ChargeParameterDiscoveryRes();
+    #endif
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ChargeParameterDiscoveryRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    //STPE 5: ============ Update Flags ============
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_ChargeParameterDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_ChargeParameterDiscoveryReq(int AcceptFd)
+{
+    int errn = 0;
+
+        //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_ChargeParameterDiscoveryReq] Got ChargeParameterDiscoveryReq");
+
+        //ftime(&SeqStartTime);
+        //Print the decoded XML Document
+        PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq(&ccs_exi_doc_DIN);
+
+        //Save into Share Memory
+        SHM_Save_din_ChargeParameterDiscoveryReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+        //Check for EV Error Code
+        Check_EVErrorCode(ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.DC_EVStatus.EVErrorCode);
+
+        errn = Proc_din_ChargeParameterDiscoveryRes(AcceptFd);
+        //ftime(&SeqEndTime);
+        //DEBUG_PRINTF_EVCOMM_DETAIL("\ndelta = %.02lf ms\n", DiffTimeb(SeqStartTime, SeqEndTime));
+        if ( errn == 0)
+        {
+            //send response successfully.
+            //SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]ChargeParameterDiscoveryRes");
+
+        }
+        else
+        {
+            sprintf(buf_log_evcomm,
+                    "[Error][DIN][ChargeParameterDiscoveryRes]%d (DEC)",
+                    errn);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_iso1_ChargeParameterDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_ChargeParameterDiscoveryReq(int AcceptFd)
+{
+    int errn = 0;
+    //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ChargeParameterDiscoveryReq] Got ChargeParameterDiscoveryReq");
+
+    //ftime(&SeqStartTime);
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_ChargeParameterDiscoveryReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.DC_EVStatus.EVErrorCode);
+
+    errn = Proc_iso1_ChargeParameterDiscoveryRes(AcceptFd);
+    //ftime(&SeqEndTime);
+    //DEBUG_PRINTF_EVCOMM_DETAIL("\ndelta = %.02lf ms\n", DiffTimeb(SeqStartTime, SeqEndTime));
+    if (errn == 0)
+    {
+        //send response successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]ChargeParameterDiscoveryRes");
+
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][ISO1][ChargeParameterDiscoveryRes]%d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Init_din_CableCheckRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+    1. shm_ccs
+
+OUTPUT:
+    1. shm_ccs
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Init_din_CableCheckRes(struct CcsData *shm_ccs)
+{
+	struct CableCheckResponse_DIN70121 *in;
+
+	in = &shm_ccs->V2GMessage_DIN70121.CableCheckResponse;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    in->ResponseCode = dinresponseCodeType_OK;
+
+    //----- [BODY (2/3)] EVSEProcessing -----
+	//in->EVSEProcessing = dinEVSEProcessingType_Finished; //for test
+    in->EVSEProcessing = dinEVSEProcessingType_Ongoing; //default
+    // 	dinEVSEProcessingType_Finished = 0,
+    //	dinEVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+	SHM_Init_dinDC_EVSEStatusType(&in->DC_EVSEStatus);
+    in->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid;    //0 (default)
+    //	dinisolationLevelType_Invalid = 0,
+    //	dinisolationLevelType_Valid = 1, (default)
+    //	dinisolationLevelType_Warning = 2,
+    //	dinisolationLevelType_Fault = 3
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_din_CableCheckRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_din_CableCheckRes()
+{
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinCableCheckResType(&ccs_exi_doc_DIN.V2G_Message.Body.CableCheckRes);
+
+    ccs_exi_doc_DIN.V2G_Message.Body.CableCheckRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct dinCableCheckResType *res;
+    res = &ccs_exi_doc_DIN.V2G_Message.Body.CableCheckRes;
+    res->ResponseCode = dinresponseCodeType_OK;
+
+    //----- [BODY (2/3)] EVSEProcessing -----
+    res->EVSEProcessing = dinEVSEProcessingType_Finished; //0
+    // 	dinEVSEProcessingType_Finished = 0,
+    //	dinEVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+    res->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;
+    //	dinisolationLevelType_Invalid = 0,
+    //	dinisolationLevelType_Valid = 1,
+    //	dinisolationLevelType_Warning = 2,
+    //	dinisolationLevelType_Fault = 3
+
+    res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+    // dinDC_EVSEStatusCodeType_EVSE_NotReady = 0,
+    // dinDC_EVSEStatusCodeType_EVSE_Ready = 1,
+    // dinDC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+    // dinDC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+    // dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+    // dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+    // dinDC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+    // dinDC_EVSEStatusCodeType_Reserved_8 = 7,
+    // dinDC_EVSEStatusCodeType_Reserved_9 = 8,
+    // dinDC_EVSEStatusCodeType_Reserved_A = 9,
+    // dinDC_EVSEStatusCodeType_Reserved_B = 10,
+    // dinDC_EVSEStatusCodeType_Reserved_C = 11
+
+    res->DC_EVSEStatus.NotificationMaxDelay = 0u;
+
+    res->DC_EVSEStatus.EVSENotification = dinEVSENotificationType_None;
+    // dinEVSENotificationType_None = 0,
+    // dinEVSENotificationType_StopCharging = 1,
+    // dinEVSENotificationType_ReNegotiation = 2
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_iso1_CableCheckRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_iso1_CableCheckRes()
+{
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1CableCheckResType(&ccs_exi_doc_ISO1.V2G_Message.Body.CableCheckRes);
+
+    ccs_exi_doc_ISO1.V2G_Message.Body.CableCheckRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct iso1CableCheckResType *res;
+    res = &ccs_exi_doc_ISO1.V2G_Message.Body.CableCheckRes;
+    res->ResponseCode = iso1responseCodeType_OK;
+
+    //----- [BODY (2/3)] EVSEProcessing -----
+    res->EVSEProcessing = iso1EVSEProcessingType_Finished; //0
+    //iso1EVSEProcessingType_Finished = 0,
+	//iso1EVSEProcessingType_Ongoing = 1,
+	//iso1EVSEProcessingType_Ongoing_WaitingForCustomerInteraction = 2
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+    res->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;
+    //iso1isolationLevelType_Invalid = 0,
+	//iso1isolationLevelType_Valid = 1,
+	//iso1isolationLevelType_Warning = 2,
+	//iso1isolationLevelType_Fault = 3,
+	//iso1isolationLevelType_No_IMD = 4
+
+    res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+    //iso1DC_EVSEStatusCodeType_EVSE_NotReady = 0,
+	//iso1DC_EVSEStatusCodeType_EVSE_Ready = 1,
+	//iso1DC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+	//iso1DC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+	//iso1DC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+	//iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+	//iso1DC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+	//iso1DC_EVSEStatusCodeType_Reserved_8 = 7,
+	//iso1DC_EVSEStatusCodeType_Reserved_9 = 8,
+	//iso1DC_EVSEStatusCodeType_Reserved_A = 9,
+	//iso1DC_EVSEStatusCodeType_Reserved_B = 10,
+	//iso1DC_EVSEStatusCodeType_Reserved_C = 11
+
+    res->DC_EVSEStatus.NotificationMaxDelay = 0u;
+
+    res->DC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+    //iso1EVSENotificationType_None = 0,
+	//iso1EVSENotificationType_StopCharging = 1,
+	//iso1EVSENotificationType_ReNegotiation = 2
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_CableCheckRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_CableCheckRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct CableCheckResponse_DIN70121 *cab;
+    static struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    cab = &ShmCcsData->V2GMessage_DIN70121.CableCheckResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    cab->ResponseCode = OK_DIN70121;
+    cab->cnt++;
+
+    DEBUG_PRINTF_EVCOMM_DETAIL("CP_State = %d (%.02f V), V_now = %.02f, Isolation Status = %d, EVSEProcessing = %d\n",
+            sys->CpState,
+            sys->CpVoltage,
+            sys->PresentChargingVoltage,
+            sys->IsolationStatus,
+            cab->EVSEProcessing);
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        cab->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        cab->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    if (sys->IsolationStatus == GFD_Invalid)  //0: on going
+    {
+        //For PSU
+        sys->EvBatterytargetVoltage = CABLECHECK_TARGET_VOLTAGE;	//500V	//[To-Do] this should be modified to auto decision.
+        sys->EvBatterytargetCurrent = CABLECHECK_TARGET_CURRENT;	//2A(default), unit: 1A
+
+        cab->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid;
+        cab->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive;    //4
+        cab->EVSEProcessing = dinEVSEProcessingType_Ongoing;
+    }
+    else if ((sys->IsolationStatus == GFD_Valid) || (sys->IsolationStatus == GFD_Warning)) //1: valid, 2: warning
+    {
+        //For PSU
+        sys->EvBatterytargetVoltage = 0;	//0V, asking PSU to discharge to 0V
+        sys->EvBatterytargetCurrent = 0;	//0A, unit: 1A
+
+        if (sys->PresentChargingVoltage < 60)  // < 60V
+        {
+            //memset(buf_log_evcomm, 0, sizeof(buf_log_evcomm));
+            sprintf(buf_log_evcomm, "[V2G][CableCheck]Pass (V_now = %.02f, Isolated = %d)",
+                    sys->PresentChargingVoltage,
+                    sys->IsolationStatus);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+            //IsolationStatus
+            if (sys->IsolationStatus == GFD_Valid)
+            {
+                cab->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;
+            }
+            else if (sys->IsolationStatus == GFD_Warning)
+            {
+                cab->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Warning;
+            }
+            else
+            {
+                sprintf(buf_log_evcomm,
+                        "[WARNING]unexpected IsolationStatus(%d)",
+                        sys->IsolationStatus);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            }
+            cab->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+            cab->EVSEProcessing = dinEVSEProcessingType_Finished;
+        }
+        else
+        {
+            cab->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid;
+            cab->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive;
+            cab->EVSEProcessing = dinEVSEProcessingType_Ongoing;
+        }
+    }
+    else if (sys->IsolationStatus == GFD_Fault) //3: fault
+    {
+        //For PSU
+        sys->EvBatterytargetVoltage = 0;	//0V, asking PSU to discharge to 0V
+        sys->EvBatterytargetCurrent = 0;	//0A, unit: 1A
+
+        cab->ResponseCode = FAILED_DIN70121;
+        cab->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        cab->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_NotReady;
+        cab->EVSEProcessing = dinEVSEProcessingType_Finished;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_CableCheckRes]IsolationStatus = 3 (fault)");
+        errn = -1;
+    }
+    else
+    {
+        //For PSU
+        sys->EvBatterytargetVoltage = 0;	//0V, asking PSU to discharge to 0V
+        sys->EvBatterytargetCurrent = 0;	//0A, unit: 1A
+
+        cab->ResponseCode = FAILED_DIN70121;
+        cab->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid;
+        cab->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_NotReady;
+        cab->EVSEProcessing = dinEVSEProcessingType_Finished;
+        sprintf(buf_log_evcomm,
+                "[Proc_din_CableCheckRes]Undefined Isolation Status(%d)",
+                sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        cab->ResponseCode = FAILED_DIN70121;
+        cab->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        cab->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        cab->EVSEProcessing = dinEVSEProcessingType_Finished;
+	    errn = -1;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_CableCheckRes]EVSE_Shutdown");
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        cab->ResponseCode = FAILED_DIN70121;
+        cab->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        cab->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        cab->EVSEProcessing = dinEVSEProcessingType_Finished;
+	    errn = -1;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_CableCheckRes]EVSE_EmergencyShutdown");
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        cab->ResponseCode = FAILED_DIN70121;
+        cab->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        cab->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        cab->EVSEProcessing = dinEVSEProcessingType_Finished;
+	    errn = -1;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_din_CableCheckRes]ChargingPermission = FALSE");
+    }
+    else
+    {
+        //null
+    }
+
+    //Response to CP Error
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    //#if 1
+    if (sys->CableCheckPreCountDownDone == TRUE)   //[To-Do] Here should be modified to 2 seconds
+    {
+        if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+        {
+            cab->ResponseCode = FAILED_DIN70121;
+            cab->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+            CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+            Update_V2G_Flow_Status(Other_Fault);
+            errn = -1;
+
+            //Update_ShmStatusCode(); //[To-Do] to be implemented
+            //CCS_SECC_CP_State_Error (023889)
+            ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+            ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+            ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+            ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+            ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+            ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+            CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+
+            sprintf(buf_log_evcomm,
+                    "[CableCheck]Emergency Stop by CP Error (%d, %.02f V, %d)\n",
+                    sys->CpState,
+                    sys->CpVoltage,
+                    cab->cnt
+                    );
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            //cab->cnt = 0;
+        }
+    }
+    #endif
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_CableCheckRes(&ccs_exi_doc_DIN, ShmCcsData);
+    #else
+    Sudo_Parameter_din_CableCheckRes();
+    #endif
+
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+      errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+    sys->ConnectorLocked = TRUE;    //Inicating EVSE that the CCS Connector is Locked.
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_iso1_CableCheckRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_CableCheckRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct CableCheckResponse_ISO15118_2014 *cab;
+    static struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    cab = &ShmCcsData->V2GMessage_ISO15118_2014.CableCheckResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    cab->ResponseCode = OK_ISO15118_2014;
+    cab->cnt++;
+
+    DEBUG_PRINTF_EVCOMM_DETAIL("CP_State = %d (%.02f V), V_now = %.02f, Isolation Status = %d, EVSEProcessing = %d\n",
+            sys->CpState,
+            sys->CpVoltage,
+            sys->PresentChargingVoltage,
+            sys->IsolationStatus,
+            cab->EVSEProcessing);
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        cab->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        cab->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    if (sys->IsolationStatus == GFD_Invalid)  //0: invalid (on going)
+    {
+        //For PSU
+        sys->EvBatterytargetVoltage = CABLECHECK_TARGET_VOLTAGE;	//500V	//[To-Do] this should be modified to auto decision.
+        sys->EvBatterytargetCurrent = CABLECHECK_TARGET_CURRENT;	//2A(default), unit: 1A
+
+        cab->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Invalid;
+        cab->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive;
+        cab->EVSEProcessing = iso1EVSEProcessingType_Ongoing;
+    }
+    else if ((sys->IsolationStatus == GFD_Valid) || (sys->IsolationStatus == GFD_Warning)) //1: valid, 2:waring
+    {
+        //For PSU
+        sys->EvBatterytargetVoltage = 0;	//0V, asking PSU to discharge to 0V
+        sys->EvBatterytargetCurrent = 0;	//0A, unit: 1A
+
+        if (sys->PresentChargingVoltage < 60)  // < 60V
+        {
+            //memset(buf_log_evcomm, 0, sizeof(buf_log_evcomm));
+            sprintf(buf_log_evcomm, "[V2G][CableCheck]Pass (V_now = %.02f, Isolated = %d)",
+                    sys->PresentChargingVoltage,
+                    sys->IsolationStatus);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+            //IsolationStatus
+            if (sys->IsolationStatus == GFD_Valid)
+            {
+                cab->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;
+            }
+            else if (sys->IsolationStatus == GFD_Warning)
+            {
+                cab->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Warning;
+            }
+            else
+            {
+                sprintf(buf_log_evcomm,
+                        "[WARNING]unexpected IsolationStatus(%d)",
+                        sys->IsolationStatus);
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            }
+
+            cab->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+            cab->EVSEProcessing = iso1EVSEProcessingType_Finished;
+        }
+        else
+        {
+            cab->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Invalid;
+            cab->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive;
+            cab->EVSEProcessing = iso1EVSEProcessingType_Ongoing;
+        }
+    }
+    else if (sys->IsolationStatus == GFD_Fault) //3: fault
+    {
+        //For PSU
+        sys->EvBatterytargetVoltage = 0;	//0V, asking PSU to discharge to 0V
+        sys->EvBatterytargetCurrent = 0;	//0A, unit: 1A
+
+        cab->ResponseCode = FAILED_ISO15118_2014;
+        cab->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        cab->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_NotReady;
+        cab->EVSEProcessing = iso1EVSEProcessingType_Finished;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_CableCheckRes]IsolationStatus = 3 (fault)");
+        errn = -1;
+    }
+    //else if (sys->IsolationStatus == GFD_No_IMD){}    //only for ISO15118
+    else
+    {
+        //For PSU
+        sys->EvBatterytargetVoltage = 0;	//0V, asking PSU to discharge to 0V
+        sys->EvBatterytargetCurrent = 0;	//0A, unit: 1A
+
+        cab->ResponseCode = FAILED_ISO15118_2014;
+        cab->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        cab->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_NotReady;
+        cab->EVSEProcessing = iso1EVSEProcessingType_Finished;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_CableCheckRes]Undefined Isolation Status.");
+    }
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        cab->ResponseCode = FAILED_ISO15118_2014;
+        cab->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        cab->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        cab->EVSEProcessing = iso1EVSEProcessingType_Finished;
+        errn = -1;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_CableCheckRes]EVSE_Shutdown");
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        cab->ResponseCode = FAILED_ISO15118_2014;
+        cab->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        cab->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        cab->EVSEProcessing = iso1EVSEProcessingType_Finished;
+        errn = -1;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_CableCheckRes]EVSE_EmergencyShutdown");
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        cab->ResponseCode = FAILED_ISO15118_2014;
+        cab->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        cab->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        cab->EVSEProcessing = iso1EVSEProcessingType_Finished;
+        errn = -1;
+	    SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_iso1_CableCheckRes]ChargingPermission = FALSE");
+    }
+    else
+    {
+        //null
+    }
+
+    //Response to CP Error
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if (sys->CableCheckPreCountDownDone == TRUE)   //[To-Do] Here should be modified to 2 seconds
+    {
+        if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+        {
+            cab->ResponseCode = FAILED_ISO15118_2014;
+            cab->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+            CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+            Update_V2G_Flow_Status(Other_Fault);
+            errn = -1;
+
+            //Update_ShmStatusCode(); //[To-Do] to be implemented
+            //CCS_SECC_CP_State_Error (023889)
+            ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+            ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+            ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+            ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+            ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+            ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+            CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+
+            sprintf(buf_log_evcomm,
+                    "[CableCheck]Emergency Stop by CP Error (%d, %.02f V, %d)\n",
+                    sys->CpState,
+                    sys->CpVoltage,
+                    cab->cnt
+                    );
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            //cab->cnt = 0;
+        }
+    }
+    #endif
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_CableCheckRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #else
+    Sudo_Parameter_iso1_CableCheckRes();
+    #endif
+
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+    sys->ConnectorLocked = TRUE;    //Inicating EVSE that the CCS Connector is Locked.
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_CableCheckReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_CableCheckReq(int AcceptFd)
+{
+    int errn = 0;
+    //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_CableCheckReq] Got CableCheckReq\n");
+
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_CableCheckReq(&ccs_exi_doc_DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_CableCheckReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_DIN70121.CableCheckRequest.DC_EVStatus.EVErrorCode);
+
+    errn = Proc_din_CableCheckRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]CableCheckRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_din_CableCheckReq]Proc_iso1_CableCheckRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_CableCheckReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_CableCheckReq(int AcceptFd)
+{
+    int errn = 0;
+    //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_CableCheckReq] Got CableCheckReq");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_CableCheckReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_CableCheckReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_ISO15118_2014.CableCheckRequest.DC_EVStatus.EVErrorCode);
+
+    errn = Proc_iso1_CableCheckRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]CableCheckRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_iso1_CableCheckReq]Proc_iso1_CableCheckRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+
+/*===========================================================================
+FUNCTION: SHM_Init_din_PreChargeRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+    1. shm_ccs
+
+OUTPUT:
+    1. shm_ccs
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Init_din_PreChargeRes(struct CcsData *shm_ccs)
+{
+	struct PreChargeResponse_DIN70121 *in;
+
+	in = &shm_ccs->V2GMessage_DIN70121.PreChargeResponse;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    in->ResponseCode = dinresponseCodeType_OK;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+    short value = 0; int multiplier = 0; unsigned char unit = 0;
+    //value = 3820; multiplier = -1; unit = V_DIN70121;    //382V, for Test
+    value = 0; multiplier = 0; unit = V_DIN70121; //waiting for CsuComm to update V to fit EV Target
+	SHM_Save_dinPhysicalValueType(&in->EVSEPresentVoltage, value, multiplier, unit);
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+	SHM_Init_dinDC_EVSEStatusType(&in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_din_PreChargeRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_din_PreChargeRes()
+{
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinPreChargeResType(&ccs_exi_doc_DIN.V2G_Message.Body.PreChargeRes);
+
+    ccs_exi_doc_DIN.V2G_Message.Body.PreChargeRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct dinPreChargeResType *res;
+    res = &ccs_exi_doc_DIN.V2G_Message.Body.PreChargeRes;
+    res->ResponseCode = dinresponseCodeType_OK;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+    res->EVSEPresentVoltage.Value = 3820;
+    res->EVSEPresentVoltage.Multiplier = -1;
+    res->EVSEPresentVoltage.Unit_isUsed = 1u;
+    res->EVSEPresentVoltage.Unit = dinunitSymbolType_V;
+    //	dinunitSymbolType_h = 0,
+    //	dinunitSymbolType_m = 1,
+    //	dinunitSymbolType_s = 2,
+    //	dinunitSymbolType_A = 3,
+    //	dinunitSymbolType_Ah = 4,
+    //	dinunitSymbolType_V = 5,
+    //	dinunitSymbolType_VA = 6,
+    //	dinunitSymbolType_W = 7,
+    //	dinunitSymbolType_W_s = 8,
+    //	dinunitSymbolType_Wh = 9
+
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+    res->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;
+    //	dinisolationLevelType_Invalid = 0,
+    //	dinisolationLevelType_Valid = 1,
+    //	dinisolationLevelType_Warning = 2,
+    //	dinisolationLevelType_Fault = 3
+
+    res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+    // dinDC_EVSEStatusCodeType_EVSE_NotReady = 0,
+    // dinDC_EVSEStatusCodeType_EVSE_Ready = 1,
+    // dinDC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+    // dinDC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+    // dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+    // dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+    // dinDC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+    // dinDC_EVSEStatusCodeType_Reserved_8 = 7,
+    // dinDC_EVSEStatusCodeType_Reserved_9 = 8,
+    // dinDC_EVSEStatusCodeType_Reserved_A = 9,
+    // dinDC_EVSEStatusCodeType_Reserved_B = 10,
+    // dinDC_EVSEStatusCodeType_Reserved_C = 11
+
+    res->DC_EVSEStatus.NotificationMaxDelay = 0u;
+
+    res->DC_EVSEStatus.EVSENotification = dinEVSENotificationType_None;
+    // dinEVSENotificationType_None = 0,
+    // dinEVSENotificationType_StopCharging = 1,
+    // dinEVSENotificationType_ReNegotiation = 2
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_iso1_PreChargeRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_iso1_PreChargeRes()
+{
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1PreChargeResType(&ccs_exi_doc_ISO1.V2G_Message.Body.PreChargeRes);
+
+    ccs_exi_doc_ISO1.V2G_Message.Body.PreChargeRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct iso1PreChargeResType *res;
+    res = &ccs_exi_doc_ISO1.V2G_Message.Body.PreChargeRes;
+    res->ResponseCode = iso1responseCodeType_OK;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+    res->EVSEPresentVoltage.Value = 3820;
+    res->EVSEPresentVoltage.Multiplier = -1;
+    //res->EVSEPresentVoltage.Unit_isUsed = 1u;
+    res->EVSEPresentVoltage.Unit = iso1unitSymbolType_V;
+    //iso1unitSymbolType_h = 0,
+	//iso1unitSymbolType_m = 1,
+	//iso1unitSymbolType_s = 2,
+	//iso1unitSymbolType_A = 3,
+	//iso1unitSymbolType_V = 4,
+	//iso1unitSymbolType_W = 5,
+	//iso1unitSymbolType_Wh = 6
+
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+    res->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;
+    //iso1isolationLevelType_Invalid = 0,
+	//iso1isolationLevelType_Valid = 1,
+	//iso1isolationLevelType_Warning = 2,
+	//iso1isolationLevelType_Fault = 3,
+	//iso1isolationLevelType_No_IMD = 4
+
+    res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+    //iso1DC_EVSEStatusCodeType_EVSE_NotReady = 0,
+	//iso1DC_EVSEStatusCodeType_EVSE_Ready = 1,
+	//iso1DC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+	//iso1DC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+	//iso1DC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+	//iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+	//iso1DC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+	//iso1DC_EVSEStatusCodeType_Reserved_8 = 7,
+	//iso1DC_EVSEStatusCodeType_Reserved_9 = 8,
+	//iso1DC_EVSEStatusCodeType_Reserved_A = 9,
+	//iso1DC_EVSEStatusCodeType_Reserved_B = 10,
+	//iso1DC_EVSEStatusCodeType_Reserved_C = 11
+
+    res->DC_EVSEStatus.NotificationMaxDelay = 0u;
+
+    res->DC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+    //iso1EVSENotificationType_None = 0,
+	//iso1EVSENotificationType_StopCharging = 1,
+	//iso1EVSENotificationType_ReNegotiation = 2
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_PreChargeRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_PreChargeRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct PreChargeResponse_DIN70121 *pre;
+    static struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    pre = &ShmCcsData->V2GMessage_DIN70121.PreChargeResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    pre->ResponseCode = OK_DIN70121;
+
+    //EVSE Status Code
+    pre->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        pre->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        pre->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_DIN70121(&pre->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_DIN70121);
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid)  //0: invalid
+    {
+        pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid; //0
+        pre->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+        sprintf(buf_log_evcomm, "[Error][Proc_din_PreChargeRes]IsolationStatus = %d", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    else if (sys->IsolationStatus == GFD_Valid) //1: valid
+    {
+        pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;  //1
+    }
+    else if (sys->IsolationStatus == GFD_Warning) //2: warning
+    {
+        pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Warning;  //2
+    }
+    else if (sys->IsolationStatus == GFD_Fault) //3: fault
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_din_PreChargeRes]GFD_Fault => Emergency Shutdown");
+        pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;  //3
+        pre->ResponseCode = FAILED_DIN70121;
+        pre->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        errn = -1;
+    }
+    else    //GFD_No_IMD or other unexpected status
+    {
+        pre->ResponseCode = FAILED_DIN70121;
+        pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;  //3
+        pre->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+        sprintf(buf_log_evcomm,
+                "[Error][Proc_din_PreChargeRes]IsolationStatus = %d (undefined)",
+                sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //Check for Alarm Code: CCS GFD trip (012235)
+        if (ShmInternalComm->EVSEStopChargingReq.alarmcode[0] == 0 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[1] == 1 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[2] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[3] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[4] == 3 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[5] == 5)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_din_PreChargeRes]CCS GFD trip => EVSE_Shutdown");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        }
+        else
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_din_PreChargeRes]EVSE_Shutdown");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        }
+
+        pre->ResponseCode = FAILED_DIN70121;
+        pre->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //Check for Alarm Code: CCS GFD trip (012235)
+        if (ShmInternalComm->EVSEStopChargingReq.alarmcode[0] == 0 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[1] == 1 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[2] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[3] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[4] == 3 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[5] == 5)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_din_PreChargeRes]CCS GFD trip => EVSE_EmergencyShutdown");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        }
+        else
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_din_PreChargeRes]EVSE_EmergencyShutdown");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        }
+
+        pre->ResponseCode = FAILED_DIN70121;
+        pre->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        errn = -1;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_din_PreChargeRes]ChargingPermission = FALSE");
+        pre->ResponseCode = FAILED_DIN70121;
+        pre->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        pre->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+    }
+    else
+    {
+        //null
+    }
+
+    //Response to CP Error
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+    {
+        pre->ResponseCode = FAILED_DIN70121;
+        pre->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_CP_State_Error (023889)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+
+        sprintf(buf_log_evcomm,
+                "[Error][Proc_din_PreChargeRes]Emergency Stop by CP Error (%d, %.02f V)\n",
+                sys->CpState,
+                sys->CpVoltage
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    #endif
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_PreChargeRes(&ccs_exi_doc_DIN, ShmCcsData);
+    #else
+    Sudo_Parameter_din_PreChargeRes();
+    #endif
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][send_encoded_din_V2GTP_Stream]:Tx encoded msg error");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_PreChargeRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_PreChargeRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct PreChargeResponse_ISO15118_2014 *pre;
+    static struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    pre = &ShmCcsData->V2GMessage_ISO15118_2014.PreChargeResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    pre->ResponseCode = OK_ISO15118_2014;
+
+    //EVSE Status Code
+    pre->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        pre->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        pre->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_ISO15118_2014(&pre->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_ISO15118_2014);
+
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid)    //0: invalid(on going)
+    {
+        pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Invalid; //0
+        pre->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+        sprintf(buf_log_evcomm, "[Error][Proc_iso1_PreChargeRes]IsolationStatus = %d", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    else if (sys->IsolationStatus == GFD_Valid) //1: valid
+    {
+        pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1
+    }
+    else if (sys->IsolationStatus == GFD_Warning) //2: waring
+    {
+        pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Warning;  //1
+    }
+    else if (sys->IsolationStatus == GFD_Fault) //3: fault
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_iso1_PreChargeRes]GFD_Fault => Emergency Shutdown");
+        pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;  //3
+        pre->ResponseCode = FAILED_ISO15118_2014;
+        pre->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        errn = -1;
+    }
+    else
+    {
+        pre->ResponseCode = FAILED_ISO15118_2014;
+        pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;  //3
+        pre->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+        sprintf(buf_log_evcomm,
+                "[Error][Proc_iso1_PreChargeRes]IsolationStatus = %d (undefined)",
+                sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //Check for Alarm Code: CCS GFD trip (012235)
+        if (ShmInternalComm->EVSEStopChargingReq.alarmcode[0] == 0 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[1] == 1 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[2] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[3] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[4] == 3 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[5] == 5)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_iso1_PreChargeRes]CCS GFD trip => EVSE_Shutdown");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        }
+        else
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_iso1_PreChargeRes]EVSE_Shutdown");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        }
+
+        pre->ResponseCode = FAILED_ISO15118_2014;
+        pre->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //Check for Alarm Code: CCS GFD trip (012235)
+        if (ShmInternalComm->EVSEStopChargingReq.alarmcode[0] == 0 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[1] == 1 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[2] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[3] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[4] == 3 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[5] == 5)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_iso1_PreChargeRes]CCS GFD trip => EVSE_EmergencyShutdown");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        }
+        else
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_iso1_PreChargeRes]EVSE_EmergencyShutdown");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        }
+
+        pre->ResponseCode = FAILED_ISO15118_2014;
+        pre->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        errn = -1;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_iso1_PreChargeRes]ChargingPermission = FALSE");
+        pre->ResponseCode = FAILED_ISO15118_2014;
+        pre->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        pre->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+    }
+    else
+    {
+        //null
+    }
+
+    //Response to CP Error
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+    {
+        pre->ResponseCode = FAILED_ISO15118_2014;
+        pre->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_CP_State_Error (023889)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+
+        sprintf(buf_log_evcomm,
+                "[Error][Proc_iso1_PreChargeRes]Emergency Stop by CP Error (%d, %.02f V)\n",
+                sys->CpState,
+                sys->CpVoltage
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    #endif
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_PreChargeRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #else
+    Sudo_Parameter_iso1_PreChargeRes();
+    #endif
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][send_encoded_iso1_V2GTP_Stream]:Tx encoded msg error");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_PreChargeReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_PreChargeReq(int AcceptFd)
+{
+    int errn = 0;
+    //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_PreChargeReq] Got PreChargeReq");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_PreChargeReq(&ccs_exi_doc_DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_PreChargeReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_DIN70121.PreChargeRequest.DC_EVStatus.EVErrorCode);
+
+    errn = Proc_din_PreChargeRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]PreChargeRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_din_PreChargeReq]Proc_iso1_PreChargeRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_PreChargeReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_PreChargeReq(int AcceptFd)
+{
+    int errn = 0;
+    //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_PreChargeReq] Got PreChargeReq");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_PreChargeReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_PreChargeReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_ISO15118_2014.PreChargeRequest.DC_EVStatus.EVErrorCode);
+
+    errn = Proc_iso1_PreChargeRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]PreChargeRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_iso1_PreChargeReq]Proc_iso1_PreChargeRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Init_din_PowerDeliveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+    1. shm_ccs
+
+OUTPUT:
+    1. shm_ccs
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Init_din_PowerDeliveryRes(struct CcsData *shm_ccs)
+{
+	struct PowerDeliveryResponse_DIN70121 *in;
+
+	in = &shm_ccs->V2GMessage_DIN70121.PowerDeliveryResponse;
+
+
+	//----- [BODY (1/3)] ResponseCode -----
+    in->ResponseCode = dinresponseCodeType_OK;
+
+
+    //----- [BODY (2/3)] AC_EVSEStatus -----
+    //ignore, since DIN 70121 doesn't support AC, yet.
+
+
+    //----- [BODY (2/3)] DC_EVSEStatus -----
+	SHM_Init_dinDC_EVSEStatusType(&in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_din_PowerDeliveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_din_PowerDeliveryRes()
+{
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinPowerDeliveryResType(&ccs_exi_doc_DIN.V2G_Message.Body.PowerDeliveryRes);
+
+    ccs_exi_doc_DIN.V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct dinPowerDeliveryResType *res;
+    res = &ccs_exi_doc_DIN.V2G_Message.Body.PowerDeliveryRes;
+    res->ResponseCode = dinresponseCodeType_OK;
+
+
+    //----- [BODY (2/3)] AC_EVSEStatus -----
+    //ignore, since DIN 70121 doesn't support AC, yet.
+
+
+    //----- [BODY (2/3)] DC_EVSEStatus -----
+    res->DC_EVSEStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;
+    //	dinisolationLevelType_Invalid = 0,
+    //	dinisolationLevelType_Valid = 1,
+    //	dinisolationLevelType_Warning = 2,
+    //	dinisolationLevelType_Fault = 3
+
+    res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+    // dinDC_EVSEStatusCodeType_EVSE_NotReady = 0,
+    // dinDC_EVSEStatusCodeType_EVSE_Ready = 1,
+    // dinDC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+    // dinDC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+    // dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+    // dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+    // dinDC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+    // dinDC_EVSEStatusCodeType_Reserved_8 = 7,
+    // dinDC_EVSEStatusCodeType_Reserved_9 = 8,
+    // dinDC_EVSEStatusCodeType_Reserved_A = 9,
+    // dinDC_EVSEStatusCodeType_Reserved_B = 10,
+    // dinDC_EVSEStatusCodeType_Reserved_C = 11
+
+    res->DC_EVSEStatus.NotificationMaxDelay = 0u;
+
+    res->DC_EVSEStatus.EVSENotification = dinEVSENotificationType_None;
+    // dinEVSENotificationType_None = 0,
+    // dinEVSENotificationType_StopCharging = 1,
+    // dinEVSENotificationType_ReNegotiation = 2
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_iso1_PowerDeliveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_iso1_PowerDeliveryRes()
+{
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1PowerDeliveryResType(&ccs_exi_doc_ISO1.V2G_Message.Body.PowerDeliveryRes);
+
+    ccs_exi_doc_ISO1.V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct iso1PowerDeliveryResType *res;
+    res = &ccs_exi_doc_ISO1.V2G_Message.Body.PowerDeliveryRes;
+    res->ResponseCode = iso1responseCodeType_OK;
+
+
+    //----- [BODY (2/3)] AC_EVSEStatus -----
+    //ignore, since our ISO1 70121 doesn't support AC, yet.
+
+
+    //----- [BODY (2/3)] DC_EVSEStatus -----
+    res->DC_EVSEStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;
+    //iso1isolationLevelType_Invalid = 0,
+	//iso1isolationLevelType_Valid = 1,
+	//iso1isolationLevelType_Warning = 2,
+	//iso1isolationLevelType_Fault = 3,
+	//iso1isolationLevelType_No_IMD = 4
+
+    res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+    //iso1DC_EVSEStatusCodeType_EVSE_NotReady = 0,
+	//iso1DC_EVSEStatusCodeType_EVSE_Ready = 1,
+	//iso1DC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+	//iso1DC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+	//iso1DC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+	//iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+	//iso1DC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+	//iso1DC_EVSEStatusCodeType_Reserved_8 = 7,
+	//iso1DC_EVSEStatusCodeType_Reserved_9 = 8,
+	//iso1DC_EVSEStatusCodeType_Reserved_A = 9,
+	//iso1DC_EVSEStatusCodeType_Reserved_B = 10,
+	//iso1DC_EVSEStatusCodeType_Reserved_C = 11
+
+    res->DC_EVSEStatus.NotificationMaxDelay = 0u;
+
+    res->DC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+    //iso1EVSENotificationType_None = 0,
+	//iso1EVSENotificationType_StopCharging = 1,
+	//iso1EVSENotificationType_ReNegotiation = 2
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_PowerDeliveryStartRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_PowerDeliveryStartRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct dinPowerDeliveryResType *res;
+    struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    res = &ccs_exi_doc_DIN.V2G_Message.Body.PowerDeliveryRes;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    res->ResponseCode = OK_DIN70121;
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_PowerDeliveryRes(&ccs_exi_doc_DIN, ShmCcsData);
+    #else
+    Sudo_Parameter_din_PowerDeliveryRes();
+    #endif
+
+    //EVSE Status Code
+    res->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;  //1
+    res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_PowerDeliveryStartRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_iso1_PowerDeliveryStartRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_PowerDeliveryStartRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct iso1PowerDeliveryResType *res;
+    struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    res = &ccs_exi_doc_ISO1.V2G_Message.Body.PowerDeliveryRes;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    res->ResponseCode = OK_ISO15118_2014;
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_PowerDeliveryRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #else
+    Sudo_Parameter_iso1_PowerDeliveryRes();
+    #endif
+
+    //EVSE Status Code
+    res->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1
+    res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_PowerDeliveryStartRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_PowerDeliveryStartReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_PowerDeliveryStartReq(int AcceptFd)
+{
+    int errn = 0;
+    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]PowerDeliveryStartReq");
+
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_PowerDeliveryReq(&ccs_exi_doc_DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_PowerDeliveryReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_DIN70121.PowerDeliveryRequest.DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode);
+
+    errn = Proc_din_PowerDeliveryStartRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]PowerDeliveryStartRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][Proc_din_PowerDeliveryStartReq]Proc_iso1_PowerDeliveryStartRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_PowerDeliveryStartReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_PowerDeliveryStartReq(int AcceptFd)
+{
+    int errn = 0;
+    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]PowerDeliveryStartReq");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_PowerDeliveryReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_PowerDeliveryReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode);
+
+    errn = Proc_iso1_PowerDeliveryStartRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]PowerDeliveryStartRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][Proc_iso1_PowerDeliveryStartReq]Proc_iso1_PowerDeliveryStartRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Init_din_CurrentDemandRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+    1. shm_ccs
+
+OUTPUT:
+    1. shm_ccs
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Init_din_CurrentDemandRes(struct CcsData *shm_ccs)
+{
+	struct CurrentDemandResponse_DIN70121 *in;
+
+	in = &shm_ccs->V2GMessage_DIN70121.CurrentDemandResponse;
+
+
+	//----- [BODY (1/10)] ResponseCode -----
+    in->ResponseCode = dinresponseCodeType_OK;
+
+    //----- [BODY (2/10)] DC_EVSEStatus -----
+    SHM_Init_dinDC_EVSEStatusType(&in->DC_EVSEStatus);
+
+
+    //----- [BODY (3/10)] EVSEPresentVoltage -----
+    short value = 0; int multiplier = 0; unsigned char unit = 0;
+
+    //value = 3820; multiplier = -1; unit = V_DIN70121;    //382V, for test only.
+    value = 0; multiplier = 0; unit = V_DIN70121;
+	SHM_Save_dinPhysicalValueType(&in->EVSEPresentVoltage, value, multiplier, unit);
+
+
+    //----- [BODY (4/10)] EVSEPresentCurrent -----
+    //value = 600; multiplier = -1; unit = A_DIN70121;    //60A, for test only.
+    value = 0; multiplier = 0; unit = A_DIN70121;
+    SHM_Save_dinPhysicalValueType(&in->EVSEPresentCurrent, value, multiplier, unit);
+
+
+    //----- [BODY (5/10)] EVSECurrentLimitAchieved -----
+    in->EVSECurrentLimitAchieved = FALSE;
+
+    //----- [BODY (6/10)] EVSEVoltageLimitAchieved -----
+    in->EVSEVoltageLimitAchieved = FALSE;
+
+    //----- [BODY (7/10)] EVSEPowerLimitAchieved -----
+    in->EVSEPowerLimitAchieved = FALSE;
+
+    //----- [BODY (8/10)] EVSEMaximumVoltageLimit -----
+    //value = 7500; multiplier = -1; unit = V_DIN70121;    //750V
+    value = 5000; multiplier = -1; unit = V_DIN70121;    //500V
+    SHM_Save_dinPhysicalValueType(&in->EVSEMaximumVoltageLimit, value, multiplier, unit);
+
+    //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
+    value = 600; multiplier = -1; unit = A_DIN70121;    //60A
+    SHM_Save_dinPhysicalValueType(&in->EVSEMaximumCurrentLimit, value, multiplier, unit);
+
+    //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
+    value = 3000; multiplier = 1; unit = W_DIN70121;    //30KW
+    SHM_Save_dinPhysicalValueType(&in->EVSEMaximumPowerLimit, value, multiplier, unit);
+}
+
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_din_CurrentDemandRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_din_CurrentDemandRes()
+{
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinCurrentDemandResType(&ccs_exi_doc_DIN.V2G_Message.Body.CurrentDemandRes);
+
+    ccs_exi_doc_DIN.V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
+
+    //----- [BODY (1/10)] ResponseCode -----
+    struct dinCurrentDemandResType *res;
+    res = &ccs_exi_doc_DIN.V2G_Message.Body.CurrentDemandRes;
+    res->ResponseCode = dinresponseCodeType_OK;
+
+    //----- [BODY (2/10)] DC_EVSEStatus -----
+    res->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid;
+    //	dinisolationLevelType_Invalid = 0,
+    //	dinisolationLevelType_Valid = 1,
+    //	dinisolationLevelType_Warning = 2,
+    //	dinisolationLevelType_Fault = 3
+
+    res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+    // dinDC_EVSEStatusCodeType_EVSE_NotReady = 0,
+    // dinDC_EVSEStatusCodeType_EVSE_Ready = 1,
+    // dinDC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+    // dinDC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+    // dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+    // dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+    // dinDC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+    // dinDC_EVSEStatusCodeType_Reserved_8 = 7,
+    // dinDC_EVSEStatusCodeType_Reserved_9 = 8,
+    // dinDC_EVSEStatusCodeType_Reserved_A = 9,
+    // dinDC_EVSEStatusCodeType_Reserved_B = 10,
+    // dinDC_EVSEStatusCodeType_Reserved_C = 11
+
+    res->DC_EVSEStatus.NotificationMaxDelay = 0u;
+    res->DC_EVSEStatus.EVSENotification = dinEVSENotificationType_None;
+    // dinEVSENotificationType_None = 0,
+    // dinEVSENotificationType_StopCharging = 1,
+    // dinEVSENotificationType_ReNegotiation = 2
+
+
+
+    //----- [BODY (3/10)] EVSEPresentVoltage -----
+    res->EVSEPresentVoltage.Value = 3820;
+    res->EVSEPresentVoltage.Multiplier = -1;
+    res->EVSEPresentVoltage.Unit_isUsed = 1u;
+    res->EVSEPresentVoltage.Unit = dinunitSymbolType_V;
+
+
+    //----- [BODY (4/10)] EVSEPresentCurrent -----
+    res->EVSEPresentCurrent.Value = 1200;
+    res->EVSEPresentCurrent.Multiplier = -1;
+    res->EVSEPresentCurrent.Unit_isUsed = 1u;
+    res->EVSEPresentCurrent.Unit = dinunitSymbolType_A;
+
+
+    //----- [BODY (5/10)] EVSECurrentLimitAchieved -----
+    res->EVSECurrentLimitAchieved = 0;
+
+    //----- [BODY (6/10)] EVSEVoltageLimitAchieved -----
+    res->EVSEVoltageLimitAchieved = 0;
+
+    //----- [BODY (7/10)] EVSEPowerLimitAchieved -----
+    res->EVSEPowerLimitAchieved = 0;
+
+    //----- [BODY (8/10)] EVSEMaximumVoltageLimit -----
+    res->EVSEMaximumVoltageLimit_isUsed = 1u;
+    res->EVSEMaximumVoltageLimit.Value = 7500;
+    res->EVSEMaximumVoltageLimit.Multiplier = -1;
+    res->EVSEMaximumVoltageLimit.Unit_isUsed = 1u;
+    res->EVSEMaximumVoltageLimit.Unit = dinunitSymbolType_V;
+
+    //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
+    res->EVSEMaximumCurrentLimit_isUsed = 1u;
+    res->EVSEMaximumCurrentLimit.Value = 1200;
+    res->EVSEMaximumCurrentLimit.Multiplier = -1;
+    res->EVSEMaximumCurrentLimit.Unit_isUsed = 1u;
+    res->EVSEMaximumCurrentLimit.Unit = dinunitSymbolType_A;
+
+    //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
+    res->EVSEMaximumPowerLimit_isUsed = 1u;
+    res->EVSEMaximumPowerLimit.Value = 6000;
+    res->EVSEMaximumPowerLimit.Multiplier = 1;
+    res->EVSEMaximumPowerLimit.Unit_isUsed = 1u;
+    res->EVSEMaximumPowerLimit.Unit = dinunitSymbolType_W;
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_iso1_CurrentDemandRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_iso1_CurrentDemandRes()
+{
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1CurrentDemandResType(&ccs_exi_doc_ISO1.V2G_Message.Body.CurrentDemandRes);
+
+    ccs_exi_doc_ISO1.V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
+
+    //----- [BODY (1/10)] ResponseCode -----
+    struct iso1CurrentDemandResType *res;
+    res = &ccs_exi_doc_ISO1.V2G_Message.Body.CurrentDemandRes;
+    res->ResponseCode = iso1responseCodeType_OK;
+
+    //----- [BODY (2/10)] DC_EVSEStatus -----
+    res->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Invalid;
+    //iso1isolationLevelType_Invalid = 0,
+	//iso1isolationLevelType_Valid = 1,
+	//iso1isolationLevelType_Warning = 2,
+	//iso1isolationLevelType_Fault = 3,
+	//iso1isolationLevelType_No_IMD = 4
+
+    res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+    //iso1DC_EVSEStatusCodeType_EVSE_NotReady = 0,
+	//iso1DC_EVSEStatusCodeType_EVSE_Ready = 1,
+	//iso1DC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+	//iso1DC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+	//iso1DC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+	//iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+	//iso1DC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+	//iso1DC_EVSEStatusCodeType_Reserved_8 = 7,
+	//iso1DC_EVSEStatusCodeType_Reserved_9 = 8,
+	//iso1DC_EVSEStatusCodeType_Reserved_A = 9,
+	//iso1DC_EVSEStatusCodeType_Reserved_B = 10,
+	//iso1DC_EVSEStatusCodeType_Reserved_C = 11
+
+    res->DC_EVSEStatus.NotificationMaxDelay = 0u;
+    res->DC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+    //iso1EVSENotificationType_None = 0,
+	//iso1EVSENotificationType_StopCharging = 1,
+	//iso1EVSENotificationType_ReNegotiation = 2
+
+
+
+    //----- [BODY (3/10)] EVSEPresentVoltage -----
+    res->EVSEPresentVoltage.Value = 3820;
+    res->EVSEPresentVoltage.Multiplier = -1;
+    //res->EVSEPresentVoltage.Unit_isUsed = 1u;
+    res->EVSEPresentVoltage.Unit = iso1unitSymbolType_V;
+
+
+    //----- [BODY (4/10)] EVSEPresentCurrent -----
+    res->EVSEPresentCurrent.Value = 1200;
+    res->EVSEPresentCurrent.Multiplier = -1;
+    //res->EVSEPresentCurrent.Unit_isUsed = 1u;
+    res->EVSEPresentCurrent.Unit = iso1unitSymbolType_A;
+
+
+    //----- [BODY (5/10)] EVSECurrentLimitAchieved -----
+    res->EVSECurrentLimitAchieved = 0;
+
+    //----- [BODY (6/10)] EVSEVoltageLimitAchieved -----
+    res->EVSEVoltageLimitAchieved = 0;
+
+    //----- [BODY (7/10)] EVSEPowerLimitAchieved -----
+    res->EVSEPowerLimitAchieved = 0;
+
+    //----- [BODY (8/10)] EVSEMaximumVoltageLimit -----
+    res->EVSEMaximumVoltageLimit_isUsed = 1u;
+    res->EVSEMaximumVoltageLimit.Value = 7500;
+    res->EVSEMaximumVoltageLimit.Multiplier = -1;
+    //res->EVSEMaximumVoltageLimit.Unit_isUsed = 1u;
+    res->EVSEMaximumVoltageLimit.Unit = iso1unitSymbolType_V;
+
+    //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
+    res->EVSEMaximumCurrentLimit_isUsed = 1u;
+    res->EVSEMaximumCurrentLimit.Value = 1200;
+    res->EVSEMaximumCurrentLimit.Multiplier = -1;
+    //res->EVSEMaximumCurrentLimit.Unit_isUsed = 1u;
+    res->EVSEMaximumCurrentLimit.Unit = iso1unitSymbolType_A;
+
+    //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
+    res->EVSEMaximumPowerLimit_isUsed = 1u;
+    res->EVSEMaximumPowerLimit.Value = 6000;
+    res->EVSEMaximumPowerLimit.Multiplier = 1;
+    //res->EVSEMaximumPowerLimit.Unit_isUsed = 1u;
+    res->EVSEMaximumPowerLimit.Unit = iso1unitSymbolType_W;
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_iso1_ChargingStatusRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_iso1_ChargingStatusRes()
+{
+    int i = 0;
+	struct iso1ChargingStatusResType *res;
+	init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+	init_iso1ChargingStatusResType(&ccs_exi_doc_ISO1.V2G_Message.Body.ChargingStatusRes);
+
+	res = &ccs_exi_doc_ISO1.V2G_Message.Body.ChargingStatusRes;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ChargingStatusRes_isUsed = 1u;
+
+
+	//----- [BODY (1/10)] ResponseCode -----
+    res->ResponseCode = OK_ISO15118_2014;
+
+    //----- [BODY (2/10)] AC_EVSEStatus -----
+    res->AC_EVSEStatus.RCD = FALSE;     //FALSE(no error), TRUE(error is detected)
+    res->AC_EVSEStatus.NotificationMaxDelay = 0;
+    res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+    //	iso1EVSENotificationType_None = 0,
+    //	iso1EVSENotificationType_StopCharging = 1,
+    //	iso1EVSENotificationType_ReNegotiation = 2
+
+    //----- [BODY (3/10)] EVSEMaxCurrent -----
+	res->EVSEMaxCurrent_isUsed = 1u;
+	res->EVSEMaxCurrent.Value = 32;
+	res->EVSEMaxCurrent.Multiplier = 0;
+	res->EVSEMaxCurrent.Unit = iso1unitSymbolType_A;
+
+    //----- [BODY (4/10)] SAScheduleTupleID -----
+	res->SAScheduleTupleID = 0;
+
+    //----- [BODY (5/10)] EVSEID -----
+    res->EVSEID.charactersLen = 37;
+    memset(res->EVSEID.characters, 0, sizeof(res->EVSEID.characters));
+    //sprintf(res->EVSEID.characters, CCS_AC_EVSEID);
+
+    //----- [BODY (6/10)] MeterInfo -----
+    res->MeterInfo_isUsed = 1u;
+    memset(res->MeterInfo.MeterID.characters, 0, sizeof(res->MeterInfo.MeterID.characters));
+    memset(res->MeterInfo.SigMeterReading.bytes, 0, sizeof(res->MeterInfo.SigMeterReading.bytes));
+
+    //[MeterInfo][1/5] MeterID
+    //sprintf(res->MeterInfo.MeterID , CCS_AC_METER_ID);
+
+    //[MeterInfo][2/5] SigMeterReading (optional)
+    //sprintf(res->MeterInfo.SigMeterReading , CCS_AC_SIG_METER_READING);
+
+    //[MeterInfo][3/5] MeterStatus (optional)
+    res->MeterInfo.MeterStatus = 0;
+
+    //[MeterInfo][4/5] MeterReading (optional)
+    res->MeterInfo.MeterReading = 12345;
+
+    //[MeterInfo][5/5] TMeter (optional)
+    res->MeterInfo.TMeter = 1586243587; //Unix Time Stamp format
+
+
+    //----- [BODY (7/10)] ReceiptRequired -----
+    res->ReceiptRequired_isUsed = 1u;
+    res->ReceiptRequired = FALSE;       //optional
+}
+
+/*===========================================================================
+FUNCTION: Check_EVErrorCode
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Check_EVErrorCode(int code)
+{
+    if (code != NO_ERROR)	//NO_ERROR = 0
+    {
+        //Asking CSU to Stop
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        //Update_V2G_Flow_Status(Other_Fault);
+
+        //memset(buf_log_evcomm, 0, sizeof(buf_log_evcomm));
+        sprintf(buf_log_evcomm,
+                "Stop by EV (EVErrorCode = %d (DEC))",
+                code);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+}
+
+/*===========================================================================
+FUNCTION: Proc_din_CurrentDemandRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_CurrentDemandRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct CurrentDemandResponse_DIN70121 *cur;
+    static struct ChargingInfoData *sys;
+    static int EVSE_max_current;
+    int tmp = 0;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    cur = &ShmCcsData->V2GMessage_DIN70121.CurrentDemandResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    cur->ResponseCode = OK_DIN70121;
+
+    //EVSE Status Code
+    cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        cur->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        cur->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //Check for negative EvBatteryMaxCurrent
+    if (sys->EvBatteryMaxCurrent < 0)
+    {
+        sprintf(buf_log_evcomm,
+                "[ERROR]EvBatteryMaxCurrent is negative(%.02f) => End_Process",
+                sys->EvBatteryMaxCurrent);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+        cur->DC_EVSEStatus.EVSEStatusCode = dinresponseCodeType_FAILED_WrongChargeParameter;    //16
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_WrongChargeParameter (023775)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 5;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_DIN70121(&cur->EVSEPresentCurrent, (int) (sys->PresentChargingCurrent * 10), A_DIN70121);
+    SAVE_PhysicalValueType_DIN70121(&cur->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_DIN70121);
+    #if TESLA_SLOW_INCREASE_CURRENT_FUNCTION == DISABLE
+    SAVE_PhysicalValueType_DIN70121(&cur->EVSEMaximumCurrentLimit, (int) (sys->AvailableChargingCurrent * 10), A_DIN70121);
+    #endif
+    SAVE_PhysicalValueType_DIN70121(&cur->EVSEMaximumPowerLimit, (int) (sys->AvailableChargingPower * 10), W_DIN70121);
+    SAVE_PhysicalValueType_DIN70121(&cur->EVSEMaximumVoltageLimit, (int) (sys->MaximumChargingVoltage * 10), V_DIN70121);
+
+
+    #if PATCH_FOR_BMW_I3_BUG_EVSEMAXIMUMVOLTAGELIMIT_599V == ENABLE
+    if (sys->EvBatteryMaxVoltage <= 500)
+    {
+        SAVE_PhysicalValueType_DIN70121(&cur->EVSEMaximumVoltageLimit, (int) (500 * 10), V_DIN70121);   //500V
+    }
+    #endif
+
+    //Limit the EVTargetCurrent should be under EVSEMaximumCurrentLimit
+    if (sys->EvBatterytargetCurrent > sys->AvailableChargingCurrent)
+    {
+        sys->EvBatterytargetCurrent = sys->AvailableChargingCurrent;
+
+        //[To-Do] Limit is achieved flag
+    }
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid)  //0:invalid (on going)
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid; //0
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        sprintf(buf_log_evcomm, "[Error][Proc_din_CurrentDemandRes]IsolationStatus = %d", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+    }
+    else if (sys->IsolationStatus == GFD_Valid) //1: valid
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;  //1
+    }
+    else if (sys->IsolationStatus == GFD_Warning) //2: warning
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Warning; //2
+    }
+    else if (sys->IsolationStatus == GFD_Fault) //3: fault
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;  //3
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_din_CurrentDemandRes]GFD_Fault => Emergency Shutdown");
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+    else //GFD_No_IMD or other unexpected status
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;  //3
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        sprintf(buf_log_evcomm, "[Error][Proc_din_CurrentDemandRes]IsolationStatus = %d(undefined)", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+
+    //For testing with Tesla Model 3
+    #if TESLA_SLOW_INCREASE_CURRENT_FUNCTION == ENABLE
+    //[CAUTION][To-Do] Decresement of Current is not implemented.
+    //SAVE_PhysicalValueType_DIN70121(&cur->EVSEMaximumCurrentLimit, 10, A_DIN70121);
+    if (sys->EvBatterytargetCurrent <= 0)
+    {
+        EVSE_max_current =  50;   //10A
+        cur->EVSEMaximumCurrentLimit.Value = 50;   //10A
+        /*
+          DEBUG_PRINTF_EVCOMM_DETAIL("1PresentChargingCurrent = %.02f, EvBatterytargetCurrent = %.02f, EVSE_max_current = %d, EVSEMaximumCurrentLimit = %d\n",
+                    sys->PresentChargingCurrent,
+                    sys->EvBatterytargetCurrent,
+                    EVSE_max_current,
+                    cur->EVSEMaximumCurrentLimit.Value
+                );
+        */
+    }
+    else //1A
+    {
+        /*
+    	  DEBUG_PRINTF_EVCOMM_DETAIL("2PresentChargingCurrent = %.02f, EvBatterytargetCurrent = %.02f, EVSE_max_current = %d, EVSEMaximumCurrentLimit = %d\n",
+                    sys->PresentChargingCurrent,
+                    sys->EvBatterytargetCurrent,
+                    EVSE_max_current,
+                    cur->EVSEMaximumCurrentLimit.Value
+                );
+        */
+        if ((abs((int)sys->PresentChargingCurrent - (int)sys->EvBatterytargetCurrent) < 3)&&(abs((int)(EVSE_max_current/10) - (int)sys->EvBatterytargetCurrent) < 3))
+        {
+            tmp = EVSE_max_current + 50; //10A
+
+            if (tmp <= (int)(sys->AvailableChargingCurrent * 10))
+            {
+             cur->EVSEMaximumCurrentLimit.Value = (int)tmp;
+                EVSE_max_current = tmp;
+            }
+            else
+            {
+                cur->EVSEMaximumCurrentLimit.Value = (int) (sys->AvailableChargingCurrent * 10);   //max is set to 40A
+                 EVSE_max_current =  (int) (sys->AvailableChargingCurrent * 10);
+            }
+        }
+    }
+    #endif
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //Check for Alarm Code: CCS GFD trip (012235)
+        if (ShmInternalComm->EVSEStopChargingReq.alarmcode[0] == 0 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[1] == 1 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[2] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[3] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[4] == 3 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[5] == 5)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[DIN][Error][CurrentDemandRes]CCS GFD trip => EVSE_Shutdown");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        }
+        else
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[DIN][Error][CurrentDemandRes]EVSE_Shutdown");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        }
+
+        //cur->ResponseCode = FAILED_DIN70121;
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        //errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //Check for Alarm Code: CCS GFD trip (012235)
+        if (ShmInternalComm->EVSEStopChargingReq.alarmcode[0] == 0 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[1] == 1 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[2] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[3] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[4] == 3 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[5] == 5)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[DIN][Error][CurrentDemandRes]CCS GFD trip => EVSE_EmergencyShutdown");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        }
+        else
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[DIN][Error][CurrentDemandRes]EVSE_EmergencyShutdown");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        }
+
+        //cur->ResponseCode = FAILED_DIN70121;
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        //errn = -1;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[DIN][Error][CurrentDemandRes]Permission OFF");
+        //cur->ResponseCode = FAILED_DIN70121;
+        cur->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        //errn = -1;
+    }
+    else
+    {
+        //null
+    }
+
+    //Response to CP Error
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+    {
+        cur->ResponseCode = FAILED_DIN70121;
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_CP_State_Error (023889)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+
+        sprintf(buf_log_evcomm,
+                "[CurrentDemand]Emergency Stop by CP Error (%d, %.02f V)",
+                sys->CpState,
+                sys->CpVoltage);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    #endif
+
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_CurrentDemandRes(&ccs_exi_doc_DIN, ShmCcsData);
+    #else
+    Sudo_Parameter_din_CurrentDemandRes();
+    #endif
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_CurrentDemandRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_CurrentDemandRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct CurrentDemandResponse_ISO15118_2014 *cur;
+    static struct ChargingInfoData *sys;
+    static int EVSE_max_current;
+    int tmp = 0;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    cur = &ShmCcsData->V2GMessage_ISO15118_2014.CurrentDemandResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    cur->ResponseCode = OK_ISO15118_2014;
+    //EVSE Status Code
+    cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        cur->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        cur->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //Check for negative EvBatteryMaxCurrent
+    if (sys->EvBatteryMaxCurrent < 0)
+    {
+        sprintf(buf_log_evcomm,
+                "[ERROR]EvBatteryMaxCurrent is negative(%.02f) => End_Process",
+                sys->EvBatteryMaxCurrent);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+        cur->ResponseCode = iso1responseCodeType_FAILED_WrongChargeParameter;   //16
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_WrongChargeParameter (023775)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 5;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEPresentCurrent, (int) (sys->PresentChargingCurrent * 10), A_ISO15118_2014);
+    SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_ISO15118_2014);
+    #if TESLA_SLOW_INCREASE_CURRENT_FUNCTION == DISABLE
+    SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEMaximumCurrentLimit, (int) (sys->AvailableChargingCurrent * 10), A_ISO15118_2014);
+    #endif
+    SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEMaximumPowerLimit, (int) (sys->AvailableChargingPower * 10), W_ISO15118_2014);
+    SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEMaximumVoltageLimit, (int) (sys->MaximumChargingVoltage * 10), V_ISO15118_2014);
+    #if PATCH_FOR_BMW_I3_BUG_EVSEMAXIMUMVOLTAGELIMIT_599V == ENABLE
+    if (sys->EvBatteryMaxVoltage <= 500)
+    {
+        SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEMaximumVoltageLimit, (int) (500 * 10), V_ISO15118_2014);   //500V
+    }
+    #endif
+
+    //Limit the EVTargetCurrent should be under EVSEMaximumCurrentLimit
+    if (sys->EvBatterytargetCurrent > sys->AvailableChargingCurrent)
+    {
+        sys->EvBatterytargetCurrent = sys->AvailableChargingCurrent;
+        //[To-Do] Limit is achieved flag
+    }
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid) //0: invalid (on going)
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Invalid; //0
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        sprintf(buf_log_evcomm, "[Error][Proc_iso1_CurrentDemandRes]IsolationStatus = %d", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+    else if (sys->IsolationStatus == GFD_Valid) //1: valid
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1
+    }
+    else if (sys->IsolationStatus == GFD_Warning) //2: warning
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Warning; //2
+    }
+    else if (sys->IsolationStatus == GFD_Fault) //3: fault
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;  //3
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_iso1_CurrentDemandRes]GFD_Fault => EmergencyShutdown");
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+    else
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;  //3
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        sprintf(buf_log_evcomm, "[Error][Proc_iso1_CurrentDemandRes]IsolationStatus = %d(undefined)", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+    //For testing with Tesla Model 3
+    #if TESLA_SLOW_INCREASE_CURRENT_FUNCTION == ENABLE
+    //[CAUTION][To-Do] Decresement of Current is not implemented.
+    //SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEMaximumCurrentLimit, 10, A_ISO15118_2014);
+    if (sys->EvBatterytargetCurrent <= 0)
+    {
+        EVSE_max_current =  50;   //10A
+        cur->EVSEMaximumCurrentLimit.Value = 50;   //10A
+        /*
+          DEBUG_PRINTF_EVCOMM_DETAIL("1PresentChargingCurrent = %.02f, EvBatterytargetCurrent = %.02f, EVSE_max_current = %d, EVSEMaximumCurrentLimit = %d\n",
+                    sys->PresentChargingCurrent,
+                    sys->EvBatterytargetCurrent,
+                    EVSE_max_current,
+                    cur->EVSEMaximumCurrentLimit.Value
+                );
+        */
+    }
+    else //1A
+    {
+        /*
+    	  DEBUG_PRINTF_EVCOMM_DETAIL("2PresentChargingCurrent = %.02f, EvBatterytargetCurrent = %.02f, EVSE_max_current = %d, EVSEMaximumCurrentLimit = %d\n",
+                    sys->PresentChargingCurrent,
+                    sys->EvBatterytargetCurrent,
+                    EVSE_max_current,
+                    cur->EVSEMaximumCurrentLimit.Value
+                );
+        */
+        if ((abs((int)sys->PresentChargingCurrent - (int)sys->EvBatterytargetCurrent) < 3)&&(abs((int)(EVSE_max_current/10) - (int)sys->EvBatterytargetCurrent) < 3))
+        {
+            tmp = EVSE_max_current + 50; //10A
+
+            if (tmp <= (int)(sys->AvailableChargingCurrent * 10))
+            {
+             cur->EVSEMaximumCurrentLimit.Value = (int)tmp;
+                EVSE_max_current = tmp;
+            }
+            else
+            {
+                cur->EVSEMaximumCurrentLimit.Value = (int) (sys->AvailableChargingCurrent * 10);   //max is set to 40A
+                 EVSE_max_current =  (int) (sys->AvailableChargingCurrent * 10);
+            }
+        }
+    }
+    #endif
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //Check for Alarm Code: CCS GFD trip (012235)
+        if (ShmInternalComm->EVSEStopChargingReq.alarmcode[0] == 0 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[1] == 1 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[2] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[3] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[4] == 3 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[5] == 5)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][Error][CurrentDemandRes]CCS GFD trip => EVSE_Shutdown");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        }
+        else
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][Error][CurrentDemandRes]EVSE_Shutdown");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        }
+
+        //cur->ResponseCode = FAILED_ISO15118_2014;
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        //errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //Check for Alarm Code: CCS GFD trip (012235)
+        if (ShmInternalComm->EVSEStopChargingReq.alarmcode[0] == 0 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[1] == 1 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[2] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[3] == 2 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[4] == 3 &&
+            ShmInternalComm->EVSEStopChargingReq.alarmcode[5] == 5)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][Error][CurrentDemandRes]CCS GFD trip => EVSE_EmergencyShutdown");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        }
+        else
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][Error][CurrentDemandRes]EVSE_EmergencyShutdown");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        }
+
+        //cur->ResponseCode = FAILED_ISO15118_2014;
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        //errn = -1;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][Error][CurrentDemandRes]Permission OFF");
+        //cur->ResponseCode = FAILED_ISO15118_2014;
+        cur->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        //errn = -1;
+    }
+    else
+    {
+        //null
+    }
+
+    //Response to CP Error
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+    {
+        cur->ResponseCode = FAILED_ISO15118_2014;
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_CP_State_Error (023889)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+
+        sprintf(buf_log_evcomm,
+                "[CurrentDemand]Emergency Stop by CP Error (%d, %.02f V)",
+                sys->CpState,
+                sys->CpVoltage);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    #endif
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_CurrentDemandRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #else
+    Sudo_Parameter_iso1_CurrentDemandRes();
+    #endif
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_ChargingStatusRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_ChargingStatusRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct ChargingStatusResponse_ISO15118_2014 *res;
+    static struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    res = &ShmCcsData->V2GMessage_ISO15118_2014.ChargingStatusResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    //Init
+    res->ResponseCode = OK_ISO15118_2014;
+    res->ReceiptRequired = FALSE;       //optional
+    res->SAScheduleTupleID = 0;
+    res->AC_EVSEStatus.RCD = FALSE;     //FALSE(no error), TRUE(error is detected)
+    res->AC_EVSEStatus.NotificationMaxDelay = 0;
+    res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+    //	iso1EVSENotificationType_None = 0,
+    //	iso1EVSENotificationType_StopCharging = 1,
+    //	iso1EVSENotificationType_ReNegotiation = 2
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //EVSE ID
+    memset(res->EVSEID, 0, sizeof(res->EVSEID));
+    //sprintf(res->EVSEID, CCS_AC_EVSEID);
+
+    //[MeterInfo][0/5] init
+    //memset(res->MeterInfo.MeterID.characters, 0, sizeof(res->MeterInfo.MeterID.characters));
+    //memset(res->MeterInfo.SigMeterReading.bytes, 0, sizeof(res->MeterInfo.SigMeterReading.bytes));
+
+    //[MeterInfo][1/5] MeterID
+    //sprintf(res->MeterInfo.MeterID , CCS_AC_METER_ID);
+
+    //[MeterInfo][2/5] SigMeterReading (optional)
+    //sprintf(res->MeterInfo.SigMeterReading , CCS_AC_SIG_METER_READING);
+
+    //[MeterInfo][3/5] MeterStatus (optional)
+    res->MeterInfo.MeterStatus = 0;
+
+    //[MeterInfo][4/5] MeterReading (optional)
+    res->MeterInfo.MeterReading = 12345;
+
+    //[MeterInfo][5/5] TMeter (optional)
+    res->MeterInfo.TMeter = 1586243587; //Unix Time Stamp format
+
+
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_ISO15118_2014(&res->EVSEMaxCurrent, (int)(sys->AvailableChargingCurrent * 10), A_ISO15118_2014);
+
+    //Isolation Status (RCD)
+    if (sys->IsolationStatus == 0)  //Isolation is invalid
+    {
+        res->AC_EVSEStatus.RCD = TRUE;     //FALSE(no error), TRUE(error is detected)
+        res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        sprintf(buf_log_evcomm, "[ISO1][Error][ChargingStatusRes]IsolationStatus = %d", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+    else if (sys->IsolationStatus == 1) //Isolation is valid
+    {
+        res->AC_EVSEStatus.RCD = FALSE;     //FALSE(no error), TRUE(error is detected)
+        res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+    }
+    else
+    {
+        res->AC_EVSEStatus.RCD = TRUE;     //FALSE(no error), TRUE(error is detected)
+        res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        sprintf(buf_log_evcomm, "[ISO1][Error][ChargingStatusRes]IsolationStatus = %d(undefined)", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        //errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        //errn = -1;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        //errn = -1;
+    }
+
+    //Response to CP Error
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+    {
+        res->ResponseCode = FAILED_ISO15118_2014;
+        res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_CP_State_Error (023889)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+
+        sprintf(buf_log_evcomm,
+                "[ChargingStatus]Emergency Stop by CP Error (%d, %.02f V)",
+                sys->CpState,
+                sys->CpVoltage);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    #endif
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_ChargingStatusRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #else
+    Sudo_Parameter_iso1_ChargingStatusRes();
+    #endif
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_din_CurrentDemandReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_CurrentDemandReq(int AcceptFd)
+{
+    int errn = 0;
+    //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_CurrentDemandReq] Got CurrentDemandReq\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_CurrentDemandReq(&ccs_exi_doc_DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_CurrentDemandReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_DIN70121.CurrentDemandRequest.DC_EVStatus.EVErrorCode);
+
+    errn = Proc_din_CurrentDemandRes(AcceptFd);
+    if (errn == 0)
+    {
+        //Response is sent successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]CurrentDemandRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[DIN][Error][CurrentDemandReq]CurrentDemandRes: fail(%d,DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_CurrentDemandReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_CurrentDemandReq(int AcceptFd)
+{
+    int errn = 0;
+    //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_CurrentDemandReq] Got CurrentDemandReq\n");
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_CurrentDemandReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_CurrentDemandReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_ISO15118_2014.CurrentDemandRequest.DC_EVStatus.EVErrorCode);
+    errn = Proc_iso1_CurrentDemandRes(AcceptFd);
+    if (errn == 0)
+    {
+        //Response is sent successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]CurrentDemandRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[ISO1][Error][CurrentDemandReq]CurrentDemandRes: fail(%d,DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_ChargingStatusReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_ChargingStatusReq(int AcceptFd)
+{
+    int errn = 0;
+    //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ChargingStatusReq] Got ChargingStatusReq\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_ChargingStatusReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_ChargingStatusReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    //no content in ISO1
+
+    errn = Proc_iso1_ChargingStatusRes(AcceptFd);
+    if (errn == 0)
+    {
+        //Response is sent successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]ChargingStatusRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[ISO1][Error][ChargingStatusReq]ChargingStatusRes: fail(%d,DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_din_PowerDeliveryStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_PowerDeliveryStopRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct dinPowerDeliveryResType *res;
+    struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    res = &ccs_exi_doc_DIN.V2G_Message.Body.PowerDeliveryRes;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    res->ResponseCode = OK_DIN70121;
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ShmCcsData->V2GMessage_DIN70121.PowerDeliveryResponse.DC_EVSEStatus.EVSEStatusCode = EVSE_NotReady;
+    SHM_Read_din_PowerDeliveryRes(&ccs_exi_doc_DIN, ShmCcsData);
+    #else
+    Sudo_Parameter_din_PreChargeRes();
+    #endif
+
+    //EVSE Status Code
+    res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_PowerDeliveryStopRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_PowerDeliveryStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_PowerDeliveryStopRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct iso1PowerDeliveryResType *res;
+    struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    res = &ccs_exi_doc_ISO1.V2G_Message.Body.PowerDeliveryRes;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    res->ResponseCode = OK_ISO15118_2014;
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryResponse.DC_EVSEStatus.DC_EVSEStatusCode = EVSE_NotReady;
+    SHM_Read_iso1_PowerDeliveryRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #else
+    Sudo_Parameter_iso1_PreChargeRes();
+    #endif
+
+    //EVSE Status Code
+    res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+    res->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1 /*+++ 20200808, vern, Isolation Status should be valid during 2nd PowerDelivert ---*/
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready; /*+++ 20200808, vern, Isolation Status should be valid during 2nd PowerDelivert ---*/
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready; /*+++ 20200808, vern, Isolation Status should be valid during 2nd PowerDelivert ---*/
+    }
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_PowerDeliveryStopRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_din_PowerDeliveryStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_PowerDeliveryStopReq(int AcceptFd)
+{
+    int errn = 0;
+    //Request CSU to STOP
+    //This should be reponsed as soon as possible once this message is received.
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    EVCOMM_SYS_INFO.EvBatterytargetVoltage = 0;
+    EVCOMM_SYS_INFO.EvBatterytargetCurrent = 0;
+
+    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]PowerDeliveryReq (2nd)\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_PowerDeliveryReq(&ccs_exi_doc_DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_PowerDeliveryReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_DIN70121.PowerDeliveryRequest.DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode);
+
+    //[To-Do] Sending response after the EVSE output voltage decreases to under 60V
+    usleep(1500000);    //1.5 seconds
+    //sleep(1);   //1 second
+
+    errn = Proc_din_PowerDeliveryStopRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]PowerDeliveryRes (2nd)\n");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_din_PowerDeliveryStopReq]Proc_iso1_PowerDeliveryStopRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_PowerDeliveryStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_PowerDeliveryStopReq(int AcceptFd)
+{
+    int errn = 0;
+    //Request CSU to STOP
+    //This should be reponsed as soon as possible once this message is received.
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    EVCOMM_SYS_INFO.EvBatterytargetVoltage = 0;
+    EVCOMM_SYS_INFO.EvBatterytargetCurrent = 0;
+
+    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]PowerDeliveryReq (2nd)\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_PowerDeliveryReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_PowerDeliveryReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode);
+
+    //[To-Do] Sending response after the EVSE output voltage decreases to under 60V
+    usleep(1500000);    //1.5 seconds
+    //sleep(1);   //1 second
+    errn = Proc_iso1_PowerDeliveryStopRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]PowerDeliveryRes (2nd)");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_iso1_PowerDeliveryStopReq]Proc_iso1_PowerDeliveryStopRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Init_din_WeldingDetectionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+    1. shm_ccs
+
+OUTPUT:
+    1. shm_ccs
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Init_din_WeldingDetectionRes(struct CcsData *shm_ccs)
+{
+	struct WeldingDetectionResponse_DIN70121 *in;
+
+	in = &shm_ccs->V2GMessage_DIN70121.WeldingDetectionResponse;
+
+
+	//----- [BODY (1/3)] ResponseCode -----
+    in->ResponseCode = dinresponseCodeType_OK;
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+    short value = 0; int multiplier = 0; unsigned char unit = 0;
+
+    //value = 3820; multiplier = -1; unit = V_DIN70121;    //382V, for test only.
+    value = 0; multiplier = 0; unit = V_DIN70121;
+	SHM_Save_dinPhysicalValueType(&in->EVSEPresentVoltage, value, multiplier, unit);
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+    SHM_Init_dinDC_EVSEStatusType(&in->DC_EVSEStatus);
+}
+
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_din_WeldingDetectionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_din_WeldingDetectionRes()
+{
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinWeldingDetectionResType(&ccs_exi_doc_DIN.V2G_Message.Body.WeldingDetectionRes);
+
+    ccs_exi_doc_DIN.V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct dinWeldingDetectionResType *res;
+    res = &ccs_exi_doc_DIN.V2G_Message.Body.WeldingDetectionRes;
+    res->ResponseCode = dinresponseCodeType_OK;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+    res->EVSEPresentVoltage.Value = 3820;
+    res->EVSEPresentVoltage.Multiplier = -1;
+    res->EVSEPresentVoltage.Unit_isUsed = 1u;
+    res->EVSEPresentVoltage.Unit = dinunitSymbolType_V;
+    //	dinunitSymbolType_h = 0,
+    //	dinunitSymbolType_m = 1,
+    //	dinunitSymbolType_s = 2,
+    //	dinunitSymbolType_A = 3,
+    //	dinunitSymbolType_Ah = 4,
+    //	dinunitSymbolType_V = 5,
+    //	dinunitSymbolType_VA = 6,
+    //	dinunitSymbolType_W = 7,
+    //	dinunitSymbolType_W_s = 8,
+    //	dinunitSymbolType_Wh = 9
+
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+    res->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;
+    //	dinisolationLevelType_Invalid = 0,
+    //	dinisolationLevelType_Valid = 1,
+    //	dinisolationLevelType_Warning = 2,
+    //	dinisolationLevelType_Fault = 3
+
+    res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+    // dinDC_EVSEStatusCodeType_EVSE_NotReady = 0,
+    // dinDC_EVSEStatusCodeType_EVSE_Ready = 1,
+    // dinDC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+    // dinDC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+    // dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+    // dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+    // dinDC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+    // dinDC_EVSEStatusCodeType_Reserved_8 = 7,
+    // dinDC_EVSEStatusCodeType_Reserved_9 = 8,
+    // dinDC_EVSEStatusCodeType_Reserved_A = 9,
+    // dinDC_EVSEStatusCodeType_Reserved_B = 10,
+    // dinDC_EVSEStatusCodeType_Reserved_C = 11
+
+    res->DC_EVSEStatus.NotificationMaxDelay = 0u;
+
+    res->DC_EVSEStatus.EVSENotification = dinEVSENotificationType_None;
+    // dinEVSENotificationType_None = 0,
+    // dinEVSENotificationType_StopCharging = 1,
+    // dinEVSENotificationType_ReNegotiation = 2
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_iso1_WeldingDetectionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_iso1_WeldingDetectionRes()
+{
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1WeldingDetectionResType(&ccs_exi_doc_ISO1.V2G_Message.Body.WeldingDetectionRes);
+
+    ccs_exi_doc_ISO1.V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct iso1WeldingDetectionResType *res;
+    res = &ccs_exi_doc_ISO1.V2G_Message.Body.WeldingDetectionRes;
+    res->ResponseCode = iso1responseCodeType_OK;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+    res->EVSEPresentVoltage.Value = 3820;
+    res->EVSEPresentVoltage.Multiplier = -1;
+    //res->EVSEPresentVoltage.Unit_isUsed = 1u;
+    res->EVSEPresentVoltage.Unit = iso1unitSymbolType_V;
+    //iso1unitSymbolType_h = 0,
+	//iso1unitSymbolType_m = 1,
+	//iso1unitSymbolType_s = 2,
+	//iso1unitSymbolType_A = 3,
+	//iso1unitSymbolType_V = 4,
+	//iso1unitSymbolType_W = 5,
+	//iso1unitSymbolType_Wh = 6
+
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+    res->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+    res->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;
+    //iso1isolationLevelType_Invalid = 0,
+	//iso1isolationLevelType_Valid = 1,
+	//iso1isolationLevelType_Warning = 2,
+	//iso1isolationLevelType_Fault = 3,
+	//iso1isolationLevelType_No_IMD = 4
+
+    res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+    //iso1DC_EVSEStatusCodeType_EVSE_NotReady = 0,
+	//iso1DC_EVSEStatusCodeType_EVSE_Ready = 1,
+	//iso1DC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+	//iso1DC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+	//iso1DC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+	//iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+	//iso1DC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+	//iso1DC_EVSEStatusCodeType_Reserved_8 = 7,
+	//iso1DC_EVSEStatusCodeType_Reserved_9 = 8,
+	//iso1DC_EVSEStatusCodeType_Reserved_A = 9,
+	//iso1DC_EVSEStatusCodeType_Reserved_B = 10,
+	//iso1DC_EVSEStatusCodeType_Reserved_C = 11
+
+    res->DC_EVSEStatus.NotificationMaxDelay = 0u;
+
+    res->DC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+    //iso1EVSENotificationType_None = 0,
+	//iso1EVSENotificationType_StopCharging = 1,
+	//iso1EVSENotificationType_ReNegotiation = 2
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_WeldingDetectionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_WeldingDetectionRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct WeldingDetectionResponse_DIN70121 *wel;
+    static struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    wel = &ShmCcsData->V2GMessage_DIN70121.WeldingDetectionResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    wel->ResponseCode = OK_DIN70121;
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        wel->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        wel->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_DIN70121(&wel->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_DIN70121);
+
+    //EVSE Status Code
+    wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //wel->ResponseCode = FAILED_DIN70121;
+        wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //wel->ResponseCode = FAILED_DIN70121;
+        wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //wel->ResponseCode = FAILED_DIN70121;
+        wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid)  //0:invalid (on going)
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid; //0
+        wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        sprintf(buf_log_evcomm, "[Error][Proc_din_WeldingDetectionRes]IsolationStatus = %d", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+
+    }
+    else if (sys->IsolationStatus == GFD_Valid) //1: valid
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;  //1
+    }
+    else if (sys->IsolationStatus == GFD_Warning) //2: warning
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Warning; //2
+    }
+    else if (sys->IsolationStatus == GFD_Fault) //3: fault
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;  //3
+        wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_din_WeldingDetectionRes]GFD_Fault => Emergency Shutdown");
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+    else //GFD_No_IMD or other unexpected status
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;  //3
+        wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        sprintf(buf_log_evcomm, "[Error][Proc_din_WeldingDetectionRes]IsolationStatus = %d(undefined)", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_WeldingDetectionRes(&ccs_exi_doc_DIN, ShmCcsData);
+    #else
+    Sudo_Parameter_din_WeldingDetectionRes();
+    #endif
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_WeldingDetectionRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_WeldingDetectionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_WeldingDetectionRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    static struct WeldingDetectionResponse_ISO15118_2014 *wel;
+    static struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    wel = &ShmCcsData->V2GMessage_ISO15118_2014.WeldingDetectionResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    wel->ResponseCode = OK_ISO15118_2014;
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        wel->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        wel->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_ISO15118_2014(&wel->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_ISO15118_2014);
+
+    //EVSE Status Code
+    wel->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //wel->ResponseCode = FAILED_ISO15118_2014;
+        wel->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //wel->ResponseCode = FAILED_ISO15118_2014;
+        wel->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //wel->ResponseCode = FAILED_ISO15118_2014;
+        wel->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+    }
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid) //0: invalid (on going)
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Invalid; //0
+        wel->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        sprintf(buf_log_evcomm, "[Error][Proc_iso1_WeldingDetectionRes]IsolationStatus = %d", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+    else if (sys->IsolationStatus == GFD_Valid) //1: valid
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1
+    }
+    else if (sys->IsolationStatus == GFD_Warning) //2: warning
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Warning; //2
+    }
+    else if (sys->IsolationStatus == GFD_Fault) //3: fault
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;  //3
+        wel->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        SAVE_SYS_LOG_MSG_EVCOMM("[Error][Proc_iso1_WeldingDetectionRes]GFD_Fault => EmergencyShutdown");
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+    else
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;  //3
+        wel->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        sprintf(buf_log_evcomm, "[Error][Proc_iso1_WeldingDetectionRes]IsolationStatus = %d(undefined)", sys->IsolationStatus);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_WeldingDetectionRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #else
+    Sudo_Parameter_iso1_WeldingDetectionRes();
+    #endif
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_WeldingDetectionRes][Error]Tx encoded msg error");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_WeldingDetectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_WeldingDetectionReq(int AcceptFd)
+{
+    int errn = 0;
+    //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_din_WeldingDetectionReq] Got WeldingDetectionReq\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_WeldingDetectionReq(&ccs_exi_doc_DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_WeldingDetectionReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_DIN70121.WeldingDetectionRequest.DC_EVStatus.EVErrorCode);
+
+    errn = Proc_din_WeldingDetectionRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[DIN][V2G][Tx]WeldingDetectionRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_din_WeldingDetectionReq]Proc_din_WeldingDetectionRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_WeldingDetectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_WeldingDetectionReq(int AcceptFd)
+{
+    int errn = 0;
+    //SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_WeldingDetectionReq] Got WeldingDetectionReq\n");
+
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_WeldingDetectionReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_WeldingDetectionReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_ISO15118_2014.WeldingDetectionRequest.DC_EVStatus.EVErrorCode);
+
+    errn = Proc_iso1_WeldingDetectionRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        //SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]WeldingDetectionRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_iso1_WeldingDetectionReq]Proc_iso1_WeldingDetectionRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Init_din_SessionStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+    1. shm_ccs
+
+OUTPUT:
+    1. shm_ccs
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Init_din_SessionStopRes(struct CcsData *shm_ccs)
+{
+	struct SessionStopResponse_DIN70121 *in;
+
+	in = &shm_ccs->V2GMessage_DIN70121.SessionStopResponse;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    in->ResponseCode = dinresponseCodeType_OK;
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_din_SessionStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_din_SessionStopRes()
+{
+    init_dinBodyType(&ccs_exi_doc_DIN.V2G_Message.Body);
+    init_dinSessionStopResType(&ccs_exi_doc_DIN.V2G_Message.Body.SessionStopRes);
+
+    ccs_exi_doc_DIN.V2G_Message.Body.SessionStopRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct dinSessionStopResType *res;
+    res = &ccs_exi_doc_DIN.V2G_Message.Body.SessionStopRes;
+    res->ResponseCode = dinresponseCodeType_OK;
+}
+
+/*===========================================================================
+FUNCTION: Sudo_Parameter_iso1_SessionStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Sudo_Parameter_iso1_SessionStopRes()
+{
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1SessionStopResType(&ccs_exi_doc_ISO1.V2G_Message.Body.SessionStopRes);
+
+    ccs_exi_doc_ISO1.V2G_Message.Body.SessionStopRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct iso1SessionStopResType *res;
+    res = &ccs_exi_doc_ISO1.V2G_Message.Body.SessionStopRes;
+    res->ResponseCode = iso1responseCodeType_OK;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_SessionStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_SessionStopRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct SessionStopResponse_DIN70121 *stp;
+    struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    stp = &ShmCcsData->V2GMessage_DIN70121.SessionStopResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    stp->ResponseCode = OK_DIN70121;
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&ccs_exi_doc_DIN) < 0)
+    {
+        stp->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        stp->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_SessionStopRes(&ccs_exi_doc_DIN, ShmCcsData);
+    #else
+    Sudo_Parameter_din_SessionStopRes();
+    #endif
+
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_DIN) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Tx]SessionStopRes: fail");
+        errn = -1;
+    }
+    else 
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Tx]SessionStopRes");
+    }
+
+
+    //STEP 5: ============ Update Flags ===========
+    EVCOMM_SYS_INFO.ConnectorLocked = FALSE;   //Indicating CSU that the Connector is unlocked.
+                                               //Once this is set, the CSU should
+
+    // =========== Annouce to CSU [To-Be Implemented]=============
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;    //This should be also added to EV Error events.
+
+
+    // =========== Re-initialized [To-Be Implemented]=============
+    //Keep 5% PWM for 2 seconds
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 5\% countdown: 2");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 5\% countdown: 1");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 5\% countdown: 0");
+    OutputCpPwmDuty(100);
+
+    //[To-Do] Reset All Share memory
+
+    //[To-Do] CCS Module enter "idle" mode and CSU should check for this state.
+
+    //system("reboot -f");
+    //sleep(5);
+    //system("reboot -f");
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_iso1_SessionStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_SessionStopRes(int AcceptFd)
+{
+    //[Joseph, To-Do] Check SessionID of ServiceDiscoveryReq,
+    //if it is not the same, the packet should be ignored.
+
+    //STEP 1: ============ Initialize ============
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct SessionStopResponse_ISO15118_2014 *stp;
+    struct ChargingInfoData *sys;
+
+    size_t pos = 0;
+    v2g_tx_stream.pos = &pos;
+    v2g_tx_stream.size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+    v2g_tx_stream.data = V2GTP_Tx_buf;
+    stp = &ShmCcsData->V2GMessage_ISO15118_2014.SessionStopResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    stp->ResponseCode = OK_ISO15118_2014;
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&ccs_exi_doc_ISO1) < 0)
+    {
+        stp->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]unmatched SessionID => End_Process");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        stp->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        SAVE_SYS_LOG_MSG_EVCOMM("[ERROR]SequenceError => End_Process");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_SessionStopRes(&ccs_exi_doc_ISO1, ShmCcsData);
+    #else
+    Sudo_Parameter_iso1_SessionStopRes();
+    #endif
+
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &ccs_exi_doc_ISO1) != 0)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Tx]SessionStopRes: fail");
+        errn = -1;
+    }
+    else 
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Tx]SessionStopRes");
+    }
+
+    //STEP 5: ============ Update Flags ===========
+    EVCOMM_SYS_INFO.ConnectorLocked = FALSE;   //Indicating CSU that the Connector is unlocked.
+                                               //Once this is set, the CSU should
+
+    // =========== Annouce to CSU [To-Be Implemented]=============
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;    //This should be also added to EV Error events.
+
+
+    // =========== Re-initialized [To-Be Implemented]=============
+    //Keep 5% PWM for 2 seconds
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 5\% countdown: 2");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 5\% countdown: 1");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 5\% countdown: 0");
+    OutputCpPwmDuty(100);
+
+    //[To-Do] Reset All Share memory
+
+    //[To-Do] CCS Module enter "idle" mode and CSU should check for this state.
+
+    //system("reboot -f");
+    //sleep(5);
+    //system("reboot -f");
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_din_SessionStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_din_SessionStopReq(int AcceptFd)
+{
+    int errn = 0;
+    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]SessionStopReq");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_SessionStopReq(&ccs_exi_doc_DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_SessionStopReq(ShmCcsData, &ccs_exi_doc_DIN, ShmSysConfigAndInfo);
+
+    errn = Proc_din_SessionStopRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_din_SessionStopReq]Proc_iso1_SessionStopRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_SessionStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_SessionStopReq(int AcceptFd)
+{
+    int errn = 0;
+    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]SessionStopReq");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_SessionStopReq(&ccs_exi_doc_ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_SessionStopReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_SessionStopRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_iso1_SessionStopReq]Proc_iso1_SessionStopRes(): %d (DEC)",
+                errn);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: V2gMsg_Process_din
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+        1. V2gFlowStatus
+OUTPUT:
+GLOBAL VARIABLES:
+        1. V2gFlowStatus
+=============================================================================*/
+int V2gMsg_Process_din(int AcceptFd)
+{
+    unsigned char req_is_responsed = FALSE;
+    while (req_is_responsed == FALSE)
+    {
+        //Check if it is in End_Process
+        if (EVCOMM_SYS_INFO.End_Process_inused == TRUE)
+        {
+            break;
+        }
+
+        switch(V2gFlowStatus)
+        {
+            //-------------------------------------------
+            case SupportedAppProtocolRequest:
+            {
+                if (ccs_handshake.supportedAppProtocolReq_isUsed == 1u)
+                {
+                    ccs_handshake.supportedAppProtocolReq_isUsed = 0;
+                    if (Proc_supportedAppProtocolReq(AcceptFd) == 0)   //0: no error
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                        Update_V2G_Flow_Status(SupportedAppProtocolResponse);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]supportedAppProtocolResReq: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SupportedAppProtocolResponse:
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionSetupRequest)
+                {
+                    Update_V2G_Flow_Status(SessionSetupRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case SessionSetupRequest:               //19
+            {
+                if (Proc_din_SessionSetupReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(SessionSetupResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionSetupReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionSetupResponse:              //20
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceDiscoveryRequest)
+                {
+                    Update_V2G_Flow_Status(ServiceDiscoveryRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ServiceDiscoveryRequest:           //21
+            {
+                if (Proc_din_ServiceDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ServiceDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ServiceDiscoveryReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceDiscoveryResponse:          //22
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceAndPaymentSelectionRequest)
+                {
+                    Update_V2G_Flow_Status(ServiceAndPaymentSelectionRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ServiceAndPaymentSelectionRequest:     //25
+            {
+                if (Proc_din_ServiceAndPaymentSelectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ServiceAndPaymentSelectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ServiceAndPaymentSelectionReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceAndPaymentSelectionResponse:    //26
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    Update_V2G_Flow_Status(AuthorizationRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            //case ContractAuthenticationReq:
+            case AuthorizationRequest:              //29
+            {
+                if (Proc_din_ContractAuthenticationReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(AuthorizationResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]AuthorizationReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case AuthorizationResponse:             //30
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_din_ContractAuthenticationReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]AuthorizationReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //Check for ChargeParameterDiscoveryReq
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(ChargeParameterDiscoveryRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]ChargeParameterDiscoveryReq: CSU Permission?");
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ChargeParameterDiscoveryRequest:   //35
+            {
+                if (Proc_din_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ChargeParameterDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ChargeParameterDiscoveryReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ChargeParameterDiscoveryResponse:
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_ChargingParameter_Performance_Time)  //60 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "ChargingParameter Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_ChargingParameter_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+                }
+                #endif
+
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_din_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]ChargeParameterDiscoveryReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 2: Check for CableCheckReq message
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CableCheckRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]CableCheckReqReq: isolated?");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_Start);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_End);
+
+                    Update_V2G_Flow_Status(CableCheckRequest);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                //STEP 3: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStop);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //ftime(&EVCOMM_SYS_INFO.V2G_SECC_ChargeParameterDiscovery_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+
+                    if (Proc_din_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case CableCheckRequest:                 //37
+            {
+                //STEP 3: Execute Cable Check Process
+                if (Proc_din_CableCheckReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(CableCheckResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]CableCheckReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case CableCheckResponse:                //38
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_CableCheck_Performance_Time)  //38 seconds
+                {
+                    //SAVE_SYS_LOG_MSG_EVCOMM("[CableCheck] end counting...");
+                    sprintf(buf_log_evcomm,
+                            "CableCheck Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_CableCheck_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+
+                    //Update_ShmStatusCode(); //[To-Do] to be implemented
+                    //CCS_SECC_TIMEOUT_V2G_CableCheck_Performance_Time (023847)
+                    ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                    ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                    ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                    ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+                    ShmStatusCodeData->PresentStatusCode[0][5] = 7;
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for CableCheckReq message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CableCheckRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //STEP 3: Execute Cable Check Process
+                    if (Proc_din_CableCheckReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]CableCheckReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 3: Check for PreChargeReq message
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == PreChargeRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(PreChargeRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]PreChargeReqReq: waiting for precharge voltage...");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_End);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Precharge_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                //STEP 3: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStop);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //ftime(&EVCOMM_SYS_INFO.V2G_SECC_ChargeParameterDiscovery_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+
+                    if (Proc_din_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PreChargeRequest:                  //39
+            {
+                if (Proc_din_PreChargeReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PreChargeResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PreChargeReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PreChargeResponse:                 //40
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_PreCharge_Performance_Time)  //5 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "Precharge Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_PreCharge_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+
+                    //Update_ShmStatusCode(); //[To-Do] to be implemented
+                    //CCS_SECC_TIMEOUT_V2G_PreCharge_Performace_Time (023850)
+                    ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                    ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                    ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                    ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+                    ShmStatusCodeData->PresentStatusCode[0][5] = 0;
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for PreChargeReq message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == PreChargeRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_din_PreChargeReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]PreChargeReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+
+                //STEP 3: Check for PowerDeliveryReq message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStart);
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Precharge_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStart:         //41
+            {
+                if (Proc_din_PowerDeliveryStartReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryResponsetStart);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStartReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponsetStart:        //42
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                if (ccs_exi_doc_DIN.V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+                {
+                    ftime(&SeqEndTime);
+                    if(DiffTimeb(SeqStartTime, SeqEndTime) > 2000)  //5 seconds
+                    {
+                        sprintf(buf_log_evcomm,
+                                "Wait for CurrentDemandReq Timeout - (%.02lf of %d ms)\n",
+                                DiffTimeb(SeqStartTime, SeqEndTime),
+                                2000);
+                        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                        Update_V2G_Flow_Status(Sequence_Timeout);
+                    }
+                    break;
+                }
+                #endif
+
+                //STEP 2: Wait for CurrentDemandReq Message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CurrentDemandRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(CurrentDemandRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]CurrentDemandReqReq: energy transfering...");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CurrentDemand_Timer_Start);
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case CurrentDemandRequest:              //45,
+            {
+                if (Proc_din_CurrentDemandReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(CurrentDemandResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]CurrentDemandReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case CurrentDemandResponse:             //46,
+            {
+                //STEP 1: Wait for CurrentDemandReq Message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CurrentDemandRequest)
+                {
+                   EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    if (Proc_din_CurrentDemandReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]CurrentDemandReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+
+                //STEP 2: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStop);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CurrentDemand_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStop:          //49,
+            {
+                if (Proc_din_PowerDeliveryStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponseStop:        //50,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > 2000)  //2 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "Wait for WeldingDetectionReq or SessionStopReq Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            2000);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for WeldingDetectionReq Message
+                if(EVCOMM_SYS_INFO.V2G_Rx_Msg == WeldingDetectionRequest)
+                {
+                   EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(WeldingDetectionRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]WeldingDetectionReq: ongoing...");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_WeldingDetection_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_Flow_Status(SessionStopRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_din_SessionStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Flow_Status(SessionStopResponse);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionStopReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case WeldingDetectionRequest:           //51,
+            {
+                if (Proc_din_WeldingDetectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(WeldingDetectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]WeldingDetectionReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case WeldingDetectionResponse:          //52,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_WeldingDetection_Performance_Time)  //20 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "Wait for SessionStopReq Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_WeldingDetection_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for WeldingDetectionReq Message
+                if(EVCOMM_SYS_INFO.V2G_Rx_Msg == WeldingDetectionRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    if (Proc_din_WeldingDetectionReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]WeldingDetectionReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 3: Check for SessionStopReq Message
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_Flow_Status(SessionStopRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_WeldingDetection_Timer_End);
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case SessionStopRequest:                //53,
+            {
+                if (Proc_din_SessionStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(SessionStopResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionStopReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                //break;
+            }
+            case SessionStopResponse:               //54,
+            {
+                break;
+            }
+            //-------------------------------------------
+            default:
+            {
+                break;
+            }
+        }
+    }
+
+}
+
+/*===========================================================================
+FUNCTION: V2gMsg_Process_iso1_DC
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+        1. V2gFlowStatus
+OUTPUT:
+GLOBAL VARIABLES:
+        1. V2gFlowStatus
+=============================================================================*/
+int V2gMsg_Process_iso1_DC(int AcceptFd)
+{
+    unsigned char req_is_responsed = FALSE;
+    while (req_is_responsed == FALSE)
+    {
+        //Check if it is in End_Process
+        if (EVCOMM_SYS_INFO.End_Process_inused == TRUE)
+        {
+            break;
+        }
+
+        switch(V2gFlowStatus)
+        {
+            //-------------------------------------------
+            case SupportedAppProtocolRequest:
+            {
+                if (ccs_handshake.supportedAppProtocolReq_isUsed == 1u)
+                {
+                    ccs_handshake.supportedAppProtocolReq_isUsed = 0;
+                    if (Proc_supportedAppProtocolReq(AcceptFd) == 0)   //0: no error
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                        Update_V2G_Flow_Status(SupportedAppProtocolResponse);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]supportedAppProtocolResReq: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SupportedAppProtocolResponse:
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionSetupRequest)
+                {
+                    Update_V2G_Flow_Status(SessionSetupRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case SessionSetupRequest:               //19
+            {
+                if (Proc_iso1_SessionSetupReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(SessionSetupResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionSetupReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionSetupResponse:              //20
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceDiscoveryRequest)
+                {
+                    Update_V2G_Flow_Status(ServiceDiscoveryRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ServiceDiscoveryRequest:           //21
+            {
+                if (Proc_iso1_ServiceDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ServiceDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ServiceDiscoveryReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceDiscoveryResponse:          //22
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceAndPaymentSelectionRequest)
+                {
+                    Update_V2G_Flow_Status(ServiceAndPaymentSelectionRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ServiceAndPaymentSelectionRequest:     //25
+            {
+                if (Proc_iso1_ServiceAndPaymentSelectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ServiceAndPaymentSelectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ServiceAndPaymentSelectionReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceAndPaymentSelectionResponse:    //26
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    Update_V2G_Flow_Status(AuthorizationRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            //case ContractAuthenticationReq:
+            case AuthorizationRequest:              //29
+            {
+                if (Proc_iso1_AuthenticationReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(AuthorizationResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]AuthorizationReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case AuthorizationResponse:             //30
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso1_AuthenticationReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]AuthorizationReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //Check for ChargeParameterDiscoveryReq
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(ChargeParameterDiscoveryRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]ChargeParameterDiscoveryReq: CSU Permission?");
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ChargeParameterDiscoveryRequest:   //35
+            {
+                if (Proc_iso1_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ChargeParameterDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ChargeParameterDiscoveryReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ChargeParameterDiscoveryResponse:
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_ChargingParameter_Performance_Time)  //60 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "ChargingParameter Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_ChargingParameter_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+                }
+                #endif
+
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso1_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]ChargeParameterDiscoveryReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 2: Check for CableCheckReq message
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CableCheckRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]CableCheckReqReq: isolated?");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_Start);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_End);
+
+                    Update_V2G_Flow_Status(CableCheckRequest);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                //STEP 3: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStop);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //ftime(&EVCOMM_SYS_INFO.V2G_SECC_ChargeParameterDiscovery_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+
+                    if (Proc_iso1_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case CableCheckRequest:                 //37
+            {
+                //STEP 3: Execute Cable Check Process
+                if (Proc_iso1_CableCheckReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(CableCheckResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]CableCheckReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case CableCheckResponse:                //38
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_CableCheck_Performance_Time)  //38 seconds
+                {
+                    //SAVE_SYS_LOG_MSG_EVCOMM("[CableCheck] end counting...");
+                    sprintf(buf_log_evcomm,
+                            "CableCheck Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_CableCheck_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+
+                    //Update_ShmStatusCode(); //[To-Do] to be implemented
+                    //CCS_SECC_TIMEOUT_V2G_CableCheck_Performance_Time (023847)
+                    ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                    ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                    ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                    ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+                    ShmStatusCodeData->PresentStatusCode[0][5] = 7;
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for CableCheckReq message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CableCheckRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //STEP 3: Execute Cable Check Process
+                    if (Proc_iso1_CableCheckReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]CableCheckReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 3: Check for PreChargeReq message
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == PreChargeRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(PreChargeRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]PreChargeReqReq: waiting for precharge voltage...");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_End);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Precharge_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                //STEP 3: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStop);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //ftime(&EVCOMM_SYS_INFO.V2G_SECC_ChargeParameterDiscovery_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+
+                    if (Proc_iso1_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PreChargeRequest:                  //39
+            {
+                if (Proc_iso1_PreChargeReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PreChargeResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PreChargeReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PreChargeResponse:                 //40
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_PreCharge_Performance_Time)  //5 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "Precharge Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_PreCharge_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+
+                    //Update_ShmStatusCode(); //[To-Do] to be implemented
+                    //CCS_SECC_TIMEOUT_V2G_PreCharge_Performace_Time (023850)
+                    ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                    ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                    ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                    ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+                    ShmStatusCodeData->PresentStatusCode[0][5] = 0;
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for PreChargeReq message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == PreChargeRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso1_PreChargeReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]PreChargeReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 3: Check for PowerDeliveryReq message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStart);
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Precharge_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStart:         //41
+            {
+                if (Proc_iso1_PowerDeliveryStartReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryResponsetStart);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStartReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponsetStart:        //42
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                if (ccs_exi_doc_ISO1.V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+                {
+                    ftime(&SeqEndTime);
+                    if(DiffTimeb(SeqStartTime, SeqEndTime) > 2000)  //5 seconds
+                    {
+                        sprintf(buf_log_evcomm,
+                                "Wait for CurrentDemandReq Timeout - (%.02lf of %d ms)\n",
+                                DiffTimeb(SeqStartTime, SeqEndTime),
+                                2000);
+                        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                        Update_V2G_Flow_Status(Sequence_Timeout);
+                    }
+                    break;
+                }
+                #endif
+
+                //STEP 2: Wait for CurrentDemandReq Message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CurrentDemandRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(CurrentDemandRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]CurrentDemandReqReq: energy transfering...");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CurrentDemand_Timer_Start);
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case CurrentDemandRequest:              //45,
+            {
+                if (Proc_iso1_CurrentDemandReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(CurrentDemandResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]CurrentDemandReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case CurrentDemandResponse:             //46,
+            {
+                //STEP 1: Wait for CurrentDemandReq Message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CurrentDemandRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    if (Proc_iso1_CurrentDemandReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]CurrentDemandReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 2: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStop);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CurrentDemand_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStop:          //49,
+            {
+                if (Proc_iso1_PowerDeliveryStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponseStop:        //50,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > 2000)  //2 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "Wait for WeldingDetectionReq or SessionStopReq Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            2000);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for WeldingDetectionReq Message
+                if(EVCOMM_SYS_INFO.V2G_Rx_Msg == WeldingDetectionRequest)
+                {
+                   EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(WeldingDetectionRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]WeldingDetectionReq: ongoing...");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_WeldingDetection_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_Flow_Status(SessionStopRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso1_SessionStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Flow_Status(SessionStopResponse);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionStopReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case WeldingDetectionRequest:           //51,
+            {
+                if (Proc_iso1_WeldingDetectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(WeldingDetectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]WeldingDetectionReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case WeldingDetectionResponse:          //52,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_WeldingDetection_Performance_Time)  //20 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "Wait for SessionStopReq Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_WeldingDetection_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for WeldingDetectionReq Message
+                if(EVCOMM_SYS_INFO.V2G_Rx_Msg == WeldingDetectionRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    if (Proc_iso1_WeldingDetectionReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]WeldingDetectionReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 3: Check for SessionStopReq Message
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_Flow_Status(SessionStopRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_WeldingDetection_Timer_End);
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case SessionStopRequest:                //53,
+            {
+                if (Proc_iso1_SessionStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(SessionStopResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionStopReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                //break;
+            }
+            case SessionStopResponse:               //54,
+            {
+                break;
+            }
+            //-------------------------------------------
+            default:
+            {
+                break;
+            }
+        }
+    }
+}
+
+
+/*===========================================================================
+FUNCTION: V2gMsg_Process_iso1_AC
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+        1. V2gFlowStatus
+OUTPUT:
+GLOBAL VARIABLES:
+        1. V2gFlowStatus
+=============================================================================*/
+int V2gMsg_Process_iso1_AC(int AcceptFd)
+{
+    unsigned char req_is_responsed = FALSE;
+    while (req_is_responsed == FALSE)
+    {
+        //Check if it is in End_Process
+        if (EVCOMM_SYS_INFO.End_Process_inused == TRUE)
+        {
+            break;
+        }
+
+        switch(V2gFlowStatus)
+        {
+            //-------------------------------------------
+            case SupportedAppProtocolRequest:       //17
+            {
+                if (ccs_handshake.supportedAppProtocolReq_isUsed == 1u)
+                {
+                    ccs_handshake.supportedAppProtocolReq_isUsed = 0;
+                    if (Proc_supportedAppProtocolReq(AcceptFd) == 0)   //0: no error
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                        Update_V2G_Flow_Status(SupportedAppProtocolResponse);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]supportedAppProtocolResReq: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SupportedAppProtocolResponse:      //18
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionSetupRequest)
+                {
+                    Update_V2G_Flow_Status(SessionSetupRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case SessionSetupRequest:               //19
+            {
+                if (Proc_iso1_SessionSetupReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(SessionSetupResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionSetupReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionSetupResponse:              //20
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceDiscoveryRequest)
+                {
+                    Update_V2G_Flow_Status(ServiceDiscoveryRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ServiceDiscoveryRequest:           //21
+            {
+                if (Proc_iso1_ServiceDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ServiceDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ServiceDiscoveryReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceDiscoveryResponse:          //22
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceAndPaymentSelectionRequest)
+                {
+                    Update_V2G_Flow_Status(ServiceAndPaymentSelectionRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ServiceAndPaymentSelectionRequest: //25
+            {
+                if (Proc_iso1_ServiceAndPaymentSelectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ServiceAndPaymentSelectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ServiceAndPaymentSelectionReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceAndPaymentSelectionResponse://26
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    Update_V2G_Flow_Status(AuthorizationRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            //case ContractAuthenticationReq:
+            case AuthorizationRequest:              //29
+            {
+                if (Proc_iso1_AuthenticationReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(AuthorizationResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]AuthorizationReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                break;
+            }
+            case AuthorizationResponse:             //30
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso1_AuthenticationReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]AuthorizationReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //Check for ChargeParameterDiscoveryReq
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(ChargeParameterDiscoveryRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]ChargeParameterDiscoveryReq: CSU Permission?");
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ChargeParameterDiscoveryRequest:   //35
+            {
+                if (Proc_iso1_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ChargeParameterDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ChargeParameterDiscoveryReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ChargeParameterDiscoveryResponse:  //36
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+    	        ftime(&SeqEndTime);
+    	        if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_ChargingParameter_Performance_Time)  //60 seconds
+    	        {
+    	            sprintf(buf_log_evcomm,
+                            "ChargingParameter Timeout - (%.02lf of %d ms)\n",
+    	                    DiffTimeb(SeqStartTime, SeqEndTime),
+    	                    V2G_SECC_ChargingParameter_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    	            Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+    	        }
+                #endif
+
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso1_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]ChargeParameterDiscoveryReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+
+                //STEP 3: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStart);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //ftime(&EVCOMM_SYS_INFO.V2G_SECC_ChargeParameterDiscovery_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+
+                    if (Proc_iso1_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+    		#if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                    break;
+                }
+    	    else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStart:         //41
+            {
+                if (Proc_iso1_PowerDeliveryStartReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryResponsetStart);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStartReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponsetStart:       //42
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                if (ccs_exi_doc_ISO1.V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+                {
+                    ftime(&SeqEndTime);
+                    if(DiffTimeb(SeqStartTime, SeqEndTime) > 2000)  //5 seconds
+                    {
+                        sprintf(buf_log_evcomm,
+                                "Wait for ChargingStatusReq Timeout - (%.02lf of %d ms)\n",
+                                DiffTimeb(SeqStartTime, SeqEndTime),
+                                2000);
+                        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                        Update_V2G_Flow_Status(Sequence_Timeout);
+                    }
+                    break;
+                }
+                #endif
+
+                //STEP 2: Wait for ChargingStatusReq Message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargingStatusRequest)
+                {
+    	            EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(ChargingStatusRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]ChargingStatusReq: energy transfering...");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_ChargingStatus_Timer_Start);
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ChargingStatusRequest:             //43
+            {
+                if (Proc_iso1_ChargingStatusReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ChargingStatusResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ChargingStatusRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ChargingStatusResponse:            //44
+            {
+                //STEP 1: Wait for ChargingStatusReq Message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargingStatusRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    if (Proc_iso1_ChargingStatusReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]ChargingStatusRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 2: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStop);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_ChargingStatus_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStop:          //49
+            {
+                if (Proc_iso1_PowerDeliveryStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponseStop:         //50
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > 2000)  //2 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "Wait for SessionStopReq Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            2000);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+                }
+                #endif
+
+                //STEP 3: Check for SessionStopReq Message
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_Flow_Status(SessionStopRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case SessionStopRequest:                //53
+            {
+                if (Proc_iso1_SessionStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(SessionStopResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionStopReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                //break;
+            }
+            case SessionStopResponse:               //54
+            {
+                break;
+            }
+            //-------------------------------------------
+            default:
+            {
+                break;
+            }
+        }
+    }
+
+}
+
+
+/*===========================================================================
+FUNCTION: V2gMsg_Process_iso1
+DESCRIPTION:
+    1. EnergyTransferMode:
+        AC_single_phase_core =  0,
+        AC_three_phase_core =   1,
+        DC_core =               2,
+        DC_extended =           3,
+        DC_combo_core =         4,
+        DC_unique =             5
+
+        iso1EnergyTransferModeType_AC_single_phase_core = 0,
+    	iso1EnergyTransferModeType_AC_three_phase_core = 1,
+    	iso1EnergyTransferModeType_DC_core = 2,
+    	iso1EnergyTransferModeType_DC_extended = 3,
+    	iso1EnergyTransferModeType_DC_combo_core = 4,
+    	iso1EnergyTransferModeType_DC_unique = 5
+PRE-CONDITION:
+INPUT:
+        1. V2gFlowStatus
+OUTPUT:
+GLOBAL VARIABLES:
+        1. V2gFlowStatus
+=============================================================================*/
+int V2gMsg_Process_iso1(int AcceptFd, unsigned char EnergyTransferMode)
+{
+    switch (EnergyTransferMode)
+    {
+        case DC_extended:
+        {
+            V2gMsg_Process_iso1_DC(AcceptFd);
+            break;
+        }
+
+        case AC_single_phase_core:
+        case AC_three_phase_core:
+        {
+            V2gMsg_Process_iso1_AC(AcceptFd);
+            break;
+        }
+
+        default:
+        {
+            sprintf(buf_log_evcomm,
+                    "[ISO1][Warning]Unexpected EnergyTransferMode(%d)",
+                    EnergyTransferMode);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            break;
+        }
+    }
+}
+
+/*===========================================================================
+FUNCTION: V2gMsg_Process_iso2_DC
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+        1. V2gFlowStatus
+OUTPUT:
+GLOBAL VARIABLES:
+        1. V2gFlowStatus
+=============================================================================*/
+int V2gMsg_Process_iso2_DC(int AcceptFd)
+{
+    unsigned char req_is_responsed = FALSE;
+    while (req_is_responsed == FALSE)
+    {
+        //Check if it is in End_Process
+        if (EVCOMM_SYS_INFO.End_Process_inused == TRUE)
+        {
+            break;
+        }
+
+        switch(V2gFlowStatus)
+        {
+            //-------------------------------------------
+            case SupportedAppProtocolRequest:
+            {
+                if (ccs_handshake.supportedAppProtocolReq_isUsed == 1u)
+                {
+                    ccs_handshake.supportedAppProtocolReq_isUsed = 0;
+                    if (Proc_supportedAppProtocolReq(AcceptFd) == 0)   //0: no error
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                        Update_V2G_Flow_Status(SupportedAppProtocolResponse);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]supportedAppProtocolResReq: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SupportedAppProtocolResponse:
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionSetupRequest)
+                {
+                    Update_V2G_Flow_Status(SessionSetupRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case SessionSetupRequest:               //19
+            {
+                if (Proc_iso2_SessionSetupReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(SessionSetupResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionSetupReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionSetupResponse:              //20
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceDiscoveryRequest)
+                {
+                    Update_V2G_Flow_Status(ServiceDiscoveryRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+    #if 0
+            //-------------------------------------------
+            case ServiceDiscoveryRequest:           //21
+            {
+                if (Proc_iso2_ServiceDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ServiceDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ServiceDiscoveryReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceDiscoveryResponse:          //22
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceAndPaymentSelectionRequest)
+                {
+                    Update_V2G_Flow_Status(ServiceAndPaymentSelectionRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ServiceAndPaymentSelectionRequest:     //25
+            {
+                if (Proc_iso2_ServiceAndPaymentSelectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ServiceAndPaymentSelectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ServiceAndPaymentSelectionReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceAndPaymentSelectionResponse:    //26
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    Update_V2G_Flow_Status(AuthorizationRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            //case ContractAuthenticationReq:
+            case AuthorizationRequest:              //29
+            {
+                if (Proc_iso2_AuthenticationReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(AuthorizationResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]AuthorizationReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case AuthorizationResponse:             //30
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso2_AuthenticationReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]AuthorizationReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+
+                //Check for ChargeParameterDiscoveryReq
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(ChargeParameterDiscoveryRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]ChargeParameterDiscoveryReq: CSU Permission?");
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ChargeParameterDiscoveryRequest:   //35
+            {
+                if (Proc_iso2_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(ChargeParameterDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]ChargeParameterDiscoveryReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ChargeParameterDiscoveryResponse:
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_ChargingParameter_Performance_Time)  //60 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "ChargingParameter Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_ChargingParameter_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+                }
+                #endif
+
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso2_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]ChargeParameterDiscoveryReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 2: Check for CableCheckReq message
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CableCheckRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(CableCheckRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]CableCheckReqReq: isolated?");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_Start);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                //STEP 3: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStop);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //ftime(&EVCOMM_SYS_INFO.V2G_SECC_ChargeParameterDiscovery_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+
+                    if (Proc_iso2_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case CableCheckRequest:                 //37
+            {
+                //STEP 3: Execute Cable Check Process
+                if (Proc_iso2_CableCheckReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(CableCheckResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]CableCheckReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case CableCheckResponse:                //38
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_CableCheck_Performance_Time)  //38 seconds
+                {
+                    //SAVE_SYS_LOG_MSG_EVCOMM("[CableCheck] end counting...");
+                    sprintf(buf_log_evcomm,
+                            "CableCheck Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_CableCheck_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+
+                    //Update_ShmStatusCode(); //[To-Do] to be implemented
+                    //CCS_SECC_TIMEOUT_V2G_CableCheck_Performance_Time (023847)
+                    ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                    ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                    ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                    ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+                    ShmStatusCodeData->PresentStatusCode[0][5] = 7;
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for CableCheckReq message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CableCheckRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //STEP 3: Execute Cable Check Process
+                    if (Proc_iso2_CableCheckReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]CableCheckReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 3: Check for PreChargeReq message
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == PreChargeRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(PreChargeRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]PreChargeReqReq: waiting for precharge voltage...");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_End);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Precharge_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                //STEP 3: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStop);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //ftime(&EVCOMM_SYS_INFO.V2G_SECC_ChargeParameterDiscovery_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+
+                    if (Proc_iso2_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PreChargeRequest:                  //39
+            {
+                if (Proc_iso2_PreChargeReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PreChargeResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PreChargeReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PreChargeResponse:                 //40
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_PreCharge_Performance_Time)  //5 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "Precharge Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_PreCharge_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+
+                    //Update_ShmStatusCode(); //[To-Do] to be implemented
+                    //CCS_SECC_TIMEOUT_V2G_PreCharge_Performace_Time (023850)
+                    ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                    ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                    ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                    ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+                    ShmStatusCodeData->PresentStatusCode[0][5] = 0;
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for PreChargeReq message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == PreChargeRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso2_PreChargeReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]PreChargeReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 3: Check for PowerDeliveryReq message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStart);
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Precharge_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStart:         //41
+            {
+                if (Proc_iso2_PowerDeliveryStartReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryResponsetStart);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStartReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponsetStart:        //42
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                if (ccs_exi_doc_ISO2.V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+                {
+                    ftime(&SeqEndTime);
+                    if(DiffTimeb(SeqStartTime, SeqEndTime) > 2000)  //5 seconds
+                    {
+                        sprintf(buf_log_evcomm,
+                                "Wait for CurrentDemandReq Timeout - (%.02lf of %d ms)\n",
+                                DiffTimeb(SeqStartTime, SeqEndTime),
+                                2000);
+                        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                        Update_V2G_Flow_Status(Sequence_Timeout);
+                    }
+                    break;
+                }
+                #endif
+
+                //STEP 2: Wait for CurrentDemandReq Message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CurrentDemandRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(CurrentDemandRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]CurrentDemandReqReq: energy transfering...");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CurrentDemand_Timer_Start);
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case CurrentDemandRequest:              //45,
+            {
+                if (Proc_iso2_CurrentDemandReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(CurrentDemandResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]CurrentDemandReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case CurrentDemandResponse:             //46,
+            {
+                //STEP 1: Wait for CurrentDemandReq Message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CurrentDemandRequest)
+                {
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    if (Proc_iso2_CurrentDemandReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]CurrentDemandReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 2: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryRequestStop);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CurrentDemand_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStop:          //49,
+            {
+                if (Proc_iso2_PowerDeliveryStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(PowerDeliveryResponseStop);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]PowerDeliveryStopReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponseStop:        //50,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > 2000)  //2 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "Wait for WeldingDetectionReq or SessionStopReq Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            2000);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for WeldingDetectionReq Message
+                if(EVCOMM_SYS_INFO.V2G_Rx_Msg == WeldingDetectionRequest)
+                {
+                   EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Flow_Status(WeldingDetectionRequest);
+                    SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]WeldingDetectionReq: ongoing...");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_WeldingDetection_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_Flow_Status(SessionStopRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso2_SessionStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Flow_Status(SessionStopResponse);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionStopReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case WeldingDetectionRequest:           //51,
+            {
+                if (Proc_iso2_WeldingDetectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(WeldingDetectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]WeldingDetectionReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case WeldingDetectionResponse:          //52,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > V2G_SECC_WeldingDetection_Performance_Time)  //20 seconds
+                {
+                    sprintf(buf_log_evcomm,
+                            "Wait for SessionStopReq Timeout - (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            V2G_SECC_WeldingDetection_Performance_Time);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for WeldingDetectionReq Message
+                if(EVCOMM_SYS_INFO.V2G_Rx_Msg == WeldingDetectionRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    if (Proc_iso1_WeldingDetectionReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        SAVE_SYS_LOG_MSG_EVCOMM("[Error]WeldingDetectionReqRes: fail");
+                        Update_V2G_Flow_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                    break;
+                }
+                //STEP 3: Check for SessionStopReq Message
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_Flow_Status(SessionStopRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_WeldingDetection_Timer_End);
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case SessionStopRequest:                //53,
+            {
+                if (Proc_iso2_SessionStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Flow_Status(SessionStopResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                    SAVE_SYS_LOG_MSG_EVCOMM("[Error]SessionStopReqRes: fail");
+                    Update_V2G_Flow_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                //break;
+            }
+            case SessionStopResponse:               //54,
+            {
+                break;
+            }
+    #endif
+            //-------------------------------------------
+            default:
+            {
+                break;
+            }
+        }
+    }
+}
+
+
+
+/*===========================================================================
+FUNCTION: V2gMsg_Process_iso2_AC
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+        1. V2gFlowStatus
+OUTPUT:
+GLOBAL VARIABLES:
+        1. V2gFlowStatus
+=============================================================================*/
+int V2gMsg_Process_iso2_AC(int AcceptFd)
+{
+}
+
+/*===========================================================================
+FUNCTION: V2gMsg_Process_iso2
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+        1. V2gFlowStatus
+OUTPUT:
+GLOBAL VARIABLES:
+        1. V2gFlowStatus
+=============================================================================*/
+int V2gMsg_Process_iso2(int AcceptFd, unsigned char EnergyTransferMode)
+{
+    switch (EnergyTransferMode)
+    {
+        case DC_extended:
+        {
+            V2gMsg_Process_iso2_DC(AcceptFd);
+            break;
+        }
+
+        case AC_single_phase_core:
+        case AC_three_phase_core:
+        {
+            V2gMsg_Process_iso2_AC(AcceptFd);
+            break;
+        }
+
+        default:
+        {
+            sprintf(buf_log_evcomm,
+                    "[ISO2][Warning]Unexpected EnergyTransferMode(%d)",
+                    EnergyTransferMode);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            break;
+        }
+    }
+}
+
+/*===========================================================================
+FUNCTION: V2gMsg_Process
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int V2gMsg_Process(int AcceptFd)
+{
+    int errn = 0;
+
+    switch (ShmCcsData->CommProtocol)
+    {
+        case V2GT_MSG_PROTOCOL_DIN70121:        //0
+        {
+            V2gMsg_Process_din(AcceptFd);
+            break;
+        }
+
+        case V2GT_MSG_PROTOCOL_ISO15118_2014:   //1
+        {
+            V2gMsg_Process_iso1(AcceptFd, ShmCcsData->EnergyTransferMode);
+            break;
+        }
+
+        case V2GT_MSG_PROTOCOL_ISO15118_2018:   //2
+        {
+            V2gMsg_Process_iso2(AcceptFd, ShmCcsData->EnergyTransferMode);
+            break;
+        }
+
+        default:
+        {
+            sprintf(buf_log_evcomm,
+                    "[Warning]Unexpected CommProtocol(%d)",
+                    ShmCcsData->CommProtocol);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            break;
+        }
+    }
+
+    return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: V2gMsg_Rx
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int V2gMsg_Rx(int AcceptFd)
+{
+    int errn = 0;
+    unsigned int packet_size = 0;
+
+    memset(V2gtpMsgRxBuf, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+    packet_size = recv(AcceptFd, V2gtpMsgRxBuf, V2GTP_MSG_RX_BUFFER_SIZE, 0);
+    //[CAUTION] Everytime recv() is called, it will take a default time to wait for TCP packets.
+    //The more time you call recv(), the more time you will waste here.
+    //Here it is suggested that response immediatedly once you receive any packets.
+    //For configuring the Rx waiting time, please use setsockopt().
+
+    if(packet_size > 0) //[Joseph] If there is no data, ignore. (TBD)
+    {
+        //DEBUG_PRINTF_EVCOMM_DETAIL("\n\n Got TCP V2GTP Message: size = %d Bytes\n", packet_size);
+        errn = V2gMsgDecoder(V2gtpMsgRxBuf, packet_size, V2gFlowStatus);
+        if (errn < 0)
+        {
+            sprintf(buf_log_evcomm, "[ERROR]V2gMsgDecoder", errn);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        }
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: V2gComm
+DESCRIPTION:
+PRE-CONDITION:
+        1. TCP socket is connected.
+INPUT:
+        1. AcceptFd         //TCP Connection ID
+        2. V2gtpMsgRxBuf[]     //V2GTP Messages (Header + Payload)
+        3. V2GTP_MSG_RX_BUFFER_SIZE   //64*1024 = 65,536 = 65.5K (Bytes)
+
+OUTPUT:
+GLOBAL VARIABLES:
+        1. V2gtpMsgRxBuf[]
+=============================================================================*/
+int V2gComm(int AcceptFd)
+{
+    int errn = 0;
+
+    if (V2gMsg_Rx(AcceptFd) < 0)
+    {
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+    }
+
+    //following are the response message handling according to status flag
+    if (V2gMsg_Process(AcceptFd) < 0)
+    {
+        errn = -1;
+    }
+
+    //Error Check
+    //V2G_Error_Monitor();
+
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: SdpUdpConnected
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int SdpUdpConnected()
+{
+    int packet_size,Rtn;
+    struct sockaddr_in6 ServerAddr,ClientAddr;
+    struct V2gtpHeader *header;
+    unsigned char *payload;
+
+    if(UdpSock <= 0)
+    {
+        if ((UdpSock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("SdpUdpConnected: Fail to open UdpSock");
+            return 0;
+        }
+        memset(&ServerAddr,0, sizeof(struct sockaddr_in));
+        ServerAddr.sin6_family = AF_INET6;
+        ServerAddr.sin6_addr = in6addr_any;
+        ServerAddr.sin6_port = htons(SdpUdpServerPort);
+        if(bind(UdpSock, (struct sockaddr *)&ServerAddr, sizeof(struct sockaddr_in6)) <0)
+        {
+            sprintf(buf_log_evcomm,
+                    "SdpUdpConnected: Fail to bind UdpSock(%d)",
+                    UdpSock);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+            close(UdpSock);
+            UdpSock = -1;
+            return 0;
+        }
+        sprintf(buf_log_evcomm, "[UdpSock]opend:%d", UdpSock);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+        sprintf(buf_log_evcomm, "[SDP]Req from EVCC: waiting...(%d)", UdpSock);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+
+    memset(V2gtpMsgRxBuf, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+    memset(&ClientAddr, 0, sizeof(struct sockaddr_in));
+    Rtn = sizeof(struct sockaddr_in6);
+    packet_size = recvfrom(UdpSock, V2gtpMsgRxBuf, V2GTP_MSG_RX_BUFFER_SIZE, MSG_DONTWAIT, (struct sockaddr *)&ClientAddr, &Rtn);
+
+    if(packet_size > 0)
+    {
+        header = (struct V2gtpHeader *) V2gtpMsgRxBuf;
+        payload = V2gtpMsgRxBuf+sizeof(struct V2gtpHeader);
+
+        #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+        {
+            DEBUG_PRINTF_EVCOMM_DETAIL("\n\n Got UDP packet_size = %d (Bytes)\n", packet_size);
+
+            DEBUG_PRINTF_EVCOMM_DETAIL("\n\n***********************************\n");
+            DEBUG_PRINTF_EVCOMM_DETAIL("***** Received SDP Packet *****\n");
+            DEBUG_PRINTF_EVCOMM_DETAIL("***********************************\n");
+            DEBUG_PRINTF_EVCOMM_DETAIL("ClientAddress=");
+
+            for(Rtn = 0; Rtn < 16; Rtn += 2)
+            {
+                DEBUG_PRINTF_EVCOMM_DETAIL("%02x%02x:",ClientAddr.sin6_addr.s6_addr[Rtn],ClientAddr.sin6_addr.s6_addr[Rtn+1]);
+            }
+            DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+            DEBUG_PRINTF_EVCOMM_DETAIL("ClientPort=%d\n",ClientAddr.sin6_port);
+            DEBUG_PRINTF_EVCOMM_DETAIL("ProtocolVersion=%d\n",header->ProtocolVersion);
+            DEBUG_PRINTF_EVCOMM_DETAIL("InverseProtocolVersion=0x%x\n",header->InverseProtocolVersion);
+            DEBUG_PRINTF_EVCOMM_DETAIL("PayloadType=0x%x\n",htons(header->PayloadType));
+            DEBUG_PRINTF_EVCOMM_DETAIL("PayloadLength=0x%x\n",htonl(header->PayloadLength));
+            DEBUG_PRINTF_EVCOMM_DETAIL("htons(header->PayloadType)=0x%x\n",htons(header->PayloadType));
+        }
+        #endif
+
+        if( (header->ProtocolVersion == 0x01) &&
+            (header->InverseProtocolVersion == 0xFE) &&
+            (htons(header->PayloadType) == V2GTP_PAYLOAD_TYPE_SDP_REQUEST))
+        {
+            sprintf(buf_log_evcomm, "[SDP][Rx]Req from EVCC: GOT(%d)", UdpSock);
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+            DEBUG_PRINTF_EVCOMM_DETAIL("Security=0x%x\n", *(payload + 0));
+            DEBUG_PRINTF_EVCOMM_DETAIL("TransportProtocol=0x%x\n", *(payload + 1));
+
+            header->PayloadType = htons(V2GTP_PAYLOAD_TYPE_SDP_RESPONSE);
+            header->PayloadLength = htonl(20);    //Fixed Length=20
+            memset(payload, 0, 20);
+            // MAC address[0:2] + FFFE + MAC address[3:5]
+            payload[0] = (IPV6_LINK_LOCAL_PREFIX>>8) & 0xFF;
+            payload[1] = IPV6_LINK_LOCAL_PREFIX & 0xFF;
+            payload[8 ]= CsuMac[0];
+            payload[8] ^= 0x02;// bit 1 should complemented.
+            payload[9] = CsuMac[1];
+            payload[10] = CsuMac[2];
+            payload[11] = 0xFF;
+            payload[12] = 0xFE;
+            payload[13] = CsuMac[3];
+            payload[14] = CsuMac[4];
+            payload[15] = CsuMac[5];
+            //TCP port
+            payload[16] = (EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active>>8) & 0xFF;
+            payload[17] = EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active & 0xFF;
+            payload[18] = SDP_PAYLOAD_SECURITY_NONE;      //Security
+            payload[19] = SDP_PAYLOAD_TRANS_PROTOCOL_TCP; //Transport protocol
+
+            //[To-Do] Setup the TCP in advance to receive the coming TCP handshke messages after SDP response.
+
+            Rtn = sendto(UdpSock, V2gtpMsgRxBuf, sizeof(struct V2gtpHeader) + htonl(header->PayloadLength), 0, (struct sockaddr *)&ClientAddr, sizeof(struct sockaddr_in6));
+
+            sprintf(buf_log_evcomm, "[SDP][Tx]Res from SECC");
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+            #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+            {
+                DEBUG_PRINTF_EVCOMM_DETAIL("\n\n***** Response SDP Packet *****\n");
+                DEBUG_PRINTF_EVCOMM_DETAIL("Send size=%d\n",Rtn);
+                DEBUG_PRINTF_EVCOMM_DETAIL("Destination Address=");
+                for(Rtn = 0; Rtn < 16; Rtn++)
+                {
+                    DEBUG_PRINTF_EVCOMM_DETAIL("%02x, ", ClientAddr.sin6_addr.s6_addr[Rtn]);
+                }
+                DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+                DEBUG_PRINTF_EVCOMM_DETAIL("Destination Port=%d\n", ClientAddr.sin6_port);
+                DEBUG_PRINTF_EVCOMM_DETAIL("ProtocolVersion=%d\n", header->ProtocolVersion);
+                DEBUG_PRINTF_EVCOMM_DETAIL("InverseProtocolVersion=0x%x\n", header->InverseProtocolVersion);
+                DEBUG_PRINTF_EVCOMM_DETAIL("PayloadType=0x%x\n", htons(header->PayloadType));
+                DEBUG_PRINTF_EVCOMM_DETAIL("PayloadLength=0x%x\n", htonl(header->PayloadLength));
+                DEBUG_PRINTF_EVCOMM_DETAIL("SECC Ipv6 Address=");
+                for(Rtn = 0; Rtn < 16; Rtn++)
+                {
+                    DEBUG_PRINTF_EVCOMM_DETAIL("%02x:",payload[Rtn]);
+                }
+                DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+                DEBUG_PRINTF_EVCOMM_DETAIL("SECC Port=%d\n", (payload[16]<<8 | payload[17]));
+                DEBUG_PRINTF_EVCOMM_DETAIL("Security=0x%x\n", payload[19]);
+                DEBUG_PRINTF_EVCOMM_DETAIL("TransportProtocol=0x%x\n", payload[20]);
+            }
+            #endif
+
+            if(Rtn > 0)
+            {
+                return 1;
+            }
+        }
+    }
+    return 0;
+}
+
+/*===========================================================================
+FUNCTION: V2gTcpConnected
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int V2gTcpConnected()
+{
+    int packet_size,Rtn,AcceptFd;
+    struct sockaddr_in6 ServerAddr,ClientAddr;
+
+    if(TcpSock <= 0)
+    {
+        if ((TcpSock = socket(PF_INET6, SOCK_STREAM, 0)) < 0)
+        {
+            sprintf(buf_log_evcomm,
+                    "V2gTcpConnected: Fail to open TcpSock (%s)",
+                    strerror(errno));
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            usleep(100000); //100ms
+
+            return 0;
+        }
+        fcntl(TcpSock, F_SETFL, O_NONBLOCK);    //set to O_NONBLOCK
+        SAVE_SYS_LOG_MSG_EVCOMM("[TCP]socket set: DONE");
+
+        memset(&ServerAddr,0, sizeof(struct sockaddr_in));
+        ServerAddr.sin6_family = PF_INET6;
+        ServerAddr.sin6_addr = in6addr_any;
+        ServerAddr.sin6_port = htons(EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active);
+        //ServerAddr.sin6_port = htons(SdpTcpServerPort + (rand() % 10) + 1);
+        //printf("SdpTcpServerPort = %d(DEC)\n", htons(ServerAddr.sin6_port));
+        if(bind(TcpSock, (struct sockaddr *)&ServerAddr, sizeof(struct sockaddr_in6)) < 0)
+        {
+            sprintf(buf_log_evcomm,
+                    "V2gTcpConnected: Fail to bind TcpSock (%s), SdpTcpServerPort = %d",
+                    strerror(errno),
+                    EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active
+                    );
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+            //Change to another TCP port
+            /*
+            memset(&ServerAddr, 0, sizeof(struct sockaddr_in));
+            ServerAddr.sin6_family = PF_INET6;
+            ServerAddr.sin6_addr = in6addr_any;
+            //ServerAddr.sin6_port = htons(SdpTcpServerPort + (rand() % 1000) + 1);
+            ServerAddr.sin6_port = htons(EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active);
+            */
+            if(bind(TcpSock, (struct sockaddr *)&ServerAddr, sizeof(struct sockaddr_in6)) < 0)
+            {
+                sprintf(buf_log_evcomm,
+                        "V2gTcpConnected: Fail to bind TcpSock (%s), SdpTcpServerPort = %d",
+                        strerror(errno),
+                        EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active
+                        );
+                SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+                usleep(100000); //100ms
+                close(TcpSock);
+                TcpSock = -1;
+                return 0;
+            }
+        }
+        SAVE_SYS_LOG_MSG_EVCOMM("[TCP]blid: DONE");
+
+        SAVE_SYS_LOG_MSG_EVCOMM("[TCP]listen: START");
+
+        if(listen(TcpSock, 1) == -1)     //only accept one connection
+        {
+            sprintf(buf_log_evcomm,
+                    "V2gTcpConnected: Fail to listen TcpSock (%s)",
+                    strerror(errno));
+            SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+            usleep(100000); //100ms
+
+            close(TcpSock);
+            TcpSock = -1;
+            return 0;
+        }
+        SAVE_SYS_LOG_MSG_EVCOMM("[TCP]listen: DONE");
+
+        sprintf(buf_log_evcomm, "[TCP]TcpSock: opened(%d), port=%d", TcpSock, htons(ServerAddr.sin6_port));
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        SAVE_SYS_LOG_MSG_EVCOMM("[TCP]accept: START");
+    }
+    Rtn = sizeof(struct sockaddr_in6);
+    if((AcceptFd = accept(TcpSock, (struct sockaddr *)&ClientAddr, &Rtn)) == -1)
+    {
+        static BOOL tmp = 0;
+        if (tmp = 0)
+        {
+            SAVE_SYS_LOG_MSG_EVCOMM("[TCP]Wait TCP connection...");
+            tmp = 1;
+        }
+        else
+        {
+            //DEBUG_PRINTF_EVCOMM_DETAIL(".");
+        }
+        return 0;
+    }
+
+    SAVE_SYS_LOG_MSG_EVCOMM("[TCP]accept: DONE\n");
+
+    #if (DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE)
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("\n\nAccept one TCP connection:\n");
+        DEBUG_PRINTF_EVCOMM_DETAIL("AcceptFd=%d\n",AcceptFd);
+        DEBUG_PRINTF_EVCOMM_DETAIL("ClientAddress=");
+
+        for(Rtn = 0; Rtn < 16; Rtn += 2)
+        {
+            DEBUG_PRINTF_EVCOMM_DETAIL("%02x%02x:", ClientAddr.sin6_addr.s6_addr[Rtn], ClientAddr.sin6_addr.s6_addr[Rtn+1]);
+        }
+        DEBUG_PRINTF_EVCOMM_DETAIL("\n");
+        DEBUG_PRINTF_EVCOMM_DETAIL("ClientPort=%d\n", ClientAddr.sin6_port);
+    }
+    #endif
+
+    return AcceptFd;
+}
+
+/*===========================================================================
+FUNCTION: End_Process
+DESCRIPTION:
+PRE-CONDITION:
+        1. <CAUTION> This function could only be used in SeccComm fork2.
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int End_Process()
+{
+    if(EVCOMM_SYS_INFO.End_Process_inused == TRUE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("End_Process has been triggered by another event.");
+        return -1;
+    }
+
+    SAVE_SYS_LOG_MSG_EVCOMM("[End_Process]entering...");
+
+    //STEP 1: Ask CSU to Stop
+    EVCOMM_SYS_INFO.End_Process_inused = TRUE;
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    EVCOMM_SYS_INFO.ConnectorLocked = FALSE;
+    ShmInternalComm->ChargingPermission = FALSE;
+
+    //Step 2: Close sockets
+    SAVE_SYS_LOG_MSG_EVCOMM("[End_Process]close sockets...");
+    if(RawSock > 0)
+    {
+        close(RawSock);
+    }
+    if(UdpSock > 0)
+    {
+        close(UdpSock);
+    }
+    if(TcpSock > 0)
+    {
+        close(TcpSock);
+        close(TcpAcceptFd);
+    }
+    RawSock = UdpSock = TcpSock = TcpAcceptFd = -1;
+
+    //STEP 3: Switch to State E
+    //SwitchCpStateE(ENABLE);
+
+    //STEP 4: Close tcpdump
+    Sniffer_Tcpdump(DISABLE);
+
+    //STEP 5: Keep 100% PWM for 5 seconds
+    OutputCpPwmDuty(100);
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 100\% countdown: 5");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 100\% countdown: 4");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 100\% countdown: 3");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 100\% countdown: 2");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 100\% countdown: 1");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("PWM 100\% countdown: 0");
+
+    AttenProfileCnt = 0;
+    init_appHandEXIDocument(&ccs_handshake);
+   // Qca7kPowerReset();  //reset QCA7000 /* +++ 20200808, vern, should disconnected PLC connection after session stop ---*/
+
+    #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == DISABLE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[End_Process]1st sync...");
+        system("sync");
+    }
+    #endif
+
+    //STEP 4: Switch to State E
+    //Keep State E for 5 seconds
+    #if 0
+    SwitchCpStateE(ENABLE); //Set PWM Duty as 0 and set State as E (0V)
+    SAVE_SYS_LOG_MSG_EVCOMM("State E countdown: 5");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("State E countdown: 4");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("State E countdown: 3");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("State E countdown: 2");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("State E countdown: 1");
+    sleep(1);
+    SAVE_SYS_LOG_MSG_EVCOMM("State E countdown: 0");
+    #endif
+
+    //Reset Memory
+    unsigned char SlaveAddress_backup;
+    unsigned int matched_backup;
+    //unsigned char state_backup;
+
+
+    SAVE_SYS_LOG_MSG_EVCOMM("[CCS Board]soft reset (closing SeccComm)...");
+    SAVE_SYS_LOG_MSG_EVCOMM("---------------------------------------------");
+    SAVE_SYS_LOG_MSG_EVCOMM("--               EVCOMM: END               --");
+    SAVE_SYS_LOG_MSG_EVCOMM("---------------------------------------------\n");
+
+    #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == DISABLE)
+    {
+        SAVE_SYS_LOG_MSG_EVCOMM("[End_Process]2nd sync...");
+        system("sync");
+    }
+    #endif
+
+    system("sleep 1");
+
+    //Backup CsuComm flags
+    SlaveAddress_backup = ShmInternalComm->SlaveAddress;
+    matched_backup = CSUCOMMDC_TASK_FLAG.matched;
+    //state_backup = Check_V2G_Flow_Status();
+
+    memset(V2gtpMsgRxBuf, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+    memset(V2gtpMsgTxBuf, 0, V2GTP_MSG_TX_BUFFER_SIZE);
+    memset(&ccs_handshake, 0, sizeof(struct appHandEXIDocument));
+    memset(&ccs_exi_doc_DIN, 0, sizeof(struct dinEXIDocument));
+    memset(V2GTP_Tx_buf, 0, V2GTP_MSG_TX_BUFFER_SIZE);
+    memset(buf_log_evcomm, 0, sizeof(buf_log_evcomm));
+    memset(ShmStatusCodeData, 0, sizeof(struct StatusCodeData));
+    memset(ShmInternalComm, 0, sizeof(struct InternalComm));
+    memset(ShmCcsData, 0, sizeof(struct CcsData));
+
+    //Resume CsuComm flags
+    ShmInternalComm->SlaveAddress = SlaveAddress_backup;
+    CSUCOMMDC_TASK_FLAG.matched = matched_backup;
+    Sniffer_Candump(DISABLE);
+    Sniffer_Candump(ENABLE);
+    //memset(ShmSysConfigAndInfo, 0, sizeof(struct SysConfigAndInfo)); //EVCOMM_SYS_INFO.End_Process_inused = FALSE;
+    //EVCOMM_SYS_INFO.End_Process_inused = TRUE;
+    //Update_V2G_Flow_Status(state_backup);
+    //CP_Detection_Pid = 0;
+    //PP_Detection_Pid = 0;
+    //Error_Monitor_Pid = 0;
+ /*  while(CheckConnectorPlugIn() != TRUE)
+   {
+   	sleep(1);
+   }*/
+	free(V2gtpMsgRxBuf);
+	free(V2gtpMsgTxBuf);
+	//DetachShareMemory();
+    system("cd /root;./reset_soft.sh");
+    while(1)
+    {
+        //wait for CSU configrm
+    }
+}
+
+
+/*===========================================================================
+FUNCTION: Parameters_Init
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Parameters_Init()
+{
+    //Step 0: Generate random number
+    unsigned int value_random;
+    struct timeb time_seed;
+    ftime(&time_seed);
+    srand(time_seed.millitm);
+
+    //Step 1: Init SDP TCP Port
+    value_random = rand();
+    EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active = (unsigned short)(SdpTcpServerPort + (value_random % 10000) + 1);
+
+    sprintf(buf_log_evcomm,
+            "[Init]TCP Port:OK(%d)",
+            EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active);
+    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+    //Step 2: Init SessionID
+    value_random = rand();
+    memcpy(&EVCOMM_SYS_INFO.SessionID[0], &value_random, 4);
+
+    value_random = rand();
+    memcpy(&EVCOMM_SYS_INFO.SessionID[4], &value_random, 4);
+
+    sprintf(buf_log_evcomm,
+            "[Init]SessionID:OK(%02X%02X%02X%02X%02X%02X%02X%02X)",
+            EVCOMM_SYS_INFO.SessionID[0],
+            EVCOMM_SYS_INFO.SessionID[1],
+            EVCOMM_SYS_INFO.SessionID[2],
+            EVCOMM_SYS_INFO.SessionID[3],
+            EVCOMM_SYS_INFO.SessionID[4],
+            EVCOMM_SYS_INFO.SessionID[5],
+            EVCOMM_SYS_INFO.SessionID[6],
+            EVCOMM_SYS_INFO.SessionID[7]);
+    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+}
+
+
+/*===========================================================================
+FUNCTION: main
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int main(int argc, char *argv[])
+{
+    unsigned char Rtn;
+
+    //Initialization
+    if(ShareMemory_Init()==0)
+    {
+	system("reboot -f");
+	sleep(5);
+	system("reboot -f");
+    }	
+    memset(ShmSysConfigAndInfo, 0, sizeof(struct SysConfigAndInfo));
+
+    if(RawSock > 0)
+    {
+        close(RawSock);
+    }
+    if(UdpSock > 0)
+    {
+        close(UdpSock);
+    }
+    if(TcpSock > 0)
+    {
+        close(TcpSock);
+    }
+
+    RawSock = UdpSock = TcpSock = -1;
+    Update_V2G_Flow_Status(IDLE);
+
+    SAVE_SYS_LOG_MSG_EVCOMM("---------------------------------------------");
+    SAVE_SYS_LOG_MSG_EVCOMM("--               EVCOMM: START             --");
+    SAVE_SYS_LOG_MSG_EVCOMM("---------------------------------------------\n");
+    
+    //Print Linux Kernel Version
+    sprintf(buf_log_evcomm, "\nLinux Image SHA1: %s\n", LINUX_IMAGE_VERSION);
+    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+    //Print Hardware Version
+    sprintf(buf_log_evcomm, "HW: %s\n", HARDWARE_VERSION);
+    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+    //Print Firmware Version
+    sprintf(buf_log_evcomm, "FW: %s\n", FIRMWARE_VERSION);
+    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+
+    SAVE_SYS_LOG_MSG_EVCOMM("init...");
+
+    //Init V2G TCP/IPv6 packets buffer
+    V2gtpMsgRxBuf = (unsigned char *)malloc(V2GTP_MSG_RX_BUFFER_SIZE);
+    memset(V2gtpMsgRxBuf, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+
+    V2gtpMsgTxBuf = (unsigned char *)malloc(V2GTP_MSG_TX_BUFFER_SIZE);
+    memset(V2gtpMsgTxBuf, 0, V2GTP_MSG_TX_BUFFER_SIZE);
+
+    //Release State E Control
+    SwitchCpStateE(DISABLE);
+    OutputCpPwmDuty(100);
+
+    //start to detect CP pilot state
+    CP_Detection_Pid = 0;
+    CP_Detection();     //fork1
+    SAVE_SYS_LOG_MSG_EVCOMM("[fork1]CP Detection: ON");
+
+    //start to detect errors
+    Error_Monitor();    //fork2
+    SAVE_SYS_LOG_MSG_EVCOMM("[fork2]Error Monitor: ON");
+
+    //start to detect PP
+    PP_Detection_Pid = 0;
+    #if (PP_PROTECTION_MECHANISM == ENABLE)
+    PP_Detection();
+    SAVE_SYS_LOG_MSG_EVCOMM("[fork3]PP Detection: ON");
+    #else
+    SAVE_SYS_LOG_MSG_EVCOMM("[fork3]PP Detection: OFF");
+    #endif
+
+    //Init communication parameters
+    GetEthMac(QcaInterface, CsuMac);
+
+    AttenProfileCnt = 0;
+    init_appHandEXIDocument(&ccs_handshake);
+
+    //Init Energy transfer mode
+    //[To-Do] Parsing Model Name
+    ShmCcsData->EnergyTransferMode = CCS_ENERGY_TRANSFER_MODE;
+
+    struct ChargingInfoData *ccs;
+    ccs = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    Parameters_Init();
+    Sniffer_Tcpdump(ENABLE);
+    #if (TCPDUMP_PACKETS_SNIFFER_SWITCH == ENABLE)
+    sleep(1); //wait for tcpdump getting ready
+    #endif
+
+    SAVE_SYS_LOG_MSG_EVCOMM("[Init]DONE");
+
+    while(1)
+    {
+        //DEBUG_PRINTF_EVCOMM_DETAIL("\nV2gFlowStatus = %d\n", V2gFlowStatus);
+        //if((ShmInternalComm->ChargingPermission == 0x01) && (CheckConnectorPlugIn() == 1))
+        //if((CheckConnectorPlugIn() == TRUE) && (ShmInternalComm->ChargingPermission == TRUE))
+        //if(ShmInternalComm->ChargingPermission == 0x01)
+        //if(CheckConnectorPlugIn() == TRUE)
+        if (EVCOMM_SYS_INFO.End_Process_inused == FALSE)
+        {
+            if(V2gFlowStatus < SLACC_SDP_UDP_Connection)
+            {
+                SlacComm();
+            }
+            else if(V2gFlowStatus == SLACC_SDP_UDP_Connection)
+            {
+                if(SdpUdpConnected() == 1)
+                {
+                    Update_V2G_Flow_Status(SLACC_SDP_TCP_Connection);
+                    continue;
+                }
+                SlacComm(); //TC_SECC_VTB_CmSlacMatch_004
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > TT_match_join)
+                {
+                    sprintf(buf_log_evcomm,
+                            "Wait SLACC_SDP_UDP_Connection Timeout - TT_match_join (%.02lf of %d ms)\n",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            TT_match_join);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    //Update_ShmStatusCode(); //[To-Do] to be implemented
+                    //CCS_SECC_TIMEOUT_SLACC_SDP_UDP_TT_match_join (023823)
+                    ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                    ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                    ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                    ShmStatusCodeData->PresentStatusCode[0][4] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+                    //CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+                    Proc_EVStopRes(ShmInternalComm->FD_CAN_Socket);
+                }
+            }
+            else if(V2gFlowStatus == SLACC_SDP_TCP_Connection)
+            {
+                if((TcpAcceptFd = V2gTcpConnected()) > 0)
+                {
+                    Update_V2G_Flow_Status(SupportedAppProtocolRequest);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    continue;
+                }
+                SlacComm();
+                ftime(&SeqEndTime);
+
+                if(DiffTimeb(SeqStartTime, SeqEndTime) > TT_match_join)
+                {
+                    sprintf(buf_log_evcomm,
+                            "Wait SLACC_SDP_TCP_Connection Timeout - TT_match_join (%.02lf / %d ms)",
+                            DiffTimeb(SeqStartTime, SeqEndTime),
+                            TT_match_join);
+                    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+                    Update_V2G_Flow_Status(Sequence_Timeout);
+                    //Update_ShmStatusCode(); //[To-Do] to be implemented
+                    //CCS_SECC_TIMEOUT_SLACC_SDP_TCP_TT_match_join (023824)
+                    ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                    ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                    ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                    ShmStatusCodeData->PresentStatusCode[0][4] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][5] = 4;
+                    //CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+                    Proc_EVStopRes(ShmInternalComm->FD_CAN_Socket);
+                }
+            }
+            else if(V2gFlowStatus <= SessionStopResponse)
+            {
+                if (V2gComm(TcpAcceptFd) < 0)
+                {
+                    //error occours
+                }
+            }
+            else if (V2gFlowStatus >= Performance_Timeout)
+            {
+                //End_Process
+            }
+            else
+            {
+                //null
+            }
+        }
+    } //while
+}//main while

+ 236 - 0
EVSE/Projects/CCS/Apps/SeccComm.h

@@ -0,0 +1,236 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                EVComm.h
+
+                        initiated by Vern, Joseph
+                           (since 2019/07/19)
+   =============================================================================*/
+
+#ifndef EVCOMM_H_
+#define EVCOMM_H_
+
+#if FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_EVCOMM_SWITCH          ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_EVCOMM_SHOW                DISABLE     //DISABLE, ENABLE
+#define DEBUG_PRINTF_EVCOMM_BRIEF_SHOW          DISABLE      //DISABLE, ENABLE
+#define DEBUG_PRINTF_EVCOMM_DETAIL_SHOW         DISABLE      //DISABLE, ENABLE
+#define DEBUG_PRINTF_EVCOMM_SYSTEM_LOG_SHOW     DISABLE      //ENABLE, DISABLE
+#else //debug mode
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_EVCOMM_SWITCH          ENABLE      //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_EVCOMM_SHOW                ENABLE     //DISABLE, ENABLE
+#define DEBUG_PRINTF_EVCOMM_BRIEF_SHOW          DISABLE      //DISABLE, ENABLE
+#define DEBUG_PRINTF_EVCOMM_DETAIL_SHOW         DISABLE      //DISABLE, ENABLE
+#define DEBUG_PRINTF_EVCOMM_SYSTEM_LOG_SHOW     ENABLE      //ENABLE, DISABLE
+#endif
+
+//ADC Channels (0, 1, 2, 3)
+#define ADC_CHANNEL_AIN0_NTC1   0
+#define ADC_CHANNEL_AIN1_NTC2   1
+#define ADC_CHANNEL_AIN2_PP     2
+#define ADC_CHANNEL_AIN3_CP     3
+
+#define QcaInterface                        "eth1"
+#define SUPPORT_BCB_TOGGLE_FUNCTION         ENABLE      //BCB
+#define SdpUdpServerPort                    15118
+//#define SdpTcpServerPort                    59438       //49152-65535 (default:59438)
+#define SdpTcpServerPort                    50000       //49152-65535 (base: 50000)
+#define IPV6_LINK_LOCAL_PREFIX              0xFE80
+
+//[Joseph] These Tx/Rx buffer size should owns 8 + 4294967295 = 4,294,967,303 Bytes = 4.GB as maximum.
+//(according to Figure 24 in DIN 70121)
+#define V2GTP_MSG_RX_BUFFER_SIZE           (64*1024)   //65,536 = 65.5KB
+#define V2GTP_MSG_TX_BUFFER_SIZE           (64*1024)   //65,536 = 65.5KB
+#define V2GTP_MSG_HEADER_LENGTH             8           //8 Bytes
+
+/***********************************************/
+/*********** Ethernet Type ********************/
+/**********************************************/
+#define EtherType_HomePlug                  0x88E1
+
+/***********************************************/
+/*** MMTYPE (Management Message Type) **/
+/**********************************************/
+#define MMTYPE_CM_SET_KEY_REQ               0x6008
+#define MMTYPE_CM_SET_KEY_CNF               0x6009
+#define MMTYPE_CM_SLAC_PARM_REQ             0x6064
+#define MMTYPE_CM_SLAC_PARM_CNF             0x6065
+#define MMTYPE_CM_START_ATTEN_CHAR_IND      0x606A
+#define MMTYPE_CM_MNBC_SOUND_IND            0x6076
+#define MMTYPE_CM_ATTEN_CHAR_IND             0x606E
+#define MMTYPE_CM_ATTEN_CHAR_RSP            0x606F
+#define MMTYPE_CM_VALIDATE_REQ              0x6078
+#define MMTYPE_CM_VALIDATE_CNF              0x6079
+#define MMTYPE_CM_SLAC_MATCH_REQ            0x607C
+#define MMTYPE_CM_SLAC_MATCH_CNF            0x607D
+#define MMTYPE_CM_ATTEN_PROFILE_IND         0x6086
+//following are the vendor specific type
+#define MMTYPE_VENDOR_VS_HOST_ACTION        0xA062      //Embedded Host Action Requested Indication MME
+#define MMTYPE_VENDOR_ATTEN_CHAR            0xA14E      //Attenuation Characteristics MME (VS_ATTEN_CHAR)
+#define MMTYPE_VENDOR_VS_NW_INFO            0xA038      //Network Info MME
+#define MMTYPE_VENDOR_VS_NW_INFO_CNF        0xA039      //Network Info MME
+#define MMTYPE_VENDOR_VS_PL_LNK_STATUS        0xA0B8      //Powerline Link Status /*+++ 20200808, vern, for PLC connection monitoring ---*/
+#define MMTYPE_VENDOR_VS_PL_LNK_STATUS_CNF        0xA0B9      //Powerline Link Status /*+++ 20200808, vern, for PLC connection monitoring ---*/
+
+/***********************************************/
+/************** V2GTP Payload Type ************/
+/**********************************************/
+//Reference:
+//Table 16 — "Overview on V2GTP payload types," page 79, DIN SPEC 70121:2014-12
+#define V2GTP_PAYLOAD_TYPE_SDP_REQUEST      0x9000      //SDP request message
+#define V2GTP_PAYLOAD_TYPE_SDP_RESPONSE     0x9001      //SDP response message
+#define V2GTP_PAYLOAD_TYPE_EXI_MSG          0x8001      //EXI encoded V2G Message
+//Payload
+#define SDP_PAYLOAD_SECURITY_TLS            0x00        //0x00 = secured with TLS
+#define SDP_PAYLOAD_SECURITY_NONE           0x10        //0x10 = No transport layer security
+#define SDP_PAYLOAD_TRANS_PROTOCOL_TCP      0x00        //0x00= TCP
+#define SDP_PAYLOAD_TRANS_PROTOCOL_UDP      0x10        //0x10 = reserved for UDP
+/***********************************************/
+/****** Timing and constant values **********/
+/*********** [2015] ISO 15118_3 ***************/
+/**********************************************/
+//#define TT_EVSE_match_MNBC                  600         //unit: 1ms (default: 600ms)
+#define TT_EVSE_match_MNBC                  (600+400)   //unit: 1ms (default: 600ms)
+#define C_EV_match_MNBC                     0x0A
+#define TT_EVSE_SLAC_init                   50          //unit: sec.
+#define TT_match_sequence                   400         //unit: ms
+#define TP_match_response                   100         //unit: ms, General performance time for a response to a request
+#define TT_match_response                   (200*3)     //unit: ms, Time that the EV/EVSE shall wait for a response from the EVSE/EV
+#define TP_EV_batch_msg_interval            (50*3)      //unit: ms
+#define TT_EVSE_match_session               10000       //unit: ms
+#define TT_match_join                       (12000*2)   //unit: ms
+
+#define V2G_SECC_ReadyToCharge_Performance_Time             148000  //unit: ms (148 sec)
+#define V2G_SECC_CommunicationSetup_Performance_Time        18000   //unit: ms (18 sec)
+#define V2G_SECC_ChargingParameter_Performance_Time         60000   //unit: ms (60 sec)
+//#define V2G_SECC_ChargingParameter_Performance_Time       120000   //unit: ms (120 sec)
+#define V2G_SECC_CableCheck_Performance_Time                38000   //unit: ms (38 sec)
+//#define V2G_SECC_CableCheck_Performance_Time              60000   //unit: ms (extend to 60 sec)
+//#define V2G_SECC_PreCharge_Performance_Time                 5000    //unit: ms (5 sec)
+#define V2G_SECC_PreCharge_Performance_Time                 10000   //unit: ms (extend to 10 sec)
+#define V2G_SECC_WeldingDetection_Performance_Time          20000   //unit: ms (20 sec)
+#define V2G_SECC_CPState_Detection_Timeout                  1500    //unit: ms (1.5 sec)
+#define V2G_SECC_CPOscillator_Retain_Timeout                1500    //unit: ms (1.5 sec)
+
+#define V2G_EVCC_Msg_Timeout_SupportedAppProtocolReq        2000    //unit: ms (1.5 sec)
+#define V2G_EVCC_Msg_Timeout_SessionSetupReq                2000    //unit: ms (1.5 sec)
+#define V2G_EVCC_Msg_Timeout_ServiceDiscoveryReq            2000
+#define V2G_EVCC_Msg_Timeout_ServicePaymentSelectionReq     2000
+#define V2G_EVCC_Msg_Timeout_ContractAuthenticationReq      2000
+#define V2G_EVCC_Msg_Timeout_ChargeParameterDiscoveryReq    2000
+#define V2G_EVCC_Msg_Timeout_PowerDeliveryReq               2000
+#define V2G_EVCC_Msg_Timeout_CableCheckReq                  2000
+#define V2G_EVCC_Msg_Timeout_PreChargeReq                   2000
+#define V2G_EVCC_Msg_Timeout_CurrentDemandReq               25
+#define V2G_EVCC_Msg_Timeout_WeldingDetectionReq            2000
+#define V2G_EVCC_Msg_Timeout_SessionStopReq                 2000
+#define V2G_SECC_Sequence_Timeout                           60000   //unit: ms (default: 60000, i.e. 60 sec)
+#define V2G_SECC_QCA7000_GET_MAC_ADDR_REQ_RETRY_PERIOD      3000    //unit: ms (default: 3000, i.e. 3 sec)
+#define V2G_SECC_QCA7000_SEND_SET_KEY_PERIOD                2000    //unit: ms (default: 2000, i.e. 2 sec)
+#define V2G_SECC_QCA7000_COMM_TIMEOUT                       10000   //unit: ms (default: 10000, i.e. 20 sec)
+//[To-Do] to be continued. (DIN 70121, Table 75)
+
+#define V2G_SECC_CP_Timeout_CableCheck                      2000    //unit: ms (default: 2 sec)
+
+#define DIN_SPEC_70121_2012_VersionNumberMajor              2
+#define DIN_SPEC_70121_2012_VersionNumberMinor              0
+#define ISO1_15118_2013_VersionNumberMajor                  2
+#define ISO1_15118_2013_VersionNumberMinor                  0
+#define ISO2_15118_2018_VersionNumberMajor                  2
+#define ISO2_15118_2018_VersionNumberMinor                  0
+
+/***********************************************/
+/*************** Structure *********************/
+/**********************************************/
+struct MmeHeader
+{
+    unsigned char ODA[6];           //Original Destination Address
+    unsigned char OSA[6];           //Original source Address
+    //unsigned int VLAN Tag;        //IEEE802.1Q VLAN Tag (optional)
+    unsigned short MTYPE;           //Ethernet Type for HomePlug, should be 0x88E1
+    unsigned char MMV;              //Management Message Version
+    unsigned short MMTYPE;          //Management Message Type
+    unsigned char FMI[2];           //Fragmentation Management Information, Fragmentation Message Sequence Number
+    unsigned char MMENTRY[256];     //Management Message Entry Data
+} __attribute__((packed));
+
+//Qualcomm Atheros Vendor Specific MME Format
+struct QcaVendorMmeHeader
+{
+    unsigned char ODA[6];           //Original Destination Address
+    unsigned char OSA[6];           //Original source Address
+    //unsigned int VLAN Tag;        //IEEE802.1Q VLAN Tag (optional)
+    unsigned short MTYPE;           //Ethernet Type for HomePlug, should be 0x88E1
+    unsigned char MMV;              //Management Message Version
+    unsigned short MMTYPE;          //Management Message Type
+    unsigned char OUI[3];           //Fragmentation Management Information, Fragmentation Message Sequence Number
+    unsigned char MBODY[1024];      //Management Message Entry Data
+} __attribute__((packed));
+
+struct V2gtpHeader                          //8 Bytes (see Figure 25 in DIN 70121)
+{
+    unsigned char ProtocolVersion;          //0x01: V2GTP version 1, 0x00, 0x02-0xFF reserved
+    unsigned char InverseProtocolVersion;   //Equals the <Protocol_Version> XOR 0xFF, 0xFE: V2GTP Version 1
+    unsigned short PayloadType;             //0x8001:	EXI encoded V2G Message,
+                                            //0x9000:	SDP request message,
+                                            //0x9001:	SDP response message,
+                                            //0xA000 - 0xFFFF:	Manufacturer specific use
+    unsigned int PayloadLength;             //excluding the generic V2GTP header byte
+} __attribute__((packed));
+
+int Proc_din_supportedAppProtocolRes(int AcceptFd);
+void SHM_Init_din_ChargeParameterDiscoveryRes(struct CcsData *shm_ccs);
+void SHM_Init_din_CableCheckRes(struct CcsData *shm_ccs);
+void SHM_Init_din_PreChargeRes(struct CcsData *shm_ccs);
+void SHM_Init_din_PowerDeliveryRes(struct CcsData *shm_ccs);
+void SHM_Init_din_CurrentDemandRes(struct CcsData *shm_ccs);
+void SHM_Init_din_WeldingDetectionRes(struct CcsData *shm_ccs);
+void SHM_Init_din_SessionStopRes(struct CcsData *shm_ccs);
+int OutputCpPwmDuty(unsigned char Duty);
+void Check_EVErrorCode(int code);
+unsigned char Check_V2G_Flow_Status_pre();
+int End_Process();
+int SdpUdpConnected();
+int V2gTcpConnected();
+
+//System Log
+#if SAVE_SYS_LOG_MSG_EVCOMM_SWITCH == ENABLE
+    #define SAVE_SYS_LOG_MSG_EVCOMM     StoreLogMsg
+#else
+    #define SAVE_SYS_LOG_MSG_EVCOMM(...)
+#endif
+
+//Debug Message
+#if DEBUG_PRINTF_EVCOMM_SHOW == ENABLE
+    //Brief Messages
+    #if DEBUG_PRINTF_EVCOMM_BRIEF_SHOW == ENABLE
+        #define DEBUG_PRINTF_EVCOMM_BRIEF      printf
+    #else
+        #define DEBUG_PRINTF_EVCOMM_BRIEF(...)
+    #endif
+
+    //Detail Messages
+    #if DEBUG_PRINTF_EVCOMM_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_EVCOMM_DETAIL     printf
+    #else
+        #define DEBUG_PRINTF_EVCOMM_DETAIL(...)
+    #endif
+
+    //System Log Messages
+    #if DEBUG_PRINTF_EVCOMM_SYSTEM_LOG_SHOW == ENABLE
+        #define DEBUG_PRINTF_EVCOMM_SYSTEM_LOG    printf
+    #else
+        #define DEBUG_PRINTF_EVCOMM_SYSTEM_LOG(...)
+    #endif
+#else
+    #define DEBUG_PRINTF_EVCOMM_BRIEF(...)
+    #define DEBUG_PRINTF_EVCOMM_DETAIL(...)
+    #define DEBUG_PRINTF_EVCOMM_SYSTEM_LOG(...)
+#endif
+
+#endif

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 584 - 553
EVSE/Projects/CCS/Apps/define.h


+ 5076 - 0
EVSE/Projects/CCS/Apps/exi_engine/api/api.c

@@ -5,4 +5,5080 @@
                           initiated by Joseph
                            (since 2019/08/07)
 =============================================================================*/
+#include <netinet/ip.h>
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <linux/termios.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <stdlib.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/mman.h>
+#include <linux/sockios.h>
+#include <linux/socket.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <sys/time.h>
+#include <sys/timeb.h>
+#include <math.h>//for pow
+#include <unistd.h>
+#include <linux/if_packet.h>
+#include <netinet/if_ether.h>
+#include <net/if.h>
+#include <netinet/ether.h>
+#include <linux/can.h>
+#include <linux/can/raw.h>
+
 #include "api.h"
+#include "../../SeccComm.h"
+//#include "../../CsuComm.h"
+#include "../../define.h"
+#include "../codec/EXITypes.h"
+
+/* Activate support for DIN */
+#include "../din/dinEXIDatatypes.h"
+#if DEPLOY_DIN_CODEC == SUPPORT_YES
+#include "../din/dinEXIDatatypesEncoder.h"
+#include "../din/dinEXIDatatypesDecoder.h"
+#endif /* DEPLOY_DIN_CODEC == SUPPORT_YES */
+
+/* Activate support for XMLDSIG */
+#include "../xmldsig/xmldsigEXIDatatypes.h"
+#if DEPLOY_XMLDSIG_CODEC == SUPPORT_YES
+#include "../xmldsig/xmldsigEXIDatatypesEncoder.h"
+#include "../xmldsig/xmldsigEXIDatatypesDecoder.h"
+#endif /* DEPLOY_XMLDSIG_CODEC == SUPPORT_YES */
+
+/* Activate support for ISO1 */
+#include "../iso1/iso1EXIDatatypes.h"
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+#include "../iso1/iso1EXIDatatypesEncoder.h"
+#include "../iso1/iso1EXIDatatypesDecoder.h"
+#endif /* DEPLOY_ISO1_CODEC == SUPPORT_YES */
+
+/* Activate support for ISO2 */
+#include "../iso2/iso2EXIDatatypes.h"
+#if DEPLOY_ISO2_CODEC == SUPPORT_YES
+#include "../iso2/iso2EXIDatatypesEncoder.h"
+#include "../iso2/iso2EXIDatatypesDecoder.h"
+#endif /* DEPLOY_ISO2_CODEC == SUPPORT_YES */
+
+#include "../transport/v2gtp.h"
+
+extern struct SysConfigAndInfo *ShmSysConfigAndInfo;
+extern struct StatusCodeData *ShmStatusCodeData;
+extern struct CcsData *ShmCcsData;
+extern struct InternalComm *ShmInternalComm;
+extern struct InternalCommAC *ShmInternalCommAC;
+
+/*Preserve V2GTP Rx and Tx Buffer*/
+//unsigned char V2GTP_Rx_buf[V2GTP_MSG_RX_BUFFER_SIZE];	//(64*1024)   //65,536 = 65.5KB
+unsigned char V2GTP_Tx_buf[V2GTP_MSG_TX_BUFFER_SIZE];		//(64*1024)   //65,536 = 65.5KB
+
+
+bitstream_t iStream;	//for V2GTP Message
+struct appHandEXIDocument exiDoc;	//for decoded V2GTP messages, i.e. EXI DOC (XML)
+
+unsigned char buf_log_exi_api[256];
+
+
+/*===========================================================================
+FUNCTION: printASCIIString
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+			1. exi_doc_DIN
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+static void printASCIIString(exi_string_character_t* string, uint16_t len)
+{
+	unsigned int i = 0;
+
+	for(i = 0; i < len; i++)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("%c", (char)string[i]);
+	}
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n");
+}
+
+/*===========================================================================
+FUNCTION: writeStringToEXIString
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+			1. exi_doc_DIN
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+static int writeStringToEXIString(char* string, exi_string_character_t* exiString)
+{
+	int pos = 0;
+	while(string[pos]!='\0')
+	{
+		exiString[pos] = string[pos];
+		pos++;
+	}
+
+	return pos;
+}
+
+/*===========================================================================
+FUNCTION: PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+			1. exi_doc_DIN
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Check_V2G_Rx_Msg_Name_din(struct dinEXIDocument *exi_doc_DIN)
+{
+	int errn = 0;
+
+	//Session Setup (0a ⇄ 0b)
+	if (exi_doc_DIN->V2G_Message.Body.SessionSetupReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] SessionSetupReq_isUsed: YES (0a ⇄ 0b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionSetupRequest;
+	}
+	//Service Discovery (1a ⇄ 1b)
+	else if (exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] ServiceDiscoveryReq_isUsed: YES (1a ⇄ 1b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceDiscoveryRequest;
+	}
+	//Service Payment Selection (2a ⇄ 2b)
+	else if (exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] ServicePaymentSelectionReq_isUsed: YES (2a ⇄ 2b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceAndPaymentSelectionRequest;
+	}
+	//Contract Contract Authentication (Xa ⇄ Xb)
+	else if (exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] ContractAuthenticationReq_isUsed: YES (Xa ⇄ Xb)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = AuthorizationRequest;
+	}
+	//Charge Parameter Discovery (3a ⇄ 3b)
+	else if (exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] ChargeParameterDiscoveryReq_isUsed: YES (3a ⇄ 3b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ChargeParameterDiscoveryRequest;
+	}
+	//Cable Check (4a ⇄ 4b)
+	else if (exi_doc_DIN->V2G_Message.Body.CableCheckReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] CableCheckReq_isUsed: YES (4a ⇄ 4b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = CableCheckRequest;
+	}
+	//Precharge (5a ⇄ 5b)
+	else if (exi_doc_DIN->V2G_Message.Body.PreChargeReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] PreChargeReq_isUsed: YES (5a ⇄ 5b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = PreChargeRequest;
+	}
+	//Power Delivery (6a ⇄ 6b)
+	else if (exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] PowerDeliveryReq_isUsed: YES (6a ⇄ 6b)\n");
+
+		if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre == PreChargeRequest)
+		{
+			EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStart;
+		}
+		else
+		{
+			EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStop;
+		}
+	}
+	//Current Demand (7a ⇄ 7b)
+	else if (exi_doc_DIN->V2G_Message.Body.CurrentDemandReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] CurrentDemandReq_isUsed: YES (7a ⇄ 7b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = CurrentDemandRequest;
+	}
+	//Welding Detection (9a ⇄ 9b)
+	else if (exi_doc_DIN->V2G_Message.Body.WeldingDetectionReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] WeldingDetectionReq_isUsed: YES (9a ⇄ 9b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = WeldingDetectionRequest;
+	}
+	//Session Stop (10a ⇄ 10b)
+	else if (exi_doc_DIN->V2G_Message.Body.SessionStopReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_DIN] SessionStopReq_isUsed: YES (10a ⇄ 10b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionStopRequest;
+	}
+	else
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]unidentified V2G_Rx_Msg\n");
+		errn = -1;
+	}
+
+	//Compare with the previous Message
+	if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre != EVCOMM_SYS_INFO.V2G_Rx_Msg)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[V2G_RX_MSG]%d >> %d\n",
+										EVCOMM_SYS_INFO.V2G_Rx_Msg_pre,
+										EVCOMM_SYS_INFO.V2G_Rx_Msg);
+		EVCOMM_SYS_INFO.V2G_Rx_Msg_pre = EVCOMM_SYS_INFO.V2G_Rx_Msg;
+	}
+
+	return errn;
+}
+
+/*===========================================================================
+FUNCTION: PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+			1. exi_doc_ISO1
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Check_V2G_Rx_Msg_Name_iso1(struct iso1EXIDocument *exi_doc_ISO1)
+{
+	int errn = 0;
+
+	//Session Setup (0a ⇄ 0b)
+	if (exi_doc_ISO1->V2G_Message.Body.SessionSetupReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] SessionSetupReq_isUsed: YES (0a ⇄ 0b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionSetupRequest;
+	}
+	//Service Discovery (1a ⇄ 1b)
+	else if (exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] ServiceDiscoveryReq_isUsed: YES (1a ⇄ 1b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceDiscoveryRequest;
+	}
+	//Service Detail
+	else if (exi_doc_ISO1->V2G_Message.Body.ServiceDetailReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] ServiceDetailReq_isUsed: YES\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceDetailRequest;
+	}
+	//Payment Service Selection (2a ⇄ 2b)
+	else if (exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] PaymentServiceSelectionReq_isUsed: YES (2a ⇄ 2b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceAndPaymentSelectionRequest;
+	}
+	//Payment Details
+	else if (exi_doc_ISO1->V2G_Message.Body.PaymentDetailsReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] PaymentDetailsReq_isUsed: YES\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = PaymentDetailsRequest;
+	}
+	//Authorization (Xa ⇄ Xb)
+	else if (exi_doc_ISO1->V2G_Message.Body.AuthorizationReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] AuthorizationReq_isUsed: YES (Xa ⇄ Xb)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = AuthorizationRequest;
+	}
+	//Certificate Update
+	else if (exi_doc_ISO1->V2G_Message.Body.CertificateUpdateReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] CertificateUpdateReq_isUsed: YES\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = CertificateUpdateRequest;
+	}
+	//Certificate Installation
+	else if (exi_doc_ISO1->V2G_Message.Body.CertificateInstallationReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] CertificateInstallationReq_isUsed: YES\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = CertificateInstallationRequest;
+	}
+	//Charge Parameter Discovery (3a ⇄ 3b)
+	else if (exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] ChargeParameterDiscoveryReq_isUsed: YES (3a ⇄ 3b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ChargeParameterDiscoveryRequest;
+	}
+	//Cable Check (4a ⇄ 4b)
+	else if (exi_doc_ISO1->V2G_Message.Body.CableCheckReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] CableCheckReq_isUsed: YES (4a ⇄ 4b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = CableCheckRequest;
+	}
+	//Precharge (5a ⇄ 5b)
+	else if (exi_doc_ISO1->V2G_Message.Body.PreChargeReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] PreChargeReq_isUsed: YES (5a ⇄ 5b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = PreChargeRequest;
+	}
+	//Power Delivery (6a ⇄ 6b)
+	else if (exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] PowerDeliveryReq_isUsed: YES (6a ⇄ 6b)\n");
+
+		//For DC
+		if (CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED)
+		{
+			if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre == PreChargeRequest)
+			{
+				EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStart;
+			}
+			else
+			{
+				EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStop;
+			}
+		}
+		//For AC
+		else if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+		{
+			if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre == ChargeParameterDiscoveryRequest)
+			{
+				EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStart;
+			}
+			else
+			{
+				EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStop;
+			}
+		}
+		else
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]unexpected CCS_ENERGY_TRANSFER_MODE(%d)\n", CCS_ENERGY_TRANSFER_MODE);
+			errn = -2;
+		}
+	}
+	//Current Demand (7a ⇄ 7b)
+	else if (exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] CurrentDemandReq_isUsed: YES (7a ⇄ 7b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = CurrentDemandRequest;
+	}
+	//Charging Status
+	else if (exi_doc_ISO1->V2G_Message.Body.ChargingStatusReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] ChargingStatusReq_isUsed: YES (7a ⇄ 7b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ChargingStatusRequest;
+	}
+	//Metering Receipt
+	else if (exi_doc_ISO1->V2G_Message.Body.MeteringReceiptReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] MeteringReceiptReq_isUsed: YES\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = MeteringReceiptRequest;
+	}
+	//Welding Detection (9a ⇄ 9b)
+	else if (exi_doc_ISO1->V2G_Message.Body.WeldingDetectionReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] WeldingDetectionReq_isUsed: YES (9a ⇄ 9b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = WeldingDetectionRequest;
+	}
+	//Session Stop (10a ⇄ 10b)
+	else if (exi_doc_ISO1->V2G_Message.Body.SessionStopReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO1] SessionStopReq_isUsed: YES (10a ⇄ 10b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionStopRequest;
+	}
+	else
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]unidentified V2G_Rx_Msg\n");
+		errn = -1;
+	}
+
+	//Compare with the previous Message
+	if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre != EVCOMM_SYS_INFO.V2G_Rx_Msg)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[V2G_RX_MSG]%d >> %d\n",
+										EVCOMM_SYS_INFO.V2G_Rx_Msg_pre,
+										EVCOMM_SYS_INFO.V2G_Rx_Msg);
+		EVCOMM_SYS_INFO.V2G_Rx_Msg_pre = EVCOMM_SYS_INFO.V2G_Rx_Msg;
+	}
+
+	return errn;
+}
+
+/*===========================================================================
+FUNCTION: PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+			1. exi_doc_ISO2
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Check_V2G_Rx_Msg_Name_iso2(struct iso2EXIDocument *exi_doc_ISO2)
+{
+	int errn = 0;
+
+	//V2GRequest_isUsed
+	if (exi_doc_ISO2->V2G_Message.Body.V2GRequest_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] V2GRequest_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//DisconnectChargingDeviceReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.DisconnectChargingDeviceReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] DisconnectChargingDeviceReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//ConnectChargingDeviceReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.ConnectChargingDeviceReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] ConnectChargingDeviceReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//SystemStatusReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.SystemStatusReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] SystemStatusReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//DC_BidirectionalControlReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.DC_BidirectionalControlReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] DC_BidirectionalControlReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//AC_BidirectionalControlReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.AC_BidirectionalControlReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] AC_BidirectionalControlReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//VehicleCheckOutReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.VehicleCheckOutReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] VehicleCheckOutReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//VehicleCheckInReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.VehicleCheckInReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] VehicleCheckInReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//PowerDemandReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.PowerDemandReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PowerDemandReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//PairingReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.PairingReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PairingReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//AlignmentCheckReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.AlignmentCheckReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] AlignmentCheckReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//FinePositioningReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.FinePositioningReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] FinePositioningReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//FinePositioningSetupReq_isUsed
+	else if (exi_doc_ISO2->V2G_Message.Body.FinePositioningSetupReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] FinePositioningSetupReq_isUsed: YES\n");
+		//EVCOMM_SYS_INFO.V2G_Rx_Msg = ;
+	}
+	//Session Setup (0a ⇄ 0b)
+	else if (exi_doc_ISO2->V2G_Message.Body.SessionSetupReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] SessionSetupReq_isUsed: YES (0a ⇄ 0b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionSetupRequest;
+	}
+	//Service Discovery (1a ⇄ 1b)
+	else if (exi_doc_ISO2->V2G_Message.Body.ServiceDiscoveryReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] ServiceDiscoveryReq_isUsed: YES (1a ⇄ 1b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceDiscoveryRequest;
+	}
+	//Service Detail
+	else if (exi_doc_ISO2->V2G_Message.Body.ServiceDetailReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] ServiceDetailReq_isUsed: YES\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceDetailRequest;
+	}
+	//Payment Service Selection (2a ⇄ 2b)
+	else if (exi_doc_ISO2->V2G_Message.Body.PaymentServiceSelectionReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PaymentServiceSelectionReq_isUsed: YES (2a ⇄ 2b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ServiceAndPaymentSelectionRequest;
+	}
+	//Payment Details
+	else if (exi_doc_ISO2->V2G_Message.Body.PaymentDetailsReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PaymentDetailsReq_isUsed: YES\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = PaymentDetailsRequest;
+	}
+	//Authorization (Xa ⇄ Xb)
+	else if (exi_doc_ISO2->V2G_Message.Body.AuthorizationReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] AuthorizationReq_isUsed: YES (Xa ⇄ Xb)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = AuthorizationRequest;
+	}
+	//Certificate Update
+	else if (exi_doc_ISO2->V2G_Message.Body.CertificateUpdateReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] CertificateUpdateReq_isUsed: YES\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = CertificateUpdateRequest;
+	}
+	//Certificate Installation
+	else if (exi_doc_ISO2->V2G_Message.Body.CertificateInstallationReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] CertificateInstallationReq_isUsed: YES\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = CertificateInstallationRequest;
+	}
+	//Charge Parameter Discovery (3a ⇄ 3b)
+	else if (exi_doc_ISO2->V2G_Message.Body.ChargeParameterDiscoveryReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] ChargeParameterDiscoveryReq_isUsed: YES (3a ⇄ 3b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ChargeParameterDiscoveryRequest;
+	}
+	//Cable Check (4a ⇄ 4b)
+	else if (exi_doc_ISO2->V2G_Message.Body.CableCheckReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] CableCheckReq_isUsed: YES (4a ⇄ 4b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = CableCheckRequest;
+	}
+	//Precharge (5a ⇄ 5b)
+	else if (exi_doc_ISO2->V2G_Message.Body.PreChargeReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PreChargeReq_isUsed: YES (5a ⇄ 5b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = PreChargeRequest;
+	}
+	//Power Delivery (6a ⇄ 6b)
+	else if (exi_doc_ISO2->V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] PowerDeliveryReq_isUsed: YES (6a ⇄ 6b)\n");
+
+		//For DC
+		if (CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED)
+		{
+			if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre == PreChargeRequest)
+			{
+				EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStart;
+			}
+			else
+			{
+				EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStop;
+			}
+		}
+		//For AC
+		else if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+		{
+			if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre == ChargeParameterDiscoveryRequest)
+			{
+				EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStart;
+			}
+			else
+			{
+				EVCOMM_SYS_INFO.V2G_Rx_Msg = PowerDeliveryRequestStop;
+			}
+		}
+		else
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]unexpected CCS_ENERGY_TRANSFER_MODE(%d)\n", CCS_ENERGY_TRANSFER_MODE);
+			errn = -2;
+		}
+	}
+	//Current Demand (7a ⇄ 7b)
+	else if (exi_doc_ISO2->V2G_Message.Body.CurrentDemandReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] CurrentDemandReq_isUsed: YES (7a ⇄ 7b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = CurrentDemandRequest;
+	}
+	//Charging Status
+	else if (exi_doc_ISO2->V2G_Message.Body.ChargingStatusReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] ChargingStatusReq_isUsed: YES (7a ⇄ 7b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = ChargingStatusRequest;
+	}
+	//Metering Receipt
+	else if (exi_doc_ISO2->V2G_Message.Body.MeteringReceiptReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] MeteringReceiptReq_isUsed: YES\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = MeteringReceiptRequest;
+	}
+	//Welding Detection (9a ⇄ 9b)
+	else if (exi_doc_ISO2->V2G_Message.Body.WeldingDetectionReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] WeldingDetectionReq_isUsed: YES (9a ⇄ 9b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = WeldingDetectionRequest;
+	}
+	//Session Stop (10a ⇄ 10b)
+	else if (exi_doc_ISO2->V2G_Message.Body.SessionStopReq_isUsed == 1u)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][PRINT_V2GTP_MSG_RX_REQUEST_NAME_ISO2] SessionStopReq_isUsed: YES (10a ⇄ 10b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionStopRequest;
+	}
+	else
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]unidentified V2G_Rx_Msg\n");
+		errn = -1;
+	}
+
+	//Compare with the previous Message
+	if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre != EVCOMM_SYS_INFO.V2G_Rx_Msg)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[V2G_RX_MSG]%d >> %d\n",
+										EVCOMM_SYS_INFO.V2G_Rx_Msg_pre,
+										EVCOMM_SYS_INFO.V2G_Rx_Msg);
+		EVCOMM_SYS_INFO.V2G_Rx_Msg_pre = EVCOMM_SYS_INFO.V2G_Rx_Msg;
+	}
+
+	return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: SAVE_PhysicalValueType_DIN70121
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SAVE_PhysicalValueType_DIN70121(struct PhysicalValueType_DIN70121 *out, int in_value, unsigned char unit)
+{
+    out->Value = in_value;
+    out->Unit = unit;
+
+    switch (unit)
+    {
+        case H_DIN70121:
+        case M_DIN70121:
+        case S_DIN70121:
+        case A_DIN70121:
+        case V_DIN70121:
+        case AH_DIN70121:
+        case VA_DIN70121:
+            out->Multiplier = -1;
+            break;    //KW
+
+        case W_DIN70121:
+        case WH_DIN70121:
+			out->Value = in_value * 10;
+            out->Multiplier = 1;
+            break;    //KWh
+    }
+    //H_DIN70121 = 0,
+    //M_DIN70121 = 1,
+    //S_DIN70121 = 2,
+    //A_DIN70121 = 3,
+    //AH_DIN70121 = 4,
+    //V_DIN70121 = 5,
+    //VA_DIN70121 = 6,
+    //W_DIN70121 = 7,
+    //WS_DIN70121 = 8,
+    //WH_DIN70121 = 9};
+}
+
+/*===========================================================================
+FUNCTION: SAVE_PhysicalValueType_ISO15118_2014
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SAVE_PhysicalValueType_ISO15118_2014(struct PhysicalValueType_ISO15118_2014 *out, int in_value, unsigned char unit)
+{
+    out->Value = in_value;
+    out->Unit = unit;
+
+    switch (unit)
+    {
+        case h_ISO15118_2014:
+        case m_ISO15118_2014:
+        case s_ISO15118_2014:
+        case A_ISO15118_2014:
+        case V_ISO15118_2014:
+            out->Multiplier = -1;
+            break;    //KW
+
+        case W_ISO15118_2014:
+        case Wh_ISO15118_2014:
+			out->Value = in_value * 10;
+            out->Multiplier = 1;
+            break;    //KWh
+    }
+    //H_DIN70121 = 0,
+    //M_DIN70121 = 1,
+    //S_DIN70121 = 2,
+    //A_DIN70121 = 3,
+    //AH_DIN70121 = 4,
+    //V_DIN70121 = 5,
+    //VA_DIN70121 = 6,
+    //W_DIN70121 = 7,
+    //WS_DIN70121 = 8,
+    //WH_DIN70121 = 9};
+}
+
+
+/*===========================================================================
+FUNCTION: DIN70121PhyValDecode
+DESCRIPTION:
+        Output Unit: 1V, 1A, 1S, etc.
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+float DIN70121PhyValDecode(struct PhysicalValueType_DIN70121 PhysicalData)
+{
+    short DataValue;
+    int DataMultiplier;
+    float Rtn;
+
+    DataValue = PhysicalData.Value;
+    DataMultiplier = PhysicalData.Multiplier;
+
+    switch(PhysicalData.Unit)
+    {
+        case H_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier) * 60 * 60);
+            return Rtn;
+
+        case M_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier) * 60);
+            return Rtn;
+
+        case S_DIN70121:
+        case A_DIN70121:
+        case V_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier));
+            return Rtn;     //S, A, V
+
+        case AH_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier));
+            return Rtn;
+
+        case VA_DIN70121:
+        case W_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;
+            return Rtn;    //kW
+
+        case WS_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;    //[Joseph] TBD
+            return Rtn;
+
+        case WH_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;
+            return Rtn;    //kWh
+    }
+}
+
+/*===========================================================================
+FUNCTION: ISO151182014PhyValDecode
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+float ISO151182014PhyValDecode(struct PhysicalValueType_ISO15118_2014 PhysicalData)
+{
+    short DataValue;
+    int DataMultiplier;
+    float Rtn;
+
+    DataValue = PhysicalData.Value;
+    DataMultiplier = PhysicalData.Multiplier;
+
+    switch(PhysicalData.Unit)
+    {
+        case h_ISO15118_2014:
+            Rtn = (DataValue * pow(10, DataMultiplier) * 60 * 60);
+            return Rtn;
+
+        case m_ISO15118_2014:
+            Rtn = (DataValue * pow(10, DataMultiplier) * 60);
+            return Rtn;
+
+        case s_ISO15118_2014:
+        case A_ISO15118_2014:
+        case V_ISO15118_2014:
+            Rtn = (DataValue * pow(10, DataMultiplier));
+            return Rtn;
+
+        case W_ISO15118_2014:
+            Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;
+            return Rtn;    //kW
+
+        case Wh_ISO15118_2014:
+            Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;
+            return Rtn;    //kWh
+    }
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Read_dinPhysicalValueType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. in
+OUTPUT:
+		2. out
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_dinPhysicalValueType(struct dinPhysicalValueType *out, struct PhysicalValueType_DIN70121 *in)
+{
+	out->Value = (short) in->Value;
+	out->Multiplier = (char) in->Multiplier;
+	out->Unit_isUsed = 1u;	//[CAUTION] Remember to put Uinit, since here we set it as 1 as default.
+	out->Unit = (unsigned char) in->Unit;
+	//	dinunitSymbolType_h = 0,
+	//	dinunitSymbolType_m = 1,
+	//	dinunitSymbolType_s = 2,
+	//	dinunitSymbolType_A = 3,
+	//	dinunitSymbolType_Ah = 4,
+	//	dinunitSymbolType_V = 5,
+	//	dinunitSymbolType_VA = 6,
+	//	dinunitSymbolType_W = 7,
+	//	dinunitSymbolType_W_s = 8,
+	//	dinunitSymbolType_Wh = 9
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1PhysicalValueType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. in
+OUTPUT:
+		2. out
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1PhysicalValueType(struct iso1PhysicalValueType *out, struct PhysicalValueType_ISO15118_2014 *in)
+{
+	out->Value = (short) in->Value;
+	out->Multiplier = (char) in->Multiplier;
+	//out->Unit_isUsed = 1u;	//[CAUTION] Remember to put Uinit, since here we set it as 1 as default.
+	out->Unit = (unsigned char) in->Unit;
+	//iso1unitSymbolType_h = 0,
+	//iso1unitSymbolType_m = 1,
+	//iso1unitSymbolType_s = 2,
+	//iso1unitSymbolType_A = 3,
+	//iso1unitSymbolType_V = 4,
+	//iso1unitSymbolType_W = 5,
+	//iso1unitSymbolType_Wh = 6
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Read_dinDC_EVSEStatusType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. in
+OUTPUT:
+		2. out
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_dinDC_EVSEStatusType(struct dinDC_EVSEStatusType *out, struct DC_EVSEStatusType_DIN70121 *in)
+{
+	out->EVSEIsolationStatus_isUsed = 1u;
+	out->EVSEIsolationStatus = (unsigned char) in->EVSEIsolationStatus;
+	//	dinisolationLevelType_Invalid = 0, (default)
+	//	dinisolationLevelType_Valid = 1,
+	//	dinisolationLevelType_Warning = 2,
+	//	dinisolationLevelType_Fault = 3
+
+	out->EVSEStatusCode = (unsigned char) in->EVSEStatusCode;
+	// dinDC_EVSEStatusCodeType_EVSE_NotReady = 0,
+	// dinDC_EVSEStatusCodeType_EVSE_Ready = 1, (default)
+	// dinDC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+	// dinDC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+	// dinDC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+	// dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+	// dinDC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+	// dinDC_EVSEStatusCodeType_Reserved_8 = 7,
+	// dinDC_EVSEStatusCodeType_Reserved_9 = 8,
+	// dinDC_EVSEStatusCodeType_Reserved_A = 9,
+	// dinDC_EVSEStatusCodeType_Reserved_B = 10,
+	// dinDC_EVSEStatusCodeType_Reserved_C = 11
+
+	out->NotificationMaxDelay = 0u;
+
+	out->EVSENotification = (unsigned char) in->EVSENotification;
+	// dinEVSENotificationType_None = 0, (default)
+	// dinEVSENotificationType_StopCharging = 1,
+	// dinEVSENotificationType_ReNegotiation = 2
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1DC_EVSEStatusType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. in
+OUTPUT:
+		2. out
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1DC_EVSEStatusType(struct iso1DC_EVSEStatusType *out, struct DC_EVSEStatusType_ISO15118_2014 *in)
+{
+	out->EVSEIsolationStatus_isUsed = 1u;
+	out->EVSEIsolationStatus = (unsigned char) in->EVSEIsolationStatus;
+	//iso1isolationLevelType_Invalid = 0,
+	//iso1isolationLevelType_Valid = 1,
+	//iso1isolationLevelType_Warning = 2,
+	//iso1isolationLevelType_Fault = 3,
+	//iso1isolationLevelType_No_IMD = 4
+
+	out->EVSEStatusCode = (unsigned char) in->DC_EVSEStatusCode;
+	//iso1DC_EVSEStatusCodeType_EVSE_NotReady = 0,
+	//iso1DC_EVSEStatusCodeType_EVSE_Ready = 1,
+	//iso1DC_EVSEStatusCodeType_EVSE_Shutdown = 2,
+	//iso1DC_EVSEStatusCodeType_EVSE_UtilityInterruptEvent = 3,
+	//iso1DC_EVSEStatusCodeType_EVSE_IsolationMonitoringActive = 4,
+	//iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown = 5,
+	//iso1DC_EVSEStatusCodeType_EVSE_Malfunction = 6,
+	//iso1DC_EVSEStatusCodeType_Reserved_8 = 7,
+	//iso1DC_EVSEStatusCodeType_Reserved_9 = 8,
+	//iso1DC_EVSEStatusCodeType_Reserved_A = 9,
+	//iso1DC_EVSEStatusCodeType_Reserved_B = 10,
+	//iso1DC_EVSEStatusCodeType_Reserved_C = 11
+
+	out->NotificationMaxDelay = 0u;
+
+	out->EVSENotification = (unsigned char) in->EVSENotification;
+	//iso1EVSENotificationType_None = 0, (default)
+	//iso1EVSENotificationType_StopCharging = 1,
+	//iso1EVSENotificationType_ReNegotiation = 2
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1AC_EVSEStatusType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. in
+OUTPUT:
+		2. out
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1AC_EVSEStatusType(struct iso1AC_EVSEStatusType *out, struct AC_EVSEStatusType_ISO15118_2014 *in)
+{
+	out->RCD = (int)in->RCD;	
+	//0: no error is detected
+	//1: an error is detected
+
+	out->NotificationMaxDelay = (unsigned short)in->NotificationMaxDelay;	
+	//unit: 1s
+	//The time SECC expects EVCC to perform EVSENotification
+
+	out->EVSENotification = (unsigned char)in->EVSENotification;
+	//iso1EVSENotificationType_None = 0,
+	//iso1EVSENotificationType_StopCharging = 1,
+	//iso1EVSENotificationType_ReNegotiation = 2
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1MeterInfo
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. in
+OUTPUT:
+		2. out
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1MeterInfo(struct iso1MeterInfoType *out, struct MeterInfoType_ISO15118_2014 *in)
+{
+	int i = 0;
+
+	//[1/5] MeterID
+	out->MeterID.charactersLen = 32;
+	for (i = 0; i < out->MeterID.charactersLen; i++)
+	{
+		out->MeterID.characters[i] = (unsigned char)in->MeterID[i];
+	}
+
+	//[2/5] MeterReading
+	out->MeterReading_isUsed = 1u;
+	out->MeterReading = (unsigned long)in->MeterReading;
+
+	//[3/5] SigMeterReading
+	out->SigMeterReading_isUsed = 1u;
+	out->SigMeterReading.bytesLen = 64;
+	for (i = 0; i < out->SigMeterReading.bytesLen; i++)
+	{
+		out->SigMeterReading.bytes[i] = (unsigned char)in->SigMeterReading[i];
+	}
+
+	//[4/5] MeterStatus
+	out->MeterStatus_isUsed = 1u;
+	out->MeterStatus = (short)in->MeterStatus;
+
+	//[5/5] TMeter
+	out->TMeter_isUsed = 1u;
+	out->TMeter = (long)in->TMeter;		//[CAUTION] data type
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_supportedAppProtocolReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_supportedAppProtocolReq(struct CcsData *shm_ccs, struct appHandEXIDocument *buf, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    int j = 0;
+    struct SupportedAppProtocolRequest_DIN70121 *shm_msg;
+    struct appHandAnonType_supportedAppProtocolReq *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.SupportedAppProtocolRequest;
+    exi = &buf->supportedAppProtocolReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    for (i = 0; i < exi->AppProtocol.arrayLen ; i++)
+    {
+        //ProtocolNamespace
+        shm_msg->AppProtocol[i].ProtocolNamespaceLen = (unsigned int) exi->AppProtocol.array[i].ProtocolNamespace.charactersLen;
+
+        for (j = 0; j< shm_msg->AppProtocol[i].ProtocolNamespaceLen; j++)
+        {
+            shm_msg->AppProtocol[i].ProtocolNamespace[j] = (unsigned char) exi->AppProtocol.array[i].ProtocolNamespace.characters[j];
+        }
+
+        //Version (Major, Minor)
+        shm_msg->AppProtocol[i].VersionNumberMajor = (unsigned int) exi->AppProtocol.array[i].VersionNumberMajor;
+        shm_msg->AppProtocol[i].VersionNumberMinor = (unsigned int) exi->AppProtocol.array[i].VersionNumberMinor;
+
+        //SchemaID
+        shm_msg->AppProtocol[i].SchemaID = (unsigned char) exi->AppProtocol.array[i].SchemaID;
+
+        //Priority
+        shm_msg->AppProtocol[i].Priority = (unsigned char) exi->AppProtocol.array[i].Priority;
+    }
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_SessionSetupReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct SessionSetupRequest_DIN70121 *shm_msg;
+    struct dinSessionSetupReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.SessionSetupRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.SessionSetupReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//EVCCID Length
+	EVCOMM_SYS_INFO.EVCCID_length = (unsigned char)exi->EVCCID.bytesLen;
+	//EVCCID
+	for (i = 0; i < exi->EVCCID.bytesLen; i++)
+	{
+		shm_msg->EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+		EVCOMM_SYS_INFO.EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+	}
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_SessionSetupReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct SessionSetupRequest_ISO15118_2014 *shm_msg;
+    struct iso1SessionSetupReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.SessionSetupRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.SessionSetupReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//EVCCID Length
+	EVCOMM_SYS_INFO.EVCCID_length = (unsigned char)exi->EVCCID.bytesLen;
+
+	//EVCCID
+	for (i = 0; i < exi->EVCCID.bytesLen; i++)
+	{
+		shm_msg->EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+		EVCOMM_SYS_INFO.EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+	}
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso2_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso2_SessionSetupReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct SessionSetupRequest_ISO15118_2018 *shm_msg;
+    struct iso2SessionSetupReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2018.SessionSetupRequest;
+    exi = &exi_doc_ISO2->V2G_Message.Body.SessionSetupReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//EVCCID Length
+	EVCOMM_SYS_INFO.EVCCID_length = (unsigned char)exi->EVCCID.bytesLen;
+
+
+	//EVCCID
+	for (i = 0; i < exi->EVCCID.bytesLen; i++)
+	{
+		shm_msg->EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+		EVCOMM_SYS_INFO.EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+	}
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_ServiceDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_ServiceDiscoveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ServiceDiscoveryRequest_DIN70121 *shm_msg;
+    struct dinServiceDiscoveryReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.ServiceDiscoveryRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//ServiceScope
+	shm_msg->ServiceScopeLen = (unsigned int) exi->ServiceScope.charactersLen;
+    for (i = 0; i <shm_msg->ServiceScopeLen ; i++)
+    {
+        shm_msg->ServiceScope[i] = (unsigned char) exi->ServiceScope.characters[i];
+    }
+
+    //ServiceCategory
+    shm_msg->ServiceCategory = (unsigned int) exi->ServiceCategory;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_ServiceDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_ServiceDiscoveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ServiceDiscoveryRequest_ISO15118_2014 *shm_msg;
+    struct iso1ServiceDiscoveryReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ServiceDiscoveryRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+	//ServiceScope
+	shm_msg->ServiceScopeLen = (unsigned int) exi->ServiceScope.charactersLen;
+    for (i = 0; i <shm_msg->ServiceScopeLen ; i++)
+    {
+        shm_msg->ServiceScope[i] = (unsigned char) exi->ServiceScope.characters[i];
+    }
+
+    //ServiceCategory
+    shm_msg->ServiceCategory = (unsigned int) exi->ServiceCategory;
+}
+
+
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_ServiceAndPaymentSelectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ServiceAndPaymentSelectionRequest_DIN70121 *shm_msg;
+    struct dinServicePaymentSelectionReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.ServiceAndPaymentSelectionRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//[1/2] SelectedPaymentOption
+	shm_msg->SelectedPaymentOption = (unsigned char) exi->SelectedPaymentOption;
+
+	//[2/2] SelectedServiceList
+    shm_msg->SelectedServiceList.SelectedServiceLen = (unsigned int) exi->SelectedServiceList.SelectedService.arrayLen;
+    for (i = 0; i< shm_msg->SelectedServiceList.SelectedServiceLen; i++)
+    {
+        shm_msg->SelectedServiceList.SelectedService[i].ServiceID =
+				(unsigned short) exi->SelectedServiceList.SelectedService.array[i].ServiceID;
+
+        shm_msg->SelectedServiceList.SelectedService[i].ParameterSetID =
+				(short) exi->SelectedServiceList.SelectedService.array[i].ParameterSetID;
+    }
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_ServiceAndPaymentSelectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ServiceAndPaymentSelectionRequest_ISO15118_2014 *shm_msg;
+    struct iso1PaymentServiceSelectionReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ServiceAndPaymentSelectionRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+	//[1/2] SelectedPaymentOption
+	shm_msg->SelectedPaymentOption = (unsigned char) exi->SelectedPaymentOption;
+
+	//[2/2] SelectedServiceList
+    shm_msg->SelectedServiceList.SelectedServiceLen = (unsigned int) exi->SelectedServiceList.SelectedService.arrayLen;
+    for (i = 0; i< shm_msg->SelectedServiceList.SelectedServiceLen; i++)
+    {
+        shm_msg->SelectedServiceList.SelectedService[i].ServiceID =
+				(unsigned short) exi->SelectedServiceList.SelectedService.array[i].ServiceID;
+
+        shm_msg->SelectedServiceList.SelectedService[i].ParameterSetID =
+				(short) exi->SelectedServiceList.SelectedService.array[i].ParameterSetID;
+    }
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_ContractAuthenticationReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_ContractAuthenticationReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ContractAuthenticationRequest_DIN70121 *shm_msg;
+    struct dinContractAuthenticationReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.ContractAuthenticationRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//none
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_AuthorizationReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_AuthorizationReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct AuthorizationRequest_ISO15118_2014 *shm_msg;
+    struct iso1AuthorizationReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.AuthorizationRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.AuthorizationReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+	//none
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_ChargeParameterDiscoveryReq
+DESCRIPTION: Save into share memories
+			(1) ShmCcsData (shm_ccs)
+			(2) ShmSysConfigAndInfo (shm_sys)
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ChargeParameterDiscoveryRequest_DIN70121 *shm_msg;
+    struct dinChargeParameterDiscoveryReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//===== [BODY (1/9)] EVRequestedEnergyTransferType =====
+	shm_msg->EVRequestedEnergyTransferType = (unsigned char) exi->EVRequestedEnergyTransferType;
+
+	//===== [BODY (2/9)] DC_EVChargeParameter of EVChargeParameter =====
+    //DC_EVStatus
+    shm_msg->DC_EVChargeParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVReady;
+	shm_msg->DC_EVChargeParameter.DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVChargeParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
+
+    //[BODY (3/9)] EVMaximumCurrentLimit
+    shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier;
+	//shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit;
+	shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = A_DIN70121;
+	shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Value =
+			(short) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Value;
+	sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit);
+
+    //[BODY (4/9)] EVMaximumPowerLimit
+	shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier;
+	//shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Unit;
+	shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = W_DIN70121;
+	shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Value =
+			(short) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Value;
+	sys->EvBatteryMaxPower = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit);
+
+    //[BODY (5/9)] EVMaximumVoltageLimit
+	shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier;
+	//shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit;
+	shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = V_DIN70121;
+	shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Value =
+			(short) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Value;
+	sys->EvBatteryMaxVoltage = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit);
+
+    //[BODY (6/9)] EVEnergyCapacity
+	shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVEnergyCapacity.Multiplier;
+	shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Unit = WH_DIN70121;
+	shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Value =
+			(short) exi->DC_EVChargeParameter.EVEnergyCapacity.Value;
+	sys->EvBatteryCapacity = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyCapacity);
+
+    //[BODY (7/9)] EVEnergyRequest
+	shm_msg->DC_EVChargeParameter.EVEnergyRequest.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVEnergyRequest.Multiplier;
+	shm_msg->DC_EVChargeParameter.EVEnergyRequest.Unit = WH_DIN70121;
+	shm_msg->DC_EVChargeParameter.EVEnergyRequest.Value =
+			(short) exi->DC_EVChargeParameter.EVEnergyRequest.Value;
+	sys->EvBatteryEngergyRequest = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyRequest);
+
+    //[BODY (8/9)] FullSOC
+	if (exi->DC_EVChargeParameter.FullSOC_isUsed != 0 && exi->DC_EVChargeParameter.FullSOC != 0)
+	{
+		shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.FullSOC;
+	}
+	else
+	{
+		shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
+	}
+
+    //[BODY (9/9)] BulkSOC
+    shm_msg->DC_EVChargeParameter.BulkSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_ChargeParameterDiscoveryReq
+DESCRIPTION: Save into share memories
+			(1) ShmCcsData (shm_ccs)
+			(2) ShmSysConfigAndInfo (shm_sys)
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ChargeParameterDiscoveryRequest_ISO15118_2014 *shm_msg;
+    struct iso1ChargeParameterDiscoveryReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+	//===== [BODY (1/9)] EVRequestedEnergyTransferType =====
+	shm_msg->RequestedEnergyTransferMode = (unsigned char) exi->RequestedEnergyTransferMode;
+
+	//===== [BODY (2/9)] DC_EVChargeParameter of EVChargeParameter =====
+    //DC_EVStatus
+    shm_msg->DC_EVChargeParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVReady;
+	shm_msg->DC_EVChargeParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
+
+    //[BODY (3/9)] EVMaximumCurrentLimit
+    shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier;
+	//shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit;
+	shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = A_ISO15118_2014;
+	shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Value =
+			(short) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Value;
+	sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit);
+
+    //[BODY (4/9)] EVMaximumPowerLimit
+	shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier;
+	//shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Unit;
+	shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = W_ISO15118_2014;
+	shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Value =
+			(short) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Value;
+	sys->EvBatteryMaxPower = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit);
+
+    //[BODY (5/9)] EVMaximumVoltageLimit
+	shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier;
+	//shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit;
+	shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = V_ISO15118_2014;
+	shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Value =
+			(short) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Value;
+	sys->EvBatteryMaxVoltage = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit);
+
+    //[BODY (6/9)] EVEnergyCapacity
+	shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVEnergyCapacity.Multiplier;
+	shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Unit = Wh_ISO15118_2014;
+	shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Value =
+			(short) exi->DC_EVChargeParameter.EVEnergyCapacity.Value;
+	sys->EvBatteryCapacity = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyCapacity);
+
+    //[BODY (7/9)] EVEnergyRequest
+	shm_msg->DC_EVChargeParameter.EVEnergyRequest.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVEnergyRequest.Multiplier;
+	shm_msg->DC_EVChargeParameter.EVEnergyRequest.Unit = Wh_ISO15118_2014;
+	shm_msg->DC_EVChargeParameter.EVEnergyRequest.Value =
+			(short) exi->DC_EVChargeParameter.EVEnergyRequest.Value;
+	sys->EvBatteryEngergyRequest = ISO151182014PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyRequest);
+
+    //[BODY (8/9)] FullSOC
+	if (exi->DC_EVChargeParameter.FullSOC_isUsed != 0 && exi->DC_EVChargeParameter.FullSOC != 0)
+	{
+		shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.FullSOC;
+	}
+	else
+	{
+		shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
+	}
+
+    //[BODY (9/9)] BulkSOC
+    shm_msg->DC_EVChargeParameter.BulkSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_CableCheckReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_CableCheckReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    struct CableCheckRequest_DIN70121 *shm_msg;
+    struct dinCableCheckReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.CableCheckRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.CableCheckReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/1)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+	//Check for EVReady
+	//if (shm_msg->DC_EVStatus.EVReady == TRUE && shm_msg->DC_EVStatus.EVErrorCode == NO_ERROR)
+	//{
+		//sys->ConnectorLocked = TRUE;    //Inicating EVSE that the CCS Connector is Locked.
+	//}
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_CableCheckReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_CableCheckReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    struct CableCheckRequest_ISO15118_2014 *shm_msg;
+    struct iso1CableCheckReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.CableCheckRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.CableCheckReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/1)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+	//Check for EVReady
+	//if (shm_msg->DC_EVStatus.EVReady == TRUE && shm_msg->DC_EVStatus.EVErrorCode == NO_ERROR)
+	//{
+		//sys->ConnectorLocked = TRUE;    //Inicating EVSE that the CCS Connector is Locked.
+	//}
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_PreChargeReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_PreChargeReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    struct PreChargeRequest_DIN70121 *shm_msg;
+    struct dinPreChargeReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.PreChargeRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.PreChargeReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+	shm_msg->cnt++;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/3)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+	//[BODY (2/3)] EVTargetVoltage
+    shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
+	//shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
+	shm_msg->EVTargetVoltage.Unit = V_DIN70121;
+	shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
+	if ((sys->EVSEPrechargeStatus == EVSE_STATUS_NOT_READY_FOR_PRECHARGE) || (shm_msg->cnt <= 2)) //0
+	{
+		sys->EvBatterytargetVoltage = 0;	//0V, in order to avoid of turning off relay when D+/D- owns voltage.
+	}
+	else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
+	{
+		sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage);
+		//sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + 5;	//for test, add 10V
+	}
+
+	//[BODY (3/3)] EVTargetCurrent
+    shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
+	//shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
+	shm_msg->EVTargetCurrent.Unit = A_DIN70121;
+	shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
+	if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
+	{
+		//sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
+		sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT;	//for EVSE (default: 2A)
+	}
+	else
+	{
+		sys->EvBatterytargetCurrent = 0;	//0A
+	}
+	//printf("\n\n[%d-th]sys-EvBatterytargetVoltage = %.02f (ori = %d)\n\n", cnt, sys->EvBatterytargetVoltage, shm_msg->EVTargetVoltage.Value);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_PreChargeReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_PreChargeReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    struct PreChargeRequest_ISO15118_2014 *shm_msg;
+    struct iso1PreChargeReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.PreChargeRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+	shm_msg->cnt++;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/3)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+	//[BODY (2/3)] EVTargetVoltage
+    shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
+	//shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
+	shm_msg->EVTargetVoltage.Unit = V_ISO15118_2014;
+	shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
+	if ((sys->EVSEPrechargeStatus == EVSE_STATUS_NOT_READY_FOR_PRECHARGE) || (shm_msg->cnt <= 2)) //0
+	{
+		sys->EvBatterytargetVoltage = 0;	//0V, in order to avoid of turning off relay when D+/D- owns voltage.
+	}
+	else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
+	{
+		sys->EvBatterytargetVoltage = ISO151182014PhyValDecode(shm_msg->EVTargetVoltage);
+	}
+
+	//[BODY (3/3)] EVTargetCurrent
+    shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
+	//shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
+	shm_msg->EVTargetCurrent.Unit = A_ISO15118_2014;
+	shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
+	if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
+	{
+		//sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
+		sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT;	//for EVSE (default: 2A)
+	}
+	else
+	{
+		sys->EvBatterytargetCurrent = 0;	//0A
+	}
+	//printf("\n\n[%d-th]sys-EvBatterytargetVoltage = %.02f (ori = %d)\n\n", cnt, sys->EvBatterytargetVoltage, shm_msg->EVTargetVoltage.Value);
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_PowerDeliveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_PowerDeliveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct PowerDeliveryRequest_DIN70121 *shm_msg;
+    struct dinPowerDeliveryReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.PowerDeliveryRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+
+	//[BODY (1/3)] ReadyToChargeState
+	shm_msg->ReadyToChargeState = (BOOL) exi->ReadyToChargeState;
+
+	//[BODY (2/3)] ChargingProfile
+
+	//[BODY (3/3)] DC_EVPowerDeliveryParameters
+	//DC_EVStatus
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
+
+	//BulkChargingComplete
+	shm_msg->DC_EVPowerDeliveryParameter.BulkChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.BulkChargingComplete;
+
+	//ChargingComplete
+	shm_msg->DC_EVPowerDeliveryParameter.ChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.ChargingComplete;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_PowerDeliveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_PowerDeliveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct PowerDeliveryRequest_ISO15118_2014 *shm_msg;
+    struct iso1PowerDeliveryReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.PowerDeliveryRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+
+	//[BODY (1/3)] ChargeProgress
+	shm_msg->ChargeProgress = (BOOL) exi->ChargeProgress;
+
+	//[BODY (2/3)] ChargingProfile
+
+	//[BODY (3/3)] DC_EVPowerDeliveryParameters
+	//DC_EVStatus
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
+
+	//BulkChargingComplete
+	shm_msg->DC_EVPowerDeliveryParameter.BulkChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.BulkChargingComplete;
+
+	//ChargingComplete
+	shm_msg->DC_EVPowerDeliveryParameter.ChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.ChargingComplete;
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_CurrentDemandReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_CurrentDemandReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct CurrentDemandRequest_DIN70121 *shm_msg;
+    struct dinCurrentDemandReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.CurrentDemandRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+    //[BODY (1/10)] DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+    //[BODY (2/10)] EVTargetCurrent
+    shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
+	//shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
+	shm_msg->EVTargetCurrent.Unit = A_DIN70121;
+	shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
+	if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_ENERGY_TRANSFER) //3 (Precharge Relay OFF, DC+ Relay ON)
+	{
+		sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
+
+		#if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
+		sys->EvBatterytargetCurrent = SUDO_EV_TARGET_CURRENT; //60A, for test;
+		#endif
+	}
+	else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2 (Precharge Relay ON, DC+ Relay OFF)
+	{
+		//sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT;	//2A, unit: 1A
+		sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
+	}
+	else	//0 (Precharge Relay is still under preparing, not ON, yet.)
+	{
+		//sys->EvBatterytargetCurrent = 0;	//0A
+		sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
+	}
+
+	//[BODY (3/10)] EVMaximumVoltageLimit
+    shm_msg->EVMaximumVoltageLimit.Multiplier = (int) exi->EVMaximumVoltageLimit.Multiplier;
+	//shm_msg->EVMaximumVoltageLimit.Unit = (unsigned char) exi->EVMaximumVoltageLimit.Unit;
+	shm_msg->EVMaximumVoltageLimit.Unit = V_DIN70121;
+	shm_msg->EVMaximumVoltageLimit.Value = (short) exi->EVMaximumVoltageLimit.Value;
+	if (shm_msg->EVMaximumVoltageLimit.Value != 0 && exi->EVMaximumVoltageLimit_isUsed == 1u)	//Gridwiz EVCC Emulator will not send EVMaximumVoltageLimit in CurrentDemandReq
+	{
+		sys->EvBatteryMaxVoltage = DIN70121PhyValDecode(shm_msg->EVMaximumVoltageLimit);
+	}
+
+	//[BODY (4/10)] EVMaximumCurrentLimit
+    shm_msg->EVMaximumCurrentLimit.Multiplier = (int) exi->EVMaximumCurrentLimit.Multiplier;
+	//shm_msg->EVMaximumCurrentLimit.Unit = (unsigned char) exi->EVMaximumCurrentLimit.Unit;
+	shm_msg->EVMaximumCurrentLimit.Unit = A_DIN70121;
+	shm_msg->EVMaximumCurrentLimit.Value = (short) exi->EVMaximumCurrentLimit.Value;
+	sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->EVMaximumCurrentLimit);
+
+	//[BODY (5/10)] EVMaximumPowerLimit
+    shm_msg->EVMaximumPowerLimit.Multiplier = (int) exi->EVMaximumPowerLimit.Multiplier;
+	//shm_msg->EVMaximumPowerLimit.Unit = (unsigned char) exi->EVMaximumPowerLimit.Unit;
+	shm_msg->EVMaximumPowerLimit.Unit = W_DIN70121;
+	shm_msg->EVMaximumPowerLimit.Value = (short) exi->EVMaximumPowerLimit.Value;
+	sys->EvBatteryMaxPower = DIN70121PhyValDecode(shm_msg->EVMaximumPowerLimit);
+
+    //[BODY (6/10)] BulkChargingComplete
+	shm_msg->BulkChargingComplete = (BOOL) exi->BulkChargingComplete;
+
+    //[BODY (7/10)] ChargingComplete
+    shm_msg->ChargingComplete = (BOOL) exi->ChargingComplete;
+
+	//[BODY (8/10)] RemainingTimeToFullSoC
+	shm_msg->RemainingTimeToFullSoC.Multiplier = (int) exi->RemainingTimeToFullSoC.Multiplier;
+	shm_msg->RemainingTimeToFullSoC.Unit = (unsigned char) exi->RemainingTimeToFullSoC.Unit;
+	shm_msg->RemainingTimeToFullSoC.Value = (short) exi->RemainingTimeToFullSoC.Value;
+	sys->RemainChargingDuration = DIN70121PhyValDecode(shm_msg->RemainingTimeToFullSoC);
+
+	//[BODY (9/10)] RemainingTimeToBulkSoC
+	shm_msg->RemainingTimeToBulkSoC.Multiplier = (int) exi->RemainingTimeToBulkSoC.Multiplier;
+	shm_msg->RemainingTimeToBulkSoC.Unit = (unsigned char) exi->RemainingTimeToBulkSoC.Unit;
+	shm_msg->RemainingTimeToBulkSoC.Value = (short) exi->RemainingTimeToBulkSoC.Value;
+
+	//[BODY (10/10)] EVTargetVoltage
+	shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
+	//shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
+	shm_msg->EVTargetVoltage.Unit = V_DIN70121;
+	shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
+	if((shm_msg->EVTargetVoltage.Value != 0) && (sys->EvBatteryMaxVoltage != 0))
+	{
+		sys->EvBatterytargetVoltage = (DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
+	}
+	else
+	{
+		sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage);
+	}
+
+	#if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
+	sys->EvBatterytargetVoltage = SUDO_EV_TARGET_VOLTAGE;	//for test (500V, unit: 1V)
+	#endif
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_CurrentDemandReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_CurrentDemandReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct CurrentDemandRequest_ISO15118_2014 *shm_msg;
+    struct iso1CurrentDemandReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.CurrentDemandRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+    //[BODY (1/10)] DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+    //[BODY (2/10)] EVTargetCurrent
+    shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
+	//shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
+	shm_msg->EVTargetCurrent.Unit = A_ISO15118_2014;
+	shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
+	if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_ENERGY_TRANSFER) //3 (Precharge Relay OFF, DC+ Relay ON)
+	{
+		sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
+
+		#if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
+		sys->EvBatterytargetCurrent = SUDO_EV_TARGET_CURRENT; //60A, for test;
+		#endif
+	}
+	else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2 (Precharge Relay ON, DC+ Relay OFF)
+	{
+		//sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT;	//2A, unit: 1A
+		sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
+	}
+	else	//0 (Precharge Relay is still under preparing, not ON, yet.)
+	{
+		//sys->EvBatterytargetCurrent = 0;	//0A
+		sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
+	}
+
+	//[BODY (3/10)] EVMaximumVoltageLimit
+    shm_msg->EVMaximumVoltageLimit.Multiplier = (int) exi->EVMaximumVoltageLimit.Multiplier;
+	//shm_msg->EVMaximumVoltageLimit.Unit = (unsigned char) exi->EVMaximumVoltageLimit.Unit;
+	shm_msg->EVMaximumVoltageLimit.Unit = V_ISO15118_2014;
+	shm_msg->EVMaximumVoltageLimit.Value = (short) exi->EVMaximumVoltageLimit.Value;
+	if (shm_msg->EVMaximumVoltageLimit.Value != 0 && exi->EVMaximumVoltageLimit_isUsed == 1u)	//Gridwiz EVCC Emulator will not send EVMaximumVoltageLimit in CurrentDemandReq
+	{
+		sys->EvBatteryMaxVoltage = ISO151182014PhyValDecode(shm_msg->EVMaximumVoltageLimit);
+	}
+	/*
+	printf("[SeccComm] <V_ev_max> = %d, %d, %.02f\n",
+			exi->EVMaximumVoltageLimit.Value,
+			shm_msg->EVMaximumVoltageLimit.Value,
+			sys->EvBatteryMaxVoltage
+		  );
+	*/
+
+	//[BODY (4/10)] EVMaximumCurrentLimit
+    shm_msg->EVMaximumCurrentLimit.Multiplier = (int) exi->EVMaximumCurrentLimit.Multiplier;
+	//shm_msg->EVMaximumCurrentLimit.Unit = (unsigned char) exi->EVMaximumCurrentLimit.Unit;
+	shm_msg->EVMaximumCurrentLimit.Unit = A_ISO15118_2014;
+	shm_msg->EVMaximumCurrentLimit.Value = (short) exi->EVMaximumCurrentLimit.Value;
+	sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->EVMaximumCurrentLimit);
+
+	//[BODY (5/10)] EVMaximumPowerLimit
+    shm_msg->EVMaximumPowerLimit.Multiplier = (int) exi->EVMaximumPowerLimit.Multiplier;
+	//shm_msg->EVMaximumPowerLimit.Unit = (unsigned char) exi->EVMaximumPowerLimit.Unit;
+	shm_msg->EVMaximumPowerLimit.Unit = W_ISO15118_2014;
+	shm_msg->EVMaximumPowerLimit.Value = (short) exi->EVMaximumPowerLimit.Value;
+	sys->EvBatteryMaxPower = ISO151182014PhyValDecode(shm_msg->EVMaximumPowerLimit);
+
+    //[BODY (6/10)] BulkChargingComplete
+	shm_msg->BulkChargingComplete = (BOOL) exi->BulkChargingComplete;
+
+    //[BODY (7/10)] ChargingComplete
+    shm_msg->ChargingComplete = (BOOL) exi->ChargingComplete;
+
+	//[BODY (8/10)] RemainingTimeToFullSoC
+	shm_msg->RemainingTimeToFullSoC.Multiplier = (int) exi->RemainingTimeToFullSoC.Multiplier;
+	shm_msg->RemainingTimeToFullSoC.Unit = (unsigned char) exi->RemainingTimeToFullSoC.Unit;
+	shm_msg->RemainingTimeToFullSoC.Value = (short) exi->RemainingTimeToFullSoC.Value;
+	sys->RemainChargingDuration = ISO151182014PhyValDecode(shm_msg->RemainingTimeToFullSoC);
+
+	//[BODY (9/10)] RemainingTimeToBulkSoC
+	shm_msg->RemainingTimeToBulkSoC.Multiplier = (int) exi->RemainingTimeToBulkSoC.Multiplier;
+	shm_msg->RemainingTimeToBulkSoC.Unit = (unsigned char) exi->RemainingTimeToBulkSoC.Unit;
+	shm_msg->RemainingTimeToBulkSoC.Value = (short) exi->RemainingTimeToBulkSoC.Value;
+
+	//[BODY (10/10)] EVTargetVoltage
+	shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
+	//shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
+	shm_msg->EVTargetVoltage.Unit = V_ISO15118_2014;
+	shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
+	if((shm_msg->EVTargetVoltage.Value != 0) && (sys->EvBatteryMaxVoltage != 0))
+	{
+		sys->EvBatterytargetVoltage = (ISO151182014PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
+	}
+	else
+	{
+		sys->EvBatterytargetVoltage = ISO151182014PhyValDecode(shm_msg->EVTargetVoltage);
+	}
+
+	/*
+	printf("[SeccComm] <V_ev_target> = %d, %d, %.02f\n",
+			exi->EVTargetVoltage.Value,
+			shm_msg->EVTargetVoltage.Value,
+			sys->EvBatterytargetVoltage
+		  );
+	*/
+
+	#if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
+	sys->EvBatterytargetVoltage = SUDO_EV_TARGET_VOLTAGE;	//for test (500V, unit: 1V)
+	#endif
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_ChargingStatusReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_ChargingStatusReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+	//no content for ISO1
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_WeldingDetectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_WeldingDetectionReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct WeldingDetectionRequest_DIN70121 *shm_msg;
+    struct dinWeldingDetectionReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.WeldingDetectionRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/3)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_WeldingDetectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_WeldingDetectionReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct WeldingDetectionRequest_ISO15118_2014 *shm_msg;
+    struct iso1WeldingDetectionReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.WeldingDetectionRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/3)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_SessionStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_SessionStopReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+	/*
+    int i = 0;
+    struct SessionStopRequest_DIN70121 *shm_msg;
+    struct dinSessionStopReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.SessionStopRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.SessionStopReq;
+	*/
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//null
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_SessionStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_SessionStopReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+	/*
+    int i = 0;
+    struct SessionStopRequest_ISO15118_2014 *shm_msg;
+    struct iso1SessionStopReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.SessionStopRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.SessionStopReq;
+	*/
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+	//null
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_SessionSetupRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_SessionSetupRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	int i = 0;
+	struct dinSessionSetupResType *out;
+	struct SessionSetupResponse_DIN70121 *in;
+
+	out = &exi_doc_DIN->V2G_Message.Body.SessionSetupRes;
+	in = &shm_ccs->V2GMessage_DIN70121.SessionSetupResponse;
+
+	exi_doc_DIN->V2G_Message.Body.SessionSetupRes_isUsed = 1u;
+
+	// ====== [BODY (1/3) ResponseCode ======
+	out->ResponseCode = in->ResponseCode;
+
+	// ====== [BODY (2/3) EVSEID ======
+	out->EVSEID.bytesLen = 32;  //max = 32  bytes(DIN), all zero
+	for (i = 0; i< 32; i++)
+	{
+		out->EVSEID.bytes[i] = (unsigned char) in->EVSEID[i];
+	}
+
+	// ====== [BODY (3/3) DateTimeNow ======
+	out->DateTimeNow_isUsed = 1u;
+	out->DateTimeNow = (int64_t) in->EVSETimeStamp;   //Format: Unix Time Stamp
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_ContractAuthenticationRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_ContractAuthenticationRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinContractAuthenticationResType *out;
+	struct ContractAuthenticationResponse_DIN70121 *in;
+
+	out = &exi_doc_DIN->V2G_Message.Body.ContractAuthenticationRes;
+	in = &shm_ccs->V2GMessage_DIN70121.ContractAuthenticationResponse;
+
+	//[BODY (2/2)] EVSEProcessing
+	out->EVSEProcessing = (BOOL)in->EVSEProcessing; //0(Finished) or 1(Ongoing)
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_ChargeParameterDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_ChargeParameterDiscoveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinChargeParameterDiscoveryResType *out;
+	struct ChargeParameterDiscoveryResponse_DIN70121 *in;
+
+	out = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryRes;
+	in = &shm_ccs->V2GMessage_DIN70121.ChargeParameterDiscoveryResponse;
+
+	//Initialize
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+	init_dinChargeParameterDiscoveryResType(out);
+	exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
+
+	//----- [BODY (1/5)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+    //----- [BODY (2/5)] EVSEProcessing -----
+    out->EVSEProcessing = (BOOL) in->EVSEProcessing;
+    // 	dinEVSEProcessingType_Finished = 0,
+    //	dinEVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/5)] SAScheduleList of SASchedules -----
+	//[Joseph] Here keep constant values and not copy from share memory, yet.
+    out->SAScheduleList_isUsed = 1u;
+    struct dinSAScheduleListType *list;
+    list = &out->SAScheduleList;
+    //
+    list->SAScheduleTuple.arrayLen = 1;
+    list->SAScheduleTuple.array[0].SAScheduleTupleID = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleID = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.arrayLen = 1;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval_isUsed = 1u;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.start = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration = 86400;	//24Hrs at least, unit:second
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration_isUsed = 1u;
+     /*+++ 20200808, vern, add Pmax parameters in chargeParameters discovery +++*/
+    in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value*=10;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax = in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value;
+       /*--- 20200808, vern, add Pmax parameters in chargeParameters discovery ---*/
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 1u;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval = 600;
+    //list->SAScheduleTuple.array[0].SalesTariff.xxx
+    //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
+
+
+    //-----  [BODY (4/5)] AC_EVSEChargeParameter of EVSEChargeParameter -----
+    //ignore, since DIN doesn't support AC
+
+    //----- [BODY (5/5)] DC_EVSEChargeParameter of EVSEChargeParameter -----
+    out->DC_EVSEChargeParameter_isUsed = 1u;
+    struct dinDC_EVSEChargeParameterType *out_dc_para;
+	struct DC_EVSEChargeParameterType_DIN70121 *in_dc_para;
+    out_dc_para = &out->DC_EVSEChargeParameter;
+	in_dc_para = &in->DC_EVSEChargeParameter;
+
+    //DC_EVSEStatus
+	out_dc_para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+	SHM_Read_dinDC_EVSEStatusType(&out_dc_para->DC_EVSEStatus, &in_dc_para->DC_EVSEStatus);
+
+    //EVSEMaximumCurrentLimit
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumCurrentLimit, &in_dc_para->EVSEMaximumCurrentLimit);
+
+    //EVSEMaximumPowerLimit
+	out_dc_para->EVSEMaximumPowerLimit_isUsed = 1u;
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumPowerLimit, &in_dc_para->EVSEMaximumPowerLimit);
+
+    //EVSEMaximumVoltageLimit
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumVoltageLimit, &in_dc_para->EVSEMaximumVoltageLimit);
+
+    //EVSEMinimumVoltageLimit
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMinimumVoltageLimit, &in_dc_para->EVSEMinimumVoltageLimit);
+
+
+    //EVSEMinimumCurrentLimit
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMinimumCurrentLimit, &in_dc_para->EVSEMinimumCurrentLimit);
+
+    //EVSECurrentRegulationTolerance_isUsed
+    out_dc_para->EVSECurrentRegulationTolerance_isUsed = 1u;
+    //EVSECurrentRegulationTolerance
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSECurrentRegulationTolerance, &in_dc_para->EVSECurrentRegulationTolerance);
+
+    //EVSEEnergyToBeDelivered_isUsed
+    out_dc_para->EVSEEnergyToBeDelivered_isUsed = 0u;
+	//EVSEEnergyToBeDelivered (optional)
+    //SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEEnergyToBeDelivered, &in_dc_para->EVSEEnergyToBeDelivered);
+
+    //EVSEPeakCurrentRipple
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEPeakCurrentRipple, &in_dc_para->EVSEPeakCurrentRipple);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_ChargeParameterDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_ChargeParameterDiscoveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1ChargeParameterDiscoveryResType *out;
+	struct ChargeParameterDiscoveryResponse_ISO15118_2014 *in;
+
+	out = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryResponse;
+
+	//Initialize
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+	init_iso1ChargeParameterDiscoveryResType(out);
+	exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
+
+	//----- [BODY (1/5)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+    //----- [BODY (2/5)] EVSEProcessing -----
+    out->EVSEProcessing = (BOOL) in->EVSEProcessing;
+    // 	iso1EVSEProcessingType_Finished = 0,
+    //	iso1EVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/5)] SAScheduleList of SASchedules -----
+	//[Joseph] Here keep constant values and not copy from share memory, yet.
+    out->SAScheduleList_isUsed = 1u;
+    struct iso1SAScheduleListType *list;
+    list = &out->SAScheduleList;
+    //
+    list->SAScheduleTuple.arrayLen = 1;
+    list->SAScheduleTuple.array[0].SAScheduleTupleID = 1;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleID = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.arrayLen = 1;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval_isUsed = 1u;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.start = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration = 86400;	//24Hrs at least, unit:second
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration_isUsed = 1u;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 1u;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval = 86400;
+    /*+++ 20200808, vern, add Pmax parameters in chargeParameters discovery +++*/
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Unit = iso1unitSymbolType_W;	//iso1unitSymbolType_W
+    in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value*=10;   /*+++ 20200808, vern, lack one more 0 ---*/
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Value =in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value;	//30000 if DW/DM product
+    /*--- 20200808, vern, add Pmax parameters in chargeParameters discovery ---*/
+    //list->SAScheduleTuple.array[0].SalesTariff.xxx
+    //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
+
+
+	//-----  [BODY (4/5)] AC/DC EVSEChargeParameter -----
+	#if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+	{
+		//-----  [BODY (4/5)] AC_EVSEChargeParameter -----
+		out->AC_EVSEChargeParameter_isUsed = 1u;
+		struct iso1AC_EVSEChargeParameterType *out_ac_para;
+		struct AC_EVSEChargeParameterType_ISO15118_2014 *in_ac_para;
+		out_ac_para = &out->AC_EVSEChargeParameter;
+		in_ac_para = &in->AC_EVSEChargeParameter;
+
+		//[1/3] AC_EVSEStatus
+		SHM_Read_iso1AC_EVSEStatusType(&out_ac_para->AC_EVSEStatus, &in_ac_para->AC_EVSEStatus);
+
+		//[2/3] EVSENominalVoltage
+		SHM_Read_iso1PhysicalValueType(&out_ac_para->EVSENominalVoltage, &in_ac_para->EVSENominalVoltage);
+
+		//[3/3] EVSEMaxCurrent
+		SHM_Read_iso1PhysicalValueType(&out_ac_para->EVSEMaxCurrent, &in_ac_para->EVSEMaxCurrent);
+	}
+	#else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
+	{
+		//----- [BODY (5/5)] DC_EVSEChargeParameter -----
+		out->DC_EVSEChargeParameter_isUsed = 1u;
+		struct iso1DC_EVSEChargeParameterType *out_dc_para;
+		struct DC_EVSEChargeParameterType_ISO15118_2014 *in_dc_para;
+		out_dc_para = &out->DC_EVSEChargeParameter;
+		in_dc_para = &in->DC_EVSEChargeParameter;
+
+		//DC_EVSEStatus
+		out_dc_para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+		SHM_Read_iso1DC_EVSEStatusType(&out_dc_para->DC_EVSEStatus, &in_dc_para->DC_EVSEStatus);
+
+		//EVSEMaximumCurrentLimit
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumCurrentLimit, &in_dc_para->EVSEMaximumCurrentLimit);
+
+		//EVSEMaximumPowerLimit
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumPowerLimit, &in_dc_para->EVSEMaximumPowerLimit);
+		
+		//EVSEMaximumVoltageLimit
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumVoltageLimit, &in_dc_para->EVSEMaximumVoltageLimit);
+
+		//EVSEMinimumVoltageLimit
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMinimumVoltageLimit, &in_dc_para->EVSEMinimumVoltageLimit);
+
+
+		//EVSEMinimumCurrentLimit
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMinimumCurrentLimit, &in_dc_para->EVSEMinimumCurrentLimit);
+
+		//EVSECurrentRegulationTolerance_isUsed
+		out_dc_para->EVSECurrentRegulationTolerance_isUsed = 1u;
+		//EVSECurrentRegulationTolerance
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSECurrentRegulationTolerance, &in_dc_para->EVSECurrentRegulationTolerance);
+
+		//EVSEEnergyToBeDelivered_isUsed
+		out_dc_para->EVSEEnergyToBeDelivered_isUsed = 0u;
+		//EVSEEnergyToBeDelivered (optional)
+		//SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEEnergyToBeDelivered, &in_dc_para->EVSEEnergyToBeDelivered);
+
+		//EVSEPeakCurrentRipple
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEPeakCurrentRipple, &in_dc_para->EVSEPeakCurrentRipple);
+	}
+	#endif
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_CableCheckRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_CableCheckRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinCableCheckResType *out;
+	struct CableCheckResponse_DIN70121 *in;
+
+	out = &exi_doc_DIN->V2G_Message.Body.CableCheckRes;
+	in = &shm_ccs->V2GMessage_DIN70121.CableCheckResponse;
+
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+    init_dinCableCheckResType(out);
+	exi_doc_DIN->V2G_Message.Body.CableCheckRes_isUsed = 1u;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+    //----- [BODY (2/3)] EVSEProcessing -----
+	out->EVSEProcessing = (BOOL) in->EVSEProcessing;
+    // 	dinEVSEProcessingType_Finished = 0,
+    //	dinEVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+	SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_CableCheckRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_CableCheckRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1CableCheckResType *out;
+	struct CableCheckResponse_ISO15118_2014 *in;
+
+	out = &exi_doc_ISO1->V2G_Message.Body.CableCheckRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.CableCheckResponse;
+
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+    init_iso1CableCheckResType(out);
+	exi_doc_ISO1->V2G_Message.Body.CableCheckRes_isUsed = 1u;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+    //----- [BODY (2/3)] EVSEProcessing -----
+	out->EVSEProcessing = (BOOL) in->EVSEProcessing;
+    // 	iso1EVSEProcessingType_Finished = 0,
+    //	iso1EVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+	SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_PreChargeRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_PreChargeRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinPreChargeResType *out;
+	struct PreChargeResponse_DIN70121 *in;
+
+	out = &exi_doc_DIN->V2G_Message.Body.PreChargeRes;
+	in = &shm_ccs->V2GMessage_DIN70121.PreChargeResponse;
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+    init_dinPreChargeResType(&exi_doc_DIN->V2G_Message.Body.PreChargeRes);
+	exi_doc_DIN->V2G_Message.Body.PreChargeRes_isUsed = 1u;
+
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+	SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
+    //	dinunitSymbolType_h = 0,
+    //	dinunitSymbolType_m = 1,
+    //	dinunitSymbolType_s = 2,
+    //	dinunitSymbolType_A = 3,
+    //	dinunitSymbolType_Ah = 4,
+    //	dinunitSymbolType_V = 5,
+    //	dinunitSymbolType_VA = 6,
+    //	dinunitSymbolType_W = 7,
+    //	dinunitSymbolType_W_s = 8,
+    //	dinunitSymbolType_Wh = 9
+
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+	SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_PreChargeRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_PreChargeRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1PreChargeResType *out;
+	struct PreChargeResponse_ISO15118_2014 *in;
+
+	out = &exi_doc_ISO1->V2G_Message.Body.PreChargeRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.PreChargeResponse;
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+    init_iso1PreChargeResType(&exi_doc_ISO1->V2G_Message.Body.PreChargeRes);
+	exi_doc_ISO1->V2G_Message.Body.PreChargeRes_isUsed = 1u;
+
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+	SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
+	//iso1unitSymbolType_h = 0,
+	//iso1unitSymbolType_m = 1,
+	//iso1unitSymbolType_s = 2,
+	//iso1unitSymbolType_A = 3,
+	//iso1unitSymbolType_V = 4,
+	//iso1unitSymbolType_W = 5,
+	//iso1unitSymbolType_Wh = 6
+
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+	SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_PowerDeliveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_PowerDeliveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinPowerDeliveryResType *out;
+	struct PowerDeliveryResponse_DIN70121 *in;
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+	init_dinPowerDeliveryResType(&exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes);
+
+	out = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes;
+	in = &shm_ccs->V2GMessage_DIN70121.PowerDeliveryResponse;
+	exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+
+    //----- [BODY (2/3)] AC_EVSEStatus -----
+    //ignore, since DIN 70121 doesn't support AC, yet.
+
+
+    //----- [BODY (2/3)] DC_EVSEStatus -----
+	out->DC_EVSEStatus_isUsed = 1u;
+	SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_PowerDeliveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_PowerDeliveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1PowerDeliveryResType *out;
+	struct PowerDeliveryResponse_ISO15118_2014 *in;
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+	init_iso1PowerDeliveryResType(&exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes);
+
+	out = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.PowerDeliveryResponse;
+	exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+
+    //----- [BODY (2/3)] AC_EVSEStatus -----
+    //ignore, since our ISO1 70121 doesn't support AC, yet.
+
+
+    //----- [BODY (2/3)] DC_EVSEStatus -----
+	#if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+	{
+		//out->DC_EVSEStatus_isUsed = 0u;
+	}
+	#else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
+	{
+		out->DC_EVSEStatus_isUsed = 1u;
+		SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+	}
+	#endif
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_CurrentDemandRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_CurrentDemandRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinCurrentDemandResType *out;
+	struct CurrentDemandResponse_DIN70121 *in;
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+	init_dinCurrentDemandResType(&exi_doc_DIN->V2G_Message.Body.CurrentDemandRes);
+
+	out = &exi_doc_DIN->V2G_Message.Body.CurrentDemandRes;
+	in = &shm_ccs->V2GMessage_DIN70121.CurrentDemandResponse;
+	exi_doc_DIN->V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
+
+
+	//----- [BODY (1/10)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+    //----- [BODY (2/10)] DC_EVSEStatus -----
+    SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+
+    //----- [BODY (3/10)] EVSEPresentVoltage -----
+	SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
+
+
+    //----- [BODY (4/10)] EVSEPresentCurrent -----
+	SHM_Read_dinPhysicalValueType(&out->EVSEPresentCurrent, &in->EVSEPresentCurrent);
+
+
+    //----- [BODY (5/10)] EVSECurrentLimitAchieved -----
+    out->EVSECurrentLimitAchieved = in->EVSECurrentLimitAchieved;
+
+    //----- [BODY (6/10)] EVSEVoltageLimitAchieved -----
+    out->EVSEVoltageLimitAchieved = in->EVSEVoltageLimitAchieved;
+
+    //----- [BODY (7/10)] EVSEPowerLimitAchieved -----
+    out->EVSEPowerLimitAchieved = in->EVSEPowerLimitAchieved;
+
+    //----- [BODY (8/10)] EVSEMaximumVoltageLimit -----
+    out->EVSEMaximumVoltageLimit_isUsed = 1u;
+	SHM_Read_dinPhysicalValueType(&out->EVSEMaximumVoltageLimit, &in->EVSEMaximumVoltageLimit);
+
+    //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
+    out->EVSEMaximumCurrentLimit_isUsed = 1u;
+	SHM_Read_dinPhysicalValueType(&out->EVSEMaximumCurrentLimit, &in->EVSEMaximumCurrentLimit);
+
+    //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
+    out->EVSEMaximumPowerLimit_isUsed = 1u;
+	SHM_Read_dinPhysicalValueType(&out->EVSEMaximumPowerLimit, &in->EVSEMaximumPowerLimit);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_CurrentDemandRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_CurrentDemandRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1CurrentDemandResType *out;
+	struct CurrentDemandResponse_ISO15118_2014 *in;
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+	init_iso1CurrentDemandResType(&exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes);
+
+	out = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.CurrentDemandResponse;
+	exi_doc_ISO1->V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
+
+	//vern, fill up necessary 
+	 out->EVSEID.charactersLen=7;
+	 out->EVSEID.characters[0]='Z';
+	 out->EVSEID.characters[1]='Z';
+	 out->EVSEID.characters[2]='0';
+	 out->EVSEID.characters[3]='0';
+	 out->EVSEID.characters[4]='0';
+	 out->EVSEID.characters[5]='0';
+	 out->EVSEID.characters[6]='0';
+	out->SAScheduleTupleID=1;
+	out->MeterInfo_isUsed=0u;
+	out->ReceiptRequired_isUsed=0u;
+	//----- [BODY (1/10)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+    //----- [BODY (2/10)] DC_EVSEStatus -----
+    SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+
+    //----- [BODY (3/10)] EVSEPresentVoltage -----
+	SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
+
+
+    //----- [BODY (4/10)] EVSEPresentCurrent -----
+	SHM_Read_iso1PhysicalValueType(&out->EVSEPresentCurrent, &in->EVSEPresentCurrent);
+
+
+    //----- [BODY (5/10)] EVSECurrentLimitAchieved -----
+    out->EVSECurrentLimitAchieved = in->EVSECurrentLimitAchieved;
+
+    //----- [BODY (6/10)] EVSEVoltageLimitAchieved -----
+    out->EVSEVoltageLimitAchieved = in->EVSEVoltageLimitAchieved;
+
+    //----- [BODY (7/10)] EVSEPowerLimitAchieved -----
+    out->EVSEPowerLimitAchieved = in->EVSEPowerLimitAchieved;
+
+    //----- [BODY (8/10)] EVSEMaximumVoltageLimit -----
+    out->EVSEMaximumVoltageLimit_isUsed = 1u;
+	SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumVoltageLimit, &in->EVSEMaximumVoltageLimit);
+
+    //----- [BODY (9/10)] EVSEMaximumCurrentLimit -----
+    out->EVSEMaximumCurrentLimit_isUsed = 1u;
+	SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumCurrentLimit, &in->EVSEMaximumCurrentLimit);
+
+    //----- [BODY (10/10)] EVSEMaximumPowerLimit -----
+    out->EVSEMaximumPowerLimit_isUsed = 1u;
+	SHM_Read_iso1PhysicalValueType(&out->EVSEMaximumPowerLimit, &in->EVSEMaximumPowerLimit);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_ChargingStatusRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_ChargingStatusRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	int i = 0;
+	struct iso1ChargingStatusResType *out;
+	struct ChargingStatusResponse_ISO15118_2014 *in;
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+	init_iso1ChargingStatusResType(&exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes);
+
+	out = &exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.ChargingStatusResponse;
+	exi_doc_ISO1->V2G_Message.Body.ChargingStatusRes_isUsed = 1u;
+
+
+	//----- [BODY (1/10)] ResponseCode -----
+    out->ResponseCode = (unsigned char)in->ResponseCode;
+
+    //----- [BODY (2/10)] AC_EVSEStatus -----
+    SHM_Read_iso1AC_EVSEStatusType(&out->AC_EVSEStatus, &in->AC_EVSEStatus);
+
+    //----- [BODY (3/10)] EVSEMaxCurrent -----
+	out->EVSEMaxCurrent_isUsed = 1u;
+	SHM_Read_iso1PhysicalValueType(&out->EVSEMaxCurrent, &in->EVSEMaxCurrent);
+
+    //----- [BODY (4/10)] SAScheduleTupleID -----
+	out->SAScheduleTupleID = (unsigned char)in->SAScheduleTupleID;	//[CAUTION] data type
+
+    //----- [BODY (5/10)] EVSEID -----
+	out->EVSEID.charactersLen = 37;  //min length: 7, max length:37  bytes(ISO1, AC)
+	for (i = 0; i< out->EVSEID.charactersLen; i++)
+	{
+		out->EVSEID.characters[i] = (unsigned char)in->EVSEID[i];
+	}
+
+    //----- [BODY (6/10)] MeterInfo -----
+    out->MeterInfo_isUsed = 1u;
+	SHM_Read_iso1MeterInfo(&out->MeterInfo, &in->MeterInfo);
+
+    //----- [BODY (7/10)] ReceiptRequired -----
+    out->ReceiptRequired_isUsed = 1u;
+	out->ReceiptRequired = (int)in->ReceiptRequired;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_WeldingDetectionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_WeldingDetectionRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinWeldingDetectionResType *out;
+	struct WeldingDetectionResponse_DIN70121 *in;
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+	init_dinWeldingDetectionResType(&exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes);
+
+
+	out = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes;
+	in = &shm_ccs->V2GMessage_DIN70121.WeldingDetectionResponse;
+	exi_doc_DIN->V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
+
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+	SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
+
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+    SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_WeldingDetectionRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_WeldingDetectionRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1WeldingDetectionResType *out;
+	struct WeldingDetectionResponse_ISO15118_2014 *in;
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+	init_iso1WeldingDetectionResType(&exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes);
+
+
+	out = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.WeldingDetectionResponse;
+	exi_doc_ISO1->V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
+
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+	SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
+
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+    SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_SessionStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_SessionStopRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinSessionStopResType *out;
+	struct SessionStopResponse_DIN70121 *in;
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+	init_dinSessionStopResType(&exi_doc_DIN->V2G_Message.Body.SessionStopRes);
+
+	out = &exi_doc_DIN->V2G_Message.Body.SessionStopRes;
+	in = &shm_ccs->V2GMessage_DIN70121.SessionStopResponse;
+	exi_doc_DIN->V2G_Message.Body.SessionStopRes_isUsed = 1u;
+
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_SessionStopRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_SessionStopRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1SessionStopResType *out;
+	struct SessionStopResponse_ISO15118_2014 *in;
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+	init_iso1SessionStopResType(&exi_doc_ISO1->V2G_Message.Body.SessionStopRes);
+
+	out = &exi_doc_ISO1->V2G_Message.Body.SessionStopRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.SessionStopResponse;
+	exi_doc_ISO1->V2G_Message.Body.SessionStopRes_isUsed = 1u;
+
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_V2G_MSG_din_Header
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_V2G_MSG_din_Header(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    int leng = 0;
+    leng = exi_doc_DIN->V2G_Message.Header.SessionID.bytesLen;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
+    for (i = 0; i <leng ; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Header.SessionID.bytes[i]);
+    }
+}
+
+/*===========================================================================
+FUNCTION: PRINT_V2G_MSG_iso1_Header
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_V2G_MSG_iso1_Header(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    int leng = 0;
+    leng = exi_doc_ISO1->V2G_Message.Header.SessionID.bytesLen;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
+    for (i = 0; i <leng ; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[i]);
+    }
+}
+
+/*===========================================================================
+FUNCTION: PRINT_V2G_MSG_iso1_Header
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_V2G_MSG_iso2_Header(struct iso2EXIDocument *exi_doc_ISO2)
+{
+    int i = 0;
+    int leng = 0;
+    leng = exi_doc_ISO2->V2G_Message.Header.SessionID.bytesLen;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t SessionID (%d Bytes) = ", leng);
+    for (i = 0; i <leng ; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[i]);
+    }
+}
+
+/*===========================================================================
+FUNCTION: DEBUG_PRINT_EXI_MSG_supportedAppProtocolReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_supportedAppProtocolReq(struct appHandEXIDocument *exi_doc)
+{
+	int i = 0;
+
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n EVSE side: List of application handshake protocols of the EV \n");
+
+	for(i = 0; i < exi_doc->supportedAppProtocolReq.AppProtocol.arrayLen; i++)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("\tProtocol entry #=%d\n",(i+1));
+
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tProtocolNamespace=");
+		printASCIIString(
+			exi_doc->supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.characters,
+			exi_doc->supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.charactersLen
+			);
+
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tVersion=%d.%d\n",
+			exi_doc->supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMajor,
+			exi_doc->supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMinor);
+
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tSchemaID=%d\n", exi_doc->supportedAppProtocolReq.AppProtocol.array[i].SchemaID);
+
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\tPriority=%d\n", exi_doc->supportedAppProtocolReq.AppProtocol.array[i].Priority);
+	}
+
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_SessionSetupReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionSetupReq ⨀⨀⨀⨀⨀⬇\n");
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
+    for (i = 0; i < exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionSetupReq ⨂⨂⨂⨂⨂⬆\n\n");
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_SessionSetupReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionSetupReq ⨀⨀⨀⨀⨀⬇\n");
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
+    for (i = 0; i < exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionSetupReq ⨂⨂⨂⨂⨂⬆\n\n");
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO2_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO2_SessionSetupReq(struct iso2EXIDocument *exi_doc_ISO2)
+{
+    int i = 0;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionSetupReq ⨀⨀⨀⨀⨀⬇\n");
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso2_Header(exi_doc_ISO2);
+
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tEVCCID (%d Bytes) = ", exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
+    for (i = 0; i < exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionSetupReq ⨂⨂⨂⨂⨂⬆\n\n");
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_ServiceDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_ServiceDiscoveryReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    int leng = 0;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServiceDiscoveryReq ⨀⨀⨀⨀⨀⬇\n");
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+    //[BODY(1/2)] Service Scope
+    leng = exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.charactersLen;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceScope (%d Bytes, optional) = ", leng);
+    for (i = 0; i <leng ; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
+    }
+
+    //[BODY(2/2)] Service Category
+    int cat = 0;
+    cat = exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceCategory = %d ", cat);
+    switch (cat)
+    {
+        case dinserviceCategoryType_EVCharging:             //0
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(EVCharging)");
+            break;
+        }
+        case dinserviceCategoryType_Internet:               //1
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Internet: not supported)");
+            break;
+        }
+        case dinserviceCategoryType_ContractCertificate:    //2
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ContractCertificate: not supported)");
+            break;
+        }
+        case dinserviceCategoryType_OtherCustom:            //3
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(OtherCustom: not supported)");
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected Service Category: %d)", cat);
+            break;
+        }
+
+    }
+    //DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t([0]EVCharging, [1]Internet, [2]ContractCertificate, [3]OtherCustom)\n");
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServiceDiscoveryReq ⨂⨂⨂⨂⨂⬆\n\n");
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_ServiceDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_ServiceDiscoveryReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    int leng = 0;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServiceDiscoveryReq ⨀⨀⨀⨀⨀⬇\n");
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+    //[BODY(1/2)] Service Scope
+    leng = exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.charactersLen;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceScope (%d Bytes, optional) = ", leng);
+    for (i = 0; i <leng ; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
+    }
+
+    //[BODY(2/2)] Service Category
+    int cat = 0;
+    cat = exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t ServiceCategory = %d ", cat);
+    switch (cat)
+    {
+        case iso1serviceCategoryType_EVCharging:             //0
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(EVCharging)");
+            break;
+        }
+        case iso1serviceCategoryType_Internet:               //1
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Internet: not supported)");
+            break;
+        }
+        case iso1serviceCategoryType_ContractCertificate:    //2
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ContractCertificate: not supported)");
+            break;
+        }
+        case iso1serviceCategoryType_OtherCustom:            //3
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(OtherCustom: not supported)");
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected Service Category)");
+            break;
+        }
+
+    }
+    //DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t([0]EVCharging, [1]Internet, [2]ContractCertificate, [3]OtherCustom)\n");
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServiceDiscoveryReq ⨂⨂⨂⨂⨂⬆\n\n");
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    int leng = 0;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ServicePaymentSelectionReq ⨀⨀⨀⨀⨀⬇\n");
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+
+    //[BODY(1/2)] SelectedPaymentOption
+    int opt = 0;
+    opt = exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedPaymentOption;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedPaymentOption = %d ", opt);
+    switch (opt)
+    {
+        case dinpaymentOptionType_Contract:         //0
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Contract)");
+            break;
+        }
+
+        case dinpaymentOptionType_ExternalPayment:  //1
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ExternalPayment)");
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected SelectedPaymentOption)\n");
+            break;
+        }
+    }
+
+
+    //[BODY(2/2)] SelectedServiceList
+    leng = exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.arrayLen;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedServiceList (%d items) = \n", leng);
+    for (i = 0; i< leng; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t\t [%d-th](ServiceID, ParameterSetID, ParameterSetID_isUsed) = {%d, %d, %d}\n",
+            (i+1),
+            exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ServiceID,
+            exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID,
+            exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID_isUsed);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ServicePaymentSelectionReq ⨂⨂⨂⨂⨂⬆\n\n");
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    int leng = 0;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PaymentServiceSelectionReq ⨀⨀⨀⨀⨀⬇\n");
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+
+    //[BODY(1/2)] SelectedPaymentOption
+    int opt = 0;
+    opt = exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedPaymentOption;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedPaymentOption = %d ", opt);
+    switch (opt)
+    {
+        case iso1paymentOptionType_Contract:         //0
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Contract)");
+            break;
+        }
+
+        case iso1paymentOptionType_ExternalPayment:  //1
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ExternalPayment)");
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("([ERROR] Unexpected SelectedPaymentOption)\n");
+            break;
+        }
+    }
+
+
+    //[BODY(2/2)] SelectedServiceList
+    leng = exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.arrayLen;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\tSelectedServiceList (%d items) = \n", leng);
+    for (i = 0; i< leng; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t\t\t [%d-th](ServiceID, ParameterSetID, ParameterSetID_isUsed) = {%d, %d, %d}\n",
+            (i+1),
+            exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ServiceID,
+            exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID,
+            exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.array[i].ParameterSetID_isUsed);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PaymentServiceSelectionReq ⨂⨂⨂⨂⨂⬆\n\n");
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_ContractAuthenticationReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_ContractAuthenticationReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ContractAuthenticationReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+
+    //[BODY(1/2)] Id
+    //[Joseph, To-Do, not full implemented, yet]
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t Id_isUsed = %d ",
+        exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq.Id_isUsed);
+
+
+    //[BODY(2/2)] GenChallenge
+    //[Joseph, To-Do, not full implemented, yet]
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t GenChallenge_isUsed = %d ",
+        exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq.GenChallenge_isUsed);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ContractAuthenticationReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_AuthorizationReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_AuthorizationReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing AuthorizationReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+
+    //[BODY(1/2)] Id
+    //[Joseph, To-Do, not full implemented, yet]
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t Id_isUsed = %d ",
+        exi_doc_ISO1->V2G_Message.Body.AuthorizationReq.Id_isUsed);
+
+
+    //[BODY(2/2)] GenChallenge
+    //[Joseph, To-Do, not full implemented, yet]
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t GenChallenge_isUsed = %d ",
+        exi_doc_ISO1->V2G_Message.Body.AuthorizationReq.GenChallenge_isUsed);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing AuthorizationReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargeParameterDiscoveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+    //===== [BODY (1/3)] EVRequestedEnergyTransferType =====
+    int type = 0;
+    type = exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.EVRequestedEnergyTransferType;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVRequestedEnergyTransferType = %d ", type);
+    switch (type)
+    {
+        case dinEVRequestedEnergyTransferType_AC_single_phase_core:    //0,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_single_phase_core)\n");
+            break;
+        }
+    	case dinEVRequestedEnergyTransferType_AC_three_phase_core:     //1,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_three_phase_core)\n");
+            break;
+        }
+    	case dinEVRequestedEnergyTransferType_DC_core:                 //2,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_core)\n");
+            break;
+        }
+    	case dinEVRequestedEnergyTransferType_DC_extended:             //3,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_extended)\n");  //expected
+            //[Joseph, To-Do]
+            //If this parameter is different from previous message,
+            //a warning should be noted.
+            break;
+        }
+    	case dinEVRequestedEnergyTransferType_DC_combo_core:           //4,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_combo_core)\n");
+            break;
+        }
+    	case dinEVRequestedEnergyTransferType_DC_unique:               //5
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_unique)\n");
+            break;
+        }
+    }
+
+    //===== [BODY (2/3)] AC_EVChargeParameter of EVChargeParameter =====
+    //ignored, since DIN doesn't support AC.
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t AC_EVChargeParameter_isUsed = %d ",
+            exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed);
+
+    //===== [BODY (3/3)] DC_EVChargeParameter of EVChargeParameter =====
+    int value = 0;
+    struct dinPhysicalValueType *obj;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed);
+
+    //DC_EVStatus
+    struct dinDC_EVStatusType *status;
+    status = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.DC_EVStatus;
+    PRINT_dinDC_EVStatusType(status);
+
+    //EVMaximumCurrentLimit
+    obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumCurrentLimit;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    //EVMaximumPowerLimit
+    obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumPowerLimit;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    //EVMaximumVoltageLimit
+    obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumVoltageLimit;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    //EVEnergyCapacity
+    obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyCapacity;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyCapacity = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    //EVEnergyRequest
+    obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyRequest;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyRequest = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    //FullSOC
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t FullSOC = %d \% (DEC)",
+            exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.FullSOC);
+
+    //BulkSOC
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkSOC = %d \% (DEC)",
+            exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.BulkSOC);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargeParameterDiscoveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargeParameterDiscoveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+    //===== [BODY (1/3)] RequestedEnergyTransferMode =====
+    int type = 0;
+    type = exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.RequestedEnergyTransferMode;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RequestedEnergyTransferMode = %d ", type);
+    switch (type)
+    {
+        case iso1EnergyTransferModeType_AC_single_phase_core:    //0,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_single_phase_core)\n");
+            break;
+        }
+    	case iso1EnergyTransferModeType_AC_three_phase_core:     //1,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(AC_three_phase_core)\n");
+            break;
+        }
+    	case iso1EnergyTransferModeType_DC_core:                 //2,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_core)\n");
+            break;
+        }
+    	case iso1EnergyTransferModeType_DC_extended:             //3,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_extended)\n");  //expected
+            //[Joseph, To-Do]
+            //If this parameter is different from previous message,
+            //a warning should be noted.
+            break;
+        }
+    	case iso1EnergyTransferModeType_DC_combo_core:           //4,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_combo_core)\n");
+            break;
+        }
+    	case iso1EnergyTransferModeType_DC_unique:               //5
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(DC_unique)\n");
+            break;
+        }
+    }
+
+    //===== [BODY (2/3)] AC_EVChargeParameter of EVChargeParameter =====
+    //ignored, since our ISO1 doesn't support AC.
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t AC_EVChargeParameter_isUsed = %d ",
+            exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed);
+
+    //===== [BODY (3/3)] DC_EVChargeParameter of EVChargeParameter =====
+    int value = 0;
+    struct iso1PhysicalValueType *obj;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed);
+
+    //DC_EVStatus
+    struct iso1DC_EVStatusType *status;
+    status = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.DC_EVStatus;
+    PRINT_iso1DC_EVStatusType(status);
+
+    //EVMaximumCurrentLimit
+    obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumCurrentLimit;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    //EVMaximumPowerLimit
+    obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumPowerLimit;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    //EVMaximumVoltageLimit
+    obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumVoltageLimit;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    //EVEnergyCapacity
+    obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyCapacity;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyCapacity = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    //EVEnergyRequest
+    obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyRequest;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVEnergyRequest = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    //FullSOC
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t FullSOC = %d \% (DEC)",
+            exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.FullSOC);
+
+    //BulkSOC
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkSOC = %d \% (DEC)",
+            exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.BulkSOC);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargeParameterDiscoveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_CableCheckReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_CableCheckReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CableCheckReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+    //===== [BODY (1/1)] DC_EVStatus =====
+    struct dinDC_EVStatusType *status;
+    status = &exi_doc_DIN->V2G_Message.Body.CableCheckReq.DC_EVStatus;
+    PRINT_dinDC_EVStatusType(status);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CableCheckReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_CableCheckReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_CableCheckReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CableCheckReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+    //===== [BODY (1/1)] DC_EVStatus =====
+    struct iso1DC_EVStatusType *status;
+    status = &exi_doc_ISO1->V2G_Message.Body.CableCheckReq.DC_EVStatus;
+    PRINT_iso1DC_EVStatusType(status);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CableCheckReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_PreChargeReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_PreChargeReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PreChargeReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+    //===== [BODY (1/3)] DC_EVStatus =====
+    struct dinDC_EVStatusType *status;
+    status = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.DC_EVStatus;
+    PRINT_dinDC_EVStatusType(status);
+
+    //===== [BODY (2/3)] EVTargetVoltage =====
+    int value = 0;
+    struct dinPhysicalValueType *obj;
+    obj = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.EVTargetVoltage;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    //===== [BODY (3/3)] EVTargetCurrent =====
+    obj = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.EVTargetCurrent;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PreChargeReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_PreChargeReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_PreChargeReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PreChargeReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+    //===== [BODY (1/3)] DC_EVStatus =====
+    struct iso1DC_EVStatusType *status;
+    status = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.DC_EVStatus;
+    PRINT_iso1DC_EVStatusType(status);
+
+    //===== [BODY (2/3)] EVTargetVoltage =====
+    int value = 0;
+    struct iso1PhysicalValueType *obj;
+    obj = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.EVTargetVoltage;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    //===== [BODY (3/3)] EVTargetCurrent =====
+    obj = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.EVTargetCurrent;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PreChargeReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_PowerDeliveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_PowerDeliveryReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PowerDeliveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+
+    //===== [BODY (1/3)] ReadyToChargeState =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ReadyToChargeState = %d (DEC)",
+            exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.ReadyToChargeState);
+
+
+    //===== [BODY (2/3)] ChargingProfile =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingProfile_isUsed = %d (DEC)",
+            exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.ChargingProfile_isUsed);
+
+
+    //===== [BODY (3/3)] DC_EVPowerDeliveryParameter =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVPowerDeliveryParameter_isUsed = %d (DEC)",
+            exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter_isUsed);
+
+    //DC_EVStatus
+    struct dinDC_EVStatusType *status;
+    status = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.DC_EVStatus;
+    PRINT_dinDC_EVStatusType(status);
+
+    //BulkChargingComplete
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d (DEC)",
+            exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete);
+
+    //BulkChargingComplete_isUsed
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d (DEC)",
+            exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete_isUsed);
+
+    //ChargingComplete
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d (DEC)",
+            exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.ChargingComplete);
+
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PowerDeliveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_PowerDeliveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_PowerDeliveryReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing PowerDeliveryReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+
+    //===== [BODY (1/3)] ChargeProgress =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargeProgress = %d (DEC, 0:start, 1:stop, 2:renegotiate)",
+            exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.ChargeProgress);
+	//iso1chargeProgressType_Start = 0,
+	//iso1chargeProgressType_Stop = 1,
+	//iso1chargeProgressType_Renegotiate = 2
+
+
+    //===== [BODY (2/3)] ChargingProfile =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingProfile_isUsed = %d (DEC)",
+            exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.ChargingProfile_isUsed);
+
+
+    //===== [BODY (3/3)] DC_EVPowerDeliveryParameter =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVPowerDeliveryParameter_isUsed = %d (DEC)",
+            exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter_isUsed);
+
+    //DC_EVStatus
+    struct iso1DC_EVStatusType *status;
+    status = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.DC_EVStatus;
+    PRINT_iso1DC_EVStatusType(status);
+
+    //BulkChargingComplete
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d (DEC)",
+            exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete);
+
+    //BulkChargingComplete_isUsed
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d (DEC)",
+            exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete_isUsed);
+
+    //ChargingComplete
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d (DEC)",
+            exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.ChargingComplete);
+
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing PowerDeliveryReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_CurrentDemandReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_CurrentDemandReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CurrentDemandReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+    //===== [BODY (1/10)] DC_EVStatus =====
+    struct dinDC_EVStatusType *status;
+    status = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.DC_EVStatus;
+    PRINT_dinDC_EVStatusType(status);
+
+
+    //===== [BODY (2/10)] EVTargetCurrent =====
+    int value = 0;
+    struct dinPhysicalValueType *obj;
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (3/10)] EVMaximumVoltageLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed);
+
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+
+    //===== [BODY (4/10)] EVMaximumCurrentLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed);
+
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (5/10)] EVMaximumPowerLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed);
+
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (6/10)] BulkChargingComplete =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d \n",
+            exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d \n",
+            exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete);
+
+
+    //===== [BODY (7/10)] ChargingComplete =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d \n",
+            exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.ChargingComplete);
+
+
+    //===== [BODY (8/10)] RemainingTimeToFullSoC =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed);
+
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToFullSoC = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (9/10)] RemainingTimeToBulkSoC =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed);
+
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToBulkSoC = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (10/10)] EVTargetVoltage =====
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage;
+    value = GetValue_dinPhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", value);
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CurrentDemandReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_CurrentDemandReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_CurrentDemandReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing CurrentDemandReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+    //===== [BODY (1/10)] DC_EVStatus =====
+    struct iso1DC_EVStatusType *status;
+    status = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.DC_EVStatus;
+    PRINT_iso1DC_EVStatusType(status);
+
+
+    //===== [BODY (2/10)] EVTargetCurrent =====
+    int value = 0;
+    struct iso1PhysicalValueType *obj;
+    obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetCurrent = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (3/10)] EVMaximumVoltageLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed);
+
+    obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumVoltageLimit = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+
+
+    //===== [BODY (4/10)] EVMaximumCurrentLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed);
+
+    obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumCurrentLimit = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (5/10)] EVMaximumPowerLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed);
+
+    obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVMaximumPowerLimit = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (6/10)] BulkChargingComplete =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete_isUsed = %d \n",
+            exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t BulkChargingComplete = %d \n",
+            exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete);
+
+
+    //===== [BODY (7/10)] ChargingComplete =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t ChargingComplete = %d \n",
+            exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.ChargingComplete);
+
+
+    //===== [BODY (8/10)] RemainingTimeToFullSoC =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed);
+
+    obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToFullSoC = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (9/10)] RemainingTimeToBulkSoC =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVChargeParameter_isUsed = %d \n",
+            exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed);
+
+    obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t RemainingTimeToBulkSoC = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (10/10)] EVTargetVoltage =====
+    obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage;
+    value = GetValue_iso1PhysicalValueType(obj);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t EVTargetVoltage = %d (DEC) ", value);
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing CurrentDemandReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_ChargingStatusReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_ChargingStatusReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing ChargingStatusReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+    //===== [BODY (0/0)] =====
+	//ISO1: no content
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t no content (ISO1)");
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing ChargingStatusReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_WeldingDetectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_WeldingDetectionReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing WeldingDetectionReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+    //===== [BODY (1/3)] DC_EVStatus =====
+    struct dinDC_EVStatusType *status;
+    status = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionReq.DC_EVStatus;
+    PRINT_dinDC_EVStatusType(status);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing WeldingDetectionReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_WeldingDetectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_WeldingDetectionReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing WeldingDetectionReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+    //===== [BODY (1/3)] DC_EVStatus =====
+    struct iso1DC_EVStatusType *status;
+    status = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionReq.DC_EVStatus;
+    PRINT_iso1DC_EVStatusType(status);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing WeldingDetectionReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_SessionStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_SessionStopReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionStopReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+
+    //===== [BODY (0/0)] noContent =====
+
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionStopReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_ISO1_SessionStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_ISO1_SessionStopReq(struct iso1EXIDocument *exi_doc_ISO1)
+{
+    int i = 0;
+    static int cnt = 0;
+    cnt++;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n\t⬇⨀⨀⨀⨀⨀ [START] Parsing SessionStopReq (%d-th) ⨀⨀⨀⨀⨀⬇\n", cnt);
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+
+    //===== [BODY (0/0)] noContent =====
+
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t⬆⨂⨂⨂⨂⨂ [END] Parsing SessionStopReq (%d-th) ⨂⨂⨂⨂⨂⬆\n\n", cnt);
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_V2GTP_STREAM
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_V2GTP_STREAM(bitstream_t *stream)
+{
+	#if (DEBUG_PRINTF_EXI_ENGINE_DETAIL_SHOW == ENABLE)
+	int i = 0;
+
+
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n ----- Got a new V2GTP Message -----\n\n");
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t SIZE: %d (Bytes, DEC)\n", (int)stream->size);
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t HEADER (HEX): ");
+	for (i = 0; i < stream->size; i++)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", stream->data[i]);
+		if (i == (V2GTP_HEADER_LENGTH - 1))
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t EXI (HEX): ");
+		}
+	}
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n");
+	#endif
+}
+
+
+/*===========================================================================
+FUNCTION: API_V2GMSG_EXI_Decoder_AppProtocol
+DESCRIPTION:
+PRE-CONDITION:
+        1. #define EXI_STREAM    BYTE_ARRAY
+
+INPUT:
+        1. V2GTP_msg
+        2. V2GTP_msg_length
+
+OUTPUT:
+        1. ccs_handshake       	//Share Memory
+        2. V2gFlowStatus   //Status Flag
+
+GLOBAL VARIABLES:
+		1. iStream
+		2. exiDoc
+=============================================================================*/
+int API_V2GMSG_EXI_Decoder_AppProtocol(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct appHandEXIDocument *exiDoc_handshake)
+{
+	int errn = 0;
+	size_t pos = 0;
+	uint32_t payloadLengthDec = 0;
+
+	//Initialize iStream
+	iStream.size = V2GTP_msg_length;	//V2GTP_MSG_RX_BUFFER_SIZE;	//64*1024 = 65,536
+	iStream.pos = &pos;
+	iStream.data = V2GTP_msg;
+
+	//Initialize exiDoc
+	init_appHandEXIDocument(exiDoc_handshake);
+
+	//Print the original EXI message
+	PRINT_V2GTP_STREAM(&iStream);
+
+	//STEP 1: Parsing Header
+	errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
+
+	//TC_SECC_VTB_V2GTPSessionSetup_004
+	if (payloadLengthDec == 0)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_AppProtocol]payloadLengthDec = 0\n");
+		errn = -1;
+	}
+
+	if (errn == 0)
+	{
+		//STEP 2: Parsing Payload EXI Message
+		*iStream.pos = V2GTP_HEADER_LENGTH;
+		errn = decode_appHandExiDocument(&iStream, exiDoc_handshake);
+		if(errn == 0)
+		{
+			//Print the decoded XML Document
+			PRINT_XML_DOC_supportedAppProtocolReq(exiDoc_handshake);
+
+			//errn = SupportedAppProtocolRequest;	//17 (define.h)
+		}
+		else
+		{
+			/* an error occured */
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_AppProtocol]decode_appHandExiDocument()\n");
+			errn = -1;
+		}
+	}
+
+	return errn;
+}
+
+
+int API_V2GMSG_EXI_Encoder_AppProtocol(struct appHandEXIDocument *exi_doc, bitstream_t *exi_packet)
+{
+	int i = 0;
+	int errn = 0;
+	size_t pos = 0;
+	exi_packet->pos = &pos;
+	//*exi_packet->pos = 0;
+	exi_packet->size = V2GTP_MSG_TX_BUFFER_SIZE;	//(64*1024)   //65,536 = 65.5KB
+	exi_packet->data = V2GTP_Tx_buf;
+
+	*exi_packet->pos = V2GTP_HEADER_LENGTH;
+	if( (errn = encode_appHandExiDocument(exi_packet, exi_doc)) == 0)
+	{
+		errn = write_v2gtpHeader(exi_packet->data, (*exi_packet->pos) - V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
+		//*exi_packet.pos = total length of the encoded V2GMSG.
+		//V2GTP_HEADER_LENGTH = 8 Bytes
+	}
+	exi_packet->size = *exi_packet->pos;	//total length of the encoded V2GMSG.
+
+
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n -----  supportedAppProtocolRes [START] -----\n\n");
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t SIZE: %d (Bytes, DEC)\n", (int)exi_packet->size);
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\t HEADER (HEX): ");
+	for (i = 0; i < (int)exi_packet->size; i++)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("%02X", exi_packet->data[i]);
+		if (i == (V2GTP_HEADER_LENGTH - 1)) DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t EXI (HEX): ");
+	}
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\n -----  supportedAppProtocolRes [END] -----\n\n");
+
+
+	return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: API_V2GMSG_EXI_Decoder_DIN
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int API_V2GMSG_EXI_Decoder_DIN(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct dinEXIDocument *exi_doc_DIN)
+{
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("API_V2GMSG_EXI_Decoder_DIN(): Entered!\n");
+
+	int errn = 0;
+	size_t pos = 0;
+	uint32_t payloadLengthDec = 0;
+
+	//Initialize iStream
+	iStream.size = V2GTP_msg_length;	//V2GTP_MSG_RX_BUFFER_SIZE;	//64*1024 = 65,536
+	iStream.pos = &pos;
+	iStream.data = V2GTP_msg;
+
+	iStream.buffer = 0;
+	iStream.capacity = 0;
+
+	//Print the original EXI message
+	PRINT_V2GTP_STREAM(&iStream);
+
+	//STEP 1: Parsing Header
+	errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
+
+	//TC_SECC_VTB_V2GTPSessionSetup_004
+	if (payloadLengthDec == 0)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][Error][API_V2GMSG_EXI_Decoder_DIN]payloadLengthDec = 0\n");
+		errn = -1;
+	}
+
+	if (errn == 0)
+	{
+		//STEP 2: Parsing Payload EXI Message
+		*iStream.pos = V2GTP_HEADER_LENGTH;
+		errn = decode_dinExiDocument(&iStream, exi_doc_DIN);
+		//The "eventcode" inside this function could present which kind of message it is.
+
+		if (errn == 0)
+		{
+			// successfully received and parsed.
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_DIN] decode_dinExiDocument: %d (DEC) => OK!\n", errn);
+			errn = Check_V2G_Rx_Msg_Name_din(exi_doc_DIN);
+			if (errn < 0)
+			{
+				DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
+			}
+		}
+		else
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_DIN] decode_dinExiDocument: %d (DEC)\n", errn);
+			errn = -1;
+		}
+	}
+	else
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_DIN] read_v2gtpHeader: %d (DEC)\n", errn);
+	}
+	return errn;
+}
+
+/*===========================================================================
+FUNCTION: API_V2GMSG_EXI_Decoder_ISO1
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int API_V2GMSG_EXI_Decoder_ISO1(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct iso1EXIDocument *exi_doc_ISO1)
+{
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("[API_V2GMSG_EXI_Decoder_ISO1] Entered!\n");
+
+	int errn = 0;
+	size_t pos = 0;
+	uint32_t payloadLengthDec = 0;
+
+	//Initialize iStream
+	iStream.size = V2GTP_msg_length;	//V2GTP_MSG_RX_BUFFER_SIZE;	//64*1024 = 65,536
+	iStream.pos = &pos;
+	iStream.data = V2GTP_msg;
+
+	iStream.buffer = 0;
+	iStream.capacity = 0;
+
+	//Print the original EXI message
+	PRINT_V2GTP_STREAM(&iStream);
+
+	//STEP 1: Parsing Header
+	errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
+
+	//TC_SECC_VTB_V2GTPSessionSetup_004
+	if (payloadLengthDec == 0)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO1]payloadLengthDec = 0");
+		errn = -1;
+	}
+
+	if (errn == 0)
+	{
+		//STEP 2: Parsing Payload EXI Message
+		*iStream.pos = V2GTP_HEADER_LENGTH;
+		errn = decode_iso1ExiDocument(&iStream, exi_doc_ISO1);
+		//The "eventcode" inside this function could present which kind of message it is.
+
+		if (errn == 0)
+		{
+			// successfully received and parsed.
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO1] decode_iso1ExiDocument: %d (DEC) => OK!\n", errn);
+			errn = Check_V2G_Rx_Msg_Name_iso1(exi_doc_ISO1);
+			if (errn < 0)
+			{
+				DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
+			}
+		}
+		else
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO1] decode_iso1ExiDocument: %d (DEC)\n", errn);
+			errn = -1;
+		}
+	}
+	else
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO1] read_v2gtpHeader: %d (DEC)\n", errn);
+	}
+	return errn;
+}
+
+/*===========================================================================
+FUNCTION: API_V2GMSG_EXI_Decoder_ISO2
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int API_V2GMSG_EXI_Decoder_ISO2(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct iso2EXIDocument *exi_doc_ISO2)
+{
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("[API_V2GMSG_EXI_Decoder_ISO2] Entered!\n");
+
+	int errn = 0;
+	size_t pos = 0;
+	uint32_t payloadLengthDec = 0;
+
+	//Initialize iStream
+	iStream.size = V2GTP_msg_length;	//V2GTP_MSG_RX_BUFFER_SIZE;	//64*1024 = 65,536
+	iStream.pos = &pos;
+	iStream.data = V2GTP_msg;
+
+	iStream.buffer = 0;
+	iStream.capacity = 0;
+
+	//Print the original EXI message
+	PRINT_V2GTP_STREAM(&iStream);
+
+	//STEP 1: Parsing Header
+	errn = read_v2gtpHeader(iStream.data, &payloadLengthDec);
+
+	//TC_SECC_VTB_V2GTPSessionSetup_004
+	if (payloadLengthDec == 0)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO2]payloadLengthDec = 0\n");
+		errn = -1;
+	}
+
+	if (errn == 0)
+	{
+		//STEP 2: Parsing Payload EXI Message
+		*iStream.pos = V2GTP_HEADER_LENGTH;
+		errn = decode_iso2ExiDocument(&iStream, exi_doc_ISO2);
+		//The "eventcode" inside this function could present which kind of message it is.
+
+		if (errn == 0)
+		{
+			// successfully received and parsed.
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("[SeccComm][API_V2GMSG_EXI_Decoder_ISO2] decode_iso2ExiDocument: %d (DEC) => OK!\n", errn);
+			errn = Check_V2G_Rx_Msg_Name_iso2(exi_doc_ISO2);
+			if (errn < 0)
+			{
+				DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]Check_V2G_Rx_Msg_Name_din: fail\n");
+			}
+		}
+		else
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO2] decode_iso2ExiDocument: %d (DEC)\n", errn);
+		}
+	}
+	else
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR][API_V2GMSG_EXI_Decoder_ISO2] read_v2gtpHeader: %d (DEC)\n", errn);
+	}
+	return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_dinPhysicalValueType_UNIT
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_dinPhysicalValueType_UNIT(struct dinPhysicalValueType *obj)
+{
+    if (obj->Unit_isUsed == TRUE)
+    {
+        switch (obj->Unit)
+        {
+            case dinunitSymbolType_h:      // = 0,
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: h)");
+                break;
+            }
+        	case dinunitSymbolType_m:      // = 1,
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: m)");
+                break;
+            }
+        	case dinunitSymbolType_s:      // = 2,
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: s)");
+                break;
+            }
+        	case dinunitSymbolType_A:      // = 3,
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: A)");
+                break;
+            }
+        	case dinunitSymbolType_Ah:     // = 4,
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Ah)");
+                break;
+            }
+        	case dinunitSymbolType_V:      // = 5,
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: V)");
+                break;
+            }
+        	case dinunitSymbolType_VA:     // = 6,
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: VA)");
+                break;
+            }
+        	case dinunitSymbolType_W:      // = 7,
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W)");
+                break;
+            }
+        	case dinunitSymbolType_W_s:    // = 8,
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W_s)");
+                break;
+            }
+        	case dinunitSymbolType_Wh:     // = 9
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Wh)");
+                break;
+            }
+            default:
+            {
+                DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] unit: unexpected dinPhysicalValueType unit)");
+                break;
+            }
+        }
+    }
+    else
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: null)");
+    }
+}
+
+/*===========================================================================
+FUNCTION: PRINT_iso1PhysicalValueType_UNIT
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_iso1PhysicalValueType_UNIT(struct iso1PhysicalValueType *obj)
+{
+	switch (obj->Unit)
+	{
+		case iso1unitSymbolType_h:      // = 0,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: h)");
+			break;
+		}
+		case iso1unitSymbolType_m:      // = 1,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: m)");
+			break;
+		}
+		case iso1unitSymbolType_s:      // = 2,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: s)");
+			break;
+		}
+		case iso1unitSymbolType_A:      // = 3,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: A)");
+			break;
+		}
+		case iso1unitSymbolType_V:      // = 4,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: V)");
+			break;
+		}
+		case iso1unitSymbolType_W:      // = 5,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W)");
+			break;
+		}
+		case iso1unitSymbolType_Wh:     // = 6
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Wh)");
+			break;
+		}
+		default:
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] unit: unexpected iso1PhysicalValueType unit)");
+			break;
+		}
+	}
+}
+
+/*===========================================================================
+FUNCTION: GetValue_dinPhysicalValueType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int GetValue_dinPhysicalValueType(struct dinPhysicalValueType *obj)
+{
+    int result;
+    result = (obj->Value) * pow(10, obj->Multiplier);
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: GetValue_iso1PhysicalValueType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int GetValue_iso1PhysicalValueType(struct iso1PhysicalValueType *obj)
+{
+    int result;
+    result = (obj->Value) * pow(10, obj->Multiplier);
+    return result;
+}
+
+/*===========================================================================
+FUNCTION: PRINT_dinDC_EVErrorCodeType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_dinDC_EVErrorCodeType(struct dinDC_EVStatusType *status)
+{
+    switch (status->EVErrorCode)
+    {
+        case dinDC_EVErrorCodeType_NO_ERROR:                           // = 0,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NO_ERROR)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_FAILED_RESSTemperatureInhibit:      // = 1,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_RESSTemperatureInhibit)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_FAILED_EVShiftPosition:             // = 2,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVShiftPosition)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_FAILED_ChargerConnectorLockFault:   // = 3,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ChargerConnectorLockFault)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_FAILED_EVRESSMalfunction:           // = 4,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVRESSMalfunction)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_FAILED_ChargingCurrentdifferential: // = 5,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingCurrentdifferential)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange:   // = 6,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingVoltageOutOfRange)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_Reserved_A:                         // = 7,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_A)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_Reserved_B:                         // = 8,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_B)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_Reserved_C:                         // = 9,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_C)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility:// = 10,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingSystemIncompatibility)");
+            break;
+        }
+    	case dinDC_EVErrorCodeType_NoData:                             // = 11
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NoData)");
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] Unexpected din EVErrorCode)");
+            break;
+        }
+    }
+}
+
+/*===========================================================================
+FUNCTION: PRINT_iso1DC_EVErrorCodeType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_iso1DC_EVErrorCodeType(struct iso1DC_EVStatusType *status)
+{
+    switch (status->EVErrorCode)
+    {
+        case iso1DC_EVErrorCodeType_NO_ERROR:                           // = 0,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NO_ERROR)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_RESSTemperatureInhibit:      // = 1,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_RESSTemperatureInhibit)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_EVShiftPosition:             // = 2,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVShiftPosition)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_ChargerConnectorLockFault:   // = 3,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ChargerConnectorLockFault)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_EVRESSMalfunction:           // = 4,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVRESSMalfunction)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_ChargingCurrentdifferential: // = 5,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingCurrentdifferential)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange:   // = 6,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingVoltageOutOfRange)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_Reserved_A:                         // = 7,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_A)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_Reserved_B:                         // = 8,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_B)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_Reserved_C:                         // = 9,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_C)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility:// = 10,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingSystemIncompatibility)");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_NoData:                             // = 11
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NoData)");
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] Unexpected iso1 EVErrorCode)");
+            break;
+        }
+    }
+}
+
+
+/*===========================================================================
+FUNCTION: PRINT_dinDC_EVStatusType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_dinDC_EVStatusType(struct dinDC_EVStatusType *status)
+{
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVStatus:");
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVReady = %d (DEC) ", status->EVReady);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVErrorCode = %d (DEC) ", status->EVErrorCode);
+    PRINT_dinDC_EVErrorCodeType(status);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSSOC = %d \%(DEC) \n", status->EVRESSSOC);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVCabinConditioning = %d (DEC) ", status->EVCabinConditioning);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVCabinConditioning_isUsed = %d (DEC) ", status->EVCabinConditioning_isUsed);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSConditioning = %d (DEC) ", status->EVRESSConditioning);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSConditioning_isUsed = %d (DEC) \n", status->EVRESSConditioning_isUsed);
+}
+
+/*===========================================================================
+FUNCTION: PRINT_iso1DC_EVStatusType
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_iso1DC_EVStatusType(struct iso1DC_EVStatusType *status)
+{
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t DC_EVStatus:");
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVReady = %d (DEC) ", status->EVReady);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVErrorCode = %d (DEC) ", status->EVErrorCode);
+    PRINT_iso1DC_EVErrorCodeType(status);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t\t\t\t- EVRESSSOC = %d \%(DEC) \n", status->EVRESSSOC);
+}

+ 173 - 0
EVSE/Projects/CCS/Apps/exi_engine/api/api.h

@@ -5,3 +5,176 @@
                           initiated by Joseph
                            (since 2019/08/07)
 =============================================================================*/
+#include "../../define.h"
+
+#include "../appHandshake/appHandEXIDatatypes.h"
+#include "../appHandshake/appHandEXIDatatypesEncoder.h"
+#include "../appHandshake/appHandEXIDatatypesDecoder.h"
+
+#include "../din/dinEXIDatatypes.h"
+#include "../din/dinEXIDatatypesEncoder.h"
+#include "../din/dinEXIDatatypesDecoder.h"
+
+#include "../iso1/iso1EXIDatatypes.h"
+#include "../iso1/iso1EXIDatatypesEncoder.h"
+#include "../iso1/iso1EXIDatatypesDecoder.h"
+
+#include "../iso2/iso2EXIDatatypes.h"
+#include "../iso2/iso2EXIDatatypesEncoder.h"
+#include "../iso2/iso2EXIDatatypesDecoder.h"
+
+//Configuration for Debug Print Messages
+#if FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE
+#define DEBUG_PRINTF_EXI_ENGINE_SHOW           DISABLE   //ENABLE, DISABLE
+#define DEBUG_PRINTF_EXI_ENGINE_BRIEF_SHOW     DISABLE   //ENABLE, DISABLE
+#define DEBUG_PRINTF_EXI_ENGINE_DETAIL_SHOW    DISABLE   //ENABLE, DISABLE
+#else   //debug mode
+#define DEBUG_PRINTF_EXI_ENGINE_SHOW           ENABLE   //ENABLE, DISABLE
+#define DEBUG_PRINTF_EXI_ENGINE_BRIEF_SHOW     DISABLE   //ENABLE, DISABLE
+#define DEBUG_PRINTF_EXI_ENGINE_DETAIL_SHOW    DISABLE   //ENABLE, DISABLE
+#endif
+
+void SHM_Save_din_supportedAppProtocolReq(struct CcsData *shm_ccs, struct appHandEXIDocument *buf, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_SessionSetupReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_ServiceDiscoveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_ContractAuthenticationReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_CableCheckReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_PreChargeReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_PowerDeliveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_CurrentDemandReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_WeldingDetectionReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_din_SessionStopReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys);
+
+void SHM_Save_iso1_SessionSetupReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_ServiceDiscoveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_AuthorizationReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_CableCheckReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_PreChargeReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_PowerDeliveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_CurrentDemandReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_ChargingStatusReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_WeldingDetectionReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+void SHM_Save_iso1_SessionStopReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys);
+
+void SHM_Save_iso2_SessionSetupReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+//void SHM_Save_iso2_ServiceDiscoveryReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+//void SHM_Save_iso2_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+//void SHM_Save_iso2_ContractAuthenticationReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+//void SHM_Save_iso2_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+//void SHM_Save_iso2_CableCheckReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+//void SHM_Save_iso2_PreChargeReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+//void SHM_Save_iso2_PowerDeliveryReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+//void SHM_Save_iso2_CurrentDemandReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+//void SHM_Save_iso2_WeldingDetectionReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+//void SHM_Save_iso2_SessionStopReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys);
+
+
+void SAVE_PhysicalValueType_DIN70121(struct PhysicalValueType_DIN70121 *out, int in_value, unsigned char unit);
+void SAVE_PhysicalValueType_ISO15118_2014(struct PhysicalValueType_ISO15118_2014 *out, int in_value, unsigned char unit);
+void SHM_Read_dinPhysicalValueType(struct dinPhysicalValueType *out, struct PhysicalValueType_DIN70121 *in);
+void SHM_Read_iso1PhysicalValueType(struct iso1PhysicalValueType *out, struct PhysicalValueType_ISO15118_2014 *in);
+void SHM_Read_dinDC_EVSEStatusType(struct dinDC_EVSEStatusType *out, struct DC_EVSEStatusType_DIN70121 *in);
+void SHM_Read_iso1DC_EVSEStatusType(struct iso1DC_EVSEStatusType *out, struct DC_EVSEStatusType_ISO15118_2014 *in);
+
+
+void SHM_Read_din_SessionSetupRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs);
+void SHM_Read_din_ContractAuthenticationRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs);
+void SHM_Read_din_ChargeParameterDiscoveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs);
+void SHM_Read_din_CableCheckRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs);
+void SHM_Read_din_PreChargeRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs);
+void SHM_Read_din_PowerDeliveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs);
+void SHM_Read_din_CurrentDemandRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs);
+void SHM_Read_din_WeldingDetectionRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs);
+void SHM_Read_din_SessionStopRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs);
+
+void SHM_Read_iso1_SessionSetupRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs);
+void SHM_Read_iso1_ContractAuthenticationRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs);
+void SHM_Read_iso1_ChargeParameterDiscoveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs);
+void SHM_Read_iso1_CableCheckRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs);
+void SHM_Read_iso1_PreChargeRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs);
+void SHM_Read_iso1_PowerDeliveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs);
+void SHM_Read_iso1_CurrentDemandRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs);
+void SHM_Read_iso1_ChargingStatusRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs);
+void SHM_Read_iso1_WeldingDetectionRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs);
+void SHM_Read_iso1_SessionStopRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs);
+
+int API_V2GMSG_EXI_Decoder_AppProtocol(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct appHandEXIDocument *ccs_data);
+int API_V2GMSG_EXI_Encoder_AppProtocol(struct appHandEXIDocument *exi_doc, bitstream_t *exi_packet);
+
+int API_V2GMSG_EXI_Decoder_DIN(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct dinEXIDocument *exi_doc_DIN);
+int API_V2GMSG_EXI_Decoder_ISO1(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct iso1EXIDocument *exi_doc_ISO1);
+int API_V2GMSG_EXI_Decoder_ISO2(unsigned char *V2GTP_msg, unsigned int V2GTP_msg_length, struct iso2EXIDocument *exi_doc_ISO2);
+
+void PRINT_XML_DOC_supportedAppProtocolReq(struct appHandEXIDocument *exi_doc);
+void PRINT_XML_DOC_DIN_SessionSetupReq(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_XML_DOC_DIN_ServiceDiscoveryReq(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_XML_DOC_DIN_ContractAuthenticationReq(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_XML_DOC_DIN_CableCheckReq(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_XML_DOC_DIN_PreChargeReq(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_XML_DOC_DIN_PowerDeliveryReq(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_XML_DOC_DIN_CurrentDemandReq(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_XML_DOC_DIN_WeldingDetectionReq(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_XML_DOC_DIN_SessionStopReq(struct dinEXIDocument *exi_doc_DIN);
+
+void PRINT_XML_DOC_ISO1_SessionSetupReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_ServiceDiscoveryReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_AuthorizationReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_CableCheckReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_PreChargeReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_PowerDeliveryReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_CurrentDemandReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_ChargingStatusReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_WeldingDetectionReq(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_XML_DOC_ISO1_SessionStopReq(struct iso1EXIDocument *exi_doc_ISO1);
+
+void PRINT_XML_DOC_ISO2_SessionSetupReq(struct iso2EXIDocument *exi_doc_ISO2);
+//void PRINT_XML_DOC_ISO2_ServiceDiscoveryReq(struct iso2EXIDocument *exi_doc_ISO2);
+//void PRINT_XML_DOC_ISO2_ServiceAndPaymentSelectionReq(struct iso2EXIDocument *exi_doc_ISO2);
+//void PRINT_XML_DOC_ISO2_ContractAuthenticationReq(struct iso2EXIDocument *exi_doc_ISO2);
+//void PRINT_XML_DOC_ISO2_ChargeParameterDiscoveryReq(struct iso2EXIDocument *exi_doc_ISO2);
+//void PRINT_XML_DOC_ISO2_CableCheckReq(struct iso2EXIDocument *exi_doc_ISO2);
+//void PRINT_XML_DOC_ISO2_PreChargeReq(struct iso2EXIDocument *exi_doc_ISO2);
+//void PRINT_XML_DOC_ISO2_PowerDeliveryReq(struct iso2EXIDocument *exi_doc_ISO2);
+//void PRINT_XML_DOC_ISO2_CurrentDemandReq(struct iso2EXIDocument *exi_doc_ISO2);
+//void PRINT_XML_DOC_ISO2_WeldingDetectionReq(struct iso2EXIDocument *exi_doc_ISO2);
+//void PRINT_XML_DOC_ISO2_SessionStopReq(struct iso2EXIDocument *exi_doc_ISO2);
+
+void PRINT_V2G_MSG_din_Header(struct dinEXIDocument *exi_doc_DIN);
+void PRINT_V2G_MSG_iso1_Header(struct iso1EXIDocument *exi_doc_ISO1);
+void PRINT_V2G_MSG_iso2_Header(struct iso2EXIDocument *exi_doc_ISO2);
+
+void PRINT_dinPhysicalValueType_UNIT(struct dinPhysicalValueType *obj);
+void PRINT_iso1PhysicalValueType_UNIT(struct iso1PhysicalValueType *obj);
+int GetValue_dinPhysicalValueType(struct dinPhysicalValueType *obj);
+int GetValue_iso1PhysicalValueType(struct iso1PhysicalValueType *obj);
+void PRINT_dinDC_EVStatusType(struct dinDC_EVStatusType *status);
+void PRINT_iso1DC_EVStatusType(struct iso1DC_EVStatusType *status);
+void PRINT_dinDC_EVErrorCodeType(struct dinDC_EVStatusType *status);
+void PRINT_iso1DC_EVErrorCodeType(struct iso1DC_EVStatusType *status);
+float DIN70121PhyValDecode(struct PhysicalValueType_DIN70121 PhysicalData);
+float ISO151182014PhyValDecode(struct PhysicalValueType_ISO15118_2014 PhysicalData);
+
+#if DEBUG_PRINTF_EXI_ENGINE_SHOW == ENABLE
+    #if DEBUG_PRINTF_EXI_ENGINE_BRIEF_SHOW == ENABLE
+        #define DEBUG_PRINTF_EXI_ENGINE_BRIEF      printf
+    #else
+        #define DEBUG_PRINTF_EXI_ENGINE_BRIEF(...)
+    #endif
+
+    #if DEBUG_PRINTF_EXI_ENGINE_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_EXI_ENGINE_DETAIL     printf
+    #else
+        #define DEBUG_PRINTF_EXI_ENGINE_DETAIL(...)
+    #endif
+#else
+    #define DEBUG_PRINTF_EXI_ENGINE_BRIEF(...)
+    #define DEBUG_PRINTF_EXI_ENGINE_DETAIL(...)
+#endif

+ 2 - 1
EVSE/Projects/CCS/Apps/exi_engine/appHandshake/appHandEXIDatatypes.h

@@ -88,7 +88,8 @@ struct appHandAnonType_supportedAppProtocolRes {
 };
 
 /* Complex type name='urn:iso:15118:2:2010:AppProtocol,#AnonType_supportedAppProtocolReq',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(AppProtocol{1-20})',  derivedBy='RESTRICTION'.  */
-#define appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE 5
+//#define appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE 5	//original setting
+#define appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE 20	//modified by Joseph
 struct appHandAnonType_supportedAppProtocolReq {
 	/* element: AppProtocol, Complex type name='urn:iso:15118:2:2010:AppProtocol,AppProtocolType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(ProtocolNamespace,VersionNumberMajor,VersionNumberMinor,SchemaID,Priority)',  derivedBy='RESTRICTION'.  */
 	struct {

+ 1 - 3
EVSE/Projects/CCS/Apps/exi_engine/codec/EXIHeaderDecoder.c

@@ -18,7 +18,7 @@
 /*******************************************************************
  *
  * @author Daniel.Peintner.EXT@siemens.com
- * @version 2017-03-02 
+ * @version 2017-03-02
  * @contact Richard.Kuntschke@siemens.com
  *
  * <p>Code generated by EXIdizer</p>
@@ -64,5 +64,3 @@ int readEXIHeader(bitstream_t* stream) {
 
 
 #endif
-
-

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
EVSE/Projects/CCS/Apps/exi_engine/din/dinEXIDatatypesDecoder.c


+ 1 - 1
EVSE/Projects/CCS/Apps/exi_engine/iso1/iso1EXIDatatypes.h

@@ -44,7 +44,7 @@ extern "C" {
 
 #define SUPPORT_YES 1
 #define SUPPORT_NO 2
-#define DEPLOY_ISO1_CODEC SUPPORT_NO
+#define DEPLOY_ISO1_CODEC SUPPORT_YES
 #define DEPLOY_ISO1_CODEC_FRAGMENT SUPPORT_YES
 
 #if DEPLOY_ISO1_CODEC == SUPPORT_YES

+ 77 - 77
EVSE/Projects/CCS/Apps/exi_engine/iso2/iso2EXIDatatypes.h

@@ -18,7 +18,7 @@
 /*******************************************************************
  *
  * @author Daniel.Peintner.EXT@siemens.com
- * @version 0.9.4 
+ * @version 0.9.4
  * @contact Richard.Kuntschke@siemens.com
  *
  * <p>Code generated by EXIdizer</p>
@@ -44,14 +44,14 @@ extern "C" {
 
 #define SUPPORT_YES 1
 #define SUPPORT_NO 2
-#define DEPLOY_ISO2_CODEC SUPPORT_NO
+#define DEPLOY_ISO2_CODEC SUPPORT_YES
 #define DEPLOY_ISO2_CODEC_FRAGMENT SUPPORT_NO
 
 #if DEPLOY_ISO2_CODEC == SUPPORT_YES
 
 #include <stdint.h>
 
-#include "EXITypes.h"
+#include "../codec/EXITypes.h"
 
 
 /* Datatype definitions and structs for given XML Schema definitions */
@@ -94,8 +94,8 @@ extern "C" {
 
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,RSAKeyValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Modulus,"http://www.w3.org/2000/09/xmldsig#":Exponent)',  derivedBy='RESTRICTION'.  */
-#define iso2RSAKeyValueType_Modulus_BYTES_SIZE 350 
-#define iso2RSAKeyValueType_Exponent_BYTES_SIZE 350 
+#define iso2RSAKeyValueType_Modulus_BYTES_SIZE 350
+#define iso2RSAKeyValueType_Exponent_BYTES_SIZE 350
 struct iso2RSAKeyValueType {
 	/* element: "http://www.w3.org/2000/09/xmldsig#":Modulus, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
 	struct {
@@ -168,7 +168,7 @@ typedef enum {
 } iso2operationModeType;
 
 /* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MagneticVectorSetupType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":GAID,"urn:iso:15118:2:2016:MsgDataTypes":FrequencyChannel)',  derivedBy='RESTRICTION'.  */
-#define iso2MagneticVectorSetupType_GAID_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2MagneticVectorSetupType_GAID_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2MagneticVectorSetupType {
 	/* element: "urn:iso:15118:2:2016:MsgDataTypes":GAID, http://www.w3.org/2001/XMLSchema,ID */
 	struct {
@@ -194,10 +194,10 @@ struct iso2EVFinePositioningParametersType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,ObjectType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((WC[##any])){0-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
-#define iso2ObjectType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2ObjectType_MimeType_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2ObjectType_Encoding_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2ObjectType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2ObjectType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2ObjectType_MimeType_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2ObjectType_Encoding_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2ObjectType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2ObjectType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
 	struct {
@@ -246,9 +246,9 @@ struct iso2MeasurementDataListType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertyType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
-#define iso2SignaturePropertyType_Target_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2SignaturePropertyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2SignaturePropertyType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2SignaturePropertyType_Target_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2SignaturePropertyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2SignaturePropertyType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2SignaturePropertyType {
 	/* attribute: Target {http://www.w3.org/2001/XMLSchema,anyURI} */
 	struct {
@@ -270,9 +270,9 @@ struct iso2SignaturePropertyType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"])|"http://www.w3.org/2000/09/xmldsig#":XPath){0-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
-#define iso2TransformType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR 
-#define iso2TransformType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2TransformType_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2TransformType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define iso2TransformType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2TransformType_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2TransformType_XPath_ARRAY_SIZE 1
 struct iso2TransformType {
 	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
@@ -302,8 +302,8 @@ typedef enum {
 } iso2EVSENotificationType;
 
 /* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EMAIDType',  base type name='eMAIDType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
-#define iso2EMAIDType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2EMAIDType_CONTENT_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2EMAIDType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2EMAIDType_CONTENT_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2EMAIDType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
 	struct {
@@ -318,13 +318,13 @@ struct iso2EMAIDType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,DSAKeyValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("http://www.w3.org/2000/09/xmldsig#":P,"http://www.w3.org/2000/09/xmldsig#":Q){0-1},"http://www.w3.org/2000/09/xmldsig#":G{0-1},"http://www.w3.org/2000/09/xmldsig#":Y,"http://www.w3.org/2000/09/xmldsig#":J{0-1},("http://www.w3.org/2000/09/xmldsig#":Seed,"http://www.w3.org/2000/09/xmldsig#":PgenCounter){0-1})',  derivedBy='RESTRICTION'.  */
-#define iso2DSAKeyValueType_P_BYTES_SIZE 350 
-#define iso2DSAKeyValueType_Q_BYTES_SIZE 350 
-#define iso2DSAKeyValueType_G_BYTES_SIZE 350 
-#define iso2DSAKeyValueType_Y_BYTES_SIZE 350 
-#define iso2DSAKeyValueType_J_BYTES_SIZE 350 
-#define iso2DSAKeyValueType_Seed_BYTES_SIZE 350 
-#define iso2DSAKeyValueType_PgenCounter_BYTES_SIZE 350 
+#define iso2DSAKeyValueType_P_BYTES_SIZE 350
+#define iso2DSAKeyValueType_Q_BYTES_SIZE 350
+#define iso2DSAKeyValueType_G_BYTES_SIZE 350
+#define iso2DSAKeyValueType_Y_BYTES_SIZE 350
+#define iso2DSAKeyValueType_J_BYTES_SIZE 350
+#define iso2DSAKeyValueType_Seed_BYTES_SIZE 350
+#define iso2DSAKeyValueType_PgenCounter_BYTES_SIZE 350
 struct iso2DSAKeyValueType {
 	/* element: "http://www.w3.org/2000/09/xmldsig#":P, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
 	struct {
@@ -395,7 +395,7 @@ struct iso2EVSEEnergyTransferParameterType {
 };
 
 /* Complex type name='urn:iso:15118:2:2016:MsgBody,MeteringReceiptReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":SessionID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo)',  derivedBy='EXTENSION'.  */
-#define iso2MeteringReceiptReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2MeteringReceiptReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2MeteringReceiptReqType_SessionID_BYTES_SIZE 8 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,sessionIDType is 8 */
 struct iso2MeteringReceiptReqType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -416,7 +416,7 @@ struct iso2MeteringReceiptReqType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyValueType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":DSAKeyValue|"http://www.w3.org/2000/09/xmldsig#":RSAKeyValue|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))',  derivedBy='RESTRICTION'.  */
-#define iso2KeyValueType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2KeyValueType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2KeyValueType {
 	/* element: "http://www.w3.org/2000/09/xmldsig#":DSAKeyValue, Complex type name='http://www.w3.org/2000/09/xmldsig#,DSAKeyValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("http://www.w3.org/2000/09/xmldsig#":P,"http://www.w3.org/2000/09/xmldsig#":Q){0-1},"http://www.w3.org/2000/09/xmldsig#":G{0-1},"http://www.w3.org/2000/09/xmldsig#":Y,"http://www.w3.org/2000/09/xmldsig#":J{0-1},("http://www.w3.org/2000/09/xmldsig#":Seed,"http://www.w3.org/2000/09/xmldsig#":PgenCounter){0-1})',  derivedBy='RESTRICTION'.  */
 	struct iso2DSAKeyValueType DSAKeyValue ;
@@ -450,7 +450,7 @@ struct iso2BodyBaseType {
 };
 
 /* Complex type name='urn:iso:15118:2:2016:MsgBody,AuthorizationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":GenChallenge{0-1})',  derivedBy='EXTENSION'.  */
-#define iso2AuthorizationReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2AuthorizationReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2AuthorizationReqType_GenChallenge_BYTES_SIZE 16 /* XML schema facet length for urn:iso:15118:2:2016:MsgDataTypes,genChallengeType is 16 */
 struct iso2AuthorizationReqType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -468,9 +468,9 @@ struct iso2AuthorizationReqType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SPKIDataType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":SPKISexp,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-1}){1-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
-#define iso2SPKIDataType_SPKISexp_BYTES_SIZE 350 
+#define iso2SPKIDataType_SPKISexp_BYTES_SIZE 350
 #define iso2SPKIDataType_SPKISexp_ARRAY_SIZE 1
-#define iso2SPKIDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2SPKIDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2SPKIDataType {
 	/* element: "http://www.w3.org/2000/09/xmldsig#":SPKISexp, http://www.w3.org/2001/XMLSchema,base64Binary */
 	struct {
@@ -489,8 +489,8 @@ struct iso2SPKIDataType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureMethodType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":HMACOutputLength{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
-#define iso2SignatureMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR 
-#define iso2SignatureMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2SignatureMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define iso2SignatureMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2SignatureMethodType {
 	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
 	struct {
@@ -530,8 +530,8 @@ typedef enum {
 } iso2chargeProgressType;
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,CanonicalizationMethodType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((WC[##any]){0-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
-#define iso2CanonicalizationMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR 
-#define iso2CanonicalizationMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2CanonicalizationMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define iso2CanonicalizationMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2CanonicalizationMethodType {
 	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
 	struct {
@@ -585,8 +585,8 @@ typedef enum {
 } iso2costKindType;
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,DigestMethodType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
-#define iso2DigestMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR 
-#define iso2DigestMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2DigestMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define iso2DigestMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2DigestMethodType {
 	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
 	struct {
@@ -708,7 +708,7 @@ struct iso2EVEnergyTransferParameterType {
 };
 
 /* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ContractSignatureEncryptedPrivateKeyType',  base type name='encryptedPrivateKeyType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
-#define iso2ContractSignatureEncryptedPrivateKeyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2ContractSignatureEncryptedPrivateKeyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2ContractSignatureEncryptedPrivateKeyType_CONTENT_BYTES_SIZE 350
 struct iso2ContractSignatureEncryptedPrivateKeyType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -767,7 +767,7 @@ typedef enum {
 } iso2responseCodeType;
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)',  derivedBy='RESTRICTION'.  */
-#define iso2X509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2X509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2X509IssuerSerialType {
 	/* element: "http://www.w3.org/2000/09/xmldsig#":X509IssuerName, http://www.w3.org/2001/XMLSchema,string */
 	struct {
@@ -800,9 +800,9 @@ typedef enum {
 } iso2EVSECheckOutStatusType;
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,PGPDataType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("http://www.w3.org/2000/09/xmldsig#":PGPKeyID,"http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket{0-1},(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED})|("http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket,(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]){0-UNBOUNDED}))',  derivedBy='RESTRICTION'.  */
-#define iso2PGPDataType_PGPKeyID_BYTES_SIZE 350 
-#define iso2PGPDataType_PGPKeyPacket_BYTES_SIZE 350 
-#define iso2PGPDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2PGPDataType_PGPKeyID_BYTES_SIZE 350
+#define iso2PGPDataType_PGPKeyPacket_BYTES_SIZE 350
+#define iso2PGPDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2PGPDataType {
 	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPKeyID, http://www.w3.org/2001/XMLSchema,base64Binary */
 	struct {
@@ -856,7 +856,7 @@ struct iso2SensorType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureValueType',  base type name='base64Binary',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
-#define iso2SignatureValueType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2SignatureValueType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2SignatureValueType_CONTENT_BYTES_SIZE 350
 struct iso2SignatureValueType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -902,7 +902,7 @@ typedef enum {
 } iso2EVSEErrorCodeType;
 
 /* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DiffieHellmanPublickeyType',  base type name='dHpublickeyType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
-#define iso2DiffieHellmanPublickeyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2DiffieHellmanPublickeyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2DiffieHellmanPublickeyType_CONTENT_BYTES_SIZE 350
 struct iso2DiffieHellmanPublickeyType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -961,15 +961,15 @@ struct iso2MV_EVSEFinePositioningSetupParametersType {
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,X509DataType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial|"http://www.w3.org/2000/09/xmldsig#":X509SKI|"http://www.w3.org/2000/09/xmldsig#":X509SubjectName|"http://www.w3.org/2000/09/xmldsig#":X509Certificate|"http://www.w3.org/2000/09/xmldsig#":X509CRL|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"]))){1-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
 #define iso2X509DataType_X509IssuerSerial_ARRAY_SIZE 1
-#define iso2X509DataType_X509SKI_BYTES_SIZE 350 
+#define iso2X509DataType_X509SKI_BYTES_SIZE 350
 #define iso2X509DataType_X509SKI_ARRAY_SIZE 1
-#define iso2X509DataType_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2X509DataType_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2X509DataType_X509SubjectName_ARRAY_SIZE 1
-#define iso2X509DataType_X509Certificate_BYTES_SIZE 350 
+#define iso2X509DataType_X509Certificate_BYTES_SIZE 350
 #define iso2X509DataType_X509Certificate_ARRAY_SIZE 1
-#define iso2X509DataType_X509CRL_BYTES_SIZE 350 
+#define iso2X509DataType_X509CRL_BYTES_SIZE 350
 #define iso2X509DataType_X509CRL_ARRAY_SIZE 1
-#define iso2X509DataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2X509DataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2X509DataType {
 	/* element: "http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial, Complex type name='http://www.w3.org/2000/09/xmldsig#,X509IssuerSerialType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":X509IssuerName,"http://www.w3.org/2000/09/xmldsig#":X509SerialNumber)',  derivedBy='RESTRICTION'.  */
 	struct {
@@ -1168,7 +1168,7 @@ struct iso2ServiceDiscoveryReqType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignaturePropertiesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":SignatureProperty{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
-#define iso2SignaturePropertiesType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2SignaturePropertiesType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2SignaturePropertiesType_SignatureProperty_ARRAY_SIZE 1
 struct iso2SignaturePropertiesType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -1316,8 +1316,8 @@ struct iso2TransformsType {
 };
 
 /* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":boolValue|"urn:iso:15118:2:2016:MsgDataTypes":byteValue|"urn:iso:15118:2:2016:MsgDataTypes":shortValue|"urn:iso:15118:2:2016:MsgDataTypes":intValue|"urn:iso:15118:2:2016:MsgDataTypes":physicalValue|"urn:iso:15118:2:2016:MsgDataTypes":stringValue)',  derivedBy='RESTRICTION'.  */
-#define iso2ParameterType_Name_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2ParameterType_stringValue_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2ParameterType_Name_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2ParameterType_stringValue_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2ParameterType {
 	/* attribute: Name {http://www.w3.org/2001/XMLSchema,string} */
 	struct {
@@ -1386,7 +1386,7 @@ struct iso2DC_EVSEChargeParameterType {
 };
 
 /* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Certificate,"urn:iso:15118:2:2016:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
-#define iso2CertificateChainType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2CertificateChainType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2CertificateChainType_Certificate_BYTES_SIZE 800 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,certificateType is 800 */
 struct iso2CertificateChainType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -1460,10 +1460,10 @@ struct iso2SessionSetupResType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,ReferenceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1},"http://www.w3.org/2000/09/xmldsig#":DigestMethod,"http://www.w3.org/2000/09/xmldsig#":DigestValue)',  derivedBy='RESTRICTION'.  */
-#define iso2ReferenceType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2ReferenceType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2ReferenceType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2ReferenceType_DigestValue_BYTES_SIZE 350 
+#define iso2ReferenceType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2ReferenceType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2ReferenceType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2ReferenceType_DigestValue_BYTES_SIZE 350
 struct iso2ReferenceType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
 	struct {
@@ -1808,7 +1808,7 @@ struct iso2DC_EVBidirectionalParameterType {
 };
 
 /* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MagneticVectorType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":GAID,"urn:iso:15118:2:2016:MsgDataTypes":Distance,"urn:iso:15118:2:2016:MsgDataTypes":AngleGAtoVA,"urn:iso:15118:2:2016:MsgDataTypes":RotationVAtoGA,"urn:iso:15118:2:2016:MsgDataTypes":FODStatus)',  derivedBy='RESTRICTION'.  */
-#define iso2MagneticVectorType_GAID_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2MagneticVectorType_GAID_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2MagneticVectorType {
 	/* element: "urn:iso:15118:2:2016:MsgDataTypes":GAID, http://www.w3.org/2001/XMLSchema,ID */
 	struct {
@@ -1868,7 +1868,7 @@ struct iso2PaymentServiceSelectionResType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,ManifestType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
-#define iso2ManifestType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2ManifestType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2ManifestType_Reference_ARRAY_SIZE 1
 struct iso2ManifestType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -2073,7 +2073,7 @@ struct iso2ChargingProfileType {
 };
 
 /* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SalesTariffType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SalesTariffID,"urn:iso:15118:2:2016:MsgDataTypes":SalesTariffDescription{0-1},"urn:iso:15118:2:2016:MsgDataTypes":NumEPriceLevels{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SalesTariffEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
-#define iso2SalesTariffType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2SalesTariffType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2SalesTariffType_SalesTariffDescription_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,tariffDescriptionType is 32 */
 #define iso2SalesTariffType_SalesTariffEntry_ARRAY_SIZE 5
 struct iso2SalesTariffType {
@@ -2101,7 +2101,7 @@ struct iso2SalesTariffType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignedInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod,"http://www.w3.org/2000/09/xmldsig#":SignatureMethod,"http://www.w3.org/2000/09/xmldsig#":Reference{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
-#define iso2SignedInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2SignedInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2SignedInfoType_Reference_ARRAY_SIZE 1
 struct iso2SignedInfoType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -2133,8 +2133,8 @@ struct iso2PowerDeliveryResType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,RetrievalMethodType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transforms{0-1})',  derivedBy='RESTRICTION'.  */
-#define iso2RetrievalMethodType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2RetrievalMethodType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2RetrievalMethodType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2RetrievalMethodType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2RetrievalMethodType {
 	/* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */
 	struct {
@@ -2240,7 +2240,7 @@ struct iso2DC_BidirectionalControlReqType {
 };
 
 /* Complex type name='urn:iso:15118:2:2016:MsgBody,CertificateUpdateReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2016:MsgBody":eMAID,"urn:iso:15118:2:2016:MsgBody":ListOfRootCertificateIDs)',  derivedBy='EXTENSION'.  */
-#define iso2CertificateUpdateReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2CertificateUpdateReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2CertificateUpdateReqType_eMAID_CHARACTERS_SIZE 15 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,eMAIDType is 15 */
 struct iso2CertificateUpdateReqType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -2289,7 +2289,7 @@ struct iso2AlignmentCheckReqType {
 };
 
 /* Complex type name='urn:iso:15118:2:2016:MsgBody,CertificateInstallationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":OEMProvisioningCert,"urn:iso:15118:2:2016:MsgBody":ListOfRootCertificateIDs)',  derivedBy='EXTENSION'.  */
-#define iso2CertificateInstallationReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2CertificateInstallationReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2CertificateInstallationReqType_OEMProvisioningCert_BYTES_SIZE 800 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,certificateType is 800 */
 struct iso2CertificateInstallationReqType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -2435,14 +2435,14 @@ struct iso2FinePositioningSetupReqType {
 	/* substitutionGroup */
 #if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
 	union {
-#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
 		/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVFinePositioningSetupParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVFinePositioningSetupParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
 		struct iso2EVFinePositioningSetupParametersType EVFinePositioningSetupParameters ;
 		/* element: "urn:iso:15118:2:2016:MsgDataTypes":LFA_EVFinePositioningSetupParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVFinePositioningSetupParametersType',  base type name='EVFinePositioningSetupParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NumberOfSensors,"urn:iso:15118:2:2016:MsgDataTypes":SensorList,"urn:iso:15118:2:2016:MsgDataTypes":SensorOrder,"urn:iso:15118:2:2016:MsgDataTypes":SignalPulseDuration,"urn:iso:15118:2:2016:MsgDataTypes":SignalSeparationTime,"urn:iso:15118:2:2016:MsgDataTypes":PackageSeparationTime,"urn:iso:15118:2:2016:MsgDataTypes":AlignmentOffset)',  derivedBy='EXTENSION'.  */
 		struct iso2LFA_EVFinePositioningSetupParametersType LFA_EVFinePositioningSetupParameters ;
 #if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
 	};
-#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
 		unsigned int EVFinePositioningSetupParameters_isUsed:1;
 		unsigned int LFA_EVFinePositioningSetupParameters_isUsed:1;
 };
@@ -2549,17 +2549,17 @@ struct iso2LFA_EVFinePositioningParametersType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,KeyInfoType',  base type name='anyType',  content type='MIXED',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":KeyName|"http://www.w3.org/2000/09/xmldsig#":KeyValue|"http://www.w3.org/2000/09/xmldsig#":RetrievalMethod|"http://www.w3.org/2000/09/xmldsig#":X509Data|"http://www.w3.org/2000/09/xmldsig#":PGPData|"http://www.w3.org/2000/09/xmldsig#":SPKIData|"http://www.w3.org/2000/09/xmldsig#":MgmtData|(WC[##other:"http://www.w3.org/2000/09/xmldsig#"])){1-UNBOUNDED}',  derivedBy='RESTRICTION'.  */
-#define iso2KeyInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
-#define iso2KeyInfoType_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2KeyInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2KeyInfoType_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2KeyInfoType_KeyName_ARRAY_SIZE 1
 #define iso2KeyInfoType_KeyValue_ARRAY_SIZE 1
 #define iso2KeyInfoType_RetrievalMethod_ARRAY_SIZE 1
 #define iso2KeyInfoType_X509Data_ARRAY_SIZE 1
 #define iso2KeyInfoType_PGPData_ARRAY_SIZE 1
 #define iso2KeyInfoType_SPKIData_ARRAY_SIZE 1
-#define iso2KeyInfoType_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2KeyInfoType_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2KeyInfoType_MgmtData_ARRAY_SIZE 1
-#define iso2KeyInfoType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2KeyInfoType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
 struct iso2KeyInfoType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
 	struct {
@@ -2632,7 +2632,7 @@ struct iso2FinePositioningReqType {
 };
 
 /* Complex type name='http://www.w3.org/2000/09/xmldsig#,SignatureType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":SignedInfo,"http://www.w3.org/2000/09/xmldsig#":SignatureValue,"http://www.w3.org/2000/09/xmldsig#":KeyInfo{0-1},"http://www.w3.org/2000/09/xmldsig#":Object{0-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
-#define iso2SignatureType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define iso2SignatureType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
 #define iso2SignatureType_Object_ARRAY_SIZE 1
 struct iso2SignatureType {
 	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
@@ -2764,7 +2764,7 @@ struct iso2BodyType {
 	/* substitutionGroup */
 #if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
 	union {
-#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
 		/* element: "urn:iso:15118:2:2016:MsgBody":BodyElement, Complex type name='urn:iso:15118:2:2016:MsgBody,BodyBaseType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
 		struct iso2BodyBaseType BodyElement ;
 		/* element: "urn:iso:15118:2:2016:MsgBody":V2GRequest, Complex type name='urn:iso:15118:2:2016:MsgBody,BodyBaseType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
@@ -2889,7 +2889,7 @@ struct iso2BodyType {
 		struct iso2SessionSetupResType SessionSetupRes ;
 #if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
 	};
-#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
 		unsigned int BodyElement_isUsed:1;
 		unsigned int V2GRequest_isUsed:1;
 		unsigned int DisconnectChargingDeviceReq_isUsed:1;
@@ -3004,7 +3004,7 @@ struct iso2AnonType_V2G_Message {
 struct iso2EXIDocument {
 #if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
 	union {
-#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
 	struct iso2AnonType_V2G_Message V2G_Message ;
 	struct iso2ServiceDiscoveryReqType ServiceDiscoveryReq ;
 	struct iso2ServiceDiscoveryResType ServiceDiscoveryRes ;
@@ -3130,7 +3130,7 @@ struct iso2EXIDocument {
 	struct iso2ObjectType Object ;
 #if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
 	};
-#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
 	unsigned int V2G_Message_isUsed:1;
 	unsigned int ServiceDiscoveryReq_isUsed:1;
 	unsigned int ServiceDiscoveryRes_isUsed:1;
@@ -3256,7 +3256,7 @@ struct iso2EXIDocument {
 struct iso2EXIFragment {
 #if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
 	union {
-#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
 	struct iso2PhysicalValueType EVMaximumVoltage ;
 	uint32_t FrequencyChannel ;
 	iso2EVSEProcessingType EVProcessing ;
@@ -3682,7 +3682,7 @@ struct iso2EXIFragment {
 	uint16_t TargetOffsetX ;
 #if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
 	};
-#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
 	unsigned int EVMaximumVoltage_isUsed:1;
 	unsigned int FrequencyChannel_isUsed:1;
 	unsigned int EVProcessing_isUsed:1;

+ 2 - 2
EVSE/Projects/CCS/Apps/exi_engine/iso2/iso2EXIDatatypesDecoder.h

@@ -18,7 +18,7 @@
 /*******************************************************************
  *
  * @author Daniel.Peintner.EXT@siemens.com
- * @version 0.9.4 
+ * @version 0.9.4
  * @contact Richard.Kuntschke@siemens.com
  *
  * <p>Code generated by EXIdizer</p>
@@ -48,7 +48,7 @@ extern "C" {
 
 #include <stdint.h>
 
-#include "EXITypes.h"
+#include "../codec/EXITypes.h"
 
 int decode_iso2ExiDocument(bitstream_t* stream, struct iso2EXIDocument* exiDoc);
 

+ 2 - 2
EVSE/Projects/CCS/Apps/exi_engine/iso2/iso2EXIDatatypesEncoder.h

@@ -18,7 +18,7 @@
 /*******************************************************************
  *
  * @author Daniel.Peintner.EXT@siemens.com
- * @version 0.9.4 
+ * @version 0.9.4
  * @contact Richard.Kuntschke@siemens.com
  *
  * <p>Code generated by EXIdizer</p>
@@ -49,7 +49,7 @@ extern "C" {
 
 #include <stdint.h>
 
-#include "EXITypes.h"
+#include "../codec/EXITypes.h"
 
 
 int encode_iso2ExiDocument(bitstream_t* stream, struct iso2EXIDocument* exiDoc);

+ 11 - 3
EVSE/Projects/CCS/Apps/exi_engine/test/main.c

@@ -28,13 +28,22 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-
+#include <sys/timeb.h>
+#include <time.h>
 #include "main.h"
 
-int main(int argc, char *argv[]) {
+void JSPH_Test()
+{
+
+}
+
+int main(int argc, char *argv[])
+{
     /* disable buffering of output, especially when piped or redirected */
     setvbuf(stdout, NULL, _IONBF, 0);
 
+    JSPH_Test();
+
 #if CODE_VERSION == CODE_VERSION_EXI
 	/* EXI codec only */
 	return main_databinder(argc, argv);
@@ -44,4 +53,3 @@ int main(int argc, char *argv[]) {
 #endif
 
 }
-

+ 175 - 10
EVSE/Projects/CCS/Apps/exi_engine/test/main_example.c

@@ -69,10 +69,13 @@
 
 #include "../transport/v2gtp.h"
 
+//#include "../../SeccComm.h"
+
 #define BUFFER_SIZE 256
 uint8_t buffer1[BUFFER_SIZE];
 uint8_t buffer2[BUFFER_SIZE];
 
+
 #define ERROR_UNEXPECTED_REQUEST_MESSAGE -601
 #define ERROR_UNEXPECTED_SESSION_SETUP_RESP_MESSAGE -602
 #define ERROR_UNEXPECTED_SERVICE_DISCOVERY_RESP_MESSAGE -602
@@ -90,6 +93,35 @@ uint8_t buffer2[BUFFER_SIZE];
 #define ERROR_UNEXPECTED_CURRENT_DEMAND_RESP_MESSAGE -613
 #define ERROR_UNEXPECTED_WELDING_DETECTION_RESP_MESSAGE -614
 
+/*===========================================================================
+FUNCTION: PRINT_XML_DOC_DIN_ServiceDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void PRINT_XML_DOC_DIN_ServiceDiscoveryReq(struct dinEXIDocument *exi_doc_DIN)
+{
+    int i = 0;
+    printf("\n\n⬇⨀⨀⨀⨀⨀ [START] Parsing ServiceDiscoveryReq ⨀⨀⨀⨀⨀⬇\n");
+
+    //Service Scope
+    int leng = 0;
+    leng = exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.charactersLen;
+    printf("\tServieScope (%d Bytes)= ", leng);
+    for (i = 0; i <leng ; i++)
+    {
+        printf("%02X", exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
+    }
+
+    //Service Category
+    printf("\n\tServiceCategory = %d (DEC)",
+            exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory);
+    printf("\n\t([1]EVCharging, [2]Internet, [3]ContractCertificate, [4]OtherCustom)\n");
+    printf("⬆⨂⨂⨂⨂⨂ [END] Parsing ServiceDiscoveryReq ⨂⨂⨂⨂⨂⬆\n\n");
+}
+
 
 static int writeStringToEXIString(char* string, exi_string_character_t* exiString) {
 	int pos = 0;
@@ -135,9 +167,21 @@ static int appHandshakeHandler(bitstream_t* iStream, bitstream_t* oStream) {
 	int errn = 0;
 	uint32_t payloadLengthDec;
 
+	#if 1
+	printf("\n\n -----------  Content of iStream [START]------------\n\n");
+	printf("\t size (DEC): %d\n", (int)iStream->size);
+	printf("\t pos  (DEC): %ld\n", *iStream->pos);
+	printf("\t data (HEX): ");
+	for (i=0; i<68; i++)	//0x44 = 68, i.e. the length of payload
+	{
+		printf("%02X", iStream->data[i+8]);	//V2GTP Payload without 8-Byte Header
+	}
+	printf("\n\n -----------  Content of iStream [END] ------------\n\n");
+	#endif
 
 	if ( (errn = read_v2gtpHeader(iStream->data, &payloadLengthDec)) == 0) {
 		*iStream->pos = V2GTP_HEADER_LENGTH;
+		printf("\t pos: %ld\n", *iStream->pos);	//added by Joseph
 		if( (errn = decode_appHandExiDocument(iStream, &exiDoc)) ) {
 			/* an error occured */
 			return errn;
@@ -145,13 +189,10 @@ static int appHandshakeHandler(bitstream_t* iStream, bitstream_t* oStream) {
 
 	}
 
-
-
-
-
 	printf("EVSE side: List of application handshake protocols of the EV \n");
 
-	for(i=0;i<exiDoc.supportedAppProtocolReq.AppProtocol.arrayLen;i++) {
+	for(i=0;i<exiDoc.supportedAppProtocolReq.AppProtocol.arrayLen;i++)
+	{
 		printf("\tProtocol entry #=%d\n",(i+1));
 		printf("\t\tProtocolNamespace=");
 		printASCIIString(exiDoc.supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.characters, exiDoc.supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.charactersLen);
@@ -169,11 +210,11 @@ static int appHandshakeHandler(bitstream_t* iStream, bitstream_t* oStream) {
 	appHandResp.supportedAppProtocolRes.SchemaID_isUsed = 1u;
 
 	*oStream->pos = V2GTP_HEADER_LENGTH;
-	if( (errn = encode_appHandExiDocument(oStream, &appHandResp)) == 0) {
+	if( (errn = encode_appHandExiDocument(oStream, &appHandResp)) == 0)
+	{
 		errn = write_v2gtpHeader(oStream->data, (*oStream->pos)-V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
 	}
 
-
 	return errn;
 }
 
@@ -2204,10 +2245,127 @@ static int charging1()
 #endif /* DEPLOY_ISO1_CODEC == SUPPORT_YES */
 
 
+/*===========================================================================
+FUNCTION: din_test_decode_SessionSetupReq
+DESCRIPTION:
+	The original V2GTP EXI stream is as below.
+		SIZE: 			20 (Bytes, DEC)
+		TOTAL: 			01fe80010000000c809a004011d0111d5d155800
+		HEADER (HEX): 	01FE80010000000C
+		EXI (HEX): 		809A004011D0111D5D155800
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int din_test_decode_SessionSetupReq()
+{
+	int errn = 0;
+	struct dinEXIDocument exiDin;
+	bitstream_t stream;
+	uint8_t buffer[] = {0x80, 0x9A, 0x00, 0x40, 0x11, 0xD0, 0x11, 0x1D, 0x5D, 0x15, 0x58, 0x00};
+	size_t pos = 0;
+	stream.size = BUFFER_SIZE;
+	stream.data = buffer;
+	stream.pos = &pos;
+
+	errn = decode_dinExiDocument(&stream, &exiDin);
 
+	if(errn != 0)
+	{
+		printf("\n\n[SessionSetupReq] DIN test error %d!\n", errn);
+		return errn;
+	}
+	else if (pos != 0x0C)	//[CAUTION] length
+	{
+		printf("\n\n[SessionSetupReq] DIN warning. not all bytes read! (pos = %ld)\n", pos);
+		errn = -1;
+		return errn;
+	}
+	else
+	{
+		unsigned int tmp = 0;
+		tmp = exiDin.V2G_Message.Body.SessionSetupReq_isUsed;
+		if (tmp == 1u)
+		{
+			printf("\n ---------- [din_test_decode_SessionSetupReq] ----------\n \
+				\t - SessionSetupReq is decoded OK!\n\
+				\t - SessionSetupReq_isUsed = %d\
+				\n", tmp);
+		}
+		else
+		{
+			printf("[ERROR][din_test_decode_SessionSetupReq] SessionSetupReq_isUsed = %d\n", tmp);
+		}
+
+	}
+	return errn;
+}
+
+
+/*===========================================================================
+FUNCTION: din_test_ServiceDiscoveryReq
+DESCRIPTION:
+	The original V2GTP EXI stream is as below.
+		SIZE: 			15 (Bytes, DEC)
+		TOTAL:			01fe800100000007809a0040119400
+		HEADER (HEX): 	01FE800100000007
+		EXI (HEX): 		809A0040119400
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int din_test_decode_ServiceDiscoveryReq()
+{
+	int errn = 0;
+	struct dinEXIDocument exiDin;
+	bitstream_t stream;
+	uint8_t buffer[] = {0x80, 0x9A, 0x00, 0x40, 0x11, 0x94, 0x00};
+	size_t pos = 0;
+	stream.size = BUFFER_SIZE;
+	stream.data = buffer;
+	stream.pos = &pos;
+
+	errn = decode_dinExiDocument(&stream, &exiDin);
+
+	if(errn != 0)
+	{
+		printf("\n\n[ServiceDiscoveryReq] DIN test error %d!\n", errn);
+		return errn;
+	}
+	else if (pos != 0x07) //[CAUTION] length
+	{
+		printf("\n\n[ServiceDiscoveryReq] DIN warning. not all bytes read! (pos = %ld)\n", pos);
+		errn = -1;
+		return errn;
+	}
+	else
+	{
+		unsigned int tmp = 0;
+		tmp = exiDin.V2G_Message.Body.ServiceDiscoveryReq_isUsed;
+		if (tmp == 1u)
+		{
+			printf("\n ---------- [din_test_decode_ServiceDiscoveryReq] ----------\n\
+			\t - ServiceDiscoveryReq is decoded OK!\n\
+			\t - ServiceDiscoveryReq_isUsed = %d\n", tmp);
+			PRINT_XML_DOC_DIN_ServiceDiscoveryReq(&exiDin);
+		}
+		else
+		{
+			printf("[ERROR][din_test_decode_ServiceDiscoveryReq] ServiceDiscoveryReq_isUsed = %d\n", tmp);
+		}
+
+	}
+
+	return errn;
+}
 
 #if DEPLOY_DIN_CODEC == SUPPORT_YES
-static int din_test() {
+static int din_test()
+{
 	int errn = 0;
 
 	struct dinEXIDocument exiDin1;
@@ -2215,6 +2373,7 @@ static int din_test() {
 
 	bitstream_t stream1;
 	bitstream_t stream2;
+
 	size_t pos1 = 0;
 	size_t pos2 = 0;
 
@@ -2226,6 +2385,9 @@ static int din_test() {
 	stream2.data = buffer2;
 	stream2.pos = &pos2;
 
+	errn = din_test_decode_SessionSetupReq();		//added by Joseph
+	errn = din_test_decode_ServiceDiscoveryReq();	//added by Joseph
+
 	/* SetupSessionReq  */
 	/* BMW: 80 9A 00 11 D0 20 00 03 C1 FC 30 00 43 F8 00 */
 	buffer1[0] = 0x80;
@@ -2260,10 +2422,13 @@ static int din_test() {
 		);
 
 
-	if(errn != 0) {
+	if(errn != 0)
+	{
 		printf("\n\nDIN test error %d!\n", errn);
 		return errn;
-	} else if (pos1 != 15) {
+	}
+	else if (pos1 != 15)
+	{
 		printf("\n\nDIN warning. not all bytes read!\n");
 		errn = -1;
 		return errn;

+ 262 - 136
EVSE/Projects/CCS/Apps/main.c

@@ -27,14 +27,16 @@
 #include "define.h"
 #include "main.h"
 
-#define Debug
 
 struct SysConfigAndInfo     *ShmSysConfigAndInfo;
 struct StatusCodeData       *ShmStatusCodeData;
 struct CcsData              *ShmCcsData;
 struct InternalComm         *ShmInternalComm;
+struct InternalCommAC       *ShmInternalCommAC;
 
-#ifdef SystemLogMessage
+unsigned char buf_log_main[SIZE_OF_LOG_BUFFER];
+
+#if SAVE_SYS_LOG_MSG_MAIN_SWITCH == ENABLE
 int StoreLogMsg(unsigned char *DataString);
 #endif
 
@@ -43,8 +45,8 @@ void CreateShareMemory_Init();
 void GPIO_Init();
 void PWM_Init();
 void Confinguration_Init();
-int DiffTimeb(struct timeb ST, struct timeb ET);
-int CreatShareMemory();
+double DiffTimeb(struct timeb ST, struct timeb ET);
+int CreateShareMemory();
 int LoadSysConfigAndInfo(struct SysConfigData *ptr);
 int SpawnTask();
 int StoreUsrConfigData(struct SysConfigData *UsrData);
@@ -62,6 +64,11 @@ GLOBAL VARIABLES:
 =============================================================================*/
 int main(int argc, char *argv[])
 {
+    SAVE_SYS_LOG_MSG_MAIN("ccs: on");
+    SAVE_SYS_LOG_MSG_MAIN("---------------------------------------------");
+    SAVE_SYS_LOG_MSG_MAIN("--                   MAIN                  --");
+    SAVE_SYS_LOG_MSG_MAIN("---------------------------------------------\n");
+
     //int Rtn = 0;
     //unsigned int StartTime;
     //struct timeb StartChargingTime, CurrentChargingTime, ChargingLoopTime;
@@ -71,7 +78,7 @@ int main(int argc, char *argv[])
     System_Init();
 
     //task spawn
-    //SpawnTask();
+    SpawnTask();
 
     /**************************************************************/
     /************** main Loop********************************/
@@ -79,11 +86,64 @@ int main(int argc, char *argv[])
 
     while(1)
     {
+        //Sleep to reduce CPU power comsumption
         sleep(5);
     }//main while
 
 }
 
+/*===========================================================================
+FUNCTION: Eth0_PortSetting
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Eth0_PortSetting_Base(unsigned char addr)
+{
+    SAVE_SYS_LOG_MSG_MAIN("[Eth0_PortSetting]start");
+
+    unsigned char cmd[128];
+    if ((addr >= 20) && (addr <= (255-20-1)))   //preserved for dynamic IP and QCA7000
+    {
+        //Step 0: shutdown eth0
+        #if 0
+        SAVE_SYS_LOG_MSG_MAIN("[Eth0_PortSetting][eth0]down");
+        system("/sbin/ifconfig eth0 down");
+        sleep(1);
+        #endif
+
+        //Step 1: eth0 setting
+        sprintf(buf_log_main,
+                "[Eth0_PortSetting][eth0]IP >> 192.168.0.%d(up)",
+                addr);
+        SAVE_SYS_LOG_MSG_MAIN(buf_log_main);
+        sprintf(cmd, "/sbin/ifconfig eth0 192.168.0.%d netmask 255.255.255.0 up", addr);
+        system(cmd);
+        memset(cmd, 0, sizeof(cmd));
+        sleep(1);
+
+        //Step 2: add route
+        system("/sbin/route add default gw 192.168.0.1");
+
+        //Step 3: done
+        sprintf(buf_log_main,
+                "[Eth0_PortSetting]done");
+        SAVE_SYS_LOG_MSG_MAIN(buf_log_main);
+        return PASS;
+    }
+    else
+    {
+        sprintf(buf_log_main,
+                "[Eth0_PortSetting][Error]addr(%d) is out of range(20~234)",
+                addr);
+        SAVE_SYS_LOG_MSG_MAIN(buf_log_main);
+        return FAIL;
+    }
+}
+
+
 /*===========================================================================
 FUNCTION: System_Init
 DESCRIPTION:
@@ -97,7 +157,58 @@ GLOBAL VARIABLES:
 =============================================================================*/
 void System_Init()
 {
-    // ---------- Hardware Init ----------
+    //RTC Update
+    time_t rtc_new;
+    rtc_new = RTC_DEFAULT_TIME; //Epoch time
+    stime(&rtc_new);
+    system("date");
+    sprintf(buf_log_main, "[RTC]%d (DEC)\n", rtc_new);
+    SAVE_SYS_LOG_MSG_MAIN(buf_log_main);
+
+    //-----------------------------------
+    //Print Linux Kernel Version
+    sprintf(buf_log_main, "\nLinux Image SHA1: %s\n", LINUX_IMAGE_VERSION);
+    SAVE_SYS_LOG_MSG_MAIN(buf_log_main);
+
+    //Print Hardware Version
+    sprintf(buf_log_main, "HW: %s\n", HARDWARE_VERSION);
+    SAVE_SYS_LOG_MSG_MAIN(buf_log_main);
+
+    //Print Firmware Version
+    sprintf(buf_log_main, "FW: %s\n", FIRMWARE_VERSION);
+    SAVE_SYS_LOG_MSG_MAIN(buf_log_main);
+
+    #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE)
+    {
+        //Print Linux Kernel Version
+        printf("\nLinux Image SHA1: %s\n", LINUX_IMAGE_VERSION);
+
+        //Print Hardware Version
+        printf("HW: %s\n", HARDWARE_VERSION);
+
+        //Print Firmware Version
+        printf("FW: %s\n", FIRMWARE_VERSION);
+    }
+    #endif
+
+    //Init Eth0
+    Eth0_PortSetting_Base(ETH0_PORT_BASE); //192.168.0.20
+
+    // ---------- Hardware Init ---------
+    system("/sbin/insmod /lib/qcaspi.ko");
+    sleep(2);
+    system("/sbin/ifconfig eth1 192.168.0.11 netmask 255.255.255.0 up");
+    sleep(1);
+
+    printf("Starting SSH            : \n");
+    system("/sbin/dropbear &");
+
+    printf("Starting FTPD           : \n");
+    system("/usr/bin/tcpsvd -vE 0.0.0.0 21 ftpd -w -t 30 / &");
+
+    //printf("Starting LIGHTTPD       : \n");
+    //system("/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf  -m /lib");
+
     //Init GPIO
     GPIO_Init();
 
@@ -111,10 +222,10 @@ void System_Init()
     //Init System Confinguration
     Confinguration_Init();
 
-    #ifdef SystemLogMessage
-    StoreLogMsg("--------------------------");
-    StoreLogMsg("[main] System_Init(): DONE");
-    #endif
+
+    SAVE_SYS_LOG_MSG_MAIN("--------------------------");
+    SAVE_SYS_LOG_MSG_MAIN("System_Init(): DONE");
+
 }
 
 /*===========================================================================
@@ -127,11 +238,9 @@ GLOBAL VARIABLES:
 =============================================================================*/
 void CreateShareMemory_Init()
 {
-    if(CreatShareMemory() == 0)
+    if(CreateShareMemory() == 0)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main] CreateShareMemory_Init(): NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory_Init(): NG");
 
         if(ShmStatusCodeData != NULL)
         {
@@ -145,9 +254,7 @@ void CreateShareMemory_Init()
     }
     else
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main] CreateShareMemory_Init(): DONE");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory_Init(): DONE");
     }
 }
 
@@ -156,7 +263,7 @@ void CreateShareMemory_Init()
 /**************************************************************************************/
 
 /*===========================================================================
-FUNCTION: CreatShareMemory
+FUNCTION: CreateShareMemory
 
 DESCRIPTION:
     There are 4 share memory created here, which are listed as below.
@@ -170,82 +277,83 @@ INPUT:
 OUTPUT:
 GLOBAL VARIABLES:
 =============================================================================*/
-int CreatShareMemory()
+int CreateShareMemory()
 {
     int MeterSMId;
 
-    //creat ShmSysConfigAndInfo
+    //create ShmSysConfigAndInfo
     if((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), IPC_CREAT | 0777)) < 0)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]CreatShareMemory:shmget ShmSysConfigAndInfo NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmget ShmSysConfigAndInfo NG");
         return 0;
     }
     else if((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *)-1)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]CreatShareMemory:shmat ShmSysConfigAndInfo NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmat ShmSysConfigAndInfo NG");
         return 0;
     }
 
     memset(ShmSysConfigAndInfo, 0, sizeof(struct SysConfigAndInfo));
 
 
-    //creat ShmStatusCodeData
+    //create ShmStatusCodeData
     if((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), IPC_CREAT | 0777)) < 0)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]CreatShareMemory:shmget ShmStatusCodeData NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmget ShmStatusCodeData NG");
         return 0;
     }
     else if((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]CreatShareMemory:shmat ShmStatusCodeData NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmat ShmStatusCodeData NG");
         return 0;
     }
 
     memset(ShmStatusCodeData, 0, sizeof(struct StatusCodeData));
 
 
-    //creat ShmCcsData
+    //create ShmCcsData
     if((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData), IPC_CREAT | 0777)) < 0)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]CreatShareMemory:shmget ShmCcsData NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmget ShmCcsData NG");
         return 0;
     }
     else if((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]CreatShareMemory:shmat ShmCcsData NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmat ShmCcsData NG");
         return 0;
     }
 
     memset(ShmCcsData, 0, sizeof(struct CcsData));
 
 
-    //creat ShmInternalComm
+    //create ShmInternalComm
     if((MeterSMId = shmget(ShmInternalCommKey, sizeof(struct InternalComm),   IPC_CREAT | 0777)) < 0)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]CreatShareMemory:shmget ShmInternalComm NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmget ShmInternalComm NG");
         return 0;
     }
     else if((ShmInternalComm = shmat(MeterSMId, NULL, 0)) == (void *)-1)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]CreatShareMemory:shmat ShmInternalComm NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmat ShmInternalComm NG");
         return 0;
     }
+    memset(ShmInternalComm, 0, sizeof(struct InternalComm));
+
+    
+    //create ShmInternalCommAC
+    if((MeterSMId = shmget(ShmInternalCommACKey, sizeof(struct InternalCommAC),   IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmget ShmInternalCommAC NG");
+        return 0;
+    }
+    else if((ShmInternalCommAC = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmat ShmInternalCommAC NG");
+        return 0;
+    }
+    //[To-Do] The reset here should be removed, since AW-CCS CSU will reset it in its main.c.
+    memset(ShmInternalCommAC, 0, sizeof(struct InternalCommAC)); 
+
 
     return 1;
 }
@@ -256,10 +364,10 @@ FUNCTION: GPIO_Init
 DESCRIPTION:
     1. GPIO (input) x 1
         * gpio2_0(gpio64): QCA7000 interrupt
+        * gpio2_23 (gpio87): CCS Board ID detection
 
     2. GPIO (output) x 4
         * gpio2_25 (gpio89): reserved                       (default = 0)
-        * gpio2_23 (gpio87): reserved                       (default = 0)
         * gpio2_24 (gpio88): power reset QCA7000            (default = 0)
         * gpio2_22 (gpio86): Pilot Status E control (0V)    (default = 0)
 
@@ -278,6 +386,11 @@ void GPIO_Init()
     system("echo 64 > /sys/class/gpio/export");
     system("echo \"in\" > /sys/class/gpio/gpio64/direction");
 
+    //IO port for CCS Board ID detection
+    /*GPIO2_23: AM_IO_1, H: ?; L: ?*/
+    system("echo 87 > /sys/class/gpio/export");
+    system("echo \"in\" > /sys/class/gpio/gpio87/direction");
+
 
     /***************************************************************/
     /*************** OUTPUT PIN ************************************/
@@ -288,11 +401,6 @@ void GPIO_Init()
     system("echo \"out\" > /sys/class/gpio/gpio89/direction");
     system("echo 0 > /sys/class/gpio/gpio89/value");
 
-    //IO port for Communication Board.(reserved for emergency shutdown PSU, i.e. PSKILL)
-    /*GPIO2_23: AM_IO_1, H: ?; L: ?*/
-    system("echo 87 > /sys/class/gpio/export");
-    system("echo \"out\" > /sys/class/gpio/gpio87/direction");
-    system("echo 0 > /sys/class/gpio/gpio87/value");
 
     //Power Reset QCA7000
     /*GPIO2_24: AM_QCA_PWR_RST, H: reset, L: noraml*/
@@ -306,9 +414,7 @@ void GPIO_Init()
     system("echo \"out\" > /sys/class/gpio/gpio86/direction");
     system("echo 0 > /sys/class/gpio/gpio86/value");
 
-    #ifdef SystemLogMessage
-    StoreLogMsg("[main] GPIO_Init(): DONE");
-    #endif
+    SAVE_SYS_LOG_MSG_MAIN("GPIO_Init(): DONE");
 }
 
 
@@ -349,9 +455,7 @@ void PWM_Init()
     //PWM_Init_Check(); //Checking if the PWM analog signal is well-initialized
                         //as 1KHz,100%, and 12V/9V.
 
-    #ifdef SystemLogMessage
-    StoreLogMsg("[main] PWM_Init(): DONE");
-    #endif
+    SAVE_SYS_LOG_MSG_MAIN("PWM_Init(): DONE");
 }
 
 /*===========================================================================
@@ -367,49 +471,53 @@ void Confinguration_Init()
     //Load System Confinguration
     LoadSysConfigAndInfo(&ShmSysConfigAndInfo->SysConfig);
 
-    #ifdef SystemLogMessage
-    StoreLogMsg("[main] Confinguration_Init(): DONE");
-    #endif
+    SAVE_SYS_LOG_MSG_MAIN("Confinguration_Init(): DONE");
 }
 
 /*===========================================================================
-FUNCTION:
+FUNCTION: StoreLogMsg
 DESCRIPTION:
 PRE-CONDITION:
 INPUT:
 OUTPUT:
 GLOBAL VARIABLES:
 =============================================================================*/
-#ifdef SystemLogMessage
+#if SAVE_SYS_LOG_MSG_MAIN_SWITCH == ENABLE
 int StoreLogMsg(unsigned char *DataString)
 {
-    unsigned char Buf[256];
-    time_t CurrentTime;
-    struct tm *tm;
-
-    struct timeval tv;
-    gettimeofday(&tv, NULL); // get microseconds, 10^-6
-
-    //Get uptime in nano-second precision
-    //struct timespec elapsed_from_boot;
-    //clock_gettime(CLOCK_BOOTTIME, &elapsed_from_boot);
-    //Need GLIBC_2.17
+    static unsigned char Buf[1024];
+    static time_t CurrentTime;
+    static struct tm *tm;
+    static struct timeval tv;
 
     memset(Buf, 0, sizeof(Buf));
     CurrentTime = time(NULL);
     tm = localtime(&CurrentTime);
-    sprintf(Buf, "echo \"[%04d.%02d.%02d-%02d:%02d:%02d.%06d] @ %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
-            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec,
+    gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][main]%s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
+            tm->tm_year + 1900,
+            tm->tm_mon + 1,
+            tm->tm_mday,
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
             DataString,
-            tm->tm_year + 1900, tm->tm_mon + 1);
+            tm->tm_year + 1900,
+            tm->tm_mon + 1);
     system(Buf);
 
-    #ifdef Debug
-    printf("[%04d.%02d.%02d-%02d:%02d:%02d.%06d] @ %s \n",
-            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, tv.tv_usec,
+    DEBUG_PRINTF_MAIN_SYSTEM_LOG("[%02d:%02d:%02d.%06d][main]%s \n",
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec,
+            tv.tv_usec,
             DataString);
-    #endif
-    }
+
+    //Reset the buf_log_main Buffer, i.e. DataString
+    memset(buf_log_main, 0, SIZE_OF_LOG_BUFFER);
+}
 #endif
 
 /*===========================================================================
@@ -421,14 +529,35 @@ INPUT:
 OUTPUT:
 GLOBAL VARIABLES:
 =============================================================================*/
-int DiffTimeb(struct timeb ST, struct timeb ET)
+double DiffTimeb(struct timeb ST, struct timeb ET)
 {
     //return milli-second
-    unsigned int StartTime, StopTime;
+    double StartTime, EndTime;
+    double t_diff;
+
+    StartTime = ((double)ST.time)*1000 + (double)ST.millitm;
+    EndTime = ((double)ET.time)*1000 + (double)ET.millitm;
+    t_diff = EndTime - StartTime;
+
+    //printf("%.02lf - %.02lf = %.02lf\n", EndTime, StartTime, t_diff);
+
+    if (t_diff < 0)
+    {
+        #if 0
+        if (t_diff < -1000)   //1000ms
+        {
+            sprintf(buf_log_main,
+                    "[Warning]StartTime(%.02lf) > EndTime(%.02lf), d(%.02lf)",
+                    StartTime,
+                    EndTime,
+                    t_diff);
+            SAVE_SYS_LOG_MSG_MAIN(buf_log_main);
+        }
+        #endif
 
-    StartTime = (unsigned int)ST.time;
-    StopTime = (unsigned int)ET.time;
-    return (StopTime - StartTime) * 1000 + ET.millitm - ST.millitm;
+        return -1;
+    }
+    return t_diff;
 }
 
 
@@ -446,9 +575,13 @@ GLOBAL VARIABLES:
 =============================================================================*/
 int SpawnTask()
 {
-    system("/root/EventLogging &");
+    //system("/root/EventLogging &");
     system("/root/CsuComm &");
-    system("/root/EvComm &");
+    
+    usleep(50000);  //50ms
+    
+    //system("echo 50000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle"); //5%, for test.
+    system("/root/SeccComm &");
 }
 
 
@@ -480,9 +613,7 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 
     if(fd < 0)
     {
-        #ifdef SystemLogMessage
-            StoreLogMsg("[main]StoreUsrConfigData: open /dev/mtdblock10 NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("StoreUsrConfigData: open /dev/mtdblock10 NG");
         return 0;
     }
 
@@ -491,9 +622,7 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 
     if(wrd != (sizeof(struct SysConfigData)))
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]StoreUsrConfigData: write /dev/mtdblock10 NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("StoreUsrConfigData: write /dev/mtdblock10 NG");
         return 0;
     }
 
@@ -501,9 +630,8 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 
     if(fd < 0)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]StoreUsrConfigData: open /dev/mtdblock11(backup) NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("StoreUsrConfigData: open /dev/mtdblock11(backup) NG");
+
         return 0;
     }
 
@@ -512,9 +640,7 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 
     if(wrd != (sizeof(struct SysConfigData)))
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main]StoreUsrConfigData: write /dev/mtdblock11(backup) NG");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("StoreUsrConfigData: write /dev/mtdblock11(backup) NG");
         return 0;
     }
 
@@ -538,9 +664,7 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 
     if((buf = malloc(sizeof(struct SysConfigData))) == NULL)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main] LoadSysConfigAndInfo(): malloc buffer NG,rebooting..");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): malloc buffer NG,rebooting..");
 
         if(ShmStatusCodeData != NULL)
         {
@@ -559,9 +683,7 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
     if(fd < 0)
     {
         free(buf);
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main] LoadSysConfigAndInfo():open mtdblock10 NG,rebooting..");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo():open mtdblock10 NG,rebooting..");
 
         if(ShmStatusCodeData != NULL)
         {
@@ -580,9 +702,8 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
     if(wrd != (sizeof(struct SysConfigData)))
     {
         free(buf);
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main] LoadSysConfigAndInfo(): read SysConfigData data NG,rebooting..");
-        #endif
+
+        SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): read SysConfigData data NG,rebooting..");
 
         if(ShmStatusCodeData != NULL)
         {
@@ -607,17 +728,15 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 
     if(ChkSum != ChkSumOrg)
     {
-        #ifdef SystemLogMessage
-        StoreLogMsg("[main] LoadSysConfigAndInfo(): Primary SysConfigData checksum NG, read backup");
-        #endif
+        SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): Primary SysConfigData checksum NG, read backup");
+
         fd = open("/dev/mtdblock11", O_RDWR);
 
         if(fd < 0)
         {
             free(buf);
-            #ifdef SystemLogMessage
-            StoreLogMsg("[main] LoadSysConfigAndInfo(): open mtdblock11 (backup) NG,rebooting..");
-            #endif
+
+            SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): open mtdblock11 (backup) NG,rebooting..");
 
             if(ShmStatusCodeData != NULL)
             {
@@ -637,9 +756,9 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
         if(wrd != sizeof(struct SysConfigData))
         {
             free(buf);
-            #ifdef SystemLogMessage
-            StoreLogMsg("[main] LoadSysConfigAndInfo(): read backup SysConfigData data NG,rebooting..");
-            #endif
+
+            SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): read backup SysConfigData data NG,rebooting..");
+
 
             if(ShmStatusCodeData != NULL)
             {
@@ -664,17 +783,17 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 
         if(ChkSum != ChkSumOrg)
         {
-            #ifdef SystemLogMessage
-            StoreLogMsg("[main] LoadSysConfigAndInfo(): backup SysConfigData checksum NG, read Factory default");
-            #endif
+
+            SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): backup SysConfigData checksum NG, read Factory default");
+
             fd = open("/dev/mtdblock12", O_RDWR);
 
             if(fd < 0)
             {
                 free(buf);
-                #ifdef SystemLogMessage
-                StoreLogMsg("[main] LoadSysConfigAndInfo(): open mtdblock12 (Factory default) NG,rebooting..");
-                #endif
+
+                SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): open mtdblock12 (Factory default) NG,rebooting..");
+
 
                 if(ShmStatusCodeData != NULL)
                 {
@@ -694,9 +813,9 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
             if(wrd != sizeof(struct SysConfigData))
             {
                 free(buf);
-                #ifdef SystemLogMessage
-                StoreLogMsg("[main] LoadSysConfigAndInfo(): read factory default  SysConfigData data NG,rebooting..");
-                #endif
+
+                SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): read factory default  SysConfigData data NG,rebooting..");
+
 
                 if(ShmStatusCodeData != NULL)
                 {
@@ -721,9 +840,9 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
 
             if(ChkSum != ChkSumOrg)
             {
-                #ifdef SystemLogMessage
-                StoreLogMsg("[main] LoadSysConfigAndInfo(): factory default  SysConfigData checksum NG, restore factory default");
-                #endif
+
+                SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): factory default  SysConfigData checksum NG, restore factory default");
+
                 goto DefaultShm;
             }
         }
@@ -732,14 +851,21 @@ int LoadSysConfigAndInfo(struct SysConfigData *ptr)
     //load OK
     memcpy((struct SysConfigData *)ptr, (struct SysConfigData *)buf, sizeof(struct SysConfigData));
     free(buf);
-    #ifdef SystemLogMessage
-    StoreLogMsg("[main]LoadSysConfigAndInfo(): Load SysConfigData OK");
-    #endif
+
+    SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): Load SysConfigData OK");
+
     return 1;
 
 DefaultShm:
     system("cd /root;./FactoryConfig");
-    system("sync");
+
+    #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == DISABLE)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("sync...");
+        system("sync");
+    }
+    #endif
+
     sleep(5);
     system("reboot -f");
     sleep(5);

+ 55 - 0
EVSE/Projects/CCS/Apps/main.h

@@ -5,3 +5,58 @@
                         initiated by Vern, Joseph
                            (since 2019/07/19)
 =============================================================================*/
+#if FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == ENABLE
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_MAIN_SWITCH        ENABLE  //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_MAIN_SHOW              DISABLE  //ENABLE, DISABLE
+#define DEBUG_PRINTF_MAIN_BRIEF_SHOW        DISABLE  //ENABLE, DISABLE
+#define DEBUG_PRINTF_MAIN_DETAIL_SHOW       DISABLE  //ENABLE, DISABLE
+#define DEBUG_PRINTF_MAIN_SYSTEM_LOG_SHOW   DISABLE  //ENABLE, DISABLE
+#else   //debug mode
+//Saving System Log
+#define SAVE_SYS_LOG_MSG_MAIN_SWITCH        ENABLE  //ENABLE, DISABLE
+
+//Configuration for Debug Print Messages
+#define DEBUG_PRINTF_MAIN_SHOW              ENABLE  //ENABLE, DISABLE
+#define DEBUG_PRINTF_MAIN_BRIEF_SHOW        ENABLE  //ENABLE, DISABLE
+#define DEBUG_PRINTF_MAIN_DETAIL_SHOW       ENABLE  //ENABLE, DISABLE
+#define DEBUG_PRINTF_MAIN_SYSTEM_LOG_SHOW   ENABLE  //ENABLE, DISABLE
+#endif
+
+//System Log
+#if SAVE_SYS_LOG_MSG_MAIN_SWITCH == ENABLE
+    #define SAVE_SYS_LOG_MSG_MAIN           StoreLogMsg
+#else
+    #define SAVE_SYS_LOG_MSG_MAIN(...)
+#endif
+
+
+//Debug Message
+#if DEBUG_PRINTF_MAIN_SHOW == ENABLE
+    //Brief Messages
+    #if DEBUG_PRINTF_MAIN_BRIEF_SHOW == ENABLE
+        #define DEBUG_PRINTF_MAIN_BRIEF      printf
+    #else
+        #define DEBUG_PRINTF_MAIN_BRIEF(...)
+    #endif
+
+    //Detail Messages
+    #if DEBUG_PRINTF_MAIN_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_MAIN_DETAIL     printf
+    #else
+        #define DEBUG_PRINTF_MAIN_DETAIL(...)
+    #endif
+
+    //System Log Messages
+    #if DEBUG_PRINTF_MAIN_SYSTEM_LOG_SHOW == ENABLE
+        #define DEBUG_PRINTF_MAIN_SYSTEM_LOG    printf
+    #else
+        #define DEBUG_PRINTF_MAIN_SYSTEM_LOG(...)
+    #endif
+#else
+    #define DEBUG_PRINTF_MAIN_BRIEF(...)
+    #define DEBUG_PRINTF_MAIN_DETAIL(...)
+    #define DEBUG_PRINTF_MAIN_SYSTEM_LOG(...)
+#endif

+ 733 - 0
EVSE/Projects/CCS/Apps/version.h

@@ -0,0 +1,733 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 version.h
+
+                     initiated by Joseph D. Anderson
+                           (since 2019/12/03)
+=============================================================================*/
+#define FIRMWARE_VERSION            "D0.16.S0"   //8-Byte(ASCII Code), “tx.yz.ab.cd”
+#define HARDWARE_VERSION            "CCS_8.0x"      //8-Byte(ASCII Code): CSU-03-RW, CCS_Board, REV:5.0
+#define LINUX_IMAGE_VERSION         "dd2da761d59f2cdd4064c9d95f8c302a442d33f3 (2019-01-04)"
+#define RTC_DEFAULT_TIME            1595486300      //Epoch time (decimal)
+//https://git.phihong.com.tw:30000/System_Integration/CSU3_AM335x/commit/SHA1
+#define FIRMWARE_VERSION_LENGTH     8               //unit: byte, max = 8, due to CAN bus payload.
+#define HARDWARE_VERSION_LENGTH     8               //unit: byte, max = 8, due to CAN bus payload.
+/*
+================================================================================
+==================== [Software] Version Naming Rule (2020) =====================
+================================================================================
+
+The firmware version consists of 8 bytes ASCII characters and be separated by
+dot symbol per coupling bytes as the format:
+
+                “tx.yz.ab”
+
+Following table describes the version naming rule.
+
+- BYTE 0: t (Stage)
+One ASCII character to indicate the firmware maturity according to project stage.
+D: development stage (under developing)
+B: verification stage (under QE verification)
+V: manufacture stage (after QE verified and release to factory)
+
+
+- BYTE 1: x (Major)
+Increased with major changes, e.g., hardware change, incompatible change, etc.
+It should be more than or equal to 1 if the first character t is ‘V’
+Only numerical values 0 ~ 9 can be used.
+
+
+- BYTE 2,3: yz (Minor)
+Increased with iterant changes, e.g., new functions, bug fix and so on.
+Two numerical values 00 ~ 99 can be used.
+
+
+- BYTE 4: a (Project)
+Abbreviation for Firmware Projects
+R: Relay Control Board
+F: Fan Control Board
+C: CHAdeMO Board
+D: DC Main Board
+G: GB Board
+L: LED Bar Board
+S: CCS Board
+
+
+- BYTE 5: b (reserved)
+
+================================================================================
+====================== [Software] Version History (2020) =======================
+================================================================================
+[VERSION] V0.13.S0 (sync with D0.63.13.1D)
+* Release Date: 2020-07-27
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV8.0)
+* Minor Version: 13
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  1. Adding response to isolation status in WeldingDetectionRes.
+    (1) DIN: DONE
+    (2) ISO1: DONE
+
+
+[VERSION] V0.12.S0
+* Release Date: 2020-07-20
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV8.0)
+* Minor Version: 12
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  1. Abandoning previous version name of D1.00.S0 and changing it to V0.12.S0.
+     to be the 1st MP version.
+
+
+[VERSION] D1.00.S0
+* Release Date: 2020-07-20
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV8.0)
+* Minor Version: 12
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  1. Chaning the version name from D0.12.S0 to D1.00.S0
+     to be the 1st CE pass version.
+
+
+[VERSION] D0.12.S0
+* Release Date: 2020-07-20
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV8.0)
+* Minor Version: 12
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+	1. Sync with D0.62.13.1D (2020-07-03), 
+	   => final version verified at DEKRA for CE (60KW)
+
+
+[VERSION] D0.11.S0
+* Release Date: 2020-05-14
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 11
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Sync with D0.43.13.1D
+
+
+[VERSION] D0.10.S0
+* Release Date: 2020-04-27
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 10
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Removing redundant debug message and code.
+
+    2. Adding error codes for the following situations.
+       (1) CCS_SECC_TIMEOUT_SLACC_SDP_UDP_TT_match_join (023823)
+       (2) CCS_SECC_TIMEOUT_SLACC_SDP_TCP_TT_match_join (023824)
+
+
+[VERSION] D0.09.S0
+* Release Date: 2020-04-23
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 09
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Merging D0.08.13.1D to here.
+
+[VERSION] D0.08.S0
+* Release Date: 2020-04-13
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 08
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Disabling "Check for ChargingPermission" when CP state is between 3 and 5,
+       which is a new function in D0.07.S0.
+
+    2. Disabling RTC function.
+
+[VERSION] D0.07.S0
+* Release Date: 2020-04-09
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 07
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Adding response to "ChargingPermission off" before V2G messages.
+       => End_Process()
+
+    2. Modifying the EVSEStatusCode status to be TRUE in the following 2 messages.
+       (1) din_ChargeParameterDiscoveryRes
+       (2) iso1_ChargeParameterDiscoveryRes
+
+[VERSION] D0.06.S0
+* Release Date: 2020-03-17
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 06
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Adding "CSUCOMM_TASK_FLAG.EV_Stop_Type_Emergency" flag to handle CAN Stop
+       command type to CSU.
+
+    2. Adding error code to the following situation.
+       (1) CCS_SECC_TIMEOUT_SLAC_TT_EVSE_SLAC_init (023809)
+           SlacComm: Wait CM_SLAC_PARM_REQ Timeout - TT_EVSE_SLAC_init (50s)
+
+[VERSION] D0.05.S0
+* Release Date: 2020-03-17
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 05
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Sync with D0.20.11.1D.
+
+
+[VERSION] D0.04.S0
+* Release Date: 2020-03-13
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 04
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Adding error code of the following two situation.
+       - CCS_SECC_CP_State_Error (023889)
+       - CCS_SECC_TIMEOUT_V2G_Sequence_Time (023844)
+
+[VERSION] D0.03.S0
+* Release Date: 2020-03-13
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 03
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Merging D0.16.11.1D to here.
+
+[VERSION] D0.02.S0
+* Release Date: 2020-03-04
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 02
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Changing the default CAN bus firmware update method of ramdisk to
+       root_app process.
+
+[VERSION] D0.01.S0
+* Release Date: 2020-03-02
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 01
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2(default: DISABLE)
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Merging D0.12.11.1D of branch ISO_15118 to master.
+
+    2. Limiting the Supported CCS protocols to DIN 70121 only. (Disabling ISO1)
+       => #define V2GT_MSG_PROTOCOL_PREFERENCE  V2GT_MSG_PROTOCOL_DIN70121
+
+    3. Changing the firmware naming rule.
+
+
+
+================================================================================
+=================== [Software] Version Naming Rule (2019)=======================
+================================================================================
+
+The firmware version consists of 8 bytes ASCII characters and be separated by
+dot symbol per coupling bytes as the format:
+
+                “tx.yz.ab.cd”.
+
+Following table describes the version naming rule.
+
+- BYTE 0: t (Stage)
+One ASCII character to indicate the firmware maturity according to project stage.
+D: development stage (under developing)
+B: verification stage (under QE verification)
+V: manufacture stage (after QE verified and release to factory)
+
+
+- BYTE 1: x (Major)
+Increased with major changes, e.g., hardware change, incompatible change, etc.
+It should be more than or equal to 1 if the first character t is ‘V’
+Only numerical values 0 ~ 9 can be used.
+
+
+- BYTE 2,3: yz (Minor)
+Increased with iterant changes, e.g., new functions, bug fix and so on.
+Two numerical values 00 ~ 99 can be used.
+
+
+- BYTE 4: a (Comm Method)
+Supported HLC Communication Methods
+bit 7   bit 6   bit 5   bit 4   bit 3   bit 2   bit 1   bit 0
+|------------------ reserved ----------------|	Wi-Fi    PLC
+1: PLC only
+2: Wi-Fi only
+3: PLC + Wi-Fi
+others: reserved
+
+
+- BYTE 5: b (Charging Type)
+Supported Charging Types
+bit 7   bit 6   bit 5   bit 4   bit 3   bit 2   bit 1   bit 0
+|-------- reserved  --------|    BPT     WPT     AC      DC
+1: DC only
+2: AC only
+3: DC + AC
+4: WPT: Wireless Power Transfer
+8: BPT: Bidirectional Power Transfer, etc
+others: reserved
+
+
+- BYTE 6: c (Supported Features)
+bit 7   bit 6   bit 5   bit 4   bit 3   bit 2   bit 1   bit 0
+|-------------- reserved -----------|    ACD     PnC     EIM
+1: EIM
+2: PnC
+4: ACD (Automatic Connection Device), etc
+Others: reserved
+
+
+- BYTE 7: d (Supported Protocols)
+bit 7       bit 6       bit 5       bit 4       bit 3       bit 2       bit 1       bit 0
+|--------- reserved --------------------|   ISO 15118-20  ISO 15118-2  SAE J2847  DIN 70121
+1: DIN SPEC 70121
+2: SAE J2847
+3: DIN SPEC 70121 + SAE J2847
+4: ISO/IEC 15118-2
+8: ISO/IEC 15118-20, etc
+others: reserved
+
+================================================================================
+========================= [Software] Version History ===========================
+================================================================================
+[VERSION] D0.12.11.1D
+* Release Date: 2020-02-24
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 11
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Checking EVMaximumVoltageLimit_isUsed flag when using decoded
+       EVMaximumVoltageLimit value.
+
+    2. Extending V2G_SECC_WeldingDetection_Performance_Time from 2s to 20s.
+    -
+
+[VERSION] D0.10.11.1D
+* Release Date: 2020-02-24
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 10
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Adding Check_CP_State_Error() function in the forked EvComm task.
+    2. Updating the log mechanism of present EVSE V/I information.
+
+
+[VERSION] D0.09.11.1D
+* Release Date: 2020-02-20
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 09
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Adding Tx timeout for RawSock (100ms, SO_SNDTIMEO)
+
+    2. Replacing the original "static variable" of counter of iso1_CableCheckRes and iso1_PreChargeReq
+       with another new variable inside CcsData structure.
+
+[VERSION] D0.08.11.1D
+* Release Date: 2020-02-20
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 08
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Modifying the state machine to let state return back to IDLE(0)
+       once the set key process of QCA7000 is completed.
+
+[VERSION] D0.07.11.1D
+* Release Date: 2020-02-20
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 07
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    1. Modifying 5% PWM start timing as below. (requested by Diamler)
+       (1) Start 5% PWM once receiving CM_SLAC_PARM_REQ from EV.
+           => The Charging Permission status from CSU doesn't have to be TRUE
+       (2) Start 5% once QCA7000 finishs setting key (CM_SET_KEY_CNF) and
+           detecting both of
+           "CheckConnectorPlugIn()" and
+           "Charging Permission status from CSU" are TRUE.
+           => The Charging Permission status from CSU have to be TRUE
+
+    2. Adding the following system reset methods for the selection.
+       (1) #define RESET_MECHANISM_SOFT_RESET_KILLALL_EVCOMM       0  (default)
+       (2) #define RESET_MECHANISM_HARD_RESET                      1
+       (3) #define RESET_MECHANISM_SOFT_RESET_INTERNAL_RESUME      2
+
+    2. Adding check mechanism for Charging Permission in all V2G message process
+       after ChargeParameterDiscoveryReq.
+       => if (ShmInternalComm->ChargingPermission == FALSE)
+
+    3. Printing states on the following task log. (via Check_V2G_Flow_Status())
+       (1) EvComm
+       (2) CsuComm
+
+    4. Adding Check_V2G_Flow_Status_pre() function to check previous status.
+
+
+[VERSION] D0.06.11.1D
+* Release Date: 2020-02-19
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 06
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  - Fixing the issue of Shutdown by EVSE Mechanism in D0.05.11.1D.
+
+[VERSION] D0.05.11.1D
+* Release Date: 2020-02-19
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 05
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  - Merging D1.19.11.11 to here.
+
+[VERSION] D0.04.11.1D
+* Release Date: 2020-02-11
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 04
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  - Fixing the software CP protection mechanism,
+    which won't be triggered in previous version.
+
+[VERSION] D0.03.11.1D
+* Release Date: 2020-02-11
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 03
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    - [ISO1] The first successful version for ISO15118_2014
+    - Verification:
+      -- Emulator: Gridwiz Simplemint (ISO 15118, ISO1)
+         => Normal Stop by EVSE during CurrentDemand(): PASS
+      -- EVSE: to be verified
+    - [ISO2] paused on development
+
+
+[VERSION] D0.02.11.1D
+* Release Date: 2020-02-06
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 02
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    - [ISO1] SessionSetupReq: done
+    - [ISO1] SessionSetupRes: done
+    - [ISO2] SessionSetupReq: done
+    - [ISO2] SessionSetupRes: done
+
+
+[VERSION] D0.01.11.1D
+* Release Date: 2020-02-03
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV5.0)
+* Minor Version: 01
+* Supported Protocol(1101b): DIN 70121, ISO 15118-2, ISO 15118-20
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    - kick-off of ISO 15118-2 and 15118-20
+    - supportedAppProtocolReq: done
+
+*--------------------------- start of ISO 15118 --------------------------------
+
+[VERSION] D1.09.11.11
+* Release Date: 2020-01-17
+* Stage: D (development)
+* Major Version: 1 (Compliant HW Version: REV5.0)
+* Minor Version: 09
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    - Adding Update_Module.c (not be enabled, yet).
+    - Updating the "NAND flash mapping table" of Firmware Design SPEC
+
+
+[VERSION] D1.08.11.11
+* Release Date: 2020-01-15
+* Stage: D (development)
+* Major Version: 1 (Compliant HW Version: REV5.0)
+* Minor Version: 08
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    - Fixing CAN Bus firmware image update function.
+      -- ramdisk, configuration
+
+
+[VERSION] D1.07.11.11
+* Release Date: 2020-01-15
+* Stage: D (development)
+* Major Version: 1 (Compliant HW Version: REV5.0)
+* Minor Version: 07
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    - Adding CAN Bus firmware image update function.
+      -- supporting MLO, uboot, zImage, ramdisk, configuration
+
+
+[VERSION] D1.06.11.11
+* Release Date: 2020-01-10
+* Stage: D (development)
+* Major Version: 1 (Compliant HW Version: REV5.0)
+* Minor Version: 06
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    - Adding CAN Bus firmware image update function.
+      -- supporting ramdisk_app (type = 5)
+
+[VERSION] D1.05.11.11
+* Release Date: 2020-01-07
+* Stage: D (development)
+* Major Version: 1 (Compliant HW Version: REV5.0)
+* Minor Version: 05
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    - Enabling the CP_PROTECTION_MECHANISM.
+
+
+[VERSION] D1.04.11.11
+* Release Date: 2020-01-07
+* Stage: D (development)
+* Major Version: 1 (Compliant HW Version: REV5.0)
+* Minor Version: 04
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    - Adding auto detection of CCS Board ID pin. (AM_IO_1)
+    - Adding dts files for linux and uboot.
+      By executing auto_win.sh or auto_mac.sh, it will update dts into linux
+      kernel and compile.
+
+
+[VERSION] D1.03.11.11
+* Release Date: 2020-01-06
+* Stage: D (development)
+* Major Version: 1 (Compliant HW Version: REV5.0)
+* Minor Version: 03
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+    - Fixing all shell script "Next Line" error
+      * "CRLF" ==> "LF"
+    - Adding scripts for auto compile and data moving.
+
+
+[VERSION] D1.02.11.11
+* Release Date: 2020-01-06
+* Stage: D (development)
+* Major Version: 1 (Compliant HW Version: REV5.0)
+* Minor Version: 02
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  - Canceling "LIGHTTPD" (web server) when Linux is booting up.
+    Purpose: Reduce the CPU resource to enhance the CCS tasks performance.
+
+
+[VERSION] D1.01.11.11
+* Release Date: 2020-01-06
+* Stage: D (development)
+* Major Version: 1 (Compliant HW Version: REV5.0)
+* Minor Version: 01
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  - The first version for CCS Board HW 5.0,
+    which supports Ethernet(eth0) and higher ADC sampling rate.
+
+
+[VERSION] D0.04.11.11
+* Release Date: 2019-12-23
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV2.0, REV4.0)
+* Minor Version: 04
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  - CCS Board ID = 2. (can_tx_payload[4] = 0x02)
+
+[VERSION] D0.04.11.11
+* Release Date: 2019-12-05
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV2.0, REV4.0)
+* Minor Version: 03
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  - CCS Board ID = 2.
+
+
+[VERSION] D0.03.11.11
+* Release Date: 2019-12-05
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV2.0, REV4.0)
+* Minor Version: 03
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  - RTC time byte sequence inside CAN msg is modified to [0] [1] [2] [3]
+    from [3] [2] [1] [0].
+
+
+[VERSION] D0.02.11.11
+* Release Date: 2019-12-04
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV2.0, REV4.0)
+* Minor Version: 02
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note:
+  - Adding RTC update function (via CAN message)
+
+
+[VERSION] D0.01.11.11
+* Release Date: 2019-12-04
+* Stage: D (development)
+* Major Version: 0 (Compliant HW Version: REV2.0, REV4.0)
+* Minor Version: 01
+* Supported Protocol: DIN 70121
+* Supported Feature: EIM
+* Charging Type: DC
+* Comm Method: PLC
+* Note: -
+
+
+================================================================================
+======================== [Hardware] Version Naming Rule ========================
+================================================================================
+
+
+
+================================================================================
+========================== [Software] Version History ==========================
+================================================================================
+
+*/

BIN
EVSE/Projects/CCS/Images/MLO


BIN
EVSE/Projects/CCS/Images/am335x-evm.dtb


BIN
EVSE/Projects/CCS/Images/ramdisk.gz


BIN
EVSE/Projects/CCS/Images/u-boot.img


BIN
EVSE/Projects/CCS/Images/zImage


+ 3001 - 0
EVSE/Projects/CCS/Log/CCS_CAN_log.txt

@@ -0,0 +1,3001 @@
+??          ????  ??????       ?ID        ???  ???  ????   ??
+0		??   0x0e787d93          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f1 11 
+1		??   0x0e787f50          0x00000901  ???  ???  0x00       
+2		??   0x0e787f53          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+3		??   0x0e787f58          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f1 11 
+4		??   0x0e788114          0x00000901  ???  ???  0x00       
+5		??   0x0e788117          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+6		??   0x0e788119          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f1 11 
+7		??   0x0e7882d7          0x00000901  ???  ???  0x00       
+8		??   0x0e7882da          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+9		??   0x0e7882dd          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+10		??   0x0e788318          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f1 11 
+11		??   0x0e78849b          0x00000d01  ???  ???  0x00       
+12		??   0x0e78849c          0x00000901  ???  ???  0x00       
+13		??   0x0e78849f          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+14		??   0x0e7884a8          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f1 11 
+15		??   0x0e7884ab          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+16		??   0x0e78865f          0x00000901  ???  ???  0x00       
+17		??   0x0e788661          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+18		??   0x0e788673          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f1 11 
+19		??   0x0e788822          0x00000901  ???  ???  0x00       
+20		??   0x0e788825          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+21		??   0x0e7889e5          0x00000901  ???  ???  0x00       
+22		??   0x0e7889e8          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+23		??   0x0e788ba9          0x00000901  ???  ???  0x00       
+24		??   0x0e788bac          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+25		??   0x0e788bae          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+26		??   0x0e788d6c          0x00000901  ???  ???  0x00       
+27		??   0x0e788d6f          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+28		??   0x0e788e5e          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f1 11 
+29		??   0x0e788e61          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+30		??   0x0e788f30          0x00000901  ???  ???  0x00       
+31		??   0x0e788f33          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+32		??   0x0e788f36          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f1 11 
+33		??   0x0e7890f4          0x00000901  ???  ???  0x00       
+34		??   0x0e7890f6          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+35		??   0x0e789152          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f1 11 
+36		??   0x0e7892b7          0x00000901  ???  ???  0x00       
+37		??   0x0e7892ba          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+38		??   0x0e7892bd          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f1 11 
+39		??   0x0e78947b          0x00000901  ???  ???  0x00       
+40		??   0x0e78947d          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+41		??   0x0e789480          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+42		??   0x0e789483          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+43		??   0x0e78963e          0x00000901  ???  ???  0x00       
+44		??   0x0e789641          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+45		??   0x0e7896a7          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+46		??   0x0e789802          0x00000901  ???  ???  0x00       
+47		??   0x0e789804          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+48		??   0x0e789871          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+49		??   0x0e7899c5          0x00000901  ???  ???  0x00       
+50		??   0x0e7899c8          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+51		??   0x0e7899cb          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+52		??   0x0e789b89          0x00000901  ???  ???  0x00       
+53		??   0x0e789b8c          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+54		??   0x0e789b8e          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+55		??   0x0e789d4c          0x00000901  ???  ???  0x00       
+56		??   0x0e789d4f          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+57		??   0x0e789d52          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+58		??   0x0e789dc2          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+59		??   0x0e789f10          0x00000901  ???  ???  0x00       
+60		??   0x0e789f13          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+61		??   0x0e789f64          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+62		??   0x0e78a0d3          0x00000901  ???  ???  0x00       
+63		??   0x0e78a0d6          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+64		??   0x0e78a0d9          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+65		??   0x0e78a297          0x00000901  ???  ???  0x00       
+66		??   0x0e78a29a          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+67		??   0x0e78a29c          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+68		??   0x0e78a45a          0x00000901  ???  ???  0x00       
+69		??   0x0e78a45d          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+70		??   0x0e78a61e          0x00000901  ???  ???  0x00       
+71		??   0x0e78a621          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+72		??   0x0e78a624          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+73		??   0x0e78a7e1          0x00000d01  ???  ???  0x00       
+74		??   0x0e78a7e3          0x00000901  ???  ???  0x00       
+75		??   0x0e78a7e6          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+76		??   0x0e78a9a5          0x00000901  ???  ???  0x00       
+77		??   0x0e78a9a8          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+78		??   0x0e78ab69          0x00000901  ???  ???  0x00       
+79		??   0x0e78ab6b          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+80		??   0x0e78ad2c          0x00000901  ???  ???  0x00       
+81		??   0x0e78ad2f          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+82		??   0x0e78aebf          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+83		??   0x0e78aec1          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+84		??   0x0e78aeef          0x00000901  ???  ???  0x00       
+85		??   0x0e78aef2          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+86		??   0x0e78aef5          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+87		??   0x0e78af39          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+88		??   0x0e78b0b3          0x00000901  ???  ???  0x00       
+89		??   0x0e78b0b6          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+90		??   0x0e78b0d2          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+91		??   0x0e78b276          0x00000901  ???  ???  0x00       
+92		??   0x0e78b279          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+93		??   0x0e78b27c          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+94		??   0x0e78b43a          0x00000901  ???  ???  0x00       
+95		??   0x0e78b43d          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+96		??   0x0e78b43f          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+97		??   0x0e78b581          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+98		??   0x0e78b5fe          0x00000901  ???  ???  0x00       
+99		??   0x0e78b600          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+100		??   0x0e78b63f          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+101		??   0x0e78b7c1          0x00000901  ???  ???  0x00       
+102		??   0x0e78b7c4          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+103		??   0x0e78b7c6          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+104		??   0x0e78b7db          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 f0 11 
+105		??   0x0e78b984          0x00000901  ???  ???  0x00       
+106		??   0x0e78b987          0x00000700  ???  ???  0x08       70 10 eb 01 70 10 eb 01 
+107		??   0x0e78b98a          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+108		??   0x0e78bb48          0x00000901  ???  ???  0x00       
+109		??   0x0e78bb4b          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+110		??   0x0e78bb4d          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+111		??   0x0e78bd0b          0x00000901  ???  ???  0x00       
+112		??   0x0e78bd0e          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+113		??   0x0e78bd11          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+114		??   0x0e78becf          0x00000901  ???  ???  0x00       
+115		??   0x0e78bed2          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+116		??   0x0e78beda          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+117		??   0x0e78c093          0x00000901  ???  ???  0x00       
+118		??   0x0e78c095          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+119		??   0x0e78c098          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+120		??   0x0e78c0d5          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+121		??   0x0e78c256          0x00000901  ???  ???  0x00       
+122		??   0x0e78c259          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+123		??   0x0e78c26d          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+124		??   0x0e78c41a          0x00000901  ???  ???  0x00       
+125		??   0x0e78c41c          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+126		??   0x0e78c421          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+127		??   0x0e78c5dd          0x00000901  ???  ???  0x00       
+128		??   0x0e78c5e0          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+129		??   0x0e78c5e3          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+130		??   0x0e78c7a1          0x00000901  ???  ???  0x00       
+131		??   0x0e78c7a3          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+132		??   0x0e78c7f5          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+133		??   0x0e78c964          0x00000901  ???  ???  0x00       
+134		??   0x0e78c967          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+135		??   0x0e78c96a          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+136		??   0x0e78c99c          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+137		??   0x0e78cb27          0x00000d01  ???  ???  0x00       
+138		??   0x0e78cb29          0x00000901  ???  ???  0x00       
+139		??   0x0e78cb2c          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+140		??   0x0e78cb2e          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+141		??   0x0e78cb31          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+142		??   0x0e78cceb          0x00000901  ???  ???  0x00       
+143		??   0x0e78ccee          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+144		??   0x0e78cd20          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+145		??   0x0e78ceaf          0x00000901  ???  ???  0x00       
+146		??   0x0e78ceb1          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+147		??   0x0e78ceb4          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+148		??   0x0e78d073          0x00000901  ???  ???  0x00       
+149		??   0x0e78d076          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+150		??   0x0e78d07f          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+151		??   0x0e78d237          0x00000901  ???  ???  0x00       
+152		??   0x0e78d23a          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+153		??   0x0e78d23d          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+154		??   0x0e78d3fb          0x00000901  ???  ???  0x00       
+155		??   0x0e78d3fe          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+156		??   0x0e78d5be          0x00000901  ???  ???  0x00       
+157		??   0x0e78d5c1          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+158		??   0x0e78d782          0x00000901  ???  ???  0x00       
+159		??   0x0e78d785          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+160		??   0x0e78d945          0x00000901  ???  ???  0x00       
+161		??   0x0e78d948          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+162		??   0x0e78db09          0x00000901  ???  ???  0x00       
+163		??   0x0e78db0c          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+164		??   0x0e78db0f          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+165		??   0x0e78dccd          0x00000901  ???  ???  0x00       
+166		??   0x0e78dcd0          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+167		??   0x0e78dd4b          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+168		??   0x0e78dd4e          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+169		??   0x0e78de90          0x00000901  ???  ???  0x00       
+170		??   0x0e78de93          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+171		??   0x0e78de96          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+172		??   0x0e78e054          0x00000901  ???  ???  0x00       
+173		??   0x0e78e057          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+174		??   0x0e78e059          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ef 11 
+175		??   0x0e78e217          0x00000901  ???  ???  0x00       
+176		??   0x0e78e21a          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+177		??   0x0e78e299          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+178		??   0x0e78e3db          0x00000901  ???  ???  0x00       
+179		??   0x0e78e3de          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+180		??   0x0e78e3e0          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+181		??   0x0e78e431          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+182		??   0x0e78e59e          0x00000901  ???  ???  0x00       
+183		??   0x0e78e5a1          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+184		??   0x0e78e5a4          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+185		??   0x0e78e762          0x00000901  ???  ???  0x00       
+186		??   0x0e78e765          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+187		??   0x0e78e767          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+188		??   0x0e78e925          0x00000901  ???  ???  0x00       
+189		??   0x0e78e928          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+190		??   0x0e78e967          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+191		??   0x0e78eae9          0x00000901  ???  ???  0x00       
+192		??   0x0e78eaec          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+193		??   0x0e78eb0f          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+194		??   0x0e78ecac          0x00000901  ???  ???  0x00       
+195		??   0x0e78ecaf          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+196		??   0x0e78ecb2          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+197		??   0x0e78ecb5          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+198		??   0x0e78ee70          0x00000d01  ???  ???  0x00       
+199		??   0x0e78ee71          0x00000901  ???  ???  0x00       
+200		??   0x0e78ee74          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+201		??   0x0e78ee77          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+202		??   0x0e78ee7a          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+203		??   0x0e78f034          0x00000901  ???  ???  0x00       
+204		??   0x0e78f036          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+205		??   0x0e78f075          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+206		??   0x0e78f1f7          0x00000901  ???  ???  0x00       
+207		??   0x0e78f1fa          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+208		??   0x0e78f241          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+209		??   0x0e78f3bb          0x00000901  ???  ???  0x00       
+210		??   0x0e78f3bd          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+211		??   0x0e78f3c0          0x08000901  ???  ???  0x08       2d 47 ee 11 f4 01 ee 11 
+212		??   0x0e78f57e          0x00000901  ???  ???  0x00       
+213		??   0x0e78f581          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+214		??   0x0e78f584          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+215		??   0x0e78f5b3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ee 11 
+216		??   0x0e78f742          0x00000901  ???  ???  0x00       
+217		??   0x0e78f744          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+218		??   0x0e78f7aa          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ee 11 
+219		??   0x0e78f905          0x00000901  ???  ???  0x00       
+220		??   0x0e78f908          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+221		??   0x0e78f949          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ee 11 
+222		??   0x0e78fac9          0x00000901  ???  ???  0x00       
+223		??   0x0e78facc          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+224		??   0x0e78face          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ee 11 
+225		??   0x0e78fc8d          0x00000901  ???  ???  0x00       
+226		??   0x0e78fc8f          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+227		??   0x0e78fe50          0x00000901  ???  ???  0x00       
+228		??   0x0e78fe53          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+229		??   0x0e78fe56          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+230		??   0x0e790014          0x00000901  ???  ???  0x00       
+231		??   0x0e790016          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+232		??   0x0e7901d7          0x00000901  ???  ???  0x00       
+233		??   0x0e7901da          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+234		??   0x0e79039b          0x00000901  ???  ???  0x00       
+235		??   0x0e79039d          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+236		??   0x0e79055e          0x00000901  ???  ???  0x00       
+237		??   0x0e790561          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+238		??   0x0e7906fe          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ee 11 
+239		??   0x0e790701          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+240		??   0x0e790722          0x00000901  ???  ???  0x00       
+241		??   0x0e790724          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+242		??   0x0e790727          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+243		??   0x0e79073b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ee 11 
+244		??   0x0e7908e5          0x00000901  ???  ???  0x00       
+245		??   0x0e7908e8          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+246		??   0x0e790913          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ee 11 
+247		??   0x0e790aa8          0x00000901  ???  ???  0x00       
+248		??   0x0e790aab          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+249		??   0x0e790aae          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ee 11 
+250		??   0x0e790c6c          0x00000901  ???  ???  0x00       
+251		??   0x0e790c6f          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+252		??   0x0e790cdd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+253		??   0x0e790e2f          0x00000901  ???  ???  0x00       
+254		??   0x0e790e32          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+255		??   0x0e790e3c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+256		??   0x0e790ff3          0x00000901  ???  ???  0x00       
+257		??   0x0e790ff6          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+258		??   0x0e790ff8          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+259		??   0x0e790ffb          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+260		??   0x0e7911b7          0x00000d01  ???  ???  0x00       
+261		??   0x0e7911b8          0x00000901  ???  ???  0x00       
+262		??   0x0e7911bb          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+263		??   0x0e7911bd          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+264		??   0x0e7911c0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+265		??   0x0e79137a          0x00000901  ???  ???  0x00       
+266		??   0x0e79137d          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+267		??   0x0e7913b5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+268		??   0x0e79153e          0x00000901  ???  ???  0x00       
+269		??   0x0e791540          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+270		??   0x0e791547          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+271		??   0x0e791701          0x00000901  ???  ???  0x00       
+272		??   0x0e791704          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+273		??   0x0e791707          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+274		??   0x0e7918c5          0x00000901  ???  ???  0x00       
+275		??   0x0e7918c7          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+276		??   0x0e7918ca          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+277		??   0x0e791933          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+278		??   0x0e791a88          0x00000901  ???  ???  0x00       
+279		??   0x0e791a8b          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+280		??   0x0e791af1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+281		??   0x0e791c4c          0x00000901  ???  ???  0x00       
+282		??   0x0e791c4e          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+283		??   0x0e791c51          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+284		??   0x0e791e0f          0x00000901  ???  ???  0x00       
+285		??   0x0e791e12          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+286		??   0x0e791e15          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+287		??   0x0e791fd3          0x00000901  ???  ???  0x00       
+288		??   0x0e791fd5          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+289		??   0x0e792045          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+290		??   0x0e792196          0x00000901  ???  ???  0x00       
+291		??   0x0e792199          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+292		??   0x0e79219c          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+293		??   0x0e7921c8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+294		??   0x0e79235a          0x00000901  ???  ???  0x00       
+295		??   0x0e79235c          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+296		??   0x0e79235f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+297		??   0x0e79251d          0x00000901  ???  ???  0x00       
+298		??   0x0e792520          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+299		??   0x0e792523          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+300		??   0x0e7926e1          0x00000901  ???  ???  0x00       
+301		??   0x0e7926e3          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+302		??   0x0e792722          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+303		??   0x0e7928a4          0x00000901  ???  ???  0x00       
+304		??   0x0e7928a7          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+305		??   0x0e7928c5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+306		??   0x0e792a68          0x00000901  ???  ???  0x00       
+307		??   0x0e792a6a          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+308		??   0x0e792a6d          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+309		??   0x0e792a70          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+310		??   0x0e792c2b          0x00000901  ???  ???  0x00       
+311		??   0x0e792c2e          0x00000700  ???  ???  0x08       72 10 eb 01 72 10 eb 01 
+312		??   0x0e792def          0x00000901  ???  ???  0x00       
+313		??   0x0e792df1          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+314		??   0x0e792fb2          0x00000901  ???  ???  0x00       
+315		??   0x0e792fb5          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+316		??   0x0e7930dd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+317		??   0x0e7930e0          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+318		??   0x0e793176          0x00000901  ???  ???  0x00       
+319		??   0x0e793178          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+320		??   0x0e79317b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+321		??   0x0e793339          0x00000901  ???  ???  0x00       
+322		??   0x0e79333c          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+323		??   0x0e79333f          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+324		??   0x0e793341          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+325		??   0x0e7934fc          0x00000d01  ???  ???  0x00       
+326		??   0x0e7934fe          0x00000901  ???  ???  0x00       
+327		??   0x0e793501          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+328		??   0x0e793566          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ed 11 
+329		??   0x0e793568          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+330		??   0x0e7936c0          0x00000901  ???  ???  0x00       
+331		??   0x0e7936c3          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+332		??   0x0e7936ce          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+333		??   0x0e793884          0x00000901  ???  ???  0x00       
+334		??   0x0e793886          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+335		??   0x0e793889          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+336		??   0x0e793a47          0x00000901  ???  ???  0x00       
+337		??   0x0e793a4a          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+338		??   0x0e793a4d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+339		??   0x0e793c0b          0x00000901  ???  ???  0x00       
+340		??   0x0e793c0d          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+341		??   0x0e793c10          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+342		??   0x0e793c6e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+343		??   0x0e793dce          0x00000901  ???  ???  0x00       
+344		??   0x0e793dd1          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+345		??   0x0e793dea          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+346		??   0x0e793f92          0x00000901  ???  ???  0x00       
+347		??   0x0e793f95          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+348		??   0x0e793f98          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+349		??   0x0e794156          0x00000901  ???  ???  0x00       
+350		??   0x0e794158          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+351		??   0x0e794160          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+352		??   0x0e794319          0x00000901  ???  ???  0x00       
+353		??   0x0e79431c          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+354		??   0x0e79435b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+355		??   0x0e7944dd          0x00000901  ???  ???  0x00       
+356		??   0x0e7944df          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+357		??   0x0e7944e2          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+358		??   0x0e7944f8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+359		??   0x0e7946a0          0x00000901  ???  ???  0x00       
+360		??   0x0e7946a3          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+361		??   0x0e7946a6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+362		??   0x0e794864          0x00000901  ???  ???  0x00       
+363		??   0x0e794867          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+364		??   0x0e794869          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+365		??   0x0e794a27          0x00000901  ???  ???  0x00       
+366		??   0x0e794a2a          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+367		??   0x0e794a58          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+368		??   0x0e794beb          0x00000901  ???  ???  0x00       
+369		??   0x0e794bed          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+370		??   0x0e794bfc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+371		??   0x0e794dae          0x00000901  ???  ???  0x00       
+372		??   0x0e794db1          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+373		??   0x0e794db4          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+374		??   0x0e794ddd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+375		??   0x0e794f71          0x00000901  ???  ???  0x00       
+376		??   0x0e794f74          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+377		??   0x0e794f77          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+378		??   0x0e795135          0x00000901  ???  ???  0x00       
+379		??   0x0e795138          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+380		??   0x0e7952f9          0x00000901  ???  ???  0x00       
+381		??   0x0e7952fb          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+382		??   0x0e7954bc          0x00000901  ???  ???  0x00       
+383		??   0x0e7954bf          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+384		??   0x0e79567f          0x00000901  ???  ???  0x00       
+385		??   0x0e795682          0x00000700  ???  ???  0x08       77 10 ea 01 77 10 ea 01 
+386		??   0x0e795685          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+387		??   0x0e795843          0x00000d01  ???  ???  0x00       
+388		??   0x0e795844          0x00000901  ???  ???  0x00       
+389		??   0x0e795847          0x00000700  ???  ???  0x08       75 10 ea 01 75 10 ea 01 
+390		??   0x0e795a07          0x00000901  ???  ???  0x00       
+391		??   0x0e795a0a          0x00000700  ???  ???  0x08       75 10 ea 01 75 10 ea 01 
+392		??   0x0e795b3e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+393		??   0x0e795b41          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+394		??   0x0e795b44          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+395		??   0x0e795bca          0x00000901  ???  ???  0x00       
+396		??   0x0e795bcd          0x00000700  ???  ???  0x08       75 10 ea 01 75 10 ea 01 
+397		??   0x0e795bd0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+398		??   0x0e795d8e          0x00000901  ???  ???  0x00       
+399		??   0x0e795d90          0x00000700  ???  ???  0x08       75 10 ea 01 75 10 ea 01 
+400		??   0x0e795d93          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+401		??   0x0e795f51          0x00000901  ???  ???  0x00       
+402		??   0x0e795f54          0x00000700  ???  ???  0x08       75 10 ea 01 75 10 ea 01 
+403		??   0x0e795f57          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+404		??   0x0e795f88          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ec 11 
+405		??   0x0e796115          0x00000901  ???  ???  0x00       
+406		??   0x0e796117          0x00000700  ???  ???  0x08       75 10 ea 01 75 10 ea 01 
+407		??   0x0e79611a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+408		??   0x0e7962d8          0x00000901  ???  ???  0x00       
+409		??   0x0e7962db          0x00000700  ???  ???  0x08       77 10 ea 01 77 10 ea 01 
+410		??   0x0e7962de          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+411		??   0x0e79649c          0x00000901  ???  ???  0x00       
+412		??   0x0e79649f          0x00000700  ???  ???  0x08       75 10 ea 01 75 10 ea 01 
+413		??   0x0e7964bd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+414		??   0x0e79665f          0x00000901  ???  ???  0x00       
+415		??   0x0e796662          0x00000700  ???  ???  0x08       77 10 ea 01 77 10 ea 01 
+416		??   0x0e7966bc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+417		??   0x0e796823          0x00000901  ???  ???  0x00       
+418		??   0x0e796826          0x00000700  ???  ???  0x08       75 10 ea 01 75 10 ea 01 
+419		??   0x0e796828          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+420		??   0x0e79682b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+421		??   0x0e7969e6          0x00000901  ???  ???  0x00       
+422		??   0x0e7969e9          0x00000700  ???  ???  0x08       75 10 ea 01 75 10 ea 01 
+423		??   0x0e7969ec          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+424		??   0x0e796baa          0x00000901  ???  ???  0x00       
+425		??   0x0e796bac          0x00000700  ???  ???  0x08       77 10 ea 01 77 10 ea 01 
+426		??   0x0e796c13          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+427		??   0x0e796d6d          0x00000901  ???  ???  0x00       
+428		??   0x0e796d70          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+429		??   0x0e796e15          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+430		??   0x0e796f31          0x00000901  ???  ???  0x00       
+431		??   0x0e796f34          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+432		??   0x0e796fcf          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+433		??   0x0e7970f4          0x00000901  ???  ???  0x00       
+434		??   0x0e7970f7          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+435		??   0x0e7970fa          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+436		??   0x0e797148          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+437		??   0x0e7972b8          0x00000901  ???  ???  0x00       
+438		??   0x0e7972bb          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+439		??   0x0e7972bd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+440		??   0x0e79747b          0x00000901  ???  ???  0x00       
+441		??   0x0e79747e          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+442		??   0x0e797481          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+443		??   0x0e79763f          0x00000901  ???  ???  0x00       
+444		??   0x0e797642          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+445		??   0x0e797644          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+446		??   0x0e797802          0x00000901  ???  ???  0x00       
+447		??   0x0e797805          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+448		??   0x0e797808          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+449		??   0x0e7979c6          0x00000901  ???  ???  0x00       
+450		??   0x0e7979c8          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+451		??   0x0e7979cb          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+452		??   0x0e7979ce          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 eb 11 
+453		??   0x0e797b89          0x00000d01  ???  ???  0x00       
+454		??   0x0e797b8b          0x00000901  ???  ???  0x00       
+455		??   0x0e797b8d          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+456		??   0x0e797d4d          0x00000901  ???  ???  0x00       
+457		??   0x0e797d50          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+458		??   0x0e797f10          0x00000901  ???  ???  0x00       
+459		??   0x0e797f13          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+460		??   0x0e7980d4          0x00000901  ???  ???  0x00       
+461		??   0x0e7980d6          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+462		??   0x0e798297          0x00000901  ???  ???  0x00       
+463		??   0x0e79829a          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+464		??   0x0e79829d          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+465		??   0x0e79845b          0x00000901  ???  ???  0x00       
+466		??   0x0e79845d          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+467		??   0x0e7985b3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+468		??   0x0e7985b6          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+469		??   0x0e7985b9          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+470		??   0x0e79861e          0x00000901  ???  ???  0x00       
+471		??   0x0e798621          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+472		??   0x0e798624          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+473		??   0x0e7987e2          0x00000901  ???  ???  0x00       
+474		??   0x0e7987e4          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+475		??   0x0e7987e7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+476		??   0x0e7989a5          0x00000901  ???  ???  0x00       
+477		??   0x0e7989a8          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+478		??   0x0e7989ab          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+479		??   0x0e798b68          0x00000901  ???  ???  0x00       
+480		??   0x0e798b6b          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+481		??   0x0e798b6e          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+482		??   0x0e798ba0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+483		??   0x0e798d2e          0x00000901  ???  ???  0x00       
+484		??   0x0e798d31          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+485		??   0x0e798d42          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+486		??   0x0e798ef2          0x00000901  ???  ???  0x00       
+487		??   0x0e798ef5          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+488		??   0x0e798ef8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+489		??   0x0e7990b6          0x00000901  ???  ???  0x00       
+490		??   0x0e7990b8          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+491		??   0x0e7990bb          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+492		??   0x0e799279          0x00000901  ???  ???  0x00       
+493		??   0x0e79927c          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+494		??   0x0e7992e3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+495		??   0x0e79943d          0x00000901  ???  ???  0x00       
+496		??   0x0e79943f          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+497		??   0x0e799442          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+498		??   0x0e79944f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+499		??   0x0e799600          0x00000901  ???  ???  0x00       
+500		??   0x0e799603          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+501		??   0x0e799606          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+502		??   0x0e7997c4          0x00000901  ???  ???  0x00       
+503		??   0x0e7997c7          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+504		??   0x0e7997c9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+505		??   0x0e799987          0x00000901  ???  ???  0x00       
+506		??   0x0e79998a          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+507		??   0x0e799a1b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+508		??   0x0e799b4b          0x00000901  ???  ???  0x00       
+509		??   0x0e799b4e          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+510		??   0x0e799b7d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+511		??   0x0e799d0e          0x00000901  ???  ???  0x00       
+512		??   0x0e799d11          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+513		??   0x0e799d14          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+514		??   0x0e799d17          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+515		??   0x0e799ed2          0x00000d01  ???  ???  0x00       
+516		??   0x0e799ed3          0x00000901  ???  ???  0x00       
+517		??   0x0e799ed6          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+518		??   0x0e799f15          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+519		??   0x0e799f18          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+520		??   0x0e79a095          0x00000901  ???  ???  0x00       
+521		??   0x0e79a098          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+522		??   0x0e79a0f5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+523		??   0x0e79a259          0x00000901  ???  ???  0x00       
+524		??   0x0e79a25c          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+525		??   0x0e79a25f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+526		??   0x0e79a41d          0x00000901  ???  ???  0x00       
+527		??   0x0e79a41f          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+528		??   0x0e79a422          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ea 11 
+529		??   0x0e79a5e0          0x00000901  ???  ???  0x00       
+530		??   0x0e79a5e3          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+531		??   0x0e79a5e6          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+532		??   0x0e79a7a3          0x00000901  ???  ???  0x00       
+533		??   0x0e79a7a6          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+534		??   0x0e79a967          0x00000901  ???  ???  0x00       
+535		??   0x0e79a96a          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+536		??   0x0e79ab2a          0x00000901  ???  ???  0x00       
+537		??   0x0e79ab2d          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+538		??   0x0e79acee          0x00000901  ???  ???  0x00       
+539		??   0x0e79acf1          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+540		??   0x0e79aeb1          0x00000901  ???  ???  0x00       
+541		??   0x0e79aeb4          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+542		??   0x0e79aeb7          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+543		??   0x0e79af7a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+544		??   0x0e79af7d          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+545		??   0x0e79b075          0x00000901  ???  ???  0x00       
+546		??   0x0e79b078          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+547		??   0x0e79b0bc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+548		??   0x0e79b238          0x00000901  ???  ???  0x00       
+549		??   0x0e79b23b          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+550		??   0x0e79b264          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+551		??   0x0e79b3fc          0x00000901  ???  ???  0x00       
+552		??   0x0e79b3ff          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+553		??   0x0e79b401          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+554		??   0x0e79b5bf          0x00000901  ???  ???  0x00       
+555		??   0x0e79b5c2          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+556		??   0x0e79b5c5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+557		??   0x0e79b783          0x00000901  ???  ???  0x00       
+558		??   0x0e79b786          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+559		??   0x0e79b789          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+560		??   0x0e79b7c9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+561		??   0x0e79b947          0x00000901  ???  ???  0x00       
+562		??   0x0e79b949          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+563		??   0x0e79b96d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+564		??   0x0e79bb0a          0x00000901  ???  ???  0x00       
+565		??   0x0e79bb0d          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+566		??   0x0e79bb0f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+567		??   0x0e79bccd          0x00000901  ???  ???  0x00       
+568		??   0x0e79bcd0          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+569		??   0x0e79bcd3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+570		??   0x0e79be91          0x00000901  ???  ???  0x00       
+571		??   0x0e79be94          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+572		??   0x0e79be96          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+573		??   0x0e79c054          0x00000901  ???  ???  0x00       
+574		??   0x0e79c057          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+575		??   0x0e79c05a          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+576		??   0x0e79c05d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+577		??   0x0e79c218          0x00000d01  ???  ???  0x00       
+578		??   0x0e79c219          0x00000901  ???  ???  0x00       
+579		??   0x0e79c21c          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+580		??   0x0e79c21f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+581		??   0x0e79c221          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+582		??   0x0e79c3db          0x00000901  ???  ???  0x00       
+583		??   0x0e79c3de          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+584		??   0x0e79c3e1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+585		??   0x0e79c59f          0x00000901  ???  ???  0x00       
+586		??   0x0e79c5a2          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+587		??   0x0e79c5e1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e9 11 
+588		??   0x0e79c763          0x00000901  ???  ???  0x00       
+589		??   0x0e79c766          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+590		??   0x0e79c7be          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+591		??   0x0e79c926          0x00000901  ???  ???  0x00       
+592		??   0x0e79c929          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+593		??   0x0e79c92c          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+594		??   0x0e79c92f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+595		??   0x0e79caea          0x00000901  ???  ???  0x00       
+596		??   0x0e79caed          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+597		??   0x0e79caf0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+598		??   0x0e79ccad          0x00000901  ???  ???  0x00       
+599		??   0x0e79ccb0          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+600		??   0x0e79ce71          0x00000901  ???  ???  0x00       
+601		??   0x0e79ce74          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+602		??   0x0e79d034          0x00000901  ???  ???  0x00       
+603		??   0x0e79d037          0x00000700  ???  ???  0x08       7a 10 eb 01 7a 10 eb 01 
+604		??   0x0e79d1f8          0x00000901  ???  ???  0x00       
+605		??   0x0e79d1fb          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+606		??   0x0e79d1fd          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+607		??   0x0e79d3bb          0x00000901  ???  ???  0x00       
+608		??   0x0e79d3be          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+609		??   0x0e79d57f          0x00000901  ???  ???  0x00       
+610		??   0x0e79d582          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+611		??   0x0e79d742          0x00000901  ???  ???  0x00       
+612		??   0x0e79d745          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+613		??   0x0e79d906          0x00000901  ???  ???  0x00       
+614		??   0x0e79d908          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+615		??   0x0e79d9b7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+616		??   0x0e79d9ba          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+617		??   0x0e79dac9          0x00000901  ???  ???  0x00       
+618		??   0x0e79dacc          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+619		??   0x0e79dacf          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+620		??   0x0e79db1b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+621		??   0x0e79dc8d          0x00000901  ???  ???  0x00       
+622		??   0x0e79dc90          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+623		??   0x0e79dc9a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+624		??   0x0e79de50          0x00000901  ???  ???  0x00       
+625		??   0x0e79de53          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+626		??   0x0e79de56          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+627		??   0x0e79e014          0x00000901  ???  ???  0x00       
+628		??   0x0e79e017          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+629		??   0x0e79e019          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+630		??   0x0e79e1d7          0x00000901  ???  ???  0x00       
+631		??   0x0e79e1da          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+632		??   0x0e79e1dd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+633		??   0x0e79e39b          0x00000901  ???  ???  0x00       
+634		??   0x0e79e39e          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+635		??   0x0e79e3a0          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+636		??   0x0e79e3a7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+637		??   0x0e79e55e          0x00000d01  ???  ???  0x00       
+638		??   0x0e79e560          0x00000901  ???  ???  0x00       
+639		??   0x0e79e563          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+640		??   0x0e79e5c0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+641		??   0x0e79e5c3          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+642		??   0x0e79e722          0x00000901  ???  ???  0x00       
+643		??   0x0e79e725          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+644		??   0x0e79e728          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+645		??   0x0e79e8e6          0x00000901  ???  ???  0x00       
+646		??   0x0e79e8e8          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+647		??   0x0e79e8eb          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+648		??   0x0e79eaa9          0x00000901  ???  ???  0x00       
+649		??   0x0e79eaac          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+650		??   0x0e79eab0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+651		??   0x0e79ec6c          0x00000901  ???  ???  0x00       
+652		??   0x0e79ec6f          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+653		??   0x0e79ec72          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+654		??   0x0e79eca1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e8 11 
+655		??   0x0e79ee30          0x00000901  ???  ???  0x00       
+656		??   0x0e79ee33          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+657		??   0x0e79ee36          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+658		??   0x0e79eff4          0x00000901  ???  ???  0x00       
+659		??   0x0e79eff6          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+660		??   0x0e79eff9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+661		??   0x0e79f1b7          0x00000901  ???  ???  0x00       
+662		??   0x0e79f1ba          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+663		??   0x0e79f1bd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+664		??   0x0e79f37b          0x00000901  ???  ???  0x00       
+665		??   0x0e79f37d          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+666		??   0x0e79f53e          0x00000901  ???  ???  0x00       
+667		??   0x0e79f541          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+668		??   0x0e79f544          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+669		??   0x0e79f702          0x00000901  ???  ???  0x00       
+670		??   0x0e79f704          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+671		??   0x0e79f8c5          0x00000901  ???  ???  0x00       
+672		??   0x0e79f8c8          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+673		??   0x0e79fa89          0x00000901  ???  ???  0x00       
+674		??   0x0e79fa8c          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+675		??   0x0e79fc4c          0x00000901  ???  ???  0x00       
+676		??   0x0e79fc4f          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+677		??   0x0e79fe10          0x00000901  ???  ???  0x00       
+678		??   0x0e79fe12          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+679		??   0x0e79fe15          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+680		??   0x0e79ff0f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+681		??   0x0e79ffd3          0x00000901  ???  ???  0x00       
+682		??   0x0e79ffd6          0x00000700  ???  ???  0x08       72 10 ec 01 72 10 ec 01 
+683		??   0x0e79ffd9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+684		??   0x0e7a00c4          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+685		??   0x0e7a0197          0x00000901  ???  ???  0x00       
+686		??   0x0e7a0199          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+687		??   0x0e7a019c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+688		??   0x0e7a035a          0x00000901  ???  ???  0x00       
+689		??   0x0e7a035d          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+690		??   0x0e7a0360          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+691		??   0x0e7a051e          0x00000901  ???  ???  0x00       
+692		??   0x0e7a0520          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+693		??   0x0e7a0523          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+694		??   0x0e7a06e1          0x00000901  ???  ???  0x00       
+695		??   0x0e7a06e4          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+696		??   0x0e7a06e7          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+697		??   0x0e7a0724          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+698		??   0x0e7a08a5          0x00000d01  ???  ???  0x00       
+699		??   0x0e7a08a6          0x00000901  ???  ???  0x00       
+700		??   0x0e7a08a9          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+701		??   0x0e7a08c5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+702		??   0x0e7a08c8          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+703		??   0x0e7a0a68          0x00000901  ???  ???  0x00       
+704		??   0x0e7a0a6b          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+705		??   0x0e7a0a6e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+706		??   0x0e7a0c2c          0x00000901  ???  ???  0x00       
+707		??   0x0e7a0c2e          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+708		??   0x0e7a0c31          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+709		??   0x0e7a0def          0x00000901  ???  ???  0x00       
+710		??   0x0e7a0df2          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+711		??   0x0e7a0ea9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+712		??   0x0e7a0fb3          0x00000901  ???  ???  0x00       
+713		??   0x0e7a0fb5          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+714		??   0x0e7a0fb8          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+715		??   0x0e7a0ff6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+716		??   0x0e7a1176          0x00000901  ???  ???  0x00       
+717		??   0x0e7a1179          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+718		??   0x0e7a117c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+719		??   0x0e7a133a          0x00000901  ???  ???  0x00       
+720		??   0x0e7a133d          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+721		??   0x0e7a1342          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+722		??   0x0e7a14fd          0x00000901  ???  ???  0x00       
+723		??   0x0e7a1500          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+724		??   0x0e7a1565          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e7 11 
+725		??   0x0e7a16c1          0x00000901  ???  ???  0x00       
+726		??   0x0e7a16c3          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+727		??   0x0e7a1715          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+728		??   0x0e7a1884          0x00000901  ???  ???  0x00       
+729		??   0x0e7a1887          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+730		??   0x0e7a188a          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+731		??   0x0e7a188c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+732		??   0x0e7a1a48          0x00000901  ???  ???  0x00       
+733		??   0x0e7a1a4a          0x00000700  ???  ???  0x08       72 10 eb 01 72 10 eb 01 
+734		??   0x0e7a1a4d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+735		??   0x0e7a1c0b          0x00000901  ???  ???  0x00       
+736		??   0x0e7a1c0e          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+737		??   0x0e7a1c11          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+738		??   0x0e7a1dcf          0x00000901  ???  ???  0x00       
+739		??   0x0e7a1dd1          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+740		??   0x0e7a1f92          0x00000901  ???  ???  0x00       
+741		??   0x0e7a1f95          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+742		??   0x0e7a2156          0x00000901  ???  ???  0x00       
+743		??   0x0e7a2158          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+744		??   0x0e7a215b          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+745		??   0x0e7a2319          0x00000901  ???  ???  0x00       
+746		??   0x0e7a231c          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+747		??   0x0e7a24dd          0x00000901  ???  ???  0x00       
+748		??   0x0e7a24df          0x00000700  ???  ???  0x08       72 10 eb 01 72 10 eb 01 
+749		??   0x0e7a26a0          0x00000901  ???  ???  0x00       
+750		??   0x0e7a26a3          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+751		??   0x0e7a2863          0x00000901  ???  ???  0x00       
+752		??   0x0e7a2866          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+753		??   0x0e7a2897          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+754		??   0x0e7a289a          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+755		??   0x0e7a2a27          0x00000901  ???  ???  0x00       
+756		??   0x0e7a2a2a          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+757		??   0x0e7a2a2d          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+758		??   0x0e7a2a30          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+759		??   0x0e7a2beb          0x00000d01  ???  ???  0x00       
+760		??   0x0e7a2bec          0x00000901  ???  ???  0x00       
+761		??   0x0e7a2bef          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+762		??   0x0e7a2bf6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+763		??   0x0e7a2bf8          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+764		??   0x0e7a2dae          0x00000901  ???  ???  0x00       
+765		??   0x0e7a2db1          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+766		??   0x0e7a2deb          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+767		??   0x0e7a2f71          0x00000901  ???  ???  0x00       
+768		??   0x0e7a2f74          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+769		??   0x0e7a2f77          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+770		??   0x0e7a3135          0x00000901  ???  ???  0x00       
+771		??   0x0e7a3138          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+772		??   0x0e7a313b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+773		??   0x0e7a32f9          0x00000901  ???  ???  0x00       
+774		??   0x0e7a32fb          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+775		??   0x0e7a32fe          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+776		??   0x0e7a3371          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+777		??   0x0e7a34bc          0x00000901  ???  ???  0x00       
+778		??   0x0e7a34bf          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+779		??   0x0e7a3517          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+780		??   0x0e7a3680          0x00000901  ???  ???  0x00       
+781		??   0x0e7a3683          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+782		??   0x0e7a3685          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+783		??   0x0e7a3843          0x00000901  ???  ???  0x00       
+784		??   0x0e7a3846          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+785		??   0x0e7a3849          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+786		??   0x0e7a3a07          0x00000901  ???  ???  0x00       
+787		??   0x0e7a3a09          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+788		??   0x0e7a3a48          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+789		??   0x0e7a3bca          0x00000901  ???  ???  0x00       
+790		??   0x0e7a3bcd          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+791		??   0x0e7a3bd0          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+792		??   0x0e7a3bf8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e6 11 
+793		??   0x0e7a3d8e          0x00000901  ???  ???  0x00       
+794		??   0x0e7a3d91          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+795		??   0x0e7a3dc5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+796		??   0x0e7a3f51          0x00000901  ???  ???  0x00       
+797		??   0x0e7a3f54          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+798		??   0x0e7a3f7c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+799		??   0x0e7a4115          0x00000901  ???  ???  0x00       
+800		??   0x0e7a4118          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+801		??   0x0e7a411b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+802		??   0x0e7a42d8          0x00000901  ???  ???  0x00       
+803		??   0x0e7a42db          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+804		??   0x0e7a42de          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+805		??   0x0e7a449c          0x00000901  ???  ???  0x00       
+806		??   0x0e7a449f          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+807		??   0x0e7a44a2          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+808		??   0x0e7a4504          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+809		??   0x0e7a4660          0x00000901  ???  ???  0x00       
+810		??   0x0e7a4663          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+811		??   0x0e7a4823          0x00000901  ???  ???  0x00       
+812		??   0x0e7a4826          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+813		??   0x0e7a49e7          0x00000901  ???  ???  0x00       
+814		??   0x0e7a49ea          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+815		??   0x0e7a4baa          0x00000901  ???  ???  0x00       
+816		??   0x0e7a4bad          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+817		??   0x0e7a4d6e          0x00000901  ???  ???  0x00       
+818		??   0x0e7a4d71          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+819		??   0x0e7a4d73          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+820		??   0x0e7a4f31          0x00000d01  ???  ???  0x00       
+821		??   0x0e7a4f33          0x00000901  ???  ???  0x00       
+822		??   0x0e7a4f35          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+823		??   0x0e7a50f5          0x00000901  ???  ???  0x00       
+824		??   0x0e7a50f8          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+825		??   0x0e7a5267          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+826		??   0x0e7a526a          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+827		??   0x0e7a526d          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+828		??   0x0e7a52b8          0x00000901  ???  ???  0x00       
+829		??   0x0e7a52bb          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+830		??   0x0e7a531a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+831		??   0x0e7a547c          0x00000901  ???  ???  0x00       
+832		??   0x0e7a547f          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+833		??   0x0e7a5499          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+834		??   0x0e7a563f          0x00000901  ???  ???  0x00       
+835		??   0x0e7a5642          0x00000700  ???  ???  0x08       75 10 ed 01 75 10 ed 01 
+836		??   0x0e7a5645          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+837		??   0x0e7a5648          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+838		??   0x0e7a5803          0x00000901  ???  ???  0x00       
+839		??   0x0e7a5806          0x00000700  ???  ???  0x08       77 10 ed 01 77 10 ed 01 
+840		??   0x0e7a5808          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+841		??   0x0e7a59c6          0x00000901  ???  ???  0x00       
+842		??   0x0e7a59c9          0x00000700  ???  ???  0x08       75 10 ed 01 75 10 ed 01 
+843		??   0x0e7a59cc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+844		??   0x0e7a5b8a          0x00000901  ???  ???  0x00       
+845		??   0x0e7a5b8d          0x00000700  ???  ???  0x08       75 10 ed 01 75 10 ed 01 
+846		??   0x0e7a5b8f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+847		??   0x0e7a5d4d          0x00000901  ???  ???  0x00       
+848		??   0x0e7a5d50          0x00000700  ???  ???  0x08       77 10 ed 01 77 10 ed 01 
+849		??   0x0e7a5da6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+850		??   0x0e7a5f11          0x00000901  ???  ???  0x00       
+851		??   0x0e7a5f14          0x00000700  ???  ???  0x08       75 10 ed 01 75 10 ed 01 
+852		??   0x0e7a5f16          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+853		??   0x0e7a5f4d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+854		??   0x0e7a60d4          0x00000901  ???  ???  0x00       
+855		??   0x0e7a60d7          0x00000700  ???  ???  0x08       77 10 ed 01 77 10 ed 01 
+856		??   0x0e7a60da          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+857		??   0x0e7a6298          0x00000901  ???  ???  0x00       
+858		??   0x0e7a629b          0x00000700  ???  ???  0x08       77 10 ed 01 77 10 ed 01 
+859		??   0x0e7a62da          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+860		??   0x0e7a645b          0x00000901  ???  ???  0x00       
+861		??   0x0e7a645e          0x00000700  ???  ???  0x08       77 10 ed 01 77 10 ed 01 
+862		??   0x0e7a649c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e5 11 
+863		??   0x0e7a661f          0x00000901  ???  ???  0x00       
+864		??   0x0e7a6622          0x00000700  ???  ???  0x08       77 10 ed 01 77 10 ed 01 
+865		??   0x0e7a662e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+866		??   0x0e7a67e2          0x00000901  ???  ???  0x00       
+867		??   0x0e7a67e5          0x00000700  ???  ???  0x08       77 10 ed 01 77 10 ed 01 
+868		??   0x0e7a67e8          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+869		??   0x0e7a67eb          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+870		??   0x0e7a69a6          0x00000901  ???  ???  0x00       
+871		??   0x0e7a69a9          0x00000700  ???  ???  0x08       75 10 ed 01 75 10 ed 01 
+872		??   0x0e7a69ac          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+873		??   0x0e7a6b69          0x00000901  ???  ???  0x00       
+874		??   0x0e7a6b6c          0x00000700  ???  ???  0x08       77 10 ed 01 77 10 ed 01 
+875		??   0x0e7a6bb7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+876		??   0x0e7a6d2d          0x00000901  ???  ???  0x00       
+877		??   0x0e7a6d30          0x00000700  ???  ???  0x08       77 10 ed 01 77 10 ed 01 
+878		??   0x0e7a6d37          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+879		??   0x0e7a6ef0          0x00000901  ???  ???  0x00       
+880		??   0x0e7a6ef3          0x00000700  ???  ???  0x08       75 10 ed 01 75 10 ed 01 
+881		??   0x0e7a6ef6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+882		??   0x0e7a70b4          0x00000901  ???  ???  0x00       
+883		??   0x0e7a70b6          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+884		??   0x0e7a70b9          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+885		??   0x0e7a70bc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+886		??   0x0e7a7278          0x00000d01  ???  ???  0x00       
+887		??   0x0e7a7279          0x00000901  ???  ???  0x00       
+888		??   0x0e7a727c          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+889		??   0x0e7a743b          0x00000901  ???  ???  0x00       
+890		??   0x0e7a743e          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+891		??   0x0e7a75ff          0x00000901  ???  ???  0x00       
+892		??   0x0e7a7601          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+893		??   0x0e7a77c2          0x00000901  ???  ???  0x00       
+894		??   0x0e7a77c5          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+895		??   0x0e7a7986          0x00000901  ???  ???  0x00       
+896		??   0x0e7a7988          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+897		??   0x0e7a798b          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+898		??   0x0e7a7b49          0x00000901  ???  ???  0x00       
+899		??   0x0e7a7b4c          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+900		??   0x0e7a7cd0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+901		??   0x0e7a7cd3          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+902		??   0x0e7a7cd6          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+903		??   0x0e7a7d0d          0x00000901  ???  ???  0x00       
+904		??   0x0e7a7d0f          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+905		??   0x0e7a7d70          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+906		??   0x0e7a7ed0          0x00000901  ???  ???  0x00       
+907		??   0x0e7a7ed3          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+908		??   0x0e7a7ed6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+909		??   0x0e7a8094          0x00000901  ???  ???  0x00       
+910		??   0x0e7a8096          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+911		??   0x0e7a8099          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+912		??   0x0e7a8257          0x00000901  ???  ???  0x00       
+913		??   0x0e7a825a          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+914		??   0x0e7a825d          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+915		??   0x0e7a82c6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+916		??   0x0e7a841b          0x00000901  ???  ???  0x00       
+917		??   0x0e7a841d          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+918		??   0x0e7a8471          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+919		??   0x0e7a85de          0x00000901  ???  ???  0x00       
+920		??   0x0e7a85e1          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+921		??   0x0e7a85e4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+922		??   0x0e7a87a2          0x00000901  ???  ???  0x00       
+923		??   0x0e7a87a4          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+924		??   0x0e7a87a7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+925		??   0x0e7a8965          0x00000901  ???  ???  0x00       
+926		??   0x0e7a8968          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+927		??   0x0e7a89a7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e4 11 
+928		??   0x0e7a8b29          0x00000901  ???  ???  0x00       
+929		??   0x0e7a8b2b          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+930		??   0x0e7a8b2e          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+931		??   0x0e7a8b50          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+932		??   0x0e7a8cec          0x00000901  ???  ???  0x00       
+933		??   0x0e7a8cef          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+934		??   0x0e7a8cf2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+935		??   0x0e7a8eb0          0x00000901  ???  ???  0x00       
+936		??   0x0e7a8eb2          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+937		??   0x0e7a8eb5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+938		??   0x0e7a9073          0x00000901  ???  ???  0x00       
+939		??   0x0e7a9076          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+940		??   0x0e7a90af          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+941		??   0x0e7a9237          0x00000901  ???  ???  0x00       
+942		??   0x0e7a9239          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+943		??   0x0e7a9280          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+944		??   0x0e7a93fa          0x00000901  ???  ???  0x00       
+945		??   0x0e7a93fd          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+946		??   0x0e7a9400          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+947		??   0x0e7a9402          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+948		??   0x0e7a95be          0x00000d01  ???  ???  0x00       
+949		??   0x0e7a95bf          0x00000901  ???  ???  0x00       
+950		??   0x0e7a95c2          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+951		??   0x0e7a95ca          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+952		??   0x0e7a95cc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+953		??   0x0e7a9781          0x00000901  ???  ???  0x00       
+954		??   0x0e7a9784          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+955		??   0x0e7a97c3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+956		??   0x0e7a9945          0x00000901  ???  ???  0x00       
+957		??   0x0e7a9947          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+958		??   0x0e7a9990          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+959		??   0x0e7a9b09          0x00000901  ???  ???  0x00       
+960		??   0x0e7a9b0b          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+961		??   0x0e7a9b0e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+962		??   0x0e7a9ccc          0x00000901  ???  ???  0x00       
+963		??   0x0e7a9ccf          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+964		??   0x0e7a9cd2          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+965		??   0x0e7a9cd5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+966		??   0x0e7a9e90          0x00000901  ???  ???  0x00       
+967		??   0x0e7a9e93          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+968		??   0x0e7aa053          0x00000901  ???  ???  0x00       
+969		??   0x0e7aa056          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+970		??   0x0e7aa217          0x00000901  ???  ???  0x00       
+971		??   0x0e7aa219          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+972		??   0x0e7aa3da          0x00000901  ???  ???  0x00       
+973		??   0x0e7aa3dd          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+974		??   0x0e7aa59e          0x00000901  ???  ???  0x00       
+975		??   0x0e7aa5a0          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+976		??   0x0e7aa5a3          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+977		??   0x0e7aa761          0x00000901  ???  ???  0x00       
+978		??   0x0e7aa764          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+979		??   0x0e7aa925          0x00000901  ???  ???  0x00       
+980		??   0x0e7aa927          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+981		??   0x0e7aaae8          0x00000901  ???  ???  0x00       
+982		??   0x0e7aaaeb          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+983		??   0x0e7aaba6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+984		??   0x0e7aaba9          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+985		??   0x0e7aacac          0x00000901  ???  ???  0x00       
+986		??   0x0e7aacae          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+987		??   0x0e7aacb2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+988		??   0x0e7aae6f          0x00000901  ???  ???  0x00       
+989		??   0x0e7aae72          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+990		??   0x0e7aae75          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+991		??   0x0e7aae78          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+992		??   0x0e7ab033          0x00000901  ???  ???  0x00       
+993		??   0x0e7ab036          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+994		??   0x0e7ab0a1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+995		??   0x0e7ab1f6          0x00000901  ???  ???  0x00       
+996		??   0x0e7ab1f9          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+997		??   0x0e7ab22a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+998		??   0x0e7ab3ba          0x00000901  ???  ???  0x00       
+999		??   0x0e7ab3bd          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+1000		??   0x0e7ab3bf          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e3 11 
+1001		??   0x0e7ab57d          0x00000901  ???  ???  0x00       
+1002		??   0x0e7ab580          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+1003		??   0x0e7ab583          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1004		??   0x0e7ab741          0x00000901  ???  ???  0x00       
+1005		??   0x0e7ab744          0x00000700  ???  ???  0x08       75 10 ec 01 75 10 ec 01 
+1006		??   0x0e7ab746          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1007		??   0x0e7ab77a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1008		??   0x0e7ab904          0x00000d01  ???  ???  0x00       
+1009		??   0x0e7ab906          0x00000901  ???  ???  0x00       
+1010		??   0x0e7ab908          0x00000700  ???  ???  0x08       77 10 ec 01 77 10 ec 01 
+1011		??   0x0e7ab90b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1012		??   0x0e7ab90e          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1013		??   0x0e7abac8          0x00000901  ???  ???  0x00       
+1014		??   0x0e7abacb          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1015		??   0x0e7abace          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1016		??   0x0e7abc8b          0x00000901  ???  ???  0x00       
+1017		??   0x0e7abc8e          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1018		??   0x0e7abcf8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1019		??   0x0e7abe4f          0x00000901  ???  ???  0x00       
+1020		??   0x0e7abe52          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1021		??   0x0e7abe84          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1022		??   0x0e7ac012          0x00000901  ???  ???  0x00       
+1023		??   0x0e7ac015          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1024		??   0x0e7ac018          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1025		??   0x0e7ac01b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1026		??   0x0e7ac1d6          0x00000901  ???  ???  0x00       
+1027		??   0x0e7ac1d9          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1028		??   0x0e7ac1dc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1029		??   0x0e7ac399          0x00000901  ???  ???  0x00       
+1030		??   0x0e7ac39c          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1031		??   0x0e7ac3a7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1032		??   0x0e7ac55d          0x00000901  ???  ???  0x00       
+1033		??   0x0e7ac560          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1034		??   0x0e7ac5b4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1035		??   0x0e7ac720          0x00000901  ???  ???  0x00       
+1036		??   0x0e7ac723          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1037		??   0x0e7ac726          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1038		??   0x0e7ac8e4          0x00000901  ???  ???  0x00       
+1039		??   0x0e7ac8e7          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1040		??   0x0e7ac8e9          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1041		??   0x0e7ac8ec          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1042		??   0x0e7acaa7          0x00000901  ???  ???  0x00       
+1043		??   0x0e7acaaa          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1044		??   0x0e7acaef          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1045		??   0x0e7acc6b          0x00000901  ???  ???  0x00       
+1046		??   0x0e7acc6d          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1047		??   0x0e7acc95          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1048		??   0x0e7ace2e          0x00000901  ???  ???  0x00       
+1049		??   0x0e7ace31          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1050		??   0x0e7ace34          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1051		??   0x0e7acff2          0x00000901  ???  ???  0x00       
+1052		??   0x0e7acff5          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1053		??   0x0e7acff7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1054		??   0x0e7ad1b5          0x00000901  ???  ???  0x00       
+1055		??   0x0e7ad1b8          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1056		??   0x0e7ad1bb          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1057		??   0x0e7ad379          0x00000901  ???  ???  0x00       
+1058		??   0x0e7ad37c          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1059		??   0x0e7ad491          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1060		??   0x0e7ad494          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1061		??   0x0e7ad53c          0x00000901  ???  ???  0x00       
+1062		??   0x0e7ad53f          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1063		??   0x0e7ad542          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1064		??   0x0e7ad700          0x00000901  ???  ???  0x00       
+1065		??   0x0e7ad703          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1066		??   0x0e7ad74b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1067		??   0x0e7ad8c3          0x00000901  ???  ???  0x00       
+1068		??   0x0e7ad8c6          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1069		??   0x0e7ad8c9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e2 11 
+1070		??   0x0e7ada87          0x00000901  ???  ???  0x00       
+1071		??   0x0e7ada8a          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1072		??   0x0e7ada8c          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1073		??   0x0e7ada94          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1074		??   0x0e7adc4a          0x00000d01  ???  ???  0x00       
+1075		??   0x0e7adc4c          0x00000901  ???  ???  0x00       
+1076		??   0x0e7adc4f          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1077		??   0x0e7adcb3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1078		??   0x0e7adcb6          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1079		??   0x0e7ade0e          0x00000901  ???  ???  0x00       
+1080		??   0x0e7ade11          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1081		??   0x0e7ade2b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1082		??   0x0e7adfd1          0x00000901  ???  ???  0x00       
+1083		??   0x0e7adfd4          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1084		??   0x0e7adfd7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1085		??   0x0e7ae195          0x00000901  ???  ???  0x00       
+1086		??   0x0e7ae198          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1087		??   0x0e7ae19c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1088		??   0x0e7ae359          0x00000901  ???  ???  0x00       
+1089		??   0x0e7ae35b          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1090		??   0x0e7ae35e          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1091		??   0x0e7ae361          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1092		??   0x0e7ae51c          0x00000901  ???  ???  0x00       
+1093		??   0x0e7ae51f          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1094		??   0x0e7ae522          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1095		??   0x0e7ae6df          0x00000901  ???  ???  0x00       
+1096		??   0x0e7ae6e2          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1097		??   0x0e7ae6e5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1098		??   0x0e7ae8a3          0x00000901  ???  ???  0x00       
+1099		??   0x0e7ae8a6          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1100		??   0x0e7ae8a8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1101		??   0x0e7aea66          0x00000901  ???  ???  0x00       
+1102		??   0x0e7aea69          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1103		??   0x0e7aeaa8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1104		??   0x0e7aec2a          0x00000901  ???  ???  0x00       
+1105		??   0x0e7aec2d          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1106		??   0x0e7aec30          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1107		??   0x0e7aec3d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1108		??   0x0e7aedee          0x00000901  ???  ???  0x00       
+1109		??   0x0e7aedf0          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1110		??   0x0e7aee2e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1111		??   0x0e7aefb1          0x00000901  ???  ???  0x00       
+1112		??   0x0e7aefb4          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1113		??   0x0e7aefc2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1114		??   0x0e7af175          0x00000901  ???  ???  0x00       
+1115		??   0x0e7af177          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1116		??   0x0e7af17c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1117		??   0x0e7af338          0x00000901  ???  ???  0x00       
+1118		??   0x0e7af33b          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1119		??   0x0e7af33e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1120		??   0x0e7af4fc          0x00000901  ???  ???  0x00       
+1121		??   0x0e7af4fe          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1122		??   0x0e7af501          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1123		??   0x0e7af53b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1124		??   0x0e7af6bf          0x00000901  ???  ???  0x00       
+1125		??   0x0e7af6c2          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1126		??   0x0e7af6cc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1127		??   0x0e7af883          0x00000901  ???  ???  0x00       
+1128		??   0x0e7af885          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1129		??   0x0e7af888          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1130		??   0x0e7afa46          0x00000901  ???  ???  0x00       
+1131		??   0x0e7afa49          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1132		??   0x0e7afa4c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1133		??   0x0e7afba7          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1134		??   0x0e7afc0a          0x00000901  ???  ???  0x00       
+1135		??   0x0e7afc0c          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1136		??   0x0e7afc43          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1137		??   0x0e7afdcd          0x00000901  ???  ???  0x00       
+1138		??   0x0e7afdd0          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1139		??   0x0e7afdd3          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1140		??   0x0e7aff91          0x00000d01  ???  ???  0x00       
+1141		??   0x0e7aff92          0x00000901  ???  ???  0x00       
+1142		??   0x0e7aff95          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1143		??   0x0e7b0154          0x00000901  ???  ???  0x00       
+1144		??   0x0e7b0157          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1145		??   0x0e7b02d1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1146		??   0x0e7b02d3          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1147		??   0x0e7b0318          0x00000901  ???  ???  0x00       
+1148		??   0x0e7b031b          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1149		??   0x0e7b0382          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1150		??   0x0e7b04db          0x00000901  ???  ???  0x00       
+1151		??   0x0e7b04de          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1152		??   0x0e7b04e1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1153		??   0x0e7b069f          0x00000901  ???  ???  0x00       
+1154		??   0x0e7b06a2          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1155		??   0x0e7b06a4          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1156		??   0x0e7b06a7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e1 11 
+1157		??   0x0e7b0862          0x00000901  ???  ???  0x00       
+1158		??   0x0e7b0865          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1159		??   0x0e7b0889          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1160		??   0x0e7b0a26          0x00000901  ???  ???  0x00       
+1161		??   0x0e7b0a28          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1162		??   0x0e7b0a2b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1163		??   0x0e7b0be9          0x00000901  ???  ???  0x00       
+1164		??   0x0e7b0bec          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1165		??   0x0e7b0c52          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1166		??   0x0e7b0dac          0x00000901  ???  ???  0x00       
+1167		??   0x0e7b0daf          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1168		??   0x0e7b0dc1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1169		??   0x0e7b0f70          0x00000901  ???  ???  0x00       
+1170		??   0x0e7b0f73          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1171		??   0x0e7b0f76          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1172		??   0x0e7b0f79          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1173		??   0x0e7b1134          0x00000901  ???  ???  0x00       
+1174		??   0x0e7b1136          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1175		??   0x0e7b1139          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1176		??   0x0e7b12f7          0x00000901  ???  ???  0x00       
+1177		??   0x0e7b12fa          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1178		??   0x0e7b1360          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1179		??   0x0e7b14bb          0x00000901  ???  ???  0x00       
+1180		??   0x0e7b14bd          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1181		??   0x0e7b14e3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1182		??   0x0e7b167e          0x00000901  ???  ???  0x00       
+1183		??   0x0e7b1681          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1184		??   0x0e7b1684          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1185		??   0x0e7b1842          0x00000901  ???  ???  0x00       
+1186		??   0x0e7b1844          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1187		??   0x0e7b1847          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1188		??   0x0e7b184a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1189		??   0x0e7b1a05          0x00000901  ???  ???  0x00       
+1190		??   0x0e7b1a08          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1191		??   0x0e7b1a0b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1192		??   0x0e7b1bc9          0x00000901  ???  ???  0x00       
+1193		??   0x0e7b1bcb          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1194		??   0x0e7b1bce          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1195		??   0x0e7b1d8c          0x00000901  ???  ???  0x00       
+1196		??   0x0e7b1d8f          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1197		??   0x0e7b1df5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1198		??   0x0e7b1f4f          0x00000901  ???  ???  0x00       
+1199		??   0x0e7b1f52          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1200		??   0x0e7b1f71          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1201		??   0x0e7b2113          0x00000901  ???  ???  0x00       
+1202		??   0x0e7b2116          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1203		??   0x0e7b2119          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1204		??   0x0e7b211b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1205		??   0x0e7b22bc          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1206		??   0x0e7b22d7          0x00000d01  ???  ???  0x00       
+1207		??   0x0e7b22d8          0x00000901  ???  ???  0x00       
+1208		??   0x0e7b22db          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1209		??   0x0e7b22dd          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1210		??   0x0e7b22e0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1211		??   0x0e7b249a          0x00000901  ???  ???  0x00       
+1212		??   0x0e7b249d          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1213		??   0x0e7b265e          0x00000901  ???  ???  0x00       
+1214		??   0x0e7b2661          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1215		??   0x0e7b2822          0x00000901  ???  ???  0x00       
+1216		??   0x0e7b2824          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1217		??   0x0e7b29e5          0x00000901  ???  ???  0x00       
+1218		??   0x0e7b29e8          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1219		??   0x0e7b29eb          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1220		??   0x0e7b2ba9          0x00000901  ???  ???  0x00       
+1221		??   0x0e7b2bab          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1222		??   0x0e7b2cbe          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1223		??   0x0e7b2d6c          0x00000901  ???  ???  0x00       
+1224		??   0x0e7b2d6f          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1225		??   0x0e7b2d72          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1226		??   0x0e7b2f2f          0x00000901  ???  ???  0x00       
+1227		??   0x0e7b2f32          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1228		??   0x0e7b2f35          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1229		??   0x0e7b30f3          0x00000901  ???  ???  0x00       
+1230		??   0x0e7b30f6          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1231		??   0x0e7b30f9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 e0 11 
+1232		??   0x0e7b32b6          0x00000901  ???  ???  0x00       
+1233		??   0x0e7b32b9          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1234		??   0x0e7b32bc          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1235		??   0x0e7b32bf          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1236		??   0x0e7b347a          0x00000901  ???  ???  0x00       
+1237		??   0x0e7b347d          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1238		??   0x0e7b347f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1239		??   0x0e7b363e          0x00000901  ???  ???  0x00       
+1240		??   0x0e7b3640          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1241		??   0x0e7b367e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1242		??   0x0e7b3801          0x00000901  ???  ???  0x00       
+1243		??   0x0e7b3804          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1244		??   0x0e7b3843          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1245		??   0x0e7b39c5          0x00000901  ???  ???  0x00       
+1246		??   0x0e7b39c8          0x00000700  ???  ???  0x08       77 10 eb 01 77 10 eb 01 
+1247		??   0x0e7b3a2d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1248		??   0x0e7b3b88          0x00000901  ???  ???  0x00       
+1249		??   0x0e7b3b8b          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1250		??   0x0e7b3b8e          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1251		??   0x0e7b3bc4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1252		??   0x0e7b3d4c          0x00000901  ???  ???  0x00       
+1253		??   0x0e7b3d4f          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1254		??   0x0e7b3d51          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1255		??   0x0e7b3f0f          0x00000901  ???  ???  0x00       
+1256		??   0x0e7b3f12          0x00000700  ???  ???  0x08       75 10 eb 01 75 10 eb 01 
+1257		??   0x0e7b3f15          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1258		??   0x0e7b40d3          0x00000901  ???  ???  0x00       
+1259		??   0x0e7b40d6          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1260		??   0x0e7b411c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1261		??   0x0e7b4296          0x00000901  ???  ???  0x00       
+1262		??   0x0e7b4299          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1263		??   0x0e7b429d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1264		??   0x0e7b445a          0x00000901  ???  ???  0x00       
+1265		??   0x0e7b445d          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1266		??   0x0e7b445f          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1267		??   0x0e7b4462          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1268		??   0x0e7b461d          0x00000d01  ???  ???  0x00       
+1269		??   0x0e7b461f          0x00000901  ???  ???  0x00       
+1270		??   0x0e7b4622          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1271		??   0x0e7b47e1          0x00000901  ???  ???  0x00       
+1272		??   0x0e7b47e4          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1273		??   0x0e7b49a4          0x00000901  ???  ???  0x00       
+1274		??   0x0e7b49a7          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1275		??   0x0e7b4b68          0x00000901  ???  ???  0x00       
+1276		??   0x0e7b4b6b          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1277		??   0x0e7b4d2b          0x00000901  ???  ???  0x00       
+1278		??   0x0e7b4d2e          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1279		??   0x0e7b4d31          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1280		??   0x0e7b4eef          0x00000901  ???  ???  0x00       
+1281		??   0x0e7b4ef2          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1282		??   0x0e7b50b3          0x00000901  ???  ???  0x00       
+1283		??   0x0e7b50b5          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1284		??   0x0e7b51b2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1285		??   0x0e7b51b4          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1286		??   0x0e7b51b7          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1287		??   0x0e7b5276          0x00000901  ???  ???  0x00       
+1288		??   0x0e7b5279          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1289		??   0x0e7b527b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1290		??   0x0e7b5439          0x00000901  ???  ???  0x00       
+1291		??   0x0e7b543c          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1292		??   0x0e7b54a3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1293		??   0x0e7b55fd          0x00000901  ???  ???  0x00       
+1294		??   0x0e7b5600          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1295		??   0x0e7b5602          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1296		??   0x0e7b5652          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 df 11 
+1297		??   0x0e7b57c0          0x00000901  ???  ???  0x00       
+1298		??   0x0e7b57c3          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1299		??   0x0e7b57c6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1300		??   0x0e7b5984          0x00000901  ???  ???  0x00       
+1301		??   0x0e7b5987          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1302		??   0x0e7b598a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1303		??   0x0e7b5b47          0x00000901  ???  ???  0x00       
+1304		??   0x0e7b5b4a          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1305		??   0x0e7b5bc5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1306		??   0x0e7b5d0b          0x00000901  ???  ???  0x00       
+1307		??   0x0e7b5d0e          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1308		??   0x0e7b5d5b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1309		??   0x0e7b5ecf          0x00000901  ???  ???  0x00       
+1310		??   0x0e7b5ed1          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1311		??   0x0e7b5ed4          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1312		??   0x0e7b5ed7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1313		??   0x0e7b6092          0x00000901  ???  ???  0x00       
+1314		??   0x0e7b6095          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1315		??   0x0e7b6097          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1316		??   0x0e7b6255          0x00000901  ???  ???  0x00       
+1317		??   0x0e7b6258          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1318		??   0x0e7b6297          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1319		??   0x0e7b6419          0x00000901  ???  ???  0x00       
+1320		??   0x0e7b641c          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1321		??   0x0e7b646d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1322		??   0x0e7b65dc          0x00000901  ???  ???  0x00       
+1323		??   0x0e7b65df          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1324		??   0x0e7b65e2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1325		??   0x0e7b67a0          0x00000901  ???  ???  0x00       
+1326		??   0x0e7b67a3          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1327		??   0x0e7b67a6          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1328		??   0x0e7b67a8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1329		??   0x0e7b6963          0x00000d01  ???  ???  0x00       
+1330		??   0x0e7b6965          0x00000901  ???  ???  0x00       
+1331		??   0x0e7b6967          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1332		??   0x0e7b696a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1333		??   0x0e7b696d          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1334		??   0x0e7b6b27          0x00000901  ???  ???  0x00       
+1335		??   0x0e7b6b2a          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1336		??   0x0e7b6b95          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1337		??   0x0e7b6cea          0x00000901  ???  ???  0x00       
+1338		??   0x0e7b6ced          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1339		??   0x0e7b6d53          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1340		??   0x0e7b6eae          0x00000901  ???  ???  0x00       
+1341		??   0x0e7b6eb1          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1342		??   0x0e7b7072          0x00000901  ???  ???  0x00       
+1343		??   0x0e7b7075          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1344		??   0x0e7b7077          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1345		??   0x0e7b7235          0x00000901  ???  ???  0x00       
+1346		??   0x0e7b7238          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1347		??   0x0e7b73f9          0x00000901  ???  ???  0x00       
+1348		??   0x0e7b73fc          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1349		??   0x0e7b75bc          0x00000901  ???  ???  0x00       
+1350		??   0x0e7b75bf          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1351		??   0x0e7b7780          0x00000901  ???  ???  0x00       
+1352		??   0x0e7b7783          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1353		??   0x0e7b7943          0x00000901  ???  ???  0x00       
+1354		??   0x0e7b7946          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1355		??   0x0e7b7949          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1356		??   0x0e7b7b07          0x00000901  ???  ???  0x00       
+1357		??   0x0e7b7b0a          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1358		??   0x0e7b7b72          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1359		??   0x0e7b7b75          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1360		??   0x0e7b7cca          0x00000901  ???  ???  0x00       
+1361		??   0x0e7b7ccd          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1362		??   0x0e7b7cd0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1363		??   0x0e7b7e8e          0x00000901  ???  ???  0x00       
+1364		??   0x0e7b7e91          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1365		??   0x0e7b7e94          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1366		??   0x0e7b8051          0x00000901  ???  ???  0x00       
+1367		??   0x0e7b8054          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1368		??   0x0e7b8057          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 de 11 
+1369		??   0x0e7b8215          0x00000901  ???  ???  0x00       
+1370		??   0x0e7b8218          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1371		??   0x0e7b821a          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1372		??   0x0e7b827d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1373		??   0x0e7b83d9          0x00000901  ???  ???  0x00       
+1374		??   0x0e7b83db          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1375		??   0x0e7b83e4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1376		??   0x0e7b859c          0x00000901  ???  ???  0x00       
+1377		??   0x0e7b859f          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1378		??   0x0e7b85a2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1379		??   0x0e7b875f          0x00000901  ???  ???  0x00       
+1380		??   0x0e7b8762          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1381		??   0x0e7b8765          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1382		??   0x0e7b8923          0x00000901  ???  ???  0x00       
+1383		??   0x0e7b8926          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1384		??   0x0e7b895d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1385		??   0x0e7b8ae7          0x00000901  ???  ???  0x00       
+1386		??   0x0e7b8ae9          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1387		??   0x0e7b8aec          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1388		??   0x0e7b8aef          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1389		??   0x0e7b8caa          0x00000d01  ???  ???  0x00       
+1390		??   0x0e7b8cac          0x00000901  ???  ???  0x00       
+1391		??   0x0e7b8cae          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1392		??   0x0e7b8cb1          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1393		??   0x0e7b8cb4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1394		??   0x0e7b8e6e          0x00000901  ???  ???  0x00       
+1395		??   0x0e7b8e71          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1396		??   0x0e7b8edc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1397		??   0x0e7b9031          0x00000901  ???  ???  0x00       
+1398		??   0x0e7b9034          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1399		??   0x0e7b9074          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1400		??   0x0e7b91f5          0x00000901  ???  ???  0x00       
+1401		??   0x0e7b91f8          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1402		??   0x0e7b91fa          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1403		??   0x0e7b93b8          0x00000901  ???  ???  0x00       
+1404		??   0x0e7b93bb          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1405		??   0x0e7b93be          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1406		??   0x0e7b93c1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1407		??   0x0e7b957c          0x00000901  ???  ???  0x00       
+1408		??   0x0e7b957e          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1409		??   0x0e7b95bf          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1410		??   0x0e7b973f          0x00000901  ???  ???  0x00       
+1411		??   0x0e7b9742          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1412		??   0x0e7b9796          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1413		??   0x0e7b9903          0x00000901  ???  ???  0x00       
+1414		??   0x0e7b9906          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1415		??   0x0e7b9908          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1416		??   0x0e7b9ac6          0x00000901  ???  ???  0x00       
+1417		??   0x0e7b9ac9          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1418		??   0x0e7b9acc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dd 11 
+1419		??   0x0e7b9c8a          0x00000901  ???  ???  0x00       
+1420		??   0x0e7b9c8d          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1421		??   0x0e7b9c8f          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1422		??   0x0e7b9e4d          0x00000901  ???  ???  0x00       
+1423		??   0x0e7b9e50          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1424		??   0x0e7ba011          0x00000901  ???  ???  0x00       
+1425		??   0x0e7ba014          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1426		??   0x0e7ba1d4          0x00000901  ???  ???  0x00       
+1427		??   0x0e7ba1d7          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1428		??   0x0e7ba398          0x00000901  ???  ???  0x00       
+1429		??   0x0e7ba39b          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1430		??   0x0e7ba55c          0x00000901  ???  ???  0x00       
+1431		??   0x0e7ba55e          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1432		??   0x0e7ba561          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1433		??   0x0e7ba62a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1434		??   0x0e7ba62d          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1435		??   0x0e7ba71f          0x00000901  ???  ???  0x00       
+1436		??   0x0e7ba722          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1437		??   0x0e7ba759          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1438		??   0x0e7ba8e2          0x00000901  ???  ???  0x00       
+1439		??   0x0e7ba8e5          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1440		??   0x0e7ba92d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1441		??   0x0e7baaa6          0x00000901  ???  ???  0x00       
+1442		??   0x0e7baaa9          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1443		??   0x0e7baaac          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1444		??   0x0e7bac69          0x00000901  ???  ???  0x00       
+1445		??   0x0e7bac6c          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1446		??   0x0e7bac75          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1447		??   0x0e7bae2d          0x00000901  ???  ???  0x00       
+1448		??   0x0e7bae30          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+1449		??   0x0e7bae33          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1450		??   0x0e7bae96          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1451		??   0x0e7baff0          0x00000d01  ???  ???  0x00       
+1452		??   0x0e7baff2          0x00000901  ???  ???  0x00       
+1453		??   0x0e7baff5          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1454		??   0x0e7bb04e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1455		??   0x0e7bb051          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1456		??   0x0e7bb1b4          0x00000901  ???  ???  0x00       
+1457		??   0x0e7bb1b7          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1458		??   0x0e7bb1b9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1459		??   0x0e7bb378          0x00000901  ???  ???  0x00       
+1460		??   0x0e7bb37a          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1461		??   0x0e7bb37d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1462		??   0x0e7bb53b          0x00000901  ???  ???  0x00       
+1463		??   0x0e7bb53e          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1464		??   0x0e7bb541          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1465		??   0x0e7bb6ff          0x00000901  ???  ???  0x00       
+1466		??   0x0e7bb701          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1467		??   0x0e7bb704          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1468		??   0x0e7bb717          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1469		??   0x0e7bb8c3          0x00000901  ???  ???  0x00       
+1470		??   0x0e7bb8c6          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1471		??   0x0e7bb8c9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1472		??   0x0e7bba87          0x00000901  ???  ???  0x00       
+1473		??   0x0e7bba8a          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1474		??   0x0e7bba8c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1475		??   0x0e7bbc4a          0x00000901  ???  ???  0x00       
+1476		??   0x0e7bbc4d          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1477		??   0x0e7bbc50          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1478		??   0x0e7bbe0e          0x00000901  ???  ???  0x00       
+1479		??   0x0e7bbe10          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1480		??   0x0e7bbe13          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1481		??   0x0e7bbfd1          0x00000901  ???  ???  0x00       
+1482		??   0x0e7bbfd4          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1483		??   0x0e7bbfd7          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1484		??   0x0e7bc018          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1485		??   0x0e7bc195          0x00000901  ???  ???  0x00       
+1486		??   0x0e7bc197          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1487		??   0x0e7bc1a4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1488		??   0x0e7bc358          0x00000901  ???  ???  0x00       
+1489		??   0x0e7bc35b          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1490		??   0x0e7bc35d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1491		??   0x0e7bc51b          0x00000901  ???  ???  0x00       
+1492		??   0x0e7bc51e          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1493		??   0x0e7bc521          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1494		??   0x0e7bc6df          0x00000901  ???  ???  0x00       
+1495		??   0x0e7bc6e2          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1496		??   0x0e7bc8a3          0x00000901  ???  ???  0x00       
+1497		??   0x0e7bc8a5          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1498		??   0x0e7bc8a8          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1499		??   0x0e7bca66          0x00000901  ???  ???  0x00       
+1500		??   0x0e7bca69          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1501		??   0x0e7bcb55          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1502		??   0x0e7bcc2a          0x00000901  ???  ???  0x00       
+1503		??   0x0e7bcc2c          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1504		??   0x0e7bcc2f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1505		??   0x0e7bcd5c          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1506		??   0x0e7bcded          0x00000901  ???  ???  0x00       
+1507		??   0x0e7bcdf0          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1508		??   0x0e7bcea1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 dc 11 
+1509		??   0x0e7bcfb0          0x00000901  ???  ???  0x00       
+1510		??   0x0e7bcfb3          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1511		??   0x0e7bd062          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1512		??   0x0e7bd174          0x00000901  ???  ???  0x00       
+1513		??   0x0e7bd177          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1514		??   0x0e7bd17a          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1515		??   0x0e7bd192          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1516		??   0x0e7bd338          0x00000d01  ???  ???  0x00       
+1517		??   0x0e7bd339          0x00000901  ???  ???  0x00       
+1518		??   0x0e7bd33c          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1519		??   0x0e7bd33e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1520		??   0x0e7bd341          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1521		??   0x0e7bd4fb          0x00000901  ???  ???  0x00       
+1522		??   0x0e7bd4fe          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1523		??   0x0e7bd501          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1524		??   0x0e7bd6bf          0x00000901  ???  ???  0x00       
+1525		??   0x0e7bd6c1          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1526		??   0x0e7bd6c4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1527		??   0x0e7bd882          0x00000901  ???  ???  0x00       
+1528		??   0x0e7bd885          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1529		??   0x0e7bd888          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1530		??   0x0e7bda46          0x00000901  ???  ???  0x00       
+1531		??   0x0e7bda48          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1532		??   0x0e7bda4b          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1533		??   0x0e7bda6d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1534		??   0x0e7bdc09          0x00000901  ???  ???  0x00       
+1535		??   0x0e7bdc0c          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1536		??   0x0e7bdc0e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1537		??   0x0e7bddcc          0x00000901  ???  ???  0x00       
+1538		??   0x0e7bddcf          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1539		??   0x0e7bde0e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1540		??   0x0e7bdf90          0x00000901  ???  ???  0x00       
+1541		??   0x0e7bdf92          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1542		??   0x0e7bdfca          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1543		??   0x0e7be153          0x00000901  ???  ???  0x00       
+1544		??   0x0e7be156          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1545		??   0x0e7be159          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1546		??   0x0e7be317          0x00000901  ???  ???  0x00       
+1547		??   0x0e7be319          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1548		??   0x0e7be31c          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1549		??   0x0e7be31f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1550		??   0x0e7be4da          0x00000901  ???  ???  0x00       
+1551		??   0x0e7be4dd          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1552		??   0x0e7be543          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1553		??   0x0e7be69e          0x00000901  ???  ???  0x00       
+1554		??   0x0e7be6a1          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1555		??   0x0e7be6ee          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1556		??   0x0e7be861          0x00000901  ???  ???  0x00       
+1557		??   0x0e7be864          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1558		??   0x0e7be867          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1559		??   0x0e7bea25          0x00000901  ???  ???  0x00       
+1560		??   0x0e7bea27          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1561		??   0x0e7bebe8          0x00000901  ???  ???  0x00       
+1562		??   0x0e7bebeb          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+1563		??   0x0e7bebee          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1564		??   0x0e7bedac          0x00000901  ???  ???  0x00       
+1565		??   0x0e7bedae          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1566		??   0x0e7bef6f          0x00000901  ???  ???  0x00       
+1567		??   0x0e7bef72          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1568		??   0x0e7bf133          0x00000901  ???  ???  0x00       
+1569		??   0x0e7bf135          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1570		??   0x0e7bf2f6          0x00000901  ???  ???  0x00       
+1571		??   0x0e7bf2f9          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1572		??   0x0e7bf4ba          0x00000901  ???  ???  0x00       
+1573		??   0x0e7bf4bd          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1574		??   0x0e7bf4bf          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1575		??   0x0e7bf523          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1576		??   0x0e7bf526          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1577		??   0x0e7bf67d          0x00000d01  ???  ???  0x00       
+1578		??   0x0e7bf67f          0x00000901  ???  ???  0x00       
+1579		??   0x0e7bf681          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1580		??   0x0e7bf684          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1581		??   0x0e7bf687          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1582		??   0x0e7bf841          0x00000901  ???  ???  0x00       
+1583		??   0x0e7bf844          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1584		??   0x0e7bf846          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1585		??   0x0e7bfa04          0x00000901  ???  ???  0x00       
+1586		??   0x0e7bfa07          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1587		??   0x0e7bfa47          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 db 11 
+1588		??   0x0e7bfbc8          0x00000901  ???  ???  0x00       
+1589		??   0x0e7bfbcb          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1590		??   0x0e7bfc0a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1591		??   0x0e7bfd8b          0x00000901  ???  ???  0x00       
+1592		??   0x0e7bfd8e          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1593		??   0x0e7bfd91          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1594		??   0x0e7bfd94          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1595		??   0x0e7bff4f          0x00000901  ???  ???  0x00       
+1596		??   0x0e7bff52          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1597		??   0x0e7bff55          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1598		??   0x0e7c0112          0x00000901  ???  ???  0x00       
+1599		??   0x0e7c0115          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1600		??   0x0e7c017b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1601		??   0x0e7c02d6          0x00000901  ???  ???  0x00       
+1602		??   0x0e7c02d9          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1603		??   0x0e7c0313          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1604		??   0x0e7c049a          0x00000901  ???  ???  0x00       
+1605		??   0x0e7c049c          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1606		??   0x0e7c049f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1607		??   0x0e7c065d          0x00000901  ???  ???  0x00       
+1608		??   0x0e7c0660          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1609		??   0x0e7c0663          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1610		??   0x0e7c0665          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1611		??   0x0e7c0820          0x00000901  ???  ???  0x00       
+1612		??   0x0e7c0823          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1613		??   0x0e7c084f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1614		??   0x0e7c09e4          0x00000901  ???  ???  0x00       
+1615		??   0x0e7c09e7          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1616		??   0x0e7c09e9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1617		??   0x0e7c0ba7          0x00000901  ???  ???  0x00       
+1618		??   0x0e7c0baa          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1619		??   0x0e7c0be7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1620		??   0x0e7c0d6b          0x00000901  ???  ???  0x00       
+1621		??   0x0e7c0d6e          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1622		??   0x0e7c0d77          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1623		??   0x0e7c0f2e          0x00000901  ???  ???  0x00       
+1624		??   0x0e7c0f31          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1625		??   0x0e7c0f34          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1626		??   0x0e7c0f37          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1627		??   0x0e7c10f2          0x00000901  ???  ???  0x00       
+1628		??   0x0e7c10f5          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1629		??   0x0e7c10f7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 da 11 
+1630		??   0x0e7c12b5          0x00000901  ???  ???  0x00       
+1631		??   0x0e7c12b8          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1632		??   0x0e7c12f2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1633		??   0x0e7c1479          0x00000901  ???  ???  0x00       
+1634		??   0x0e7c147c          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1635		??   0x0e7c163c          0x00000901  ???  ???  0x00       
+1636		??   0x0e7c163f          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1637		??   0x0e7c1800          0x00000901  ???  ???  0x00       
+1638		??   0x0e7c1802          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1639		??   0x0e7c1805          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1640		??   0x0e7c19c3          0x00000d01  ???  ???  0x00       
+1641		??   0x0e7c19c5          0x00000901  ???  ???  0x00       
+1642		??   0x0e7c19c7          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1643		??   0x0e7c1b87          0x00000901  ???  ???  0x00       
+1644		??   0x0e7c1b8a          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1645		??   0x0e7c1d4a          0x00000901  ???  ???  0x00       
+1646		??   0x0e7c1d4d          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1647		??   0x0e7c1f0e          0x00000901  ???  ???  0x00       
+1648		??   0x0e7c1f11          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+1649		??   0x0e7c1f43          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1650		??   0x0e7c1f46          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1651		??   0x0e7c1f49          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1652		??   0x0e7c20d1          0x00000901  ???  ???  0x00       
+1653		??   0x0e7c20d4          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1654		??   0x0e7c20d7          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1655		??   0x0e7c20da          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1656		??   0x0e7c2295          0x00000901  ???  ???  0x00       
+1657		??   0x0e7c2298          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1658		??   0x0e7c22d8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1659		??   0x0e7c2458          0x00000901  ???  ???  0x00       
+1660		??   0x0e7c245b          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1661		??   0x0e7c24aa          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1662		??   0x0e7c261c          0x00000901  ???  ???  0x00       
+1663		??   0x0e7c261f          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1664		??   0x0e7c2621          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1665		??   0x0e7c27df          0x00000901  ???  ???  0x00       
+1666		??   0x0e7c27e2          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1667		??   0x0e7c27e5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1668		??   0x0e7c29a3          0x00000901  ???  ???  0x00       
+1669		??   0x0e7c29a6          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1670		??   0x0e7c29a9          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1671		??   0x0e7c29e7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1672		??   0x0e7c2b67          0x00000901  ???  ???  0x00       
+1673		??   0x0e7c2b69          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1674		??   0x0e7c2b90          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1675		??   0x0e7c2d2a          0x00000901  ???  ???  0x00       
+1676		??   0x0e7c2d2d          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1677		??   0x0e7c2d30          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1678		??   0x0e7c2eed          0x00000901  ???  ???  0x00       
+1679		??   0x0e7c2ef0          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1680		??   0x0e7c2ef3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1681		??   0x0e7c30b1          0x00000901  ???  ???  0x00       
+1682		??   0x0e7c30b4          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1683		??   0x0e7c311a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1684		??   0x0e7c3275          0x00000901  ???  ???  0x00       
+1685		??   0x0e7c3277          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1686		??   0x0e7c327a          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1687		??   0x0e7c32c2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1688		??   0x0e7c3438          0x00000901  ???  ???  0x00       
+1689		??   0x0e7c343b          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1690		??   0x0e7c343e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1691		??   0x0e7c35fc          0x00000901  ???  ???  0x00       
+1692		??   0x0e7c35ff          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1693		??   0x0e7c3601          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1694		??   0x0e7c37bf          0x00000901  ???  ???  0x00       
+1695		??   0x0e7c37c2          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1696		??   0x0e7c37c8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1697		??   0x0e7c3983          0x00000901  ???  ???  0x00       
+1698		??   0x0e7c3986          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1699		??   0x0e7c3988          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1700		??   0x0e7c3b46          0x00000901  ???  ???  0x00       
+1701		??   0x0e7c3b49          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1702		??   0x0e7c3b4c          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1703		??   0x0e7c3b89          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d9 11 
+1704		??   0x0e7c3d0a          0x00000d01  ???  ???  0x00       
+1705		??   0x0e7c3d0b          0x00000901  ???  ???  0x00       
+1706		??   0x0e7c3d0e          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1707		??   0x0e7c3ece          0x00000901  ???  ???  0x00       
+1708		??   0x0e7c3ed0          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1709		??   0x0e7c4091          0x00000901  ???  ???  0x00       
+1710		??   0x0e7c4094          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1711		??   0x0e7c4255          0x00000901  ???  ???  0x00       
+1712		??   0x0e7c4258          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1713		??   0x0e7c4418          0x00000901  ???  ???  0x00       
+1714		??   0x0e7c441b          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1715		??   0x0e7c441e          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1716		??   0x0e7c44df          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1717		??   0x0e7c44e2          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1718		??   0x0e7c45dc          0x00000901  ???  ???  0x00       
+1719		??   0x0e7c45df          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1720		??   0x0e7c4608          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1721		??   0x0e7c4658          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1722		??   0x0e7c479f          0x00000901  ???  ???  0x00       
+1723		??   0x0e7c47a2          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1724		??   0x0e7c47dc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1725		??   0x0e7c4963          0x00000901  ???  ???  0x00       
+1726		??   0x0e7c4966          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1727		??   0x0e7c4968          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1728		??   0x0e7c4b26          0x00000901  ???  ???  0x00       
+1729		??   0x0e7c4b29          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1730		??   0x0e7c4b2c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1731		??   0x0e7c4cea          0x00000901  ???  ???  0x00       
+1732		??   0x0e7c4ced          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1733		??   0x0e7c4cef          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1734		??   0x0e7c4d2c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1735		??   0x0e7c4ead          0x00000901  ???  ???  0x00       
+1736		??   0x0e7c4eb0          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1737		??   0x0e7c4ebd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1738		??   0x0e7c5071          0x00000901  ???  ???  0x00       
+1739		??   0x0e7c5074          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1740		??   0x0e7c5076          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1741		??   0x0e7c5234          0x00000901  ???  ???  0x00       
+1742		??   0x0e7c5237          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1743		??   0x0e7c523a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1744		??   0x0e7c53f8          0x00000901  ???  ???  0x00       
+1745		??   0x0e7c53fb          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+1746		??   0x0e7c53fd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1747		??   0x0e7c55bb          0x00000901  ???  ???  0x00       
+1748		??   0x0e7c55be          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1749		??   0x0e7c55c1          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1750		??   0x0e7c55c4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1751		??   0x0e7c577f          0x00000901  ???  ???  0x00       
+1752		??   0x0e7c5782          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1753		??   0x0e7c57e3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1754		??   0x0e7c5942          0x00000901  ???  ???  0x00       
+1755		??   0x0e7c5945          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1756		??   0x0e7c5948          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1757		??   0x0e7c5b06          0x00000901  ???  ???  0x00       
+1758		??   0x0e7c5b09          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1759		??   0x0e7c5b0b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1760		??   0x0e7c5cc9          0x00000901  ???  ???  0x00       
+1761		??   0x0e7c5ccc          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1762		??   0x0e7c5cd3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1763		??   0x0e7c5e8d          0x00000901  ???  ???  0x00       
+1764		??   0x0e7c5e8f          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1765		??   0x0e7c5e92          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1766		??   0x0e7c5ec4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1767		??   0x0e7c6050          0x00000d01  ???  ???  0x00       
+1768		??   0x0e7c6052          0x00000901  ???  ???  0x00       
+1769		??   0x0e7c6054          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1770		??   0x0e7c6057          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d8 11 
+1771		??   0x0e7c605a          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1772		??   0x0e7c6214          0x00000901  ???  ???  0x00       
+1773		??   0x0e7c6217          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1774		??   0x0e7c6219          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1775		??   0x0e7c63d7          0x00000901  ???  ???  0x00       
+1776		??   0x0e7c63da          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1777		??   0x0e7c63f9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1778		??   0x0e7c659b          0x00000901  ???  ???  0x00       
+1779		??   0x0e7c659d          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1780		??   0x0e7c65f4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1781		??   0x0e7c675e          0x00000901  ???  ???  0x00       
+1782		??   0x0e7c6761          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1783		??   0x0e7c6764          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1784		??   0x0e7c6767          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1785		??   0x0e7c6922          0x00000901  ???  ???  0x00       
+1786		??   0x0e7c6925          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1787		??   0x0e7c6927          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1788		??   0x0e7c6ae6          0x00000901  ???  ???  0x00       
+1789		??   0x0e7c6ae8          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1790		??   0x0e7c6ca9          0x00000901  ???  ???  0x00       
+1791		??   0x0e7c6cac          0x00000700  ???  ???  0x08       72 10 e5 01 72 10 e5 01 
+1792		??   0x0e7c6e6c          0x00000901  ???  ???  0x00       
+1793		??   0x0e7c6e6f          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1794		??   0x0e7c7030          0x00000901  ???  ???  0x00       
+1795		??   0x0e7c7033          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1796		??   0x0e7c7035          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1797		??   0x0e7c71f3          0x00000901  ???  ???  0x00       
+1798		??   0x0e7c71f6          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1799		??   0x0e7c73b7          0x00000901  ???  ???  0x00       
+1800		??   0x0e7c73ba          0x00000700  ???  ???  0x08       7a 10 e5 01 7a 10 e5 01 
+1801		??   0x0e7c742c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1802		??   0x0e7c742f          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1803		??   0x0e7c757a          0x00000901  ???  ???  0x00       
+1804		??   0x0e7c757d          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1805		??   0x0e7c75e3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1806		??   0x0e7c773e          0x00000901  ???  ???  0x00       
+1807		??   0x0e7c7741          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1808		??   0x0e7c7765          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1809		??   0x0e7c7901          0x00000901  ???  ???  0x00       
+1810		??   0x0e7c7904          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1811		??   0x0e7c7907          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1812		??   0x0e7c790a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1813		??   0x0e7c7ac5          0x00000901  ???  ???  0x00       
+1814		??   0x0e7c7ac8          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1815		??   0x0e7c7aca          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1816		??   0x0e7c7c88          0x00000901  ???  ???  0x00       
+1817		??   0x0e7c7c8b          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+1818		??   0x0e7c7d1d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1819		??   0x0e7c7e4c          0x00000901  ???  ???  0x00       
+1820		??   0x0e7c7e4f          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1821		??   0x0e7c7e9d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1822		??   0x0e7c800f          0x00000901  ???  ???  0x00       
+1823		??   0x0e7c8012          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1824		??   0x0e7c8015          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1825		??   0x0e7c81d3          0x00000901  ???  ???  0x00       
+1826		??   0x0e7c81d6          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+1827		??   0x0e7c81d8          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1828		??   0x0e7c81db          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1829		??   0x0e7c8396          0x00000d01  ???  ???  0x00       
+1830		??   0x0e7c8398          0x00000901  ???  ???  0x00       
+1831		??   0x0e7c839b          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1832		??   0x0e7c839d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1833		??   0x0e7c83a0          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1834		??   0x0e7c855a          0x00000901  ???  ???  0x00       
+1835		??   0x0e7c855d          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1836		??   0x0e7c8560          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1837		??   0x0e7c871d          0x00000901  ???  ???  0x00       
+1838		??   0x0e7c8720          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1839		??   0x0e7c876c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1840		??   0x0e7c88e1          0x00000901  ???  ???  0x00       
+1841		??   0x0e7c88e4          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1842		??   0x0e7c88f9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1843		??   0x0e7c8aa4          0x00000901  ???  ???  0x00       
+1844		??   0x0e7c8aa7          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1845		??   0x0e7c8aaa          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1846		??   0x0e7c8aad          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d7 11 
+1847		??   0x0e7c8c68          0x00000901  ???  ???  0x00       
+1848		??   0x0e7c8c6b          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1849		??   0x0e7c8c6e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1850		??   0x0e7c8e2b          0x00000901  ???  ???  0x00       
+1851		??   0x0e7c8e2e          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1852		??   0x0e7c8e6d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1853		??   0x0e7c8fef          0x00000901  ???  ???  0x00       
+1854		??   0x0e7c8ff2          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+1855		??   0x0e7c902a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1856		??   0x0e7c91b2          0x00000901  ???  ???  0x00       
+1857		??   0x0e7c91b5          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1858		??   0x0e7c91b8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1859		??   0x0e7c9376          0x00000901  ???  ???  0x00       
+1860		??   0x0e7c9379          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1861		??   0x0e7c937c          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1862		??   0x0e7c953a          0x00000901  ???  ???  0x00       
+1863		??   0x0e7c953d          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1864		??   0x0e7c96fd          0x00000901  ???  ???  0x00       
+1865		??   0x0e7c9700          0x00000700  ???  ???  0x08       7a 10 e5 01 7a 10 e5 01 
+1866		??   0x0e7c98c1          0x00000901  ???  ???  0x00       
+1867		??   0x0e7c98c4          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1868		??   0x0e7c9a84          0x00000901  ???  ???  0x00       
+1869		??   0x0e7c9a87          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+1870		??   0x0e7c9c48          0x00000901  ???  ???  0x00       
+1871		??   0x0e7c9c4b          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1872		??   0x0e7c9c4e          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1873		??   0x0e7c9e0b          0x00000901  ???  ???  0x00       
+1874		??   0x0e7c9e0e          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1875		??   0x0e7c9e1c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1876		??   0x0e7c9e1f          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1877		??   0x0e7c9fcf          0x00000901  ???  ???  0x00       
+1878		??   0x0e7c9fd1          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1879		??   0x0e7c9fd4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1880		??   0x0e7ca192          0x00000901  ???  ???  0x00       
+1881		??   0x0e7ca195          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+1882		??   0x0e7ca1b7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1883		??   0x0e7ca356          0x00000901  ???  ???  0x00       
+1884		??   0x0e7ca358          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1885		??   0x0e7ca3bd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1886		??   0x0e7ca519          0x00000901  ???  ???  0x00       
+1887		??   0x0e7ca51c          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1888		??   0x0e7ca51f          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1889		??   0x0e7ca521          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1890		??   0x0e7ca6dd          0x00000d01  ???  ???  0x00       
+1891		??   0x0e7ca6de          0x00000901  ???  ???  0x00       
+1892		??   0x0e7ca6e1          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1893		??   0x0e7ca6e4          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1894		??   0x0e7ca6e6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1895		??   0x0e7ca8a0          0x00000901  ???  ???  0x00       
+1896		??   0x0e7ca8a3          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1897		??   0x0e7ca8e7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1898		??   0x0e7caa64          0x00000901  ???  ???  0x00       
+1899		??   0x0e7caa67          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1900		??   0x0e7caa97          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1901		??   0x0e7cac27          0x00000901  ???  ???  0x00       
+1902		??   0x0e7cac2a          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1903		??   0x0e7cac2d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1904		??   0x0e7cadeb          0x00000901  ???  ???  0x00       
+1905		??   0x0e7cadee          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1906		??   0x0e7cadf1          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1907		??   0x0e7cadf3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1908		??   0x0e7cafaf          0x00000901  ???  ???  0x00       
+1909		??   0x0e7cafb1          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1910		??   0x0e7caff0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d6 11 
+1911		??   0x0e7cb172          0x00000901  ???  ???  0x00       
+1912		??   0x0e7cb175          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1913		??   0x0e7cb1c8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1914		??   0x0e7cb336          0x00000901  ???  ???  0x00       
+1915		??   0x0e7cb338          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1916		??   0x0e7cb33b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1917		??   0x0e7cb4f9          0x00000901  ???  ???  0x00       
+1918		??   0x0e7cb4fc          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1919		??   0x0e7cb4ff          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1920		??   0x0e7cb6bd          0x00000901  ???  ???  0x00       
+1921		??   0x0e7cb6bf          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1922		??   0x0e7cb6c2          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1923		??   0x0e7cb700          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1924		??   0x0e7cb880          0x00000901  ???  ???  0x00       
+1925		??   0x0e7cb883          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1926		??   0x0e7cb8a8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1927		??   0x0e7cba44          0x00000901  ???  ???  0x00       
+1928		??   0x0e7cba46          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1929		??   0x0e7cba49          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1930		??   0x0e7cbc07          0x00000901  ???  ???  0x00       
+1931		??   0x0e7cbc0a          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1932		??   0x0e7cbc0d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1933		??   0x0e7cbdcb          0x00000901  ???  ???  0x00       
+1934		??   0x0e7cbdce          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1935		??   0x0e7cbe0d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1936		??   0x0e7cbf8e          0x00000901  ???  ???  0x00       
+1937		??   0x0e7cbf91          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1938		??   0x0e7cbf94          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1939		??   0x0e7cbfa3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1940		??   0x0e7cc152          0x00000901  ???  ???  0x00       
+1941		??   0x0e7cc155          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1942		??   0x0e7cc157          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1943		??   0x0e7cc315          0x00000901  ???  ???  0x00       
+1944		??   0x0e7cc318          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1945		??   0x0e7cc31b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1946		??   0x0e7cc4d9          0x00000901  ???  ???  0x00       
+1947		??   0x0e7cc4dc          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+1948		??   0x0e7cc51a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1949		??   0x0e7cc52d          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+1950		??   0x0e7cc69c          0x00000901  ???  ???  0x00       
+1951		??   0x0e7cc69f          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1952		??   0x0e7cc860          0x00000901  ???  ???  0x00       
+1953		??   0x0e7cc863          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1954		??   0x0e7cc865          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1955		??   0x0e7cca23          0x00000d01  ???  ???  0x00       
+1956		??   0x0e7cca25          0x00000901  ???  ???  0x00       
+1957		??   0x0e7cca27          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1958		??   0x0e7ccbe7          0x00000901  ???  ???  0x00       
+1959		??   0x0e7ccbea          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1960		??   0x0e7ccc73          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1961		??   0x0e7ccc75          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+1962		??   0x0e7ccdaa          0x00000901  ???  ???  0x00       
+1963		??   0x0e7ccdad          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1964		??   0x0e7ccdb0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1965		??   0x0e7ccf6e          0x00000901  ???  ???  0x00       
+1966		??   0x0e7ccf71          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1967		??   0x0e7ccf73          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1968		??   0x0e7cd131          0x00000901  ???  ???  0x00       
+1969		??   0x0e7cd134          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1970		??   0x0e7cd137          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1971		??   0x0e7cd13a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1972		??   0x0e7cd2f5          0x00000901  ???  ???  0x00       
+1973		??   0x0e7cd2f8          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1974		??   0x0e7cd337          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1975		??   0x0e7cd4b8          0x00000901  ???  ???  0x00       
+1976		??   0x0e7cd4bb          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1977		??   0x0e7cd4cc          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1978		??   0x0e7cd67c          0x00000901  ???  ???  0x00       
+1979		??   0x0e7cd67f          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1980		??   0x0e7cd681          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d5 11 
+1981		??   0x0e7cd83f          0x00000901  ???  ???  0x00       
+1982		??   0x0e7cd842          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1983		??   0x0e7cd882          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+1984		??   0x0e7cda03          0x00000901  ???  ???  0x00       
+1985		??   0x0e7cda06          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1986		??   0x0e7cda08          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+1987		??   0x0e7cda45          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+1988		??   0x0e7cdbc7          0x00000901  ???  ???  0x00       
+1989		??   0x0e7cdbc9          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1990		??   0x0e7cdbd0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+1991		??   0x0e7cdd8a          0x00000901  ???  ???  0x00       
+1992		??   0x0e7cdd8d          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+1993		??   0x0e7cdd90          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+1994		??   0x0e7cdf4d          0x00000901  ???  ???  0x00       
+1995		??   0x0e7cdf50          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1996		??   0x0e7cdf53          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+1997		??   0x0e7ce111          0x00000901  ???  ???  0x00       
+1998		??   0x0e7ce114          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+1999		??   0x0e7ce132          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2000		??   0x0e7ce2d4          0x00000901  ???  ???  0x00       
+2001		??   0x0e7ce2d7          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2002		??   0x0e7ce2da          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2003		??   0x0e7ce308          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2004		??   0x0e7ce498          0x00000901  ???  ???  0x00       
+2005		??   0x0e7ce49b          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2006		??   0x0e7ce49e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2007		??   0x0e7ce65c          0x00000901  ???  ???  0x00       
+2008		??   0x0e7ce65e          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2009		??   0x0e7ce661          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2010		??   0x0e7ce81f          0x00000901  ???  ???  0x00       
+2011		??   0x0e7ce822          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2012		??   0x0e7ce880          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2013		??   0x0e7ce9e2          0x00000901  ???  ???  0x00       
+2014		??   0x0e7ce9e5          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2015		??   0x0e7ce9e8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2016		??   0x0e7ceba6          0x00000901  ???  ???  0x00       
+2017		??   0x0e7ceba9          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2018		??   0x0e7cebac          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2019		??   0x0e7cebae          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2020		??   0x0e7cec43          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2021		??   0x0e7ced69          0x00000d01  ???  ???  0x00       
+2022		??   0x0e7ced6b          0x00000901  ???  ???  0x00       
+2023		??   0x0e7ced6e          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2024		??   0x0e7cedd7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2025		??   0x0e7cedd9          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2026		??   0x0e7cef2d          0x00000901  ???  ???  0x00       
+2027		??   0x0e7cef30          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2028		??   0x0e7cf0f1          0x00000901  ???  ???  0x00       
+2029		??   0x0e7cf0f3          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2030		??   0x0e7cf2b4          0x00000901  ???  ???  0x00       
+2031		??   0x0e7cf2b7          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2032		??   0x0e7cf478          0x00000901  ???  ???  0x00       
+2033		??   0x0e7cf47a          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2034		??   0x0e7cf47d          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2035		??   0x0e7cf63b          0x00000901  ???  ???  0x00       
+2036		??   0x0e7cf63e          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2037		??   0x0e7cf7fe          0x00000901  ???  ???  0x00       
+2038		??   0x0e7cf801          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2039		??   0x0e7cf9c2          0x00000901  ???  ???  0x00       
+2040		??   0x0e7cf9c5          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2041		??   0x0e7cfb85          0x00000901  ???  ???  0x00       
+2042		??   0x0e7cfb88          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2043		??   0x0e7cfbcb          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2044		??   0x0e7cfd49          0x00000901  ???  ???  0x00       
+2045		??   0x0e7cfd4c          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2046		??   0x0e7cfd4f          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2047		??   0x0e7cfd74          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2048		??   0x0e7cff0c          0x00000901  ???  ???  0x00       
+2049		??   0x0e7cff0f          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2050		??   0x0e7cff12          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d4 11 
+2051		??   0x0e7d00d0          0x00000901  ???  ???  0x00       
+2052		??   0x0e7d00d3          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2053		??   0x0e7d00d5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2054		??   0x0e7d0293          0x00000901  ???  ???  0x00       
+2055		??   0x0e7d0296          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2056		??   0x0e7d02fb          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2057		??   0x0e7d0457          0x00000901  ???  ???  0x00       
+2058		??   0x0e7d045a          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2059		??   0x0e7d0489          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2060		??   0x0e7d061a          0x00000901  ???  ???  0x00       
+2061		??   0x0e7d061d          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2062		??   0x0e7d0620          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2063		??   0x0e7d0623          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2064		??   0x0e7d07de          0x00000901  ???  ???  0x00       
+2065		??   0x0e7d07e1          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2066		??   0x0e7d07e3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2067		??   0x0e7d09a1          0x00000901  ???  ???  0x00       
+2068		??   0x0e7d09a4          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2069		??   0x0e7d09a7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2070		??   0x0e7d0b65          0x00000901  ???  ???  0x00       
+2071		??   0x0e7d0b68          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2072		??   0x0e7d0b6d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2073		??   0x0e7d0d28          0x00000901  ???  ???  0x00       
+2074		??   0x0e7d0d2b          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2075		??   0x0e7d0d6b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2076		??   0x0e7d0eec          0x00000901  ???  ???  0x00       
+2077		??   0x0e7d0eee          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2078		??   0x0e7d0ef1          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2079		??   0x0e7d0f02          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2080		??   0x0e7d10af          0x00000d01  ???  ???  0x00       
+2081		??   0x0e7d10b1          0x00000901  ???  ???  0x00       
+2082		??   0x0e7d10b4          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2083		??   0x0e7d10b6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2084		??   0x0e7d10b9          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2085		??   0x0e7d1274          0x00000901  ???  ???  0x00       
+2086		??   0x0e7d1277          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2087		??   0x0e7d1279          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2088		??   0x0e7d1359          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2089		??   0x0e7d1437          0x00000901  ???  ???  0x00       
+2090		??   0x0e7d143a          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2091		??   0x0e7d1467          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2092		??   0x0e7d15fb          0x00000901  ???  ???  0x00       
+2093		??   0x0e7d15fe          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2094		??   0x0e7d1611          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2095		??   0x0e7d17be          0x00000901  ???  ???  0x00       
+2096		??   0x0e7d17c1          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2097		??   0x0e7d17c4          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2098		??   0x0e7d17c7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2099		??   0x0e7d1982          0x00000901  ???  ???  0x00       
+2100		??   0x0e7d1985          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2101		??   0x0e7d19c4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2102		??   0x0e7d1b45          0x00000901  ???  ???  0x00       
+2103		??   0x0e7d1b48          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2104		??   0x0e7d1b87          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2105		??   0x0e7d1d09          0x00000901  ???  ???  0x00       
+2106		??   0x0e7d1d0c          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2107		??   0x0e7d1d0e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2108		??   0x0e7d1ecc          0x00000901  ???  ???  0x00       
+2109		??   0x0e7d1ecf          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2110		??   0x0e7d208f          0x00000901  ???  ???  0x00       
+2111		??   0x0e7d2092          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2112		??   0x0e7d2095          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2113		??   0x0e7d2253          0x00000901  ???  ???  0x00       
+2114		??   0x0e7d2256          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2115		??   0x0e7d2417          0x00000901  ???  ???  0x00       
+2116		??   0x0e7d2419          0x00000700  ???  ???  0x08       7a 10 e5 01 7a 10 e5 01 
+2117		??   0x0e7d25da          0x00000901  ???  ???  0x00       
+2118		??   0x0e7d25dd          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2119		??   0x0e7d279d          0x00000901  ???  ???  0x00       
+2120		??   0x0e7d27a0          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2121		??   0x0e7d2961          0x00000901  ???  ???  0x00       
+2122		??   0x0e7d2964          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2123		??   0x0e7d2967          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2124		??   0x0e7d29df          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2125		??   0x0e7d2b24          0x00000901  ???  ???  0x00       
+2126		??   0x0e7d2b27          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2127		??   0x0e7d2b2a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2128		??   0x0e7d2ce8          0x00000901  ???  ???  0x00       
+2129		??   0x0e7d2ceb          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2130		??   0x0e7d2ced          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2131		??   0x0e7d2eab          0x00000901  ???  ???  0x00       
+2132		??   0x0e7d2eae          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2133		??   0x0e7d2eb6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d3 11 
+2134		??   0x0e7d306f          0x00000901  ???  ???  0x00       
+2135		??   0x0e7d3072          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2136		??   0x0e7d30cf          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2137		??   0x0e7d3232          0x00000901  ???  ???  0x00       
+2138		??   0x0e7d3235          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2139		??   0x0e7d3238          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2140		??   0x0e7d323b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2141		??   0x0e7d33f6          0x00000d01  ???  ???  0x00       
+2142		??   0x0e7d33f7          0x00000901  ???  ???  0x00       
+2143		??   0x0e7d33fa          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2144		??   0x0e7d33fd          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2145		??   0x0e7d3400          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2146		??   0x0e7d35b9          0x00000901  ???  ???  0x00       
+2147		??   0x0e7d35bc          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2148		??   0x0e7d35fe          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2149		??   0x0e7d377d          0x00000901  ???  ???  0x00       
+2150		??   0x0e7d3780          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2151		??   0x0e7d37ae          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2152		??   0x0e7d3940          0x00000901  ???  ???  0x00       
+2153		??   0x0e7d3943          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2154		??   0x0e7d394f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2155		??   0x0e7d3a70          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2156		??   0x0e7d3b04          0x00000901  ???  ???  0x00       
+2157		??   0x0e7d3b07          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2158		??   0x0e7d3b09          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2159		??   0x0e7d3b0c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2160		??   0x0e7d3cc8          0x00000901  ???  ???  0x00       
+2161		??   0x0e7d3cca          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2162		??   0x0e7d3d0a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2163		??   0x0e7d3e8b          0x00000901  ???  ???  0x00       
+2164		??   0x0e7d3e8e          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2165		??   0x0e7d3e99          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2166		??   0x0e7d404f          0x00000901  ???  ???  0x00       
+2167		??   0x0e7d4051          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2168		??   0x0e7d4054          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2169		??   0x0e7d4212          0x00000901  ???  ???  0x00       
+2170		??   0x0e7d4215          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2171		??   0x0e7d4218          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2172		??   0x0e7d43d6          0x00000901  ???  ???  0x00       
+2173		??   0x0e7d43d8          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2174		??   0x0e7d43db          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2175		??   0x0e7d4418          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2176		??   0x0e7d4599          0x00000901  ???  ???  0x00       
+2177		??   0x0e7d459c          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2178		??   0x0e7d45c1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2179		??   0x0e7d475d          0x00000901  ???  ???  0x00       
+2180		??   0x0e7d475f          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2181		??   0x0e7d4762          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2182		??   0x0e7d4920          0x00000901  ???  ???  0x00       
+2183		??   0x0e7d4923          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2184		??   0x0e7d4926          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2185		??   0x0e7d4ae4          0x00000901  ???  ???  0x00       
+2186		??   0x0e7d4ae6          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2187		??   0x0e7d4ae9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2188		??   0x0e7d4ca7          0x00000901  ???  ???  0x00       
+2189		??   0x0e7d4caa          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2190		??   0x0e7d4cad          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2191		??   0x0e7d4cb0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d2 11 
+2192		??   0x0e7d4e6b          0x00000901  ???  ???  0x00       
+2193		??   0x0e7d4e6e          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2194		??   0x0e7d502e          0x00000901  ???  ???  0x00       
+2195		??   0x0e7d5031          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2196		??   0x0e7d51f2          0x00000901  ???  ???  0x00       
+2197		??   0x0e7d51f5          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2198		??   0x0e7d53b5          0x00000901  ???  ???  0x00       
+2199		??   0x0e7d53b8          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2200		??   0x0e7d5579          0x00000901  ???  ???  0x00       
+2201		??   0x0e7d557b          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2202		??   0x0e7d557e          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2203		??   0x0e7d573c          0x00000d01  ???  ???  0x00       
+2204		??   0x0e7d573e          0x00000901  ???  ???  0x00       
+2205		??   0x0e7d5740          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2206		??   0x0e7d58f8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2207		??   0x0e7d58fb          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2208		??   0x0e7d5900          0x00000901  ???  ???  0x00       
+2209		??   0x0e7d5903          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2210		??   0x0e7d5905          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2211		??   0x0e7d5ac3          0x00000901  ???  ???  0x00       
+2212		??   0x0e7d5ac6          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2213		??   0x0e7d5ac9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2214		??   0x0e7d5c87          0x00000901  ???  ???  0x00       
+2215		??   0x0e7d5c8a          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2216		??   0x0e7d5c8c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2217		??   0x0e7d5e4a          0x00000901  ???  ???  0x00       
+2218		??   0x0e7d5e4d          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2219		??   0x0e7d5e50          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2220		??   0x0e7d5e53          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2221		??   0x0e7d600e          0x00000901  ???  ???  0x00       
+2222		??   0x0e7d6011          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2223		??   0x0e7d6050          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2224		??   0x0e7d6184          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2225		??   0x0e7d61d1          0x00000901  ???  ???  0x00       
+2226		??   0x0e7d61d4          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2227		??   0x0e7d620f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2228		??   0x0e7d6395          0x00000901  ???  ???  0x00       
+2229		??   0x0e7d6398          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2230		??   0x0e7d639b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2231		??   0x0e7d6558          0x00000901  ???  ???  0x00       
+2232		??   0x0e7d655b          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2233		??   0x0e7d655e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2234		??   0x0e7d671c          0x00000901  ???  ???  0x00       
+2235		??   0x0e7d671f          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2236		??   0x0e7d6722          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2237		??   0x0e7d6724          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2238		??   0x0e7d68e0          0x00000901  ???  ???  0x00       
+2239		??   0x0e7d68e2          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2240		??   0x0e7d68e5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2241		??   0x0e7d6aa3          0x00000901  ???  ???  0x00       
+2242		??   0x0e7d6aa6          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2243		??   0x0e7d6ae2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2244		??   0x0e7d6c66          0x00000901  ???  ???  0x00       
+2245		??   0x0e7d6c69          0x00000700  ???  ???  0x08       7a 10 e5 01 7a 10 e5 01 
+2246		??   0x0e7d6cb2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2247		??   0x0e7d6e2a          0x00000901  ???  ???  0x00       
+2248		??   0x0e7d6e2d          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2249		??   0x0e7d6e2f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2250		??   0x0e7d6fed          0x00000901  ???  ???  0x00       
+2251		??   0x0e7d6ff0          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2252		??   0x0e7d6ff3          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2253		??   0x0e7d6ff6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d1 11 
+2254		??   0x0e7d71b1          0x00000901  ???  ???  0x00       
+2255		??   0x0e7d71b4          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2256		??   0x0e7d7201          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2257		??   0x0e7d7375          0x00000901  ???  ???  0x00       
+2258		??   0x0e7d7377          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2259		??   0x0e7d737b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2260		??   0x0e7d7538          0x00000901  ???  ???  0x00       
+2261		??   0x0e7d753b          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2262		??   0x0e7d753e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2263		??   0x0e7d76fb          0x00000901  ???  ???  0x00       
+2264		??   0x0e7d76fe          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2265		??   0x0e7d78bf          0x00000901  ???  ???  0x00       
+2266		??   0x0e7d78c2          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2267		??   0x0e7d78c5          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2268		??   0x0e7d7a83          0x00000d01  ???  ???  0x00       
+2269		??   0x0e7d7a84          0x00000901  ???  ???  0x00       
+2270		??   0x0e7d7a87          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2271		??   0x0e7d7c46          0x00000901  ???  ???  0x00       
+2272		??   0x0e7d7c49          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2273		??   0x0e7d7e0a          0x00000901  ???  ???  0x00       
+2274		??   0x0e7d7e0c          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2275		??   0x0e7d7fcd          0x00000901  ???  ???  0x00       
+2276		??   0x0e7d7fd0          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2277		??   0x0e7d8191          0x00000901  ???  ???  0x00       
+2278		??   0x0e7d8194          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2279		??   0x0e7d8196          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2280		??   0x0e7d82e1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2281		??   0x0e7d82e4          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2282		??   0x0e7d8354          0x00000901  ???  ???  0x00       
+2283		??   0x0e7d8357          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2284		??   0x0e7d838a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2285		??   0x0e7d8518          0x00000901  ???  ???  0x00       
+2286		??   0x0e7d851a          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2287		??   0x0e7d851d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2288		??   0x0e7d86db          0x00000901  ???  ???  0x00       
+2289		??   0x0e7d86de          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2290		??   0x0e7d86e1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2291		??   0x0e7d889a          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2292		??   0x0e7d889f          0x00000901  ???  ???  0x00       
+2293		??   0x0e7d88a2          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2294		??   0x0e7d8910          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2295		??   0x0e7d8a62          0x00000901  ???  ???  0x00       
+2296		??   0x0e7d8a65          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2297		??   0x0e7d8a68          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2298		??   0x0e7d8ab6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2299		??   0x0e7d8c26          0x00000901  ???  ???  0x00       
+2300		??   0x0e7d8c29          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2301		??   0x0e7d8c2b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2302		??   0x0e7d8de9          0x00000901  ???  ???  0x00       
+2303		??   0x0e7d8dec          0x00000700  ???  ???  0x08       7a 10 e5 01 7a 10 e5 01 
+2304		??   0x0e7d8def          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2305		??   0x0e7d8fad          0x00000901  ???  ???  0x00       
+2306		??   0x0e7d8fb0          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2307		??   0x0e7d9016          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2308		??   0x0e7d9170          0x00000901  ???  ???  0x00       
+2309		??   0x0e7d9173          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2310		??   0x0e7d9194          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2311		??   0x0e7d9334          0x00000901  ???  ???  0x00       
+2312		??   0x0e7d9337          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2313		??   0x0e7d9339          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2314		??   0x0e7d933c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2315		??   0x0e7d94f7          0x00000901  ???  ???  0x00       
+2316		??   0x0e7d94fa          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2317		??   0x0e7d94fd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 d0 11 
+2318		??   0x0e7d96bb          0x00000901  ???  ???  0x00       
+2319		??   0x0e7d96be          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2320		??   0x0e7d96f2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2321		??   0x0e7d987e          0x00000901  ???  ???  0x00       
+2322		??   0x0e7d9881          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2323		??   0x0e7d9884          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2324		??   0x0e7d9a42          0x00000901  ???  ???  0x00       
+2325		??   0x0e7d9a45          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2326		??   0x0e7d9a83          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2327		??   0x0e7d9c05          0x00000901  ???  ???  0x00       
+2328		??   0x0e7d9c08          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2329		??   0x0e7d9c0b          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2330		??   0x0e7d9c53          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2331		??   0x0e7d9dc9          0x00000d01  ???  ???  0x00       
+2332		??   0x0e7d9dcb          0x00000901  ???  ???  0x00       
+2333		??   0x0e7d9dcd          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2334		??   0x0e7d9dd0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2335		??   0x0e7d9dd3          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2336		??   0x0e7d9f8d          0x00000901  ???  ???  0x00       
+2337		??   0x0e7d9f8f          0x00000700  ???  ???  0x08       7a 10 e5 01 7a 10 e5 01 
+2338		??   0x0e7d9f92          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2339		??   0x0e7da150          0x00000901  ???  ???  0x00       
+2340		??   0x0e7da153          0x00000700  ???  ???  0x08       75 10 e5 01 75 10 e5 01 
+2341		??   0x0e7da156          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2342		??   0x0e7da314          0x00000901  ???  ???  0x00       
+2343		??   0x0e7da317          0x00000700  ???  ???  0x08       77 10 e5 01 77 10 e5 01 
+2344		??   0x0e7da4d7          0x00000901  ???  ???  0x00       
+2345		??   0x0e7da4da          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2346		??   0x0e7da4dd          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2347		??   0x0e7da69b          0x00000901  ???  ???  0x00       
+2348		??   0x0e7da69e          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2349		??   0x0e7da85e          0x00000901  ???  ???  0x00       
+2350		??   0x0e7da861          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2351		??   0x0e7daa22          0x00000901  ???  ???  0x00       
+2352		??   0x0e7daa25          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2353		??   0x0e7dabe6          0x00000901  ???  ???  0x00       
+2354		??   0x0e7dabe9          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2355		??   0x0e7dada9          0x00000901  ???  ???  0x00       
+2356		??   0x0e7dadac          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2357		??   0x0e7dadaf          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2358		??   0x0e7dadb8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2359		??   0x0e7daf6d          0x00000901  ???  ???  0x00       
+2360		??   0x0e7daf6f          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2361		??   0x0e7daf72          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2362		??   0x0e7dafb0          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2363		??   0x0e7db130          0x00000901  ???  ???  0x00       
+2364		??   0x0e7db133          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2365		??   0x0e7db136          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2366		??   0x0e7db2f4          0x00000901  ???  ???  0x00       
+2367		??   0x0e7db2f6          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2368		??   0x0e7db318          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2369		??   0x0e7db4b7          0x00000901  ???  ???  0x00       
+2370		??   0x0e7db4ba          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2371		??   0x0e7db4c0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2372		??   0x0e7db67b          0x00000901  ???  ???  0x00       
+2373		??   0x0e7db67d          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2374		??   0x0e7db680          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2375		??   0x0e7db683          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2376		??   0x0e7db83e          0x00000901  ???  ???  0x00       
+2377		??   0x0e7db841          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2378		??   0x0e7db844          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2379		??   0x0e7dba02          0x00000901  ???  ???  0x00       
+2380		??   0x0e7dba05          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2381		??   0x0e7dba39          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2382		??   0x0e7dbbc5          0x00000901  ???  ???  0x00       
+2383		??   0x0e7dbbc8          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2384		??   0x0e7dbbcb          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2385		??   0x0e7dbd88          0x00000901  ???  ???  0x00       
+2386		??   0x0e7dbd8b          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2387		??   0x0e7dbd8e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2388		??   0x0e7dbf4c          0x00000901  ???  ???  0x00       
+2389		??   0x0e7dbf4f          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2390		??   0x0e7dbf52          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2391		??   0x0e7dbf54          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cf 11 
+2392		??   0x0e7dc10f          0x00000d01  ???  ???  0x00       
+2393		??   0x0e7dc111          0x00000901  ???  ???  0x00       
+2394		??   0x0e7dc114          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2395		??   0x0e7dc14a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2396		??   0x0e7dc14c          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2397		??   0x0e7dc2d3          0x00000901  ???  ???  0x00       
+2398		??   0x0e7dc2d6          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2399		??   0x0e7dc2d9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2400		??   0x0e7dc496          0x00000901  ???  ???  0x00       
+2401		??   0x0e7dc499          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2402		??   0x0e7dc49c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2403		??   0x0e7dc65a          0x00000901  ???  ???  0x00       
+2404		??   0x0e7dc65d          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2405		??   0x0e7dc719          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2406		??   0x0e7dc81d          0x00000901  ???  ???  0x00       
+2407		??   0x0e7dc820          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2408		??   0x0e7dc823          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2409		??   0x0e7dc89a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2410		??   0x0e7dc9e1          0x00000901  ???  ???  0x00       
+2411		??   0x0e7dc9e4          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2412		??   0x0e7dcba5          0x00000901  ???  ???  0x00       
+2413		??   0x0e7dcba7          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2414		??   0x0e7dcd68          0x00000901  ???  ???  0x00       
+2415		??   0x0e7dcd6b          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2416		??   0x0e7dcf2b          0x00000901  ???  ???  0x00       
+2417		??   0x0e7dcf2e          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2418		??   0x0e7dd0ef          0x00000901  ???  ???  0x00       
+2419		??   0x0e7dd0f2          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2420		??   0x0e7dd0f5          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2421		??   0x0e7dd2b3          0x00000901  ???  ???  0x00       
+2422		??   0x0e7dd2b6          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2423		??   0x0e7dd476          0x00000901  ???  ???  0x00       
+2424		??   0x0e7dd479          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2425		??   0x0e7dd63a          0x00000901  ???  ???  0x00       
+2426		??   0x0e7dd63d          0x00000700  ???  ???  0x08       6d 10 e7 01 6d 10 e7 01 
+2427		??   0x0e7dd6e1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2428		??   0x0e7dd6e4          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2429		??   0x0e7dd7fd          0x00000901  ???  ???  0x00       
+2430		??   0x0e7dd800          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2431		??   0x0e7dd867          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2432		??   0x0e7dd9c1          0x00000901  ???  ???  0x00       
+2433		??   0x0e7dd9c4          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2434		??   0x0e7dd9c7          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2435		??   0x0e7dd9e3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2436		??   0x0e7ddb84          0x00000901  ???  ???  0x00       
+2437		??   0x0e7ddb87          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2438		??   0x0e7ddb8a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2439		??   0x0e7ddd48          0x00000901  ???  ???  0x00       
+2440		??   0x0e7ddd4b          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2441		??   0x0e7ddd89          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2442		??   0x0e7ddf0b          0x00000901  ???  ???  0x00       
+2443		??   0x0e7ddf0e          0x00000700  ???  ???  0x08       7a 10 e8 01 7a 10 e8 01 
+2444		??   0x0e7ddf74          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2445		??   0x0e7de0cf          0x00000901  ???  ???  0x00       
+2446		??   0x0e7de0d2          0x00000700  ???  ???  0x08       75 10 e8 01 75 10 e8 01 
+2447		??   0x0e7de12b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2448		??   0x0e7de292          0x00000901  ???  ???  0x00       
+2449		??   0x0e7de295          0x00000700  ???  ???  0x08       77 10 e8 01 77 10 e8 01 
+2450		??   0x0e7de298          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2451		??   0x0e7de29b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2452		??   0x0e7de456          0x00000d01  ???  ???  0x00       
+2453		??   0x0e7de457          0x00000901  ???  ???  0x00       
+2454		??   0x0e7de45a          0x00000700  ???  ???  0x08       77 10 e8 01 77 10 e8 01 
+2455		??   0x0e7de45d          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2456		??   0x0e7de460          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ce 11 
+2457		??   0x0e7de619          0x00000901  ???  ???  0x00       
+2458		??   0x0e7de61c          0x00000700  ???  ???  0x08       77 10 e8 01 77 10 e8 01 
+2459		??   0x0e7de65d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2460		??   0x0e7de7dd          0x00000901  ???  ???  0x00       
+2461		??   0x0e7de7e0          0x00000700  ???  ???  0x08       77 10 e8 01 77 10 e8 01 
+2462		??   0x0e7de7f3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2463		??   0x0e7de9a0          0x00000901  ???  ???  0x00       
+2464		??   0x0e7de9a3          0x00000700  ???  ???  0x08       77 10 e8 01 77 10 e8 01 
+2465		??   0x0e7de9a6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2466		??   0x0e7deb64          0x00000901  ???  ???  0x00       
+2467		??   0x0e7deb66          0x00000700  ???  ???  0x08       77 10 e8 01 77 10 e8 01 
+2468		??   0x0e7deb69          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2469		??   0x0e7deb6c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2470		??   0x0e7ded27          0x00000901  ???  ???  0x00       
+2471		??   0x0e7ded2a          0x00000700  ???  ???  0x08       77 10 e8 01 77 10 e8 01 
+2472		??   0x0e7ded68          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2473		??   0x0e7deeeb          0x00000901  ???  ???  0x00       
+2474		??   0x0e7deeed          0x00000700  ???  ???  0x08       75 10 e8 01 75 10 e8 01 
+2475		??   0x0e7def3d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2476		??   0x0e7df0ae          0x00000901  ???  ???  0x00       
+2477		??   0x0e7df0b1          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2478		??   0x0e7df0b4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2479		??   0x0e7df271          0x00000901  ???  ???  0x00       
+2480		??   0x0e7df274          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2481		??   0x0e7df283          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2482		??   0x0e7df435          0x00000901  ???  ???  0x00       
+2483		??   0x0e7df438          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2484		??   0x0e7df43b          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2485		??   0x0e7df45d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2486		??   0x0e7df5f9          0x00000901  ???  ???  0x00       
+2487		??   0x0e7df5fb          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2488		??   0x0e7df7bc          0x00000901  ???  ???  0x00       
+2489		??   0x0e7df7bf          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2490		??   0x0e7df980          0x00000901  ???  ???  0x00       
+2491		??   0x0e7df982          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2492		??   0x0e7dfb43          0x00000901  ???  ???  0x00       
+2493		??   0x0e7dfb46          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2494		??   0x0e7dfd07          0x00000901  ???  ???  0x00       
+2495		??   0x0e7dfd09          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2496		??   0x0e7dfd0c          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2497		??   0x0e7dfeca          0x00000901  ???  ???  0x00       
+2498		??   0x0e7dfecd          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2499		??   0x0e7e008e          0x00000901  ???  ???  0x00       
+2500		??   0x0e7e0090          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2501		??   0x0e7e00e6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2502		??   0x0e7e00e9          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2503		??   0x0e7e0251          0x00000901  ???  ???  0x00       
+2504		??   0x0e7e0254          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2505		??   0x0e7e0257          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2506		??   0x0e7e0415          0x00000901  ???  ???  0x00       
+2507		??   0x0e7e0417          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2508		??   0x0e7e041c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2509		??   0x0e7e05d8          0x00000901  ???  ???  0x00       
+2510		??   0x0e7e05db          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2511		??   0x0e7e05de          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2512		??   0x0e7e0606          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2513		??   0x0e7e079b          0x00000d01  ???  ???  0x00       
+2514		??   0x0e7e079d          0x00000901  ???  ???  0x00       
+2515		??   0x0e7e07a0          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2516		??   0x0e7e07a2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2517		??   0x0e7e07a5          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2518		??   0x0e7e095f          0x00000901  ???  ???  0x00       
+2519		??   0x0e7e0962          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2520		??   0x0e7e0965          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2521		??   0x0e7e0b23          0x00000901  ???  ???  0x00       
+2522		??   0x0e7e0b25          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2523		??   0x0e7e0b2b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2524		??   0x0e7e0ce6          0x00000901  ???  ???  0x00       
+2525		??   0x0e7e0ce9          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2526		??   0x0e7e0d3e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2527		??   0x0e7e0eaa          0x00000901  ???  ???  0x00       
+2528		??   0x0e7e0eac          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2529		??   0x0e7e0eaf          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2530		??   0x0e7e0eb2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cd 11 
+2531		??   0x0e7e106d          0x00000901  ???  ???  0x00       
+2532		??   0x0e7e1070          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2533		??   0x0e7e1073          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2534		??   0x0e7e1231          0x00000901  ???  ???  0x00       
+2535		??   0x0e7e1233          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2536		??   0x0e7e1272          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2537		??   0x0e7e13f4          0x00000901  ???  ???  0x00       
+2538		??   0x0e7e13f7          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2539		??   0x0e7e141e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2540		??   0x0e7e15b8          0x00000901  ???  ???  0x00       
+2541		??   0x0e7e15ba          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2542		??   0x0e7e15bd          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2543		??   0x0e7e177b          0x00000901  ???  ???  0x00       
+2544		??   0x0e7e177e          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2545		??   0x0e7e1781          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2546		??   0x0e7e1784          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2547		??   0x0e7e193f          0x00000901  ???  ???  0x00       
+2548		??   0x0e7e1942          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2549		??   0x0e7e1982          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2550		??   0x0e7e1b02          0x00000901  ???  ???  0x00       
+2551		??   0x0e7e1b05          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2552		??   0x0e7e1b27          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2553		??   0x0e7e1cc6          0x00000901  ???  ???  0x00       
+2554		??   0x0e7e1cc8          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2555		??   0x0e7e1ccb          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2556		??   0x0e7e1e89          0x00000901  ???  ???  0x00       
+2557		??   0x0e7e1e8c          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2558		??   0x0e7e1e8f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2559		??   0x0e7e204d          0x00000901  ???  ???  0x00       
+2560		??   0x0e7e204f          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2561		??   0x0e7e2052          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2562		??   0x0e7e2094          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2563		??   0x0e7e2210          0x00000901  ???  ???  0x00       
+2564		??   0x0e7e2213          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2565		??   0x0e7e2231          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2566		??   0x0e7e23d4          0x00000901  ???  ???  0x00       
+2567		??   0x0e7e23d6          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2568		??   0x0e7e23d9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2569		??   0x0e7e2597          0x00000901  ???  ???  0x00       
+2570		??   0x0e7e259a          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2571		??   0x0e7e275a          0x00000901  ???  ???  0x00       
+2572		??   0x0e7e275d          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2573		??   0x0e7e291e          0x00000901  ???  ???  0x00       
+2574		??   0x0e7e2921          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2575		??   0x0e7e2924          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2576		??   0x0e7e2ae2          0x00000d01  ???  ???  0x00       
+2577		??   0x0e7e2ae3          0x00000901  ???  ???  0x00       
+2578		??   0x0e7e2ae6          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2579		??   0x0e7e2ca5          0x00000901  ???  ???  0x00       
+2580		??   0x0e7e2ca8          0x00000700  ???  ???  0x08       75 10 e6 01 75 10 e6 01 
+2581		??   0x0e7e2e69          0x00000901  ???  ???  0x00       
+2582		??   0x0e7e2e6c          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2583		??   0x0e7e2fc4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2584		??   0x0e7e2fc6          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2585		??   0x0e7e2fc9          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2586		??   0x0e7e302c          0x00000901  ???  ???  0x00       
+2587		??   0x0e7e302f          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2588		??   0x0e7e3074          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2589		??   0x0e7e31f0          0x00000901  ???  ???  0x00       
+2590		??   0x0e7e31f3          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2591		??   0x0e7e31f5          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2592		??   0x0e7e31f8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2593		??   0x0e7e33b3          0x00000901  ???  ???  0x00       
+2594		??   0x0e7e33b6          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2595		??   0x0e7e33b9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cc 11 
+2596		??   0x0e7e3577          0x00000901  ???  ???  0x00       
+2597		??   0x0e7e357a          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2598		??   0x0e7e35c8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2599		??   0x0e7e373a          0x00000901  ???  ???  0x00       
+2600		??   0x0e7e373d          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2601		??   0x0e7e374b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2602		??   0x0e7e38fe          0x00000901  ???  ???  0x00       
+2603		??   0x0e7e3901          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2604		??   0x0e7e392c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2605		??   0x0e7e3ac1          0x00000901  ???  ???  0x00       
+2606		??   0x0e7e3ac4          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2607		??   0x0e7e3ac7          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2608		??   0x0e7e3aca          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2609		??   0x0e7e3c85          0x00000901  ???  ???  0x00       
+2610		??   0x0e7e3c88          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2611		??   0x0e7e3cc5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2612		??   0x0e7e3e48          0x00000901  ???  ???  0x00       
+2613		??   0x0e7e3e4b          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2614		??   0x0e7e3e95          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2615		??   0x0e7e400c          0x00000901  ???  ???  0x00       
+2616		??   0x0e7e400f          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2617		??   0x0e7e4011          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2618		??   0x0e7e41cf          0x00000901  ???  ???  0x00       
+2619		??   0x0e7e41d2          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2620		??   0x0e7e41d5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2621		??   0x0e7e4393          0x00000901  ???  ???  0x00       
+2622		??   0x0e7e4395          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2623		??   0x0e7e4398          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2624		??   0x0e7e43d5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2625		??   0x0e7e4556          0x00000901  ???  ???  0x00       
+2626		??   0x0e7e4559          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2627		??   0x0e7e455d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2628		??   0x0e7e471a          0x00000901  ???  ???  0x00       
+2629		??   0x0e7e471d          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2630		??   0x0e7e471f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2631		??   0x0e7e48dd          0x00000901  ???  ???  0x00       
+2632		??   0x0e7e48e0          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2633		??   0x0e7e48e9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2634		??   0x0e7e4aa1          0x00000901  ???  ???  0x00       
+2635		??   0x0e7e4aa4          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2636		??   0x0e7e4afe          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2637		??   0x0e7e4c64          0x00000901  ???  ???  0x00       
+2638		??   0x0e7e4c67          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2639		??   0x0e7e4c6a          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2640		??   0x0e7e4c6d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2641		??   0x0e7e4e28          0x00000d01  ???  ???  0x00       
+2642		??   0x0e7e4e29          0x00000901  ???  ???  0x00       
+2643		??   0x0e7e4e2c          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2644		??   0x0e7e4feb          0x00000901  ???  ???  0x00       
+2645		??   0x0e7e4fee          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2646		??   0x0e7e51af          0x00000901  ???  ???  0x00       
+2647		??   0x0e7e51b1          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2648		??   0x0e7e5372          0x00000901  ???  ???  0x00       
+2649		??   0x0e7e5375          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2650		??   0x0e7e5536          0x00000901  ???  ???  0x00       
+2651		??   0x0e7e5539          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2652		??   0x0e7e553b          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2653		??   0x0e7e56f9          0x00000901  ???  ???  0x00       
+2654		??   0x0e7e56fc          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2655		??   0x0e7e58bd          0x00000901  ???  ???  0x00       
+2656		??   0x0e7e58c0          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2657		??   0x0e7e599e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2658		??   0x0e7e59a0          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2659		??   0x0e7e59a3          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2660		??   0x0e7e5a81          0x00000901  ???  ???  0x00       
+2661		??   0x0e7e5a83          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2662		??   0x0e7e5a89          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2663		??   0x0e7e5c44          0x00000901  ???  ???  0x00       
+2664		??   0x0e7e5c47          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2665		??   0x0e7e5c6d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2666		??   0x0e7e5e07          0x00000901  ???  ???  0x00       
+2667		??   0x0e7e5e0a          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2668		??   0x0e7e5e0d          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2669		??   0x0e7e5e10          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 cb 11 
+2670		??   0x0e7e5fcb          0x00000901  ???  ???  0x00       
+2671		??   0x0e7e5fce          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2672		??   0x0e7e5fd0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2673		??   0x0e7e618e          0x00000901  ???  ???  0x00       
+2674		??   0x0e7e6191          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2675		??   0x0e7e61f7          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2676		??   0x0e7e6352          0x00000901  ???  ???  0x00       
+2677		??   0x0e7e6355          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2678		??   0x0e7e6376          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2679		??   0x0e7e6515          0x00000901  ???  ???  0x00       
+2680		??   0x0e7e6518          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2681		??   0x0e7e651b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2682		??   0x0e7e66d9          0x00000901  ???  ???  0x00       
+2683		??   0x0e7e66dc          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2684		??   0x0e7e66df          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2685		??   0x0e7e66e1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2686		??   0x0e7e689d          0x00000901  ???  ???  0x00       
+2687		??   0x0e7e689f          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2688		??   0x0e7e68d1          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2689		??   0x0e7e6a60          0x00000901  ???  ???  0x00       
+2690		??   0x0e7e6a63          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2691		??   0x0e7e6a66          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2692		??   0x0e7e6c23          0x00000901  ???  ???  0x00       
+2693		??   0x0e7e6c26          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2694		??   0x0e7e6c65          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2695		??   0x0e7e6de7          0x00000901  ???  ???  0x00       
+2696		??   0x0e7e6dea          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2697		??   0x0e7e6e0b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2698		??   0x0e7e6faa          0x00000901  ???  ???  0x00       
+2699		??   0x0e7e6fad          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2700		??   0x0e7e6fb0          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2701		??   0x0e7e6fb3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2702		??   0x0e7e716e          0x00000d01  ???  ???  0x00       
+2703		??   0x0e7e7170          0x00000901  ???  ???  0x00       
+2704		??   0x0e7e7172          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2705		??   0x0e7e7175          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2706		??   0x0e7e7178          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2707		??   0x0e7e7332          0x00000901  ???  ???  0x00       
+2708		??   0x0e7e7334          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2709		??   0x0e7e7376          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2710		??   0x0e7e74f5          0x00000901  ???  ???  0x00       
+2711		??   0x0e7e74f8          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2712		??   0x0e7e76b9          0x00000901  ???  ???  0x00       
+2713		??   0x0e7e76bc          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2714		??   0x0e7e787c          0x00000901  ???  ???  0x00       
+2715		??   0x0e7e787f          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2716		??   0x0e7e7882          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2717		??   0x0e7e7a40          0x00000901  ???  ???  0x00       
+2718		??   0x0e7e7a42          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2719		??   0x0e7e7c03          0x00000901  ???  ???  0x00       
+2720		??   0x0e7e7c06          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2721		??   0x0e7e7dc7          0x00000901  ???  ???  0x00       
+2722		??   0x0e7e7dc9          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2723		??   0x0e7e7f4a          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2724		??   0x0e7e7f8a          0x00000901  ???  ???  0x00       
+2725		??   0x0e7e7f8d          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2726		??   0x0e7e7fd3          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2727		??   0x0e7e80c4          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2728		??   0x0e7e814e          0x00000901  ???  ???  0x00       
+2729		??   0x0e7e8150          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2730		??   0x0e7e8153          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2731		??   0x0e7e818f          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2732		??   0x0e7e8311          0x00000901  ???  ???  0x00       
+2733		??   0x0e7e8314          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2734		??   0x0e7e8347          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 ca 11 
+2735		??   0x0e7e84d5          0x00000901  ???  ???  0x00       
+2736		??   0x0e7e84d7          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2737		??   0x0e7e84da          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2738		??   0x0e7e8698          0x00000901  ???  ???  0x00       
+2739		??   0x0e7e869b          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2740		??   0x0e7e869e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2741		??   0x0e7e885c          0x00000901  ???  ???  0x00       
+2742		??   0x0e7e885e          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2743		??   0x0e7e88c0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2744		??   0x0e7e8a1f          0x00000901  ???  ???  0x00       
+2745		??   0x0e7e8a22          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2746		??   0x0e7e8a25          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2747		??   0x0e7e8a2b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2748		??   0x0e7e8be3          0x00000901  ???  ???  0x00       
+2749		??   0x0e7e8be5          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2750		??   0x0e7e8be8          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2751		??   0x0e7e8da6          0x00000901  ???  ???  0x00       
+2752		??   0x0e7e8da9          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2753		??   0x0e7e8dc6          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2754		??   0x0e7e8f69          0x00000901  ???  ???  0x00       
+2755		??   0x0e7e8f6c          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2756		??   0x0e7e8fa0          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2757		??   0x0e7e912d          0x00000901  ???  ???  0x00       
+2758		??   0x0e7e9130          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2759		??   0x0e7e9134          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2760		??   0x0e7e92f1          0x00000901  ???  ???  0x00       
+2761		??   0x0e7e92f3          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2762		??   0x0e7e92f6          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2763		??   0x0e7e92f9          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2764		??   0x0e7e94b4          0x00000d01  ???  ???  0x00       
+2765		??   0x0e7e94b6          0x00000901  ???  ???  0x00       
+2766		??   0x0e7e94b8          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2767		??   0x0e7e94bb          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2768		??   0x0e7e94be          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2769		??   0x0e7e9678          0x00000901  ???  ???  0x00       
+2770		??   0x0e7e967a          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2771		??   0x0e7e96d2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2772		??   0x0e7e983b          0x00000901  ???  ???  0x00       
+2773		??   0x0e7e983e          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2774		??   0x0e7e9841          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2775		??   0x0e7e99ff          0x00000901  ???  ???  0x00       
+2776		??   0x0e7e9a02          0x00000700  ???  ???  0x08       81 10 e7 01 81 10 e7 01 
+2777		??   0x0e7e9a04          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2778		??   0x0e7e9bc2          0x00000901  ???  ???  0x00       
+2779		??   0x0e7e9bc5          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2780		??   0x0e7e9bc8          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2781		??   0x0e7e9d86          0x00000901  ???  ???  0x00       
+2782		??   0x0e7e9d89          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2783		??   0x0e7e9f49          0x00000901  ???  ???  0x00       
+2784		??   0x0e7e9f4c          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2785		??   0x0e7ea10d          0x00000901  ???  ???  0x00       
+2786		??   0x0e7ea110          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2787		??   0x0e7ea2d0          0x00000901  ???  ???  0x00       
+2788		??   0x0e7ea2d3          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2789		??   0x0e7ea446          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2790		??   0x0e7ea494          0x00000901  ???  ???  0x00       
+2791		??   0x0e7ea497          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2792		??   0x0e7ea49a          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2793		??   0x0e7ea49c          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2794		??   0x0e7ea657          0x00000901  ???  ???  0x00       
+2795		??   0x0e7ea65a          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2796		??   0x0e7ea65d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2797		??   0x0e7ea7d9          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2798		??   0x0e7ea81b          0x00000901  ???  ???  0x00       
+2799		??   0x0e7ea81e          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2800		??   0x0e7ea820          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c9 11 
+2801		??   0x0e7ea9de          0x00000901  ???  ???  0x00       
+2802		??   0x0e7ea9e1          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2803		??   0x0e7eaa21          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2804		??   0x0e7eaba2          0x00000901  ???  ???  0x00       
+2805		??   0x0e7eaba5          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2806		??   0x0e7eabc5          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2807		??   0x0e7ead66          0x00000901  ???  ???  0x00       
+2808		??   0x0e7ead68          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2809		??   0x0e7ead6b          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2810		??   0x0e7ead6e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2811		??   0x0e7eaf29          0x00000901  ???  ???  0x00       
+2812		??   0x0e7eaf2c          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2813		??   0x0e7eaf2e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2814		??   0x0e7eb0ec          0x00000901  ???  ???  0x00       
+2815		??   0x0e7eb0ef          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2816		??   0x0e7eb12e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2817		??   0x0e7eb2b0          0x00000901  ???  ???  0x00       
+2818		??   0x0e7eb2b3          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2819		??   0x0e7eb2ce          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2820		??   0x0e7eb474          0x00000901  ???  ???  0x00       
+2821		??   0x0e7eb476          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2822		??   0x0e7eb479          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2823		??   0x0e7eb637          0x00000901  ???  ???  0x00       
+2824		??   0x0e7eb63a          0x00000700  ???  ???  0x08       75 10 e7 01 75 10 e7 01 
+2825		??   0x0e7eb63d          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2826		??   0x0e7eb640          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2827		??   0x0e7eb7fb          0x00000d01  ???  ???  0x00       
+2828		??   0x0e7eb7fc          0x00000901  ???  ???  0x00       
+2829		??   0x0e7eb7ff          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2830		??   0x0e7eb802          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2831		??   0x0e7eb805          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2832		??   0x0e7eb9be          0x00000901  ???  ???  0x00       
+2833		??   0x0e7eb9c1          0x00000700  ???  ???  0x08       75 10 e7 01 75 10 e7 01 
+2834		??   0x0e7eb9c4          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2835		??   0x0e7ebb82          0x00000901  ???  ???  0x00       
+2836		??   0x0e7ebb85          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2837		??   0x0e7ebb88          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2838		??   0x0e7ebd46          0x00000901  ???  ???  0x00       
+2839		??   0x0e7ebd48          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2840		??   0x0e7ebd4b          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2841		??   0x0e7ebf09          0x00000901  ???  ???  0x00       
+2842		??   0x0e7ebf0c          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2843		??   0x0e7ebf0f          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2844		??   0x0e7ebf11          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2845		??   0x0e7ec0cd          0x00000901  ???  ???  0x00       
+2846		??   0x0e7ec0cf          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2847		??   0x0e7ec0d2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2848		??   0x0e7ec290          0x00000901  ???  ???  0x00       
+2849		??   0x0e7ec293          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2850		??   0x0e7ec2d2          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2851		??   0x0e7ec454          0x00000901  ???  ???  0x00       
+2852		??   0x0e7ec457          0x00000700  ???  ???  0x08       7a 10 e7 01 7a 10 e7 01 
+2853		??   0x0e7ec48d          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2854		??   0x0e7ec617          0x00000901  ???  ???  0x00       
+2855		??   0x0e7ec61a          0x00000700  ???  ???  0x08       77 10 e7 01 77 10 e7 01 
+2856		??   0x0e7ec61e          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2857		??   0x0e7ec7db          0x00000901  ???  ???  0x00       
+2858		??   0x0e7ec7de          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2859		??   0x0e7ec7e1          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2860		??   0x0e7ec99e          0x00000901  ???  ???  0x00       
+2861		??   0x0e7ec9a1          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2862		??   0x0e7ecb62          0x00000901  ???  ???  0x00       
+2863		??   0x0e7ecb65          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2864		??   0x0e7ecd26          0x00000901  ???  ???  0x00       
+2865		??   0x0e7ecd28          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2866		??   0x0e7ecee9          0x00000901  ???  ???  0x00       
+2867		??   0x0e7eceec          0x00000700  ???  ???  0x08       7a 10 e6 01 7a 10 e6 01 
+2868		??   0x0e7ed0ac          0x00000901  ???  ???  0x00       
+2869		??   0x0e7ed0af          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2870		??   0x0e7ed0b2          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2871		??   0x0e7ed270          0x00000901  ???  ???  0x00       
+2872		??   0x0e7ed273          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2873		??   0x0e7ed344          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2874		??   0x0e7ed347          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2875		??   0x0e7ed433          0x00000901  ???  ???  0x00       
+2876		??   0x0e7ed436          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2877		??   0x0e7ed439          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2878		??   0x0e7ed5f7          0x00000901  ???  ???  0x00       
+2879		??   0x0e7ed5fa          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2880		??   0x0e7ed600          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2881		??   0x0e7ed7ba          0x00000901  ???  ???  0x00       
+2882		??   0x0e7ed7bd          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2883		??   0x0e7ed7ef          0x08000901  ???  ???  0x08       2d 48 ee 11 f4 01 c8 11 
+2884		??   0x0e7ed97e          0x00000901  ???  ???  0x00       
+2885		??   0x0e7ed981          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2886		??   0x0e7ed983          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2887		??   0x0e7ed9b1          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2888		??   0x0e7edb41          0x00000d01  ???  ???  0x00       
+2889		??   0x0e7edb43          0x00000901  ???  ???  0x00       
+2890		??   0x0e7edb46          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2891		??   0x0e7edb48          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2892		??   0x0e7edb4b          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2893		??   0x0e7edd05          0x00000901  ???  ???  0x00       
+2894		??   0x0e7edd08          0x00000700  ???  ???  0x08       77 10 e6 01 77 10 e6 01 
+2895		??   0x0e7edd53          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2896		??   0x0e7edec8          0x00000901  ???  ???  0x00       
+2897		??   0x0e7edecb          0x00000700  ???  ???  0x08       70 10 e6 01 70 10 e6 01 
+2898		??   0x0e7edf21          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2899		??   0x0e7ee08c          0x00000901  ???  ???  0x00       
+2900		??   0x0e7ee08f          0x00000700  ???  ???  0x08       70 10 e6 01 70 10 e6 01 
+2901		??   0x0e7ee092          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2902		??   0x0e7ee250          0x00000901  ???  ???  0x00       
+2903		??   0x0e7ee253          0x00000700  ???  ???  0x08       70 10 e6 01 70 10 e6 01 
+2904		??   0x0e7ee255          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2905		??   0x0e7ee258          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2906		??   0x0e7ee413          0x00000901  ???  ???  0x00       
+2907		??   0x0e7ee416          0x00000700  ???  ???  0x08       6d 10 e6 01 6d 10 e6 01 
+2908		??   0x0e7ee47c          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2909		??   0x0e7ee5d7          0x00000901  ???  ???  0x00       
+2910		??   0x0e7ee5da          0x00000700  ???  ???  0x08       6b 10 e6 01 6b 10 e6 01 
+2911		??   0x0e7ee629          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2912		??   0x0e7ee79a          0x00000901  ???  ???  0x00       
+2913		??   0x0e7ee79d          0x00000700  ???  ???  0x08       6b 10 e6 01 6b 10 e6 01 
+2914		??   0x0e7ee7a0          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2915		??   0x0e7ee95e          0x00000901  ???  ???  0x00       
+2916		??   0x0e7ee961          0x00000700  ???  ???  0x08       6b 10 e6 01 6b 10 e6 01 
+2917		??   0x0e7ee963          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2918		??   0x0e7eeb21          0x00000901  ???  ???  0x00       
+2919		??   0x0e7eeb24          0x00000700  ???  ???  0x08       6b 10 e6 01 6b 10 e6 01 
+2920		??   0x0e7eeb27          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2921		??   0x0e7eeb4e          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2922		??   0x0e7eece5          0x00000901  ???  ???  0x00       
+2923		??   0x0e7eece8          0x00000700  ???  ???  0x08       68 10 e6 01 68 10 e6 01 
+2924		??   0x0e7eecea          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2925		??   0x0e7eeea8          0x00000901  ???  ???  0x00       
+2926		??   0x0e7eeeab          0x00000700  ???  ???  0x08       66 10 e6 01 66 10 e6 01 
+2927		??   0x0e7eeeae          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2928		??   0x0e7ef06c          0x00000901  ???  ???  0x00       
+2929		??   0x0e7ef06f          0x00000700  ???  ???  0x08       64 10 e6 01 64 10 e6 01 
+2930		??   0x0e7ef072          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2931		??   0x0e7ef22f          0x00000901  ???  ???  0x00       
+2932		??   0x0e7ef232          0x00000700  ???  ???  0x08       64 10 02 01 64 10 02 01 
+2933		??   0x0e7ef299          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2934		??   0x0e7ef3f3          0x00000901  ???  ???  0x00       
+2935		??   0x0e7ef3f6          0x00000700  ???  ???  0x08       64 10 02 01 64 10 02 01 
+2936		??   0x0e7ef3f9          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2937		??   0x0e7ef415          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2938		??   0x0e7ef5b7          0x00000901  ???  ???  0x00       
+2939		??   0x0e7ef5b9          0x00000700  ???  ???  0x08       64 10 02 01 64 10 02 01 
+2940		??   0x0e7ef5bc          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2941		??   0x0e7ef77a          0x00000901  ???  ???  0x00       
+2942		??   0x0e7ef77d          0x00000700  ???  ???  0x08       61 10 02 01 61 10 02 01 
+2943		??   0x0e7ef780          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2944		??   0x0e7ef93d          0x00000901  ???  ???  0x00       
+2945		??   0x0e7ef940          0x00000700  ???  ???  0x08       61 10 02 01 61 10 02 01 
+2946		??   0x0e7efb01          0x00000901  ???  ???  0x00       
+2947		??   0x0e7efb04          0x00000700  ???  ???  0x08       61 10 02 01 61 10 02 01 
+2948		??   0x0e7efcc4          0x00000901  ???  ???  0x00       
+2949		??   0x0e7efcc7          0x00000700  ???  ???  0x08       61 10 02 01 61 10 02 01 
+2950		??   0x0e7efcca          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2951		??   0x0e7efe88          0x00000d01  ???  ???  0x00       
+2952		??   0x0e7efe89          0x00000901  ???  ???  0x00       
+2953		??   0x0e7efe8c          0x00000700  ???  ???  0x08       61 10 02 01 61 10 02 01 
+2954		??   0x0e7f004c          0x00000901  ???  ???  0x00       
+2955		??   0x0e7f004e          0x00000700  ???  ???  0x08       61 10 02 01 61 10 02 01 
+2956		??   0x0e7f0199          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2957		??   0x0e7f019c          0x08000d01  ???  ???  0x07       01 00 00 14 05 00 00 
+2958		??   0x0e7f019e          0x08000301  ???  ???  0x08       01 05 00 00 00 00 00 00 
+2959		??   0x0e7f020f          0x00000901  ???  ???  0x00       
+2960		??   0x0e7f0212          0x00000700  ???  ???  0x08       61 10 2f 00 61 10 2f 00 
+2961		??   0x0e7f0215          0x08000901  ???  ???  0x08       2d 48 ee 11 00 00 c7 11 
+2962		??   0x0e7f03d2          0x00000901  ???  ???  0x00       
+2963		??   0x0e7f03d5          0x00000700  ???  ???  0x08       61 10 2f 00 61 10 2f 00 
+2964		??   0x0e7f03d8          0x08000901  ???  ???  0x08       32 48 ee 11 00 00 c7 11 
+2965		??   0x0e7f0596          0x00000901  ???  ???  0x00       
+2966		??   0x0e7f0599          0x00000700  ???  ???  0x08       61 10 2f 00 61 10 2f 00 
+2967		??   0x0e7f059c          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2968		??   0x0e7f059e          0x08000901  ???  ???  0x08       33 48 ee 11 00 00 c7 11 
+2969		??   0x0e7f0759          0x00000901  ???  ???  0x00       
+2970		??   0x0e7f075c          0x00000700  ???  ???  0x08       61 10 2f 00 61 10 2f 00 
+2971		??   0x0e7f079b          0x08000901  ???  ???  0x08       33 48 ee 11 00 00 c7 11 
+2972		??   0x0e7f091d          0x00000901  ???  ???  0x00       
+2973		??   0x0e7f0920          0x00000700  ???  ???  0x08       61 10 2f 00 61 10 2f 00 
+2974		??   0x0e7f0937          0x08000901  ???  ???  0x08       33 48 ee 11 00 00 c7 11 
+2975		??   0x0e7f0ae0          0x00000901  ???  ???  0x00       
+2976		??   0x0e7f0ae3          0x00000700  ???  ???  0x08       61 10 2f 00 61 10 2f 00 
+2977		??   0x0e7f0ae7          0x08000901  ???  ???  0x08       33 48 ee 11 00 00 c7 11 
+2978		??   0x0e7f0ca4          0x00000901  ???  ???  0x00       
+2979		??   0x0e7f0ca7          0x00000700  ???  ???  0x08       61 10 2f 00 61 10 2f 00 
+2980		??   0x0e7f0caa          0x08000901  ???  ???  0x08       33 48 ee 11 00 00 c7 11 
+2981		??   0x0e7f0e67          0x00000901  ???  ???  0x00       
+2982		??   0x0e7f0e6a          0x00000700  ???  ???  0x08       ca 0f 2f 00 ca 0f 2f 00 
+2983		??   0x0e7f0e6d          0x00000800  ???  ???  0x08       2c 01 f4 01 2c 01 f4 01 
+2984		??   0x0e7f0ed0          0x08000901  ???  ???  0x08       33 48 ee 11 00 00 c7 11 
+2985		??   0x0e7f102b          0x00000901  ???  ???  0x00       
+2986		??   0x0e7f102e          0x00000700  ???  ???  0x08       bb 0f 2f 00 bb 0f 2f 00 
+2987		??   0x0e7f1062          0x08000901  ???  ???  0x08       33 48 ee 11 00 00 c7 11 
+2988		??   0x0e7f10ef          0x08000b01  ???  ???  0x07       01 00 00 00 00 00 00 
+2989		??   0x0e7f11f0          0x00000700  ???  ???  0x08       ad 0f 2f 00 ad 0f 2f 00 
+2990		??   0x0e7f122e          0x00000c01  ???  ???  0x07       01 00 00 06 03 01 00 
+2991		??   0x0e7f122f          0x00000901  ???  ???  0x00       
+2992		??   0x0e7f1238          0x08000901  ???  ???  0x08       36 48 ee 11 00 00 c7 11 
+2993		??   0x0e7f13f1          0x00000700  ???  ???  0x08       97 0f 2f 00 97 0f 2f 00 
+2994		??   0x0e7f13f4          0x00000c01  ???  ???  0x07       02 00 00 06 03 01 00 
+2995		??   0x0e7f13f6          0x00000901  ???  ???  0x00       
+2996		??   0x0e7f1426          0x08000901  ???  ???  0x08       36 48 ee 11 00 00 c7 11 
+2997		??   0x0e7f15b5          0x00000700  ???  ???  0x08       88 0f 2f 00 88 0f 2f 00 
+2998		??   0x0e7f15b8          0x00000c01  ???  ???  0x07       02 00 00 06 03 01 00 
+2999		??   0x0e7f15b9          0x00000901  ???  ???  0x00       

+ 29 - 0
EVSE/Projects/CCS/Log/CSU_Simulatation_Tx_MSG.list

@@ -0,0 +1,29 @@
+<SendList m_dwCycles="0">
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="ADDRESS_ASSIGN" obj="010200000005DB000001000105CCA1B2C30100000005F100" />
+    <tagSendUint iInterval="41" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="Download Image Req (166953 Bytes)" obj="010E000066007400770100010705298C020001016F006C00" />
+    <tagSendUint iInterval="10562" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="Download Image Req (MLO, 107,408B)" obj="010E00000000000000010001070690A30100010101000000" />
+    <tagSendUint iInterval="692204600" iTimes="0" len="1" bIncreaseID="0" bIncreaseData="0" szname="Download Image Req (uboot, 629,384B)" obj="010E0000C4175E0FA40100010702889A0900010100000000" />
+    <tagSendUint iInterval="842476601" iTimes="10544" len="1" bIncreaseID="0" bIncreaseData="0" szname="Download Image Req (zImage, 4,369,720)" obj="010E00000000000000010001070338AD4200010101000000" />
+    <tagSendUint iInterval="875311924" iTimes="14390" len="1" bIncreaseID="0" bIncreaseData="0" szname="Download Image Req (ramdisk,32,843,468" obj="010E000000000000000100010704CC26F501010101000000" />
+    <tagSendUint iInterval="10603" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="Block Transfer Start Req (1 Block)" obj="010F00000000000000010001020100000000000001000000" />
+    <tagSendUint iInterval="0" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="Data Transfer Req (5 Bytes)" obj="011000000000000000010001053132333435000001000000" />
+    <tagSendUint iInterval="0" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="Download Image Finish" obj="011100000000000000010001000000000000000001000000" />
+    <tagSendUint iInterval="2701621" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="SET RTC-3210- (2019-12-04T12:41:59)" obj="011400000000000000010001045DE7A99700000001000000" />
+    <tagSendUint iInterval="2701621" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="SET RTC-0123- (2019-12-04T12:41:59)" obj="0114000000000000000100010497A9E75D00000001000000" />
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="GET_FW_VERSION" obj="010400000000000000010001000000000000000001000000" />
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="GET_HW_VERSION " obj="010500000000000000010001000000000000000001000000" />
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="CHARGING_PERMISSION" obj="01060000000000000001000108012C0158024C1D00000000" />
+    <tagSendUint iInterval="0" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="EVSE STOP CHARGING (Normal Stop)" obj="010C00000000000000010001070100000000000000000000" />
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="ISOLATION STATUS" obj="011200000000000000010001010100000000000001000000" />
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="PRECHARGE STATUS" obj="011500000000000000010001010200000000000001000000" />
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="EVSE PRESENT OUTPUT (382V, 0A)" obj="00070000000000000001000108EC0E00004C1D5802000000" />
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="EVSE PRESENT OUTPUT (750V, 60A)" obj="000700000000000000010001084C1D58024C1D5802000000" />
+    <tagSendUint iInterval="0" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="EVSE PRESENT OUTPUT (382V, 110A)" obj="00070000000000000001000108EC0E4C044C1D5802000000" />
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="EVSE PRESENT OUTPUT (0V, 0A)" obj="00070000000000000001000108000000004C1D5802000000" />
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="EVSE PRESENT OUTPUT (60V, 0A)" obj="00070000000000000001000108580200004C1D5802000000" />
+    <tagSendUint iInterval="10" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="EVSE PRESENT OUTPUT (59V, 0A)" obj="00070000000000000001000108570200004C1D5802000000" />
+    <tagSendUint iInterval="539776768" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="EVSE OUTPUT CAPACITY (30KW, 60A)" obj="000800000000000000010001082C0158025802B004000000" />
+    <tagSendUint iInterval="539754537" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="EVSE OUTPUT CAPACITY (60KW, 120A)" obj="000800000000000000010001085802B0045802B004000000" />
+    <tagSendUint iInterval="0" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="GET EV TARGET" obj="010900000000000000010001000000000000000001000000" />
+    <tagSendUint iInterval="0" iTimes="1" len="1" bIncreaseID="0" bIncreaseData="0" szname="GET EV BATTERY INFO" obj="010A00000000000000010001000000000000000001000000" />
+</SendList>

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 150 - 453
EVSE/Projects/CCS/Log/Debug_Log.txt


BIN
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra.pcap


+ 22 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/CableCheckReq.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:CableCheckReq>
+            <s1:DC_EVStatus>
+                <s2:EVReady>false</s2:EVReady>
+                <s2:EVErrorCode>NO_ERROR</s2:EVErrorCode>
+                <s2:EVRESSSOC>50</s2:EVRESSSOC>
+            </s1:DC_EVStatus>
+        </s1:CableCheckReq>
+    </s3:Body>
+</s3:V2G_Message>

+ 25 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/CableCheckRes_Invalid.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:CableCheckRes>
+            <s1:ResponseCode>OK</s1:ResponseCode>
+            <s1:DC_EVSEStatus>
+                <s2:EVSEIsolationStatus>Invalid</s2:EVSEIsolationStatus>
+                <s2:EVSEStatusCode>EVSE_IsolationMonitoringActive</s2:EVSEStatusCode>
+                <s2:NotificationMaxDelay>0</s2:NotificationMaxDelay>
+                <s2:EVSENotification>None</s2:EVSENotification>
+            </s1:DC_EVSEStatus>
+            <s1:EVSEProcessing>Ongoing</s1:EVSEProcessing>
+        </s1:CableCheckRes>
+    </s3:Body>
+</s3:V2G_Message>

+ 25 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/CableCheckRes_Valid.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:CableCheckRes>
+            <s1:ResponseCode>OK</s1:ResponseCode>
+            <s1:DC_EVSEStatus>
+                <s2:EVSEIsolationStatus>Valid</s2:EVSEIsolationStatus>
+                <s2:EVSEStatusCode>EVSE_Ready</s2:EVSEStatusCode>
+                <s2:NotificationMaxDelay>0</s2:NotificationMaxDelay>
+                <s2:EVSENotification>None</s2:EVSENotification>
+            </s1:DC_EVSEStatus>
+            <s1:EVSEProcessing>Finished</s1:EVSEProcessing>
+        </s1:CableCheckRes>
+    </s3:Body>
+</s3:V2G_Message>

+ 38 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ChargeParameterDiscoveryReq.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:ChargeParameterDiscoveryReq>
+            <s1:EVRequestedEnergyTransferType>DC_extended</s1:EVRequestedEnergyTransferType>
+            <s2:DC_EVChargeParameter>
+                <s2:DC_EVStatus>
+                    <s2:EVReady>false</s2:EVReady>
+                    <s2:EVCabinConditioning>true</s2:EVCabinConditioning>
+                    <s2:EVErrorCode>NO_ERROR</s2:EVErrorCode>
+                    <s2:EVRESSSOC>50</s2:EVRESSSOC>
+                </s2:DC_EVStatus>
+                <s2:EVMaximumCurrentLimit>
+                    <s2:Multiplier>-1</s2:Multiplier>
+                    <s2:Unit>A</s2:Unit>
+                    <s2:Value>2000</s2:Value>
+                </s2:EVMaximumCurrentLimit>
+                <s2:EVMaximumVoltageLimit>
+                    <s2:Multiplier>-1</s2:Multiplier>
+                    <s2:Unit>V</s2:Unit>
+                    <s2:Value>5000</s2:Value>
+                </s2:EVMaximumVoltageLimit>
+                <s2:FullSOC>100</s2:FullSOC>
+                <s2:BulkSOC>80</s2:BulkSOC>
+            </s2:DC_EVChargeParameter>
+        </s1:ChargeParameterDiscoveryReq>
+    </s3:Body>
+</s3:V2G_Message>

+ 76 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ChargeParameterDiscoveryRes.xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:ChargeParameterDiscoveryRes>
+            <s1:ResponseCode>OK</s1:ResponseCode>
+            <s1:EVSEProcessing>Finished</s1:EVSEProcessing>
+            <s2:SAScheduleList>
+                <s2:SAScheduleTuple>
+                    <s2:SAScheduleTupleID>0</s2:SAScheduleTupleID>
+                    <s2:PMaxSchedule>
+                        <s2:PMaxScheduleID>0</s2:PMaxScheduleID>
+                        <s2:PMaxScheduleEntry>
+                            <s2:RelativeTimeInterval>
+                                <s2:start>0</s2:start>
+                            </s2:RelativeTimeInterval>
+                            <s2:PMax>60</s2:PMax>
+                        </s2:PMaxScheduleEntry>
+                    </s2:PMaxSchedule>
+                </s2:SAScheduleTuple>
+            </s2:SAScheduleList>
+            <s2:DC_EVSEChargeParameter>
+                <s2:DC_EVSEStatus>
+                    <s2:EVSEIsolationStatus>Invalid</s2:EVSEIsolationStatus>
+                    <s2:EVSEStatusCode>EVSE_NotReady</s2:EVSEStatusCode>
+                    <s2:NotificationMaxDelay>0</s2:NotificationMaxDelay>
+                    <s2:EVSENotification>None</s2:EVSENotification>
+                </s2:DC_EVSEStatus>
+                <s2:EVSEMaximumCurrentLimit>
+                    <s2:Multiplier>-1</s2:Multiplier>
+                    <s2:Unit>A</s2:Unit>
+                    <s2:Value>2400</s2:Value>
+                </s2:EVSEMaximumCurrentLimit>
+                <s2:EVSEMaximumPowerLimit>
+                    <s2:Multiplier>1</s2:Multiplier>
+                    <s2:Unit>W</s2:Unit>
+                    <s2:Value>6000</s2:Value>
+                </s2:EVSEMaximumPowerLimit>
+                <s2:EVSEMaximumVoltageLimit>
+                    <s2:Multiplier>-1</s2:Multiplier>
+                    <s2:Unit>V</s2:Unit>
+                    <s2:Value>7500</s2:Value>
+                </s2:EVSEMaximumVoltageLimit>
+                <s2:EVSEMinimumCurrentLimit>
+                    <s2:Multiplier>-1</s2:Multiplier>
+                    <s2:Unit>A</s2:Unit>
+                    <s2:Value>20</s2:Value>
+                </s2:EVSEMinimumCurrentLimit>
+                <s2:EVSEMinimumVoltageLimit>
+                    <s2:Multiplier>-1</s2:Multiplier>
+                    <s2:Unit>V</s2:Unit>
+                    <s2:Value>1500</s2:Value>
+                </s2:EVSEMinimumVoltageLimit>
+                <s2:EVSECurrentRegulationTolerance>
+                    <s2:Multiplier>-1</s2:Multiplier>
+                    <s2:Unit>A</s2:Unit>
+                    <s2:Value>10</s2:Value>
+                </s2:EVSECurrentRegulationTolerance>
+                <s2:EVSEPeakCurrentRipple>
+                    <s2:Multiplier>-1</s2:Multiplier>
+                    <s2:Unit>A</s2:Unit>
+                    <s2:Value>2</s2:Value>
+                </s2:EVSEPeakCurrentRipple>
+            </s2:DC_EVSEChargeParameter>
+        </s1:ChargeParameterDiscoveryRes>
+    </s3:Body>
+</s3:V2G_Message>

+ 14 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ContractAuthenticationReq.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body><s1:ContractAuthenticationReq/></s3:Body>
+</s3:V2G_Message>

+ 19 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ContractAuthenticationRes.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:ContractAuthenticationRes>
+            <s1:ResponseCode>OK</s1:ResponseCode>
+            <s1:EVSEProcessing>Finished</s1:EVSEProcessing>
+        </s1:ContractAuthenticationRes>
+    </s3:Body>
+</s3:V2G_Message>

+ 44 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/CurrentDemandReq.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:CurrentDemandReq>
+            <s1:DC_EVStatus>
+                <s2:EVReady>false</s2:EVReady>
+                <s2:EVErrorCode>NO_ERROR</s2:EVErrorCode>
+                <s2:EVRESSSOC>50</s2:EVRESSSOC>
+            </s1:DC_EVStatus>
+            <s1:EVTargetCurrent>
+                <s2:Multiplier>-1</s2:Multiplier>
+                <s2:Unit>A</s2:Unit>
+                <s2:Value>1100</s2:Value>
+            </s1:EVTargetCurrent>
+            <s1:BulkChargingComplete>false</s1:BulkChargingComplete>
+            <s1:ChargingComplete>false</s1:ChargingComplete>
+            <s1:RemainingTimeToFullSoC>
+                <s2:Multiplier>0</s2:Multiplier>
+                <s2:Unit>s</s2:Unit>
+                <s2:Value>0</s2:Value>
+            </s1:RemainingTimeToFullSoC>
+            <s1:RemainingTimeToBulkSoC>
+                <s2:Multiplier>0</s2:Multiplier>
+                <s2:Unit>s</s2:Unit>
+                <s2:Value>0</s2:Value>
+            </s1:RemainingTimeToBulkSoC>
+            <s1:EVTargetVoltage>
+                <s2:Multiplier>-1</s2:Multiplier>
+                <s2:Unit>V</s2:Unit>
+                <s2:Value>3820</s2:Value>
+            </s1:EVTargetVoltage>
+        </s1:CurrentDemandReq>
+    </s3:Body>
+</s3:V2G_Message>

+ 52 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/CurrentDemandRes.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:CurrentDemandRes>
+            <s1:ResponseCode>OK</s1:ResponseCode>
+            <s1:DC_EVSEStatus>
+                <s2:EVSEIsolationStatus>Valid</s2:EVSEIsolationStatus>
+                <s2:EVSEStatusCode>EVSE_Ready</s2:EVSEStatusCode>
+                <s2:NotificationMaxDelay>0</s2:NotificationMaxDelay>
+                <s2:EVSENotification>None</s2:EVSENotification>
+            </s1:DC_EVSEStatus>
+            <s1:EVSEPresentVoltage>
+                <s2:Multiplier>-1</s2:Multiplier>
+                <s2:Unit>V</s2:Unit>
+                <s2:Value>5003</s2:Value>
+            </s1:EVSEPresentVoltage>
+            <s1:EVSEPresentCurrent>
+                <s2:Multiplier>-1</s2:Multiplier>
+                <s2:Unit>A</s2:Unit>
+                <s2:Value>0</s2:Value>
+            </s1:EVSEPresentCurrent>
+            <s1:EVSECurrentLimitAchieved>false</s1:EVSECurrentLimitAchieved>
+            <s1:EVSEVoltageLimitAchieved>false</s1:EVSEVoltageLimitAchieved>
+            <s1:EVSEPowerLimitAchieved>false</s1:EVSEPowerLimitAchieved>
+            <s1:EVSEMaximumVoltageLimit>
+                <s2:Multiplier>-1</s2:Multiplier>
+                <s2:Unit>V</s2:Unit>
+                <s2:Value>7500</s2:Value>
+            </s1:EVSEMaximumVoltageLimit>
+            <s1:EVSEMaximumCurrentLimit>
+                <s2:Multiplier>-1</s2:Multiplier>
+                <s2:Unit>A</s2:Unit>
+                <s2:Value>2400</s2:Value>
+            </s1:EVSEMaximumCurrentLimit>
+            <s1:EVSEMaximumPowerLimit>
+                <s2:Multiplier>1</s2:Multiplier>
+                <s2:Unit>W</s2:Unit>
+                <s2:Value>6000</s2:Value>
+            </s1:EVSEMaximumPowerLimit>
+        </s1:CurrentDemandRes>
+    </s3:Body>
+</s3:V2G_Message>

+ 29 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/PowerDeliveryReq.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:PowerDeliveryReq>
+            <s1:ReadyToChargeState>true</s1:ReadyToChargeState>
+            <s2:DC_EVPowerDeliveryParameter>
+                <s2:DC_EVStatus>
+                    <s2:EVReady>false</s2:EVReady>
+                    <s2:EVCabinConditioning>true</s2:EVCabinConditioning>
+                    <s2:EVRESSConditioning>true</s2:EVRESSConditioning>
+                    <s2:EVErrorCode>NO_ERROR</s2:EVErrorCode>
+                    <s2:EVRESSSOC>50</s2:EVRESSSOC>
+                </s2:DC_EVStatus>
+                <s2:BulkChargingComplete>false</s2:BulkChargingComplete>
+                <s2:ChargingComplete>false</s2:ChargingComplete>
+            </s2:DC_EVPowerDeliveryParameter>
+        </s1:PowerDeliveryReq>
+    </s3:Body>
+</s3:V2G_Message>

+ 24 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/PowerDeliveryRes.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:PowerDeliveryRes>
+            <s1:ResponseCode>OK</s1:ResponseCode>
+            <s2:DC_EVSEStatus>
+                <s2:EVSEIsolationStatus>Valid</s2:EVSEIsolationStatus>
+                <s2:EVSEStatusCode>EVSE_Ready</s2:EVSEStatusCode>
+                <s2:NotificationMaxDelay>0</s2:NotificationMaxDelay>
+                <s2:EVSENotification>None</s2:EVSENotification>
+            </s2:DC_EVSEStatus>
+        </s1:PowerDeliveryRes>
+    </s3:Body>
+</s3:V2G_Message>

+ 32 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/PreChargeReq.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:PreChargeReq>
+            <s1:DC_EVStatus>
+                <s2:EVReady>false</s2:EVReady>
+                <s2:EVErrorCode>NO_ERROR</s2:EVErrorCode>
+                <s2:EVRESSSOC>50</s2:EVRESSSOC>
+            </s1:DC_EVStatus>
+            <s1:EVTargetVoltage>
+                <s2:Multiplier>-1</s2:Multiplier>
+                <s2:Unit>V</s2:Unit>
+                <s2:Value>3820</s2:Value>
+            </s1:EVTargetVoltage>
+            <s1:EVTargetCurrent>
+                <s2:Multiplier>-1</s2:Multiplier>
+                <s2:Unit>A</s2:Unit>
+                <s2:Value>1100</s2:Value>
+            </s1:EVTargetCurrent>
+        </s1:PreChargeReq>
+    </s3:Body>
+</s3:V2G_Message>

+ 29 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/PreChargeRes.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:PreChargeRes>
+            <s1:ResponseCode>OK</s1:ResponseCode>
+            <s1:DC_EVSEStatus>
+                <s2:EVSEIsolationStatus>Valid</s2:EVSEIsolationStatus>
+                <s2:EVSEStatusCode>EVSE_Ready</s2:EVSEStatusCode>
+                <s2:NotificationMaxDelay>0</s2:NotificationMaxDelay>
+                <s2:EVSENotification>None</s2:EVSENotification>
+            </s1:DC_EVSEStatus>
+            <s1:EVSEPresentVoltage>
+                <s2:Multiplier>-1</s2:Multiplier>
+                <s2:Unit>V</s2:Unit>
+                <s2:Value>3820</s2:Value>
+            </s1:EVSEPresentVoltage>
+        </s1:PreChargeRes>
+    </s3:Body>
+</s3:V2G_Message>

+ 18 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ServiceDiscoveryReq.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:ServiceDiscoveryReq>
+            <s1:ServiceCategory>EVCharging</s1:ServiceCategory>
+        </s1:ServiceDiscoveryReq>
+    </s3:Body>
+</s3:V2G_Message>

+ 29 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ServiceDiscoveryRes.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:ServiceDiscoveryRes>
+            <s1:ResponseCode>OK</s1:ResponseCode>
+            <s1:PaymentOptions>
+                <s2:PaymentOption>ExternalPayment</s2:PaymentOption>
+            </s1:PaymentOptions>
+            <s1:ChargeService>
+                <s2:ServiceTag>
+                    <s2:ServiceID>1</s2:ServiceID>
+                    <s2:ServiceCategory>EVCharging</s2:ServiceCategory>
+                </s2:ServiceTag>
+                <s2:FreeService>true</s2:FreeService>
+                <s2:EnergyTransferType>DC_extended</s2:EnergyTransferType>
+            </s1:ChargeService>
+        </s1:ServiceDiscoveryRes>
+    </s3:Body>
+</s3:V2G_Message>

+ 23 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ServicePaymentSelectionReq.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:ServicePaymentSelectionReq>
+            <s1:SelectedPaymentOption>ExternalPayment</s1:SelectedPaymentOption>
+            <s1:SelectedServiceList>
+                <s2:SelectedService>
+                    <s2:ServiceID>1</s2:ServiceID>
+                </s2:SelectedService>
+            </s1:SelectedServiceList>
+        </s1:ServicePaymentSelectionReq>
+    </s3:Body>
+</s3:V2G_Message>

+ 18 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/ServicePaymentSelectionRes.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s3:V2G_Message
+    xmlns:s3="urn:din:70121:2012:MsgDef"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:s0="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:s1="urn:din:70121:2012:MsgBody"
+    xmlns:s2="urn:din:70121:2012:MsgDataTypes"
+    xmlns:s4="urn:din:70121:2012:MsgHeader">
+    <s3:Header>
+        <s4:SessionID>070000009F260557</s4:SessionID>
+    </s3:Header>
+    <s3:Body>
+        <s1:ServicePaymentSelectionRes>
+            <s1:ResponseCode>OK</s1:ResponseCode>
+        </s1:ServicePaymentSelectionRes>
+    </s3:Body>
+</s3:V2G_Message>

+ 18 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/SessionSetupReq.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+    xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:ns5="urn:din:70121:2012:MsgBody"
+    xmlns:ns6="urn:din:70121:2012:MsgDataTypes"
+    xmlns:ns7="urn:din:70121:2012:MsgDef"
+    xmlns:ns8="urn:din:70121:2012:MsgHeader">
+    <ns7:Header>
+        <ns8:SessionID>00</ns8:SessionID>
+    </ns7:Header>
+    <ns7:Body>
+        <ns5:SessionSetupReq>
+            <ns5:EVCCID>47574556</ns5:EVCCID>
+        </ns5:SessionSetupReq>
+    </ns7:Body>
+</ns7:V2G_Message>

+ 20 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/SessionSetupRes.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+    xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+    xmlns:ns5="urn:din:70121:2012:MsgBody"
+    xmlns:ns6="urn:din:70121:2012:MsgDataTypes"
+    xmlns:ns7="urn:din:70121:2012:MsgDef"
+    xmlns:ns8="urn:din:70121:2012:MsgHeader">
+    <ns7:Header>
+        <ns8:SessionID>070000009F260557</ns8:SessionID>
+    </ns7:Header>
+    <ns7:Body>
+        <ns5:SessionSetupRes>
+            <ns5:ResponseCode>OK_NewSessionEstablished</ns5:ResponseCode>
+            <ns5:EVSEID>504849484F4E475F4343535F303031</ns5:EVSEID>
+            <ns5:DateTimeNow>1459955359</ns5:DateTimeNow>
+        </ns5:SessionSetupRes>
+    </ns7:Body>
+</ns7:V2G_Message>

+ 10 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/supportedAppProtocolReq.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s0:supportedAppProtocolReq xmlns:s0="urn:iso:15118:2:2010:AppProtocol" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <AppProtocol>
+        <ProtocolNamespace>urn:din:70121:2012:MsgDef</ProtocolNamespace>
+        <VersionNumberMajor>2</VersionNumberMajor>
+        <VersionNumberMinor>0</VersionNumberMinor>
+        <SchemaID>20</SchemaID>
+        <Priority>1</Priority>
+    </AppProtocol>
+</s0:supportedAppProtocolReq>

+ 5 - 0
EVSE/Projects/CCS/Log/din/2019_SECC(GridwizPeppermint)_EVCC(GridwizSimplemint)_recorded_in_Dekra/xml/supportedAppProtocolRes.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s0:supportedAppProtocolRes xmlns:s0="urn:iso:15118:2:2010:AppProtocol" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <ResponseCode>OK_SuccessfulNegotiation</ResponseCode>
+    <SchemaID>20</SchemaID>
+</s0:supportedAppProtocolRes>

BIN
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/[D0.30.11.1D][20200401-06_16_27.544378]packets.pcap


+ 16 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/AuthorizationReq.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:AuthorizationReq/>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 19 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/AuthorizationRes.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:AuthorizationRes>
+			<ns5:ResponseCode>OK</ns5:ResponseCode>
+			<ns5:EVSEProcessing>Finished</ns5:EVSEProcessing>
+		</ns5:AuthorizationRes>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 22 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/CableCheckReq.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:CableCheckReq>
+			<ns5:DC_EVStatus>
+				<ns6:EVReady>true</ns6:EVReady>
+				<ns6:EVErrorCode>NO_ERROR</ns6:EVErrorCode>
+				<ns6:EVRESSSOC>50</ns6:EVRESSSOC>
+			</ns5:DC_EVStatus>
+		</ns5:CableCheckReq>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 25 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/CableCheckRes.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:CableCheckRes>
+			<ns5:ResponseCode>OK</ns5:ResponseCode>
+			<ns5:DC_EVSEStatus>
+				<ns6:NotificationMaxDelay>0</ns6:NotificationMaxDelay>
+				<ns6:EVSENotification>None</ns6:EVSENotification>
+				<ns6:EVSEIsolationStatus>Valid</ns6:EVSEIsolationStatus>
+				<ns6:EVSEStatusCode>EVSE_Ready</ns6:EVSEStatusCode>
+			</ns5:DC_EVSEStatus>
+			<ns5:EVSEProcessing>Finished</ns5:EVSEProcessing>
+		</ns5:CableCheckRes>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 39 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/ChargeParameterDiscoveryReq.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:ChargeParameterDiscoveryReq>
+			<ns5:MaxEntriesSAScheduleTuple>5</ns5:MaxEntriesSAScheduleTuple>
+			<ns5:RequestedEnergyTransferMode>DC_extended</ns5:RequestedEnergyTransferMode>
+			<ns6:DC_EVChargeParameter>
+				<ns6:DepartureTime>172500</ns6:DepartureTime>
+				<ns6:DC_EVStatus>
+					<ns6:EVReady>true</ns6:EVReady>
+					<ns6:EVErrorCode>NO_ERROR</ns6:EVErrorCode>
+					<ns6:EVRESSSOC>50</ns6:EVRESSSOC>
+				</ns6:DC_EVStatus>
+				<ns6:EVMaximumCurrentLimit>
+					<ns6:Multiplier>-1</ns6:Multiplier>
+					<ns6:Unit>A</ns6:Unit>
+					<ns6:Value>2000</ns6:Value>
+				</ns6:EVMaximumCurrentLimit>
+				<ns6:EVMaximumVoltageLimit>
+					<ns6:Multiplier>-1</ns6:Multiplier>
+					<ns6:Unit>V</ns6:Unit>
+					<ns6:Value>5000</ns6:Value>
+				</ns6:EVMaximumVoltageLimit>
+				<ns6:FullSOC>100</ns6:FullSOC>
+				<ns6:BulkSOC>80</ns6:BulkSOC>
+			</ns6:DC_EVChargeParameter>
+		</ns5:ChargeParameterDiscoveryReq>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 2 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/ChargeParameterDiscoveryRes.xml

@@ -0,0 +1,2 @@
+01fe80010000003a
+80980201c0000027c98155d0a00001fe000017c1870300aa000000001061b00808285c0b81081104e060000018000003000000c0000018000000

+ 33 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/CurrentDemandReq.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:CurrentDemandReq>
+			<ns5:DC_EVStatus>
+				<ns6:EVReady>true</ns6:EVReady>
+				<ns6:EVErrorCode>NO_ERROR</ns6:EVErrorCode>
+				<ns6:EVRESSSOC>50</ns6:EVRESSSOC>
+			</ns5:DC_EVStatus>
+			<ns5:EVTargetCurrent>
+				<ns6:Multiplier>-1</ns6:Multiplier>
+				<ns6:Unit>A</ns6:Unit>
+				<ns6:Value>1100</ns6:Value>
+			</ns5:EVTargetCurrent>
+			<ns5:ChargingComplete>false</ns5:ChargingComplete>
+			<ns5:EVTargetVoltage>
+				<ns6:Multiplier>-1</ns6:Multiplier>
+				<ns6:Unit>V</ns6:Unit>
+				<ns6:Value>3820</ns6:Value>
+			</ns5:EVTargetVoltage>
+		</ns5:CurrentDemandReq>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 54 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/CurrentDemandRes.xml

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:CurrentDemandRes>
+			<ns5:ResponseCode>OK</ns5:ResponseCode>
+			<ns5:DC_EVSEStatus>
+				<ns6:NotificationMaxDelay>0</ns6:NotificationMaxDelay>
+				<ns6:EVSENotification>None</ns6:EVSENotification>
+				<ns6:EVSEIsolationStatus>Valid</ns6:EVSEIsolationStatus>
+				<ns6:EVSEStatusCode>EVSE_Shutdown</ns6:EVSEStatusCode>
+			</ns5:DC_EVSEStatus>
+			<ns5:EVSEPresentVoltage>
+				<ns6:Multiplier>-1</ns6:Multiplier>
+				<ns6:Unit>V</ns6:Unit>
+				<ns6:Value>3820</ns6:Value>
+			</ns5:EVSEPresentVoltage>
+			<ns5:EVSEPresentCurrent>
+				<ns6:Multiplier>-1</ns6:Multiplier>
+				<ns6:Unit>A</ns6:Unit>
+				<ns6:Value>0</ns6:Value>
+			</ns5:EVSEPresentCurrent>
+			<ns5:EVSECurrentLimitAchieved>false</ns5:EVSECurrentLimitAchieved>
+			<ns5:EVSEVoltageLimitAchieved>false</ns5:EVSEVoltageLimitAchieved>
+			<ns5:EVSEPowerLimitAchieved>false</ns5:EVSEPowerLimitAchieved>
+			<ns5:EVSEMaximumVoltageLimit>
+				<ns6:Multiplier>-1</ns6:Multiplier>
+				<ns6:Unit>V</ns6:Unit>
+				<ns6:Value>5000</ns6:Value>
+			</ns5:EVSEMaximumVoltageLimit>
+			<ns5:EVSEMaximumCurrentLimit>
+				<ns6:Multiplier>-1</ns6:Multiplier>
+				<ns6:Unit>A</ns6:Unit>
+				<ns6:Value>600</ns6:Value>
+			</ns5:EVSEMaximumCurrentLimit>
+			<ns5:EVSEMaximumPowerLimit>
+				<ns6:Multiplier>1</ns6:Multiplier>
+				<ns6:Unit>W</ns6:Unit>
+				<ns6:Value>3000</ns6:Value>
+			</ns5:EVSEMaximumPowerLimit>
+			<ns5:EVSEID/>
+			<ns5:SAScheduleTupleID>256</ns5:SAScheduleTupleID>
+		</ns5:CurrentDemandRes>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 23 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PaymentServiceSelectionReq.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:PaymentServiceSelectionReq>
+			<ns5:SelectedPaymentOption>ExternalPayment</ns5:SelectedPaymentOption>
+			<ns5:SelectedServiceList>
+				<ns6:SelectedService>
+					<ns6:ServiceID>1</ns6:ServiceID>
+				</ns6:SelectedService>
+			</ns5:SelectedServiceList>
+		</ns5:PaymentServiceSelectionReq>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 18 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PaymentServiceSelectionRes.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:PaymentServiceSelectionRes>
+			<ns5:ResponseCode>OK</ns5:ResponseCode>
+		</ns5:PaymentServiceSelectionRes>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 28 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PowerDeliveryReq(End).xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:PowerDeliveryReq>
+			<ns5:ChargeProgress>Stop</ns5:ChargeProgress>
+			<ns5:SAScheduleTupleID>1</ns5:SAScheduleTupleID>
+			<ns6:DC_EVPowerDeliveryParameter>
+				<ns6:DC_EVStatus>
+					<ns6:EVReady>false</ns6:EVReady>
+					<ns6:EVErrorCode>NO_ERROR</ns6:EVErrorCode>
+					<ns6:EVRESSSOC>50</ns6:EVRESSSOC>
+				</ns6:DC_EVStatus>
+				<ns6:BulkChargingComplete>false</ns6:BulkChargingComplete>
+				<ns6:ChargingComplete>false</ns6:ChargingComplete>
+			</ns6:DC_EVPowerDeliveryParameter>
+		</ns5:PowerDeliveryReq>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 28 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PowerDeliveryReq(Start).xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:PowerDeliveryReq>
+			<ns5:ChargeProgress>Start</ns5:ChargeProgress>
+			<ns5:SAScheduleTupleID>1</ns5:SAScheduleTupleID>
+			<ns6:DC_EVPowerDeliveryParameter>
+				<ns6:DC_EVStatus>
+					<ns6:EVReady>false</ns6:EVReady>
+					<ns6:EVErrorCode>NO_ERROR</ns6:EVErrorCode>
+					<ns6:EVRESSSOC>50</ns6:EVRESSSOC>
+				</ns6:DC_EVStatus>
+				<ns6:BulkChargingComplete>false</ns6:BulkChargingComplete>
+				<ns6:ChargingComplete>false</ns6:ChargingComplete>
+			</ns6:DC_EVPowerDeliveryParameter>
+		</ns5:PowerDeliveryReq>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 24 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PowerDeliveryRes(End).xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:PowerDeliveryRes>
+			<ns5:ResponseCode>OK</ns5:ResponseCode>
+			<ns6:DC_EVSEStatus>
+				<ns6:NotificationMaxDelay>0</ns6:NotificationMaxDelay>
+				<ns6:EVSENotification>None</ns6:EVSENotification>
+				<ns6:EVSEIsolationStatus>Invalid</ns6:EVSEIsolationStatus>
+				<ns6:EVSEStatusCode>EVSE_Shutdown</ns6:EVSEStatusCode>
+			</ns6:DC_EVSEStatus>
+		</ns5:PowerDeliveryRes>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 24 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PowerDeliveryRes(Start).xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:PowerDeliveryRes>
+			<ns5:ResponseCode>OK</ns5:ResponseCode>
+			<ns6:DC_EVSEStatus>
+				<ns6:NotificationMaxDelay>0</ns6:NotificationMaxDelay>
+				<ns6:EVSENotification>None</ns6:EVSENotification>
+				<ns6:EVSEIsolationStatus>Valid</ns6:EVSEIsolationStatus>
+				<ns6:EVSEStatusCode>EVSE_Ready</ns6:EVSEStatusCode>
+			</ns6:DC_EVSEStatus>
+		</ns5:PowerDeliveryRes>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 32 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PreChargeReq.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:PreChargeReq>
+			<ns5:DC_EVStatus>
+				<ns6:EVReady>true</ns6:EVReady>
+				<ns6:EVErrorCode>NO_ERROR</ns6:EVErrorCode>
+				<ns6:EVRESSSOC>50</ns6:EVRESSSOC>
+			</ns5:DC_EVStatus>
+			<ns5:EVTargetVoltage>
+				<ns6:Multiplier>-1</ns6:Multiplier>
+				<ns6:Unit>V</ns6:Unit>
+				<ns6:Value>3820</ns6:Value>
+			</ns5:EVTargetVoltage>
+			<ns5:EVTargetCurrent>
+				<ns6:Multiplier>-1</ns6:Multiplier>
+				<ns6:Unit>A</ns6:Unit>
+				<ns6:Value>1100</ns6:Value>
+			</ns5:EVTargetCurrent>
+		</ns5:PreChargeReq>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 29 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/PreChargeRes.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:PreChargeRes>
+			<ns5:ResponseCode>OK</ns5:ResponseCode>
+			<ns5:DC_EVSEStatus>
+				<ns6:NotificationMaxDelay>0</ns6:NotificationMaxDelay>
+				<ns6:EVSENotification>None</ns6:EVSENotification>
+				<ns6:EVSEIsolationStatus>Valid</ns6:EVSEIsolationStatus>
+				<ns6:EVSEStatusCode>EVSE_Ready</ns6:EVSEStatusCode>
+			</ns5:DC_EVSEStatus>
+			<ns5:EVSEPresentVoltage>
+				<ns6:Multiplier>-1</ns6:Multiplier>
+				<ns6:Unit>V</ns6:Unit>
+				<ns6:Value>3820</ns6:Value>
+			</ns5:EVSEPresentVoltage>
+		</ns5:PreChargeRes>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 18 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/ServiceDiscoveryReq.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:ServiceDiscoveryReq>
+			<ns5:ServiceCategory>EVCharging</ns5:ServiceCategory>
+		</ns5:ServiceDiscoveryReq>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 30 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/ServiceDiscoveryRes.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:ServiceDiscoveryRes>
+			<ns5:ResponseCode>OK</ns5:ResponseCode>
+			<ns5:PaymentOptionList>
+				<ns6:PaymentOption>ExternalPayment</ns6:PaymentOption>
+			</ns5:PaymentOptionList>
+			<ns5:ChargeService>
+				<ns6:ServiceID>1</ns6:ServiceID>
+				<ns6:ServiceName/>
+				<ns6:ServiceCategory>EVCharging</ns6:ServiceCategory>
+				<ns6:FreeService>true</ns6:FreeService>
+				<ns6:SupportedEnergyTransferMode>
+					<ns6:EnergyTransferMode>DC_extended</ns6:EnergyTransferMode>
+				</ns6:SupportedEnergyTransferMode>
+			</ns5:ChargeService>
+		</ns5:ServiceDiscoveryRes>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 18 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/SessionSetupReq.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID/>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:SessionSetupReq>
+			<ns5:EVCCID>5CCCA0000000</ns5:EVCCID>
+		</ns5:SessionSetupReq>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 20 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/SessionSetupRes.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:SessionSetupRes>
+			<ns5:ResponseCode>OK_NewSessionEstablished</ns5:ResponseCode>
+			<ns5:EVSEID>PHIHONG_CCS_001</ns5:EVSEID>
+			<ns5:EVSETimeStamp>1459955359</ns5:EVSETimeStamp>
+		</ns5:SessionSetupRes>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 18 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/SessionStopReq.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:SessionStopReq>
+			<ns5:ChargingSession>Terminate</ns5:ChargingSession>
+		</ns5:SessionStopReq>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 18 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/SessionStopRes.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns7:V2G_Message
+	xmlns:ns7="urn:iso:15118:2:2013:MsgDef"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema"
+	xmlns:ns4="http://www.w3.org/2000/09/xmldsig#"
+	xmlns:ns5="urn:iso:15118:2:2013:MsgBody"
+	xmlns:ns6="urn:iso:15118:2:2013:MsgDataTypes"
+	xmlns:ns8="urn:iso:15118:2:2013:MsgHeader">
+	<ns7:Header>
+		<ns8:SessionID>070000009F260557</ns8:SessionID>
+	</ns7:Header>
+	<ns7:Body>
+		<ns5:SessionStopRes>
+			<ns5:ResponseCode>OK</ns5:ResponseCode>
+		</ns5:SessionStopRes>
+	</ns7:Body>
+</ns7:V2G_Message>

+ 13 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/supportedAppProtocolReq.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns4:supportedAppProtocolReq
+	xmlns:ns4="urn:iso:15118:2:2010:AppProtocol"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema">
+	<AppProtocol>
+		<ProtocolNamespace>urn:iso:15118:2:2013:MsgDef</ProtocolNamespace>
+		<VersionNumberMajor>2</VersionNumberMajor>
+		<VersionNumberMinor>0</VersionNumberMinor>
+		<SchemaID>10</SchemaID>
+		<Priority>1</Priority>
+	</AppProtocol>
+</ns4:supportedAppProtocolReq>

+ 8 - 0
EVSE/Projects/CCS/Log/iso1/20200401_SECC(PhihongCcsDcBoard-D0.30.11.1D)_EVCC(GridwizSimplemint)/xml/supportedAppProtocolRes.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns4:supportedAppProtocolRes
+	xmlns:ns4="urn:iso:15118:2:2010:AppProtocol"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:ns3="http://www.w3.org/2001/XMLSchema">
+	<ResponseCode>OK_SuccessfulNegotiation</ResponseCode>
+	<SchemaID>10</SchemaID>
+</ns4:supportedAppProtocolRes>

BIN
EVSE/Projects/CCS/doc/CCS module.vsdx


BIN
EVSE/Projects/CCS/doc/CharIN Implementation Guide to DIN_70121 2014.docx


BIN
EVSE/Projects/CCS/doc/CharIN_Test_Cases_for_DIN-70121_Implementation_Guide.docx


BIN
EVSE/Projects/CCS/doc/Define.h.xlsx


BIN
EVSE/Projects/CCS/doc/Design for FSW.xlsx


BIN
EVSE/Projects/CCS/doc/EV Board Communication Protocol - flowchart.pdf


BIN
EVSE/Projects/CCS/doc/EV Board Communication Protocol - flowchart.vsd


BIN
EVSE/Projects/CCS/doc/EV Board Communication Protocol.docx


BIN
EVSE/Projects/CCS/doc/EVSE Model Name Naming Rule.xlsx


BIN
EVSE/Projects/CCS/doc/Firmware Design Specification-CCS module.docx


BIN
EVSE/Projects/CCS/doc/Firmware Image and Update Behavior.docx


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác