فهرست منبع

[Improve][NoodoeAX][All files]
2022-11-14 / EASON YANG
Action:
1. Improve: Synchronize whole project files from AW-CCS to NoodoeAX.

File:
1. NoodoeAX project
Action 1

FIRMWARE VERSION: B0.62.XX.XXXX.NX

8009 2 سال پیش
والد
کامیت
1b6b9b38f3
100فایلهای تغییر یافته به همراه196807 افزوده شده و 530 حذف شده
  1. BIN
      EVSE/Projects/NoodoeAX/Apps/CCS/CsuComm
  2. 3691 0
      EVSE/Projects/NoodoeAX/Apps/CCS/CsuComm.c
  3. 105 0
      EVSE/Projects/NoodoeAX/Apps/CCS/CsuComm.h
  4. 465 0
      EVSE/Projects/NoodoeAX/Apps/CCS/CsuCommAC.h
  5. 1668 0
      EVSE/Projects/NoodoeAX/Apps/CCS/EvComm.c
  6. 109 0
      EVSE/Projects/NoodoeAX/Apps/CCS/EvComm.h
  7. 508 0
      EVSE/Projects/NoodoeAX/Apps/CCS/EventLogging.c
  8. 62 0
      EVSE/Projects/NoodoeAX/Apps/CCS/EventLogging.h
  9. 185 0
      EVSE/Projects/NoodoeAX/Apps/CCS/FWMaker.c
  10. 61 0
      EVSE/Projects/NoodoeAX/Apps/CCS/FWMaker.h
  11. 1390 0
      EVSE/Projects/NoodoeAX/Apps/CCS/FWUpdate.c
  12. 75 0
      EVSE/Projects/NoodoeAX/Apps/CCS/FWUpdate.h
  13. 211 0
      EVSE/Projects/NoodoeAX/Apps/CCS/FactoryConfig.c
  14. 61 0
      EVSE/Projects/NoodoeAX/Apps/CCS/FactoryConfig.h
  15. 149 0
      EVSE/Projects/NoodoeAX/Apps/CCS/Makefile
  16. 341 300
      EVSE/Projects/NoodoeAX/Apps/CCS/NidNmk.c
  17. 94 40
      EVSE/Projects/NoodoeAX/Apps/CCS/NidNmk.h
  18. 1238 0
      EVSE/Projects/NoodoeAX/Apps/CCS/PCBATester.c
  19. 66 0
      EVSE/Projects/NoodoeAX/Apps/CCS/PCBATester.h
  20. BIN
      EVSE/Projects/NoodoeAX/Apps/CCS/SeccComm
  21. 17999 0
      EVSE/Projects/NoodoeAX/Apps/CCS/SeccComm.c
  22. 246 0
      EVSE/Projects/NoodoeAX/Apps/CCS/SeccComm.h
  23. 86 0
      EVSE/Projects/NoodoeAX/Apps/CCS/UpdateRootfs.c
  24. 7 0
      EVSE/Projects/NoodoeAX/Apps/CCS/UpdateRootfs.h
  25. 14 0
      EVSE/Projects/NoodoeAX/Apps/CCS/cacert.pem
  26. 24 0
      EVSE/Projects/NoodoeAX/Apps/CCS/cakey.pem
  27. 2511 0
      EVSE/Projects/NoodoeAX/Apps/CCS/define.h
  28. 46 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/Makefile
  29. 5168 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/api/api.c
  30. 180 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/api/api.h
  31. 64 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypes.c
  32. 134 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypes.h
  33. 896 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypesDecoder.c
  34. 57 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypesDecoder.h
  35. 671 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypesEncoder.c
  36. 58 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypesEncoder.h
  37. 105 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/BitInputStream.c
  38. 67 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/BitInputStream.h
  39. 124 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/BitOutputStream.c
  40. 85 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/BitOutputStream.h
  41. 88 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/ByteStream.c
  42. 75 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/ByteStream.h
  43. 930 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/DecoderChannel.c
  44. 441 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/DecoderChannel.h
  45. 106 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIConfig.h
  46. 66 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIHeaderDecoder.c
  47. 60 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIHeaderDecoder.h
  48. 50 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIHeaderEncoder.c
  49. 61 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIHeaderEncoder.h
  50. 93 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIOptions.h
  51. 591 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXITypes.h
  52. 704 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EncoderChannel.c
  53. 423 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EncoderChannel.h
  54. 120 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/ErrorCodes.h
  55. 117 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/MethodsBag.c
  56. 70 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/MethodsBag.h
  57. 969 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypes.c
  58. 2934 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypes.h
  59. 345 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypesDecoder.c
  60. 65 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypesDecoder.h
  61. 281 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypesEncoder.c
  62. 68 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypesEncoder.h
  63. 992 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypes.c
  64. 2992 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypes.h
  65. 9847 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypesDecoder.c
  66. 65 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypesDecoder.h
  67. 7011 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypesEncoder.c
  68. 68 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypesEncoder.h
  69. 1496 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypes.c
  70. 4189 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypes.h
  71. 63551 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypesDecoder.c
  72. 65 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypesDecoder.h
  73. 44215 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypesEncoder.c
  74. 68 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypesEncoder.h
  75. 55 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/test/main.c
  76. 42 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/test/main.h
  77. 178 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/test/main_databinder.c
  78. 2749 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/test/main_example.c
  79. 92 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/transport/v2gtp.c
  80. 55 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/transport/v2gtp.h
  81. 255 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypes.c
  82. 935 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypes.h
  83. 4331 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypesDecoder.c
  84. 65 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypesDecoder.h
  85. 3100 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypesEncoder.c
  86. 66 0
      EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypesEncoder.h
  87. 1009 0
      EVSE/Projects/NoodoeAX/Apps/CCS/main.c
  88. 62 0
      EVSE/Projects/NoodoeAX/Apps/CCS/main.h
  89. 104 0
      EVSE/Projects/NoodoeAX/Apps/CCS/rcS
  90. 16 0
      EVSE/Projects/NoodoeAX/Apps/CCS/reset_soft.sh
  91. 831 0
      EVSE/Projects/NoodoeAX/Apps/CCS/version.h
  92. BIN
      EVSE/Projects/NoodoeAX/Apps/Images/root/CsuComm
  93. BIN
      EVSE/Projects/NoodoeAX/Apps/Images/root/FWUpdate
  94. BIN
      EVSE/Projects/NoodoeAX/Apps/Images/root/FactoryConfig
  95. BIN
      EVSE/Projects/NoodoeAX/Apps/Images/root/PCBATester
  96. BIN
      EVSE/Projects/NoodoeAX/Apps/Images/root/SeccComm
  97. 14 0
      EVSE/Projects/NoodoeAX/Apps/Images/root/cacert.pem
  98. 24 0
      EVSE/Projects/NoodoeAX/Apps/Images/root/cakey.pem
  99. BIN
      EVSE/Projects/NoodoeAX/Apps/Images/root/main
  100. 587 190
      EVSE/Projects/NoodoeAX/Apps/LCM/Module_LcmControl.c

BIN
EVSE/Projects/NoodoeAX/Apps/CCS/CsuComm


+ 3691 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/CsuComm.c

@@ -0,0 +1,3691 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 CsuComm.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 <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 <unistd.h>
+#include "define.h"
+#include "CsuComm.h"
+#include "SeccComm.h"
+#include "exi_engine/api/api.h"
+#ifdef AWCCS
+#include "../main.h"
+#endif
+
+struct SysConfigAndInfo             *ShmSysConfigAndInfo;
+struct StatusCodeData               *ShmStatusCodeData;
+struct CcsData                      *ShmCcsData;
+struct InternalComm                 *ShmInternalComm;
+//struct InternalCommAC               *ShmInternalCommAC;
+#ifdef AWCCS
+struct Charger							*ShmCharger;
+#endif
+
+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];
+
+/*===========================================================================
+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);
+}
+
+/*===========================================================================
+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 StoreLogMsg2(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
+	#ifdef AWCCS
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][CsuComm][%d][%02d]%s\" >> /Storage/SystemLog/[%04d.%02d]CCS-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);
+    #else
+    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);
+    #endif        
+    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
+
+/*===========================================================================
+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
+    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
+
+        return -1;
+    }
+    return t_diff;
+}
+
+
+/*===========================================================================
+FUNCTION: ShareMemory_Init
+DESCRIPTION
+        Initialize all share memories.
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int ShareMemory_Init()
+{
+    int MeterSMId;
+    
+    #ifdef AWCCS
+    //[1/5] create ShmSysConfigAndInfo
+    if((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmSysConfigAndInfo NG");
+        return 0;
+    }
+    else if((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmSysConfigAndInfo NG");
+        return 0;
+    }
+	 memset(ShmSysConfigAndInfo, 0, sizeof(struct SysConfigAndInfo));
+	 
+    //[2/5] create ShmStatusCodeData
+    if((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  IPC_CREAT |0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmStatusCodeData NG");
+        return 0;
+    }
+    else if((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmStatusCodeData NG");
+        return 0;
+    }
+	memset(ShmStatusCodeData, 0, sizeof(struct StatusCodeData));
+	
+    //[3/5] create ShmCcsData
+    if((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData),  IPC_CREAT |0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmCcsData NG");
+        return 0;
+    }
+    else if((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmCcsData NG");
+        return 0;
+    }
+	memset(ShmCcsData, 0, sizeof(struct CcsData));
+	
+    //[4/5] create ShmInternalComm
+    if((MeterSMId = shmget(ShmInternalCommKey, sizeof(struct InternalComm),  IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmInternalComm NG");
+        return 0;
+    }
+    else if((ShmInternalComm = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmInternalComm NG");
+        return 0;
+    }
+   memset(ShmInternalComm, 0, sizeof(struct InternalComm));
+	#if 0
+    //[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));
+    #endif
+   
+    //creat ShmCharger
+   	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger),  0777)) < 0)
+    {
+   		SAVE_SYS_LOG_MSG_CSUCOMM("shmget ShmCharger NG\n");
+   		return 0;
+	}
+    else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	SAVE_SYS_LOG_MSG_CSUCOMM("shmat ShmCharger NG\n");
+    	return 0;
+   	}
+   	
+   	#else
+   	  //[1/5] create ShmSysConfigAndInfo
+    if((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),   0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmSysConfigAndInfo NG");
+        return 0;
+    }
+    else if((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmSysConfigAndInfo NG");
+        return 0;
+    }
+    //[2/5] create ShmStatusCodeData
+    if((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmStatusCodeData NG");
+        return 0;
+    }
+    else if((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmStatusCodeData NG");
+        return 0;
+    }
+
+    //[3/5] create ShmCcsData
+    if((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData),  0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmCcsData NG");
+        return 0;
+    }
+    else if((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmCcsData NG");
+        return 0;
+    }
+    //[4/5] create ShmInternalComm
+    if((MeterSMId = shmget(ShmInternalCommKey, sizeof(struct InternalComm),   0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmget ShmInternalComm NG");
+        return 0;
+    }
+    else if((ShmInternalComm = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("ShareMemory_Init:shmat ShmInternalComm NG");
+        return 0;
+    }
+    //memset(ShmInternalComm, 0, sizeof(struct InternalComm));
+   	#endif
+    return 1;
+}
+
+/*===========================================================================
+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_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)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("CANBus_Init:Set SO_RCVTIMEO NG");
+    }
+
+    nbytes = 40960;
+
+    if(setsockopt(s0, SOL_SOCKET,  SO_RCVBUF, &nbytes, sizeof(int)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("CANBus_Init:Set SO_RCVBUF NG");
+    }
+
+    nbytes = 40960;
+
+    if(setsockopt(s0, SOL_SOCKET, SO_SNDBUF, &nbytes, sizeof(int)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_CSUCOMM("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: 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 I_now = 0;  //0.1A
+    int V_now = 0;  //0.1V
+    int P_now = 0;  //0.1KW
+
+    int I_max = 0;  //0.1A
+    int V_max = 0;  //0.1V
+    int P_max = 0;  //0.1KW
+
+    //[CAUTION] Re-initializing process is necessary. (to-be implemented)
+    //----------[1/7] Permission --------
+    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;
+    }
+
+    // -------- [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();
+
+            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;
+    }
+
+ // -------- [2/7] I_now --------
+    I_now = ShmInternalComm->PresentChargingCurrent;
+    EVCOMM_SYS_INFO.PresentChargingCurrent = I_now / 10.0; //1A
+    if (ShmInternalComm->PresentChargingCurrent_pre != ShmInternalComm->PresentChargingCurrent)
+    {
+        if ((abs(ShmInternalComm->PresentChargingCurrent_pre - ShmInternalComm->PresentChargingCurrent) > 20)&&
+            (ShmInternalComm->PresentChargingVoltage >= 100))  
+        {
+            //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;
+    }
+
+    // -------- [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);
+
+        ShmInternalComm->PresentChargingPower_pre = ShmInternalComm->PresentChargingPower;
+    }
+
+    // -------- [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);
+
+        ShmInternalComm->AvailableChargingCurrent_pre = ShmInternalComm->AvailableChargingCurrent;
+    }
+
+    // -------- [6/7] V_max --------
+    V_max = ShmInternalComm->MaximumChargingVoltage;
+    EVCOMM_SYS_INFO.MaximumChargingVoltage = V_max / 10.0;   //1V
+    if (ShmInternalComm->MaximumChargingVoltage_pre != ShmInternalComm->MaximumChargingVoltage)
+    {
+        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);
+
+        ShmInternalComm->MaximumChargingVoltage_pre = ShmInternalComm->MaximumChargingVoltage;
+    }
+
+    // -------- [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);
+
+        ShmInternalComm->AvailableChargingPower_pre = ShmInternalComm->AvailableChargingPower;
+    }
+}
+
+
+/*===========================================================================
+FUNCTION: Proc_EVBoardStatusRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_EVBoardStatusRes(int Fd)
+{
+    int nbytes;
+    unsigned char Buffer[8];
+
+    memset(Buffer, 0, sizeof(Buffer));
+
+    Buffer[0] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].ConnectorPlugIn;
+
+    Buffer[1] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].CpState;
+
+    /*
+    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;
+
+    return nbytes;
+}
+
+/*===========================================================================
+FUNCTION: Proc_AddressAssignRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Proc_AddressAssignRes(int Fd)
+{
+
+}
+
+/*===========================================================================
+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;
+    Buffer[1] =ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp&0xFF;
+    Buffer[2] =(ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp>>8)&0xFF;
+    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));
+
+    //[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];//0x00 : CCS1, 0x01 : CCS2
+    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(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];
+    
+    if(( Buffer[1]== 0)&&( Buffer[2]== 2)&&( Buffer[3]== 3)&&( Buffer[4]== 9)&&( Buffer[5]== 7)&&( Buffer[6]== 9))
+    	CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+   else
+   	CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+   	
+    if (CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency == TRUE)
+    {
+        Buffer[0] = EV_EMERGENCY_STOP;  //2
+    }
+    else
+    {
+        Buffer[0] = EV_NORMAL_STOP;     //1
+    }
+    
+    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;
+		
+		Reboot_Process();
+		
+        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();
+	usleep(1000);
+        //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:
+=============================================================================*/
+#ifdef AWCCS
+int CsuCommAC_SHM_Rx_Update()
+{
+	int gun_index=0;
+    //[CAUTION] Re-initializing process is necessary. (to-be implemented)
+   ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus=Check_V2G_Flow_Status();
+   ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress = ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.ChargeProgress;
+   ShmCharger->gun_info[gun_index].acCcsInfo.CpSetPWMDuty=ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].CpDuty;
+   memcpy(ShmCharger->gun_info[gun_index].acCcsInfo.EVCCID, EVCOMM_SYS_INFO.EVCCID, sizeof(ShmCharger->gun_info[gun_index].acCcsInfo.EVCCID));
+    //----------[1] Permission --------
+   // ShmInternalComm->ChargingPermission_new = (unsigned char) CSUCOMMAC_SHM.ChargingPermission;
+    ShmInternalComm->ChargingPermission_new=ShmCharger->gun_info[gun_index].acCcsInfo.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 1
+    // -------- [2] CpPresentPWMDuty --------
+    ShmInternalComm->AC_CpPresentPWMDuty = ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current;       //unit: 1 sec.
+    if (ShmInternalComm->AC_CpPresentPWMDuty_pre != ShmInternalComm->AC_CpPresentPWMDuty)
+    {
+        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;
+    }
+	#endif
+	
+    // -------- [3] CpPresentState --------
+    //ShmInternalComm->AC_CpPresentState = CSUCOMMAC_SHM.CpPresentState;       //unit: 1 sec.
+    ShmInternalComm->AC_CpPresentState=ShmCharger->gun_info[gun_index].acCcsInfo.CpPresentState;
+    if (ShmInternalComm->AC_CpPresentState_pre != ShmInternalComm->AC_CpPresentState)
+    {
+        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 0
+    // -------- [4] ChargingRemainTime --------
+    ShmInternalComm->AC_ChargingRemainTime = CSUCOMMAC_SHM.ChargingRemainTime;       //unit: 1 sec.
+    if (ShmInternalComm->AC_ChargingRemainTime_pre != ShmInternalComm->AC_ChargingRemainTime)
+    {
+        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;
+    }
+	#endif
+    // -------- [5] CSUAlarmStatusCode --------
+    //ShmInternalComm->AC_CSUAlarmStatusCode = CSUCOMMAC_SHM.CSUAlarmStatusCode;
+   ShmInternalComm->AC_CSUAlarmStatusCode =  ShmCharger->gun_info[gun_index].acCcsInfo.CSUAlarmStatusCode;
+    if (ShmInternalComm->AC_CSUAlarmStatusCode_pre != ShmInternalComm->AC_CSUAlarmStatusCode)
+    {
+        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
+   ShmInternalComm->AC_MeterReadingValue=((float)ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10.0);
+  /*  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
+    ShmInternalComm->AC_CpPositiveVoltage=ShmCharger->gun_info[gun_index].acCcsInfo.CpPositiveVoltage;
+       //the modification message will be logged via Check_CP_State_Update_fork1() in SeccComm task.
+    if (abs(ShmInternalComm->AC_CpPositiveVoltage_pre - ShmInternalComm->AC_CpPositiveVoltage)>=0.5)
+    {
+        sprintf(buf_log_csucomm, "CP_P_V: %.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;
+    }
+
+
+    // -------- [8] CpNegativeVoltage --------
+    //ShmInternalComm->AC_CpNegativeVoltage = CSUCOMMAC_SHM.CpNegativeVoltage;       //unit: 1V
+    ShmInternalComm->AC_CpNegativeVoltage = ShmCharger->gun_info[gun_index].acCcsInfo.CpNegativeVoltage;   //unit: 1V
+    if (abs(ShmInternalComm->AC_CpNegativeVoltage_pre - ShmInternalComm->AC_CpNegativeVoltage>=0.5))
+    {
+        sprintf(buf_log_csucomm, "CP_N_V: - %.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
+    EVCOMM_SYS_INFO.PresentChargingCurrent = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0];   //unit: 1A (using phase L)
+    ShmInternalComm->PresentChargingCurrent = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0] * 10;
+    ShmInternalComm->AC_EVSEPresentCurrent[0] = (float)ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[0]; //L1
+    ShmInternalComm->AC_EVSEPresentCurrent[1] = (float)ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[0]; //L2
+    ShmInternalComm->AC_EVSEPresentCurrent[2] = (float)ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[0]; //L3
+    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
+           )
+        {
+            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);
+        }
+
+        ShmInternalComm->PresentChargingCurrent_pre = ShmInternalComm->PresentChargingCurrent;
+        memcpy(ShmInternalComm->AC_EVSEPresentCurrent_pre, ShmInternalComm->AC_EVSEPresentCurrent, sizeof(ShmInternalComm->AC_EVSEPresentCurrent));
+    }
+
+    //-------- [10] OutputRelayStatus --------
+    //ShmInternalComm->AC_OutputRelayStatus = CSUCOMMAC_SHM.OutputRelayStatus;    //bool
+    ShmInternalComm->AC_OutputRelayStatus= ShmCharger->gun_info[gun_index].acCcsInfo.OutputRelayStatus;
+    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
+    EVCOMM_SYS_INFO.AC_EVSENominalVoltage =  ShmCharger->gun_info[gun_index].acCcsInfo.GridVoltage[0] ;  
+    ShmInternalComm->AC_GridVoltage[0]=ShmCharger->gun_info[gun_index].acCcsInfo.GridVoltage[0];
+	ShmInternalComm->AC_GridVoltage[1]=ShmCharger->gun_info[gun_index].acCcsInfo.GridVoltage[1] ;
+	ShmInternalComm->AC_GridVoltage[2]=ShmCharger->gun_info[gun_index].acCcsInfo.GridVoltage[2] ;
+    if ((abs(ShmInternalComm->AC_GridVoltage_pre[0] - ShmInternalComm->AC_GridVoltage[0])>=10) ||
+        (abs(ShmInternalComm->AC_GridVoltage_pre[0] - ShmInternalComm->AC_GridVoltage[0])>=10) ||
+        (abs(ShmInternalComm->AC_GridVoltage_pre[0] - ShmInternalComm->AC_GridVoltage[0])>=10) 
+       )
+    {
+        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, sizeof(ShmInternalComm->AC_GridVoltage));
+    }
+
+    // -------- [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
+        {
+
+            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;
+    }
+
+
+    // -------- [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);
+
+        ShmInternalComm->PresentChargingPower_pre = ShmInternalComm->PresentChargingPower;
+    }
+
+    // -------- [14] I_max (EVSE)--------
+    //EVCOMM_SYS_INFO.AvailableChargingCurrent = CSUCOMMAC_SHM.EVSEMaxCurrent; //unit: 1A
+    //ShmInternalComm->AvailableChargingCurrent = (int)(CSUCOMMAC_SHM.EVSEMaxCurrent *10); //unit: 0.1A
+    EVCOMM_SYS_INFO.AvailableChargingCurrent = ShmCharger->gun_info[gun_index].targetCurrent;; //unit: 1A
+    ShmInternalComm->AvailableChargingCurrent = (int)(ShmCharger->gun_info[gun_index].targetCurrent*10); //unit: 0.1A
+    ShmInternalComm->AC_EVSEMaxCurrent=ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+    if (ShmInternalComm->AvailableChargingCurrent_pre != ShmInternalComm->AvailableChargingCurrent)
+    {
+        sprintf(buf_log_csucomm, "I_max(EVSE): %d >> %d (0.1A)",
+                ShmInternalComm->AvailableChargingCurrent_pre,
+                ShmInternalComm->AvailableChargingCurrent);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->AvailableChargingCurrent_pre = ShmInternalComm->AvailableChargingCurrent;
+    }
+	#if 0
+    // -------- [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);
+
+        ShmInternalComm->AC_EVSEMinCurrent_pre = ShmInternalComm->AC_EVSEMinCurrent;
+    }
+	
+    // -------- [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)
+    EVCOMM_SYS_INFO.MaximumChargingVoltage =ShmCharger->gun_info[gun_index].acCcsInfo.GridVoltage[0]; //unit: 1V (using phase 1)
+    ShmInternalComm->MaximumChargingVoltage = (int)(ShmCharger->gun_info[gun_index].acCcsInfo.GridVoltage[0]* 10); //unit: 0.1V (using phase 1)
+    if (ShmInternalComm->MaximumChargingVoltage_pre != ShmInternalComm->MaximumChargingVoltage)
+    {
+        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);
+
+        ShmInternalComm->MaximumChargingVoltage_pre = ShmInternalComm->MaximumChargingVoltage;
+    }
+	
+    // -------- [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)
+    {
+        sprintf(buf_log_csucomm, "P_max(EVSE): %d >> %d (0.1KW)",
+                ShmInternalComm->AvailableChargingPower_pre,
+                ShmInternalComm->AvailableChargingPower);
+        SAVE_SYS_LOG_MSG_CSUCOMM(buf_log_csucomm);
+
+        ShmInternalComm->AvailableChargingPower_pre = ShmInternalComm->AvailableChargingPower;
+    }
+	
+    // -------- [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, 40);
+    }
+	#endif
+	
+    // -------- [19] MeterID[32] --------
+    if(strlen(ShmInternalComm->AC_MeterID)<=1)
+    {	
+	  //  memcpy(ShmInternalComm->AC_MeterID, CSUCOMMAC_SHM.MeterID, 32);
+	    memset(ShmInternalComm->AC_MeterID, 0, sizeof(ShmInternalComm->AC_MeterID));
+	    sprintf(ShmInternalComm->AC_MeterID,"%s_%s",ShmCharger->evseId.model_name,ShmCharger->evseId.serial_number);
+	   /* 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);
+	    }*/
+	}
+
+    // -------- [20] EVSEModelName[32] --------
+    if(strlen(ShmInternalComm->AC_EVSEModelName)<=1)
+    {	
+	  //  memcpy(ShmInternalComm->AC_EVSEModelName, CSUCOMMAC_SHM.EVSEModelName, 32);
+	    memset(ShmInternalComm->AC_EVSEModelName, 0, sizeof(ShmInternalComm->AC_EVSEModelName));
+	    strcpy(ShmInternalComm->AC_EVSEModelName,ShmCharger->evseId.model_name);
+	  /*  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);
+	    }*/
+	}
+	#if 0
+    // -------- [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);
+
+        ShmInternalComm->AC_BatteryChargeType_pre = ShmInternalComm->AC_BatteryChargeType;
+    }
+	#endif
+    // -------- [21] RcdStatus --------
+    //ShmInternalComm->AC_RcdStatus = CSUCOMMAC_SHM.RcdStatus;
+    ShmInternalComm->AC_RcdStatus=ShmCharger->gun_info[gun_index].otherAlarmCode.isACLeakage;
+    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);
+
+        ShmInternalComm->AC_RcdStatus_pre = ShmInternalComm->AC_RcdStatus;
+    }
+
+	#if 0
+    // -------- [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);
+
+        ShmInternalComm->AC_EVSENotification_pre = ShmInternalComm->AC_EVSENotification;
+    }
+	#endif
+}
+#endif
+
+/*===========================================================================
+FUNCTION: CsuCommAC_Error_Monitor
+DESCRIPTION:
+    1. fork1
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+/*void CsuCommAC_Error_Monitor()
+{
+    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)
+    {
+        CsuCommAC_HeartBeat_Handler();  //timeout: 60s
+    }   
+}*/
+
+
+/*===========================================================================
+FUNCTION: CsuCommAC_Proc
+DESCRIPTION:
+PRE-CONDITION:
+    1. Share Memory should be initialized in advance.
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#ifdef AWCCS
+int CsuCommAC_Proc()
+{
+    //CsuCommAC_Init();
+    //CsuCommAC_Error_Monitor();  //fork1
+
+    while(1)
+    {
+        CsuCommAC_SHM_Rx_Update();
+        usleep(100000);
+    }
+}
+#endif
+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;
+    }
+
+    #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;
+
+    //Sniffering CAN packets
+    Sniffer_Candump(ENABLE);
+
+    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(&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
+
+        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 value_random_return = 0; //4 Bytes
+          
+            memset(&frame, 0, sizeof(struct can_frame));
+            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(&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(value_random_return == value_random)
+            {
+                //Getting a legal Slave Address, successfully.
+                ShmInternalComm->SlaveAddress = frame.can_id & 0x000000FF;
+                CSUCOMMDC_TASK_FLAG.matched = TRUE;
+                #if (SAVE_SYS_LOG_MSG_CSUCOMM_SWITCH == ENABLE)
+                {
+                    SAVE_SYS_LOG_MSG_CSUCOMM("Matched");
+                }
+                #endif
+                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.
+
+    // ======== [STEP 5/5] CAN TX  ========
+    //main loop
+    ftime(&ShmInternalComm->Start_Time);
+
+    while(1)
+    {
+/*
+        //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);
+        }
+
+        //#define CAN_CMD_DOWNLOAD_REQUEST     0x00000E00
+        if (CSUCOMMDC_TASK_FLAG.Got_DownloadImageReq == TRUE)
+        {
+            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);
+
+        }
+
+        //CAN_CMD_DOWNLOAD_FINISH              0x00001100
+        if (CSUCOMMDC_TASK_FLAG.Got_DownloadFinishReq == TRUE)
+        {
+            Proc_DownloadFinishRes(FD_CAN_Socket);
+
+        }
+
+        // CAN_CMD_ISOLATION_STATUS            0x00001200
+        if (CSUCOMMDC_TASK_FLAG.Got_IsolationStatus == TRUE)
+        {
+            Proc_IsolationStatusAnnounceRes(FD_CAN_Socket);
+
+        }
+
+        // CAN_CMD_CCS_CONNECTOR_INFO          0x00001300
+        if (CSUCOMMDC_TASK_FLAG.Got_CCSConnectorReq == TRUE)
+        {
+            Proc_CCSConnectorTypeSetRes(FD_CAN_Socket);   //to-do
+
+        }
+
+        // CAN_CMD_RTC_INFO                    0x00001400
+        if (CSUCOMMDC_TASK_FLAG.Got_RTC == TRUE)
+        {
+            Proc_RTCSetRes(FD_CAN_Socket);   //to-do
+
+        }
+
+        //CAN_CMD_EVSE_PRECHARGE_INFO       //0x00001500
+        if (CSUCOMMDC_TASK_FLAG.Got_EVSE_Precharge_Info == TRUE)
+        {
+            Proc_EVSEPrechargeInfoUpdateRes(FD_CAN_Socket);
+        }
+
+        //CAN_CMD_EVCCID_REQUEST            //0x00001600
+        if (CSUCOMMDC_TASK_FLAG.Got_EVCCID_Req == TRUE)
+        {
+            Proc_EVCCIDRes(FD_CAN_Socket);
+        }
+	usleep(1000);
+    }
+
+EndProcess:
+    if(PID_CAN_Rx_Task > 0)
+    {
+        char Buf[32];
+        memset(Buf, 0, 32);
+        sprintf(Buf, "kill %d", PID_CAN_Rx_Task);
+        system(Buf);
+    }
+
+    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");
+    system("/sbin/ip link set can0 down");
+    system("killall CsuComm");
+}

+ 105 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/CsuComm.h

@@ -0,0 +1,105 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 CsuComm.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_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     StoreLogMsg2
+#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/NoodoeAX/Apps/CCS/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;
+};

+ 1668 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/EvComm.c

@@ -0,0 +1,1668 @@
+/*===========================================================================
+                    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 "define.h"
+#include "EvComm.h"
+#include "NidNmk.h"
+#include "EvComm.h"
+
+#define Debug
+
+struct SysConfigAndInfo         *ShmSysConfigAndInfo;
+struct StatusCodeData           *ShmStatusCodeData;
+struct CcsData              	*ShmCcsData;
+struct InternalComm         	*ShmInternalComm;
+
+pid_t PilotDetectionPid;
+enum MsgFlowStatus V2gFlowStatus;
+int RawSock,UdpSock,TcpSock;
+unsigned char                   *RecvBuffer,*SendBuffer;
+int RecvBufferSize=64*1024;
+int SendBufferSize=64*1024;
+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,AttenProfileNum;
+unsigned char NewNmkKey[16],Nid[7];
+
+
+#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
+}
+#endif
+
+int DiffTimeb(struct timeb ST, struct timeb ET)
+{
+    //return milli-second
+    unsigned int StartTime,StopTime;
+
+    StartTime=(unsigned int)ST.time;
+    StopTime=(unsigned int)ET.time;
+    return (StopTime-StartTime)*1000+ET.millitm-ST.millitm;
+}
+
+int CreatShareMemory()
+{
+    int MeterSMId;
+
+    //creat ShmSysConfigAndInfo
+    if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), IPC_CREAT | 0777)) < 0)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[main]CreatShareMemory:shmget ShmSysConfigAndInfo NG");
+        #endif
+        return 0;
+    }
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[main]CreatShareMemory:shmat ShmSysConfigAndInfo NG");
+        #endif
+        return 0;
+    }
+    memset(ShmSysConfigAndInfo,0,sizeof(struct SysConfigAndInfo));
+    //creat ShmStatusCodeData
+    if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), IPC_CREAT | 0777)) < 0)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[main]CreatShareMemory:shmget ShmStatusCodeData NG");
+        #endif
+        return 0;
+    }
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[main]CreatShareMemory:shmat ShmStatusCodeData NG");
+        #endif
+        return 0;
+    }
+    memset(ShmStatusCodeData,0,sizeof(struct StatusCodeData));
+    //creat ShmCcsData
+    if ((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData), IPC_CREAT | 0777)) < 0)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[main]CreatShareMemory:shmget ShmCcsData NG");
+        #endif
+        return 0;
+    }
+    else if ((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[main]CreatShareMemory:shmat ShmCcsData NG");
+        #endif
+        return 0;
+    }
+    memset(ShmCcsData,0,sizeof(struct CcsData));
+    return 1;
+}
+
+int InitShareMemory()
+{
+    int MeterSMId;
+
+    //creat ShmSysConfigAndInfo
+    if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[EvComm]InitShareMemory:shmget ShmSysConfigAndInfo NG");
+        #endif
+        return 0;
+    }
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[EvComm]InitShareMemory:shmat ShmSysConfigAndInfo NG");
+        #endif
+        return 0;
+    }
+    //creat ShmStatusCodeData
+    if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[EvComm]InitShareMemory:shmget ShmStatusCodeData NG");
+        #endif
+        return 0;
+    }
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+            #ifdef SystemLogMessage
+        StoreLogMsg("[EvComm]InitShareMemory:shmat ShmStatusCodeData NG");
+        #endif
+        return 0;
+    }
+
+    //creat ShmCcsData
+    if ((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData),  0777)) < 0)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[EvComm]InitShareMemory:shmget ShmCcsData NG");
+        #endif
+        return 0;
+    }
+    else if ((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+            #ifdef SystemLogMessage
+        StoreLogMsg("[EvComm]InitShareMemory:shmat ShmCcsData NG");
+        #endif
+        return 0;
+    }
+
+    //creat ShmInternalComm
+    if ((MeterSMId = shmget(ShmInternalCommKey, sizeof(struct InternalComm),   0777)) < 0)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[EvComm]InitShareMemory:shmget ShmInternalComm NG");
+        #endif
+        return 0;
+    }
+    else if ((ShmInternalComm = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[EvComm]InitShareMemory:shmat ShmInternalComm NG");
+        #endif
+        return 0;
+    }
+
+    return 1;
+}
+
+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);
+    system(Buffer);
+    fd = open("/mnt/GetEthInfo", O_RDONLY);
+    if(fd<0)
+    {
+        system("rm -f /mnt/GetEthInfo");
+        #ifdef SystemLogMessage
+        StoreLogMsg("[EvComm]GetEthMac: MAC Address open error");
+        #endif
+        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]);
+    return 1;
+}
+
+float ReadAdcVolt(unsigned char AdcChannel)
+{
+    //AIN0=CCS GUN Temp 1
+    //AIN1=CCS GUN Temp 2
+    //AIN2=CCS_Proximity/2
+    //AIN3=pilot voltage
+    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;
+}
+
+void Qca7kPowerReset()
+{
+    system("echo 1 > /sys/class/gpio/gpio88/value");
+    usleep(500000);
+    system("echo 0 > /sys/class/gpio/gpio88/value");
+}
+
+void SwitchCpStateE(unsigned char OnOff)
+{
+    //OnOff=1 => switch State to E
+    //OnOff=0 => return noraml
+    if(OnOff==0)
+        system("echo 0 > /sys/class/gpio/gpio86/value");
+    else
+        system("echo 1 > /sys/class/gpio/gpio86/value");
+}
+
+int OutputCpPwmDuty(unsigned char Duty)
+{
+    unsigned char str[128];
+    int DutyInNanoSec;
+
+    if((Duty<0)||(Duty>100))
+        return -1;
+
+    memset(str,0,sizeof(str));
+    DutyInNanoSec=10000*Duty;
+    sprintf(str,"echo %d > /sys/class/pwm/pwmchip0/pwm0/duty_cycle",DutyInNanoSec);//nanoseconds
+    system(str);
+    ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotDuty=Duty;
+    return 0;
+}
+
+int ConnectorPlugIn()
+{
+    //return 0 => unplug
+    //return 1 => plug-in
+    float TmpProximity;
+    unsigned char Rtn=0;
+
+    if(((FirmwareVersion&0x0000FF00)>>8)==0x01)
+    {
+        //UL version: judge with CP and proximity
+        TmpProximity=ReadAdcVolt(2);
+        if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState>=2)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState<=5)&&
+           (TmpProximity>=0.4)&&(TmpProximity<=0.9))
+        {
+            Rtn=1;
+        }
+    }
+    else
+    {
+        //CE version: judge with CP only
+        if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState>=2)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState<=5))
+            Rtn=1;
+    }
+    ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].ConnectorPlugIn=Rtn;
+    return Rtn;
+}
+
+void PilotDetection()
+{
+    pid_t tmp=0;
+    struct timeb StartTime,EndTime;
+    unsigned char CpState[3],count;
+    float TmpVolt;
+
+    if(PilotDetectionPid==0)
+    {
+        tmp=fork();
+        if(tmp>0)
+        {
+            PilotDetectionPid=tmp;
+            {
+                unsigned char buf[64];
+                memset(buf,0,sizeof(buf));
+                sprintf(buf,"renice -20 -p %d",tmp);
+                system(buf);
+            }
+            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
+        //ftime(&StartTime);
+        TmpVolt=0;
+        for(count=0; count<3; count++)
+        {
+            TmpVolt+=(0.954-ReadAdcVolt(3))/0.06;
+        }
+        TmpVolt/=3;
+        ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotVoltage=TmpVolt;
+        if(TmpVolt>=13.5)
+        {
+            //Pilot Error
+            if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==1)&&(TmpVolt<13.75))
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=1;
+            else
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=8;
+        }
+        else if((TmpVolt>=10.5)&&(TmpVolt<13.5))
+        {
+            //State A
+            if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState>=2)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState<=3)&&(TmpVolt<10.75))
+            {
+                if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotDuty>=5)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotDuty<100))
+                    ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=3;
+                else
+                    ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=2;
+            }
+            else if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==8)&&(TmpVolt>=13.25))
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=8;
+            else
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=1;
+        }
+        else if((TmpVolt>=7.5)&&(TmpVolt<10.5))
+        {
+            //State B
+            if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==4)&&(TmpVolt<7.75))
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=4;
+            else if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==1)&&(TmpVolt>=10.25))
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=1;
+            else
+            {
+                if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotDuty>=5)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotDuty<100))
+                    ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=3;
+                else
+                    ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=2;
+            }
+        }
+        else if((TmpVolt>=4.5)&&(TmpVolt<7.5))
+        {
+            //State C
+            if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==5)&&(TmpVolt<4.75))
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=5;
+            else if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState>=2)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState<=3)&&(TmpVolt>=7.25))
+            {
+                if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotDuty>=5)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotDuty<100))
+                    ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=3;
+                else
+                    ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=2;
+            }
+            else
+            {
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=4;
+            }
+        }
+        else if((TmpVolt>=1.5)&&(TmpVolt<4.5))
+        {
+            //State D
+            if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==6)&&(TmpVolt<1.75))
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=6;
+            else if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==4)&&(TmpVolt>=4.25))
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=4;
+            else
+            {
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=5;
+            }
+        }
+        else if((TmpVolt>= -1.5)&&(TmpVolt<1.5))
+        {
+            //State E
+            if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==8)&&(TmpVolt< -1.25))
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=8;
+            else if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==5)&&(TmpVolt>=1.25))
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=5;
+            else
+            {
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=6;
+            }
+        }
+        else if((TmpVolt>= -13.5)&&(TmpVolt< -10.5))
+        {
+            //State F
+            if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==8)&&(TmpVolt>= -10.75))
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=8;
+            else
+            {
+                ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState=7;
+            }
+        }
+        //ftime(&EndTime);
+        //printf("duration:%d\n", DiffTimeb(StartTime, EndTime));
+    }//while
+}
+
+int MmeProcess(unsigned char *Buffer, int DataLength)
+{
+    //struct ethhdr	*EthPacket;
+    struct MmeHeader    *MmePacket;
+    int Rtn;
+    static unsigned char counter;
+
+    MmePacket = (struct MmeHeader *)Buffer;
+
+    #ifdef Debug
+    printf("\n\n***********************************\n");
+    printf("***** Received MME Packet *****\n");
+    printf("***********************************\n");
+    printf("DataLength=%d\n",DataLength);
+    printf("ODA: %02x:%02x:%02x:%02x:%02x:%02x\n",
+           MmePacket->ODA[0],MmePacket->ODA[1],MmePacket->ODA[2],MmePacket->ODA[3],MmePacket->ODA[4],MmePacket->ODA[5]);
+    printf("OSA: %02x:%02x:%02x:%02x:%02x:%02x\n",
+           MmePacket->OSA[0],MmePacket->OSA[1],MmePacket->OSA[2],MmePacket->OSA[3],MmePacket->OSA[4],MmePacket->OSA[5]);
+    printf("MTYPE: 0x%x\n", htons(MmePacket->MTYPE));
+    printf("MMV: 0x%x\n", MmePacket->MMV);
+    printf("MMTYPE: 0x%x\n", MmePacket->MMTYPE);
+    printf("FMI 0x%x, 0x%x\n", MmePacket->FMI[0],MmePacket->FMI[1]);
+    #endif
+
+    //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:
+		{
+	        #ifdef Debug
+	        printf("--- MMTYPE_CM_SET_KEY_CNF ---\n");
+	        printf("Result: 0x%x\n", MmePacket->MMENTRY[0]);
+	        #endif
+	        V2gFlowStatus=CM_SET_KEY_CNF;
+	        break;
+		}
+
+	    case MMTYPE_CM_SLAC_PARM_REQ:
+		{
+	        #ifdef Debug
+	        printf("--- MMTYPE_CM_SLAC_PARM_REQ ---\n");
+	        printf("APPLICATION_TYPE: 0x%x\n", MmePacket->MMENTRY[0]);
+	        printf("SECURITY_TYPE: 0x%x\n", MmePacket->MMENTRY[1]);
+	        printf("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]);
+	        printf("CipherSuiteSetSize: 0x%x\n", MmePacket->MMENTRY[10]);
+	        printf("CipherSuite [1]: 0x%x,0x%x\n", MmePacket->MMENTRY[11], MmePacket->MMENTRY[12]);
+	        #endif
+	        V2gFlowStatus=CM_SLAC_PARM_REQ;
+	        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);       //Fixed value indicating that M-Sounds to be sent as Ethernet broadcast
+	        SendMmePacketSize+=6;
+	        SendMmePacket.MMENTRY[SendMmePacketSize++]=C_EV_match_MNBC;
+	        SendMmePacket.MMENTRY[SendMmePacketSize++]=TT_EVSE_match_MNBC;
+	        SendMmePacket.MMENTRY[SendMmePacketSize++]=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);
+	        SendMmePacketSize+=6;
+	        SendMmePacket.MMENTRY[SendMmePacketSize++]=0;           //Fixed value indicating ��PEVEVSEMatching��
+	        SendMmePacket.MMENTRY[SendMmePacketSize++]=0;           //Fixed value indicating ��No Security��
+	        memcpy(SendMmePacket.MMENTRY+SendMmePacketSize,SlacRunId,sizeof(SlacRunId));
+	        SendMmePacketSize+=sizeof(SlacRunId);
+	        SendMmePacketSize+=19;      //the size before MMENTRY
+	        #ifdef Debug
+	        printf("\n\n***** Response MME Packet *****\n");
+	        printf("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]);
+	        printf("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]);
+	        printf("MTYPE: 0x%x\n", htons(SendMmePacket.MTYPE));
+	        printf("MMV: 0x%x\n", SendMmePacket.MMV);
+	        printf("MMTYPE: 0x%x\n", SendMmePacket.MMTYPE);
+	        printf("FMI 0x%x, 0x%x\n", SendMmePacket.FMI[0],SendMmePacket.FMI[1]);
+	        printf("--- CM_SLAC_PARM_CNF ---\n");
+	        printf("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]);
+	        printf("NUM_SOUNDS: 0x%x\n", SendMmePacket.MMENTRY[6]);
+	        printf("Time_Out: 0x%x\n", SendMmePacket.MMENTRY[7]);
+	        printf("RESP_TYPE: 0x%x\n", SendMmePacket.MMENTRY[8]);
+	        printf("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]);
+	        printf("APPLICATION_TYPE: 0x%x\n", SendMmePacket.MMENTRY[15]);
+	        printf("SECURITY_TYPE: 0x%x\n", SendMmePacket.MMENTRY[16]);
+	        printf("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
+	        V2gFlowStatus=CM_SLAC_PARM_CONF;
+	        Rtn=sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+	        #ifdef Debug
+	        printf("SendMmePacketSize=%d,Rtn=%d\n",SendMmePacketSize,Rtn);
+	        #endif
+	        ftime(&SeqStartTime);
+	        counter=0;
+	        break;
+		}
+
+	    case MMTYPE_CM_START_ATTEN_CHAR_IND:
+		{
+	        #ifdef Debug
+	        printf("--- MMTYPE_CM_START_ATTEN_CHAR_IND (counter : %d/3 ) ---\n",counter+1);
+	        printf("APPLICATION_TYPE: 0x%x\n", MmePacket->MMENTRY[0]);
+	        printf("SECURITY_TYPE: 0x%x\n", MmePacket->MMENTRY[1]);
+	        printf("NUM_SOUNDS: 0x%x\n", MmePacket->MMENTRY[2]);
+	        printf("Time_Out 0x%x\n", MmePacket->MMENTRY[3]);
+	        printf("RESP_TYPE 0x%x\n", MmePacket->MMENTRY[4]);    //Fixed value (0x01) indicating ��other Green PHY station��
+	        printf("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]);
+	        printf("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
+	        MnbcSoundNum=MmePacket->MMENTRY[2];
+	        V2gFlowStatus=CM_START_ATTEN_CHAR_IND;
+	        counter++;
+	        if(counter==1)
+	        {
+	            memset(Aag,0,sizeof(Aag));
+	            AttenProfileNum=0;
+	            ftime(&SeqStartTime);       //start TT_EVSE_match_MNBC
+	        }
+	        else if(counter>=3)
+	        {
+	            counter=0;
+	        }
+	        break;
+		}
+
+	    case MMTYPE_CM_MNBC_SOUND_IND:
+		{
+	        if(V2gFlowStatus>=CM_ATTEN_CHAR_IND)
+	            break;
+	        #ifdef Debug
+	        printf("--- MMTYPE_CM_MNBC_SOUND_IND (counter : %d/%d) ---\n",counter+1,MnbcSoundNum);
+	        printf("APPLICATION_TYPE: 0x%x\n", MmePacket->MMENTRY[0]);
+	        printf("SECURITY_TYPE: 0x%x\n", MmePacket->MMENTRY[1]);
+	        printf("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]);
+	        printf("Cnt: 0x%x\n", MmePacket->MMENTRY[19]);
+	        printf("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]);
+	        printf("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]);
+	        printf("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
+	        V2gFlowStatus=CM_MNBC_SOUND_IND;
+	        counter++;
+	        break;
+		}
+
+	    case MMTYPE_CM_ATTEN_PROFILE_IND:
+		{
+	        if(V2gFlowStatus>=CM_ATTEN_CHAR_IND)
+	        {
+				break;
+			}
+
+	        #ifdef Debug
+	        printf("--- MMTYPE_CM_ATTEN_PROFILE_IND (counter : %d/%d) ---\n",counter,MnbcSoundNum);
+	        printf("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]);
+	        printf("NumGroups: 0x%x\n", MmePacket->MMENTRY[6]);
+	        printf("RSVD: 0x%x\n", MmePacket->MMENTRY[7]);
+	        printf("AAG: \n");
+	        for(Rtn=0; Rtn<MmePacket->MMENTRY[6]; Rtn++)
+	            printf("%02x, ",MmePacket->MMENTRY[8+Rtn]);
+	        printf("\n");
+	            #endif
+	        AagGroupsNum=MmePacket->MMENTRY[6];
+	        for(Rtn=0; Rtn<MmePacket->MMENTRY[6]; Rtn++)
+	            Aag[Rtn]+=MmePacket->MMENTRY[8+Rtn];
+	        AttenProfileNum++;
+	        V2gFlowStatus=CM_MNBC_SOUND_IND;
+	        break;
+		}
+
+	    case MMTYPE_CM_ATTN_CHAR_RSP:
+		{
+	        #ifdef Debug
+	        printf("--- MMTYPE_CM_ATTN_CHAR_RSP ---\n");
+	        printf("APPLICATION_TYPE: 0x%x\n", MmePacket->MMENTRY[0]);
+	        printf("SECURITY_TYPE: 0x%x\n", MmePacket->MMENTRY[1]);
+	        printf("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]);
+	        printf("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]);
+	        printf("SOURCE_ID: \n");
+	        for(Rtn=0; Rtn<17; Rtn++)
+	            printf("%02x, ",MmePacket->MMENTRY[16+Rtn]);
+	        printf("\n");
+	        printf("RESP_ID: \n");
+	        for(Rtn=0; Rtn<17; Rtn++)
+	            printf("%02x, ",MmePacket->MMENTRY[33+Rtn]);
+	        printf("\n");
+	        printf("Result: 0x%x\n", MmePacket->MMENTRY[50]);    //Fixed value of 0x00 indicates a successful SLAC process
+	            #endif
+	        V2gFlowStatus=CM_ATTEN_CHAR_RSP;
+	        ftime(&SeqStartTime);
+	        break;
+		}
+
+	    case MMTYPE_CM_VALIDATE_REQ:
+		{
+	        #ifdef Debug
+	        printf("--- MMTYPE_CM_VALIDATE_REQ ---\n");
+	        printf("Signal Type: 0x%x\n", MmePacket->MMENTRY[0]);    //Fixed value (0x00) to indicate ��PEV S2 toggles on control pilot line��
+	        printf("Timer: 0x%x\n", MmePacket->MMENTRY[1]);    //Fixed value In the first VALIDATE Request-Response exchange, the Timer field shall be set to zero.
+	        printf("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
+	        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)
+	        {
+	            //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.
+	                #ifdef SupportBcbToggle
+	            SendMmePacket.MMENTRY[SendMmePacketSize++]=1;    //0x01 = Ready
+	                #else
+	            SendMmePacket.MMENTRY[SendMmePacketSize++]=4;    //0x04 = Not Required
+	                #endif
+	        }
+	        else
+	        {
+	            //second MMTYPE_CM_VALIDATE_REQ because Broadcast
+	            unsigned char PreStatus=3,ToggleNum=0;
+	            ftime(&SeqStartTime);
+	            while(1)
+	            {
+	                ftime(&SeqEndTime);
+	                if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].PilotState==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;
+	                        #ifdef SupportBcbToggle
+	                    SendMmePacket.MMENTRY[SendMmePacketSize++]=2;    //0x02 = Success
+	                        #else
+	                    SendMmePacket.MMENTRY[SendMmePacketSize++]=4;    //0x04 = Not Required
+	                        #endif
+	                    break;
+	                }
+	            }
+	        }
+	        SendMmePacketSize+=19;      //the size before MMENTRY
+	        sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+	        V2gFlowStatus=CM_VALIDATE_CNF;
+	        ftime(&SeqStartTime);
+	        break;
+		}
+
+	    case MMTYPE_CM_SLAC_MATCH_REQ:
+		{
+	        #ifdef Debug
+	        printf("--- MMTYPE_CM_SLAC_MATCH_REQ ---\n");
+	        printf("APPLICATION_TYPE: 0x%x\n", MmePacket->MMENTRY[0]);
+	        printf("SECURITY_TYPE: 0x%x\n", MmePacket->MMENTRY[1]);
+	        printf("MVFLength: 0x%x, 0x%x\n", MmePacket->MMENTRY[2],MmePacket->MMENTRY[3]);    //Fixed value (0x3E) for matching
+	        printf("PEV ID: \n");
+	        for(Rtn=0; Rtn<17; Rtn++)
+	            printf("%02x, ",MmePacket->MMENTRY[4+Rtn]);
+	        printf("\n");
+	        printf("PEV MAC: \n");
+	        for(Rtn=0; Rtn<6; Rtn++)
+	            printf("%02x, ",MmePacket->MMENTRY[21+Rtn]);
+	        printf("\n");
+	        printf("EVSE ID: \n");
+	        for(Rtn=0; Rtn<17; Rtn++)
+	            printf("%02x, ",MmePacket->MMENTRY[27+Rtn]);
+	        printf("\n");
+	        printf("EVSE MAC: \n");
+	        for(Rtn=0; Rtn<6; Rtn++)
+	            printf("%02x, ",MmePacket->MMENTRY[44+Rtn]);
+	        printf("\n");
+	        printf("RunID: \n");
+	        for(Rtn=0; Rtn<8; Rtn++)
+	            printf("%02x, ",MmePacket->MMENTRY[50+Rtn]);
+	        printf("\n");
+	        printf("RSVD: \n");
+	        for(Rtn=0; Rtn<8; Rtn++)
+	            printf("%02x, ",MmePacket->MMENTRY[58+Rtn]);
+	        printf("\n");
+	            #endif
+	        V2gFlowStatus=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++]=0x00;    //Fixed value (0x0056) for matching
+	        SendMmePacket.MMENTRY[SendMmePacketSize++]=0x56;    //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
+	            #ifdef Debug
+	        printf("\n\n***** Response MME Packet *****\n");
+	        printf("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]);
+	        printf("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]);
+	        printf("MTYPE: 0x%x\n", htons(SendMmePacket.MTYPE));
+	        printf("MMV: 0x%x\n", SendMmePacket.MMV);
+	        printf("MMTYPE: 0x%x\n", SendMmePacket.MMTYPE);
+	        printf("FMI 0x%x, 0x%x\n", SendMmePacket.FMI[0],SendMmePacket.FMI[1]);
+	        printf("--- CM_SLAC_MATCH_CNF ---\n");
+	        printf("APPLICATION_TYPE: 0x%x\n", SendMmePacket.MMENTRY[0]);
+	        printf("SECURITY_TYPE: 0x%x\n", SendMmePacket.MMENTRY[1]);
+	        printf("MVFLength: 0x%x, 0x%x\n", SendMmePacket.MMENTRY[2],SendMmePacket.MMENTRY[3]);
+	        printf("PEV ID: \n");
+	        for(Rtn=0; Rtn<17; Rtn++)
+	            printf("%02x, ",SendMmePacket.MMENTRY[4+Rtn]);
+	        printf("\n");
+	        printf("PEV MAC: \n");
+	        for(Rtn=0; Rtn<6; Rtn++)
+	            printf("%02x, ",SendMmePacket.MMENTRY[21+Rtn]);
+	        printf("\n");
+	        printf("EVSE ID: \n");
+	        for(Rtn=0; Rtn<17; Rtn++)
+	            printf("%02x, ",SendMmePacket.MMENTRY[27+Rtn]);
+	        printf("\n");
+	        printf("EVSE MAC: \n");
+	        for(Rtn=0; Rtn<6; Rtn++)
+	            printf("%02x, ",SendMmePacket.MMENTRY[44+Rtn]);
+	        printf("\n");
+	        printf("RunID: \n");
+	        for(Rtn=0; Rtn<8; Rtn++)
+	            printf("%02x, ",SendMmePacket.MMENTRY[50+Rtn]);
+	        printf("\n");
+	        printf("RSVD: \n");
+	        for(Rtn=0; Rtn<8; Rtn++)
+	            printf("%02x, ",SendMmePacket.MMENTRY[58+Rtn]);
+	        printf("\n");
+	        printf("NID: \n");
+	        for(Rtn=0; Rtn<7; Rtn++)
+	            printf("%02x, ",SendMmePacket.MMENTRY[66+Rtn]);
+	        printf("\n");
+	        printf("RSVD: 0x%x\n", SendMmePacket.MMENTRY[73]);
+	        printf("NMK: \n");
+	        for(Rtn=0; Rtn<16; Rtn++)
+	            printf("%02x, ",SendMmePacket.MMENTRY[74+Rtn]);
+	        printf("\n");
+	            #endif
+	        V2gFlowStatus=CM_SLAC_MATCH_CNF;
+	        Rtn=sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+	            #ifdef Debug
+	        printf("SendMmePacketSize=%d,Rtn=%d\n",SendMmePacketSize,Rtn);
+	            #endif
+	        ftime(&SeqStartTime);
+	        break;
+		}
+
+	    case MMTYPE_VENDOR_VS_HOST_ACTION:
+	    {
+	        struct QcaVendorMmeHeader *RecvPacket;
+	        RecvPacket = (struct QcaVendorMmeHeader *)Buffer;
+	        //#ifdef Debug
+	        printf("--- MMTYPE_VENDOR_VS_HOST_ACTION ---\n");
+	        //#endif
+	        switch (RecvPacket->MBODY[0])
+	        {
+		        case 0x00:
+		            //Loader (Device Softloader or Bootloader) ready
+		            printf("QCA7K: Loader Ready\n");
+		            break;
+
+		        case 0x01:
+		            //Firmware Upgrade Ready
+		            printf("QCA7K: Firmware Upgrade Ready\n");
+		            break;
+
+		        case 0x02:
+		            //PIB Update Ready
+		            printf("QCA7K: PIB Update Ready\n");
+		            break;
+
+		        case 0x03:
+		            //Firmware Upgrade and PIB Update ready
+		            printf("QCA7K: Firmware Upgrade and PIB Update ready\n");
+		            break;
+
+		        case 0x04:
+		            //Loader (Bootloader) ready to receive SDRAM configuration.
+		            printf("QCA7K: Loader ready to receive SDRAM configuration\n");
+		            break;
+
+		        case 0x05:
+		            //Reset to Factory Defaults.
+		            printf("QCA7K: Reset to Factory Defaults\n");
+		            break;
+
+		        default:
+		            //Reserved
+		            printf("QCA7K: Reserved\n");
+		            break;
+	        }
+			break;
+	    }
+
+	    case MMTYPE_VENDOR_ATTEN_CHAR:
+		{
+	        #ifdef Debug
+	        printf("--- MMTYPE_VENDOR_ATTEN_CHAR ---\n");
+	        #endif
+	        break;
+		}
+
+	    case MMTYPE_VENDOR_VS_NW_INFO_CNF:
+		{
+	        memcpy(QcaMac,MmePacket->OSA,6);
+	            #ifdef Debug
+	        printf("--- MMTYPE_VENDOR_VS_NW_INFO_CNF ---\n");
+	        printf("QcaMac: %02x:%02x:%02x:%02x:%02x:%02x\n",
+	               QcaMac[0],QcaMac[1],QcaMac[2],QcaMac[3],QcaMac[4],QcaMac[5]);
+	            #endif
+	        V2gFlowStatus=CM_SET_KEY_REQ;
+		}
+
+	    default:
+		{
+	        break;
+		}
+    }
+}
+
+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
+    V2gFlowStatus=CM_SET_KEY_REQ;
+    i=sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+    #ifdef Debug
+    printf("SendSetKey: send size =%d\n",i);
+    #endif
+
+}
+
+int GetQca7kMac()
+{
+    int i = 0;
+    struct QcaVendorMmeHeader SendPacket;
+
+    memset(&SendPacket,0,sizeof(struct QcaVendorMmeHeader));
+    memset(SendPacket.ODA, 0xFF, 6);
+    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));
+    #ifdef Debug
+    printf("GetQca7kMac: send size =%d\n",i);
+    #endif
+}
+
+int SlacComm()
+{
+    int packet_size,count;
+    static unsigned int STime;
+
+    if(RawSock>=0)
+    {
+        memset(RecvBuffer,0,RecvBufferSize);
+        packet_size = recvfrom(RawSock, RecvBuffer, RecvBufferSize, 0, NULL, NULL);
+        if(packet_size>0)
+        {
+            /*#ifdef Debug
+               printf("Raw Data: ");
+               for(count=0;count<packet_size;count++)
+                printf("0x%x, ",RecvBuffer[count]);
+               printf("\n");
+             #endif*/
+            MmeProcess(RecvBuffer, packet_size);
+        }
+    }
+    switch(V2gFlowStatus)
+    {
+	    case Idle:
+		{
+	        if(RawSock<0)
+	        {
+	            struct timeval tv;
+	            RawSock= socket(PF_PACKET, SOCK_RAW, htons(EtherType_HomePlug));
+	                #ifdef Debug
+	            printf("RawSock=%d\n",RawSock);
+	                #endif
+	            if(RawSock == -1)
+	            {
+
+	                    #ifdef SystemLogMessage
+	                StoreLogMsg("[EvComm]SlacComm:Failed to create socke");
+	                    #endif
+	                V2gFlowStatus=Other_Fault;
+	                return -1;
+	            }
+	            setsockopt(RawSock, SOL_SOCKET, SO_BINDTODEVICE,QcaInterface, 4);
+	            /*tv.tv_sec = 0;
+	               tv.tv_usec = 10000;
+	               if (setsockopt(RawSock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct	timeval)) < 0)
+	               {
+	             #ifdef SystemLogMessage
+	               StoreLogMsg("[EvComm]SlacComm:Set SO_RCVTIMEO NG");
+	             #endif
+	               V2gFlowStatus=Other_Fault;
+	               return -1;
+	               }*/
+	            memset(&Req, 0, sizeof(struct ifreq));
+	            strcpy( (char*)Req.ifr_name, QcaInterface);
+	            if (ioctl(RawSock, SIOCGIFINDEX, &Req) < 0)
+	            {
+	                        #ifdef SystemLogMessage
+	                StoreLogMsg("[EvComm]SlacComm: ioctl NG");
+	                    #endif
+	                V2gFlowStatus=Other_Fault;
+	                return -1;
+	            }
+	            memset( &DestSocketAddress, 0, sizeof(struct sockaddr_ll) );
+	            DestSocketAddress.sll_ifindex = Req.ifr_ifindex;
+	            DestSocketAddress.sll_halen = ETH_ALEN;
+	            //Get QCA7K MAC address
+	            GetQca7kMac();
+	            PwmStartTime=0;
+	            count=0;
+	            STime=time(NULL);
+	        }
+	        else
+	        {
+	            if((time(NULL)-STime)>=3)
+	            {
+	                if((count++) >=3)
+	                    V2gFlowStatus=Sequence_Timeout;
+	                else
+	                {
+	                    GetQca7kMac();
+	                    STime=time(NULL);
+	                }
+	            }
+	        }
+	        break;
+		}
+
+	    case CM_SET_KEY_REQ:
+		{
+	        //CM_SET_KEY_REQ
+	        SendSetKey();
+	        break;
+		}
+
+	    case CM_SET_KEY_CNF:
+		{
+	        OutputCpPwmDuty(5);
+	        if(PwmStartTime<=0)
+	            PwmStartTime=time(NULL);
+	        else
+	        {
+	            if((time(NULL)-PwmStartTime)>TT_EVSE_SLAC_init)
+	            {
+	                    #ifdef SystemLogMessage
+	                StoreLogMsg("[EvComm]SlacComm: Wait CM_SLAC_PARM_REQ Timeout - TT_EVSE_SLAC_init ");
+	                    #endif
+	                V2gFlowStatus=Sequence_Timeout;
+	                return -1;
+	            }
+	        }
+	        break;
+		}
+
+	    case CM_SLAC_PARM_CONF:
+		{
+	        ftime(&SeqEndTime);
+	        if(DiffTimeb(SeqStartTime, SeqEndTime)>TT_match_sequence)
+	        {
+	                #ifdef SystemLogMessage
+	            StoreLogMsg("[EvComm]SlacComm: Wait CM_START_ATTEN_CHAR_IND Timeout - TT_match_sequence ");
+	                #endif
+	            V2gFlowStatus=Sequence_Timeout;
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_START_ATTEN_CHAR_IND:
+		{
+	        ftime(&SeqEndTime);
+	        if(DiffTimeb(SeqStartTime, SeqEndTime)>(3*TP_EV_batch_msg_interval))    //one more time interval for tolerance
+	        {
+	                #ifdef SystemLogMessage
+	            StoreLogMsg("[EvComm]SlacComm: Wait CM_MNBC_SOUND_IND Timeout - 3*TP_EV_batch_msg_interval ");
+	                #endif
+	            V2gFlowStatus=Sequence_Timeout;
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_MNBC_SOUND_IND:
+		{
+	        ftime(&SeqEndTime);
+	        if(DiffTimeb(SeqStartTime, SeqEndTime)>(TT_EVSE_match_MNBC*100)||(AttenProfileNum>=MnbcSoundNum))
+	        {
+	            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_ATTN_CHAR_IND;
+	            SendMmePacket.FMI[0]=SendMmePacket.FMI[1]=0;
+	            SendMmePacketSize=0;
+	            SendMmePacket.MMENTRY[SendMmePacketSize++]=0;    //APPLICATION_TYPE,  Fixed value indicating ��PEVEVSE matching��
+	            SendMmePacket.MMENTRY[SendMmePacketSize++]=0;    //SECURITY_TYPE, Fixed value indicating ��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++]=AttenProfileNum;    //NumSounds
+	            SendMmePacket.MMENTRY[SendMmePacketSize++]=AagGroupsNum;    //NumGroups
+	            for(count=0; count<AagGroupsNum; count++)
+	            {
+	                unsigned char TmpAag;
+	                TmpAag=((Aag[count]/AttenProfileNum)&0xFF);
+	                if(TmpAag>=39)
+	                {
+						/*
+						// [To-do] If this statement is enabled, SLAC will fail due to timeout.
+	                    #ifdef SystemLogMessage
+	                    {
+	                        unsigned char TmpBuf[64];
+	                        memset(TmpBuf,0,sizeof(TmpBuf));
+	                        sprintf(TmpBuf,"[EvComm]SlacComm: bad Aag[%d]=%d",count,TmpAag);
+	                        StoreLogMsg(TmpBuf);
+	                    }
+	                    #endif
+						*/
+	                    TmpAag=37;
+	                }
+	                SendMmePacket.MMENTRY[SendMmePacketSize++]=TmpAag;
+	            }
+	            SendMmePacketSize+=19;      //the size before MMENTRY
+	                #ifdef Debug
+	            printf("\n\n***** Send MME Packet *****\n");
+	            printf("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]);
+	            printf("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]);
+	            printf("MTYPE: 0x%x\n", htons(SendMmePacket.MTYPE));
+	            printf("MMV: 0x%x\n", SendMmePacket.MMV);
+	            printf("MMTYPE: 0x%x\n", SendMmePacket.MMTYPE);
+	            printf("FMI 0x%x, 0x%x\n", SendMmePacket.FMI[0],SendMmePacket.FMI[1]);
+	            printf("--- CM_ATTEN_CHAR_IND ---\n");
+	            printf("APPLICATION_TYPE: 0x%x\n", SendMmePacket.MMENTRY[0]);
+	            printf("SECURITY_TYPE: 0x%x\n", SendMmePacket.MMENTRY[1]);
+	            printf("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]);
+	            printf("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]);
+	            printf("SOURCE_ID: \n");
+	            for(count=0; count<17; count++)
+	                printf("%02x, ",SendMmePacket.MMENTRY[16+count]);
+	            printf("\n");
+	            printf("RESP_ID: \n");
+	            for(count=0; count<17; count++)
+	                printf("%02x, ",SendMmePacket.MMENTRY[33+count]);
+	            printf("\n");
+	            printf("NumSounds: 0x%x\n", SendMmePacket.MMENTRY[50]);
+	            printf("ATTEN_PROFILE: \n");
+	            for(count=0; count<AagGroupsNum; count++)
+	                printf("%02x, ",SendMmePacket.MMENTRY[51+count]);
+	            printf("\n");
+	                #endif
+	            V2gFlowStatus=CM_ATTEN_CHAR_IND;
+	            count=sendto(RawSock, &SendMmePacket, SendMmePacketSize, 0, (struct sockaddr*)&DestSocketAddress, sizeof(struct sockaddr_ll));
+	                #ifdef Debug
+	            printf("SendMmePacketSize=%d,Rtn=%d\n",SendMmePacketSize,count);
+	                #endif
+	            ftime(&SeqStartTime);
+	        }
+	        break;
+		}
+
+	    case CM_ATTEN_CHAR_IND:
+		{
+	        ftime(&SeqEndTime);
+	        //if(DiffTimeb(SeqStartTime, SeqEndTime)>TT_match_response)
+	        if(DiffTimeb(SeqStartTime, SeqEndTime)>TT_match_response*2)     //extended to 400ms due to the response of CM_ATTEN_CHAR.RSP of some EVCC is slower than 200ms.
+	        {
+	                #ifdef SystemLogMessage
+	            StoreLogMsg("[EvComm]SlacComm: Wait CM_ATTEN_CHAR_RSP Timeout - TT_match_response ");
+	                #endif
+	            V2gFlowStatus=Sequence_Timeout;
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_ATTEN_CHAR_RSP:
+		{
+	        ftime(&SeqEndTime);
+	        if(DiffTimeb(SeqStartTime, SeqEndTime)>TT_EVSE_match_session)
+	        {
+	                #ifdef SystemLogMessage
+	            StoreLogMsg("[EvComm]SlacComm: Wait CM_VALIDATE_REQ or CM_SLAC_MATCH_REQ Timeout - TT_EVSE_match_session ");
+	                #endif
+	            V2gFlowStatus=Sequence_Timeout;
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_VALIDATE_CNF:
+		{
+	        ftime(&SeqEndTime);
+	        if(DiffTimeb(SeqStartTime, SeqEndTime)>TT_match_sequence)
+	        {
+	                #ifdef SystemLogMessage
+	            StoreLogMsg("[EvComm]SlacComm: Wait CM_VALIDATE_CNF or CM_SLAC_MATCH_REQ Timeout - TT_match_sequence ");
+	                #endif
+	            V2gFlowStatus=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);
+	        V2gFlowStatus=SLACC_SDP_UDP_Connection;
+	        break;
+		}
+
+		defaudlt:
+		{
+		    break;
+		}
+    }
+    return 0;
+}
+
+int V2gMsgProcess(unsigned char *Buffer, int DataLength)
+{
+    struct V2gtpHeader *RecvHeader;
+    unsigned char *PayloadData;
+
+    RecvHeader= (struct V2gtpHeader *) Buffer;
+
+    #ifdef Debug
+    printf("\n\n***********************************\n");
+    printf("***** Received V2G Packet *****\n");
+    printf("***********************************\n");
+    printf("ProtocolVersion=%d\n",RecvHeader->ProtocolVersion);
+    printf("InverseProtocolVersion=0x%x\n",RecvHeader->InverseProtocolVersion);
+    printf("PayloadType=0x%x\n",htons(RecvHeader->PayloadType));
+    printf("PayloadLength=0x%x\n",htonl(RecvHeader->PayloadLength));
+    #endif
+
+    if(htons(RecvHeader->PayloadType)!=V2GTP_PAYLOAD_TYPE_EXI_MSG)
+    {
+        #ifdef SystemLogMessage
+        StoreLogMsg("[EvComm]V2gMsgProcess: Wrong Payload Type");
+        #endif
+        return 0;
+    }
+    //EXI decode
+    //process received message and change status flag
+
+}
+
+int V2gComm(int AcceptFd)
+{
+    int packet_size,count;
+
+    memset(RecvBuffer,0,RecvBufferSize);
+    packet_size=recv(AcceptFd, RecvBuffer, RecvBufferSize, 0);
+    if(packet_size>0)
+    {
+        /*#ifdef Debug
+           printf("V2gComm Data: ");
+           for(count=0;count<packet_size;count++)
+            printf("0x%x, ",RecvBuffer[count]);
+           printf("\n");
+         #endif*/
+        V2gMsgProcess(RecvBuffer, packet_size);
+    }
+    //following are the response message handling according to status flag
+    switch(V2gFlowStatus)
+    {
+	    case SupportedAppProtocolRequest:
+	        break;
+	    default:
+	        break;
+    }
+    return 0;
+}
+
+int SdpUdpConnected()
+{
+    int packet_size,Rtn;
+    struct sockaddr_in6 ServerAddr,ClientAddr;
+    struct V2gtpHeader *RecvHeader;
+    unsigned char *PayloadData;
+
+    if(UdpSock<=0)
+    {
+        if ((UdpSock = socket(AF_INET6, SOCK_DGRAM, 0)) <0)
+        {
+                    #ifdef SystemLogMessage
+            StoreLogMsg("[EvComm]SdpUdpConnected: Fail to open UdpSock");
+            #endif
+            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)
+        {
+                    #ifdef SystemLogMessage
+            StoreLogMsg("[EvComm]SdpUdpConnected: Fail to bind UdpSock");
+            #endif
+            close(UdpSock);
+            UdpSock=-1;
+            return 0;
+        }
+            #ifdef Debug
+        printf("UdpSock=%d\n",UdpSock);
+            #endif
+    }
+    memset(RecvBuffer,0,RecvBufferSize);
+    memset(&ClientAddr,0, sizeof(struct sockaddr_in));
+    Rtn=sizeof(struct sockaddr_in6);
+    packet_size = recvfrom(UdpSock, RecvBuffer, RecvBufferSize, MSG_DONTWAIT, (struct sockaddr *)&ClientAddr, &Rtn);
+    #ifdef Debug
+    printf("packet_size=%d\n",packet_size);
+        #endif
+    if(packet_size>0)
+    {
+        RecvHeader= (struct V2gtpHeader *) RecvBuffer;
+        PayloadData=RecvBuffer+sizeof(struct V2gtpHeader);
+        #ifdef Debug
+        printf("\n\n***********************************\n");
+        printf("***** Received SDP Packet *****\n");
+        printf("***********************************\n");
+        printf("ClientAddress=");
+        for(Rtn=0; Rtn<16; Rtn+=2)
+            printf("%02x%02x:",ClientAddr.sin6_addr.s6_addr[Rtn],ClientAddr.sin6_addr.s6_addr[Rtn+1]);
+        printf("\n");
+        printf("ClientPort=%d\n",ClientAddr.sin6_port);
+        printf("ProtocolVersion=%d\n",RecvHeader->ProtocolVersion);
+        printf("InverseProtocolVersion=0x%x\n",RecvHeader->InverseProtocolVersion);
+        printf("PayloadType=0x%x\n",htons(RecvHeader->PayloadType));
+        printf("PayloadLength=0x%x\n",htonl(RecvHeader->PayloadLength));
+        #endif
+        if((RecvHeader->ProtocolVersion==0x01)&&(RecvHeader->InverseProtocolVersion==0xFE)&&(htons(RecvHeader->PayloadType)==V2GTP_PAYLOAD_TYPE_SDP_REQUEST))
+        {
+            #ifdef Debug
+            printf("Security=0x%x\n",*(PayloadData+0));
+            printf("TransportProtocol=0x%x\n",*(PayloadData+1));
+            #endif
+            RecvHeader->PayloadType=htons(V2GTP_PAYLOAD_TYPE_SDP_RESPONSE);
+            RecvHeader->PayloadLength=htonl(20);    //Fixed Length=20
+            memset(PayloadData,0,20);
+            // MAC address[0:2] + FFFE + MAC address[3:5]
+            PayloadData[0]=(IPV6_LINK_LOCAL_PREFIX>>8)&0xFF;
+            PayloadData[1]=IPV6_LINK_LOCAL_PREFIX&0xFF;
+            PayloadData[8]=CsuMac[0];
+            PayloadData[8]^=0x02;// bit 1 should complemented.
+            PayloadData[9]=CsuMac[1];
+            PayloadData[10]=CsuMac[2];
+            PayloadData[11]=0xFF;
+            PayloadData[12]=0xFE;
+            PayloadData[13] =CsuMac[3];
+            PayloadData[14]=CsuMac[4];
+            PayloadData[15]=CsuMac[5];
+            //TCP port
+            PayloadData[16]=(SdpTcpServerPort>>8)&0xFF;
+            PayloadData[17]=SdpTcpServerPort&0xFF;
+            PayloadData[18]=SDP_PAYLOAD_SECURITY_NONE;      //Security
+            PayloadData[19]=SDP_PAYLOAD_TRANS_PROTOCOL_TCP; //Transport protocol
+            Rtn=sendto(UdpSock, RecvBuffer, sizeof(struct V2gtpHeader)+htonl(RecvHeader->PayloadLength), 0, (struct sockaddr *)&ClientAddr, sizeof(struct sockaddr_in6));
+            #ifdef Debug
+            printf("\n\n***** Response SDP Packet *****\n");
+            printf("Send size=%d\n",Rtn);
+            printf("Destination Address=");
+            for(Rtn=0; Rtn<16; Rtn++)
+                printf("%02x, ",ClientAddr.sin6_addr.s6_addr[Rtn]);
+            printf("\n");
+            printf("Destination Port=%d\n",ClientAddr.sin6_port);
+            printf("ProtocolVersion=%d\n",RecvHeader->ProtocolVersion);
+            printf("InverseProtocolVersion=0x%x\n",RecvHeader->InverseProtocolVersion);
+            printf("PayloadType=0x%x\n",htons(RecvHeader->PayloadType));
+            printf("PayloadLength=0x%x\n",htonl(RecvHeader->PayloadLength));
+            printf("SECC Ipv6 Address=");
+            for(Rtn=0; Rtn<16; Rtn++)
+                printf("%02x:",PayloadData[Rtn]);
+            printf("\n");
+            printf("SECC Port=%d\n",(PayloadData[16]<<8|PayloadData[17]));
+            printf("Security=0x%x\n",PayloadData[19]);
+            printf("TransportProtocol=0x%x\n",PayloadData[20]);
+            #endif
+            if(Rtn>0)
+                return 1;
+        }
+    }
+    return 0;
+}
+
+int V2gTcpConnected()
+{
+    int packet_size,Rtn,AcceptFd;
+    struct sockaddr_in6 ServerAddr,ClientAddr;
+
+    if(TcpSock<=0)
+    {
+        if ((TcpSock = socket(PF_INET6, SOCK_STREAM, 0)) <0)
+        {
+                    #ifdef SystemLogMessage
+            StoreLogMsg("[EvComm]V2gTcpConnected: Fail to open TcpSock");
+            #endif
+            return 0;
+        }
+        fcntl(TcpSock, F_SETFL, O_NONBLOCK);    //set to O_NONBLOCK
+        memset(&ServerAddr,0, sizeof(struct sockaddr_in));
+        ServerAddr.sin6_family = PF_INET6;
+        ServerAddr.sin6_addr=in6addr_any;
+        ServerAddr.sin6_port = htons(SdpTcpServerPort);
+        if(bind(TcpSock, (struct sockaddr *)&ServerAddr, sizeof(struct sockaddr_in6)) <0)
+        {
+                    #ifdef SystemLogMessage
+            StoreLogMsg("[EvComm]V2gTcpConnected: Fail to bind TcpSock");
+            #endif
+            close(TcpSock);
+            TcpSock=-1;
+            return 0;
+        }
+        if(listen(TcpSock, 1) == -1)     //only accept one connection
+        {
+                #ifdef SystemLogMessage
+            StoreLogMsg("[EvComm]V2gTcpConnected: Fail to listen TcpSock");
+            #endif
+            close(TcpSock);
+            TcpSock=-1;
+            return 0;
+        }
+            #ifdef Debug
+        printf("TcpSock=%d\n",TcpSock);
+            #endif
+    }
+    Rtn=sizeof(struct sockaddr_in6);
+    if((AcceptFd=accept(TcpSock,(struct sockaddr *)&ClientAddr,&Rtn))==-1)
+    {
+        #ifdef Debug
+        printf("Wait TCP connection\n");
+        #endif
+        return 0;
+    }
+    #ifdef Debug
+    printf("Accept one TCP connection:\n");
+    printf("AcceptFd=%d\n",AcceptFd);
+    printf("ClientAddress=");
+    for(Rtn=0; Rtn<16; Rtn+=2)
+        printf("%02x%02x:",ClientAddr.sin6_addr.s6_addr[Rtn],ClientAddr.sin6_addr.s6_addr[Rtn+1]);
+    printf("\n");
+    printf("ClientPort=%d\n",ClientAddr.sin6_port);
+    #endif
+    return AcceptFd;
+}
+
+int main(int argc,char *argv[])
+{
+    unsigned char Rtn;
+    int TcpAcceptFd;
+    //Initialization
+    InitShareMemory();
+    //start to detect pilot state
+    PilotDetectionPid=0;
+    PilotDetection();
+    //Init communication parameters
+    GetEthMac(QcaInterface, CsuMac);
+    RecvBuffer=(unsigned char *)malloc(RecvBufferSize);
+    memset(RecvBuffer,0,RecvBufferSize);
+    SendBuffer=(unsigned char *)malloc(SendBufferSize);
+    memset(SendBuffer,0,SendBufferSize);
+    if(RawSock>0)
+        close(RawSock);
+    if(UdpSock>0)
+        close(UdpSock);
+    if(TcpSock>0)
+        close(TcpSock);
+    RawSock=UdpSock=TcpSock=-1;
+    V2gFlowStatus=0;
+    AttenProfileNum=0;
+    while(1)
+    {
+        #ifdef Debug
+        printf("V2gFlowStatus=%d\n",V2gFlowStatus);
+        #endif
+        //if((ShmInternalComm->ChargingPermission==0x01)&&(ConnectorPlugIn()==1))
+        if(1)
+        {
+            if(V2gFlowStatus<SLACC_SDP_UDP_Connection)
+                SlacComm();
+            else if(V2gFlowStatus==SLACC_SDP_UDP_Connection)
+            {
+                if(SdpUdpConnected()==1)
+                {
+                    V2gFlowStatus=SLACC_SDP_TCP_Connection;
+                    continue;
+                }
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime)>TT_match_join)
+                {
+                    #ifdef SystemLogMessage
+                    StoreLogMsg("[EvComm]main: Wait SLACC_SDP_UDP_Connection Timeout - TT_match_join ");
+                    #endif
+                    V2gFlowStatus=Sequence_Timeout;
+                }
+            }
+            else if(V2gFlowStatus==SLACC_SDP_TCP_Connection)
+            {
+                if((TcpAcceptFd=V2gTcpConnected())>0)
+                {
+                    V2gFlowStatus=SupportedAppProtocolRequest;
+                    continue;
+                }
+                ftime(&SeqEndTime);
+                if(DiffTimeb(SeqStartTime, SeqEndTime)>TT_match_join)
+                {
+                    #ifdef SystemLogMessage
+                    StoreLogMsg("[EvComm]main: Wait SLACC_SDP_TCP_Connection Timeout - TT_match_join ");
+                    #endif
+                    V2gFlowStatus=Sequence_Timeout;
+                }
+            }
+            else if(V2gFlowStatus<Performance_Timeout)
+                V2gComm(TcpAcceptFd);
+        }
+        if(V2gFlowStatus>=Performance_Timeout)
+        {
+            //Normal Stop
+            //alarm and duty to 100%
+            OutputCpPwmDuty(100);
+            goto ReSet;
+        }
+        /*else if((ConnectorPlugIn()==0)&&(V2gFlowStatus>Idle))
+           {
+            //Emergency stop
+            OutputCpPwmDuty(100);
+            goto ReSet;
+           }*/
+        continue;
+
+ReSet:
+        if(RawSock>0)
+            close(RawSock);
+        if(UdpSock>0)
+            close(UdpSock);
+        if(TcpSock>0)
+        {
+            close(TcpSock);
+            close(TcpAcceptFd);
+        }
+        RawSock=UdpSock=TcpSock=TcpAcceptFd=-1;
+        V2gFlowStatus=0;
+        while(1)
+        {
+            //wait for CSU configrm
+        }
+    }//main while
+}

+ 109 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/EvComm.h

@@ -0,0 +1,109 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                EVComm.h
+
+                        initiated by Vern, Joseph
+                           (since 2019/07/19)
+   =============================================================================*/
+
+#ifndef EVCOMM_H_
+#define EVCOMM_H_
+
+
+#define QcaInterface                        "eth0"
+#define SupportBcbToggle
+#define SdpUdpServerPort                    15118
+#define SdpTcpServerPort                    59438   //49152-65535
+#define IPV6_LINK_LOCAL_PREFIX              0xFE80
+
+/***********************************************/
+/*********** 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_ATTN_CHAR_IND             0x606E
+#define MMTYPE_CM_ATTN_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
+
+/***********************************************/
+/************** V2GTP Payload Type ************/
+/**********************************************/
+#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 C_EV_match_MNBC                     0x0A
+#define TT_EVSE_SLAC_init                   50          //unit: sec.
+#define TT_match_sequence                   400         //unit: ms
+#define TT_EVSE_match_MNBC                  6           //unit: 100ms
+#define TP_match_response                   100         //unit: ms, General performance time for a response to a request
+#define TT_match_response                   200         //unit: ms, Time that the EV/EVSE shall wait for a response from the EVSE/EV
+#define TP_EV_batch_msg_interval            50          //unit: ms
+#define TT_EVSE_match_session               10000       //unit: ms
+#define TT_match_join                       12000       //unit: ms
+/***********************************************/
+/*************** 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
+{
+    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));
+
+#endif

+ 508 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/EventLogging.c

@@ -0,0 +1,508 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                             EventLogging.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 <unistd.h>
+#include "define.h"
+#include "EventLogging.h"
+
+//#define Debug
+
+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
+};
+
+/*===========================================================================
+FUNCTION: StoreLogMsg
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#if SAVE_SYS_LOG_MSG_EVENTLOG_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][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);
+    system(Buf);
+
+    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)
+{
+    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/EventLog/[%04d.%02d]EventLog",
+            tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
+            EventCodeString,
+            tm->tm_year + 1900, tm->tm_mon + 1);
+    system(Buf);
+
+    DEBUG_PRINTF_EVENTLOG_DETAIL("%s \n", Buf);
+}
+
+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_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 ShareMemory_Init()
+{
+    int MeterSMId;
+
+    //create ShmSysConfigAndInfo
+    if((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+        StoreLogMsg("[EventLogging]ShareMemory_Init:shmget ShmSysConfigAndInfo NG");
+
+        return 0;
+    }
+    else if((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        StoreLogMsg("[EventLogging]ShareMemory_Init:shmat ShmSysConfigAndInfo NG");
+
+        return 0;
+    }
+
+    //create ShmStatusCodeData
+    if((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+        StoreLogMsg("[EventLogging]ShareMemory_Init:shmget ShmStatusCodeData NG");
+
+        return 0;
+    }
+    else if((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        StoreLogMsg("[EventLogging]ShareMemory_Init:shmat ShmStatusCodeData NG");
+
+        return 0;
+    }
+
+    return 1;
+}
+
+void FlashPresentStatusCode(unsigned char *NewCode)
+{
+    unsigned char CodeIndex, SaveIndex = 0;
+    unsigned char StatusCodeTmp[10][6];
+
+    memset(StatusCodeTmp, 0, sizeof(StatusCodeTmp));
+
+    for(CodeIndex = 0; CodeIndex < (sizeof(ShmStatusCodeData->PresentStatusCode) / 6); CodeIndex++)
+    {
+        if(strlen(ShmStatusCodeData->PresentStatusCode[CodeIndex]) <= 0)
+        {
+            memcpy(StatusCodeTmp[SaveIndex++], NewCode, 6);
+            memset(ShmStatusCodeData->PresentStatusCode, 0, sizeof(ShmStatusCodeData->PresentStatusCode));
+            memcpy(ShmStatusCodeData->PresentStatusCode, StatusCodeTmp, sizeof(StatusCodeTmp));
+            return;
+        }
+        else if(strstr(ShmStatusCodeData->PresentStatusCode[CodeIndex], NewCode + 1) != NULL)
+        {
+            if((CodeIndex + 1) < 10)
+            {
+                memcpy(StatusCodeTmp[SaveIndex], ShmStatusCodeData->PresentStatusCode[CodeIndex + 1], (9 - CodeIndex) * 6);
+            }
+
+            memset(ShmStatusCodeData->PresentStatusCode, 0, sizeof(ShmStatusCodeData->PresentStatusCode));
+            memcpy(ShmStatusCodeData->PresentStatusCode, StatusCodeTmp, sizeof(StatusCodeTmp));
+            return;
+        }
+        else
+        {
+            memcpy(StatusCodeTmp[SaveIndex++], ShmStatusCodeData->PresentStatusCode[CodeIndex], 6);
+        }
+    }
+}
+
+int main(int argc, char *argv[])
+{
+    int ByteCount, BitCount;
+    unsigned char tmp, EventCodeTmp[7];
+
+    //Initialization
+    if(ShareMemory_Init() == 0)
+    {
+        StoreLogMsg("[EventLogging]main:ShareMemory_Init NG");
+
+        if(ShmStatusCodeData != NULL)
+        {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
+        }
+
+        sleep(5);
+        return 0;
+    }
+
+    while(1)
+    {
+        //check Fault Status
+        for(ByteCount = 0; ByteCount < 4; ByteCount++)
+        {
+            if(ShmStatusCodeData->FaultCode.FaultEvents.FaultVal[ByteCount] != ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount])
+            {
+                tmp = ShmStatusCodeData->FaultCode.FaultEvents.FaultVal[ByteCount]; //prevent be modified during following process
+
+                for(BitCount = 0; BitCount < 8; BitCount++)
+                {
+                    if(((tmp >> BitCount) & 0x01) != ((ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount] >> BitCount) & 0x01))
+                    {
+                        memset(EventCodeTmp, 0, sizeof(EventCodeTmp));
+                        memcpy(EventCodeTmp, FaultStatusCode[ByteCount * 8 + BitCount], sizeof(EventCodeTmp) - 1);
+
+                        if(((tmp >> BitCount) & 0x01) == 0)//Recovered
+                        {
+                            EventCodeTmp[0] = 1;
+                            ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount] &= (0 << BitCount);
+                        }
+                        else
+                        {
+                            ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount] |= (1 << BitCount);
+                        }
+
+                        FlashPresentStatusCode(EventCodeTmp);
+                        StoreEventLogMsg(EventCodeTmp);
+                    }
+                }
+            }
+        }
+
+        //check Alarm Status
+        for(ByteCount = 0; ByteCount < 8; ByteCount++)
+        {
+            if(ShmStatusCodeData->AlarmCode.AlarmEvents.AlarmVal[ByteCount] != ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount])
+            {
+                tmp = ShmStatusCodeData->AlarmCode.AlarmEvents.AlarmVal[ByteCount]; //prevent be modified during following process
+
+                for(BitCount = 0; BitCount < 8; BitCount++)
+                {
+                    if(((tmp >> BitCount) & 0x01) != ((ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount] >> BitCount) & 0x01))
+                    {
+                        memset(EventCodeTmp, 0, sizeof(EventCodeTmp));
+                        memcpy(EventCodeTmp, AlarmStatusCode[ByteCount * 8 + BitCount], sizeof(EventCodeTmp) - 1);
+
+                        if(((tmp >> BitCount) & 0x01) == 0)//Recovered
+                        {
+                            EventCodeTmp[0] = 1;
+                            ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount] &= (0 << BitCount);
+                        }
+                        else
+                        {
+                            ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount] |= (1 << BitCount);
+
+                        }
+
+                        FlashPresentStatusCode(EventCodeTmp);
+                        StoreEventLogMsg(EventCodeTmp);
+                    }
+                }
+            }
+        }
+
+        //check Info Status
+        for(ByteCount = 0; ByteCount < 8; ByteCount++)
+        {
+            if(ShmStatusCodeData->InfoCode.InfoEvents.InfoVal[ByteCount] != ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount])
+            {
+                tmp = ShmStatusCodeData->InfoCode.InfoEvents.InfoVal[ByteCount]; //prevent be modified during following process
+
+                for(BitCount = 0; BitCount < 8; BitCount++)
+                {
+                    if(((tmp >> BitCount) & 0x01) != ((ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount] >> BitCount) & 0x01))
+                    {
+                        memset(EventCodeTmp, 0, sizeof(EventCodeTmp));
+                        memcpy(EventCodeTmp, InfoStatusCode[ByteCount * 8 + BitCount], sizeof(EventCodeTmp) - 1);
+
+                        if(((tmp >> BitCount) & 0x01) == 0)//Recovered
+                        {
+                            EventCodeTmp[0] = 1;
+                            ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount] &= (0 << BitCount);
+                        }
+                        else
+                        {
+                            ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount] |= (1 << BitCount);
+                        }
+
+                        FlashPresentStatusCode(EventCodeTmp);
+                        StoreEventLogMsg(EventCodeTmp);
+                    }
+                }
+            }
+        }
+    }//main while loop
+
+}

+ 62 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/EventLogging.h

@@ -0,0 +1,62 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                             EventLogging.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_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

+ 185 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/FWMaker.c

@@ -0,0 +1,185 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 FWMaker.c
+
+                        initiated by Vern, Joseph
+                           (since 2019/07/19)
+=============================================================================*/
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <string.h>
+#include <net/if.h> /*struct ifreq*/
+#include <linux/sockios.h> /*SIOCGIFINDEX*/
+#include <linux/socket.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/timeb.h>
+#include <fcntl.h>
+#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[])
+{
+    unsigned char *MemBuf, *MemBuf2, buf[64];
+    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);
+    memset(buf, 0, 64);
+    sprintf(buf, "tftp -gr rootfs_nor.img -l /mnt/rootfs_nor.img %s", argv[1]);
+    system(buf);
+
+    if((MemBuf = malloc(0x100000D)) == NULL)
+    {
+        DEBUG_PRINTF_FWMAKER_DETAIL("Allocate MemBuf memory error\n");
+        return 0;
+    }
+
+    memset(MemBuf, 0xff, 0x100000D);
+    fd = open("/mnt/uImage", O_RDWR);
+
+    if(fd > 0)
+    {
+        if((rd = read(fd, MemBuf, 0x100000D)) <= 0)
+        {
+            DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/uImage read Error\n");
+            free(MemBuf);
+            close(fd);
+            return 0;
+        }
+
+        close(fd);
+
+        for(tmp = 0; tmp < rd; tmp++)
+        {
+            CheckSum += MemBuf[tmp];
+        }
+
+        strncpy(MemBuf + rd, "DELTADCOK", 9);
+        *(MemBuf + rd + 9) = CheckSum >> 24;
+        *(MemBuf + rd + 10) = CheckSum >> 16;
+        *(MemBuf + rd + 11) = CheckSum >> 8;
+        *(MemBuf + rd + 12) = CheckSum;
+        // memcpy(MemBuf+rd+9,&CheckSum,4);
+        fd = open("/mnt/DcoKImage", O_CREAT | O_RDWR);
+        wrd = write(fd, MemBuf, rd + 13);
+
+        if(wrd != (rd + 13))
+        {
+            DEBUG_PRINTF_FWMAKER_DETAIL("write error wrd=0x%x, rd=0x%x\n", wrd, rd + 13);
+        }
+        else
+        {
+            DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/DcoKImage OK\n");
+        }
+
+    }
+    else
+    {
+        free(MemBuf);
+        DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/uImage open Error\n");
+        return 0;
+    }
+
+
+    memset(MemBuf, 0xff, 0x100000D);
+    CheckSum = rd = 0;
+    fd = open("/mnt/rootfs_nor.img", O_RDWR);
+
+    if(fd > 0)
+    {
+        if((rd = read(fd, MemBuf, 0x100000D)) <= 0)
+        {
+            DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/rootfs_nor.img read Error\n");
+            free(MemBuf);
+            close(fd);
+            return 0;
+        }
+
+        close(fd);
+
+        for(tmp = 0; tmp < rd; tmp++)
+        {
+            CheckSum += MemBuf[tmp];
+        }
+
+        strncpy(MemBuf + rd, "DELTADCOF", 9);
+        *(MemBuf + rd + 9) = CheckSum >> 24;
+        *(MemBuf + rd + 10) = CheckSum >> 16;
+        *(MemBuf + rd + 11) = CheckSum >> 8;
+        *(MemBuf + rd + 12) = CheckSum;
+        //memcpy(MemBuf+rd+9,&CheckSum,4);
+        fd = open("/mnt/DcoFImage", O_CREAT | O_RDWR);
+        wrd = write(fd, MemBuf, rd + 13);
+
+        if(wrd != (rd + 13))
+        {
+            DEBUG_PRINTF_FWMAKER_DETAIL("write error wrd=0x%x, rd=0x%x\n", wrd, rd + 13);
+        }
+        else
+        {
+            DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/DcoFImage OK\n");
+        }
+    }
+    else
+    {
+        free(MemBuf);
+        DEBUG_PRINTF_FWMAKER_DETAIL("/mnt/rootfs_nor.img open Error\n");
+        return 0;
+    }
+
+}

+ 61 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/FWMaker.h

@@ -0,0 +1,61 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 FWMaker.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_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

+ 1390 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/FWUpdate.c

@@ -0,0 +1,1390 @@
+/*===========================================================================
+                    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;
+    }
+	#if 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;
+    }
+	#endif
+    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);
+                
+        system("/bin/flash_erase /dev/mtd1 0 2");
+	system("/usr/sbin/nandwrite -p /dev/mtd1 /root/u-boot.img");
+	system("/bin/flash_erase /dev/mtd3 0 2");
+	system("/usr/sbin/nandwrite -p /dev/mtd3 /root/u-boot.img");
+
+        
+        sprintf(buf_log_fwupdate, "[uboot]mtdblock1 - written length: %d bytes\n", wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+#if 0
+        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;
+                }
+            }
+        }
+#endif    
+    }
+    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);
+        
+        system("/bin/flash_erase /dev/mtd4 0 1");
+	system("/usr/sbin/nandwrite -p /dev/mtd4 /root/am335x-evm.dtb");
+
+	system("/bin/flash_erase /dev/mtd5 0 1");
+	system("/usr/sbin/nandwrite -p /dev/mtd5 /root/am335x-evm.dtb");
+        
+        
+        sprintf(buf_log_fwupdate, "[DTB]mtdblock4 - written length: %d bytes\n", wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+#if 0
+        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;
+                }
+            }
+        }
+#endif        
+    }
+    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);
+        
+	
+	system("/bin/flash_erase /dev/mtd6 0 20");
+	system("/usr/sbin/nandwrite -p /dev/mtd6 /root/zImage");
+
+	system("/bin/flash_erase /dev/mtd7 0 20");
+	system("/usr/sbin/nandwrite -p /dev/mtd7 /root/zImage");
+        
+        sprintf(buf_log_fwupdate, "[zImage]mtdblock6 - written length: %d bytes\n", wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+#if 0
+        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;
+                }
+            }
+        }
+#endif        
+    }
+    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);
+        
+
+       system("/bin/flash_erase /dev/mtd8 0 96");
+       system("/usr/sbin/nandwrite -p /dev/mtd8 /root/ramdisk.gz");
+
+       system("/bin/flash_erase /dev/mtd9 0 96");
+       system("/usr/sbin/nandwrite -p /dev/mtd9 /root/ramdisk.gz");
+                                	
+                                	
+        sprintf(buf_log_fwupdate, "[ramdisk]mtdblock8 - written length: %d bytes\n", wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+#if 0      
+        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
+            }
+        }
+#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);
+        system("/bin/flash_erase /dev/mtd10 0 12");
+	system("/usr/sbin/nandwrite -p /dev/mtd10 /root/FactoryConfig.bin");
+
+	system("/bin/flash_erase /dev/mtd11 0 12");
+	system("/usr/sbin/nandwrite -p /dev/mtd11 /root/FactoryConfig.bin");
+									
+        sprintf(buf_log_fwupdate,
+                "[user_config]mtdblock10 - written length: %d bytes\n",
+                wrd);
+        SAVE_SYS_LOG_MSG_FWUPDATE(buf_log_fwupdate);
+#if 0      
+        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;
+                }
+            }
+        }
+#endif        
+    }
+    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/NoodoeAX/Apps/CCS/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

+ 211 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/FactoryConfig.c

@@ -0,0 +1,211 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                            FactoryConfig.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 <unistd.h>
+#include "define.h"
+#include "FactoryConfig.h"
+
+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
+
+
+/**************************************************************************************/
+/************This task will create Factory default confgiuration file *****************/
+/***********and store it into mtdblock 10,11,12                               ****************/
+/**************************************************************************************/
+
+int main(int argc, char *argv[])
+{
+    struct SysConfigData SysConfig;
+    unsigned int i, Chk;
+    unsigned char *ptr;
+    int fd, wrd;
+
+    ptr = malloc(sizeof(struct SysConfigData));
+
+    if(ptr == NULL)
+    {
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: malloc for SysConfigData NG");
+        return 0;
+    }
+
+    memset(ptr, 0, sizeof(struct SysConfigData));
+    memset(&SysConfig, 0, sizeof(struct SysConfigData));
+
+    //Set default configuration
+    strcpy(SysConfig.Eth0Interface.EthIpAddress, "192.168.0.11");
+    strcpy(SysConfig.Eth0Interface.EthSubmaskAddress, "255.255.255.0");
+    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.0.1");
+    SysConfig.BackendConnTimeout = 300; //300 seconds
+
+    //copy default configuration to pointer
+    memcpy(ptr, &SysConfig, sizeof(struct SysConfigData));
+
+    //calculate CRC
+    Chk = 0;
+
+    for(i = 0; i < (sizeof(struct SysConfigData) - 4); i++)
+    {
+        Chk += *(ptr + i);
+    }
+
+    SysConfig.Checksum = Chk;
+
+    fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR | O_CREAT);
+
+    if(fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: open /mnt/FactoryDefaultConfig.bin NG");
+
+        free(ptr);
+        return 0;
+    }
+
+    wrd = write(fd, &SysConfig, sizeof(struct SysConfigData));
+    close(fd);
+
+    if(wrd != (sizeof(struct SysConfigData)))
+    {
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: write /mnt/FactoryDefaultConfig.bin NG");
+
+        free(ptr);
+        return 0;
+    }
+
+    fd = open("/dev/mtdblock12", O_RDWR);
+
+    if(fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: open /dev/mtdblock12 NG");
+
+        free(ptr);
+        return 0;
+    }
+
+    wrd = write(fd, &SysConfig, sizeof(struct SysConfigData));
+    close(fd);
+
+    if(wrd != (sizeof(struct SysConfigData)))
+    {
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: write /dev/mtdblock12 NG");
+
+        free(ptr);
+        return 0;
+    }
+
+    fd = open("/dev/mtdblock11", O_RDWR);
+
+    if(fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: open /dev/mtdblock11 NG");
+
+        free(ptr);
+        return 0;
+    }
+
+    wrd = write(fd, &SysConfig, sizeof(struct SysConfigData));
+    close(fd);
+
+    if(wrd != (sizeof(struct SysConfigData)))
+    {
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: write /dev/mtdblock11 NG");
+
+        free(ptr);
+        return 0;
+    }
+
+    fd = open("/dev/mtdblock10", O_RDWR);
+
+    if(fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: open /dev/mtdblock10 NG");
+
+        free(ptr);
+        return 0;
+    }
+
+    wrd = write(fd, &SysConfig, sizeof(struct SysConfigData));
+    close(fd);
+
+    if(wrd != (sizeof(struct SysConfigData)))
+    {
+        SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: write /dev/mtdblock10 NG");
+
+        free(ptr);
+        return 0;
+    }
+
+    free(ptr);
+
+    SAVE_SYS_LOG_MSG_FACTORY_CONFIG("[FactoryConfig]main: FactoryConfig OK");
+}

+ 61 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/FactoryConfig.h

@@ -0,0 +1,61 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                            FactoryConfig.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_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

+ 149 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/Makefile

@@ -0,0 +1,149 @@
+#===========================================================================
+#                    Combined Charging System (CCS): SECC
+#                                 Makefile
+
+#                        initiated by Vern, Joseph
+#                           (since 2019/07/19)
+#=============================================================================
+	
+ifeq ($(CCSType),AWCCS)
+-include ../../../../../Rules.make
+export PATH=/bin:/sbin:/usr/bin:$(SDK_PATH_TARGET)/usr/bin:$PATH
+SSL_PATH= ../../../../GPL/openssl-1.0.2g/
+CFLAGS=-I$(SSL_PATH)include -L$(SSL_PATH)lib/ -lcrypto -lssl
+else
+-include ../Rules.make
+export PATH=/bin:/sbin:/usr/bin:$(SDK_PATH_TARGET)/usr/bin:$PATH
+SSL_PATH= ../../../GPL/openssl-1.0.2g/
+CFLAGS=-I$(SSL_PATH)include -L$(SSL_PATH)lib/ -lcrypto -lssl
+endif
+
+EXI_ENGINE =	exi_engine/api/api.c \
+				exi_engine/appHandshake/appHandEXIDatatypes.c \
+				exi_engine/appHandshake/appHandEXIDatatypesDecoder.c \
+				exi_engine/appHandshake/appHandEXIDatatypesEncoder.c \
+				exi_engine/codec/BitInputStream.c \
+				exi_engine/codec/BitOutputStream.c \
+				exi_engine/codec/ByteStream.c \
+				exi_engine/codec/DecoderChannel.c \
+				exi_engine/codec/EncoderChannel.c \
+				exi_engine/codec/EXIHeaderDecoder.c \
+				exi_engine/codec/EXIHeaderEncoder.c \
+				exi_engine/codec/MethodsBag.c \
+				exi_engine/din/dinEXIDatatypes.c \
+				exi_engine/din/dinEXIDatatypesDecoder.c \
+				exi_engine/din/dinEXIDatatypesEncoder.c \
+				exi_engine/iso1/iso1EXIDatatypes.c \
+				exi_engine/iso1/iso1EXIDatatypesDecoder.c \
+				exi_engine/iso1/iso1EXIDatatypesEncoder.c \
+				exi_engine/iso2/iso2EXIDatatypes.c \
+				exi_engine/iso2/iso2EXIDatatypesDecoder.c \
+				exi_engine/iso2/iso2EXIDatatypesEncoder.c \
+				exi_engine/transport/v2gtp.c \
+				exi_engine/xmldsig/xmldsigEXIDatatypes.c \
+				exi_engine/xmldsig/xmldsigEXIDatatypesDecoder.c \
+				exi_engine/xmldsig/xmldsigEXIDatatypesEncoder.c
+
+all: init secc
+ifeq ($(CCSType),AWCCS)
+secc:  CsuCommTask SeccCommTask 
+else
+secc: MainTask SeccCommTask CsuCommTask FactoryConfigTask FWUpdateTask PCBATesterTask
+endif
+
+evcc: MainTask EvccCommTask CsuCommTask FactoryConfigTask FWUpdateTask PCBATesterTask
+#secc: MainTask CsuCommTask FactoryConfigTask SeccCommTask FWUpdateTask FWMakerTask EventLoggingTask
+
+MainTask:
+	rm -f main
+	$(CC) main.c -lm -o main
+	cp -f main ../Images/root
+	rm -f main
+
+CsuCommTask:
+ifeq ($(CCSType),AWCCS)
+	rm -f CsuComm
+	@echo "=============== Make AC CsuCommTask==========================="
+	$(CC) -D $(CCSType) CsuComm.c ${EXI_ENGINE} -lm -o CsuComm
+	cp -f CsuComm ../../Images/root
+else
+	@echo "=============== Make DC CsuCommTask==========================="
+	rm -f CsuComm
+	$(CC) CsuComm.c ${EXI_ENGINE} -lm -o CsuComm
+	cp -f CsuComm ../Images/root
+endif
+#	rm -f CsuComm
+
+SeccCommTask:
+	rm -f SeccComm
+ifeq ($(CCSType),AWCCS)
+	@echo "=============== Make AC SeccCommTask==========================="
+	$(CC) -D $(CCSType) SeccComm.c NidNmk.c ${EXI_ENGINE} -lm -o SeccComm $(CFLAGS)
+	cp -f SeccComm ../../Images/root
+	cp -f cacert.pem ../../Images/root
+	cp -f cakey.pem ../../Images/root
+else
+	@echo "=============== Make DC SeccCommTask==========================="
+	$(CC) SeccComm.c NidNmk.c ${EXI_ENGINE} -lm -o SeccComm $(CFLAGS)
+	cp -f SeccComm ../Images/root
+	cp -f cacert.pem ../Images/root
+	cp -f cakey.pem ../Images/root
+endif
+#	rm -f SeccComm
+
+FactoryConfigTask:
+	rm -f FactoryConfig
+	$(CC) FactoryConfig.c -o FactoryConfig
+	cp -f FactoryConfig ../Images/root
+	rm -f FactoryConfig
+	
+EvccCommTask:
+	rm -f EvccComm
+	$(CC) EvccComm.c NidNmk.c ${EXI_ENGINE} -lm -o EvccComm
+	cp -f EvccComm ../Images/root
+	rm -f EvccComm
+
+FWUpdateTask:
+	rm -f FWUpdate
+	$(CC) FWUpdate.c -o FWUpdate
+	cp -f FWUpdate ../Images/root
+	rm -f FWUpdate
+
+EventLoggingTask:
+	rm -f EventLogging
+	$(CC) EventLogging.c -o EventLogging
+	cp -f EventLogging ../Images/root
+	rm -f EventLogging
+
+FWMakerTask:
+	rm -f FWMaker
+	$(CC) FWMaker.c -o FWMaker
+	cp -f FWMaker ../Images/root
+	rm -f FWMaker
+
+PCBATesterTask:
+	rm -f PCBATester
+	$(CC) PCBATester.c -lm -o PCBATester
+	cp -f PCBATester ../Images/root
+	rm -f PCBATester
+
+init:
+ifeq ($(CCSType),AWCCS)
+	rm -rfv ../../Images/root
+	mkdir -p ../../Images/root
+else
+	rm -rfv ../Images/root
+	mkdir -p ../Images/root
+endif
+#	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

+ 341 - 300
EVSE/Projects/NoodoeAX/Apps/CCS/NidNmk.c

@@ -1,300 +1,341 @@
-/*===========================================================================
-                    Combined Charging System (CCS): SECC
-                                NidNmk.c
-
-                        initiated by Vern, Joseph
-                           (since 2019/07/19)
-=============================================================================*/
-#include <time.h>
-#include <sys/time.h>
-#include "NidNmk.h"
-
-/*===========================================================================
-FUNCTION: StoreLogMsg
-DESCRIPTION:
-PRE-CONDITION:
-INPUT:
-OUTPUT:
-GLOBAL VARIABLES:
-=============================================================================*/
-void HPAVKeyNMK(uint8_t NMK [], const char *string)
-
-{
-    struct sha256 sha256;
-    uint8_t digest [SHA256_DIGEST_LENGTH];
-    const uint8_t secret [] =
-    {
-        0x08,
-        0x85,
-        0x6D,
-        0xAF,
-        0x7C,
-        0xF5,
-        0x81,
-        0x86
-    };
-    unsigned rehash = 999;
-
-    SHA256Reset(&sha256);
-    SHA256Write(&sha256, string, strlen(string));
-    SHA256Write(&sha256, secret, sizeof(secret));
-    SHA256Fetch(&sha256, digest);
-
-    while(rehash--)
-    {
-        SHA256Reset(&sha256);
-        SHA256Write(&sha256, digest, sizeof(digest));
-        SHA256Fetch(&sha256, digest);
-    }
-
-    memcpy(NMK, digest, HPAVKEY_NMK_LEN);
-    return;
-}
-
-void HPAVKeyNID(uint8_t NID[], const uint8_t NMK[], uint8_t level)
-{
-    struct sha256 sha256;
-    uint8_t digest [SHA256_DIGEST_LENGTH];
-    unsigned int rehash = 4;
-
-    SHA256Reset(&sha256);
-    SHA256Write(&sha256, NMK, HPAVKEY_NMK_LEN);
-    SHA256Fetch(&sha256, digest);
-
-    while(rehash--)
-    {
-        SHA256Reset(&sha256);
-        SHA256Write(&sha256, digest, sizeof(digest));
-        SHA256Fetch(&sha256, digest);
-    }
-
-    #if 1
-
-        level <<= 4;
-        digest [HPAVKEY_NID_LEN - 1] >>= 4;
-        digest [HPAVKEY_NID_LEN - 1] |= level;
-
-    #else
-
-        digest [HPAVKEY_NID_LEN - 1] &= ~0xC0;
-        digest [HPAVKEY_NID_LEN - 1] |= level << 6;
-
-    #endif
-
-    memcpy(NID, digest, HPAVKEY_NID_LEN);
-
-    return;
-}
-
-void SHA256Reset(struct sha256 *sha256)
-
-{
-    memset(sha256, 0, sizeof(struct sha256));
-    sha256->state [0] = 0x6A09E667;
-    sha256->state [1] = 0xBB67AE85;
-    sha256->state [2] = 0x3C6EF372;
-    sha256->state [3] = 0xA54FF53A;
-    sha256->state [4] = 0x510E527F;
-    sha256->state [5] = 0x9B05688C;
-    sha256->state [6] = 0x1F83D9AB;
-    sha256->state [7] = 0x5BE0CD19;
-    sha256->extra [0] = 0x80;
-    return;
-}
-
-void SHA256Block(struct sha256 *sha256, void const *memory)
-{
-    static const uint32_t K [sizeof(sha256->block)] =
-    {
-        0x428A2F98,
-        0x71374491,
-        0xB5C0FBCF,
-        0xE9B5DBA5,
-        0x3956C25B,
-        0x59F111F1,
-        0x923F82A4,
-        0xAB1C5ED5,
-        0xD807AA98,
-        0x12835B01,
-        0x243185BE,
-        0x550C7DC3,
-        0x72BE5D74,
-        0x80DEB1FE,
-        0x9BDC06A7,
-        0xC19BF174,
-        0xE49B69C1,
-        0xEFBE4786,
-        0x0FC19DC6,
-        0x240CA1CC,
-        0x2DE92C6F,
-        0x4A7484AA,
-        0x5CB0A9DC,
-        0x76F988DA,
-        0x983E5152,
-        0xA831C66D,
-        0xB00327C8,
-        0xBF597FC7,
-        0xC6E00BF3,
-        0xD5A79147,
-        0x06CA6351,
-        0x14292967,
-        0x27B70A85,
-        0x2E1B2138,
-        0x4D2C6DFC,
-        0x53380D13,
-        0x650A7354,
-        0x766A0ABB,
-        0x81C2C92E,
-        0x92722C85,
-        0xA2BFE8A1,
-        0xA81A664B,
-        0xC24B8B70,
-        0xC76C51A3,
-        0xD192E819,
-        0xD6990624,
-        0xF40E3585,
-        0x106AA070,
-        0x19A4C116,
-        0x1E376C08,
-        0x2748774C,
-        0x34B0BCB5,
-        0x391C0CB3,
-        0x4ED8AA4A,
-        0x5B9CCA4F,
-        0x682E6FF3,
-        0x748F82EE,
-        0x78A5636F,
-        0x84C87814,
-        0x8CC70208,
-        0x90BEFFFA,
-        0xA4506CEB,
-        0xBEF9A3F7,
-        0xC67178F2
-    };
-    unsigned int pass;
-    unsigned int word;
-    uint32_t H [sizeof(sha256->state) / sizeof(uint32_t)];
-    uint32_t W [sizeof(sha256->block)];
-    uint8_t *buffer = (uint8_t *)(memory);
-
-    for(word = 0; word < 16; word++)
-    {
-        W [word] = 0;
-        W [word] |= (uint32_t)(*buffer++) << 24;
-        W [word] |= (uint32_t)(*buffer++) << 16;
-        W [word] |= (uint32_t)(*buffer++) << 8;
-        W [word] |= (uint32_t)(*buffer++) << 0;;
-    }
-
-    for(; word < sizeof(sha256->block); word++)
-    {
-        uint32_t s0 = ROTR(W [word - 15], 7) ^ ROTR(W [word - 15], 18) ^ SHR(W [word - 15], 3);
-        uint32_t s1 = ROTR(W [word - 2], 17) ^ ROTR(W [word - 2], 19) ^ SHR(W [word - 2], 10);
-        W [word] = W [word - 16] + s0 + W [word - 7] + s1;
-    }
-
-    for(word = 0; word < (sizeof(sha256->state) / sizeof(uint32_t)); word++)
-    {
-        H [word] = sha256->state [word];
-    }
-
-    for(pass = 0; pass < sizeof(sha256->block); pass++)
-    {
-        uint32_t s2 = ROTR(H [0], 2) ^ ROTR(H [0], 13) ^ ROTR(H [0], 22);
-        uint32_t maj = (H [0] & H [1]) ^ (H [0] & H [2]) ^ (H [1] & H [2]);
-        uint32_t t2 = s2 + maj;
-        uint32_t s3 = ROTR(H [4], 6) ^ ROTR(H [4], 11) ^ ROTR(H [4], 25);
-        uint32_t ch = (H [4] & H [5]) ^ ((~H [4]) & H [6]);
-        uint32_t t1 = H [7] + s3 + ch + K [pass] + W [pass];
-
-        for(word = (sizeof(sha256->state) / sizeof(uint32_t)) - 1; word > 0; word--)
-        {
-            H [word] = H [word - 1];
-        }
-
-        H [0] = t1 + t2;
-        H [4] += t1;
-    }
-
-    for(word = 0; word < (sizeof(sha256->state) / sizeof(uint32_t)); word++)
-    {
-        sha256->state [word] += H [word];
-    }
-
-    return;
-}
-
-void SHA256Write(struct sha256 *sha256, void const *memory, uint16_t extent)
-
-{
-    if(extent)
-    {
-        uint8_t *buffer = (uint8_t *)(memory);
-        unsigned int left = sha256->count [0] & 0x3F;
-        unsigned int fill = sizeof(sha256->block) - left;
-        sha256->count [0] += (uint32_t)(extent);
-        sha256->count [0] &= 0xFFFFFFFF;
-
-        if(sha256->count [0] < extent)
-        {
-            sha256->count [1]++;
-        }
-
-        if((left) && (extent >= fill))
-        {
-            memcpy(sha256->block + left, buffer, fill);
-            SHA256Block(sha256, sha256->block);
-            extent -= fill;
-            buffer += fill;
-            left = 0;
-        }
-
-        while(extent >= sizeof(sha256->block))
-        {
-            SHA256Block(sha256, buffer);
-            extent -= sizeof(sha256->block);
-            buffer += sizeof(sha256->block);
-        }
-
-        if(extent)
-        {
-            memcpy(sha256->block + left, buffer, extent);
-        }
-    }
-
-    return;
-}
-
-void SHAEncode(uint8_t memory[], uint32_t number)
-{
-    *memory++ = (uint8_t)(number >> 24);
-    *memory++ = (uint8_t)(number >> 16);
-    *memory++ = (uint8_t)(number >> 8);
-    *memory++ = (uint8_t)(number >> 0);
-    return;
-}
-
-void SHA256Fetch(struct sha256 *sha256, uint8_t digest[])
-
-{
-    unsigned int word;
-    uint8_t bits [8];
-    uint32_t upper = (sha256->count [0] >> 29) | (sha256->count [1] << 3);
-    uint32_t lower = (sha256->count [0] << 3);
-    uint32_t final = (sha256->count [0] & 0x3F);
-    uint32_t extra = (final < 56) ? (56 - final) : (120 - final);
-
-    SHAEncode(&bits[0], upper);
-    SHAEncode(&bits[4], lower);
-    SHA256Write(sha256, sha256->extra, extra);
-    SHA256Write(sha256, bits, sizeof(bits));
-
-    for(word = 0; word < sizeof(sha256->state) / sizeof(uint32_t); word++)
-    {
-        SHAEncode(digest, sha256->state [word]);
-        digest += sizeof(uint32_t);
-    }
-
-    memset(sha256, 0, sizeof(struct sha256));
-    return;
-}
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                NidNmk.c
+
+                        initiated by Vern, Joseph
+                           (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)
+
+{
+    struct sha256 sha256;
+    uint8_t digest [SHA256_DIGEST_LENGTH];
+    const uint8_t secret [] =
+    {
+        0x08,
+        0x85,
+        0x6D,
+        0xAF,
+        0x7C,
+        0xF5,
+        0x81,
+        0x86
+    };
+    unsigned rehash = 999;
+
+    SHA256Reset(&sha256);
+    SHA256Write(&sha256, string, strlen(string));
+    SHA256Write(&sha256, secret, sizeof(secret));
+    SHA256Fetch(&sha256, digest);
+
+    while(rehash--)
+    {
+        SHA256Reset(&sha256);
+        SHA256Write(&sha256, digest, sizeof(digest));
+        SHA256Fetch(&sha256, digest);
+    }
+
+    memcpy(NMK, digest, HPAVKEY_NMK_LEN);
+    return;
+}
+
+
+void HPAVKeyNID(uint8_t NID[], const uint8_t NMK[], uint8_t level)
+
+{
+    struct sha256 sha256;
+    uint8_t digest [SHA256_DIGEST_LENGTH];
+    unsigned int rehash = 4;
+
+    SHA256Reset(&sha256);
+    SHA256Write(&sha256, NMK, HPAVKEY_NMK_LEN);
+    SHA256Fetch(&sha256, digest);
+
+    while(rehash--)
+    {
+        SHA256Reset(&sha256);
+        SHA256Write(&sha256, digest, sizeof(digest));
+        SHA256Fetch(&sha256, digest);
+    }
+
+    #if 1
+
+        level <<= 4;
+        digest [HPAVKEY_NID_LEN - 1] >>= 4;
+        digest [HPAVKEY_NID_LEN - 1] |= level;
+
+    #else
+
+        digest [HPAVKEY_NID_LEN - 1] &= ~0xC0;
+        digest [HPAVKEY_NID_LEN - 1] |= level << 6;
+
+    #endif
+
+    memcpy(NID, digest, HPAVKEY_NID_LEN);
+
+    return;
+}
+
+void SHA256Reset(struct sha256 *sha256)
+
+{
+    memset(sha256, 0, sizeof(struct sha256));
+    sha256->state [0] = 0x6A09E667;
+    sha256->state [1] = 0xBB67AE85;
+    sha256->state [2] = 0x3C6EF372;
+    sha256->state [3] = 0xA54FF53A;
+    sha256->state [4] = 0x510E527F;
+    sha256->state [5] = 0x9B05688C;
+    sha256->state [6] = 0x1F83D9AB;
+    sha256->state [7] = 0x5BE0CD19;
+    sha256->extra [0] = 0x80;
+    return;
+}
+void SHA256Block(struct sha256 *sha256, void const *memory)
+
+{
+    static const uint32_t K [sizeof(sha256->block)] =
+    {
+        0x428A2F98,
+        0x71374491,
+        0xB5C0FBCF,
+        0xE9B5DBA5,
+        0x3956C25B,
+        0x59F111F1,
+        0x923F82A4,
+        0xAB1C5ED5,
+        0xD807AA98,
+        0x12835B01,
+        0x243185BE,
+        0x550C7DC3,
+        0x72BE5D74,
+        0x80DEB1FE,
+        0x9BDC06A7,
+        0xC19BF174,
+        0xE49B69C1,
+        0xEFBE4786,
+        0x0FC19DC6,
+        0x240CA1CC,
+        0x2DE92C6F,
+        0x4A7484AA,
+        0x5CB0A9DC,
+        0x76F988DA,
+        0x983E5152,
+        0xA831C66D,
+        0xB00327C8,
+        0xBF597FC7,
+        0xC6E00BF3,
+        0xD5A79147,
+        0x06CA6351,
+        0x14292967,
+        0x27B70A85,
+        0x2E1B2138,
+        0x4D2C6DFC,
+        0x53380D13,
+        0x650A7354,
+        0x766A0ABB,
+        0x81C2C92E,
+        0x92722C85,
+        0xA2BFE8A1,
+        0xA81A664B,
+        0xC24B8B70,
+        0xC76C51A3,
+        0xD192E819,
+        0xD6990624,
+        0xF40E3585,
+        0x106AA070,
+        0x19A4C116,
+        0x1E376C08,
+        0x2748774C,
+        0x34B0BCB5,
+        0x391C0CB3,
+        0x4ED8AA4A,
+        0x5B9CCA4F,
+        0x682E6FF3,
+        0x748F82EE,
+        0x78A5636F,
+        0x84C87814,
+        0x8CC70208,
+        0x90BEFFFA,
+        0xA4506CEB,
+        0xBEF9A3F7,
+        0xC67178F2
+    };
+    unsigned int pass;
+    unsigned int word;
+    uint32_t H [sizeof(sha256->state) / sizeof(uint32_t)];
+    uint32_t W [sizeof(sha256->block)];
+    uint8_t *buffer = (uint8_t *)(memory);
+
+    for(word = 0; word < 16; word++)
+    {
+        W [word] = 0;
+        W [word] |= (uint32_t)(*buffer++) << 24;
+        W [word] |= (uint32_t)(*buffer++) << 16;
+        W [word] |= (uint32_t)(*buffer++) << 8;
+        W [word] |= (uint32_t)(*buffer++) << 0;;
+    }
+
+    for(word = word; word < sizeof(sha256->block); word++)
+    {
+        uint32_t s0 = ROTR(W [word - 15], 7) ^ ROTR(W [word - 15], 18) ^ SHR(W [word - 15], 3);
+        uint32_t s1 = ROTR(W [word - 2], 17) ^ ROTR(W [word - 2], 19) ^ SHR(W [word - 2], 10);
+        W [word] = W [word - 16] + s0 + W [word - 7] + s1;
+    }
+
+    for(word = 0; word < (sizeof(sha256->state) / sizeof(uint32_t)); word++)
+    {
+        H [word] = sha256->state [word];
+    }
+
+    for(pass = 0; pass < sizeof(sha256->block); pass++)
+    {
+        uint32_t s2 = ROTR(H [0], 2) ^ ROTR(H [0], 13) ^ ROTR(H [0], 22);
+        uint32_t maj = (H [0] & H [1]) ^ (H [0] & H [2]) ^ (H [1] & H [2]);
+        uint32_t t2 = s2 + maj;
+        uint32_t s3 = ROTR(H [4], 6) ^ ROTR(H [4], 11) ^ ROTR(H [4], 25);
+        uint32_t ch = (H [4] & H [5]) ^ ((~H [4]) & H [6]);
+        uint32_t t1 = H [7] + s3 + ch + K [pass] + W [pass];
+
+        for(word = (sizeof(sha256->state) / sizeof(uint32_t)) - 1; word > 0; word--)
+        {
+            H [word] = H [word - 1];
+        }
+
+        H [0] = t1 + t2;
+        H [4] += t1;
+    }
+
+    for(word = 0; word < (sizeof(sha256->state) / sizeof(uint32_t)); word++)
+    {
+        sha256->state [word] += H [word];
+    }
+
+    return;
+}
+
+void SHA256Write(struct sha256 *sha256, void const *memory, uint16_t extent)
+
+{
+    if(extent)
+    {
+        uint8_t *buffer = (uint8_t *)(memory);
+        unsigned int left = sha256->count [0] & 0x3F;
+        unsigned int fill = sizeof(sha256->block) - left;
+        sha256->count [0] += (uint32_t)(extent);
+        sha256->count [0] &= 0xFFFFFFFF;
+
+        if(sha256->count [0] < extent)
+        {
+            sha256->count [1]++;
+        }
+
+        if((left) && (extent >= fill))
+        {
+            memcpy(sha256->block + left, buffer, fill);
+            SHA256Block(sha256, sha256->block);
+            extent -= fill;
+            buffer += fill;
+            left = 0;
+        }
+
+        while(extent >= sizeof(sha256->block))
+        {
+            SHA256Block(sha256, buffer);
+            extent -= sizeof(sha256->block);
+            buffer += sizeof(sha256->block);
+        }
+
+        if(extent)
+        {
+            memcpy(sha256->block + left, buffer, extent);
+        }
+    }
+
+    return;
+}
+void SHAEncode(uint8_t memory[], uint32_t number)
+
+{
+    *memory++ = (uint8_t)(number >> 24);
+    *memory++ = (uint8_t)(number >> 16);
+    *memory++ = (uint8_t)(number >> 8);
+    *memory++ = (uint8_t)(number >> 0);
+    return;
+}
+
+void SHA256Fetch(struct sha256 *sha256, uint8_t digest[])
+
+{
+    unsigned int word;
+    uint8_t bits [8];
+    uint32_t upper = (sha256->count [0] >> 29) | (sha256->count [1] << 3);
+    uint32_t lower = (sha256->count [0] << 3);
+    uint32_t final = (sha256->count [0] & 0x3F);
+    uint32_t extra = (final < 56) ? (56 - final) : (120 - final);
+
+    SHAEncode(&bits[0], upper);
+    SHAEncode(&bits[4], lower);
+    SHA256Write(sha256, sha256->extra, extra);
+    SHA256Write(sha256, bits, sizeof(bits));
+
+    for(word = 0; word < sizeof(sha256->state) / sizeof(uint32_t); word++)
+    {
+        SHAEncode(digest, sha256->state [word]);
+        digest += sizeof(uint32_t);
+    }
+
+    memset(sha256, 0, sizeof(struct sha256));
+    return;
+}

+ 94 - 40
EVSE/Projects/NoodoeAX/Apps/CCS/NidNmk.h

@@ -1,40 +1,94 @@
-/*===========================================================================
-                    Combined Charging System (CCS): SECC
-                                 NidNmk.h
-
-                        initiated by Vern, Joseph
-                           (since 2019/07/19)
-=============================================================================*/
-
-#include <stdint.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-
-typedef struct sha256
-{
-
-    uint32_t count [2];
-    uint32_t state [8];
-    uint8_t block [64];
-    uint8_t extra [64];
-
-} SHA256;
-
-#define SHA256_DIGEST_LENGTH 256 / 8
-#define HPAVKEY_NMK_LEN 16
-#define HPAVKEY_NID_LEN 7
-#define SHR(word, bits) ((word & 0xFFFFFFFF) >> bits)
-#define ROTR(word, bits) (SHR(word, bits) | (word << (32 - bits)))
-#define DEFAULT_LEVEL 0
-//--------------------------------------------------------------------------
-/* Functions -----------------------------------------------------------*/
-//--------------------------------------------------------------------------
-void HPAVKeyNMK(uint8_t NMK [], const char *string);
-void HPAVKeyNID(uint8_t NID [], const uint8_t NMK [], uint8_t level);
-void SHA256Reset(struct sha256 *sha256);
-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 []);
-
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 NidNmk.h
+
+                        initiated by Vern, Joseph
+                           (since 2019/07/19)
+=============================================================================*/
+
+#include <stdint.h>
+#include <unistd.h>
+#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
+{
+
+    uint32_t count [2];
+    uint32_t state [8];
+    uint8_t block [64];
+    uint8_t extra [64];
+
+} NidSHA256;
+
+#define SHA256_DIGEST_LENGTH 256 / 8
+#define HPAVKEY_NMK_LEN 16
+#define HPAVKEY_NID_LEN 7
+#define SHR(word, bits) ((word & 0xFFFFFFFF) >> bits)
+#define ROTR(word, bits) (SHR(word, bits) | (word << (32 - bits)))
+#define DEFAULT_LEVEL 0
+//--------------------------------------------------------------------------
+/* Functions -----------------------------------------------------------*/
+//--------------------------------------------------------------------------
+void HPAVKeyNMK(uint8_t NMK [], const char *string);
+void HPAVKeyNID(uint8_t NID [], const uint8_t NMK [], uint8_t level);
+void SHA256Reset(struct sha256 *sha256);
+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/NoodoeAX/Apps/CCS/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/NoodoeAX/Apps/CCS/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/NoodoeAX/Apps/CCS/SeccComm


+ 17999 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/SeccComm.c

@@ -0,0 +1,17999 @@
+/*===========================================================================
+                    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 <openssl/ssl.h>
+#include <openssl/err.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;
+#ifdef SUPPORT_TLS_CONNECTION
+SSL_CTX *ctx;
+SSL *ssl;
+unsigned char EvSecurity;
+#endif
+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];
+
+
+int writeStringToEXIString(unsigned char* string, exi_string_character_t* exiString)
+{
+	int pos = 0;
+	while(string[pos]!='\0')
+	{
+		exiString[pos] = string[pos];
+		pos++;
+	}
+
+	return pos;
+}
+/*===========================================================================
+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 StoreLogMsg2(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
+	#ifdef AWCCS
+    sprintf(Buf, "echo \"[%04d%02d%02d: %02d:%02d:%02d.%06d][SECC][%d][%02d]%s\" >> /Storage/SystemLog/[%04d.%02d]CCS-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);
+	#else
+	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);
+	#endif            
+    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;
+    }
+	#if 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;
+    }
+    #endif
+
+    //[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 < 30)  //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 = (1.8*AvgSample)/4095;    //PP
+	//CCS1: plug : 0.61<=V_pp<=1.18
+	//CCS2:plug : 1.2<=V_pp<=2.4
+        #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
+        {
+        	#ifdef AWCCS
+  			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
+        }
+        #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  <=1)
+            {
+                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))
+        {
+        	usleep(100000);
+            ccs->CpVoltage = ShmInternalComm->AC_CpPositiveVoltage;
+            ccs->CpState = ShmInternalComm->AC_CpPresentState;
+        }
+        #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
+        {
+		usleep(1000);
+            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);
+        #ifndef AWCCS
+        Check_CP_State_Error_fork1(ccs);
+		#endif
+        //Updating Plugin status
+        #if (PP_PROTECTION_MECHANISM == ENABLE)
+        if((ccs->CpState >= 2 ) && (ccs->CpState <= 5 ) && 
+           (ShmInternalComm->CCSConnectorType>0?((EVCOMM_SYS_INFO.PpVoltage > 1.2)&&(EVCOMM_SYS_INFO.PpVoltage <= 2.4)):((EVCOMM_SYS_INFO.PpVoltage > 0.61)&&(EVCOMM_SYS_INFO.PpVoltage <= 1.185)))
+        )
+        #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((( (ShmInternalComm->CCSConnectorType>0?((EVCOMM_SYS_INFO.PpVoltage > 1.2)&&(EVCOMM_SYS_INFO.PpVoltage <= 2.4)):((EVCOMM_SYS_INFO.PpVoltage > 0.61)&&(EVCOMM_SYS_INFO.PpVoltage <= 1.185))))&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].ConnectorPlugIn==FALSE))
+           	||(( (ShmInternalComm->CCSConnectorType>0?((EVCOMM_SYS_INFO.PpVoltage <= 1.2)||(EVCOMM_SYS_INFO.PpVoltage > 2.4)):((EVCOMM_SYS_INFO.PpVoltage <= 0.61)||(EVCOMM_SYS_INFO.PpVoltage > 1.185))))&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].ConnectorPlugIn==TRUE)))
+            {
+            	// plug-in : CCS1 (0.61 < V <1.185),  CCS2 (1.2 < V <2.4)
+                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;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+                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();
+            }
+        }
+	#if 0
+        //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();
+            }
+           
+        }
+        #endif
+	
+	#if 1
+        //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();
+            }
+        }
+	#endif
+        //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();
+        }
+		usleep(100000);
+    }//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
+		
+		            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);
+		            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_016]
+	                if (MmePacket->MMENTRY[3] != 0x06) //Time_Out must be 0x06 , (600ms)
+	                {
+	                    sprintf(buf_log_evcomm,
+	                            "[WARNING][SLAC][Rx][CM_START_ATTEN_CHAR_IND]Time_Out(%d): invalid => ignore Req",
+	                            MmePacket->MMENTRY[3]);
+	                    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))||(EVCOMM_SYS_INFO.CpState == 1))
+	                        {
+	                            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)
+	                            	if(ToggleNum==0)
+	                            		SendMmePacket.MMENTRY[SendMmePacketSize++] = 3;    //0x02 = Failure
+	                            	else	
+	                                	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_CM_AMP_MAP_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
+		
+		         //Check ODA (Destination Address)
+		            if (Array_Compare_Identity(CsuMac, MmePacket->ODA, SLAC_EVSE_MAC_LENGTH) == FALSE)
+		            {
+		                SAVE_SYS_LOG_MSG_EVCOMM("[SLAC][Rx][CM_AMP_MAP_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_AMP_MAP_REQ);
+		
+		                SLAC_INFO.array[idx].MatchReqNum++;
+		
+		                sprintf(buf_log_evcomm,
+		                        "[SLAC][Rx]CM_AMP_MAP_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] != 0x3A)||(MmePacket->MMENTRY[1] != 0))
+		                {
+		                    sprintf(buf_log_evcomm,
+		                            "[SLAC][Rx]CM_AMP_MAP_REQ[%d]:wrong AMLEN(%d)",
+		                            (idx + 1),
+		                            MmePacket->MMENTRY[0]);
+		                    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_AMP_MAP_CNF;
+		        	        SendMmePacket.FMI[0] = SendMmePacket.FMI[1] = 0;
+		        	        SendMmePacketSize = 0;
+		        	        SendMmePacket.MMENTRY[SendMmePacketSize++] = 0x00;    //success
+		        	     
+		                    	Update_V2G_Flow_Status(CM_AMP_MAP_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_AMP_MAP_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;
+		        }
+	
+	    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;
+	            }
+				ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp=RawSock;
+	            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 = TRUE;
+                        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) > ((CCS_ENERGY_TRANSFER_MODE<=1)?20: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 = TRUE;
+                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 = TRUE;
+                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 = TRUE;
+                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.
+	        {
+	        	// Alston - 2022/07/05 : Fix can't resend Atten_char_ind problem
+	         	if(EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry < 2)
+		        {
+		        	EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry++;
+		        	Update_V2G_Flow_Status(CM_MNBC_SOUND_IND);
+		        }
+		        else
+		        {	
+		        	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 = TRUE;
+	                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 = TRUE;
+		                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 = TRUE;
+		                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+	
+		            	Update_V2G_Flow_Status(Sequence_Timeout);
+		            	return -1;
+		        }
+	        	break;
+		}
+	    case CM_AMP_MAP_CNF:	
+	    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;
+		}
+		default:
+		{
+		    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;
+    #ifdef SUPPORT_TLS_CONNECTION
+    if(EvSecurity == 0)//support security
+    {	
+		rtn = SSL_write(ssl, v2g_tx_stream->data, v2g_tx_stream->size); 
+	}
+	else
+	{
+		rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+	}	
+	#else
+    rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+	#endif
+	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;
+    #ifdef SUPPORT_TLS_CONNECTION
+    if(EvSecurity == 0)//support security
+    {	
+		rtn = SSL_write(ssl, v2g_tx_stream->data, v2g_tx_stream->size); 
+	}
+	else
+	{
+		 rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+	}	
+	#else
+    rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+	#endif
+	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;
+    #ifdef SUPPORT_TLS_CONNECTION
+    if(EvSecurity == 0)//support security
+    {
+		rtn = SSL_write(ssl, v2g_tx_stream->data, v2g_tx_stream->size); 
+	}
+	else
+	{
+		rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+	}	
+	#else
+    rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+	#endif
+	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);
+			#ifdef AWCCS
+			continue;
+			#endif
+            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;
+	#ifdef SUPPORT_TLS_CONNECTION
+	if(EvSecurity == 0)//support security
+    {
+		Rtn = SSL_write(ssl, v2g_tx_stream.data, v2g_tx_stream.size); 
+	}
+	else
+	{
+		Rtn = send(AcceptFd, v2g_tx_stream.data, v2g_tx_stream.size, 0);
+	}	
+	#else
+	Rtn = send(AcceptFd, v2g_tx_stream.data, v2g_tx_stream.size, 0);
+	#endif
+    //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;
+    }
+    else 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	//Benz already CP=4
+    if ((sys->CpState < 2) ||(sys->CpState > 5))  //State B1, B2	//Benz already CP=4
+    {
+        #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;
+    }
+    else   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;
+    }
+    else 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;
+    }
+    else  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
+    #ifdef SUPPORT_ISO15118_PnC
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.PaymentOptionList.PaymentOption.arrayLen = 2u;
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.PaymentOptionList.PaymentOption.array[1] = iso1paymentOptionType_Contract; //0
+    #endif
+
+    //[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;   
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceName.charactersLen = strlen("AC_DC_Charging");//AC_Charging 
+    writeStringToEXIString("AC_DC_Charging", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceName.characters);
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceCategory = iso1serviceCategoryType_EVCharging;
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.FreeService = 1; 
+    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:
+        {
+        	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.array[0] = iso1EnergyTransferModeType_DC_extended;
+            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 
+    i=0;
+    #ifdef SUPPORT_ISO15118_PnC
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList_isUsed = 1u;
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.arrayLen=i;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceID = 2;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceName_isUsed = 1;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceName.charactersLen = strlen("Certificate");
+	writeStringToEXIString("Certificate", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceName.characters);
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceCategory = iso1serviceCategoryType_ContractCertificate;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].FreeService = 0;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.arrayLen++;
+	i++;
+    #endif
+    #ifdef SUPPORT_ISO15118_VAS
+  	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList_isUsed = 1u;
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.arrayLen=i;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceID = 3;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceName_isUsed = 1;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceName.charactersLen = strlen("InternetAccess");
+	writeStringToEXIString("InternetAccess", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceName.characters);
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceCategory = iso1serviceCategoryType_Internet;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].FreeService = 0;
+	ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.arrayLen++;
+	i++;
+	#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_iso1_ServiceDetailReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_ServiceDetailReq(int AcceptFd)
+{
+    int errn = 0;
+
+
+    //Save into Share Memory
+    SHM_Save_iso1_ServiceDetailReq(ShmCcsData, &ccs_exi_doc_ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_ServiceDetailRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]ServiceDetailRes");
+    }
+    else
+    {
+        sprintf(buf_log_evcomm,
+                "[Error][SeccComm][Proc_iso1_ServiceDetailReq]Proc_iso1_ServiceDetailRes(): %d (DEC)",
+                errn
+                );
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    }
+    return errn;
+}
+
+/*===========================================================================
+FUNCTION: Proc_iso1_ServiceDetailRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int Proc_iso1_ServiceDetailRes(int AcceptFd)
+{
+    int i = 0;
+    int errn = 0;
+    bitstream_t v2g_tx_stream;
+    struct ChargingInfoData *sys;
+    struct ServiceDetailRequest_ISO15118_2014 *req;
+    struct ServiceDetailResponse_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.ServiceDetailRequest;
+    res = &ShmCcsData->V2GMessage_ISO15118_2014.ServiceDetailResponse;
+
+    init_iso1BodyType(&ccs_exi_doc_ISO1.V2G_Message.Body);
+    init_iso1ServiceDetailResType(&ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes);
+    
+
+    //[1/4] Response Code
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes_isUsed = 1u;
+    ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.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.ServiceDetailRes.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.ServiceDetailRes.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.ServiceDetailRes.ResponseCode = iso1responseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Flow_Status(Other_Fault);
+        errn = -1;
+        sprintf(buf_log_evcomm,
+                "[ServiceDetailRes]Emergency Stop by CP Error (%d)",
+                sys->CpState);
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        #else
+        sprintf(buf_log_evcomm,
+                "[ServiceDetailRes]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.ServiceDetailRes.ResponseCode = iso1responseCodeType_FAILED;
+        SAVE_SYS_LOG_MSG_EVCOMM("[ServiceDetailRes]shutdown by EVSE");
+        errn = -1;
+    }
+    else  if (sys->DC_EVSEStatus == EVSE_Shutdown /*||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown*/)
+    {
+        ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ResponseCode = iso1responseCodeType_FAILED;
+        SAVE_SYS_LOG_MSG_EVCOMM("[ServiceDetailRes]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][ServiceDetailRes]Permission OFF");
+        ccs_exi_doc_DIN.V2G_Message.Body.ServiceDetailRes.ResponseCode = iso1responseCodeType_FAILED;
+      //  errn = -1;
+    }
+    switch (req->ServiceID)
+    {
+    	#ifdef SUPPORT_ISO15118_PnC
+    	case 2:
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceID = req->ServiceID;
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList_isUsed = 1;  
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.arrayLen = 2;//Installation(1), Update(2)
+    		//=============Set ParameterSet===================
+    		{
+    			unsigned char ServiceName[16];
+	    		for(int j=0;j<ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.arrayLen;j++)
+	    		{
+	    			memset(ServiceName,0,sizeof(ServiceName));
+	    			switch (j)
+	    			{
+	    				case 0://ftp with port 20
+	    					strcpy(ServiceName,"Installation");
+	    					break;
+	    				case 1://ftp with port 21
+	    					strcpy(ServiceName,"Update");
+	    					break;	
+	    				default:
+	    					break;	
+	    			}
+	    			if(strlen(ServiceName)>0)
+	    			{
+	    					ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].ParameterSetID=j+1;
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.arrayLen=1;//Service
+				    		//Name= Protocol
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[0].Name.charactersLen= strlen("Service");
+				    		writeStringToEXIString("Service", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[0].Name.characters);
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[0].stringValue_isUsed=1;
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[0].stringValue.charactersLen=strlen(ServiceName);
+				    		writeStringToEXIString(ServiceName, ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[0].stringValue.characters);
+	    			}
+	    			else
+	    				break;	
+	    		}//for
+    		}
+    		break;
+    	#endif	
+    	#ifdef SUPPORT_ISO15118_VAS
+    	case 3:
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceID = req->ServiceID;
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList_isUsed = 1;  
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.arrayLen = 4;//ftp(1), ftp(2), http(3), https(4)
+    		//=============Set ParameterSet===================
+    		{
+    			unsigned char ProtocolName[16];
+    			int ProtocolPort; 
+	    		for(int j=0;j<ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.arrayLen;j++)
+	    		{
+	    			memset(ProtocolName,0,sizeof(ProtocolName));
+	    			switch (j)
+	    			{
+	    				case 0://ftp with port 20
+	    					strcpy(ProtocolName,"ftp");
+	    					ProtocolPort=20;
+	    					break;
+	    				case 1://ftp with port 21
+	    					strcpy(ProtocolName,"ftp");
+	    					ProtocolPort=21;
+	    					break;	
+	    				case 2://http with port 80
+	    					strcpy(ProtocolName,"http");
+	    					ProtocolPort=80;
+	    					break;	
+	    				case 3://https with port 443
+	    					strcpy(ProtocolName,"https");
+	    					ProtocolPort=443;
+	    					break;		
+	    				default:
+	    					break;	
+	    			}
+	    			if(strlen(ProtocolName)>0)
+	    			{
+	    					ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].ParameterSetID=j+1;
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.arrayLen=2;//protocol and port
+				    		//Name= Protocol
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[0].Name.charactersLen= strlen("Protocol");
+				    		writeStringToEXIString("Protocol", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[0].Name.characters);
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[0].stringValue_isUsed=1;
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[0].stringValue.charactersLen=strlen(ProtocolName);
+				    		writeStringToEXIString(ProtocolName, ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[0].stringValue.characters);
+				    		//Name= Port
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[1].Name.charactersLen= strlen("Port");
+				    		writeStringToEXIString("Port", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[1].Name.characters);
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[1].intValue_isUsed=1;
+				    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[j].Parameter.array[1].intValue=ProtocolPort;
+	    			}
+	    			else
+	    				break;	
+	    		}//for
+    		}
+    		/*
+    		//=============http,ParameterSetID=3===================
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].ParameterSetID=3;//http
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.arrayLen=2;//protocol and port
+    		//Name= Protocol, value= "HTTP"
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.charactersLen= strlen("Protocol");
+    		writeStringToEXIString("Protocol", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters);
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].stringValue_isUsed=1;
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].stringValue.charactersLen=strlen("http");
+    		writeStringToEXIString("http", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].stringValue.characters);
+    		//Name= Port, value= 80
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.charactersLen= strlen("Port");
+    		writeStringToEXIString("Port", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.characters);
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].intValue_isUsed=1;
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].intValue=80;
+    		
+    		//==================https,ParameterSetID=4=====================
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].ParameterSetID=4;//https
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.arrayLen=2;//protocol and port
+    		//Name= Protocol, value= "HTTP"
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.charactersLen= strlen("Protocol");
+    		writeStringToEXIString("Protocol", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters);
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].stringValue_isUsed=1;
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].stringValue.charactersLen=strlen("https");
+    		writeStringToEXIString("https", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].stringValue.characters);
+    		//Name= Port, value= 443
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[1].Name.charactersLen= strlen("Port");
+    		writeStringToEXIString("Port", ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[1].Name.characters);
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[1].intValue_isUsed=1;
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[1].intValue=443;
+    		*/
+    		break;
+    	#endif	
+    	default:
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceID = req->ServiceID;
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ServiceParameterList_isUsed = 0;  
+    		ccs_exi_doc_ISO1.V2G_Message.Body.ServiceDetailRes.ResponseCode = iso1responseCodeType_FAILED_ServiceIDInvalid;
+    		break;	
+    }
+    // ============ 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;
+    }
+    else   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;
+    }
+	#ifdef SUPPORT_ISO15118_PnC
+	if (req->SelectedPaymentOption > iso1paymentOptionType_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;
+    }
+	#else
+    //Check for SelectedPaymentOption (TC_SECC_VTB_ServicePaymentSelection_007)
+    if (req->SelectedPaymentOption != iso1paymentOptionType_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;
+    }
+	#endif
+	
+	for(i=0;i<req->SelectedServiceList.SelectedServiceLen;i++)
+	{
+		switch(req->SelectedServiceList.SelectedService[i].ServiceID)
+		{
+			case 1:
+				break;
+			case 2:
+				#ifndef SUPPORT_ISO15118_PnC
+				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;
+				 #endif
+				 break;
+			case 3:
+				#ifndef SUPPORT_ISO15118_VAS
+				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;
+				 #endif
+				 break;			 
+			default:
+				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;
+			     break;
+		}
+	}
+    //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;
+    }
+    else  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, MIN_SUPPORTED_CURRENT*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;
+    }
+/*	printf("req->RequestedEnergyTransferMode=%d\n",req->RequestedEnergyTransferMode);
+	printf("req->AC_EVChargeParameter.DepartureTime=%d\n",req->AC_EVChargeParameter.DepartureTime);
+	
+	printf("req->AC_EVChargeParameter.EAmount.Multiplier=%d\n",req->AC_EVChargeParameter.EAmount.Multiplier);
+	printf("req->AC_EVChargeParameter.EAmount.Unit=%d\n",req->AC_EVChargeParameter.EAmount.Unit);
+	printf("req->AC_EVChargeParameter.EAmount.Value=%d\n",req->AC_EVChargeParameter.EAmount.Value);
+	
+	printf("req->AC_EVChargeParameter.EVMaxVoltage.Multiplier=%d\n",req->AC_EVChargeParameter.EVMaxVoltage.Multiplier);
+	printf("req->AC_EVChargeParameter.EVMaxVoltage.Unit=%d\n",req->AC_EVChargeParameter.EVMaxVoltage.Unit);
+	printf("req->AC_EVChargeParameter.EVMaxVoltage.Value=%d\n",req->AC_EVChargeParameter.EVMaxVoltage.Value);
+	
+	printf("req->AC_EVChargeParameter.EVMaxCurrent.Multiplier=%d\n",req->AC_EVChargeParameter.EVMaxCurrent.Multiplier);
+	printf("req->AC_EVChargeParameter.EVMaxCurrent.Unit=%d\n",req->AC_EVChargeParameter.EVMaxCurrent.Unit);
+	printf("req->AC_EVChargeParameter.EVMaxCurrent.Value=%d\n",req->AC_EVChargeParameter.EVMaxCurrent.Value);
+	
+	printf("req->AC_EVChargeParameter.EVMinCurrent.Multiplier=%d\n",req->AC_EVChargeParameter.EVMinCurrent.Multiplier);
+	printf("req->AC_EVChargeParameter.EVMinCurrent.Unit=%d\n",req->AC_EVChargeParameter.EVMinCurrent.Unit);
+	printf("req->AC_EVChargeParameter.EVMinCurrent.Value=%d\n",req->AC_EVChargeParameter.EVMinCurrent.Value);*/
+
+	if(req->RequestedEnergyTransferMode <= 1)//0 for 1P, 1 for 3P
+	{
+		//AC parameters
+		SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ChargeParameterDiscoveryRes]AC charging");
+		//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);
+	    SAVE_PhysicalValueType_ISO15118_2014(&ac_para->EVSEMaxCurrent, (int) (ShmInternalComm->AC_EVSEMaxCurrent * 10), A_ISO15118_2014);
+	}
+	else
+	{
+		//DC parameters
+		SAVE_SYS_LOG_MSG_EVCOMM("[Proc_iso1_ChargeParameterDiscoveryRes]DC charging");
+		//[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/MaxVolatge is mismatch(current=%.02f, voltage=%.02f) => End_Process",
+	                sys->EvBatteryMaxCurrent,sys->EvBatteryMaxVoltage);
+	        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, MIN_SUPPORTED_CURRENT*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
+	    
+	    #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
+		 //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
+	}		
+
+    //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 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
+    {
+    	#if 0
+        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
+          pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;  //1
+        #endif
+    }
+    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)
+    {
+    	#if 0
+        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
+          pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1
+        #endif
+    }
+    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;
+          errn = -1;
+    }
+    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;
+          errn = -1;
+    }
+    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)
+{
+	 struct ChargingInfoData *sys;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+    
+        
+    if (code != NO_ERROR)	//NO_ERROR = 0
+    {
+        //Asking CSU to Stop
+	    switch (code)
+	    {
+	        /*case dinDC_EVErrorCodeType_NO_ERROR:                           // = 0,
+	        {
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NO_ERROR)");
+	            break;
+	        }*/
+	    	case dinDC_EVErrorCodeType_FAILED_RESSTemperatureInhibit:      // = 1,
+	        {	//023737
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 7;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_RESSTemperatureInhibit)");
+	            break;
+	        }
+	    	case dinDC_EVErrorCodeType_FAILED_EVShiftPosition:             // = 2,
+	        {//023738
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVShiftPosition)");
+	            break;
+	        }
+	    	case dinDC_EVErrorCodeType_FAILED_ChargerConnectorLockFault:   // = 3,
+	        {
+	        	//023739
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ChargerConnectorLockFault)");
+	            break;
+	        }
+	    	case dinDC_EVErrorCodeType_FAILED_EVRESSMalfunction:           // = 4,
+	        {
+	        	//023740
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 0;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVRESSMalfunction)");
+	            break;
+	        }
+	    	case dinDC_EVErrorCodeType_FAILED_ChargingCurrentdifferential: // = 5,
+	        {
+	        	//023741
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 1;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingCurrentdifferential)");
+	            break;
+	        }
+	    	case dinDC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange:   // = 6,
+	        {
+	        	//023742
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 2;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingVoltageOutOfRange)");
+	            break;
+	        }
+	    	case dinDC_EVErrorCodeType_Reserved_A:                         // = 7,
+	        {
+	        	//023983
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_A)");
+	            break;
+	        }
+	    	case dinDC_EVErrorCodeType_Reserved_B:                         // = 8,
+	        {
+	        	//023983
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_B)");
+	            break;
+	        }
+	    	case dinDC_EVErrorCodeType_Reserved_C:                         // = 9,
+	        {
+	        	//023983
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_C)");
+	            break;
+	        }
+	    	case dinDC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility:// = 10,
+	        {
+	        	//023743
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingSystemIncompatibility)");
+	            break;
+	        }
+	    	case dinDC_EVErrorCodeType_NoData:                             // = 11
+	        {
+	        	//023746
+	        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		    	ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+		    	ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+		    	ShmStatusCodeData->PresentStatusCode[0][5] = 6;
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NoData)");
+	            break;
+	        }
+	        default:
+	        {
+	        	if(sys->EvBatterySoc==100)
+			{	
+			    	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+			    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+			    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+			    	ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+			    	ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+			    	ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+			 }
+			 else
+			 {	
+		        	//023983
+		        	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+			    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+			    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+			    	ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+			    	ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+			    	ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+			   }
+	            DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] Unexpected din EVErrorCode)");
+	            break;
+	        }
+	    }
+	     CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+        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);
+    }
+    else
+    {
+    	if(Check_V2G_Flow_Status()>=49)
+    	{	
+	    	if((sys->EvBatterySoc==100)||(ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.DC_EVPowerDeliveryParameter.ChargingComplete))
+		{	
+			    	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+			    	ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+			    	ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+			    	ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+			    	ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+			    	ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+			    	 CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+			    	  sprintf(buf_log_evcomm,
+		                "Check_EVErrorCode => Stop by EV (EVErrorCode = %d (023979))",
+		                code);
+		        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);	
+		 }
+		 else if(ShmStatusCodeData->PresentStatusCode[0][1] ==0)
+		 {
+		 	if(!( (ShmInternalComm->ChargingPermission == FALSE)||
+		 	    (sys->DC_EVSEStatus == EVSE_Shutdown)||
+		 	    (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)))
+		 	{	
+			 	//023983
+			 	ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+				ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+				ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+				ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+				ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+				ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+				  CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+				  sprintf(buf_log_evcomm,
+		                "Check_EVErrorCode => Stop by EV (EVErrorCode = %d (023983))",
+		                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)
+    {
+    	#if 0
+        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
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;  //1
+        #endif
+
+    }
+    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)
+    {
+    	 if(sys->CpState <= 1)
+    	 {	
+	        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);
+	     }
+	     else 
+	     {
+	     	SAVE_SYS_LOG_MSG_EVCOMM("[DIN][Error][CurrentDemandRes]EVSE Normal Stop");
+	        //cur->ResponseCode = FAILED_DIN70121;
+	        cur->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+	        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+	        //errn = -1;
+	     }	
+    }
+    #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)
+    {
+    	#if 0
+        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
+         cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1
+         #endif
+    }
+    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)
+    {
+    	 if(sys->CpState <= 1)
+    	 {	
+	        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);
+	  }
+	  else
+	  {
+	  	    SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][Error][CurrentDemandRes]EVSE Normal Stop");
+	        //cur->ResponseCode = FAILED_ISO15118_2014;
+	        cur->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+	        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+	  }	
+    }
+    #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 = 1;
+    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));
+    res->EVSEID[0]='Z';
+	res->EVSEID[1]='Z';
+	res->EVSEID[2]='0';
+	res->EVSEID[3]='0';
+	res->EVSEID[4]='0';
+	res->EVSEID[5]='0';
+	res->EVSEID[6]='0';
+ 
+    //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
+    strcpy(res->MeterInfo.MeterID , ShmSysConfigAndInfo->SysConfig.SerialNumber);
+	
+    //[MeterInfo][2/5] SigMeterReading (optional)
+    //sprintf(res->MeterInfo.SigMeterReading , CCS_AC_SIG_METER_READING);
+
+
+    //[MeterInfo][3/5] MeterStatus (optional)
+    res->MeterInfo.MeterStatus = 1;
+
+    //[MeterInfo][4/5] MeterReading (optional)
+    res->MeterInfo.MeterReading = ShmInternalComm->AC_MeterReadingValue;//Wh
+    //[MeterInfo][5/5] TMeter (optional)
+    res->MeterInfo.TMeter =  time(NULL); //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 (ShmInternalComm->AC_RcdStatus == 1)  //RCD tripped,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;
+    }
+
+    if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+        sprintf(buf_log_evcomm, "[ISO1][ChargingStatusRes]ChargingPermission = FALSE");
+        SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+        //errn = -1;
+    }
+
+    //Response to CP Error
+    //#if CP_PROTECTION_MECHANISM == ENABLE
+    #if 1
+   // if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+    if ((sys->CpState < 3) || (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;
+          errn = -1;
+    }
+    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
+    if(ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.ChargeProgress==iso1chargeProgressType_Stop)
+    	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;
+          errn = -1;
+    }
+    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;
+      struct ChargingInfoData *sys;
+    //Request CSU to STOP
+    //This should be reponsed as soon as possible once this message is received.
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+  
+    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);
+    
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    //[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;
+      struct ChargingInfoData *sys;
+    //Request CSU to STOP
+    //This should be reponsed as soon as possible once this message is received.
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    //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);
+
+	if(ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.ChargeProgress==iso1chargeProgressType_Stop)
+	{
+		 //CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    	EVCOMM_SYS_INFO.EvBatterytargetVoltage = 0;
+    	EVCOMM_SYS_INFO.EvBatterytargetCurrent = 0;
+		CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    	SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]PowerDeliveryReq (2nd-Stop)\n");
+    	//[To-Do] Sending response after the EVSE output voltage decreases to under 60V
+    	usleep(1500000);    //1.5 seconds
+    	//sleep(1);   //1 second
+	}	
+	else
+		SAVE_SYS_LOG_MSG_EVCOMM("[V2G][Rx]PowerDeliveryReq (2nd-Renegotiation)\n");
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode);
+	
+    errn = Proc_iso1_PowerDeliveryStopRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        SAVE_SYS_LOG_MSG_EVCOMM("[ISO1][V2G][Tx]PowerDeliveryRes (2nd-stop)");
+    }
+    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;
+        errn = -1;
+    }
+    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.EVSEIsolationStatus = dinisolationLevelType_Valid;  //1
+        //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;
+          errn = -1;
+    }
+    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.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1
+       // 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    
+                   if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                    if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                     if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                   if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                     if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                   if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                    if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                   if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                     if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&SeqStartTime);
+                    #endif
+                }
+                 else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                     if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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;
+                }
+                 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;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);	
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                   if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                    if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                    if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                    if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                     if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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)
+                   if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		       } 
+                    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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                     if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                   if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                     
+                     if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+	                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+					        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+					        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+					        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+					        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+					        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+					        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+					        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+				       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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
+                    
+                    if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+				        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+				        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+				        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+				        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+				        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+				        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+				        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       		} 
+                }
+               else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                  if((EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_Shutdown) && (EVCOMM_SYS_INFO.DC_EVSEStatus != EVSE_EmergencyShutdown))
+                     {	
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+		        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+		        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+		        ShmStatusCodeData->PresentStatusCode[0][3] = 9;
+		        ShmStatusCodeData->PresentStatusCode[0][4] = 8;
+		        ShmStatusCodeData->PresentStatusCode[0][5] = 3;
+		        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+		        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+		       } 
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    sprintf(buf_log_evcomm,
+                            "[ERROR]SequenceError(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    if(ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.ChargeProgress==iso1chargeProgressType_Stop)
+                    	EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }         
+                else
+                {
+                    break;
+                }
+                 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 < PowerDeliveryRequestStop)
+                {
+                    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 if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= PowerDeliveryRequestStop &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	 sprintf(buf_log_evcomm,
+                            "[ERROR]Receive EV Stop Message(%d) => Tx Res MSG",
+                            EVCOMM_SYS_INFO.V2G_Rx_Msg);
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                     EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }         
+                else
+                {
+                    break;
+                }
+                 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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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
+                    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;
+                }
+                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;
+                }
+                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;
+                    break;
+                }
+                else
+                {
+                    break;
+                }
+                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
+               	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);
+                      if(ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.ChargeProgress==iso1chargeProgressType_Stop)        
+                    	EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Flow_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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;
+                }
+                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);
+    #ifdef SUPPORT_TLS_CONNECTION
+    if(EvSecurity == 0)//support security
+    {
+    	packet_size = SSL_read(ssl, V2gtpMsgRxBuf, V2GTP_MSG_RX_BUFFER_SIZE);
+    }
+    else
+    {
+    	packet_size = recv(AcceptFd, V2gtpMsgRxBuf, V2GTP_MSG_RX_BUFFER_SIZE, 0);
+    }
+    #else
+    packet_size = recv(AcceptFd, V2gtpMsgRxBuf, V2GTP_MSG_RX_BUFFER_SIZE, 0);
+    #endif
+    //[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;
+        }
+        ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp=UdpSock;
+        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));
+	   		#ifdef SUPPORT_TLS_CONNECTION
+	   		EvSecurity= 	*(payload);
+	   		#endif
+		
+            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;
+            #ifdef SUPPORT_TLS_CONNECTION
+            if(EvSecurity == 0)//support security
+            	 payload[18] = SDP_PAYLOAD_SECURITY_TLS;      //Security
+            else
+            	 payload[18] = SDP_PAYLOAD_SECURITY_NONE;      // No Security	 
+            #else
+            payload[18] = SDP_PAYLOAD_SECURITY_NONE;      //No Security
+            #endif
+            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 >= 28)
+            {
+                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;
+        }
+        ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp=TcpSock;
+        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) < 0)     //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)) < 0 )
+    {
+        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;
+    }
+	ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=AcceptFd;
+    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
+    
+    #ifdef SUPPORT_TLS_CONNECTION
+    /* TCP connection is ready. Do server side SSL connection. */
+    if(EvSecurity == 0)//support security
+    {	
+		ssl = SSL_new(ctx);
+		SSL_set_fd(ssl, AcceptFd);
+		if (SSL_accept(ssl) <= 0) 
+		{
+			//SAVE_SYS_LOG_MSG_EVCOMM("[SSL]SSL_accept Failed");
+			//SSL_free(ssl);
+			//close(AcceptFd);
+			//AcceptFd = -1;
+			return 0;
+	  	}
+	 }
+    #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;
+     if(ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp > 0)
+    {
+        close(ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp);
+        ShmSysConfigAndInfo->SysInfo.SystemAmbientTemp=0;
+    }
+    if(ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp > 0)
+    {
+        close(ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp);
+         ShmSysConfigAndInfo->SysInfo.SystemCriticalTemp=0;
+    }
+    if(ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp > 0)
+    {
+        close(ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp);
+        close(ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed);
+         ShmSysConfigAndInfo->SysInfo.PsuAmbientTemp=0;
+          ShmSysConfigAndInfo->SysInfo.PsuFanRotaSpeed=0;
+    }
+    /*#ifdef SUPPORT_TLS_CONNECTION
+	if(EvSecurity == 0)//support security
+    {	
+    	SSL_shutdown(ssl);
+		SSL_free (ssl);
+  	}
+  	SSL_CTX_free (ctx);
+  	#endif*/
+    //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);
+ 
+
+    #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));
+    ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.ChargeProgress= 0xFF;
+
+    //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;
+    EVCOMM_SYS_INFO.DC_EVSEStatus=EVSE_NotReady;
+    //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();
+	Qca7kPowerReset();  //reset QCA7000 /* +++ 20200808, vern, should disconnected PLC connection after session stop ---*/
+#ifdef AWCCS
+	system("killall SeccComm");
+#else	
+    	system("cd /root;./reset_soft.sh");
+#endif
+    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);
+    if((EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active <= 49152)||(EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active >= 65535))//49152-65535
+    	EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active=59438;
+    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);
+}
+
+#ifdef SUPPORT_TLS_CONNECTION
+SSL_CTX *create_sslcontext()
+{
+    const SSL_METHOD *method;
+    SSL_CTX *ctx;
+    
+    // Support only TLSv1.2
+    method = TLSv1_2_server_method();
+    
+    // Create context
+    ctx = SSL_CTX_new(method);
+    if (!ctx) 
+    {
+    	ERR_print_errors_fp(stderr);	
+        return NULL;
+    }   
+    return ctx;
+}
+
+int configure_sslcertkey_file(SSL_CTX *ctx)
+{
+    SSL_CTX_set_ecdh_auto(ctx, 1);
+    
+    // Load certificate file
+    if (SSL_CTX_use_certificate_file(ctx, "/root/cacert.pem", SSL_FILETYPE_PEM) <= 0) 
+    {
+    	ERR_print_errors_fp(stderr);	
+        return -1;
+    }
+    // Load private key file
+    if (SSL_CTX_use_PrivateKey_file(ctx, "/root/cakey.pem", SSL_FILETYPE_PEM) <= 0 )
+    {
+    	ERR_print_errors_fp(stderr);		
+        return -1;
+    }
+    return 0;
+}
+#endif
+
+/*===========================================================================
+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");
+
+    //CCS connector type
+    sprintf(buf_log_evcomm, "CCS connector type : %s\n",  ShmInternalComm->CCSConnectorType > 0? "CCS2":"CCS1" );
+    SAVE_SYS_LOG_MSG_EVCOMM(buf_log_evcomm);
+    
+    //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
+    if(CCS_ENERGY_TRANSFER_MODE<=1)
+    {
+    	if((ShmInternalComm->AC_EVSEModelName[2]=='Y') || (ShmInternalComm->AC_EVSEModelName[2]=='D') || (ShmInternalComm->AC_EVSEModelName[2]=='W'))
+		//if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount==3)
+    		ShmCcsData->EnergyTransferMode = MODE_AC_THREE_PHASE_CORE;
+		else
+			ShmCcsData->EnergyTransferMode = MODE_AC_SINGLE_PHASE_CORE;
+    }
+    else	
+    	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
+    
+    #ifdef SUPPORT_TLS_CONNECTION
+    // SSL init
+    //SSL_free (ssl);
+  	//SSL_CTX_free (ctx);
+    SSL_load_error_strings();
+    OpenSSL_add_ssl_algorithms();
+    // Create SSL_CTX
+    ctx = create_sslcontext();
+    if (ctx  == NULL)
+    {	
+		SAVE_SYS_LOG_MSG_EVCOMM("[SSL]create_sslcontext Failed");
+    }
+    else
+    	SAVE_SYS_LOG_MSG_EVCOMM("[SSL]create_sslcontext OK");
+    // Configure cert and key
+    if (configure_sslcertkey_file(ctx) < 0)
+    {	
+		SAVE_SYS_LOG_MSG_EVCOMM("[SSL]configure_sslcertkey_file Failed");
+    }
+    else
+    	SAVE_SYS_LOG_MSG_EVCOMM("[SSL]configure_sslcertkey_file OK");
+    #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
+                }
+                if(V2gFlowStatus == SessionStopResponse)
+                {
+                	 if(RawSock > 0)
+				    {
+				        close(RawSock);
+				    }
+				    if(UdpSock > 0)
+				    {
+				        close(UdpSock);
+				    }
+				    if(TcpSock > 0)
+				    {
+				        close(TcpSock);
+				        close(TcpAcceptFd);
+				    }
+				    RawSock = UdpSock = TcpSock = TcpAcceptFd = -1;
+                	#ifdef SUPPORT_TLS_CONNECTION
+					if(EvSecurity == 0)//support security
+				    {	
+				    	SSL_shutdown(ssl);
+						SSL_free (ssl);
+				  	}
+				  	SSL_CTX_free (ctx);
+				  #endif
+                }	
+            }
+            else if (V2gFlowStatus >= Performance_Timeout)
+            {
+                //End_Process
+                 if(RawSock > 0)
+			    {
+			        close(RawSock);
+			    }
+			    if(UdpSock > 0)
+			    {
+			        close(UdpSock);
+			    }
+			    if(TcpSock > 0)
+			    {
+			        close(TcpSock);
+			        close(TcpAcceptFd);
+			    }
+			    RawSock = UdpSock = TcpSock = TcpAcceptFd = -1;
+                #ifdef SUPPORT_TLS_CONNECTION
+				if(EvSecurity == 0)//support security
+			    {	
+			    	SSL_shutdown(ssl);
+					SSL_free (ssl);
+			  	}
+			  	SSL_CTX_free (ctx);
+			  	#endif
+            }
+            else
+            {
+                //null
+            }
+        }
+      //  printf("V2gFlowStatus=%d, socket=%d,%d,%d\n",V2gFlowStatus,RawSock,UdpSock,TcpSock);
+    } //while
+}//main while

+ 246 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/SeccComm.h

@@ -0,0 +1,246 @@
+/*===========================================================================
+                    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_AMP_MAP_REQ             0x601C
+#define MMTYPE_CM_AMP_MAP_CNF             0x601D
+#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
+// Alston 20220723
+//#define TT_EVSE_RESET_STATE                 3          //unit: sec.
+// Alston 20220723 end
+#ifdef DIN70122_ISO15118_VERIFICATION
+#define TT_match_response                   (200)     //unit: ms, Time that the EV/EVSE shall wait for a response from the EVSE/EV
+#else
+#define TT_match_response                   (200)     //unit: ms, Time that the EV/EVSE shall wait for a response from the EVSE/EV
+#endif
+
+#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                  3
+#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     StoreLogMsg2
+#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

+ 86 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/UpdateRootfs.c

@@ -0,0 +1,86 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                              UpdateRootfs.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 "UpdateRootfs.h"
+
+int main(int argc, char *argv[])
+{
+    unsigned int MaxLen = 25 * 1024 * 1024, ImageLen = 0;
+    unsigned char *ptr;
+    int fd, wrd;
+
+    ptr = malloc(MaxLen);
+
+    if(ptr == NULL)
+    {
+        printf("UpdateRootfs NG - can not malloc\n");
+        return 0;
+    }
+
+    memset(ptr, 0xFF, MaxLen);
+
+    fd = open(argv[1], O_RDONLY);
+
+    if(fd < 0)
+    {
+        printf("UpdateRootfs NG - can not open rootfs\n");
+        free(ptr);
+        return 0;
+    }
+
+    ImageLen = read(fd, ptr, MaxLen);
+    close(fd);
+    printf("ImageLen=0x%x\n", ImageLen);
+
+    if(ImageLen < (24 * 1024 * 1024))
+    {
+        printf("ImageLen size mismatch\n");
+        free(ptr);
+        return 0;
+    }
+
+    fd = open("/dev/mtdblock8", O_RDWR);
+
+    if(fd < 0)
+    {
+        printf("UpdateRootfs NG - can not open mtdblock8\n");
+        free(ptr);
+        return 0;
+    }
+
+    wrd = write(fd, ptr, ImageLen);
+    close(fd);
+
+    if(wrd != ImageLen)
+    {
+        printf("UpdateRootfs NG - wrd(0x%x) != ImageLen(0x%x)\n", wrd, ImageLen);
+        free(ptr);
+        return 0;
+    }
+
+    free(ptr);
+    printf("UpdateRootfs OK\n");
+}

+ 7 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/UpdateRootfs.h

@@ -0,0 +1,7 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                              UpdateRootfs.h
+
+                        initiated by Vern, Joseph
+                           (since 2019/07/19)
+=============================================================================*/

+ 14 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/cacert.pem

@@ -0,0 +1,14 @@
+subject=/C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server
+issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA
+-----BEGIN X509 CERTIFICATE-----
+
+MIIBgjCCASwCAQQwDQYJKoZIhvcNAQEEBQAwODELMAkGA1UEBhMCQVUxDDAKBgNV
+BAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3JzYSB0ZXN0IENBMB4XDTk1MTAwOTIz
+MzIwNVoXDTk4MDcwNTIzMzIwNVowYDELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FM
+RDEZMBcGA1UEChMQTWluY29tIFB0eS4gTHRkLjELMAkGA1UECxMCQ1MxGzAZBgNV
+BAMTElNTTGVheSBkZW1vIHNlcnZlcjBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3
+LCXcScWua0PFLkHBLm2VejqpA1F4RQ8q0VjRiPafjx/Z/aWH3ipdMVvuJGa/wFXb
+/nDFLDlfWp+oCPwhBtVPAgMBAAEwDQYJKoZIhvcNAQEEBQADQQArNFsihWIjBzb0
+DCsU0BvL2bvSwJrPEqFlkDq3F4M6EGutL9axEcANWgbbEdAvNJD1dmEmoWny27Pn
+IMs6ZOZB
+-----END X509 CERTIFICATE-----

+ 24 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/cakey.pem

@@ -0,0 +1,24 @@
+issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA
+subject=/C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server
+-----BEGIN X509 CERTIFICATE-----
+
+MIIBgjCCASwCAQQwDQYJKoZIhvcNAQEEBQAwODELMAkGA1UEBhMCQVUxDDAKBgNV
+BAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3JzYSB0ZXN0IENBMB4XDTk1MTAwOTIz
+MzIwNVoXDTk4MDcwNTIzMzIwNVowYDELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FM
+RDEZMBcGA1UEChMQTWluY29tIFB0eS4gTHRkLjELMAkGA1UECxMCQ1MxGzAZBgNV
+BAMTElNTTGVheSBkZW1vIHNlcnZlcjBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3
+LCXcScWua0PFLkHBLm2VejqpA1F4RQ8q0VjRiPafjx/Z/aWH3ipdMVvuJGa/wFXb
+/nDFLDlfWp+oCPwhBtVPAgMBAAEwDQYJKoZIhvcNAQEEBQADQQArNFsihWIjBzb0
+DCsU0BvL2bvSwJrPEqFlkDq3F4M6EGutL9axEcANWgbbEdAvNJD1dmEmoWny27Pn
+IMs6ZOZB
+-----END X509 CERTIFICATE-----
+-----BEGIN RSA PRIVATE KEY-----
+
+MIIBPAIBAAJBALcsJdxJxa5rQ8UuQcEubZV6OqkDUXhFDyrRWNGI9p+PH9n9pYfe
+Kl0xW+4kZr/AVdv+cMUsOV9an6gI/CEG1U8CAwEAAQJAXJMBZ34ZXHd1vtgL/3hZ
+hexKbVTx/djZO4imXO/dxPGRzG2ylYZpHmG32/T1kaHpZlCHoEPgHoSzmxYXfxjG
+sQIhAPmZ/bQOjmRUHM/VM2X5zrjjM6z18R1P6l3ObFwt9FGdAiEAu943Yh9SqMRw
+tL0xHGxKmM/YJueUw1gB6sLkETN71NsCIQCeT3RhoqXfrpXDoEcEU+gwzjI1bpxq
+agiNTOLfqGoA5QIhAIQFYjgzONxex7FLrsKBm16N2SFl5pXsN9SpRqqL2n63AiEA
+g9VNIQ3xwpw7og3IbONifeku+J9qGMGQJMKwSTwrFtI=
+-----END RSA PRIVATE KEY-----

+ 2511 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/define.h

@@ -0,0 +1,2511 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 define.h
+
+                        initiated by Vern, Joseph
+                           (since 2019/07/19)
+   =============================================================================*/
+
+#ifndef DEFINE_H_
+#define DEFINE_H_
+#include "version.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <sys/timeb.h>
+//#include "CsuCommAC.h"
+
+
+/**************************************************************************************/
+/*********************************NAND Flash mapping *****************************/
+/**************************************************************************************/
+/*
+   sector size	   512 KiB
+   Page size       4096 b
+   OOB size        224 b
+   Erase size      524288 b
+   -------------------------------------------------------------------------------------------------------------------------------
+   Segment                  Physical address            Size
+   -------------------------------------------------------------------------------------------------------------------------------
+   MLO						        0x00000000-0x0007FFFF		512 KB
+   Primary u-boot                   0x00080000-0x0017FFFF		1 MB
+   Environment                      0x00180000-0x001FFFFF		512 KB
+   Secondary u-boot	                0x00200000-0x002FFFFF		1 MB
+   Primary dtb				        0x00300000-0x0037FFFF		512 KB
+   Secondary dtb				    0x00380000-0x003FFFFF		512 KB
+   Primary kernel				    0x00400000-0x00DFFFFF		10 MB
+   Secondary Kernel                 0x00E00000-0x017FFFFF		10 MB
+   Primary root file system		    0x01800000-0x029FFFFF		24 MB
+   Secondary root file system	    0x03000000-0x047FFFFF		24 MB
+   Primary user configuration       0x04800000-0x004DFFFF		6 MB
+   Secondary user configuration	    0x04E00000-0x0053FFFF		6 MB
+   Factory default configuration	0x05400000-0x0059FFFF		6 MB
+   Storage					        0x05A00000-0x7FFFFFFF		1958 MB
+ */
+ #define ENABLE              1
+ #define DISABLE             0
+ #define PASS                1
+ #define FAIL                0
+
+#define DIN70122_ISO15118_VERIFICATION
+/**************************************************************************************/
+/*********************************System Limitation**********************************/
+/**************************************************************************************/
+#ifdef AWCCS
+#undef CONNECTOR_TEMP_DETECTION
+#define CCS_ENERGY_TRANSFER_MODE                    MODE_AC_SINGLE_PHASE_CORE 
+#else
+#define CCS_ENERGY_TRANSFER_MODE                    MODE_DC_EXTENDED
+#endif
+
+//#define SUPPORT_ISO15118_PnC      
+//#define SUPPORT_ISO15118_VAS      
+//#define SUPPORT_TLS_CONNECTION              
+#define SUPPORT_DIN70122_ISO15118_4              0         		
+#define MIN_SUPPORTED_CURRENT              	   3 	   			   
+#define CONNECTOR_TEMP_DETECTION                  //REMA
+
+#ifdef SUPPORT_ISO15118_VAS
+#define SUPPORT_TLS_CONNECTION          
+#endif
+#ifdef SUPPORT_ISO15118_PnC
+#define SUPPORT_TLS_CONNECTION          
+#endif
+
+#define SIZE_OF_LOG_BUFFER              256         //Bytes
+
+#define PARAMETER_NORMAL_MODE           ENABLE      //DISABLE: using sudo parameters
+                                                    //ENABLE: using CAN commands
+//For Test or Burn-in Purpose
+#define MANUAL_SET_EV_TARGET_FUNCTION           DISABLE
+#define SUDO_EV_TARGET_VOLTAGE                  500 //unit: 1V
+#define SUDO_EV_TARGET_CURRENT                  60  //unit: 1A
+
+//Configuration for CCS EVSE Process
+#define CABLECHECK_TARGET_VOLTAGE               500 //unit 1V, default: 500V
+#define CABLECHECK_TARGET_CURRENT               2   //unit: 1A, default: 2A
+#define PRECHARGE_TARGET_CURRENT                2   //unit: 1A, default: 2A
+
+//EVSE ID
+#define CCS_AC_EVSEID                           "PHIHONG_CCS_AC_001"  //max: DIN = 32, ISO1/ISO2 = 37 bytes
+#define CCS_DC_EVSEID                           "PHIHONG_CCS_DC_001"  //max: DIN = 32, ISO1/ISO2 = 37 bytes
+#define CCS_AC_METER_ID                         "ABCDE-0123456789-0123456789" //max = 32 bytes
+#define CCS_AC_SIG_METER_READING                "SIG_METER_READING_ABCDE-0123456789" //max = 64 bytes
+
+/*CCS Protocol ID*/
+#define V2GT_MSG_PROTOCOL_DIN70121                  0
+#define V2GT_MSG_PROTOCOL_ISO15118_2014             1    //i.e. ISO15118-2 (ISO 1)
+#define V2GT_MSG_PROTOCOL_ISO15118_2018             2    //i.e. ISO15118-20 (ISO 2)
+#define V2GT_MSG_PROTOCOL_HIGHEST_PRIORITY          255  //for auto detect highest priority protocol
+
+#define V2GT_MSG_PROTOCOL_PREFERENCE             V2GT_MSG_PROTOCOL_HIGHEST_PRIORITY// V2GT_MSG_PROTOCOL_HIGHEST_PRIORITY // V2GT_MSG_PROTOCOL_ISO15118_2014//V2GT_MSG_PROTOCOL_HIGHEST_PRIORITY
+//#define CCS_ENERGY_TRANSFER_MODE                    MODE_DC_EXTENDED
+                                                    //DC: MODE_DC_EXTENDED (default)
+                                                    //AC: MODE_AC_SINGLE_PHASE_CORE, MODE_AC_THREE_PHASE_CORE
+
+#define SET_NO_PWM_IF_NOT_GET_PERMISSION                    0
+#define SET_5_PWM_ONCE_RX_CM_SLAC_PARM_REQ                  1
+#define SET_5_PWM_ONCE_GET_PERMISSION_IN_AUTHORIZATIONRES   2
+
+#define FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE       ENABLE  //default: ENABLE: release; DISABLE: debug
+#define NEW_SLAC_ARCHITECTURE_SWITCH                        ENABLE  //defualt: ENABLE
+#define CAN_RAMDOM_MATCHING_ID_MECHANISM                    ENABLE  //defualt: ENABLE
+#define CAN_RX_TIMEOUT_MECHANISM                            DISABLE  //defualt: ENABLE
+#define SLAC_FIRST_RESPONSE_METHOD                          SET_5_PWM_ONCE_RX_CM_SLAC_PARM_REQ
+
+#define TCPDUMP_PACKETS_SNIFFER_SWITCH                      DISABLE //default: DISABLE
+#define CANDUMP_PACKETS_SNIFFER_SWITCH                      DISABLE //default: DISABLE
+
+#define DYNAMIC_ETH0_IP_MECHANISM                           ENABLE //default: DISABLE
+#define CP_PROTECTION_MECHANISM                             ENABLE  //default: ENABLE
+#define PP_PROTECTION_MECHANISM                             DISABLE //default: DISABLE
+#define SUDO_PSD_PARAMETER_MECHANISM                        ENABLE  //default: ENABLE
+#define TESLA_SLOW_INCREASE_CURRENT_FUNCTION                DISABLE
+#define V2G_SECC_TIMEOUT_PROTECTION                         ENABLE
+#define PATCH_FOR_BMW_I3_BUG_EVSEMAXIMUMVOLTAGELIMIT_599V   ENABLE   //default: ENABLE; CE/UL: DISABLE
+
+//CSU CAN Message EV Stop Type
+#define EV_NORMAL_STOP      1
+#define EV_EMERGENCY_STOP   2
+
+//CSU CAN Message GFD Isolation Status Type
+#define GFD_Invalid       0     //ongoing
+#define GFD_Valid         1
+#define GFD_Warning       2
+#define GFD_Fault         3
+#define GFD_No_IMD        4     //for ISO 15118
+
+//Default Ethernet Port Base for eth0
+#define ETH0_PORT_BASE    20
+
+//Energy Transfer Mode
+#define MODE_AC_SINGLE_PHASE_CORE    0
+#define MODE_AC_THREE_PHASE_CORE     1
+#define MODE_DC_CORE                 2
+#define MODE_DC_EXTENDED             3
+#define MODE_DC_COMBO_CORE           4
+#define MODE_DC_UNIQUE               5
+
+/*
+   0xAaBbCcDd
+   Aa: main version
+   Bb: minor version
+   Cc:
+    0x01: UL
+    0x02: CE
+    0x03: JP
+    0x04: GB
+   Dd:
+    0x01: CCS protocol
+    0x02: CHAdeMO protocol
+    0x03: GB Protocol
+ */
+
+/*Download Image Type*/
+#define IMAGE_TYPE_KERNEL_CONFIGURATION_DTB     1
+#define IMAGE_TYPE_BOOTLOADER_UBOOT             2
+#define IMAGE_TYPE_OS_KERNEL_ZIMAGE             3
+#define IMAGE_TYPE_ROOT_FILESYSTEM_RAMDISK      4
+#define IMAGE_TYPE_ROOT_APP_ZIP                 5
+#define IMAGE_TYPE_BOOTLOADER_MLO_SPL           6
+#define IMAGE_TYPE_USER_CONFIGURATION           7
+//--- [CAUTION] To increase type ID, please modify this condition.
+//(Check_DwnldImgParameter())
+
+/*relevant to Quantity */
+#define CHAdeMO_QUANTITY    1
+#define CCS_QUANTITY        1
+#define GB_QUANTITY         1
+
+/*SystemLog message*/
+#define SystemLogMessage            //for engineer to do analysis
+
+#define CSUCOMMDC_TASK_FLAG        (ShmInternalComm->InternalCommUnion.bits)
+//#define CSUCOMMAC_SHM              (ShmInternalCommAC->gun_info[0].acCcsInfo)
+#define EVCOMM_SYS_INFO            (ShmSysConfigAndInfo->SysInfo.CcsChargingData[0])
+#define SLAC_INFO                  (ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].evcc_slac_data)
+#define CCS_HANDSHAKE_PROTOCOLS    (ccs_handshake.supportedAppProtocolReq.AppProtocol)
+
+#define GPIO_SYS_DIR 		       "/sys/class/gpio"
+#define GPIO_2_23_AM_IO_1          87
+
+// Debug Message
+#define DEBUG_CCS_EVEM_MESSAGE_SHOW     ENABLE
+
+#if DEBUG_CCS_EVEM_MESSAGE_SHOW == ENABLE
+    #define DEBUG_MAIN_PRINTF           printf
+    #define DEBUG_EVCOMM_PRINTF         printf
+#else
+    #define DEBUG_MAIN_PRINTF(...)
+    #define DEBUG_EVCOMM_PRINTF(...)
+#endif
+
+//Precharge Relay Status
+#define EVSE_STATUS_NOT_READY_FOR_PRECHARGE         0   //un-initialized
+#define EVSE_STATUS_READY_FOR_PRECHARGE             2   //DC+ Relay: OFF, Precharge Relay: ON
+#define EVSE_STATUS_READY_FOR_ENERGY_TRANSFER       3   //DC+ Relay: ON, Precharge Relay: OFF
+
+
+/**************************************************************************************/
+/**************************share memory key information***************************/
+/**************************************************************************************/
+#define ShmSysConfigAndInfoKey      3001    //0xBB9
+#define ShmCcsCommKey               3004    //0xBBC
+#define ShmStatusCodeKey            3005    //0xBBD
+#define ShmInternalCommKey          3009    //0xBC1
+#define ShmInternalCommACKey        3007    //0x7D1
+
+/**************************************************************************************/
+/****structure SysConfigData => shall store the data to NAND flash****************/
+/****structure SysInfoData => shall NOT store the data to NAND flash***************/
+/****according to System Configuration and Information Table.xlsx Rev.0.2 *******/
+/**************************************************************************************/
+
+struct EthConfigData
+{
+    unsigned char EthDhcpClient;                //0: enable,1: disable
+    unsigned char EthMacAddress[18];                //default: Null
+    unsigned char EthIpAddress[16];                 //Eth0 default:192.168.0.10	,Eth1 default:192.168.1.10
+    unsigned char EthSubmaskAddress[16];            //Eth0 default:255.255.255.0	,Eth1 default:255.255.255.0
+    unsigned char EthGatewayAddress[16];            //Eth0 default:192.168.0.254	,Eth1 default:192.168.1.254
+};
+
+struct WifiConfigData
+{
+    unsigned char WifiMode;                     //0: disable, 1: Infrastructure client, 2: Infrastructure server, 3: Ad-Hoc
+    unsigned char WifiSsid[256];                    //default: Null
+    unsigned char WifiPassword[256];                //default: Null
+    int WifiRssi;                               //dbm
+    unsigned char WifiDhcpServer;               //0: enable, 1: disable
+    unsigned char WifiDhcpClient;               //0: enable, 1: disable
+    unsigned char WifiMacAddress[18];           //default: Null
+    unsigned char WifiIpAddress[16];                //default:192.168.2.10
+    unsigned char WifiSubmaskAddress[16];           //default:255.255.255.0
+    unsigned char WifiGatewayAddress[16];       //default:192.168.2.254
+};
+
+struct TeleConfigData
+{
+    unsigned char TelcomApn[256];               //default: Null
+    int TelcomRssi;                         //dbm
+    unsigned char TelcomChapPapId[256];             //default: Null
+    unsigned char TelcomChapPapPwd[256];        //default: Null
+    unsigned char TelcomModemImei[16];              //default: Null
+    unsigned char TelcomSimImsi[16];                //default: Null
+    unsigned char TelcomSimStatus;                  //0: no SIM card is found, 1: valid SIM card, 2: invalid SIM card
+    unsigned char TelcomModemMode;              //0: No services, 1: CDMA, 2: GSM/GPRS, 3: WCDMA, 4: GSM/WCDMA, 5: TD_SCDMA mode, 6: Unknow
+    unsigned char TelcomIpAddress[16];              //default: Null
+};
+
+struct SysConfigData
+{
+    /**************System***************/
+    unsigned char ModelName[64];                    //charger model name
+    unsigned char SerialNumber[64];                     //charger system serial number
+    unsigned char SystemId[128];                        //charger system ID
+    unsigned char SystemDateTime[32];               //charger system date and time
+    unsigned char AuthorisationMode;                    //0: Phihong RFID tag,  1: OCPP backend,  2: Phihong backend,  3: free mode
+    unsigned char DefaultLanguage;                      //
+    unsigned char RfidCardNumEndian;                //0: little endian,  1: big endian
+    unsigned short AcPlugInTimes;                       //0~65535
+    unsigned short GbPlugInTimes;                   //0~65535
+    unsigned short Ccs1PlugInTime;                  //0~65535
+    unsigned short Ccs2PlugInTimes;                     //0~65535
+    unsigned short ChademoPlugInTimes;              //0~65535
+    /**************Charging***************/
+    unsigned short MaxChargingEnergy;               //0: no limit,	1 ~ 65535	kWh
+    unsigned short MaxChargingPower;                //0: rating value, 1 ~ RATING_POWER	kW"
+    unsigned short MaxChargingCurrent;              //0: rating value, 1 ~ RATING_CURRENT	amp"
+    unsigned short MaxChargingDuration;                 //0: no limit,	1 ~ 65535	minutes
+    unsigned char PhaseLossPolicy;                      //0: charging,  1: stop charging
+    unsigned char LocalWhiteCard[10][32];               //Max. card quantity is 10
+    unsigned char UserId[32];                       //the user use this ID to trigger charging event, it can be RFID card number, OCPP IdTag, etc.
+    /**************Network***************/
+    unsigned char FtpServer[32];                        //the ftp server for Phihong server to do data transimission
+    struct EthConfigData Eth0Interface;
+    struct EthConfigData Eth1Interface;
+    struct WifiConfigData AthInterface;
+    struct TeleConfigData TelecomInterface;
+    /**************Backend***************/
+    unsigned int BackendConnTimeout;                //default : 300s
+    unsigned char OfflinePolicy;                        //0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
+    unsigned short OfflineMaxChargeEnergy;          //0: same as MaxChargingEnergy, 1 ~ 65535 kWh
+    unsigned short OfflineMaxChargeDuration;            //0: same as MaxChargeDuration, 1 ~ 65535 minutes
+    unsigned char OcppServerURL[512];               //http: non-secure OCPP 1.5-S, https: secure OCPP 1.5-S, ws: non-secure OCPP 1.6-J, wss: secure OCPP 1.6-J"
+    unsigned char ChargeBoxId[128];
+    unsigned int Checksum;                      //4 bytes checksum
+};
+
+#define SLAC_EVSE_MAC_LENGTH    6
+#define SLAC_EVMAC_LENGTH       6
+#define SLAC_RUNID_LENGTH       8
+#define SLAC_AAG_LENGTH         64     //ISO 15118 defines it as 0x3A, i.e. 58
+struct EVCC_SLAC_DATA_ARRAY_TYPE {
+    unsigned char EvMac[SLAC_EVMAC_LENGTH];
+    unsigned char RunID[SLAC_RUNID_LENGTH];
+    unsigned short AAG[SLAC_AAG_LENGTH];
+    unsigned char StartAttenCharCnt;
+    unsigned char StartAttenCharErr;
+    unsigned char MnbcSoundNum;
+    unsigned char MnbcSoundCnt;
+    unsigned char AttenProfileCnt;
+    unsigned char AagGroupsNum;
+    unsigned char AttenCharRspCnt;
+    unsigned char ValidateReqCnt;
+    unsigned char MatchReqNum;
+    float AAG_quality_ori;
+    float AAG_quality_refined;
+};
+
+#define EVCC_SLAC_DATA_ARRAY_TYPE_ARRAY_SIZE    20
+struct EVCC_SLAC_DATA_TYPE {
+    unsigned char arrayLen;
+    struct EVCC_SLAC_DATA_ARRAY_TYPE array[EVCC_SLAC_DATA_ARRAY_TYPE_ARRAY_SIZE];
+};
+
+struct ChargingInfoData {
+    float MaximumChargingVoltage;                   //0~6553.5 volt, unit = 1V
+    float AvailableChargingCurrent;                 //0~6553.5 amp, unit =1A
+    float AvailableChargingPower;                   //0~6553.5 kW, unit = 1KW
+    float PresentChargingVoltage;                   //0~6553.5 volt, unit = 1V
+    float PresentChargingCurrent;                   //0~6553.5 amp, unit = 1A
+    float PresentChargingPower;                     //0~6553.5 kW, unit = 1KW
+    float PresentChargedEnergy;                     //0~6553.5 kWh, unit = 1KWH
+    int PresentChargedDuration;                     // second, unit = 1s
+    int RemainChargingDuration;                     // second, unit = 1s
+    float EvBatteryMaxVoltage;                      // 0~6553.5 volt, unit = 1V
+    float EvBatteryMaxCurrent;                      //1V
+    float EvBatteryMaxPower;                        //1KW
+    float EvBatterytargetVoltage;                   // 0~6553.5 volt, unit = 1V
+    float EvBatterytargetCurrent;                   //1A
+    int EvBatterySoc;                               // 0~100%, unit = 1%
+    float EvBatteryCapacity;                        //1KWH
+    float EvBatteryEngergyRequest;                  //1KWH
+    unsigned char ConnectorPlugIn;                  //0: unplug, 1: Plug-in
+    unsigned char ConnectorLocked;                  //0: unlocked, 1:locked.
+    float CpVoltage;                                //
+    unsigned char CpState;                          //1:state A, 2:State B1, 3:State B2, 4:State C, 5:State D, 6:State E, 7:State F, 8: Pilot error
+    unsigned char CpDuty;                           //0~100%
+    float PpVoltage;
+    unsigned char EVSEPrechargeStatus;              //00:not ready, 01:ready for precharge, 02: ready for engergy trnasfer (> 2A)
+    unsigned char IsolationStatus;                  //0:ongoing, 1:valid, 2:warning/fault
+    unsigned char DC_EVSEStatus;
+    unsigned char SwitchCpStateE_status;
+    unsigned char QCA7K_SetKeyDone;
+    unsigned char CpState_err;
+    unsigned char CpState_err_logged;
+    unsigned char CableCheckPreCountDownDone;
+    unsigned char End_Process_inused;
+    struct timeb V2G_SECC_CableCheck_Timer_Start;
+    struct timeb V2G_SECC_CableCheck_Timer_End;
+    struct timeb V2G_SECC_Precharge_Timer_Start;
+    struct timeb V2G_SECC_Precharge_Timer_End;
+    struct timeb V2G_SECC_CurrentDemand_Timer_Start;
+    struct timeb V2G_SECC_CurrentDemand_Timer_End;
+    struct timeb V2G_SECC_ChargingStatus_Timer_Start;
+    struct timeb V2G_SECC_ChargingStatus_Timer_End;
+    struct timeb V2G_SECC_WeldingDetection_Timer_Start;
+    struct timeb V2G_SECC_WeldingDetection_Timer_End;
+    struct timeb V2G_SECC_Sequence_Timer_Start;
+    struct timeb V2G_SECC_Sequence_Timer_End;
+    struct timeb V2G_SECC_Msg_Timer_Start;
+    struct timeb V2G_SECC_Msg_Timer_End;
+    unsigned short SDP_TCP_Server_Port_active;
+    unsigned char SessionID[8];
+    unsigned char V2G_Rx_Msg;
+    unsigned char SequenceError;
+    unsigned char SupportedAppProtocol_result;          //appHandresponseCodeType: 0,1,2
+    char CM_ATTEN_CHAR_IND_retry;
+    struct EVCC_SLAC_DATA_TYPE evcc_slac_data;
+    unsigned char State_Change_Ignored_Notice;
+    unsigned char EVCCID[8];
+    unsigned char EVCCID_length;
+    float AC_EVSENominalVoltage;                        //unit: 1V
+
+    //previous state
+    float MaximumChargingVoltage_pre;                   //0~6553.5 volt, unit = 1V
+    float AvailableChargingCurrent_pre;                 //0~6553.5 amp, unit =1A
+    float AvailableChargingPower_pre;                   //0~6553.5 kW, unit = 1KW
+    float PresentChargingVoltage_pre;                   //0~6553.5 volt, unit = 1V
+    float PresentChargingCurrent_pre;                   //0~6553.5 amp, unit = 1A
+    float PresentChargingPower_pre;                     //0~6553.5 kW, unit = 1KW
+    float PresentChargedEnergy_pre;                     //0~6553.5 kWh, unit = 1KWH
+    int PresentChargedDuration_pre;                     // second, unit = 1s
+    int RemainChargingDuration_pre;                     // second, unit = 1s
+    float EvBatteryMaxVoltage_pre;                      // 0~6553.5 volt, unit = 1V
+    float EvBatteryMaxCurrent_pre;                      //1A
+    float EvBatteryMaxPower_pre;                            //1KW
+    float EvBatterytargetVoltage_pre;                   // 0~6553.5 volt, unit = 1V
+    float EvBatterytargetCurrent_pre;                   //1A
+    int EvBatterySoc_pre;                               // 0~100%, unit = 1%
+    float EvBatteryCapacity_pre;                        //1KWH
+    float EvBatteryEngergyRequest_pre;                      //1KWH
+    unsigned char ConnectorPlugIn_pre;                  //0: unplug, 1: Plug-in
+    unsigned char ConnectorPlugIn_new;                  //0: unplug, 1: Plug-in
+    unsigned char ConnectorLocked_pre;                  //0: unlocked, 1:locked.
+    float CpVoltage_pre;                                //
+    unsigned char CpState_pre;                          //1:state A, 2:State B1, 3:State B2, 4:State C, 5:State D, 6:State E, 7:State F, 8: Pilot error
+    unsigned char CpDuty_pre;                           //0~100%
+    float PpVoltage_pre;
+    unsigned char EVSEPrechargeStatus_pre;              //
+    unsigned char IsolationStatus_pre;                  //0:ongoing, 1:valid, 2:warning/fault
+    unsigned char DC_EVSEStatus_pre;
+    unsigned char SwitchCpStateE_status_pre;
+    unsigned char V2G_Rx_Msg_pre;
+    float AC_EVSENominalVoltage_pre;                    //unit: 1V
+};
+
+struct SysInfoData
+{
+    /**************System***************/
+    unsigned char SystemStatus;                     //0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
+    unsigned char FactoryConfiguration;             //0: normal, 1: trigger, charger will return the configuration to factory default if trigger
+    float InputVoltageR;                    //0~655.35 volt
+    float InputVoltageS;                        //0~655.35 volt
+    float InputVoltageT;                        //0~655.35 volt
+    unsigned int SystemFanRotaSpeed;            //0 ~ 65535 RPM
+    unsigned int PsuFanRotaSpeed;                   //0 ~ 65535 RPM
+    unsigned char AuxPower5V;                   //0 ~ 255 volt
+    unsigned char AuxPower12V;                      //0 ~ 255 volt
+    unsigned char AuxPower24V;                      //0 ~ 255 volt
+    unsigned char AuxPower48V;                      //0 ~ 255 volt
+    unsigned char CsuHwRev[32];                 //CSU board hardware version
+    unsigned char CsuBootLoadFwRev[32];             //CSU board bootloader firmware version
+    unsigned char CsuKernelFwRev[32];           //CSU board OS kernel firmware version
+    unsigned char CsuRootFsFwRev[32];           //CSU board root file system firmware version
+    unsigned char CsuPrimFwRev[32];                 //CSU board root file system firmware version
+    unsigned char LcmHwRev[32];                 //LCM module hardware version
+    unsigned char LcmFwRev[32];                 //LCM module firmware version
+    unsigned char PsuHwRev[32];                     //PSU hardware version
+    unsigned char PsuPrimFwRev[32];                 //PSU primary firmware version
+    unsigned char PsuSecFwRev[32];                  //PSU secondary firmware version
+    unsigned char AuxPwrHwRev[32];                  //Aux. power module hardware version
+    unsigned char AuxPwrFwRev[32];                  //Aux. power module firmware version
+    unsigned char FanModuleHwRev[32];           //Fan  module hardware version
+    unsigned char FanModuleFwRev[32];           //Fan  module firmware version
+    unsigned char RelayModuleHwRev[32];             //Relay control  module hardware version
+    unsigned char RelayModuleFwRev[32];             //Relay control  module firmware version
+    unsigned char TelcomModemFwRev[32];         //the 3G/4G modem firmware version
+    int SystemAmbientTemp;                  // -40 ~ 215 degree C
+    int SystemCriticalTemp;                 // -40 ~ 215 degree C
+    int CcsConnectorTemp;                   // -40 ~ 215 degree C
+    int PsuAmbientTemp;                     // -40 ~ 215 degree C
+    /**************Charging***************/
+    struct ChargingInfoData ChademoChargingData[CHAdeMO_QUANTITY];
+    struct ChargingInfoData CcsChargingData[CCS_QUANTITY];
+    struct ChargingInfoData GbChargingData[GB_QUANTITY];
+    /**************Network***************/
+    unsigned char InternetConn;                     //0: disconnected, 1: connected
+    /**************Backend***************/
+    unsigned char OcppConnStatus;               //0: disconnected, 1: connected
+};
+
+struct SysConfigAndInfo
+{
+    struct SysConfigData SysConfig;
+    struct SysInfoData SysInfo;
+};
+
+struct FaultCodeData
+{
+    unsigned char PreviousFaultVal[4];
+    union
+    {
+        unsigned char FaultVal[4];
+        struct
+        {
+            //FaultVal[0]
+            unsigned char ChademoOutputFuseBlew : 1;              //bit 0
+            unsigned char CcsOutputFuseBlew : 1;                  //bit 1
+            unsigned char GbOutputFuseBlew : 1;                       //bit 2
+            unsigned char RcdSelfTestFail : 1;                        //bit 3
+            unsigned char AcInputContactor1Welding : 1;           //bit 4
+            unsigned char AcInputContactor1DrivingFault : 1;          //bit 5
+            unsigned char AcInputContactor2Welding : 1;           //bit 6
+            unsigned char AcInputContactor2DrivingFault : 1;          //bit 7
+            //FaultVal[1]
+            unsigned char AcOutputRelayWelding : 1;               //bit 0
+            unsigned char AcOutputRelayDrivingFault : 1;              //bit 1
+            unsigned char ChademoOutputRelayWelding : 1;          //bit 2
+            unsigned char ChademoOutputRelayDrivingFault    : 1;     //bit 3
+            unsigned char CcsOutputRelayWelding : 1;              //bit 4
+            unsigned char CcsOutputRelayDrivingFault : 1;         //bit 5
+            unsigned char GbOutputRelayWelding : 1;               //bit 6
+            unsigned char GbOutputRelayDrivingFault : 1;              //bit 7
+            //FaultVal[2]
+            unsigned char AcConnectorTempSensorBroken : 1;            //bit 0
+            unsigned char ChademoConnectorTempSensorBroken : 1;   //bit 1
+            unsigned char CcsConnectorTempSensorBroken : 1;       //bit 2
+            unsigned char GbConnectorTempSensorBroken : 1;            //bit 3
+            unsigned char WiFiModuleBroken : 1;                   //bit 4
+            unsigned char Telecom4GModuleBroken : 1;              //bit 5
+            unsigned char AuxPowerModuleBroken : 1;               //bit 6
+            unsigned char RelayControlModuleBroken : 1;          //bit 7
+            //FaultVal[3]
+            unsigned char ChademoConnectorLockFail : 1;           //bit 0
+            unsigned char GbConnectorLockFail : 1;                    //bit 1
+            unsigned char AcConnectorLockFail : 1;                    //bit 2
+            unsigned char ChademoModuleBroken : 1;                //bit 3
+            unsigned char CcsModuleBroken : 1;                    //bit 4
+            unsigned char GbModuleBroken : 1;                     //bit 5
+            unsigned char PsuModuleBroken : 1;                        //bit 6
+            unsigned char : 1;                                   //bit 7		reserved
+        } bits;
+    } FaultEvents;
+};
+
+
+struct AlarmCodeData
+{
+    unsigned char PreviousAlarmVal[8];
+    union
+    {
+        unsigned char AlarmVal[8];
+        struct
+        {
+            //AlarmVal[0]
+            unsigned char SystemL1InputOVP : 1;                   //bit 0
+            unsigned char SystemL2InputOVP : 1;                   //bit 1
+            unsigned char SystemL3InputOVP : 1;                       //bit 2
+            unsigned char SystemL1InputUVP : 1;                   //bit 3
+            unsigned char SystemL2InputUVP : 1;                   //bit 4
+            unsigned char SystemL3InputUVP : 1;                   //bit 5
+            unsigned char PsuL1InputOVP : 1;                      //bit 6
+            unsigned char PsuL2InputOVP : 1;                      //bit 7
+            //AlarmVal[1]
+            unsigned char PsuL3InputOVP : 1;                      //bit 0
+            unsigned char PsuL1InputUVP : 1;                      //bit 1
+            unsigned char PsuL2InputUVP : 1;                      //bit 2
+            unsigned char PsuL3InputUVP : 1;                     //bit 3
+            unsigned char SystemL1InputDrop : 1;                  //bit 4
+            unsigned char SystemL2InputDrop : 1;                  //bit 5
+            unsigned char SystemL3InputDrop : 1;                  //bit 6
+            unsigned char SystemAcOutputOVP : 1;                  //bit 7
+            //AlarmVal[2]
+            unsigned char SystemAcOutputOCP : 1;                  //bit 0
+            unsigned char SystemChademoOutputOVP : 1;         //bit 1
+            unsigned char SystemChademoOutputOCP : 1;         //bit 2
+            unsigned char SystemCcsOutputOVP : 1;                 //bit 3
+            unsigned char SystemCcsOutputOCP : 1;                 //bit 4
+            unsigned char SystemGbOutputOVP : 1;                  //bit 5
+            unsigned char SystemGbOutputOCP : 1;                  //bit 6
+            unsigned char SystemAmbientOTP : 1;                  //bit 7
+            //AlarmVal[3]
+            unsigned char SystemCriticalPointOTP : 1;             //bit 0
+            unsigned char PsuAmbientOTP : 1;                      //bit 1
+            unsigned char PsuCriticalPointOTP : 1;                    //bit 2
+            unsigned char AuxPowerModuleOTP : 1;                  //bit 3
+            unsigned char RelayBoardOTP : 1;                      //bit 4
+            unsigned char ChademoConnectorOTP : 1;                //bit 5
+            unsigned char CcsConnectorOTP : 1;                    //bit 6
+            unsigned char GbConnectorOTP : 1;                 //bit 7
+            //AlarmVal[4]
+            unsigned char AcConnectorOTP : 1;                     //bit 0
+            unsigned char RcdTrip : 1;                                //bit 1
+            unsigned char ChademoGfdTrip : 1;                     //bit 2
+            unsigned char CcsGfdTrip : 1;                         //bit 3
+            unsigned char GbGfdTrip : 1;                          //bit 4
+            unsigned char SpdTrip : 1;                                //bit 5
+            unsigned char MainPowerBreakerTrip : 1;                   //bit 6
+            unsigned char AuxPowerBreakerTrip : 1;                    //bit 7
+            //AlarmVal[5]
+            unsigned char PsuCommunicationFail : 1;               //bit 0
+            unsigned char WiFiModuleCommFail : 1;                 //bit 1
+            unsigned char Telecom4GModuleCommFail : 1;            //bit 2
+            unsigned char RfidModuleCommFail : 1;                 //bit 3
+            unsigned char BluetoothModuleCommFail : 1;                //bit 4
+            unsigned char LcmModuleCommFail : 1;                  //bit 5
+            unsigned char AuxPowerModuleCommFail : 1;         //bit 6
+            unsigned char RelayBoardCommFail : 1;                 //bit 7
+            //AlarmVal[6]
+            unsigned char CcsModuleCommFail : 1;                  //bit 0
+            unsigned char ChademoModuleCommFail : 1;          //bit 1
+            unsigned char GbModuleCommFail : 1;                   //bit 2
+            unsigned char EmergencyStopTrip : 1;                  //bit 3
+            unsigned char DoorOpen : 1;                           //bit 4
+            unsigned char SystemFanDecay : 1;                     //bit 5
+            unsigned char FailToCreateShareMemory : 1;                //bit 6
+            unsigned char CsuInitFailed : 1;                          //bit 7
+            //AlarmVal[7]
+            unsigned char : 8;                                   //reserved
+        } bits;
+    } AlarmEvents;
+};
+
+
+struct InfoCodeData
+{
+    unsigned char PreviousInfoVal[8];
+    union
+    {
+        unsigned char InfoVal[8];
+        struct
+        {
+            //InfoVal[0]
+            unsigned char NormalStopChargingByUser : 1;                 //bit 0
+            unsigned char ChargingTimesUp : 1;                        //bit 1
+            unsigned char ReplaceSystemAirFilter : 1;                     //bit 2
+            unsigned char ReachChademoMaxPluggingTimes : 1;       //bit 3
+            unsigned char ReachCcsMaxPluggingTimes : 1;           //bit 4
+            unsigned char ReachGbMaxPluggingTimes : 1;            //bit 5
+            unsigned char ReachAcMaxPluggingTimes : 1;                //bit 6
+            unsigned char CsuFimrwareUpdateFail : 1;              //bit 7
+            //InfoVal[1]
+            unsigned char ChademoModuleFimrwareUpdateFail : 1;    //bit 0
+            unsigned char CcsModuleFimrwareUpdateFail : 1;            //bit 1
+            unsigned char GbModuleFimrwareUpdateFail : 1;         //bit 2
+            unsigned char AuxPowerModuleFimrwareUpdateFail : 1;       //bit 3
+            unsigned char RelayBoardFimrwareUpdateFail : 1;           //bit 4
+            unsigned char LcmModuleFimrwareUpdateFail : 1;            //bit 5
+            unsigned char BluetoothModuleFimrwareUpdateFail : 1;      //bit 6
+            unsigned char WiFiModuleFimrwareUpdateFail : 1;           //bit 7
+            //InfoVal[2]
+            unsigned char Telocom4GModuleFimrwareUpdateFail : 1;  //bit 0
+            unsigned char PsuFimrwareUpdateFail : 1;              //bit 1
+            unsigned char RfidModuleFimrwareUpdateFail : 1;           //bit 2
+            unsigned char ConfiguredByUsbFlashDrive : 1;              //bit 3
+            unsigned char ConfiguredByBackend : 1;                    //bit 4
+            unsigned char ConfiguredByWebpage : 1;                //bit 5
+            unsigned char InternetDisconnectViaEthernet : 1;          //bit 6
+            unsigned char InternetDisconnectViaWiFi : 1;             //bit 7
+            //InfoVal[3]
+            unsigned char InternetDisconnectVia4Gi : 1;               //bit 0
+            unsigned char ApDisconnectViaWiFi : 1;                    //bit 1
+            unsigned char ApnDisconnectVia4Gi : 1;                    //bit 2
+            unsigned char : 5;                                   //bit 3~7 reserved
+            //InfoVal[4]
+            unsigned char ChademoSeccCommFail : 1;              //bit 0
+            unsigned char CcsSeccCommFail : 1;                      //bit 1
+            unsigned char GbSeccCommFail : 1;                       //bit 2
+            unsigned char PilotFault : 1;                         //bit 3
+            unsigned char ChademoBatteryMalfun : 1;               //bit 4
+            unsigned char ChademoNoPermission : 1;                //bit 5
+            unsigned char ChademoBatteryIncompatibility : 1;          //bit 6
+            unsigned char ChademoBatteryOVP : 1;                  //bit 7
+            //InfoVal[5]
+            unsigned char ChademoBatteryUVP : 1;                  //bit 0
+            unsigned char ChademoBatteryOTP : 1;                  //bit 1
+            unsigned char ChademoBatteryCurrentDiff : 1;          //bit 2
+            unsigned char ChademoBatteryVoltageDiff : 1;          //bit 3
+            unsigned char ChademoShiftPosition : 1;                   //bit 4
+            unsigned char ChademoBatteryOtherFault : 1;           //bit 5
+            unsigned char ChademoChargingSystemError : 1;         //bit 6
+            unsigned char ChademoEvNormalStop : 1;                //bit 7
+            //InfoVal[6]
+            unsigned char : 8;                                   //bit 0~7 reserved
+            //InfoVal[7]
+            unsigned char BackendDisconnectedViaEthernet : 1;     //bit 0
+            unsigned char BackendDisconnectViaWiFi : 1;               //bit 1
+            unsigned char BackendDisconnectVia4G : 1;             //bit 2
+            unsigned char BackendRemoteStart : 1;                 //bit 3
+            unsigned char BackendRemoteStop : 1;                  //bit 4
+            unsigned char BackendRemoteReset : 1;                 //bit 5
+            unsigned char : 2;                                   //bit 6~7 reserved
+        } bits;
+    } InfoEvents;
+};
+
+struct StatusCodeData {
+    unsigned char PresentStatusCode[10][6];
+    struct FaultCodeData FaultCode;
+    struct AlarmCodeData AlarmCode;
+    struct InfoCodeData InfoCode;
+};
+
+/************************************************************************************/
+/**************************CCS protocol Share memory***************************/
+/**************************DIN70121: 201412***************************************/
+/**************************ISO15118_2014: 2014************************************/
+/**************************ISO15118_2018: 2018************************************/
+/************************************************************************************/
+typedef enum boolean { FALSE, TRUE } BOOL;
+
+enum ResponseCodeType_DIN70121 {
+    OK_DIN70121 =                               0,
+    OK_NewSessionEstablished_DIN70121 =         1,
+    OK_OldSessionJoined_DIN70121 =              2,
+    OK_CertificateExpiresSoon_DIN70121 =        3,
+    FAILED_DIN70121 =                           4,
+    FAILED_SequenceError_DIN70121 =             5,
+    FAILED_ServiceIDInvalid_DIN70121 =          6,
+    FAILED_UnknownSession_DIN70121 =            7,
+    FAILED_ServiceSelectionInvalid_DIN70121 =   8,
+    FAILED_PaymentSelectionInvalid_DIN70121 =   9,
+    FAILED_CertificateExpired_DIN70121 =        10,
+    FAILED_SignatureError_DIN70121 =            11,
+    FAILED_NoCertificateAvailable_DIN70121 =    12,
+    FAILED_CertChainError_DIN70121 =            13,
+    FAILED_ChallengeInvalid_DIN70121 =          14,
+    FAILED_ContractCanceled_DIN70121 =          15,
+    FAILED_WrongChargeParameter_DIN70121 =      16,
+    FAILED_PowerDeliveryNotApplied_DIN70121 =   17,
+    FAILED_TariffSelectionInvalid_DIN70121 =    18,
+    FAILED_ChargingProfileInvalid_DIN70121 =    19,
+    FAILED_EVSEPresentVoltageToLow_DIN70121 =   20,
+    FAILED_MeteringSignatureNotValid_DIN70121 = 21,
+    FAILED_WrongEnergyTransferType_DIN70121 =   22
+    };
+
+enum ResponseCodeType_ISO15118_2014 {
+    OK_ISO15118_2014 =                                      0,
+    OK_NewSessionEstablished_ISO15118_2014 =                1,
+    OK_OldSessionJoined_ISO15118_2014 =                     2,
+    OK_CertificateExpiresSoon_ISO15118_2014 =               3,
+    FAILED_ISO15118_2014 =                                  4,
+    FAILED_SequenceError_ISO15118_2014 =                    5,
+    FAILED_ServiceIDInvalid_ISO15118_2014 =                 6,
+    FAILED_UnknownSession_ISO15118_2014 =                   7,
+    FAILED_ServiceSelectionInvalid_ISO15118_2014 =          8,
+    FAILED_PaymentSelectionInvalid_ISO15118_2014 =          9,
+    FAILED_CertificateExpired_ISO15118_2014 =               10,
+    FAILED_SignatureError_ISO15118_2014 =                   11,
+    FAILED_NoCertificateAvailable_ISO15118_2014 =           12,
+    FAILED_CertChainError_ISO15118_2014 =                   13,
+    FAILED_ChallengeInvalid_ISO15118_2014 =                 14,
+    FAILED_ContractCanceled_ISO15118_2014 =                 15,
+    FAILED_WrongChargeParameter_ISO15118_2014 =             16,
+    FAILED_PowerDeliveryNotApplied_ISO15118_2014 =          17,
+    FAILED_TariffSelectionInvalid_ISO15118_2014 =           18,
+    FAILED_ChargingProfileInvalid_ISO15118_2014 =           19,
+    FAILED_MeteringSignatureNotValid_ISO15118_2014 =        20,
+    FAILED_NoChargeServiceSelected_ISO15118_2014 =          21,
+    FAILED_WrongEnergyTransferMode_ISO15118_2014 =          22,
+    FAILED_ContactorError_ISO15118_2014 =                   23,
+    FAILED_CertificateNotAllowedAtThisEVSE_ISO15118_2014 =  24,
+    FAILED_CertificateRevoked_ISO15118_2014 =               25
+    };
+
+enum ResponseCodeType_ISO15118_2018 {
+    OK_ISO15118_2018 =                                      0,
+    OK_NewSessionEstablished_ISO15118_2018 =                1,
+    OK_OldSessionJoined_ISO15118_2018 =                     2,
+    OK_CertificateExpiresSoon_ISO15118_2018 =               3,
+    OK_IsolationValid_ISO15118_2018 =                       4,
+    OK_IsolationWarning_ISO15118_2018 =                     5,
+    WARNING_CertificateExpired_ISO15118_2018 =              6,
+    WARNING_NoCertificateAvailable_ISO15118_2018 =          7,
+    WARNING_CertValidationError_ISO15118_2018 =             8,
+    WARNING_CertVerificationError_ISO15118_2018 =           9,
+    WARNING_ContractCanceled_ISO15118_2018 =                10,
+    FAILED_ISO15118_2018 =                                  11,
+    FAILED_SequenceError_ISO15118_2018 =                    12,
+    FAILED_ServiceIDInvalid_ISO15118_2018 =                 13,
+    FAILED_UnknownSession_ISO15118_2018 =                   14,
+    FAILED_ServiceSelectionInvalid_ISO15118_2018 =          15,
+    FAILED_SignatureError_ISO15118_2018 =                   16,
+    FAILED_IdentificationSelectionInvalid_ISO15118_2018 =   17,
+    FAILED_ChallengeInvalid_ISO15118_2018 =                 18,
+    FAILED_WrongChargeParameter_ISO15118_2018 =             19,
+    FAILED_IsolationFault_ISO15118_2018 =                   20,
+    FAILED_PowerDeliveryNotApplied_ISO15118_2018 =          21,
+    FAILED_TariffSelectionInvalid_ISO15118_2018 =           22,
+    FAILED_ChargingProfileInvalid_ISO15118_2018 =           23,
+    FAILED_MeteringSignatureNotValid_ISO15118_2018 =        24,
+    FAILED_NoChargeServiceSelected_ISO15118_2018 =          25,
+    FAILED_WrongEnergyTransferMode_ISO15118_2018 =          26,
+    FAILED_ContactorError_ISO15118_2018 =                   27,
+    FAILED_CertificateRevoked_ISO15118_2018 =               28,
+    FAILED_CertificateNotYetValid_ISO15118_2018 =           29
+    };
+
+enum EVSENotificationType { None = 0, StopCharging = 1, ReNegotiation = 2};
+enum ServiceCategoryType { EVCharging = 0, Internet = 1, ContractCertificate = 2, OtherCustom = 3};
+enum PaymentOptionType { Contract = 0, ExternalPayment = 1};
+/*enum EVSESupportedEnergyTransferType  { AC_single_phase_core = 0, AC_three_phase_core = 1, DC_core = 2, DC_extended = 3,
+                                      DC_combo_core = 4, DC_dual = 5, AC_core1p_DC_extended = 6, AC_single_DC_core = 7,
+                                      AC_single_phase_three_phase_core_DC_extended = 8, AC_core3p_DC_extended = 9};*/
+enum EnergyTransferModeType {
+    AC_single_phase_core =  0,
+    AC_three_phase_core =   1,
+    DC_core =               2,
+    DC_extended =           3,
+    DC_combo_core =         4,
+    DC_unique =             5
+    };
+
+//enum identificationOptionType             { Contract = 0, ExternalIdentification = 1};
+enum unitSymbolType_DIN70121 {
+    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};
+
+enum unitSymbolType_ISO15118_2014 {
+    h_ISO15118_2014 = 0,
+    m_ISO15118_2014 = 1,
+    s_ISO15118_2014 = 2,
+    A_ISO15118_2014 = 3,
+    V_ISO15118_2014 = 4,
+    W_ISO15118_2014 = 5,
+    Wh_ISO15118_2014 = 6
+};
+
+enum ProcessingType { Finished = 0, Ongoing = 1, Ongoing_WaitingForCustomerInteraction = 2};
+enum EVSEProcessingType_DIN70121 { Finished_DIN70121 = 0, Ongoing_DIN70121 = 1};
+enum EVSEProcessingType_ISO15118_2014 { Finished_ISO15118_2014 = 0, Ongoing_ISO15118_2014 = 1, Ongoing_WaitingForCustomerInteraction_ISO15118_2014=2 };
+
+enum DC_EVErrorCodeType {
+        NO_ERROR = 0,
+        FAILED_RESSTemperatureInhibit = 1,
+        FAILED_EVShiftPosition = 2,
+        FAILED_ChargerConnectorLockFault = 3,
+        FAILED_EVRESSMalfunction = 4,
+        FAILED_ChargingCurrentdifferential = 5,
+        FAILED_ChargingVoltageOutOfRange = 6,
+        Reserved_A = 7,
+        Reserved_B = 8,
+        Reserved_C = 9,
+        FAILED_ChargingSystemIncompatibility = 10,
+        NoData = 11
+    };
+
+enum IsolationLevelType_DIN70121 {
+        Invalid_DIN70121 = 0,
+        Valid_DIN70121 = 1,
+        Warning_DIN70121 = 2,
+        Fault_DIN70121 = 3
+};
+
+enum IsolationLevelType_ISO15118_2014 {
+        Invalid_ISO15118_2014 = 0,
+        Valid_ISO15118_2014 = 1,
+        Warning_ISO15118_2014 = 2,
+        Fault_ISO15118_2014 = 3,
+        No_IMD_ISO15118_2014   = 4
+};
+
+enum DC_EVSEStatusCodeType {
+        EVSE_NotReady = 0,
+        EVSE_Ready = 1,
+        EVSE_Shutdown = 2,
+        EVSE_UtilityInterruptEvent = 3,
+        EVSE_IsolationMonitoringActive = 4,
+        EVSE_EmergencyShutdown = 5,
+        EVSE_Malfunction = 6,
+        Reserved_8 = 7,
+        Reserved_9 = 8
+};
+
+enum ScheduleOriginType { EV = 0, SA = 1};
+enum ChargeProgressType_ISO15118_2014 {start_ISO15118_2014 = 0, Stop_ISO15118_2014 = 1, Renegotiate_ISO15118_2014 = 2};
+enum ChargeProgressType_ISO15118_2018 {start_ISO15118_2018 = 0, Renegotiate_ISO15118_2018 = 1, Standby_ISO15118_2018 = 2, Stop_ISO15118_2018 = 3};
+enum evOperationType {Charge = 0, Discharge = 1, Standby = 2};
+enum mechanicalChargingDeviceStatusType {Home = 0, Moving = 1, EndPosition = 2};
+enum EV_CP_StatusType {A = 0, B = 1, C = 2, D = 3, E = 4, F = 5};
+enum EV_Error_Status_CodeType { No_EV_Error = 0, EV_FAILED_EmergencyEvent = 1, EV_FAILED_Breaker = 2, EV_FAILED_RESSTemperatureInhibit = 3,
+                                EV_FAILED_RESS = 4, EV_FAILED_ChargingCurrentDifferential = 5, EV_FAILED_ChargingVoltageOutOfRange = 6,
+                                Reserved_by_ISO_1 = 7,  Reserved_by_ISO_2 = 8, Reserved_by_ISO_3 = 9, OEM1 = 10,
+                                OEM2 = 11,  OEM3 = 12, OEM4 = 13};
+enum IsolationStatusType { Invalid = 0, Safe = 1, Warning = 2, Fault = 3};
+enum ChargingSessionType { Terminate = 0, Pause = 1};
+enum CostKindType { relativePricePercentage = 0, RenewableGenerationPercentage = 1, CarbonDioxideEmission = 2};
+
+enum MsgFlowStatus {
+    IDLE = 0,
+    CM_SLAC_PARM_REQ =                      1,
+    CM_SLAC_PARM_CONF =                     2,
+    CM_START_ATTEN_CHAR_IND =               3,
+    CM_MNBC_SOUND_IND =                     4,
+    CM_ATTEN_CHAR_IND =                     5,
+    CM_ATTEN_CHAR_RSP =                     6,
+    CM_VALIDATE_REQ =                       7,
+    CM_VALIDATE_CNF =                       8,
+    CM_SLAC_MATCH_REQ =                     9,
+    CM_SLAC_MATCH_CNF =                     10,
+    CM_AMP_MAP_REQ =                        11,
+    CM_AMP_MAP_CNF =                        12,
+    CM_SET_KEY_REQ =                        13,
+    CM_SET_KEY_CNF =                        14,
+    SLACC_SDP_UDP_Connection =              15,
+    SLACC_SDP_TCP_Connection =              16,
+    SupportedAppProtocolRequest =           17,
+    SupportedAppProtocolResponse =          18,
+    SessionSetupRequest =                   19,
+    SessionSetupResponse =                  20,
+    ServiceDiscoveryRequest =               21,
+    ServiceDiscoveryResponse =              22,
+    ServiceDetailRequest =                  23,
+    ServiceDetailResponse =                 24,
+    ServiceAndPaymentSelectionRequest =     25,
+    ServiceAndPaymentSelectionResponse =    26,
+    PaymentDetailsRequest =                 27,
+    PaymentDetailsResponse =                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,
+    PowerDeliveryRequestStart =             41,
+    PowerDeliveryResponsetStart =           42,
+    ChargingStatusRequest =                 43,
+    ChargingStatusResponse =                44,
+    CurrentDemandRequest =                  45,
+    CurrentDemandResponse =                 46,
+    MeteringReceiptRequest =                47,
+    MeteringReceiptResponse =               48,
+    PowerDeliveryRequestStop =              49,
+    PowerDeliveryResponseStop =             50,
+    WeldingDetectionRequest =               51,
+    WeldingDetectionResponse =              52,
+    SessionStopRequest =                    53,
+    SessionStopResponse =                   54,
+    Performance_Timeout =                   253,
+    Sequence_Timeout =                      254,
+    Other_Fault =                           255
+};
+
+
+struct PhysicalValueType_DIN70121 {              //The final physical value is determined by: Value * 10 ^ Multiplier [Unit]
+    int Multiplier;                              //range: -3..+3
+    enum unitSymbolType_DIN70121 Unit;
+    short Value;
+};
+struct PhysicalValueType_ISO15118_2014 {        //The final physical value is determined by: Value * 10 ^ Multiplier [Unit]
+    int Multiplier;                             //range: -3..+3
+    enum unitSymbolType_ISO15118_2014 Unit;
+    short Value;
+};
+struct PhysicalValueType_ISO15118_2018          //The final physical value is determined by: Value * 10 ^ Exponent [Unit]
+{
+    int Exponent;                                       //range: -3..+3
+    short Value;
+};
+struct AppProtocolType {
+    unsigned char ProtocolNamespace[100];
+    unsigned int ProtocolNamespaceLen;
+    unsigned int VersionNumberMajor;
+    unsigned int VersionNumberMinor;
+    unsigned char SchemaID;
+    unsigned char Priority;                     //range 1..20
+};
+struct ACD_SSEnergyTransferModeType
+{
+    unsigned char EVID[20];
+};
+struct EVSEStatusType
+{
+    unsigned short NotificationMaxDelay;                //in seconds
+    enum EVSENotificationType EVSENotification;
+};
+struct ServiceIDListType
+{
+    unsigned short ServiceID[10];   //refer to chapter 8.6.2.1 Table 192
+};
+struct PaymentOptionListType
+{
+    enum PaymentOptionType PaymentOption[2];
+};
+struct ServiceTagType
+{
+    unsigned short ServiceID;
+    unsigned char ServiceName[32];              //Optional Element
+    enum ServiceCategoryType ServiceCategory;
+    unsigned char ServiceScope[32];              //Optional Element
+};
+struct ServiceType_DIN70121
+{
+    struct ServiceTagType ServiceTag;
+    BOOL FreeService;
+};
+struct ServiceType_ISO15118_2014
+{
+    unsigned short ServiceID;
+    unsigned char ServiceName[32];                  //Optional
+    enum ServiceCategoryType ServiceCategory;
+    unsigned char ServiceScope[64];                 //Optional
+    BOOL FreeService;
+};
+/*struct ServiceType_ISO15118_2018
+   {
+    unsigned short				ServiceID;
+    BOOL					FreeService;
+   }; */
+struct SupportedEnergyTransferModeType
+{
+    enum EnergyTransferModeType EnergyTransferMode[6];
+};
+struct ServiceChargeType
+{
+    struct ServiceType_DIN70121 Services;
+    //enum EVSESupportedEnergyTransferType		EnergyTransferType;
+    enum EnergyTransferModeType EnergyTransferType;
+};
+
+struct ChargeServiceType
+{
+    struct ServiceType_ISO15118_2014 Services;
+    struct SupportedEnergyTransferModeType SupportedEnergyTransferMode;
+};
+struct ServiceListType
+{
+    struct ServiceType_ISO15118_2014 Service[8];
+};
+struct IdentificationOptionListType
+{
+    enum PaymentOptionType IdentificationOption[2];
+};
+struct ParameterType
+{
+    unsigned char Name[32];
+    struct PhysicalValueType_ISO15118_2014 PhysicalValue_ISO15118_2014;
+    struct PhysicalValueType_ISO15118_2018 PhysicalValue_ISO15118_2018;
+};
+struct ParameterSetType
+{
+    short ParameterSetID;
+    struct ParameterType Parameter[16];
+};
+struct ServiceParameterListType
+{
+    struct ParameterSetType ParameterSet[255];
+};
+struct WPT_SDlEnergyTransferModeType
+{
+    struct ServiceParameterListType ServiceParameterList;
+};
+struct SelectedServiceType
+{
+    unsigned short ServiceID;
+    short ParameterSetID;
+};
+struct SelectedServiceListType
+{
+    struct SelectedServiceType SelectedService[16];
+    unsigned int SelectedServiceLen;
+};
+
+struct CertificateChainType
+{
+    unsigned char Id[32];                           //Optional
+    unsigned char Certificate[800];                     //check size again
+    unsigned char SubCertificates[4][800];                  //Optional,     check size again
+};
+struct PNC_AReqIdentificationModeType
+{
+    unsigned char GenChallenge[16];                             //DIN70121=> None,	ISO15118_2014=>None,	ISO15118_2018=>Optional
+    unsigned char Id[32];                                   //DIN70121=> None,	ISO15118_2014=>None,	ISO15118_2018=>Optional
+};
+struct AC_EVChargeParameterType
+{
+    unsigned int DepartureTime;                                     //Optional
+    struct PhysicalValueType_ISO15118_2014 EAmount;
+    struct PhysicalValueType_ISO15118_2014 EVMaxVoltage;
+    struct PhysicalValueType_ISO15118_2014 EVMaxCurrent;
+    struct PhysicalValueType_ISO15118_2014 EVMinCurrent;
+};
+struct DC_EVStatusType_DIN70121
+{
+    BOOL EVReady;
+    BOOL EVCabinConditioning;
+    BOOL EVRESSConiditioning;
+    enum DC_EVErrorCodeType EVErrorCode;
+    unsigned char EVRESSSOC;                        /*0-100 percentage*/
+};
+struct DC_EVChargeParameterType_DIN70121
+{
+    struct DC_EVStatusType_DIN70121 DC_EVStatus;
+    struct PhysicalValueType_DIN70121 EVMaximumCurrentLimit;
+    struct PhysicalValueType_DIN70121 EVMaximumPowerLimit;                      //Optional
+    struct PhysicalValueType_DIN70121 EVMaximumVoltageLimit;
+    struct PhysicalValueType_DIN70121 EVEnergyCapacity;                         //Optional
+    struct PhysicalValueType_DIN70121 EVEnergyRequest;                          //Optional
+    unsigned char FullSOC; /*0-100 percentage*/                                 //Optional
+    unsigned char BulkSOC; /*0-100 percentage*/                             //Optional
+};
+struct DC_EVStatusType_ISO15118_2014
+{
+    BOOL EVReady;
+    enum DC_EVErrorCodeType EVErrorCode;
+    unsigned char EVRESSSOC;                        /*0-100 percentage*/
+};
+struct DC_EVChargeParameterType_ISO15118_2014
+{
+    unsigned int DepartureTime;                                             //Optional
+    struct DC_EVStatusType_ISO15118_2014 DC_EVStatus;
+    struct PhysicalValueType_ISO15118_2014 EVMaximumCurrentLimit;
+    struct PhysicalValueType_ISO15118_2014 EVMaximumPowerLimit;                     //Optional
+    struct PhysicalValueType_ISO15118_2014 EVMaximumVoltageLimit;
+    struct PhysicalValueType_ISO15118_2014 EVEnergyCapacity;                        //Optional
+    struct PhysicalValueType_ISO15118_2014 EVEnergyRequest;                         //Optional
+    unsigned char FullSOC; /*0-100 percentage*/                                     //Optional
+    unsigned char BulkSOC; /*0-100 percentage*/                                 //Optional
+};
+struct Dynamic_CPDReqControlModeType
+{
+    unsigned int DepartureTime;
+};
+struct RelativeTimeIntervalType
+{
+    unsigned int duration;              //Optional
+    unsigned int start;
+};
+struct PMaxScheduleEntryType
+{
+    struct RelativeTimeIntervalType RelativeTimeInterval;
+    unsigned short PMax;
+};
+struct PMaxScheduleType
+{
+    unsigned short PMaxScheduleID;                          //no this itme in ISO15118_2014
+    struct PMaxScheduleEntryType PMaxScheduleEntry[1024];
+};
+struct CostType
+{
+    unsigned int amount;
+    enum CostKindType costKind;
+    int amountMultiplier;                                   //Optional , range: -3..+3
+};
+struct ConsumptionCostType
+{
+    struct CostType Cost[3];
+    struct PhysicalValueType_ISO15118_2014 startValue;
+};
+struct SalesTariffEntryType
+{
+    struct RelativeTimeIntervalType RelativeTimeInterval;
+    unsigned char EPriceLevel;                              //Optional
+    struct ConsumptionCostType ConsumptionCost[3];      //Optional
+};
+struct SalesTariffType
+{
+    unsigned char Id[32];                                   //Optional
+    short SalesTariffID;
+    unsigned char SalesTariffDescription[32];                   //Optional
+    unsigned char NumEPriceLevels;                              //Optional
+    struct SalesTariffEntryType SalesTariffEntry[1024];
+};
+struct SAScheduleTupleType
+{
+    short SAScheduleTupleID;
+    struct PMaxScheduleType PMaxSchedule;
+    struct SalesTariffType SalesTariff;                             //Optional
+};
+struct ScheduleListType
+{
+    enum ScheduleOriginType ScheduleOrigin;
+    struct SAScheduleTupleType ScheduleTuple[3];
+};
+struct Scheduled_CPDReqControlModeType
+{
+    enum ProcessingType EVProcessing;
+    unsigned int DepartureTime;                                     //Optional
+    unsigned short MaxSupportingPoints;
+    struct ScheduleListType ScheduleList;                               //Optional
+};
+struct AC_CPDReqEnergyTransferModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVTargetEnergyRequest;                   //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMaximumEnergyRequest;              //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMinimumEnergyRequest;              //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargePower;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumVoltage;
+};
+struct DC_CPDReqEnergyTransferModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargePower;                    //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMinimumChargePower;                    //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumVoltage;
+    struct PhysicalValueType_ISO15118_2018 EVTargetEnergyRequest;                       //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMaximumEnergyRequest;                  //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMinimumEnergyRequest;                  //Optional
+    unsigned char TargetSOC;                                                    //Optional
+    unsigned char BulkSOC;                                                          //Optional
+};
+struct BPT_AC_CPDReqEnergyTransferModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargePower;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumDischargePower;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumDischargePower;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumDischargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumDischargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVTargetEnergyRequest;                       //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMinimumEnergyRequest;                  //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMaximumEnergyRequest;                  //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMaximumVoltage;
+};
+struct BPT_DC_CPDReqEnergyTransferModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargePower;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumChargePower;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumDischargePower;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumDischargePower;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumDischargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumDischargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumVoltage;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumVoltage;
+    struct PhysicalValueType_ISO15118_2018 EVTargetEnergyRequest;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumEnergyRequest;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumEnergyRequest;
+    unsigned char TargetSOC;                                                //Optional
+    unsigned char BulkSOC;                                                      //Optional
+};
+struct WPT_CPDReqEnergyTransferModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVMaximumPower;                      //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMinimumPower;                      //Optional
+    struct PhysicalValueType_ISO15118_2018 EVTargetEnergyRequest;                   //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMaximumEnergyRequest;              //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMinimumEnergyRequest;              //Optional
+};
+struct ACD_CPDReqEnergyTransferModeType
+{
+    //cannot be found in standard
+};
+struct SAScheduleListType
+{
+    struct SAScheduleTupleType SAScheduleTuple[3];
+};
+struct DC_EVSEStatusType_DIN70121
+{
+    enum IsolationLevelType_DIN70121 EVSEIsolationStatus;                       //Optional
+    enum DC_EVSEStatusCodeType EVSEStatusCode;
+    unsigned int NotificationMaxDelay;
+    enum EVSENotificationType EVSENotification;
+};
+struct DC_EVSEChargeParameterType_DIN70121
+{
+    struct DC_EVSEStatusType_DIN70121 DC_EVSEStatus;
+    struct PhysicalValueType_DIN70121 EVSEMaximumCurrentLimit;
+    struct PhysicalValueType_DIN70121 EVSEMaximumPowerLimit;                    //Optional
+    struct PhysicalValueType_DIN70121 EVSEMaximumVoltageLimit;
+    struct PhysicalValueType_DIN70121 EVSEMinimumCurrentLimit;
+    struct PhysicalValueType_DIN70121 EVSEMinimumVoltageLimit;
+    struct PhysicalValueType_DIN70121 EVSECurrentRegulationTolerance;               //Optional
+    struct PhysicalValueType_DIN70121 EVSEPeakCurrentRipple;
+    struct PhysicalValueType_DIN70121 EVSEEnergyToBeDelivered;                      //Optional
+};
+struct AC_EVSEStatusType_ISO15118_2014
+{
+    BOOL RCD;
+    unsigned short NotificationMaxDelay;
+    enum EVSENotificationType EVSENotification;                         //need to be confirmed
+};
+struct AC_EVSEChargeParameterType_ISO15118_2014
+{
+    struct AC_EVSEStatusType_ISO15118_2014 AC_EVSEStatus;
+    struct PhysicalValueType_ISO15118_2014 EVSENominalVoltage;
+    struct PhysicalValueType_ISO15118_2014 EVSEMaxCurrent;
+};
+struct DC_EVSEStatusType_ISO15118_2014
+{
+    unsigned short NotificationMaxDelay;
+    enum EVSENotificationType EVSENotification;
+    enum IsolationLevelType_ISO15118_2014 EVSEIsolationStatus;                              //Optional
+    enum DC_EVSEStatusCodeType DC_EVSEStatusCode;
+};
+struct DC_EVSEChargeParameterType_ISO15118_2014
+{
+    struct DC_EVSEStatusType_ISO15118_2014 DC_EVSEStatus;
+    struct PhysicalValueType_ISO15118_2014 EVSEMaximumCurrentLimit;
+    struct PhysicalValueType_ISO15118_2014 EVSEMaximumPowerLimit;
+    struct PhysicalValueType_ISO15118_2014 EVSEMaximumVoltageLimit;
+    struct PhysicalValueType_ISO15118_2014 EVSEMinimumCurrentLimit;
+    struct PhysicalValueType_ISO15118_2014 EVSEMinimumVoltageLimit;
+    struct PhysicalValueType_ISO15118_2014 EVSECurrentRegulationTolerance;              //Optional
+    struct PhysicalValueType_ISO15118_2014 EVSEPeakCurrentRipple;
+    struct PhysicalValueType_ISO15118_2014 EVSEEnergyToBeDelivered;                     //Optional
+};
+struct Scheduled_CPDResControlModeType
+{
+    struct ScheduleListType ScheduleList;
+};
+struct AC_CPDResEnergyTransferModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargeCurrent[3];
+    struct PhysicalValueType_ISO15118_2018 EVSENominalVoltage;
+    struct PhysicalValueType_ISO15118_2018 EVSENominalFrequency;
+};
+struct DC_CPDResEnergyTransferModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargePower;
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVSEMinimumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumVoltage;
+    struct PhysicalValueType_ISO15118_2018 EVSEMinimumVoltage;
+};
+struct BPT_AC_CPDResEnergyTransferModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargeCurrent[3];
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumDischargeCurrent[3];
+    struct PhysicalValueType_ISO15118_2018 EVSENominalVoltage;
+    struct PhysicalValueType_ISO15118_2018 EVSENominalFrequency;
+};
+struct BPT_DC_CPDResEnergyTransferModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargePower;
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumDischargePower;
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumDischargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVSEMinimumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVSEMinimumDischargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumVoltage;
+    struct PhysicalValueType_ISO15118_2018 EVSEMinimumVoltage;
+};
+struct WPT_CPDResEnergyTransferModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumPower;
+    struct PhysicalValueType_ISO15118_2018 EVSEMinimumPower;
+};
+struct ACD_CPDResEnergyTransferModeType
+{
+    //not found in ISO15118_2018
+};
+struct ProfileEntryType_DIN70121
+{
+    unsigned int ChargingProfileEntryStart;
+    short ChargingProfileEntryMaxPower;
+};
+struct ChargingProfileType_DIN70121
+{
+    short SAScheduleTupleID;
+    struct ProfileEntryType_DIN70121 ProfileEntry[24];
+};
+struct DC_EVPowerDeliveryParameterType_DIN70121
+{
+    struct DC_EVStatusType_DIN70121 DC_EVStatus;
+    BOOL BulkChargingComplete;                                      //Optional
+    BOOL ChargingComplete;
+};
+struct ProfileEntryType_ISO15118_2014
+{
+    unsigned int ChargingProfileEntryStart;
+    struct PhysicalValueType_ISO15118_2018 ChargingProfileEntryMaxPower;
+    unsigned char ChargingProfileEntryMaxNumberOfPhasesInUse;                               //Optional
+};
+struct ChargingProfileType_ISO15118_2014
+{
+    struct ProfileEntryType_ISO15118_2014 ProfileEntry[24];
+};
+struct DC_EVPowerDeliveryParameterType_ISO15118_2014
+{
+    struct DC_EVStatusType_ISO15118_2014 DC_EVStatus;
+    BOOL BulkChargingComplete;                                          //Optional
+    BOOL ChargingComplete;
+};
+struct TimeInterval
+{
+    unsigned int start;
+    unsigned int duration;                                              //Optional
+};
+struct PowerScheduleEntryType
+{
+    struct TimeInterval TimeInterval;
+    struct PhysicalValueType_ISO15118_2018 Power[3];
+};
+struct EVPowerProfileType
+{
+    struct PowerScheduleEntryType EVPowerProfileEntry[2048];
+};
+struct Scheduled_PDReqControlModeType
+{
+    unsigned char ScheduleTupleID;
+    struct EVPowerProfileType EVPowerProfile;
+};
+struct BPT_Scheduled_PDReqControlModeType
+{
+    unsigned char ScheduleTupleID;
+    struct EVPowerProfileType EVPowerProfile;                           //Optional
+    enum evOperationType EVOperation;
+};
+struct ListOfRootCertificateIDsType
+{
+    unsigned char RootCertificateID[20][40];
+};
+struct ContractSignatureEncryptedPrivateKeyType
+{
+    unsigned char Id[32];
+};
+struct DiffieHellmanPublickeyType
+{
+    unsigned char Id[32];
+};
+struct ContractCertificateEncryptedPrivateKeyType
+{
+    unsigned char Id[32];
+};
+struct EVTechnicalStatusType
+{
+    BOOL EV_Status_ReadyToCharge;
+    BOOL EV_Status_ImmobilizationRequest;                                           //Optional
+    BOOL EV_Status_Immobilized;
+    struct PhysicalValueType_ISO15118_2018 EV_Status_WLAN_Strength;
+    enum EV_CP_StatusType EV_CP_Status;
+    unsigned char EV_Status_RESSSOC;                                                //0~100%
+    enum EV_Error_Status_CodeType EV_Error_Status_Code;
+    BOOL EVSE_Timeout;
+};
+struct MeterInfoType_ISO15118_2014
+{
+    unsigned char MeterID[32];
+    unsigned long MeterReading;                                                     //Optional
+    unsigned char SigMeterReading[64];                                              //Optional
+    short MeterStatus;                                                          //Optional
+    long TMeter;                                                           //Optional
+};
+struct Scheduled_MRReqControlModeType
+{
+    unsigned char ScheduleTupleID;
+};
+struct MeterInfoType_ISO15118_2018
+{
+    unsigned char MeterID[32];
+    unsigned long MeterReadingWhCharged;                                        //Optional
+    unsigned long MeterReadingWhDischarged;                                         //Optional
+    unsigned long MeterReadingVARhLeading;                                          //Optional
+    unsigned long MeterReadingVARhLagging;                                          //Optional
+    unsigned char SignatureMeterReading[64];                                        //Optional
+    short MeterStatus;                                                          //Optional
+    short TimeStampMeter;                                                   //Optional
+    BOOL ReceiptRequired;                                                       //Optional
+};
+struct PnC_CLReqIdentificationModeType
+{
+    BOOL MeteringReceiptRequested;
+};
+struct Dynamic_CSReqControlModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVTargetEnergyRequest;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumEnergyRequest;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumEnergyRequest;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargePower;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargeCurrent;
+    struct PhysicalValueType_ISO15118_2018 EVMinimumChargeCurrent;
+};
+struct Scheduled_CSReqControlModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVTargetEnergyRequest;                       //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMaximumEnergyRequest;                  //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMinimumEnergyRequest;                  //Optional
+    BOOL Standby;
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargePower;                    //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMaximumChargeCurrent;                  //Optional
+    struct PhysicalValueType_ISO15118_2018 EVMinimumChargeCurrent;                  //Optional
+};
+struct DisplayParametersType
+{
+    unsigned short CurrentRange;
+    unsigned char CurrentSOC;                                                   //0~100%
+    unsigned char MinimumSOC;                                                   //0~100%
+    struct PhysicalValueType_ISO15118_2018 RemainingTimeToMaximumSOC;
+    struct PhysicalValueType_ISO15118_2018 RemainingTimeToTargetSOC;
+    struct PhysicalValueType_ISO15118_2018 RemainingTimeToBulkSOC;
+    struct PhysicalValueType_ISO15118_2018 RemainingTimeToMinimumSOC;
+    BOOL ChargingComplete;
+    BOOL BulkChargingComplete;
+    BOOL InletHot;
+};
+struct PnC_CLResIdentificationModeType
+{
+    struct MeterInfoType_ISO15118_2018 MeterInfo;
+};
+struct Dynamic_CSResControlModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVSETargetActivePower;
+};
+struct Scheduled_CDResControlModeType
+{
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargePower;              //Optional
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargeCurrent;            //Optional
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumVoltage;                  //Optional
+};
+struct LFA_EVFinePositioningSetupParametersType
+{
+    unsigned char NumberOfSensors;
+    //NOT complete yet,  to be continue.....
+};
+
+/****SupportedAppProtocolRequest****/
+struct SupportedAppProtocolRequest_DIN70121 {
+    struct AppProtocolType AppProtocol[20];
+};
+struct SupportedAppProtocolRequest_ISO15118_2014
+{
+    struct AppProtocolType AppProtocol[20];
+};
+struct SupportedAppProtocolRequest_ISO15118_2018
+{
+    struct AppProtocolType AppProtocol[20];
+};
+/****SupportedAppProtocolResponse****/
+struct SupportedAppProtocolResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+    unsigned char SchemaID;                                         //Optional
+};
+struct SupportedAppProtocolResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    unsigned char SchemaID;                                         //Optional
+};
+struct SupportedAppProtocolResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    unsigned char SchemaID;                                             //Optional
+};
+/****SessionSetupRequest****/
+struct SessionSetupRequest_DIN70121
+{
+    unsigned char EVCCID[8];                                            //the MAC address of the EVCC in Hex
+};
+struct SessionSetupRequest_ISO15118_2014
+{
+    unsigned char EVCCID[8];                                            //the MAC address of the EVCC in Hex
+};
+struct SessionSetupRequest_ISO15118_2018
+{
+    unsigned char EVCCID[8];                                            //the MAC address of the EVCC in Hex
+    struct ACD_SSEnergyTransferModeType ACD_SSEnergyTransferMode;           //For ACD mandatory, optional for rest
+};
+/****SessionSetupResponse****/
+struct SessionSetupResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+    unsigned char EVSEID[40];                                           //DIN70121=>Max length:32,	ISO15118=>min length:7, max length:37
+    long EVSETimeStamp;                                         //EPOCH format, Optional
+};
+struct SessionSetupResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    unsigned char EVSEID[40];                                           //DIN70121=>Max length:32,	ISO15118=>min length:7, max length:37
+    long EVSETimeStamp;                                         //EPOCH format, Optional
+};
+struct SessionSetupResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    unsigned char EVSEID[40];                                           //DIN70121=>Max length:32,	ISO15118=>min length:7, max length:37
+    struct EVSEStatusType EVSEStatus;                                   //Optional
+};
+/****ServiceDiscoveryRequest****/
+struct ServiceDiscoveryRequest_DIN70121
+{
+    unsigned char ServiceScope[32];                     //Optional
+    unsigned int ServiceScopeLen;
+    enum ServiceCategoryType ServiceCategory;           //Optional
+};
+struct ServiceDiscoveryRequest_ISO15118_2014
+{
+    unsigned char ServiceScope[32];                     //Optional
+    unsigned int ServiceScopeLen;
+    enum ServiceCategoryType ServiceCategory;           //Optional
+};
+struct ServiceDiscoveryRequest_ISO15118_2018
+{
+    struct ServiceIDListType SupportedServiceIDs;           //Optional
+};
+/****ServiceDiscoveryResponse****/
+struct ServiceDiscoveryResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+    struct PaymentOptionListType PaymentOptions;
+    struct ServiceChargeType ChargeService_DIN70121;
+};
+struct ServiceDiscoveryResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    struct PaymentOptionListType PaymentOptions;
+    struct ChargeServiceType ChargeService;
+    struct ServiceListType ServiceList;                                     //Optional
+};
+struct ServiceDiscoveryResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                   //Optional
+    struct IdentificationOptionListType IdentificationOptionList;
+    struct ServiceListType EnergyTransferServiceList;
+    struct ServiceListType VASList;                                         //Optional
+};
+/****ServiceDetailRequest****/
+//Only in ISO15118_2014 and ISO15118_2018
+struct ServiceDetailRequest_ISO15118_2014
+{
+    unsigned short ServiceID;
+};
+struct ServiceDetailRequest_ISO15118_2018
+{
+    unsigned short ServiceID;
+    struct WPT_SDlEnergyTransferModeType WPT_SDlEnergyTransferMode;
+};
+/****ServiceDetailResponse****/
+struct ServiceDetailResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    unsigned short ServiceID;
+    struct ServiceParameterListType ServiceParameterList;
+};
+struct ServiceDetailResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    unsigned short ServiceID;
+    struct ServiceParameterListType ServiceParameterList;
+    struct EVSEStatusType EVSEStatus;                                   //Optional
+};
+/****ServiceAndPaymentSelectionRequest / ServiceSelectionRequest****/
+struct ServiceAndPaymentSelectionRequest_DIN70121
+{
+    enum PaymentOptionType SelectedPaymentOption;
+    struct SelectedServiceListType SelectedServiceList;
+};
+struct ServiceAndPaymentSelectionRequest_ISO15118_2014
+{
+    enum PaymentOptionType SelectedPaymentOption;
+    struct SelectedServiceListType SelectedServiceList;
+};
+struct ServiceSelectionRequest_ISO15118_2018
+{
+    enum PaymentOptionType SelectedPaymentOption;
+    struct SelectedServiceType SelectedEnergyTransferService;
+    struct SelectedServiceListType SelectedVASList;
+    enum ProcessingType EVProcessing;
+};
+/****ServiceAndPaymentSelectionResponse / ServiceSelectionResponse****/
+struct ServiceAndPaymentSelectionResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+};
+struct ServiceAndPaymentSelectionResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+};
+struct ServiceSelectionResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                   //Optional
+};
+/****PaymentDetailsRequest / IdentificationDetailsRequest****/
+struct PaymentDetailsRequest_ISO15118_2014
+{
+    unsigned char eMAID[16];
+    struct CertificateChainType ContractSignatureCertChain;
+};
+struct IdentificationDetailsRequest_ISO15118_2018
+{
+    struct CertificateChainType ContractSignatureCertChain;
+};
+/****PaymentDetailsResponse  / IdentificationDetailsResponse ****/
+struct PaymentDetailsResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    unsigned char GenChallenge[16];
+    long EVSETimeStamp;
+};
+struct IdentificationDetailsResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                       //Optional
+    unsigned char GenChallenge[16];
+    enum ProcessingType EVSEProcessing;
+};
+/****ContractAuthenticationRequest / AuthorizationRequest****/
+struct ContractAuthenticationRequest_DIN70121
+{
+    //None
+};
+struct AuthorizationRequest_ISO15118_2014
+{
+    unsigned char GenChallenge[16];                             //Optional
+    unsigned char Id[32];                                   //Optional
+};
+struct AuthorizationRequest_ISO15118_2018
+{
+    struct PNC_AReqIdentificationModeType PNC_AReqIdentificationMode;       //Optional
+};
+/****ContractAuthenticationResponse  / AuthorizationResponse****/
+struct ContractAuthenticationResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+    enum EVSEProcessingType_DIN70121 EVSEProcessing;
+};
+struct AuthorizationResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    enum EVSEProcessingType_ISO15118_2014 EVSEProcessing;
+};
+struct AuthorizationResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    enum ProcessingType EVSEProcessing;
+    struct EVSEStatusType EVSEStatus;                                       //Optional
+};
+/****ChargeParameterDiscoveryRequest****/
+struct ChargeParameterDiscoveryRequest_DIN70121
+{
+    enum EnergyTransferModeType EVRequestedEnergyTransferType;
+    struct DC_EVChargeParameterType_DIN70121 DC_EVChargeParameter;
+};
+struct ChargeParameterDiscoveryRequest_ISO15118_2014
+{
+    unsigned short MaxEntriesSAScheduleTuple;                                               //Optional
+    enum EnergyTransferModeType RequestedEnergyTransferMode;
+    struct AC_EVChargeParameterType AC_EVChargeParameter;
+    struct DC_EVChargeParameterType_ISO15118_2014 DC_EVChargeParameter;
+};
+struct ChargeParameterDiscoveryRequest_ISO15118_2018
+{
+    struct Dynamic_CPDReqControlModeType Dynamic_CPDReqControlMode;
+    struct Scheduled_CPDReqControlModeType Scheduled_CPDReqControlMode;
+    struct AC_CPDReqEnergyTransferModeType AC_CPDReqEnergyTransferMode;
+    struct DC_CPDReqEnergyTransferModeType DC_CPDReqEnergyTransferMode;
+    struct BPT_AC_CPDReqEnergyTransferModeType BPT_AC_CPDReqEnergyTransferMode;
+    struct BPT_DC_CPDReqEnergyTransferModeType BPT_DC_CPDReqEnergyTransferMode;
+    struct WPT_CPDReqEnergyTransferModeType WPT_CPDReqEnergyTransferMode;
+    struct ACD_CPDReqEnergyTransferModeType ACD_CPDReqEnergyTransferMode;
+};
+/****ChargeParameterDiscoveryResponse****/
+struct ChargeParameterDiscoveryResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+    enum EVSEProcessingType_DIN70121 EVSEProcessing;
+    struct SAScheduleListType SAScheduleList;
+    struct DC_EVSEChargeParameterType_DIN70121 DC_EVSEChargeParameter;
+};
+struct ChargeParameterDiscoveryResponse_ISO15118_2014
+{
+    enum EVSEProcessingType_ISO15118_2014 EVSEProcessing;
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    struct SAScheduleListType SAScheduleList;
+    struct AC_EVSEChargeParameterType_ISO15118_2014 AC_EVSEChargeParameter;
+    struct DC_EVSEChargeParameterType_ISO15118_2014 DC_EVSEChargeParameter;
+};
+struct ChargeParameterDiscoveryResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                               //Optional
+    enum ProcessingType EVSEProcessing;
+    struct Scheduled_CPDResControlModeType Scheduled_CPDResControlMode;                 //Optional
+    struct AC_CPDResEnergyTransferModeType AC_CPDResEnergyTransferMode;
+    struct DC_CPDResEnergyTransferModeType DC_CPDResEnergyTransferMode;
+    struct BPT_AC_CPDResEnergyTransferModeType BPT_AC_CPDResEnergyTransferMode;
+    struct BPT_DC_CPDResEnergyTransferModeType BPT_DC_CPDResEnergyTransferMode;
+    struct WPT_CPDResEnergyTransferModeType WPT_CPDResEnergyTransferMode;
+    struct ACD_CPDResEnergyTransferModeType ACD_CPDResEnergyTransferMode;
+};
+/****PowerDeliveryRequest****/
+struct PowerDeliveryRequest_DIN70121
+{
+    BOOL ReadyToChargeState;
+    struct ChargingProfileType_DIN70121 ChargingProfile;
+    struct DC_EVPowerDeliveryParameterType_DIN70121 DC_EVPowerDeliveryParameter;
+};
+struct PowerDeliveryRequest_ISO15118_2014
+{
+    enum ChargeProgressType_ISO15118_2014 ChargeProgress;
+    short SAScheduleTupleID;
+    struct ChargingProfileType_ISO15118_2014 ChargingProfile;
+    struct DC_EVPowerDeliveryParameterType_ISO15118_2014 DC_EVPowerDeliveryParameter;
+};
+struct PowerDeliveryRequest_ISO15118_2018
+{
+    enum ChargeProgressType_ISO15118_2018 ChargeProgress;
+    struct Scheduled_PDReqControlModeType Scheduled_PDReqControlMode;
+    struct BPT_Scheduled_PDReqControlModeType BPT_Scheduled_PDReqControlMode;
+};
+/****PowerDeliveryResponse****/
+struct PowerDeliveryResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+    struct DC_EVSEStatusType_DIN70121 DC_EVSEStatus;
+};
+struct PowerDeliveryResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    struct AC_EVSEStatusType_ISO15118_2014 AC_EVSEStatus;
+    struct DC_EVSEStatusType_ISO15118_2014 DC_EVSEStatus;
+};
+struct PowerDeliveryResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                       //Optional
+};
+/****CertificateUpdateRequest****/
+struct CertificateUpdateRequest_ISO15118_2014
+{
+    unsigned char Id[32];
+    struct CertificateChainType ContractSignatureCertChain;
+    unsigned char eMAID[16];
+    struct ListOfRootCertificateIDsType ListOfRootCertificateIDs;
+};
+/****CertificateUpdateResponse****/
+struct CertificateUpdateResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    struct CertificateChainType SAProvisioningCertificateChain;
+    struct CertificateChainType ContractSignatureCertChain;
+    struct ContractSignatureEncryptedPrivateKeyType ContractSignatureEncryptedPrivateKey;
+    struct DiffieHellmanPublickeyType DHpublickey;
+    unsigned char eMAID[16];
+    short RetryCounter;                                                                     //Optional
+};
+/****CertificateInstallationRequest****/
+struct CertificateInstallationRequest_ISO15118_2014
+{
+    unsigned char Id[32];
+    unsigned char OEMProvisioningCert[800];
+    struct ListOfRootCertificateIDsType ListOfRootCertificateIDs;
+};
+struct CertificateInstallationRequest_ISO15118_2018
+{
+    unsigned char Id[32];
+    struct CertificateChainType OEMProvisioningCertChain;
+    struct ListOfRootCertificateIDsType ListOfRootCertificateIDs;
+    unsigned short MaxSupportedCerts;
+};
+/****CertificateInstallationResponse****/
+struct CertificateInstallationResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    struct CertificateChainType SAProvisioningCertificateChain;
+    struct CertificateChainType ContractSignatureCertChain;
+    struct ContractSignatureEncryptedPrivateKeyType ContractSignatureEncryptedPrivateKey;
+    struct DiffieHellmanPublickeyType DHpublickey;
+    unsigned char eMAID[16];
+};
+struct CertificateInstallationResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                               //Optional
+    struct CertificateChainType SAProvisioningCertificateChain;
+    struct CertificateChainType ContractCertificateChain;
+    struct ContractCertificateEncryptedPrivateKeyType ContractEncryptedPrivateKey;
+    struct DiffieHellmanPublickeyType DHpublickey;
+    enum ProcessingType EVSEProcessing;
+    unsigned short RemainingContractCertificateChains;
+};
+/****SystemStatusRequest****/
+struct SystemStatusRequest_ISO15118_2018
+{
+    enum mechanicalChargingDeviceStatusType EVMechanicalChargingDeviceStatus;
+    struct EVTechnicalStatusType EVTechnicalStatus;
+    unsigned char EV_OEMStatus[800];                                                        //Optional
+};
+/****SystemStatusResponse****/
+struct SystemStatusResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    enum mechanicalChargingDeviceStatusType EVSEMechanicalChargingDeviceStatus;
+    BOOL EVSE_ReadyToCharge;
+    enum IsolationStatusType EVSE_IsolationStatus;
+    BOOL EVSE_Disabled;
+    BOOL EVSE_UtilityInterruptEvent;
+    BOOL EVSE_EmergencyShutdown;
+    BOOL EVSE_Malfunction;
+    BOOL EV_InChargePosition;
+    BOOL EV_AssociationStatus;
+};
+/****SessionStopRequest****/
+struct SessionStopRequest_DIN70121
+{
+    //No member in standard
+};
+struct SessionStopRequest_ISO15118_2014
+{
+    enum ChargingSessionType ChargingSession;
+};
+struct SessionStopRequest_ISO15118_2018
+{
+    enum ChargingSessionType ChargingSession;
+};
+/****SessionStopResponse****/
+struct SessionStopResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+};
+struct SessionStopResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+};
+struct SessionStopResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                               //Optional
+};
+/****MeteringReceiptRequest****/
+struct MeteringReceiptRequest_ISO15118_2014
+{
+    unsigned char Id[32];                                                           //Optional
+    unsigned char SessionID[8];
+    short SAScheduleTupleID;                                                            //Optional
+    struct MeterInfoType_ISO15118_2014 MeterInfo;
+};
+struct MeteringReceiptRequest_ISO15118_2018
+{
+    unsigned char Id[32];                                                           //Optional
+    unsigned char SessionID[8];
+    struct Scheduled_MRReqControlModeType Schedule_MRReqControlMode;
+    struct MeterInfoType_ISO15118_2018 MeterInfo;
+};
+/****MeteringReceiptResponse****/
+struct MeteringReceiptResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    struct AC_EVSEStatusType_ISO15118_2014 AC_EVSEStatus;
+    struct DC_EVSEStatusType_ISO15118_2014 DC_EVSEStatus;
+};
+struct MeteringReceiptResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                               //Optional
+};
+/****ChargingStatusRequest (AC Only)****/
+struct ChargingStatusRequest_ISO15118_2014
+{
+    //No member in standard
+};
+struct ChargingStatusRequest_ISO15118_2018
+{
+    struct PnC_CLReqIdentificationModeType PnC_CLReqIdentificationMode;
+    struct Dynamic_CSReqControlModeType Dynamic_CSReqControlMode;
+    struct Scheduled_CSReqControlModeType Scheduled_CSReqControlMode;
+    struct DisplayParametersType DisplayParameters;
+};
+/****ChargingStatusResponse (AC Only)****/
+struct ChargingStatusResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    unsigned char EVSEID[40];                                               //DIN70121=>Max length:32,	ISO15118=>min length:7, max length:37
+    short SAScheduleTupleID;
+    struct PhysicalValueType_ISO15118_2014 EVSEMaxCurrent;                  //Optional
+    struct MeterInfoType_ISO15118_2014 MeterInfo;                           //Optional
+    BOOL ReceiptRequired;                                                   //Optional
+    struct AC_EVSEStatusType_ISO15118_2014 AC_EVSEStatus;
+};
+struct ChargingStatusResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                               //Optional
+    unsigned char EVSEID[40];                                                       //DIN70121=>Max length:32,	ISO15118=>min length:7, max length:37
+    struct PhysicalValueType_ISO15118_2018 EVSETargetFrequency;                         //Optional
+    struct PnC_CLResIdentificationModeType PnC_CLResIdentificationMode;
+    struct Dynamic_CSResControlModeType Dynamic_CSResControlMode;
+    struct Scheduled_CSReqControlModeType Scheduled_CSReqControlMode;
+};
+/****CableCheckRequest (DC Only)****/
+struct CableCheckRequest_DIN70121
+{
+    struct DC_EVStatusType_DIN70121 DC_EVStatus;
+};
+struct CableCheckRequest_ISO15118_2014
+{
+    struct DC_EVStatusType_ISO15118_2014 DC_EVStatus;
+};
+struct CableCheckRequest_ISO15118_2018
+{
+    //No member in standard
+};
+/****CableCheckResponse (DC Only)****/
+struct CableCheckResponse_DIN70121
+{
+    unsigned int cnt;   //self added
+    enum ResponseCodeType_DIN70121 ResponseCode;
+    struct DC_EVSEStatusType_DIN70121 DC_EVSEStatus;
+    enum EVSEProcessingType_DIN70121 EVSEProcessing;
+};
+
+struct CableCheckResponse_ISO15118_2014
+{
+    unsigned int cnt;  //self added
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    struct DC_EVSEStatusType_ISO15118_2014 DC_EVSEStatus;
+    enum EVSEProcessingType_ISO15118_2014 EVSEProcessing;
+};
+
+struct CableCheckResponse_ISO15118_2018
+{
+    unsigned int cnt;  //self added
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                               //Optional
+    enum ProcessingType EVSEProcessing;
+};
+
+/****PreChargeRequest (DC Only)****/
+struct PreChargeRequest_DIN70121
+{
+    unsigned int cnt;  //self added
+    struct DC_EVStatusType_DIN70121 DC_EVStatus;
+    struct PhysicalValueType_DIN70121 EVTargetVoltage;
+    struct PhysicalValueType_DIN70121 EVTargetCurrent;
+};
+
+struct PreChargeRequest_ISO15118_2014
+{
+    unsigned int cnt;  //self added
+    struct DC_EVStatusType_ISO15118_2014 DC_EVStatus;
+    struct PhysicalValueType_ISO15118_2014 EVTargetVoltage;
+    struct PhysicalValueType_ISO15118_2014 EVTargetCurrent;
+};
+
+struct PreChargeRequest_ISO15118_2018
+{
+    unsigned int cnt;  //self added
+    struct PhysicalValueType_ISO15118_2018 EVTargetVoltage;
+    struct PhysicalValueType_ISO15118_2018 EVTargetCurrent;
+};
+
+/****PreChargeResponse (DC Only)****/
+struct PreChargeResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+    struct DC_EVSEStatusType_DIN70121 DC_EVSEStatus;
+    struct PhysicalValueType_DIN70121 EVSEPresentVoltage;
+};
+
+struct PreChargeResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    struct DC_EVSEStatusType_ISO15118_2014 DC_EVSEStatus;
+    struct PhysicalValueType_ISO15118_2014 EVSEPresentVoltage;
+};
+
+struct PreChargeResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                                   //Optional
+    struct PhysicalValueType_ISO15118_2018 EVSEPresentVoltage;
+};
+
+/****CurrentDemandRequest (DC Only)****/
+struct CurrentDemandRequest_DIN70121
+{
+    struct DC_EVStatusType_DIN70121 DC_EVStatus;
+    struct PhysicalValueType_DIN70121 EVTargetCurrent;
+    struct PhysicalValueType_DIN70121 EVMaximumVoltageLimit;                            //Optional
+    struct PhysicalValueType_DIN70121 EVMaximumCurrentLimit;                            //Optional
+    struct PhysicalValueType_DIN70121 EVMaximumPowerLimit;                                  //Optional
+    BOOL BulkChargingComplete;                                                              //Optional
+    BOOL ChargingComplete;
+    struct PhysicalValueType_DIN70121 RemainingTimeToFullSoC;                           //Optional
+    struct PhysicalValueType_DIN70121 RemainingTimeToBulkSoC;                           //Optional
+    struct PhysicalValueType_DIN70121 EVTargetVoltage;
+};
+
+struct CurrentDemandRequest_ISO15118_2014
+{
+    struct DC_EVStatusType_ISO15118_2014 DC_EVStatus;
+    struct PhysicalValueType_ISO15118_2014 EVTargetCurrent;
+    struct PhysicalValueType_ISO15118_2014 EVMaximumVoltageLimit;                       //Optional
+    struct PhysicalValueType_ISO15118_2014 EVMaximumCurrentLimit;                       //Optional
+    struct PhysicalValueType_ISO15118_2014 EVMaximumPowerLimit;                             //Optional
+    BOOL BulkChargingComplete;                                                              //Optional
+    BOOL ChargingComplete;
+    struct PhysicalValueType_ISO15118_2014 RemainingTimeToFullSoC;                      //Optional
+    struct PhysicalValueType_ISO15118_2014 RemainingTimeToBulkSoC;                      //Optional
+    struct PhysicalValueType_ISO15118_2014 EVTargetVoltage;
+};
+
+struct CurrentDemandRequest_ISO15118_2018
+{
+    struct DisplayParametersType DisplayParameters;                                     //Optional
+    struct PnC_CLReqIdentificationModeType PnC_CLReqIdentificationMode;
+    struct Dynamic_CSReqControlModeType Dynamic_CDReqControlMode;
+    struct Scheduled_CSReqControlModeType Scheduled_CDReqControlMode;
+};
+
+/****CurrentDemandResponse (DC Only)****/
+struct CurrentDemandResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+    struct DC_EVSEStatusType_DIN70121 DC_EVSEStatus;
+    struct PhysicalValueType_DIN70121 EVSEPresentVoltage;
+    struct PhysicalValueType_DIN70121 EVSEPresentCurrent;
+    BOOL EVSECurrentLimitAchieved;
+    BOOL EVSEVoltageLimitAchieved;
+    BOOL EVSEPowerLimitAchieved;
+    struct PhysicalValueType_DIN70121 EVSEMaximumVoltageLimit;                          //Optional
+    struct PhysicalValueType_DIN70121 EVSEMaximumCurrentLimit;                          //Optional
+    struct PhysicalValueType_DIN70121 EVSEMaximumPowerLimit;                        //Optional
+};
+
+struct CurrentDemandResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    struct DC_EVSEStatusType_ISO15118_2014 DC_EVSEStatus;
+    struct PhysicalValueType_ISO15118_2014 EVSEPresentVoltage;
+    struct PhysicalValueType_ISO15118_2014 EVSEPresentCurrent;
+    BOOL EVSECurrentLimitAchieved;
+    BOOL EVSEVoltageLimitAchieved;
+    BOOL EVSEPowerLimitAchieved;
+    struct PhysicalValueType_ISO15118_2014 EVSEMaximumVoltageLimit;                     //Optional
+    struct PhysicalValueType_ISO15118_2014 EVSEMaximumCurrentLimit;                     //Optional
+    struct PhysicalValueType_ISO15118_2014 EVSEMaximumPowerLimit;                   //Optional
+    unsigned char EVSEID[40];                                               //DIN70121=>Max length:32,	ISO15118=>min length:7, max length:37
+    short SAScheduleTupleID;
+    struct MeterInfoType_ISO15118_2014 MeterInfo;                           //Optional
+    BOOL ReceiptRequired;                                                       //Optional
+};
+
+struct CurrentDemandResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                                   //Optional
+    struct PhysicalValueType_ISO15118_2018 EVSEPresentVoltage;
+    struct PhysicalValueType_ISO15118_2018 EVSEPresentCurrent;
+    BOOL EVSECurrentLimitAchieved;
+    BOOL EVSEVoltageLimitAchieved;
+    BOOL EVSEPowerLimitAchieved;
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargeVoltage;                    //Optional
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargeCurrent;                    //Optional
+    struct PhysicalValueType_ISO15118_2018 EVSEMaximumChargePower;                      //Optional
+    unsigned char EVSEID[40];                                                           //DIN70121=>Max length:32,	ISO15118=>min length:7, max length:37
+    struct PnC_CLResIdentificationModeType PnC_CLResIdentificationMode;
+    struct Scheduled_CDResControlModeType Scheduled_CDResControlMode;
+};
+
+/****WeldingDetectionRequest (DC Only)*****/
+struct WeldingDetectionRequest_DIN70121
+{
+    struct DC_EVStatusType_DIN70121 DC_EVStatus;
+};
+
+struct WeldingDetectionRequest_ISO15118_2014
+{
+    struct DC_EVStatusType_ISO15118_2014 DC_EVStatus;
+};
+
+struct WeldingDetectionRequest_ISO15118_2018
+{
+    //No member in Standard
+};
+
+/****WeldingDetectionResponse (DC Only)****/
+struct WeldingDetectionResponse_DIN70121
+{
+    enum ResponseCodeType_DIN70121 ResponseCode;
+    struct DC_EVSEStatusType_DIN70121 DC_EVSEStatus;
+    struct PhysicalValueType_DIN70121 EVSEPresentVoltage;
+};
+
+struct WeldingDetectionResponse_ISO15118_2014
+{
+    enum ResponseCodeType_ISO15118_2014 ResponseCode;
+    struct DC_EVSEStatusType_ISO15118_2014 DC_EVSEStatus;
+    struct PhysicalValueType_ISO15118_2014 EVSEPresentVoltage;
+};
+
+struct WeldingDetectionResponse_ISO15118_2018
+{
+    enum ResponseCodeType_ISO15118_2018 ResponseCode;
+    struct EVSEStatusType EVSEStatus;                                               //Optional
+    struct PhysicalValueType_ISO15118_2018 EVSEPresentVoltage;
+};
+
+/****FinePositioningSetupRequest (WPT Only)****/
+struct FinePositioningSetupRequest_ISO15118_2018
+{
+    struct LFA_EVFinePositioningSetupParametersType LFA_EVFinePositioningSetupParameters;   //Optional
+};
+
+/****FinePositioningSetupResponse (WPT Only)****/
+struct FinePositioningSetupResponse_ISO15118_2018
+{
+    //NOT complete yet,  to be continue.....
+};
+
+
+struct V2GMessageType_DIN70121 {
+    enum MsgFlowStatus PresentMsgFlowStatus;
+    enum MsgFlowStatus PresentMsgFlowStatus_pre;
+    /* 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
+     */
+    struct SupportedAppProtocolRequest_DIN70121 SupportedAppProtocolRequest;
+    struct SupportedAppProtocolResponse_DIN70121 SupportedAppProtocolResponse;
+    struct SessionSetupRequest_DIN70121 SessionSetupRequest;
+    struct SessionSetupResponse_DIN70121 SessionSetupResponse;
+    struct ServiceDiscoveryRequest_DIN70121 ServiceDiscoveryRequest;
+    struct ServiceDiscoveryResponse_DIN70121 ServiceDiscoveryResponse;
+    struct ServiceAndPaymentSelectionRequest_DIN70121 ServiceAndPaymentSelectionRequest;
+    struct ServiceAndPaymentSelectionResponse_DIN70121 ServiceAndPaymentSelectionResponse;
+    struct ContractAuthenticationRequest_DIN70121 ContractAuthenticationRequest;
+    struct ContractAuthenticationResponse_DIN70121 ContractAuthenticationResponse;
+    struct ChargeParameterDiscoveryRequest_DIN70121 ChargeParameterDiscoveryRequest;
+    struct ChargeParameterDiscoveryResponse_DIN70121 ChargeParameterDiscoveryResponse;
+    struct CableCheckRequest_DIN70121 CableCheckRequest;
+    struct CableCheckResponse_DIN70121 CableCheckResponse;
+    struct PreChargeRequest_DIN70121 PreChargeRequest;
+    struct PreChargeResponse_DIN70121 PreChargeResponse;
+    struct PowerDeliveryRequest_DIN70121 PowerDeliveryRequest;
+    struct PowerDeliveryResponse_DIN70121 PowerDeliveryResponse;
+    struct CurrentDemandRequest_DIN70121 CurrentDemandRequest;
+    struct CurrentDemandResponse_DIN70121 CurrentDemandResponse;
+    struct WeldingDetectionRequest_DIN70121 WeldingDetectionRequest;
+    struct WeldingDetectionResponse_DIN70121 WeldingDetectionResponse;
+    struct SessionStopRequest_DIN70121 SessionStopRequest;
+    struct SessionStopResponse_DIN70121 SessionStopResponse;
+};
+
+struct V2GMessageType_ISO15118_2014 {
+    enum MsgFlowStatus PresentMsgFlowStatus;
+    enum MsgFlowStatus PresentMsgFlowStatus_pre;
+    /* 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
+     */
+    struct SupportedAppProtocolRequest_ISO15118_2014 SupportedAppProtocolRequest;
+    struct SupportedAppProtocolResponse_ISO15118_2014 SupportedAppProtocolResponse;
+    struct SessionSetupRequest_ISO15118_2014 SessionSetupRequest;
+    struct SessionSetupResponse_ISO15118_2014 SessionSetupResponse;
+    struct ServiceDiscoveryRequest_ISO15118_2014 ServiceDiscoveryRequest;
+    struct ServiceDiscoveryResponse_ISO15118_2014 ServiceDiscoveryResponse;
+    struct ServiceDetailRequest_ISO15118_2014 ServiceDetailRequest;
+    struct ServiceDetailResponse_ISO15118_2014 ServiceDetailResponse;
+    struct ServiceAndPaymentSelectionRequest_ISO15118_2014 ServiceAndPaymentSelectionRequest;
+    struct ServiceAndPaymentSelectionResponse_ISO15118_2014 ServiceAndPaymentSelectionResponse;
+    struct PaymentDetailsRequest_ISO15118_2014 PaymentDetailsRequest;
+    struct PaymentDetailsResponse_ISO15118_2014 PaymentDetailsResponse;
+    struct AuthorizationRequest_ISO15118_2014 AuthorizationRequest;
+    struct AuthorizationResponse_ISO15118_2014 AuthorizationResponse;
+    struct CertificateUpdateRequest_ISO15118_2014 CertificateUpdateRequest;
+    struct CertificateUpdateResponse_ISO15118_2014 CertificateUpdateResponse;
+    struct CertificateInstallationRequest_ISO15118_2014 CertificateInstallationRequest;
+    struct CertificateInstallationResponse_ISO15118_2014 CertificateInstallationResponse;
+    struct ChargeParameterDiscoveryRequest_ISO15118_2014 ChargeParameterDiscoveryRequest;
+    struct ChargeParameterDiscoveryResponse_ISO15118_2014 ChargeParameterDiscoveryResponse;
+    struct CableCheckRequest_ISO15118_2014 CableCheckRequest;
+    struct CableCheckResponse_ISO15118_2014 CableCheckResponse;
+    struct PreChargeRequest_ISO15118_2014 PreChargeRequest;
+    struct PreChargeResponse_ISO15118_2014 PreChargeResponse;
+    struct PowerDeliveryRequest_ISO15118_2014 PowerDeliveryRequest;
+    struct PowerDeliveryResponse_ISO15118_2014 PowerDeliveryResponse;
+    struct ChargingStatusRequest_ISO15118_2014 ChargingStatusRequest;
+    struct ChargingStatusResponse_ISO15118_2014 ChargingStatusResponse;
+    struct CurrentDemandRequest_ISO15118_2014 CurrentDemandRequest;
+    struct CurrentDemandResponse_ISO15118_2014 CurrentDemandResponse;
+    struct MeteringReceiptRequest_ISO15118_2014 MeteringReceiptRequest;
+    struct MeteringReceiptResponse_ISO15118_2014 MeteringReceiptResponse;
+    struct WeldingDetectionRequest_ISO15118_2014 WeldingDetectionRequest;
+    struct WeldingDetectionResponse_ISO15118_2014 WeldingDetectionResponse;
+    struct SessionStopRequest_ISO15118_2014 SessionStopRequest;
+    struct SessionStopResponse_ISO15118_2014 SessionStopResponse;
+};
+
+struct V2GMessageType_ISO15118_2018 {
+    enum MsgFlowStatus PresentMsgFlowStatus;
+    enum MsgFlowStatus PresentMsgFlowStatus_pre;
+    /* 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
+     */
+    struct SupportedAppProtocolRequest_ISO15118_2018 SupportedAppProtocolRequest;
+    struct SupportedAppProtocolResponse_ISO15118_2018 SupportedAppProtocolResponse;
+    struct SessionSetupRequest_ISO15118_2018 SessionSetupRequest;
+    struct SessionSetupResponse_ISO15118_2018 SessionSetupResponse;
+    struct ServiceDiscoveryRequest_ISO15118_2018 ServiceDiscoveryRequest;
+    struct ServiceDiscoveryResponse_ISO15118_2018 ServiceDiscoveryResponse;
+    struct ServiceDetailRequest_ISO15118_2018 ServiceDetailRequest;
+    struct ServiceDetailResponse_ISO15118_2018 ServiceDetailResponse;
+    struct ServiceSelectionRequest_ISO15118_2018 ServiceSelectionRequest;
+    struct ServiceSelectionResponse_ISO15118_2018 ServiceSelectionResponse;
+    struct IdentificationDetailsRequest_ISO15118_2018 IdentificationDetailsRequest;
+    struct IdentificationDetailsResponse_ISO15118_2018 IdentificationDetailsResponse;
+    struct AuthorizationRequest_ISO15118_2018 AuthorizationRequest;
+    struct AuthorizationResponse_ISO15118_2018 AuthorizationResponse;
+    struct CertificateInstallationRequest_ISO15118_2018 CertificateInstallationRequest;
+    struct CertificateInstallationResponse_ISO15118_2018 CertificateInstallationResponse;
+    struct ChargeParameterDiscoveryRequest_ISO15118_2018 ChargeParameterDiscoveryRequest;
+    struct ChargeParameterDiscoveryResponse_ISO15118_2018 ChargeParameterDiscoveryResponse;
+    struct CableCheckRequest_ISO15118_2018 CableCheckRequest;
+    struct CableCheckResponse_ISO15118_2018 CableCheckResponse;
+    struct PreChargeRequest_ISO15118_2018 PreChargeRequest;
+    struct PreChargeResponse_ISO15118_2018 PreChargeResponse;
+    struct PowerDeliveryRequest_ISO15118_2018 PowerDeliveryRequest;
+    struct PowerDeliveryResponse_ISO15118_2018 PowerDeliveryResponse;
+    struct ChargingStatusRequest_ISO15118_2018 ChargingStatusRequest;
+    struct ChargingStatusResponse_ISO15118_2018 ChargingStatusResponse;
+    struct CurrentDemandRequest_ISO15118_2018 CurrentDemandRequest;
+    struct CurrentDemandResponse_ISO15118_2018 CurrentDemandResponse;
+    struct MeteringReceiptRequest_ISO15118_2018 MeteringReceiptRequest;
+    struct MeteringReceiptResponse_ISO15118_2018 MeteringReceiptResponse;
+    struct WeldingDetectionRequest_ISO15118_2018 WeldingDetectionRequest;
+    struct WeldingDetectionResponse_ISO15118_2018 WeldingDetectionResponse;
+    struct SessionStopRequest_ISO15118_2018 SessionStopRequest;
+    struct SessionStopResponse_ISO15118_2018 SessionStopResponse;
+};
+
+struct CcsData {
+    unsigned char CommProtocol;
+    //0: V2GT_MSG_PROTOCOL_DIN70121
+    //1: V2GT_MSG_PROTOCOL_ISO15118_2014
+    //2: V2GT_MSG_PROTOCOL_ISO15118_2018
+
+    unsigned char EnergyTransferMode;
+
+    struct V2GMessageType_DIN70121      V2GMessage_DIN70121;
+    struct V2GMessageType_ISO15118_2014 V2GMessage_ISO15118_2014;
+    struct V2GMessageType_ISO15118_2018 V2GMessage_ISO15118_2018;
+};
+
+struct InternalComm {
+    unsigned char ChargingPermission;
+    unsigned char SlaveAddress;
+    unsigned char IsolationStatus;              //0:ongoing, 1:valid, 2:warning/fault
+    unsigned char CCSConnectorType;             //0:CCS1, 1:CCS2
+    unsigned char MaximumAllowedChargingTime;   //0x00: unlimited
+                                                //(0x01: 1 minutes ~ 0xFF: 255 minutes, resolution: 1 minute)
+    unsigned int RTC;                           //4 bytes
+    unsigned char EVSEPrechargeStatus;
+
+    int MaximumChargingVoltage;                 //0~6553.5 volt, resolution: 0.1V
+    int AvailableChargingCurrent;               //0~6553.5 amp, resolution: 0.1V
+    int AvailableChargingPower;                 //0~6553.5 kW, resolution: 0.1KW
+    int PresentChargingVoltage;                 //0~6553.5 volt, resolution: 0.1V
+    int PresentChargingCurrent;                 //0~6553.5 amp, resolution: 0.1A
+    int PresentChargingPower;                   //0~6553.5 KW, resolution: 0.1KW
+    struct timeb CAN_Rx_Timer_Start;
+    struct timeb CAN_Rx_Timer_End;
+    int FD_CAN_Socket;
+    struct timeb Start_Time;
+    struct timeb End_Time;
+
+    unsigned char ChargingPermission_new;
+
+    BOOL AC_RcdStatus;                          //0:no error, 1:error
+    unsigned char AC_EVSEID[40];
+    unsigned char AC_MeterID[32];
+    unsigned char AC_EVSEModelName[32];
+    unsigned char AC_BatteryChargeType;
+    unsigned char AC_CpPresentPWMDuty;
+    unsigned char AC_CpPresentState;
+    unsigned short AC_ChargingRemainTime;
+    unsigned int AC_CSUAlarmStatusCode;
+    unsigned int AC_CcsHeartBeat;
+    float AC_GridVoltage[3];
+    float AC_MeterReadingValue;
+    float AC_CpPositiveVoltage;
+    float AC_CpNegativeVoltage;
+    float AC_EVSEMaxCurrent;
+	float AC_EVSEMinCurrent;
+    float AC_EVSEPresentCurrent[3];
+    BOOL AC_OutputRelayStatus;
+    float AC_AvailableChargingPower;					//1KW
+    unsigned char AC_EVSENotification;                  //0:none, 1:StopCharging, 2:RenNgotiation
+
+    unsigned char ChargingPermission_pre;
+    unsigned char SlaveAddress_pre;
+    unsigned char IsolationStatus_pre;              //0:ongoing, 1:valid, 2:warning/fault
+    unsigned char CCSConnectorType_pre;             //0:CCS1, 1:CCS2
+    unsigned char MaximumAllowedChargingTime_pre;   //0x00: unlimited
+                                                //(0x01: 1 minutes ~ 0xFF: 255 minutes, resolution: 1 minute)
+    unsigned int RTC_pre;                           //4 bytes
+    unsigned char EVSEPrechargeStatus_pre;
+
+    int MaximumChargingVoltage_pre;                 //0~6553.5 volt, resolution: 0.1V
+    int AvailableChargingCurrent_pre;               //0~6553.5 amp, resolution: 0.1V
+    int AvailableChargingPower_pre;                 //0~6553.5 kW, resolution: 0.1KW
+    int PresentChargingVoltage_pre;                 //0~6553.5 volt, resolution: 0.1V
+    int PresentChargingCurrent_pre;                 //0~6553.5 amp, resolution: 0.1A
+    int PresentChargingPower_pre;                   //0~6553.5 KW, resolution: 0.1KW
+
+    BOOL AC_RcdStatus_pre;                          //0:no error, 1:error
+    unsigned char AC_EVSEID_pre[40];
+    unsigned char AC_MeterID_pre[32];
+    unsigned char AC_EVSEModelName_pre[32];
+    unsigned char AC_BatteryChargeType_pre;
+    unsigned char AC_CpPresentPWMDuty_pre;
+    unsigned char AC_CpPresentState_pre;
+    unsigned short AC_ChargingRemainTime_pre;
+    unsigned int AC_CSUAlarmStatusCode_pre;
+    unsigned int AC_CcsHeartBeat_pre;
+    float AC_GridVoltage_pre[3];
+    float AC_MeterReadingValue_pre;
+    float AC_CpPositiveVoltage_pre;
+    float AC_CpNegativeVoltage_pre;
+    float AC_EVSEMaxCurrent_pre;
+	float AC_EVSEMinCurrent_pre;
+    float AC_EVSEPresentCurrent_pre[3];
+    BOOL AC_OutputRelayStatus_pre;
+    float AC_AvailableChargingPower_pre;					//1KW
+    unsigned char AC_EVSENotification_pre;                  //0:none, 1:StopCharging, 2:RenNgotiation
+
+    struct DownloadImageInfoStructure {
+        FILE *file;
+        unsigned char active;
+        unsigned char type;
+        char filename[128];
+        unsigned long image_rx_cnt;
+        unsigned long image_size;
+        unsigned long total_can_packets;
+        unsigned long image_size_received;       //unit: byte
+        unsigned char block_quantity;
+        unsigned char block_sequence_number;
+        unsigned char block_size_KByte;               //unit: KBytes
+        unsigned char block_checksum;
+        unsigned char final_canmsg_size;  //unit: byte
+        unsigned char downlaod_percentage;
+        unsigned char downlaod_percentage_pre;
+    } DownloadImageInfo;
+
+    struct EVSEStopChargingReqType {
+        unsigned char type;
+        unsigned char alarmcode[6];
+    } EVSEStopChargingReq;
+
+    union
+    {
+        unsigned char InternalCommVal;
+        struct
+        {
+            //FaultVal[0]
+            unsigned int matched:                   1; //CAN_CMD_ADDRESS_REQUEST             0x00000100
+            unsigned int Got_AssignedAddress:       1; //CAN_CMD_ADDRESS_ASSIGN              0x00000200
+            unsigned int Send_EVBoardStatus:        1; //CAN_CMD_EV_BOARD_STATUS             0x00000300
+            unsigned int Got_FWVersionReq:          1; //CAN_CMD_GET_FW_VERSION              0x00000400
+            unsigned int Got_HWVersionReq:          1; //CAN_CMD_GET_HW_VERSION              0x00000500
+
+            unsigned int Got_ChargingPermission:    1; //CAN_CMD_CHARGING_PERMISSION          0x00000600
+            unsigned int Got_EVSEOutputStatus:      1; //CAN_CMD_EVSE_OUTPUT_STATUS_ANNOUNCEMENT  0x00000700
+            unsigned int Got_EnergyCapacity:        1; //CAN_CMD_EVSE_CAPACITY_ANNOUNCEMENT       0x00000800
+            unsigned int Got_EVTargetReq:           1; //CAN_CMD_GET_EV_TARGET_INFO           0x00000900
+            unsigned int Got_EVBatteryInfoReq:      1; //CAN_CMD_GET_EV_BATTERY_INFO          0x00000A00
+
+            unsigned int Send_EVStopReq:            1; //#define CAN_CMD_EV_STOP_EVENT        0x00000B00
+            unsigned int Got_EVSEStopReq:           1; //#define CAN_CMD_EVSE_STOP_EVENT      0x00000C00
+            unsigned int Got_MiscellaneousInfoReq:  1; //#define CAN_CMD_GET_MISC_INFO        0x00000D00
+            unsigned int Got_DownloadImageReq:      1; //#define CAN_CMD_DOWNLOAD_REQUEST     0x00000E00
+            unsigned int Got_BlockTransferStartReq: 1; //#define CAN_CMD_START_BLOCK_TRANSFER 0x00000F00
+
+            unsigned int Got_DataTransferReq:       1; //CAN_CMD_DATA_TRANSFER                0x00001000
+            unsigned int Got_DownloadFinishReq:     1; //CAN_CMD_DOWNLOAD_FINISH              0x00001100
+            unsigned int Got_IsolationStatus:       1; //CAN_CMD_ISOLATION_STATUS             0x00001200
+            unsigned int Got_CCSConnectorReq:       1; //CAN_CMD_CCS_CONNECTOR_INFO           0x00001300
+            unsigned int Got_RTC:                   1; //CAN_CMD_RTC_INFO                     0x00001400
+
+            unsigned int Got_EVSE_Precharge_Info:   1; //CAN_CMD_EVSE_PRECHARGE_INFO          0x00001500
+            unsigned int Got_EVCCID_Req:            1; //CAN_CMD_EVCCID_REQUEST               0x00001600
+            unsigned int EV_Stop_Type_Emergency:    1;
+            unsigned int FW_Update_Done:            1;
+            unsigned int FW_Update_Task_inused:     1;
+            unsigned int FW_Update_result:          1;
+            unsigned int FW_Update_Reboot_inused:   1;
+            unsigned int CAN_Rx_Timeout:            1;
+            unsigned int Reboot_Process_inused:     1;
+            unsigned int reserved:                  3;
+        } bits;
+    } InternalCommUnion;
+};
+#endif // DEFINE_H_

+ 46 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/Makefile

@@ -0,0 +1,46 @@
+#===========================================================================
+#                    Combined Charging System (CCS): SECC
+#                                 Makefile
+
+#                            initiated by Joseph
+#                            (since 2019/08/07)
+#=============================================================================
+
+-include ../Rules.make
+export PATH=/bin:/sbin:/usr/bin:$(SDK_PATH_TARGET)/usr/bin:$PATH
+
+LIBS = -lm
+OBJS = 	test/main.o \
+		test/main_example.o \
+		test/main_databinder.o \
+		api/api.o \
+		appHandshake/appHandEXIDatatypes.o \
+		appHandshake/appHandEXIDatatypesDecoder.o \
+		appHandshake/appHandEXIDatatypesEncoder.o \
+		codec/BitInputStream.o \
+		codec/BitOutputStream.o \
+		codec/ByteStream.o \
+		codec/DecoderChannel.o \
+		codec/EncoderChannel.o \
+		codec/EXIHeaderDecoder.o \
+		codec/EXIHeaderEncoder.o \
+		codec/MethodsBag.o \
+		din/dinEXIDatatypes.o \
+		din/dinEXIDatatypesDecoder.o \
+		din/dinEXIDatatypesEncoder.o \
+		iso1/iso1EXIDatatypes.o \
+		iso1/iso1EXIDatatypesDecoder.o \
+		iso1/iso1EXIDatatypesEncoder.o \
+		iso2/iso2EXIDatatypes.o \
+		iso2/iso2EXIDatatypesDecoder.o \
+		iso2/iso2EXIDatatypesEncoder.o \
+		transport/v2gtp.o \
+		xmldsig/xmldsigEXIDatatypes.o \
+		xmldsig/xmldsigEXIDatatypesDecoder.o \
+		xmldsig/xmldsigEXIDatatypesEncoder.o
+
+main: ${OBJS}
+	$(CC) -o main ${OBJS} ${LIBS}
+
+clean:
+	rm -rfv main ${OBJS}

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

@@ -0,0 +1,5168 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 api.c
+
+                          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;//in_value * 10;
+            out->Multiplier = 3;
+            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;//in_value * 10;
+            out->Multiplier = 3;
+            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 = strlen(in->MeterID);
+	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 = 0u;
+	/*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;
+}
+
+
+void SHM_Save_iso1_ServiceDetailReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ServiceDetailRequest_ISO15118_2014 *shm_msg;
+    struct iso1ServiceDetailReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ServiceDetailRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.ServiceDetailReq;
+
+	//ServiceScope
+	shm_msg->ServiceID = (unsigned int) exi->ServiceID;
+}
+
+
+/*===========================================================================
+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 =====
+	//AC_EVChargeParameter
+	if(exi->RequestedEnergyTransferMode <= 1)//0 for 1P, 1 for 3P
+	{	
+		if(exi->AC_EVChargeParameter.DepartureTime_isUsed != 0)
+		 	shm_msg->AC_EVChargeParameter.DepartureTime =  exi->AC_EVChargeParameter.DepartureTime;
+		 
+		 shm_msg->AC_EVChargeParameter.EAmount.Multiplier =  (int) exi->AC_EVChargeParameter.EAmount.Multiplier;
+		 shm_msg->AC_EVChargeParameter.EAmount.Unit = exi->AC_EVChargeParameter.EAmount.Unit;
+		 shm_msg->AC_EVChargeParameter.EAmount.Value = (short)exi->AC_EVChargeParameter.EAmount.Value;
+	 
+		 shm_msg->AC_EVChargeParameter.EVMaxVoltage.Multiplier =  (int) exi->AC_EVChargeParameter.EVMaxVoltage.Multiplier;
+		 shm_msg->AC_EVChargeParameter.EVMaxVoltage.Unit = exi->AC_EVChargeParameter.EVMaxVoltage.Unit;
+		 shm_msg->AC_EVChargeParameter.EVMaxVoltage.Value = (short)exi->AC_EVChargeParameter.EVMaxVoltage.Value;
+	 
+		 shm_msg->AC_EVChargeParameter.EVMaxCurrent.Multiplier =  (int) exi->AC_EVChargeParameter.EVMaxCurrent.Multiplier;
+		 shm_msg->AC_EVChargeParameter.EVMaxCurrent.Unit = exi->AC_EVChargeParameter.EVMaxCurrent.Unit;
+		 shm_msg->AC_EVChargeParameter.EVMaxCurrent.Value = (short)exi->AC_EVChargeParameter.EVMaxCurrent.Value;
+		 
+		 shm_msg->AC_EVChargeParameter.EVMinCurrent.Multiplier =  (int) exi->AC_EVChargeParameter.EVMinCurrent.Multiplier;
+		 shm_msg->AC_EVChargeParameter.EVMinCurrent.Unit = exi->AC_EVChargeParameter.EVMinCurrent.Unit;
+		 shm_msg->AC_EVChargeParameter.EVMinCurrent.Value = (short)exi->AC_EVChargeParameter.EVMinCurrent.Value;
+	 
+	}
+	else
+	{	
+	    //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, TimeToFull=0, TimeToBulk=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;
+	TimeToFull = 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;
+	TimeToBulk =  DIN70121PhyValDecode(shm_msg->RemainingTimeToBulkSoC);
+
+	if(TimeToFull > 0)
+		sys->RemainChargingDuration = TimeToFull;
+	else if(TimeToBulk > 0)
+		sys->RemainChargingDuration = TimeToBulk;
+	else
+	{
+		sys->RemainChargingDuration=0;		
+	}	
+	
+	//[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))
+	{
+		/*+++ vern, itme 5 in V0.24.S0, +++*/
+		//sys->EvBatterytargetVoltage = (DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
+		if((DIN70121PhyValDecode(shm_msg->EVTargetVoltage)+10)>=sys->EvBatteryMaxVoltage)
+			sys->EvBatterytargetVoltage = (DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
+		else
+			sys->EvBatterytargetVoltage =  DIN70121PhyValDecode(shm_msg->EVTargetVoltage)+10;
+		/*--- vern, itme 5 in V0.24.S0, ---*/	
+	}
+	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, TimeToFull=0, TimeToBulk=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;
+	TimeToFull = 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;
+	TimeToBulk = ISO151182014PhyValDecode(shm_msg->RemainingTimeToBulkSoC);
+	
+	if(TimeToFull > 0)
+		sys->RemainChargingDuration = TimeToFull;
+	else if(TimeToBulk > 0)
+		sys->RemainChargingDuration = TimeToBulk;
+	else
+	{
+		sys->RemainChargingDuration=0;		
+	}	
+
+	//[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;
+		/*+++ vern, itme 5 in V0.24.S0, +++*/
+		//sys->EvBatterytargetVoltage = (DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
+		if((ISO151182014PhyValDecode(shm_msg->EVTargetVoltage)+10)>=sys->EvBatteryMaxVoltage)
+			sys->EvBatterytargetVoltage = (ISO151182014PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
+		else
+			sys->EvBatterytargetVoltage =  ISO151182014PhyValDecode(shm_msg->EVTargetVoltage)+10;
+		/*--- vern, itme 5 in V0.24.S0, ---*/	
+	}
+	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;
+	
+	//in_dc_para->EVSEMaximumPowerLimit.Value=360;
+	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 +++*/
+   // in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value*=10;   /*+++ 20200808, vern, lack one more 0 ---*/
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Unit = iso1unitSymbolType_W;	//iso1unitSymbolType_W
+    #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Multiplier = 0;	//w
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Value =((unsigned int)in->AC_EVSEChargeParameter.EVSEMaxCurrent.Value*(unsigned int)in->AC_EVSEChargeParameter.EVSENominalVoltage.Value)/100;	
+    #else
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Multiplier = 3;	//kw
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Value =in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value;	//30000 if DW/DM product
+    #endif
+    /*--- 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
+		//in_dc_para->EVSEMaximumPowerLimit.Value=360;
+		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;
+		out->AC_EVSEStatus_isUsed = 1u;
+		SHM_Read_iso1AC_EVSEStatusType(&out->AC_EVSEStatus, &in->AC_EVSEStatus);
+	}
+	#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);
+}

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

@@ -0,0 +1,180 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 api.h
+
+                          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

+ 64 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypes.c

@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_AppProtocol.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include <stdint.h>
+
+#include "appHandEXIDatatypes.h"
+#include "../codec/EXITypes.h"
+
+
+#ifndef EXI_appHand_DATATYPES_C
+#define EXI_appHand_DATATYPES_C
+
+
+
+void init_appHandEXIDocument(struct appHandEXIDocument* exiDoc) {
+	exiDoc->supportedAppProtocolReq_isUsed = 0u;
+	exiDoc->supportedAppProtocolRes_isUsed = 0u;
+}
+
+void init_appHandAppProtocolType(struct appHandAppProtocolType* appHandAppProtocolType) {
+}
+
+void init_appHandAnonType_supportedAppProtocolReq(struct appHandAnonType_supportedAppProtocolReq* appHandAnonType_supportedAppProtocolReq) {
+	appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen = 0u;
+}
+
+void init_appHandAnonType_supportedAppProtocolRes(struct appHandAnonType_supportedAppProtocolRes* appHandAnonType_supportedAppProtocolRes) {
+	appHandAnonType_supportedAppProtocolRes->SchemaID_isUsed = 0u;
+}
+
+
+
+
+
+#endif
+

+ 134 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypes.h

@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_AppProtocol.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypes.h
+ * \brief 	Datatype definitions and structs for given XML Schema definitions and initialization methods
+ *
+ */
+
+#ifndef EXI_appHand_DATATYPES_H
+#define EXI_appHand_DATATYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+
+
+/* Datatype definitions and structs for given XML Schema definitions */
+
+#define UNION_YES 1
+#define UNION_NO 2
+#define SAVE_MEMORY_WITH_UNNAMED_UNION UNION_YES
+
+/* 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'.  */
+#define appHandAppProtocolType_ProtocolNamespace_CHARACTERS_SIZE 100 /* XML schema facet maxLength for urn:iso:15118:2:2010:AppProtocol,protocolNamespaceType is 100 */
+struct appHandAppProtocolType {
+	/* element: ProtocolNamespace, urn:iso:15118:2:2010:AppProtocol,protocolNamespaceType */
+	struct {
+		exi_string_character_t characters[appHandAppProtocolType_ProtocolNamespace_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ProtocolNamespace ;
+	/* element: VersionNumberMajor, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t VersionNumberMajor ;
+	/* element: VersionNumberMinor, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t VersionNumberMinor ;
+	/* element: SchemaID, urn:iso:15118:2:2010:AppProtocol,idType */
+	uint8_t SchemaID ;
+	/* element: Priority, urn:iso:15118:2:2010:AppProtocol,priorityType */
+	uint8_t Priority ;
+};
+
+typedef enum {
+	appHandresponseCodeType_OK_SuccessfulNegotiation = 0,
+	appHandresponseCodeType_OK_SuccessfulNegotiationWithMinorDeviation = 1,
+	appHandresponseCodeType_Failed_NoNegotiation = 2
+} appHandresponseCodeType;
+
+/* Complex type name='urn:iso:15118:2:2010:AppProtocol,#AnonType_supportedAppProtocolRes',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(ResponseCode,SchemaID{0-1})',  derivedBy='RESTRICTION'.  */
+struct appHandAnonType_supportedAppProtocolRes {
+	/* element: ResponseCode, urn:iso:15118:2:2010:AppProtocol,responseCodeType */
+	appHandresponseCodeType ResponseCode ;
+	/* element: SchemaID, urn:iso:15118:2:2010:AppProtocol,idType */
+	uint8_t SchemaID ;
+	unsigned int SchemaID_isUsed:1;
+};
+
+/* 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	//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 {
+		struct appHandAppProtocolType array[appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} AppProtocol;
+};
+
+
+
+
+
+/* Possible root elements of EXI Document */
+struct appHandEXIDocument {
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	struct appHandAnonType_supportedAppProtocolReq supportedAppProtocolReq ;
+	struct appHandAnonType_supportedAppProtocolRes supportedAppProtocolRes ;
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	};
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	unsigned int supportedAppProtocolReq_isUsed:1;
+	unsigned int supportedAppProtocolRes_isUsed:1;
+
+
+	int _warning_;
+};
+
+/* Initialization methods for structs */
+
+void init_appHandEXIDocument(struct appHandEXIDocument* exiDoc);
+void init_appHandAppProtocolType(struct appHandAppProtocolType* appHandAppProtocolType);
+void init_appHandAnonType_supportedAppProtocolReq(struct appHandAnonType_supportedAppProtocolReq* appHandAnonType_supportedAppProtocolReq);
+void init_appHandAnonType_supportedAppProtocolRes(struct appHandAnonType_supportedAppProtocolRes* appHandAnonType_supportedAppProtocolRes);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 896 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypesDecoder.c

@@ -0,0 +1,896 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_AppProtocol.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+
+#include "appHandEXIDatatypesDecoder.h"
+
+#include "../codec/DecoderChannel.h"
+#include "../codec/EXIHeaderDecoder.h"
+
+#include "appHandEXIDatatypes.h"
+#include "../codec/ErrorCodes.h"
+
+#ifndef EXI_appHand_DATATYPES_DECODER_C
+#define EXI_appHand_DATATYPES_DECODER_C
+
+/** event-code */
+static uint32_t eventCode;
+static int errn;
+static uint32_t uint32;
+
+
+/* Forward Declarations */
+static int decode_appHandAppProtocolType(bitstream_t* stream, struct appHandAppProtocolType* appHandAppProtocolType);
+static int decode_appHandAnonType_supportedAppProtocolReq(bitstream_t* stream, struct appHandAnonType_supportedAppProtocolReq* appHandAnonType_supportedAppProtocolReq);
+static int decode_appHandAnonType_supportedAppProtocolRes(bitstream_t* stream, struct appHandAnonType_supportedAppProtocolRes* appHandAnonType_supportedAppProtocolRes);
+
+/* Deviant data decoding (skip functions) */
+
+
+
/* 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'.  */
+static int decode_appHandAppProtocolType(bitstream_t* stream, struct appHandAppProtocolType* appHandAppProtocolType) {
+	int grammarID = 0;
+	int done = 0;
+
+	init_appHandAppProtocolType(appHandAppProtocolType);
+
+	while(!done) {
+		switch(grammarID) {
+		case 0:
+			/* FirstStartTag[START_ELEMENT(ProtocolNamespace)] */
+			errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					/* FirstStartTag[CHARACTERS[STRING]] */
+					errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+					if(errn == 0) {
+						if(eventCode == 0) {
+							errn = decodeUnsignedInteger16(stream, &appHandAppProtocolType->ProtocolNamespace.charactersLen);
+							if (errn == 0) {
+								if (appHandAppProtocolType->ProtocolNamespace.charactersLen >= 2) {
+									appHandAppProtocolType->ProtocolNamespace.charactersLen = (uint16_t)(appHandAppProtocolType->ProtocolNamespace.charactersLen - 2); /* string table miss */
+									errn = decodeCharacters(stream, appHandAppProtocolType->ProtocolNamespace.charactersLen, appHandAppProtocolType->ProtocolNamespace.characters, appHandAppProtocolType_ProtocolNamespace_CHARACTERS_SIZE);
+								} else {
+									/* string table hit */
+									errn = EXI_ERROR_STRINGVALUES_NOT_SUPPORTED;
+								}
+							}
+						} else {
+							/* Second level event (e.g., xsi:type, xsi:nil, ...) */
+							errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
+						}
+					}
+					if(errn == 0) {
+						/* valid EE for simple element START_ELEMENT(ProtocolNamespace) ? */
+						errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+						if(eventCode == 0) {
+						grammarID = 1;
+						} else {
+							errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */
+						}
+					}
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 1:
+			/* Element[START_ELEMENT(VersionNumberMajor)] */
+			errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
+					errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+					if(errn == 0) {
+						if(eventCode == 0) {
+							errn = decodeUnsignedInteger32(stream, &appHandAppProtocolType->VersionNumberMajor);
+						} else {
+							/* Second level event (e.g., xsi:type, xsi:nil, ...) */
+							errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
+						}
+					}
+					if(errn == 0) {
+						/* valid EE for simple element START_ELEMENT(VersionNumberMajor) ? */
+						errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+						if(eventCode == 0) {
+						grammarID = 2;
+						} else {
+							errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */
+						}
+					}
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 2:
+			/* Element[START_ELEMENT(VersionNumberMinor)] */
+			errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
+					errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+					if(errn == 0) {
+						if(eventCode == 0) {
+							errn = decodeUnsignedInteger32(stream, &appHandAppProtocolType->VersionNumberMinor);
+						} else {
+							/* Second level event (e.g., xsi:type, xsi:nil, ...) */
+							errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
+						}
+					}
+					if(errn == 0) {
+						/* valid EE for simple element START_ELEMENT(VersionNumberMinor) ? */
+						errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+						if(eventCode == 0) {
+						grammarID = 3;
+						} else {
+							errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */
+						}
+					}
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 3:
+			/* Element[START_ELEMENT(SchemaID)] */
+			errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
+					errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+					if(errn == 0) {
+						if(eventCode == 0) {
+							errn = decodeNBitUnsignedInteger(stream, 8, &(uint32));
+							appHandAppProtocolType->SchemaID = (uint8_t)(uint32 + 0);
+						} else {
+							/* Second level event (e.g., xsi:type, xsi:nil, ...) */
+							errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
+						}
+					}
+					if(errn == 0) {
+						/* valid EE for simple element START_ELEMENT(SchemaID) ? */
+						errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+						if(eventCode == 0) {
+						grammarID = 4;
+						} else {
+							errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */
+						}
+					}
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 4:
+			/* Element[START_ELEMENT(Priority)] */
+			errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
+					errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+					if(errn == 0) {
+						if(eventCode == 0) {
+							errn = decodeNBitUnsignedInteger(stream, 5, &(uint32));
+							appHandAppProtocolType->Priority = (uint8_t)(uint32 + 1);
+						} else {
+							/* Second level event (e.g., xsi:type, xsi:nil, ...) */
+							errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
+						}
+					}
+					if(errn == 0) {
+						/* valid EE for simple element START_ELEMENT(Priority) ? */
+						errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+						if(eventCode == 0) {
+						grammarID = 5;
+						} else {
+							errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */
+						}
+					}
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 5:
+			/* Element[END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		default:
+			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
+			break;
+		}
+		if(errn) {
+			done = 1;
+		}
+	}
+	return errn;
+}
+
+/* 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'.  */
+static int decode_appHandAnonType_supportedAppProtocolReq(bitstream_t* stream, struct appHandAnonType_supportedAppProtocolReq* appHandAnonType_supportedAppProtocolReq) {
+	int grammarID = 7;
+	int done = 0;
+
+	init_appHandAnonType_supportedAppProtocolReq(appHandAnonType_supportedAppProtocolReq);
+
+	while(!done) {
+		switch(grammarID) {
+		case 7:
+			/* FirstStartTag[START_ELEMENT(AppProtocol)] */
+			errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 8;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 8:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 9;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 9:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 10;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 10:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 11;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 11:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 12;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 12:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 13;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 13:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 14;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 14:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 15;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 15:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 16;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 16:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 17;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 17:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 18;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 18:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 19;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 19:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 20;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 20:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 21;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 21:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 22;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 22:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 23;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 23:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 24;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 24:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 25;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 25:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 26;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 26:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					if (appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen < appHandAnonType_supportedAppProtocolReq_AppProtocol_ARRAY_SIZE) {
+						errn = decode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array[appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen++]);
+					} else {
+						errn = EXI_ERROR_OUT_OF_BOUNDS;
+					}
+					grammarID = 5;
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 5:
+			/* Element[END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		default:
+			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
+			break;
+		}
+		if(errn) {
+			done = 1;
+		}
+	}
+	return errn;
+}
+
+/* Complex type name='urn:iso:15118:2:2010:AppProtocol,#AnonType_supportedAppProtocolRes',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(ResponseCode,SchemaID{0-1})',  derivedBy='RESTRICTION'.  */
+static int decode_appHandAnonType_supportedAppProtocolRes(bitstream_t* stream, struct appHandAnonType_supportedAppProtocolRes* appHandAnonType_supportedAppProtocolRes) {
+	int grammarID = 27;
+	int done = 0;
+
+	init_appHandAnonType_supportedAppProtocolRes(appHandAnonType_supportedAppProtocolRes);
+
+	while(!done) {
+		switch(grammarID) {
+		case 27:
+			/* FirstStartTag[START_ELEMENT(ResponseCode)] */
+			errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
+					errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+					if(errn == 0) {
+						if(eventCode == 0) {
+							errn = decodeNBitUnsignedInteger(stream, 2, &uint32);
+							appHandAnonType_supportedAppProtocolRes->ResponseCode = (appHandresponseCodeType) uint32;
+						} else {
+							/* Second level event (e.g., xsi:type, xsi:nil, ...) */
+							errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
+						}
+					}
+					if(errn == 0) {
+						/* valid EE for simple element START_ELEMENT(ResponseCode) ? */
+						errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+						if(eventCode == 0) {
+						grammarID = 28;
+						} else {
+							errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */
+						}
+					}
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 28:
+			/* Element[START_ELEMENT(SchemaID), END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
+					errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+					if(errn == 0) {
+						if(eventCode == 0) {
+							errn = decodeNBitUnsignedInteger(stream, 8, &(uint32));
+							appHandAnonType_supportedAppProtocolRes->SchemaID = (uint8_t)(uint32 + 0);
+							appHandAnonType_supportedAppProtocolRes->SchemaID_isUsed = 1u;
+						} else {
+							/* Second level event (e.g., xsi:type, xsi:nil, ...) */
+							errn = EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS;
+						}
+					}
+					if(errn == 0) {
+						/* valid EE for simple element START_ELEMENT(SchemaID) ? */
+						errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+						if(eventCode == 0) {
+						grammarID = 5;
+						} else {
+							errn = EXI_DEVIANT_SUPPORT_NOT_DEPLOYED; /* or also typecast and nillable */
+						}
+					}
+					break;
+				case 1:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		case 5:
+			/* Element[END_ELEMENT] */
+			errn = decodeNBitUnsignedInteger(stream, 1, &eventCode);
+			if (errn == 0) {
+				switch(eventCode) {
+				case 0:
+					done = 1;
+					grammarID = 6;
+					break;
+				default:
+					errn = EXI_ERROR_UNKOWN_EVENT_CODE;
+					break;
+				}
+			}
+			break;
+		default:
+			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
+			break;
+		}
+		if(errn) {
+			done = 1;
+		}
+	}
+	return errn;
+}
+
+
+
+
+int decode_appHandExiDocument(bitstream_t* stream, struct appHandEXIDocument* exiDoc) {
+	errn = readEXIHeader(stream);
+
+	if(errn == 0) {
+		/* DocContent[START_ELEMENT({urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolReq), START_ELEMENT({urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolRes), START_ELEMENT_GENERIC] */
+		init_appHandEXIDocument(exiDoc);
+		errn = decodeNBitUnsignedInteger(stream, 2, &eventCode);
+		if(errn == 0) {
+			switch(eventCode) {
+			case 0:
+				/* START_ELEMENT({urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolReq) */
+				errn = decode_appHandAnonType_supportedAppProtocolReq(stream, &exiDoc->supportedAppProtocolReq);
+				exiDoc->supportedAppProtocolReq_isUsed = 1u;
+				break;
+			case 1:
+				/* START_ELEMENT({urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolRes) */
+				errn = decode_appHandAnonType_supportedAppProtocolRes(stream, &exiDoc->supportedAppProtocolRes);
+				exiDoc->supportedAppProtocolRes_isUsed = 1u;
+				break;
+			default:
+				errn = EXI_ERROR_UNEXPECTED_EVENT_LEVEL1;
+				break;
+			}
+		}
+
+	}
+
+	return errn;
+}
+
+
+#endif
+

+ 57 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypesDecoder.h

@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_AppProtocol.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypesDecoder.h
+ * \brief 	Decoder for datatype definitions
+ *
+ */
+
+#ifndef EXI_appHand_DATATYPES_DECODER_H
+#define EXI_appHand_DATATYPES_DECODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+#include "appHandEXIDatatypes.h"
+
+int decode_appHandExiDocument(bitstream_t* stream, struct appHandEXIDocument* exiDoc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 671 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypesEncoder.c

@@ -0,0 +1,671 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_AppProtocol.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+
+#include "appHandEXIDatatypesEncoder.h"
+
+#include "../codec/EncoderChannel.h"
+#include "../codec/EXIHeaderEncoder.h"
+
+#include "appHandEXIDatatypes.h"
+#include "../codec/ErrorCodes.h"
+
+#ifndef EXI_appHand_DATATYPES_ENCODER_C
+#define EXI_appHand_DATATYPES_ENCODER_C
+
+static int errn;
+
+/* Forward Declarations */
+static int encode_appHandAppProtocolType(bitstream_t* stream, struct appHandAppProtocolType* appHandAppProtocolType);
+static int encode_appHandAnonType_supportedAppProtocolReq(bitstream_t* stream, struct appHandAnonType_supportedAppProtocolReq* appHandAnonType_supportedAppProtocolReq);
+static int encode_appHandAnonType_supportedAppProtocolRes(bitstream_t* stream, struct appHandAnonType_supportedAppProtocolRes* appHandAnonType_supportedAppProtocolRes);
+
+
+
/* 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'.  */
+static int encode_appHandAppProtocolType(bitstream_t* stream, struct appHandAppProtocolType* appHandAppProtocolType) {
+	int grammarID = 0;
+	int done = 0;
+
+
+	while(!done) {
+		switch(grammarID) {
+		case 0:
+			/* FirstStartTag[START_ELEMENT(ProtocolNamespace)] */
+			if ( 1 == 1 ) {
+				errn = encodeNBitUnsignedInteger(stream, 1, 0);
+				if(errn == 0) {
+					/* FirstStartTag[CHARACTERS[STRING]] */
+					errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					if(errn == 0) {
+						/* encode string as string table miss (+2 len)*/
+						errn = encodeUnsignedInteger16(stream, (uint16_t)(appHandAppProtocolType->ProtocolNamespace.charactersLen + 2));
+						if (errn == 0) {
+							errn = encodeCharacters(stream, appHandAppProtocolType->ProtocolNamespace.characters, appHandAppProtocolType->ProtocolNamespace.charactersLen);
+						}
+						/* valid EE */
+						errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					}
+				}
+				grammarID = 1;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 1:
+			/* Element[START_ELEMENT(VersionNumberMajor)] */
+			if ( 1 == 1 ) {
+				errn = encodeNBitUnsignedInteger(stream, 1, 0);
+				if(errn == 0) {
+					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
+					errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					if(errn == 0) {
+						errn = encodeUnsignedInteger32(stream, appHandAppProtocolType->VersionNumberMajor);
+						/* valid EE */
+						errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					}
+				}
+				grammarID = 2;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 2:
+			/* Element[START_ELEMENT(VersionNumberMinor)] */
+			if ( 1 == 1 ) {
+				errn = encodeNBitUnsignedInteger(stream, 1, 0);
+				if(errn == 0) {
+					/* First(xsi:type)StartTag[CHARACTERS[UNSIGNED_INTEGER]] */
+					errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					if(errn == 0) {
+						errn = encodeUnsignedInteger32(stream, appHandAppProtocolType->VersionNumberMinor);
+						/* valid EE */
+						errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					}
+				}
+				grammarID = 3;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 3:
+			/* Element[START_ELEMENT(SchemaID)] */
+			if ( 1 == 1 ) {
+				errn = encodeNBitUnsignedInteger(stream, 1, 0);
+				if(errn == 0) {
+					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
+					errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					if(errn == 0) {
+						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(appHandAppProtocolType->SchemaID - 0));
+						/* valid EE */
+						errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					}
+				}
+				grammarID = 4;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 4:
+			/* Element[START_ELEMENT(Priority)] */
+			if ( 1 == 1 ) {
+				errn = encodeNBitUnsignedInteger(stream, 1, 0);
+				if(errn == 0) {
+					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
+					errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					if(errn == 0) {
+						errn = encodeNBitUnsignedInteger(stream, 5, (uint32_t)(appHandAppProtocolType->Priority - 1));
+						/* valid EE */
+						errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					}
+				}
+				grammarID = 5;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 5:
+			/* Element[END_ELEMENT] */
+			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 1, 0);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		default:
+			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
+			break;
+		}
+		if(errn) {
+			done = 1;
+		}
+	}
+	return errn;
+}
+
+/* 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'.  */
+static int encode_appHandAnonType_supportedAppProtocolReq(bitstream_t* stream, struct appHandAnonType_supportedAppProtocolReq* appHandAnonType_supportedAppProtocolReq) {
+	int grammarID = 7;
+	int done = 0;
+
+	unsigned int appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex = 0;
+
+	while(!done) {
+		switch(grammarID) {
+		case 7:
+			/* FirstStartTag[START_ELEMENT(AppProtocol)] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 1, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 8;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 8:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 9;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 9:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 10;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 10:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 11;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 11:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 12;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 12:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 13;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 13:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 14;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 14:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 15;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 15:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 16;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 16:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 17;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 17:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 18;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 18:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 19;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 19:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 20;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 20:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 21;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 21:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 22;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 22:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 23;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 23:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 24;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 24:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 25;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 25:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 26;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 26:
+			/* Element[START_ELEMENT(AppProtocol), END_ELEMENT] */
+			if (appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex < appHandAnonType_supportedAppProtocolReq->AppProtocol.arrayLen ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					errn = encode_appHandAppProtocolType(stream, &appHandAnonType_supportedAppProtocolReq->AppProtocol.array [appHandAnonType_supportedAppProtocolReq_AppProtocol_currArrayIndex++]);
+				}
+				grammarID = 5;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 5:
+			/* Element[END_ELEMENT] */
+			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 1, 0);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		default:
+			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
+			break;
+		}
+		if(errn) {
+			done = 1;
+		}
+	}
+	return errn;
+}
+
+/* Complex type name='urn:iso:15118:2:2010:AppProtocol,#AnonType_supportedAppProtocolRes',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(ResponseCode,SchemaID{0-1})',  derivedBy='RESTRICTION'.  */
+static int encode_appHandAnonType_supportedAppProtocolRes(bitstream_t* stream, struct appHandAnonType_supportedAppProtocolRes* appHandAnonType_supportedAppProtocolRes) {
+	int grammarID = 27;
+	int done = 0;
+
+
+	while(!done) {
+		switch(grammarID) {
+		case 27:
+			/* FirstStartTag[START_ELEMENT(ResponseCode)] */
+			if ( 1 == 1 ) {
+				errn = encodeNBitUnsignedInteger(stream, 1, 0);
+				if(errn == 0) {
+					/* FirstStartTag[CHARACTERS[ENUMERATION]] */
+					errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					if(errn == 0) {
+						errn = encodeNBitUnsignedInteger(stream, 2, appHandAnonType_supportedAppProtocolRes->ResponseCode);
+						/* valid EE */
+						errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					}
+				}
+				grammarID = 28;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 28:
+			/* Element[START_ELEMENT(SchemaID), END_ELEMENT] */
+			if ( appHandAnonType_supportedAppProtocolRes->SchemaID_isUsed == 1u ) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 0);
+				if(errn == 0) {
+					/* FirstStartTag[CHARACTERS[NBIT_UNSIGNED_INTEGER]] */
+					errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					if(errn == 0) {
+						errn = encodeNBitUnsignedInteger(stream, 8, (uint32_t)(appHandAnonType_supportedAppProtocolRes->SchemaID - 0));
+						/* valid EE */
+						errn = encodeNBitUnsignedInteger(stream, 1, 0);
+					}
+				}
+				grammarID = 5;
+			} else 			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 2, 1);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		case 5:
+			/* Element[END_ELEMENT] */
+			if (1==1) {
+				errn = encodeNBitUnsignedInteger(stream, 1, 0);
+				if(errn == 0) {
+					done = 1;
+				}
+				grammarID = 6;
+			} else {
+				errn = EXI_ERROR_UNKOWN_EVENT;
+			}
+			break;
+		default:
+			errn = EXI_ERROR_UNKOWN_GRAMMAR_ID;
+			break;
+		}
+		if(errn) {
+			done = 1;
+		}
+	}
+	return errn;
+}
+
+
+
+int encode_appHandExiDocument(bitstream_t* stream, struct appHandEXIDocument* exiDoc) {
+	errn = writeEXIHeader(stream);
+
+	if(errn == 0) {
+		/* DocContent[START_ELEMENT({urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolReq), START_ELEMENT({urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolRes), START_ELEMENT_GENERIC] */
+		if ( exiDoc->supportedAppProtocolReq_isUsed == 1u ) {
+			/* START_ELEMENT({urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolReq) */
+			errn = encodeNBitUnsignedInteger(stream, 2, 0);
+			if(errn == 0) {
+				errn = encode_appHandAnonType_supportedAppProtocolReq(stream, &exiDoc->supportedAppProtocolReq );
+			}
+		} else if ( exiDoc->supportedAppProtocolRes_isUsed == 1u ) {
+			/* START_ELEMENT({urn:iso:15118:2:2010:AppProtocol}supportedAppProtocolRes) */
+			errn = encodeNBitUnsignedInteger(stream, 2, 1);
+			if(errn == 0) {
+				errn = encode_appHandAnonType_supportedAppProtocolRes(stream, &exiDoc->supportedAppProtocolRes );
+			}
+		} else {
+			errn = EXI_ERROR_UNKOWN_EVENT;
+		}
+
+	}
+
+	if(errn == 0) {
+		/* flush any pending bits */
+		errn = encodeFinish(stream);
+	}
+
+	return errn;
+}
+
+
+#endif
+

+ 58 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/appHandshake/appHandEXIDatatypesEncoder.h

@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_AppProtocol.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypesEncoder.h
+ * \brief 	Encoder for datatype definitions
+ *
+ */
+
+#ifndef EXI_appHand_DATATYPES_ENCODER_H
+#define EXI_appHand_DATATYPES_ENCODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+#include "appHandEXIDatatypes.h"
+
+
+int encode_appHandExiDocument(bitstream_t* stream, struct appHandEXIDocument* exiDoc);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 105 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/BitInputStream.c

@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include "BitInputStream.h"
+#include "EXIConfig.h"
+#include "EXITypes.h"
+#include "ErrorCodes.h"
+
+#ifndef BIT_INPUT_STREAM_C
+#define BIT_INPUT_STREAM_C
+
+/* internal method to (re)fill buffer */
+static int readBuffer(bitstream_t* stream)
+{
+	int errn = 0;
+	if(stream->capacity==0)
+	{
+#if EXI_STREAM == BYTE_ARRAY
+		if ( (*stream->pos) < stream->size ) {
+			stream->buffer = stream->data[(*stream->pos)++];
+			stream->capacity = BITS_IN_BYTE;
+		} else {
+			errn = EXI_ERROR_INPUT_STREAM_EOF;
+		}
+#endif
+#if EXI_STREAM == FILE_STREAM
+		stream->buffer = (uint8_t)(getc(stream->file));
+		/* EOF cannot be used, 0xFF valid value */
+		if ( feof(stream->file) || ferror(stream->file) ) {
+			errn = EXI_ERROR_INPUT_STREAM_EOF;
+		} else {
+			stream->capacity = BITS_IN_BYTE;
+		}
+#endif
+	}
+	return errn;
+}
+
+int readBits(bitstream_t* stream, size_t num_bits, uint32_t* b)
+{
+	int errn = readBuffer(stream);
+	if (errn == 0) {
+		/* read the bits in one step */
+		if(num_bits <= stream->capacity) {
+			stream->capacity = (uint8_t)(stream->capacity - num_bits);
+			*b = (uint32_t)((stream->buffer >> stream->capacity) & (0xff >> (BITS_IN_BYTE - num_bits)));
+		} else {
+			/* read bits as much as possible */
+			*b = (uint32_t)(stream->buffer & (0xff >> (BITS_IN_BYTE - stream->capacity)));
+			num_bits = (num_bits - stream->capacity);
+			stream->capacity = 0;
+
+			/* read whole bytes */
+			while(errn == 0 && num_bits >= 8)
+			{
+				errn = readBuffer(stream);
+				*b = ((*b) << BITS_IN_BYTE) | stream->buffer;
+				num_bits = (num_bits - BITS_IN_BYTE);
+				stream->capacity = 0;
+			}
+
+			/* read the spare bits in the buffer */
+			if(errn == 0 && num_bits > 0)
+			{
+				errn = readBuffer(stream);
+				if (errn == 0) {
+					*b = ( (*b) << num_bits) | (uint8_t)(stream->buffer  >> (BITS_IN_BYTE - num_bits)) ;
+					stream->capacity = (uint8_t)(BITS_IN_BYTE - num_bits);
+				}
+			}
+		}
+	}
+
+	return errn;
+}
+
+#endif

+ 67 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/BitInputStream.h

@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	BitInputStream.h
+ * \brief 	Bit Input Stream
+ *
+ * 			Read bits and bytes from an underlying input stream.
+ *
+ */
+
+#ifndef BIT_INPUT_STREAM_H
+#define BIT_INPUT_STREAM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "EXITypes.h"
+
+/**
+ * \brief 		Read bits
+ *
+ * 				Read the next num_bits bits and returns result an integer.
+ *
+ * \param       stream   		Input Stream
+ * \param       num_bits		Number of bits
+ * \param       b		   		Integer value (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int readBits(bitstream_t* stream, size_t num_bits, uint32_t* b);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 124 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/BitOutputStream.c

@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include "BitOutputStream.h"
+#include "EXIConfig.h"
+#include "EXITypes.h"
+#include "ErrorCodes.h"
+
+#ifndef BIT_OUTPUT_STREAM_C
+#define BIT_OUTPUT_STREAM_C
+
+int writeBits(bitstream_t* stream, size_t nbits, uint32_t val) {
+	int errn = 0;
+	/*  is there enough space in the buffer */
+	if (nbits <= stream->capacity) {
+		/* all bits fit into the current buffer */
+		stream->buffer = (uint8_t)(stream->buffer << (nbits)) | (uint8_t)(val & (uint32_t)(0xff >> (uint32_t)(BITS_IN_BYTE - nbits)));
+		stream->capacity = (uint8_t)(stream->capacity - nbits);
+		/* if the buffer is full write byte */
+		if (stream->capacity == 0) {
+#if EXI_STREAM == BYTE_ARRAY
+			if ((*stream->pos) >= stream->size) {
+				errn = EXI_ERROR_OUTPUT_STREAM_EOF;
+			} else {
+				stream->data[(*stream->pos)++] = stream->buffer;
+			}
+#endif
+#if EXI_STREAM == FILE_STREAM
+			if ( putc(stream->buffer, stream->file) == EOF ) {
+				errn = EXI_ERROR_OUTPUT_STREAM_EOF;
+			}
+#endif
+			stream->capacity = BITS_IN_BYTE;
+			stream->buffer = 0;
+		}
+	} else {
+		/* the buffer is not enough
+		 * fill the buffer */
+		stream->buffer = (uint8_t)(stream->buffer << stream->capacity) |
+				( (uint8_t)(val >> (nbits - stream->capacity)) & (uint8_t)(0xff >> (BITS_IN_BYTE - stream->capacity)) );
+
+		nbits = (nbits - stream->capacity);
+#if EXI_STREAM == BYTE_ARRAY
+		if ((*stream->pos) >= stream->size) {
+			errn = EXI_ERROR_OUTPUT_STREAM_EOF;
+		} else {
+			stream->data[(*stream->pos)++] = stream->buffer;
+		}
+#endif
+#if EXI_STREAM == FILE_STREAM
+		if ( putc(stream->buffer, stream->file) == EOF ) {
+			errn = EXI_ERROR_OUTPUT_STREAM_EOF;
+		}
+#endif
+		stream->buffer = 0;
+
+		/* write whole bytes */
+		while (errn == 0 && nbits >= BITS_IN_BYTE) {
+			nbits = (nbits - BITS_IN_BYTE);
+#if EXI_STREAM == BYTE_ARRAY
+			if ((*stream->pos) >= stream->size) {
+				errn = EXI_ERROR_OUTPUT_STREAM_EOF;
+			} else {
+				stream->data[(*stream->pos)++] = (uint8_t)(val >> (nbits));
+			}
+#endif
+#if EXI_STREAM == FILE_STREAM
+			if ( putc((int)(val >> (nbits)), stream->file) == EOF ) {
+				errn = EXI_ERROR_OUTPUT_STREAM_EOF;
+			}
+#endif
+		}
+
+		/* spared bits are kept in the buffer */
+		stream->buffer = (uint8_t)val; /* Note: the high bits will be shifted out during further filling */
+		stream->capacity = (uint8_t)(BITS_IN_BYTE - (nbits));
+	}
+
+	return errn;
+}
+
+/**
+ * Flush output
+ */
+int flush(bitstream_t* stream) {
+	int errn = 0;
+	if (stream->capacity == BITS_IN_BYTE) {
+		/* nothing to do, no bits in buffer */
+	} else {
+		errn = writeBits(stream, stream->capacity, 0);
+	}
+	return errn;
+}
+
+#endif
+

+ 85 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/BitOutputStream.h

@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	BitOutputStream.h
+ * \brief 	Bit Output Stream
+ *
+ * 			Write bits and bytes to an underlying output stream.
+ *
+ */
+
+#ifndef BIT_OUTPUT_STREAM_H
+#define BIT_OUTPUT_STREAM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#include "EXITypes.h"
+
+/**
+ * \brief 		Write bits
+ *
+ * 				Write the n least significant bits of parameter b starting
+ * 				with the most significant, i.e. from left to right.
+ *
+ * \param       stream   		Output Stream
+ * \param       nbits			Number of bits
+ * \param       bits		   	value
+ * \return                  	Error-Code <> 0
+ *
+ */
+int writeBits(bitstream_t* stream, size_t nbits, uint32_t bits);
+
+
+/**
+ * \brief 		Flush output
+ *
+ * 				If there are some unwritten bits, pad them if necessary and
+ * 				write them out. Note that this method does flush the
+ * 				underlying stream.
+ *
+ * \param       stream   		Output Stream
+ * \return                  	Error-Code <> 0
+ *
+ */
+int flush(bitstream_t* stream);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

+ 88 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/ByteStream.c

@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/* Avoid VS warning, put before your included header files */
+/* warning C4996: ‘fopen’: This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. */
+#define _CRT_SECURE_NO_DEPRECATE
+
+#include <stdio.h>
+
+#include "EXITypes.h"
+#include "ErrorCodes.h"
+
+#ifndef BYTE_STREAM_C
+#define BYTE_STREAM_C
+
+int readBytesFromFile(const char * filename, uint8_t* data, size_t size, size_t* pos) {
+	FILE* f;
+	int character;
+	int errn = 0;
+
+	f = fopen(filename, "rb");
+
+	if (f == NULL) {
+		errn = EXI_ERROR_INPUT_FILE_HANDLE;
+	} else {
+		/* read bytes */
+		while (errn == 0 && (character = getc(f)) != EOF) {
+			if (*pos >= size) {
+				errn = EXI_ERROR_OUT_OF_BYTE_BUFFER;
+			} else {
+				data[(*pos)++] = (uint8_t) character;
+			}
+		}
+		fclose(f);
+	}
+
+	return errn;
+}
+
+int writeBytesToFile(uint8_t* data, size_t len, const char * filename) {
+	size_t rlen;
+	FILE* f = fopen(filename, "wb+");
+
+	if (f == NULL) {
+		return -1;
+	} else {
+		rlen = fwrite(data, sizeof(uint8_t), len, f);
+		fflush(f);
+		fclose(f);
+		if(rlen == len) {
+			return 0;
+		} else {
+			return EXI_ERROR_OUTPUT_FILE;
+		}
+	}
+}
+
+
+#endif /* BYTE_STREAM_C */
+

+ 75 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/ByteStream.h

@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	ByteStream.h
+ * \brief 	Byte Stream utilities
+ *
+ */
+
+#ifndef BYTE_STREAM_H
+#define BYTE_STREAM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "EXITypes.h"
+
+/**
+ * \brief 		Write bytes to file
+ *
+ * \param       data	   		byte array
+ * \param       len				length
+ * \param       filename		File name
+ * \return                  	Error-Code <> 0
+ *
+ */
+int writeBytesToFile(uint8_t* data, size_t len, const char * filename);
+
+
+/**
+ * \brief 		Read bytes from file
+ *
+ * \param       filename   		File name
+ * \param       data			byte array
+ * \param       size		   	byte array size
+ * \param       pos			   	byte array position
+ * \return                  	Error-Code <> 0
+ *
+ */
+int readBytesFromFile(const char * filename, uint8_t* data, size_t size, size_t* pos);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BYTE_STREAM_H */

+ 930 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/DecoderChannel.c

@@ -0,0 +1,930 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include "DecoderChannel.h"
+
+#include "EXIConfig.h"
+#include "EXIOptions.h"
+#include "BitInputStream.h"
+#include "EXITypes.h"
+#include "MethodsBag.h"
+/*#include "v2gEXICoder.h"*/
+#include "ErrorCodes.h"
+
+#if MEMORY_ALLOCATION == DYNAMIC_ALLOCATION
+#include "DynamicMemory.h"
+#endif /* DYNAMIC_ALLOCATION */
+
+#ifndef DECODER_CHANNEL_C
+#define DECODER_CHANNEL_C
+
+/* unsigned long == 64 bits, 10 * 7bits = 70 bits */
+#define MAX_OCTETS_FOR_UNSIGNED_INTEGER_64 10
+/* unsigned int == 32 bits, 5 * 7bits = 35 bits */
+#define MAX_OCTETS_FOR_UNSIGNED_INTEGER_32 5
+
+/* buffer for reading (arbitrary) large integer values */
+static uint8_t maskedOctets[MAX_OCTETS_FOR_UNSIGNED_INTEGER_64];
+
+
+static int _decodeUnsignedInteger(bitstream_t* stream, exi_integer_t* iv, int negative) {
+	int errn = 0;
+	int i = 0;
+	uint8_t b;
+	int k;
+
+	do {
+		/* Read the next octet */
+		errn = decode(stream, &b);
+		if (errn == 0) {
+			if(i < MAX_OCTETS_FOR_UNSIGNED_INTEGER_64) {
+				/* the 7 least significant bits hold the actual value */
+				maskedOctets[i++] = (b & 127);
+			} else {
+				errn = EXI_UNSUPPORTED_INTEGER_VALUE;
+			}
+		}
+	} while( errn == 0 && b >= 128 ); /* no more octets ? */
+
+	if ( errn == 0 ) {
+		/* For negative values, the Unsigned Integer holds the
+		 * magnitude of the value minus 1 */
+
+		switch(i) {
+		case 1: /* 7 bits */
+			if (negative) {
+				iv->val.int8 =  (int8_t)(-( b + 1));
+				iv->type = EXI_INTEGER_8;
+			} else {
+				iv->val.uint8 = b;
+				iv->type = EXI_UNSIGNED_INTEGER_8;
+			}
+			break;
+		case 2: /* 14 bits */
+			iv->val.uint16 = 0;
+			for (k = i-1; k >= 0 ; k--) {
+				iv->val.uint16  = (uint16_t)((iv->val.uint16 << 7) | maskedOctets[k]);
+			}
+			if (negative) {
+				iv->val.int16 = (int16_t)( -( iv->val.uint16 + 1 ));
+				iv->type = EXI_INTEGER_16;
+			} else {
+				iv->type = EXI_UNSIGNED_INTEGER_16;
+			}
+			break;
+		case 3: /* 21 bits */
+		case 4: /* 28 bits */
+			iv->val.uint32 = 0;
+			for (k = i-1; k >= 0 ; k--) {
+				iv->val.uint32 = (iv->val.uint32 << 7) | maskedOctets[k];
+			}
+			if (negative) {
+				iv->val.int32 = (-(int32_t)(iv->val.uint32 + 1));
+				if (iv->val.int32 <= INT16_MAX && iv->val.int32 >= INT16_MIN ) {
+					iv->type = EXI_INTEGER_16;
+				} else {
+					iv->type = EXI_INTEGER_32;
+				}
+			} else {
+				if (iv->val.uint32 <= UINT16_MAX) {
+					iv->type = EXI_UNSIGNED_INTEGER_16;
+				} else {
+					iv->type = EXI_UNSIGNED_INTEGER_32;
+				}
+			}
+			break;
+		case 5: /* 35 bits */
+		case 6: /* 42 bits */
+		case 7: /* 49 bits */
+		case 8: /* 56 bits */
+		case 9: /* 63 bits */
+		case 10: /* 70 bits */
+			iv->val.uint64 = 0;
+			for (k = i-1; k >= 0 ; k--) {
+				iv->val.uint64  = (iv->val.uint64 << 7) | maskedOctets[k];
+			}
+			if (negative) {
+				if (i > 9) {
+					/* too large */
+					return EXI_UNSUPPORTED_INTEGER_VALUE;
+				}
+				iv->val.int64 = (-(int64_t)(iv->val.uint64 + 1));
+				if (iv->val.int64 <= INT32_MAX && iv->val.int64 >= INT32_MIN ) {
+					iv->type = EXI_INTEGER_32;
+				} else {
+					iv->type = EXI_INTEGER_64;
+				}
+			} else {
+				if (iv->val.uint64 <= UINT32_MAX) {
+					iv->type = EXI_UNSIGNED_INTEGER_32;
+					/* iv->val.uint32 = iv->val.uint64;*/
+				} else {
+					iv->type = EXI_UNSIGNED_INTEGER_64;
+				}
+			}
+			break;
+		default:
+			errn = EXI_UNSUPPORTED_INTEGER_VALUE;
+			break;
+		}
+	}
+
+	return errn;
+}
+
+int decodeUnsignedInteger(bitstream_t* stream, exi_integer_t* iv) {
+	return _decodeUnsignedInteger(stream, iv, 0);
+}
+
+int decodeUnsignedInteger16(bitstream_t* stream, uint16_t* uint16) {
+	unsigned int mShift = 0;
+	int errn = 0;
+	uint8_t b = 0;
+	*uint16 = 0;
+
+	do {
+		/* 1. Read the next octet */
+		errn = decode(stream, &b);
+		/* 2. Multiply the value of the unsigned number represented by the 7
+		 * least significant
+		 * bits of the octet by the current multiplier and add the result to
+		 * the current value */
+		*uint16 = (uint16_t)(*uint16 + ((b & 127) << mShift));
+		/* 3. Multiply the multiplier by 128 */
+		mShift += 7;
+		/* 4. If the most significant bit of the octet was 1, go back to step 1 */
+	} while (errn == 0 && (b >> 7) == 1);
+
+	return errn;
+}
+
+int decodeUnsignedInteger32(bitstream_t* stream, uint32_t* uint32) {
+	/* 0XXXXXXX ... 1XXXXXXX 1XXXXXXX */
+	unsigned int mShift = 0;
+	int errn = 0;
+	uint8_t b = 0;
+	*uint32 = 0;
+
+	do {
+		/* 1. Read the next octet */
+		errn = decode(stream, &b);
+		/* 2. Multiply the value of the unsigned number represented by the 7
+		 * least significant
+		 * bits of the octet by the current multiplier and add the result to
+		 * the current value */
+		*uint32 += (uint32_t)((b & 127) << mShift);
+		/* 3. Multiply the multiplier by 128 */
+		mShift += 7;
+		/* 4. If the most significant bit of the octet was 1, go back to step 1 */
+	} while (errn == 0 && (b >> 7) == 1);
+
+	return errn;
+}
+
+int decodeUnsignedIntegerSizeT(bitstream_t* stream, size_t* sizeT) {
+	int errn = 0;
+
+	/* TODO is there a better way to detect the actual size of size_t */
+	if(SIZE_MAX == UINT16_MAX) {
+		/* 16bit */
+		uint16_t uint16;
+		errn = decodeUnsignedInteger16(stream, &uint16);
+		if(errn == 0) {
+			*sizeT = (size_t)uint16;
+		}
+	} else if(SIZE_MAX == UINT32_MAX) {
+		/* 32bit */
+		uint32_t uint32;
+		errn = decodeUnsignedInteger32(stream, &uint32);
+		if(errn == 0) {
+			*sizeT = (size_t)uint32;
+		}
+	} else {
+		/* 64bit */
+		uint64_t uint64;
+		errn = decodeUnsignedInteger64(stream, &uint64);
+		if(errn == 0) {
+			*sizeT = (size_t)uint64;
+		}
+	}
+
+	return errn;
+}
+
+
+
+/**
+ * Decode an arbitrary precision non negative integer using a sequence of
+ * octets. The most significant bit of the last octet is set to zero to
+ * indicate sequence termination. Only seven bits per octet are used to
+ * store the integer's value.
+ */
+int decodeUnsignedInteger64(bitstream_t* stream, uint64_t* uint64) {
+	unsigned int mShift = 0;
+	int errn = 0;
+	uint8_t b;
+	*uint64 = 0L;
+
+	do {
+		errn = decode(stream, &b);
+		*uint64 += ((uint64_t) (b & 127)) << mShift;
+		mShift += 7;
+	} while (errn == 0 && (b >> 7) == 1);
+
+	return errn;
+}
+
+
+void _reverseArray(uint8_t *array, int number) {
+    int x, t;
+    number--;
+
+    for(x = 0; x < number; x ++, number --) {
+        t = array[x];
+        array[x] = array[number];
+        array[number] = t;
+    }
+}
+
+/**
+ * Decode an arbitrary precision non negative integer using a sequence of
+ * octets. The most significant bit of the last octet is set to zero to
+ * indicate sequence termination. Only seven bits per octet are used to
+ * store the integer's value.
+ */
+int decodeUnsignedIntegerBig(bitstream_t* stream, size_t size, uint8_t* data, size_t* len) {
+	int errn = 0;
+	uint8_t b = 0;
+	unsigned int mShift1 = 0;
+	unsigned int mShift2 = 0;
+	unsigned int mShift3 = 0;
+	unsigned int mShift4 = 0;
+	unsigned int nBytesRead = 0;
+	unsigned int nBitsAvailable = 0;
+	uint64_t uint64_1 = 0;
+	uint64_t uint64_2 = 0;
+	uint64_t uint64_3 = 0;
+	uint64_t uint64_4 = 0;
+
+	*len = 0;
+
+	do {
+		errn = decode(stream, &b);
+		nBytesRead++;
+		nBitsAvailable += 7;
+
+		if(nBytesRead <= 8) {
+			uint64_1 += ((uint64_t) (b & 127)) << mShift1;
+			mShift1 += 7;
+		} else if(nBytesRead <= 16) {
+			uint64_2 += ((uint64_t) (b & 127)) << mShift2;
+			mShift2 += 7;
+		} else if(nBytesRead <= 24) {
+			uint64_3 += ((uint64_t) (b & 127)) << mShift3;
+			mShift3 += 7;
+		} else if(nBytesRead <= 32) {
+			uint64_4 += ((uint64_t) (b & 127)) << mShift4;
+			mShift4 += 7;
+		} else {
+			return -1; // too large
+		}
+	} while (errn == 0 && (b >> 7) == 1);
+
+	// shift actual data into array
+	if(uint64_4 != 0) {
+		// 7 octets for uint64_1
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 1
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 2
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 3
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 4
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 5
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 6
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 7
+
+		// 7 octets for uint64_2
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 1
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 2
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 3
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 4
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 5
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 6
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 7
+
+		// 7 octets for uint64_3
+		data[(*len)++] = (uint8_t)(uint64_3 & 0xFF); // 1
+		uint64_3 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_3 & 0xFF); // 2
+		uint64_3 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_3 & 0xFF); // 3
+		uint64_3 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_3 & 0xFF); // 4
+		uint64_3 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_3 & 0xFF); // 5
+		uint64_3 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_3 & 0xFF); // 6
+		uint64_3 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_3 & 0xFF); // 7
+
+		// remaining octets of uint64_4
+		while (uint64_4 != 0 && errn == 0) {
+			data[(*len)++] = uint64_4 & 0xFF;
+			uint64_4 >>= 8;
+		}
+	} else if(uint64_3 != 0) {
+		// 7 octets for uint64_1
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 1
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 2
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 3
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 4
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 5
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 6
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 7
+
+		// 7 octets for uint64_2
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 1
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 2
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 3
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 4
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 5
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 6
+		uint64_2 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_2 & 0xFF); // 7
+
+		// remaining octets of uint64_3
+		while (uint64_3 != 0 && errn == 0) {
+			data[(*len)++] = uint64_3 & 0xFF;
+			uint64_3 >>= 8;
+		}
+
+	} else if(uint64_2 != 0) {
+		// 7 octets for uint64_1
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 1
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 2
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 3
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 4
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 5
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 6
+		uint64_1 >>= 8;
+		data[(*len)++] = (uint8_t)(uint64_1 & 0xFF); // 7
+		// remaining octets of uint64_2
+		while (uint64_2 != 0 && errn == 0) {
+			data[(*len)++] = uint64_2 & 0xFF;
+			uint64_2 >>= 8;
+		}
+	} else if(uint64_1 != 0) {
+		while (uint64_1 != 0 && errn == 0) {
+			data[(*len)++] = uint64_1 & 0xFF;
+			uint64_1 >>= 8;
+		}
+	}
+
+	_reverseArray(data, *len);
+
+	return errn;
+}
+
+int decodeInteger(bitstream_t* stream, exi_integer_t* iv) {
+	int b;
+	int errn = decodeBoolean(stream, &b);
+	if (errn == 0) {
+		errn = _decodeUnsignedInteger(stream, iv, b);
+	}
+
+	return errn;
+}
+
+
+/**
+ * Decode an arbitrary precision integer using a sign bit followed by a
+ * sequence of octets. The most significant bit of the last octet is set to
+ * zero to indicate sequence termination. Only seven bits per octet are used
+ * to store the integer's value.
+ */
+int decodeInteger16(bitstream_t* stream, int16_t* int16) {
+	int b;
+	uint16_t uint16;
+	int errn = decodeBoolean(stream, &b);
+
+	if (errn == 0) {
+		if (b) {
+			/* For negative values, the Unsigned Integer holds the
+			 * magnitude of the value minus 1 */
+			errn = decodeUnsignedInteger16(stream, &uint16);
+			*int16 = (int16_t)(-(uint16 + 1));
+		} else {
+			/* positive */
+			errn = decodeUnsignedInteger16(stream, &uint16);
+			*int16 = (int16_t)(uint16);
+		}
+	}
+
+	return errn;
+}
+
+/**
+ * Decode an arbitrary precision integer using a sign bit followed by a
+ * sequence of octets. The most significant bit of the last octet is set to
+ * zero to indicate sequence termination. Only seven bits per octet are used
+ * to store the integer's value.
+ */
+int decodeInteger32(bitstream_t* stream, int32_t* int32) {
+	int b;
+	uint32_t uint32;
+	int errn = decodeBoolean(stream, &b);
+
+	if (errn == 0) {
+		if (b) {
+			/* For negative values, the Unsigned Integer holds the
+			 * magnitude of the value minus 1 */
+			errn = decodeUnsignedInteger32(stream, &uint32);
+			*int32 = (-(int32_t)(uint32 + 1));
+		} else {
+			/* positive */
+			errn = decodeUnsignedInteger32(stream, &uint32);
+			*int32 = (int32_t)(uint32);
+		}
+	}
+
+	return errn;
+}
+
+/**
+ * Decode an arbitrary precision integer using a sign bit followed by a
+ * sequence of octets. The most significant bit of the last octet is set to
+ * zero to indicate sequence termination. Only seven bits per octet are used
+ * to store the integer's value.
+ */
+int decodeInteger64(bitstream_t* stream, int64_t* int64) {
+	int b;
+	uint64_t uint64;
+	int errn = decodeBoolean(stream, &b);
+
+	if (errn == 0) {
+		if (b) {
+			/* For negative values, the Unsigned Integer holds the
+			 * magnitude of the value minus 1 */
+			errn = decodeUnsignedInteger64(stream, &uint64);
+			*int64 = (-(int64_t)(uint64 + 1));
+		} else {
+			/* positive */
+			errn = decodeUnsignedInteger64(stream, &uint64);
+			*int64 = (int64_t)(uint64);
+		}
+	}
+
+	return errn;
+}
+
+/**
+ * Decode an arbitrary precision integer using a sign bit followed by a
+ * sequence of octets. The most significant bit of the last octet is set to
+ * zero to indicate sequence termination. Only seven bits per octet are used
+ * to store the integer's value.
+ */
+int decodeIntegerBig(bitstream_t* stream, int* negative, size_t size, uint8_t* data, size_t* len) {
+	int errn = decodeBoolean(stream, negative);
+
+	if (errn == 0) {
+		if (*negative) {
+			/* For negative values, the Unsigned Integer holds the
+			 * magnitude of the value minus 1 */
+		} else {
+			/* positive */
+		}
+		errn = decodeUnsignedIntegerBig(stream, size, data, len);
+	}
+
+	return errn;
+}
+
+/**
+ * Decode a Float datatype as two consecutive Integers.
+ * The first Integer represents the mantissa of the floating point
+ * number and the second Integer represents the base-10 exponent
+ * of the floating point number.
+ */
+int decodeFloat(bitstream_t* stream, exi_float_me_t* f) {
+	int errn = decodeInteger64(stream, &f->mantissa);
+	if (errn == 0) {
+		errn = decodeInteger16(stream, &f->exponent);
+	}
+	return errn;
+}
+
+/**
+ * Decode a decimal represented as a Boolean sign followed by two Unsigned
+ * Integers. A sign value of zero (0) is used to represent positive Decimal
+ * values and a sign value of one (1) is used to represent negative Decimal
+ * values The first Integer represents the integral portion of the Decimal
+ * value. The second positive integer represents the fractional portion of
+ * the decimal with the digits in reverse order to preserve leading zeros.
+ */
+int decodeDecimal(bitstream_t* stream, exi_decimal_t* d) {
+	int errn = decodeBoolean(stream, &d->negative);
+	if (errn == 0) {
+		errn = decodeUnsignedInteger(stream, &d->integral);
+		if (errn == 0) {
+			errn = decodeUnsignedInteger(stream, &d->reverseFraction);
+		}
+	}
+
+	return errn;
+}
+
+/**
+ * Decode a sequence of characters for a given length.
+ */
+int decodeStringOnly(bitstream_t* stream, size_t len, exi_string_t* s) {
+	int errn = 0;
+	unsigned int extraChar = 0;
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_ASCII
+	extraChar = 1; /* null terminator */
+#endif /* STRING_REPRESENTATION_ASCII */
+
+	if ( (len + extraChar) > s->size) {
+#if MEMORY_ALLOCATION == STATIC_ALLOCATION
+		errn = EXI_ERROR_OUT_OF_STRING_BUFFER;
+#endif /* STATIC_ALLOCATION */
+#if MEMORY_ALLOCATION == DYNAMIC_ALLOCATION
+		if(s->size > 0) {
+			errn = exiFreeDynamicStringMemory(s);
+			if(errn) {
+				return errn;
+			}
+		}
+		errn = exiAllocateDynamicStringMemory(s, (len + extraChar)); /*s->len*/
+#endif /* DYNAMIC_ALLOCATION */
+	}
+	if(errn == 0) {
+		errn = decodeCharacters(stream, len, s->characters, s->size);
+		s->len = len;
+	}
+
+	return errn;
+}
+
+/**
+ * Decode a length prefixed sequence of characters.
+ */
+int decodeString(bitstream_t* stream, exi_string_t* s) {
+	int errn = decodeUnsignedIntegerSizeT(stream, &s->len);
+	if (errn == 0) {
+		errn = decodeStringOnly(stream, s->len, s);
+	}
+	return errn;
+}
+
+/**
+ * Decode a sequence of characters according to a given length.
+ * Each character is represented by its UCS [ISO/IEC 10646]
+ * code point encoded as an Unsigned Integer
+ */
+int decodeCharacters(bitstream_t* stream, size_t len, exi_string_character_t* chars, size_t charsSize) {
+	unsigned int i;
+	int errn = 0;
+
+	unsigned int extraChar = 0;
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_ASCII
+	extraChar = 1; /* null terminator */
+#endif /* STRING_REPRESENTATION_ASCII */
+
+	if ( (len + extraChar) > charsSize) {
+		errn = EXI_ERROR_OUT_OF_STRING_BUFFER;
+		return errn;
+	}
+
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_ASCII
+	uint8_t b;
+	for (i = 0; i < len && errn == 0; i++) {
+		errn = decode(stream, &b);
+		if(b < 128) {
+			chars[i] = (exi_string_character_t)b;
+		} else {
+			errn = EXI_ERROR_STRINGVALUES_CHARACTER;
+		}
+	}
+	/* null terminator \0 */
+	chars[i] = '\0';
+
+#endif /* STRING_REPRESENTATION_ASCII */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_UCS
+	for (i = 0; i < len && errn == 0; i++) {
+		errn = decodeUnsignedInteger32(stream, &chars[i]);
+	}
+#endif /* STRING_REPRESENTATION_UCS */
+
+
+
+
+	return errn;
+}
+
+int decodeRCSCharacters(bitstream_t* stream, size_t len, exi_string_character_t* chars, size_t charsSize, size_t rcsCodeLength, size_t rcsSize, const exi_string_character_t rcsSet[]) {
+	unsigned int i;
+	int errn = 0;
+	uint32_t uint32;
+	unsigned int extraChar = 0;
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_ASCII
+	uint8_t b;
+	extraChar = 1; /* null terminator */
+#endif /* STRING_REPRESENTATION_ASCII */
+
+	if ( (len + extraChar) > charsSize) {
+		errn = EXI_ERROR_OUT_OF_STRING_BUFFER;
+		return errn;
+	}
+
+
+	for (i = 0; i < len && errn == 0; i++) {
+		errn = decodeNBitUnsignedInteger(stream, rcsCodeLength, &uint32);
+		if(errn == 0) {
+			if ( uint32 == rcsSize ) {
+				/* RCS deviation */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_ASCII
+				errn = decode(stream, &b);
+				if(b < 128) {
+					chars[i] = (exi_string_character_t)b;
+				} else {
+					errn = EXI_ERROR_STRINGVALUES_CHARACTER;
+				}
+#endif /* STRING_REPRESENTATION_ASCII */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_UCS
+				errn = decodeUnsignedInteger32(stream, &chars[i]);
+#endif /* STRING_REPRESENTATION_UCS */
+
+			} else {
+				/* RCS match */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_ASCII
+				chars[i] = rcsSet[uint32];
+#endif /* STRING_REPRESENTATION_ASCII */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_UCS
+				chars[i] = rcsSet[uint32];
+#endif /* STRING_REPRESENTATION_UCS */
+			}
+		}
+	}
+
+	return errn;
+}
+
+
+/**
+ * Decode a binary value as a length-prefixed sequence of octets.
+ */
+int decodeBinary(bitstream_t* stream, exi_bytes_t* bytes) {
+	int errn = decodeUnsignedIntegerSizeT(stream, &bytes->len);
+	if (errn == 0) {
+		if (bytes->len > bytes->size) {
+#if MEMORY_ALLOCATION == STATIC_ALLOCATION
+			errn = EXI_ERROR_OUT_OF_BYTE_BUFFER;
+#endif /* STATIC_ALLOCATION */
+#if MEMORY_ALLOCATION == DYNAMIC_ALLOCATION
+			errn = exiFreeDynamicBinaryMemory(bytes);
+			if(errn == 0) {
+				errn = exiAllocateDynamicBinaryMemory(bytes, bytes->len);
+			}
+#endif /* DYNAMIC_ALLOCATION */
+		}
+
+		errn = decodeBytes(stream, bytes->len, bytes->data);
+	}
+
+	return errn;
+}
+
+
+int decodeBytes(bitstream_t* stream, size_t len, uint8_t* data) {
+	unsigned int i;
+	int errn = 0;
+	uint8_t b = 0;
+
+	for (i = 0; i < len && errn == 0; i++) {
+		errn = decode(stream, &b);
+		data[i] = (uint8_t)b;
+	}
+
+	return errn;
+}
+
+/**
+ * Decode Date-Time as sequence of values representing the individual
+ * components of the Date-Time.
+ */
+int decodeDateTime(bitstream_t* stream, exi_datetime_type_t type, exi_datetime_t* datetime) {
+	int errn = 0;
+
+	datetime->type = type;
+
+	datetime->year = 0;
+	datetime->monthDay = 0;
+	datetime->time = 0;
+	datetime->presenceFractionalSecs = 0;
+	datetime->fractionalSecs = 0;
+	datetime->presenceTimezone = 0;
+	datetime->timezone = 0;
+
+	switch (type) {
+	case EXI_DATETIME_GYEAR: /* Year, [Time-Zone] */
+		errn = decodeInteger32(stream, &datetime->year);
+		if (errn == 0) {
+			datetime->year += DATETIME_YEAR_OFFSET;
+		}
+		break;
+	case EXI_DATETIME_GYEARMONTH: /* Year, MonthDay, [TimeZone] */
+	case EXI_DATETIME_DATE:
+		errn = decodeInteger32(stream, &datetime->year);
+		if (errn == 0) {
+			datetime->year += DATETIME_YEAR_OFFSET;
+			errn = decodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY, &datetime->monthDay);
+		}
+		break;
+	case EXI_DATETIME_DATETIME: /* Year, MonthDay, Time, [FractionalSecs], [TimeZone] */
+		/* e.g. "0001-01-01T00:00:00.111+00:33"  */
+		errn = decodeInteger32(stream, &datetime->year);
+		if (errn == 0) {
+			datetime->year += DATETIME_YEAR_OFFSET;
+			errn = decodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY, &datetime->monthDay);
+			if (errn != 0) {
+				break;
+			}
+		}
+		/* no break */
+	case EXI_DATETIME_TIME: /* Time, [FractionalSecs], [TimeZone] */
+		/* e.g. "12:34:56.135"  */
+		errn = decodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_TIME, &datetime->time);
+		if (errn == 0) {
+			errn = decodeBoolean(stream, &datetime->presenceFractionalSecs);
+			if (errn == 0) {
+				if (datetime->presenceFractionalSecs) {
+					errn = decodeUnsignedInteger32(stream, &datetime->fractionalSecs);
+				}
+			}
+		}
+		break;
+	case EXI_DATETIME_GMONTH: /* MonthDay, [TimeZone] */
+		/* e.g. "--12" */
+	case EXI_DATETIME_GMONTHDAY: /* MonthDay, [TimeZone] */
+		/* e.g. "--01-28"  */
+	case EXI_DATETIME_GDAY: /* MonthDay, [TimeZone] */
+		/* "---16"  */
+		errn = decodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY, &datetime->monthDay );
+		break;
+	default:
+		errn = EXI_UNSUPPORTED_DATETIME_TYPE;
+		break;
+	}
+
+	if(errn == 0) {
+		errn = decodeBoolean(stream, &datetime->presenceTimezone );
+		if (errn == 0 && datetime->presenceTimezone) {
+			errn = decodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_TIMEZONE, &datetime->timezone);
+			datetime->timezone -= DATETIME_TIMEZONE_OFFSET_IN_MINUTES;
+		}
+	}
+
+	return errn;
+}
+
+
+
+int decode(bitstream_t* stream, uint8_t* b) {
+#if EXI_OPTION_ALIGNMENT == BIT_PACKED
+	uint32_t bb;
+	int errn =  readBits(stream, 8, &bb);
+	if (errn == 0) {
+		if (bb > 256) {
+			errn = EXI_ERROR_UNEXPECTED_BYTE_VALUE;
+		} else {
+			*b = (uint8_t)bb;
+		}
+	}
+
+	return errn;
+#endif /* EXI_OPTION_ALIGNMENT == BIT_PACKED */
+#if EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT
+	int errn = 0;
+#if EXI_STREAM == BYTE_ARRAY
+	if ( (*stream->pos) < stream->size ) {
+		*b = stream->data[(*stream->pos)++];
+	} else {
+		errn = EXI_ERROR_INPUT_STREAM_EOF;
+	}
+#endif /* EXI_STREAM == BYTE_ARRAY */
+#if EXI_STREAM == FILE_STREAM
+	*b = (uint8_t)(getc(stream->file));
+	/* EOF cannot be used, 0xFF valid value */
+	if ( feof(stream->file) || ferror(stream->file) ) {
+		errn = EXI_ERROR_INPUT_STREAM_EOF;
+	}
+#endif /* EXI_STREAM == FILE_STREAM */
+
+	return errn;
+#endif /* EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT */
+}
+
+int decodeBoolean(bitstream_t* stream, int* b) {
+#if EXI_OPTION_ALIGNMENT == BIT_PACKED
+	uint32_t ub;
+	int errn = readBits(stream, 1, &ub);
+	*b = (ub == 0) ? 0 : 1;
+	return errn;
+#endif /* EXI_OPTION_ALIGNMENT == BIT_PACKED */
+#if EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT
+	uint8_t bb;
+	int errn = decode(stream, &bb);
+	*b = (bb == 0) ? 0 : 1;
+	return errn;
+#endif /* EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT */
+
+}
+
+/**
+ * Decodes and returns an n-bit unsigned integer using the minimum number of
+ * bytes required for n bits.
+ */
+int decodeNBitUnsignedInteger(bitstream_t* stream, size_t nbits, uint32_t* uint32) {
+#if EXI_OPTION_ALIGNMENT == BIT_PACKED
+	int errn = 0;
+	if (nbits == 0) {
+		*uint32 = 0;
+	} else {
+		errn= readBits(stream, nbits, uint32);
+	}
+	return errn;
+#endif /* EXI_OPTION_ALIGNMENT == BIT_PACKED */
+#if EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT
+	size_t bitsRead = 0;
+	uint8_t b;
+	int errn = 0;
+	*uint32 = 0;
+
+	while (errn == 0 && bitsRead < nbits) {
+		errn = decode(stream, &b);
+		*uint32 = *uint32 + (uint32_t)(b << bitsRead);
+		bitsRead = (bitsRead + 8);
+	}
+
+	return errn;
+#endif /* EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT */
+}
+
+
+
+#endif
+

+ 441 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/DecoderChannel.h

@@ -0,0 +1,441 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	DecoderChannel.h
+ * \brief 	EXI Decoder Channel
+ *
+ */
+
+#ifndef DECODER_CHANNEL_H
+#define DECODER_CHANNEL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "EXIOptions.h"
+#include "EXITypes.h"
+
+/**
+ * \brief 		Decode byte value
+ *
+ * \param       stream   		Input Stream
+ * \param       b		   		byte (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decode(bitstream_t* stream, uint8_t* b);
+
+
+/**
+ * \brief 		Decode boolean
+ *
+ * 				Decode a single boolean value. The value false is
+ * 				represented by 0, and the value true is represented by 1.
+ *
+ * \param       stream   		Input Stream
+ * \param       b		   		boolean (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeBoolean(bitstream_t* stream, int* b);
+
+
+/**
+ * \brief 		Decode n-bit unsigned integer
+ *
+ * 				Decodes and returns an n-bit unsigned integer.
+ *
+ * \param       stream   		Input Stream
+ * \param       nbits		   	Number of bits
+ * \param       uint32		   	Value (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeNBitUnsignedInteger(bitstream_t* stream, size_t nbits, uint32_t* uint32);
+
+
+/**
+ * \brief 		Decode unsigned integer
+ *
+ * 				Decode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       iv		   		Unsigned Integer Value (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeUnsignedInteger(bitstream_t* stream, exi_integer_t* iv);
+
+
+/**
+ * \brief 		Decode unsigned integer
+ *
+ * 				Decode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       uint16		   	Unsigned Integer Value 16 bits (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeUnsignedInteger16(bitstream_t* stream, uint16_t* uint16);
+
+
+/**
+ * \brief 		Decode unsigned integer
+ *
+ * 				Decode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       uint32		   	Unsigned Integer Value 32 bits (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeUnsignedInteger32(bitstream_t* stream, uint32_t* uint32);
+
+
+/**
+ * \brief 		Decode unsigned integer
+ *
+ * 				Decode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       sizeT			Unsigned Integer Value (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeUnsignedIntegerSizeT(bitstream_t* stream, size_t* sizeT);
+
+
+/**
+ * \brief 		Decode unsigned integer
+ *
+ * 				Decode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       uint64		   	Unsigned Integer Value 64 bits (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeUnsignedInteger64(bitstream_t* stream, uint64_t* uint64);
+
+/**
+ * \brief 		Decode unsigned integer
+ *
+ * 				Decode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       size		   	size array
+ * \param       data		   	data array
+ * \param       len		   		length array
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeUnsignedIntegerBig(bitstream_t* stream, size_t size, uint8_t* data, size_t* len);
+
+
+/**
+ * \brief 		Decode integer
+ *
+ * 				Decode an arbitrary precision integer using a sign bit
+ * 				followed by a sequence of octets. The most significant bit
+ * 				of the last octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       iv		   		Integer Value 64 bits (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeInteger(bitstream_t* stream, exi_integer_t* iv);
+
+
+/**
+ * \brief 		Decode integer
+ *
+ * 				Decode an arbitrary precision integer using a sign bit
+ * 				followed by a sequence of octets. The most significant bit
+ * 				of the last octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       int16		   	Integer Value 16 bits (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeInteger16(bitstream_t* stream, int16_t* int16);
+
+
+/**
+ * \brief 		Decode integer
+ *
+ * 				Decode an arbitrary precision integer using a sign bit
+ * 				followed by a sequence of octets. The most significant bit
+ * 				of the last octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       int32		   	Integer Value 32 bits (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeInteger32(bitstream_t* stream, int32_t* int32);
+
+
+/**
+ * \brief 		Decode integer
+ *
+ * 				Decode an arbitrary precision integer using a sign bit
+ * 				followed by a sequence of octets. The most significant bit
+ * 				of the last octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       int64		   	Integer Value 64 bits (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeInteger64(bitstream_t* stream, int64_t* int64);
+
+/**
+ * \brief 		Decode integer
+ *
+ * 				Decode an arbitrary precision integer using a sign bit
+ * 				followed by a sequence of octets. The most significant bit
+ * 				of the last octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Input Stream
+ * \param       negative		negative integer
+ * \param       size		   	size array
+ * \param       data		   	data array
+ * \param       len		   		length array
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeIntegerBig(bitstream_t* stream, int* negative, size_t size, uint8_t* data, size_t* len);
+
+/**
+ * \brief 		Decode float
+ *
+ * 				Decode a Float datatype as two consecutive Integers. The
+ * 				first Integer represents the mantissa of the floating point
+ * 				number and the second Integer represents the base-10 exponent
+ * 				of the floating point number.
+ *
+ * \param       stream   		Input Stream
+ * \param       f			   	Float Value (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeFloat(bitstream_t* stream, exi_float_me_t* f);
+
+
+/**
+ * \brief 		Decode decimal
+ *
+ * 				Decode a decimal represented as a Boolean sign followed by two
+ * 				Unsigned Integers. A sign value of zero (0) is used to represent
+ * 				positive Decimal values and a sign value of one (1) is used to
+ * 				represent negative Decimal values The first Integer represents
+ * 				the integral portion of the Decimal value. The second positive
+ * 				integer represents the fractional portion of the decimal with
+ * 				the digits in reverse order to preserve leading zeros.
+ *
+ * \param       stream   		Input Stream
+ * \param       d			   	Decimal Value (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeDecimal(bitstream_t* stream, exi_decimal_t* d);
+
+
+/**
+ * \brief 		Decode String (no length prefix)
+ *
+ * 				Decode a sequence of characters for a given length.
+ *
+ * \param       stream   		Input Stream
+ * \param       len			   	Characters length
+ * \param       s			   	String Value (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeStringOnly(bitstream_t* stream, size_t len, exi_string_t* s);
+
+
+/**
+ * \brief 		Decode String
+ *
+ * 				Decode a length prefixed sequence of characters.
+ *
+ * \param       stream   		Input Stream
+ * \param       s			   	String Value (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeString(bitstream_t* stream, exi_string_t* s);
+
+
+
+/**
+ * \brief 		Decode String value
+ *
+ * 				Decode a length prefixed sequence of characters in the sense of string tables.
+ * 				length == 0: local value partition hit.
+ * 				length == 1: global value partition hit.
+ * 				length > 1: string literal is encoded as a String with the length incremented by two
+ *
+ * \param       stream   		Input Stream
+ * \param       stringTable   	String Table
+ * \param       qnameID   		Qualified Name ID
+ * \param       namespaceUriID  Qualified Namespace ID
+ * \param       localNameID  	Qualified LocalName ID
+ * \param       s			   	String Value (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeStringValue(bitstream_t* stream, exi_value_string_table_t* stringTable, size_t namespaceUriID, size_t localNameID, exi_string_value_t* s);
+
+
+/**
+ * \brief 		Decode Restricted characters set string value
+ *
+ * \param       stream   		Input Stream
+ * \param       stringTable   	StringTable
+ * \param       namespaceUriID  qualified namespace ID
+ * \param       localNameID   	qualified localName ID
+ * \param       rcs		   		Restricted character set
+ * \param       s			   	String Value (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeRCSStringValue(bitstream_t* stream, exi_value_string_table_t* stringTable, size_t namespaceUriID, size_t localNameID, exi_rcs_t* rcs, exi_string_value_t* s);
+
+
+/**
+ * \brief 		Decode characters
+ *
+ * 				Decode a sequence of characters according to a given length.
+ *
+ * \param       stream   		Input Stream
+ * \param       len		   		Length
+ * \param       chars   		Characters (out)
+ * \param       charsSize		Size of possible characters
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeCharacters(bitstream_t* stream, size_t len, exi_string_character_t* chars, size_t charsSize);
+
+
+/**
+ * \brief 		Decode restricted character set characters
+ *
+ * 				Decode a sequence of characters according to a given length and rcs code-length, size and set.
+ *
+ * \param       stream   		Input Stream
+ * \param       len		   		Length
+ * \param       chars   		Characters (out)
+ * \param       charsSize		Size of possible characters
+ * \param       rcsCodeLength   RCS code-length
+ * \param       rcsCodeLength   RCS size
+ * \param       rcsCodeLength   RCS set
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeRCSCharacters(bitstream_t* stream, size_t len, exi_string_character_t* chars, size_t charsSize, size_t rcsCodeLength, size_t rcsSize, const exi_string_character_t rcsSet[]);
+
+
+
+/**
+ * \brief 		Decode Binary
+ *
+ * 				Decode a binary value as a length-prefixed sequence of octets.
+ *
+ * \param       stream   		Input Stream
+ * \param       bytes   		Bytes (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeBinary(bitstream_t* stream, exi_bytes_t* bytes);
+
+/**
+ * \brief 		Decode Binary data
+ *
+ * 				Decode a sequence of octets.
+ *
+ * \param       stream   		Input Stream
+ * \param       len		   		Length
+ * \param       data	   		Bytes (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeBytes(bitstream_t* stream, size_t len, uint8_t* data);
+
+/**
+ * \brief 		Decode DateTime
+ *
+ * 				Decode Date-Time as sequence of values representing the
+ * 				individual components of the Date-Time.
+ *
+ * \param       stream   		Input Stream
+ * \param       type   			Datetime type
+ * \param       datetime   		Datetime (out)
+ * \return                  	Error-Code <> 0
+ *
+ */
+int decodeDateTime(bitstream_t* stream, exi_datetime_type_t type, exi_datetime_t* datetime);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 106 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIConfig.h

@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-23
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIConfig.h
+ * \brief 	EXI Configurations for the EXI Codec
+ *
+ */
+
+#ifndef EXI_CONFIG_H
+#define EXI_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** EXI stream - Option Byte Array */
+#define BYTE_ARRAY 1
+/** EXI stream - Option File */
+#define FILE_STREAM 2
+/** \brief 	EXI stream
+ *
+ * 			Byte array or file
+ * */
+#define EXI_STREAM BYTE_ARRAY
+
+
+
+
+
+/** Memory allocation - static */
+#define STATIC_ALLOCATION 1
+/** Memory allocation - dynamic */
+#define DYNAMIC_ALLOCATION  2
+/** */
+/** \brief 	Memory allocation mode
+ *
+ * 			static or dynamic memory allocation
+ * */
+#define MEMORY_ALLOCATION STATIC_ALLOCATION
+
+
+
+/** String representation ASCII */
+#define STRING_REPRESENTATION_ASCII 1
+/** String representation Universal Character Set (UCS) */
+#define STRING_REPRESENTATION_UCS 2
+/** */
+/** \brief 	String representation mode
+ *
+ * 			ASCII or UCS
+ * */
+#define STRING_REPRESENTATION STRING_REPRESENTATION_UCS
+
+
+/* in the case of ASCII an extra char (null terminator) for printf and other functions is useful */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_ASCII
+#define EXTRA_CHAR 1
+#endif /* STRING_REPRESENTATION_ASCII */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_UCS
+#define EXTRA_CHAR 0
+#endif /* STRING_REPRESENTATION_UCS */
+
+
+
+
+
+/** Maximum number of cascading elements, XML tree depth */
+#define EXI_ELEMENT_STACK_SIZE 24
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* EXI_CONFIG_H */
+

+ 66 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIHeaderDecoder.c

@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include "EXIHeaderDecoder.h"
+#include "BitInputStream.h"
+#include "DecoderChannel.h"
+#include "ErrorCodes.h"
+
+#ifndef EXI_HEADER_DECODER_C
+#define EXI_HEADER_DECODER_C
+
+int readEXIHeader(bitstream_t* stream) {
+	int errn;
+	uint32_t header = 0;
+
+	/* init stream */
+	stream->buffer = 0;
+	stream->capacity = 0;
+
+	errn = readBits(stream, 8, &header);
+	if (errn == 0) {
+		if(header == '$') {
+			/*	we do not support "EXI Cookie" */
+			errn = EXI_UNSUPPORTED_HEADER_COOKIE;
+		} else if ( header & 0x20 ) {
+			/* we do not support "Presence Bit for EXI Options" */
+			errn = EXI_UNSUPPORTED_HEADER_OPTIONS;
+		} else {
+			/* Yes, a *simple* header */
+			errn = 0;
+		}
+	}
+
+	return errn;
+}
+
+
+#endif

+ 60 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIHeaderDecoder.h

@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIHeaderDecoder.h
+ * \brief 	EXI Header Decoder
+ *
+ */
+
+#ifndef EXI_HEADER_DECODER_H
+#define EXI_HEADER_DECODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "EXITypes.h"
+
+/**
+ * \brief 		Reads EXI header
+ *
+ * \param       stream   		Input Stream
+ * \return                  	Error-Code <> 0
+ *
+ */
+int readEXIHeader(bitstream_t* stream);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 50 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIHeaderEncoder.c

@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include "EXIHeaderEncoder.h"
+#include "BitOutputStream.h"
+#include "EncoderChannel.h"
+
+#ifndef EXI_HEADER_ENCODER_C
+#define EXI_HEADER_ENCODER_C
+
+int writeEXIHeader(bitstream_t* stream) {
+	/* init stream */
+	stream->buffer = 0;
+	stream->capacity = 8;
+
+	return writeBits(stream, 8, 128);
+}
+
+
+#endif
+
+

+ 61 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIHeaderEncoder.h

@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIHeaderEncoder.h
+ * \brief 	EXI Header Encoder
+ *
+ */
+
+#ifndef EXI_HEADER_ENCODER_H
+#define EXI_HEADER_ENCODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "EXITypes.h"
+
+
+/**
+ * \brief 		Writes EXI header
+ *
+ * \param       stream   		Output Stream
+ * \return                  	Error-Code <> 0
+ *
+ */
+int writeEXIHeader(bitstream_t* stream);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 93 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXIOptions.h

@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIOptions.h
+ * \brief 	EXI Options for the EXI Codec
+ *
+ */
+
+#ifndef EXI_OPTIONS_H
+#define EXI_OPTIONS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** EXI alignment - Option bit-packed */
+#define BIT_PACKED 1
+/** EXI alignment - Option byte-packed */
+#define BYTE_ALIGNMENT  2
+/** EXI alignment */
+/**
+ * \brief 		EXI Option 'alignment'
+ *
+ *				The alignment option is used to control the alignment of event codes and content items.
+ *				Default Value: bit-packed
+ */
+#define EXI_OPTION_ALIGNMENT BIT_PACKED
+
+
+
+/**
+ * \brief 		EXI Option 'strict'
+ *
+ *				Strict interpretation of schemas is used to achieve better compactness.
+ *				Default Value: false
+ */
+#define EXI_OPTION_STRICT 0
+
+
+/**
+ * \brief 		EXI Option 'valueMaxLength'
+ *
+ *				Specifies the maximum string length of value content items to be
+ *				considered for addition to the string table.
+ *				Default Value: unbounded (-1)
+ */
+#define EXI_OPTION_VALUE_MAX_LENGTH -1
+
+
+/**
+ * \brief 		EXI Option 'valuePartitionCapacity'
+ *
+ *				Specifies the total capacity of value partitions in a string table.
+ *				Default Value: unbounded (-1)
+ */
+#define EXI_OPTION_VALUE_PARTITION_CAPACITY 0
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* EXI_OPTIONS_H */

+ 591 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EXITypes.h

@@ -0,0 +1,591 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXITypes.h
+ * \brief 	Basic type definitions and structs
+ *
+ */
+
+#ifndef EXI_TYPES_H
+#define EXI_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdio.h>
+#include "EXIConfig.h"
+#if EXI_STREAM == FILE_STREAM
+#include <stdio.h>
+#endif
+
+
+/** Number of bits for each byte */
+#define BITS_IN_BYTE 8
+
+/** EXI Date-Time offset for year */
+#define DATETIME_YEAR_OFFSET 2000
+/** EXI Date-Time number of bits for monthDay */
+#define DATETIME_NUMBER_BITS_MONTHDAY 9
+/** EXI Date-Time number of bits for time */
+#define DATETIME_NUMBER_BITS_TIME 17
+/** EXI Date-Time number of bits for timezone */
+#define DATETIME_NUMBER_BITS_TIMEZONE 11
+/** EXI Date-Time month multiplicator */
+#define DATETIME_MONTH_MULTIPLICATOR 32
+/** EXI Date-Time offset for timzone minutes */
+#define DATETIME_TIMEZONE_OFFSET_IN_MINUTES 896
+
+/** Maximum integer value for uint */
+#define UINT_MAX_VALUE 65535
+
+
+/** EXI Float exponent special values */
+#define FLOAT_EXPONENT_SPECIAL_VALUES -16384
+/** EXI Float mantissa infinity */
+#define FLOAT_MANTISSA_INFINITY 1
+/** EXI Float minus mantissa infinity */
+#define FLOAT_MANTISSA_MINUS_INFINITY -1
+/** EXI Float not a number */
+#define FLOAT_MANTISSA_NOT_A_NUMBER 0
+
+/** \brief EXI Events */
+typedef enum {
+	/** Start Document SD */
+	EXI_EVENT_START_DOCUMENT,
+	/** End Document ED */
+	EXI_EVENT_END_DOCUMENT,
+	/** Start Element SE(qname) */
+	EXI_EVENT_START_ELEMENT,
+	/** Start Element SE(uri:*) */
+	EXI_EVENT_START_ELEMENT_NS,
+	/** Start Element SE(*) generic */
+	EXI_EVENT_START_ELEMENT_GENERIC,
+	/** Start Element SE(*) generic undeclared */
+	EXI_EVENT_START_ELEMENT_GENERIC_UNDECLARED,
+	/** End Element EE */
+	EXI_EVENT_END_ELEMENT,
+	/** End Element EE undeclared*/
+	EXI_EVENT_END_ELEMENT_UNDECLARED,
+	/** Characters CH */
+	EXI_EVENT_CHARACTERS,
+	/** Characters CH generic */
+	EXI_EVENT_CHARACTERS_GENERIC,
+	/** Characters CH generic undeclared */
+	EXI_EVENT_CHARACTERS_GENERIC_UNDECLARED,
+	/** Attribute AT(xsi:type) */
+	EXI_EVENT_ATTRIBUTE_XSI_TYPE,
+	/** Attribute AT(xsi:nil) */
+	EXI_EVENT_ATTRIBUTE_XSI_NIL,
+	/** Attribute AT(qname) */
+	EXI_EVENT_ATTRIBUTE,
+	/** Attribute AT(uri:*) */
+	EXI_EVENT_ATTRIBUTE_NS,
+	/** Attribute AT(*) generic */
+	EXI_EVENT_ATTRIBUTE_GENERIC,
+	/** Attribute AT(*) invalid value */
+	EXI_EVENT_ATTRIBUTE_INVALID_VALUE,
+	/** Attribute AT(*) any invalid value */
+	EXI_EVENT_ATTRIBUTE_ANY_INVALID_VALUE,
+	/** Attribute AT(*) generic undeclared */
+	EXI_EVENT_ATTRIBUTE_GENERIC_UNDECLARED,
+	/* error state */
+	EXI_EVENT_ERROR
+} exi_event_t;
+
+
+/**
+ * \brief 	Bit stream container
+ *
+ *	Structure for byteArray/file stream.
+ *
+ *	# General
+ *	.size defines the maximum size of the byte array (see .data)
+ *
+ *	.data points to the input/output array of bytes (unsigned char*).
+ *
+ *	.pos has to be set to an pointer to an 32 bit long unsigned integer (uint32_t *)
+ *	 as this variable is read/write.
+ *	 Therefore it is best practice to declare the variable itself and use the &-operator
+ *	 to assign the address. The value of that variable points to the position inside the
+ *	 buffer where the stream begins. Which is usually the first (0th) byte but can also be
+ *	 another value if there more information transferred in that stream.
+ *	 After processing .pos points to the next "available" byte (if any left).
+ *
+ *	.buffer has to be set to 0 for internal use only (single byte buffer)
+ *
+ *	# Receiving data (input)
+ *	.capacity is used for addressing single bits in the actual byte (see .buffer)
+ *	 and has to be set to 0, which means there are 0 bits read so far and a new
+ *	 byte needs to be read from the input stream/data-array to the current byte buffer.
+ *
+ *	# Sending data (output)
+ *	.capacity is used for addressing single bits in the actual byte (see .buffer)
+ *	 and has to be set to 8, which means there are still 8 bits left to fill up
+ *	 the current byte buffer before writing the final byte to the output stream/data-array.
+ *
+ */
+typedef struct {
+#if EXI_STREAM == BYTE_ARRAY
+	/**	byte array size */
+	size_t size;
+	/**	byte array data */
+	uint8_t* data;
+	/**	byte array next position in array */
+	size_t* pos;
+#endif
+#if EXI_STREAM == FILE_STREAM
+	/** file pointer */
+	FILE *file;
+#endif
+	/** Current byte buffer*/
+	uint8_t buffer;
+	/** Remaining bit capacity in current byte buffer*/
+	uint8_t capacity;
+} bitstream_t;
+
+
+/** \brief EXI Value Datatypes */
+typedef enum {
+	/** Binary Base64 */
+	EXI_DATATYPE_BINARY_BASE64,
+	/** Binary Hex */
+	EXI_DATATYPE_BINARY_HEX,
+	/** Boolean */
+	EXI_DATATYPE_BOOLEAN,
+	/** Boolean with Facets */
+	EXI_DATATYPE_BOOLEAN_FACET,
+	/** Decimal */
+	EXI_DATATYPE_DECIMAL,
+	/** Float & Double */
+	EXI_DATATYPE_FLOAT,
+	/** N-Bit Unsigned Integer */
+	EXI_DATATYPE_NBIT_UNSIGNED_INTEGER,
+	/** Unsigned Integer */
+	EXI_DATATYPE_UNSIGNED_INTEGER,
+	/** (Signed) Integer */
+	EXI_DATATYPE_INTEGER,
+	/** Datetime */
+	EXI_DATATYPE_DATETIME,
+	/** String */
+	EXI_DATATYPE_STRING,
+	/** Restricted Character Set String */
+	EXI_DATATYPE_RCS_STRING,
+	/** Enumeration */
+	EXI_DATATYPE_ENUMERATION,
+	/** List */
+	EXI_DATATYPE_LIST,
+	/** QName (e.g. xsi:type) */
+	EXI_DATATYPE_QNAME
+} exi_datatype_t;
+
+
+/** \brief EXI Integer Value types */
+typedef enum {
+	/** Unsigned Integer 8 bits */
+	EXI_UNSIGNED_INTEGER_8,
+	/** Unsigned Integer 16 bits */
+	EXI_UNSIGNED_INTEGER_16,
+	/** Unsigned Integer 32 bits */
+	EXI_UNSIGNED_INTEGER_32,
+	/** Unsigned Integer 64 bits */
+	EXI_UNSIGNED_INTEGER_64,
+	/** (Signed) Integer 8 bits */
+	EXI_INTEGER_8,
+	/** (Signed) Integer 16 bits */
+	EXI_INTEGER_16,
+	/** (Signed) Integer 32 bits */
+	EXI_INTEGER_32,
+	/** (Signed) Integer 64 bits */
+	EXI_INTEGER_64
+} exi_integer_type_t;
+
+
+/** \brief EXI Datetime types */
+typedef enum {
+	/** gYear */
+	EXI_DATETIME_GYEAR,
+	/** gYearMonth */
+	EXI_DATETIME_GYEARMONTH,
+	/** date */
+	EXI_DATETIME_DATE,
+	/** datetime */
+	EXI_DATETIME_DATETIME,
+	/** gMonth */
+	EXI_DATETIME_GMONTH,
+	/** gMonthDay */
+	EXI_DATETIME_GMONTHDAY,
+	/** gDay */
+	EXI_DATETIME_GDAY,
+	/** time */
+	EXI_DATETIME_TIME
+} exi_datetime_type_t;
+
+
+/** \brief String value type */
+typedef enum {
+	/** value miss */
+	EXI_STRING_VALUE_MISS,
+	/** value local-hit */
+	EXI_STRING_VALUE_LOCAL_HIT,
+	/** value global-hit */
+	EXI_STRING_VALUE_GLOBAL_HIT
+} exi_string_value_type_t;
+
+/** \brief EXI string character */
+/* Note: define whether you wan't to support ASCII only or UCS */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_ASCII
+typedef char exi_string_character_t;
+#endif /* STRING_REPRESENTATION_ASCII */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_UCS
+typedef uint32_t exi_string_character_t;
+#endif /* STRING_REPRESENTATION_UCS */
+
+
+
+/** \brief Universal Character Set (UCS) strings */
+typedef struct {
+	/** container size  */
+	size_t size;
+	/** string character container */
+	exi_string_character_t* characters;
+	/** current string length == number of code-points, (len <= size) */
+	size_t len;
+} exi_string_t;
+
+
+/** \brief String value */
+typedef struct {
+	/** value type (e.g., miss, local-hit, global-hit) */
+	exi_string_value_type_t type;
+	/** miss entry */
+	exi_string_t miss;
+	/** (local) hit entry */
+	size_t localID;
+	/** (global) hit entry */
+	size_t globalID;
+} exi_string_value_t;
+
+
+/** \brief Restricted Characeter Set */
+typedef struct {
+	/** size */
+	size_t size;
+	/** rcs codepoints */
+	exi_string_character_t* characters;
+	/** character coding length (less than 256 characters) */
+	uint8_t codingLength;
+} exi_rcs_t;
+
+
+/** \brief Byte value container */
+typedef struct {
+	/** bytes array size */
+	size_t size;
+	/** bytes array data container */
+	uint8_t* data;
+	/** bytes array length (len <= size) */
+	size_t len;
+} exi_bytes_t;
+
+
+/** \brief Integer value container */
+typedef struct {
+	/** type */
+	exi_integer_type_t type;
+	union {
+		/* (signed) values */
+		/** (signed) int 8 bits */
+		int8_t int8;
+		/** (signed) int 16 bits */
+		int16_t int16;
+		/** (signed) int 32 bits */
+		int32_t int32;
+		/** (signed) int 64 bits */
+		int64_t int64;
+		/* unsigned values */
+		/** unsigned int 8 bits */
+		uint8_t uint8;
+		/** unsigned int 16 bits */
+		uint16_t uint16;
+		/** unsigned int 32 bits */
+		uint32_t uint32;
+		/** unsigned int 64 bits */
+		uint64_t uint64;
+	} val;
+} exi_integer_t;
+
+
+/** \brief Float value container */
+typedef struct {
+	/** range of the mantissa is -(2^63) to 2^63-1 */
+	int64_t mantissa;
+	/** range of the exponent is - (2^14-1) to 2^14-1 */
+	int16_t exponent; /* base-10 */
+} exi_float_me_t;
+
+
+/** \brief Decimal value container */
+typedef struct {
+	/** a sign value */
+	int negative;
+	/** represents the integral portion of the Decimal */
+	exi_integer_t integral;
+	/** represents the fractional portion of the Decimal with the digits in reverse order to preserve leading zeros */
+	exi_integer_t reverseFraction;
+} exi_decimal_t;
+
+
+/** \brief Datetime value container */
+typedef struct {
+	/** datetime type */
+	exi_datetime_type_t type;
+	/** Datetime value for year */
+	int32_t year;
+	/** Datetime value for monthDay */
+	uint32_t monthDay;
+	/** Datetime value for time */
+	uint32_t time;
+	/** Datetime value for presenceFractionalSecs */
+	int presenceFractionalSecs;
+	/** Datetime value for fractionalSecs */
+	uint32_t fractionalSecs;
+	/** Datetime value for presenceTimezone */
+	int presenceTimezone;
+	/** Datetime value for timezone */
+	uint32_t timezone;
+} exi_datetime_t;
+
+
+/** \brief List value container */
+typedef struct {
+	/** list item type */
+	exi_datatype_t type;
+	/** number of items */
+	size_t len;
+	/* Special datatype: integer */
+	/* exi_integer_type_t intType;*/
+	/** Special datatype: datetime */
+	exi_datetime_type_t datetimeType;
+} exi_list_t;
+
+
+/** \brief Efficient qname */
+typedef struct {
+	/** namespace URI ID*/
+	size_t namespaceURI;
+	/** local name ID*/
+	size_t localPart;
+} exi_eqname_t;
+
+
+/** \brief Name entry type */
+typedef enum {
+	/** As known IDs */
+	EXI_NAME_ENTRY_TYPE_ID,
+	/** As String */
+	EXI_NAME_ENTRY_TYPE_STRING_AND_ID
+} exi_name_entry_type_t;
+
+
+/** \brief Name entry */
+typedef struct {
+	/** type */
+	exi_name_entry_type_t type;
+	/** entry ID */
+	size_t id;
+	/** entry string */
+	exi_string_t str;
+} exi_name_entry_t;
+
+
+/** \brief Qualified name */
+typedef struct {
+	/** Uri */
+	exi_name_entry_t uri;
+	/** LocalName */
+	exi_name_entry_t localName;
+} exi_qname_t;
+
+/*TODO Doxygen Documentation */
+
+
+/* ==================================== */
+/* URI and LocalName Entries */
+typedef struct exiNameTablePrepopulated {
+	/* number of namespaces AND length name-partitions array */
+	size_t len;
+	/* number of localName entries divided by URI */
+	size_t* localNames;
+} exi_name_table_prepopulated_t;
+
+#define EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_ENTRIES 25
+
+typedef enum {
+	EXI_NAME_PARTITION_URI, EXI_NAME_PARTITION_LOCALNAME
+} exi_name_partition_type_t;
+
+typedef struct {
+	char* uri;
+	size_t uriID;
+} exi_uri_partition_t;
+
+typedef struct {
+	char* localName;
+	size_t localNameID;
+	size_t uriID;
+} exi_localname_partition_t;
+
+typedef struct {
+	exi_name_partition_type_t namePartitionType;
+	struct {
+		exi_uri_partition_t uriPartition;
+		exi_localname_partition_t localNamePartition;
+	} entry;
+} exi_name_partition_t;
+
+typedef struct exiNameTableRuntime {
+	/* maximum number of characters in the name partitions entries PLUS null terminators */
+	/* char characters[EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_CHARACTERS + EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_ENTRIES]; */
+	/* uint16_t numberOfUsedCharacters; *//* initially zero <= EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_CHARACTERS */
+	/* maximum number of name partitions entries. Name partitions entries consist in all uri, and local-name partition entries */
+	exi_name_partition_t
+			namePartitionsEntries[EXI_MAXIMUM_NUMBER_OF_NAME_PARTITION_ENTRIES];
+	/* uint16_t numberOfUsedNamePartitions; *//* initially zero */
+	/* added entries */
+	size_t addedUriEntries; /* initially zero */
+	size_t addedLocalNameEntries; /* initially zero */
+} exi_name_table_runtime_t;
+
+
+/* StartTagContent grammar initially empty */
+/* ElementContent grammar has EE per default */
+typedef struct {
+	size_t namespaceUriID;
+	size_t localNameID;
+	size_t numberOfProductions;
+	int hasXsiType; /* StartTagContent only */
+	int hasEE; /* ElementContentper default TRUE */
+} exi_runtime_element_t;
+
+/* Note: We do have twice as many runtime grammars (StartTagContent and ElementContent)*/
+#define MAX_NUMBER_OF_RUNTIME_ELEMENTS 80
+
+
+
+/* ==================================== */
+/* Value string table */
+typedef struct exiValueStringTableEntry {
+	/** Qualified namespace URI */
+	size_t namespaceUriID;
+	/** Qualified localName */
+	size_t localNameID;
+	/** Local Value ID */
+	size_t localValueID;
+	/** String */
+	exi_string_t str;
+} exi_value_string_table_entry_t;
+
+typedef struct exiValueStringTable {
+	/** maximum number of global string table entry size */
+	size_t size;
+	/** string table entry array container */
+	exi_value_string_table_entry_t* strs;
+	/** current number of string table entries (len <= size) */
+	size_t len;
+} exi_value_string_table_t;
+
+/* typedef struct { */
+	/** number of global strings */
+	/* uint16_t numberOfGlobalStrings; */
+	/** size of local-names container */
+	/* uint16_t sizeLocalStrings; */
+	/** number of local strings container */
+	/* uint16_t* numberOfLocalStrings; */
+	/** string values */
+/*	exi_value_string_table_t* valueStringTable;
+} exi_value_table_t;*/
+
+typedef struct {
+	/** stack of grammar states */
+	int16_t grammarStack[EXI_ELEMENT_STACK_SIZE];
+	/** stack of grammar elements / qnameIDs */
+	exi_eqname_t elementStack[EXI_ELEMENT_STACK_SIZE];
+	/** stack index for both stacks */
+	size_t stackIndex;
+
+	/** event-code */
+	uint32_t eventCode;
+
+	/** name table entries, pre-populated */
+	exi_name_table_prepopulated_t* nameTablePrepopulated;
+	/** name table entries, at runtime */
+	exi_name_table_runtime_t* nameTableRuntime;
+
+	/** next qname ID */
+	size_t nextQNameID;
+
+	/** string table entries */
+	exi_value_string_table_t* stringTable;
+
+	/** runtime built-in element grammars - numbers */
+	size_t numberOfRuntimeGrammars;
+	/** runtime built-in element grammars */
+	exi_runtime_element_t runtimeGrammars[MAX_NUMBER_OF_RUNTIME_ELEMENTS * 2];
+} exi_state_t;
+
+typedef struct {
+	/* type of value */
+	exi_datatype_t type;
+
+	/* base types */
+	int boolean;
+	uint32_t enumeration;
+
+	/* complex types: Integers, Bytes, Strings and Lists are not native types anymore */
+	exi_integer_t integer;
+	exi_bytes_t binary;
+	exi_string_value_t str;
+	exi_float_me_t float_me;
+	exi_decimal_t decimal;
+	exi_datetime_t datetime;
+	exi_list_t list;
+	exi_eqname_t eqname;
+} exi_value_t;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 704 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EncoderChannel.c

@@ -0,0 +1,704 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include "EncoderChannel.h"
+#include "EXIOptions.h"
+#include "BitOutputStream.h"
+#include "EXITypes.h"
+#include "ErrorCodes.h"
+#include "MethodsBag.h"
+/*#include "v2gEXICoder.h"*/
+
+#ifndef ENCODER_CHANNEL_C
+#define ENCODER_CHANNEL_C
+
+int encodeUnsignedInteger(bitstream_t* stream, exi_integer_t* iv) {
+	int errn = 0;
+	switch (iv->type) {
+	/* Unsigned Integer */
+	case EXI_UNSIGNED_INTEGER_8:
+		errn = encodeUnsignedInteger32(stream, iv->val.uint8);
+		break;
+	case EXI_UNSIGNED_INTEGER_16:
+		errn = encodeUnsignedInteger32(stream, iv->val.uint16);
+		break;
+	case EXI_UNSIGNED_INTEGER_32:
+		errn = encodeUnsignedInteger32(stream, iv->val.uint32);
+		break;
+	case EXI_UNSIGNED_INTEGER_64:
+		errn = encodeUnsignedInteger64(stream, iv->val.uint64);
+		break;
+		/* (Signed) Integer */
+	case EXI_INTEGER_8:
+		if (iv->val.int8 < 0) {
+			return EXI_NEGATIVE_UNSIGNED_INTEGER_VALUE;
+		}
+		errn = encodeUnsignedInteger32(stream, (uint32_t)(iv->val.int8));
+		break;
+	case EXI_INTEGER_16:
+		if (iv->val.int16 < 0) {
+			return EXI_NEGATIVE_UNSIGNED_INTEGER_VALUE;
+		}
+		errn = encodeUnsignedInteger32(stream, (uint32_t)(iv->val.int16));
+		break;
+	case EXI_INTEGER_32:
+		if (iv->val.int32 < 0) {
+			return EXI_NEGATIVE_UNSIGNED_INTEGER_VALUE;
+		}
+		errn = encodeUnsignedInteger32(stream, (uint32_t)(iv->val.int32));
+		break;
+	case EXI_INTEGER_64:
+		if (iv->val.int64 < 0) {
+			return EXI_NEGATIVE_UNSIGNED_INTEGER_VALUE;
+		}
+		errn = encodeUnsignedInteger64(stream, (uint64_t)(iv->val.int64));
+		break;
+	default:
+		errn = EXI_UNSUPPORTED_INTEGER_VALUE_TYPE;
+		break;
+	}
+
+	return errn;
+}
+
+/**
+ * Encode an arbitrary precision non negative integer using a sequence of
+ * octets. The most significant bit of the last octet is set to zero to
+ * indicate sequence termination. Only seven bits per octet are used to
+ * store the integer's value.
+ */
+int encodeUnsignedInteger16(bitstream_t* stream, uint16_t n) {
+	int errn = 0;
+	if (n < 128) {
+		/* write byte as is */
+		errn = encode(stream, (uint8_t) n);
+	} else {
+		uint8_t n7BitBlocks = numberOf7BitBlocksToRepresent(n);
+
+		switch (n7BitBlocks) {
+		case 3:
+			errn = encode(stream, (uint8_t) (128 | n));
+			n = n >> 7;
+			if (errn != 0) {
+				break;
+			}
+			/* no break */
+		case 2:
+			errn = encode(stream, (uint8_t) (128 | n));
+			n = n >> 7;
+			if (errn != 0) {
+				break;
+			}
+			/* no break */
+		case 1:
+			/* 0 .. 7 (last byte) */
+			errn = encode(stream, (uint8_t) (0 | n));
+			/* no break */
+		}
+	}
+
+	return errn;
+}
+
+/**
+ * Encode an arbitrary precision non negative integer using a sequence of
+ * octets. The most significant bit of the last octet is set to zero to
+ * indicate sequence termination. Only seven bits per octet are used to
+ * store the integer's value.
+ */
+int encodeUnsignedInteger32(bitstream_t* stream, uint32_t n) {
+	int errn = 0;
+	if (n < 128) {
+		/* write byte as is */
+		errn = encode(stream, (uint8_t) n);
+	} else {
+		uint8_t n7BitBlocks = numberOf7BitBlocksToRepresent(n);
+
+		switch (n7BitBlocks) {
+		case 5:
+			errn = encode(stream, (uint8_t) (128 | n));
+			n = n >> 7;
+			if (errn != 0) {
+				break;
+			}
+			/* no break */
+		case 4:
+			errn = encode(stream, (uint8_t) (128 | n));
+			n = n >> 7;
+			if (errn != 0) {
+				break;
+			}
+			/* no break */
+		case 3:
+			errn = encode(stream, (uint8_t) (128 | n));
+			n = n >> 7;
+			if (errn != 0) {
+				break;
+			}
+			/* no break */
+		case 2:
+			errn = encode(stream, (uint8_t) (128 | n));
+			n = n >> 7;
+			if (errn != 0) {
+				break;
+			}
+			/* no break */
+		case 1:
+			/* 0 .. 7 (last byte) */
+			errn = encode(stream, (uint8_t) (0 | n));
+			/* no break */
+		}
+	}
+
+	return errn;
+}
+
+/**
+ * Encode an arbitrary precision non negative integer using a sequence of
+ * octets. The most significant bit of the last octet is set to zero to
+ * indicate sequence termination. Only seven bits per octet are used to
+ * store the integer's value.
+ */
+int encodeUnsignedInteger64(bitstream_t* stream, uint64_t n) {
+	int errn = 0;
+	uint8_t lastEncode = (uint8_t) n;
+	n >>= 7;
+
+	while (n != 0 && errn == 0) {
+		errn = encode(stream, lastEncode | 128);
+		lastEncode = (uint8_t) n;
+		n >>= 7;
+	}
+
+	if (errn == 0) {
+		errn = encode(stream, lastEncode);
+	}
+
+	return errn;
+}
+
+void _shiftRight7(uint8_t* buf, int len) {
+	const int shift = 7;
+    unsigned char tmp = 0x00, tmp2 = 0x00;
+    for (int k = 0; k <= len; k++) {
+        if (k == 0) {
+            tmp = buf[k];
+            buf[k] >>= shift;
+        } else {
+            tmp2 = buf[k];
+            buf[k] >>= shift;
+            buf[k] |= ((tmp & 0x7F) << (8 - shift));
+
+            if (k != len) {
+                tmp = tmp2;
+            }
+        }
+    }
+}
+
+/**
+ * Encode an arbitrary precision non negative integer using a sequence of
+ * octets. The most significant bit of the last octet is set to zero to
+ * indicate sequence termination. Only seven bits per octet are used to
+ * store the integer's value.
+ */
+int encodeUnsignedIntegerBig(bitstream_t* stream, size_t size, uint8_t* data, size_t len) {
+	int errn = 0;
+	int i;
+	int lenM1 = len - 1;
+	const int MAX_BIGINT_ARRAY = 25;
+	uint8_t lastEncode = 0;
+	uint8_t bytesToShift[MAX_BIGINT_ARRAY]; // MAXIMUM
+	size_t bitsToEncode = len * 8;
+
+	if(MAX_BIGINT_ARRAY <= len) {
+		return -1;
+	}
+
+	/* init */
+	for(i=0; i<MAX_BIGINT_ARRAY; i++) {
+		bytesToShift[i] = 0;
+	}
+
+	/* copy bytes first in same order for shifting */
+	for(i=0; i < len; i++) {
+		bytesToShift[i] = data[i];
+	}
+
+	while(bitsToEncode > 7) {
+		lastEncode = bytesToShift[lenM1];
+		lastEncode = lastEncode | 128;
+		errn = encode(stream, lastEncode);
+		_shiftRight7(bytesToShift, len);
+		bitsToEncode -= 7;
+	}
+
+	if (errn == 0) {
+		errn = encode(stream, bytesToShift[lenM1]);
+	}
+
+	return errn;
+}
+
+int encodeInteger(bitstream_t* stream, exi_integer_t* iv) {
+	int errn = 0;
+	switch (iv->type) {
+	/* Unsigned Integer */
+	case EXI_UNSIGNED_INTEGER_8:
+		errn = encodeInteger32(stream, iv->val.uint8);
+		break;
+	case EXI_UNSIGNED_INTEGER_16:
+		errn = encodeInteger32(stream, iv->val.uint16);
+		break;
+	case EXI_UNSIGNED_INTEGER_32:
+		errn = encodeInteger64(stream, iv->val.uint32);
+		break;
+	case EXI_UNSIGNED_INTEGER_64:
+		errn = encodeInteger64(stream, (int64_t)(iv->val.uint64));
+		break;
+		/* (Signed) Integer */
+	case EXI_INTEGER_8:
+		errn = encodeInteger32(stream, iv->val.int8);
+		break;
+	case EXI_INTEGER_16:
+		errn = encodeInteger32(stream, iv->val.int16);
+		break;
+	case EXI_INTEGER_32:
+		errn = encodeInteger32(stream, iv->val.int32);
+		break;
+	case EXI_INTEGER_64:
+		errn = encodeInteger64(stream, iv->val.int64);
+		break;
+	default:
+		errn = EXI_UNSUPPORTED_INTEGER_VALUE_TYPE;
+		break;
+	}
+
+	return errn;
+}
+
+
+/**
+ * Encode an arbitrary precision integer using a sign bit followed by a
+ * sequence of octets. The most significant bit of the last octet is set to
+ * zero to indicate sequence termination. Only seven bits per octet are used
+ * to store the integer's value.
+ */
+int encodeInteger16(bitstream_t* stream, int16_t n) {
+	int errn;
+	/* signalize sign */
+	if (n < 0) {
+		errn = encodeBoolean(stream, 1);
+		/* For negative values, the Unsigned Integer holds the
+		 * magnitude of the value minus 1 */
+		n = (int16_t)((-n) - 1);
+	} else {
+		errn = encodeBoolean(stream, 0);
+	}
+	if (errn == 0) {
+		errn = encodeUnsignedInteger16(stream, (uint16_t)n);
+	}
+	return errn;
+}
+
+
+
+/**
+ * Encode an arbitrary precision integer using a sign bit followed by a
+ * sequence of octets. The most significant bit of the last octet is set to
+ * zero to indicate sequence termination. Only seven bits per octet are used
+ * to store the integer's value.
+ */
+int encodeInteger32(bitstream_t* stream, int32_t n) {
+	int errn;
+	/* signalize sign */
+	if (n < 0) {
+		errn = encodeBoolean(stream, 1);
+		/* For negative values, the Unsigned Integer holds the
+		 * magnitude of the value minus 1 */
+		n = (-n) - 1;
+	} else {
+		errn = encodeBoolean(stream, 0);
+	}
+	if (errn == 0) {
+		errn = encodeUnsignedInteger32(stream, (uint32_t)n);
+	}
+	return errn;
+}
+
+/**
+ * Encode an arbitrary precision integer using a sign bit followed by a
+ * sequence of octets. The most significant bit of the last octet is set to
+ * zero to indicate sequence termination. Only seven bits per octet are used
+ * to store the integer's value.
+ */
+int encodeInteger64(bitstream_t* stream, int64_t n) {
+	int errn;
+	/* signalize sign */
+	if (n < 0) {
+		errn = encodeBoolean(stream, 1);
+		/* For negative values, the Unsigned Integer holds the
+		 * magnitude of the value minus 1 */
+		n = (-n) - 1;
+	} else {
+		errn = encodeBoolean(stream, 0);
+	}
+	if (errn == 0) {
+		errn = encodeUnsignedInteger64(stream, (uint64_t)n);
+	}
+	return errn;
+}
+
+
+/**
+ * Encode an arbitrary precision integer using a sign bit followed by a
+ * sequence of octets. The most significant bit of the last octet is set to
+ * zero to indicate sequence termination. Only seven bits per octet are used
+ * to store the integer's value.
+ */
+int encodeIntegerBig(bitstream_t* stream, int negative, size_t size, uint8_t* data, size_t len) {
+	int errn;
+	/* signalize sign */
+	if (negative) {
+		errn = encodeBoolean(stream, 1);
+		/* For negative values, the Unsigned Integer holds the
+		 * magnitude of the value minus 1 */
+		/* n = (-n) - 1; */
+	} else {
+		errn = encodeBoolean(stream, 0);
+	}
+	if (errn == 0) {
+		errn = encodeUnsignedIntegerBig(stream, size, data, len);
+	}
+	return errn;
+}
+
+/**
+ * The Float datatype representation is two consecutive Integers.
+ * The first Integer represents the mantissa of the floating point
+ * number and the second Integer represents the base-10 exponent
+ * of the floating point number.
+ */
+int encodeFloat(bitstream_t* stream, exi_float_me_t* f) {
+	int errn = encodeInteger64(stream, f->mantissa);
+	if (errn == 0) {
+		errn = encodeInteger32(stream, f->exponent);
+	}
+	return errn;
+}
+
+/**
+ * Encode a decimal represented as a Boolean sign followed by two Unsigned
+ * Integers. A sign value of zero (0) is used to represent positive Decimal
+ * values and a sign value of one (1) is used to represent negative Decimal
+ * values The first Integer represents the integral portion of the Decimal
+ * value. The second positive integer represents the fractional portion of
+ * the decimal with the digits in reverse order to preserve leading zeros.
+ */
+int encodeDecimal(bitstream_t* stream, exi_decimal_t* d) {
+	/* sign, integral, reverse fractional */
+	int errn = encodeBoolean(stream, d->negative);
+	if (errn == 0) {
+		errn = encodeUnsignedInteger(stream, &d->integral);
+		if (errn == 0) {
+			errn = encodeUnsignedInteger(stream, &d->reverseFraction);
+		}
+	}
+	return errn;
+}
+
+/**
+ * Encode a length prefixed sequence of characters.
+ */
+int encodeString(bitstream_t* stream, exi_string_t* string) {
+	int errn = encodeUnsignedInteger32(stream, string->len);
+	if (errn == 0) {
+		errn = encodeCharacters(stream, string->characters, string->len);
+	}
+	return errn;
+}
+
+/**
+ * Encode a sequence of characters according to a given length.
+ * Each character is represented by its UCS [ISO/IEC 10646]
+ * code point encoded as an Unsigned Integer
+ */
+int encodeCharacters(bitstream_t* stream, exi_string_character_t* chars, size_t len) {
+	unsigned int i;
+	int errn = 0;
+	for (i = 0; i < len && errn == 0; i++) {
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_ASCII
+		errn = encode(stream, (uint8_t)chars[i]);
+#endif /* STRING_REPRESENTATION_ASCII */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_UCS
+		errn = encodeUnsignedInteger32(stream, chars[i]);
+#endif /* STRING_REPRESENTATION_UCS */
+	}
+	return errn;
+}
+
+
+int encodeRCSCharacters(bitstream_t* stream, exi_string_character_t* chars, size_t len, size_t rcsCodeLength, size_t rcsSize, const exi_string_character_t rcsSet[]) {
+	unsigned int i;
+	unsigned int k;
+	int errn = 0;
+	size_t rcsCode = SIZE_MAX;
+
+	for (i = 0; i < len && errn == 0; i++) {
+		/* try to find short code */
+		rcsCode = SIZE_MAX;
+		for(k=0; k<rcsSize && rcsCode == SIZE_MAX; k++) {
+			if(rcsSet[k] == chars[i]) {
+				rcsCode = k;
+			}
+		}
+
+		if( rcsCode == SIZE_MAX) {
+			/* RCS mis-match */
+			errn = encodeNBitUnsignedInteger(stream, rcsCodeLength, rcsSize);
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_ASCII
+			errn = encode(stream, (uint8_t)chars[i]);
+#endif /* STRING_REPRESENTATION_ASCII */
+#if STRING_REPRESENTATION == STRING_REPRESENTATION_UCS
+			errn = encodeUnsignedInteger32(stream, chars[i]);
+#endif /* STRING_REPRESENTATION_UCS */
+
+		} else {
+			/* RCS match */
+			errn = encodeNBitUnsignedInteger(stream, rcsCodeLength, (uint32_t)rcsCode);
+		}
+	}
+	return errn;
+}
+
+/**
+ * Encode a binary value as a length-prefixed sequence of octets.
+ */
+int encodeBinary(bitstream_t* stream, exi_bytes_t* bytes) {
+	int errn = encodeUnsignedInteger32(stream, bytes->len);
+
+	if(errn == 0) {
+		errn = encodeBytes(stream, bytes->data, bytes->len);
+	}
+
+	return errn;
+}
+
+int encodeBytes(bitstream_t* stream, uint8_t* data, size_t len) {
+	unsigned int i;
+	int errn = 0;
+
+	for (i = 0; i < len && errn == 0; i++) {
+		errn = encode(stream, data[i]);
+	}
+	return errn;
+}
+
+/**
+ * Encode a datetime representation which is a sequence of values
+ * representing the individual components of the Date-Time
+ */
+int encodeDateTime(bitstream_t* stream, exi_datetime_t* datetime) {
+	int errn = 0;
+	switch (datetime->type) {
+	case EXI_DATETIME_GYEAR: /* Year, [Time-Zone] */
+		errn = encodeInteger32(stream, datetime->year - DATETIME_YEAR_OFFSET);
+		break;
+	case EXI_DATETIME_GYEARMONTH: /* Year, MonthDay, [TimeZone] */
+	case EXI_DATETIME_DATE: /* Year, MonthDay, [TimeZone] */
+		errn = encodeInteger32(stream, datetime->year - DATETIME_YEAR_OFFSET);
+		if (errn == 0) {
+			errn = encodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY,
+					datetime->monthDay);
+		}
+		break;
+	case EXI_DATETIME_DATETIME: /* Year, MonthDay, Time, [FractionalSecs], [TimeZone] */
+		errn = encodeInteger32(stream, datetime->year - DATETIME_YEAR_OFFSET);
+		if (errn == 0) {
+			errn = encodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY,
+					datetime->monthDay);
+			if (errn != 0) {
+				break;
+			}
+		}
+		/* no break */
+	case EXI_DATETIME_TIME: /* Time, [FractionalSecs], [TimeZone] */
+		errn = encodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_TIME,
+				datetime->time);
+		if (errn == 0) {
+			if (datetime->presenceFractionalSecs) {
+				errn = encodeBoolean(stream, 1);
+				if (errn == 0) {
+					errn = encodeUnsignedInteger32(stream, datetime->fractionalSecs);
+				}
+			} else {
+				errn = encodeBoolean(stream, 0);
+			}
+		}
+		break;
+	case EXI_DATETIME_GMONTH: /* MonthDay, [TimeZone] */
+	case EXI_DATETIME_GMONTHDAY: /* MonthDay, [TimeZone] */
+	case EXI_DATETIME_GDAY: /* MonthDay, [TimeZone] */
+		errn = encodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_MONTHDAY,
+				datetime->monthDay);
+		break;
+	default:
+		errn = EXI_UNSUPPORTED_DATETIME_TYPE;
+		break;
+	}
+	if (errn == 0) {
+		/* [TimeZone] */
+		if (datetime->presenceTimezone) {
+			errn = encodeBoolean(stream, 1);
+			if (errn == 0) {
+				errn = encodeNBitUnsignedInteger(stream, DATETIME_NUMBER_BITS_TIMEZONE,
+						datetime->timezone + DATETIME_TIMEZONE_OFFSET_IN_MINUTES);
+			}
+		} else {
+			errn = encodeBoolean(stream, 0);
+		}
+	}
+
+	return errn;
+}
+
+
+
+
+int encode(bitstream_t* stream, uint8_t b) {
+#if EXI_OPTION_ALIGNMENT == BIT_PACKED
+	return writeBits(stream, 8, b);
+#endif /* EXI_OPTION_ALIGNMENT == BIT_PACKED */
+#if EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT
+	int errn = 0;
+#if EXI_STREAM == BYTE_ARRAY
+	if ( (*stream->pos) < stream->size ) {
+		stream->data[(*stream->pos)++] = b;
+	} else {
+		errn = EXI_ERROR_OUTPUT_STREAM_EOF;
+	}
+#endif /* EXI_STREAM == BYTE_ARRAY */
+#if EXI_STREAM == FILE_STREAM
+	if ( putc(b, stream->file) == EOF ) {
+		errn = EXI_ERROR_OUTPUT_STREAM_EOF;
+	}
+#endif /* EXI_STREAM == FILE_STREAM */
+	return errn;
+#endif /* EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT */
+}
+
+/**
+ * Encode a single boolean value. A false value is encoded as bit 0 and true
+ * value is encode as bit 1.
+ */
+int encodeBoolean(bitstream_t* stream, int b) {
+#if EXI_OPTION_ALIGNMENT == BIT_PACKED
+	uint8_t val = b ? 1 : 0;
+	return writeBits(stream, 1, val);
+#endif /* EXI_OPTION_ALIGNMENT == BIT_PACKED */
+#if EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT
+	uint8_t val = b ? 1 : 0;
+	return encode(stream, val);
+#endif /* EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT */
+}
+
+
+/**
+ * Encode n-bit unsigned integer. The n least significant bits of parameter
+ * b starting with the most significant, i.e. from left to right.
+ */
+int encodeNBitUnsignedInteger(bitstream_t* stream, size_t nbits, uint32_t val)  {
+#if EXI_OPTION_ALIGNMENT == BIT_PACKED
+	int errn = 0;
+	if (nbits > 0) {
+		errn = writeBits(stream, nbits, val);
+	}
+	return errn;
+#endif /* EXI_OPTION_ALIGNMENT == BIT_PACKED */
+#if EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT
+	int errn = 0;
+	if (nbits > 0) {
+		if (nbits < 9) {
+			/* 1 byte */
+			errn = encode(stream, val & 0xff);
+		} else if (nbits < 17) {
+			/* 2 bytes */
+			errn = encode(stream, val & 0x00ff);
+			if(errn == 0) {
+				errn = encode(stream, (uint8_t)((val & 0xff00) >> 8));
+			}
+		} else if (nbits < 25) {
+			/* 3 bytes */
+			errn = encode(stream, val & 0x0000ff);
+			if(errn == 0) {
+				errn = encode(stream, (uint8_t)((val & 0x00ff00) >> 8));
+				if(errn == 0) {
+					errn = encode(stream, (uint8_t)((val & 0xff0000) >> 16));
+				}
+			}
+		} else if (nbits < 33) {
+			/* 4 bytes */
+			errn = encode(stream, val & 0x000000ff);
+			if(errn == 0) {
+				errn = encode(stream, (uint8_t)((val & 0x0000ff00) >> 8));
+				if(errn == 0) {
+					errn = encode(stream, (uint8_t)((val & 0x00ff0000) >> 16));
+					if(errn == 0) {
+						errn = encode(stream, (uint8_t)((val & 0xff000000) >> 24));
+					}
+				}
+			}
+		} else {
+			/* TODO Currently not more than 4 Bytes allowed for NBitUnsignedInteger */
+			errn = EXI_UNSUPPORTED_NBIT_INTEGER_LENGTH;
+		}
+	}
+	return errn;
+#endif /* EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT */
+}
+
+/**
+ * Flush underlying output stream.
+ */
+int encodeFinish(bitstream_t* stream) {
+#if EXI_OPTION_ALIGNMENT == BIT_PACKED
+#endif /* EXI_OPTION_ALIGNMENT == BIT_PACKED */
+	return flush(stream);
+#if EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT
+	/* no pending bits in byte-aligned mode */
+	return 0;
+#endif /* EXI_OPTION_ALIGNMENT == BYTE_ALIGNMENT */
+}
+
+
+
+#endif
+

+ 423 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/EncoderChannel.h

@@ -0,0 +1,423 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EncoderChannel.h
+ * \brief 	EXI Encoder Channel
+ *
+ */
+
+#ifndef ENCODER_CHANNEL_H
+#define ENCODER_CHANNEL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "EXITypes.h"
+
+
+/**
+ * \brief 		Encode byte value
+ *
+ * \param       stream   		Output Stream
+ * \param       b		   		byte
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encode(bitstream_t* stream, uint8_t b);
+
+
+/**
+ * \brief 		Encode a single boolean value
+ *
+ * 				A false value is encoded as 0 and true value is encode as 1.
+ *
+ * \param       stream   		Output Stream
+ * \param       b		   		boolean
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeBoolean(bitstream_t* stream, int b);
+
+
+/**
+ * \brief 		Encode n-bit unsigned integer
+ *
+ * 				The n least significant bits of parameter b starting with the
+ * 				most significant, i.e. from left to right.
+ *
+ * \param       stream   		Output Stream
+ * \param       nbits		   	number of bits
+ * \param       val		   		value
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeNBitUnsignedInteger(bitstream_t* stream, size_t nbits, uint32_t val);
+
+
+/**
+ * \brief 		Encode unsigned integer
+ *
+ * 				Encode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Output Stream
+ * \param       iv		   		Unsigned integer value
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeUnsignedInteger(bitstream_t* stream, exi_integer_t* iv);
+
+
+/**
+ * \brief 		Encode unsigned integer
+ *
+ * 				Encode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Output Stream
+ * \param       n		   		Unsigned integer value 16 bits
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeUnsignedInteger16(bitstream_t* stream, uint16_t n);
+
+
+
+/**
+ * \brief 		Encode unsigned integer
+ *
+ * 				Encode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Output Stream
+ * \param       n		   		Unsigned integer value 32 bits
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeUnsignedInteger32(bitstream_t* stream, uint32_t n);
+
+
+/**
+ * \brief 		Encode unsigned integer
+ *
+ * 				Encode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Output Stream
+ * \param       n		   		Unsigned integer value 64 bits
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeUnsignedInteger64(bitstream_t* stream, uint64_t n);
+
+/**
+ * \brief 		Encode unsigned integer
+ *
+ * 				Encode an arbitrary precision non negative integer using
+ * 				a sequence of octets. The most significant bit of the last
+ * 				octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Output Stream
+ * \param       size		   	size array
+ * \param       data		   	data array
+ * \param       len		   		length array
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeUnsignedIntegerBig(bitstream_t* stream, size_t size, uint8_t* data, size_t len);
+
+
+/**
+ * \brief 		Encode integer
+ *
+ * 				Encode an arbitrary precision integer using a sign boolean
+ * 				followed by a sequence of octets. The most significant bit
+ * 				of the last octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Output Stream
+ * \param       iv		   		Integer value
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeInteger(bitstream_t* stream, exi_integer_t* iv);
+
+
+/**
+ * \brief 		Encode integer
+ *
+ * 				Encode an arbitrary precision integer using a sign boolean
+ * 				followed by a sequence of octets. The most significant bit
+ * 				of the last octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Output Stream
+ * \param       n		   		Integer value 16 bits
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeInteger16(bitstream_t* stream, int16_t n);
+
+/**
+ * \brief 		Encode integer
+ *
+ * 				Encode an arbitrary precision integer using a sign boolean
+ * 				followed by a sequence of octets. The most significant bit
+ * 				of the last octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Output Stream
+ * \param       n		   		Integer value 32 bits
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeInteger32(bitstream_t* stream, int32_t n);
+
+
+/**
+ * \brief 		Encode integer
+ *
+ * 				Encode an arbitrary precision integer using a sign boolean
+ * 				followed by a sequence of octets. The most significant bit
+ * 				of the last octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Output Stream
+ * \param       n		   		Integer value 64 bits
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeInteger64(bitstream_t* stream, int64_t n);
+
+/**
+ * \brief 		Encode integer
+ *
+ * 				Encode an arbitrary precision integer using a sign boolean
+ * 				followed by a sequence of octets. The most significant bit
+ * 				of the last octet is set to zero to indicate sequence termination.
+ * 				Only seven bits per octet are used to store the integer's value.
+ *
+ * \param       stream   		Output Stream
+ * \param       negative		negative integer
+ * \param       size		   	size array
+ * \param       data		   	data array
+ * \param       len		   		length array
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeIntegerBig(bitstream_t* stream, int negative, size_t size, uint8_t* data, size_t len);
+
+/**
+ * \brief 		Encode float
+ *
+ * 				Encode a Float datatype as two consecutive Integers. The first
+ * 				Integer represents the mantissa of the floating point number
+ * 				and the second Integer represents the base-10 exponent of the
+ * 				floating point number.
+ *
+ * \param       stream   		Output Stream
+ * \param       f		   		Float value
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeFloat(bitstream_t* stream, exi_float_me_t* f);
+
+
+/**
+ * \brief 		Encode decimal
+ *
+ * 				Encode a decimal represented as a Boolean sign followed by two
+ * 				Unsigned Integers. A sign value of zero (0) is used to represent
+ * 				positive Decimal values and a sign value of one (1) is used to
+ * 				represent negative Decimal values The first Integer represents
+ * 				the integral portion of the Decimal value. The second positive
+ * 				integer represents the fractional portion of the decimal with
+ * 				the digits in reverse order to preserve leading zeros.
+ *
+ * \param       stream   		Output Stream
+ * \param       d		   		Decimal value
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeDecimal(bitstream_t* stream, exi_decimal_t* d);
+
+
+/**
+ * \brief 		Encode string
+ *
+ * 				Encode a length prefixed sequence of characters.
+ *
+ * \param       stream   		Output Stream
+ * \param       string		   	String
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeString(bitstream_t* stream, exi_string_t* string);
+
+
+/**
+ * \brief 		Encode string value
+ *
+ * 				 Encode a length prefixed sequence of characters
+ * 				 in the sense of string tables
+ *
+ * \param       stream   		Output Stream
+ * \param       stringTable   	String Table
+ * \param       namespaceUriID  Qualified Namespace ID
+ * \param       localNameID  	Qualified LocalName ID
+ * \param       string		   	String value
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeStringValue(bitstream_t* stream, exi_value_string_table_t* stringTable, size_t namespaceUriID, size_t localNameID,
+		exi_string_value_t* string);
+
+
+/**
+ * \brief 		Encode restricted character set value
+ *
+ * 				 Encode a length prefixed sequence of characters
+ * 				 in the sense of string tables
+ *
+ * \param       stream   		Output Stream
+ * \param       StringTable   	StringTable
+ * \param       namespaceUriID  Qualified Namespace ID
+ * \param       localNameID  	Qualified LocalName ID
+ * \param       rcs   			Restricted character set
+ * \param       string		   	String value
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeRCSStringValue(bitstream_t* stream, exi_value_string_table_t* stringTable,
+		size_t namespaceUriID, size_t localNameID, exi_rcs_t* rcs, exi_string_value_t* string);
+
+
+/**
+ * \brief 		Encode characters
+ *
+ * 				Encode a sequence of characters according to a given length.
+ * 				Each character is represented by its UCS [ISO/IEC 10646]
+ * 				code point encoded as an Unsigned Integer.
+ *
+ * \param       stream   		Output Stream
+ * \param       chars   		Characters
+ * \param       len				Numbr of characters
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeCharacters(bitstream_t* stream, exi_string_character_t* chars, size_t len);
+
+
+/**
+ * \brief 		Encode characters
+ *
+ * 				Encode a sequence of characters according to a given length.
+ * 				Each character is represented by its UCS [ISO/IEC 10646]
+ * 				code point encoded as an Unsigned Integer.
+ *
+ * \param       stream   		Output Stream
+ * \param       chars   		Characters
+ * \param       len				Numbr of characters
+ *  \param       rcsCodeLength   RCS code-length
+ * \param       rcsCodeLength   RCS size
+ * \param       rcsCodeLength   RCS set
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeRCSCharacters(bitstream_t* stream, exi_string_character_t* chars, size_t len, size_t rcsCodeLength, size_t rcsSize, const exi_string_character_t rcsSet[]);
+
+
+
+/**
+ * \brief 		Encode binary
+ *
+ * 				Encode a binary value as a length-prefixed sequence of octets.
+ *
+ * \param       stream   		Output Stream
+ * \param       bytes   		Byte values
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeBinary(bitstream_t* stream, exi_bytes_t* bytes);
+
+
+/**
+ * \brief 		Encode binary data
+ *
+ * 				Encode a sequence of octets.
+ *
+ * \param       stream   		Output Stream
+ * \param       data	   		Byte values
+ * \param       len		   		Length
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeBytes(bitstream_t* stream, uint8_t* data, size_t len);
+
+/**
+ * \brief 		Encode datetime
+ *
+ * 				Encode a datetime representation which is a sequence of values
+ * 				representing the individual components of the Date-Time.
+ *
+ * \param       stream   		Output Stream
+ * \param       datetime   		Datetime values
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeDateTime(bitstream_t* stream, exi_datetime_t* datetime);
+
+
+/**
+ * \brief 		Flush underlying bit output stream
+ *
+ * \param       stream   		Output Stream
+ * \return                  	Error-Code <> 0
+ *
+ */
+int encodeFinish(bitstream_t* stream);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 120 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/ErrorCodes.h

@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	ErrorCodes.h
+ * \brief 	Error Codes descriptions
+ *
+ */
+
+#ifndef EXI_ERROR_CODES_H
+#define EXI_ERROR_CODES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define EXI_ERROR_INPUT_STREAM_EOF -10
+#define EXI_ERROR_OUTPUT_STREAM_EOF -11
+#define EXI_ERROR_INPUT_FILE_HANDLE -12
+#define EXI_ERROR_OUTPUT_FILE -13
+
+#define EXI_ERROR_OUT_OF_BOUNDS -100
+#define EXI_ERROR_OUT_OF_STRING_BUFFER -101
+/*#define EXI_ERROR_OUT_OF_ASCII_BUFFER -102 */
+#define EXI_ERROR_OUT_OF_BYTE_BUFFER -103
+#define EXI_ERROR_OUT_OF_GRAMMAR_STACK -104
+#define EXI_ERROR_OUT_OF_RUNTIME_GRAMMAR_STACK -105
+#define EXI_ERROR_OUT_OF_QNAMES -106
+
+#define EXI_ERROR_UNKOWN_GRAMMAR_ID -108
+#define EXI_ERROR_UNKOWN_EVENT -109
+#define EXI_ERROR_UNKOWN_EVENT_CODE -110
+#define EXI_ERROR_UNEXPECTED_EVENT_LEVEL1 -111
+#define EXI_ERROR_UNEXPECTED_EVENT_LEVEL2 -112
+
+#define EXI_ERROR_UNEXPECTED_START_DOCUMENT -113
+#define EXI_ERROR_UNEXPECTED_END_DOCUMENT -114
+#define EXI_ERROR_UNEXPECTED_START_ELEMENT -115
+#define EXI_ERROR_UNEXPECTED_START_ELEMENT_NS -116
+#define EXI_ERROR_UNEXPECTED_START_ELEMENT_GENERIC -117
+#define EXI_ERROR_UNEXPECTED_START_ELEMENT_GENERIC_UNDECLARED -118
+#define EXI_ERROR_UNEXPECTED_END_ELEMENT -119
+#define EXI_ERROR_UNEXPECTED_CHARACTERS -120
+#define EXI_ERROR_UNEXPECTED_ATTRIBUTE -121
+#define EXI_ERROR_UNEXPECTED_ATTRIBUTE_NS -122
+#define EXI_ERROR_UNEXPECTED_ATTRIBUTE_GENERIC -123
+#define EXI_ERROR_UNEXPECTED_ATTRIBUTE_GENERIC_UNDECLARED -124
+#define EXI_ERROR_UNEXPECTED_ATTRIBUTE_XSI_TYPE -125
+#define EXI_ERROR_UNEXPECTED_ATTRIBUTE_XSI_NIL -126
+#define EXI_ERROR_UNEXPECTED_GRAMMAR_ID -127
+#define EXI_ERROR_UNEXPECTED_ATTRIBUTE_MOVE_TO_CONTENT_RULE -128
+
+#define EXI_UNSUPPORTED_NBIT_INTEGER_LENGTH -132
+#define EXI_UNSUPPORTED_EVENT_CODE_CHARACTERISTICS -133
+#define EXI_UNSUPPORTED_INTEGER_VALUE -134
+#define EXI_NEGATIVE_UNSIGNED_INTEGER_VALUE -135
+#define EXI_UNSUPPORTED_LIST_VALUE_TYPE -136
+#define EXI_UNSUPPORTED_HEADER_COOKIE -137
+#define EXI_UNSUPPORTED_HEADER_OPTIONS -138
+
+#define EXI_UNSUPPORTED_GLOBAL_ATTRIBUTE_VALUE_TYPE -139
+#define EXI_UNSUPPORTED_DATATYPE -140
+#define EXI_UNSUPPORTED_STRING_VALUE_TYPE -141
+#define EXI_UNSUPPORTED_INTEGER_VALUE_TYPE -142
+#define EXI_UNSUPPORTED_DATETIME_TYPE -143
+#define EXI_UNSUPPORTED_FRAGMENT_ELEMENT -144
+
+#define EXI_UNSUPPORTED_GRAMMAR_LEARNING_CH -150
+
+/* string values */
+#define EXI_ERROR_STRINGVALUES_NOT_SUPPORTED -160
+#define EXI_ERROR_STRINGVALUES_OUT_OF_ENTRIES -161
+#define EXI_ERROR_STRINGVALUES_OUT_OF_MEMORY -162
+#define EXI_ERROR_STRINGVALUES_OUT_OF_BOUND -163
+#define EXI_ERROR_STRINGVALUES_CHARACTER -164
+
+#define EXI_ERROR_UNEXPECTED_BYTE_VALUE -200
+
+
+#define EXI_ERROR_CONVERSION_NO_ASCII_CHARACTERS -300
+#define EXI_ERROR_CONVERSION_TYPE_TO_STRING -301
+
+
+#define EXI_DEVIANT_SUPPORT_NOT_DEPLOYED -500
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* EXI_ERROR_CODES_H */
+

+ 117 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/MethodsBag.c

@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#ifndef METHODS_BAG_C
+#define METHODS_BAG_C
+
+#include "MethodsBag.h"
+#include "ErrorCodes.h"
+
+static const uint16_t smallLengths[] = { 0, 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4,
+		4, 4, 4 };
+
+int exiGetCodingLength(size_t characteristics, size_t* codingLength) {
+	/* Note: we could use range expressions in switch statements but those are non-standard */
+	/* e.g., case 1 ... 5: */
+	int errn = 0;
+	if (characteristics < 17) {
+		*codingLength = smallLengths[characteristics];
+	} else if (characteristics < 33) {
+		/* 17 .. 32 */
+		*codingLength = 5;
+	} else if (characteristics < 65) {
+		/* 33 .. 64 */
+		*codingLength = 6;
+	} else if (characteristics < 129) {
+		/* 65 .. 128 */
+		*codingLength = 7;
+	} else if (characteristics < 257) {
+		/* 129 .. 256 */
+		*codingLength = 8;
+	} else if (characteristics < 513) {
+		/* 257 .. 512 */
+		*codingLength = 9;
+	} else if (characteristics < 1025) {
+		/* 513 .. 1024 */
+		*codingLength = 10;
+	} else if (characteristics < 2049) {
+		/* 1025 .. 2048 */
+		*codingLength = 11;
+	} else if (characteristics < 4097) {
+		/* 2049 .. 4096 */
+		*codingLength = 12;
+	} else if (characteristics < 8193) {
+		/* 4097 .. 8192 */
+		*codingLength = 13;
+	} else if (characteristics < 16385) {
+		/* 8193 .. 16384 */
+		*codingLength = 14;
+	} else if (characteristics < 32769) {
+		/* 16385 .. 32768 */
+		*codingLength = 15;
+	} else {
+		/* 32769 .. 65536 */
+		*codingLength = 16;
+	}
+	return errn;
+}
+
+
+uint8_t numberOf7BitBlocksToRepresent(uint32_t n) {
+	/* assert (n >= 0); */
+
+	/* 7 bits */
+	if (n < 128) {
+		return 1;
+	}
+	/* 14 bits */
+	else if (n < 16384) {
+		return 2;
+	}
+	/* 21 bits */
+	else if (n < 2097152) {
+		return 3;
+	}
+	/* 28 bits */
+	else if (n < 268435456) {
+		return 4;
+	}
+	/* 35 bits */
+	else {
+		/* int, 32 bits */
+		return 5;
+	}
+}
+
+
+
+#endif
+

+ 70 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/codec/MethodsBag.h

@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 2017-03-02 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+* \file 	MethodsBag.h
+* \brief 	Method bag for bit and octet functions
+*
+*/
+
+#ifndef METHODS_BAG_H
+#define METHODS_BAG_H
+
+
+
+#include <stdint.h>
+#include <stddef.h>
+
+/**
+ * \brief  	Returns the number of bits to identify the characteristics.
+ *
+ * \param       characteristics	number of characteristics
+ * \param       codingLength   	number of bits
+ * \return                  	Error-Code <> 0
+ *
+ */
+int exiGetCodingLength(size_t characteristics, size_t* codingLength);
+
+
+/**
+ * \brief  	Returns the least number of 7 bit-blocks that is needed to represent the passed integer value
+ *
+ *			Note: Returns 1 if passed parameter is 0.
+ *
+ * \param       n				integer value
+ * \return                  	Error-Code <> 0
+ *
+ */
+uint8_t numberOf7BitBlocksToRepresent(uint32_t n);
+
+
+#endif
+

+ 969 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypes.c

@@ -0,0 +1,969 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include <stdint.h>
+
+#include "dinEXIDatatypes.h"
+#include "../codec/EXITypes.h"
+
+
+#ifndef EXI_din_DATATYPES_C
+#define EXI_din_DATATYPES_C
+
+#if DEPLOY_DIN_CODEC == SUPPORT_YES
+
+
+void init_dinEXIDocument(struct dinEXIDocument* exiDoc) {
+	exiDoc->BodyElement_isUsed = 0u;
+	exiDoc->V2G_Message_isUsed = 0u;
+	exiDoc->SignatureProperty_isUsed = 0u;
+	exiDoc->DSAKeyValue_isUsed = 0u;
+	exiDoc->SignatureProperties_isUsed = 0u;
+	exiDoc->KeyValue_isUsed = 0u;
+	exiDoc->Transforms_isUsed = 0u;
+	exiDoc->DigestMethod_isUsed = 0u;
+	exiDoc->Signature_isUsed = 0u;
+	exiDoc->RetrievalMethod_isUsed = 0u;
+	exiDoc->Manifest_isUsed = 0u;
+	exiDoc->Reference_isUsed = 0u;
+	exiDoc->CanonicalizationMethod_isUsed = 0u;
+	exiDoc->RSAKeyValue_isUsed = 0u;
+	exiDoc->Transform_isUsed = 0u;
+	exiDoc->PGPData_isUsed = 0u;
+	exiDoc->MgmtData_isUsed = 0u;
+	exiDoc->SignatureMethod_isUsed = 0u;
+	exiDoc->KeyInfo_isUsed = 0u;
+	exiDoc->SPKIData_isUsed = 0u;
+	exiDoc->X509Data_isUsed = 0u;
+	exiDoc->SignatureValue_isUsed = 0u;
+	exiDoc->KeyName_isUsed = 0u;
+	exiDoc->DigestValue_isUsed = 0u;
+	exiDoc->SignedInfo_isUsed = 0u;
+	exiDoc->Object_isUsed = 0u;
+	exiDoc->DC_EVSEStatus_isUsed = 0u;
+	exiDoc->RelativeTimeInterval_isUsed = 0u;
+	exiDoc->SalesTariffEntry_isUsed = 0u;
+	exiDoc->DC_EVPowerDeliveryParameter_isUsed = 0u;
+	exiDoc->SASchedules_isUsed = 0u;
+	exiDoc->AC_EVChargeParameter_isUsed = 0u;
+	exiDoc->SAScheduleList_isUsed = 0u;
+	exiDoc->DC_EVStatus_isUsed = 0u;
+	exiDoc->ServiceCharge_isUsed = 0u;
+	exiDoc->EVStatus_isUsed = 0u;
+	exiDoc->DC_EVChargeParameter_isUsed = 0u;
+	exiDoc->DC_EVSEChargeParameter_isUsed = 0u;
+	exiDoc->EVSEStatus_isUsed = 0u;
+	exiDoc->TimeInterval_isUsed = 0u;
+	exiDoc->EVPowerDeliveryParameter_isUsed = 0u;
+	exiDoc->EVSEChargeParameter_isUsed = 0u;
+	exiDoc->AC_EVSEStatus_isUsed = 0u;
+	exiDoc->Entry_isUsed = 0u;
+	exiDoc->AC_EVSEChargeParameter_isUsed = 0u;
+	exiDoc->PMaxScheduleEntry_isUsed = 0u;
+	exiDoc->EVChargeParameter_isUsed = 0u;
+	exiDoc->ServiceDiscoveryReq_isUsed = 0u;
+	exiDoc->ServiceDiscoveryRes_isUsed = 0u;
+	exiDoc->MeteringReceiptReq_isUsed = 0u;
+	exiDoc->PaymentDetailsReq_isUsed = 0u;
+	exiDoc->MeteringReceiptRes_isUsed = 0u;
+	exiDoc->PaymentDetailsRes_isUsed = 0u;
+	exiDoc->SessionSetupReq_isUsed = 0u;
+	exiDoc->SessionSetupRes_isUsed = 0u;
+	exiDoc->CableCheckReq_isUsed = 0u;
+	exiDoc->CableCheckRes_isUsed = 0u;
+	exiDoc->ContractAuthenticationReq_isUsed = 0u;
+	exiDoc->CertificateInstallationReq_isUsed = 0u;
+	exiDoc->ContractAuthenticationRes_isUsed = 0u;
+	exiDoc->CertificateInstallationRes_isUsed = 0u;
+	exiDoc->WeldingDetectionReq_isUsed = 0u;
+	exiDoc->WeldingDetectionRes_isUsed = 0u;
+	exiDoc->CertificateUpdateReq_isUsed = 0u;
+	exiDoc->CertificateUpdateRes_isUsed = 0u;
+	exiDoc->PowerDeliveryReq_isUsed = 0u;
+	exiDoc->PowerDeliveryRes_isUsed = 0u;
+	exiDoc->ChargingStatusReq_isUsed = 0u;
+	exiDoc->ChargingStatusRes_isUsed = 0u;
+	exiDoc->CurrentDemandReq_isUsed = 0u;
+	exiDoc->PreChargeReq_isUsed = 0u;
+	exiDoc->CurrentDemandRes_isUsed = 0u;
+	exiDoc->PreChargeRes_isUsed = 0u;
+	exiDoc->ServicePaymentSelectionReq_isUsed = 0u;
+	exiDoc->SessionStopReq_isUsed = 0u;
+	exiDoc->ServicePaymentSelectionRes_isUsed = 0u;
+	exiDoc->SessionStopRes_isUsed = 0u;
+	exiDoc->ChargeParameterDiscoveryReq_isUsed = 0u;
+	exiDoc->ChargeParameterDiscoveryRes_isUsed = 0u;
+	exiDoc->ServiceDetailReq_isUsed = 0u;
+	exiDoc->ServiceDetailRes_isUsed = 0u;
+}
+
+
+#if DEPLOY_DIN_CODEC_FRAGMENT == SUPPORT_YES
+void init_dinEXIFragment(struct dinEXIFragment* exiFrag) {
+	exiFrag->Unit_isUsed = 0u;
+	exiFrag->EVSEMaximumCurrentLimit_isUsed = 0u;
+	exiFrag->EVPowerDeliveryParameter_isUsed = 0u;
+	exiFrag->ChargingProfileEntryMaxPower_isUsed = 0u;
+	exiFrag->TMeter_isUsed = 0u;
+	exiFrag->EVSEPowerLimitAchieved_isUsed = 0u;
+	exiFrag->duration_isUsed = 0u;
+	exiFrag->EVMaximumCurrentLimit_isUsed = 0u;
+	exiFrag->Parameter_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->AC_EVChargeParameter_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->PMaxScheduleEntry_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEMaximumVoltageLimit_isUsed = 0u;
+	exiFrag->SelectedService_isUsed = 0u;
+	exiFrag->Certificate_isUsed = 0u;
+	exiFrag->Certificate_isUsed = 0u;
+	exiFrag->EVSEMaximumPowerLimit_isUsed = 0u;
+	exiFrag->EVReady_isUsed = 0u;
+	exiFrag->X509SerialNumber_isUsed = 0u;
+	exiFrag->RetrievalMethod_isUsed = 0u;
+	exiFrag->RetryCounter_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->MeteringReceiptReq_isUsed = 0u;
+	exiFrag->ReadyToChargeState_isUsed = 0u;
+	exiFrag->Multiplier_isUsed = 0u;
+	exiFrag->EPriceLevel_isUsed = 0u;
+	exiFrag->stringValue_isUsed = 0u;
+	exiFrag->ServiceDiscoveryReq_isUsed = 0u;
+	exiFrag->Transforms_isUsed = 0u;
+	exiFrag->MeteringReceiptRes_isUsed = 0u;
+	exiFrag->PreChargeReq_isUsed = 0u;
+	exiFrag->OEMProvisioningCert_isUsed = 0u;
+	exiFrag->ServiceDiscoveryRes_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ContractAuthenticationReq_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->ContractAuthenticationRes_isUsed = 0u;
+	exiFrag->HMACOutputLength_isUsed = 0u;
+	exiFrag->BulkChargingComplete_isUsed = 0u;
+	exiFrag->Exponent_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->SAScheduleTuple_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->DepartureTime_isUsed = 0u;
+	exiFrag->X509IssuerSerial_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SPKIData_isUsed = 0u;
+	exiFrag->RelativeTimeInterval_isUsed = 0u;
+	exiFrag->EVEnergyRequest_isUsed = 0u;
+	exiFrag->PreChargeRes_isUsed = 0u;
+	exiFrag->SessionID_isUsed = 0u;
+	exiFrag->PMaxSchedule_isUsed = 0u;
+	exiFrag->ServiceCharge_isUsed = 0u;
+	exiFrag->PgenCounter_isUsed = 0u;
+	exiFrag->ChargingStatusReq_isUsed = 0u;
+	exiFrag->X509Data_isUsed = 0u;
+	exiFrag->SalesTariffEntry_isUsed = 0u;
+	exiFrag->KeyValue_isUsed = 0u;
+	exiFrag->ChargingStatusRes_isUsed = 0u;
+	exiFrag->V2G_Message_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->ServicePaymentSelectionReq_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->EVSEIsolationStatus_isUsed = 0u;
+	exiFrag->ServicePaymentSelectionRes_isUsed = 0u;
+	exiFrag->EVSEPresentVoltage_isUsed = 0u;
+	exiFrag->EVSEPresentVoltage_isUsed = 0u;
+	exiFrag->EVSEPresentVoltage_isUsed = 0u;
+	exiFrag->BodyElement_isUsed = 0u;
+	exiFrag->EVCCID_isUsed = 0u;
+	exiFrag->PGPData_isUsed = 0u;
+	exiFrag->RootCertificateID_isUsed = 0u;
+	exiFrag->FaultCode_isUsed = 0u;
+	exiFrag->CableCheckReq_isUsed = 0u;
+	exiFrag->EVSEVoltageLimitAchieved_isUsed = 0u;
+	exiFrag->EVRESSConditioning_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->CableCheckRes_isUsed = 0u;
+	exiFrag->ChargingProfileEntryStart_isUsed = 0u;
+	exiFrag->SignatureProperty_isUsed = 0u;
+	exiFrag->EVMaxCurrent_isUsed = 0u;
+	exiFrag->PGPKeyPacket_isUsed = 0u;
+	exiFrag->PGPKeyPacket_isUsed = 0u;
+	exiFrag->Seed_isUsed = 0u;
+	exiFrag->RSAKeyValue_isUsed = 0u;
+	exiFrag->costKind_isUsed = 0u;
+	exiFrag->EAmount_isUsed = 0u;
+	exiFrag->EVSEPresentCurrent_isUsed = 0u;
+	exiFrag->PowerDeliveryRes_isUsed = 0u;
+	exiFrag->NumEPriceLevels_isUsed = 0u;
+	exiFrag->SessionStopRes_isUsed = 0u;
+	exiFrag->PowerDeliveryReq_isUsed = 0u;
+	exiFrag->SessionStopReq_isUsed = 0u;
+	exiFrag->XPath_isUsed = 0u;
+	exiFrag->BulkSOC_isUsed = 0u;
+	exiFrag->PMax_isUsed = 0u;
+	exiFrag->ParameterSetID_isUsed = 0u;
+	exiFrag->ParameterSetID_isUsed = 0u;
+	exiFrag->ContractID_isUsed = 0u;
+	exiFrag->ContractID_isUsed = 0u;
+	exiFrag->ContractID_isUsed = 0u;
+	exiFrag->ContractID_isUsed = 0u;
+	exiFrag->Signature_isUsed = 0u;
+	exiFrag->EVMaxVoltage_isUsed = 0u;
+	exiFrag->ReceiptRequired_isUsed = 0u;
+	exiFrag->ChargingComplete_isUsed = 0u;
+	exiFrag->ChargingProfile_isUsed = 0u;
+	exiFrag->PaymentOptions_isUsed = 0u;
+	exiFrag->SessionSetupRes_isUsed = 0u;
+	exiFrag->EVSEMaximumVoltageLimit_isUsed = 0u;
+	exiFrag->ServiceDetailRes_isUsed = 0u;
+	exiFrag->DC_EVPowerDeliveryParameter_isUsed = 0u;
+	exiFrag->PaymentDetailsRes_isUsed = 0u;
+	exiFrag->PaymentDetailsReq_isUsed = 0u;
+	exiFrag->MgmtData_isUsed = 0u;
+	exiFrag->Value_isUsed = 0u;
+	exiFrag->EVSENotification_isUsed = 0u;
+	exiFrag->EVSENotification_isUsed = 0u;
+	exiFrag->EVSEMaximumPowerLimit_isUsed = 0u;
+	exiFrag->EVTargetCurrent_isUsed = 0u;
+	exiFrag->RemainingTimeToBulkSoC_isUsed = 0u;
+	exiFrag->EVTargetCurrent_isUsed = 0u;
+	exiFrag->SessionSetupReq_isUsed = 0u;
+	exiFrag->EVSECurrentLimitAchieved_isUsed = 0u;
+	exiFrag->ServiceDetailReq_isUsed = 0u;
+	exiFrag->byteValue_isUsed = 0u;
+	exiFrag->EVMaximumPowerLimit_isUsed = 0u;
+	exiFrag->PowerSwitchClosed_isUsed = 0u;
+	exiFrag->Manifest_isUsed = 0u;
+	exiFrag->P_isUsed = 0u;
+	exiFrag->SAScheduleList_isUsed = 0u;
+	exiFrag->Q_isUsed = 0u;
+	exiFrag->X509SubjectName_isUsed = 0u;
+	exiFrag->G_isUsed = 0u;
+	exiFrag->SessionID_isUsed = 0u;
+	exiFrag->J_isUsed = 0u;
+	exiFrag->CertificateInstallationRes_isUsed = 0u;
+	exiFrag->CertificateInstallationReq_isUsed = 0u;
+	exiFrag->SalesTariff_isUsed = 0u;
+	exiFrag->Header_isUsed = 0u;
+	exiFrag->EVSEMinimumCurrentLimit_isUsed = 0u;
+	exiFrag->X509CRL_isUsed = 0u;
+	exiFrag->EVMaximumCurrentLimit_isUsed = 0u;
+	exiFrag->Y_isUsed = 0u;
+	exiFrag->DigestValue_isUsed = 0u;
+	exiFrag->DC_EVChargeParameter_isUsed = 0u;
+	exiFrag->ContractSignatureEncryptedPrivateKey_isUsed = 0u;
+	exiFrag->ContractSignatureEncryptedPrivateKey_isUsed = 0u;
+	exiFrag->DigestMethod_isUsed = 0u;
+	exiFrag->SPKISexp_isUsed = 0u;
+	exiFrag->ChargeService_isUsed = 0u;
+	exiFrag->EVSEEnergyToBeDelivered_isUsed = 0u;
+	exiFrag->SignatureProperties_isUsed = 0u;
+	exiFrag->EVSEMaxCurrent_isUsed = 0u;
+	exiFrag->EVMaximumPowerLimit_isUsed = 0u;
+	exiFrag->EVSEStatus_isUsed = 0u;
+	exiFrag->Service_isUsed = 0u;
+	exiFrag->DHParams_isUsed = 0u;
+	exiFrag->DHParams_isUsed = 0u;
+	exiFrag->DHParams_isUsed = 0u;
+	exiFrag->DHParams_isUsed = 0u;
+	exiFrag->PGPKeyID_isUsed = 0u;
+	exiFrag->DSAKeyValue_isUsed = 0u;
+	exiFrag->EnergyTransferType_isUsed = 0u;
+	exiFrag->WeldingDetectionRes_isUsed = 0u;
+	exiFrag->FreeService_isUsed = 0u;
+	exiFrag->SelectedServiceList_isUsed = 0u;
+	exiFrag->WeldingDetectionReq_isUsed = 0u;
+	exiFrag->EVTargetVoltage_isUsed = 0u;
+	exiFrag->EVTargetVoltage_isUsed = 0u;
+	exiFrag->CanonicalizationMethod_isUsed = 0u;
+	exiFrag->X509Certificate_isUsed = 0u;
+	exiFrag->CertificateUpdateRes_isUsed = 0u;
+	exiFrag->CertificateUpdateReq_isUsed = 0u;
+	exiFrag->EVSEMaxVoltage_isUsed = 0u;
+	exiFrag->SignedInfo_isUsed = 0u;
+	exiFrag->AC_EVSEChargeParameter_isUsed = 0u;
+	exiFrag->EVEnergyCapacity_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->EVSECurrentRegulationTolerance_isUsed = 0u;
+	exiFrag->ServiceParameterList_isUsed = 0u;
+	exiFrag->ListOfRootCertificateIDs_isUsed = 0u;
+	exiFrag->ListOfRootCertificateIDs_isUsed = 0u;
+	exiFrag->ProfileEntry_isUsed = 0u;
+	exiFrag->EVSEMinimumVoltageLimit_isUsed = 0u;
+	exiFrag->CurrentDemandRes_isUsed = 0u;
+	exiFrag->EVRESSSOC_isUsed = 0u;
+	exiFrag->MeterReading_isUsed = 0u;
+	exiFrag->CurrentDemandReq_isUsed = 0u;
+	exiFrag->physicalValue_isUsed = 0u;
+	exiFrag->ChargingComplete_isUsed = 0u;
+	exiFrag->TimeInterval_isUsed = 0u;
+	exiFrag->AC_EVSEStatus_isUsed = 0u;
+	exiFrag->AC_EVSEStatus_isUsed = 0u;
+	exiFrag->EVMaximumVoltageLimit_isUsed = 0u;
+	exiFrag->SignatureValue_isUsed = 0u;
+	exiFrag->DateTimeNow_isUsed = 0u;
+	exiFrag->DateTimeNow_isUsed = 0u;
+	exiFrag->ServiceTag_isUsed = 0u;
+	exiFrag->intValue_isUsed = 0u;
+	exiFrag->SelectedPaymentOption_isUsed = 0u;
+	exiFrag->ServiceName_isUsed = 0u;
+	exiFrag->EVCabinConditioning_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->ServiceScope_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->MeterStatus_isUsed = 0u;
+	exiFrag->EVRequestedEnergyTransferType_isUsed = 0u;
+	exiFrag->ServiceCategory_isUsed = 0u;
+	exiFrag->GenChallenge_isUsed = 0u;
+	exiFrag->GenChallenge_isUsed = 0u;
+	exiFrag->SalesTariffDescription_isUsed = 0u;
+	exiFrag->NotificationMaxDelay_isUsed = 0u;
+	exiFrag->NotificationMaxDelay_isUsed = 0u;
+	exiFrag->boolValue_isUsed = 0u;
+	exiFrag->EVSEStatusCode_isUsed = 0u;
+	exiFrag->ServiceScope_isUsed = 0u;
+	exiFrag->FaultMsg_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->BulkChargingComplete_isUsed = 0u;
+	exiFrag->KeyName_isUsed = 0u;
+	exiFrag->ParameterSet_isUsed = 0u;
+	exiFrag->SigMeterReading_isUsed = 0u;
+	exiFrag->EVSEChargeParameter_isUsed = 0u;
+	exiFrag->Body_isUsed = 0u;
+	exiFrag->SASchedules_isUsed = 0u;
+	exiFrag->ServiceCategory_isUsed = 0u;
+	exiFrag->KeyInfo_isUsed = 0u;
+	exiFrag->PMaxScheduleID_isUsed = 0u;
+	exiFrag->RemainingTimeToFullSoC_isUsed = 0u;
+	exiFrag->EVStatus_isUsed = 0u;
+	exiFrag->SubCertificates_isUsed = 0u;
+	exiFrag->PaymentOption_isUsed = 0u;
+	exiFrag->X509SKI_isUsed = 0u;
+	exiFrag->EVMaximumVoltageLimit_isUsed = 0u;
+	exiFrag->ServiceList_isUsed = 0u;
+	exiFrag->Cost_isUsed = 0u;
+	exiFrag->AC_EVSEStatus_isUsed = 0u;
+	exiFrag->AC_EVSEStatus_isUsed = 0u;
+	exiFrag->SignatureMethod_isUsed = 0u;
+	exiFrag->EVSEMinCurrent_isUsed = 0u;
+	exiFrag->ConsumptionCost_isUsed = 0u;
+	exiFrag->EVSEPeakCurrentRipple_isUsed = 0u;
+	exiFrag->EVErrorCode_isUsed = 0u;
+	exiFrag->EVChargeParameter_isUsed = 0u;
+	exiFrag->start_isUsed = 0u;
+	exiFrag->X509IssuerName_isUsed = 0u;
+	exiFrag->Reference_isUsed = 0u;
+	exiFrag->EVMinCurrent_isUsed = 0u;
+	exiFrag->FullSOC_isUsed = 0u;
+	exiFrag->amount_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->shortValue_isUsed = 0u;
+	exiFrag->DC_EVSEChargeParameter_isUsed = 0u;
+	exiFrag->Entry_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->SalesTariffID_isUsed = 0u;
+	exiFrag->MeterID_isUsed = 0u;
+	exiFrag->EVSEMaximumCurrentLimit_isUsed = 0u;
+	exiFrag->ChargeParameterDiscoveryReq_isUsed = 0u;
+	exiFrag->amountMultiplier_isUsed = 0u;
+	exiFrag->ChargeParameterDiscoveryRes_isUsed = 0u;
+	exiFrag->Transform_isUsed = 0u;
+	exiFrag->Object_isUsed = 0u;
+	exiFrag->RCD_isUsed = 0u;
+	exiFrag->Notification_isUsed = 0u;
+	exiFrag->startValue_isUsed = 0u;
+	exiFrag->Modulus_isUsed = 0u;
+	exiFrag->EVSEMaxCurrent_isUsed = 0u;
+}
+#endif /* DEPLOY_DIN_CODEC_FRAGMENT */
+
+void init_dinMeteringReceiptReqType(struct dinMeteringReceiptReqType* dinMeteringReceiptReqType) {
+	dinMeteringReceiptReqType->Id_isUsed = 0u;
+	dinMeteringReceiptReqType->SAScheduleTupleID_isUsed = 0u;
+}
+
+void init_dinBodyType(struct dinBodyType* dinBodyType) {
+	dinBodyType->BodyElement_isUsed = 0u;
+	dinBodyType->SessionSetupReq_isUsed = 0u;
+	dinBodyType->SessionSetupRes_isUsed = 0u;
+	dinBodyType->ServiceDiscoveryReq_isUsed = 0u;
+	dinBodyType->ServiceDiscoveryRes_isUsed = 0u;
+	dinBodyType->ServiceDetailReq_isUsed = 0u;
+	dinBodyType->ServiceDetailRes_isUsed = 0u;
+	dinBodyType->ServicePaymentSelectionReq_isUsed = 0u;
+	dinBodyType->ServicePaymentSelectionRes_isUsed = 0u;
+	dinBodyType->PaymentDetailsReq_isUsed = 0u;
+	dinBodyType->PaymentDetailsRes_isUsed = 0u;
+	dinBodyType->ContractAuthenticationReq_isUsed = 0u;
+	dinBodyType->ContractAuthenticationRes_isUsed = 0u;
+	dinBodyType->ChargeParameterDiscoveryReq_isUsed = 0u;
+	dinBodyType->ChargeParameterDiscoveryRes_isUsed = 0u;
+	dinBodyType->PowerDeliveryReq_isUsed = 0u;
+	dinBodyType->PowerDeliveryRes_isUsed = 0u;
+	dinBodyType->ChargingStatusReq_isUsed = 0u;
+	dinBodyType->ChargingStatusRes_isUsed = 0u;
+	dinBodyType->MeteringReceiptReq_isUsed = 0u;
+	dinBodyType->MeteringReceiptRes_isUsed = 0u;
+	dinBodyType->SessionStopReq_isUsed = 0u;
+	dinBodyType->SessionStopRes_isUsed = 0u;
+	dinBodyType->CertificateUpdateReq_isUsed = 0u;
+	dinBodyType->CertificateUpdateRes_isUsed = 0u;
+	dinBodyType->CertificateInstallationReq_isUsed = 0u;
+	dinBodyType->CertificateInstallationRes_isUsed = 0u;
+	dinBodyType->CableCheckReq_isUsed = 0u;
+	dinBodyType->CableCheckRes_isUsed = 0u;
+	dinBodyType->PreChargeReq_isUsed = 0u;
+	dinBodyType->PreChargeRes_isUsed = 0u;
+	dinBodyType->CurrentDemandReq_isUsed = 0u;
+	dinBodyType->CurrentDemandRes_isUsed = 0u;
+	dinBodyType->WeldingDetectionReq_isUsed = 0u;
+	dinBodyType->WeldingDetectionRes_isUsed = 0u;
+}
+
+void init_dinSessionSetupReqType(struct dinSessionSetupReqType* dinSessionSetupReqType) {
+	(void)dinSessionSetupReqType; /* avoid unused warning */
+}
+
+void init_dinPowerDeliveryResType(struct dinPowerDeliveryResType* dinPowerDeliveryResType) {
+	dinPowerDeliveryResType->EVSEStatus_isUsed = 0u;
+	dinPowerDeliveryResType->AC_EVSEStatus_isUsed = 0u;
+	dinPowerDeliveryResType->DC_EVSEStatus_isUsed = 0u;
+}
+
+void init_dinServiceDetailResType(struct dinServiceDetailResType* dinServiceDetailResType) {
+	dinServiceDetailResType->ServiceParameterList_isUsed = 0u;
+}
+
+void init_dinWeldingDetectionResType(struct dinWeldingDetectionResType* dinWeldingDetectionResType) {
+	(void)dinWeldingDetectionResType; /* avoid unused warning */
+}
+
+void init_dinContractAuthenticationResType(struct dinContractAuthenticationResType* dinContractAuthenticationResType) {
+	(void)dinContractAuthenticationResType; /* avoid unused warning */
+}
+
+void init_dinCanonicalizationMethodType(struct dinCanonicalizationMethodType* dinCanonicalizationMethodType) {
+	dinCanonicalizationMethodType->ANY_isUsed = 0u;
+}
+
+void init_dinSPKIDataType(struct dinSPKIDataType* dinSPKIDataType) {
+	dinSPKIDataType->SPKISexp.arrayLen = 0u;
+	dinSPKIDataType->ANY_isUsed = 0u;
+}
+
+void init_dinListOfRootCertificateIDsType(struct dinListOfRootCertificateIDsType* dinListOfRootCertificateIDsType) {
+	dinListOfRootCertificateIDsType->RootCertificateID.arrayLen = 0u;
+}
+
+void init_dinSelectedServiceListType(struct dinSelectedServiceListType* dinSelectedServiceListType) {
+	dinSelectedServiceListType->SelectedService.arrayLen = 0u;
+}
+
+void init_dinCurrentDemandResType(struct dinCurrentDemandResType* dinCurrentDemandResType) {
+	dinCurrentDemandResType->EVSEMaximumVoltageLimit_isUsed = 0u;
+	dinCurrentDemandResType->EVSEMaximumCurrentLimit_isUsed = 0u;
+	dinCurrentDemandResType->EVSEMaximumPowerLimit_isUsed = 0u;
+}
+
+void init_dinTransformType(struct dinTransformType* dinTransformType) {
+	dinTransformType->ANY_isUsed = 0u;
+	dinTransformType->XPath.arrayLen = 0u;
+}
+
+void init_dinAC_EVChargeParameterType(struct dinAC_EVChargeParameterType* dinAC_EVChargeParameterType) {
+	(void)dinAC_EVChargeParameterType; /* avoid unused warning */
+}
+
+void init_dinX509DataType(struct dinX509DataType* dinX509DataType) {
+	dinX509DataType->X509IssuerSerial.arrayLen = 0u;
+	dinX509DataType->X509SKI.arrayLen = 0u;
+	dinX509DataType->X509SubjectName.arrayLen = 0u;
+	dinX509DataType->X509Certificate.arrayLen = 0u;
+	dinX509DataType->X509CRL.arrayLen = 0u;
+	dinX509DataType->ANY_isUsed = 0u;
+}
+
+void init_dinChargingStatusResType(struct dinChargingStatusResType* dinChargingStatusResType) {
+	dinChargingStatusResType->EVSEMaxCurrent_isUsed = 0u;
+	dinChargingStatusResType->MeterInfo_isUsed = 0u;
+}
+
+void init_dinWeldingDetectionReqType(struct dinWeldingDetectionReqType* dinWeldingDetectionReqType) {
+	(void)dinWeldingDetectionReqType; /* avoid unused warning */
+}
+
+void init_dinSignaturePropertiesType(struct dinSignaturePropertiesType* dinSignaturePropertiesType) {
+	dinSignaturePropertiesType->Id_isUsed = 0u;
+	dinSignaturePropertiesType->SignatureProperty.arrayLen = 0u;
+}
+
+void init_dinContractAuthenticationReqType(struct dinContractAuthenticationReqType* dinContractAuthenticationReqType) {
+	dinContractAuthenticationReqType->Id_isUsed = 0u;
+	dinContractAuthenticationReqType->GenChallenge_isUsed = 0u;
+}
+
+void init_dinDC_EVPowerDeliveryParameterType(struct dinDC_EVPowerDeliveryParameterType* dinDC_EVPowerDeliveryParameterType) {
+	dinDC_EVPowerDeliveryParameterType->BulkChargingComplete_isUsed = 0u;
+}
+
+void init_dinEVSEChargeParameterType(struct dinEVSEChargeParameterType* dinEVSEChargeParameterType) {
+	(void)dinEVSEChargeParameterType; /* avoid unused warning */
+}
+
+void init_dinCableCheckReqType(struct dinCableCheckReqType* dinCableCheckReqType) {
+	(void)dinCableCheckReqType; /* avoid unused warning */
+}
+
+void init_dinDC_EVChargeParameterType(struct dinDC_EVChargeParameterType* dinDC_EVChargeParameterType) {
+	dinDC_EVChargeParameterType->EVMaximumPowerLimit_isUsed = 0u;
+	dinDC_EVChargeParameterType->EVEnergyCapacity_isUsed = 0u;
+	dinDC_EVChargeParameterType->EVEnergyRequest_isUsed = 0u;
+	dinDC_EVChargeParameterType->FullSOC_isUsed = 0u;
+	dinDC_EVChargeParameterType->BulkSOC_isUsed = 0u;
+}
+
+void init_dinSAScheduleListType(struct dinSAScheduleListType* dinSAScheduleListType) {
+	dinSAScheduleListType->SAScheduleTuple.arrayLen = 0u;
+}
+
+void init_dinPMaxScheduleType(struct dinPMaxScheduleType* dinPMaxScheduleType) {
+	dinPMaxScheduleType->PMaxScheduleEntry.arrayLen = 0u;
+}
+
+void init_dinServicePaymentSelectionReqType(struct dinServicePaymentSelectionReqType* dinServicePaymentSelectionReqType) {
+	(void)dinServicePaymentSelectionReqType; /* avoid unused warning */
+}
+
+void init_dinRelativeTimeIntervalType(struct dinRelativeTimeIntervalType* dinRelativeTimeIntervalType) {
+	dinRelativeTimeIntervalType->duration_isUsed = 0u;
+}
+
+void init_dinEVStatusType(struct dinEVStatusType* dinEVStatusType) {
+	(void)dinEVStatusType; /* avoid unused warning */
+}
+
+void init_dinPreChargeResType(struct dinPreChargeResType* dinPreChargeResType) {
+	(void)dinPreChargeResType; /* avoid unused warning */
+}
+
+void init_dinDC_EVSEChargeParameterType(struct dinDC_EVSEChargeParameterType* dinDC_EVSEChargeParameterType) {
+	dinDC_EVSEChargeParameterType->EVSEMaximumPowerLimit_isUsed = 0u;
+	dinDC_EVSEChargeParameterType->EVSECurrentRegulationTolerance_isUsed = 0u;
+	dinDC_EVSEChargeParameterType->EVSEEnergyToBeDelivered_isUsed = 0u;
+}
+
+void init_dinPaymentDetailsResType(struct dinPaymentDetailsResType* dinPaymentDetailsResType) {
+	(void)dinPaymentDetailsResType; /* avoid unused warning */
+}
+
+void init_dinDSAKeyValueType(struct dinDSAKeyValueType* dinDSAKeyValueType) {
+	dinDSAKeyValueType->P_isUsed = 0u;
+	dinDSAKeyValueType->Q_isUsed = 0u;
+	dinDSAKeyValueType->G_isUsed = 0u;
+	dinDSAKeyValueType->J_isUsed = 0u;
+	dinDSAKeyValueType->Seed_isUsed = 0u;
+	dinDSAKeyValueType->PgenCounter_isUsed = 0u;
+}
+
+void init_dinSASchedulesType(struct dinSASchedulesType* dinSASchedulesType) {
+	(void)dinSASchedulesType; /* avoid unused warning */
+}
+
+void init_dinCertificateUpdateResType(struct dinCertificateUpdateResType* dinCertificateUpdateResType) {
+	(void)dinCertificateUpdateResType; /* avoid unused warning */
+}
+
+void init_dinEVChargeParameterType(struct dinEVChargeParameterType* dinEVChargeParameterType) {
+	(void)dinEVChargeParameterType; /* avoid unused warning */
+}
+
+void init_dinMessageHeaderType(struct dinMessageHeaderType* dinMessageHeaderType) {
+	dinMessageHeaderType->Notification_isUsed = 0u;
+	dinMessageHeaderType->Signature_isUsed = 0u;
+}
+
+void init_dinBodyBaseType(struct dinBodyBaseType* dinBodyBaseType) {
+	(void)dinBodyBaseType; /* avoid unused warning */
+}
+
+void init_dinKeyValueType(struct dinKeyValueType* dinKeyValueType) {
+	dinKeyValueType->DSAKeyValue_isUsed = 0u;
+	dinKeyValueType->RSAKeyValue_isUsed = 0u;
+	dinKeyValueType->ANY_isUsed = 0u;
+}
+
+void init_dinIntervalType(struct dinIntervalType* dinIntervalType) {
+	(void)dinIntervalType; /* avoid unused warning */
+}
+
+void init_dinChargeParameterDiscoveryResType(struct dinChargeParameterDiscoveryResType* dinChargeParameterDiscoveryResType) {
+	dinChargeParameterDiscoveryResType->SASchedules_isUsed = 0u;
+	dinChargeParameterDiscoveryResType->SAScheduleList_isUsed = 0u;
+	dinChargeParameterDiscoveryResType->EVSEChargeParameter_isUsed = 0u;
+	dinChargeParameterDiscoveryResType->AC_EVSEChargeParameter_isUsed = 0u;
+	dinChargeParameterDiscoveryResType->DC_EVSEChargeParameter_isUsed = 0u;
+}
+
+void init_dinPowerDeliveryReqType(struct dinPowerDeliveryReqType* dinPowerDeliveryReqType) {
+	dinPowerDeliveryReqType->ChargingProfile_isUsed = 0u;
+	dinPowerDeliveryReqType->EVPowerDeliveryParameter_isUsed = 0u;
+	dinPowerDeliveryReqType->DC_EVPowerDeliveryParameter_isUsed = 0u;
+}
+
+void init_dinCertificateChainType(struct dinCertificateChainType* dinCertificateChainType) {
+	dinCertificateChainType->SubCertificates_isUsed = 0u;
+}
+
+void init_dinTransformsType(struct dinTransformsType* dinTransformsType) {
+	dinTransformsType->Transform.arrayLen = 0u;
+}
+
+void init_dinEntryType(struct dinEntryType* dinEntryType) {
+	dinEntryType->TimeInterval_isUsed = 0u;
+	dinEntryType->RelativeTimeInterval_isUsed = 0u;
+}
+
+void init_dinSessionStopType(struct dinSessionStopType* dinSessionStopType) {
+	(void)dinSessionStopType; /* avoid unused warning */
+}
+
+void init_dinServiceDetailReqType(struct dinServiceDetailReqType* dinServiceDetailReqType) {
+	(void)dinServiceDetailReqType; /* avoid unused warning */
+}
+
+void init_dinDigestMethodType(struct dinDigestMethodType* dinDigestMethodType) {
+	dinDigestMethodType->ANY_isUsed = 0u;
+}
+
+void init_dinParameterType(struct dinParameterType* dinParameterType) {
+	dinParameterType->boolValue_isUsed = 0u;
+	dinParameterType->byteValue_isUsed = 0u;
+	dinParameterType->shortValue_isUsed = 0u;
+	dinParameterType->intValue_isUsed = 0u;
+	dinParameterType->physicalValue_isUsed = 0u;
+	dinParameterType->stringValue_isUsed = 0u;
+}
+
+void init_dinChargingStatusReqType(struct dinChargingStatusReqType* dinChargingStatusReqType) {
+	(void)dinChargingStatusReqType; /* avoid unused warning */
+}
+
+void init_dinSignatureMethodType(struct dinSignatureMethodType* dinSignatureMethodType) {
+	dinSignatureMethodType->HMACOutputLength_isUsed = 0u;
+	dinSignatureMethodType->ANY_isUsed = 0u;
+}
+
+void init_dinCertificateInstallationReqType(struct dinCertificateInstallationReqType* dinCertificateInstallationReqType) {
+	dinCertificateInstallationReqType->Id_isUsed = 0u;
+}
+
+void init_dinSalesTariffEntryType(struct dinSalesTariffEntryType* dinSalesTariffEntryType) {
+	dinSalesTariffEntryType->TimeInterval_isUsed = 0u;
+	dinSalesTariffEntryType->RelativeTimeInterval_isUsed = 0u;
+	dinSalesTariffEntryType->ConsumptionCost.arrayLen = 0u;
+}
+
+void init_dinServiceDiscoveryResType(struct dinServiceDiscoveryResType* dinServiceDiscoveryResType) {
+	dinServiceDiscoveryResType->ServiceList_isUsed = 0u;
+}
+
+void init_dinParameterSetType(struct dinParameterSetType* dinParameterSetType) {
+	dinParameterSetType->Parameter.arrayLen = 0u;
+}
+
+void init_dinCurrentDemandReqType(struct dinCurrentDemandReqType* dinCurrentDemandReqType) {
+	dinCurrentDemandReqType->EVMaximumVoltageLimit_isUsed = 0u;
+	dinCurrentDemandReqType->EVMaximumCurrentLimit_isUsed = 0u;
+	dinCurrentDemandReqType->EVMaximumPowerLimit_isUsed = 0u;
+	dinCurrentDemandReqType->BulkChargingComplete_isUsed = 0u;
+	dinCurrentDemandReqType->RemainingTimeToFullSoC_isUsed = 0u;
+	dinCurrentDemandReqType->RemainingTimeToBulkSoC_isUsed = 0u;
+}
+
+void init_dinPreChargeReqType(struct dinPreChargeReqType* dinPreChargeReqType) {
+	(void)dinPreChargeReqType; /* avoid unused warning */
+}
+
+void init_dinSignatureType(struct dinSignatureType* dinSignatureType) {
+	dinSignatureType->Id_isUsed = 0u;
+	dinSignatureType->KeyInfo_isUsed = 0u;
+	dinSignatureType->Object.arrayLen = 0u;
+}
+
+void init_dinReferenceType(struct dinReferenceType* dinReferenceType) {
+	dinReferenceType->Id_isUsed = 0u;
+	dinReferenceType->URI_isUsed = 0u;
+	dinReferenceType->Type_isUsed = 0u;
+	dinReferenceType->Transforms_isUsed = 0u;
+}
+
+void init_dinProfileEntryType(struct dinProfileEntryType* dinProfileEntryType) {
+	(void)dinProfileEntryType; /* avoid unused warning */
+}
+
+void init_dinAnonType_V2G_Message(struct dinAnonType_V2G_Message* dinAnonType_V2G_Message) {
+	(void)dinAnonType_V2G_Message; /* avoid unused warning */
+}
+
+void init_dinChargeParameterDiscoveryReqType(struct dinChargeParameterDiscoveryReqType* dinChargeParameterDiscoveryReqType) {
+	dinChargeParameterDiscoveryReqType->EVChargeParameter_isUsed = 0u;
+	dinChargeParameterDiscoveryReqType->AC_EVChargeParameter_isUsed = 0u;
+	dinChargeParameterDiscoveryReqType->DC_EVChargeParameter_isUsed = 0u;
+}
+
+void init_dinConsumptionCostType(struct dinConsumptionCostType* dinConsumptionCostType) {
+	dinConsumptionCostType->Cost.arrayLen = 0u;
+}
+
+void init_dinRSAKeyValueType(struct dinRSAKeyValueType* dinRSAKeyValueType) {
+	(void)dinRSAKeyValueType; /* avoid unused warning */
+}
+
+void init_dinServiceType(struct dinServiceType* dinServiceType) {
+	(void)dinServiceType; /* avoid unused warning */
+}
+
+void init_dinServiceTagListType(struct dinServiceTagListType* dinServiceTagListType) {
+	dinServiceTagListType->Service.arrayLen = 0u;
+}
+
+void init_dinEVSEStatusType(struct dinEVSEStatusType* dinEVSEStatusType) {
+	(void)dinEVSEStatusType; /* avoid unused warning */
+}
+
+void init_dinSessionSetupResType(struct dinSessionSetupResType* dinSessionSetupResType) {
+	dinSessionSetupResType->DateTimeNow_isUsed = 0u;
+}
+
+void init_dinEVPowerDeliveryParameterType(struct dinEVPowerDeliveryParameterType* dinEVPowerDeliveryParameterType) {
+	(void)dinEVPowerDeliveryParameterType; /* avoid unused warning */
+}
+
+void init_dinX509IssuerSerialType(struct dinX509IssuerSerialType* dinX509IssuerSerialType) {
+	(void)dinX509IssuerSerialType; /* avoid unused warning */
+}
+
+void init_dinSelectedServiceType(struct dinSelectedServiceType* dinSelectedServiceType) {
+	dinSelectedServiceType->ParameterSetID_isUsed = 0u;
+}
+
+void init_dinMeteringReceiptResType(struct dinMeteringReceiptResType* dinMeteringReceiptResType) {
+	(void)dinMeteringReceiptResType; /* avoid unused warning */
+}
+
+void init_dinDC_EVStatusType(struct dinDC_EVStatusType* dinDC_EVStatusType) {
+	dinDC_EVStatusType->EVCabinConditioning_isUsed = 0u;
+	dinDC_EVStatusType->EVRESSConditioning_isUsed = 0u;
+}
+
+void init_dinPhysicalValueType(struct dinPhysicalValueType* dinPhysicalValueType) {
+	dinPhysicalValueType->Unit_isUsed = 0u;
+}
+
+void init_dinManifestType(struct dinManifestType* dinManifestType) {
+	dinManifestType->Id_isUsed = 0u;
+	dinManifestType->Reference.arrayLen = 0u;
+}
+
+void init_dinPMaxScheduleEntryType(struct dinPMaxScheduleEntryType* dinPMaxScheduleEntryType) {
+	dinPMaxScheduleEntryType->TimeInterval_isUsed = 0u;
+	dinPMaxScheduleEntryType->RelativeTimeInterval_isUsed = 0u;
+}
+
+void init_dinServiceParameterListType(struct dinServiceParameterListType* dinServiceParameterListType) {
+	dinServiceParameterListType->ParameterSet.arrayLen = 0u;
+}
+
+void init_dinSignatureValueType(struct dinSignatureValueType* dinSignatureValueType) {
+	dinSignatureValueType->Id_isUsed = 0u;
+}
+
+void init_dinPaymentOptionsType(struct dinPaymentOptionsType* dinPaymentOptionsType) {
+	dinPaymentOptionsType->PaymentOption.arrayLen = 0u;
+}
+
+void init_dinServiceTagType(struct dinServiceTagType* dinServiceTagType) {
+	dinServiceTagType->ServiceName_isUsed = 0u;
+	dinServiceTagType->ServiceScope_isUsed = 0u;
+}
+
+void init_dinAC_EVSEStatusType(struct dinAC_EVSEStatusType* dinAC_EVSEStatusType) {
+	(void)dinAC_EVSEStatusType; /* avoid unused warning */
+}
+
+void init_dinCertificateUpdateReqType(struct dinCertificateUpdateReqType* dinCertificateUpdateReqType) {
+	dinCertificateUpdateReqType->Id_isUsed = 0u;
+}
+
+void init_dinServicePaymentSelectionResType(struct dinServicePaymentSelectionResType* dinServicePaymentSelectionResType) {
+	(void)dinServicePaymentSelectionResType; /* avoid unused warning */
+}
+
+void init_dinSAScheduleTupleType(struct dinSAScheduleTupleType* dinSAScheduleTupleType) {
+	dinSAScheduleTupleType->SalesTariff_isUsed = 0u;
+}
+
+void init_dinChargingProfileType(struct dinChargingProfileType* dinChargingProfileType) {
+	dinChargingProfileType->ProfileEntry.arrayLen = 0u;
+}
+
+void init_dinServiceDiscoveryReqType(struct dinServiceDiscoveryReqType* dinServiceDiscoveryReqType) {
+	dinServiceDiscoveryReqType->ServiceScope_isUsed = 0u;
+	dinServiceDiscoveryReqType->ServiceCategory_isUsed = 0u;
+}
+
+void init_dinAC_EVSEChargeParameterType(struct dinAC_EVSEChargeParameterType* dinAC_EVSEChargeParameterType) {
+	(void)dinAC_EVSEChargeParameterType; /* avoid unused warning */
+}
+
+void init_dinKeyInfoType(struct dinKeyInfoType* dinKeyInfoType) {
+	dinKeyInfoType->Id_isUsed = 0u;
+	dinKeyInfoType->KeyName.arrayLen = 0u;
+	dinKeyInfoType->KeyValue.arrayLen = 0u;
+	dinKeyInfoType->RetrievalMethod.arrayLen = 0u;
+	dinKeyInfoType->X509Data.arrayLen = 0u;
+	dinKeyInfoType->PGPData.arrayLen = 0u;
+	dinKeyInfoType->SPKIData.arrayLen = 0u;
+	dinKeyInfoType->MgmtData.arrayLen = 0u;
+	dinKeyInfoType->ANY_isUsed = 0u;
+}
+
+void init_dinPaymentDetailsReqType(struct dinPaymentDetailsReqType* dinPaymentDetailsReqType) {
+	(void)dinPaymentDetailsReqType; /* avoid unused warning */
+}
+
+void init_dinCableCheckResType(struct dinCableCheckResType* dinCableCheckResType) {
+	(void)dinCableCheckResType; /* avoid unused warning */
+}
+
+void init_dinObjectType(struct dinObjectType* dinObjectType) {
+	dinObjectType->Id_isUsed = 0u;
+	dinObjectType->MimeType_isUsed = 0u;
+	dinObjectType->Encoding_isUsed = 0u;
+	dinObjectType->ANY_isUsed = 0u;
+}
+
+void init_dinSessionStopResType(struct dinSessionStopResType* dinSessionStopResType) {
+	(void)dinSessionStopResType; /* avoid unused warning */
+}
+
+void init_dinSignedInfoType(struct dinSignedInfoType* dinSignedInfoType) {
+	dinSignedInfoType->Id_isUsed = 0u;
+	dinSignedInfoType->Reference.arrayLen = 0u;
+}
+
+void init_dinSalesTariffType(struct dinSalesTariffType* dinSalesTariffType) {
+	dinSalesTariffType->SalesTariffDescription_isUsed = 0u;
+	dinSalesTariffType->SalesTariffEntry.arrayLen = 0u;
+}
+
+void init_dinCostType(struct dinCostType* dinCostType) {
+	dinCostType->amountMultiplier_isUsed = 0u;
+}
+
+void init_dinServiceChargeType(struct dinServiceChargeType* dinServiceChargeType) {
+	(void)dinServiceChargeType; /* avoid unused warning */
+}
+
+void init_dinDC_EVSEStatusType(struct dinDC_EVSEStatusType* dinDC_EVSEStatusType) {
+	dinDC_EVSEStatusType->EVSEIsolationStatus_isUsed = 0u;
+}
+
+void init_dinRetrievalMethodType(struct dinRetrievalMethodType* dinRetrievalMethodType) {
+	dinRetrievalMethodType->URI_isUsed = 0u;
+	dinRetrievalMethodType->Type_isUsed = 0u;
+	dinRetrievalMethodType->Transforms_isUsed = 0u;
+}
+
+void init_dinNotificationType(struct dinNotificationType* dinNotificationType) {
+	dinNotificationType->FaultMsg_isUsed = 0u;
+}
+
+void init_dinPGPDataType(struct dinPGPDataType* dinPGPDataType) {
+	dinPGPDataType->PGPKeyID_isUsed = 0u;
+	dinPGPDataType->PGPKeyPacket_isUsed = 0u;
+	dinPGPDataType->ANY_isUsed = 0u;
+}
+
+void init_dinCertificateInstallationResType(struct dinCertificateInstallationResType* dinCertificateInstallationResType) {
+	(void)dinCertificateInstallationResType; /* avoid unused warning */
+}
+
+void init_dinSignaturePropertyType(struct dinSignaturePropertyType* dinSignaturePropertyType) {
+	dinSignaturePropertyType->Id_isUsed = 0u;
+	dinSignaturePropertyType->ANY_isUsed = 0u;
+}
+
+void init_dinMeterInfoType(struct dinMeterInfoType* dinMeterInfoType) {
+	dinMeterInfoType->MeterReading_isUsed = 0u;
+	dinMeterInfoType->SigMeterReading_isUsed = 0u;
+	dinMeterInfoType->MeterStatus_isUsed = 0u;
+	dinMeterInfoType->TMeter_isUsed = 0u;
+}
+
+void init_dinSubCertificatesType(struct dinSubCertificatesType* dinSubCertificatesType) {
+	dinSubCertificatesType->Certificate.arrayLen = 0u;
+}
+
+
+
+#endif /* DEPLOY_DIN_CODEC */
+
+#endif
+

+ 2934 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypes.h

@@ -0,0 +1,2934 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypes.h
+ * \brief 	Datatype definitions and structs for given XML Schema definitions and initialization methods
+ *
+ */
+
+#ifndef EXI_din_DATATYPES_H
+#define EXI_din_DATATYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SUPPORT_YES 1
+#define SUPPORT_NO 2
+#define DEPLOY_DIN_CODEC SUPPORT_YES
+#define DEPLOY_DIN_CODEC_FRAGMENT SUPPORT_NO
+
+#if DEPLOY_DIN_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+
+
+/* Datatype definitions and structs for given XML Schema definitions */
+
+#define UNION_YES 1
+#define UNION_NO 2
+#define SAVE_MEMORY_WITH_UNNAMED_UNION UNION_YES
+
+/* Note: Please find below a list of occurrence limits that have been applied */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":SPKISexp from unbounded to 1 (see #define dinSPKIDataType_SPKISexp_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":RootCertificateID from unbounded to 5 (see #define dinListOfRootCertificateIDsType_RootCertificateID_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":XPath from unbounded to 1 (see #define dinTransformType_XPath_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Transform from unbounded to 1 (see #define dinTransformsType_Transform_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Reference from unbounded to 1 (see #define dinManifestType_Reference_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":PaymentOption from unbounded to 5 (see #define dinPaymentOptionsType_PaymentOption_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":ProfileEntry from unbounded to 24 (see #define dinChargingProfileType_ProfileEntry_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Reference from unbounded to 1 (see #define dinSignedInfoType_Reference_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":Certificate from unbounded to 5 (see #define dinSubCertificatesType_Certificate_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":SelectedService from unbounded to 16 (see #define dinSelectedServiceListType_SelectedService_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial from unbounded to 1 (see #define dinX509DataType_X509IssuerSerial_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509SKI from unbounded to 1 (see #define dinX509DataType_X509SKI_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509SubjectName from unbounded to 1 (see #define dinX509DataType_X509SubjectName_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509Certificate from unbounded to 1 (see #define dinX509DataType_X509Certificate_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509CRL from unbounded to 1 (see #define dinX509DataType_X509CRL_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":SignatureProperty from unbounded to 1 (see #define dinSignaturePropertiesType_SignatureProperty_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":PMaxScheduleEntry from unbounded to 5 (see #define dinPMaxScheduleType_PMaxScheduleEntry_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":Parameter from unbounded to 16 (see #define dinParameterSetType_Parameter_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":Cost from unbounded to 5 (see #define dinConsumptionCostType_Cost_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":Service from unbounded to 8 (see #define dinServiceTagListType_Service_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":ParameterSet from unbounded to 5 (see #define dinServiceParameterListType_ParameterSet_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":KeyName from unbounded to 1 (see #define dinKeyInfoType_KeyName_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":KeyValue from unbounded to 1 (see #define dinKeyInfoType_KeyValue_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":RetrievalMethod from unbounded to 1 (see #define dinKeyInfoType_RetrievalMethod_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509Data from unbounded to 1 (see #define dinKeyInfoType_X509Data_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":PGPData from unbounded to 1 (see #define dinKeyInfoType_PGPData_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":SPKIData from unbounded to 1 (see #define dinKeyInfoType_SPKIData_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":MgmtData from unbounded to 1 (see #define dinKeyInfoType_MgmtData_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":ConsumptionCost from unbounded to 5 (see #define dinSalesTariffEntryType_ConsumptionCost_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Object from unbounded to 1 (see #define dinSignatureType_Object_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":SalesTariffEntry from unbounded to 5 (see #define dinSalesTariffType_SalesTariffEntry_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2010:MsgDataTypes":SAScheduleTuple from unbounded to 5 (see #define dinSAScheduleListType_SAScheduleTuple_ARRAY_SIZE) */
+
+
+typedef enum {
+	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
+} dinDC_EVSEStatusCodeType;
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,SessionSetupReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":EVCCID)',  derivedBy='EXTENSION'.  */
+#define dinSessionSetupReqType_EVCCID_BYTES_SIZE 8 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,evccIDType is 8 */
+struct dinSessionSetupReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVCCID, urn:iso:15118:2:2010:MsgDataTypes,evccIDType */
+	struct {
+		uint8_t bytes[dinSessionSetupReqType_EVCCID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  EVCCID ;
+};
+
+typedef enum {
+	dinEVSEProcessingType_Finished = 0,
+	dinEVSEProcessingType_Ongoing = 1
+} dinEVSEProcessingType;
+
+/* 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 dinCanonicalizationMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define dinCanonicalizationMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinCanonicalizationMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[dinCanonicalizationMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##any] */
+	struct {
+		exi_string_character_t characters[dinCanonicalizationMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 dinSPKIDataType_SPKISexp_BYTES_SIZE 350
+#define dinSPKIDataType_SPKISexp_ARRAY_SIZE 1
+#define dinSPKIDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinSPKIDataType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SPKISexp, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[dinSPKIDataType_SPKISexp_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[dinSPKIDataType_SPKISexp_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SPKISexp;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[dinSPKIDataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ListOfRootCertificateIDsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":RootCertificateID{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinListOfRootCertificateIDsType_RootCertificateID_CHARACTERS_SIZE 40 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,rootCertificateIDType is 40 */
+#define dinListOfRootCertificateIDsType_RootCertificateID_ARRAY_SIZE 5
+struct dinListOfRootCertificateIDsType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":RootCertificateID, urn:iso:15118:2:2010:MsgDataTypes,rootCertificateIDType */
+	struct {
+		struct {
+			exi_string_character_t characters[dinListOfRootCertificateIDsType_RootCertificateID_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[dinListOfRootCertificateIDsType_RootCertificateID_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} RootCertificateID;
+};
+
+/* 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 dinTransformType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define dinTransformType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinTransformType_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinTransformType_XPath_ARRAY_SIZE 1
+struct dinTransformType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[dinTransformType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[dinTransformType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":XPath, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[dinTransformType_XPath_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[dinTransformType_XPath_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} XPath;
+};
+
+typedef enum {
+	dinDC_EVErrorCodeType_NO_ERROR = 0,
+	dinDC_EVErrorCodeType_FAILED_RESSTemperatureInhibit = 1,
+	dinDC_EVErrorCodeType_FAILED_EVShiftPosition = 2,
+	dinDC_EVErrorCodeType_FAILED_ChargerConnectorLockFault = 3,
+	dinDC_EVErrorCodeType_FAILED_EVRESSMalfunction = 4,
+	dinDC_EVErrorCodeType_FAILED_ChargingCurrentdifferential = 5,
+	dinDC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange = 6,
+	dinDC_EVErrorCodeType_Reserved_A = 7,
+	dinDC_EVErrorCodeType_Reserved_B = 8,
+	dinDC_EVErrorCodeType_Reserved_C = 9,
+	dinDC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility = 10,
+	dinDC_EVErrorCodeType_NoData = 11
+} dinDC_EVErrorCodeType;
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ContractAuthenticationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":GenChallenge{0-1})',  derivedBy='EXTENSION'.  */
+#define dinContractAuthenticationReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinContractAuthenticationReqType_GenChallenge_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinContractAuthenticationReqType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,IDREF} */
+	struct {
+		exi_string_character_t characters[dinContractAuthenticationReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":GenChallenge, urn:iso:15118:2:2010:MsgDataTypes,genChallengeType */
+	struct {
+		exi_string_character_t characters[dinContractAuthenticationReqType_GenChallenge_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  GenChallenge ;
+	unsigned int GenChallenge_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,EVSEChargeParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct dinEVSEChargeParameterType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,RelativeTimeIntervalType',  base type name='IntervalType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":start,"urn:iso:15118:2:2010:MsgDataTypes":duration{0-1})',  derivedBy='EXTENSION'.  */
+struct dinRelativeTimeIntervalType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":start, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t start ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":duration, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t duration ;
+	unsigned int duration_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,EVStatusType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct dinEVStatusType {
+	int noContent; /* avoid warning */
+};
+
+/* 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 dinDSAKeyValueType_P_BYTES_SIZE 350
+#define dinDSAKeyValueType_Q_BYTES_SIZE 350
+#define dinDSAKeyValueType_G_BYTES_SIZE 350
+#define dinDSAKeyValueType_Y_BYTES_SIZE 350
+#define dinDSAKeyValueType_J_BYTES_SIZE 350
+#define dinDSAKeyValueType_Seed_BYTES_SIZE 350
+#define dinDSAKeyValueType_PgenCounter_BYTES_SIZE 350
+struct dinDSAKeyValueType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":P, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[dinDSAKeyValueType_P_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  P ;
+	unsigned int P_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Q, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[dinDSAKeyValueType_Q_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Q ;
+	unsigned int Q_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":G, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[dinDSAKeyValueType_G_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  G ;
+	unsigned int G_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Y, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[dinDSAKeyValueType_Y_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Y ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":J, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[dinDSAKeyValueType_J_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  J ;
+	unsigned int J_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Seed, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[dinDSAKeyValueType_Seed_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Seed ;
+	unsigned int Seed_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PgenCounter, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[dinDSAKeyValueType_PgenCounter_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PgenCounter ;
+	unsigned int PgenCounter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SASchedulesType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct dinSASchedulesType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,EVChargeParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct dinEVChargeParameterType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDef,BodyBaseType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct dinBodyBaseType {
+	int noContent; /* avoid warning */
+};
+
+typedef enum {
+	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
+} dinunitSymbolType;
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,IntervalType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct dinIntervalType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinTransformsType_Transform_ARRAY_SIZE 1
+struct dinTransformsType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transform, 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'.  */
+	struct {
+		struct dinTransformType array[dinTransformsType_Transform_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Transform;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,EntryType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":TimeInterval)',  derivedBy='RESTRICTION'.  */
+struct dinEntryType {
+	/* substitutionGroup */
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+		/* element: "urn:iso:15118:2:2010:MsgDataTypes":TimeInterval, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,IntervalType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+		struct dinIntervalType TimeInterval ;
+		/* element: "urn:iso:15118:2:2010:MsgDataTypes":RelativeTimeInterval, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,RelativeTimeIntervalType',  base type name='IntervalType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":start,"urn:iso:15118:2:2010:MsgDataTypes":duration{0-1})',  derivedBy='EXTENSION'.  */
+		struct dinRelativeTimeIntervalType RelativeTimeInterval ;
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	};
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+		unsigned int TimeInterval_isUsed:1;
+		unsigned int RelativeTimeInterval_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,SessionStopType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+struct dinSessionStopType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ServiceDetailReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ServiceID)',  derivedBy='EXTENSION'.  */
+struct dinServiceDetailReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ServiceID, urn:iso:15118:2:2010:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+};
+
+/* 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 dinDigestMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define dinDigestMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinDigestMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[dinDigestMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[dinDigestMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+typedef enum {
+	dinvalueType_bool = 0,
+	dinvalueType_byte = 1,
+	dinvalueType_short = 2,
+	dinvalueType_int = 3,
+	dinvalueType_physicalValue = 4,
+	dinvalueType_string = 5
+} dinvalueType;
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ChargingStatusReqType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+struct dinChargingStatusReqType {
+	int noContent; /* avoid warning */
+};
+
+/* 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 dinSignatureMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define dinSignatureMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinSignatureMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[dinSignatureMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":HMACOutputLength, http://www.w3.org/2000/09/xmldsig#,HMACOutputLengthType */
+	int64_t HMACOutputLength ;
+	unsigned int HMACOutputLength_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[dinSignatureMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,CertificateInstallationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":OEMProvisioningCert,"urn:iso:15118:2:2010:MsgBody":ListOfRootCertificateIDs,"urn:iso:15118:2:2010:MsgBody":DHParams)',  derivedBy='EXTENSION'.  */
+#define dinCertificateInstallationReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinCertificateInstallationReqType_OEMProvisioningCert_BYTES_SIZE 1200 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,certificateType is 1200 */
+#define dinCertificateInstallationReqType_DHParams_BYTES_SIZE 256 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,dHParamsType is 256 */
+struct dinCertificateInstallationReqType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,IDREF} */
+	struct {
+		exi_string_character_t characters[dinCertificateInstallationReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":OEMProvisioningCert, urn:iso:15118:2:2010:MsgDataTypes,certificateType */
+	struct {
+		uint8_t bytes[dinCertificateInstallationReqType_OEMProvisioningCert_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  OEMProvisioningCert ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ListOfRootCertificateIDs, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ListOfRootCertificateIDsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":RootCertificateID{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinListOfRootCertificateIDsType ListOfRootCertificateIDs ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":DHParams, urn:iso:15118:2:2010:MsgDataTypes,dHParamsType */
+	struct {
+		uint8_t bytes[dinCertificateInstallationReqType_DHParams_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DHParams ;
+};
+
+typedef enum {
+	dinEVRequestedEnergyTransferType_AC_single_phase_core = 0,
+	dinEVRequestedEnergyTransferType_AC_three_phase_core = 1,
+	dinEVRequestedEnergyTransferType_DC_core = 2,
+	dinEVRequestedEnergyTransferType_DC_extended = 3,
+	dinEVRequestedEnergyTransferType_DC_combo_core = 4,
+	dinEVRequestedEnergyTransferType_DC_unique = 5
+} dinEVRequestedEnergyTransferType;
+
+typedef enum {
+	dinpaymentOptionType_Contract = 0,
+	dinpaymentOptionType_ExternalPayment = 1
+} dinpaymentOptionType;
+
+typedef enum {
+	dinEVSESupportedEnergyTransferType_AC_single_phase_core = 0,
+	dinEVSESupportedEnergyTransferType_AC_three_phase_core = 1,
+	dinEVSESupportedEnergyTransferType_DC_core = 2,
+	dinEVSESupportedEnergyTransferType_DC_extended = 3,
+	dinEVSESupportedEnergyTransferType_DC_combo_core = 4,
+	dinEVSESupportedEnergyTransferType_DC_dual = 5,
+	dinEVSESupportedEnergyTransferType_AC_core1p_DC_extended = 6,
+	dinEVSESupportedEnergyTransferType_AC_single_DC_core = 7,
+	dinEVSESupportedEnergyTransferType_AC_single_phase_three_phase_core_DC_extended = 8,
+	dinEVSESupportedEnergyTransferType_AC_core3p_DC_extended = 9
+} dinEVSESupportedEnergyTransferType;
+
+/* 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 dinReferenceType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinReferenceType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinReferenceType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinReferenceType_DigestValue_BYTES_SIZE 350
+struct dinReferenceType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[dinReferenceType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[dinReferenceType_URI_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  URI ;
+	unsigned int URI_isUsed:1;
+	/* attribute: Type {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[dinReferenceType_Type_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Type ;
+	unsigned int Type_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transforms, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinTransformsType Transforms ;
+	unsigned int Transforms_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":DigestMethod, 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'.  */
+	struct dinDigestMethodType DigestMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":DigestValue, http://www.w3.org/2000/09/xmldsig#,DigestValueType */
+	struct {
+		uint8_t bytes[dinReferenceType_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ProfileEntryType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ChargingProfileEntryStart,"urn:iso:15118:2:2010:MsgDataTypes":ChargingProfileEntryMaxPower)',  derivedBy='RESTRICTION'.  */
+struct dinProfileEntryType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ChargingProfileEntryStart, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t ChargingProfileEntryStart ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ChargingProfileEntryMaxPower, urn:iso:15118:2:2010:MsgDataTypes,PMaxType */
+	int16_t ChargingProfileEntryMaxPower ;
+};
+
+/* 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 dinRSAKeyValueType_Modulus_BYTES_SIZE 350
+#define dinRSAKeyValueType_Exponent_BYTES_SIZE 350
+struct dinRSAKeyValueType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Modulus, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[dinRSAKeyValueType_Modulus_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Modulus ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Exponent, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[dinRSAKeyValueType_Exponent_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Exponent ;
+};
+
+typedef enum {
+	dinfaultCodeType_ParsingError = 0,
+	dinfaultCodeType_NoTLSRootCertificatAvailable = 1,
+	dinfaultCodeType_UnknownError = 2
+} dinfaultCodeType;
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct dinEVSEStatusType {
+	int noContent; /* avoid warning */
+};
+
+typedef enum {
+	dinserviceCategoryType_EVCharging = 0,
+	dinserviceCategoryType_Internet = 1,
+	dinserviceCategoryType_ContractCertificate = 2,
+	dinserviceCategoryType_OtherCustom = 3
+} dinserviceCategoryType;
+
+typedef enum {
+	dinEVSENotificationType_None = 0,
+	dinEVSENotificationType_StopCharging = 1,
+	dinEVSENotificationType_ReNegotiation = 2
+} dinEVSENotificationType;
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,EVPowerDeliveryParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct dinEVPowerDeliveryParameterType {
+	int noContent; /* avoid warning */
+};
+
+/* 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 dinX509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinX509IssuerSerialType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509IssuerName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		exi_string_character_t characters[dinX509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509IssuerName ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SerialNumber, http://www.w3.org/2001/XMLSchema,integer */
+	int64_t X509SerialNumber ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SelectedServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ServiceID,"urn:iso:15118:2:2010:MsgDataTypes":ParameterSetID{0-1})',  derivedBy='RESTRICTION'.  */
+struct dinSelectedServiceType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ServiceID, urn:iso:15118:2:2010:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ParameterSetID, http://www.w3.org/2001/XMLSchema,short */
+	int16_t ParameterSetID ;
+	unsigned int ParameterSetID_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVReady,"urn:iso:15118:2:2010:MsgDataTypes":EVCabinConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVRESSConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2010:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+struct dinDC_EVStatusType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVReady, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVReady ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVCabinConditioning, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVCabinConditioning ;
+	unsigned int EVCabinConditioning_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVRESSConditioning, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVRESSConditioning ;
+	unsigned int EVRESSConditioning_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVErrorCode, urn:iso:15118:2:2010:MsgDataTypes,DC_EVErrorCodeType */
+	dinDC_EVErrorCodeType EVErrorCode ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVRESSSOC, urn:iso:15118:2:2010:MsgDataTypes,percentValueType */
+	int8_t EVRESSSOC ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+struct dinPhysicalValueType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":Multiplier, urn:iso:15118:2:2010:MsgDataTypes,unitMultiplierType */
+	int8_t Multiplier ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":Unit, urn:iso:15118:2:2010:MsgDataTypes,unitSymbolType */
+	dinunitSymbolType Unit ;
+	unsigned int Unit_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":Value, http://www.w3.org/2001/XMLSchema,short */
+	int16_t Value ;
+};
+
+/* 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 dinManifestType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinManifestType_Reference_ARRAY_SIZE 1
+struct dinManifestType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[dinManifestType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Reference, 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'.  */
+	struct {
+		struct dinReferenceType array[dinManifestType_Reference_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Reference;
+};
+
+typedef enum {
+	dincostKindType_relativePricePercentage = 0,
+	dincostKindType_RenewableGenerationPercentage = 1,
+	dincostKindType_CarbonDioxideEmission = 2
+} dincostKindType;
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PMaxScheduleEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2010:MsgDataTypes":TimeInterval),("urn:iso:15118:2:2010:MsgDataTypes":PMax))',  derivedBy='EXTENSION'.  */
+struct dinPMaxScheduleEntryType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":TimeInterval, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,IntervalType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct dinIntervalType TimeInterval ;
+	unsigned int TimeInterval_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":RelativeTimeInterval, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,RelativeTimeIntervalType',  base type name='IntervalType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":start,"urn:iso:15118:2:2010:MsgDataTypes":duration{0-1})',  derivedBy='EXTENSION'.  */
+	struct dinRelativeTimeIntervalType RelativeTimeInterval ;
+	unsigned int RelativeTimeInterval_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":PMax, urn:iso:15118:2:2010:MsgDataTypes,PMaxType */
+	int16_t PMax ;
+};
+
+typedef enum {
+	dinisolationLevelType_Invalid = 0,
+	dinisolationLevelType_Valid = 1,
+	dinisolationLevelType_Warning = 2,
+	dinisolationLevelType_Fault = 3
+} dinisolationLevelType;
+
+/* 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 dinSignatureValueType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinSignatureValueType_CONTENT_BYTES_SIZE 350
+struct dinSignatureValueType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[dinSignatureValueType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* simple content: http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[dinSignatureValueType_CONTENT_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  CONTENT ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PaymentOptionsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":PaymentOption{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinPaymentOptionsType_PaymentOption_ARRAY_SIZE 5
+struct dinPaymentOptionsType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":PaymentOption, urn:iso:15118:2:2010:MsgDataTypes,paymentOptionType */
+	struct {
+		dinpaymentOptionType array[dinPaymentOptionsType_PaymentOption_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PaymentOption;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceTagType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ServiceID,"urn:iso:15118:2:2010:MsgDataTypes":ServiceName{0-1},"urn:iso:15118:2:2010:MsgDataTypes":ServiceCategory,"urn:iso:15118:2:2010:MsgDataTypes":ServiceScope{0-1})',  derivedBy='RESTRICTION'.  */
+#define dinServiceTagType_ServiceName_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,serviceNameType is 32 */
+#define dinServiceTagType_ServiceScope_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,serviceScopeType is 32 */
+struct dinServiceTagType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ServiceID, urn:iso:15118:2:2010:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ServiceName, urn:iso:15118:2:2010:MsgDataTypes,serviceNameType */
+	struct {
+		exi_string_character_t characters[dinServiceTagType_ServiceName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceName ;
+	unsigned int ServiceName_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ServiceCategory, urn:iso:15118:2:2010:MsgDataTypes,serviceCategoryType */
+	dinserviceCategoryType ServiceCategory ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ServiceScope, urn:iso:15118:2:2010:MsgDataTypes,serviceScopeType */
+	struct {
+		exi_string_character_t characters[dinServiceTagType_ServiceScope_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceScope ;
+	unsigned int ServiceScope_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,AC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":PowerSwitchClosed,"urn:iso:15118:2:2010:MsgDataTypes":RCD,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+struct dinAC_EVSEStatusType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":PowerSwitchClosed, http://www.w3.org/2001/XMLSchema,boolean */
+	int PowerSwitchClosed ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":RCD, http://www.w3.org/2001/XMLSchema,boolean */
+	int RCD ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t NotificationMaxDelay ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSENotification, urn:iso:15118:2:2010:MsgDataTypes,EVSENotificationType */
+	dinEVSENotificationType EVSENotification ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ChargingProfileType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":SAScheduleTupleID,"urn:iso:15118:2:2010:MsgDataTypes":ProfileEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinChargingProfileType_ProfileEntry_ARRAY_SIZE 24
+struct dinChargingProfileType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SAScheduleTupleID, urn:iso:15118:2:2010:MsgDataTypes,SAIDType */
+	int16_t SAScheduleTupleID ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ProfileEntry, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ProfileEntryType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ChargingProfileEntryStart,"urn:iso:15118:2:2010:MsgDataTypes":ChargingProfileEntryMaxPower)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct dinProfileEntryType array[dinChargingProfileType_ProfileEntry_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} ProfileEntry;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ServiceDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ServiceScope{0-1},"urn:iso:15118:2:2010:MsgBody":ServiceCategory{0-1})',  derivedBy='EXTENSION'.  */
+#define dinServiceDiscoveryReqType_ServiceScope_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,serviceScopeType is 32 */
+struct dinServiceDiscoveryReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ServiceScope, urn:iso:15118:2:2010:MsgDataTypes,serviceScopeType */
+	struct {
+		exi_string_character_t characters[dinServiceDiscoveryReqType_ServiceScope_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceScope ;
+	unsigned int ServiceScope_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ServiceCategory, urn:iso:15118:2:2010:MsgDataTypes,serviceCategoryType */
+	dinserviceCategoryType ServiceCategory ;
+	unsigned int ServiceCategory_isUsed:1;
+};
+
+typedef enum {
+	dinresponseCodeType_OK = 0,
+	dinresponseCodeType_OK_NewSessionEstablished = 1,
+	dinresponseCodeType_OK_OldSessionJoined = 2,
+	dinresponseCodeType_OK_CertificateExpiresSoon = 3,
+	dinresponseCodeType_FAILED = 4,
+	dinresponseCodeType_FAILED_SequenceError = 5,
+	dinresponseCodeType_FAILED_ServiceIDInvalid = 6,
+	dinresponseCodeType_FAILED_UnknownSession = 7,
+	dinresponseCodeType_FAILED_ServiceSelectionInvalid = 8,
+	dinresponseCodeType_FAILED_PaymentSelectionInvalid = 9,
+	dinresponseCodeType_FAILED_CertificateExpired = 10,
+	dinresponseCodeType_FAILED_SignatureError = 11,
+	dinresponseCodeType_FAILED_NoCertificateAvailable = 12,
+	dinresponseCodeType_FAILED_CertChainError = 13,
+	dinresponseCodeType_FAILED_ChallengeInvalid = 14,
+	dinresponseCodeType_FAILED_ContractCanceled = 15,
+	dinresponseCodeType_FAILED_WrongChargeParameter = 16,
+	dinresponseCodeType_FAILED_PowerDeliveryNotApplied = 17,
+	dinresponseCodeType_FAILED_TariffSelectionInvalid = 18,
+	dinresponseCodeType_FAILED_ChargingProfileInvalid = 19,
+	dinresponseCodeType_FAILED_EVSEPresentVoltageToLow = 20,
+	dinresponseCodeType_FAILED_MeteringSignatureNotValid = 21,
+	dinresponseCodeType_FAILED_WrongEnergyTransferType = 22
+} dinresponseCodeType;
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,AC_EVSEChargeParameterType',  base type name='EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":AC_EVSEStatus,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMaxVoltage,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMaxCurrent,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMinCurrent)',  derivedBy='EXTENSION'.  */
+struct dinAC_EVSEChargeParameterType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":AC_EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,AC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":PowerSwitchClosed,"urn:iso:15118:2:2010:MsgDataTypes":RCD,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+	struct dinAC_EVSEStatusType AC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEMaxVoltage, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMaxVoltage ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEMaxCurrent, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMaxCurrent ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEMinCurrent, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMinCurrent ;
+};
+
+/* 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 dinObjectType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinObjectType_MimeType_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinObjectType_Encoding_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinObjectType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinObjectType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[dinObjectType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* attribute: MimeType {http://www.w3.org/2001/XMLSchema,string} */
+	struct {
+		exi_string_character_t characters[dinObjectType_MimeType_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MimeType ;
+	unsigned int MimeType_isUsed:1;
+	/* attribute: Encoding {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[dinObjectType_Encoding_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Encoding ;
+	unsigned int Encoding_isUsed:1;
+	/* element: WC[##any] */
+	struct {
+		exi_string_character_t characters[dinObjectType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,SessionStopResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode)',  derivedBy='EXTENSION'.  */
+struct dinSessionStopResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+};
+
+/* 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 dinSignedInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinSignedInfoType_Reference_ARRAY_SIZE 1
+struct dinSignedInfoType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[dinSignedInfoType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod, 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'.  */
+	struct dinCanonicalizationMethodType CanonicalizationMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureMethod, 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'.  */
+	struct dinSignatureMethodType SignatureMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Reference, 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'.  */
+	struct {
+		struct dinReferenceType array[dinSignedInfoType_Reference_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Reference;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,CostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":costKind,"urn:iso:15118:2:2010:MsgDataTypes":amount,"urn:iso:15118:2:2010:MsgDataTypes":amountMultiplier{0-1})',  derivedBy='RESTRICTION'.  */
+struct dinCostType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":costKind, urn:iso:15118:2:2010:MsgDataTypes,costKindType */
+	dincostKindType costKind ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":amount, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t amount ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":amountMultiplier, urn:iso:15118:2:2010:MsgDataTypes,unitMultiplierType */
+	int8_t amountMultiplier ;
+	unsigned int amountMultiplier_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceChargeType',  base type name='ServiceType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2010:MsgDataTypes":ServiceTag,"urn:iso:15118:2:2010:MsgDataTypes":FreeService),("urn:iso:15118:2:2010:MsgDataTypes":EnergyTransferType))',  derivedBy='EXTENSION'.  */
+struct dinServiceChargeType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ServiceTag, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceTagType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ServiceID,"urn:iso:15118:2:2010:MsgDataTypes":ServiceName{0-1},"urn:iso:15118:2:2010:MsgDataTypes":ServiceCategory,"urn:iso:15118:2:2010:MsgDataTypes":ServiceScope{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinServiceTagType ServiceTag ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":FreeService, http://www.w3.org/2001/XMLSchema,boolean */
+	int FreeService ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EnergyTransferType, urn:iso:15118:2:2010:MsgDataTypes,EVSESupportedEnergyTransferType */
+	dinEVSESupportedEnergyTransferType EnergyTransferType ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEStatusCode,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+struct dinDC_EVSEStatusType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEIsolationStatus, urn:iso:15118:2:2010:MsgDataTypes,isolationLevelType */
+	dinisolationLevelType EVSEIsolationStatus ;
+	unsigned int EVSEIsolationStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEStatusCode, urn:iso:15118:2:2010:MsgDataTypes,DC_EVSEStatusCodeType */
+	dinDC_EVSEStatusCodeType EVSEStatusCode ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t NotificationMaxDelay ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSENotification, urn:iso:15118:2:2010:MsgDataTypes,EVSENotificationType */
+	dinEVSENotificationType EVSENotification ;
+};
+
+/* 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 dinRetrievalMethodType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinRetrievalMethodType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinRetrievalMethodType {
+	/* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[dinRetrievalMethodType_URI_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  URI ;
+	unsigned int URI_isUsed:1;
+	/* attribute: Type {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[dinRetrievalMethodType_Type_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Type ;
+	unsigned int Type_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transforms, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinTransformsType Transforms ;
+	unsigned int Transforms_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,NotificationType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":FaultCode,"urn:iso:15118:2:2010:MsgDataTypes":FaultMsg{0-1})',  derivedBy='RESTRICTION'.  */
+#define dinNotificationType_FaultMsg_CHARACTERS_SIZE 64 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,faultMsgType is 64 */
+struct dinNotificationType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":FaultCode, urn:iso:15118:2:2010:MsgDataTypes,faultCodeType */
+	dinfaultCodeType FaultCode ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":FaultMsg, urn:iso:15118:2:2010:MsgDataTypes,faultMsgType */
+	struct {
+		exi_string_character_t characters[dinNotificationType_FaultMsg_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  FaultMsg ;
+	unsigned int FaultMsg_isUsed:1;
+};
+
+/* 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 dinPGPDataType_PGPKeyID_BYTES_SIZE 350
+#define dinPGPDataType_PGPKeyPacket_BYTES_SIZE 350
+#define dinPGPDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinPGPDataType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPKeyID, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[dinPGPDataType_PGPKeyID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyID ;
+	unsigned int PGPKeyID_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[dinPGPDataType_PGPKeyPacket_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyPacket ;
+	unsigned int PGPKeyPacket_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[dinPGPDataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 dinSignaturePropertyType_Target_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinSignaturePropertyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinSignaturePropertyType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinSignaturePropertyType {
+	/* attribute: Target {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[dinSignaturePropertyType_Target_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Target ;
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[dinSignaturePropertyType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[dinSignaturePropertyType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":MeterID,"urn:iso:15118:2:2010:MsgDataTypes":MeterReading{0-1},"urn:iso:15118:2:2010:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2010:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2010:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+#define dinMeterInfoType_MeterID_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,meterIDType is 32 */
+#define dinMeterInfoType_SigMeterReading_BYTES_SIZE 32 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,sigMeterReadingType is 32 */
+struct dinMeterInfoType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":MeterID, urn:iso:15118:2:2010:MsgDataTypes,meterIDType */
+	struct {
+		exi_string_character_t characters[dinMeterInfoType_MeterID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MeterID ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":MeterReading, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType MeterReading ;
+	unsigned int MeterReading_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SigMeterReading, urn:iso:15118:2:2010:MsgDataTypes,sigMeterReadingType */
+	struct {
+		uint8_t bytes[dinMeterInfoType_SigMeterReading_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SigMeterReading ;
+	unsigned int SigMeterReading_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":MeterStatus, urn:iso:15118:2:2010:MsgDataTypes,meterStatusType */
+	int16_t MeterStatus ;
+	unsigned int MeterStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":TMeter, http://www.w3.org/2001/XMLSchema,long */
+	int64_t TMeter ;
+	unsigned int TMeter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SubCertificatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Certificate{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinSubCertificatesType_Certificate_BYTES_SIZE 1200 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,certificateType is 1200 */
+#define dinSubCertificatesType_Certificate_ARRAY_SIZE 5
+struct dinSubCertificatesType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":Certificate, urn:iso:15118:2:2010:MsgDataTypes,certificateType */
+	struct {
+		struct {
+			uint8_t bytes[dinSubCertificatesType_Certificate_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[dinSubCertificatesType_Certificate_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Certificate;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,MeteringReceiptReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":SessionID,"urn:iso:15118:2:2010:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2010:MsgBody":MeterInfo)',  derivedBy='EXTENSION'.  */
+#define dinMeteringReceiptReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinMeteringReceiptReqType_SessionID_BYTES_SIZE 8 /* XML schema facet length for urn:iso:15118:2:2010:MsgDataTypes,sessionIDType is 8 */
+struct dinMeteringReceiptReqType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,IDREF} */
+	struct {
+		exi_string_character_t characters[dinMeteringReceiptReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":SessionID, urn:iso:15118:2:2010:MsgDataTypes,sessionIDType */
+	struct {
+		uint8_t bytes[dinMeteringReceiptReqType_SessionID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SessionID ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2010:MsgDataTypes,SAIDType */
+	int16_t SAScheduleTupleID ;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":MeterID,"urn:iso:15118:2:2010:MsgDataTypes":MeterReading{0-1},"urn:iso:15118:2:2010:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2010:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2010:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinMeterInfoType MeterInfo ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,PowerDeliveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgDataTypes":EVSEStatus)',  derivedBy='EXTENSION'.  */
+struct dinPowerDeliveryResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct dinEVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":AC_EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,AC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":PowerSwitchClosed,"urn:iso:15118:2:2010:MsgDataTypes":RCD,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+	struct dinAC_EVSEStatusType AC_EVSEStatus ;
+	unsigned int AC_EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEStatusCode,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVSEStatusType DC_EVSEStatus ;
+	unsigned int DC_EVSEStatus_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,WeldingDetectionResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2010:MsgBody":EVSEPresentVoltage)',  derivedBy='EXTENSION'.  */
+struct dinWeldingDetectionResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEStatusCode,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVSEStatusType DC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEPresentVoltage, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEPresentVoltage ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ContractAuthenticationResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":EVSEProcessing)',  derivedBy='EXTENSION'.  */
+struct dinContractAuthenticationResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEProcessing, urn:iso:15118:2:2010:MsgDataTypes,EVSEProcessingType */
+	dinEVSEProcessingType EVSEProcessing ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SelectedServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":SelectedService{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinSelectedServiceListType_SelectedService_ARRAY_SIZE 16
+struct dinSelectedServiceListType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SelectedService, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SelectedServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ServiceID,"urn:iso:15118:2:2010:MsgDataTypes":ParameterSetID{0-1})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct dinSelectedServiceType array[dinSelectedServiceListType_SelectedService_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SelectedService;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,CurrentDemandResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2010:MsgBody":EVSEPresentVoltage,"urn:iso:15118:2:2010:MsgBody":EVSEPresentCurrent,"urn:iso:15118:2:2010:MsgBody":EVSECurrentLimitAchieved,"urn:iso:15118:2:2010:MsgBody":EVSEVoltageLimitAchieved,"urn:iso:15118:2:2010:MsgBody":EVSEPowerLimitAchieved,"urn:iso:15118:2:2010:MsgBody":EVSEMaximumVoltageLimit{0-1},"urn:iso:15118:2:2010:MsgBody":EVSEMaximumCurrentLimit{0-1},"urn:iso:15118:2:2010:MsgBody":EVSEMaximumPowerLimit{0-1})',  derivedBy='EXTENSION'.  */
+struct dinCurrentDemandResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEStatusCode,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVSEStatusType DC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEPresentVoltage, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEPresentVoltage ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEPresentCurrent, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEPresentCurrent ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSECurrentLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSECurrentLimitAchieved ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEVoltageLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSEVoltageLimitAchieved ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEPowerLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSEPowerLimitAchieved ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEMaximumVoltageLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMaximumVoltageLimit ;
+	unsigned int EVSEMaximumVoltageLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEMaximumCurrentLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMaximumCurrentLimit ;
+	unsigned int EVSEMaximumCurrentLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEMaximumPowerLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMaximumPowerLimit ;
+	unsigned int EVSEMaximumPowerLimit_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,AC_EVChargeParameterType',  base type name='EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":DepartureTime,"urn:iso:15118:2:2010:MsgDataTypes":EAmount,"urn:iso:15118:2:2010:MsgDataTypes":EVMaxVoltage,"urn:iso:15118:2:2010:MsgDataTypes":EVMaxCurrent,"urn:iso:15118:2:2010:MsgDataTypes":EVMinCurrent)',  derivedBy='EXTENSION'.  */
+struct dinAC_EVChargeParameterType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":DepartureTime, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t DepartureTime ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EAmount, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EAmount ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVMaxVoltage, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVMaxVoltage ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVMaxCurrent, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVMaxCurrent ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVMinCurrent, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVMinCurrent ;
+};
+
+/* 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 dinX509DataType_X509IssuerSerial_ARRAY_SIZE 1
+#define dinX509DataType_X509SKI_BYTES_SIZE 350
+#define dinX509DataType_X509SKI_ARRAY_SIZE 1
+#define dinX509DataType_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinX509DataType_X509SubjectName_ARRAY_SIZE 1
+#define dinX509DataType_X509Certificate_BYTES_SIZE 350
+#define dinX509DataType_X509Certificate_ARRAY_SIZE 1
+#define dinX509DataType_X509CRL_BYTES_SIZE 350
+#define dinX509DataType_X509CRL_ARRAY_SIZE 1
+#define dinX509DataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinX509DataType {
+	/* 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 {
+		struct dinX509IssuerSerialType array[dinX509DataType_X509IssuerSerial_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509IssuerSerial;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SKI, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[dinX509DataType_X509SKI_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[dinX509DataType_X509SKI_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509SKI;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SubjectName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[dinX509DataType_X509SubjectName_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[dinX509DataType_X509SubjectName_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509SubjectName;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509Certificate, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[dinX509DataType_X509Certificate_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[dinX509DataType_X509Certificate_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509Certificate;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509CRL, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[dinX509DataType_X509CRL_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[dinX509DataType_X509CRL_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509CRL;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[dinX509DataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ChargingStatusResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":EVSEID,"urn:iso:15118:2:2010:MsgBody":SAScheduleTupleID,"urn:iso:15118:2:2010:MsgBody":EVSEMaxCurrent{0-1},"urn:iso:15118:2:2010:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2010:MsgBody":ReceiptRequired,"urn:iso:15118:2:2010:MsgBody":AC_EVSEStatus)',  derivedBy='EXTENSION'.  */
+#define dinChargingStatusResType_EVSEID_BYTES_SIZE 32 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,evseIDType is 32 */
+struct dinChargingStatusResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEID, urn:iso:15118:2:2010:MsgDataTypes,evseIDType */
+	struct {
+		uint8_t bytes[dinChargingStatusResType_EVSEID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2010:MsgDataTypes,SAIDType */
+	int16_t SAScheduleTupleID ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEMaxCurrent, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMaxCurrent ;
+	unsigned int EVSEMaxCurrent_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":MeterID,"urn:iso:15118:2:2010:MsgDataTypes":MeterReading{0-1},"urn:iso:15118:2:2010:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2010:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2010:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinMeterInfoType MeterInfo ;
+	unsigned int MeterInfo_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ReceiptRequired, http://www.w3.org/2001/XMLSchema,boolean */
+	int ReceiptRequired ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":AC_EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,AC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":PowerSwitchClosed,"urn:iso:15118:2:2010:MsgDataTypes":RCD,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+	struct dinAC_EVSEStatusType AC_EVSEStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,WeldingDetectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":DC_EVStatus)',  derivedBy='EXTENSION'.  */
+struct dinWeldingDetectionReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":DC_EVStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVReady,"urn:iso:15118:2:2010:MsgDataTypes":EVCabinConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVRESSConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2010:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVStatusType DC_EVStatus ;
+};
+
+/* 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 dinSignaturePropertiesType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinSignaturePropertiesType_SignatureProperty_ARRAY_SIZE 1
+struct dinSignaturePropertiesType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[dinSignaturePropertiesType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureProperty, 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'.  */
+	struct {
+		struct dinSignaturePropertyType array[dinSignaturePropertiesType_SignatureProperty_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SignatureProperty;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVPowerDeliveryParameterType',  base type name='EVPowerDeliveryParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":DC_EVStatus,"urn:iso:15118:2:2010:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2010:MsgDataTypes":ChargingComplete)',  derivedBy='EXTENSION'.  */
+struct dinDC_EVPowerDeliveryParameterType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":DC_EVStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVReady,"urn:iso:15118:2:2010:MsgDataTypes":EVCabinConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVRESSConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2010:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVStatusType DC_EVStatus ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":BulkChargingComplete, http://www.w3.org/2001/XMLSchema,boolean */
+	int BulkChargingComplete ;
+	unsigned int BulkChargingComplete_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ChargingComplete, http://www.w3.org/2001/XMLSchema,boolean */
+	int ChargingComplete ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,CableCheckReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":DC_EVStatus)',  derivedBy='EXTENSION'.  */
+struct dinCableCheckReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":DC_EVStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVReady,"urn:iso:15118:2:2010:MsgDataTypes":EVCabinConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVRESSConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2010:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVStatusType DC_EVStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVChargeParameterType',  base type name='EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":DC_EVStatus,"urn:iso:15118:2:2010:MsgDataTypes":EVMaximumCurrentLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVMaximumPowerLimit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVMaximumVoltageLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVEnergyCapacity{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVEnergyRequest{0-1},"urn:iso:15118:2:2010:MsgDataTypes":FullSOC{0-1},"urn:iso:15118:2:2010:MsgDataTypes":BulkSOC{0-1})',  derivedBy='EXTENSION'.  */
+struct dinDC_EVChargeParameterType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":DC_EVStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVReady,"urn:iso:15118:2:2010:MsgDataTypes":EVCabinConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVRESSConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2010:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVStatusType DC_EVStatus ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVMaximumCurrentLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVMaximumCurrentLimit ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVMaximumPowerLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVMaximumPowerLimit ;
+	unsigned int EVMaximumPowerLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVMaximumVoltageLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVMaximumVoltageLimit ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVEnergyCapacity, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVEnergyCapacity ;
+	unsigned int EVEnergyCapacity_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVEnergyRequest, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVEnergyRequest ;
+	unsigned int EVEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":FullSOC, urn:iso:15118:2:2010:MsgDataTypes,percentValueType */
+	int8_t FullSOC ;
+	unsigned int FullSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":BulkSOC, urn:iso:15118:2:2010:MsgDataTypes,percentValueType */
+	int8_t BulkSOC ;
+	unsigned int BulkSOC_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PMaxScheduleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":PMaxScheduleID,"urn:iso:15118:2:2010:MsgDataTypes":PMaxScheduleEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinPMaxScheduleType_PMaxScheduleEntry_ARRAY_SIZE 5
+struct dinPMaxScheduleType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":PMaxScheduleID, urn:iso:15118:2:2010:MsgDataTypes,SAIDType */
+	int16_t PMaxScheduleID ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":PMaxScheduleEntry, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PMaxScheduleEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2010:MsgDataTypes":TimeInterval),("urn:iso:15118:2:2010:MsgDataTypes":PMax))',  derivedBy='EXTENSION'.  */
+	struct {
+		struct dinPMaxScheduleEntryType array[dinPMaxScheduleType_PMaxScheduleEntry_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PMaxScheduleEntry;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ServicePaymentSelectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":SelectedPaymentOption,"urn:iso:15118:2:2010:MsgBody":SelectedServiceList)',  derivedBy='EXTENSION'.  */
+struct dinServicePaymentSelectionReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":SelectedPaymentOption, urn:iso:15118:2:2010:MsgDataTypes,paymentOptionType */
+	dinpaymentOptionType SelectedPaymentOption ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":SelectedServiceList, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SelectedServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":SelectedService{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinSelectedServiceListType SelectedServiceList ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,PreChargeResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2010:MsgBody":EVSEPresentVoltage)',  derivedBy='EXTENSION'.  */
+struct dinPreChargeResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEStatusCode,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVSEStatusType DC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEPresentVoltage, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEPresentVoltage ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVSEChargeParameterType',  base type name='EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":DC_EVSEStatus,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMaximumCurrentLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMaximumPowerLimit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEMaximumVoltageLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMinimumCurrentLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMinimumVoltageLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVSECurrentRegulationTolerance{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEPeakCurrentRipple,"urn:iso:15118:2:2010:MsgDataTypes":EVSEEnergyToBeDelivered{0-1})',  derivedBy='EXTENSION'.  */
+struct dinDC_EVSEChargeParameterType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEStatusCode,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVSEStatusType DC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEMaximumCurrentLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMaximumCurrentLimit ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEMaximumPowerLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMaximumPowerLimit ;
+	unsigned int EVSEMaximumPowerLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEMaximumVoltageLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMaximumVoltageLimit ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEMinimumCurrentLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMinimumCurrentLimit ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEMinimumVoltageLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEMinimumVoltageLimit ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSECurrentRegulationTolerance, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSECurrentRegulationTolerance ;
+	unsigned int EVSECurrentRegulationTolerance_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEPeakCurrentRipple, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEPeakCurrentRipple ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEEnergyToBeDelivered, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVSEEnergyToBeDelivered ;
+	unsigned int EVSEEnergyToBeDelivered_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,PaymentDetailsResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":GenChallenge,"urn:iso:15118:2:2010:MsgBody":DateTimeNow)',  derivedBy='EXTENSION'.  */
+#define dinPaymentDetailsResType_GenChallenge_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinPaymentDetailsResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":GenChallenge, urn:iso:15118:2:2010:MsgDataTypes,genChallengeType */
+	struct {
+		exi_string_character_t characters[dinPaymentDetailsResType_GenChallenge_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  GenChallenge ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":DateTimeNow, http://www.w3.org/2001/XMLSchema,long */
+	int64_t DateTimeNow ;
+};
+
+/* 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 dinKeyValueType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinKeyValueType {
+	/* 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 dinDSAKeyValueType DSAKeyValue ;
+	unsigned int DSAKeyValue_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":RSAKeyValue, 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'.  */
+	struct dinRSAKeyValueType RSAKeyValue ;
+	unsigned int RSAKeyValue_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[dinKeyValueType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,PowerDeliveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ReadyToChargeState,"urn:iso:15118:2:2010:MsgBody":ChargingProfile{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVPowerDeliveryParameter{0-1})',  derivedBy='EXTENSION'.  */
+struct dinPowerDeliveryReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ReadyToChargeState, http://www.w3.org/2001/XMLSchema,boolean */
+	int ReadyToChargeState ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ChargingProfile, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ChargingProfileType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":SAScheduleTupleID,"urn:iso:15118:2:2010:MsgDataTypes":ProfileEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinChargingProfileType ChargingProfile ;
+	unsigned int ChargingProfile_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVPowerDeliveryParameter, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,EVPowerDeliveryParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct dinEVPowerDeliveryParameterType EVPowerDeliveryParameter ;
+	unsigned int EVPowerDeliveryParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":DC_EVPowerDeliveryParameter, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVPowerDeliveryParameterType',  base type name='EVPowerDeliveryParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":DC_EVStatus,"urn:iso:15118:2:2010:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2010:MsgDataTypes":ChargingComplete)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVPowerDeliveryParameterType DC_EVPowerDeliveryParameter ;
+	unsigned int DC_EVPowerDeliveryParameter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Certificate,"urn:iso:15118:2:2010:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+#define dinCertificateChainType_Certificate_BYTES_SIZE 1200 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,certificateType is 1200 */
+struct dinCertificateChainType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":Certificate, urn:iso:15118:2:2010:MsgDataTypes,certificateType */
+	struct {
+		uint8_t bytes[dinCertificateChainType_Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Certificate ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SubCertificates, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SubCertificatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Certificate{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinSubCertificatesType SubCertificates ;
+	unsigned int SubCertificates_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":boolValue|"urn:iso:15118:2:2010:MsgDataTypes":byteValue|"urn:iso:15118:2:2010:MsgDataTypes":shortValue|"urn:iso:15118:2:2010:MsgDataTypes":intValue|"urn:iso:15118:2:2010:MsgDataTypes":physicalValue|"urn:iso:15118:2:2010:MsgDataTypes":stringValue)',  derivedBy='RESTRICTION'.  */
+#define dinParameterType_Name_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinParameterType_stringValue_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinParameterType {
+	/* attribute: Name {http://www.w3.org/2001/XMLSchema,string} */
+	struct {
+		exi_string_character_t characters[dinParameterType_Name_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Name ;
+	/* attribute: ValueType {urn:iso:15118:2:2010:MsgDataTypes,valueType} */
+	dinvalueType ValueType ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":boolValue, http://www.w3.org/2001/XMLSchema,boolean */
+	int boolValue ;
+	unsigned int boolValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":byteValue, http://www.w3.org/2001/XMLSchema,byte */
+	int8_t byteValue ;
+	unsigned int byteValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":shortValue, http://www.w3.org/2001/XMLSchema,short */
+	int16_t shortValue ;
+	unsigned int shortValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":intValue, http://www.w3.org/2001/XMLSchema,int */
+	int32_t intValue ;
+	unsigned int intValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":physicalValue, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType physicalValue ;
+	unsigned int physicalValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":stringValue, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		exi_string_character_t characters[dinParameterType_stringValue_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  stringValue ;
+	unsigned int stringValue_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2010:MsgDataTypes":Parameter{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinParameterSetType_Parameter_ARRAY_SIZE 16
+struct dinParameterSetType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ParameterSetID, http://www.w3.org/2001/XMLSchema,short */
+	int16_t ParameterSetID ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":Parameter, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":boolValue|"urn:iso:15118:2:2010:MsgDataTypes":byteValue|"urn:iso:15118:2:2010:MsgDataTypes":shortValue|"urn:iso:15118:2:2010:MsgDataTypes":intValue|"urn:iso:15118:2:2010:MsgDataTypes":physicalValue|"urn:iso:15118:2:2010:MsgDataTypes":stringValue)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct dinParameterType array[dinParameterSetType_Parameter_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Parameter;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,CurrentDemandReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":DC_EVStatus,"urn:iso:15118:2:2010:MsgBody":EVTargetCurrent,"urn:iso:15118:2:2010:MsgBody":EVMaximumVoltageLimit{0-1},"urn:iso:15118:2:2010:MsgBody":EVMaximumCurrentLimit{0-1},"urn:iso:15118:2:2010:MsgBody":EVMaximumPowerLimit{0-1},"urn:iso:15118:2:2010:MsgBody":BulkChargingComplete{0-1},"urn:iso:15118:2:2010:MsgBody":ChargingComplete,"urn:iso:15118:2:2010:MsgBody":RemainingTimeToFullSoC{0-1},"urn:iso:15118:2:2010:MsgBody":RemainingTimeToBulkSoC{0-1},"urn:iso:15118:2:2010:MsgBody":EVTargetVoltage)',  derivedBy='EXTENSION'.  */
+struct dinCurrentDemandReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":DC_EVStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVReady,"urn:iso:15118:2:2010:MsgDataTypes":EVCabinConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVRESSConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2010:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVStatusType DC_EVStatus ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVTargetCurrent, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVTargetCurrent ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVMaximumVoltageLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVMaximumVoltageLimit ;
+	unsigned int EVMaximumVoltageLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVMaximumCurrentLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVMaximumCurrentLimit ;
+	unsigned int EVMaximumCurrentLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVMaximumPowerLimit, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVMaximumPowerLimit ;
+	unsigned int EVMaximumPowerLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":BulkChargingComplete, http://www.w3.org/2001/XMLSchema,boolean */
+	int BulkChargingComplete ;
+	unsigned int BulkChargingComplete_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ChargingComplete, http://www.w3.org/2001/XMLSchema,boolean */
+	int ChargingComplete ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":RemainingTimeToFullSoC, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType RemainingTimeToFullSoC ;
+	unsigned int RemainingTimeToFullSoC_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":RemainingTimeToBulkSoC, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType RemainingTimeToBulkSoC ;
+	unsigned int RemainingTimeToBulkSoC_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVTargetVoltage, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVTargetVoltage ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,PreChargeReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":DC_EVStatus,"urn:iso:15118:2:2010:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2010:MsgBody":EVTargetCurrent)',  derivedBy='EXTENSION'.  */
+struct dinPreChargeReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":DC_EVStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVReady,"urn:iso:15118:2:2010:MsgDataTypes":EVCabinConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVRESSConditioning{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2010:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVStatusType DC_EVStatus ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVTargetVoltage, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVTargetVoltage ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVTargetCurrent, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Multiplier,"urn:iso:15118:2:2010:MsgDataTypes":Unit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct dinPhysicalValueType EVTargetCurrent ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ChargeParameterDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":EVRequestedEnergyTransferType,"urn:iso:15118:2:2010:MsgDataTypes":EVChargeParameter)',  derivedBy='EXTENSION'.  */
+struct dinChargeParameterDiscoveryReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVRequestedEnergyTransferType, urn:iso:15118:2:2010:MsgDataTypes,EVRequestedEnergyTransferType */
+	dinEVRequestedEnergyTransferType EVRequestedEnergyTransferType ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVChargeParameter, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,EVChargeParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct dinEVChargeParameterType EVChargeParameter ;
+	unsigned int EVChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":AC_EVChargeParameter, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,AC_EVChargeParameterType',  base type name='EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":DepartureTime,"urn:iso:15118:2:2010:MsgDataTypes":EAmount,"urn:iso:15118:2:2010:MsgDataTypes":EVMaxVoltage,"urn:iso:15118:2:2010:MsgDataTypes":EVMaxCurrent,"urn:iso:15118:2:2010:MsgDataTypes":EVMinCurrent)',  derivedBy='EXTENSION'.  */
+	struct dinAC_EVChargeParameterType AC_EVChargeParameter ;
+	unsigned int AC_EVChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":DC_EVChargeParameter, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVChargeParameterType',  base type name='EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":DC_EVStatus,"urn:iso:15118:2:2010:MsgDataTypes":EVMaximumCurrentLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVMaximumPowerLimit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVMaximumVoltageLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVEnergyCapacity{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVEnergyRequest{0-1},"urn:iso:15118:2:2010:MsgDataTypes":FullSOC{0-1},"urn:iso:15118:2:2010:MsgDataTypes":BulkSOC{0-1})',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVChargeParameterType DC_EVChargeParameter ;
+	unsigned int DC_EVChargeParameter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ConsumptionCostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":startValue,"urn:iso:15118:2:2010:MsgDataTypes":Cost{0-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinConsumptionCostType_Cost_ARRAY_SIZE 5
+struct dinConsumptionCostType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":startValue, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t startValue ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":Cost, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,CostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":costKind,"urn:iso:15118:2:2010:MsgDataTypes":amount,"urn:iso:15118:2:2010:MsgDataTypes":amountMultiplier{0-1})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct dinCostType array[dinConsumptionCostType_Cost_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Cost;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ServiceTag,"urn:iso:15118:2:2010:MsgDataTypes":FreeService)',  derivedBy='RESTRICTION'.  */
+struct dinServiceType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ServiceTag, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceTagType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ServiceID,"urn:iso:15118:2:2010:MsgDataTypes":ServiceName{0-1},"urn:iso:15118:2:2010:MsgDataTypes":ServiceCategory,"urn:iso:15118:2:2010:MsgDataTypes":ServiceScope{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinServiceTagType ServiceTag ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":FreeService, http://www.w3.org/2001/XMLSchema,boolean */
+	int FreeService ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceTagListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Service{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinServiceTagListType_Service_ARRAY_SIZE 8
+struct dinServiceTagListType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":Service, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ServiceTag,"urn:iso:15118:2:2010:MsgDataTypes":FreeService)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct dinServiceType array[dinServiceTagListType_Service_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Service;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,SessionSetupResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":EVSEID,"urn:iso:15118:2:2010:MsgBody":DateTimeNow{0-1})',  derivedBy='EXTENSION'.  */
+#define dinSessionSetupResType_EVSEID_BYTES_SIZE 32 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,evseIDType is 32 */
+struct dinSessionSetupResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEID, urn:iso:15118:2:2010:MsgDataTypes,evseIDType */
+	struct {
+		uint8_t bytes[dinSessionSetupResType_EVSEID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":DateTimeNow, http://www.w3.org/2001/XMLSchema,long */
+	int64_t DateTimeNow ;
+	unsigned int DateTimeNow_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,MeteringReceiptResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":AC_EVSEStatus)',  derivedBy='EXTENSION'.  */
+struct dinMeteringReceiptResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":AC_EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,AC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":PowerSwitchClosed,"urn:iso:15118:2:2010:MsgDataTypes":RCD,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+	struct dinAC_EVSEStatusType AC_EVSEStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceParameterListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ParameterSet{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinServiceParameterListType_ParameterSet_ARRAY_SIZE 5
+struct dinServiceParameterListType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ParameterSet, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2010:MsgDataTypes":Parameter{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct dinParameterSetType array[dinServiceParameterListType_ParameterSet_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} ParameterSet;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,CertificateUpdateReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2010:MsgBody":ContractID,"urn:iso:15118:2:2010:MsgBody":ListOfRootCertificateIDs,"urn:iso:15118:2:2010:MsgBody":DHParams)',  derivedBy='EXTENSION'.  */
+#define dinCertificateUpdateReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinCertificateUpdateReqType_ContractID_CHARACTERS_SIZE 24 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,contractIDType is 24 */
+#define dinCertificateUpdateReqType_DHParams_BYTES_SIZE 256 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,dHParamsType is 256 */
+struct dinCertificateUpdateReqType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,IDREF} */
+	struct {
+		exi_string_character_t characters[dinCertificateUpdateReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Certificate,"urn:iso:15118:2:2010:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinCertificateChainType ContractSignatureCertChain ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ContractID, urn:iso:15118:2:2010:MsgDataTypes,contractIDType */
+	struct {
+		exi_string_character_t characters[dinCertificateUpdateReqType_ContractID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ContractID ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ListOfRootCertificateIDs, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ListOfRootCertificateIDsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":RootCertificateID{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinListOfRootCertificateIDsType ListOfRootCertificateIDs ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":DHParams, urn:iso:15118:2:2010:MsgDataTypes,dHParamsType */
+	struct {
+		uint8_t bytes[dinCertificateUpdateReqType_DHParams_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DHParams ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ServicePaymentSelectionResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode)',  derivedBy='EXTENSION'.  */
+struct dinServicePaymentSelectionResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+};
+
+/* 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 dinKeyInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinKeyInfoType_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinKeyInfoType_KeyName_ARRAY_SIZE 1
+#define dinKeyInfoType_KeyValue_ARRAY_SIZE 1
+#define dinKeyInfoType_RetrievalMethod_ARRAY_SIZE 1
+#define dinKeyInfoType_X509Data_ARRAY_SIZE 1
+#define dinKeyInfoType_PGPData_ARRAY_SIZE 1
+#define dinKeyInfoType_SPKIData_ARRAY_SIZE 1
+#define dinKeyInfoType_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinKeyInfoType_MgmtData_ARRAY_SIZE 1
+#define dinKeyInfoType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct dinKeyInfoType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[dinKeyInfoType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[dinKeyInfoType_KeyName_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[dinKeyInfoType_KeyName_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} KeyName;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyValue, 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'.  */
+	struct {
+		struct dinKeyValueType array[dinKeyInfoType_KeyValue_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} KeyValue;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":RetrievalMethod, 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'.  */
+	struct {
+		struct dinRetrievalMethodType array[dinKeyInfoType_RetrievalMethod_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} RetrievalMethod;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509Data, 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'.  */
+	struct {
+		struct dinX509DataType array[dinKeyInfoType_X509Data_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509Data;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPData, 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'.  */
+	struct {
+		struct dinPGPDataType array[dinKeyInfoType_PGPData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PGPData;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SPKIData, 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'.  */
+	struct {
+		struct dinSPKIDataType array[dinKeyInfoType_SPKIData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SPKIData;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":MgmtData, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[dinKeyInfoType_MgmtData_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[dinKeyInfoType_MgmtData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} MgmtData;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[dinKeyInfoType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,PaymentDetailsReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ContractID,"urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain)',  derivedBy='EXTENSION'.  */
+#define dinPaymentDetailsReqType_ContractID_CHARACTERS_SIZE 24 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,contractIDType is 24 */
+struct dinPaymentDetailsReqType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ContractID, urn:iso:15118:2:2010:MsgDataTypes,contractIDType */
+	struct {
+		exi_string_character_t characters[dinPaymentDetailsReqType_ContractID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ContractID ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Certificate,"urn:iso:15118:2:2010:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinCertificateChainType ContractSignatureCertChain ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,CableCheckResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2010:MsgBody":EVSEProcessing)',  derivedBy='EXTENSION'.  */
+struct dinCableCheckResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEStatusCode,"urn:iso:15118:2:2010:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2010:MsgDataTypes":EVSENotification)',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVSEStatusType DC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEProcessing, urn:iso:15118:2:2010:MsgDataTypes,EVSEProcessingType */
+	dinEVSEProcessingType EVSEProcessing ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,CertificateInstallationResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2010:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2010:MsgBody":DHParams,"urn:iso:15118:2:2010:MsgBody":ContractID)',  derivedBy='EXTENSION'.  */
+#define dinCertificateInstallationResType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinCertificateInstallationResType_ContractSignatureEncryptedPrivateKey_BYTES_SIZE 128 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,privateKeyType is 128 */
+#define dinCertificateInstallationResType_DHParams_BYTES_SIZE 256 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,dHParamsType is 256 */
+#define dinCertificateInstallationResType_ContractID_CHARACTERS_SIZE 24 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,contractIDType is 24 */
+struct dinCertificateInstallationResType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,IDREF} */
+	struct {
+		exi_string_character_t characters[dinCertificateInstallationResType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Certificate,"urn:iso:15118:2:2010:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinCertificateChainType ContractSignatureCertChain ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ContractSignatureEncryptedPrivateKey, urn:iso:15118:2:2010:MsgDataTypes,privateKeyType */
+	struct {
+		uint8_t bytes[dinCertificateInstallationResType_ContractSignatureEncryptedPrivateKey_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  ContractSignatureEncryptedPrivateKey ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":DHParams, urn:iso:15118:2:2010:MsgDataTypes,dHParamsType */
+	struct {
+		uint8_t bytes[dinCertificateInstallationResType_DHParams_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DHParams ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ContractID, urn:iso:15118:2:2010:MsgDataTypes,contractIDType */
+	struct {
+		exi_string_character_t characters[dinCertificateInstallationResType_ContractID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ContractID ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ServiceDetailResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":ServiceID,"urn:iso:15118:2:2010:MsgBody":ServiceParameterList{0-1})',  derivedBy='EXTENSION'.  */
+struct dinServiceDetailResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ServiceID, urn:iso:15118:2:2010:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ServiceParameterList, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceParameterListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":ParameterSet{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinServiceParameterListType ServiceParameterList ;
+	unsigned int ServiceParameterList_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,CertificateUpdateResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2010:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2010:MsgBody":DHParams,"urn:iso:15118:2:2010:MsgBody":ContractID,"urn:iso:15118:2:2010:MsgBody":RetryCounter)',  derivedBy='EXTENSION'.  */
+#define dinCertificateUpdateResType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinCertificateUpdateResType_ContractSignatureEncryptedPrivateKey_BYTES_SIZE 128 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,privateKeyType is 128 */
+#define dinCertificateUpdateResType_DHParams_BYTES_SIZE 256 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,dHParamsType is 256 */
+#define dinCertificateUpdateResType_ContractID_CHARACTERS_SIZE 24 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,contractIDType is 24 */
+struct dinCertificateUpdateResType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,IDREF} */
+	struct {
+		exi_string_character_t characters[dinCertificateUpdateResType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Certificate,"urn:iso:15118:2:2010:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinCertificateChainType ContractSignatureCertChain ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ContractSignatureEncryptedPrivateKey, urn:iso:15118:2:2010:MsgDataTypes,privateKeyType */
+	struct {
+		uint8_t bytes[dinCertificateUpdateResType_ContractSignatureEncryptedPrivateKey_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  ContractSignatureEncryptedPrivateKey ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":DHParams, urn:iso:15118:2:2010:MsgDataTypes,dHParamsType */
+	struct {
+		uint8_t bytes[dinCertificateUpdateResType_DHParams_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DHParams ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ContractID, urn:iso:15118:2:2010:MsgDataTypes,contractIDType */
+	struct {
+		exi_string_character_t characters[dinCertificateUpdateResType_ContractID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ContractID ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":RetryCounter, http://www.w3.org/2001/XMLSchema,short */
+	int16_t RetryCounter ;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SalesTariffEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2010:MsgDataTypes":TimeInterval),("urn:iso:15118:2:2010:MsgDataTypes":EPriceLevel,"urn:iso:15118:2:2010:MsgDataTypes":ConsumptionCost{0-UNBOUNDED}))',  derivedBy='EXTENSION'.  */
+#define dinSalesTariffEntryType_ConsumptionCost_ARRAY_SIZE 5
+struct dinSalesTariffEntryType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":TimeInterval, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,IntervalType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct dinIntervalType TimeInterval ;
+	unsigned int TimeInterval_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":RelativeTimeInterval, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,RelativeTimeIntervalType',  base type name='IntervalType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":start,"urn:iso:15118:2:2010:MsgDataTypes":duration{0-1})',  derivedBy='EXTENSION'.  */
+	struct dinRelativeTimeIntervalType RelativeTimeInterval ;
+	unsigned int RelativeTimeInterval_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EPriceLevel, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t EPriceLevel ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":ConsumptionCost, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ConsumptionCostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":startValue,"urn:iso:15118:2:2010:MsgDataTypes":Cost{0-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct dinConsumptionCostType array[dinSalesTariffEntryType_ConsumptionCost_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} ConsumptionCost;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ServiceDiscoveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":PaymentOptions,"urn:iso:15118:2:2010:MsgBody":ChargeService,"urn:iso:15118:2:2010:MsgBody":ServiceList{0-1})',  derivedBy='EXTENSION'.  */
+struct dinServiceDiscoveryResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":PaymentOptions, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PaymentOptionsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":PaymentOption{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinPaymentOptionsType PaymentOptions ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ChargeService, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceChargeType',  base type name='ServiceType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2010:MsgDataTypes":ServiceTag,"urn:iso:15118:2:2010:MsgDataTypes":FreeService),("urn:iso:15118:2:2010:MsgDataTypes":EnergyTransferType))',  derivedBy='EXTENSION'.  */
+	struct dinServiceChargeType ChargeService ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":ServiceList, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,ServiceTagListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":Service{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinServiceTagListType ServiceList ;
+	unsigned int ServiceList_isUsed:1;
+};
+
+/* 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 dinSignatureType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinSignatureType_Object_ARRAY_SIZE 1
+struct dinSignatureType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[dinSignatureType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignedInfo, 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'.  */
+	struct dinSignedInfoType SignedInfo ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureValue, 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'.  */
+	struct dinSignatureValueType SignatureValue ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyInfo, 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'.  */
+	struct dinKeyInfoType KeyInfo ;
+	unsigned int KeyInfo_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Object, 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'.  */
+	struct {
+		struct dinObjectType array[dinSignatureType_Object_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Object;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SalesTariffType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":SalesTariffID,"urn:iso:15118:2:2010:MsgDataTypes":SalesTariffDescription{0-1},"urn:iso:15118:2:2010:MsgDataTypes":NumEPriceLevels,"urn:iso:15118:2:2010:MsgDataTypes":SalesTariffEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define dinSalesTariffType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinSalesTariffType_SalesTariffDescription_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,tariffDescriptionType is 32 */
+#define dinSalesTariffType_SalesTariffEntry_ARRAY_SIZE 5
+struct dinSalesTariffType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,IDREF} */
+	struct {
+		exi_string_character_t characters[dinSalesTariffType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SalesTariffID, urn:iso:15118:2:2010:MsgDataTypes,SAIDType */
+	int16_t SalesTariffID ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SalesTariffDescription, urn:iso:15118:2:2010:MsgDataTypes,tariffDescriptionType */
+	struct {
+		exi_string_character_t characters[dinSalesTariffType_SalesTariffDescription_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  SalesTariffDescription ;
+	unsigned int SalesTariffDescription_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":NumEPriceLevels, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t NumEPriceLevels ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SalesTariffEntry, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SalesTariffEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2010:MsgDataTypes":TimeInterval),("urn:iso:15118:2:2010:MsgDataTypes":EPriceLevel,"urn:iso:15118:2:2010:MsgDataTypes":ConsumptionCost{0-UNBOUNDED}))',  derivedBy='EXTENSION'.  */
+	struct {
+		struct dinSalesTariffEntryType array[dinSalesTariffType_SalesTariffEntry_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SalesTariffEntry;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgHeader,MessageHeaderType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgHeader":SessionID,"urn:iso:15118:2:2010:MsgHeader":Notification{0-1},"http://www.w3.org/2000/09/xmldsig#":Signature{0-1})',  derivedBy='RESTRICTION'.  */
+#define dinMessageHeaderType_SessionID_BYTES_SIZE 8 /* XML schema facet length for urn:iso:15118:2:2010:MsgDataTypes,sessionIDType is 8 */
+struct dinMessageHeaderType {
+	/* element: "urn:iso:15118:2:2010:MsgHeader":SessionID, urn:iso:15118:2:2010:MsgDataTypes,sessionIDType */
+	struct {
+		uint8_t bytes[dinMessageHeaderType_SessionID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SessionID ;
+	/* element: "urn:iso:15118:2:2010:MsgHeader":Notification, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,NotificationType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":FaultCode,"urn:iso:15118:2:2010:MsgDataTypes":FaultMsg{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinNotificationType Notification ;
+	unsigned int Notification_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Signature, 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'.  */
+	struct dinSignatureType Signature ;
+	unsigned int Signature_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SAScheduleTupleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":SAScheduleTupleID,"urn:iso:15118:2:2010:MsgDataTypes":PMaxSchedule,"urn:iso:15118:2:2010:MsgDataTypes":SalesTariff{0-1})',  derivedBy='RESTRICTION'.  */
+struct dinSAScheduleTupleType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SAScheduleTupleID, urn:iso:15118:2:2010:MsgDataTypes,SAIDType */
+	int16_t SAScheduleTupleID ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":PMaxSchedule, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,PMaxScheduleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":PMaxScheduleID,"urn:iso:15118:2:2010:MsgDataTypes":PMaxScheduleEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinPMaxScheduleType PMaxSchedule ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SalesTariff, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SalesTariffType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":SalesTariffID,"urn:iso:15118:2:2010:MsgDataTypes":SalesTariffDescription{0-1},"urn:iso:15118:2:2010:MsgDataTypes":NumEPriceLevels,"urn:iso:15118:2:2010:MsgDataTypes":SalesTariffEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct dinSalesTariffType SalesTariff ;
+	unsigned int SalesTariff_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SAScheduleListType',  base type name='SASchedulesType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":SAScheduleTuple{1-UNBOUNDED})',  derivedBy='EXTENSION'.  */
+#define dinSAScheduleListType_SAScheduleTuple_ARRAY_SIZE 5
+struct dinSAScheduleListType {
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SAScheduleTuple, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SAScheduleTupleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":SAScheduleTupleID,"urn:iso:15118:2:2010:MsgDataTypes":PMaxSchedule,"urn:iso:15118:2:2010:MsgDataTypes":SalesTariff{0-1})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct dinSAScheduleTupleType array[dinSAScheduleListType_SAScheduleTuple_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SAScheduleTuple;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgBody,ChargeParameterDiscoveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":EVSEProcessing,"urn:iso:15118:2:2010:MsgDataTypes":SASchedules,"urn:iso:15118:2:2010:MsgDataTypes":EVSEChargeParameter)',  derivedBy='EXTENSION'.  */
+struct dinChargeParameterDiscoveryResType {
+	/* element: "urn:iso:15118:2:2010:MsgBody":ResponseCode, urn:iso:15118:2:2010:MsgDataTypes,responseCodeType */
+	dinresponseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2010:MsgBody":EVSEProcessing, urn:iso:15118:2:2010:MsgDataTypes,EVSEProcessingType */
+	dinEVSEProcessingType EVSEProcessing ;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SASchedules, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SASchedulesType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct dinSASchedulesType SASchedules ;
+	unsigned int SASchedules_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":SAScheduleList, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,SAScheduleListType',  base type name='SASchedulesType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":SAScheduleTuple{1-UNBOUNDED})',  derivedBy='EXTENSION'.  */
+	struct dinSAScheduleListType SAScheduleList ;
+	unsigned int SAScheduleList_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":EVSEChargeParameter, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,EVSEChargeParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct dinEVSEChargeParameterType EVSEChargeParameter ;
+	unsigned int EVSEChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":AC_EVSEChargeParameter, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,AC_EVSEChargeParameterType',  base type name='EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":AC_EVSEStatus,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMaxVoltage,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMaxCurrent,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMinCurrent)',  derivedBy='EXTENSION'.  */
+	struct dinAC_EVSEChargeParameterType AC_EVSEChargeParameter ;
+	unsigned int AC_EVSEChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2010:MsgDataTypes":DC_EVSEChargeParameter, Complex type name='urn:iso:15118:2:2010:MsgDataTypes,DC_EVSEChargeParameterType',  base type name='EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDataTypes":DC_EVSEStatus,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMaximumCurrentLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMaximumPowerLimit{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEMaximumVoltageLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMinimumCurrentLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVSEMinimumVoltageLimit,"urn:iso:15118:2:2010:MsgDataTypes":EVSECurrentRegulationTolerance{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVSEPeakCurrentRipple,"urn:iso:15118:2:2010:MsgDataTypes":EVSEEnergyToBeDelivered{0-1})',  derivedBy='EXTENSION'.  */
+	struct dinDC_EVSEChargeParameterType DC_EVSEChargeParameter ;
+	unsigned int DC_EVSEChargeParameter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDef,BodyType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDef":BodyElement{0-1})',  derivedBy='RESTRICTION'.  */
+struct dinBodyType {
+	/* substitutionGroup */
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+		/* element: "urn:iso:15118:2:2010:MsgDef":BodyElement, Complex type name='urn:iso:15118:2:2010:MsgDef,BodyBaseType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+		struct dinBodyBaseType BodyElement ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":SessionSetupReq, Complex type name='urn:iso:15118:2:2010:MsgBody,SessionSetupReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":EVCCID)',  derivedBy='EXTENSION'.  */
+		struct dinSessionSetupReqType SessionSetupReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":SessionSetupRes, Complex type name='urn:iso:15118:2:2010:MsgBody,SessionSetupResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":EVSEID,"urn:iso:15118:2:2010:MsgBody":DateTimeNow{0-1})',  derivedBy='EXTENSION'.  */
+		struct dinSessionSetupResType SessionSetupRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ServiceDiscoveryReq, Complex type name='urn:iso:15118:2:2010:MsgBody,ServiceDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ServiceScope{0-1},"urn:iso:15118:2:2010:MsgBody":ServiceCategory{0-1})',  derivedBy='EXTENSION'.  */
+		struct dinServiceDiscoveryReqType ServiceDiscoveryReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ServiceDiscoveryRes, Complex type name='urn:iso:15118:2:2010:MsgBody,ServiceDiscoveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":PaymentOptions,"urn:iso:15118:2:2010:MsgBody":ChargeService,"urn:iso:15118:2:2010:MsgBody":ServiceList{0-1})',  derivedBy='EXTENSION'.  */
+		struct dinServiceDiscoveryResType ServiceDiscoveryRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ServiceDetailReq, Complex type name='urn:iso:15118:2:2010:MsgBody,ServiceDetailReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ServiceID)',  derivedBy='EXTENSION'.  */
+		struct dinServiceDetailReqType ServiceDetailReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ServiceDetailRes, Complex type name='urn:iso:15118:2:2010:MsgBody,ServiceDetailResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":ServiceID,"urn:iso:15118:2:2010:MsgBody":ServiceParameterList{0-1})',  derivedBy='EXTENSION'.  */
+		struct dinServiceDetailResType ServiceDetailRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ServicePaymentSelectionReq, Complex type name='urn:iso:15118:2:2010:MsgBody,ServicePaymentSelectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":SelectedPaymentOption,"urn:iso:15118:2:2010:MsgBody":SelectedServiceList)',  derivedBy='EXTENSION'.  */
+		struct dinServicePaymentSelectionReqType ServicePaymentSelectionReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ServicePaymentSelectionRes, Complex type name='urn:iso:15118:2:2010:MsgBody,ServicePaymentSelectionResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode)',  derivedBy='EXTENSION'.  */
+		struct dinServicePaymentSelectionResType ServicePaymentSelectionRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":PaymentDetailsReq, Complex type name='urn:iso:15118:2:2010:MsgBody,PaymentDetailsReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ContractID,"urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain)',  derivedBy='EXTENSION'.  */
+		struct dinPaymentDetailsReqType PaymentDetailsReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":PaymentDetailsRes, Complex type name='urn:iso:15118:2:2010:MsgBody,PaymentDetailsResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":GenChallenge,"urn:iso:15118:2:2010:MsgBody":DateTimeNow)',  derivedBy='EXTENSION'.  */
+		struct dinPaymentDetailsResType PaymentDetailsRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ContractAuthenticationReq, Complex type name='urn:iso:15118:2:2010:MsgBody,ContractAuthenticationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":GenChallenge{0-1})',  derivedBy='EXTENSION'.  */
+		struct dinContractAuthenticationReqType ContractAuthenticationReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ContractAuthenticationRes, Complex type name='urn:iso:15118:2:2010:MsgBody,ContractAuthenticationResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":EVSEProcessing)',  derivedBy='EXTENSION'.  */
+		struct dinContractAuthenticationResType ContractAuthenticationRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ChargeParameterDiscoveryReq, Complex type name='urn:iso:15118:2:2010:MsgBody,ChargeParameterDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":EVRequestedEnergyTransferType,"urn:iso:15118:2:2010:MsgDataTypes":EVChargeParameter)',  derivedBy='EXTENSION'.  */
+		struct dinChargeParameterDiscoveryReqType ChargeParameterDiscoveryReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ChargeParameterDiscoveryRes, Complex type name='urn:iso:15118:2:2010:MsgBody,ChargeParameterDiscoveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":EVSEProcessing,"urn:iso:15118:2:2010:MsgDataTypes":SASchedules,"urn:iso:15118:2:2010:MsgDataTypes":EVSEChargeParameter)',  derivedBy='EXTENSION'.  */
+		struct dinChargeParameterDiscoveryResType ChargeParameterDiscoveryRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":PowerDeliveryReq, Complex type name='urn:iso:15118:2:2010:MsgBody,PowerDeliveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ReadyToChargeState,"urn:iso:15118:2:2010:MsgBody":ChargingProfile{0-1},"urn:iso:15118:2:2010:MsgDataTypes":EVPowerDeliveryParameter{0-1})',  derivedBy='EXTENSION'.  */
+		struct dinPowerDeliveryReqType PowerDeliveryReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":PowerDeliveryRes, Complex type name='urn:iso:15118:2:2010:MsgBody,PowerDeliveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgDataTypes":EVSEStatus)',  derivedBy='EXTENSION'.  */
+		struct dinPowerDeliveryResType PowerDeliveryRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ChargingStatusReq, Complex type name='urn:iso:15118:2:2010:MsgBody,ChargingStatusReqType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+		struct dinChargingStatusReqType ChargingStatusReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":ChargingStatusRes, Complex type name='urn:iso:15118:2:2010:MsgBody,ChargingStatusResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":EVSEID,"urn:iso:15118:2:2010:MsgBody":SAScheduleTupleID,"urn:iso:15118:2:2010:MsgBody":EVSEMaxCurrent{0-1},"urn:iso:15118:2:2010:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2010:MsgBody":ReceiptRequired,"urn:iso:15118:2:2010:MsgBody":AC_EVSEStatus)',  derivedBy='EXTENSION'.  */
+		struct dinChargingStatusResType ChargingStatusRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":MeteringReceiptReq, Complex type name='urn:iso:15118:2:2010:MsgBody,MeteringReceiptReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":SessionID,"urn:iso:15118:2:2010:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2010:MsgBody":MeterInfo)',  derivedBy='EXTENSION'.  */
+		struct dinMeteringReceiptReqType MeteringReceiptReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":MeteringReceiptRes, Complex type name='urn:iso:15118:2:2010:MsgBody,MeteringReceiptResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":AC_EVSEStatus)',  derivedBy='EXTENSION'.  */
+		struct dinMeteringReceiptResType MeteringReceiptRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":SessionStopReq, Complex type name='urn:iso:15118:2:2010:MsgBody,SessionStopType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+		struct dinSessionStopType SessionStopReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":SessionStopRes, Complex type name='urn:iso:15118:2:2010:MsgBody,SessionStopResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode)',  derivedBy='EXTENSION'.  */
+		struct dinSessionStopResType SessionStopRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":CertificateUpdateReq, Complex type name='urn:iso:15118:2:2010:MsgBody,CertificateUpdateReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2010:MsgBody":ContractID,"urn:iso:15118:2:2010:MsgBody":ListOfRootCertificateIDs,"urn:iso:15118:2:2010:MsgBody":DHParams)',  derivedBy='EXTENSION'.  */
+		struct dinCertificateUpdateReqType CertificateUpdateReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":CertificateUpdateRes, Complex type name='urn:iso:15118:2:2010:MsgBody,CertificateUpdateResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2010:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2010:MsgBody":DHParams,"urn:iso:15118:2:2010:MsgBody":ContractID,"urn:iso:15118:2:2010:MsgBody":RetryCounter)',  derivedBy='EXTENSION'.  */
+		struct dinCertificateUpdateResType CertificateUpdateRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":CertificateInstallationReq, Complex type name='urn:iso:15118:2:2010:MsgBody,CertificateInstallationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":OEMProvisioningCert,"urn:iso:15118:2:2010:MsgBody":ListOfRootCertificateIDs,"urn:iso:15118:2:2010:MsgBody":DHParams)',  derivedBy='EXTENSION'.  */
+		struct dinCertificateInstallationReqType CertificateInstallationReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":CertificateInstallationRes, Complex type name='urn:iso:15118:2:2010:MsgBody,CertificateInstallationResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2010:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2010:MsgBody":DHParams,"urn:iso:15118:2:2010:MsgBody":ContractID)',  derivedBy='EXTENSION'.  */
+		struct dinCertificateInstallationResType CertificateInstallationRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":CableCheckReq, Complex type name='urn:iso:15118:2:2010:MsgBody,CableCheckReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":DC_EVStatus)',  derivedBy='EXTENSION'.  */
+		struct dinCableCheckReqType CableCheckReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":CableCheckRes, Complex type name='urn:iso:15118:2:2010:MsgBody,CableCheckResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2010:MsgBody":EVSEProcessing)',  derivedBy='EXTENSION'.  */
+		struct dinCableCheckResType CableCheckRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":PreChargeReq, Complex type name='urn:iso:15118:2:2010:MsgBody,PreChargeReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":DC_EVStatus,"urn:iso:15118:2:2010:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2010:MsgBody":EVTargetCurrent)',  derivedBy='EXTENSION'.  */
+		struct dinPreChargeReqType PreChargeReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":PreChargeRes, Complex type name='urn:iso:15118:2:2010:MsgBody,PreChargeResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2010:MsgBody":EVSEPresentVoltage)',  derivedBy='EXTENSION'.  */
+		struct dinPreChargeResType PreChargeRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":CurrentDemandReq, Complex type name='urn:iso:15118:2:2010:MsgBody,CurrentDemandReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":DC_EVStatus,"urn:iso:15118:2:2010:MsgBody":EVTargetCurrent,"urn:iso:15118:2:2010:MsgBody":EVMaximumVoltageLimit{0-1},"urn:iso:15118:2:2010:MsgBody":EVMaximumCurrentLimit{0-1},"urn:iso:15118:2:2010:MsgBody":EVMaximumPowerLimit{0-1},"urn:iso:15118:2:2010:MsgBody":BulkChargingComplete{0-1},"urn:iso:15118:2:2010:MsgBody":ChargingComplete,"urn:iso:15118:2:2010:MsgBody":RemainingTimeToFullSoC{0-1},"urn:iso:15118:2:2010:MsgBody":RemainingTimeToBulkSoC{0-1},"urn:iso:15118:2:2010:MsgBody":EVTargetVoltage)',  derivedBy='EXTENSION'.  */
+		struct dinCurrentDemandReqType CurrentDemandReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":CurrentDemandRes, Complex type name='urn:iso:15118:2:2010:MsgBody,CurrentDemandResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2010:MsgBody":EVSEPresentVoltage,"urn:iso:15118:2:2010:MsgBody":EVSEPresentCurrent,"urn:iso:15118:2:2010:MsgBody":EVSECurrentLimitAchieved,"urn:iso:15118:2:2010:MsgBody":EVSEVoltageLimitAchieved,"urn:iso:15118:2:2010:MsgBody":EVSEPowerLimitAchieved,"urn:iso:15118:2:2010:MsgBody":EVSEMaximumVoltageLimit{0-1},"urn:iso:15118:2:2010:MsgBody":EVSEMaximumCurrentLimit{0-1},"urn:iso:15118:2:2010:MsgBody":EVSEMaximumPowerLimit{0-1})',  derivedBy='EXTENSION'.  */
+		struct dinCurrentDemandResType CurrentDemandRes ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":WeldingDetectionReq, Complex type name='urn:iso:15118:2:2010:MsgBody,WeldingDetectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":DC_EVStatus)',  derivedBy='EXTENSION'.  */
+		struct dinWeldingDetectionReqType WeldingDetectionReq ;
+		/* element: "urn:iso:15118:2:2010:MsgBody":WeldingDetectionRes, Complex type name='urn:iso:15118:2:2010:MsgBody,WeldingDetectionResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgBody":ResponseCode,"urn:iso:15118:2:2010:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2010:MsgBody":EVSEPresentVoltage)',  derivedBy='EXTENSION'.  */
+		struct dinWeldingDetectionResType WeldingDetectionRes ;
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	};
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+		unsigned int BodyElement_isUsed:1;
+		unsigned int SessionSetupReq_isUsed:1;
+		unsigned int SessionSetupRes_isUsed:1;
+		unsigned int ServiceDiscoveryReq_isUsed:1;
+		unsigned int ServiceDiscoveryRes_isUsed:1;
+		unsigned int ServiceDetailReq_isUsed:1;
+		unsigned int ServiceDetailRes_isUsed:1;
+		unsigned int ServicePaymentSelectionReq_isUsed:1;
+		unsigned int ServicePaymentSelectionRes_isUsed:1;
+		unsigned int PaymentDetailsReq_isUsed:1;
+		unsigned int PaymentDetailsRes_isUsed:1;
+		unsigned int ContractAuthenticationReq_isUsed:1;
+		unsigned int ContractAuthenticationRes_isUsed:1;
+		unsigned int ChargeParameterDiscoveryReq_isUsed:1;
+		unsigned int ChargeParameterDiscoveryRes_isUsed:1;
+		unsigned int PowerDeliveryReq_isUsed:1;
+		unsigned int PowerDeliveryRes_isUsed:1;
+		unsigned int ChargingStatusReq_isUsed:1;
+		unsigned int ChargingStatusRes_isUsed:1;
+		unsigned int MeteringReceiptReq_isUsed:1;
+		unsigned int MeteringReceiptRes_isUsed:1;
+		unsigned int SessionStopReq_isUsed:1;
+		unsigned int SessionStopRes_isUsed:1;
+		unsigned int CertificateUpdateReq_isUsed:1;
+		unsigned int CertificateUpdateRes_isUsed:1;
+		unsigned int CertificateInstallationReq_isUsed:1;
+		unsigned int CertificateInstallationRes_isUsed:1;
+		unsigned int CableCheckReq_isUsed:1;
+		unsigned int CableCheckRes_isUsed:1;
+		unsigned int PreChargeReq_isUsed:1;
+		unsigned int PreChargeRes_isUsed:1;
+		unsigned int CurrentDemandReq_isUsed:1;
+		unsigned int CurrentDemandRes_isUsed:1;
+		unsigned int WeldingDetectionReq_isUsed:1;
+		unsigned int WeldingDetectionRes_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2010:MsgDef,#AnonType_V2G_Message',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDef":Header,"urn:iso:15118:2:2010:MsgDef":Body)',  derivedBy='RESTRICTION'.  */
+struct dinAnonType_V2G_Message {
+	/* element: "urn:iso:15118:2:2010:MsgDef":Header, Complex type name='urn:iso:15118:2:2010:MsgHeader,MessageHeaderType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgHeader":SessionID,"urn:iso:15118:2:2010:MsgHeader":Notification{0-1},"http://www.w3.org/2000/09/xmldsig#":Signature{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinMessageHeaderType Header ;
+	/* element: "urn:iso:15118:2:2010:MsgDef":Body, Complex type name='urn:iso:15118:2:2010:MsgDef,BodyType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2010:MsgDef":BodyElement{0-1})',  derivedBy='RESTRICTION'.  */
+	struct dinBodyType Body ;
+};
+
+
+
+#define dinEXIDocument_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinEXIDocument_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinEXIDocument_DigestValue_BYTES_SIZE 350
+#define dinEXIFragment_Certificate_BYTES_SIZE 1200 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,certificateType is 1200 */
+#define dinEXIFragment_stringValue_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinEXIFragment_OEMProvisioningCert_BYTES_SIZE 1200 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,certificateType is 1200 */
+#define dinEXIFragment_Exponent_BYTES_SIZE 350
+#define dinEXIFragment_SessionID_BYTES_SIZE 8 /* XML schema facet length for urn:iso:15118:2:2010:MsgDataTypes,sessionIDType is 8 */
+#define dinEXIFragment_PgenCounter_BYTES_SIZE 350
+#define dinEXIFragment_EVCCID_BYTES_SIZE 8 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,evccIDType is 8 */
+#define dinEXIFragment_RootCertificateID_CHARACTERS_SIZE 40 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,rootCertificateIDType is 40 */
+#define dinEXIFragment_PGPKeyPacket_BYTES_SIZE 350
+#define dinEXIFragment_Seed_BYTES_SIZE 350
+#define dinEXIFragment_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinEXIFragment_ContractID_CHARACTERS_SIZE 24 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,contractIDType is 24 */
+#define dinEXIFragment_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinEXIFragment_P_BYTES_SIZE 350
+#define dinEXIFragment_Q_BYTES_SIZE 350
+#define dinEXIFragment_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinEXIFragment_G_BYTES_SIZE 350
+#define dinEXIFragment_J_BYTES_SIZE 350
+#define dinEXIFragment_X509CRL_BYTES_SIZE 350
+#define dinEXIFragment_Y_BYTES_SIZE 350
+#define dinEXIFragment_DigestValue_BYTES_SIZE 350
+#define dinEXIFragment_ContractSignatureEncryptedPrivateKey_BYTES_SIZE 128 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,privateKeyType is 128 */
+#define dinEXIFragment_SPKISexp_BYTES_SIZE 350
+#define dinEXIFragment_DHParams_BYTES_SIZE 256 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,dHParamsType is 256 */
+#define dinEXIFragment_PGPKeyID_BYTES_SIZE 350
+#define dinEXIFragment_X509Certificate_BYTES_SIZE 350
+#define dinEXIFragment_ServiceName_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,serviceNameType is 32 */
+#define dinEXIFragment_EVSEID_BYTES_SIZE 32 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,evseIDType is 32 */
+#define dinEXIFragment_ServiceScope_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,serviceScopeType is 32 */
+#define dinEXIFragment_GenChallenge_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinEXIFragment_SalesTariffDescription_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,tariffDescriptionType is 32 */
+#define dinEXIFragment_FaultMsg_CHARACTERS_SIZE 64 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,faultMsgType is 64 */
+#define dinEXIFragment_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinEXIFragment_SigMeterReading_BYTES_SIZE 32 /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,sigMeterReadingType is 32 */
+#define dinEXIFragment_X509SKI_BYTES_SIZE 350
+#define dinEXIFragment_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define dinEXIFragment_MeterID_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2010:MsgDataTypes,meterIDType is 32 */
+#define dinEXIFragment_Modulus_BYTES_SIZE 350
+
+
+/* Global elements of EXI Document */
+struct dinEXIDocument {
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	struct dinBodyBaseType BodyElement ;
+	struct dinAnonType_V2G_Message V2G_Message ;
+	struct dinSignaturePropertyType SignatureProperty ;
+	struct dinDSAKeyValueType DSAKeyValue ;
+	struct dinSignaturePropertiesType SignatureProperties ;
+	struct dinKeyValueType KeyValue ;
+	struct dinTransformsType Transforms ;
+	struct dinDigestMethodType DigestMethod ;
+	struct dinSignatureType Signature ;
+	struct dinRetrievalMethodType RetrievalMethod ;
+	struct dinManifestType Manifest ;
+	struct dinReferenceType Reference ;
+	struct dinCanonicalizationMethodType CanonicalizationMethod ;
+	struct dinRSAKeyValueType RSAKeyValue ;
+	struct dinTransformType Transform ;
+	struct dinPGPDataType PGPData ;
+	struct {
+		exi_string_character_t characters[dinEXIDocument_MgmtData_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MgmtData ;
+	struct dinSignatureMethodType SignatureMethod ;
+	struct dinKeyInfoType KeyInfo ;
+	struct dinSPKIDataType SPKIData ;
+	struct dinX509DataType X509Data ;
+	struct dinSignatureValueType SignatureValue ;
+	struct {
+		exi_string_character_t characters[dinEXIDocument_KeyName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  KeyName ;
+	struct {
+		uint8_t bytes[dinEXIDocument_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+	struct dinSignedInfoType SignedInfo ;
+	struct dinObjectType Object ;
+	struct dinDC_EVSEStatusType DC_EVSEStatus ;
+	struct dinRelativeTimeIntervalType RelativeTimeInterval ;
+	struct dinSalesTariffEntryType SalesTariffEntry ;
+	struct dinDC_EVPowerDeliveryParameterType DC_EVPowerDeliveryParameter ;
+	struct dinSASchedulesType SASchedules ;
+	struct dinAC_EVChargeParameterType AC_EVChargeParameter ;
+	struct dinSAScheduleListType SAScheduleList ;
+	struct dinDC_EVStatusType DC_EVStatus ;
+	struct dinServiceChargeType ServiceCharge ;
+	struct dinEVStatusType EVStatus ;
+	struct dinDC_EVChargeParameterType DC_EVChargeParameter ;
+	struct dinDC_EVSEChargeParameterType DC_EVSEChargeParameter ;
+	struct dinEVSEStatusType EVSEStatus ;
+	struct dinIntervalType TimeInterval ;
+	struct dinEVPowerDeliveryParameterType EVPowerDeliveryParameter ;
+	struct dinEVSEChargeParameterType EVSEChargeParameter ;
+	struct dinAC_EVSEStatusType AC_EVSEStatus ;
+	struct dinEntryType Entry ;
+	struct dinAC_EVSEChargeParameterType AC_EVSEChargeParameter ;
+	struct dinPMaxScheduleEntryType PMaxScheduleEntry ;
+	struct dinEVChargeParameterType EVChargeParameter ;
+	struct dinServiceDiscoveryReqType ServiceDiscoveryReq ;
+	struct dinServiceDiscoveryResType ServiceDiscoveryRes ;
+	struct dinMeteringReceiptReqType MeteringReceiptReq ;
+	struct dinPaymentDetailsReqType PaymentDetailsReq ;
+	struct dinMeteringReceiptResType MeteringReceiptRes ;
+	struct dinPaymentDetailsResType PaymentDetailsRes ;
+	struct dinSessionSetupReqType SessionSetupReq ;
+	struct dinSessionSetupResType SessionSetupRes ;
+	struct dinCableCheckReqType CableCheckReq ;
+	struct dinCableCheckResType CableCheckRes ;
+	struct dinContractAuthenticationReqType ContractAuthenticationReq ;
+	struct dinCertificateInstallationReqType CertificateInstallationReq ;
+	struct dinContractAuthenticationResType ContractAuthenticationRes ;
+	struct dinCertificateInstallationResType CertificateInstallationRes ;
+	struct dinWeldingDetectionReqType WeldingDetectionReq ;
+	struct dinWeldingDetectionResType WeldingDetectionRes ;
+	struct dinCertificateUpdateReqType CertificateUpdateReq ;
+	struct dinCertificateUpdateResType CertificateUpdateRes ;
+	struct dinPowerDeliveryReqType PowerDeliveryReq ;
+	struct dinPowerDeliveryResType PowerDeliveryRes ;
+	struct dinChargingStatusReqType ChargingStatusReq ;
+	struct dinChargingStatusResType ChargingStatusRes ;
+	struct dinCurrentDemandReqType CurrentDemandReq ;
+	struct dinPreChargeReqType PreChargeReq ;
+	struct dinCurrentDemandResType CurrentDemandRes ;
+	struct dinPreChargeResType PreChargeRes ;
+	struct dinServicePaymentSelectionReqType ServicePaymentSelectionReq ;
+	struct dinSessionStopType SessionStopReq ;
+	struct dinServicePaymentSelectionResType ServicePaymentSelectionRes ;
+	struct dinSessionStopResType SessionStopRes ;
+	struct dinChargeParameterDiscoveryReqType ChargeParameterDiscoveryReq ;
+	struct dinChargeParameterDiscoveryResType ChargeParameterDiscoveryRes ;
+	struct dinServiceDetailReqType ServiceDetailReq ;
+	struct dinServiceDetailResType ServiceDetailRes ;
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	};
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	unsigned int BodyElement_isUsed:1;
+	unsigned int V2G_Message_isUsed:1;
+	unsigned int SignatureProperty_isUsed:1;
+	unsigned int DSAKeyValue_isUsed:1;
+	unsigned int SignatureProperties_isUsed:1;
+	unsigned int KeyValue_isUsed:1;
+	unsigned int Transforms_isUsed:1;
+	unsigned int DigestMethod_isUsed:1;
+	unsigned int Signature_isUsed:1;
+	unsigned int RetrievalMethod_isUsed:1;
+	unsigned int Manifest_isUsed:1;
+	unsigned int Reference_isUsed:1;
+	unsigned int CanonicalizationMethod_isUsed:1;
+	unsigned int RSAKeyValue_isUsed:1;
+	unsigned int Transform_isUsed:1;
+	unsigned int PGPData_isUsed:1;
+	unsigned int MgmtData_isUsed:1;
+	unsigned int SignatureMethod_isUsed:1;
+	unsigned int KeyInfo_isUsed:1;
+	unsigned int SPKIData_isUsed:1;
+	unsigned int X509Data_isUsed:1;
+	unsigned int SignatureValue_isUsed:1;
+	unsigned int KeyName_isUsed:1;
+	unsigned int DigestValue_isUsed:1;
+	unsigned int SignedInfo_isUsed:1;
+	unsigned int Object_isUsed:1;
+	unsigned int DC_EVSEStatus_isUsed:1;
+	unsigned int RelativeTimeInterval_isUsed:1;
+	unsigned int SalesTariffEntry_isUsed:1;
+	unsigned int DC_EVPowerDeliveryParameter_isUsed:1;
+	unsigned int SASchedules_isUsed:1;
+	unsigned int AC_EVChargeParameter_isUsed:1;
+	unsigned int SAScheduleList_isUsed:1;
+	unsigned int DC_EVStatus_isUsed:1;
+	unsigned int ServiceCharge_isUsed:1;
+	unsigned int EVStatus_isUsed:1;
+	unsigned int DC_EVChargeParameter_isUsed:1;
+	unsigned int DC_EVSEChargeParameter_isUsed:1;
+	unsigned int EVSEStatus_isUsed:1;
+	unsigned int TimeInterval_isUsed:1;
+	unsigned int EVPowerDeliveryParameter_isUsed:1;
+	unsigned int EVSEChargeParameter_isUsed:1;
+	unsigned int AC_EVSEStatus_isUsed:1;
+	unsigned int Entry_isUsed:1;
+	unsigned int AC_EVSEChargeParameter_isUsed:1;
+	unsigned int PMaxScheduleEntry_isUsed:1;
+	unsigned int EVChargeParameter_isUsed:1;
+	unsigned int ServiceDiscoveryReq_isUsed:1;
+	unsigned int ServiceDiscoveryRes_isUsed:1;
+	unsigned int MeteringReceiptReq_isUsed:1;
+	unsigned int PaymentDetailsReq_isUsed:1;
+	unsigned int MeteringReceiptRes_isUsed:1;
+	unsigned int PaymentDetailsRes_isUsed:1;
+	unsigned int SessionSetupReq_isUsed:1;
+	unsigned int SessionSetupRes_isUsed:1;
+	unsigned int CableCheckReq_isUsed:1;
+	unsigned int CableCheckRes_isUsed:1;
+	unsigned int ContractAuthenticationReq_isUsed:1;
+	unsigned int CertificateInstallationReq_isUsed:1;
+	unsigned int ContractAuthenticationRes_isUsed:1;
+	unsigned int CertificateInstallationRes_isUsed:1;
+	unsigned int WeldingDetectionReq_isUsed:1;
+	unsigned int WeldingDetectionRes_isUsed:1;
+	unsigned int CertificateUpdateReq_isUsed:1;
+	unsigned int CertificateUpdateRes_isUsed:1;
+	unsigned int PowerDeliveryReq_isUsed:1;
+	unsigned int PowerDeliveryRes_isUsed:1;
+	unsigned int ChargingStatusReq_isUsed:1;
+	unsigned int ChargingStatusRes_isUsed:1;
+	unsigned int CurrentDemandReq_isUsed:1;
+	unsigned int PreChargeReq_isUsed:1;
+	unsigned int CurrentDemandRes_isUsed:1;
+	unsigned int PreChargeRes_isUsed:1;
+	unsigned int ServicePaymentSelectionReq_isUsed:1;
+	unsigned int SessionStopReq_isUsed:1;
+	unsigned int ServicePaymentSelectionRes_isUsed:1;
+	unsigned int SessionStopRes_isUsed:1;
+	unsigned int ChargeParameterDiscoveryReq_isUsed:1;
+	unsigned int ChargeParameterDiscoveryRes_isUsed:1;
+	unsigned int ServiceDetailReq_isUsed:1;
+	unsigned int ServiceDetailRes_isUsed:1;
+
+
+	int _warning_;
+};
+
+
+#if DEPLOY_DIN_CODEC_FRAGMENT == SUPPORT_YES
+/* Possible elements of EXI Fragment */
+struct dinEXIFragment {
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	dinunitSymbolType Unit ;
+	struct dinPhysicalValueType EVSEMaximumCurrentLimit ;
+	struct dinEVPowerDeliveryParameterType EVPowerDeliveryParameter ;
+	int16_t ChargingProfileEntryMaxPower ;
+	int64_t TMeter ;
+	int EVSEPowerLimitAchieved ;
+	uint32_t duration ;
+	struct dinPhysicalValueType EVMaximumCurrentLimit ;
+	struct dinParameterType Parameter ;
+	dinEVSEProcessingType EVSEProcessing ;
+	struct dinAC_EVChargeParameterType AC_EVChargeParameter ;
+	struct dinPMaxScheduleEntryType PMaxScheduleEntry ;
+	struct dinPhysicalValueType EVSEMaximumVoltageLimit ;
+	struct dinSelectedServiceType SelectedService ;
+	struct {
+		uint8_t bytes[dinEXIFragment_Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Certificate ;
+	struct dinPhysicalValueType EVSEMaximumPowerLimit ;
+	int EVReady ;
+	int64_t X509SerialNumber ;
+	struct dinRetrievalMethodType RetrievalMethod ;
+	int16_t RetryCounter ;
+	struct dinDC_EVSEStatusType DC_EVSEStatus ;
+	struct dinMeteringReceiptReqType MeteringReceiptReq ;
+	int ReadyToChargeState ;
+	int8_t Multiplier ;
+	uint8_t EPriceLevel ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_stringValue_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  stringValue ;
+	struct dinServiceDiscoveryReqType ServiceDiscoveryReq ;
+	struct dinTransformsType Transforms ;
+	struct dinMeteringReceiptResType MeteringReceiptRes ;
+	struct dinPreChargeReqType PreChargeReq ;
+	struct {
+		uint8_t bytes[dinEXIFragment_OEMProvisioningCert_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  OEMProvisioningCert ;
+	struct dinServiceDiscoveryResType ServiceDiscoveryRes ;
+	dinresponseCodeType ResponseCode ;
+	struct dinContractAuthenticationReqType ContractAuthenticationReq ;
+	struct dinCertificateChainType ContractSignatureCertChain ;
+	struct dinContractAuthenticationResType ContractAuthenticationRes ;
+	int64_t HMACOutputLength ;
+	int BulkChargingComplete ;
+	struct {
+		uint8_t bytes[dinEXIFragment_Exponent_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Exponent ;
+	struct dinDC_EVStatusType DC_EVStatus ;
+	struct dinSAScheduleTupleType SAScheduleTuple ;
+	uint32_t DepartureTime ;
+	struct dinX509IssuerSerialType X509IssuerSerial ;
+	int16_t SAScheduleTupleID ;
+	struct dinSPKIDataType SPKIData ;
+	struct dinRelativeTimeIntervalType RelativeTimeInterval ;
+	struct dinPhysicalValueType EVEnergyRequest ;
+	struct dinPreChargeResType PreChargeRes ;
+	struct {
+		uint8_t bytes[dinEXIFragment_SessionID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SessionID ;
+	struct dinPMaxScheduleType PMaxSchedule ;
+	struct dinServiceChargeType ServiceCharge ;
+	struct {
+		uint8_t bytes[dinEXIFragment_PgenCounter_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PgenCounter ;
+	struct dinChargingStatusReqType ChargingStatusReq ;
+	struct dinX509DataType X509Data ;
+	struct dinSalesTariffEntryType SalesTariffEntry ;
+	struct dinKeyValueType KeyValue ;
+	struct dinChargingStatusResType ChargingStatusRes ;
+	struct dinAnonType_V2G_Message V2G_Message ;
+	struct dinServicePaymentSelectionReqType ServicePaymentSelectionReq ;
+	dinisolationLevelType EVSEIsolationStatus ;
+	struct dinServicePaymentSelectionResType ServicePaymentSelectionRes ;
+	struct dinPhysicalValueType EVSEPresentVoltage ;
+	struct dinBodyBaseType BodyElement ;
+	struct {
+		uint8_t bytes[dinEXIFragment_EVCCID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  EVCCID ;
+	struct dinPGPDataType PGPData ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_RootCertificateID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  RootCertificateID ;
+	dinfaultCodeType FaultCode ;
+	struct dinCableCheckReqType CableCheckReq ;
+	int EVSEVoltageLimitAchieved ;
+	int EVRESSConditioning ;
+	struct dinMeterInfoType MeterInfo ;
+	struct dinCableCheckResType CableCheckRes ;
+	uint32_t ChargingProfileEntryStart ;
+	struct dinSignaturePropertyType SignatureProperty ;
+	struct dinPhysicalValueType EVMaxCurrent ;
+	struct {
+		uint8_t bytes[dinEXIFragment_PGPKeyPacket_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyPacket ;
+	struct {
+		uint8_t bytes[dinEXIFragment_Seed_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Seed ;
+	struct dinRSAKeyValueType RSAKeyValue ;
+	dincostKindType costKind ;
+	struct dinPhysicalValueType EAmount ;
+	struct dinPhysicalValueType EVSEPresentCurrent ;
+	struct dinPowerDeliveryResType PowerDeliveryRes ;
+	uint8_t NumEPriceLevels ;
+	struct dinSessionStopResType SessionStopRes ;
+	struct dinPowerDeliveryReqType PowerDeliveryReq ;
+	struct dinSessionStopType SessionStopReq ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_XPath_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  XPath ;
+	int8_t BulkSOC ;
+	int16_t PMax ;
+	int16_t ParameterSetID ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_ContractID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ContractID ;
+	struct dinSignatureType Signature ;
+	struct dinPhysicalValueType EVMaxVoltage ;
+	int ReceiptRequired ;
+	int ChargingComplete ;
+	struct dinChargingProfileType ChargingProfile ;
+	struct dinPaymentOptionsType PaymentOptions ;
+	struct dinSessionSetupResType SessionSetupRes ;
+	struct dinServiceDetailResType ServiceDetailRes ;
+	struct dinDC_EVPowerDeliveryParameterType DC_EVPowerDeliveryParameter ;
+	struct dinPaymentDetailsResType PaymentDetailsRes ;
+	struct dinPaymentDetailsReqType PaymentDetailsReq ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_MgmtData_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MgmtData ;
+	int16_t Value ;
+	dinEVSENotificationType EVSENotification ;
+	struct dinPhysicalValueType EVTargetCurrent ;
+	struct dinPhysicalValueType RemainingTimeToBulkSoC ;
+	struct dinSessionSetupReqType SessionSetupReq ;
+	int EVSECurrentLimitAchieved ;
+	struct dinServiceDetailReqType ServiceDetailReq ;
+	int8_t byteValue ;
+	struct dinPhysicalValueType EVMaximumPowerLimit ;
+	int PowerSwitchClosed ;
+	struct dinManifestType Manifest ;
+	struct {
+		uint8_t bytes[dinEXIFragment_P_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  P ;
+	struct dinSAScheduleListType SAScheduleList ;
+	struct {
+		uint8_t bytes[dinEXIFragment_Q_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Q ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_X509SubjectName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509SubjectName ;
+	struct {
+		uint8_t bytes[dinEXIFragment_G_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  G ;
+	struct {
+		uint8_t bytes[dinEXIFragment_J_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  J ;
+	struct dinCertificateInstallationResType CertificateInstallationRes ;
+	struct dinCertificateInstallationReqType CertificateInstallationReq ;
+	struct dinSalesTariffType SalesTariff ;
+	struct dinMessageHeaderType Header ;
+	struct dinPhysicalValueType EVSEMinimumCurrentLimit ;
+	struct {
+		uint8_t bytes[dinEXIFragment_X509CRL_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509CRL ;
+	struct {
+		uint8_t bytes[dinEXIFragment_Y_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Y ;
+	struct {
+		uint8_t bytes[dinEXIFragment_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+	struct dinDC_EVChargeParameterType DC_EVChargeParameter ;
+	struct {
+		uint8_t bytes[dinEXIFragment_ContractSignatureEncryptedPrivateKey_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  ContractSignatureEncryptedPrivateKey ;
+	struct dinDigestMethodType DigestMethod ;
+	struct {
+		uint8_t bytes[dinEXIFragment_SPKISexp_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SPKISexp ;
+	struct dinServiceChargeType ChargeService ;
+	struct dinPhysicalValueType EVSEEnergyToBeDelivered ;
+	struct dinSignaturePropertiesType SignatureProperties ;
+	struct dinPhysicalValueType EVSEMaxCurrent ;
+	struct dinEVSEStatusType EVSEStatus ;
+	struct dinServiceType Service ;
+	struct {
+		uint8_t bytes[dinEXIFragment_DHParams_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DHParams ;
+	struct {
+		uint8_t bytes[dinEXIFragment_PGPKeyID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyID ;
+	struct dinDSAKeyValueType DSAKeyValue ;
+	dinEVSESupportedEnergyTransferType EnergyTransferType ;
+	struct dinWeldingDetectionResType WeldingDetectionRes ;
+	int FreeService ;
+	struct dinSelectedServiceListType SelectedServiceList ;
+	struct dinWeldingDetectionReqType WeldingDetectionReq ;
+	struct dinPhysicalValueType EVTargetVoltage ;
+	struct dinCanonicalizationMethodType CanonicalizationMethod ;
+	struct {
+		uint8_t bytes[dinEXIFragment_X509Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509Certificate ;
+	struct dinCertificateUpdateResType CertificateUpdateRes ;
+	struct dinCertificateUpdateReqType CertificateUpdateReq ;
+	struct dinPhysicalValueType EVSEMaxVoltage ;
+	struct dinSignedInfoType SignedInfo ;
+	struct dinAC_EVSEChargeParameterType AC_EVSEChargeParameter ;
+	struct dinPhysicalValueType EVEnergyCapacity ;
+	uint16_t ServiceID ;
+	struct dinPhysicalValueType EVSECurrentRegulationTolerance ;
+	struct dinServiceParameterListType ServiceParameterList ;
+	struct dinListOfRootCertificateIDsType ListOfRootCertificateIDs ;
+	struct dinProfileEntryType ProfileEntry ;
+	struct dinPhysicalValueType EVSEMinimumVoltageLimit ;
+	struct dinCurrentDemandResType CurrentDemandRes ;
+	int8_t EVRESSSOC ;
+	struct dinPhysicalValueType MeterReading ;
+	struct dinCurrentDemandReqType CurrentDemandReq ;
+	struct dinPhysicalValueType physicalValue ;
+	struct dinIntervalType TimeInterval ;
+	struct dinAC_EVSEStatusType AC_EVSEStatus ;
+	struct dinPhysicalValueType EVMaximumVoltageLimit ;
+	struct dinSignatureValueType SignatureValue ;
+	int64_t DateTimeNow ;
+	struct dinServiceTagType ServiceTag ;
+	int32_t intValue ;
+	dinpaymentOptionType SelectedPaymentOption ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_ServiceName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceName ;
+	int EVCabinConditioning ;
+	struct {
+		uint8_t bytes[dinEXIFragment_EVSEID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  EVSEID ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_ServiceScope_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceScope ;
+	int16_t MeterStatus ;
+	dinEVRequestedEnergyTransferType EVRequestedEnergyTransferType ;
+	dinserviceCategoryType ServiceCategory ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_GenChallenge_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  GenChallenge ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_SalesTariffDescription_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  SalesTariffDescription ;
+	uint32_t NotificationMaxDelay ;
+	int boolValue ;
+	dinDC_EVSEStatusCodeType EVSEStatusCode ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_FaultMsg_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  FaultMsg ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_KeyName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  KeyName ;
+	struct dinParameterSetType ParameterSet ;
+	struct {
+		uint8_t bytes[dinEXIFragment_SigMeterReading_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SigMeterReading ;
+	struct dinEVSEChargeParameterType EVSEChargeParameter ;
+	struct dinBodyType Body ;
+	struct dinSASchedulesType SASchedules ;
+	struct dinKeyInfoType KeyInfo ;
+	int16_t PMaxScheduleID ;
+	struct dinPhysicalValueType RemainingTimeToFullSoC ;
+	struct dinEVStatusType EVStatus ;
+	struct dinSubCertificatesType SubCertificates ;
+	dinpaymentOptionType PaymentOption ;
+	struct {
+		uint8_t bytes[dinEXIFragment_X509SKI_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509SKI ;
+	struct dinServiceTagListType ServiceList ;
+	struct dinCostType Cost ;
+	struct dinSignatureMethodType SignatureMethod ;
+	struct dinPhysicalValueType EVSEMinCurrent ;
+	struct dinConsumptionCostType ConsumptionCost ;
+	struct dinPhysicalValueType EVSEPeakCurrentRipple ;
+	dinDC_EVErrorCodeType EVErrorCode ;
+	struct dinEVChargeParameterType EVChargeParameter ;
+	uint32_t start ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_X509IssuerName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509IssuerName ;
+	struct dinReferenceType Reference ;
+	struct dinPhysicalValueType EVMinCurrent ;
+	int8_t FullSOC ;
+	uint32_t amount ;
+	int16_t shortValue ;
+	struct dinDC_EVSEChargeParameterType DC_EVSEChargeParameter ;
+	struct dinEntryType Entry ;
+	int16_t SalesTariffID ;
+	struct {
+		exi_string_character_t characters[dinEXIFragment_MeterID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MeterID ;
+	struct dinChargeParameterDiscoveryReqType ChargeParameterDiscoveryReq ;
+	int8_t amountMultiplier ;
+	struct dinChargeParameterDiscoveryResType ChargeParameterDiscoveryRes ;
+	struct dinTransformType Transform ;
+	struct dinObjectType Object ;
+	int RCD ;
+	struct dinNotificationType Notification ;
+	uint32_t startValue ;
+	struct {
+		uint8_t bytes[dinEXIFragment_Modulus_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Modulus ;
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	};
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	unsigned int Unit_isUsed:1;
+	unsigned int EVSEMaximumCurrentLimit_isUsed:1;
+	unsigned int EVPowerDeliveryParameter_isUsed:1;
+	unsigned int ChargingProfileEntryMaxPower_isUsed:1;
+	unsigned int TMeter_isUsed:1;
+	unsigned int EVSEPowerLimitAchieved_isUsed:1;
+	unsigned int duration_isUsed:1;
+	unsigned int EVMaximumCurrentLimit_isUsed:1;
+	unsigned int Parameter_isUsed:1;
+	unsigned int EVSEProcessing_isUsed:1;
+	unsigned int AC_EVChargeParameter_isUsed:1;
+	unsigned int PMaxScheduleEntry_isUsed:1;
+	unsigned int EVSEMaximumVoltageLimit_isUsed:1;
+	unsigned int SelectedService_isUsed:1;
+	unsigned int Certificate_isUsed:1;
+	unsigned int EVSEMaximumPowerLimit_isUsed:1;
+	unsigned int EVReady_isUsed:1;
+	unsigned int X509SerialNumber_isUsed:1;
+	unsigned int RetrievalMethod_isUsed:1;
+	unsigned int RetryCounter_isUsed:1;
+	unsigned int DC_EVSEStatus_isUsed:1;
+	unsigned int MeteringReceiptReq_isUsed:1;
+	unsigned int ReadyToChargeState_isUsed:1;
+	unsigned int Multiplier_isUsed:1;
+	unsigned int EPriceLevel_isUsed:1;
+	unsigned int stringValue_isUsed:1;
+	unsigned int ServiceDiscoveryReq_isUsed:1;
+	unsigned int Transforms_isUsed:1;
+	unsigned int MeteringReceiptRes_isUsed:1;
+	unsigned int PreChargeReq_isUsed:1;
+	unsigned int OEMProvisioningCert_isUsed:1;
+	unsigned int ServiceDiscoveryRes_isUsed:1;
+	unsigned int ResponseCode_isUsed:1;
+	unsigned int ContractAuthenticationReq_isUsed:1;
+	unsigned int ContractSignatureCertChain_isUsed:1;
+	unsigned int ContractAuthenticationRes_isUsed:1;
+	unsigned int HMACOutputLength_isUsed:1;
+	unsigned int BulkChargingComplete_isUsed:1;
+	unsigned int Exponent_isUsed:1;
+	unsigned int DC_EVStatus_isUsed:1;
+	unsigned int SAScheduleTuple_isUsed:1;
+	unsigned int DepartureTime_isUsed:1;
+	unsigned int X509IssuerSerial_isUsed:1;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	unsigned int SPKIData_isUsed:1;
+	unsigned int RelativeTimeInterval_isUsed:1;
+	unsigned int EVEnergyRequest_isUsed:1;
+	unsigned int PreChargeRes_isUsed:1;
+	unsigned int SessionID_isUsed:1;
+	unsigned int PMaxSchedule_isUsed:1;
+	unsigned int ServiceCharge_isUsed:1;
+	unsigned int PgenCounter_isUsed:1;
+	unsigned int ChargingStatusReq_isUsed:1;
+	unsigned int X509Data_isUsed:1;
+	unsigned int SalesTariffEntry_isUsed:1;
+	unsigned int KeyValue_isUsed:1;
+	unsigned int ChargingStatusRes_isUsed:1;
+	unsigned int V2G_Message_isUsed:1;
+	unsigned int ServicePaymentSelectionReq_isUsed:1;
+	unsigned int EVSEIsolationStatus_isUsed:1;
+	unsigned int ServicePaymentSelectionRes_isUsed:1;
+	unsigned int EVSEPresentVoltage_isUsed:1;
+	unsigned int BodyElement_isUsed:1;
+	unsigned int EVCCID_isUsed:1;
+	unsigned int PGPData_isUsed:1;
+	unsigned int RootCertificateID_isUsed:1;
+	unsigned int FaultCode_isUsed:1;
+	unsigned int CableCheckReq_isUsed:1;
+	unsigned int EVSEVoltageLimitAchieved_isUsed:1;
+	unsigned int EVRESSConditioning_isUsed:1;
+	unsigned int MeterInfo_isUsed:1;
+	unsigned int CableCheckRes_isUsed:1;
+	unsigned int ChargingProfileEntryStart_isUsed:1;
+	unsigned int SignatureProperty_isUsed:1;
+	unsigned int EVMaxCurrent_isUsed:1;
+	unsigned int PGPKeyPacket_isUsed:1;
+	unsigned int Seed_isUsed:1;
+	unsigned int RSAKeyValue_isUsed:1;
+	unsigned int costKind_isUsed:1;
+	unsigned int EAmount_isUsed:1;
+	unsigned int EVSEPresentCurrent_isUsed:1;
+	unsigned int PowerDeliveryRes_isUsed:1;
+	unsigned int NumEPriceLevels_isUsed:1;
+	unsigned int SessionStopRes_isUsed:1;
+	unsigned int PowerDeliveryReq_isUsed:1;
+	unsigned int SessionStopReq_isUsed:1;
+	unsigned int XPath_isUsed:1;
+	unsigned int BulkSOC_isUsed:1;
+	unsigned int PMax_isUsed:1;
+	unsigned int ParameterSetID_isUsed:1;
+	unsigned int ContractID_isUsed:1;
+	unsigned int Signature_isUsed:1;
+	unsigned int EVMaxVoltage_isUsed:1;
+	unsigned int ReceiptRequired_isUsed:1;
+	unsigned int ChargingComplete_isUsed:1;
+	unsigned int ChargingProfile_isUsed:1;
+	unsigned int PaymentOptions_isUsed:1;
+	unsigned int SessionSetupRes_isUsed:1;
+	unsigned int ServiceDetailRes_isUsed:1;
+	unsigned int DC_EVPowerDeliveryParameter_isUsed:1;
+	unsigned int PaymentDetailsRes_isUsed:1;
+	unsigned int PaymentDetailsReq_isUsed:1;
+	unsigned int MgmtData_isUsed:1;
+	unsigned int Value_isUsed:1;
+	unsigned int EVSENotification_isUsed:1;
+	unsigned int EVTargetCurrent_isUsed:1;
+	unsigned int RemainingTimeToBulkSoC_isUsed:1;
+	unsigned int SessionSetupReq_isUsed:1;
+	unsigned int EVSECurrentLimitAchieved_isUsed:1;
+	unsigned int ServiceDetailReq_isUsed:1;
+	unsigned int byteValue_isUsed:1;
+	unsigned int EVMaximumPowerLimit_isUsed:1;
+	unsigned int PowerSwitchClosed_isUsed:1;
+	unsigned int Manifest_isUsed:1;
+	unsigned int P_isUsed:1;
+	unsigned int SAScheduleList_isUsed:1;
+	unsigned int Q_isUsed:1;
+	unsigned int X509SubjectName_isUsed:1;
+	unsigned int G_isUsed:1;
+	unsigned int J_isUsed:1;
+	unsigned int CertificateInstallationRes_isUsed:1;
+	unsigned int CertificateInstallationReq_isUsed:1;
+	unsigned int SalesTariff_isUsed:1;
+	unsigned int Header_isUsed:1;
+	unsigned int EVSEMinimumCurrentLimit_isUsed:1;
+	unsigned int X509CRL_isUsed:1;
+	unsigned int Y_isUsed:1;
+	unsigned int DigestValue_isUsed:1;
+	unsigned int DC_EVChargeParameter_isUsed:1;
+	unsigned int ContractSignatureEncryptedPrivateKey_isUsed:1;
+	unsigned int DigestMethod_isUsed:1;
+	unsigned int SPKISexp_isUsed:1;
+	unsigned int ChargeService_isUsed:1;
+	unsigned int EVSEEnergyToBeDelivered_isUsed:1;
+	unsigned int SignatureProperties_isUsed:1;
+	unsigned int EVSEMaxCurrent_isUsed:1;
+	unsigned int EVSEStatus_isUsed:1;
+	unsigned int Service_isUsed:1;
+	unsigned int DHParams_isUsed:1;
+	unsigned int PGPKeyID_isUsed:1;
+	unsigned int DSAKeyValue_isUsed:1;
+	unsigned int EnergyTransferType_isUsed:1;
+	unsigned int WeldingDetectionRes_isUsed:1;
+	unsigned int FreeService_isUsed:1;
+	unsigned int SelectedServiceList_isUsed:1;
+	unsigned int WeldingDetectionReq_isUsed:1;
+	unsigned int EVTargetVoltage_isUsed:1;
+	unsigned int CanonicalizationMethod_isUsed:1;
+	unsigned int X509Certificate_isUsed:1;
+	unsigned int CertificateUpdateRes_isUsed:1;
+	unsigned int CertificateUpdateReq_isUsed:1;
+	unsigned int EVSEMaxVoltage_isUsed:1;
+	unsigned int SignedInfo_isUsed:1;
+	unsigned int AC_EVSEChargeParameter_isUsed:1;
+	unsigned int EVEnergyCapacity_isUsed:1;
+	unsigned int ServiceID_isUsed:1;
+	unsigned int EVSECurrentRegulationTolerance_isUsed:1;
+	unsigned int ServiceParameterList_isUsed:1;
+	unsigned int ListOfRootCertificateIDs_isUsed:1;
+	unsigned int ProfileEntry_isUsed:1;
+	unsigned int EVSEMinimumVoltageLimit_isUsed:1;
+	unsigned int CurrentDemandRes_isUsed:1;
+	unsigned int EVRESSSOC_isUsed:1;
+	unsigned int MeterReading_isUsed:1;
+	unsigned int CurrentDemandReq_isUsed:1;
+	unsigned int physicalValue_isUsed:1;
+	unsigned int TimeInterval_isUsed:1;
+	unsigned int AC_EVSEStatus_isUsed:1;
+	unsigned int EVMaximumVoltageLimit_isUsed:1;
+	unsigned int SignatureValue_isUsed:1;
+	unsigned int DateTimeNow_isUsed:1;
+	unsigned int ServiceTag_isUsed:1;
+	unsigned int intValue_isUsed:1;
+	unsigned int SelectedPaymentOption_isUsed:1;
+	unsigned int ServiceName_isUsed:1;
+	unsigned int EVCabinConditioning_isUsed:1;
+	unsigned int EVSEID_isUsed:1;
+	unsigned int ServiceScope_isUsed:1;
+	unsigned int MeterStatus_isUsed:1;
+	unsigned int EVRequestedEnergyTransferType_isUsed:1;
+	unsigned int ServiceCategory_isUsed:1;
+	unsigned int GenChallenge_isUsed:1;
+	unsigned int SalesTariffDescription_isUsed:1;
+	unsigned int NotificationMaxDelay_isUsed:1;
+	unsigned int boolValue_isUsed:1;
+	unsigned int EVSEStatusCode_isUsed:1;
+	unsigned int FaultMsg_isUsed:1;
+	unsigned int KeyName_isUsed:1;
+	unsigned int ParameterSet_isUsed:1;
+	unsigned int SigMeterReading_isUsed:1;
+	unsigned int EVSEChargeParameter_isUsed:1;
+	unsigned int Body_isUsed:1;
+	unsigned int SASchedules_isUsed:1;
+	unsigned int KeyInfo_isUsed:1;
+	unsigned int PMaxScheduleID_isUsed:1;
+	unsigned int RemainingTimeToFullSoC_isUsed:1;
+	unsigned int EVStatus_isUsed:1;
+	unsigned int SubCertificates_isUsed:1;
+	unsigned int PaymentOption_isUsed:1;
+	unsigned int X509SKI_isUsed:1;
+	unsigned int ServiceList_isUsed:1;
+	unsigned int Cost_isUsed:1;
+	unsigned int SignatureMethod_isUsed:1;
+	unsigned int EVSEMinCurrent_isUsed:1;
+	unsigned int ConsumptionCost_isUsed:1;
+	unsigned int EVSEPeakCurrentRipple_isUsed:1;
+	unsigned int EVErrorCode_isUsed:1;
+	unsigned int EVChargeParameter_isUsed:1;
+	unsigned int start_isUsed:1;
+	unsigned int X509IssuerName_isUsed:1;
+	unsigned int Reference_isUsed:1;
+	unsigned int EVMinCurrent_isUsed:1;
+	unsigned int FullSOC_isUsed:1;
+	unsigned int amount_isUsed:1;
+	unsigned int shortValue_isUsed:1;
+	unsigned int DC_EVSEChargeParameter_isUsed:1;
+	unsigned int Entry_isUsed:1;
+	unsigned int SalesTariffID_isUsed:1;
+	unsigned int MeterID_isUsed:1;
+	unsigned int ChargeParameterDiscoveryReq_isUsed:1;
+	unsigned int amountMultiplier_isUsed:1;
+	unsigned int ChargeParameterDiscoveryRes_isUsed:1;
+	unsigned int Transform_isUsed:1;
+	unsigned int Object_isUsed:1;
+	unsigned int RCD_isUsed:1;
+	unsigned int Notification_isUsed:1;
+	unsigned int startValue_isUsed:1;
+	unsigned int Modulus_isUsed:1;
+
+
+	int _warning_;
+};
+#endif /* DEPLOY_DIN_CODEC_FRAGMENT */
+
+
+/* Initialization methods for structs */
+
+void init_dinEXIDocument(struct dinEXIDocument* exiDoc);
+#if DEPLOY_DIN_CODEC_FRAGMENT == SUPPORT_YES
+void init_dinEXIFragment(struct dinEXIFragment* exiFrag);
+#endif /* DEPLOY_DIN_CODEC_FRAGMENT */
+void init_dinMeteringReceiptReqType(struct dinMeteringReceiptReqType* dinMeteringReceiptReqType);
+void init_dinBodyType(struct dinBodyType* dinBodyType);
+void init_dinSessionSetupReqType(struct dinSessionSetupReqType* dinSessionSetupReqType);
+void init_dinPowerDeliveryResType(struct dinPowerDeliveryResType* dinPowerDeliveryResType);
+void init_dinServiceDetailResType(struct dinServiceDetailResType* dinServiceDetailResType);
+void init_dinWeldingDetectionResType(struct dinWeldingDetectionResType* dinWeldingDetectionResType);
+void init_dinContractAuthenticationResType(struct dinContractAuthenticationResType* dinContractAuthenticationResType);
+void init_dinCanonicalizationMethodType(struct dinCanonicalizationMethodType* dinCanonicalizationMethodType);
+void init_dinSPKIDataType(struct dinSPKIDataType* dinSPKIDataType);
+void init_dinListOfRootCertificateIDsType(struct dinListOfRootCertificateIDsType* dinListOfRootCertificateIDsType);
+void init_dinSelectedServiceListType(struct dinSelectedServiceListType* dinSelectedServiceListType);
+void init_dinCurrentDemandResType(struct dinCurrentDemandResType* dinCurrentDemandResType);
+void init_dinTransformType(struct dinTransformType* dinTransformType);
+void init_dinAC_EVChargeParameterType(struct dinAC_EVChargeParameterType* dinAC_EVChargeParameterType);
+void init_dinX509DataType(struct dinX509DataType* dinX509DataType);
+void init_dinChargingStatusResType(struct dinChargingStatusResType* dinChargingStatusResType);
+void init_dinWeldingDetectionReqType(struct dinWeldingDetectionReqType* dinWeldingDetectionReqType);
+void init_dinSignaturePropertiesType(struct dinSignaturePropertiesType* dinSignaturePropertiesType);
+void init_dinContractAuthenticationReqType(struct dinContractAuthenticationReqType* dinContractAuthenticationReqType);
+void init_dinDC_EVPowerDeliveryParameterType(struct dinDC_EVPowerDeliveryParameterType* dinDC_EVPowerDeliveryParameterType);
+void init_dinEVSEChargeParameterType(struct dinEVSEChargeParameterType* dinEVSEChargeParameterType);
+void init_dinCableCheckReqType(struct dinCableCheckReqType* dinCableCheckReqType);
+void init_dinDC_EVChargeParameterType(struct dinDC_EVChargeParameterType* dinDC_EVChargeParameterType);
+void init_dinSAScheduleListType(struct dinSAScheduleListType* dinSAScheduleListType);
+void init_dinPMaxScheduleType(struct dinPMaxScheduleType* dinPMaxScheduleType);
+void init_dinServicePaymentSelectionReqType(struct dinServicePaymentSelectionReqType* dinServicePaymentSelectionReqType);
+void init_dinRelativeTimeIntervalType(struct dinRelativeTimeIntervalType* dinRelativeTimeIntervalType);
+void init_dinEVStatusType(struct dinEVStatusType* dinEVStatusType);
+void init_dinPreChargeResType(struct dinPreChargeResType* dinPreChargeResType);
+void init_dinDC_EVSEChargeParameterType(struct dinDC_EVSEChargeParameterType* dinDC_EVSEChargeParameterType);
+void init_dinPaymentDetailsResType(struct dinPaymentDetailsResType* dinPaymentDetailsResType);
+void init_dinDSAKeyValueType(struct dinDSAKeyValueType* dinDSAKeyValueType);
+void init_dinSASchedulesType(struct dinSASchedulesType* dinSASchedulesType);
+void init_dinCertificateUpdateResType(struct dinCertificateUpdateResType* dinCertificateUpdateResType);
+void init_dinEVChargeParameterType(struct dinEVChargeParameterType* dinEVChargeParameterType);
+void init_dinMessageHeaderType(struct dinMessageHeaderType* dinMessageHeaderType);
+void init_dinBodyBaseType(struct dinBodyBaseType* dinBodyBaseType);
+void init_dinKeyValueType(struct dinKeyValueType* dinKeyValueType);
+void init_dinIntervalType(struct dinIntervalType* dinIntervalType);
+void init_dinChargeParameterDiscoveryResType(struct dinChargeParameterDiscoveryResType* dinChargeParameterDiscoveryResType);
+void init_dinPowerDeliveryReqType(struct dinPowerDeliveryReqType* dinPowerDeliveryReqType);
+void init_dinCertificateChainType(struct dinCertificateChainType* dinCertificateChainType);
+void init_dinTransformsType(struct dinTransformsType* dinTransformsType);
+void init_dinEntryType(struct dinEntryType* dinEntryType);
+void init_dinSessionStopType(struct dinSessionStopType* dinSessionStopType);
+void init_dinServiceDetailReqType(struct dinServiceDetailReqType* dinServiceDetailReqType);
+void init_dinDigestMethodType(struct dinDigestMethodType* dinDigestMethodType);
+void init_dinParameterType(struct dinParameterType* dinParameterType);
+void init_dinChargingStatusReqType(struct dinChargingStatusReqType* dinChargingStatusReqType);
+void init_dinSignatureMethodType(struct dinSignatureMethodType* dinSignatureMethodType);
+void init_dinCertificateInstallationReqType(struct dinCertificateInstallationReqType* dinCertificateInstallationReqType);
+void init_dinSalesTariffEntryType(struct dinSalesTariffEntryType* dinSalesTariffEntryType);
+void init_dinServiceDiscoveryResType(struct dinServiceDiscoveryResType* dinServiceDiscoveryResType);
+void init_dinParameterSetType(struct dinParameterSetType* dinParameterSetType);
+void init_dinCurrentDemandReqType(struct dinCurrentDemandReqType* dinCurrentDemandReqType);
+void init_dinPreChargeReqType(struct dinPreChargeReqType* dinPreChargeReqType);
+void init_dinSignatureType(struct dinSignatureType* dinSignatureType);
+void init_dinReferenceType(struct dinReferenceType* dinReferenceType);
+void init_dinProfileEntryType(struct dinProfileEntryType* dinProfileEntryType);
+void init_dinAnonType_V2G_Message(struct dinAnonType_V2G_Message* dinAnonType_V2G_Message);
+void init_dinChargeParameterDiscoveryReqType(struct dinChargeParameterDiscoveryReqType* dinChargeParameterDiscoveryReqType);
+void init_dinConsumptionCostType(struct dinConsumptionCostType* dinConsumptionCostType);
+void init_dinRSAKeyValueType(struct dinRSAKeyValueType* dinRSAKeyValueType);
+void init_dinServiceType(struct dinServiceType* dinServiceType);
+void init_dinServiceTagListType(struct dinServiceTagListType* dinServiceTagListType);
+void init_dinEVSEStatusType(struct dinEVSEStatusType* dinEVSEStatusType);
+void init_dinSessionSetupResType(struct dinSessionSetupResType* dinSessionSetupResType);
+void init_dinEVPowerDeliveryParameterType(struct dinEVPowerDeliveryParameterType* dinEVPowerDeliveryParameterType);
+void init_dinX509IssuerSerialType(struct dinX509IssuerSerialType* dinX509IssuerSerialType);
+void init_dinSelectedServiceType(struct dinSelectedServiceType* dinSelectedServiceType);
+void init_dinMeteringReceiptResType(struct dinMeteringReceiptResType* dinMeteringReceiptResType);
+void init_dinDC_EVStatusType(struct dinDC_EVStatusType* dinDC_EVStatusType);
+void init_dinPhysicalValueType(struct dinPhysicalValueType* dinPhysicalValueType);
+void init_dinManifestType(struct dinManifestType* dinManifestType);
+void init_dinPMaxScheduleEntryType(struct dinPMaxScheduleEntryType* dinPMaxScheduleEntryType);
+void init_dinServiceParameterListType(struct dinServiceParameterListType* dinServiceParameterListType);
+void init_dinSignatureValueType(struct dinSignatureValueType* dinSignatureValueType);
+void init_dinPaymentOptionsType(struct dinPaymentOptionsType* dinPaymentOptionsType);
+void init_dinServiceTagType(struct dinServiceTagType* dinServiceTagType);
+void init_dinAC_EVSEStatusType(struct dinAC_EVSEStatusType* dinAC_EVSEStatusType);
+void init_dinCertificateUpdateReqType(struct dinCertificateUpdateReqType* dinCertificateUpdateReqType);
+void init_dinServicePaymentSelectionResType(struct dinServicePaymentSelectionResType* dinServicePaymentSelectionResType);
+void init_dinSAScheduleTupleType(struct dinSAScheduleTupleType* dinSAScheduleTupleType);
+void init_dinChargingProfileType(struct dinChargingProfileType* dinChargingProfileType);
+void init_dinServiceDiscoveryReqType(struct dinServiceDiscoveryReqType* dinServiceDiscoveryReqType);
+void init_dinAC_EVSEChargeParameterType(struct dinAC_EVSEChargeParameterType* dinAC_EVSEChargeParameterType);
+void init_dinKeyInfoType(struct dinKeyInfoType* dinKeyInfoType);
+void init_dinPaymentDetailsReqType(struct dinPaymentDetailsReqType* dinPaymentDetailsReqType);
+void init_dinCableCheckResType(struct dinCableCheckResType* dinCableCheckResType);
+void init_dinObjectType(struct dinObjectType* dinObjectType);
+void init_dinSessionStopResType(struct dinSessionStopResType* dinSessionStopResType);
+void init_dinSignedInfoType(struct dinSignedInfoType* dinSignedInfoType);
+void init_dinSalesTariffType(struct dinSalesTariffType* dinSalesTariffType);
+void init_dinCostType(struct dinCostType* dinCostType);
+void init_dinServiceChargeType(struct dinServiceChargeType* dinServiceChargeType);
+void init_dinDC_EVSEStatusType(struct dinDC_EVSEStatusType* dinDC_EVSEStatusType);
+void init_dinRetrievalMethodType(struct dinRetrievalMethodType* dinRetrievalMethodType);
+void init_dinNotificationType(struct dinNotificationType* dinNotificationType);
+void init_dinPGPDataType(struct dinPGPDataType* dinPGPDataType);
+void init_dinCertificateInstallationResType(struct dinCertificateInstallationResType* dinCertificateInstallationResType);
+void init_dinSignaturePropertyType(struct dinSignaturePropertyType* dinSignaturePropertyType);
+void init_dinMeterInfoType(struct dinMeterInfoType* dinMeterInfoType);
+void init_dinSubCertificatesType(struct dinSubCertificatesType* dinSubCertificatesType);
+
+
+#endif /* DEPLOY_DIN_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 345 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypesDecoder.c


+ 65 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypesDecoder.h

@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypesDecoder.h
+ * \brief 	Decoder for datatype definitions
+ *
+ */
+
+#ifndef EXI_din_DATATYPES_DECODER_H
+#define EXI_din_DATATYPES_DECODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "dinEXIDatatypes.h"
+
+#if DEPLOY_DIN_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+
+int decode_dinExiDocument(bitstream_t* stream, struct dinEXIDocument* exiDoc);
+
+#if DEPLOY_DIN_CODEC_FRAGMENT == SUPPORT_YES
+int decode_dinExiFragment(bitstream_t* stream, struct dinEXIFragment* exiFrag);
+#endif /* DEPLOY_DIN_CODEC_FRAGMENT */
+
+#endif /* DEPLOY_DIN_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 281 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypesEncoder.c


+ 68 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/din/dinEXIDatatypesEncoder.h

@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypesEncoder.h
+ * \brief 	Encoder for datatype definitions
+ *
+ */
+
+#ifndef EXI_din_DATATYPES_ENCODER_H
+#define EXI_din_DATATYPES_ENCODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "dinEXIDatatypes.h"
+
+#if DEPLOY_DIN_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+
+
+int encode_dinExiDocument(bitstream_t* stream, struct dinEXIDocument* exiDoc);
+
+#if DEPLOY_DIN_CODEC_FRAGMENT == SUPPORT_YES
+int encode_dinExiFragment(bitstream_t* stream, struct dinEXIFragment* exiFrag);
+#endif /* DEPLOY_DIN_CODEC_FRAGMENT */
+
+
+#endif /* DEPLOY_DIN_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 992 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypes.c

@@ -0,0 +1,992 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include <stdint.h>
+
+#include "iso1EXIDatatypes.h"
+#include "../codec/EXITypes.h"
+
+
+#ifndef EXI_iso1_DATATYPES_C
+#define EXI_iso1_DATATYPES_C
+
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+
+
+void init_iso1EXIDocument(struct iso1EXIDocument* exiDoc) {
+	exiDoc->V2G_Message_isUsed = 0u;
+	exiDoc->ServiceDiscoveryReq_isUsed = 0u;
+	exiDoc->ServiceDiscoveryRes_isUsed = 0u;
+	exiDoc->MeteringReceiptReq_isUsed = 0u;
+	exiDoc->PaymentDetailsReq_isUsed = 0u;
+	exiDoc->MeteringReceiptRes_isUsed = 0u;
+	exiDoc->PaymentDetailsRes_isUsed = 0u;
+	exiDoc->SessionSetupReq_isUsed = 0u;
+	exiDoc->SessionSetupRes_isUsed = 0u;
+	exiDoc->CableCheckReq_isUsed = 0u;
+	exiDoc->CableCheckRes_isUsed = 0u;
+	exiDoc->CertificateInstallationReq_isUsed = 0u;
+	exiDoc->CertificateInstallationRes_isUsed = 0u;
+	exiDoc->WeldingDetectionReq_isUsed = 0u;
+	exiDoc->WeldingDetectionRes_isUsed = 0u;
+	exiDoc->CertificateUpdateReq_isUsed = 0u;
+	exiDoc->CertificateUpdateRes_isUsed = 0u;
+	exiDoc->PaymentServiceSelectionReq_isUsed = 0u;
+	exiDoc->PowerDeliveryReq_isUsed = 0u;
+	exiDoc->PaymentServiceSelectionRes_isUsed = 0u;
+	exiDoc->PowerDeliveryRes_isUsed = 0u;
+	exiDoc->ChargingStatusReq_isUsed = 0u;
+	exiDoc->ChargingStatusRes_isUsed = 0u;
+	exiDoc->BodyElement_isUsed = 0u;
+	exiDoc->CurrentDemandReq_isUsed = 0u;
+	exiDoc->PreChargeReq_isUsed = 0u;
+	exiDoc->CurrentDemandRes_isUsed = 0u;
+	exiDoc->PreChargeRes_isUsed = 0u;
+	exiDoc->SessionStopReq_isUsed = 0u;
+	exiDoc->AuthorizationReq_isUsed = 0u;
+	exiDoc->SessionStopRes_isUsed = 0u;
+	exiDoc->AuthorizationRes_isUsed = 0u;
+	exiDoc->ChargeParameterDiscoveryReq_isUsed = 0u;
+	exiDoc->ChargeParameterDiscoveryRes_isUsed = 0u;
+	exiDoc->ServiceDetailReq_isUsed = 0u;
+	exiDoc->ServiceDetailRes_isUsed = 0u;
+	exiDoc->DC_EVSEStatus_isUsed = 0u;
+	exiDoc->RelativeTimeInterval_isUsed = 0u;
+	exiDoc->SalesTariffEntry_isUsed = 0u;
+	exiDoc->DC_EVPowerDeliveryParameter_isUsed = 0u;
+	exiDoc->SASchedules_isUsed = 0u;
+	exiDoc->AC_EVChargeParameter_isUsed = 0u;
+	exiDoc->SAScheduleList_isUsed = 0u;
+	exiDoc->DC_EVStatus_isUsed = 0u;
+	exiDoc->EVStatus_isUsed = 0u;
+	exiDoc->DC_EVChargeParameter_isUsed = 0u;
+	exiDoc->DC_EVSEChargeParameter_isUsed = 0u;
+	exiDoc->EVSEStatus_isUsed = 0u;
+	exiDoc->TimeInterval_isUsed = 0u;
+	exiDoc->EVPowerDeliveryParameter_isUsed = 0u;
+	exiDoc->EVSEChargeParameter_isUsed = 0u;
+	exiDoc->AC_EVSEStatus_isUsed = 0u;
+	exiDoc->Entry_isUsed = 0u;
+	exiDoc->AC_EVSEChargeParameter_isUsed = 0u;
+	exiDoc->PMaxScheduleEntry_isUsed = 0u;
+	exiDoc->EVChargeParameter_isUsed = 0u;
+	exiDoc->SignatureProperty_isUsed = 0u;
+	exiDoc->DSAKeyValue_isUsed = 0u;
+	exiDoc->SignatureProperties_isUsed = 0u;
+	exiDoc->KeyValue_isUsed = 0u;
+	exiDoc->Transforms_isUsed = 0u;
+	exiDoc->DigestMethod_isUsed = 0u;
+	exiDoc->Signature_isUsed = 0u;
+	exiDoc->RetrievalMethod_isUsed = 0u;
+	exiDoc->Manifest_isUsed = 0u;
+	exiDoc->Reference_isUsed = 0u;
+	exiDoc->CanonicalizationMethod_isUsed = 0u;
+	exiDoc->RSAKeyValue_isUsed = 0u;
+	exiDoc->Transform_isUsed = 0u;
+	exiDoc->PGPData_isUsed = 0u;
+	exiDoc->MgmtData_isUsed = 0u;
+	exiDoc->SignatureMethod_isUsed = 0u;
+	exiDoc->KeyInfo_isUsed = 0u;
+	exiDoc->SPKIData_isUsed = 0u;
+	exiDoc->X509Data_isUsed = 0u;
+	exiDoc->SignatureValue_isUsed = 0u;
+	exiDoc->KeyName_isUsed = 0u;
+	exiDoc->DigestValue_isUsed = 0u;
+	exiDoc->SignedInfo_isUsed = 0u;
+	exiDoc->Object_isUsed = 0u;
+}
+
+
+#if DEPLOY_ISO1_CODEC_FRAGMENT == SUPPORT_YES
+void init_iso1EXIFragment(struct iso1EXIFragment* exiFrag) {
+	exiFrag->ChargingComplete_isUsed = 0u;
+	exiFrag->EVMaxVoltage_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->EVRESSSOC_isUsed = 0u;
+	exiFrag->MeterReading_isUsed = 0u;
+	exiFrag->physicalValue_isUsed = 0u;
+	exiFrag->TimeInterval_isUsed = 0u;
+	exiFrag->AC_EVSEStatus_isUsed = 0u;
+	exiFrag->AC_EVSEStatus_isUsed = 0u;
+	exiFrag->EVMaxCurrent_isUsed = 0u;
+	exiFrag->ChargingProfileEntryStart_isUsed = 0u;
+	exiFrag->EVSEMaxCurrent_isUsed = 0u;
+	exiFrag->costKind_isUsed = 0u;
+	exiFrag->EAmount_isUsed = 0u;
+	exiFrag->EnergyTransferMode_isUsed = 0u;
+	exiFrag->X509SerialNumber_isUsed = 0u;
+	exiFrag->NumEPriceLevels_isUsed = 0u;
+	exiFrag->RetrievalMethod_isUsed = 0u;
+	exiFrag->PMax_isUsed = 0u;
+	exiFrag->ParameterSetID_isUsed = 0u;
+	exiFrag->ParameterSetID_isUsed = 0u;
+	exiFrag->BulkSOC_isUsed = 0u;
+	exiFrag->EVSEMinimumCurrentLimit_isUsed = 0u;
+	exiFrag->EVSEPowerLimitAchieved_isUsed = 0u;
+	exiFrag->SalesTariffEntry_isUsed = 0u;
+	exiFrag->Transforms_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEIsolationStatus_isUsed = 0u;
+	exiFrag->BulkChargingComplete_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->FaultCode_isUsed = 0u;
+	exiFrag->RootCertificateID_isUsed = 0u;
+	exiFrag->HMACOutputLength_isUsed = 0u;
+	exiFrag->Exponent_isUsed = 0u;
+	exiFrag->X509IssuerSerial_isUsed = 0u;
+	exiFrag->byteValue_isUsed = 0u;
+	exiFrag->SPKIData_isUsed = 0u;
+	exiFrag->SAScheduleList_isUsed = 0u;
+	exiFrag->EVMaximumPowerLimit_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->RetryCounter_isUsed = 0u;
+	exiFrag->EVSEMaximumCurrentLimit_isUsed = 0u;
+	exiFrag->SalesTariff_isUsed = 0u;
+	exiFrag->PgenCounter_isUsed = 0u;
+	exiFrag->X509Data_isUsed = 0u;
+	exiFrag->EVSECurrentRegulationTolerance_isUsed = 0u;
+	exiFrag->KeyValue_isUsed = 0u;
+	exiFrag->V2G_Message_isUsed = 0u;
+	exiFrag->EVSEMinimumVoltageLimit_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ProfileEntry_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->start_isUsed = 0u;
+	exiFrag->EVErrorCode_isUsed = 0u;
+	exiFrag->EVChargeParameter_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->EVSEPresentCurrent_isUsed = 0u;
+	exiFrag->PGPData_isUsed = 0u;
+	exiFrag->EVMinCurrent_isUsed = 0u;
+	exiFrag->FullSOC_isUsed = 0u;
+	exiFrag->amount_isUsed = 0u;
+	exiFrag->DC_EVSEChargeParameter_isUsed = 0u;
+	exiFrag->Entry_isUsed = 0u;
+	exiFrag->SessionStopRes_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->DC_EVSEStatus_isUsed = 0u;
+	exiFrag->shortValue_isUsed = 0u;
+	exiFrag->SAProvisioningCertificateChain_isUsed = 0u;
+	exiFrag->SAProvisioningCertificateChain_isUsed = 0u;
+	exiFrag->PowerDeliveryReq_isUsed = 0u;
+	exiFrag->PowerDeliveryRes_isUsed = 0u;
+	exiFrag->SessionStopReq_isUsed = 0u;
+	exiFrag->SignatureProperty_isUsed = 0u;
+	exiFrag->SessionID_isUsed = 0u;
+	exiFrag->PGPKeyPacket_isUsed = 0u;
+	exiFrag->PGPKeyPacket_isUsed = 0u;
+	exiFrag->Header_isUsed = 0u;
+	exiFrag->Seed_isUsed = 0u;
+	exiFrag->RSAKeyValue_isUsed = 0u;
+	exiFrag->FreeService_isUsed = 0u;
+	exiFrag->EVSENominalVoltage_isUsed = 0u;
+	exiFrag->XPath_isUsed = 0u;
+	exiFrag->MeteringReceiptRes_isUsed = 0u;
+	exiFrag->ServiceDiscoveryReq_isUsed = 0u;
+	exiFrag->MeteringReceiptReq_isUsed = 0u;
+	exiFrag->PreChargeRes_isUsed = 0u;
+	exiFrag->OEMProvisioningCert_isUsed = 0u;
+	exiFrag->EVEnergyCapacity_isUsed = 0u;
+	exiFrag->Signature_isUsed = 0u;
+	exiFrag->AC_EVSEChargeParameter_isUsed = 0u;
+	exiFrag->ServiceDiscoveryRes_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->PreChargeReq_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->NotificationMaxDelay_isUsed = 0u;
+	exiFrag->CableCheckReq_isUsed = 0u;
+	exiFrag->SalesTariffDescription_isUsed = 0u;
+	exiFrag->EVSEVoltageLimitAchieved_isUsed = 0u;
+	exiFrag->boolValue_isUsed = 0u;
+	exiFrag->EVCCID_isUsed = 0u;
+	exiFrag->DC_EVChargeParameter_isUsed = 0u;
+	exiFrag->ChargingStatusReq_isUsed = 0u;
+	exiFrag->CableCheckRes_isUsed = 0u;
+	exiFrag->MgmtData_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->EVSEEnergyToBeDelivered_isUsed = 0u;
+	exiFrag->EVSEMaxCurrent_isUsed = 0u;
+	exiFrag->EVSEStatus_isUsed = 0u;
+	exiFrag->Service_isUsed = 0u;
+	exiFrag->Manifest_isUsed = 0u;
+	exiFrag->EVMaximumVoltageLimit_isUsed = 0u;
+	exiFrag->P_isUsed = 0u;
+	exiFrag->Q_isUsed = 0u;
+	exiFrag->X509SubjectName_isUsed = 0u;
+	exiFrag->intValue_isUsed = 0u;
+	exiFrag->ChargingProfile_isUsed = 0u;
+	exiFrag->G_isUsed = 0u;
+	exiFrag->J_isUsed = 0u;
+	exiFrag->ServiceScope_isUsed = 0u;
+	exiFrag->ReceiptRequired_isUsed = 0u;
+	exiFrag->ReceiptRequired_isUsed = 0u;
+	exiFrag->ServiceName_isUsed = 0u;
+	exiFrag->MeterStatus_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->ChargingStatusRes_isUsed = 0u;
+	exiFrag->ServiceCategory_isUsed = 0u;
+	exiFrag->Notification_isUsed = 0u;
+	exiFrag->X509CRL_isUsed = 0u;
+	exiFrag->Y_isUsed = 0u;
+	exiFrag->EVSEPresentVoltage_isUsed = 0u;
+	exiFrag->EVSEPresentVoltage_isUsed = 0u;
+	exiFrag->EVSEPresentVoltage_isUsed = 0u;
+	exiFrag->DigestValue_isUsed = 0u;
+	exiFrag->EVSEMaximumPowerLimit_isUsed = 0u;
+	exiFrag->EVSETimeStamp_isUsed = 0u;
+	exiFrag->EVSETimeStamp_isUsed = 0u;
+	exiFrag->Cost_isUsed = 0u;
+	exiFrag->EVSEPeakCurrentRipple_isUsed = 0u;
+	exiFrag->ConsumptionCost_isUsed = 0u;
+	exiFrag->DigestMethod_isUsed = 0u;
+	exiFrag->SPKISexp_isUsed = 0u;
+	exiFrag->SessionSetupRes_isUsed = 0u;
+	exiFrag->EVSECurrentLimitAchieved_isUsed = 0u;
+	exiFrag->ServiceDetailReq_isUsed = 0u;
+	exiFrag->EVSEMaximumVoltageLimit_isUsed = 0u;
+	exiFrag->ServiceDetailRes_isUsed = 0u;
+	exiFrag->SignatureProperties_isUsed = 0u;
+	exiFrag->EPriceLevel_isUsed = 0u;
+	exiFrag->EVTargetCurrent_isUsed = 0u;
+	exiFrag->RemainingTimeToBulkSoC_isUsed = 0u;
+	exiFrag->EVTargetCurrent_isUsed = 0u;
+	exiFrag->stringValue_isUsed = 0u;
+	exiFrag->SessionSetupReq_isUsed = 0u;
+	exiFrag->Multiplier_isUsed = 0u;
+	exiFrag->CertificateUpdateRes_isUsed = 0u;
+	exiFrag->PGPKeyID_isUsed = 0u;
+	exiFrag->EVTargetVoltage_isUsed = 0u;
+	exiFrag->EVTargetVoltage_isUsed = 0u;
+	exiFrag->DSAKeyValue_isUsed = 0u;
+	exiFrag->CertificateUpdateReq_isUsed = 0u;
+	exiFrag->EVMaximumCurrentLimit_isUsed = 0u;
+	exiFrag->CanonicalizationMethod_isUsed = 0u;
+	exiFrag->X509Certificate_isUsed = 0u;
+	exiFrag->CertificateInstallationReq_isUsed = 0u;
+	exiFrag->CertificateInstallationRes_isUsed = 0u;
+	exiFrag->EVStatus_isUsed = 0u;
+	exiFrag->SupportedEnergyTransferMode_isUsed = 0u;
+	exiFrag->SignedInfo_isUsed = 0u;
+	exiFrag->eMAID_isUsed = 0u;
+	exiFrag->eMAID_isUsed = 0u;
+	exiFrag->eMAID_isUsed = 0u;
+	exiFrag->eMAID_isUsed = 0u;
+	exiFrag->MaxEntriesSAScheduleTuple_isUsed = 0u;
+	exiFrag->PaymentOption_isUsed = 0u;
+	exiFrag->SubCertificates_isUsed = 0u;
+	exiFrag->PaymentDetailsReq_isUsed = 0u;
+	exiFrag->AuthorizationReq_isUsed = 0u;
+	exiFrag->PaymentDetailsRes_isUsed = 0u;
+	exiFrag->AuthorizationRes_isUsed = 0u;
+	exiFrag->EVSEStatusCode_isUsed = 0u;
+	exiFrag->PaymentOptionList_isUsed = 0u;
+	exiFrag->SelectedServiceList_isUsed = 0u;
+	exiFrag->ContractSignatureEncryptedPrivateKey_isUsed = 0u;
+	exiFrag->ContractSignatureEncryptedPrivateKey_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->WeldingDetectionReq_isUsed = 0u;
+	exiFrag->FaultMsg_isUsed = 0u;
+	exiFrag->WeldingDetectionRes_isUsed = 0u;
+	exiFrag->ChargeProgress_isUsed = 0u;
+	exiFrag->SelectedPaymentOption_isUsed = 0u;
+	exiFrag->BulkChargingComplete_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->ParameterSet_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->EVSEChargeParameter_isUsed = 0u;
+	exiFrag->SigMeterReading_isUsed = 0u;
+	exiFrag->SignatureValue_isUsed = 0u;
+	exiFrag->SASchedules_isUsed = 0u;
+	exiFrag->SalesTariffID_isUsed = 0u;
+	exiFrag->DHpublickey_isUsed = 0u;
+	exiFrag->DHpublickey_isUsed = 0u;
+	exiFrag->ServiceParameterList_isUsed = 0u;
+	exiFrag->ListOfRootCertificateIDs_isUsed = 0u;
+	exiFrag->ListOfRootCertificateIDs_isUsed = 0u;
+	exiFrag->MeterID_isUsed = 0u;
+	exiFrag->EVSEMaximumCurrentLimit_isUsed = 0u;
+	exiFrag->ChargeService_isUsed = 0u;
+	exiFrag->amountMultiplier_isUsed = 0u;
+	exiFrag->RCD_isUsed = 0u;
+	exiFrag->EVMaximumPowerLimit_isUsed = 0u;
+	exiFrag->startValue_isUsed = 0u;
+	exiFrag->CurrentDemandReq_isUsed = 0u;
+	exiFrag->KeyName_isUsed = 0u;
+	exiFrag->DC_EVPowerDeliveryParameter_isUsed = 0u;
+	exiFrag->Body_isUsed = 0u;
+	exiFrag->ChargingComplete_isUsed = 0u;
+	exiFrag->EVSENotification_isUsed = 0u;
+	exiFrag->Value_isUsed = 0u;
+	exiFrag->KeyInfo_isUsed = 0u;
+	exiFrag->GenChallenge_isUsed = 0u;
+	exiFrag->GenChallenge_isUsed = 0u;
+	exiFrag->AC_EVChargeParameter_isUsed = 0u;
+	exiFrag->PMaxScheduleEntry_isUsed = 0u;
+	exiFrag->Parameter_isUsed = 0u;
+	exiFrag->X509SKI_isUsed = 0u;
+	exiFrag->EVSEMaximumVoltageLimit_isUsed = 0u;
+	exiFrag->SelectedService_isUsed = 0u;
+	exiFrag->PaymentServiceSelectionReq_isUsed = 0u;
+	exiFrag->PaymentServiceSelectionRes_isUsed = 0u;
+	exiFrag->Certificate_isUsed = 0u;
+	exiFrag->Certificate_isUsed = 0u;
+	exiFrag->CurrentDemandRes_isUsed = 0u;
+	exiFrag->EVReady_isUsed = 0u;
+	exiFrag->EVSEMaximumPowerLimit_isUsed = 0u;
+	exiFrag->SignatureMethod_isUsed = 0u;
+	exiFrag->PMaxSchedule_isUsed = 0u;
+	exiFrag->ServiceCategory_isUsed = 0u;
+	exiFrag->Unit_isUsed = 0u;
+	exiFrag->X509IssuerName_isUsed = 0u;
+	exiFrag->Reference_isUsed = 0u;
+	exiFrag->ChargingProfileEntryMaxNumberOfPhasesInUse_isUsed = 0u;
+	exiFrag->EVPowerDeliveryParameter_isUsed = 0u;
+	exiFrag->ChargingProfileEntryMaxPower_isUsed = 0u;
+	exiFrag->ChargeParameterDiscoveryReq_isUsed = 0u;
+	exiFrag->duration_isUsed = 0u;
+	exiFrag->TMeter_isUsed = 0u;
+	exiFrag->ChargeParameterDiscoveryRes_isUsed = 0u;
+	exiFrag->EVMaximumCurrentLimit_isUsed = 0u;
+	exiFrag->ServiceList_isUsed = 0u;
+	exiFrag->AC_EVSEStatus_isUsed = 0u;
+	exiFrag->EVMaximumVoltageLimit_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->SAScheduleTuple_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->DC_EVStatus_isUsed = 0u;
+	exiFrag->BodyElement_isUsed = 0u;
+	exiFrag->RemainingTimeToFullSoC_isUsed = 0u;
+	exiFrag->RelativeTimeInterval_isUsed = 0u;
+	exiFrag->Transform_isUsed = 0u;
+	exiFrag->DepartureTime_isUsed = 0u;
+	exiFrag->Object_isUsed = 0u;
+	exiFrag->EVEnergyRequest_isUsed = 0u;
+	exiFrag->ServiceScope_isUsed = 0u;
+	exiFrag->Modulus_isUsed = 0u;
+	exiFrag->ChargingSession_isUsed = 0u;
+	exiFrag->RequestedEnergyTransferMode_isUsed = 0u;
+	exiFrag->SessionID_isUsed = 0u;
+}
+void init_iso1EXISchemaInformedElementFragmentGrammar(struct iso1EXISchemaInformedElementFragmentGrammar* exiFrag) {
+	exiFrag->Id_isUsed = 0u;
+	exiFrag->CHARACTERS_GENERIC_isUsed = 0u;
+}
+#endif /* DEPLOY_ISO1_CODEC_FRAGMENT */
+
+void init_iso1MessageHeaderType(struct iso1MessageHeaderType* iso1MessageHeaderType) {
+	iso1MessageHeaderType->Notification_isUsed = 0u;
+	iso1MessageHeaderType->Signature_isUsed = 0u;
+}
+
+void init_iso1SignatureType(struct iso1SignatureType* iso1SignatureType) {
+	iso1SignatureType->Id_isUsed = 0u;
+	iso1SignatureType->KeyInfo_isUsed = 0u;
+	iso1SignatureType->Object.arrayLen = 0u;
+}
+
+void init_iso1PowerDeliveryReqType(struct iso1PowerDeliveryReqType* iso1PowerDeliveryReqType) {
+	iso1PowerDeliveryReqType->ChargingProfile_isUsed = 0u;
+	iso1PowerDeliveryReqType->EVPowerDeliveryParameter_isUsed = 0u;
+	iso1PowerDeliveryReqType->DC_EVPowerDeliveryParameter_isUsed = 0u;
+}
+
+void init_iso1ParameterType(struct iso1ParameterType* iso1ParameterType) {
+	iso1ParameterType->boolValue_isUsed = 0u;
+	iso1ParameterType->byteValue_isUsed = 0u;
+	iso1ParameterType->shortValue_isUsed = 0u;
+	iso1ParameterType->intValue_isUsed = 0u;
+	iso1ParameterType->physicalValue_isUsed = 0u;
+	iso1ParameterType->stringValue_isUsed = 0u;
+}
+
+void init_iso1CertificateInstallationReqType(struct iso1CertificateInstallationReqType* iso1CertificateInstallationReqType) {
+	(void)iso1CertificateInstallationReqType; /* avoid unused warning */
+}
+
+void init_iso1SessionSetupResType(struct iso1SessionSetupResType* iso1SessionSetupResType) {
+	iso1SessionSetupResType->EVSETimeStamp_isUsed = 0u;
+}
+
+void init_iso1EVChargeParameterType(struct iso1EVChargeParameterType* iso1EVChargeParameterType) {
+	iso1EVChargeParameterType->DepartureTime_isUsed = 0u;
+}
+
+void init_iso1DiffieHellmanPublickeyType(struct iso1DiffieHellmanPublickeyType* iso1DiffieHellmanPublickeyType) {
+	(void)iso1DiffieHellmanPublickeyType; /* avoid unused warning */
+}
+
+void init_iso1ServiceDiscoveryResType(struct iso1ServiceDiscoveryResType* iso1ServiceDiscoveryResType) {
+	iso1ServiceDiscoveryResType->ServiceList_isUsed = 0u;
+}
+
+void init_iso1ServiceParameterListType(struct iso1ServiceParameterListType* iso1ServiceParameterListType) {
+	iso1ServiceParameterListType->ParameterSet.arrayLen = 0u;
+}
+
+void init_iso1CertificateChainType(struct iso1CertificateChainType* iso1CertificateChainType) {
+	iso1CertificateChainType->Id_isUsed = 0u;
+	iso1CertificateChainType->SubCertificates_isUsed = 0u;
+}
+
+void init_iso1SASchedulesType(struct iso1SASchedulesType* iso1SASchedulesType) {
+	(void)iso1SASchedulesType; /* avoid unused warning */
+}
+
+void init_iso1DC_EVSEStatusType(struct iso1DC_EVSEStatusType* iso1DC_EVSEStatusType) {
+	iso1DC_EVSEStatusType->EVSEIsolationStatus_isUsed = 0u;
+}
+
+void init_iso1PreChargeResType(struct iso1PreChargeResType* iso1PreChargeResType) {
+	(void)iso1PreChargeResType; /* avoid unused warning */
+}
+
+void init_iso1ParameterSetType(struct iso1ParameterSetType* iso1ParameterSetType) {
+	iso1ParameterSetType->Parameter.arrayLen = 0u;
+}
+
+void init_iso1ServiceDetailReqType(struct iso1ServiceDetailReqType* iso1ServiceDetailReqType) {
+	(void)iso1ServiceDetailReqType; /* avoid unused warning */
+}
+
+void init_iso1RelativeTimeIntervalType(struct iso1RelativeTimeIntervalType* iso1RelativeTimeIntervalType) {
+	iso1RelativeTimeIntervalType->duration_isUsed = 0u;
+}
+
+void init_iso1SignedInfoType(struct iso1SignedInfoType* iso1SignedInfoType) {
+	iso1SignedInfoType->Id_isUsed = 0u;
+	iso1SignedInfoType->Reference.arrayLen = 0u;
+}
+
+void init_iso1EMAIDType(struct iso1EMAIDType* iso1EMAIDType) {
+	(void)iso1EMAIDType; /* avoid unused warning */
+}
+
+void init_iso1EVStatusType(struct iso1EVStatusType* iso1EVStatusType) {
+	(void)iso1EVStatusType; /* avoid unused warning */
+}
+
+void init_iso1ServiceListType(struct iso1ServiceListType* iso1ServiceListType) {
+	iso1ServiceListType->Service.arrayLen = 0u;
+}
+
+void init_iso1EVSEChargeParameterType(struct iso1EVSEChargeParameterType* iso1EVSEChargeParameterType) {
+	(void)iso1EVSEChargeParameterType; /* avoid unused warning */
+}
+
+void init_iso1EVPowerDeliveryParameterType(struct iso1EVPowerDeliveryParameterType* iso1EVPowerDeliveryParameterType) {
+	(void)iso1EVPowerDeliveryParameterType; /* avoid unused warning */
+}
+
+void init_iso1ProfileEntryType(struct iso1ProfileEntryType* iso1ProfileEntryType) {
+	iso1ProfileEntryType->ChargingProfileEntryMaxNumberOfPhasesInUse_isUsed = 0u;
+}
+
+void init_iso1AuthorizationReqType(struct iso1AuthorizationReqType* iso1AuthorizationReqType) {
+	iso1AuthorizationReqType->Id_isUsed = 0u;
+	iso1AuthorizationReqType->GenChallenge_isUsed = 0u;
+}
+
+void init_iso1MeterInfoType(struct iso1MeterInfoType* iso1MeterInfoType) {
+	iso1MeterInfoType->MeterReading_isUsed = 0u;
+	iso1MeterInfoType->SigMeterReading_isUsed = 0u;
+	iso1MeterInfoType->MeterStatus_isUsed = 0u;
+	iso1MeterInfoType->TMeter_isUsed = 0u;
+}
+
+void init_iso1ManifestType(struct iso1ManifestType* iso1ManifestType) {
+	iso1ManifestType->Id_isUsed = 0u;
+	iso1ManifestType->Reference.arrayLen = 0u;
+}
+
+void init_iso1ChargeParameterDiscoveryResType(struct iso1ChargeParameterDiscoveryResType* iso1ChargeParameterDiscoveryResType) {
+	iso1ChargeParameterDiscoveryResType->SASchedules_isUsed = 0u;
+	iso1ChargeParameterDiscoveryResType->SAScheduleList_isUsed = 0u;
+	iso1ChargeParameterDiscoveryResType->EVSEChargeParameter_isUsed = 0u;
+	iso1ChargeParameterDiscoveryResType->AC_EVSEChargeParameter_isUsed = 0u;
+	iso1ChargeParameterDiscoveryResType->DC_EVSEChargeParameter_isUsed = 0u;
+}
+
+void init_iso1PowerDeliveryResType(struct iso1PowerDeliveryResType* iso1PowerDeliveryResType) {
+	iso1PowerDeliveryResType->EVSEStatus_isUsed = 0u;
+	iso1PowerDeliveryResType->AC_EVSEStatus_isUsed = 0u;
+	iso1PowerDeliveryResType->DC_EVSEStatus_isUsed = 0u;
+}
+
+void init_iso1DC_EVChargeParameterType(struct iso1DC_EVChargeParameterType* iso1DC_EVChargeParameterType) {
+	iso1DC_EVChargeParameterType->DepartureTime_isUsed = 0u;
+	iso1DC_EVChargeParameterType->EVMaximumPowerLimit_isUsed = 0u;
+	iso1DC_EVChargeParameterType->EVEnergyCapacity_isUsed = 0u;
+	iso1DC_EVChargeParameterType->EVEnergyRequest_isUsed = 0u;
+	iso1DC_EVChargeParameterType->FullSOC_isUsed = 0u;
+	iso1DC_EVChargeParameterType->BulkSOC_isUsed = 0u;
+}
+
+void init_iso1ConsumptionCostType(struct iso1ConsumptionCostType* iso1ConsumptionCostType) {
+	iso1ConsumptionCostType->Cost.arrayLen = 0u;
+}
+
+void init_iso1PMaxScheduleType(struct iso1PMaxScheduleType* iso1PMaxScheduleType) {
+	iso1PMaxScheduleType->PMaxScheduleEntry.arrayLen = 0u;
+}
+
+void init_iso1PaymentOptionListType(struct iso1PaymentOptionListType* iso1PaymentOptionListType) {
+	iso1PaymentOptionListType->PaymentOption.arrayLen = 0u;
+}
+
+void init_iso1ObjectType(struct iso1ObjectType* iso1ObjectType) {
+	iso1ObjectType->Id_isUsed = 0u;
+	iso1ObjectType->MimeType_isUsed = 0u;
+	iso1ObjectType->Encoding_isUsed = 0u;
+	iso1ObjectType->ANY_isUsed = 0u;
+}
+
+void init_iso1PhysicalValueType(struct iso1PhysicalValueType* iso1PhysicalValueType) {
+	(void)iso1PhysicalValueType; /* avoid unused warning */
+}
+
+void init_iso1RSAKeyValueType(struct iso1RSAKeyValueType* iso1RSAKeyValueType) {
+	(void)iso1RSAKeyValueType; /* avoid unused warning */
+}
+
+void init_iso1SessionStopResType(struct iso1SessionStopResType* iso1SessionStopResType) {
+	(void)iso1SessionStopResType; /* avoid unused warning */
+}
+
+void init_iso1CertificateUpdateReqType(struct iso1CertificateUpdateReqType* iso1CertificateUpdateReqType) {
+	(void)iso1CertificateUpdateReqType; /* avoid unused warning */
+}
+
+void init_iso1SignatureValueType(struct iso1SignatureValueType* iso1SignatureValueType) {
+	iso1SignatureValueType->Id_isUsed = 0u;
+}
+
+void init_iso1PaymentDetailsReqType(struct iso1PaymentDetailsReqType* iso1PaymentDetailsReqType) {
+	(void)iso1PaymentDetailsReqType; /* avoid unused warning */
+}
+
+void init_iso1AuthorizationResType(struct iso1AuthorizationResType* iso1AuthorizationResType) {
+	(void)iso1AuthorizationResType; /* avoid unused warning */
+}
+
+void init_iso1DC_EVSEChargeParameterType(struct iso1DC_EVSEChargeParameterType* iso1DC_EVSEChargeParameterType) {
+	iso1DC_EVSEChargeParameterType->EVSECurrentRegulationTolerance_isUsed = 0u;
+	iso1DC_EVSEChargeParameterType->EVSEEnergyToBeDelivered_isUsed = 0u;
+}
+
+void init_iso1SubCertificatesType(struct iso1SubCertificatesType* iso1SubCertificatesType) {
+	iso1SubCertificatesType->Certificate.arrayLen = 0u;
+}
+
+void init_iso1ChargingStatusResType(struct iso1ChargingStatusResType* iso1ChargingStatusResType) {
+	iso1ChargingStatusResType->EVSEMaxCurrent_isUsed = 0u;
+	iso1ChargingStatusResType->MeterInfo_isUsed = 0u;
+	iso1ChargingStatusResType->ReceiptRequired_isUsed = 0u;
+}
+
+void init_iso1DSAKeyValueType(struct iso1DSAKeyValueType* iso1DSAKeyValueType) {
+	iso1DSAKeyValueType->P_isUsed = 0u;
+	iso1DSAKeyValueType->Q_isUsed = 0u;
+	iso1DSAKeyValueType->G_isUsed = 0u;
+	iso1DSAKeyValueType->J_isUsed = 0u;
+	iso1DSAKeyValueType->Seed_isUsed = 0u;
+	iso1DSAKeyValueType->PgenCounter_isUsed = 0u;
+}
+
+void init_iso1ListOfRootCertificateIDsType(struct iso1ListOfRootCertificateIDsType* iso1ListOfRootCertificateIDsType) {
+	iso1ListOfRootCertificateIDsType->RootCertificateID.arrayLen = 0u;
+}
+
+void init_iso1ChargeServiceType(struct iso1ChargeServiceType* iso1ChargeServiceType) {
+	iso1ChargeServiceType->ServiceName_isUsed = 0u;
+	iso1ChargeServiceType->ServiceScope_isUsed = 0u;
+}
+
+void init_iso1IntervalType(struct iso1IntervalType* iso1IntervalType) {
+	(void)iso1IntervalType; /* avoid unused warning */
+}
+
+void init_iso1MeteringReceiptReqType(struct iso1MeteringReceiptReqType* iso1MeteringReceiptReqType) {
+	iso1MeteringReceiptReqType->Id_isUsed = 0u;
+	iso1MeteringReceiptReqType->SAScheduleTupleID_isUsed = 0u;
+}
+
+void init_iso1ServiceDetailResType(struct iso1ServiceDetailResType* iso1ServiceDetailResType) {
+	iso1ServiceDetailResType->ServiceParameterList_isUsed = 0u;
+}
+
+void init_iso1KeyValueType(struct iso1KeyValueType* iso1KeyValueType) {
+	iso1KeyValueType->DSAKeyValue_isUsed = 0u;
+	iso1KeyValueType->RSAKeyValue_isUsed = 0u;
+	iso1KeyValueType->ANY_isUsed = 0u;
+}
+
+void init_iso1SelectedServiceListType(struct iso1SelectedServiceListType* iso1SelectedServiceListType) {
+	iso1SelectedServiceListType->SelectedService.arrayLen = 0u;
+}
+
+void init_iso1CableCheckResType(struct iso1CableCheckResType* iso1CableCheckResType) {
+	(void)iso1CableCheckResType; /* avoid unused warning */
+}
+
+void init_iso1X509IssuerSerialType(struct iso1X509IssuerSerialType* iso1X509IssuerSerialType) {
+	(void)iso1X509IssuerSerialType; /* avoid unused warning */
+}
+
+void init_iso1KeyInfoType(struct iso1KeyInfoType* iso1KeyInfoType) {
+	iso1KeyInfoType->Id_isUsed = 0u;
+	iso1KeyInfoType->KeyName.arrayLen = 0u;
+	iso1KeyInfoType->KeyValue.arrayLen = 0u;
+	iso1KeyInfoType->RetrievalMethod.arrayLen = 0u;
+	iso1KeyInfoType->X509Data.arrayLen = 0u;
+	iso1KeyInfoType->PGPData.arrayLen = 0u;
+	iso1KeyInfoType->SPKIData.arrayLen = 0u;
+	iso1KeyInfoType->MgmtData.arrayLen = 0u;
+	iso1KeyInfoType->ANY_isUsed = 0u;
+}
+
+void init_iso1TransformsType(struct iso1TransformsType* iso1TransformsType) {
+	iso1TransformsType->Transform.arrayLen = 0u;
+}
+
+void init_iso1ChargeParameterDiscoveryReqType(struct iso1ChargeParameterDiscoveryReqType* iso1ChargeParameterDiscoveryReqType) {
+	iso1ChargeParameterDiscoveryReqType->MaxEntriesSAScheduleTuple_isUsed = 0u;
+	iso1ChargeParameterDiscoveryReqType->EVChargeParameter_isUsed = 0u;
+	iso1ChargeParameterDiscoveryReqType->AC_EVChargeParameter_isUsed = 0u;
+	iso1ChargeParameterDiscoveryReqType->DC_EVChargeParameter_isUsed = 0u;
+}
+
+void init_iso1PreChargeReqType(struct iso1PreChargeReqType* iso1PreChargeReqType) {
+	(void)iso1PreChargeReqType; /* avoid unused warning */
+}
+
+void init_iso1EVSEStatusType(struct iso1EVSEStatusType* iso1EVSEStatusType) {
+	(void)iso1EVSEStatusType; /* avoid unused warning */
+}
+
+void init_iso1SignatureMethodType(struct iso1SignatureMethodType* iso1SignatureMethodType) {
+	iso1SignatureMethodType->HMACOutputLength_isUsed = 0u;
+	iso1SignatureMethodType->ANY_isUsed = 0u;
+}
+
+void init_iso1X509DataType(struct iso1X509DataType* iso1X509DataType) {
+	iso1X509DataType->X509IssuerSerial.arrayLen = 0u;
+	iso1X509DataType->X509SKI.arrayLen = 0u;
+	iso1X509DataType->X509SubjectName.arrayLen = 0u;
+	iso1X509DataType->X509Certificate.arrayLen = 0u;
+	iso1X509DataType->X509CRL.arrayLen = 0u;
+	iso1X509DataType->ANY_isUsed = 0u;
+}
+
+void init_iso1NotificationType(struct iso1NotificationType* iso1NotificationType) {
+	iso1NotificationType->FaultMsg_isUsed = 0u;
+}
+
+void init_iso1SAScheduleListType(struct iso1SAScheduleListType* iso1SAScheduleListType) {
+	iso1SAScheduleListType->SAScheduleTuple.arrayLen = 0u;
+}
+
+void init_iso1BodyType(struct iso1BodyType* iso1BodyType) {
+	iso1BodyType->BodyElement_isUsed = 0u;
+	iso1BodyType->SessionSetupReq_isUsed = 0u;
+	iso1BodyType->SessionSetupRes_isUsed = 0u;
+	iso1BodyType->ServiceDiscoveryReq_isUsed = 0u;
+	iso1BodyType->ServiceDiscoveryRes_isUsed = 0u;
+	iso1BodyType->ServiceDetailReq_isUsed = 0u;
+	iso1BodyType->ServiceDetailRes_isUsed = 0u;
+	iso1BodyType->PaymentServiceSelectionReq_isUsed = 0u;
+	iso1BodyType->PaymentServiceSelectionRes_isUsed = 0u;
+	iso1BodyType->PaymentDetailsReq_isUsed = 0u;
+	iso1BodyType->PaymentDetailsRes_isUsed = 0u;
+	iso1BodyType->AuthorizationReq_isUsed = 0u;
+	iso1BodyType->AuthorizationRes_isUsed = 0u;
+	iso1BodyType->ChargeParameterDiscoveryReq_isUsed = 0u;
+	iso1BodyType->ChargeParameterDiscoveryRes_isUsed = 0u;
+	iso1BodyType->PowerDeliveryReq_isUsed = 0u;
+	iso1BodyType->PowerDeliveryRes_isUsed = 0u;
+	iso1BodyType->MeteringReceiptReq_isUsed = 0u;
+	iso1BodyType->MeteringReceiptRes_isUsed = 0u;
+	iso1BodyType->SessionStopReq_isUsed = 0u;
+	iso1BodyType->SessionStopRes_isUsed = 0u;
+	iso1BodyType->CertificateUpdateReq_isUsed = 0u;
+	iso1BodyType->CertificateUpdateRes_isUsed = 0u;
+	iso1BodyType->CertificateInstallationReq_isUsed = 0u;
+	iso1BodyType->CertificateInstallationRes_isUsed = 0u;
+	iso1BodyType->ChargingStatusReq_isUsed = 0u;
+	iso1BodyType->ChargingStatusRes_isUsed = 0u;
+	iso1BodyType->CableCheckReq_isUsed = 0u;
+	iso1BodyType->CableCheckRes_isUsed = 0u;
+	iso1BodyType->PreChargeReq_isUsed = 0u;
+	iso1BodyType->PreChargeRes_isUsed = 0u;
+	iso1BodyType->CurrentDemandReq_isUsed = 0u;
+	iso1BodyType->CurrentDemandRes_isUsed = 0u;
+	iso1BodyType->WeldingDetectionReq_isUsed = 0u;
+	iso1BodyType->WeldingDetectionRes_isUsed = 0u;
+}
+
+void init_iso1ChargingProfileType(struct iso1ChargingProfileType* iso1ChargingProfileType) {
+	iso1ChargingProfileType->ProfileEntry.arrayLen = 0u;
+}
+
+void init_iso1TransformType(struct iso1TransformType* iso1TransformType) {
+	iso1TransformType->ANY_isUsed = 0u;
+	iso1TransformType->XPath.arrayLen = 0u;
+}
+
+void init_iso1SAScheduleTupleType(struct iso1SAScheduleTupleType* iso1SAScheduleTupleType) {
+	iso1SAScheduleTupleType->SalesTariff_isUsed = 0u;
+}
+
+void init_iso1AC_EVChargeParameterType(struct iso1AC_EVChargeParameterType* iso1AC_EVChargeParameterType) {
+	iso1AC_EVChargeParameterType->DepartureTime_isUsed = 0u;
+}
+
+void init_iso1AnonType_V2G_Message(struct iso1AnonType_V2G_Message* iso1AnonType_V2G_Message) {
+	(void)iso1AnonType_V2G_Message; /* avoid unused warning */
+}
+
+void init_iso1PaymentDetailsResType(struct iso1PaymentDetailsResType* iso1PaymentDetailsResType) {
+	(void)iso1PaymentDetailsResType; /* avoid unused warning */
+}
+
+void init_iso1ContractSignatureEncryptedPrivateKeyType(struct iso1ContractSignatureEncryptedPrivateKeyType* iso1ContractSignatureEncryptedPrivateKeyType) {
+	(void)iso1ContractSignatureEncryptedPrivateKeyType; /* avoid unused warning */
+}
+
+void init_iso1PMaxScheduleEntryType(struct iso1PMaxScheduleEntryType* iso1PMaxScheduleEntryType) {
+	iso1PMaxScheduleEntryType->TimeInterval_isUsed = 0u;
+	iso1PMaxScheduleEntryType->RelativeTimeInterval_isUsed = 0u;
+}
+
+void init_iso1SPKIDataType(struct iso1SPKIDataType* iso1SPKIDataType) {
+	iso1SPKIDataType->SPKISexp.arrayLen = 0u;
+	iso1SPKIDataType->ANY_isUsed = 0u;
+}
+
+void init_iso1MeteringReceiptResType(struct iso1MeteringReceiptResType* iso1MeteringReceiptResType) {
+	iso1MeteringReceiptResType->EVSEStatus_isUsed = 0u;
+	iso1MeteringReceiptResType->AC_EVSEStatus_isUsed = 0u;
+	iso1MeteringReceiptResType->DC_EVSEStatus_isUsed = 0u;
+}
+
+void init_iso1SessionStopReqType(struct iso1SessionStopReqType* iso1SessionStopReqType) {
+	(void)iso1SessionStopReqType; /* avoid unused warning */
+}
+
+void init_iso1WeldingDetectionResType(struct iso1WeldingDetectionResType* iso1WeldingDetectionResType) {
+	(void)iso1WeldingDetectionResType; /* avoid unused warning */
+}
+
+void init_iso1ReferenceType(struct iso1ReferenceType* iso1ReferenceType) {
+	iso1ReferenceType->Id_isUsed = 0u;
+	iso1ReferenceType->URI_isUsed = 0u;
+	iso1ReferenceType->Type_isUsed = 0u;
+	iso1ReferenceType->Transforms_isUsed = 0u;
+}
+
+void init_iso1CurrentDemandReqType(struct iso1CurrentDemandReqType* iso1CurrentDemandReqType) {
+	iso1CurrentDemandReqType->EVMaximumVoltageLimit_isUsed = 0u;
+	iso1CurrentDemandReqType->EVMaximumCurrentLimit_isUsed = 0u;
+	iso1CurrentDemandReqType->EVMaximumPowerLimit_isUsed = 0u;
+	iso1CurrentDemandReqType->BulkChargingComplete_isUsed = 0u;
+	iso1CurrentDemandReqType->RemainingTimeToFullSoC_isUsed = 0u;
+	iso1CurrentDemandReqType->RemainingTimeToBulkSoC_isUsed = 0u;
+}
+
+void init_iso1SalesTariffEntryType(struct iso1SalesTariffEntryType* iso1SalesTariffEntryType) {
+	iso1SalesTariffEntryType->TimeInterval_isUsed = 0u;
+	iso1SalesTariffEntryType->RelativeTimeInterval_isUsed = 0u;
+	iso1SalesTariffEntryType->EPriceLevel_isUsed = 0u;
+	iso1SalesTariffEntryType->ConsumptionCost.arrayLen = 0u;
+}
+
+void init_iso1EntryType(struct iso1EntryType* iso1EntryType) {
+	iso1EntryType->TimeInterval_isUsed = 0u;
+	iso1EntryType->RelativeTimeInterval_isUsed = 0u;
+}
+
+void init_iso1SessionSetupReqType(struct iso1SessionSetupReqType* iso1SessionSetupReqType) {
+	(void)iso1SessionSetupReqType; /* avoid unused warning */
+}
+
+void init_iso1CostType(struct iso1CostType* iso1CostType) {
+	iso1CostType->amountMultiplier_isUsed = 0u;
+}
+
+void init_iso1DC_EVPowerDeliveryParameterType(struct iso1DC_EVPowerDeliveryParameterType* iso1DC_EVPowerDeliveryParameterType) {
+	iso1DC_EVPowerDeliveryParameterType->BulkChargingComplete_isUsed = 0u;
+}
+
+void init_iso1RetrievalMethodType(struct iso1RetrievalMethodType* iso1RetrievalMethodType) {
+	iso1RetrievalMethodType->URI_isUsed = 0u;
+	iso1RetrievalMethodType->Type_isUsed = 0u;
+	iso1RetrievalMethodType->Transforms_isUsed = 0u;
+}
+
+void init_iso1CertificateUpdateResType(struct iso1CertificateUpdateResType* iso1CertificateUpdateResType) {
+	iso1CertificateUpdateResType->RetryCounter_isUsed = 0u;
+}
+
+void init_iso1CertificateInstallationResType(struct iso1CertificateInstallationResType* iso1CertificateInstallationResType) {
+	(void)iso1CertificateInstallationResType; /* avoid unused warning */
+}
+
+void init_iso1CanonicalizationMethodType(struct iso1CanonicalizationMethodType* iso1CanonicalizationMethodType) {
+	iso1CanonicalizationMethodType->ANY_isUsed = 0u;
+}
+
+void init_iso1WeldingDetectionReqType(struct iso1WeldingDetectionReqType* iso1WeldingDetectionReqType) {
+	(void)iso1WeldingDetectionReqType; /* avoid unused warning */
+}
+
+void init_iso1DC_EVStatusType(struct iso1DC_EVStatusType* iso1DC_EVStatusType) {
+	(void)iso1DC_EVStatusType; /* avoid unused warning */
+}
+
+void init_iso1CurrentDemandResType(struct iso1CurrentDemandResType* iso1CurrentDemandResType) {
+	iso1CurrentDemandResType->EVSEMaximumVoltageLimit_isUsed = 0u;
+	iso1CurrentDemandResType->EVSEMaximumCurrentLimit_isUsed = 0u;
+	iso1CurrentDemandResType->EVSEMaximumPowerLimit_isUsed = 0u;
+	iso1CurrentDemandResType->MeterInfo_isUsed = 0u;
+	iso1CurrentDemandResType->ReceiptRequired_isUsed = 0u;
+}
+
+void init_iso1ServiceType(struct iso1ServiceType* iso1ServiceType) {
+	iso1ServiceType->ServiceName_isUsed = 0u;
+	iso1ServiceType->ServiceScope_isUsed = 0u;
+}
+
+void init_iso1ServiceDiscoveryReqType(struct iso1ServiceDiscoveryReqType* iso1ServiceDiscoveryReqType) {
+	iso1ServiceDiscoveryReqType->ServiceScope_isUsed = 0u;
+	iso1ServiceDiscoveryReqType->ServiceCategory_isUsed = 0u;
+}
+
+void init_iso1AC_EVSEChargeParameterType(struct iso1AC_EVSEChargeParameterType* iso1AC_EVSEChargeParameterType) {
+	(void)iso1AC_EVSEChargeParameterType; /* avoid unused warning */
+}
+
+void init_iso1CableCheckReqType(struct iso1CableCheckReqType* iso1CableCheckReqType) {
+	(void)iso1CableCheckReqType; /* avoid unused warning */
+}
+
+void init_iso1SelectedServiceType(struct iso1SelectedServiceType* iso1SelectedServiceType) {
+	iso1SelectedServiceType->ParameterSetID_isUsed = 0u;
+}
+
+void init_iso1AC_EVSEStatusType(struct iso1AC_EVSEStatusType* iso1AC_EVSEStatusType) {
+	(void)iso1AC_EVSEStatusType; /* avoid unused warning */
+}
+
+void init_iso1SalesTariffType(struct iso1SalesTariffType* iso1SalesTariffType) {
+	iso1SalesTariffType->Id_isUsed = 0u;
+	iso1SalesTariffType->SalesTariffDescription_isUsed = 0u;
+	iso1SalesTariffType->NumEPriceLevels_isUsed = 0u;
+	iso1SalesTariffType->SalesTariffEntry.arrayLen = 0u;
+}
+
+void init_iso1PaymentServiceSelectionReqType(struct iso1PaymentServiceSelectionReqType* iso1PaymentServiceSelectionReqType) {
+	(void)iso1PaymentServiceSelectionReqType; /* avoid unused warning */
+}
+
+void init_iso1SignaturePropertiesType(struct iso1SignaturePropertiesType* iso1SignaturePropertiesType) {
+	iso1SignaturePropertiesType->Id_isUsed = 0u;
+	iso1SignaturePropertiesType->SignatureProperty.arrayLen = 0u;
+}
+
+void init_iso1BodyBaseType(struct iso1BodyBaseType* iso1BodyBaseType) {
+	(void)iso1BodyBaseType; /* avoid unused warning */
+}
+
+void init_iso1SupportedEnergyTransferModeType(struct iso1SupportedEnergyTransferModeType* iso1SupportedEnergyTransferModeType) {
+	iso1SupportedEnergyTransferModeType->EnergyTransferMode.arrayLen = 0u;
+}
+
+void init_iso1ChargingStatusReqType(struct iso1ChargingStatusReqType* iso1ChargingStatusReqType) {
+	(void)iso1ChargingStatusReqType; /* avoid unused warning */
+}
+
+void init_iso1PaymentServiceSelectionResType(struct iso1PaymentServiceSelectionResType* iso1PaymentServiceSelectionResType) {
+	(void)iso1PaymentServiceSelectionResType; /* avoid unused warning */
+}
+
+void init_iso1DigestMethodType(struct iso1DigestMethodType* iso1DigestMethodType) {
+	iso1DigestMethodType->ANY_isUsed = 0u;
+}
+
+void init_iso1SignaturePropertyType(struct iso1SignaturePropertyType* iso1SignaturePropertyType) {
+	iso1SignaturePropertyType->Id_isUsed = 0u;
+	iso1SignaturePropertyType->ANY_isUsed = 0u;
+}
+
+void init_iso1PGPDataType(struct iso1PGPDataType* iso1PGPDataType) {
+	iso1PGPDataType->PGPKeyID_isUsed = 0u;
+	iso1PGPDataType->PGPKeyPacket_isUsed = 0u;
+	iso1PGPDataType->ANY_isUsed = 0u;
+}
+
+
+
+#endif /* DEPLOY_ISO1_CODEC */
+
+#endif
+

+ 2992 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypes.h

@@ -0,0 +1,2992 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypes.h
+ * \brief 	Datatype definitions and structs for given XML Schema definitions and initialization methods
+ *
+ */
+
+#ifndef EXI_iso1_DATATYPES_H
+#define EXI_iso1_DATATYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SUPPORT_YES 1
+#define SUPPORT_NO 2
+#define DEPLOY_ISO1_CODEC SUPPORT_YES
+#define DEPLOY_ISO1_CODEC_FRAGMENT SUPPORT_YES
+
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+
+
+/* Datatype definitions and structs for given XML Schema definitions */
+
+#define UNION_YES 1
+#define UNION_NO 2
+#define SAVE_MEMORY_WITH_UNNAMED_UNION UNION_YES
+
+/* Note: Please find below a list of occurrence limits that have been applied */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial from unbounded to 1 (see #define iso1X509DataType_X509IssuerSerial_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509SKI from unbounded to 1 (see #define iso1X509DataType_X509SKI_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509SubjectName from unbounded to 1 (see #define iso1X509DataType_X509SubjectName_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509Certificate from unbounded to 1 (see #define iso1X509DataType_X509Certificate_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509CRL from unbounded to 1 (see #define iso1X509DataType_X509CRL_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":XPath from unbounded to 1 (see #define iso1TransformType_XPath_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":SPKISexp from unbounded to 1 (see #define iso1SPKIDataType_SPKISexp_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2013:MsgDataTypes":RootCertificateID from unbounded to 5 (see #define iso1ListOfRootCertificateIDsType_RootCertificateID_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Transform from unbounded to 1 (see #define iso1TransformsType_Transform_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":SignatureProperty from unbounded to 1 (see #define iso1SignaturePropertiesType_SignatureProperty_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Reference from unbounded to 1 (see #define iso1SignedInfoType_Reference_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Reference from unbounded to 1 (see #define iso1ManifestType_Reference_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2013:MsgDataTypes":PMaxScheduleEntry from unbounded to 5 (see #define iso1PMaxScheduleType_PMaxScheduleEntry_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":KeyName from unbounded to 1 (see #define iso1KeyInfoType_KeyName_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":KeyValue from unbounded to 1 (see #define iso1KeyInfoType_KeyValue_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":RetrievalMethod from unbounded to 1 (see #define iso1KeyInfoType_RetrievalMethod_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509Data from unbounded to 1 (see #define iso1KeyInfoType_X509Data_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":PGPData from unbounded to 1 (see #define iso1KeyInfoType_PGPData_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":SPKIData from unbounded to 1 (see #define iso1KeyInfoType_SPKIData_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":MgmtData from unbounded to 1 (see #define iso1KeyInfoType_MgmtData_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2013:MsgDataTypes":SalesTariffEntry from unbounded to 5 (see #define iso1SalesTariffType_SalesTariffEntry_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Object from unbounded to 1 (see #define iso1SignatureType_Object_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2013:MsgDataTypes":ParameterSet from unbounded to 5 (see #define iso1ServiceParameterListType_ParameterSet_ARRAY_SIZE) */
+
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EVChargeParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":DepartureTime{0-1})',  derivedBy='RESTRICTION'.  */
+struct iso1EVChargeParameterType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DepartureTime, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t DepartureTime ;
+	unsigned int DepartureTime_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DiffieHellmanPublickeyType',  base type name='dHpublickeyType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+#define iso1DiffieHellmanPublickeyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1DiffieHellmanPublickeyType_CONTENT_BYTES_SIZE 350
+struct iso1DiffieHellmanPublickeyType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1DiffieHellmanPublickeyType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* simple content: urn:iso:15118:2:2013:MsgDataTypes,dHpublickeyType */
+	struct {
+		uint8_t bytes[iso1DiffieHellmanPublickeyType_CONTENT_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  CONTENT ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SASchedulesType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso1SASchedulesType {
+	int noContent; /* avoid warning */
+};
+
+typedef enum {
+	iso1DC_EVErrorCodeType_NO_ERROR = 0,
+	iso1DC_EVErrorCodeType_FAILED_RESSTemperatureInhibit = 1,
+	iso1DC_EVErrorCodeType_FAILED_EVShiftPosition = 2,
+	iso1DC_EVErrorCodeType_FAILED_ChargerConnectorLockFault = 3,
+	iso1DC_EVErrorCodeType_FAILED_EVRESSMalfunction = 4,
+	iso1DC_EVErrorCodeType_FAILED_ChargingCurrentdifferential = 5,
+	iso1DC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange = 6,
+	iso1DC_EVErrorCodeType_Reserved_A = 7,
+	iso1DC_EVErrorCodeType_Reserved_B = 8,
+	iso1DC_EVErrorCodeType_Reserved_C = 9,
+	iso1DC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility = 10,
+	iso1DC_EVErrorCodeType_NoData = 11
+} iso1DC_EVErrorCodeType;
+
+typedef enum {
+	iso1EVSENotificationType_None = 0,
+	iso1EVSENotificationType_StopCharging = 1,
+	iso1EVSENotificationType_ReNegotiation = 2
+} iso1EVSENotificationType;
+
+typedef enum {
+	iso1responseCodeType_OK = 0,
+	iso1responseCodeType_OK_NewSessionEstablished = 1,
+	iso1responseCodeType_OK_OldSessionJoined = 2,
+	iso1responseCodeType_OK_CertificateExpiresSoon = 3,
+	iso1responseCodeType_FAILED = 4,
+	iso1responseCodeType_FAILED_SequenceError = 5,
+	iso1responseCodeType_FAILED_ServiceIDInvalid = 6,
+	iso1responseCodeType_FAILED_UnknownSession = 7,
+	iso1responseCodeType_FAILED_ServiceSelectionInvalid = 8,
+	iso1responseCodeType_FAILED_PaymentSelectionInvalid = 9,
+	iso1responseCodeType_FAILED_CertificateExpired = 10,
+	iso1responseCodeType_FAILED_SignatureError = 11,
+	iso1responseCodeType_FAILED_NoCertificateAvailable = 12,
+	iso1responseCodeType_FAILED_CertChainError = 13,
+	iso1responseCodeType_FAILED_ChallengeInvalid = 14,
+	iso1responseCodeType_FAILED_ContractCanceled = 15,
+	iso1responseCodeType_FAILED_WrongChargeParameter = 16,
+	iso1responseCodeType_FAILED_PowerDeliveryNotApplied = 17,
+	iso1responseCodeType_FAILED_TariffSelectionInvalid = 18,
+	iso1responseCodeType_FAILED_ChargingProfileInvalid = 19,
+	iso1responseCodeType_FAILED_MeteringSignatureNotValid = 20,
+	iso1responseCodeType_FAILED_NoChargeServiceSelected = 21,
+	iso1responseCodeType_FAILED_WrongEnergyTransferMode = 22,
+	iso1responseCodeType_FAILED_ContactorError = 23,
+	iso1responseCodeType_FAILED_CertificateNotAllowedAtThisEVSE = 24,
+	iso1responseCodeType_FAILED_CertificateRevoked = 25
+} iso1responseCodeType;
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,ServiceDetailReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ServiceID)',  derivedBy='EXTENSION'.  */
+struct iso1ServiceDetailReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ServiceID, urn:iso:15118:2:2013:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,RelativeTimeIntervalType',  base type name='IntervalType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":start,"urn:iso:15118:2:2013:MsgDataTypes":duration{0-1})',  derivedBy='EXTENSION'.  */
+struct iso1RelativeTimeIntervalType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":start, urn:iso:15118:2:2013:MsgDataTypes,#AnonType_startRelativeTimeIntervalType */
+	uint32_t start ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":duration, urn:iso:15118:2:2013:MsgDataTypes,#AnonType_durationRelativeTimeIntervalType */
+	uint32_t duration ;
+	unsigned int duration_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EMAIDType',  base type name='eMAIDType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+#define iso1EMAIDType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1EMAIDType_CONTENT_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1EMAIDType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1EMAIDType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* simple content: urn:iso:15118:2:2013:MsgDataTypes,eMAIDType */
+	struct {
+		exi_string_character_t characters[iso1EMAIDType_CONTENT_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  CONTENT ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EVStatusType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso1EVStatusType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EVSEChargeParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso1EVSEChargeParameterType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EVPowerDeliveryParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso1EVPowerDeliveryParameterType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,AuthorizationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":GenChallenge{0-1})',  derivedBy='EXTENSION'.  */
+#define iso1AuthorizationReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1AuthorizationReqType_GenChallenge_BYTES_SIZE 16 /* XML schema facet length for urn:iso:15118:2:2013:MsgDataTypes,genChallengeType is 16 */
+struct iso1AuthorizationReqType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1AuthorizationReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":GenChallenge, urn:iso:15118:2:2013:MsgDataTypes,genChallengeType */
+	struct {
+		uint8_t bytes[iso1AuthorizationReqType_GenChallenge_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  GenChallenge ;
+	unsigned int GenChallenge_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":MeterID,"urn:iso:15118:2:2013:MsgDataTypes":MeterReading{0-1},"urn:iso:15118:2:2013:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2013:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+#define iso1MeterInfoType_MeterID_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,meterIDType is 32 */
+#define iso1MeterInfoType_SigMeterReading_BYTES_SIZE 64 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,sigMeterReadingType is 64 */
+struct iso1MeterInfoType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":MeterID, urn:iso:15118:2:2013:MsgDataTypes,meterIDType */
+	struct {
+		exi_string_character_t characters[iso1MeterInfoType_MeterID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MeterID ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":MeterReading, http://www.w3.org/2001/XMLSchema,unsignedLong */
+	uint64_t MeterReading ;
+	unsigned int MeterReading_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SigMeterReading, urn:iso:15118:2:2013:MsgDataTypes,sigMeterReadingType */
+	struct {
+		uint8_t bytes[iso1MeterInfoType_SigMeterReading_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SigMeterReading ;
+	unsigned int SigMeterReading_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":MeterStatus, urn:iso:15118:2:2013:MsgDataTypes,meterStatusType */
+	int16_t MeterStatus ;
+	unsigned int MeterStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":TMeter, http://www.w3.org/2001/XMLSchema,long */
+	int64_t TMeter ;
+	unsigned int TMeter_isUsed:1;
+};
+
+/* 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 iso1ObjectType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1ObjectType_MimeType_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1ObjectType_Encoding_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1ObjectType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1ObjectType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1ObjectType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* attribute: MimeType {http://www.w3.org/2001/XMLSchema,string} */
+	struct {
+		exi_string_character_t characters[iso1ObjectType_MimeType_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MimeType ;
+	unsigned int MimeType_isUsed:1;
+	/* attribute: Encoding {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso1ObjectType_Encoding_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Encoding ;
+	unsigned int Encoding_isUsed:1;
+	/* element: WC[##any] */
+	struct {
+		exi_string_character_t characters[iso1ObjectType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 iso1RSAKeyValueType_Modulus_BYTES_SIZE 350
+#define iso1RSAKeyValueType_Exponent_BYTES_SIZE 350
+struct iso1RSAKeyValueType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Modulus, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso1RSAKeyValueType_Modulus_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Modulus ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Exponent, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso1RSAKeyValueType_Exponent_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Exponent ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,SessionStopResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode)',  derivedBy='EXTENSION'.  */
+struct iso1SessionStopResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+};
+
+/* 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 iso1SignatureValueType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1SignatureValueType_CONTENT_BYTES_SIZE 350
+struct iso1SignatureValueType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1SignatureValueType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* simple content: http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[iso1SignatureValueType_CONTENT_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  CONTENT ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SubCertificatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Certificate{1-4})',  derivedBy='RESTRICTION'.  */
+#define iso1SubCertificatesType_Certificate_BYTES_SIZE 800 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,certificateType is 800 */
+#define iso1SubCertificatesType_Certificate_ARRAY_SIZE 4
+struct iso1SubCertificatesType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":Certificate, urn:iso:15118:2:2013:MsgDataTypes,certificateType */
+	struct {
+		struct {
+		uint8_t bytes[iso1SubCertificatesType_Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  array[iso1SubCertificatesType_Certificate_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Certificate;
+};
+
+typedef enum {
+	iso1faultCodeType_ParsingError = 0,
+	iso1faultCodeType_NoTLSRootCertificatAvailable = 1,
+	iso1faultCodeType_UnknownError = 2
+} iso1faultCodeType;
+
+typedef enum {
+	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
+} iso1DC_EVSEStatusCodeType;
+
+/* 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 iso1DSAKeyValueType_P_BYTES_SIZE 350
+#define iso1DSAKeyValueType_Q_BYTES_SIZE 350
+#define iso1DSAKeyValueType_G_BYTES_SIZE 350
+#define iso1DSAKeyValueType_Y_BYTES_SIZE 350
+#define iso1DSAKeyValueType_J_BYTES_SIZE 350
+#define iso1DSAKeyValueType_Seed_BYTES_SIZE 350
+#define iso1DSAKeyValueType_PgenCounter_BYTES_SIZE 350
+struct iso1DSAKeyValueType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":P, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso1DSAKeyValueType_P_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  P ;
+	unsigned int P_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Q, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso1DSAKeyValueType_Q_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Q ;
+	unsigned int Q_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":G, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso1DSAKeyValueType_G_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  G ;
+	unsigned int G_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Y, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso1DSAKeyValueType_Y_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Y ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":J, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso1DSAKeyValueType_J_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  J ;
+	unsigned int J_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Seed, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso1DSAKeyValueType_Seed_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Seed ;
+	unsigned int Seed_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PgenCounter, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso1DSAKeyValueType_PgenCounter_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PgenCounter ;
+	unsigned int PgenCounter_isUsed:1;
+};
+
+typedef enum {
+	iso1EVSEProcessingType_Finished = 0,
+	iso1EVSEProcessingType_Ongoing = 1,
+	iso1EVSEProcessingType_Ongoing_WaitingForCustomerInteraction = 2
+} iso1EVSEProcessingType;
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,IntervalType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso1IntervalType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,MeteringReceiptReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":SessionID,"urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2013:MsgBody":MeterInfo)',  derivedBy='EXTENSION'.  */
+#define iso1MeteringReceiptReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1MeteringReceiptReqType_SessionID_BYTES_SIZE 8 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,sessionIDType is 8 */
+struct iso1MeteringReceiptReqType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1MeteringReceiptReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":SessionID, urn:iso:15118:2:2013:MsgDataTypes,sessionIDType */
+	struct {
+		uint8_t bytes[iso1MeteringReceiptReqType_SessionID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SessionID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2013:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":MeterID,"urn:iso:15118:2:2013:MsgDataTypes":MeterReading{0-1},"urn:iso:15118:2:2013:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2013:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1MeterInfoType MeterInfo ;
+};
+
+/* 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 iso1KeyValueType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1KeyValueType {
+	/* 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 iso1DSAKeyValueType DSAKeyValue ;
+	unsigned int DSAKeyValue_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":RSAKeyValue, 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'.  */
+	struct iso1RSAKeyValueType RSAKeyValue ;
+	unsigned int RSAKeyValue_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso1KeyValueType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 iso1X509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1X509IssuerSerialType_X509SerialNumber_BYTES_SIZE 20
+struct iso1X509IssuerSerialType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509IssuerName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		exi_string_character_t characters[iso1X509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509IssuerName ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SerialNumber, http://www.w3.org/2001/XMLSchema,integer */
+	/* int64_t X509SerialNumber; */
+	struct {
+		/** a sign value */
+		int negative;
+		/* container size */
+		/* size_t size; iso1X509IssuerSerialType_X509SerialNumber_BYTES_SIZE */
+		/** array data container */
+		/* For negative values, the Unsigned Integer holds the
+		 * magnitude of the value minus 1 */
+		uint8_t data[iso1X509IssuerSerialType_X509SerialNumber_BYTES_SIZE];
+		/** array length (len <= size) */
+		size_t len;
+	} X509SerialNumber;
+};
+
+typedef enum {
+	iso1chargingSessionType_Terminate = 0,
+	iso1chargingSessionType_Pause = 1
+} iso1chargingSessionType;
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+struct iso1EVSEStatusType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t NotificationMaxDelay ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSENotification, urn:iso:15118:2:2013:MsgDataTypes,EVSENotificationType */
+	iso1EVSENotificationType EVSENotification ;
+};
+
+/* 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 iso1SignatureMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define iso1SignatureMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1SignatureMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso1SignatureMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":HMACOutputLength, http://www.w3.org/2000/09/xmldsig#,HMACOutputLengthType */
+	int64_t HMACOutputLength ;
+	unsigned int HMACOutputLength_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso1SignatureMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 iso1X509DataType_X509IssuerSerial_ARRAY_SIZE 1
+#define iso1X509DataType_X509SKI_BYTES_SIZE 350
+#define iso1X509DataType_X509SKI_ARRAY_SIZE 1
+#define iso1X509DataType_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1X509DataType_X509SubjectName_ARRAY_SIZE 1
+#define iso1X509DataType_X509Certificate_BYTES_SIZE 350
+#define iso1X509DataType_X509Certificate_ARRAY_SIZE 1
+#define iso1X509DataType_X509CRL_BYTES_SIZE 350
+#define iso1X509DataType_X509CRL_ARRAY_SIZE 1
+#define iso1X509DataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1X509DataType {
+	/* 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 {
+		struct iso1X509IssuerSerialType array[iso1X509DataType_X509IssuerSerial_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509IssuerSerial;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SKI, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[iso1X509DataType_X509SKI_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[iso1X509DataType_X509SKI_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509SKI;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SubjectName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[iso1X509DataType_X509SubjectName_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[iso1X509DataType_X509SubjectName_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509SubjectName;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509Certificate, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[iso1X509DataType_X509Certificate_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[iso1X509DataType_X509Certificate_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509Certificate;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509CRL, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[iso1X509DataType_X509CRL_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[iso1X509DataType_X509CRL_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509CRL;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso1X509DataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+typedef enum {
+	iso1serviceCategoryType_EVCharging = 0,
+	iso1serviceCategoryType_Internet = 1,
+	iso1serviceCategoryType_ContractCertificate = 2,
+	iso1serviceCategoryType_OtherCustom = 3
+} iso1serviceCategoryType;
+
+typedef enum {
+	iso1paymentOptionType_Contract = 0,
+	iso1paymentOptionType_ExternalPayment = 1
+} iso1paymentOptionType;
+
+typedef enum {
+	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
+} iso1EnergyTransferModeType;
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,NotificationType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":FaultCode,"urn:iso:15118:2:2013:MsgDataTypes":FaultMsg{0-1})',  derivedBy='RESTRICTION'.  */
+#define iso1NotificationType_FaultMsg_CHARACTERS_SIZE 64 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,faultMsgType is 64 */
+struct iso1NotificationType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":FaultCode, urn:iso:15118:2:2013:MsgDataTypes,faultCodeType */
+	iso1faultCodeType FaultCode ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":FaultMsg, urn:iso:15118:2:2013:MsgDataTypes,faultMsgType */
+	struct {
+		exi_string_character_t characters[iso1NotificationType_FaultMsg_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  FaultMsg ;
+	unsigned int FaultMsg_isUsed:1;
+};
+
+/* 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 iso1TransformType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define iso1TransformType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1TransformType_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1TransformType_XPath_ARRAY_SIZE 1
+struct iso1TransformType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso1TransformType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso1TransformType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":XPath, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[iso1TransformType_XPath_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[iso1TransformType_XPath_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} XPath;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,PaymentDetailsResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":GenChallenge,"urn:iso:15118:2:2013:MsgBody":EVSETimeStamp)',  derivedBy='EXTENSION'.  */
+#define iso1PaymentDetailsResType_GenChallenge_BYTES_SIZE 16 /* XML schema facet length for urn:iso:15118:2:2013:MsgDataTypes,genChallengeType is 16 */
+struct iso1PaymentDetailsResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":GenChallenge, urn:iso:15118:2:2013:MsgDataTypes,genChallengeType */
+	struct {
+		uint8_t bytes[iso1PaymentDetailsResType_GenChallenge_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  GenChallenge ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSETimeStamp, http://www.w3.org/2001/XMLSchema,long */
+	int64_t EVSETimeStamp ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ContractSignatureEncryptedPrivateKeyType',  base type name='privateKeyType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+#define iso1ContractSignatureEncryptedPrivateKeyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1ContractSignatureEncryptedPrivateKeyType_CONTENT_BYTES_SIZE 350
+struct iso1ContractSignatureEncryptedPrivateKeyType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1ContractSignatureEncryptedPrivateKeyType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* simple content: urn:iso:15118:2:2013:MsgDataTypes,privateKeyType */
+	struct {
+		uint8_t bytes[iso1ContractSignatureEncryptedPrivateKeyType_CONTENT_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  CONTENT ;
+};
+
+/* 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 iso1SPKIDataType_SPKISexp_BYTES_SIZE 350
+#define iso1SPKIDataType_SPKISexp_ARRAY_SIZE 1
+#define iso1SPKIDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1SPKIDataType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SPKISexp, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[iso1SPKIDataType_SPKISexp_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[iso1SPKIDataType_SPKISexp_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SPKISexp;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso1SPKIDataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,SessionStopReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ChargingSession)',  derivedBy='EXTENSION'.  */
+struct iso1SessionStopReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ChargingSession, urn:iso:15118:2:2013:MsgDataTypes,chargingSessionType */
+	iso1chargingSessionType ChargingSession ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EntryType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":TimeInterval)',  derivedBy='RESTRICTION'.  */
+struct iso1EntryType {
+	/* substitutionGroup */
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+		/* element: "urn:iso:15118:2:2013:MsgDataTypes":TimeInterval, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,IntervalType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+		struct iso1IntervalType TimeInterval ;
+		/* element: "urn:iso:15118:2:2013:MsgDataTypes":RelativeTimeInterval, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,RelativeTimeIntervalType',  base type name='IntervalType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":start,"urn:iso:15118:2:2013:MsgDataTypes":duration{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso1RelativeTimeIntervalType RelativeTimeInterval ;
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	};
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+		unsigned int TimeInterval_isUsed:1;
+		unsigned int RelativeTimeInterval_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,SessionSetupReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":EVCCID)',  derivedBy='EXTENSION'.  */
+#define iso1SessionSetupReqType_EVCCID_BYTES_SIZE 6 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,evccIDType is 6 */
+struct iso1SessionSetupReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVCCID, urn:iso:15118:2:2013:MsgDataTypes,evccIDType */
+	struct {
+		uint8_t bytes[iso1SessionSetupReqType_EVCCID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  EVCCID ;
+};
+
+typedef enum {
+	iso1isolationLevelType_Invalid = 0,
+	iso1isolationLevelType_Valid = 1,
+	iso1isolationLevelType_Warning = 2,
+	iso1isolationLevelType_Fault = 3,
+	iso1isolationLevelType_No_IMD = 4
+} iso1isolationLevelType;
+
+/* 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 iso1CanonicalizationMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define iso1CanonicalizationMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1CanonicalizationMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso1CanonicalizationMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##any] */
+	struct {
+		exi_string_character_t characters[iso1CanonicalizationMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":EVReady,"urn:iso:15118:2:2013:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2013:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+struct iso1DC_EVStatusType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVReady, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVReady ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVErrorCode, urn:iso:15118:2:2013:MsgDataTypes,DC_EVErrorCodeType */
+	iso1DC_EVErrorCodeType EVErrorCode ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVRESSSOC, urn:iso:15118:2:2013:MsgDataTypes,percentValueType */
+	int8_t EVRESSSOC ;
+};
+
+typedef enum {
+	iso1costKindType_relativePricePercentage = 0,
+	iso1costKindType_RenewableGenerationPercentage = 1,
+	iso1costKindType_CarbonDioxideEmission = 2
+} iso1costKindType;
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ServiceID,"urn:iso:15118:2:2013:MsgDataTypes":ServiceName{0-1},"urn:iso:15118:2:2013:MsgDataTypes":ServiceCategory,"urn:iso:15118:2:2013:MsgDataTypes":ServiceScope{0-1},"urn:iso:15118:2:2013:MsgDataTypes":FreeService)',  derivedBy='RESTRICTION'.  */
+#define iso1ServiceType_ServiceName_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,serviceNameType is 32 */
+#define iso1ServiceType_ServiceScope_CHARACTERS_SIZE 64 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,serviceScopeType is 64 */
+struct iso1ServiceType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ServiceID, urn:iso:15118:2:2013:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ServiceName, urn:iso:15118:2:2013:MsgDataTypes,serviceNameType */
+	struct {
+		exi_string_character_t characters[iso1ServiceType_ServiceName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceName ;
+	unsigned int ServiceName_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ServiceCategory, urn:iso:15118:2:2013:MsgDataTypes,serviceCategoryType */
+	iso1serviceCategoryType ServiceCategory ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ServiceScope, urn:iso:15118:2:2013:MsgDataTypes,serviceScopeType */
+	struct {
+		exi_string_character_t characters[iso1ServiceType_ServiceScope_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceScope ;
+	unsigned int ServiceScope_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":FreeService, http://www.w3.org/2001/XMLSchema,boolean */
+	int FreeService ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,ServiceDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ServiceScope{0-1},"urn:iso:15118:2:2013:MsgBody":ServiceCategory{0-1})',  derivedBy='EXTENSION'.  */
+#define iso1ServiceDiscoveryReqType_ServiceScope_CHARACTERS_SIZE 64 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,serviceScopeType is 64 */
+struct iso1ServiceDiscoveryReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ServiceScope, urn:iso:15118:2:2013:MsgDataTypes,serviceScopeType */
+	struct {
+		exi_string_character_t characters[iso1ServiceDiscoveryReqType_ServiceScope_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceScope ;
+	unsigned int ServiceScope_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ServiceCategory, urn:iso:15118:2:2013:MsgDataTypes,serviceCategoryType */
+	iso1serviceCategoryType ServiceCategory ;
+	unsigned int ServiceCategory_isUsed:1;
+};
+
+typedef enum {
+	iso1chargeProgressType_Start = 0,
+	iso1chargeProgressType_Stop = 1,
+	iso1chargeProgressType_Renegotiate = 2
+} iso1chargeProgressType;
+
+typedef enum {
+	iso1valueType_bool = 0,
+	iso1valueType_byte = 1,
+	iso1valueType_short = 2,
+	iso1valueType_int = 3,
+	iso1valueType_physicalValue = 4,
+	iso1valueType_string = 5
+} iso1valueType;
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,CableCheckReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":DC_EVStatus)',  derivedBy='EXTENSION'.  */
+struct iso1CableCheckReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":DC_EVStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":EVReady,"urn:iso:15118:2:2013:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2013:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVStatusType DC_EVStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SelectedServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ServiceID,"urn:iso:15118:2:2013:MsgDataTypes":ParameterSetID{0-1})',  derivedBy='RESTRICTION'.  */
+struct iso1SelectedServiceType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ServiceID, urn:iso:15118:2:2013:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ParameterSetID, http://www.w3.org/2001/XMLSchema,short */
+	int16_t ParameterSetID ;
+	unsigned int ParameterSetID_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,AC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":RCD))',  derivedBy='EXTENSION'.  */
+struct iso1AC_EVSEStatusType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t NotificationMaxDelay ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSENotification, urn:iso:15118:2:2013:MsgDataTypes,EVSENotificationType */
+	iso1EVSENotificationType EVSENotification ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":RCD, http://www.w3.org/2001/XMLSchema,boolean */
+	int RCD ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,BodyBaseType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso1BodyBaseType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SupportedEnergyTransferModeType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":EnergyTransferMode{1-6})',  derivedBy='RESTRICTION'.  */
+#define iso1SupportedEnergyTransferModeType_EnergyTransferMode_ARRAY_SIZE 6
+struct iso1SupportedEnergyTransferModeType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EnergyTransferMode, urn:iso:15118:2:2013:MsgDataTypes,EnergyTransferModeType */
+	struct {
+		iso1EnergyTransferModeType array[iso1SupportedEnergyTransferModeType_EnergyTransferMode_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} EnergyTransferMode;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,ChargingStatusReqType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+struct iso1ChargingStatusReqType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,PaymentServiceSelectionResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode)',  derivedBy='EXTENSION'.  */
+struct iso1PaymentServiceSelectionResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+};
+
+/* 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 iso1DigestMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR
+#define iso1DigestMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1DigestMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso1DigestMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso1DigestMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 iso1SignaturePropertyType_Target_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1SignaturePropertyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1SignaturePropertyType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1SignaturePropertyType {
+	/* attribute: Target {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso1SignaturePropertyType_Target_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Target ;
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1SignaturePropertyType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso1SignaturePropertyType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+typedef enum {
+	iso1unitSymbolType_h = 0,
+	iso1unitSymbolType_m = 1,
+	iso1unitSymbolType_s = 2,
+	iso1unitSymbolType_A = 3,
+	iso1unitSymbolType_V = 4,
+	iso1unitSymbolType_W = 5,
+	iso1unitSymbolType_Wh = 6
+} iso1unitSymbolType;
+
+/* 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 iso1PGPDataType_PGPKeyID_BYTES_SIZE 350
+#define iso1PGPDataType_PGPKeyPacket_BYTES_SIZE 350
+#define iso1PGPDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1PGPDataType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPKeyID, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[iso1PGPDataType_PGPKeyID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyID ;
+	unsigned int PGPKeyID_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[iso1PGPDataType_PGPKeyPacket_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyPacket ;
+	unsigned int PGPKeyPacket_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso1PGPDataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,SessionSetupResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":EVSEID,"urn:iso:15118:2:2013:MsgBody":EVSETimeStamp{0-1})',  derivedBy='EXTENSION'.  */
+#define iso1SessionSetupResType_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,evseIDType is 37 */
+struct iso1SessionSetupResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEID, urn:iso:15118:2:2013:MsgDataTypes,evseIDType */
+	struct {
+		exi_string_character_t characters[iso1SessionSetupResType_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSETimeStamp, http://www.w3.org/2001/XMLSchema,long */
+	int64_t EVSETimeStamp ;
+	unsigned int EVSETimeStamp_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Certificate,"urn:iso:15118:2:2013:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+#define iso1CertificateChainType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1CertificateChainType_Certificate_BYTES_SIZE 800 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,certificateType is 800 */
+struct iso1CertificateChainType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1CertificateChainType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":Certificate, urn:iso:15118:2:2013:MsgDataTypes,certificateType */
+	struct {
+		uint8_t bytes[iso1CertificateChainType_Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Certificate ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SubCertificates, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SubCertificatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Certificate{1-4})',  derivedBy='RESTRICTION'.  */
+	struct iso1SubCertificatesType SubCertificates ;
+	unsigned int SubCertificates_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatusCode))',  derivedBy='EXTENSION'.  */
+struct iso1DC_EVSEStatusType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t NotificationMaxDelay ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSENotification, urn:iso:15118:2:2013:MsgDataTypes,EVSENotificationType */
+	iso1EVSENotificationType EVSENotification ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEIsolationStatus, urn:iso:15118:2:2013:MsgDataTypes,isolationLevelType */
+	iso1isolationLevelType EVSEIsolationStatus ;
+	unsigned int EVSEIsolationStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEStatusCode, urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEStatusCodeType */
+	iso1DC_EVSEStatusCodeType EVSEStatusCode ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Service{1-8})',  derivedBy='RESTRICTION'.  */
+#define iso1ServiceListType_Service_ARRAY_SIZE 8
+struct iso1ServiceListType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":Service, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ServiceID,"urn:iso:15118:2:2013:MsgDataTypes":ServiceName{0-1},"urn:iso:15118:2:2013:MsgDataTypes":ServiceCategory,"urn:iso:15118:2:2013:MsgDataTypes":ServiceScope{0-1},"urn:iso:15118:2:2013:MsgDataTypes":FreeService)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso1ServiceType array[iso1ServiceListType_Service_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Service;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,PowerDeliveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatus)',  derivedBy='EXTENSION'.  */
+struct iso1PowerDeliveryResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso1EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":AC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,AC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":RCD))',  derivedBy='EXTENSION'.  */
+	struct iso1AC_EVSEStatusType AC_EVSEStatus ;
+	unsigned int AC_EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatusCode))',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVSEStatusType DC_EVSEStatus ;
+	unsigned int DC_EVSEStatus_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PaymentOptionListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":PaymentOption{1-2})',  derivedBy='RESTRICTION'.  */
+#define iso1PaymentOptionListType_PaymentOption_ARRAY_SIZE 2
+struct iso1PaymentOptionListType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":PaymentOption, urn:iso:15118:2:2013:MsgDataTypes,paymentOptionType */
+	struct {
+		iso1paymentOptionType array[iso1PaymentOptionListType_PaymentOption_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PaymentOption;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+struct iso1PhysicalValueType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":Multiplier, urn:iso:15118:2:2013:MsgDataTypes,unitMultiplierType */
+	int8_t Multiplier ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":Unit, urn:iso:15118:2:2013:MsgDataTypes,unitSymbolType */
+	iso1unitSymbolType Unit ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":Value, http://www.w3.org/2001/XMLSchema,short */
+	int16_t Value ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,PaymentDetailsReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":eMAID,"urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain)',  derivedBy='EXTENSION'.  */
+#define iso1PaymentDetailsReqType_eMAID_CHARACTERS_SIZE 15 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,eMAIDType is 15 */
+struct iso1PaymentDetailsReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":eMAID, urn:iso:15118:2:2013:MsgDataTypes,eMAIDType */
+	struct {
+		exi_string_character_t characters[iso1PaymentDetailsReqType_eMAID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  eMAID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Certificate,"urn:iso:15118:2:2013:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1CertificateChainType ContractSignatureCertChain ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,AuthorizationResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":EVSEProcessing)',  derivedBy='EXTENSION'.  */
+struct iso1AuthorizationResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEProcessing, urn:iso:15118:2:2013:MsgDataTypes,EVSEProcessingType */
+	iso1EVSEProcessingType EVSEProcessing ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEChargeParameterType',  base type name='EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":DC_EVSEStatus,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMaximumCurrentLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMaximumPowerLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMaximumVoltageLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMinimumCurrentLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMinimumVoltageLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVSECurrentRegulationTolerance{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEPeakCurrentRipple,"urn:iso:15118:2:2013:MsgDataTypes":EVSEEnergyToBeDelivered{0-1})',  derivedBy='EXTENSION'.  */
+struct iso1DC_EVSEChargeParameterType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatusCode))',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVSEStatusType DC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEMaximumCurrentLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEMaximumCurrentLimit ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEMaximumPowerLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEMaximumPowerLimit ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEMaximumVoltageLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEMaximumVoltageLimit ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEMinimumCurrentLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEMinimumCurrentLimit ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEMinimumVoltageLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEMinimumVoltageLimit ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSECurrentRegulationTolerance, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSECurrentRegulationTolerance ;
+	unsigned int EVSECurrentRegulationTolerance_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEPeakCurrentRipple, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEPeakCurrentRipple ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEEnergyToBeDelivered, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEEnergyToBeDelivered ;
+	unsigned int EVSEEnergyToBeDelivered_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,ChargingStatusResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":EVSEID,"urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID,"urn:iso:15118:2:2013:MsgBody":EVSEMaxCurrent{0-1},"urn:iso:15118:2:2013:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2013:MsgBody":ReceiptRequired{0-1},"urn:iso:15118:2:2013:MsgBody":AC_EVSEStatus)',  derivedBy='EXTENSION'.  */
+#define iso1ChargingStatusResType_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,evseIDType is 37 */
+struct iso1ChargingStatusResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEID, urn:iso:15118:2:2013:MsgDataTypes,evseIDType */
+	struct {
+		exi_string_character_t characters[iso1ChargingStatusResType_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2013:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEMaxCurrent, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEMaxCurrent ;
+	unsigned int EVSEMaxCurrent_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":MeterID,"urn:iso:15118:2:2013:MsgDataTypes":MeterReading{0-1},"urn:iso:15118:2:2013:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2013:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1MeterInfoType MeterInfo ;
+	unsigned int MeterInfo_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ReceiptRequired, http://www.w3.org/2001/XMLSchema,boolean */
+	int ReceiptRequired ;
+	unsigned int ReceiptRequired_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":AC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,AC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":RCD))',  derivedBy='EXTENSION'.  */
+	struct iso1AC_EVSEStatusType AC_EVSEStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ListOfRootCertificateIDsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":RootCertificateID{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define iso1ListOfRootCertificateIDsType_RootCertificateID_ARRAY_SIZE 5
+struct iso1ListOfRootCertificateIDsType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":RootCertificateID, 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 {
+		struct iso1X509IssuerSerialType array[iso1ListOfRootCertificateIDsType_RootCertificateID_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} RootCertificateID;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ChargeServiceType',  base type name='ServiceType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":ServiceID,"urn:iso:15118:2:2013:MsgDataTypes":ServiceName{0-1},"urn:iso:15118:2:2013:MsgDataTypes":ServiceCategory,"urn:iso:15118:2:2013:MsgDataTypes":ServiceScope{0-1},"urn:iso:15118:2:2013:MsgDataTypes":FreeService),("urn:iso:15118:2:2013:MsgDataTypes":SupportedEnergyTransferMode))',  derivedBy='EXTENSION'.  */
+#define iso1ChargeServiceType_ServiceName_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,serviceNameType is 32 */
+#define iso1ChargeServiceType_ServiceScope_CHARACTERS_SIZE 64 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,serviceScopeType is 64 */
+struct iso1ChargeServiceType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ServiceID, urn:iso:15118:2:2013:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ServiceName, urn:iso:15118:2:2013:MsgDataTypes,serviceNameType */
+	struct {
+		exi_string_character_t characters[iso1ChargeServiceType_ServiceName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceName ;
+	unsigned int ServiceName_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ServiceCategory, urn:iso:15118:2:2013:MsgDataTypes,serviceCategoryType */
+	iso1serviceCategoryType ServiceCategory ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ServiceScope, urn:iso:15118:2:2013:MsgDataTypes,serviceScopeType */
+	struct {
+		exi_string_character_t characters[iso1ChargeServiceType_ServiceScope_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceScope ;
+	unsigned int ServiceScope_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":FreeService, http://www.w3.org/2001/XMLSchema,boolean */
+	int FreeService ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SupportedEnergyTransferMode, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SupportedEnergyTransferModeType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":EnergyTransferMode{1-6})',  derivedBy='RESTRICTION'.  */
+	struct iso1SupportedEnergyTransferModeType SupportedEnergyTransferMode ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SelectedServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":SelectedService{1-16})',  derivedBy='RESTRICTION'.  */
+#define iso1SelectedServiceListType_SelectedService_ARRAY_SIZE 16
+struct iso1SelectedServiceListType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SelectedService, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SelectedServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ServiceID,"urn:iso:15118:2:2013:MsgDataTypes":ParameterSetID{0-1})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso1SelectedServiceType array[iso1SelectedServiceListType_SelectedService_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SelectedService;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,CableCheckResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2013:MsgBody":EVSEProcessing)',  derivedBy='EXTENSION'.  */
+struct iso1CableCheckResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatusCode))',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVSEStatusType DC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEProcessing, urn:iso:15118:2:2013:MsgDataTypes,EVSEProcessingType */
+	iso1EVSEProcessingType EVSEProcessing ;
+};
+
+/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define iso1TransformsType_Transform_ARRAY_SIZE 1
+struct iso1TransformsType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transform, 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'.  */
+	struct {
+		struct iso1TransformType array[iso1TransformsType_Transform_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Transform;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,PreChargeReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":DC_EVStatus,"urn:iso:15118:2:2013:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2013:MsgBody":EVTargetCurrent)',  derivedBy='EXTENSION'.  */
+struct iso1PreChargeReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":DC_EVStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":EVReady,"urn:iso:15118:2:2013:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2013:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVStatusType DC_EVStatus ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVTargetVoltage, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVTargetVoltage ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVTargetCurrent, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVTargetCurrent ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,AC_EVChargeParameterType',  base type name='EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":DepartureTime{0-1}),("urn:iso:15118:2:2013:MsgDataTypes":EAmount,"urn:iso:15118:2:2013:MsgDataTypes":EVMaxVoltage,"urn:iso:15118:2:2013:MsgDataTypes":EVMaxCurrent,"urn:iso:15118:2:2013:MsgDataTypes":EVMinCurrent))',  derivedBy='EXTENSION'.  */
+struct iso1AC_EVChargeParameterType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DepartureTime, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t DepartureTime ;
+	unsigned int DepartureTime_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EAmount, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EAmount ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVMaxVoltage, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVMaxVoltage ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVMaxCurrent, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVMaxCurrent ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVMinCurrent, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVMinCurrent ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PMaxScheduleEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":TimeInterval),("urn:iso:15118:2:2013:MsgDataTypes":PMax))',  derivedBy='EXTENSION'.  */
+struct iso1PMaxScheduleEntryType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":TimeInterval, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,IntervalType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct iso1IntervalType TimeInterval ;
+	unsigned int TimeInterval_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":RelativeTimeInterval, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,RelativeTimeIntervalType',  base type name='IntervalType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":start,"urn:iso:15118:2:2013:MsgDataTypes":duration{0-1})',  derivedBy='EXTENSION'.  */
+	struct iso1RelativeTimeIntervalType RelativeTimeInterval ;
+	unsigned int RelativeTimeInterval_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":PMax, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType PMax ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,MeteringReceiptResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatus)',  derivedBy='EXTENSION'.  */
+struct iso1MeteringReceiptResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso1EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":AC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,AC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":RCD))',  derivedBy='EXTENSION'.  */
+	struct iso1AC_EVSEStatusType AC_EVSEStatus ;
+	unsigned int AC_EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatusCode))',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVSEStatusType DC_EVSEStatus ;
+	unsigned int DC_EVSEStatus_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,WeldingDetectionResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2013:MsgBody":EVSEPresentVoltage)',  derivedBy='EXTENSION'.  */
+struct iso1WeldingDetectionResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatusCode))',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVSEStatusType DC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEPresentVoltage, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEPresentVoltage ;
+};
+
+/* 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 iso1ReferenceType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1ReferenceType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1ReferenceType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1ReferenceType_DigestValue_BYTES_SIZE 350
+struct iso1ReferenceType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1ReferenceType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso1ReferenceType_URI_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  URI ;
+	unsigned int URI_isUsed:1;
+	/* attribute: Type {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso1ReferenceType_Type_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Type ;
+	unsigned int Type_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transforms, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso1TransformsType Transforms ;
+	unsigned int Transforms_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":DigestMethod, 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'.  */
+	struct iso1DigestMethodType DigestMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":DigestValue, http://www.w3.org/2000/09/xmldsig#,DigestValueType */
+	struct {
+		uint8_t bytes[iso1ReferenceType_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,CurrentDemandReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":DC_EVStatus,"urn:iso:15118:2:2013:MsgBody":EVTargetCurrent,"urn:iso:15118:2:2013:MsgBody":EVMaximumVoltageLimit{0-1},"urn:iso:15118:2:2013:MsgBody":EVMaximumCurrentLimit{0-1},"urn:iso:15118:2:2013:MsgBody":EVMaximumPowerLimit{0-1},"urn:iso:15118:2:2013:MsgBody":BulkChargingComplete{0-1},"urn:iso:15118:2:2013:MsgBody":ChargingComplete,"urn:iso:15118:2:2013:MsgBody":RemainingTimeToFullSoC{0-1},"urn:iso:15118:2:2013:MsgBody":RemainingTimeToBulkSoC{0-1},"urn:iso:15118:2:2013:MsgBody":EVTargetVoltage)',  derivedBy='EXTENSION'.  */
+struct iso1CurrentDemandReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":DC_EVStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":EVReady,"urn:iso:15118:2:2013:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2013:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVStatusType DC_EVStatus ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVTargetCurrent, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVTargetCurrent ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVMaximumVoltageLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVMaximumVoltageLimit ;
+	unsigned int EVMaximumVoltageLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVMaximumCurrentLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVMaximumCurrentLimit ;
+	unsigned int EVMaximumCurrentLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVMaximumPowerLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVMaximumPowerLimit ;
+	unsigned int EVMaximumPowerLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":BulkChargingComplete, http://www.w3.org/2001/XMLSchema,boolean */
+	int BulkChargingComplete ;
+	unsigned int BulkChargingComplete_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ChargingComplete, http://www.w3.org/2001/XMLSchema,boolean */
+	int ChargingComplete ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":RemainingTimeToFullSoC, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType RemainingTimeToFullSoC ;
+	unsigned int RemainingTimeToFullSoC_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":RemainingTimeToBulkSoC, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType RemainingTimeToBulkSoC ;
+	unsigned int RemainingTimeToBulkSoC_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVTargetVoltage, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVTargetVoltage ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,CostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":costKind,"urn:iso:15118:2:2013:MsgDataTypes":amount,"urn:iso:15118:2:2013:MsgDataTypes":amountMultiplier{0-1})',  derivedBy='RESTRICTION'.  */
+struct iso1CostType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":costKind, urn:iso:15118:2:2013:MsgDataTypes,costKindType */
+	iso1costKindType costKind ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":amount, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t amount ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":amountMultiplier, urn:iso:15118:2:2013:MsgDataTypes,unitMultiplierType */
+	int8_t amountMultiplier ;
+	unsigned int amountMultiplier_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVPowerDeliveryParameterType',  base type name='EVPowerDeliveryParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":DC_EVStatus,"urn:iso:15118:2:2013:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2013:MsgDataTypes":ChargingComplete)',  derivedBy='EXTENSION'.  */
+struct iso1DC_EVPowerDeliveryParameterType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DC_EVStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":EVReady,"urn:iso:15118:2:2013:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2013:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVStatusType DC_EVStatus ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":BulkChargingComplete, http://www.w3.org/2001/XMLSchema,boolean */
+	int BulkChargingComplete ;
+	unsigned int BulkChargingComplete_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ChargingComplete, http://www.w3.org/2001/XMLSchema,boolean */
+	int ChargingComplete ;
+};
+
+/* 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 iso1RetrievalMethodType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1RetrievalMethodType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1RetrievalMethodType {
+	/* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso1RetrievalMethodType_URI_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  URI ;
+	unsigned int URI_isUsed:1;
+	/* attribute: Type {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso1RetrievalMethodType_Type_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Type ;
+	unsigned int Type_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transforms, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso1TransformsType Transforms ;
+	unsigned int Transforms_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,CertificateUpdateResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":SAProvisioningCertificateChain,"urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2013:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2013:MsgBody":DHpublickey,"urn:iso:15118:2:2013:MsgBody":eMAID,"urn:iso:15118:2:2013:MsgBody":RetryCounter{0-1})',  derivedBy='EXTENSION'.  */
+struct iso1CertificateUpdateResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":SAProvisioningCertificateChain, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Certificate,"urn:iso:15118:2:2013:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1CertificateChainType SAProvisioningCertificateChain ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Certificate,"urn:iso:15118:2:2013:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1CertificateChainType ContractSignatureCertChain ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ContractSignatureEncryptedPrivateKey, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ContractSignatureEncryptedPrivateKeyType',  base type name='privateKeyType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+	struct iso1ContractSignatureEncryptedPrivateKeyType ContractSignatureEncryptedPrivateKey ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":DHpublickey, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DiffieHellmanPublickeyType',  base type name='dHpublickeyType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+	struct iso1DiffieHellmanPublickeyType DHpublickey ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":eMAID, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EMAIDType',  base type name='eMAIDType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+	struct iso1EMAIDType eMAID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":RetryCounter, http://www.w3.org/2001/XMLSchema,short */
+	int16_t RetryCounter ;
+	unsigned int RetryCounter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,CertificateInstallationResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":SAProvisioningCertificateChain,"urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2013:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2013:MsgBody":DHpublickey,"urn:iso:15118:2:2013:MsgBody":eMAID)',  derivedBy='EXTENSION'.  */
+struct iso1CertificateInstallationResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":SAProvisioningCertificateChain, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Certificate,"urn:iso:15118:2:2013:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1CertificateChainType SAProvisioningCertificateChain ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Certificate,"urn:iso:15118:2:2013:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1CertificateChainType ContractSignatureCertChain ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ContractSignatureEncryptedPrivateKey, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ContractSignatureEncryptedPrivateKeyType',  base type name='privateKeyType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+	struct iso1ContractSignatureEncryptedPrivateKeyType ContractSignatureEncryptedPrivateKey ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":DHpublickey, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DiffieHellmanPublickeyType',  base type name='dHpublickeyType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+	struct iso1DiffieHellmanPublickeyType DHpublickey ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":eMAID, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EMAIDType',  base type name='eMAIDType',  content type='SIMPLE',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+	struct iso1EMAIDType eMAID ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,WeldingDetectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":DC_EVStatus)',  derivedBy='EXTENSION'.  */
+struct iso1WeldingDetectionReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":DC_EVStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":EVReady,"urn:iso:15118:2:2013:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2013:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVStatusType DC_EVStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,CurrentDemandResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2013:MsgBody":EVSEPresentVoltage,"urn:iso:15118:2:2013:MsgBody":EVSEPresentCurrent,"urn:iso:15118:2:2013:MsgBody":EVSECurrentLimitAchieved,"urn:iso:15118:2:2013:MsgBody":EVSEVoltageLimitAchieved,"urn:iso:15118:2:2013:MsgBody":EVSEPowerLimitAchieved,"urn:iso:15118:2:2013:MsgBody":EVSEMaximumVoltageLimit{0-1},"urn:iso:15118:2:2013:MsgBody":EVSEMaximumCurrentLimit{0-1},"urn:iso:15118:2:2013:MsgBody":EVSEMaximumPowerLimit{0-1},"urn:iso:15118:2:2013:MsgBody":EVSEID,"urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID,"urn:iso:15118:2:2013:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2013:MsgBody":ReceiptRequired{0-1})',  derivedBy='EXTENSION'.  */
+#define iso1CurrentDemandResType_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,evseIDType is 37 */
+struct iso1CurrentDemandResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatusCode))',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVSEStatusType DC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEPresentVoltage, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEPresentVoltage ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEPresentCurrent, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEPresentCurrent ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSECurrentLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSECurrentLimitAchieved ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEVoltageLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSEVoltageLimitAchieved ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEPowerLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSEPowerLimitAchieved ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEMaximumVoltageLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEMaximumVoltageLimit ;
+	unsigned int EVSEMaximumVoltageLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEMaximumCurrentLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEMaximumCurrentLimit ;
+	unsigned int EVSEMaximumCurrentLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEMaximumPowerLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEMaximumPowerLimit ;
+	unsigned int EVSEMaximumPowerLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEID, urn:iso:15118:2:2013:MsgDataTypes,evseIDType */
+	struct {
+		exi_string_character_t characters[iso1CurrentDemandResType_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2013:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":MeterID,"urn:iso:15118:2:2013:MsgDataTypes":MeterReading{0-1},"urn:iso:15118:2:2013:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2013:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1MeterInfoType MeterInfo ;
+	unsigned int MeterInfo_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ReceiptRequired, http://www.w3.org/2001/XMLSchema,boolean */
+	int ReceiptRequired ;
+	unsigned int ReceiptRequired_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,AC_EVSEChargeParameterType',  base type name='EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":AC_EVSEStatus,"urn:iso:15118:2:2013:MsgDataTypes":EVSENominalVoltage,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMaxCurrent)',  derivedBy='EXTENSION'.  */
+struct iso1AC_EVSEChargeParameterType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":AC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,AC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":RCD))',  derivedBy='EXTENSION'.  */
+	struct iso1AC_EVSEStatusType AC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSENominalVoltage, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSENominalVoltage ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEMaxCurrent, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEMaxCurrent ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,PaymentServiceSelectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":SelectedPaymentOption,"urn:iso:15118:2:2013:MsgBody":SelectedServiceList)',  derivedBy='EXTENSION'.  */
+struct iso1PaymentServiceSelectionReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":SelectedPaymentOption, urn:iso:15118:2:2013:MsgDataTypes,paymentOptionType */
+	iso1paymentOptionType SelectedPaymentOption ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":SelectedServiceList, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SelectedServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":SelectedService{1-16})',  derivedBy='RESTRICTION'.  */
+	struct iso1SelectedServiceListType SelectedServiceList ;
+};
+
+/* 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 iso1SignaturePropertiesType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1SignaturePropertiesType_SignatureProperty_ARRAY_SIZE 1
+struct iso1SignaturePropertiesType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1SignaturePropertiesType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureProperty, 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'.  */
+	struct {
+		struct iso1SignaturePropertyType array[iso1SignaturePropertiesType_SignatureProperty_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SignatureProperty;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":boolValue|"urn:iso:15118:2:2013:MsgDataTypes":byteValue|"urn:iso:15118:2:2013:MsgDataTypes":shortValue|"urn:iso:15118:2:2013:MsgDataTypes":intValue|"urn:iso:15118:2:2013:MsgDataTypes":physicalValue|"urn:iso:15118:2:2013:MsgDataTypes":stringValue)',  derivedBy='RESTRICTION'.  */
+#define iso1ParameterType_Name_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1ParameterType_stringValue_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1ParameterType {
+	/* attribute: Name {http://www.w3.org/2001/XMLSchema,string} */
+	struct {
+		exi_string_character_t characters[iso1ParameterType_Name_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Name ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":boolValue, http://www.w3.org/2001/XMLSchema,boolean */
+	int boolValue ;
+	unsigned int boolValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":byteValue, http://www.w3.org/2001/XMLSchema,byte */
+	int8_t byteValue ;
+	unsigned int byteValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":shortValue, http://www.w3.org/2001/XMLSchema,short */
+	int16_t shortValue ;
+	unsigned int shortValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":intValue, http://www.w3.org/2001/XMLSchema,int */
+	int32_t intValue ;
+	unsigned int intValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":physicalValue, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType physicalValue ;
+	unsigned int physicalValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":stringValue, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		exi_string_character_t characters[iso1ParameterType_stringValue_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  stringValue ;
+	unsigned int stringValue_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,CertificateInstallationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":OEMProvisioningCert,"urn:iso:15118:2:2013:MsgBody":ListOfRootCertificateIDs)',  derivedBy='EXTENSION'.  */
+#define iso1CertificateInstallationReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1CertificateInstallationReqType_OEMProvisioningCert_BYTES_SIZE 800 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,certificateType is 800 */
+struct iso1CertificateInstallationReqType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1CertificateInstallationReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":OEMProvisioningCert, urn:iso:15118:2:2013:MsgDataTypes,certificateType */
+	struct {
+		uint8_t bytes[iso1CertificateInstallationReqType_OEMProvisioningCert_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  OEMProvisioningCert ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ListOfRootCertificateIDs, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ListOfRootCertificateIDsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":RootCertificateID{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso1ListOfRootCertificateIDsType ListOfRootCertificateIDs ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,ServiceDiscoveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":PaymentOptionList,"urn:iso:15118:2:2013:MsgBody":ChargeService,"urn:iso:15118:2:2013:MsgBody":ServiceList{0-1})',  derivedBy='EXTENSION'.  */
+struct iso1ServiceDiscoveryResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":PaymentOptionList, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PaymentOptionListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":PaymentOption{1-2})',  derivedBy='RESTRICTION'.  */
+	struct iso1PaymentOptionListType PaymentOptionList ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ChargeService, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ChargeServiceType',  base type name='ServiceType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":ServiceID,"urn:iso:15118:2:2013:MsgDataTypes":ServiceName{0-1},"urn:iso:15118:2:2013:MsgDataTypes":ServiceCategory,"urn:iso:15118:2:2013:MsgDataTypes":ServiceScope{0-1},"urn:iso:15118:2:2013:MsgDataTypes":FreeService),("urn:iso:15118:2:2013:MsgDataTypes":SupportedEnergyTransferMode))',  derivedBy='EXTENSION'.  */
+	struct iso1ChargeServiceType ChargeService ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ServiceList, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Service{1-8})',  derivedBy='RESTRICTION'.  */
+	struct iso1ServiceListType ServiceList ;
+	unsigned int ServiceList_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,PreChargeResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2013:MsgBody":EVSEPresentVoltage)',  derivedBy='EXTENSION'.  */
+struct iso1PreChargeResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEStatusType',  base type name='EVSEStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2013:MsgDataTypes":EVSENotification),("urn:iso:15118:2:2013:MsgDataTypes":EVSEIsolationStatus{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatusCode))',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVSEStatusType DC_EVSEStatus ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEPresentVoltage, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVSEPresentVoltage ;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2013:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+#define iso1ParameterSetType_Parameter_ARRAY_SIZE 16
+struct iso1ParameterSetType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ParameterSetID, http://www.w3.org/2001/XMLSchema,short */
+	int16_t ParameterSetID ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":Parameter, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":boolValue|"urn:iso:15118:2:2013:MsgDataTypes":byteValue|"urn:iso:15118:2:2013:MsgDataTypes":shortValue|"urn:iso:15118:2:2013:MsgDataTypes":intValue|"urn:iso:15118:2:2013:MsgDataTypes":physicalValue|"urn:iso:15118:2:2013:MsgDataTypes":stringValue)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso1ParameterType array[iso1ParameterSetType_Parameter_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Parameter;
+};
+
+/* 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 iso1SignedInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1SignedInfoType_Reference_ARRAY_SIZE 1
+struct iso1SignedInfoType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1SignedInfoType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod, 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'.  */
+	struct iso1CanonicalizationMethodType CanonicalizationMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureMethod, 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'.  */
+	struct iso1SignatureMethodType SignatureMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Reference, 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'.  */
+	struct {
+		struct iso1ReferenceType array[iso1SignedInfoType_Reference_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Reference;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ProfileEntryType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ChargingProfileEntryStart,"urn:iso:15118:2:2013:MsgDataTypes":ChargingProfileEntryMaxPower,"urn:iso:15118:2:2013:MsgDataTypes":ChargingProfileEntryMaxNumberOfPhasesInUse{0-1})',  derivedBy='RESTRICTION'.  */
+struct iso1ProfileEntryType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ChargingProfileEntryStart, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t ChargingProfileEntryStart ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ChargingProfileEntryMaxPower, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType ChargingProfileEntryMaxPower ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ChargingProfileEntryMaxNumberOfPhasesInUse, urn:iso:15118:2:2013:MsgDataTypes,maxNumPhasesType */
+	int8_t ChargingProfileEntryMaxNumberOfPhasesInUse ;
+	unsigned int ChargingProfileEntryMaxNumberOfPhasesInUse_isUsed:1;
+};
+
+/* 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 iso1ManifestType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1ManifestType_Reference_ARRAY_SIZE 1
+struct iso1ManifestType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1ManifestType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Reference, 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'.  */
+	struct {
+		struct iso1ReferenceType array[iso1ManifestType_Reference_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Reference;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVChargeParameterType',  base type name='EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":DepartureTime{0-1}),("urn:iso:15118:2:2013:MsgDataTypes":DC_EVStatus,"urn:iso:15118:2:2013:MsgDataTypes":EVMaximumCurrentLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVMaximumPowerLimit{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVMaximumVoltageLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVEnergyCapacity{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVEnergyRequest{0-1},"urn:iso:15118:2:2013:MsgDataTypes":FullSOC{0-1},"urn:iso:15118:2:2013:MsgDataTypes":BulkSOC{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso1DC_EVChargeParameterType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DepartureTime, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t DepartureTime ;
+	unsigned int DepartureTime_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DC_EVStatus, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVStatusType',  base type name='EVStatusType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":EVReady,"urn:iso:15118:2:2013:MsgDataTypes":EVErrorCode,"urn:iso:15118:2:2013:MsgDataTypes":EVRESSSOC)',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVStatusType DC_EVStatus ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVMaximumCurrentLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVMaximumCurrentLimit ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVMaximumPowerLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVMaximumPowerLimit ;
+	unsigned int EVMaximumPowerLimit_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVMaximumVoltageLimit, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVMaximumVoltageLimit ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVEnergyCapacity, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVEnergyCapacity ;
+	unsigned int EVEnergyCapacity_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVEnergyRequest, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType EVEnergyRequest ;
+	unsigned int EVEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":FullSOC, urn:iso:15118:2:2013:MsgDataTypes,percentValueType */
+	int8_t FullSOC ;
+	unsigned int FullSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":BulkSOC, urn:iso:15118:2:2013:MsgDataTypes,percentValueType */
+	int8_t BulkSOC ;
+	unsigned int BulkSOC_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ConsumptionCostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":startValue,"urn:iso:15118:2:2013:MsgDataTypes":Cost{1-3})',  derivedBy='RESTRICTION'.  */
+#define iso1ConsumptionCostType_Cost_ARRAY_SIZE 3
+struct iso1ConsumptionCostType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":startValue, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Multiplier,"urn:iso:15118:2:2013:MsgDataTypes":Unit,"urn:iso:15118:2:2013:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso1PhysicalValueType startValue ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":Cost, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,CostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":costKind,"urn:iso:15118:2:2013:MsgDataTypes":amount,"urn:iso:15118:2:2013:MsgDataTypes":amountMultiplier{0-1})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso1CostType array[iso1ConsumptionCostType_Cost_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Cost;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PMaxScheduleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":PMaxScheduleEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define iso1PMaxScheduleType_PMaxScheduleEntry_ARRAY_SIZE 5
+struct iso1PMaxScheduleType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":PMaxScheduleEntry, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PMaxScheduleEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":TimeInterval),("urn:iso:15118:2:2013:MsgDataTypes":PMax))',  derivedBy='EXTENSION'.  */
+	struct {
+		struct iso1PMaxScheduleEntryType array[iso1PMaxScheduleType_PMaxScheduleEntry_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PMaxScheduleEntry;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,CertificateUpdateReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2013:MsgBody":eMAID,"urn:iso:15118:2:2013:MsgBody":ListOfRootCertificateIDs)',  derivedBy='EXTENSION'.  */
+#define iso1CertificateUpdateReqType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1CertificateUpdateReqType_eMAID_CHARACTERS_SIZE 15 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,eMAIDType is 15 */
+struct iso1CertificateUpdateReqType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1CertificateUpdateReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,CertificateChainType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":Certificate,"urn:iso:15118:2:2013:MsgDataTypes":SubCertificates{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1CertificateChainType ContractSignatureCertChain ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":eMAID, urn:iso:15118:2:2013:MsgDataTypes,eMAIDType */
+	struct {
+		exi_string_character_t characters[iso1CertificateUpdateReqType_eMAID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  eMAID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ListOfRootCertificateIDs, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ListOfRootCertificateIDsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":RootCertificateID{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso1ListOfRootCertificateIDsType ListOfRootCertificateIDs ;
+};
+
+/* 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 iso1KeyInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1KeyInfoType_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1KeyInfoType_KeyName_ARRAY_SIZE 1
+#define iso1KeyInfoType_KeyValue_ARRAY_SIZE 1
+#define iso1KeyInfoType_RetrievalMethod_ARRAY_SIZE 1
+#define iso1KeyInfoType_X509Data_ARRAY_SIZE 1
+#define iso1KeyInfoType_PGPData_ARRAY_SIZE 1
+#define iso1KeyInfoType_SPKIData_ARRAY_SIZE 1
+#define iso1KeyInfoType_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1KeyInfoType_MgmtData_ARRAY_SIZE 1
+#define iso1KeyInfoType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso1KeyInfoType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1KeyInfoType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[iso1KeyInfoType_KeyName_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[iso1KeyInfoType_KeyName_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} KeyName;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyValue, 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'.  */
+	struct {
+		struct iso1KeyValueType array[iso1KeyInfoType_KeyValue_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} KeyValue;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":RetrievalMethod, 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'.  */
+	struct {
+		struct iso1RetrievalMethodType array[iso1KeyInfoType_RetrievalMethod_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} RetrievalMethod;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509Data, 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'.  */
+	struct {
+		struct iso1X509DataType array[iso1KeyInfoType_X509Data_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509Data;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPData, 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'.  */
+	struct {
+		struct iso1PGPDataType array[iso1KeyInfoType_PGPData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PGPData;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SPKIData, 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'.  */
+	struct {
+		struct iso1SPKIDataType array[iso1KeyInfoType_SPKIData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SPKIData;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":MgmtData, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[iso1KeyInfoType_MgmtData_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[iso1KeyInfoType_MgmtData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} MgmtData;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso1KeyInfoType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,ChargeParameterDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":MaxEntriesSAScheduleTuple{0-1},"urn:iso:15118:2:2013:MsgBody":RequestedEnergyTransferMode,"urn:iso:15118:2:2013:MsgDataTypes":EVChargeParameter)',  derivedBy='EXTENSION'.  */
+struct iso1ChargeParameterDiscoveryReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":MaxEntriesSAScheduleTuple, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t MaxEntriesSAScheduleTuple ;
+	unsigned int MaxEntriesSAScheduleTuple_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgBody":RequestedEnergyTransferMode, urn:iso:15118:2:2013:MsgDataTypes,EnergyTransferModeType */
+	iso1EnergyTransferModeType RequestedEnergyTransferMode ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVChargeParameter, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EVChargeParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":DepartureTime{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1EVChargeParameterType EVChargeParameter ;
+	unsigned int EVChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":AC_EVChargeParameter, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,AC_EVChargeParameterType',  base type name='EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":DepartureTime{0-1}),("urn:iso:15118:2:2013:MsgDataTypes":EAmount,"urn:iso:15118:2:2013:MsgDataTypes":EVMaxVoltage,"urn:iso:15118:2:2013:MsgDataTypes":EVMaxCurrent,"urn:iso:15118:2:2013:MsgDataTypes":EVMinCurrent))',  derivedBy='EXTENSION'.  */
+	struct iso1AC_EVChargeParameterType AC_EVChargeParameter ;
+	unsigned int AC_EVChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DC_EVChargeParameter, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVChargeParameterType',  base type name='EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":DepartureTime{0-1}),("urn:iso:15118:2:2013:MsgDataTypes":DC_EVStatus,"urn:iso:15118:2:2013:MsgDataTypes":EVMaximumCurrentLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVMaximumPowerLimit{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVMaximumVoltageLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVEnergyCapacity{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVEnergyRequest{0-1},"urn:iso:15118:2:2013:MsgDataTypes":FullSOC{0-1},"urn:iso:15118:2:2013:MsgDataTypes":BulkSOC{0-1}))',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVChargeParameterType DC_EVChargeParameter ;
+	unsigned int DC_EVChargeParameter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ChargingProfileType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ProfileEntry{1-24})',  derivedBy='RESTRICTION'.  */
+#define iso1ChargingProfileType_ProfileEntry_ARRAY_SIZE 24
+struct iso1ChargingProfileType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ProfileEntry, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ProfileEntryType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ChargingProfileEntryStart,"urn:iso:15118:2:2013:MsgDataTypes":ChargingProfileEntryMaxPower,"urn:iso:15118:2:2013:MsgDataTypes":ChargingProfileEntryMaxNumberOfPhasesInUse{0-1})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso1ProfileEntryType array[iso1ChargingProfileType_ProfileEntry_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} ProfileEntry;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SalesTariffEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":TimeInterval),("urn:iso:15118:2:2013:MsgDataTypes":EPriceLevel{0-1},"urn:iso:15118:2:2013:MsgDataTypes":ConsumptionCost{0-3}))',  derivedBy='EXTENSION'.  */
+#define iso1SalesTariffEntryType_ConsumptionCost_ARRAY_SIZE 3
+struct iso1SalesTariffEntryType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":TimeInterval, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,IntervalType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct iso1IntervalType TimeInterval ;
+	unsigned int TimeInterval_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":RelativeTimeInterval, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,RelativeTimeIntervalType',  base type name='IntervalType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":start,"urn:iso:15118:2:2013:MsgDataTypes":duration{0-1})',  derivedBy='EXTENSION'.  */
+	struct iso1RelativeTimeIntervalType RelativeTimeInterval ;
+	unsigned int RelativeTimeInterval_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EPriceLevel, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t EPriceLevel ;
+	unsigned int EPriceLevel_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ConsumptionCost, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ConsumptionCostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":startValue,"urn:iso:15118:2:2013:MsgDataTypes":Cost{1-3})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso1ConsumptionCostType array[iso1SalesTariffEntryType_ConsumptionCost_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} ConsumptionCost;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SalesTariffType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":SalesTariffID,"urn:iso:15118:2:2013:MsgDataTypes":SalesTariffDescription{0-1},"urn:iso:15118:2:2013:MsgDataTypes":NumEPriceLevels{0-1},"urn:iso:15118:2:2013:MsgDataTypes":SalesTariffEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define iso1SalesTariffType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1SalesTariffType_SalesTariffDescription_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,tariffDescriptionType is 32 */
+#define iso1SalesTariffType_SalesTariffEntry_ARRAY_SIZE 5
+struct iso1SalesTariffType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1SalesTariffType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SalesTariffID, urn:iso:15118:2:2013:MsgDataTypes,SAIDType */
+	uint8_t SalesTariffID ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SalesTariffDescription, urn:iso:15118:2:2013:MsgDataTypes,tariffDescriptionType */
+	struct {
+		exi_string_character_t characters[iso1SalesTariffType_SalesTariffDescription_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  SalesTariffDescription ;
+	unsigned int SalesTariffDescription_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":NumEPriceLevels, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t NumEPriceLevels ;
+	unsigned int NumEPriceLevels_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SalesTariffEntry, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SalesTariffEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2013:MsgDataTypes":TimeInterval),("urn:iso:15118:2:2013:MsgDataTypes":EPriceLevel{0-1},"urn:iso:15118:2:2013:MsgDataTypes":ConsumptionCost{0-3}))',  derivedBy='EXTENSION'.  */
+	struct {
+		struct iso1SalesTariffEntryType array[iso1SalesTariffType_SalesTariffEntry_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SalesTariffEntry;
+};
+
+/* 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 iso1SignatureType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1SignatureType_Object_ARRAY_SIZE 1
+struct iso1SignatureType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso1SignatureType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignedInfo, 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'.  */
+	struct iso1SignedInfoType SignedInfo ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureValue, 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'.  */
+	struct iso1SignatureValueType SignatureValue ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyInfo, 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'.  */
+	struct iso1KeyInfoType KeyInfo ;
+	unsigned int KeyInfo_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Object, 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'.  */
+	struct {
+		struct iso1ObjectType array[iso1SignatureType_Object_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Object;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,PowerDeliveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ChargeProgress,"urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID,"urn:iso:15118:2:2013:MsgBody":ChargingProfile{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVPowerDeliveryParameter{0-1})',  derivedBy='EXTENSION'.  */
+struct iso1PowerDeliveryReqType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ChargeProgress, urn:iso:15118:2:2013:MsgDataTypes,chargeProgressType */
+	iso1chargeProgressType ChargeProgress ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2013:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ChargingProfile, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ChargingProfileType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ProfileEntry{1-24})',  derivedBy='RESTRICTION'.  */
+	struct iso1ChargingProfileType ChargingProfile ;
+	unsigned int ChargingProfile_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVPowerDeliveryParameter, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EVPowerDeliveryParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct iso1EVPowerDeliveryParameterType EVPowerDeliveryParameter ;
+	unsigned int EVPowerDeliveryParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DC_EVPowerDeliveryParameter, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVPowerDeliveryParameterType',  base type name='EVPowerDeliveryParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":DC_EVStatus,"urn:iso:15118:2:2013:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2013:MsgDataTypes":ChargingComplete)',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVPowerDeliveryParameterType DC_EVPowerDeliveryParameter ;
+	unsigned int DC_EVPowerDeliveryParameter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ServiceParameterListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ParameterSet{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define iso1ServiceParameterListType_ParameterSet_ARRAY_SIZE 5
+struct iso1ServiceParameterListType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":ParameterSet, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2013:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso1ParameterSetType array[iso1ServiceParameterListType_ParameterSet_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} ParameterSet;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,ServiceDetailResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":ServiceID,"urn:iso:15118:2:2013:MsgBody":ServiceParameterList{0-1})',  derivedBy='EXTENSION'.  */
+struct iso1ServiceDetailResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ServiceID, urn:iso:15118:2:2013:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":ServiceParameterList, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,ServiceParameterListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":ParameterSet{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso1ServiceParameterListType ServiceParameterList ;
+	unsigned int ServiceParameterList_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SAScheduleTupleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":SAScheduleTupleID,"urn:iso:15118:2:2013:MsgDataTypes":PMaxSchedule,"urn:iso:15118:2:2013:MsgDataTypes":SalesTariff{0-1})',  derivedBy='RESTRICTION'.  */
+struct iso1SAScheduleTupleType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SAScheduleTupleID, urn:iso:15118:2:2013:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":PMaxSchedule, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,PMaxScheduleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":PMaxScheduleEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso1PMaxScheduleType PMaxSchedule ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SalesTariff, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SalesTariffType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":SalesTariffID,"urn:iso:15118:2:2013:MsgDataTypes":SalesTariffDescription{0-1},"urn:iso:15118:2:2013:MsgDataTypes":NumEPriceLevels{0-1},"urn:iso:15118:2:2013:MsgDataTypes":SalesTariffEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso1SalesTariffType SalesTariff ;
+	unsigned int SalesTariff_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgHeader,MessageHeaderType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgHeader":SessionID,"urn:iso:15118:2:2013:MsgHeader":Notification{0-1},"http://www.w3.org/2000/09/xmldsig#":Signature{0-1})',  derivedBy='RESTRICTION'.  */
+#define iso1MessageHeaderType_SessionID_BYTES_SIZE 8 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,sessionIDType is 8 */
+struct iso1MessageHeaderType {
+	/* element: "urn:iso:15118:2:2013:MsgHeader":SessionID, urn:iso:15118:2:2013:MsgDataTypes,sessionIDType */
+	struct {
+		uint8_t bytes[iso1MessageHeaderType_SessionID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SessionID ;
+	/* element: "urn:iso:15118:2:2013:MsgHeader":Notification, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,NotificationType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":FaultCode,"urn:iso:15118:2:2013:MsgDataTypes":FaultMsg{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1NotificationType Notification ;
+	unsigned int Notification_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Signature, 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'.  */
+	struct iso1SignatureType Signature ;
+	unsigned int Signature_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SAScheduleListType',  base type name='SASchedulesType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":SAScheduleTuple{1-3})',  derivedBy='EXTENSION'.  */
+#define iso1SAScheduleListType_SAScheduleTuple_ARRAY_SIZE 3
+struct iso1SAScheduleListType {
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SAScheduleTuple, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SAScheduleTupleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":SAScheduleTupleID,"urn:iso:15118:2:2013:MsgDataTypes":PMaxSchedule,"urn:iso:15118:2:2013:MsgDataTypes":SalesTariff{0-1})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso1SAScheduleTupleType array[iso1SAScheduleListType_SAScheduleTuple_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SAScheduleTuple;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,ChargeParameterDiscoveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":EVSEProcessing,"urn:iso:15118:2:2013:MsgDataTypes":SASchedules{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEChargeParameter)',  derivedBy='EXTENSION'.  */
+struct iso1ChargeParameterDiscoveryResType {
+	/* element: "urn:iso:15118:2:2013:MsgBody":ResponseCode, urn:iso:15118:2:2013:MsgDataTypes,responseCodeType */
+	iso1responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2013:MsgBody":EVSEProcessing, urn:iso:15118:2:2013:MsgDataTypes,EVSEProcessingType */
+	iso1EVSEProcessingType EVSEProcessing ;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SASchedules, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SASchedulesType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct iso1SASchedulesType SASchedules ;
+	unsigned int SASchedules_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":SAScheduleList, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,SAScheduleListType',  base type name='SASchedulesType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":SAScheduleTuple{1-3})',  derivedBy='EXTENSION'.  */
+	struct iso1SAScheduleListType SAScheduleList ;
+	unsigned int SAScheduleList_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":EVSEChargeParameter, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,EVSEChargeParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct iso1EVSEChargeParameterType EVSEChargeParameter ;
+	unsigned int EVSEChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":AC_EVSEChargeParameter, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,AC_EVSEChargeParameterType',  base type name='EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":AC_EVSEStatus,"urn:iso:15118:2:2013:MsgDataTypes":EVSENominalVoltage,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMaxCurrent)',  derivedBy='EXTENSION'.  */
+	struct iso1AC_EVSEChargeParameterType AC_EVSEChargeParameter ;
+	unsigned int AC_EVSEChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2013:MsgDataTypes":DC_EVSEChargeParameter, Complex type name='urn:iso:15118:2:2013:MsgDataTypes,DC_EVSEChargeParameterType',  base type name='EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDataTypes":DC_EVSEStatus,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMaximumCurrentLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMaximumPowerLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMaximumVoltageLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMinimumCurrentLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVSEMinimumVoltageLimit,"urn:iso:15118:2:2013:MsgDataTypes":EVSECurrentRegulationTolerance{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEPeakCurrentRipple,"urn:iso:15118:2:2013:MsgDataTypes":EVSEEnergyToBeDelivered{0-1})',  derivedBy='EXTENSION'.  */
+	struct iso1DC_EVSEChargeParameterType DC_EVSEChargeParameter ;
+	unsigned int DC_EVSEChargeParameter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgBody,BodyType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":BodyElement{0-1})',  derivedBy='RESTRICTION'.  */
+struct iso1BodyType {
+	/* substitutionGroup */
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+		/* element: "urn:iso:15118:2:2013:MsgBody":BodyElement, Complex type name='urn:iso:15118:2:2013:MsgBody,BodyBaseType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+		struct iso1BodyBaseType BodyElement ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":SessionSetupReq, Complex type name='urn:iso:15118:2:2013:MsgBody,SessionSetupReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":EVCCID)',  derivedBy='EXTENSION'.  */
+		struct iso1SessionSetupReqType SessionSetupReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":SessionSetupRes, Complex type name='urn:iso:15118:2:2013:MsgBody,SessionSetupResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":EVSEID,"urn:iso:15118:2:2013:MsgBody":EVSETimeStamp{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso1SessionSetupResType SessionSetupRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":ServiceDiscoveryReq, Complex type name='urn:iso:15118:2:2013:MsgBody,ServiceDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ServiceScope{0-1},"urn:iso:15118:2:2013:MsgBody":ServiceCategory{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso1ServiceDiscoveryReqType ServiceDiscoveryReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":ServiceDiscoveryRes, Complex type name='urn:iso:15118:2:2013:MsgBody,ServiceDiscoveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":PaymentOptionList,"urn:iso:15118:2:2013:MsgBody":ChargeService,"urn:iso:15118:2:2013:MsgBody":ServiceList{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso1ServiceDiscoveryResType ServiceDiscoveryRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":ServiceDetailReq, Complex type name='urn:iso:15118:2:2013:MsgBody,ServiceDetailReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ServiceID)',  derivedBy='EXTENSION'.  */
+		struct iso1ServiceDetailReqType ServiceDetailReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":ServiceDetailRes, Complex type name='urn:iso:15118:2:2013:MsgBody,ServiceDetailResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":ServiceID,"urn:iso:15118:2:2013:MsgBody":ServiceParameterList{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso1ServiceDetailResType ServiceDetailRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":PaymentServiceSelectionReq, Complex type name='urn:iso:15118:2:2013:MsgBody,PaymentServiceSelectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":SelectedPaymentOption,"urn:iso:15118:2:2013:MsgBody":SelectedServiceList)',  derivedBy='EXTENSION'.  */
+		struct iso1PaymentServiceSelectionReqType PaymentServiceSelectionReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":PaymentServiceSelectionRes, Complex type name='urn:iso:15118:2:2013:MsgBody,PaymentServiceSelectionResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode)',  derivedBy='EXTENSION'.  */
+		struct iso1PaymentServiceSelectionResType PaymentServiceSelectionRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":PaymentDetailsReq, Complex type name='urn:iso:15118:2:2013:MsgBody,PaymentDetailsReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":eMAID,"urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain)',  derivedBy='EXTENSION'.  */
+		struct iso1PaymentDetailsReqType PaymentDetailsReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":PaymentDetailsRes, Complex type name='urn:iso:15118:2:2013:MsgBody,PaymentDetailsResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":GenChallenge,"urn:iso:15118:2:2013:MsgBody":EVSETimeStamp)',  derivedBy='EXTENSION'.  */
+		struct iso1PaymentDetailsResType PaymentDetailsRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":AuthorizationReq, Complex type name='urn:iso:15118:2:2013:MsgBody,AuthorizationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":GenChallenge{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso1AuthorizationReqType AuthorizationReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":AuthorizationRes, Complex type name='urn:iso:15118:2:2013:MsgBody,AuthorizationResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":EVSEProcessing)',  derivedBy='EXTENSION'.  */
+		struct iso1AuthorizationResType AuthorizationRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":ChargeParameterDiscoveryReq, Complex type name='urn:iso:15118:2:2013:MsgBody,ChargeParameterDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":MaxEntriesSAScheduleTuple{0-1},"urn:iso:15118:2:2013:MsgBody":RequestedEnergyTransferMode,"urn:iso:15118:2:2013:MsgDataTypes":EVChargeParameter)',  derivedBy='EXTENSION'.  */
+		struct iso1ChargeParameterDiscoveryReqType ChargeParameterDiscoveryReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":ChargeParameterDiscoveryRes, Complex type name='urn:iso:15118:2:2013:MsgBody,ChargeParameterDiscoveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":EVSEProcessing,"urn:iso:15118:2:2013:MsgDataTypes":SASchedules{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVSEChargeParameter)',  derivedBy='EXTENSION'.  */
+		struct iso1ChargeParameterDiscoveryResType ChargeParameterDiscoveryRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":PowerDeliveryReq, Complex type name='urn:iso:15118:2:2013:MsgBody,PowerDeliveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ChargeProgress,"urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID,"urn:iso:15118:2:2013:MsgBody":ChargingProfile{0-1},"urn:iso:15118:2:2013:MsgDataTypes":EVPowerDeliveryParameter{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso1PowerDeliveryReqType PowerDeliveryReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":PowerDeliveryRes, Complex type name='urn:iso:15118:2:2013:MsgBody,PowerDeliveryResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatus)',  derivedBy='EXTENSION'.  */
+		struct iso1PowerDeliveryResType PowerDeliveryRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":MeteringReceiptReq, Complex type name='urn:iso:15118:2:2013:MsgBody,MeteringReceiptReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":SessionID,"urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2013:MsgBody":MeterInfo)',  derivedBy='EXTENSION'.  */
+		struct iso1MeteringReceiptReqType MeteringReceiptReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":MeteringReceiptRes, Complex type name='urn:iso:15118:2:2013:MsgBody,MeteringReceiptResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgDataTypes":EVSEStatus)',  derivedBy='EXTENSION'.  */
+		struct iso1MeteringReceiptResType MeteringReceiptRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":SessionStopReq, Complex type name='urn:iso:15118:2:2013:MsgBody,SessionStopReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ChargingSession)',  derivedBy='EXTENSION'.  */
+		struct iso1SessionStopReqType SessionStopReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":SessionStopRes, Complex type name='urn:iso:15118:2:2013:MsgBody,SessionStopResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode)',  derivedBy='EXTENSION'.  */
+		struct iso1SessionStopResType SessionStopRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":CertificateUpdateReq, Complex type name='urn:iso:15118:2:2013:MsgBody,CertificateUpdateReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2013:MsgBody":eMAID,"urn:iso:15118:2:2013:MsgBody":ListOfRootCertificateIDs)',  derivedBy='EXTENSION'.  */
+		struct iso1CertificateUpdateReqType CertificateUpdateReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":CertificateUpdateRes, Complex type name='urn:iso:15118:2:2013:MsgBody,CertificateUpdateResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":SAProvisioningCertificateChain,"urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2013:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2013:MsgBody":DHpublickey,"urn:iso:15118:2:2013:MsgBody":eMAID,"urn:iso:15118:2:2013:MsgBody":RetryCounter{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso1CertificateUpdateResType CertificateUpdateRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":CertificateInstallationReq, Complex type name='urn:iso:15118:2:2013:MsgBody,CertificateInstallationReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":OEMProvisioningCert,"urn:iso:15118:2:2013:MsgBody":ListOfRootCertificateIDs)',  derivedBy='EXTENSION'.  */
+		struct iso1CertificateInstallationReqType CertificateInstallationReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":CertificateInstallationRes, Complex type name='urn:iso:15118:2:2013:MsgBody,CertificateInstallationResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":SAProvisioningCertificateChain,"urn:iso:15118:2:2013:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2013:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2013:MsgBody":DHpublickey,"urn:iso:15118:2:2013:MsgBody":eMAID)',  derivedBy='EXTENSION'.  */
+		struct iso1CertificateInstallationResType CertificateInstallationRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":ChargingStatusReq, Complex type name='urn:iso:15118:2:2013:MsgBody,ChargingStatusReqType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+		struct iso1ChargingStatusReqType ChargingStatusReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":ChargingStatusRes, Complex type name='urn:iso:15118:2:2013:MsgBody,ChargingStatusResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":EVSEID,"urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID,"urn:iso:15118:2:2013:MsgBody":EVSEMaxCurrent{0-1},"urn:iso:15118:2:2013:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2013:MsgBody":ReceiptRequired{0-1},"urn:iso:15118:2:2013:MsgBody":AC_EVSEStatus)',  derivedBy='EXTENSION'.  */
+		struct iso1ChargingStatusResType ChargingStatusRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":CableCheckReq, Complex type name='urn:iso:15118:2:2013:MsgBody,CableCheckReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":DC_EVStatus)',  derivedBy='EXTENSION'.  */
+		struct iso1CableCheckReqType CableCheckReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":CableCheckRes, Complex type name='urn:iso:15118:2:2013:MsgBody,CableCheckResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2013:MsgBody":EVSEProcessing)',  derivedBy='EXTENSION'.  */
+		struct iso1CableCheckResType CableCheckRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":PreChargeReq, Complex type name='urn:iso:15118:2:2013:MsgBody,PreChargeReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":DC_EVStatus,"urn:iso:15118:2:2013:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2013:MsgBody":EVTargetCurrent)',  derivedBy='EXTENSION'.  */
+		struct iso1PreChargeReqType PreChargeReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":PreChargeRes, Complex type name='urn:iso:15118:2:2013:MsgBody,PreChargeResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2013:MsgBody":EVSEPresentVoltage)',  derivedBy='EXTENSION'.  */
+		struct iso1PreChargeResType PreChargeRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":CurrentDemandReq, Complex type name='urn:iso:15118:2:2013:MsgBody,CurrentDemandReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":DC_EVStatus,"urn:iso:15118:2:2013:MsgBody":EVTargetCurrent,"urn:iso:15118:2:2013:MsgBody":EVMaximumVoltageLimit{0-1},"urn:iso:15118:2:2013:MsgBody":EVMaximumCurrentLimit{0-1},"urn:iso:15118:2:2013:MsgBody":EVMaximumPowerLimit{0-1},"urn:iso:15118:2:2013:MsgBody":BulkChargingComplete{0-1},"urn:iso:15118:2:2013:MsgBody":ChargingComplete,"urn:iso:15118:2:2013:MsgBody":RemainingTimeToFullSoC{0-1},"urn:iso:15118:2:2013:MsgBody":RemainingTimeToBulkSoC{0-1},"urn:iso:15118:2:2013:MsgBody":EVTargetVoltage)',  derivedBy='EXTENSION'.  */
+		struct iso1CurrentDemandReqType CurrentDemandReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":CurrentDemandRes, Complex type name='urn:iso:15118:2:2013:MsgBody,CurrentDemandResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2013:MsgBody":EVSEPresentVoltage,"urn:iso:15118:2:2013:MsgBody":EVSEPresentCurrent,"urn:iso:15118:2:2013:MsgBody":EVSECurrentLimitAchieved,"urn:iso:15118:2:2013:MsgBody":EVSEVoltageLimitAchieved,"urn:iso:15118:2:2013:MsgBody":EVSEPowerLimitAchieved,"urn:iso:15118:2:2013:MsgBody":EVSEMaximumVoltageLimit{0-1},"urn:iso:15118:2:2013:MsgBody":EVSEMaximumCurrentLimit{0-1},"urn:iso:15118:2:2013:MsgBody":EVSEMaximumPowerLimit{0-1},"urn:iso:15118:2:2013:MsgBody":EVSEID,"urn:iso:15118:2:2013:MsgBody":SAScheduleTupleID,"urn:iso:15118:2:2013:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2013:MsgBody":ReceiptRequired{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso1CurrentDemandResType CurrentDemandRes ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":WeldingDetectionReq, Complex type name='urn:iso:15118:2:2013:MsgBody,WeldingDetectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":DC_EVStatus)',  derivedBy='EXTENSION'.  */
+		struct iso1WeldingDetectionReqType WeldingDetectionReq ;
+		/* element: "urn:iso:15118:2:2013:MsgBody":WeldingDetectionRes, Complex type name='urn:iso:15118:2:2013:MsgBody,WeldingDetectionResType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":ResponseCode,"urn:iso:15118:2:2013:MsgBody":DC_EVSEStatus,"urn:iso:15118:2:2013:MsgBody":EVSEPresentVoltage)',  derivedBy='EXTENSION'.  */
+		struct iso1WeldingDetectionResType WeldingDetectionRes ;
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	};
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+		unsigned int BodyElement_isUsed:1;
+		unsigned int SessionSetupReq_isUsed:1;
+		unsigned int SessionSetupRes_isUsed:1;
+		unsigned int ServiceDiscoveryReq_isUsed:1;
+		unsigned int ServiceDiscoveryRes_isUsed:1;
+		unsigned int ServiceDetailReq_isUsed:1;
+		unsigned int ServiceDetailRes_isUsed:1;
+		unsigned int PaymentServiceSelectionReq_isUsed:1;
+		unsigned int PaymentServiceSelectionRes_isUsed:1;
+		unsigned int PaymentDetailsReq_isUsed:1;
+		unsigned int PaymentDetailsRes_isUsed:1;
+		unsigned int AuthorizationReq_isUsed:1;
+		unsigned int AuthorizationRes_isUsed:1;
+		unsigned int ChargeParameterDiscoveryReq_isUsed:1;
+		unsigned int ChargeParameterDiscoveryRes_isUsed:1;
+		unsigned int PowerDeliveryReq_isUsed:1;
+		unsigned int PowerDeliveryRes_isUsed:1;
+		unsigned int MeteringReceiptReq_isUsed:1;
+		unsigned int MeteringReceiptRes_isUsed:1;
+		unsigned int SessionStopReq_isUsed:1;
+		unsigned int SessionStopRes_isUsed:1;
+		unsigned int CertificateUpdateReq_isUsed:1;
+		unsigned int CertificateUpdateRes_isUsed:1;
+		unsigned int CertificateInstallationReq_isUsed:1;
+		unsigned int CertificateInstallationRes_isUsed:1;
+		unsigned int ChargingStatusReq_isUsed:1;
+		unsigned int ChargingStatusRes_isUsed:1;
+		unsigned int CableCheckReq_isUsed:1;
+		unsigned int CableCheckRes_isUsed:1;
+		unsigned int PreChargeReq_isUsed:1;
+		unsigned int PreChargeRes_isUsed:1;
+		unsigned int CurrentDemandReq_isUsed:1;
+		unsigned int CurrentDemandRes_isUsed:1;
+		unsigned int WeldingDetectionReq_isUsed:1;
+		unsigned int WeldingDetectionRes_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2013:MsgDef,#AnonType_V2G_Message',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgDef":Header,"urn:iso:15118:2:2013:MsgDef":Body)',  derivedBy='RESTRICTION'.  */
+struct iso1AnonType_V2G_Message {
+	/* element: "urn:iso:15118:2:2013:MsgDef":Header, Complex type name='urn:iso:15118:2:2013:MsgHeader,MessageHeaderType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgHeader":SessionID,"urn:iso:15118:2:2013:MsgHeader":Notification{0-1},"http://www.w3.org/2000/09/xmldsig#":Signature{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1MessageHeaderType Header ;
+	/* element: "urn:iso:15118:2:2013:MsgDef":Body, Complex type name='urn:iso:15118:2:2013:MsgBody,BodyType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2013:MsgBody":BodyElement{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso1BodyType Body ;
+};
+
+
+
+#define iso1EXIDocument_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1EXIDocument_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1EXIDocument_DigestValue_BYTES_SIZE 350
+#define iso1EXIFragment_Exponent_BYTES_SIZE 350
+#define iso1EXIFragment_PgenCounter_BYTES_SIZE 350
+#define iso1EXIFragment_SessionID_BYTES_SIZE 8 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,sessionIDType is 8 */
+#define iso1EXIFragment_PGPKeyPacket_BYTES_SIZE 350
+#define iso1EXIFragment_Seed_BYTES_SIZE 350
+#define iso1EXIFragment_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1EXIFragment_OEMProvisioningCert_BYTES_SIZE 800 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,certificateType is 800 */
+#define iso1EXIFragment_SalesTariffDescription_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,tariffDescriptionType is 32 */
+#define iso1EXIFragment_EVCCID_BYTES_SIZE 6 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,evccIDType is 6 */
+#define iso1EXIFragment_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1EXIFragment_P_BYTES_SIZE 350
+#define iso1EXIFragment_Q_BYTES_SIZE 350
+#define iso1EXIFragment_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1EXIFragment_G_BYTES_SIZE 350
+#define iso1EXIFragment_J_BYTES_SIZE 350
+#define iso1EXIFragment_ServiceScope_CHARACTERS_SIZE 64 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,serviceScopeType is 64 */
+#define iso1EXIFragment_ServiceName_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,serviceNameType is 32 */
+#define iso1EXIFragment_X509CRL_BYTES_SIZE 350
+#define iso1EXIFragment_Y_BYTES_SIZE 350
+#define iso1EXIFragment_DigestValue_BYTES_SIZE 350
+#define iso1EXIFragment_SPKISexp_BYTES_SIZE 350
+#define iso1EXIFragment_stringValue_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1EXIFragment_PGPKeyID_BYTES_SIZE 350
+#define iso1EXIFragment_X509Certificate_BYTES_SIZE 350
+#define iso1EXIFragment_FaultMsg_CHARACTERS_SIZE 64 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,faultMsgType is 64 */
+#define iso1EXIFragment_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,evseIDType is 37 */
+#define iso1EXIFragment_SigMeterReading_BYTES_SIZE 64 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,sigMeterReadingType is 64 */
+#define iso1EXIFragment_MeterID_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,meterIDType is 32 */
+#define iso1EXIFragment_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1EXIFragment_GenChallenge_BYTES_SIZE 16 /* XML schema facet length for urn:iso:15118:2:2013:MsgDataTypes,genChallengeType is 16 */
+#define iso1EXIFragment_X509SKI_BYTES_SIZE 350
+#define iso1EXIFragment_Certificate_BYTES_SIZE 800 /* XML schema facet maxLength for urn:iso:15118:2:2013:MsgDataTypes,certificateType is 800 */
+#define iso1EXIFragment_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1EXIFragment_Modulus_BYTES_SIZE 350
+#define iso1exiElementFrag_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso1exiElementFrag_CHARACTERS_GENERIC_CHARACTERS_SIZE 50 + EXTRA_CHAR
+
+
+/* Global elements of EXI Document */
+struct iso1EXIDocument {
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	struct iso1AnonType_V2G_Message V2G_Message ;
+	struct iso1ServiceDiscoveryReqType ServiceDiscoveryReq ;
+	struct iso1ServiceDiscoveryResType ServiceDiscoveryRes ;
+	struct iso1MeteringReceiptReqType MeteringReceiptReq ;
+	struct iso1PaymentDetailsReqType PaymentDetailsReq ;
+	struct iso1MeteringReceiptResType MeteringReceiptRes ;
+	struct iso1PaymentDetailsResType PaymentDetailsRes ;
+	struct iso1SessionSetupReqType SessionSetupReq ;
+	struct iso1SessionSetupResType SessionSetupRes ;
+	struct iso1CableCheckReqType CableCheckReq ;
+	struct iso1CableCheckResType CableCheckRes ;
+	struct iso1CertificateInstallationReqType CertificateInstallationReq ;
+	struct iso1CertificateInstallationResType CertificateInstallationRes ;
+	struct iso1WeldingDetectionReqType WeldingDetectionReq ;
+	struct iso1WeldingDetectionResType WeldingDetectionRes ;
+	struct iso1CertificateUpdateReqType CertificateUpdateReq ;
+	struct iso1CertificateUpdateResType CertificateUpdateRes ;
+	struct iso1PaymentServiceSelectionReqType PaymentServiceSelectionReq ;
+	struct iso1PowerDeliveryReqType PowerDeliveryReq ;
+	struct iso1PaymentServiceSelectionResType PaymentServiceSelectionRes ;
+	struct iso1PowerDeliveryResType PowerDeliveryRes ;
+	struct iso1ChargingStatusReqType ChargingStatusReq ;
+	struct iso1ChargingStatusResType ChargingStatusRes ;
+	struct iso1BodyBaseType BodyElement ;
+	struct iso1CurrentDemandReqType CurrentDemandReq ;
+	struct iso1PreChargeReqType PreChargeReq ;
+	struct iso1CurrentDemandResType CurrentDemandRes ;
+	struct iso1PreChargeResType PreChargeRes ;
+	struct iso1SessionStopReqType SessionStopReq ;
+	struct iso1AuthorizationReqType AuthorizationReq ;
+	struct iso1SessionStopResType SessionStopRes ;
+	struct iso1AuthorizationResType AuthorizationRes ;
+	struct iso1ChargeParameterDiscoveryReqType ChargeParameterDiscoveryReq ;
+	struct iso1ChargeParameterDiscoveryResType ChargeParameterDiscoveryRes ;
+	struct iso1ServiceDetailReqType ServiceDetailReq ;
+	struct iso1ServiceDetailResType ServiceDetailRes ;
+	struct iso1DC_EVSEStatusType DC_EVSEStatus ;
+	struct iso1RelativeTimeIntervalType RelativeTimeInterval ;
+	struct iso1SalesTariffEntryType SalesTariffEntry ;
+	struct iso1DC_EVPowerDeliveryParameterType DC_EVPowerDeliveryParameter ;
+	struct iso1SASchedulesType SASchedules ;
+	struct iso1AC_EVChargeParameterType AC_EVChargeParameter ;
+	struct iso1SAScheduleListType SAScheduleList ;
+	struct iso1DC_EVStatusType DC_EVStatus ;
+	struct iso1EVStatusType EVStatus ;
+	struct iso1DC_EVChargeParameterType DC_EVChargeParameter ;
+	struct iso1DC_EVSEChargeParameterType DC_EVSEChargeParameter ;
+	struct iso1EVSEStatusType EVSEStatus ;
+	struct iso1IntervalType TimeInterval ;
+	struct iso1EVPowerDeliveryParameterType EVPowerDeliveryParameter ;
+	struct iso1EVSEChargeParameterType EVSEChargeParameter ;
+	struct iso1AC_EVSEStatusType AC_EVSEStatus ;
+	struct iso1EntryType Entry ;
+	struct iso1AC_EVSEChargeParameterType AC_EVSEChargeParameter ;
+	struct iso1PMaxScheduleEntryType PMaxScheduleEntry ;
+	struct iso1EVChargeParameterType EVChargeParameter ;
+	struct iso1SignaturePropertyType SignatureProperty ;
+	struct iso1DSAKeyValueType DSAKeyValue ;
+	struct iso1SignaturePropertiesType SignatureProperties ;
+	struct iso1KeyValueType KeyValue ;
+	struct iso1TransformsType Transforms ;
+	struct iso1DigestMethodType DigestMethod ;
+	struct iso1SignatureType Signature ;
+	struct iso1RetrievalMethodType RetrievalMethod ;
+	struct iso1ManifestType Manifest ;
+	struct iso1ReferenceType Reference ;
+	struct iso1CanonicalizationMethodType CanonicalizationMethod ;
+	struct iso1RSAKeyValueType RSAKeyValue ;
+	struct iso1TransformType Transform ;
+	struct iso1PGPDataType PGPData ;
+	struct {
+		exi_string_character_t characters[iso1EXIDocument_MgmtData_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MgmtData ;
+	struct iso1SignatureMethodType SignatureMethod ;
+	struct iso1KeyInfoType KeyInfo ;
+	struct iso1SPKIDataType SPKIData ;
+	struct iso1X509DataType X509Data ;
+	struct iso1SignatureValueType SignatureValue ;
+	struct {
+		exi_string_character_t characters[iso1EXIDocument_KeyName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  KeyName ;
+	struct {
+		uint8_t bytes[iso1EXIDocument_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+	struct iso1SignedInfoType SignedInfo ;
+	struct iso1ObjectType Object ;
+#if 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;
+	unsigned int MeteringReceiptReq_isUsed:1;
+	unsigned int PaymentDetailsReq_isUsed:1;
+	unsigned int MeteringReceiptRes_isUsed:1;
+	unsigned int PaymentDetailsRes_isUsed:1;
+	unsigned int SessionSetupReq_isUsed:1;
+	unsigned int SessionSetupRes_isUsed:1;
+	unsigned int CableCheckReq_isUsed:1;
+	unsigned int CableCheckRes_isUsed:1;
+	unsigned int CertificateInstallationReq_isUsed:1;
+	unsigned int CertificateInstallationRes_isUsed:1;
+	unsigned int WeldingDetectionReq_isUsed:1;
+	unsigned int WeldingDetectionRes_isUsed:1;
+	unsigned int CertificateUpdateReq_isUsed:1;
+	unsigned int CertificateUpdateRes_isUsed:1;
+	unsigned int PaymentServiceSelectionReq_isUsed:1;
+	unsigned int PowerDeliveryReq_isUsed:1;
+	unsigned int PaymentServiceSelectionRes_isUsed:1;
+	unsigned int PowerDeliveryRes_isUsed:1;
+	unsigned int ChargingStatusReq_isUsed:1;
+	unsigned int ChargingStatusRes_isUsed:1;
+	unsigned int BodyElement_isUsed:1;
+	unsigned int CurrentDemandReq_isUsed:1;
+	unsigned int PreChargeReq_isUsed:1;
+	unsigned int CurrentDemandRes_isUsed:1;
+	unsigned int PreChargeRes_isUsed:1;
+	unsigned int SessionStopReq_isUsed:1;
+	unsigned int AuthorizationReq_isUsed:1;
+	unsigned int SessionStopRes_isUsed:1;
+	unsigned int AuthorizationRes_isUsed:1;
+	unsigned int ChargeParameterDiscoveryReq_isUsed:1;
+	unsigned int ChargeParameterDiscoveryRes_isUsed:1;
+	unsigned int ServiceDetailReq_isUsed:1;
+	unsigned int ServiceDetailRes_isUsed:1;
+	unsigned int DC_EVSEStatus_isUsed:1;
+	unsigned int RelativeTimeInterval_isUsed:1;
+	unsigned int SalesTariffEntry_isUsed:1;
+	unsigned int DC_EVPowerDeliveryParameter_isUsed:1;
+	unsigned int SASchedules_isUsed:1;
+	unsigned int AC_EVChargeParameter_isUsed:1;
+	unsigned int SAScheduleList_isUsed:1;
+	unsigned int DC_EVStatus_isUsed:1;
+	unsigned int EVStatus_isUsed:1;
+	unsigned int DC_EVChargeParameter_isUsed:1;
+	unsigned int DC_EVSEChargeParameter_isUsed:1;
+	unsigned int EVSEStatus_isUsed:1;
+	unsigned int TimeInterval_isUsed:1;
+	unsigned int EVPowerDeliveryParameter_isUsed:1;
+	unsigned int EVSEChargeParameter_isUsed:1;
+	unsigned int AC_EVSEStatus_isUsed:1;
+	unsigned int Entry_isUsed:1;
+	unsigned int AC_EVSEChargeParameter_isUsed:1;
+	unsigned int PMaxScheduleEntry_isUsed:1;
+	unsigned int EVChargeParameter_isUsed:1;
+	unsigned int SignatureProperty_isUsed:1;
+	unsigned int DSAKeyValue_isUsed:1;
+	unsigned int SignatureProperties_isUsed:1;
+	unsigned int KeyValue_isUsed:1;
+	unsigned int Transforms_isUsed:1;
+	unsigned int DigestMethod_isUsed:1;
+	unsigned int Signature_isUsed:1;
+	unsigned int RetrievalMethod_isUsed:1;
+	unsigned int Manifest_isUsed:1;
+	unsigned int Reference_isUsed:1;
+	unsigned int CanonicalizationMethod_isUsed:1;
+	unsigned int RSAKeyValue_isUsed:1;
+	unsigned int Transform_isUsed:1;
+	unsigned int PGPData_isUsed:1;
+	unsigned int MgmtData_isUsed:1;
+	unsigned int SignatureMethod_isUsed:1;
+	unsigned int KeyInfo_isUsed:1;
+	unsigned int SPKIData_isUsed:1;
+	unsigned int X509Data_isUsed:1;
+	unsigned int SignatureValue_isUsed:1;
+	unsigned int KeyName_isUsed:1;
+	unsigned int DigestValue_isUsed:1;
+	unsigned int SignedInfo_isUsed:1;
+	unsigned int Object_isUsed:1;
+
+
+	int _warning_;
+};
+
+
+#if DEPLOY_ISO1_CODEC_FRAGMENT == SUPPORT_YES
+struct iso1EXISchemaInformedElementFragmentGrammar {
+	/* Schema-informed Element Fragment Grammar for START_ELEMENT({urn:iso:15118:2:2013:MsgBody}eMAID) */
+	/* 4 ATTRIBUTE[STRING]({urn:iso:15118:2:2013:MsgDataTypes}Id) */
+	unsigned int Id_isUsed:1;
+	struct {
+		exi_string_character_t characters[iso1exiElementFrag_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	} Id ;
+	/* 247 START_ELEMENT({urn:iso:15118:2:2013:MsgBody}eMAID) */
+	unsigned int CHARACTERS_GENERIC_isUsed:1;
+	struct {
+		exi_string_character_t characters[iso1exiElementFrag_CHARACTERS_GENERIC_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	} CHARACTERS_GENERIC ;
+
+
+	int _warning_;
+};
+/* Possible elements of EXI Fragment */
+struct iso1EXIFragment {
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	int ChargingComplete ;
+	struct iso1PhysicalValueType EVMaxVoltage ;
+	uint16_t ServiceID ;
+	int8_t EVRESSSOC ;
+	uint64_t MeterReading ;
+	struct iso1PhysicalValueType physicalValue ;
+	struct iso1IntervalType TimeInterval ;
+	struct iso1AC_EVSEStatusType AC_EVSEStatus ;
+	struct iso1PhysicalValueType EVMaxCurrent ;
+	uint32_t ChargingProfileEntryStart ;
+	struct iso1PhysicalValueType EVSEMaxCurrent ;
+	iso1costKindType costKind ;
+	struct iso1PhysicalValueType EAmount ;
+	iso1EnergyTransferModeType EnergyTransferMode ;
+	int64_t X509SerialNumber ;
+	uint8_t NumEPriceLevels ;
+	struct iso1RetrievalMethodType RetrievalMethod ;
+	struct iso1PhysicalValueType PMax ;
+	int16_t ParameterSetID ;
+	int8_t BulkSOC ;
+	struct iso1PhysicalValueType EVSEMinimumCurrentLimit ;
+	int EVSEPowerLimitAchieved ;
+	struct iso1SalesTariffEntryType SalesTariffEntry ;
+	struct iso1TransformsType Transforms ;
+	iso1EVSEProcessingType EVSEProcessing ;
+	iso1isolationLevelType EVSEIsolationStatus ;
+	int BulkChargingComplete ;
+	uint8_t SAScheduleTupleID ;
+	iso1faultCodeType FaultCode ;
+	struct iso1X509IssuerSerialType RootCertificateID ;
+	int64_t HMACOutputLength ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_Exponent_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Exponent ;
+	struct iso1X509IssuerSerialType X509IssuerSerial ;
+	int8_t byteValue ;
+	struct iso1SPKIDataType SPKIData ;
+	struct iso1SAScheduleListType SAScheduleList ;
+	struct iso1PhysicalValueType EVMaximumPowerLimit ;
+	struct iso1DC_EVSEStatusType DC_EVSEStatus ;
+	int16_t RetryCounter ;
+	struct iso1PhysicalValueType EVSEMaximumCurrentLimit ;
+	struct iso1SalesTariffType SalesTariff ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_PgenCounter_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PgenCounter ;
+	struct iso1X509DataType X509Data ;
+	struct iso1PhysicalValueType EVSECurrentRegulationTolerance ;
+	struct iso1KeyValueType KeyValue ;
+	struct iso1AnonType_V2G_Message V2G_Message ;
+	struct iso1PhysicalValueType EVSEMinimumVoltageLimit ;
+	iso1responseCodeType ResponseCode ;
+	struct iso1ProfileEntryType ProfileEntry ;
+	uint32_t start ;
+	iso1DC_EVErrorCodeType EVErrorCode ;
+	struct iso1EVChargeParameterType EVChargeParameter ;
+	struct iso1CertificateChainType ContractSignatureCertChain ;
+	struct iso1PhysicalValueType EVSEPresentCurrent ;
+	struct iso1PGPDataType PGPData ;
+	struct iso1PhysicalValueType EVMinCurrent ;
+	int8_t FullSOC ;
+	uint32_t amount ;
+	struct iso1DC_EVSEChargeParameterType DC_EVSEChargeParameter ;
+	struct iso1EntryType Entry ;
+	struct iso1SessionStopResType SessionStopRes ;
+	int16_t shortValue ;
+	struct iso1CertificateChainType SAProvisioningCertificateChain ;
+	struct iso1PowerDeliveryReqType PowerDeliveryReq ;
+	struct iso1PowerDeliveryResType PowerDeliveryRes ;
+	struct iso1SessionStopReqType SessionStopReq ;
+	struct iso1SignaturePropertyType SignatureProperty ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_SessionID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SessionID ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_PGPKeyPacket_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyPacket ;
+	struct iso1MessageHeaderType Header ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_Seed_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Seed ;
+	struct iso1RSAKeyValueType RSAKeyValue ;
+	int FreeService ;
+	struct iso1PhysicalValueType EVSENominalVoltage ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_XPath_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  XPath ;
+	struct iso1MeteringReceiptResType MeteringReceiptRes ;
+	struct iso1ServiceDiscoveryReqType ServiceDiscoveryReq ;
+	struct iso1MeteringReceiptReqType MeteringReceiptReq ;
+	struct iso1PreChargeResType PreChargeRes ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_OEMProvisioningCert_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  OEMProvisioningCert ;
+	struct iso1PhysicalValueType EVEnergyCapacity ;
+	struct iso1SignatureType Signature ;
+	struct iso1AC_EVSEChargeParameterType AC_EVSEChargeParameter ;
+	struct iso1ServiceDiscoveryResType ServiceDiscoveryRes ;
+	struct iso1PreChargeReqType PreChargeReq ;
+	uint16_t NotificationMaxDelay ;
+	struct iso1CableCheckReqType CableCheckReq ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_SalesTariffDescription_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  SalesTariffDescription ;
+	int EVSEVoltageLimitAchieved ;
+	int boolValue ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_EVCCID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  EVCCID ;
+	struct iso1DC_EVChargeParameterType DC_EVChargeParameter ;
+	struct iso1ChargingStatusReqType ChargingStatusReq ;
+	struct iso1CableCheckResType CableCheckRes ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_MgmtData_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MgmtData ;
+	struct iso1MeterInfoType MeterInfo ;
+	struct iso1PhysicalValueType EVSEEnergyToBeDelivered ;
+	struct iso1EVSEStatusType EVSEStatus ;
+	struct iso1ServiceType Service ;
+	struct iso1ManifestType Manifest ;
+	struct iso1PhysicalValueType EVMaximumVoltageLimit ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_P_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  P ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_Q_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Q ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_X509SubjectName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509SubjectName ;
+	int32_t intValue ;
+	struct iso1ChargingProfileType ChargingProfile ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_G_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  G ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_J_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  J ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_ServiceScope_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceScope ;
+	int ReceiptRequired ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_ServiceName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ServiceName ;
+	int16_t MeterStatus ;
+	struct iso1DC_EVStatusType DC_EVStatus ;
+	struct iso1ChargingStatusResType ChargingStatusRes ;
+	iso1serviceCategoryType ServiceCategory ;
+	struct iso1NotificationType Notification ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_X509CRL_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509CRL ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_Y_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Y ;
+	struct iso1PhysicalValueType EVSEPresentVoltage ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+	struct iso1PhysicalValueType EVSEMaximumPowerLimit ;
+	int64_t EVSETimeStamp ;
+	struct iso1CostType Cost ;
+	struct iso1PhysicalValueType EVSEPeakCurrentRipple ;
+	struct iso1ConsumptionCostType ConsumptionCost ;
+	struct iso1DigestMethodType DigestMethod ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_SPKISexp_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SPKISexp ;
+	struct iso1SessionSetupResType SessionSetupRes ;
+	int EVSECurrentLimitAchieved ;
+	struct iso1ServiceDetailReqType ServiceDetailReq ;
+	struct iso1PhysicalValueType EVSEMaximumVoltageLimit ;
+	struct iso1ServiceDetailResType ServiceDetailRes ;
+	struct iso1SignaturePropertiesType SignatureProperties ;
+	uint8_t EPriceLevel ;
+	struct iso1PhysicalValueType EVTargetCurrent ;
+	struct iso1PhysicalValueType RemainingTimeToBulkSoC ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_stringValue_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  stringValue ;
+	struct iso1SessionSetupReqType SessionSetupReq ;
+	int8_t Multiplier ;
+	struct iso1CertificateUpdateResType CertificateUpdateRes ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_PGPKeyID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyID ;
+	struct iso1PhysicalValueType EVTargetVoltage ;
+	struct iso1DSAKeyValueType DSAKeyValue ;
+	struct iso1CertificateUpdateReqType CertificateUpdateReq ;
+	struct iso1PhysicalValueType EVMaximumCurrentLimit ;
+	struct iso1CanonicalizationMethodType CanonicalizationMethod ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_X509Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509Certificate ;
+	struct iso1CertificateInstallationReqType CertificateInstallationReq ;
+	struct iso1CertificateInstallationResType CertificateInstallationRes ;
+	struct iso1EVStatusType EVStatus ;
+	struct iso1SupportedEnergyTransferModeType SupportedEnergyTransferMode ;
+	struct iso1SignedInfoType SignedInfo ;
+	/* Schema-informed Element Fragment Grammar for {urn:iso:15118:2:2013:MsgBody}eMAID */
+	struct iso1EXISchemaInformedElementFragmentGrammar eMAID ;
+	uint16_t MaxEntriesSAScheduleTuple ;
+	iso1paymentOptionType PaymentOption ;
+	struct iso1SubCertificatesType SubCertificates ;
+	struct iso1PaymentDetailsReqType PaymentDetailsReq ;
+	struct iso1AuthorizationReqType AuthorizationReq ;
+	struct iso1PaymentDetailsResType PaymentDetailsRes ;
+	struct iso1AuthorizationResType AuthorizationRes ;
+	iso1DC_EVSEStatusCodeType EVSEStatusCode ;
+	struct iso1PaymentOptionListType PaymentOptionList ;
+	struct iso1SelectedServiceListType SelectedServiceList ;
+	struct iso1ContractSignatureEncryptedPrivateKeyType ContractSignatureEncryptedPrivateKey ;
+	struct iso1WeldingDetectionReqType WeldingDetectionReq ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_FaultMsg_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  FaultMsg ;
+	struct iso1WeldingDetectionResType WeldingDetectionRes ;
+	iso1chargeProgressType ChargeProgress ;
+	iso1paymentOptionType SelectedPaymentOption ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	struct iso1ParameterSetType ParameterSet ;
+	struct iso1EVSEChargeParameterType EVSEChargeParameter ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_SigMeterReading_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SigMeterReading ;
+	struct iso1SignatureValueType SignatureValue ;
+	struct iso1SASchedulesType SASchedules ;
+	uint8_t SalesTariffID ;
+	struct iso1DiffieHellmanPublickeyType DHpublickey ;
+	struct iso1ServiceParameterListType ServiceParameterList ;
+	struct iso1ListOfRootCertificateIDsType ListOfRootCertificateIDs ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_MeterID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MeterID ;
+	struct iso1ChargeServiceType ChargeService ;
+	int8_t amountMultiplier ;
+	int RCD ;
+	struct iso1PhysicalValueType startValue ;
+	struct iso1CurrentDemandReqType CurrentDemandReq ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_KeyName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  KeyName ;
+	struct iso1DC_EVPowerDeliveryParameterType DC_EVPowerDeliveryParameter ;
+	struct iso1BodyType Body ;
+	iso1EVSENotificationType EVSENotification ;
+	int16_t Value ;
+	struct iso1KeyInfoType KeyInfo ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_GenChallenge_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  GenChallenge ;
+	struct iso1AC_EVChargeParameterType AC_EVChargeParameter ;
+	struct iso1PMaxScheduleEntryType PMaxScheduleEntry ;
+	struct iso1ParameterType Parameter ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_X509SKI_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509SKI ;
+	struct iso1SelectedServiceType SelectedService ;
+	struct iso1PaymentServiceSelectionReqType PaymentServiceSelectionReq ;
+	struct iso1PaymentServiceSelectionResType PaymentServiceSelectionRes ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Certificate ;
+	struct iso1CurrentDemandResType CurrentDemandRes ;
+	int EVReady ;
+	struct iso1SignatureMethodType SignatureMethod ;
+	struct iso1PMaxScheduleType PMaxSchedule ;
+	iso1unitSymbolType Unit ;
+	struct {
+		exi_string_character_t characters[iso1EXIFragment_X509IssuerName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509IssuerName ;
+	struct iso1ReferenceType Reference ;
+	int8_t ChargingProfileEntryMaxNumberOfPhasesInUse ;
+	struct iso1EVPowerDeliveryParameterType EVPowerDeliveryParameter ;
+	struct iso1PhysicalValueType ChargingProfileEntryMaxPower ;
+	struct iso1ChargeParameterDiscoveryReqType ChargeParameterDiscoveryReq ;
+	uint32_t duration ;
+	int64_t TMeter ;
+	struct iso1ChargeParameterDiscoveryResType ChargeParameterDiscoveryRes ;
+	struct iso1ServiceListType ServiceList ;
+	struct iso1SAScheduleTupleType SAScheduleTuple ;
+	struct iso1BodyBaseType BodyElement ;
+	struct iso1PhysicalValueType RemainingTimeToFullSoC ;
+	struct iso1RelativeTimeIntervalType RelativeTimeInterval ;
+	struct iso1TransformType Transform ;
+	uint32_t DepartureTime ;
+	struct iso1ObjectType Object ;
+	struct iso1PhysicalValueType EVEnergyRequest ;
+	struct {
+		uint8_t bytes[iso1EXIFragment_Modulus_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Modulus ;
+	iso1chargingSessionType ChargingSession ;
+	iso1EnergyTransferModeType RequestedEnergyTransferMode ;
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	};
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	unsigned int ChargingComplete_isUsed:1;
+	unsigned int EVMaxVoltage_isUsed:1;
+	unsigned int ServiceID_isUsed:1;
+	unsigned int EVRESSSOC_isUsed:1;
+	unsigned int MeterReading_isUsed:1;
+	unsigned int physicalValue_isUsed:1;
+	unsigned int TimeInterval_isUsed:1;
+	unsigned int AC_EVSEStatus_isUsed:1;
+	unsigned int EVMaxCurrent_isUsed:1;
+	unsigned int ChargingProfileEntryStart_isUsed:1;
+	unsigned int EVSEMaxCurrent_isUsed:1;
+	unsigned int costKind_isUsed:1;
+	unsigned int EAmount_isUsed:1;
+	unsigned int EnergyTransferMode_isUsed:1;
+	unsigned int X509SerialNumber_isUsed:1;
+	unsigned int NumEPriceLevels_isUsed:1;
+	unsigned int RetrievalMethod_isUsed:1;
+	unsigned int PMax_isUsed:1;
+	unsigned int ParameterSetID_isUsed:1;
+	unsigned int BulkSOC_isUsed:1;
+	unsigned int EVSEMinimumCurrentLimit_isUsed:1;
+	unsigned int EVSEPowerLimitAchieved_isUsed:1;
+	unsigned int SalesTariffEntry_isUsed:1;
+	unsigned int Transforms_isUsed:1;
+	unsigned int EVSEProcessing_isUsed:1;
+	unsigned int EVSEIsolationStatus_isUsed:1;
+	unsigned int BulkChargingComplete_isUsed:1;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	unsigned int FaultCode_isUsed:1;
+	unsigned int RootCertificateID_isUsed:1;
+	unsigned int HMACOutputLength_isUsed:1;
+	unsigned int Exponent_isUsed:1;
+	unsigned int X509IssuerSerial_isUsed:1;
+	unsigned int byteValue_isUsed:1;
+	unsigned int SPKIData_isUsed:1;
+	unsigned int SAScheduleList_isUsed:1;
+	unsigned int EVMaximumPowerLimit_isUsed:1;
+	unsigned int DC_EVSEStatus_isUsed:1;
+	unsigned int RetryCounter_isUsed:1;
+	unsigned int EVSEMaximumCurrentLimit_isUsed:1;
+	unsigned int SalesTariff_isUsed:1;
+	unsigned int PgenCounter_isUsed:1;
+	unsigned int X509Data_isUsed:1;
+	unsigned int EVSECurrentRegulationTolerance_isUsed:1;
+	unsigned int KeyValue_isUsed:1;
+	unsigned int V2G_Message_isUsed:1;
+	unsigned int EVSEMinimumVoltageLimit_isUsed:1;
+	unsigned int ResponseCode_isUsed:1;
+	unsigned int ProfileEntry_isUsed:1;
+	unsigned int start_isUsed:1;
+	unsigned int EVErrorCode_isUsed:1;
+	unsigned int EVChargeParameter_isUsed:1;
+	unsigned int ContractSignatureCertChain_isUsed:1;
+	unsigned int EVSEPresentCurrent_isUsed:1;
+	unsigned int PGPData_isUsed:1;
+	unsigned int EVMinCurrent_isUsed:1;
+	unsigned int FullSOC_isUsed:1;
+	unsigned int amount_isUsed:1;
+	unsigned int DC_EVSEChargeParameter_isUsed:1;
+	unsigned int Entry_isUsed:1;
+	unsigned int SessionStopRes_isUsed:1;
+	unsigned int shortValue_isUsed:1;
+	unsigned int SAProvisioningCertificateChain_isUsed:1;
+	unsigned int PowerDeliveryReq_isUsed:1;
+	unsigned int PowerDeliveryRes_isUsed:1;
+	unsigned int SessionStopReq_isUsed:1;
+	unsigned int SignatureProperty_isUsed:1;
+	unsigned int SessionID_isUsed:1;
+	unsigned int PGPKeyPacket_isUsed:1;
+	unsigned int Header_isUsed:1;
+	unsigned int Seed_isUsed:1;
+	unsigned int RSAKeyValue_isUsed:1;
+	unsigned int FreeService_isUsed:1;
+	unsigned int EVSENominalVoltage_isUsed:1;
+	unsigned int XPath_isUsed:1;
+	unsigned int MeteringReceiptRes_isUsed:1;
+	unsigned int ServiceDiscoveryReq_isUsed:1;
+	unsigned int MeteringReceiptReq_isUsed:1;
+	unsigned int PreChargeRes_isUsed:1;
+	unsigned int OEMProvisioningCert_isUsed:1;
+	unsigned int EVEnergyCapacity_isUsed:1;
+	unsigned int Signature_isUsed:1;
+	unsigned int AC_EVSEChargeParameter_isUsed:1;
+	unsigned int ServiceDiscoveryRes_isUsed:1;
+	unsigned int PreChargeReq_isUsed:1;
+	unsigned int NotificationMaxDelay_isUsed:1;
+	unsigned int CableCheckReq_isUsed:1;
+	unsigned int SalesTariffDescription_isUsed:1;
+	unsigned int EVSEVoltageLimitAchieved_isUsed:1;
+	unsigned int boolValue_isUsed:1;
+	unsigned int EVCCID_isUsed:1;
+	unsigned int DC_EVChargeParameter_isUsed:1;
+	unsigned int ChargingStatusReq_isUsed:1;
+	unsigned int CableCheckRes_isUsed:1;
+	unsigned int MgmtData_isUsed:1;
+	unsigned int MeterInfo_isUsed:1;
+	unsigned int EVSEEnergyToBeDelivered_isUsed:1;
+	unsigned int EVSEStatus_isUsed:1;
+	unsigned int Service_isUsed:1;
+	unsigned int Manifest_isUsed:1;
+	unsigned int EVMaximumVoltageLimit_isUsed:1;
+	unsigned int P_isUsed:1;
+	unsigned int Q_isUsed:1;
+	unsigned int X509SubjectName_isUsed:1;
+	unsigned int intValue_isUsed:1;
+	unsigned int ChargingProfile_isUsed:1;
+	unsigned int G_isUsed:1;
+	unsigned int J_isUsed:1;
+	unsigned int ServiceScope_isUsed:1;
+	unsigned int ReceiptRequired_isUsed:1;
+	unsigned int ServiceName_isUsed:1;
+	unsigned int MeterStatus_isUsed:1;
+	unsigned int DC_EVStatus_isUsed:1;
+	unsigned int ChargingStatusRes_isUsed:1;
+	unsigned int ServiceCategory_isUsed:1;
+	unsigned int Notification_isUsed:1;
+	unsigned int X509CRL_isUsed:1;
+	unsigned int Y_isUsed:1;
+	unsigned int EVSEPresentVoltage_isUsed:1;
+	unsigned int DigestValue_isUsed:1;
+	unsigned int EVSEMaximumPowerLimit_isUsed:1;
+	unsigned int EVSETimeStamp_isUsed:1;
+	unsigned int Cost_isUsed:1;
+	unsigned int EVSEPeakCurrentRipple_isUsed:1;
+	unsigned int ConsumptionCost_isUsed:1;
+	unsigned int DigestMethod_isUsed:1;
+	unsigned int SPKISexp_isUsed:1;
+	unsigned int SessionSetupRes_isUsed:1;
+	unsigned int EVSECurrentLimitAchieved_isUsed:1;
+	unsigned int ServiceDetailReq_isUsed:1;
+	unsigned int EVSEMaximumVoltageLimit_isUsed:1;
+	unsigned int ServiceDetailRes_isUsed:1;
+	unsigned int SignatureProperties_isUsed:1;
+	unsigned int EPriceLevel_isUsed:1;
+	unsigned int EVTargetCurrent_isUsed:1;
+	unsigned int RemainingTimeToBulkSoC_isUsed:1;
+	unsigned int stringValue_isUsed:1;
+	unsigned int SessionSetupReq_isUsed:1;
+	unsigned int Multiplier_isUsed:1;
+	unsigned int CertificateUpdateRes_isUsed:1;
+	unsigned int PGPKeyID_isUsed:1;
+	unsigned int EVTargetVoltage_isUsed:1;
+	unsigned int DSAKeyValue_isUsed:1;
+	unsigned int CertificateUpdateReq_isUsed:1;
+	unsigned int EVMaximumCurrentLimit_isUsed:1;
+	unsigned int CanonicalizationMethod_isUsed:1;
+	unsigned int X509Certificate_isUsed:1;
+	unsigned int CertificateInstallationReq_isUsed:1;
+	unsigned int CertificateInstallationRes_isUsed:1;
+	unsigned int EVStatus_isUsed:1;
+	unsigned int SupportedEnergyTransferMode_isUsed:1;
+	unsigned int SignedInfo_isUsed:1;
+	unsigned int eMAID_isUsed:1;
+	unsigned int MaxEntriesSAScheduleTuple_isUsed:1;
+	unsigned int PaymentOption_isUsed:1;
+	unsigned int SubCertificates_isUsed:1;
+	unsigned int PaymentDetailsReq_isUsed:1;
+	unsigned int AuthorizationReq_isUsed:1;
+	unsigned int PaymentDetailsRes_isUsed:1;
+	unsigned int AuthorizationRes_isUsed:1;
+	unsigned int EVSEStatusCode_isUsed:1;
+	unsigned int PaymentOptionList_isUsed:1;
+	unsigned int SelectedServiceList_isUsed:1;
+	unsigned int ContractSignatureEncryptedPrivateKey_isUsed:1;
+	unsigned int WeldingDetectionReq_isUsed:1;
+	unsigned int FaultMsg_isUsed:1;
+	unsigned int WeldingDetectionRes_isUsed:1;
+	unsigned int ChargeProgress_isUsed:1;
+	unsigned int SelectedPaymentOption_isUsed:1;
+	unsigned int EVSEID_isUsed:1;
+	unsigned int ParameterSet_isUsed:1;
+	unsigned int EVSEChargeParameter_isUsed:1;
+	unsigned int SigMeterReading_isUsed:1;
+	unsigned int SignatureValue_isUsed:1;
+	unsigned int SASchedules_isUsed:1;
+	unsigned int SalesTariffID_isUsed:1;
+	unsigned int DHpublickey_isUsed:1;
+	unsigned int ServiceParameterList_isUsed:1;
+	unsigned int ListOfRootCertificateIDs_isUsed:1;
+	unsigned int MeterID_isUsed:1;
+	unsigned int ChargeService_isUsed:1;
+	unsigned int amountMultiplier_isUsed:1;
+	unsigned int RCD_isUsed:1;
+	unsigned int startValue_isUsed:1;
+	unsigned int CurrentDemandReq_isUsed:1;
+	unsigned int KeyName_isUsed:1;
+	unsigned int DC_EVPowerDeliveryParameter_isUsed:1;
+	unsigned int Body_isUsed:1;
+	unsigned int EVSENotification_isUsed:1;
+	unsigned int Value_isUsed:1;
+	unsigned int KeyInfo_isUsed:1;
+	unsigned int GenChallenge_isUsed:1;
+	unsigned int AC_EVChargeParameter_isUsed:1;
+	unsigned int PMaxScheduleEntry_isUsed:1;
+	unsigned int Parameter_isUsed:1;
+	unsigned int X509SKI_isUsed:1;
+	unsigned int SelectedService_isUsed:1;
+	unsigned int PaymentServiceSelectionReq_isUsed:1;
+	unsigned int PaymentServiceSelectionRes_isUsed:1;
+	unsigned int Certificate_isUsed:1;
+	unsigned int CurrentDemandRes_isUsed:1;
+	unsigned int EVReady_isUsed:1;
+	unsigned int SignatureMethod_isUsed:1;
+	unsigned int PMaxSchedule_isUsed:1;
+	unsigned int Unit_isUsed:1;
+	unsigned int X509IssuerName_isUsed:1;
+	unsigned int Reference_isUsed:1;
+	unsigned int ChargingProfileEntryMaxNumberOfPhasesInUse_isUsed:1;
+	unsigned int EVPowerDeliveryParameter_isUsed:1;
+	unsigned int ChargingProfileEntryMaxPower_isUsed:1;
+	unsigned int ChargeParameterDiscoveryReq_isUsed:1;
+	unsigned int duration_isUsed:1;
+	unsigned int TMeter_isUsed:1;
+	unsigned int ChargeParameterDiscoveryRes_isUsed:1;
+	unsigned int ServiceList_isUsed:1;
+	unsigned int SAScheduleTuple_isUsed:1;
+	unsigned int BodyElement_isUsed:1;
+	unsigned int RemainingTimeToFullSoC_isUsed:1;
+	unsigned int RelativeTimeInterval_isUsed:1;
+	unsigned int Transform_isUsed:1;
+	unsigned int DepartureTime_isUsed:1;
+	unsigned int Object_isUsed:1;
+	unsigned int EVEnergyRequest_isUsed:1;
+	unsigned int Modulus_isUsed:1;
+	unsigned int ChargingSession_isUsed:1;
+	unsigned int RequestedEnergyTransferMode_isUsed:1;
+
+
+	int _warning_;
+};
+#endif /* DEPLOY_ISO1_CODEC_FRAGMENT */
+
+
+/* Initialization methods for structs */
+
+void init_iso1EXIDocument(struct iso1EXIDocument* exiDoc);
+#if DEPLOY_ISO1_CODEC_FRAGMENT == SUPPORT_YES
+void init_iso1EXIFragment(struct iso1EXIFragment* exiFrag);
+void init_iso1EXISchemaInformedElementFragmentGrammar(struct iso1EXISchemaInformedElementFragmentGrammar* exiFrag);
+#endif /* DEPLOY_ISO1_CODEC_FRAGMENT */
+void init_iso1MessageHeaderType(struct iso1MessageHeaderType* iso1MessageHeaderType);
+void init_iso1SignatureType(struct iso1SignatureType* iso1SignatureType);
+void init_iso1PowerDeliveryReqType(struct iso1PowerDeliveryReqType* iso1PowerDeliveryReqType);
+void init_iso1ParameterType(struct iso1ParameterType* iso1ParameterType);
+void init_iso1CertificateInstallationReqType(struct iso1CertificateInstallationReqType* iso1CertificateInstallationReqType);
+void init_iso1SessionSetupResType(struct iso1SessionSetupResType* iso1SessionSetupResType);
+void init_iso1EVChargeParameterType(struct iso1EVChargeParameterType* iso1EVChargeParameterType);
+void init_iso1DiffieHellmanPublickeyType(struct iso1DiffieHellmanPublickeyType* iso1DiffieHellmanPublickeyType);
+void init_iso1ServiceDiscoveryResType(struct iso1ServiceDiscoveryResType* iso1ServiceDiscoveryResType);
+void init_iso1ServiceParameterListType(struct iso1ServiceParameterListType* iso1ServiceParameterListType);
+void init_iso1CertificateChainType(struct iso1CertificateChainType* iso1CertificateChainType);
+void init_iso1SASchedulesType(struct iso1SASchedulesType* iso1SASchedulesType);
+void init_iso1DC_EVSEStatusType(struct iso1DC_EVSEStatusType* iso1DC_EVSEStatusType);
+void init_iso1PreChargeResType(struct iso1PreChargeResType* iso1PreChargeResType);
+void init_iso1ParameterSetType(struct iso1ParameterSetType* iso1ParameterSetType);
+void init_iso1ServiceDetailReqType(struct iso1ServiceDetailReqType* iso1ServiceDetailReqType);
+void init_iso1RelativeTimeIntervalType(struct iso1RelativeTimeIntervalType* iso1RelativeTimeIntervalType);
+void init_iso1SignedInfoType(struct iso1SignedInfoType* iso1SignedInfoType);
+void init_iso1EMAIDType(struct iso1EMAIDType* iso1EMAIDType);
+void init_iso1EVStatusType(struct iso1EVStatusType* iso1EVStatusType);
+void init_iso1ServiceListType(struct iso1ServiceListType* iso1ServiceListType);
+void init_iso1EVSEChargeParameterType(struct iso1EVSEChargeParameterType* iso1EVSEChargeParameterType);
+void init_iso1EVPowerDeliveryParameterType(struct iso1EVPowerDeliveryParameterType* iso1EVPowerDeliveryParameterType);
+void init_iso1ProfileEntryType(struct iso1ProfileEntryType* iso1ProfileEntryType);
+void init_iso1AuthorizationReqType(struct iso1AuthorizationReqType* iso1AuthorizationReqType);
+void init_iso1MeterInfoType(struct iso1MeterInfoType* iso1MeterInfoType);
+void init_iso1ManifestType(struct iso1ManifestType* iso1ManifestType);
+void init_iso1ChargeParameterDiscoveryResType(struct iso1ChargeParameterDiscoveryResType* iso1ChargeParameterDiscoveryResType);
+void init_iso1PowerDeliveryResType(struct iso1PowerDeliveryResType* iso1PowerDeliveryResType);
+void init_iso1DC_EVChargeParameterType(struct iso1DC_EVChargeParameterType* iso1DC_EVChargeParameterType);
+void init_iso1ConsumptionCostType(struct iso1ConsumptionCostType* iso1ConsumptionCostType);
+void init_iso1PMaxScheduleType(struct iso1PMaxScheduleType* iso1PMaxScheduleType);
+void init_iso1PaymentOptionListType(struct iso1PaymentOptionListType* iso1PaymentOptionListType);
+void init_iso1ObjectType(struct iso1ObjectType* iso1ObjectType);
+void init_iso1PhysicalValueType(struct iso1PhysicalValueType* iso1PhysicalValueType);
+void init_iso1RSAKeyValueType(struct iso1RSAKeyValueType* iso1RSAKeyValueType);
+void init_iso1SessionStopResType(struct iso1SessionStopResType* iso1SessionStopResType);
+void init_iso1CertificateUpdateReqType(struct iso1CertificateUpdateReqType* iso1CertificateUpdateReqType);
+void init_iso1SignatureValueType(struct iso1SignatureValueType* iso1SignatureValueType);
+void init_iso1PaymentDetailsReqType(struct iso1PaymentDetailsReqType* iso1PaymentDetailsReqType);
+void init_iso1AuthorizationResType(struct iso1AuthorizationResType* iso1AuthorizationResType);
+void init_iso1DC_EVSEChargeParameterType(struct iso1DC_EVSEChargeParameterType* iso1DC_EVSEChargeParameterType);
+void init_iso1SubCertificatesType(struct iso1SubCertificatesType* iso1SubCertificatesType);
+void init_iso1ChargingStatusResType(struct iso1ChargingStatusResType* iso1ChargingStatusResType);
+void init_iso1DSAKeyValueType(struct iso1DSAKeyValueType* iso1DSAKeyValueType);
+void init_iso1ListOfRootCertificateIDsType(struct iso1ListOfRootCertificateIDsType* iso1ListOfRootCertificateIDsType);
+void init_iso1ChargeServiceType(struct iso1ChargeServiceType* iso1ChargeServiceType);
+void init_iso1IntervalType(struct iso1IntervalType* iso1IntervalType);
+void init_iso1MeteringReceiptReqType(struct iso1MeteringReceiptReqType* iso1MeteringReceiptReqType);
+void init_iso1ServiceDetailResType(struct iso1ServiceDetailResType* iso1ServiceDetailResType);
+void init_iso1KeyValueType(struct iso1KeyValueType* iso1KeyValueType);
+void init_iso1SelectedServiceListType(struct iso1SelectedServiceListType* iso1SelectedServiceListType);
+void init_iso1CableCheckResType(struct iso1CableCheckResType* iso1CableCheckResType);
+void init_iso1X509IssuerSerialType(struct iso1X509IssuerSerialType* iso1X509IssuerSerialType);
+void init_iso1KeyInfoType(struct iso1KeyInfoType* iso1KeyInfoType);
+void init_iso1TransformsType(struct iso1TransformsType* iso1TransformsType);
+void init_iso1ChargeParameterDiscoveryReqType(struct iso1ChargeParameterDiscoveryReqType* iso1ChargeParameterDiscoveryReqType);
+void init_iso1PreChargeReqType(struct iso1PreChargeReqType* iso1PreChargeReqType);
+void init_iso1EVSEStatusType(struct iso1EVSEStatusType* iso1EVSEStatusType);
+void init_iso1SignatureMethodType(struct iso1SignatureMethodType* iso1SignatureMethodType);
+void init_iso1X509DataType(struct iso1X509DataType* iso1X509DataType);
+void init_iso1NotificationType(struct iso1NotificationType* iso1NotificationType);
+void init_iso1SAScheduleListType(struct iso1SAScheduleListType* iso1SAScheduleListType);
+void init_iso1BodyType(struct iso1BodyType* iso1BodyType);
+void init_iso1ChargingProfileType(struct iso1ChargingProfileType* iso1ChargingProfileType);
+void init_iso1TransformType(struct iso1TransformType* iso1TransformType);
+void init_iso1SAScheduleTupleType(struct iso1SAScheduleTupleType* iso1SAScheduleTupleType);
+void init_iso1AC_EVChargeParameterType(struct iso1AC_EVChargeParameterType* iso1AC_EVChargeParameterType);
+void init_iso1AnonType_V2G_Message(struct iso1AnonType_V2G_Message* iso1AnonType_V2G_Message);
+void init_iso1PaymentDetailsResType(struct iso1PaymentDetailsResType* iso1PaymentDetailsResType);
+void init_iso1ContractSignatureEncryptedPrivateKeyType(struct iso1ContractSignatureEncryptedPrivateKeyType* iso1ContractSignatureEncryptedPrivateKeyType);
+void init_iso1PMaxScheduleEntryType(struct iso1PMaxScheduleEntryType* iso1PMaxScheduleEntryType);
+void init_iso1SPKIDataType(struct iso1SPKIDataType* iso1SPKIDataType);
+void init_iso1MeteringReceiptResType(struct iso1MeteringReceiptResType* iso1MeteringReceiptResType);
+void init_iso1SessionStopReqType(struct iso1SessionStopReqType* iso1SessionStopReqType);
+void init_iso1WeldingDetectionResType(struct iso1WeldingDetectionResType* iso1WeldingDetectionResType);
+void init_iso1ReferenceType(struct iso1ReferenceType* iso1ReferenceType);
+void init_iso1CurrentDemandReqType(struct iso1CurrentDemandReqType* iso1CurrentDemandReqType);
+void init_iso1SalesTariffEntryType(struct iso1SalesTariffEntryType* iso1SalesTariffEntryType);
+void init_iso1EntryType(struct iso1EntryType* iso1EntryType);
+void init_iso1SessionSetupReqType(struct iso1SessionSetupReqType* iso1SessionSetupReqType);
+void init_iso1CostType(struct iso1CostType* iso1CostType);
+void init_iso1DC_EVPowerDeliveryParameterType(struct iso1DC_EVPowerDeliveryParameterType* iso1DC_EVPowerDeliveryParameterType);
+void init_iso1RetrievalMethodType(struct iso1RetrievalMethodType* iso1RetrievalMethodType);
+void init_iso1CertificateUpdateResType(struct iso1CertificateUpdateResType* iso1CertificateUpdateResType);
+void init_iso1CertificateInstallationResType(struct iso1CertificateInstallationResType* iso1CertificateInstallationResType);
+void init_iso1CanonicalizationMethodType(struct iso1CanonicalizationMethodType* iso1CanonicalizationMethodType);
+void init_iso1WeldingDetectionReqType(struct iso1WeldingDetectionReqType* iso1WeldingDetectionReqType);
+void init_iso1DC_EVStatusType(struct iso1DC_EVStatusType* iso1DC_EVStatusType);
+void init_iso1CurrentDemandResType(struct iso1CurrentDemandResType* iso1CurrentDemandResType);
+void init_iso1ServiceType(struct iso1ServiceType* iso1ServiceType);
+void init_iso1ServiceDiscoveryReqType(struct iso1ServiceDiscoveryReqType* iso1ServiceDiscoveryReqType);
+void init_iso1AC_EVSEChargeParameterType(struct iso1AC_EVSEChargeParameterType* iso1AC_EVSEChargeParameterType);
+void init_iso1CableCheckReqType(struct iso1CableCheckReqType* iso1CableCheckReqType);
+void init_iso1SelectedServiceType(struct iso1SelectedServiceType* iso1SelectedServiceType);
+void init_iso1AC_EVSEStatusType(struct iso1AC_EVSEStatusType* iso1AC_EVSEStatusType);
+void init_iso1SalesTariffType(struct iso1SalesTariffType* iso1SalesTariffType);
+void init_iso1PaymentServiceSelectionReqType(struct iso1PaymentServiceSelectionReqType* iso1PaymentServiceSelectionReqType);
+void init_iso1SignaturePropertiesType(struct iso1SignaturePropertiesType* iso1SignaturePropertiesType);
+void init_iso1BodyBaseType(struct iso1BodyBaseType* iso1BodyBaseType);
+void init_iso1SupportedEnergyTransferModeType(struct iso1SupportedEnergyTransferModeType* iso1SupportedEnergyTransferModeType);
+void init_iso1ChargingStatusReqType(struct iso1ChargingStatusReqType* iso1ChargingStatusReqType);
+void init_iso1PaymentServiceSelectionResType(struct iso1PaymentServiceSelectionResType* iso1PaymentServiceSelectionResType);
+void init_iso1DigestMethodType(struct iso1DigestMethodType* iso1DigestMethodType);
+void init_iso1SignaturePropertyType(struct iso1SignaturePropertyType* iso1SignaturePropertyType);
+void init_iso1PGPDataType(struct iso1PGPDataType* iso1PGPDataType);
+
+
+#endif /* DEPLOY_ISO1_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 9847 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypesDecoder.c


+ 65 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypesDecoder.h

@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypesDecoder.h
+ * \brief 	Decoder for datatype definitions
+ *
+ */
+
+#ifndef EXI_iso1_DATATYPES_DECODER_H
+#define EXI_iso1_DATATYPES_DECODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "iso1EXIDatatypes.h"
+
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+
+int decode_iso1ExiDocument(bitstream_t* stream, struct iso1EXIDocument* exiDoc);
+
+#if DEPLOY_ISO1_CODEC_FRAGMENT == SUPPORT_YES
+int decode_iso1ExiFragment(bitstream_t* stream, struct iso1EXIFragment* exiFrag);
+#endif /* DEPLOY_ISO1_CODEC_FRAGMENT */
+
+#endif /* DEPLOY_ISO1_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 7011 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypesEncoder.c


+ 68 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso1/iso1EXIDatatypesEncoder.h

@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypesEncoder.h
+ * \brief 	Encoder for datatype definitions
+ *
+ */
+
+#ifndef EXI_iso1_DATATYPES_ENCODER_H
+#define EXI_iso1_DATATYPES_ENCODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "iso1EXIDatatypes.h"
+
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+
+
+int encode_iso1ExiDocument(bitstream_t* stream, struct iso1EXIDocument* exiDoc);
+
+#if DEPLOY_ISO1_CODEC_FRAGMENT == SUPPORT_YES
+int encode_iso1ExiFragment(bitstream_t* stream, struct iso1EXIFragment* exiFrag);
+#endif /* DEPLOY_ISO1_CODEC_FRAGMENT */
+
+
+#endif /* DEPLOY_ISO1_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 1496 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypes.c

@@ -0,0 +1,1496 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include <stdint.h>
+
+#include "iso2EXIDatatypes.h"
+#include "../codec/EXITypes.h"
+
+
+#ifndef EXI_iso2_DATATYPES_C
+#define EXI_iso2_DATATYPES_C
+
+#if DEPLOY_ISO2_CODEC == SUPPORT_YES
+
+
+void init_iso2EXIDocument(struct iso2EXIDocument* exiDoc) {
+	exiDoc->V2G_Message_isUsed = 0u;
+	exiDoc->ServiceDiscoveryReq_isUsed = 0u;
+	exiDoc->ServiceDiscoveryRes_isUsed = 0u;
+	exiDoc->FinePositioningReq_isUsed = 0u;
+	exiDoc->FinePositioningRes_isUsed = 0u;
+	exiDoc->DisconnectChargingDeviceReq_isUsed = 0u;
+	exiDoc->DisconnectChargingDeviceRes_isUsed = 0u;
+	exiDoc->PowerDemandReq_isUsed = 0u;
+	exiDoc->MeteringReceiptReq_isUsed = 0u;
+	exiDoc->PaymentDetailsReq_isUsed = 0u;
+	exiDoc->PowerDemandRes_isUsed = 0u;
+	exiDoc->MeteringReceiptRes_isUsed = 0u;
+	exiDoc->PaymentDetailsRes_isUsed = 0u;
+	exiDoc->SessionSetupReq_isUsed = 0u;
+	exiDoc->SessionSetupRes_isUsed = 0u;
+	exiDoc->CableCheckReq_isUsed = 0u;
+	exiDoc->CableCheckRes_isUsed = 0u;
+	exiDoc->CertificateInstallationReq_isUsed = 0u;
+	exiDoc->CertificateInstallationRes_isUsed = 0u;
+	exiDoc->SystemStatusReq_isUsed = 0u;
+	exiDoc->SystemStatusRes_isUsed = 0u;
+	exiDoc->PairingReq_isUsed = 0u;
+	exiDoc->WeldingDetectionReq_isUsed = 0u;
+	exiDoc->ConnectChargingDeviceReq_isUsed = 0u;
+	exiDoc->PairingRes_isUsed = 0u;
+	exiDoc->WeldingDetectionRes_isUsed = 0u;
+	exiDoc->ConnectChargingDeviceRes_isUsed = 0u;
+	exiDoc->CertificateUpdateReq_isUsed = 0u;
+	exiDoc->CertificateUpdateRes_isUsed = 0u;
+	exiDoc->PaymentServiceSelectionReq_isUsed = 0u;
+	exiDoc->PowerDeliveryReq_isUsed = 0u;
+	exiDoc->PaymentServiceSelectionRes_isUsed = 0u;
+	exiDoc->PowerDeliveryRes_isUsed = 0u;
+	exiDoc->ChargingStatusReq_isUsed = 0u;
+	exiDoc->ChargingStatusRes_isUsed = 0u;
+	exiDoc->BodyElement_isUsed = 0u;
+	exiDoc->AC_BidirectionalControlReq_isUsed = 0u;
+	exiDoc->AC_BidirectionalControlRes_isUsed = 0u;
+	exiDoc->VehicleCheckInReq_isUsed = 0u;
+	exiDoc->CurrentDemandReq_isUsed = 0u;
+	exiDoc->VehicleCheckInRes_isUsed = 0u;
+	exiDoc->PreChargeReq_isUsed = 0u;
+	exiDoc->CurrentDemandRes_isUsed = 0u;
+	exiDoc->PreChargeRes_isUsed = 0u;
+	exiDoc->AlignmentCheckReq_isUsed = 0u;
+	exiDoc->V2GRequest_isUsed = 0u;
+	exiDoc->SessionStopReq_isUsed = 0u;
+	exiDoc->AuthorizationReq_isUsed = 0u;
+	exiDoc->AlignmentCheckRes_isUsed = 0u;
+	exiDoc->SessionStopRes_isUsed = 0u;
+	exiDoc->AuthorizationRes_isUsed = 0u;
+	exiDoc->VehicleCheckOutReq_isUsed = 0u;
+	exiDoc->ChargeParameterDiscoveryReq_isUsed = 0u;
+	exiDoc->VehicleCheckOutRes_isUsed = 0u;
+	exiDoc->ChargeParameterDiscoveryRes_isUsed = 0u;
+	exiDoc->V2GResponse_isUsed = 0u;
+	exiDoc->FinePositioningSetupReq_isUsed = 0u;
+	exiDoc->FinePositioningSetupRes_isUsed = 0u;
+	exiDoc->ServiceDetailReq_isUsed = 0u;
+	exiDoc->DC_BidirectionalControlReq_isUsed = 0u;
+	exiDoc->ServiceDetailRes_isUsed = 0u;
+	exiDoc->DC_BidirectionalControlRes_isUsed = 0u;
+	exiDoc->LFA_EVFinePositioningSetupParameters_isUsed = 0u;
+	exiDoc->MV_EVSEFinePositioningParameters_isUsed = 0u;
+	exiDoc->RelativeTimeInterval_isUsed = 0u;
+	exiDoc->SalesTariffEntry_isUsed = 0u;
+	exiDoc->LFA_EVSEFinePositioningSetupParameters_isUsed = 0u;
+	exiDoc->AC_EVChargeParameter_isUsed = 0u;
+	exiDoc->MV_EVSEFinePositioningSetupParameters_isUsed = 0u;
+	exiDoc->EVEnergyTransferParameter_isUsed = 0u;
+	exiDoc->DC_EVSEBidirectionalParameter_isUsed = 0u;
+	exiDoc->SAScheduleList_isUsed = 0u;
+	exiDoc->EVSEFinePositioningSetupParameters_isUsed = 0u;
+	exiDoc->Generic_EVSEFinePositioningParameters_isUsed = 0u;
+	exiDoc->DC_EVChargeParameter_isUsed = 0u;
+	exiDoc->DC_EVSEChargeParameter_isUsed = 0u;
+	exiDoc->LFA_EVFinePositioningParameters_isUsed = 0u;
+	exiDoc->EVFinePositioningSetupParameters_isUsed = 0u;
+	exiDoc->AC_EVSEBidirectionalParameter_isUsed = 0u;
+	exiDoc->EVFinePositioningParameters_isUsed = 0u;
+	exiDoc->WPT_EVChargeParameter_isUsed = 0u;
+	exiDoc->LFA_EVSEFinePositioningParameters_isUsed = 0u;
+	exiDoc->EVSEEnergyTransferParameter_isUsed = 0u;
+	exiDoc->AC_EVBidirectionalParameter_isUsed = 0u;
+	exiDoc->EVSEFinePositioningParameters_isUsed = 0u;
+	exiDoc->WPT_EVSEChargeParameter_isUsed = 0u;
+	exiDoc->AC_EVSEChargeParameter_isUsed = 0u;
+	exiDoc->PMaxScheduleEntry_isUsed = 0u;
+	exiDoc->Generic_EVFinePositioningParameters_isUsed = 0u;
+	exiDoc->DC_EVBidirectionalParameter_isUsed = 0u;
+	exiDoc->SignatureProperty_isUsed = 0u;
+	exiDoc->DSAKeyValue_isUsed = 0u;
+	exiDoc->SignatureProperties_isUsed = 0u;
+	exiDoc->KeyValue_isUsed = 0u;
+	exiDoc->Transforms_isUsed = 0u;
+	exiDoc->DigestMethod_isUsed = 0u;
+	exiDoc->Signature_isUsed = 0u;
+	exiDoc->RetrievalMethod_isUsed = 0u;
+	exiDoc->Manifest_isUsed = 0u;
+	exiDoc->Reference_isUsed = 0u;
+	exiDoc->CanonicalizationMethod_isUsed = 0u;
+	exiDoc->RSAKeyValue_isUsed = 0u;
+	exiDoc->Transform_isUsed = 0u;
+	exiDoc->PGPData_isUsed = 0u;
+	exiDoc->MgmtData_isUsed = 0u;
+	exiDoc->SignatureMethod_isUsed = 0u;
+	exiDoc->KeyInfo_isUsed = 0u;
+	exiDoc->SPKIData_isUsed = 0u;
+	exiDoc->X509Data_isUsed = 0u;
+	exiDoc->SignatureValue_isUsed = 0u;
+	exiDoc->KeyName_isUsed = 0u;
+	exiDoc->DigestValue_isUsed = 0u;
+	exiDoc->SignedInfo_isUsed = 0u;
+	exiDoc->Object_isUsed = 0u;
+}
+
+
+#if DEPLOY_ISO2_CODEC_FRAGMENT == SUPPORT_YES
+void init_iso2EXIFragment(struct iso2EXIFragment* exiFrag) {
+	exiFrag->EVMaximumVoltage_isUsed = 0u;
+	exiFrag->EVMaximumVoltage_isUsed = 0u;
+	exiFrag->FrequencyChannel_isUsed = 0u;
+	exiFrag->FrequencyChannel_isUsed = 0u;
+	exiFrag->EVProcessing_isUsed = 0u;
+	exiFrag->EVProcessing_isUsed = 0u;
+	exiFrag->EVProcessing_isUsed = 0u;
+	exiFrag->BulkChargingComplete_isUsed = 0u;
+	exiFrag->ParkingMethod_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->Distance_isUsed = 0u;
+	exiFrag->ParameterSet_isUsed = 0u;
+	exiFrag->EVMinimumDischargeCurrent_isUsed = 0u;
+	exiFrag->SignalSeparationTime_isUsed = 0u;
+	exiFrag->SignalSeparationTime_isUsed = 0u;
+	exiFrag->EVSEEnergyTransferParameter_isUsed = 0u;
+	exiFrag->EVSEMaximumVoltage_isUsed = 0u;
+	exiFrag->EVSEMaximumVoltage_isUsed = 0u;
+	exiFrag->DC_EVSEBidirectionalParameter_isUsed = 0u;
+	exiFrag->ChargingSession_isUsed = 0u;
+	exiFrag->SubCertificates_isUsed = 0u;
+	exiFrag->RetrievalMethod_isUsed = 0u;
+	exiFrag->MagneticVectorSetupList_isUsed = 0u;
+	exiFrag->PairingParameters_isUsed = 0u;
+	exiFrag->PairingParameters_isUsed = 0u;
+	exiFrag->EVSEMinimumPower_isUsed = 0u;
+	exiFrag->AC_BidirectionalControlReq_isUsed = 0u;
+	exiFrag->Cost_isUsed = 0u;
+	exiFrag->AC_BidirectionalControlRes_isUsed = 0u;
+	exiFrag->BuyBackTariff_isUsed = 0u;
+	exiFrag->XCoordinate_isUsed = 0u;
+	exiFrag->EVSECheckOutStatus_isUsed = 0u;
+	exiFrag->stringValue_isUsed = 0u;
+	exiFrag->RetryCounter_isUsed = 0u;
+	exiFrag->EVSEMaximumDischargeCurrent_isUsed = 0u;
+	exiFrag->Sensor_isUsed = 0u;
+	exiFrag->MeterReadingCharged_isUsed = 0u;
+	exiFrag->HMACOutputLength_isUsed = 0u;
+	exiFrag->V2GResponse_isUsed = 0u;
+	exiFrag->EVMinimumVoltage_isUsed = 0u;
+	exiFrag->EVMinimumEnergyRequest_isUsed = 0u;
+	exiFrag->EVMinimumEnergyRequest_isUsed = 0u;
+	exiFrag->EVMinimumEnergyRequest_isUsed = 0u;
+	exiFrag->RelativeTimeInterval_isUsed = 0u;
+	exiFrag->RelativeTimeInterval_isUsed = 0u;
+	exiFrag->WPT_EVChargeParameter_isUsed = 0u;
+	exiFrag->SAScheduleTuple_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->PgenCounter_isUsed = 0u;
+	exiFrag->SalesTariffDescription_isUsed = 0u;
+	exiFrag->AngleGAtoVA_isUsed = 0u;
+	exiFrag->boolValue_isUsed = 0u;
+	exiFrag->EVMaximumDischargeCurrent_isUsed = 0u;
+	exiFrag->EVMaximumDischargeCurrent_isUsed = 0u;
+	exiFrag->NotificationMaxDelay_isUsed = 0u;
+	exiFrag->EVSEMaximumDischargePower_isUsed = 0u;
+	exiFrag->PGPData_isUsed = 0u;
+	exiFrag->EVSEMaximumChargePower_isUsed = 0u;
+	exiFrag->SessionID_isUsed = 0u;
+	exiFrag->EVSEEnergyToBeDelivered_isUsed = 0u;
+	exiFrag->EVMaximumPower_isUsed = 0u;
+	exiFrag->EVMaximumCurrent_isUsed = 0u;
+	exiFrag->RSAKeyValue_isUsed = 0u;
+	exiFrag->EVSENominalVoltage_isUsed = 0u;
+	exiFrag->MagneticVector_isUsed = 0u;
+	exiFrag->XPath_isUsed = 0u;
+	exiFrag->Signature_isUsed = 0u;
+	exiFrag->EVElectricalChargingDeviceStatus_isUsed = 0u;
+	exiFrag->EVElectricalChargingDeviceStatus_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->EVSEProcessing_isUsed = 0u;
+	exiFrag->FODStatus_isUsed = 0u;
+	exiFrag->PowerDeliveryRes_isUsed = 0u;
+	exiFrag->SessionStopRes_isUsed = 0u;
+	exiFrag->WPT_EVSEChargeParameter_isUsed = 0u;
+	exiFrag->ResponseCode_isUsed = 0u;
+	exiFrag->EVTargetEnergyRequest_isUsed = 0u;
+	exiFrag->EVTargetEnergyRequest_isUsed = 0u;
+	exiFrag->EVTargetEnergyRequest_isUsed = 0u;
+	exiFrag->FinePositioningSetupReq_isUsed = 0u;
+	exiFrag->EVSEPresentCurrent_isUsed = 0u;
+	exiFrag->EVSEPresentCurrent_isUsed = 0u;
+	exiFrag->FinePositioningSetupRes_isUsed = 0u;
+	exiFrag->ProfileEntry_isUsed = 0u;
+	exiFrag->MgmtData_isUsed = 0u;
+	exiFrag->SAProvisioningCertificateChain_isUsed = 0u;
+	exiFrag->SAProvisioningCertificateChain_isUsed = 0u;
+	exiFrag->PowerDeliveryReq_isUsed = 0u;
+	exiFrag->SessionStopReq_isUsed = 0u;
+	exiFrag->ReceiptRequired_isUsed = 0u;
+	exiFrag->ReceiptRequired_isUsed = 0u;
+	exiFrag->ReceiptRequired_isUsed = 0u;
+	exiFrag->ReceiptRequired_isUsed = 0u;
+	exiFrag->ReceiptRequired_isUsed = 0u;
+	exiFrag->ChargingProfile_isUsed = 0u;
+	exiFrag->MaxSupportingPoints_isUsed = 0u;
+	exiFrag->start_isUsed = 0u;
+	exiFrag->EVMinimumChargePower_isUsed = 0u;
+	exiFrag->amount_isUsed = 0u;
+	exiFrag->PreChargeReq_isUsed = 0u;
+	exiFrag->OEMProvisioningCert_isUsed = 0u;
+	exiFrag->PackageIndex_isUsed = 0u;
+	exiFrag->PreChargeRes_isUsed = 0u;
+	exiFrag->P_isUsed = 0u;
+	exiFrag->Q_isUsed = 0u;
+	exiFrag->X509SubjectName_isUsed = 0u;
+	exiFrag->G_isUsed = 0u;
+	exiFrag->J_isUsed = 0u;
+	exiFrag->SessionID_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->ContractSignatureCertChain_isUsed = 0u;
+	exiFrag->MV_EVSEFinePositioningSetupParameters_isUsed = 0u;
+	exiFrag->EVSEMinimumDischargeCurrent_isUsed = 0u;
+	exiFrag->EVMaximumChargeCurrent_isUsed = 0u;
+	exiFrag->EVMaximumChargeCurrent_isUsed = 0u;
+	exiFrag->AlignmentOffset_isUsed = 0u;
+	exiFrag->AlignmentOffset_isUsed = 0u;
+	exiFrag->Y_isUsed = 0u;
+	exiFrag->RemainingTimeToTargetSOC_isUsed = 0u;
+	exiFrag->DigestValue_isUsed = 0u;
+	exiFrag->SensorMeasurements_isUsed = 0u;
+	exiFrag->SalesTariff_isUsed = 0u;
+	exiFrag->EVCCID_isUsed = 0u;
+	exiFrag->EVSEMaximumPower_isUsed = 0u;
+	exiFrag->TargetOffset_isUsed = 0u;
+	exiFrag->PowerDemandParameters_isUsed = 0u;
+	exiFrag->PowerDemandParameters_isUsed = 0u;
+	exiFrag->PGPKeyID_isUsed = 0u;
+	exiFrag->DisconnectChargingDeviceReq_isUsed = 0u;
+	exiFrag->DisconnectChargingDeviceRes_isUsed = 0u;
+	exiFrag->DSAKeyValue_isUsed = 0u;
+	exiFrag->SalesTariffEntry_isUsed = 0u;
+	exiFrag->CertificateInstallationRes_isUsed = 0u;
+	exiFrag->CanonicalizationMethod_isUsed = 0u;
+	exiFrag->Generic_EVFinePositioningParameters_isUsed = 0u;
+	exiFrag->EVSEMinimumVoltage_isUsed = 0u;
+	exiFrag->SystemStatusRes_isUsed = 0u;
+	exiFrag->EVSEOutputPower_isUsed = 0u;
+	exiFrag->SignedInfo_isUsed = 0u;
+	exiFrag->EVMinimumChargeCurrent_isUsed = 0u;
+	exiFrag->EVMinimumChargeCurrent_isUsed = 0u;
+	exiFrag->costKind_isUsed = 0u;
+	exiFrag->SystemStatusReq_isUsed = 0u;
+	exiFrag->CableCheckReq_isUsed = 0u;
+	exiFrag->NumEPriceLevels_isUsed = 0u;
+	exiFrag->EVSEVoltageLimitAchieved_isUsed = 0u;
+	exiFrag->EVSEVoltageLimitAchieved_isUsed = 0u;
+	exiFrag->PackageSeparationTime_isUsed = 0u;
+	exiFrag->PackageSeparationTime_isUsed = 0u;
+	exiFrag->CableCheckRes_isUsed = 0u;
+	exiFrag->EVCheckInStatus_isUsed = 0u;
+	exiFrag->PMaxDischargeSchedule_isUsed = 0u;
+	exiFrag->EVMinimumPower_isUsed = 0u;
+	exiFrag->ChargingPerformance_isUsed = 0u;
+	exiFrag->AlignmentCheckReq_isUsed = 0u;
+	exiFrag->EVMechanicalChargingDeviceStatus_isUsed = 0u;
+	exiFrag->EVMechanicalChargingDeviceStatus_isUsed = 0u;
+	exiFrag->EVMechanicalChargingDeviceStatus_isUsed = 0u;
+	exiFrag->VehicleSpace_isUsed = 0u;
+	exiFrag->AlignmentCheckRes_isUsed = 0u;
+	exiFrag->EVMinimumDischargePower_isUsed = 0u;
+	exiFrag->RemainingTimeToMinimumSOC_isUsed = 0u;
+	exiFrag->AuthorizationRes_isUsed = 0u;
+	exiFrag->CertificateInstallationReq_isUsed = 0u;
+	exiFrag->PaymentDetailsReq_isUsed = 0u;
+	exiFrag->PaymentDetailsRes_isUsed = 0u;
+	exiFrag->AuthorizationReq_isUsed = 0u;
+	exiFrag->EVTargetCurrent_isUsed = 0u;
+	exiFrag->EVTargetCurrent_isUsed = 0u;
+	exiFrag->EVTargetCurrent_isUsed = 0u;
+	exiFrag->SessionSetupReq_isUsed = 0u;
+	exiFrag->SessionSetupRes_isUsed = 0u;
+	exiFrag->EVSENominalFrequency_isUsed = 0u;
+	exiFrag->EVSENominalFrequency_isUsed = 0u;
+	exiFrag->Header_isUsed = 0u;
+	exiFrag->NumberOfSensors_isUsed = 0u;
+	exiFrag->NumberOfSensors_isUsed = 0u;
+	exiFrag->EVSETimeStamp_isUsed = 0u;
+	exiFrag->EVSETimeStamp_isUsed = 0u;
+	exiFrag->MeterStatus_isUsed = 0u;
+	exiFrag->EVSEMaximumPower_isUsed = 0u;
+	exiFrag->MV_EVSEFinePositioningParameters_isUsed = 0u;
+	exiFrag->ChargeProgress_isUsed = 0u;
+	exiFrag->KeyName_isUsed = 0u;
+	exiFrag->PMaxSchedule_isUsed = 0u;
+	exiFrag->duration_isUsed = 0u;
+	exiFrag->RemainingTimeToBulkSOC_isUsed = 0u;
+	exiFrag->SensorOrientation_isUsed = 0u;
+	exiFrag->EVSEMinimumVoltage_isUsed = 0u;
+	exiFrag->EVSEMaximumChargeCurrent_isUsed = 0u;
+	exiFrag->LFA_EVSEFinePositioningParameters_isUsed = 0u;
+	exiFrag->VehicleCheckInRes_isUsed = 0u;
+	exiFrag->PMaxScheduleEntry_isUsed = 0u;
+	exiFrag->SAScheduleList_isUsed = 0u;
+	exiFrag->X509SKI_isUsed = 0u;
+	exiFrag->PaymentOptionList_isUsed = 0u;
+	exiFrag->ContractSignatureEncryptedPrivateKey_isUsed = 0u;
+	exiFrag->ContractSignatureEncryptedPrivateKey_isUsed = 0u;
+	exiFrag->VehicleCheckInReq_isUsed = 0u;
+	exiFrag->Certificate_isUsed = 0u;
+	exiFrag->Certificate_isUsed = 0u;
+	exiFrag->CheckOutTime_isUsed = 0u;
+	exiFrag->CurrentSOC_isUsed = 0u;
+	exiFrag->CurrentSOC_isUsed = 0u;
+	exiFrag->ZCoordinate_isUsed = 0u;
+	exiFrag->MeasurementData_isUsed = 0u;
+	exiFrag->PairingRes_isUsed = 0u;
+	exiFrag->EVSEMaximumCurrent_isUsed = 0u;
+	exiFrag->LFA_EVFinePositioningParameters_isUsed = 0u;
+	exiFrag->AlignmentCheckParameters_isUsed = 0u;
+	exiFrag->AlignmentCheckParameters_isUsed = 0u;
+	exiFrag->EffectiveRadiatedPower_isUsed = 0u;
+	exiFrag->PairingReq_isUsed = 0u;
+	exiFrag->EVMinimumChargeCurrent_isUsed = 0u;
+	exiFrag->EVMinimumChargeCurrent_isUsed = 0u;
+	exiFrag->Value_isUsed = 0u;
+	exiFrag->byteValue_isUsed = 0u;
+	exiFrag->EVSEMaximumChargeCurrent_isUsed = 0u;
+	exiFrag->EVSEMaximumChargeCurrent_isUsed = 0u;
+	exiFrag->CurrentDemandReq_isUsed = 0u;
+	exiFrag->Generic_EVSEFinePositioningParameters_isUsed = 0u;
+	exiFrag->CurrentDemandRes_isUsed = 0u;
+	exiFrag->SAScheduleList_isUsed = 0u;
+	exiFrag->AC_EVBidirectionalParameter_isUsed = 0u;
+	exiFrag->Modulus_isUsed = 0u;
+	exiFrag->SelectedEnergyTransferService_isUsed = 0u;
+	exiFrag->startValue_isUsed = 0u;
+	exiFrag->SelectedVASList_isUsed = 0u;
+	exiFrag->EVSEMaximumDischargePower_isUsed = 0u;
+	exiFrag->ChargeParameterDiscoveryReq_isUsed = 0u;
+	exiFrag->ChargeParameterDiscoveryRes_isUsed = 0u;
+	exiFrag->EVMaximumDischargeCurrent_isUsed = 0u;
+	exiFrag->EVMaximumDischargeCurrent_isUsed = 0u;
+	exiFrag->SigMeterReading_isUsed = 0u;
+	exiFrag->TargetSOC_isUsed = 0u;
+	exiFrag->TargetSOC_isUsed = 0u;
+	exiFrag->EVMaximumPower_isUsed = 0u;
+	exiFrag->EVSEMaximumChargePower_isUsed = 0u;
+	exiFrag->EVSEStatus_isUsed = 0u;
+	exiFrag->EVSEMinimumChargeCurrent_isUsed = 0u;
+	exiFrag->EVSEElectricalChargingDeviceStatus_isUsed = 0u;
+	exiFrag->EVSEElectricalChargingDeviceStatus_isUsed = 0u;
+	exiFrag->X509SerialNumber_isUsed = 0u;
+	exiFrag->PaymentOption_isUsed = 0u;
+	exiFrag->Transforms_isUsed = 0u;
+	exiFrag->EVSEPeakCurrentRipple_isUsed = 0u;
+	exiFrag->ConsumptionCost_isUsed = 0u;
+	exiFrag->EVTargetEnergyRequest_isUsed = 0u;
+	exiFrag->EVSEFinePositioningSetupParameters_isUsed = 0u;
+	exiFrag->EPriceLevel_isUsed = 0u;
+	exiFrag->Exponent_isUsed = 0u;
+	exiFrag->X509IssuerSerial_isUsed = 0u;
+	exiFrag->SPKIData_isUsed = 0u;
+	exiFrag->MagneticVectorList_isUsed = 0u;
+	exiFrag->EVSEFinePositioningParameters_isUsed = 0u;
+	exiFrag->EVTargetPower_isUsed = 0u;
+	exiFrag->SensorPackageList_isUsed = 0u;
+	exiFrag->SensorPackageList_isUsed = 0u;
+	exiFrag->DepartureTime_isUsed = 0u;
+	exiFrag->InletHot_isUsed = 0u;
+	exiFrag->EVPresentActivePower_isUsed = 0u;
+	exiFrag->X509Data_isUsed = 0u;
+	exiFrag->YCoordinate_isUsed = 0u;
+	exiFrag->KeyValue_isUsed = 0u;
+	exiFrag->DisplayParameters_isUsed = 0u;
+	exiFrag->EVSEPowerLimitAchieved_isUsed = 0u;
+	exiFrag->EVSEPowerLimitAchieved_isUsed = 0u;
+	exiFrag->Body_isUsed = 0u;
+	exiFrag->DC_EVChargeParameter_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->SAScheduleTupleID_isUsed = 0u;
+	exiFrag->Service_isUsed = 0u;
+	exiFrag->EVMinimumDischargeCurrent_isUsed = 0u;
+	exiFrag->EVMinimumDischargeCurrent_isUsed = 0u;
+	exiFrag->SignatureProperty_isUsed = 0u;
+	exiFrag->PGPKeyPacket_isUsed = 0u;
+	exiFrag->PGPKeyPacket_isUsed = 0u;
+	exiFrag->Seed_isUsed = 0u;
+	exiFrag->LFA_EVFinePositioningSetupParameters_isUsed = 0u;
+	exiFrag->MinimumPMaxRequest_isUsed = 0u;
+	exiFrag->FinePositioningReq_isUsed = 0u;
+	exiFrag->EnergyTransferServiceList_isUsed = 0u;
+	exiFrag->FinePositioningRes_isUsed = 0u;
+	exiFrag->AC_EVSEBidirectionalParameter_isUsed = 0u;
+	exiFrag->FreeService_isUsed = 0u;
+	exiFrag->EVMinimumVoltage_isUsed = 0u;
+	exiFrag->AC_EVSEChargeParameter_isUsed = 0u;
+	exiFrag->EVMaximumVoltage_isUsed = 0u;
+	exiFrag->EVMaximumVoltage_isUsed = 0u;
+	exiFrag->SensorID_isUsed = 0u;
+	exiFrag->SensorID_isUsed = 0u;
+	exiFrag->EVMaximumChargeCurrent_isUsed = 0u;
+	exiFrag->EVMaximumChargeCurrent_isUsed = 0u;
+	exiFrag->EVMaximumChargeCurrent_isUsed = 0u;
+	exiFrag->EVSECurrentRegulationTolerance_isUsed = 0u;
+	exiFrag->EVSEMechanicalChargingDeviceStatus_isUsed = 0u;
+	exiFrag->EVSEMechanicalChargingDeviceStatus_isUsed = 0u;
+	exiFrag->EVSEMechanicalChargingDeviceStatus_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->ServiceID_isUsed = 0u;
+	exiFrag->EVEnergyTransferParameter_isUsed = 0u;
+	exiFrag->SignalPulseDuration_isUsed = 0u;
+	exiFrag->SignalPulseDuration_isUsed = 0u;
+	exiFrag->shortValue_isUsed = 0u;
+	exiFrag->EVSEMaximumDischargeCurrent_isUsed = 0u;
+	exiFrag->EVSEMaximumDischargeCurrent_isUsed = 0u;
+	exiFrag->Manifest_isUsed = 0u;
+	exiFrag->DC_EVSEChargeParameter_isUsed = 0u;
+	exiFrag->MeteringReceiptReq_isUsed = 0u;
+	exiFrag->MeterID_isUsed = 0u;
+	exiFrag->MeteringReceiptRes_isUsed = 0u;
+	exiFrag->ServiceDiscoveryReq_isUsed = 0u;
+	exiFrag->SalesTariffID_isUsed = 0u;
+	exiFrag->ServiceDiscoveryRes_isUsed = 0u;
+	exiFrag->X509CRL_isUsed = 0u;
+	exiFrag->MagneticVectorSetup_isUsed = 0u;
+	exiFrag->DigestMethod_isUsed = 0u;
+	exiFrag->SPKISexp_isUsed = 0u;
+	exiFrag->MeterReadingDischarged_isUsed = 0u;
+	exiFrag->MeasurementDataList_isUsed = 0u;
+	exiFrag->SignatureProperties_isUsed = 0u;
+	exiFrag->SensorPosition_isUsed = 0u;
+	exiFrag->SensorPosition_isUsed = 0u;
+	exiFrag->LFA_EVSEFinePositioningSetupParameters_isUsed = 0u;
+	exiFrag->eMAID_isUsed = 0u;
+	exiFrag->eMAID_isUsed = 0u;
+	exiFrag->eMAID_isUsed = 0u;
+	exiFrag->eMAID_isUsed = 0u;
+	exiFrag->SensorPackage_isUsed = 0u;
+	exiFrag->EVCheckOutStatus_isUsed = 0u;
+	exiFrag->EVMinimumEnergyRequest_isUsed = 0u;
+	exiFrag->X509Certificate_isUsed = 0u;
+	exiFrag->RootCertificateID_isUsed = 0u;
+	exiFrag->DC_BidirectionalControlReq_isUsed = 0u;
+	exiFrag->EVSEPresentVoltage_isUsed = 0u;
+	exiFrag->EVSEPresentVoltage_isUsed = 0u;
+	exiFrag->DC_BidirectionalControlRes_isUsed = 0u;
+	exiFrag->EVSEPresentVoltage_isUsed = 0u;
+	exiFrag->VASList_isUsed = 0u;
+	exiFrag->EVSEPresentVoltage_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->MeterInfo_isUsed = 0u;
+	exiFrag->EVSETargetReactivePower_isUsed = 0u;
+	exiFrag->ChargingStatusReq_isUsed = 0u;
+	exiFrag->GenericParameters_isUsed = 0u;
+	exiFrag->GenericParameters_isUsed = 0u;
+	exiFrag->ChargingStatusRes_isUsed = 0u;
+	exiFrag->EVMaximumChargePower_isUsed = 0u;
+	exiFrag->EVMaximumChargePower_isUsed = 0u;
+	exiFrag->BulkSOC_isUsed = 0u;
+	exiFrag->BulkSOC_isUsed = 0u;
+	exiFrag->NumberOfSignalPackages_isUsed = 0u;
+	exiFrag->NumberOfSignalPackages_isUsed = 0u;
+	exiFrag->ParameterSetID_isUsed = 0u;
+	exiFrag->PMax_isUsed = 0u;
+	exiFrag->ParameterSetID_isUsed = 0u;
+	exiFrag->EVMaximumEnergyRequest_isUsed = 0u;
+	exiFrag->EVMaximumEnergyRequest_isUsed = 0u;
+	exiFrag->EVMaximumEnergyRequest_isUsed = 0u;
+	exiFrag->EVOperation_isUsed = 0u;
+	exiFrag->EVOperation_isUsed = 0u;
+	exiFrag->CertificateUpdateRes_isUsed = 0u;
+	exiFrag->ChargingComplete_isUsed = 0u;
+	exiFrag->ListOfRootCertificateIDs_isUsed = 0u;
+	exiFrag->ListOfRootCertificateIDs_isUsed = 0u;
+	exiFrag->RotationVAtoGA_isUsed = 0u;
+	exiFrag->EVTargetVoltage_isUsed = 0u;
+	exiFrag->EVTargetVoltage_isUsed = 0u;
+	exiFrag->EVTargetVoltage_isUsed = 0u;
+	exiFrag->CertificateUpdateReq_isUsed = 0u;
+	exiFrag->ConnectChargingDeviceRes_isUsed = 0u;
+	exiFrag->DHpublickey_isUsed = 0u;
+	exiFrag->DHpublickey_isUsed = 0u;
+	exiFrag->ServiceParameterList_isUsed = 0u;
+	exiFrag->SignatureValue_isUsed = 0u;
+	exiFrag->physicalValue_isUsed = 0u;
+	exiFrag->Exponent_isUsed = 0u;
+	exiFrag->OperationMode_isUsed = 0u;
+	exiFrag->OperationMode_isUsed = 0u;
+	exiFrag->EVSECurrentLimitAchieved_isUsed = 0u;
+	exiFrag->EVSECurrentLimitAchieved_isUsed = 0u;
+	exiFrag->ServiceDetailReq_isUsed = 0u;
+	exiFrag->ServiceDetailRes_isUsed = 0u;
+	exiFrag->EVSEMaximumVoltage_isUsed = 0u;
+	exiFrag->intValue_isUsed = 0u;
+	exiFrag->EVMaximumDischargePower_isUsed = 0u;
+	exiFrag->EVMaximumDischargePower_isUsed = 0u;
+	exiFrag->MinimumSOC_isUsed = 0u;
+	exiFrag->MinimumSOC_isUsed = 0u;
+	exiFrag->SelectedPaymentOption_isUsed = 0u;
+	exiFrag->V2G_Message_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->EVSEID_isUsed = 0u;
+	exiFrag->TMeter_isUsed = 0u;
+	exiFrag->SensorOrder_isUsed = 0u;
+	exiFrag->SensorOrder_isUsed = 0u;
+	exiFrag->SupportedServiceIDs_isUsed = 0u;
+	exiFrag->GenChallenge_isUsed = 0u;
+	exiFrag->GenChallenge_isUsed = 0u;
+	exiFrag->EVFinePositioningParameters_isUsed = 0u;
+	exiFrag->SensorList_isUsed = 0u;
+	exiFrag->SensorList_isUsed = 0u;
+	exiFrag->KeyInfo_isUsed = 0u;
+	exiFrag->ConnectChargingDeviceReq_isUsed = 0u;
+	exiFrag->AC_EVChargeParameter_isUsed = 0u;
+	exiFrag->Parameter_isUsed = 0u;
+	exiFrag->WeldingDetectionRes_isUsed = 0u;
+	exiFrag->GAID_isUsed = 0u;
+	exiFrag->GAID_isUsed = 0u;
+	exiFrag->SignalFrequency_isUsed = 0u;
+	exiFrag->EVSETargetPower_isUsed = 0u;
+	exiFrag->DC_EVBidirectionalParameter_isUsed = 0u;
+	exiFrag->EVSETargetPower_isUsed = 0u;
+	exiFrag->SignatureMethod_isUsed = 0u;
+	exiFrag->WeldingDetectionReq_isUsed = 0u;
+	exiFrag->SelectedService_isUsed = 0u;
+	exiFrag->EVInputPower_isUsed = 0u;
+	exiFrag->VehicleCheckOutReq_isUsed = 0u;
+	exiFrag->EVMaximumDischargePower_isUsed = 0u;
+	exiFrag->EVMaximumDischargePower_isUsed = 0u;
+	exiFrag->PowerDemandReq_isUsed = 0u;
+	exiFrag->VehicleCheckOutRes_isUsed = 0u;
+	exiFrag->CurrentRange_isUsed = 0u;
+	exiFrag->EVPresentReactivePower_isUsed = 0u;
+	exiFrag->X509IssuerName_isUsed = 0u;
+	exiFrag->V2GRequest_isUsed = 0u;
+	exiFrag->Reference_isUsed = 0u;
+	exiFrag->BodyElement_isUsed = 0u;
+	exiFrag->MinimumPMaxScheduleEntry_isUsed = 0u;
+	exiFrag->EVFinePositioningSetupParameters_isUsed = 0u;
+	exiFrag->EVSENotification_isUsed = 0u;
+	exiFrag->PaymentServiceSelectionReq_isUsed = 0u;
+	exiFrag->EVMaximumChargePower_isUsed = 0u;
+	exiFrag->EVMaximumChargePower_isUsed = 0u;
+	exiFrag->EVMaximumChargePower_isUsed = 0u;
+	exiFrag->PaymentServiceSelectionRes_isUsed = 0u;
+	exiFrag->Transform_isUsed = 0u;
+	exiFrag->EVMaximumEnergyRequest_isUsed = 0u;
+	exiFrag->Object_isUsed = 0u;
+	exiFrag->TargetOffsetY_isUsed = 0u;
+	exiFrag->PowerDemandRes_isUsed = 0u;
+	exiFrag->TargetOffsetX_isUsed = 0u;
+}
+#endif /* DEPLOY_ISO2_CODEC_FRAGMENT */
+
+void init_iso2RetrievalMethodType(struct iso2RetrievalMethodType* iso2RetrievalMethodType) {
+	iso2RetrievalMethodType->URI_isUsed = 0u;
+	iso2RetrievalMethodType->Type_isUsed = 0u;
+	iso2RetrievalMethodType->Transforms_isUsed = 0u;
+}
+
+void init_iso2AuthorizationResType(struct iso2AuthorizationResType* iso2AuthorizationResType) {
+	iso2AuthorizationResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2MV_EVSEFinePositioningSetupParametersType(struct iso2MV_EVSEFinePositioningSetupParametersType* iso2MV_EVSEFinePositioningSetupParametersType) {
+	iso2MV_EVSEFinePositioningSetupParametersType->FrequencyChannel_isUsed = 0u;
+	iso2MV_EVSEFinePositioningSetupParametersType->MagneticVectorSetupList_isUsed = 0u;
+}
+
+void init_iso2X509DataType(struct iso2X509DataType* iso2X509DataType) {
+	iso2X509DataType->X509IssuerSerial.arrayLen = 0u;
+	iso2X509DataType->X509SKI.arrayLen = 0u;
+	iso2X509DataType->X509SubjectName.arrayLen = 0u;
+	iso2X509DataType->X509Certificate.arrayLen = 0u;
+	iso2X509DataType->X509CRL.arrayLen = 0u;
+	iso2X509DataType->ANY_isUsed = 0u;
+}
+
+void init_iso2RSAKeyValueType(struct iso2RSAKeyValueType* iso2RSAKeyValueType) {
+	(void)iso2RSAKeyValueType; /* avoid unused warning */
+}
+
+void init_iso2DC_BidirectionalControlResType(struct iso2DC_BidirectionalControlResType* iso2DC_BidirectionalControlResType) {
+	iso2DC_BidirectionalControlResType->EVSEStatus_isUsed = 0u;
+	iso2DC_BidirectionalControlResType->EVSEMaximumChargePower_isUsed = 0u;
+	iso2DC_BidirectionalControlResType->EVSEMaximumDischargePower_isUsed = 0u;
+	iso2DC_BidirectionalControlResType->EVSEMaximumChargeCurrent_isUsed = 0u;
+	iso2DC_BidirectionalControlResType->EVSEMaximumDischargeCurrent_isUsed = 0u;
+	iso2DC_BidirectionalControlResType->EVSEMaximumVoltage_isUsed = 0u;
+	iso2DC_BidirectionalControlResType->EVSEMinimumVoltage_isUsed = 0u;
+	iso2DC_BidirectionalControlResType->SAScheduleTupleID_isUsed = 0u;
+	iso2DC_BidirectionalControlResType->MeterInfo_isUsed = 0u;
+	iso2DC_BidirectionalControlResType->ReceiptRequired_isUsed = 0u;
+}
+
+void init_iso2CostType(struct iso2CostType* iso2CostType) {
+	(void)iso2CostType; /* avoid unused warning */
+}
+
+void init_iso2ChargingStatusResType(struct iso2ChargingStatusResType* iso2ChargingStatusResType) {
+	iso2ChargingStatusResType->EVSEStatus_isUsed = 0u;
+	iso2ChargingStatusResType->SAScheduleTupleID_isUsed = 0u;
+	iso2ChargingStatusResType->MeterInfo_isUsed = 0u;
+	iso2ChargingStatusResType->ReceiptRequired_isUsed = 0u;
+	iso2ChargingStatusResType->EVSETargetPower_isUsed = 0u;
+}
+
+void init_iso2MeterInfoType(struct iso2MeterInfoType* iso2MeterInfoType) {
+	iso2MeterInfoType->MeterReadingCharged_isUsed = 0u;
+	iso2MeterInfoType->MeterReadingDischarged_isUsed = 0u;
+	iso2MeterInfoType->SigMeterReading_isUsed = 0u;
+	iso2MeterInfoType->MeterStatus_isUsed = 0u;
+	iso2MeterInfoType->TMeter_isUsed = 0u;
+}
+
+void init_iso2AC_EVChargeParameterType(struct iso2AC_EVChargeParameterType* iso2AC_EVChargeParameterType) {
+	iso2AC_EVChargeParameterType->EVTargetEnergyRequest_isUsed = 0u;
+	iso2AC_EVChargeParameterType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2AC_EVChargeParameterType->EVMinimumEnergyRequest_isUsed = 0u;
+}
+
+void init_iso2AC_EVSEBidirectionalParameterType(struct iso2AC_EVSEBidirectionalParameterType* iso2AC_EVSEBidirectionalParameterType) {
+	(void)iso2AC_EVSEBidirectionalParameterType; /* avoid unused warning */
+}
+
+void init_iso2VehicleCheckOutResType(struct iso2VehicleCheckOutResType* iso2VehicleCheckOutResType) {
+	iso2VehicleCheckOutResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2MagneticVectorListType(struct iso2MagneticVectorListType* iso2MagneticVectorListType) {
+	iso2MagneticVectorListType->MagneticVector.arrayLen = 0u;
+}
+
+void init_iso2CableCheckResType(struct iso2CableCheckResType* iso2CableCheckResType) {
+	iso2CableCheckResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2ServiceDiscoveryReqType(struct iso2ServiceDiscoveryReqType* iso2ServiceDiscoveryReqType) {
+	iso2ServiceDiscoveryReqType->SupportedServiceIDs_isUsed = 0u;
+}
+
+void init_iso2ServiceType(struct iso2ServiceType* iso2ServiceType) {
+	(void)iso2ServiceType; /* avoid unused warning */
+}
+
+void init_iso2ServiceParameterListType(struct iso2ServiceParameterListType* iso2ServiceParameterListType) {
+	iso2ServiceParameterListType->ParameterSet.arrayLen = 0u;
+}
+
+void init_iso2PMaxScheduleType(struct iso2PMaxScheduleType* iso2PMaxScheduleType) {
+	iso2PMaxScheduleType->PMaxScheduleEntry.arrayLen = 0u;
+}
+
+void init_iso2SignaturePropertiesType(struct iso2SignaturePropertiesType* iso2SignaturePropertiesType) {
+	iso2SignaturePropertiesType->Id_isUsed = 0u;
+	iso2SignaturePropertiesType->SignatureProperty.arrayLen = 0u;
+}
+
+void init_iso2PMaxScheduleEntryType(struct iso2PMaxScheduleEntryType* iso2PMaxScheduleEntryType) {
+	iso2PMaxScheduleEntryType->PMax.arrayLen = 0u;
+}
+
+void init_iso2SignatureType(struct iso2SignatureType* iso2SignatureType) {
+	iso2SignatureType->Id_isUsed = 0u;
+	iso2SignatureType->KeyInfo_isUsed = 0u;
+	iso2SignatureType->Object.arrayLen = 0u;
+}
+
+void init_iso2VehicleCheckInReqType(struct iso2VehicleCheckInReqType* iso2VehicleCheckInReqType) {
+	iso2VehicleCheckInReqType->ParkingMethod_isUsed = 0u;
+}
+
+void init_iso2ConnectChargingDeviceResType(struct iso2ConnectChargingDeviceResType* iso2ConnectChargingDeviceResType) {
+	iso2ConnectChargingDeviceResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2WeldingDetectionResType(struct iso2WeldingDetectionResType* iso2WeldingDetectionResType) {
+	iso2WeldingDetectionResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2SessionStopResType(struct iso2SessionStopResType* iso2SessionStopResType) {
+	iso2SessionStopResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2VehicleCheckInResType(struct iso2VehicleCheckInResType* iso2VehicleCheckInResType) {
+	iso2VehicleCheckInResType->EVSEStatus_isUsed = 0u;
+	iso2VehicleCheckInResType->TargetOffset_isUsed = 0u;
+}
+
+void init_iso2ServiceListType(struct iso2ServiceListType* iso2ServiceListType) {
+	iso2ServiceListType->Service.arrayLen = 0u;
+}
+
+void init_iso2CertificateUpdateResType(struct iso2CertificateUpdateResType* iso2CertificateUpdateResType) {
+	iso2CertificateUpdateResType->EVSEStatus_isUsed = 0u;
+	iso2CertificateUpdateResType->RetryCounter_isUsed = 0u;
+}
+
+void init_iso2FinePositioningSetupResType(struct iso2FinePositioningSetupResType* iso2FinePositioningSetupResType) {
+	iso2FinePositioningSetupResType->EVSEStatus_isUsed = 0u;
+	iso2FinePositioningSetupResType->EVSEFinePositioningSetupParameters_isUsed = 0u;
+	iso2FinePositioningSetupResType->LFA_EVSEFinePositioningSetupParameters_isUsed = 0u;
+	iso2FinePositioningSetupResType->MV_EVSEFinePositioningSetupParameters_isUsed = 0u;
+}
+
+void init_iso2AC_EVBidirectionalParameterType(struct iso2AC_EVBidirectionalParameterType* iso2AC_EVBidirectionalParameterType) {
+	iso2AC_EVBidirectionalParameterType->EVTargetEnergyRequest_isUsed = 0u;
+	iso2AC_EVBidirectionalParameterType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2AC_EVBidirectionalParameterType->EVMinimumEnergyRequest_isUsed = 0u;
+}
+
+void init_iso2DC_BidirectionalControlReqType(struct iso2DC_BidirectionalControlReqType* iso2DC_BidirectionalControlReqType) {
+	iso2DC_BidirectionalControlReqType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2DC_BidirectionalControlReqType->EVMinimumEnergyRequest_isUsed = 0u;
+	iso2DC_BidirectionalControlReqType->DisplayParameters_isUsed = 0u;
+	iso2DC_BidirectionalControlReqType->EVMaximumDischargeCurrent_isUsed = 0u;
+	iso2DC_BidirectionalControlReqType->EVMaximumChargePower_isUsed = 0u;
+	iso2DC_BidirectionalControlReqType->EVMaximumDischargePower_isUsed = 0u;
+}
+
+void init_iso2CertificateUpdateReqType(struct iso2CertificateUpdateReqType* iso2CertificateUpdateReqType) {
+	(void)iso2CertificateUpdateReqType; /* avoid unused warning */
+}
+
+void init_iso2ConsumptionCostType(struct iso2ConsumptionCostType* iso2ConsumptionCostType) {
+	iso2ConsumptionCostType->Cost.arrayLen = 0u;
+}
+
+void init_iso2SAScheduleListType(struct iso2SAScheduleListType* iso2SAScheduleListType) {
+	iso2SAScheduleListType->SAScheduleTuple.arrayLen = 0u;
+}
+
+void init_iso2MagneticVectorSetupType(struct iso2MagneticVectorSetupType* iso2MagneticVectorSetupType) {
+	(void)iso2MagneticVectorSetupType; /* avoid unused warning */
+}
+
+void init_iso2LFA_EVSEFinePositioningSetupParametersType(struct iso2LFA_EVSEFinePositioningSetupParametersType* iso2LFA_EVSEFinePositioningSetupParametersType) {
+	(void)iso2LFA_EVSEFinePositioningSetupParametersType; /* avoid unused warning */
+}
+
+void init_iso2PaymentOptionListType(struct iso2PaymentOptionListType* iso2PaymentOptionListType) {
+	iso2PaymentOptionListType->PaymentOption.arrayLen = 0u;
+}
+
+void init_iso2LFA_EVSEFinePositioningParametersType(struct iso2LFA_EVSEFinePositioningParametersType* iso2LFA_EVSEFinePositioningParametersType) {
+	(void)iso2LFA_EVSEFinePositioningParametersType; /* avoid unused warning */
+}
+
+void init_iso2RelativeTimeIntervalType(struct iso2RelativeTimeIntervalType* iso2RelativeTimeIntervalType) {
+	iso2RelativeTimeIntervalType->duration_isUsed = 0u;
+}
+
+void init_iso2EVFinePositioningParametersType(struct iso2EVFinePositioningParametersType* iso2EVFinePositioningParametersType) {
+	(void)iso2EVFinePositioningParametersType; /* avoid unused warning */
+}
+
+void init_iso2AlignmentCheckReqType(struct iso2AlignmentCheckReqType* iso2AlignmentCheckReqType) {
+	iso2AlignmentCheckReqType->AlignmentCheckParameters_isUsed = 0u;
+}
+
+void init_iso2CertificateInstallationReqType(struct iso2CertificateInstallationReqType* iso2CertificateInstallationReqType) {
+	(void)iso2CertificateInstallationReqType; /* avoid unused warning */
+}
+
+void init_iso2TransformsType(struct iso2TransformsType* iso2TransformsType) {
+	iso2TransformsType->Transform.arrayLen = 0u;
+}
+
+void init_iso2ObjectType(struct iso2ObjectType* iso2ObjectType) {
+	iso2ObjectType->Id_isUsed = 0u;
+	iso2ObjectType->MimeType_isUsed = 0u;
+	iso2ObjectType->Encoding_isUsed = 0u;
+	iso2ObjectType->ANY_isUsed = 0u;
+}
+
+void init_iso2SensorOrderListType(struct iso2SensorOrderListType* iso2SensorOrderListType) {
+	iso2SensorOrderListType->SensorPosition.arrayLen = 0u;
+}
+
+void init_iso2ChargeParameterDiscoveryReqType(struct iso2ChargeParameterDiscoveryReqType* iso2ChargeParameterDiscoveryReqType) {
+	iso2ChargeParameterDiscoveryReqType->MaxSupportingPoints_isUsed = 0u;
+	iso2ChargeParameterDiscoveryReqType->EVEnergyTransferParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryReqType->AC_EVChargeParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryReqType->AC_EVBidirectionalParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryReqType->DC_EVChargeParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryReqType->DC_EVBidirectionalParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryReqType->WPT_EVChargeParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryReqType->MinimumPMaxRequest_isUsed = 0u;
+}
+
+void init_iso2ParameterType(struct iso2ParameterType* iso2ParameterType) {
+	iso2ParameterType->boolValue_isUsed = 0u;
+	iso2ParameterType->byteValue_isUsed = 0u;
+	iso2ParameterType->shortValue_isUsed = 0u;
+	iso2ParameterType->intValue_isUsed = 0u;
+	iso2ParameterType->physicalValue_isUsed = 0u;
+	iso2ParameterType->stringValue_isUsed = 0u;
+}
+
+void init_iso2SessionStopReqType(struct iso2SessionStopReqType* iso2SessionStopReqType) {
+	(void)iso2SessionStopReqType; /* avoid unused warning */
+}
+
+void init_iso2SensorMeasurementsType(struct iso2SensorMeasurementsType* iso2SensorMeasurementsType) {
+	(void)iso2SensorMeasurementsType; /* avoid unused warning */
+}
+
+void init_iso2DC_EVSEChargeParameterType(struct iso2DC_EVSEChargeParameterType* iso2DC_EVSEChargeParameterType) {
+	iso2DC_EVSEChargeParameterType->EVSECurrentRegulationTolerance_isUsed = 0u;
+	iso2DC_EVSEChargeParameterType->EVSEEnergyToBeDelivered_isUsed = 0u;
+}
+
+void init_iso2SensorPackageListType(struct iso2SensorPackageListType* iso2SensorPackageListType) {
+	iso2SensorPackageListType->SensorPackage.arrayLen = 0u;
+}
+
+void init_iso2MeasurementDataListType(struct iso2MeasurementDataListType* iso2MeasurementDataListType) {
+	iso2MeasurementDataListType->MeasurementData.arrayLen = 0u;
+}
+
+void init_iso2CertificateChainType(struct iso2CertificateChainType* iso2CertificateChainType) {
+	iso2CertificateChainType->Id_isUsed = 0u;
+	iso2CertificateChainType->SubCertificates_isUsed = 0u;
+}
+
+void init_iso2SignaturePropertyType(struct iso2SignaturePropertyType* iso2SignaturePropertyType) {
+	iso2SignaturePropertyType->Id_isUsed = 0u;
+	iso2SignaturePropertyType->ANY_isUsed = 0u;
+}
+
+void init_iso2TransformType(struct iso2TransformType* iso2TransformType) {
+	iso2TransformType->ANY_isUsed = 0u;
+	iso2TransformType->XPath.arrayLen = 0u;
+}
+
+void init_iso2EMAIDType(struct iso2EMAIDType* iso2EMAIDType) {
+	(void)iso2EMAIDType; /* avoid unused warning */
+}
+
+void init_iso2DSAKeyValueType(struct iso2DSAKeyValueType* iso2DSAKeyValueType) {
+	iso2DSAKeyValueType->P_isUsed = 0u;
+	iso2DSAKeyValueType->Q_isUsed = 0u;
+	iso2DSAKeyValueType->G_isUsed = 0u;
+	iso2DSAKeyValueType->J_isUsed = 0u;
+	iso2DSAKeyValueType->Seed_isUsed = 0u;
+	iso2DSAKeyValueType->PgenCounter_isUsed = 0u;
+}
+
+void init_iso2EntryType(struct iso2EntryType* iso2EntryType) {
+	(void)iso2EntryType; /* avoid unused warning */
+}
+
+void init_iso2MessageHeaderType(struct iso2MessageHeaderType* iso2MessageHeaderType) {
+	iso2MessageHeaderType->Signature_isUsed = 0u;
+}
+
+void init_iso2WPT_EVChargeParameterType(struct iso2WPT_EVChargeParameterType* iso2WPT_EVChargeParameterType) {
+	iso2WPT_EVChargeParameterType->EVTargetEnergyRequest_isUsed = 0u;
+	iso2WPT_EVChargeParameterType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2WPT_EVChargeParameterType->EVMinimumEnergyRequest_isUsed = 0u;
+}
+
+void init_iso2DisconnectChargingDeviceReqType(struct iso2DisconnectChargingDeviceReqType* iso2DisconnectChargingDeviceReqType) {
+	(void)iso2DisconnectChargingDeviceReqType; /* avoid unused warning */
+}
+
+void init_iso2ChargeLoopReqType(struct iso2ChargeLoopReqType* iso2ChargeLoopReqType) {
+	iso2ChargeLoopReqType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2ChargeLoopReqType->EVMinimumEnergyRequest_isUsed = 0u;
+	iso2ChargeLoopReqType->DisplayParameters_isUsed = 0u;
+}
+
+void init_iso2V2GRequestType(struct iso2V2GRequestType* iso2V2GRequestType) {
+	(void)iso2V2GRequestType; /* avoid unused warning */
+}
+
+void init_iso2MeteringReceiptResType(struct iso2MeteringReceiptResType* iso2MeteringReceiptResType) {
+	iso2MeteringReceiptResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2SessionSetupResType(struct iso2SessionSetupResType* iso2SessionSetupResType) {
+	iso2SessionSetupResType->EVSEStatus_isUsed = 0u;
+	iso2SessionSetupResType->EVSETimeStamp_isUsed = 0u;
+}
+
+void init_iso2AC_BidirectionalControlReqType(struct iso2AC_BidirectionalControlReqType* iso2AC_BidirectionalControlReqType) {
+	iso2AC_BidirectionalControlReqType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2AC_BidirectionalControlReqType->EVMinimumEnergyRequest_isUsed = 0u;
+	iso2AC_BidirectionalControlReqType->DisplayParameters_isUsed = 0u;
+	iso2AC_BidirectionalControlReqType->EVOperation_isUsed = 0u;
+	iso2AC_BidirectionalControlReqType->EVMaximumDischargePower_isUsed = 0u;
+	iso2AC_BidirectionalControlReqType->EVMaximumDischargeCurrent_isUsed = 0u;
+	iso2AC_BidirectionalControlReqType->EVMinimumDischargeCurrent_isUsed = 0u;
+}
+
+void init_iso2MV_EVSEFinePositioningParametersType(struct iso2MV_EVSEFinePositioningParametersType* iso2MV_EVSEFinePositioningParametersType) {
+	(void)iso2MV_EVSEFinePositioningParametersType; /* avoid unused warning */
+}
+
+void init_iso2ReferenceType(struct iso2ReferenceType* iso2ReferenceType) {
+	iso2ReferenceType->Id_isUsed = 0u;
+	iso2ReferenceType->URI_isUsed = 0u;
+	iso2ReferenceType->Type_isUsed = 0u;
+	iso2ReferenceType->Transforms_isUsed = 0u;
+}
+
+void init_iso2EVSEEnergyTransferParameterType(struct iso2EVSEEnergyTransferParameterType* iso2EVSEEnergyTransferParameterType) {
+	(void)iso2EVSEEnergyTransferParameterType; /* avoid unused warning */
+}
+
+void init_iso2MeteringReceiptReqType(struct iso2MeteringReceiptReqType* iso2MeteringReceiptReqType) {
+	iso2MeteringReceiptReqType->SAScheduleTupleID_isUsed = 0u;
+}
+
+void init_iso2KeyValueType(struct iso2KeyValueType* iso2KeyValueType) {
+	iso2KeyValueType->DSAKeyValue_isUsed = 0u;
+	iso2KeyValueType->RSAKeyValue_isUsed = 0u;
+	iso2KeyValueType->ANY_isUsed = 0u;
+}
+
+void init_iso2SensorListType(struct iso2SensorListType* iso2SensorListType) {
+	iso2SensorListType->Sensor.arrayLen = 0u;
+}
+
+void init_iso2CurrentDemandReqType(struct iso2CurrentDemandReqType* iso2CurrentDemandReqType) {
+	iso2CurrentDemandReqType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2CurrentDemandReqType->EVMinimumEnergyRequest_isUsed = 0u;
+	iso2CurrentDemandReqType->DisplayParameters_isUsed = 0u;
+	iso2CurrentDemandReqType->EVMaximumCurrent_isUsed = 0u;
+	iso2CurrentDemandReqType->EVMaximumPower_isUsed = 0u;
+	iso2CurrentDemandReqType->EVMaximumVoltage_isUsed = 0u;
+}
+
+void init_iso2FinePositioningSetupReqType(struct iso2FinePositioningSetupReqType* iso2FinePositioningSetupReqType) {
+	iso2FinePositioningSetupReqType->EVFinePositioningSetupParameters_isUsed = 0u;
+	iso2FinePositioningSetupReqType->LFA_EVFinePositioningSetupParameters_isUsed = 0u;
+}
+
+void init_iso2LFA_EVFinePositioningSetupParametersType(struct iso2LFA_EVFinePositioningSetupParametersType* iso2LFA_EVFinePositioningSetupParametersType) {
+	(void)iso2LFA_EVFinePositioningSetupParametersType; /* avoid unused warning */
+}
+
+void init_iso2SAScheduleTupleType(struct iso2SAScheduleTupleType* iso2SAScheduleTupleType) {
+	iso2SAScheduleTupleType->PMaxDischargeSchedule_isUsed = 0u;
+	iso2SAScheduleTupleType->SalesTariff_isUsed = 0u;
+	iso2SAScheduleTupleType->BuyBackTariff_isUsed = 0u;
+}
+
+void init_iso2WPT_EVSEChargeParameterType(struct iso2WPT_EVSEChargeParameterType* iso2WPT_EVSEChargeParameterType) {
+	(void)iso2WPT_EVSEChargeParameterType; /* avoid unused warning */
+}
+
+void init_iso2FinePositioningResType(struct iso2FinePositioningResType* iso2FinePositioningResType) {
+	iso2FinePositioningResType->EVSEStatus_isUsed = 0u;
+	iso2FinePositioningResType->EVSEFinePositioningParameters_isUsed = 0u;
+	iso2FinePositioningResType->Generic_EVSEFinePositioningParameters_isUsed = 0u;
+	iso2FinePositioningResType->LFA_EVSEFinePositioningParameters_isUsed = 0u;
+	iso2FinePositioningResType->MV_EVSEFinePositioningParameters_isUsed = 0u;
+}
+
+void init_iso2BodyBaseType(struct iso2BodyBaseType* iso2BodyBaseType) {
+	(void)iso2BodyBaseType; /* avoid unused warning */
+}
+
+void init_iso2ServiceDetailResType(struct iso2ServiceDetailResType* iso2ServiceDetailResType) {
+	iso2ServiceDetailResType->EVSEStatus_isUsed = 0u;
+	iso2ServiceDetailResType->ServiceParameterList_isUsed = 0u;
+}
+
+void init_iso2PowerDeliveryReqType(struct iso2PowerDeliveryReqType* iso2PowerDeliveryReqType) {
+	iso2PowerDeliveryReqType->EVOperation_isUsed = 0u;
+	iso2PowerDeliveryReqType->SAScheduleTupleID_isUsed = 0u;
+	iso2PowerDeliveryReqType->ChargingProfile_isUsed = 0u;
+}
+
+void init_iso2PairingResType(struct iso2PairingResType* iso2PairingResType) {
+	iso2PairingResType->EVSEStatus_isUsed = 0u;
+	iso2PairingResType->PairingParameters_isUsed = 0u;
+}
+
+void init_iso2AuthorizationReqType(struct iso2AuthorizationReqType* iso2AuthorizationReqType) {
+	iso2AuthorizationReqType->Id_isUsed = 0u;
+	iso2AuthorizationReqType->GenChallenge_isUsed = 0u;
+}
+
+void init_iso2ParameterSetType(struct iso2ParameterSetType* iso2ParameterSetType) {
+	iso2ParameterSetType->Parameter.arrayLen = 0u;
+}
+
+void init_iso2SPKIDataType(struct iso2SPKIDataType* iso2SPKIDataType) {
+	iso2SPKIDataType->SPKISexp.arrayLen = 0u;
+	iso2SPKIDataType->ANY_isUsed = 0u;
+}
+
+void init_iso2PaymentDetailsResType(struct iso2PaymentDetailsResType* iso2PaymentDetailsResType) {
+	iso2PaymentDetailsResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2SignatureMethodType(struct iso2SignatureMethodType* iso2SignatureMethodType) {
+	iso2SignatureMethodType->HMACOutputLength_isUsed = 0u;
+	iso2SignatureMethodType->ANY_isUsed = 0u;
+}
+
+void init_iso2AC_BidirectionalControlResType(struct iso2AC_BidirectionalControlResType* iso2AC_BidirectionalControlResType) {
+	iso2AC_BidirectionalControlResType->EVSEStatus_isUsed = 0u;
+	iso2AC_BidirectionalControlResType->SAScheduleTupleID_isUsed = 0u;
+	iso2AC_BidirectionalControlResType->MeterInfo_isUsed = 0u;
+	iso2AC_BidirectionalControlResType->ReceiptRequired_isUsed = 0u;
+}
+
+void init_iso2VehicleCheckOutReqType(struct iso2VehicleCheckOutReqType* iso2VehicleCheckOutReqType) {
+	(void)iso2VehicleCheckOutReqType; /* avoid unused warning */
+}
+
+void init_iso2WeldingDetectionReqType(struct iso2WeldingDetectionReqType* iso2WeldingDetectionReqType) {
+	(void)iso2WeldingDetectionReqType; /* avoid unused warning */
+}
+
+void init_iso2AlignmentCheckResType(struct iso2AlignmentCheckResType* iso2AlignmentCheckResType) {
+	iso2AlignmentCheckResType->EVSEStatus_isUsed = 0u;
+	iso2AlignmentCheckResType->AlignmentCheckParameters_isUsed = 0u;
+}
+
+void init_iso2PowerDemandReqType(struct iso2PowerDemandReqType* iso2PowerDemandReqType) {
+	iso2PowerDemandReqType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2PowerDemandReqType->EVMinimumEnergyRequest_isUsed = 0u;
+	iso2PowerDemandReqType->DisplayParameters_isUsed = 0u;
+	iso2PowerDemandReqType->PowerDemandParameters_isUsed = 0u;
+}
+
+void init_iso2MinimumPMaxRequestType(struct iso2MinimumPMaxRequestType* iso2MinimumPMaxRequestType) {
+	iso2MinimumPMaxRequestType->MinimumPMaxScheduleEntry.arrayLen = 0u;
+}
+
+void init_iso2DisconnectChargingDeviceResType(struct iso2DisconnectChargingDeviceResType* iso2DisconnectChargingDeviceResType) {
+	iso2DisconnectChargingDeviceResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2SessionSetupReqType(struct iso2SessionSetupReqType* iso2SessionSetupReqType) {
+	(void)iso2SessionSetupReqType; /* avoid unused warning */
+}
+
+void init_iso2PaymentDetailsReqType(struct iso2PaymentDetailsReqType* iso2PaymentDetailsReqType) {
+	(void)iso2PaymentDetailsReqType; /* avoid unused warning */
+}
+
+void init_iso2Generic_EVFinePositioningParametersType(struct iso2Generic_EVFinePositioningParametersType* iso2Generic_EVFinePositioningParametersType) {
+	(void)iso2Generic_EVFinePositioningParametersType; /* avoid unused warning */
+}
+
+void init_iso2ConnectChargingDeviceReqType(struct iso2ConnectChargingDeviceReqType* iso2ConnectChargingDeviceReqType) {
+	(void)iso2ConnectChargingDeviceReqType; /* avoid unused warning */
+}
+
+void init_iso2AC_EVSEChargeParameterType(struct iso2AC_EVSEChargeParameterType* iso2AC_EVSEChargeParameterType) {
+	(void)iso2AC_EVSEChargeParameterType; /* avoid unused warning */
+}
+
+void init_iso2SalesTariffEntryType(struct iso2SalesTariffEntryType* iso2SalesTariffEntryType) {
+	iso2SalesTariffEntryType->EPriceLevel_isUsed = 0u;
+	iso2SalesTariffEntryType->ConsumptionCost.arrayLen = 0u;
+}
+
+void init_iso2DC_EVSEBidirectionalParameterType(struct iso2DC_EVSEBidirectionalParameterType* iso2DC_EVSEBidirectionalParameterType) {
+	iso2DC_EVSEBidirectionalParameterType->EVSECurrentRegulationTolerance_isUsed = 0u;
+	iso2DC_EVSEBidirectionalParameterType->EVSEEnergyToBeDelivered_isUsed = 0u;
+}
+
+void init_iso2CanonicalizationMethodType(struct iso2CanonicalizationMethodType* iso2CanonicalizationMethodType) {
+	iso2CanonicalizationMethodType->ANY_isUsed = 0u;
+}
+
+void init_iso2DisplayParametersType(struct iso2DisplayParametersType* iso2DisplayParametersType) {
+	iso2DisplayParametersType->CurrentRange_isUsed = 0u;
+	iso2DisplayParametersType->CurrentSOC_isUsed = 0u;
+	iso2DisplayParametersType->TargetSOC_isUsed = 0u;
+	iso2DisplayParametersType->BulkSOC_isUsed = 0u;
+	iso2DisplayParametersType->MinimumSOC_isUsed = 0u;
+	iso2DisplayParametersType->ChargingPerformance_isUsed = 0u;
+	iso2DisplayParametersType->RemainingTimeToTargetSOC_isUsed = 0u;
+	iso2DisplayParametersType->RemainingTimeToBulkSOC_isUsed = 0u;
+	iso2DisplayParametersType->RemainingTimeToMinimumSOC_isUsed = 0u;
+	iso2DisplayParametersType->ChargingComplete_isUsed = 0u;
+	iso2DisplayParametersType->BulkChargingComplete_isUsed = 0u;
+	iso2DisplayParametersType->InletHot_isUsed = 0u;
+}
+
+void init_iso2DC_EVBidirectionalParameterType(struct iso2DC_EVBidirectionalParameterType* iso2DC_EVBidirectionalParameterType) {
+	iso2DC_EVBidirectionalParameterType->EVMaximumChargePower_isUsed = 0u;
+	iso2DC_EVBidirectionalParameterType->EVMinimumChargePower_isUsed = 0u;
+	iso2DC_EVBidirectionalParameterType->EVTargetEnergyRequest_isUsed = 0u;
+	iso2DC_EVBidirectionalParameterType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2DC_EVBidirectionalParameterType->EVMinimumEnergyRequest_isUsed = 0u;
+	iso2DC_EVBidirectionalParameterType->CurrentSOC_isUsed = 0u;
+	iso2DC_EVBidirectionalParameterType->TargetSOC_isUsed = 0u;
+	iso2DC_EVBidirectionalParameterType->BulkSOC_isUsed = 0u;
+	iso2DC_EVBidirectionalParameterType->EVMaximumDischargePower_isUsed = 0u;
+	iso2DC_EVBidirectionalParameterType->EVMinimumDischargePower_isUsed = 0u;
+	iso2DC_EVBidirectionalParameterType->MinimumSOC_isUsed = 0u;
+}
+
+void init_iso2PaymentServiceSelectionReqType(struct iso2PaymentServiceSelectionReqType* iso2PaymentServiceSelectionReqType) {
+	iso2PaymentServiceSelectionReqType->SelectedVASList_isUsed = 0u;
+}
+
+void init_iso2MagneticVectorType(struct iso2MagneticVectorType* iso2MagneticVectorType) {
+	(void)iso2MagneticVectorType; /* avoid unused warning */
+}
+
+void init_iso2PhysicalValueType(struct iso2PhysicalValueType* iso2PhysicalValueType) {
+	(void)iso2PhysicalValueType; /* avoid unused warning */
+}
+
+void init_iso2SystemStatusReqType(struct iso2SystemStatusReqType* iso2SystemStatusReqType) {
+	(void)iso2SystemStatusReqType; /* avoid unused warning */
+}
+
+void init_iso2SystemStatusResType(struct iso2SystemStatusResType* iso2SystemStatusResType) {
+	iso2SystemStatusResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2EVSEFinePositioningSetupParametersType(struct iso2EVSEFinePositioningSetupParametersType* iso2EVSEFinePositioningSetupParametersType) {
+	(void)iso2EVSEFinePositioningSetupParametersType; /* avoid unused warning */
+}
+
+void init_iso2V2GResponseType(struct iso2V2GResponseType* iso2V2GResponseType) {
+	iso2V2GResponseType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2BodyType(struct iso2BodyType* iso2BodyType) {
+	iso2BodyType->BodyElement_isUsed = 0u;
+	iso2BodyType->V2GRequest_isUsed = 0u;
+	iso2BodyType->DisconnectChargingDeviceReq_isUsed = 0u;
+	iso2BodyType->ConnectChargingDeviceReq_isUsed = 0u;
+	iso2BodyType->SystemStatusReq_isUsed = 0u;
+	iso2BodyType->DC_BidirectionalControlReq_isUsed = 0u;
+	iso2BodyType->AC_BidirectionalControlReq_isUsed = 0u;
+	iso2BodyType->VehicleCheckOutReq_isUsed = 0u;
+	iso2BodyType->VehicleCheckInReq_isUsed = 0u;
+	iso2BodyType->PowerDemandReq_isUsed = 0u;
+	iso2BodyType->PairingReq_isUsed = 0u;
+	iso2BodyType->AlignmentCheckReq_isUsed = 0u;
+	iso2BodyType->FinePositioningReq_isUsed = 0u;
+	iso2BodyType->FinePositioningSetupReq_isUsed = 0u;
+	iso2BodyType->WeldingDetectionReq_isUsed = 0u;
+	iso2BodyType->CurrentDemandReq_isUsed = 0u;
+	iso2BodyType->PreChargeReq_isUsed = 0u;
+	iso2BodyType->CableCheckReq_isUsed = 0u;
+	iso2BodyType->ChargingStatusReq_isUsed = 0u;
+	iso2BodyType->CertificateInstallationReq_isUsed = 0u;
+	iso2BodyType->CertificateUpdateReq_isUsed = 0u;
+	iso2BodyType->SessionStopReq_isUsed = 0u;
+	iso2BodyType->MeteringReceiptReq_isUsed = 0u;
+	iso2BodyType->PowerDeliveryReq_isUsed = 0u;
+	iso2BodyType->ChargeParameterDiscoveryReq_isUsed = 0u;
+	iso2BodyType->AuthorizationReq_isUsed = 0u;
+	iso2BodyType->PaymentDetailsReq_isUsed = 0u;
+	iso2BodyType->PaymentServiceSelectionReq_isUsed = 0u;
+	iso2BodyType->ServiceDetailReq_isUsed = 0u;
+	iso2BodyType->ServiceDiscoveryReq_isUsed = 0u;
+	iso2BodyType->SessionSetupReq_isUsed = 0u;
+	iso2BodyType->V2GResponse_isUsed = 0u;
+	iso2BodyType->DisconnectChargingDeviceRes_isUsed = 0u;
+	iso2BodyType->ConnectChargingDeviceRes_isUsed = 0u;
+	iso2BodyType->SystemStatusRes_isUsed = 0u;
+	iso2BodyType->DC_BidirectionalControlRes_isUsed = 0u;
+	iso2BodyType->AC_BidirectionalControlRes_isUsed = 0u;
+	iso2BodyType->VehicleCheckOutRes_isUsed = 0u;
+	iso2BodyType->VehicleCheckInRes_isUsed = 0u;
+	iso2BodyType->PowerDemandRes_isUsed = 0u;
+	iso2BodyType->PairingRes_isUsed = 0u;
+	iso2BodyType->AlignmentCheckRes_isUsed = 0u;
+	iso2BodyType->FinePositioningRes_isUsed = 0u;
+	iso2BodyType->FinePositioningSetupRes_isUsed = 0u;
+	iso2BodyType->WeldingDetectionRes_isUsed = 0u;
+	iso2BodyType->CurrentDemandRes_isUsed = 0u;
+	iso2BodyType->PreChargeRes_isUsed = 0u;
+	iso2BodyType->CableCheckRes_isUsed = 0u;
+	iso2BodyType->ChargingStatusRes_isUsed = 0u;
+	iso2BodyType->CertificateInstallationRes_isUsed = 0u;
+	iso2BodyType->CertificateUpdateRes_isUsed = 0u;
+	iso2BodyType->SessionStopRes_isUsed = 0u;
+	iso2BodyType->MeteringReceiptRes_isUsed = 0u;
+	iso2BodyType->PowerDeliveryRes_isUsed = 0u;
+	iso2BodyType->ChargeParameterDiscoveryRes_isUsed = 0u;
+	iso2BodyType->AuthorizationRes_isUsed = 0u;
+	iso2BodyType->PaymentDetailsRes_isUsed = 0u;
+	iso2BodyType->PaymentServiceSelectionRes_isUsed = 0u;
+	iso2BodyType->ServiceDetailRes_isUsed = 0u;
+	iso2BodyType->ServiceDiscoveryRes_isUsed = 0u;
+	iso2BodyType->SessionSetupRes_isUsed = 0u;
+}
+
+void init_iso2PreChargeResType(struct iso2PreChargeResType* iso2PreChargeResType) {
+	iso2PreChargeResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2EVSEFinePositioningParametersType(struct iso2EVSEFinePositioningParametersType* iso2EVSEFinePositioningParametersType) {
+	(void)iso2EVSEFinePositioningParametersType; /* avoid unused warning */
+}
+
+void init_iso2PaymentServiceSelectionResType(struct iso2PaymentServiceSelectionResType* iso2PaymentServiceSelectionResType) {
+	iso2PaymentServiceSelectionResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2DigestMethodType(struct iso2DigestMethodType* iso2DigestMethodType) {
+	iso2DigestMethodType->ANY_isUsed = 0u;
+}
+
+void init_iso2TargetPositionType(struct iso2TargetPositionType* iso2TargetPositionType) {
+	(void)iso2TargetPositionType; /* avoid unused warning */
+}
+
+void init_iso2LFA_EVFinePositioningParametersType(struct iso2LFA_EVFinePositioningParametersType* iso2LFA_EVFinePositioningParametersType) {
+	(void)iso2LFA_EVFinePositioningParametersType; /* avoid unused warning */
+}
+
+void init_iso2DC_EVChargeParameterType(struct iso2DC_EVChargeParameterType* iso2DC_EVChargeParameterType) {
+	iso2DC_EVChargeParameterType->EVMaximumChargePower_isUsed = 0u;
+	iso2DC_EVChargeParameterType->EVMinimumChargePower_isUsed = 0u;
+	iso2DC_EVChargeParameterType->EVTargetEnergyRequest_isUsed = 0u;
+	iso2DC_EVChargeParameterType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2DC_EVChargeParameterType->EVMinimumEnergyRequest_isUsed = 0u;
+	iso2DC_EVChargeParameterType->CurrentSOC_isUsed = 0u;
+	iso2DC_EVChargeParameterType->TargetSOC_isUsed = 0u;
+	iso2DC_EVChargeParameterType->BulkSOC_isUsed = 0u;
+}
+
+void init_iso2ServiceDetailReqType(struct iso2ServiceDetailReqType* iso2ServiceDetailReqType) {
+	(void)iso2ServiceDetailReqType; /* avoid unused warning */
+}
+
+void init_iso2PreChargeReqType(struct iso2PreChargeReqType* iso2PreChargeReqType) {
+	(void)iso2PreChargeReqType; /* avoid unused warning */
+}
+
+void init_iso2ManifestType(struct iso2ManifestType* iso2ManifestType) {
+	iso2ManifestType->Id_isUsed = 0u;
+	iso2ManifestType->Reference.arrayLen = 0u;
+}
+
+void init_iso2AnonType_V2G_Message(struct iso2AnonType_V2G_Message* iso2AnonType_V2G_Message) {
+	(void)iso2AnonType_V2G_Message; /* avoid unused warning */
+}
+
+void init_iso2SelectedServiceListType(struct iso2SelectedServiceListType* iso2SelectedServiceListType) {
+	iso2SelectedServiceListType->SelectedService.arrayLen = 0u;
+}
+
+void init_iso2Generic_EVSEFinePositioningParametersType(struct iso2Generic_EVSEFinePositioningParametersType* iso2Generic_EVSEFinePositioningParametersType) {
+	(void)iso2Generic_EVSEFinePositioningParametersType; /* avoid unused warning */
+}
+
+void init_iso2CartesianCoordinatesType(struct iso2CartesianCoordinatesType* iso2CartesianCoordinatesType) {
+	(void)iso2CartesianCoordinatesType; /* avoid unused warning */
+}
+
+void init_iso2KeyInfoType(struct iso2KeyInfoType* iso2KeyInfoType) {
+	iso2KeyInfoType->Id_isUsed = 0u;
+	iso2KeyInfoType->KeyName.arrayLen = 0u;
+	iso2KeyInfoType->KeyValue.arrayLen = 0u;
+	iso2KeyInfoType->RetrievalMethod.arrayLen = 0u;
+	iso2KeyInfoType->X509Data.arrayLen = 0u;
+	iso2KeyInfoType->PGPData.arrayLen = 0u;
+	iso2KeyInfoType->SPKIData.arrayLen = 0u;
+	iso2KeyInfoType->MgmtData.arrayLen = 0u;
+	iso2KeyInfoType->ANY_isUsed = 0u;
+}
+
+void init_iso2SubCertificatesType(struct iso2SubCertificatesType* iso2SubCertificatesType) {
+	iso2SubCertificatesType->Certificate.arrayLen = 0u;
+}
+
+void init_iso2ListOfRootCertificateIDsType(struct iso2ListOfRootCertificateIDsType* iso2ListOfRootCertificateIDsType) {
+	iso2ListOfRootCertificateIDsType->RootCertificateID.arrayLen = 0u;
+}
+
+void init_iso2EVEnergyTransferParameterType(struct iso2EVEnergyTransferParameterType* iso2EVEnergyTransferParameterType) {
+	(void)iso2EVEnergyTransferParameterType; /* avoid unused warning */
+}
+
+void init_iso2ContractSignatureEncryptedPrivateKeyType(struct iso2ContractSignatureEncryptedPrivateKeyType* iso2ContractSignatureEncryptedPrivateKeyType) {
+	(void)iso2ContractSignatureEncryptedPrivateKeyType; /* avoid unused warning */
+}
+
+void init_iso2MagneticVectorSetupListType(struct iso2MagneticVectorSetupListType* iso2MagneticVectorSetupListType) {
+	iso2MagneticVectorSetupListType->MagneticVectorSetup.arrayLen = 0u;
+}
+
+void init_iso2PairingReqType(struct iso2PairingReqType* iso2PairingReqType) {
+	iso2PairingReqType->PairingParameters_isUsed = 0u;
+}
+
+void init_iso2CurrentDemandResType(struct iso2CurrentDemandResType* iso2CurrentDemandResType) {
+	iso2CurrentDemandResType->EVSEStatus_isUsed = 0u;
+	iso2CurrentDemandResType->EVSEMaximumPower_isUsed = 0u;
+	iso2CurrentDemandResType->EVSEMaximumCurrent_isUsed = 0u;
+	iso2CurrentDemandResType->EVSEMaximumVoltage_isUsed = 0u;
+	iso2CurrentDemandResType->SAScheduleTupleID_isUsed = 0u;
+	iso2CurrentDemandResType->MeterInfo_isUsed = 0u;
+	iso2CurrentDemandResType->ReceiptRequired_isUsed = 0u;
+}
+
+void init_iso2X509IssuerSerialType(struct iso2X509IssuerSerialType* iso2X509IssuerSerialType) {
+	(void)iso2X509IssuerSerialType; /* avoid unused warning */
+}
+
+void init_iso2ChargingStatusReqType(struct iso2ChargingStatusReqType* iso2ChargingStatusReqType) {
+	iso2ChargingStatusReqType->EVMaximumEnergyRequest_isUsed = 0u;
+	iso2ChargingStatusReqType->EVMinimumEnergyRequest_isUsed = 0u;
+	iso2ChargingStatusReqType->DisplayParameters_isUsed = 0u;
+	iso2ChargingStatusReqType->EVMaximumChargePower_isUsed = 0u;
+	iso2ChargingStatusReqType->EVMaximumChargeCurrent_isUsed = 0u;
+	iso2ChargingStatusReqType->EVMinimumChargeCurrent_isUsed = 0u;
+}
+
+void init_iso2CertificateInstallationResType(struct iso2CertificateInstallationResType* iso2CertificateInstallationResType) {
+	iso2CertificateInstallationResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2SensorPackageType(struct iso2SensorPackageType* iso2SensorPackageType) {
+	iso2SensorPackageType->SensorMeasurements.arrayLen = 0u;
+}
+
+void init_iso2PGPDataType(struct iso2PGPDataType* iso2PGPDataType) {
+	iso2PGPDataType->PGPKeyID_isUsed = 0u;
+	iso2PGPDataType->PGPKeyPacket_isUsed = 0u;
+	iso2PGPDataType->ANY_isUsed = 0u;
+}
+
+void init_iso2ServiceDiscoveryResType(struct iso2ServiceDiscoveryResType* iso2ServiceDiscoveryResType) {
+	iso2ServiceDiscoveryResType->EVSEStatus_isUsed = 0u;
+	iso2ServiceDiscoveryResType->VASList_isUsed = 0u;
+}
+
+void init_iso2ServiceIDListType(struct iso2ServiceIDListType* iso2ServiceIDListType) {
+	iso2ServiceIDListType->ServiceID.arrayLen = 0u;
+}
+
+void init_iso2EVFinePositioningSetupParametersType(struct iso2EVFinePositioningSetupParametersType* iso2EVFinePositioningSetupParametersType) {
+	(void)iso2EVFinePositioningSetupParametersType; /* avoid unused warning */
+}
+
+void init_iso2ChargeParameterDiscoveryResType(struct iso2ChargeParameterDiscoveryResType* iso2ChargeParameterDiscoveryResType) {
+	iso2ChargeParameterDiscoveryResType->EVSEStatus_isUsed = 0u;
+	iso2ChargeParameterDiscoveryResType->SAScheduleList_isUsed = 0u;
+	iso2ChargeParameterDiscoveryResType->EVSEEnergyTransferParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryResType->AC_EVSEChargeParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryResType->AC_EVSEBidirectionalParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryResType->DC_EVSEChargeParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryResType->DC_EVSEBidirectionalParameter_isUsed = 0u;
+	iso2ChargeParameterDiscoveryResType->WPT_EVSEChargeParameter_isUsed = 0u;
+}
+
+void init_iso2PowerDemandResType(struct iso2PowerDemandResType* iso2PowerDemandResType) {
+	iso2PowerDemandResType->EVSEStatus_isUsed = 0u;
+	iso2PowerDemandResType->SAScheduleTupleID_isUsed = 0u;
+	iso2PowerDemandResType->MeterInfo_isUsed = 0u;
+	iso2PowerDemandResType->ReceiptRequired_isUsed = 0u;
+	iso2PowerDemandResType->PowerDemandParameters_isUsed = 0u;
+}
+
+void init_iso2ChargingProfileType(struct iso2ChargingProfileType* iso2ChargingProfileType) {
+	iso2ChargingProfileType->ProfileEntry.arrayLen = 0u;
+}
+
+void init_iso2FinePositioningReqType(struct iso2FinePositioningReqType* iso2FinePositioningReqType) {
+	iso2FinePositioningReqType->EVFinePositioningParameters_isUsed = 0u;
+	iso2FinePositioningReqType->Generic_EVFinePositioningParameters_isUsed = 0u;
+	iso2FinePositioningReqType->LFA_EVFinePositioningParameters_isUsed = 0u;
+}
+
+void init_iso2SalesTariffType(struct iso2SalesTariffType* iso2SalesTariffType) {
+	iso2SalesTariffType->SalesTariffDescription_isUsed = 0u;
+	iso2SalesTariffType->NumEPriceLevels_isUsed = 0u;
+	iso2SalesTariffType->SalesTariffEntry.arrayLen = 0u;
+}
+
+void init_iso2SensorType(struct iso2SensorType* iso2SensorType) {
+	(void)iso2SensorType; /* avoid unused warning */
+}
+
+void init_iso2SignatureValueType(struct iso2SignatureValueType* iso2SignatureValueType) {
+	iso2SignatureValueType->Id_isUsed = 0u;
+}
+
+void init_iso2SignedInfoType(struct iso2SignedInfoType* iso2SignedInfoType) {
+	iso2SignedInfoType->Id_isUsed = 0u;
+	iso2SignedInfoType->Reference.arrayLen = 0u;
+}
+
+void init_iso2PowerDeliveryResType(struct iso2PowerDeliveryResType* iso2PowerDeliveryResType) {
+	iso2PowerDeliveryResType->EVSEStatus_isUsed = 0u;
+}
+
+void init_iso2CableCheckReqType(struct iso2CableCheckReqType* iso2CableCheckReqType) {
+	(void)iso2CableCheckReqType; /* avoid unused warning */
+}
+
+void init_iso2SelectedServiceType(struct iso2SelectedServiceType* iso2SelectedServiceType) {
+	(void)iso2SelectedServiceType; /* avoid unused warning */
+}
+
+void init_iso2DiffieHellmanPublickeyType(struct iso2DiffieHellmanPublickeyType* iso2DiffieHellmanPublickeyType) {
+	(void)iso2DiffieHellmanPublickeyType; /* avoid unused warning */
+}
+
+void init_iso2EVSEStatusType(struct iso2EVSEStatusType* iso2EVSEStatusType) {
+	(void)iso2EVSEStatusType; /* avoid unused warning */
+}
+
+
+
+#endif /* DEPLOY_ISO2_CODEC */
+
+#endif
+

+ 4189 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypes.h

@@ -0,0 +1,4189 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypes.h
+ * \brief 	Datatype definitions and structs for given XML Schema definitions and initialization methods
+ *
+ */
+
+#ifndef EXI_iso2_DATATYPES_H
+#define EXI_iso2_DATATYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SUPPORT_YES 1
+#define SUPPORT_NO 2
+#define DEPLOY_ISO2_CODEC SUPPORT_YES
+#define DEPLOY_ISO2_CODEC_FRAGMENT SUPPORT_NO
+
+#if DEPLOY_ISO2_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+
+
+/* Datatype definitions and structs for given XML Schema definitions */
+
+#define UNION_YES 1
+#define UNION_NO 2
+#define SAVE_MEMORY_WITH_UNNAMED_UNION UNION_YES
+
+/* Note: Please find below a list of occurrence limits that have been applied */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":SensorPosition from 255 to 5 (see #define iso2SensorOrderListType_SensorPosition_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":MeasurementData from 255 to 5 (see #define iso2MeasurementDataListType_MeasurementData_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":XPath from unbounded to 1 (see #define iso2TransformType_XPath_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":SPKISexp from unbounded to 1 (see #define iso2SPKIDataType_SPKISexp_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorSetup from 255 to 5 (see #define iso2MagneticVectorSetupListType_MagneticVectorSetup_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509IssuerSerial from unbounded to 1 (see #define iso2X509DataType_X509IssuerSerial_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509SKI from unbounded to 1 (see #define iso2X509DataType_X509SKI_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509SubjectName from unbounded to 1 (see #define iso2X509DataType_X509SubjectName_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509Certificate from unbounded to 1 (see #define iso2X509DataType_X509Certificate_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509CRL from unbounded to 1 (see #define iso2X509DataType_X509CRL_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":SignatureProperty from unbounded to 1 (see #define iso2SignaturePropertiesType_SignatureProperty_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Transform from unbounded to 1 (see #define iso2TransformsType_Transform_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":Sensor from 255 to 5 (see #define iso2SensorListType_Sensor_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Reference from unbounded to 1 (see #define iso2ManifestType_Reference_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":SensorMeasurements from 255 to 5 (see #define iso2SensorPackageType_SensorMeasurements_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":ProfileEntry from unbounded to 24 (see #define iso2ChargingProfileType_ProfileEntry_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":SalesTariffEntry from unbounded to 5 (see #define iso2SalesTariffType_SalesTariffEntry_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Reference from unbounded to 1 (see #define iso2SignedInfoType_Reference_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":MagneticVector from 255 to 5 (see #define iso2MagneticVectorListType_MagneticVector_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":ParameterSet from 255 to 5 (see #define iso2ServiceParameterListType_ParameterSet_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":PMaxScheduleEntry from unbounded to 5 (see #define iso2PMaxScheduleType_PMaxScheduleEntry_ARRAY_SIZE) */
+/* Limit occurrence of element "urn:iso:15118:2:2016:MsgDataTypes":SensorPackage from 255 to 5 (see #define iso2SensorPackageListType_SensorPackage_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":KeyName from unbounded to 1 (see #define iso2KeyInfoType_KeyName_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":KeyValue from unbounded to 1 (see #define iso2KeyInfoType_KeyValue_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":RetrievalMethod from unbounded to 1 (see #define iso2KeyInfoType_RetrievalMethod_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":X509Data from unbounded to 1 (see #define iso2KeyInfoType_X509Data_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":PGPData from unbounded to 1 (see #define iso2KeyInfoType_PGPData_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":SPKIData from unbounded to 1 (see #define iso2KeyInfoType_SPKIData_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":MgmtData from unbounded to 1 (see #define iso2KeyInfoType_MgmtData_ARRAY_SIZE) */
+/* Limit occurrence of element "http://www.w3.org/2000/09/xmldsig#":Object from unbounded to 1 (see #define iso2SignatureType_Object_ARRAY_SIZE) */
+
+
+/* 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
+struct iso2RSAKeyValueType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Modulus, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso2RSAKeyValueType_Modulus_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Modulus ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Exponent, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso2RSAKeyValueType_Exponent_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Exponent ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeterID,"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingCharged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingDischarged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+#define iso2MeterInfoType_MeterID_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,meterIDType is 32 */
+#define iso2MeterInfoType_SigMeterReading_BYTES_SIZE 64 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,sigMeterReadingType is 64 */
+struct iso2MeterInfoType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MeterID, urn:iso:15118:2:2016:MsgDataTypes,meterIDType */
+	struct {
+		exi_string_character_t characters[iso2MeterInfoType_MeterID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MeterID ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MeterReadingCharged, http://www.w3.org/2001/XMLSchema,unsignedLong */
+	uint64_t MeterReadingCharged ;
+	unsigned int MeterReadingCharged_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MeterReadingDischarged, http://www.w3.org/2001/XMLSchema,unsignedLong */
+	uint64_t MeterReadingDischarged ;
+	unsigned int MeterReadingDischarged_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SigMeterReading, urn:iso:15118:2:2016:MsgDataTypes,sigMeterReadingType */
+	struct {
+		uint8_t bytes[iso2MeterInfoType_SigMeterReading_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SigMeterReading ;
+	unsigned int SigMeterReading_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MeterStatus, urn:iso:15118:2:2016:MsgDataTypes,meterStatusType */
+	int16_t MeterStatus ;
+	unsigned int MeterStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":TMeter, http://www.w3.org/2001/XMLSchema,long */
+	int64_t TMeter ;
+	unsigned int TMeter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ServiceID,"urn:iso:15118:2:2016:MsgDataTypes":FreeService)',  derivedBy='RESTRICTION'.  */
+struct iso2ServiceType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ServiceID, urn:iso:15118:2:2016:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":FreeService, http://www.w3.org/2001/XMLSchema,boolean */
+	int FreeService ;
+};
+
+typedef enum {
+	iso2vehicleSpaceType_AutoParking = 0,
+	iso2vehicleSpaceType_MVGuideManual = 1,
+	iso2vehicleSpaceType_Manual = 2
+} iso2vehicleSpaceType;
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Service{1-8})',  derivedBy='RESTRICTION'.  */
+#define iso2ServiceListType_Service_ARRAY_SIZE 8
+struct iso2ServiceListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Service, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ServiceID,"urn:iso:15118:2:2016:MsgDataTypes":FreeService)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso2ServiceType array[iso2ServiceListType_Service_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Service;
+};
+
+typedef enum {
+	iso2operationModeType_Ready = 0,
+	iso2operationModeType_NotReady = 1
+} 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
+struct iso2MagneticVectorSetupType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":GAID, http://www.w3.org/2001/XMLSchema,ID */
+	struct {
+		exi_string_character_t characters[iso2MagneticVectorSetupType_GAID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  GAID ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":FrequencyChannel, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t FrequencyChannel ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,RelativeTimeIntervalType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":start,"urn:iso:15118:2:2016:MsgDataTypes":duration{0-1})',  derivedBy='RESTRICTION'.  */
+struct iso2RelativeTimeIntervalType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":start, urn:iso:15118:2:2016:MsgDataTypes,#AnonType_startRelativeTimeIntervalType */
+	uint32_t start ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":duration, urn:iso:15118:2:2016:MsgDataTypes,#AnonType_durationRelativeTimeIntervalType */
+	uint32_t duration ;
+	unsigned int duration_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVFinePositioningParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso2EVFinePositioningParametersType {
+	int noContent; /* avoid warning */
+};
+
+/* 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
+struct iso2ObjectType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2ObjectType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* attribute: MimeType {http://www.w3.org/2001/XMLSchema,string} */
+	struct {
+		exi_string_character_t characters[iso2ObjectType_MimeType_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MimeType ;
+	unsigned int MimeType_isUsed:1;
+	/* attribute: Encoding {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso2ObjectType_Encoding_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Encoding ;
+	unsigned int Encoding_isUsed:1;
+	/* element: WC[##any] */
+	struct {
+		exi_string_character_t characters[iso2ObjectType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorOrderListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorPosition{1-255})',  derivedBy='RESTRICTION'.  */
+#define iso2SensorOrderListType_SensorPosition_ARRAY_SIZE 5
+struct iso2SensorOrderListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorPosition, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	struct {
+		uint8_t array[iso2SensorOrderListType_SensorPosition_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SensorPosition;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeasurementDataListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeasurementData{1-255})',  derivedBy='RESTRICTION'.  */
+#define iso2MeasurementDataListType_MeasurementData_ARRAY_SIZE 5
+struct iso2MeasurementDataListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MeasurementData, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	struct {
+		uint16_t array[iso2MeasurementDataListType_MeasurementData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} MeasurementData;
+};
+
+/* 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
+struct iso2SignaturePropertyType {
+	/* attribute: Target {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso2SignaturePropertyType_Target_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Target ;
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2SignaturePropertyType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso2SignaturePropertyType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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_XPath_ARRAY_SIZE 1
+struct iso2TransformType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso2TransformType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso2TransformType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":XPath, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[iso2TransformType_XPath_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[iso2TransformType_XPath_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} XPath;
+};
+
+typedef enum {
+	iso2EVSENotificationType_StopCharging = 0,
+	iso2EVSENotificationType_ReNegotiation = 1
+} 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
+struct iso2EMAIDType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2EMAIDType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* simple content: urn:iso:15118:2:2016:MsgDataTypes,eMAIDType */
+	struct {
+		exi_string_character_t characters[iso2EMAIDType_CONTENT_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  CONTENT ;
+};
+
+/* 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
+struct iso2DSAKeyValueType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":P, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso2DSAKeyValueType_P_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  P ;
+	unsigned int P_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Q, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso2DSAKeyValueType_Q_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Q ;
+	unsigned int Q_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":G, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso2DSAKeyValueType_G_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  G ;
+	unsigned int G_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Y, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso2DSAKeyValueType_Y_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Y ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":J, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso2DSAKeyValueType_J_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  J ;
+	unsigned int J_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Seed, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso2DSAKeyValueType_Seed_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Seed ;
+	unsigned int Seed_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PgenCounter, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[iso2DSAKeyValueType_PgenCounter_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PgenCounter ;
+	unsigned int PgenCounter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EntryType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval)',  derivedBy='RESTRICTION'.  */
+struct iso2EntryType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,RelativeTimeIntervalType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":start,"urn:iso:15118:2:2016:MsgDataTypes":duration{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2RelativeTimeIntervalType RelativeTimeInterval ;
+};
+
+typedef enum {
+	iso2valueType_bool = 0,
+	iso2valueType_byte = 1,
+	iso2valueType_short = 2,
+	iso2valueType_int = 3,
+	iso2valueType_physicalValue = 4,
+	iso2valueType_string = 5
+} iso2valueType;
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,V2GRequestType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso2V2GRequestType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEEnergyTransferParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso2EVSEEnergyTransferParameterType {
+	int noContent; /* avoid warning */
+};
+
+/* 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_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} */
+	struct {
+		exi_string_character_t characters[iso2MeteringReceiptReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SessionID, urn:iso:15118:2:2016:MsgDataTypes,sessionIDType */
+	struct {
+		uint8_t bytes[iso2MeteringReceiptReqType_SessionID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SessionID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2016:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeterID,"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingCharged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingDischarged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2MeterInfoType MeterInfo ;
+};
+
+/* 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
+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 ;
+	unsigned int DSAKeyValue_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":RSAKeyValue, 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'.  */
+	struct iso2RSAKeyValueType RSAKeyValue ;
+	unsigned int RSAKeyValue_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso2KeyValueType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+typedef enum {
+	iso2EVCheckInStatusType_CheckIn = 0,
+	iso2EVCheckInStatusType_Processing = 1,
+	iso2EVCheckInStatusType_Completed = 2
+} iso2EVCheckInStatusType;
+
+typedef enum {
+	iso2mechanicalChargingDeviceStatusType_Home = 0,
+	iso2mechanicalChargingDeviceStatusType_Moving = 1,
+	iso2mechanicalChargingDeviceStatusType_EndPosition = 2
+} iso2mechanicalChargingDeviceStatusType;
+
+/* 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 {
+	int noContent; /* avoid warning */
+};
+
+/* 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_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} */
+	struct {
+		exi_string_character_t characters[iso2AuthorizationReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":GenChallenge, urn:iso:15118:2:2016:MsgDataTypes,genChallengeType */
+	struct {
+		uint8_t bytes[iso2AuthorizationReqType_GenChallenge_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  GenChallenge ;
+	unsigned int GenChallenge_isUsed:1;
+};
+
+/* 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_ARRAY_SIZE 1
+#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 {
+		struct {
+			uint8_t bytes[iso2SPKIDataType_SPKISexp_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[iso2SPKIDataType_SPKISexp_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SPKISexp;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso2SPKIDataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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
+struct iso2SignatureMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso2SignatureMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":HMACOutputLength, http://www.w3.org/2000/09/xmldsig#,HMACOutputLengthType */
+	int64_t HMACOutputLength ;
+	unsigned int HMACOutputLength_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso2SignatureMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,WeldingDetectionReqType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+struct iso2WeldingDetectionReqType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,SessionSetupReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVCCID)',  derivedBy='EXTENSION'.  */
+#define iso2SessionSetupReqType_EVCCID_BYTES_SIZE 6 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,evccIDType is 6 */
+struct iso2SessionSetupReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVCCID, urn:iso:15118:2:2016:MsgDataTypes,evccIDType */
+	struct {
+		uint8_t bytes[iso2SessionSetupReqType_EVCCID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  EVCCID ;
+};
+
+typedef enum {
+	iso2chargeProgressType_Start = 0,
+	iso2chargeProgressType_Stop = 1,
+	iso2chargeProgressType_Renegotiate = 2
+} 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
+struct iso2CanonicalizationMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso2CanonicalizationMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##any] */
+	struct {
+		exi_string_character_t characters[iso2CanonicalizationMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+struct iso2PhysicalValueType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Exponent, urn:iso:15118:2:2016:MsgDataTypes,exponentType */
+	int8_t Exponent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Value, http://www.w3.org/2001/XMLSchema,short */
+	int16_t Value ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,SystemStatusReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":OperationMode,"urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus)',  derivedBy='EXTENSION'.  */
+struct iso2SystemStatusReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":OperationMode, urn:iso:15118:2:2016:MsgDataTypes,operationModeType */
+	iso2operationModeType OperationMode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus, urn:iso:15118:2:2016:MsgDataTypes,mechanicalChargingDeviceStatusType */
+	iso2mechanicalChargingDeviceStatusType EVMechanicalChargingDeviceStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEFinePositioningSetupParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso2EVSEFinePositioningSetupParametersType {
+	int noContent; /* avoid warning */
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEFinePositioningParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+struct iso2EVSEFinePositioningParametersType {
+	int noContent; /* avoid warning */
+};
+
+typedef enum {
+	iso2FODStatusType_ObjectOnPad = 0,
+	iso2FODStatusType_PadClear = 1,
+	iso2FODStatusType_UnknownError = 2
+} iso2FODStatusType;
+
+typedef enum {
+	iso2costKindType_relativePricePercentage = 0,
+	iso2costKindType_RenewableGenerationPercentage = 1,
+	iso2costKindType_CarbonDioxideEmission = 2
+} 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
+struct iso2DigestMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso2DigestMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso2DigestMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,TargetPositionType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":TargetOffsetX,"urn:iso:15118:2:2016:MsgDataTypes":TargetOffsetY)',  derivedBy='RESTRICTION'.  */
+struct iso2TargetPositionType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":TargetOffsetX, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t TargetOffsetX ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":TargetOffsetY, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t TargetOffsetY ;
+};
+
+typedef enum {
+	iso2EVOperationType_Charge = 0,
+	iso2EVOperationType_BPT = 1
+} iso2EVOperationType;
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVChargeParameterType',  base type name='EVEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2DC_EVChargeParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":DepartureTime, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t DepartureTime ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargePower ;
+	unsigned int EVMaximumChargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumChargePower ;
+	unsigned int EVMinimumChargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	unsigned int EVTargetEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t CurrentSOC ;
+	unsigned int CurrentSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":TargetSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t TargetSOC ;
+	unsigned int TargetSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":BulkSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t BulkSOC ;
+	unsigned int BulkSOC_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDetailReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ServiceID)',  derivedBy='EXTENSION'.  */
+struct iso2ServiceDetailReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ServiceID, urn:iso:15118:2:2016:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PreChargeReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2016:MsgBody":EVTargetCurrent)',  derivedBy='EXTENSION'.  */
+struct iso2PreChargeReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetCurrent ;
+};
+
+typedef enum {
+	iso2serviceCategoryType_EVCharging = 0,
+	iso2serviceCategoryType_Internet = 1,
+	iso2serviceCategoryType_ContractCertificate = 2,
+	iso2serviceCategoryType_OtherCustom = 3
+} iso2serviceCategoryType;
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,CartesianCoordinatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":XCoordinate,"urn:iso:15118:2:2016:MsgDataTypes":YCoordinate,"urn:iso:15118:2:2016:MsgDataTypes":ZCoordinate)',  derivedBy='RESTRICTION'.  */
+struct iso2CartesianCoordinatesType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":XCoordinate, http://www.w3.org/2001/XMLSchema,short */
+	int16_t XCoordinate ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":YCoordinate, http://www.w3.org/2001/XMLSchema,short */
+	int16_t YCoordinate ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ZCoordinate, http://www.w3.org/2001/XMLSchema,short */
+	int16_t ZCoordinate ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SubCertificatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Certificate{1-4})',  derivedBy='RESTRICTION'.  */
+#define iso2SubCertificatesType_Certificate_BYTES_SIZE 800 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,certificateType is 800 */
+#define iso2SubCertificatesType_Certificate_ARRAY_SIZE 4
+struct iso2SubCertificatesType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Certificate, urn:iso:15118:2:2016:MsgDataTypes,certificateType */
+	struct {
+		struct {
+		uint8_t bytes[iso2SubCertificatesType_Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  array[iso2SubCertificatesType_Certificate_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Certificate;
+};
+
+typedef enum {
+	iso2parkingMethodType_AutoParking = 0,
+	iso2parkingMethodType_MVGuideManual = 1,
+	iso2parkingMethodType_Manual = 2
+} iso2parkingMethodType;
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVEnergyTransferParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime)',  derivedBy='RESTRICTION'.  */
+struct iso2EVEnergyTransferParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":DepartureTime, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t DepartureTime ;
+};
+
+/* 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_CONTENT_BYTES_SIZE 350
+struct iso2ContractSignatureEncryptedPrivateKeyType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2ContractSignatureEncryptedPrivateKeyType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* simple content: urn:iso:15118:2:2016:MsgDataTypes,encryptedPrivateKeyType */
+	struct {
+		uint8_t bytes[iso2ContractSignatureEncryptedPrivateKeyType_CONTENT_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  CONTENT ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MagneticVectorSetupListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorSetup{1-255})',  derivedBy='RESTRICTION'.  */
+#define iso2MagneticVectorSetupListType_MagneticVectorSetup_ARRAY_SIZE 5
+struct iso2MagneticVectorSetupListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorSetup, 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'.  */
+	struct {
+		struct iso2MagneticVectorSetupType array[iso2MagneticVectorSetupListType_MagneticVectorSetup_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} MagneticVectorSetup;
+};
+
+typedef enum {
+	iso2responseCodeType_OK = 0,
+	iso2responseCodeType_OK_NewSessionEstablished = 1,
+	iso2responseCodeType_OK_OldSessionJoined = 2,
+	iso2responseCodeType_OK_CertificateExpiresSoon = 3,
+	iso2responseCodeType_OK_IsolationValid = 4,
+	iso2responseCodeType_OK_IsolationWarning = 5,
+	iso2responseCodeType_WARNING_CertificateExpired = 6,
+	iso2responseCodeType_WARNING_NoCertificateAvailable = 7,
+	iso2responseCodeType_WARNING_CertValidationError = 8,
+	iso2responseCodeType_WARNING_CertVerificationError = 9,
+	iso2responseCodeType_WARNING_ContractCanceled = 10,
+	iso2responseCodeType_FAILED = 11,
+	iso2responseCodeType_FAILED_SequenceError = 12,
+	iso2responseCodeType_FAILED_ServiceIDInvalid = 13,
+	iso2responseCodeType_FAILED_UnknownSession = 14,
+	iso2responseCodeType_FAILED_ServiceSelectionInvalid = 15,
+	iso2responseCodeType_FAILED_SignatureError = 16,
+	iso2responseCodeType_FAILED_PaymentSelectionInvalid = 17,
+	iso2responseCodeType_FAILED_ChallengeInvalid = 18,
+	iso2responseCodeType_FAILED_WrongChargeParameter = 19,
+	iso2responseCodeType_FAILED_IsolationFault = 20,
+	iso2responseCodeType_FAILED_PowerDeliveryNotApplied = 21,
+	iso2responseCodeType_FAILED_TariffSelectionInvalid = 22,
+	iso2responseCodeType_FAILED_ChargingProfileInvalid = 23,
+	iso2responseCodeType_FAILED_MeteringSignatureNotValid = 24,
+	iso2responseCodeType_FAILED_NoChargeServiceSelected = 25,
+	iso2responseCodeType_FAILED_WrongEnergyTransferMode = 26,
+	iso2responseCodeType_FAILED_ContactorError = 27,
+	iso2responseCodeType_FAILED_CertificateRevoked = 28,
+	iso2responseCodeType_FAILED_CertificateNotYetValid = 29
+} 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
+struct iso2X509IssuerSerialType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509IssuerName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		exi_string_character_t characters[iso2X509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509IssuerName ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SerialNumber, http://www.w3.org/2001/XMLSchema,integer */
+	int64_t X509SerialNumber ;
+};
+
+typedef enum {
+	iso2chargingSessionType_Terminate = 0,
+	iso2chargingSessionType_Pause = 1
+} iso2chargingSessionType;
+
+typedef enum {
+	iso2EVSEProcessingType_Finished = 0,
+	iso2EVSEProcessingType_Ongoing = 1,
+	iso2EVSEProcessingType_Ongoing_WaitingForCustomerInteraction = 2
+} iso2EVSEProcessingType;
+
+typedef enum {
+	iso2paymentOptionType_Contract = 0,
+	iso2paymentOptionType_ExternalPayment = 1
+} iso2paymentOptionType;
+
+typedef enum {
+	iso2EVSECheckOutStatusType_Scheduled = 0,
+	iso2EVSECheckOutStatusType_Completed = 1
+} 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
+struct iso2PGPDataType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPKeyID, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[iso2PGPDataType_PGPKeyID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyID ;
+	unsigned int PGPKeyID_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[iso2PGPDataType_PGPKeyPacket_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyPacket ;
+	unsigned int PGPKeyPacket_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso2PGPDataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceIDListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ServiceID{1-10})',  derivedBy='RESTRICTION'.  */
+#define iso2ServiceIDListType_ServiceID_ARRAY_SIZE 10
+struct iso2ServiceIDListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ServiceID, urn:iso:15118:2:2016:MsgDataTypes,serviceIDType */
+	struct {
+		uint16_t array[iso2ServiceIDListType_ServiceID_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} ServiceID;
+};
+
+/* 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 {
+	int noContent; /* avoid warning */
+};
+
+typedef enum {
+	iso2EVCheckOutStatusType_CheckOut = 0,
+	iso2EVCheckOutStatusType_Processing = 1,
+	iso2EVCheckOutStatusType_Completed = 2
+} iso2EVCheckOutStatusType;
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorID,"urn:iso:15118:2:2016:MsgDataTypes":SensorPosition,"urn:iso:15118:2:2016:MsgDataTypes":SensorOrientation)',  derivedBy='RESTRICTION'.  */
+struct iso2SensorType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorID, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t SensorID ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorPosition, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,CartesianCoordinatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":XCoordinate,"urn:iso:15118:2:2016:MsgDataTypes":YCoordinate,"urn:iso:15118:2:2016:MsgDataTypes":ZCoordinate)',  derivedBy='RESTRICTION'.  */
+	struct iso2CartesianCoordinatesType SensorPosition ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorOrientation, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,CartesianCoordinatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":XCoordinate,"urn:iso:15118:2:2016:MsgDataTypes":YCoordinate,"urn:iso:15118:2:2016:MsgDataTypes":ZCoordinate)',  derivedBy='RESTRICTION'.  */
+	struct iso2CartesianCoordinatesType SensorOrientation ;
+};
+
+/* 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_CONTENT_BYTES_SIZE 350
+struct iso2SignatureValueType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2SignatureValueType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* simple content: http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[iso2SignatureValueType_CONTENT_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  CONTENT ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,CableCheckReqType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+struct iso2CableCheckReqType {
+	int noContent; /* avoid warning */
+};
+
+typedef enum {
+	iso2electricalChargingDeviceStatusType_Connected = 0,
+	iso2electricalChargingDeviceStatusType_Disconnected = 1
+} iso2electricalChargingDeviceStatusType;
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SelectedServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ServiceID,"urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID)',  derivedBy='RESTRICTION'.  */
+struct iso2SelectedServiceType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ServiceID, urn:iso:15118:2:2016:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t ParameterSetID ;
+};
+
+typedef enum {
+	iso2EVSEErrorCodeType_RESSTemperatureInhibit = 0,
+	iso2EVSEErrorCodeType_ChargerConnectorLockFault = 1,
+	iso2EVSEErrorCodeType_ChargingCurrentdifferential = 2,
+	iso2EVSEErrorCodeType_ChargingVoltageOutOfRange = 3,
+	iso2EVSEErrorCodeType_ChargingSystemIncompatibility = 4,
+	iso2EVSEErrorCodeType_Reserved_A = 5,
+	iso2EVSEErrorCodeType_Reserved_B = 6,
+	iso2EVSEErrorCodeType_Reserved_C = 7
+} 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_CONTENT_BYTES_SIZE 350
+struct iso2DiffieHellmanPublickeyType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2DiffieHellmanPublickeyType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* simple content: urn:iso:15118:2:2016:MsgDataTypes,dHpublickeyType */
+	struct {
+		uint8_t bytes[iso2DiffieHellmanPublickeyType_CONTENT_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  CONTENT ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+struct iso2EVSEStatusType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t NotificationMaxDelay ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSENotification, urn:iso:15118:2:2016:MsgDataTypes,EVSENotificationType */
+	iso2EVSENotificationType EVSENotification ;
+};
+
+typedef enum {
+	iso2EVErrorCodeType_RESSTemperatureInhibit = 0,
+	iso2EVErrorCodeType_EVShiftPosition = 1,
+	iso2EVErrorCodeType_ChargerConnectorLockFault = 2,
+	iso2EVErrorCodeType_EVRESSMalfunction = 3,
+	iso2EVErrorCodeType_ChargingCurrentdifferential = 4,
+	iso2EVErrorCodeType_ChargingVoltageOutOfRange = 5,
+	iso2EVErrorCodeType_ChargingSystemIncompatibility = 6,
+	iso2EVErrorCodeType_Reserved_A = 7,
+	iso2EVErrorCodeType_Reserved_B = 8,
+	iso2EVErrorCodeType_Reserved_C = 9
+} iso2EVErrorCodeType;
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,AuthorizationResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing))',  derivedBy='EXTENSION'.  */
+struct iso2AuthorizationResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVSEProcessing ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MV_EVSEFinePositioningSetupParametersType',  base type name='EVSEFinePositioningSetupParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":FrequencyChannel{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorSetupList{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2MV_EVSEFinePositioningSetupParametersType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":FrequencyChannel, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t FrequencyChannel ;
+	unsigned int FrequencyChannel_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorSetupList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MagneticVectorSetupListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorSetup{1-255})',  derivedBy='RESTRICTION'.  */
+	struct iso2MagneticVectorSetupListType MagneticVectorSetupList ;
+	unsigned int MagneticVectorSetupList_isUsed:1;
+};
+
+/* 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_ARRAY_SIZE 1
+#define iso2X509DataType_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2X509DataType_X509SubjectName_ARRAY_SIZE 1
+#define iso2X509DataType_X509Certificate_BYTES_SIZE 350
+#define iso2X509DataType_X509Certificate_ARRAY_SIZE 1
+#define iso2X509DataType_X509CRL_BYTES_SIZE 350
+#define iso2X509DataType_X509CRL_ARRAY_SIZE 1
+#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 {
+		struct iso2X509IssuerSerialType array[iso2X509DataType_X509IssuerSerial_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509IssuerSerial;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SKI, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[iso2X509DataType_X509SKI_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[iso2X509DataType_X509SKI_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509SKI;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SubjectName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[iso2X509DataType_X509SubjectName_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[iso2X509DataType_X509SubjectName_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509SubjectName;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509Certificate, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[iso2X509DataType_X509Certificate_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[iso2X509DataType_X509Certificate_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509Certificate;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509CRL, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[iso2X509DataType_X509CRL_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[iso2X509DataType_X509CRL_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509CRL;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso2X509DataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,DC_BidirectionalControlResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentCurrent,"urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage,"urn:iso:15118:2:2016:MsgBody":EVSEPowerLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSECurrentLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEVoltageLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumDischargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumChargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumVoltage{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMinimumVoltage{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1}))',  derivedBy='EXTENSION'.  */
+#define iso2DC_BidirectionalControlResType_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,evseIDType is 37 */
+struct iso2DC_BidirectionalControlResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEPresentCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEPresentCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEPresentVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEPowerLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSEPowerLimitAchieved ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSECurrentLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSECurrentLimitAchieved ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEVoltageLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSEVoltageLimitAchieved ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMaximumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumChargePower ;
+	unsigned int EVSEMaximumChargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMaximumDischargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumDischargePower ;
+	unsigned int EVSEMaximumDischargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumChargeCurrent ;
+	unsigned int EVSEMaximumChargeCurrent_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMaximumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumDischargeCurrent ;
+	unsigned int EVSEMaximumDischargeCurrent_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMaximumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumVoltage ;
+	unsigned int EVSEMaximumVoltage_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMinimumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMinimumVoltage ;
+	unsigned int EVSEMinimumVoltage_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEID, urn:iso:15118:2:2016:MsgDataTypes,evseIDType */
+	struct {
+		exi_string_character_t characters[iso2DC_BidirectionalControlResType_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2016:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeterID,"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingCharged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingDischarged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2MeterInfoType MeterInfo ;
+	unsigned int MeterInfo_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ReceiptRequired, http://www.w3.org/2001/XMLSchema,boolean */
+	int ReceiptRequired ;
+	unsigned int ReceiptRequired_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,CostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":costKind,"urn:iso:15118:2:2016:MsgDataTypes":amount)',  derivedBy='RESTRICTION'.  */
+struct iso2CostType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":costKind, urn:iso:15118:2:2016:MsgDataTypes,costKindType */
+	iso2costKindType costKind ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":amount, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType amount ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ChargingStatusResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1},"urn:iso:15118:2:2016:MsgBody":EVSETargetPower{0-1}))',  derivedBy='EXTENSION'.  */
+#define iso2ChargingStatusResType_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,evseIDType is 37 */
+struct iso2ChargingStatusResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEID, urn:iso:15118:2:2016:MsgDataTypes,evseIDType */
+	struct {
+		exi_string_character_t characters[iso2ChargingStatusResType_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2016:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeterID,"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingCharged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingDischarged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2MeterInfoType MeterInfo ;
+	unsigned int MeterInfo_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ReceiptRequired, http://www.w3.org/2001/XMLSchema,boolean */
+	int ReceiptRequired ;
+	unsigned int ReceiptRequired_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSETargetPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSETargetPower ;
+	unsigned int EVSETargetPower_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVChargeParameterType',  base type name='EVEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage))',  derivedBy='EXTENSION'.  */
+struct iso2AC_EVChargeParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":DepartureTime, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t DepartureTime ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargePower ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	unsigned int EVTargetEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumVoltage ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVSEBidirectionalParameterType',  base type name='AC_EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency),("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency))',  derivedBy='EXTENSION'.  */
+struct iso2AC_EVSEBidirectionalParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSENominalVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSENominalVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSENominalFrequency ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumDischargeCurrent ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckOutResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSECheckOutStatus))',  derivedBy='EXTENSION'.  */
+struct iso2VehicleCheckOutResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSECheckOutStatus, urn:iso:15118:2:2016:MsgDataTypes,EVCheckOutStatusType */
+	iso2EVCheckOutStatusType EVSECheckOutStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,CableCheckResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing))',  derivedBy='EXTENSION'.  */
+struct iso2CableCheckResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVSEProcessing ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":SupportedServiceIDs{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2ServiceDiscoveryReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":SupportedServiceIDs, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceIDListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ServiceID{1-10})',  derivedBy='RESTRICTION'.  */
+	struct iso2ServiceIDListType SupportedServiceIDs ;
+	unsigned int SupportedServiceIDs_isUsed:1;
+};
+
+/* 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_SignatureProperty_ARRAY_SIZE 1
+struct iso2SignaturePropertiesType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2SignaturePropertiesType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureProperty, 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'.  */
+	struct {
+		struct iso2SignaturePropertyType array[iso2SignaturePropertiesType_SignatureProperty_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SignatureProperty;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PMaxScheduleEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval),("urn:iso:15118:2:2016:MsgDataTypes":PMax{1-3}))',  derivedBy='EXTENSION'.  */
+#define iso2PMaxScheduleEntryType_PMax_ARRAY_SIZE 3
+struct iso2PMaxScheduleEntryType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,RelativeTimeIntervalType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":start,"urn:iso:15118:2:2016:MsgDataTypes":duration{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2RelativeTimeIntervalType RelativeTimeInterval ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":PMax, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso2PhysicalValueType array[iso2PMaxScheduleEntryType_PMax_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PMax;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckInReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVCheckInStatus,"urn:iso:15118:2:2016:MsgBody":ParkingMethod{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2VehicleCheckInReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVCheckInStatus, urn:iso:15118:2:2016:MsgDataTypes,EVCheckInStatusType */
+	iso2EVCheckInStatusType EVCheckInStatus ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ParkingMethod, urn:iso:15118:2:2016:MsgDataTypes,parkingMethodType */
+	iso2parkingMethodType ParkingMethod ;
+	unsigned int ParkingMethod_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ConnectChargingDeviceResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":EVSEElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus))',  derivedBy='EXTENSION'.  */
+struct iso2ConnectChargingDeviceResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVSEProcessing ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEElectricalChargingDeviceStatus, urn:iso:15118:2:2016:MsgDataTypes,electricalChargingDeviceStatusType */
+	iso2electricalChargingDeviceStatusType EVSEElectricalChargingDeviceStatus ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus, urn:iso:15118:2:2016:MsgDataTypes,mechanicalChargingDeviceStatusType */
+	iso2mechanicalChargingDeviceStatusType EVSEMechanicalChargingDeviceStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,WeldingDetectionResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage))',  derivedBy='EXTENSION'.  */
+struct iso2WeldingDetectionResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEPresentVoltage ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,SessionStopResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2SessionStopResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckInResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":VehicleSpace,"urn:iso:15118:2:2016:MsgBody":TargetOffset{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2VehicleCheckInResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":VehicleSpace, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t VehicleSpace ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":TargetOffset, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,TargetPositionType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":TargetOffsetX,"urn:iso:15118:2:2016:MsgDataTypes":TargetOffsetY)',  derivedBy='RESTRICTION'.  */
+	struct iso2TargetPositionType TargetOffset ;
+	unsigned int TargetOffset_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVBidirectionalParameterType',  base type name='AC_EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage)),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargeCurrent))',  derivedBy='EXTENSION'.  */
+struct iso2AC_EVBidirectionalParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":DepartureTime, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t DepartureTime ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargePower ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	unsigned int EVTargetEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumDischargePower ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumDischargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumDischargeCurrent ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ConsumptionCostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":startValue,"urn:iso:15118:2:2016:MsgDataTypes":Cost{1-3})',  derivedBy='RESTRICTION'.  */
+#define iso2ConsumptionCostType_Cost_ARRAY_SIZE 3
+struct iso2ConsumptionCostType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":startValue, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType startValue ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Cost, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,CostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":costKind,"urn:iso:15118:2:2016:MsgDataTypes":amount)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso2CostType array[iso2ConsumptionCostType_Cost_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Cost;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PaymentOptionListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":PaymentOption{1-2})',  derivedBy='RESTRICTION'.  */
+#define iso2PaymentOptionListType_PaymentOption_ARRAY_SIZE 2
+struct iso2PaymentOptionListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":PaymentOption, urn:iso:15118:2:2016:MsgDataTypes,paymentOptionType */
+	struct {
+		iso2paymentOptionType array[iso2PaymentOptionListType_PaymentOption_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PaymentOption;
+};
+
+/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define iso2TransformsType_Transform_ARRAY_SIZE 1
+struct iso2TransformsType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transform, 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'.  */
+	struct {
+		struct iso2TransformType array[iso2TransformsType_Transform_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Transform;
+};
+
+/* 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
+struct iso2ParameterType {
+	/* attribute: Name {http://www.w3.org/2001/XMLSchema,string} */
+	struct {
+		exi_string_character_t characters[iso2ParameterType_Name_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Name ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":boolValue, http://www.w3.org/2001/XMLSchema,boolean */
+	int boolValue ;
+	unsigned int boolValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":byteValue, http://www.w3.org/2001/XMLSchema,byte */
+	int8_t byteValue ;
+	unsigned int byteValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":shortValue, http://www.w3.org/2001/XMLSchema,short */
+	int16_t shortValue ;
+	unsigned int shortValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":intValue, http://www.w3.org/2001/XMLSchema,int */
+	int32_t intValue ;
+	unsigned int intValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":physicalValue, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType physicalValue ;
+	unsigned int physicalValue_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":stringValue, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		exi_string_character_t characters[iso2ParameterType_stringValue_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  stringValue ;
+	unsigned int stringValue_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,SessionStopReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ChargingSession)',  derivedBy='EXTENSION'.  */
+struct iso2SessionStopReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ChargingSession, urn:iso:15118:2:2016:MsgDataTypes,chargingSessionType */
+	iso2chargingSessionType ChargingSession ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorMeasurementsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorID,"urn:iso:15118:2:2016:MsgDataTypes":EffectiveRadiatedPower,"urn:iso:15118:2:2016:MsgDataTypes":MeasurementDataList)',  derivedBy='RESTRICTION'.  */
+struct iso2SensorMeasurementsType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorID, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t SensorID ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EffectiveRadiatedPower, http://www.w3.org/2001/XMLSchema,byte */
+	int8_t EffectiveRadiatedPower ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MeasurementDataList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeasurementDataListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeasurementData{1-255})',  derivedBy='RESTRICTION'.  */
+	struct iso2MeasurementDataListType MeasurementDataList ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVSEChargeParameterType',  base type name='EVSEEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSECurrentRegulationTolerance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVSEPeakCurrentRipple,"urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyToBeDelivered{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2DC_EVSEChargeParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumChargePower ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMinimumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMinimumVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSECurrentRegulationTolerance, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSECurrentRegulationTolerance ;
+	unsigned int EVSECurrentRegulationTolerance_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEPeakCurrentRipple, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEPeakCurrentRipple ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyToBeDelivered, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEEnergyToBeDelivered ;
+	unsigned int EVSEEnergyToBeDelivered_isUsed:1;
+};
+
+/* 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_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} */
+	struct {
+		exi_string_character_t characters[iso2CertificateChainType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Certificate, urn:iso:15118:2:2016:MsgDataTypes,certificateType */
+	struct {
+		uint8_t bytes[iso2CertificateChainType_Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Certificate ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SubCertificates, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SubCertificatesType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Certificate{1-4})',  derivedBy='RESTRICTION'.  */
+	struct iso2SubCertificatesType SubCertificates ;
+	unsigned int SubCertificates_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,WPT_EVChargeParameterType',  base type name='EVEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumPower,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumPower,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2WPT_EVChargeParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":DepartureTime, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t DepartureTime ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumPower ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumPower ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	unsigned int EVTargetEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,DisconnectChargingDeviceReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus)',  derivedBy='EXTENSION'.  */
+struct iso2DisconnectChargingDeviceReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVElectricalChargingDeviceStatus, urn:iso:15118:2:2016:MsgDataTypes,electricalChargingDeviceStatusType */
+	iso2electricalChargingDeviceStatusType EVElectricalChargingDeviceStatus ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus, urn:iso:15118:2:2016:MsgDataTypes,mechanicalChargingDeviceStatusType */
+	iso2mechanicalChargingDeviceStatusType EVMechanicalChargingDeviceStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,MeteringReceiptResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2MeteringReceiptResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,SessionSetupResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":EVSETimeStamp{0-1}))',  derivedBy='EXTENSION'.  */
+#define iso2SessionSetupResType_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,evseIDType is 37 */
+struct iso2SessionSetupResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEID, urn:iso:15118:2:2016:MsgDataTypes,evseIDType */
+	struct {
+		exi_string_character_t characters[iso2SessionSetupResType_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSETimeStamp, http://www.w3.org/2001/XMLSchema,long */
+	int64_t EVSETimeStamp ;
+	unsigned int EVSETimeStamp_isUsed:1;
+};
+
+/* 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
+struct iso2ReferenceType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2ReferenceType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso2ReferenceType_URI_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  URI ;
+	unsigned int URI_isUsed:1;
+	/* attribute: Type {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso2ReferenceType_Type_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Type ;
+	unsigned int Type_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transforms, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso2TransformsType Transforms ;
+	unsigned int Transforms_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":DigestMethod, 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'.  */
+	struct iso2DigestMethodType DigestMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":DigestValue, http://www.w3.org/2000/09/xmldsig#,DigestValueType */
+	struct {
+		uint8_t bytes[iso2ReferenceType_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Sensor{1-255})',  derivedBy='RESTRICTION'.  */
+#define iso2SensorListType_Sensor_ARRAY_SIZE 5
+struct iso2SensorListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Sensor, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorID,"urn:iso:15118:2:2016:MsgDataTypes":SensorPosition,"urn:iso:15118:2:2016:MsgDataTypes":SensorOrientation)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso2SensorType array[iso2SensorListType_Sensor_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Sensor;
+};
+
+/* 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 {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":NumberOfSensors, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t NumberOfSensors ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Sensor{1-255})',  derivedBy='RESTRICTION'.  */
+	struct iso2SensorListType SensorList ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorOrder, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorOrderListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorPosition{1-255})',  derivedBy='RESTRICTION'.  */
+	struct iso2SensorOrderListType SensorOrder ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SignalPulseDuration, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t SignalPulseDuration ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SignalSeparationTime, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t SignalSeparationTime ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":PackageSeparationTime, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t PackageSeparationTime ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":AlignmentOffset, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t AlignmentOffset ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,WPT_EVSEChargeParameterType',  base type name='EVSEEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumPower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumPower)',  derivedBy='EXTENSION'.  */
+struct iso2WPT_EVSEChargeParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumPower ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMinimumPower ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+#define iso2ParameterSetType_Parameter_ARRAY_SIZE 16
+struct iso2ParameterSetType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t ParameterSetID ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Parameter, 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'.  */
+	struct {
+		struct iso2ParameterType array[iso2ParameterSetType_Parameter_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Parameter;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentDetailsResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":GenChallenge,"urn:iso:15118:2:2016:MsgBody":EVSETimeStamp))',  derivedBy='EXTENSION'.  */
+#define iso2PaymentDetailsResType_GenChallenge_BYTES_SIZE 16 /* XML schema facet length for urn:iso:15118:2:2016:MsgDataTypes,genChallengeType is 16 */
+struct iso2PaymentDetailsResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":GenChallenge, urn:iso:15118:2:2016:MsgDataTypes,genChallengeType */
+	struct {
+		uint8_t bytes[iso2PaymentDetailsResType_GenChallenge_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  GenChallenge ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSETimeStamp, http://www.w3.org/2001/XMLSchema,long */
+	int64_t EVSETimeStamp ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,AC_BidirectionalControlResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":EVSETargetPower,"urn:iso:15118:2:2016:MsgBody":EVSETargetReactivePower,"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1}))',  derivedBy='EXTENSION'.  */
+#define iso2AC_BidirectionalControlResType_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,evseIDType is 37 */
+struct iso2AC_BidirectionalControlResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVSEProcessing ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSETargetPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSETargetPower ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSETargetReactivePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSETargetReactivePower ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEID, urn:iso:15118:2:2016:MsgDataTypes,evseIDType */
+	struct {
+		exi_string_character_t characters[iso2AC_BidirectionalControlResType_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2016:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeterID,"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingCharged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingDischarged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2MeterInfoType MeterInfo ;
+	unsigned int MeterInfo_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ReceiptRequired, http://www.w3.org/2001/XMLSchema,boolean */
+	int ReceiptRequired ;
+	unsigned int ReceiptRequired_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckOutReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVCheckOutStatus,"urn:iso:15118:2:2016:MsgBody":CheckOutTime)',  derivedBy='EXTENSION'.  */
+struct iso2VehicleCheckOutReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVCheckOutStatus, urn:iso:15118:2:2016:MsgDataTypes,EVCheckOutStatusType */
+	iso2EVCheckOutStatusType EVCheckOutStatus ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":CheckOutTime, http://www.w3.org/2001/XMLSchema,unsignedLong */
+	uint64_t CheckOutTime ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,AlignmentCheckResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":AlignmentCheckParameters{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2AlignmentCheckResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVSEProcessing ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":AlignmentCheckParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+	struct iso2ParameterSetType AlignmentCheckParameters ;
+	unsigned int AlignmentCheckParameters_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MinimumPMaxRequestType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MinimumPMaxScheduleEntry{1-3})',  derivedBy='RESTRICTION'.  */
+#define iso2MinimumPMaxRequestType_MinimumPMaxScheduleEntry_ARRAY_SIZE 3
+struct iso2MinimumPMaxRequestType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MinimumPMaxScheduleEntry, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PMaxScheduleEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval),("urn:iso:15118:2:2016:MsgDataTypes":PMax{1-3}))',  derivedBy='EXTENSION'.  */
+	struct {
+		struct iso2PMaxScheduleEntryType array[iso2MinimumPMaxRequestType_MinimumPMaxScheduleEntry_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} MinimumPMaxScheduleEntry;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,DisconnectChargingDeviceResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":EVSEElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus))',  derivedBy='EXTENSION'.  */
+struct iso2DisconnectChargingDeviceResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVSEProcessing ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEElectricalChargingDeviceStatus, urn:iso:15118:2:2016:MsgDataTypes,electricalChargingDeviceStatusType */
+	iso2electricalChargingDeviceStatusType EVSEElectricalChargingDeviceStatus ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus, urn:iso:15118:2:2016:MsgDataTypes,mechanicalChargingDeviceStatusType */
+	iso2mechanicalChargingDeviceStatusType EVSEMechanicalChargingDeviceStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentDetailsReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":eMAID,"urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain)',  derivedBy='EXTENSION'.  */
+#define iso2PaymentDetailsReqType_eMAID_CHARACTERS_SIZE 15 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,eMAIDType is 15 */
+struct iso2PaymentDetailsReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":eMAID, urn:iso:15118:2:2016:MsgDataTypes,eMAIDType */
+	struct {
+		exi_string_character_t characters[iso2PaymentDetailsReqType_eMAID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  eMAID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain, 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'.  */
+	struct iso2CertificateChainType ContractSignatureCertChain ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,Generic_EVFinePositioningParametersType',  base type name='EVFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":GenericParameters)',  derivedBy='EXTENSION'.  */
+struct iso2Generic_EVFinePositioningParametersType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":GenericParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+	struct iso2ParameterSetType GenericParameters ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ConnectChargingDeviceReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus)',  derivedBy='EXTENSION'.  */
+struct iso2ConnectChargingDeviceReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVElectricalChargingDeviceStatus, urn:iso:15118:2:2016:MsgDataTypes,electricalChargingDeviceStatusType */
+	iso2electricalChargingDeviceStatusType EVElectricalChargingDeviceStatus ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus, urn:iso:15118:2:2016:MsgDataTypes,mechanicalChargingDeviceStatusType */
+	iso2mechanicalChargingDeviceStatusType EVMechanicalChargingDeviceStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVSEChargeParameterType',  base type name='EVSEEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency)',  derivedBy='EXTENSION'.  */
+struct iso2AC_EVSEChargeParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSENominalVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSENominalVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSENominalFrequency ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SalesTariffEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval),("urn:iso:15118:2:2016:MsgDataTypes":EPriceLevel{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ConsumptionCost{0-3}))',  derivedBy='EXTENSION'.  */
+#define iso2SalesTariffEntryType_ConsumptionCost_ARRAY_SIZE 3
+struct iso2SalesTariffEntryType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,RelativeTimeIntervalType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":start,"urn:iso:15118:2:2016:MsgDataTypes":duration{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2RelativeTimeIntervalType RelativeTimeInterval ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EPriceLevel, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t EPriceLevel ;
+	unsigned int EPriceLevel_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ConsumptionCost, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ConsumptionCostType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":startValue,"urn:iso:15118:2:2016:MsgDataTypes":Cost{1-3})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso2ConsumptionCostType array[iso2SalesTariffEntryType_ConsumptionCost_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} ConsumptionCost;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVSEBidirectionalParameterType',  base type name='DC_EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSECurrentRegulationTolerance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVSEPeakCurrentRipple,"urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyToBeDelivered{0-1}),("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumDischargeCurrent))',  derivedBy='EXTENSION'.  */
+struct iso2DC_EVSEBidirectionalParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumChargePower ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMinimumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMinimumVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSECurrentRegulationTolerance, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSECurrentRegulationTolerance ;
+	unsigned int EVSECurrentRegulationTolerance_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEPeakCurrentRipple, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEPeakCurrentRipple ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyToBeDelivered, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEEnergyToBeDelivered ;
+	unsigned int EVSEEnergyToBeDelivered_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumDischargePower ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumDischargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMinimumDischargeCurrent ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DisplayParametersType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":CurrentRange{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingPerformance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToTargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToBulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToMinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":InletHot{0-1})',  derivedBy='RESTRICTION'.  */
+struct iso2DisplayParametersType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":CurrentRange, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t CurrentRange ;
+	unsigned int CurrentRange_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t CurrentSOC ;
+	unsigned int CurrentSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":TargetSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t TargetSOC ;
+	unsigned int TargetSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":BulkSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t BulkSOC ;
+	unsigned int BulkSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t MinimumSOC ;
+	unsigned int MinimumSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ChargingPerformance, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType ChargingPerformance ;
+	unsigned int ChargingPerformance_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToTargetSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t RemainingTimeToTargetSOC ;
+	unsigned int RemainingTimeToTargetSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToBulkSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t RemainingTimeToBulkSOC ;
+	unsigned int RemainingTimeToBulkSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToMinimumSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t RemainingTimeToMinimumSOC ;
+	unsigned int RemainingTimeToMinimumSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ChargingComplete, http://www.w3.org/2001/XMLSchema,boolean */
+	int ChargingComplete ;
+	unsigned int ChargingComplete_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":BulkChargingComplete, http://www.w3.org/2001/XMLSchema,boolean */
+	int BulkChargingComplete ;
+	unsigned int BulkChargingComplete_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":InletHot, http://www.w3.org/2001/XMLSchema,boolean */
+	int InletHot ;
+	unsigned int InletHot_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVBidirectionalParameterType',  base type name='DC_EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1})),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2DC_EVBidirectionalParameterType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":DepartureTime, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t DepartureTime ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargePower ;
+	unsigned int EVMaximumChargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumChargePower ;
+	unsigned int EVMinimumChargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	unsigned int EVTargetEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t CurrentSOC ;
+	unsigned int CurrentSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":TargetSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t TargetSOC ;
+	unsigned int TargetSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":BulkSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t BulkSOC ;
+	unsigned int BulkSOC_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumDischargePower ;
+	unsigned int EVMaximumDischargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumDischargePower ;
+	unsigned int EVMinimumDischargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumDischargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumDischargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVMinimumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC, urn:iso:15118:2:2016:MsgDataTypes,percentValueType */
+	int8_t MinimumSOC ;
+	unsigned int MinimumSOC_isUsed:1;
+};
+
+/* 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
+struct iso2MagneticVectorType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":GAID, http://www.w3.org/2001/XMLSchema,ID */
+	struct {
+		exi_string_character_t characters[iso2MagneticVectorType_GAID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  GAID ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Distance, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t Distance ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":AngleGAtoVA, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType AngleGAtoVA ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":RotationVAtoGA, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType RotationVAtoGA ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":FODStatus, urn:iso:15118:2:2016:MsgDataTypes,FODStatusType */
+	iso2FODStatusType FODStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,SystemStatusResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":OperationMode,"urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus))',  derivedBy='EXTENSION'.  */
+struct iso2SystemStatusResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":OperationMode, urn:iso:15118:2:2016:MsgDataTypes,operationModeType */
+	iso2operationModeType OperationMode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus, urn:iso:15118:2:2016:MsgDataTypes,mechanicalChargingDeviceStatusType */
+	iso2mechanicalChargingDeviceStatusType EVSEMechanicalChargingDeviceStatus ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,V2GResponseType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2V2GResponseType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PreChargeResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage))',  derivedBy='EXTENSION'.  */
+struct iso2PreChargeResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEPresentVoltage ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentServiceSelectionResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2PaymentServiceSelectionResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+};
+
+/* 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_Reference_ARRAY_SIZE 1
+struct iso2ManifestType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2ManifestType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Reference, 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'.  */
+	struct {
+		struct iso2ReferenceType array[iso2ManifestType_Reference_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Reference;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SelectedServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SelectedService{1-16})',  derivedBy='RESTRICTION'.  */
+#define iso2SelectedServiceListType_SelectedService_ARRAY_SIZE 16
+struct iso2SelectedServiceListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SelectedService, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SelectedServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ServiceID,"urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso2SelectedServiceType array[iso2SelectedServiceListType_SelectedService_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SelectedService;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,Generic_EVSEFinePositioningParametersType',  base type name='EVSEFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":GenericParameters)',  derivedBy='EXTENSION'.  */
+struct iso2Generic_EVSEFinePositioningParametersType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":GenericParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+	struct iso2ParameterSetType GenericParameters ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ListOfRootCertificateIDsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":RootCertificateID{1-20})',  derivedBy='RESTRICTION'.  */
+#define iso2ListOfRootCertificateIDsType_RootCertificateID_ARRAY_SIZE 20
+struct iso2ListOfRootCertificateIDsType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":RootCertificateID, 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 {
+		struct iso2X509IssuerSerialType array[iso2ListOfRootCertificateIDsType_RootCertificateID_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} RootCertificateID;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PairingReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVProcessing,"urn:iso:15118:2:2016:MsgBody":PairingParameters{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2PairingReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVProcessing ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":PairingParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+	struct iso2ParameterSetType PairingParameters ;
+	unsigned int PairingParameters_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,CurrentDemandResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentCurrent,"urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage,"urn:iso:15118:2:2016:MsgBody":EVSEPowerLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSECurrentLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEVoltageLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEMaximumPower{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumVoltage{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1}))',  derivedBy='EXTENSION'.  */
+#define iso2CurrentDemandResType_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,evseIDType is 37 */
+struct iso2CurrentDemandResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEPresentCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEPresentCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEPresentVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEPowerLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSEPowerLimitAchieved ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSECurrentLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSECurrentLimitAchieved ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEVoltageLimitAchieved, http://www.w3.org/2001/XMLSchema,boolean */
+	int EVSEVoltageLimitAchieved ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMaximumPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumPower ;
+	unsigned int EVSEMaximumPower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMaximumCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumCurrent ;
+	unsigned int EVSEMaximumCurrent_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEMaximumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEMaximumVoltage ;
+	unsigned int EVSEMaximumVoltage_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEID, urn:iso:15118:2:2016:MsgDataTypes,evseIDType */
+	struct {
+		exi_string_character_t characters[iso2CurrentDemandResType_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2016:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeterID,"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingCharged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingDischarged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2MeterInfoType MeterInfo ;
+	unsigned int MeterInfo_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ReceiptRequired, http://www.w3.org/2001/XMLSchema,boolean */
+	int ReceiptRequired ;
+	unsigned int ReceiptRequired_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ChargingStatusReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumChargeCurrent{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2ChargingStatusReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":DisplayParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DisplayParametersType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":CurrentRange{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingPerformance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToTargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToBulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToMinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":InletHot{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2DisplayParametersType DisplayParameters ;
+	unsigned int DisplayParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargePower ;
+	unsigned int EVMaximumChargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargeCurrent ;
+	unsigned int EVMaximumChargeCurrent_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMinimumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumChargeCurrent ;
+	unsigned int EVMinimumChargeCurrent_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,CertificateInstallationResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":SAProvisioningCertificateChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2016:MsgBody":DHpublickey,"urn:iso:15118:2:2016:MsgBody":eMAID))',  derivedBy='EXTENSION'.  */
+struct iso2CertificateInstallationResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SAProvisioningCertificateChain, 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'.  */
+	struct iso2CertificateChainType SAProvisioningCertificateChain ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain, 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'.  */
+	struct iso2CertificateChainType ContractSignatureCertChain ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ContractSignatureEncryptedPrivateKey, 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'.  */
+	struct iso2ContractSignatureEncryptedPrivateKeyType ContractSignatureEncryptedPrivateKey ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":DHpublickey, 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'.  */
+	struct iso2DiffieHellmanPublickeyType DHpublickey ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":eMAID, 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'.  */
+	struct iso2EMAIDType eMAID ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorPackageType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":PackageIndex,"urn:iso:15118:2:2016:MsgDataTypes":SensorMeasurements{1-255})',  derivedBy='RESTRICTION'.  */
+#define iso2SensorPackageType_SensorMeasurements_ARRAY_SIZE 5
+struct iso2SensorPackageType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":PackageIndex, http://www.w3.org/2001/XMLSchema,unsignedInt */
+	uint32_t PackageIndex ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorMeasurements, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorMeasurementsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorID,"urn:iso:15118:2:2016:MsgDataTypes":EffectiveRadiatedPower,"urn:iso:15118:2:2016:MsgDataTypes":MeasurementDataList)',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso2SensorMeasurementsType array[iso2SensorPackageType_SensorMeasurements_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SensorMeasurements;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDiscoveryResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":PaymentOptionList,"urn:iso:15118:2:2016:MsgBody":EnergyTransferServiceList,"urn:iso:15118:2:2016:MsgBody":VASList{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2ServiceDiscoveryResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":PaymentOptionList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PaymentOptionListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":PaymentOption{1-2})',  derivedBy='RESTRICTION'.  */
+	struct iso2PaymentOptionListType PaymentOptionList ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EnergyTransferServiceList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Service{1-8})',  derivedBy='RESTRICTION'.  */
+	struct iso2ServiceListType EnergyTransferServiceList ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":VASList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Service{1-8})',  derivedBy='RESTRICTION'.  */
+	struct iso2ServiceListType VASList ;
+	unsigned int VASList_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDemandResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEOutputPower,"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1},"urn:iso:15118:2:2016:MsgBody":PowerDemandParameters{0-1}))',  derivedBy='EXTENSION'.  */
+#define iso2PowerDemandResType_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,evseIDType is 37 */
+struct iso2PowerDemandResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEOutputPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVSEOutputPower ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEID, urn:iso:15118:2:2016:MsgDataTypes,evseIDType */
+	struct {
+		exi_string_character_t characters[iso2PowerDemandResType_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2016:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":MeterInfo, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MeterInfoType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MeterID,"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingCharged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterReadingDischarged{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SigMeterReading{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MeterStatus{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TMeter{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2MeterInfoType MeterInfo ;
+	unsigned int MeterInfo_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ReceiptRequired, http://www.w3.org/2001/XMLSchema,boolean */
+	int ReceiptRequired ;
+	unsigned int ReceiptRequired_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":PowerDemandParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+	struct iso2ParameterSetType PowerDemandParameters ;
+	unsigned int PowerDemandParameters_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ChargingProfileType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ProfileEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define iso2ChargingProfileType_ProfileEntry_ARRAY_SIZE 24
+struct iso2ChargingProfileType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ProfileEntry, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PMaxScheduleEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval),("urn:iso:15118:2:2016:MsgDataTypes":PMax{1-3}))',  derivedBy='EXTENSION'.  */
+	struct {
+		struct iso2PMaxScheduleEntryType array[iso2ChargingProfileType_ProfileEntry_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} ProfileEntry;
+};
+
+/* 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_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 {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2SalesTariffType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SalesTariffID, urn:iso:15118:2:2016:MsgDataTypes,SAIDType */
+	uint8_t SalesTariffID ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SalesTariffDescription, urn:iso:15118:2:2016:MsgDataTypes,tariffDescriptionType */
+	struct {
+		exi_string_character_t characters[iso2SalesTariffType_SalesTariffDescription_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  SalesTariffDescription ;
+	unsigned int SalesTariffDescription_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":NumEPriceLevels, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t NumEPriceLevels ;
+	unsigned int NumEPriceLevels_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SalesTariffEntry, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SalesTariffEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval),("urn:iso:15118:2:2016:MsgDataTypes":EPriceLevel{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ConsumptionCost{0-3}))',  derivedBy='EXTENSION'.  */
+	struct {
+		struct iso2SalesTariffEntryType array[iso2SalesTariffType_SalesTariffEntry_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SalesTariffEntry;
+};
+
+/* 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_Reference_ARRAY_SIZE 1
+struct iso2SignedInfoType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2SignedInfoType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod, 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'.  */
+	struct iso2CanonicalizationMethodType CanonicalizationMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureMethod, 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'.  */
+	struct iso2SignatureMethodType SignatureMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Reference, 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'.  */
+	struct {
+		struct iso2ReferenceType array[iso2SignedInfoType_Reference_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Reference;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDeliveryResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing))',  derivedBy='EXTENSION'.  */
+struct iso2PowerDeliveryResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVSEProcessing ;
+};
+
+/* 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
+struct iso2RetrievalMethodType {
+	/* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso2RetrievalMethodType_URI_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  URI ;
+	unsigned int URI_isUsed:1;
+	/* attribute: Type {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[iso2RetrievalMethodType_Type_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Type ;
+	unsigned int Type_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transforms, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso2TransformsType Transforms ;
+	unsigned int Transforms_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MagneticVectorListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MagneticVector{1-255})',  derivedBy='RESTRICTION'.  */
+#define iso2MagneticVectorListType_MagneticVector_ARRAY_SIZE 5
+struct iso2MagneticVectorListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MagneticVector, 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'.  */
+	struct {
+		struct iso2MagneticVectorType array[iso2MagneticVectorListType_MagneticVector_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} MagneticVector;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceParameterListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSet{1-255})',  derivedBy='RESTRICTION'.  */
+#define iso2ServiceParameterListType_ParameterSet_ARRAY_SIZE 5
+struct iso2ServiceParameterListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":ParameterSet, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso2ParameterSetType array[iso2ServiceParameterListType_ParameterSet_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} ParameterSet;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PMaxScheduleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":PMaxScheduleEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define iso2PMaxScheduleType_PMaxScheduleEntry_ARRAY_SIZE 5
+struct iso2PMaxScheduleType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":PMaxScheduleEntry, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PMaxScheduleEntryType',  base type name='EntryType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":RelativeTimeInterval),("urn:iso:15118:2:2016:MsgDataTypes":PMax{1-3}))',  derivedBy='EXTENSION'.  */
+	struct {
+		struct iso2PMaxScheduleEntryType array[iso2PMaxScheduleType_PMaxScheduleEntry_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PMaxScheduleEntry;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,CertificateUpdateResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":SAProvisioningCertificateChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2016:MsgBody":DHpublickey,"urn:iso:15118:2:2016:MsgBody":eMAID,"urn:iso:15118:2:2016:MsgBody":RetryCounter{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2CertificateUpdateResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SAProvisioningCertificateChain, 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'.  */
+	struct iso2CertificateChainType SAProvisioningCertificateChain ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain, 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'.  */
+	struct iso2CertificateChainType ContractSignatureCertChain ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ContractSignatureEncryptedPrivateKey, 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'.  */
+	struct iso2ContractSignatureEncryptedPrivateKeyType ContractSignatureEncryptedPrivateKey ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":DHpublickey, 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'.  */
+	struct iso2DiffieHellmanPublickeyType DHpublickey ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":eMAID, 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'.  */
+	struct iso2EMAIDType eMAID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":RetryCounter, http://www.w3.org/2001/XMLSchema,short */
+	int16_t RetryCounter ;
+	unsigned int RetryCounter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,DC_BidirectionalControlReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVTargetCurrent,"urn:iso:15118:2:2016:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2016:MsgBody":EVMaximumVoltage,"urn:iso:15118:2:2016:MsgBody":EVMinimumVoltage,"urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargePower{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2DC_BidirectionalControlReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":DisplayParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DisplayParametersType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":CurrentRange{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingPerformance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToTargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToBulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToMinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":InletHot{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2DisplayParametersType DisplayParameters ;
+	unsigned int DisplayParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMinimumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumDischargeCurrent ;
+	unsigned int EVMaximumDischargeCurrent_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargePower ;
+	unsigned int EVMaximumChargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumDischargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumDischargePower ;
+	unsigned int EVMaximumDischargePower_isUsed:1;
+};
+
+/* 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_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} */
+	struct {
+		exi_string_character_t characters[iso2CertificateUpdateReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain, 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'.  */
+	struct iso2CertificateChainType ContractSignatureCertChain ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":eMAID, urn:iso:15118:2:2016:MsgDataTypes,eMAIDType */
+	struct {
+		exi_string_character_t characters[iso2CertificateUpdateReqType_eMAID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  eMAID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ListOfRootCertificateIDs, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ListOfRootCertificateIDsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":RootCertificateID{1-20})',  derivedBy='RESTRICTION'.  */
+	struct iso2ListOfRootCertificateIDsType ListOfRootCertificateIDs ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVSEFinePositioningSetupParametersType',  base type name='EVSEFinePositioningSetupParametersType',  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,"urn:iso:15118:2:2016:MsgDataTypes":SignalFrequency)',  derivedBy='EXTENSION'.  */
+struct iso2LFA_EVSEFinePositioningSetupParametersType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":NumberOfSensors, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t NumberOfSensors ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Sensor{1-255})',  derivedBy='RESTRICTION'.  */
+	struct iso2SensorListType SensorList ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorOrder, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorOrderListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorPosition{1-255})',  derivedBy='RESTRICTION'.  */
+	struct iso2SensorOrderListType SensorOrder ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SignalPulseDuration, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t SignalPulseDuration ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SignalSeparationTime, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t SignalSeparationTime ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":PackageSeparationTime, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t PackageSeparationTime ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":AlignmentOffset, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t AlignmentOffset ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SignalFrequency, http://www.w3.org/2001/XMLSchema,unsignedShort */
+	uint16_t SignalFrequency ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,AlignmentCheckReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVProcessing,"urn:iso:15118:2:2016:MsgBody":AlignmentCheckParameters{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2AlignmentCheckReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVProcessing ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":AlignmentCheckParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+	struct iso2ParameterSetType AlignmentCheckParameters ;
+	unsigned int AlignmentCheckParameters_isUsed:1;
+};
+
+/* 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_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} */
+	struct {
+		exi_string_character_t characters[iso2CertificateInstallationReqType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":OEMProvisioningCert, urn:iso:15118:2:2016:MsgDataTypes,certificateType */
+	struct {
+		uint8_t bytes[iso2CertificateInstallationReqType_OEMProvisioningCert_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  OEMProvisioningCert ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ListOfRootCertificateIDs, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ListOfRootCertificateIDsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":RootCertificateID{1-20})',  derivedBy='RESTRICTION'.  */
+	struct iso2ListOfRootCertificateIDsType ListOfRootCertificateIDs ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ChargeParameterDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":MaxSupportingPoints{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVEnergyTransferParameter,"urn:iso:15118:2:2016:MsgBody":MinimumPMaxRequest{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2ChargeParameterDiscoveryReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":MaxSupportingPoints, urn:iso:15118:2:2016:MsgDataTypes,maxSupportingPointsSAScheduleTuple */
+	uint16_t MaxSupportingPoints ;
+	unsigned int MaxSupportingPoints_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVEnergyTransferParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVEnergyTransferParameterType',  base type name='anyType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVEnergyTransferParameterType EVEnergyTransferParameter ;
+	unsigned int EVEnergyTransferParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":AC_EVChargeParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVChargeParameterType',  base type name='EVEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage))',  derivedBy='EXTENSION'.  */
+	struct iso2AC_EVChargeParameterType AC_EVChargeParameter ;
+	unsigned int AC_EVChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":AC_EVBidirectionalParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVBidirectionalParameterType',  base type name='AC_EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage)),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargeCurrent))',  derivedBy='EXTENSION'.  */
+	struct iso2AC_EVBidirectionalParameterType AC_EVBidirectionalParameter ;
+	unsigned int AC_EVBidirectionalParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":DC_EVChargeParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVChargeParameterType',  base type name='EVEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1}))',  derivedBy='EXTENSION'.  */
+	struct iso2DC_EVChargeParameterType DC_EVChargeParameter ;
+	unsigned int DC_EVChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":DC_EVBidirectionalParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVBidirectionalParameterType',  base type name='DC_EVChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='((("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1})),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargePower{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1}))',  derivedBy='EXTENSION'.  */
+	struct iso2DC_EVBidirectionalParameterType DC_EVBidirectionalParameter ;
+	unsigned int DC_EVBidirectionalParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":WPT_EVChargeParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,WPT_EVChargeParameterType',  base type name='EVEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":DepartureTime),("urn:iso:15118:2:2016:MsgDataTypes":EVMaximumPower,"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumPower,"urn:iso:15118:2:2016:MsgDataTypes":EVTargetEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVMinimumEnergyRequest{0-1}))',  derivedBy='EXTENSION'.  */
+	struct iso2WPT_EVChargeParameterType WPT_EVChargeParameter ;
+	unsigned int WPT_EVChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":MinimumPMaxRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MinimumPMaxRequestType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MinimumPMaxScheduleEntry{1-3})',  derivedBy='RESTRICTION'.  */
+	struct iso2MinimumPMaxRequestType MinimumPMaxRequest ;
+	unsigned int MinimumPMaxRequest_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorPackageListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorPackage{1-255})',  derivedBy='RESTRICTION'.  */
+#define iso2SensorPackageListType_SensorPackage_ARRAY_SIZE 5
+struct iso2SensorPackageListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorPackage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorPackageType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":PackageIndex,"urn:iso:15118:2:2016:MsgDataTypes":SensorMeasurements{1-255})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso2SensorPackageType array[iso2SensorPackageListType_SensorPackage_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SensorPackage;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ChargeLoopReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2ChargeLoopReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":DisplayParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DisplayParametersType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":CurrentRange{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingPerformance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToTargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToBulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToMinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":InletHot{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2DisplayParametersType DisplayParameters ;
+	unsigned int DisplayParameters_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,AC_BidirectionalControlReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVOperation{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower,"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgBody":EVMinimumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVPresentActivePower,"urn:iso:15118:2:2016:MsgBody":EVPresentReactivePower))',  derivedBy='EXTENSION'.  */
+struct iso2AC_BidirectionalControlReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":DisplayParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DisplayParametersType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":CurrentRange{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingPerformance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToTargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToBulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToMinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":InletHot{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2DisplayParametersType DisplayParameters ;
+	unsigned int DisplayParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVOperation, urn:iso:15118:2:2016:MsgDataTypes,EVOperationType */
+	iso2EVOperationType EVOperation ;
+	unsigned int EVOperation_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargePower ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumDischargePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumDischargePower ;
+	unsigned int EVMaximumDischargePower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumDischargeCurrent ;
+	unsigned int EVMaximumDischargeCurrent_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMinimumChargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumChargeCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMinimumDischargeCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumDischargeCurrent ;
+	unsigned int EVMinimumDischargeCurrent_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVPresentActivePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVPresentActivePower ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVPresentReactivePower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVPresentReactivePower ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MV_EVSEFinePositioningParametersType',  base type name='EVSEFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorList)',  derivedBy='EXTENSION'.  */
+struct iso2MV_EVSEFinePositioningParametersType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MagneticVectorListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MagneticVector{1-255})',  derivedBy='RESTRICTION'.  */
+	struct iso2MagneticVectorListType MagneticVectorList ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,CurrentDemandReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVTargetCurrent,"urn:iso:15118:2:2016:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2016:MsgBody":EVMaximumCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumPower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumVoltage{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2CurrentDemandReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":DisplayParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DisplayParametersType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":CurrentRange{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingPerformance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToTargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToBulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToMinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":InletHot{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2DisplayParametersType DisplayParameters ;
+	unsigned int DisplayParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetCurrent ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetVoltage ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumCurrent, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumCurrent ;
+	unsigned int EVMaximumCurrent_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumPower ;
+	unsigned int EVMaximumPower_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumVoltage, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumVoltage ;
+	unsigned int EVMaximumVoltage_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningSetupReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVFinePositioningSetupParameters{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2FinePositioningSetupReqType {
+	/* substitutionGroup */
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#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 */
+		unsigned int EVFinePositioningSetupParameters_isUsed:1;
+		unsigned int LFA_EVFinePositioningSetupParameters_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SAScheduleTupleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SAScheduleTupleID,"urn:iso:15118:2:2016:MsgDataTypes":PMaxSchedule,"urn:iso:15118:2:2016:MsgDataTypes":PMaxDischargeSchedule{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SalesTariff{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BuyBackTariff{0-1})',  derivedBy='RESTRICTION'.  */
+struct iso2SAScheduleTupleType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SAScheduleTupleID, urn:iso:15118:2:2016:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":PMaxSchedule, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PMaxScheduleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":PMaxScheduleEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso2PMaxScheduleType PMaxSchedule ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":PMaxDischargeSchedule, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PMaxScheduleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":PMaxScheduleEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso2PMaxScheduleType PMaxDischargeSchedule ;
+	unsigned int PMaxDischargeSchedule_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SalesTariff, 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'.  */
+	struct iso2SalesTariffType SalesTariff ;
+	unsigned int SalesTariff_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":BuyBackTariff, 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'.  */
+	struct iso2SalesTariffType BuyBackTariff ;
+	unsigned int BuyBackTariff_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDetailResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":ServiceID,"urn:iso:15118:2:2016:MsgBody":ServiceParameterList{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2ServiceDetailResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ServiceID, urn:iso:15118:2:2016:MsgDataTypes,serviceIDType */
+	uint16_t ServiceID ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ServiceParameterList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ServiceParameterListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSet{1-255})',  derivedBy='RESTRICTION'.  */
+	struct iso2ServiceParameterListType ServiceParameterList ;
+	unsigned int ServiceParameterList_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDeliveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ChargeProgress,"urn:iso:15118:2:2016:MsgBody":EVOperation{0-1},"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":ChargingProfile{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2PowerDeliveryReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ChargeProgress, urn:iso:15118:2:2016:MsgDataTypes,chargeProgressType */
+	iso2chargeProgressType ChargeProgress ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVOperation, urn:iso:15118:2:2016:MsgDataTypes,EVOperationType */
+	iso2EVOperationType EVOperation ;
+	unsigned int EVOperation_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID, urn:iso:15118:2:2016:MsgDataTypes,SAIDType */
+	uint8_t SAScheduleTupleID ;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":ChargingProfile, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ChargingProfileType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ProfileEntry{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct iso2ChargingProfileType ChargingProfile ;
+	unsigned int ChargingProfile_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PairingResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":PairingParameters{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2PairingResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVSEProcessing ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":PairingParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+	struct iso2ParameterSetType PairingParameters ;
+	unsigned int PairingParameters_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDemandReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVTargetPower,"urn:iso:15118:2:2016:MsgBody":EVInputPower,"urn:iso:15118:2:2016:MsgBody":PowerDemandParameters{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2PowerDemandReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":DisplayParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DisplayParametersType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":CurrentRange{0-1},"urn:iso:15118:2:2016:MsgDataTypes":CurrentSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":TargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingPerformance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToTargetSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToBulkSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":RemainingTimeToMinimumSOC{0-1},"urn:iso:15118:2:2016:MsgDataTypes":ChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BulkChargingComplete{0-1},"urn:iso:15118:2:2016:MsgDataTypes":InletHot{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2DisplayParametersType DisplayParameters ;
+	unsigned int DisplayParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVTargetPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVTargetPower ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVInputPower, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,PhysicalValueType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":Exponent,"urn:iso:15118:2:2016:MsgDataTypes":Value)',  derivedBy='RESTRICTION'.  */
+	struct iso2PhysicalValueType EVInputPower ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":PowerDemandParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,ParameterSetType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID,"urn:iso:15118:2:2016:MsgDataTypes":Parameter{1-16})',  derivedBy='RESTRICTION'.  */
+	struct iso2ParameterSetType PowerDemandParameters ;
+	unsigned int PowerDemandParameters_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentServiceSelectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":SelectedPaymentOption,"urn:iso:15118:2:2016:MsgBody":SelectedEnergyTransferService,"urn:iso:15118:2:2016:MsgBody":SelectedVASList{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2PaymentServiceSelectionReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":SelectedPaymentOption, urn:iso:15118:2:2016:MsgDataTypes,paymentOptionType */
+	iso2paymentOptionType SelectedPaymentOption ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SelectedEnergyTransferService, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SelectedServiceType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":ServiceID,"urn:iso:15118:2:2016:MsgDataTypes":ParameterSetID)',  derivedBy='RESTRICTION'.  */
+	struct iso2SelectedServiceType SelectedEnergyTransferService ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SelectedVASList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SelectedServiceListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SelectedService{1-16})',  derivedBy='RESTRICTION'.  */
+	struct iso2SelectedServiceListType SelectedVASList ;
+	unsigned int SelectedVASList_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVFinePositioningParametersType',  base type name='EVFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NumberOfSignalPackages,"urn:iso:15118:2:2016:MsgDataTypes":SensorPackageList)',  derivedBy='EXTENSION'.  */
+struct iso2LFA_EVFinePositioningParametersType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":NumberOfSignalPackages, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t NumberOfSignalPackages ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorPackageList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorPackageListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorPackage{1-255})',  derivedBy='RESTRICTION'.  */
+	struct iso2SensorPackageListType SensorPackageList ;
+};
+
+/* 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_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_ARRAY_SIZE 1
+#define iso2KeyInfoType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR
+struct iso2KeyInfoType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2KeyInfoType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[iso2KeyInfoType_KeyName_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[iso2KeyInfoType_KeyName_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} KeyName;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyValue, 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'.  */
+	struct {
+		struct iso2KeyValueType array[iso2KeyInfoType_KeyValue_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} KeyValue;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":RetrievalMethod, 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'.  */
+	struct {
+		struct iso2RetrievalMethodType array[iso2KeyInfoType_RetrievalMethod_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} RetrievalMethod;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509Data, 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'.  */
+	struct {
+		struct iso2X509DataType array[iso2KeyInfoType_X509Data_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509Data;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPData, 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'.  */
+	struct {
+		struct iso2PGPDataType array[iso2KeyInfoType_PGPData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PGPData;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SPKIData, 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'.  */
+	struct {
+		struct iso2SPKIDataType array[iso2KeyInfoType_SPKIData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SPKIData;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":MgmtData, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[iso2KeyInfoType_MgmtData_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[iso2KeyInfoType_MgmtData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} MgmtData;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[iso2KeyInfoType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVProcessing,"urn:iso:15118:2:2016:MsgDataTypes":EVFinePositioningParameters{0-1})',  derivedBy='EXTENSION'.  */
+struct iso2FinePositioningReqType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVProcessing ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVFinePositioningParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVFinePositioningParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct iso2EVFinePositioningParametersType EVFinePositioningParameters ;
+	unsigned int EVFinePositioningParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Generic_EVFinePositioningParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,Generic_EVFinePositioningParametersType',  base type name='EVFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":GenericParameters)',  derivedBy='EXTENSION'.  */
+	struct iso2Generic_EVFinePositioningParametersType Generic_EVFinePositioningParameters ;
+	unsigned int Generic_EVFinePositioningParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":LFA_EVFinePositioningParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVFinePositioningParametersType',  base type name='EVFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NumberOfSignalPackages,"urn:iso:15118:2:2016:MsgDataTypes":SensorPackageList)',  derivedBy='EXTENSION'.  */
+	struct iso2LFA_EVFinePositioningParametersType LFA_EVFinePositioningParameters ;
+	unsigned int LFA_EVFinePositioningParameters_isUsed:1;
+};
+
+/* 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_Object_ARRAY_SIZE 1
+struct iso2SignatureType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[iso2SignatureType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignedInfo, 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'.  */
+	struct iso2SignedInfoType SignedInfo ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureValue, 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'.  */
+	struct iso2SignatureValueType SignatureValue ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyInfo, 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'.  */
+	struct iso2KeyInfoType KeyInfo ;
+	unsigned int KeyInfo_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Object, 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'.  */
+	struct {
+		struct iso2ObjectType array[iso2SignatureType_Object_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Object;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningSetupResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgDataTypes":EVSEFinePositioningSetupParameters{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2FinePositioningSetupResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEFinePositioningSetupParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEFinePositioningSetupParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEFinePositioningSetupParametersType EVSEFinePositioningSetupParameters ;
+	unsigned int EVSEFinePositioningSetupParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":LFA_EVSEFinePositioningSetupParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVSEFinePositioningSetupParametersType',  base type name='EVSEFinePositioningSetupParametersType',  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,"urn:iso:15118:2:2016:MsgDataTypes":SignalFrequency)',  derivedBy='EXTENSION'.  */
+	struct iso2LFA_EVSEFinePositioningSetupParametersType LFA_EVSEFinePositioningSetupParameters ;
+	unsigned int LFA_EVSEFinePositioningSetupParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MV_EVSEFinePositioningSetupParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MV_EVSEFinePositioningSetupParametersType',  base type name='EVSEFinePositioningSetupParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":FrequencyChannel{0-1},"urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorSetupList{0-1})',  derivedBy='EXTENSION'.  */
+	struct iso2MV_EVSEFinePositioningSetupParametersType MV_EVSEFinePositioningSetupParameters ;
+	unsigned int MV_EVSEFinePositioningSetupParameters_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SAScheduleListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SAScheduleTuple{1-3})',  derivedBy='RESTRICTION'.  */
+#define iso2SAScheduleListType_SAScheduleTuple_ARRAY_SIZE 3
+struct iso2SAScheduleListType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SAScheduleTuple, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SAScheduleTupleType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SAScheduleTupleID,"urn:iso:15118:2:2016:MsgDataTypes":PMaxSchedule,"urn:iso:15118:2:2016:MsgDataTypes":PMaxDischargeSchedule{0-1},"urn:iso:15118:2:2016:MsgDataTypes":SalesTariff{0-1},"urn:iso:15118:2:2016:MsgDataTypes":BuyBackTariff{0-1})',  derivedBy='RESTRICTION'.  */
+	struct {
+		struct iso2SAScheduleTupleType array[iso2SAScheduleListType_SAScheduleTuple_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SAScheduleTuple;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVSEFinePositioningParametersType',  base type name='EVSEFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NumberOfSignalPackages,"urn:iso:15118:2:2016:MsgDataTypes":SensorPackageList)',  derivedBy='EXTENSION'.  */
+struct iso2LFA_EVSEFinePositioningParametersType {
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":NumberOfSignalPackages, http://www.w3.org/2001/XMLSchema,unsignedByte */
+	uint8_t NumberOfSignalPackages ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":SensorPackageList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SensorPackageListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SensorPackage{1-255})',  derivedBy='RESTRICTION'.  */
+	struct iso2SensorPackageListType SensorPackageList ;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgHeader,MessageHeaderType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgHeader":SessionID,"http://www.w3.org/2000/09/xmldsig#":Signature{0-1})',  derivedBy='RESTRICTION'.  */
+#define iso2MessageHeaderType_SessionID_BYTES_SIZE 8 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,sessionIDType is 8 */
+struct iso2MessageHeaderType {
+	/* element: "urn:iso:15118:2:2016:MsgHeader":SessionID, urn:iso:15118:2:2016:MsgDataTypes,sessionIDType */
+	struct {
+		uint8_t bytes[iso2MessageHeaderType_SessionID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SessionID ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Signature, 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'.  */
+	struct iso2SignatureType Signature ;
+	unsigned int Signature_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgDataTypes":EVSEFinePositioningParameters{0-1}))',  derivedBy='EXTENSION'.  */
+struct iso2FinePositioningResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVSEProcessing ;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEFinePositioningParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEFinePositioningParametersType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEFinePositioningParametersType EVSEFinePositioningParameters ;
+	unsigned int EVSEFinePositioningParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":Generic_EVSEFinePositioningParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,Generic_EVSEFinePositioningParametersType',  base type name='EVSEFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":GenericParameters)',  derivedBy='EXTENSION'.  */
+	struct iso2Generic_EVSEFinePositioningParametersType Generic_EVSEFinePositioningParameters ;
+	unsigned int Generic_EVSEFinePositioningParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":LFA_EVSEFinePositioningParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,LFA_EVSEFinePositioningParametersType',  base type name='EVSEFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NumberOfSignalPackages,"urn:iso:15118:2:2016:MsgDataTypes":SensorPackageList)',  derivedBy='EXTENSION'.  */
+	struct iso2LFA_EVSEFinePositioningParametersType LFA_EVSEFinePositioningParameters ;
+	unsigned int LFA_EVSEFinePositioningParameters_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":MV_EVSEFinePositioningParameters, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,MV_EVSEFinePositioningParametersType',  base type name='EVSEFinePositioningParametersType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":MagneticVectorList)',  derivedBy='EXTENSION'.  */
+	struct iso2MV_EVSEFinePositioningParametersType MV_EVSEFinePositioningParameters ;
+	unsigned int MV_EVSEFinePositioningParameters_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,ChargeParameterDiscoveryResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":SAScheduleList{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyTransferParameter))',  derivedBy='EXTENSION'.  */
+struct iso2ChargeParameterDiscoveryResType {
+	/* element: "urn:iso:15118:2:2016:MsgBody":ResponseCode, urn:iso:15118:2:2016:MsgDataTypes,responseCodeType */
+	iso2responseCodeType ResponseCode ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEStatus, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEStatusType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":NotificationMaxDelay,"urn:iso:15118:2:2016:MsgDataTypes":EVSENotification)',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEStatusType EVSEStatus ;
+	unsigned int EVSEStatus_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgBody":EVSEProcessing, urn:iso:15118:2:2016:MsgDataTypes,EVSEProcessingType */
+	iso2EVSEProcessingType EVSEProcessing ;
+	/* element: "urn:iso:15118:2:2016:MsgBody":SAScheduleList, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,SAScheduleListType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":SAScheduleTuple{1-3})',  derivedBy='RESTRICTION'.  */
+	struct iso2SAScheduleListType SAScheduleList ;
+	unsigned int SAScheduleList_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyTransferParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,EVSEEnergyTransferParameterType',  base type name='anyType',  content type='EMPTY',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  derivedBy='RESTRICTION'.  */
+	struct iso2EVSEEnergyTransferParameterType EVSEEnergyTransferParameter ;
+	unsigned int EVSEEnergyTransferParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":AC_EVSEChargeParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVSEChargeParameterType',  base type name='EVSEEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency)',  derivedBy='EXTENSION'.  */
+	struct iso2AC_EVSEChargeParameterType AC_EVSEChargeParameter ;
+	unsigned int AC_EVSEChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":AC_EVSEBidirectionalParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,AC_EVSEBidirectionalParameterType',  base type name='AC_EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency),("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSENominalFrequency))',  derivedBy='EXTENSION'.  */
+	struct iso2AC_EVSEBidirectionalParameterType AC_EVSEBidirectionalParameter ;
+	unsigned int AC_EVSEBidirectionalParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":DC_EVSEChargeParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVSEChargeParameterType',  base type name='EVSEEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSECurrentRegulationTolerance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVSEPeakCurrentRipple,"urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyToBeDelivered{0-1})',  derivedBy='EXTENSION'.  */
+	struct iso2DC_EVSEChargeParameterType DC_EVSEChargeParameter ;
+	unsigned int DC_EVSEChargeParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":DC_EVSEBidirectionalParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,DC_EVSEBidirectionalParameterType',  base type name='DC_EVSEChargeParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumVoltage,"urn:iso:15118:2:2016:MsgDataTypes":EVSECurrentRegulationTolerance{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVSEPeakCurrentRipple,"urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyToBeDelivered{0-1}),("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargePower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumDischargeCurrent,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumDischargeCurrent))',  derivedBy='EXTENSION'.  */
+	struct iso2DC_EVSEBidirectionalParameterType DC_EVSEBidirectionalParameter ;
+	unsigned int DC_EVSEBidirectionalParameter_isUsed:1;
+	/* element: "urn:iso:15118:2:2016:MsgDataTypes":WPT_EVSEChargeParameter, Complex type name='urn:iso:15118:2:2016:MsgDataTypes,WPT_EVSEChargeParameterType',  base type name='EVSEEnergyTransferParameterType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVSEMaximumPower,"urn:iso:15118:2:2016:MsgDataTypes":EVSEMinimumPower)',  derivedBy='EXTENSION'.  */
+	struct iso2WPT_EVSEChargeParameterType WPT_EVSEChargeParameter ;
+	unsigned int WPT_EVSEChargeParameter_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgBody,BodyType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":BodyElement)',  derivedBy='RESTRICTION'.  */
+struct iso2BodyType {
+	/* substitutionGroup */
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#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'.  */
+		struct iso2BodyBaseType V2GRequest ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":DisconnectChargingDeviceReq, Complex type name='urn:iso:15118:2:2016:MsgBody,DisconnectChargingDeviceReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus)',  derivedBy='EXTENSION'.  */
+		struct iso2DisconnectChargingDeviceReqType DisconnectChargingDeviceReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":ConnectChargingDeviceReq, Complex type name='urn:iso:15118:2:2016:MsgBody,ConnectChargingDeviceReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus)',  derivedBy='EXTENSION'.  */
+		struct iso2ConnectChargingDeviceReqType ConnectChargingDeviceReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":SystemStatusReq, Complex type name='urn:iso:15118:2:2016:MsgBody,SystemStatusReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":OperationMode,"urn:iso:15118:2:2016:MsgBody":EVMechanicalChargingDeviceStatus)',  derivedBy='EXTENSION'.  */
+		struct iso2SystemStatusReqType SystemStatusReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":DC_BidirectionalControlReq, Complex type name='urn:iso:15118:2:2016:MsgBody,DC_BidirectionalControlReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVTargetCurrent,"urn:iso:15118:2:2016:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2016:MsgBody":EVMaximumVoltage,"urn:iso:15118:2:2016:MsgBody":EVMinimumVoltage,"urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargePower{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2DC_BidirectionalControlReqType DC_BidirectionalControlReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":AC_BidirectionalControlReq, Complex type name='urn:iso:15118:2:2016:MsgBody,AC_BidirectionalControlReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVOperation{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower,"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent,"urn:iso:15118:2:2016:MsgBody":EVMaximumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumChargeCurrent,"urn:iso:15118:2:2016:MsgBody":EVMinimumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVPresentActivePower,"urn:iso:15118:2:2016:MsgBody":EVPresentReactivePower))',  derivedBy='EXTENSION'.  */
+		struct iso2AC_BidirectionalControlReqType AC_BidirectionalControlReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":VehicleCheckOutReq, Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckOutReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVCheckOutStatus,"urn:iso:15118:2:2016:MsgBody":CheckOutTime)',  derivedBy='EXTENSION'.  */
+		struct iso2VehicleCheckOutReqType VehicleCheckOutReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":VehicleCheckInReq, Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckInReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVCheckInStatus,"urn:iso:15118:2:2016:MsgBody":ParkingMethod{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2VehicleCheckInReqType VehicleCheckInReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PowerDemandReq, Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDemandReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVTargetPower,"urn:iso:15118:2:2016:MsgBody":EVInputPower,"urn:iso:15118:2:2016:MsgBody":PowerDemandParameters{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2PowerDemandReqType PowerDemandReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PairingReq, Complex type name='urn:iso:15118:2:2016:MsgBody,PairingReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVProcessing,"urn:iso:15118:2:2016:MsgBody":PairingParameters{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2PairingReqType PairingReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":AlignmentCheckReq, Complex type name='urn:iso:15118:2:2016:MsgBody,AlignmentCheckReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVProcessing,"urn:iso:15118:2:2016:MsgBody":AlignmentCheckParameters{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2AlignmentCheckReqType AlignmentCheckReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":FinePositioningReq, Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVProcessing,"urn:iso:15118:2:2016:MsgDataTypes":EVFinePositioningParameters{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2FinePositioningReqType FinePositioningReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":FinePositioningSetupReq, Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningSetupReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDataTypes":EVFinePositioningSetupParameters{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2FinePositioningSetupReqType FinePositioningSetupReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":WeldingDetectionReq, Complex type name='urn:iso:15118:2:2016:MsgBody,WeldingDetectionReqType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+		struct iso2WeldingDetectionReqType WeldingDetectionReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":CurrentDemandReq, Complex type name='urn:iso:15118:2:2016:MsgBody,CurrentDemandReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVTargetCurrent,"urn:iso:15118:2:2016:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2016:MsgBody":EVMaximumCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumPower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumVoltage{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2CurrentDemandReqType CurrentDemandReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PreChargeReq, Complex type name='urn:iso:15118:2:2016:MsgBody,PreChargeReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVTargetVoltage,"urn:iso:15118:2:2016:MsgBody":EVTargetCurrent)',  derivedBy='EXTENSION'.  */
+		struct iso2PreChargeReqType PreChargeReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":CableCheckReq, Complex type name='urn:iso:15118:2:2016:MsgBody,CableCheckReqType',  base type name='BodyBaseType',  content type='EMPTY',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  derivedBy='EXTENSION'.  */
+		struct iso2CableCheckReqType CableCheckReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":ChargingStatusReq, Complex type name='urn:iso:15118:2:2016:MsgBody,ChargingStatusReqType',  base type name='ChargeLoopReqType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":EVTargetEnergyRequest,"urn:iso:15118:2:2016:MsgBody":EVMaximumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumEnergyRequest{0-1},"urn:iso:15118:2:2016:MsgBody":DisplayParameters{0-1}),("urn:iso:15118:2:2016:MsgBody":EVMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVMaximumChargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVMinimumChargeCurrent{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2ChargingStatusReqType ChargingStatusReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":CertificateInstallationReq, 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'.  */
+		struct iso2CertificateInstallationReqType CertificateInstallationReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":CertificateUpdateReq, 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'.  */
+		struct iso2CertificateUpdateReqType CertificateUpdateReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":SessionStopReq, Complex type name='urn:iso:15118:2:2016:MsgBody,SessionStopReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ChargingSession)',  derivedBy='EXTENSION'.  */
+		struct iso2SessionStopReqType SessionStopReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":MeteringReceiptReq, 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'.  */
+		struct iso2MeteringReceiptReqType MeteringReceiptReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PowerDeliveryReq, Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDeliveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ChargeProgress,"urn:iso:15118:2:2016:MsgBody":EVOperation{0-1},"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":ChargingProfile{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2PowerDeliveryReqType PowerDeliveryReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":ChargeParameterDiscoveryReq, Complex type name='urn:iso:15118:2:2016:MsgBody,ChargeParameterDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":MaxSupportingPoints{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVEnergyTransferParameter,"urn:iso:15118:2:2016:MsgBody":MinimumPMaxRequest{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2ChargeParameterDiscoveryReqType ChargeParameterDiscoveryReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":AuthorizationReq, 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'.  */
+		struct iso2AuthorizationReqType AuthorizationReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PaymentDetailsReq, Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentDetailsReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":eMAID,"urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain)',  derivedBy='EXTENSION'.  */
+		struct iso2PaymentDetailsReqType PaymentDetailsReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PaymentServiceSelectionReq, Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentServiceSelectionReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":SelectedPaymentOption,"urn:iso:15118:2:2016:MsgBody":SelectedEnergyTransferService,"urn:iso:15118:2:2016:MsgBody":SelectedVASList{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2PaymentServiceSelectionReqType PaymentServiceSelectionReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":ServiceDetailReq, Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDetailReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ServiceID)',  derivedBy='EXTENSION'.  */
+		struct iso2ServiceDetailReqType ServiceDetailReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":ServiceDiscoveryReq, Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDiscoveryReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":SupportedServiceIDs{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2ServiceDiscoveryReqType ServiceDiscoveryReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":SessionSetupReq, Complex type name='urn:iso:15118:2:2016:MsgBody,SessionSetupReqType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":EVCCID)',  derivedBy='EXTENSION'.  */
+		struct iso2SessionSetupReqType SessionSetupReq ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":V2GResponse, Complex type name='urn:iso:15118:2:2016:MsgBody,V2GResponseType',  base type name='BodyBaseType',  content type='ELEMENT',  isAbstract='true',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2V2GResponseType V2GResponse ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":DisconnectChargingDeviceRes, Complex type name='urn:iso:15118:2:2016:MsgBody,DisconnectChargingDeviceResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":EVSEElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus))',  derivedBy='EXTENSION'.  */
+		struct iso2DisconnectChargingDeviceResType DisconnectChargingDeviceRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":ConnectChargingDeviceRes, Complex type name='urn:iso:15118:2:2016:MsgBody,ConnectChargingDeviceResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":EVSEElectricalChargingDeviceStatus,"urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus))',  derivedBy='EXTENSION'.  */
+		struct iso2ConnectChargingDeviceResType ConnectChargingDeviceRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":SystemStatusRes, Complex type name='urn:iso:15118:2:2016:MsgBody,SystemStatusResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":OperationMode,"urn:iso:15118:2:2016:MsgBody":EVSEMechanicalChargingDeviceStatus))',  derivedBy='EXTENSION'.  */
+		struct iso2SystemStatusResType SystemStatusRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":DC_BidirectionalControlRes, Complex type name='urn:iso:15118:2:2016:MsgBody,DC_BidirectionalControlResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentCurrent,"urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage,"urn:iso:15118:2:2016:MsgBody":EVSEPowerLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSECurrentLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEVoltageLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEMaximumChargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumDischargePower{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumChargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumDischargeCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumVoltage{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMinimumVoltage{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2DC_BidirectionalControlResType DC_BidirectionalControlRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":AC_BidirectionalControlRes, Complex type name='urn:iso:15118:2:2016:MsgBody,AC_BidirectionalControlResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":EVSETargetPower,"urn:iso:15118:2:2016:MsgBody":EVSETargetReactivePower,"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2AC_BidirectionalControlResType AC_BidirectionalControlRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":VehicleCheckOutRes, Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckOutResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSECheckOutStatus))',  derivedBy='EXTENSION'.  */
+		struct iso2VehicleCheckOutResType VehicleCheckOutRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":VehicleCheckInRes, Complex type name='urn:iso:15118:2:2016:MsgBody,VehicleCheckInResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":VehicleSpace,"urn:iso:15118:2:2016:MsgBody":TargetOffset{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2VehicleCheckInResType VehicleCheckInRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PowerDemandRes, Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDemandResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEOutputPower,"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1},"urn:iso:15118:2:2016:MsgBody":PowerDemandParameters{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2PowerDemandResType PowerDemandRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PairingRes, Complex type name='urn:iso:15118:2:2016:MsgBody,PairingResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":PairingParameters{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2PairingResType PairingRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":AlignmentCheckRes, Complex type name='urn:iso:15118:2:2016:MsgBody,AlignmentCheckResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":AlignmentCheckParameters{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2AlignmentCheckResType AlignmentCheckRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":FinePositioningRes, Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgDataTypes":EVSEFinePositioningParameters{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2FinePositioningResType FinePositioningRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":FinePositioningSetupRes, Complex type name='urn:iso:15118:2:2016:MsgBody,FinePositioningSetupResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgDataTypes":EVSEFinePositioningSetupParameters{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2FinePositioningSetupResType FinePositioningSetupRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":WeldingDetectionRes, Complex type name='urn:iso:15118:2:2016:MsgBody,WeldingDetectionResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage))',  derivedBy='EXTENSION'.  */
+		struct iso2WeldingDetectionResType WeldingDetectionRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":CurrentDemandRes, Complex type name='urn:iso:15118:2:2016:MsgBody,CurrentDemandResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentCurrent,"urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage,"urn:iso:15118:2:2016:MsgBody":EVSEPowerLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSECurrentLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEVoltageLimitAchieved,"urn:iso:15118:2:2016:MsgBody":EVSEMaximumPower{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumCurrent{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEMaximumVoltage{0-1},"urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2CurrentDemandResType CurrentDemandRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PreChargeRes, Complex type name='urn:iso:15118:2:2016:MsgBody,PreChargeResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEPresentVoltage))',  derivedBy='EXTENSION'.  */
+		struct iso2PreChargeResType PreChargeRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":CableCheckRes, Complex type name='urn:iso:15118:2:2016:MsgBody,CableCheckResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing))',  derivedBy='EXTENSION'.  */
+		struct iso2CableCheckResType CableCheckRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":ChargingStatusRes, Complex type name='urn:iso:15118:2:2016:MsgBody,ChargingStatusResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":SAScheduleTupleID{0-1},"urn:iso:15118:2:2016:MsgBody":MeterInfo{0-1},"urn:iso:15118:2:2016:MsgBody":ReceiptRequired{0-1},"urn:iso:15118:2:2016:MsgBody":EVSETargetPower{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2ChargingStatusResType ChargingStatusRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":CertificateInstallationRes, Complex type name='urn:iso:15118:2:2016:MsgBody,CertificateInstallationResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":SAProvisioningCertificateChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2016:MsgBody":DHpublickey,"urn:iso:15118:2:2016:MsgBody":eMAID))',  derivedBy='EXTENSION'.  */
+		struct iso2CertificateInstallationResType CertificateInstallationRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":CertificateUpdateRes, Complex type name='urn:iso:15118:2:2016:MsgBody,CertificateUpdateResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":SAProvisioningCertificateChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureCertChain,"urn:iso:15118:2:2016:MsgBody":ContractSignatureEncryptedPrivateKey,"urn:iso:15118:2:2016:MsgBody":DHpublickey,"urn:iso:15118:2:2016:MsgBody":eMAID,"urn:iso:15118:2:2016:MsgBody":RetryCounter{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2CertificateUpdateResType CertificateUpdateRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":SessionStopRes, Complex type name='urn:iso:15118:2:2016:MsgBody,SessionStopResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2SessionStopResType SessionStopRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":MeteringReceiptRes, Complex type name='urn:iso:15118:2:2016:MsgBody,MeteringReceiptResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2MeteringReceiptResType MeteringReceiptRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PowerDeliveryRes, Complex type name='urn:iso:15118:2:2016:MsgBody,PowerDeliveryResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing))',  derivedBy='EXTENSION'.  */
+		struct iso2PowerDeliveryResType PowerDeliveryRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":ChargeParameterDiscoveryRes, Complex type name='urn:iso:15118:2:2016:MsgBody,ChargeParameterDiscoveryResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing,"urn:iso:15118:2:2016:MsgBody":SAScheduleList{0-1},"urn:iso:15118:2:2016:MsgDataTypes":EVSEEnergyTransferParameter))',  derivedBy='EXTENSION'.  */
+		struct iso2ChargeParameterDiscoveryResType ChargeParameterDiscoveryRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":AuthorizationRes, Complex type name='urn:iso:15118:2:2016:MsgBody,AuthorizationResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEProcessing))',  derivedBy='EXTENSION'.  */
+		struct iso2AuthorizationResType AuthorizationRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PaymentDetailsRes, Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentDetailsResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":GenChallenge,"urn:iso:15118:2:2016:MsgBody":EVSETimeStamp))',  derivedBy='EXTENSION'.  */
+		struct iso2PaymentDetailsResType PaymentDetailsRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":PaymentServiceSelectionRes, Complex type name='urn:iso:15118:2:2016:MsgBody,PaymentServiceSelectionResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1})',  derivedBy='EXTENSION'.  */
+		struct iso2PaymentServiceSelectionResType PaymentServiceSelectionRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":ServiceDetailRes, Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDetailResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":ServiceID,"urn:iso:15118:2:2016:MsgBody":ServiceParameterList{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2ServiceDetailResType ServiceDetailRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":ServiceDiscoveryRes, Complex type name='urn:iso:15118:2:2016:MsgBody,ServiceDiscoveryResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":PaymentOptionList,"urn:iso:15118:2:2016:MsgBody":EnergyTransferServiceList,"urn:iso:15118:2:2016:MsgBody":VASList{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2ServiceDiscoveryResType ServiceDiscoveryRes ;
+		/* element: "urn:iso:15118:2:2016:MsgBody":SessionSetupRes, Complex type name='urn:iso:15118:2:2016:MsgBody,SessionSetupResType',  base type name='V2GResponseType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='(("urn:iso:15118:2:2016:MsgBody":ResponseCode,"urn:iso:15118:2:2016:MsgBody":EVSEStatus{0-1}),("urn:iso:15118:2:2016:MsgBody":EVSEID,"urn:iso:15118:2:2016:MsgBody":EVSETimeStamp{0-1}))',  derivedBy='EXTENSION'.  */
+		struct iso2SessionSetupResType SessionSetupRes ;
+#if 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;
+		unsigned int ConnectChargingDeviceReq_isUsed:1;
+		unsigned int SystemStatusReq_isUsed:1;
+		unsigned int DC_BidirectionalControlReq_isUsed:1;
+		unsigned int AC_BidirectionalControlReq_isUsed:1;
+		unsigned int VehicleCheckOutReq_isUsed:1;
+		unsigned int VehicleCheckInReq_isUsed:1;
+		unsigned int PowerDemandReq_isUsed:1;
+		unsigned int PairingReq_isUsed:1;
+		unsigned int AlignmentCheckReq_isUsed:1;
+		unsigned int FinePositioningReq_isUsed:1;
+		unsigned int FinePositioningSetupReq_isUsed:1;
+		unsigned int WeldingDetectionReq_isUsed:1;
+		unsigned int CurrentDemandReq_isUsed:1;
+		unsigned int PreChargeReq_isUsed:1;
+		unsigned int CableCheckReq_isUsed:1;
+		unsigned int ChargingStatusReq_isUsed:1;
+		unsigned int CertificateInstallationReq_isUsed:1;
+		unsigned int CertificateUpdateReq_isUsed:1;
+		unsigned int SessionStopReq_isUsed:1;
+		unsigned int MeteringReceiptReq_isUsed:1;
+		unsigned int PowerDeliveryReq_isUsed:1;
+		unsigned int ChargeParameterDiscoveryReq_isUsed:1;
+		unsigned int AuthorizationReq_isUsed:1;
+		unsigned int PaymentDetailsReq_isUsed:1;
+		unsigned int PaymentServiceSelectionReq_isUsed:1;
+		unsigned int ServiceDetailReq_isUsed:1;
+		unsigned int ServiceDiscoveryReq_isUsed:1;
+		unsigned int SessionSetupReq_isUsed:1;
+		unsigned int V2GResponse_isUsed:1;
+		unsigned int DisconnectChargingDeviceRes_isUsed:1;
+		unsigned int ConnectChargingDeviceRes_isUsed:1;
+		unsigned int SystemStatusRes_isUsed:1;
+		unsigned int DC_BidirectionalControlRes_isUsed:1;
+		unsigned int AC_BidirectionalControlRes_isUsed:1;
+		unsigned int VehicleCheckOutRes_isUsed:1;
+		unsigned int VehicleCheckInRes_isUsed:1;
+		unsigned int PowerDemandRes_isUsed:1;
+		unsigned int PairingRes_isUsed:1;
+		unsigned int AlignmentCheckRes_isUsed:1;
+		unsigned int FinePositioningRes_isUsed:1;
+		unsigned int FinePositioningSetupRes_isUsed:1;
+		unsigned int WeldingDetectionRes_isUsed:1;
+		unsigned int CurrentDemandRes_isUsed:1;
+		unsigned int PreChargeRes_isUsed:1;
+		unsigned int CableCheckRes_isUsed:1;
+		unsigned int ChargingStatusRes_isUsed:1;
+		unsigned int CertificateInstallationRes_isUsed:1;
+		unsigned int CertificateUpdateRes_isUsed:1;
+		unsigned int SessionStopRes_isUsed:1;
+		unsigned int MeteringReceiptRes_isUsed:1;
+		unsigned int PowerDeliveryRes_isUsed:1;
+		unsigned int ChargeParameterDiscoveryRes_isUsed:1;
+		unsigned int AuthorizationRes_isUsed:1;
+		unsigned int PaymentDetailsRes_isUsed:1;
+		unsigned int PaymentServiceSelectionRes_isUsed:1;
+		unsigned int ServiceDetailRes_isUsed:1;
+		unsigned int ServiceDiscoveryRes_isUsed:1;
+		unsigned int SessionSetupRes_isUsed:1;
+};
+
+/* Complex type name='urn:iso:15118:2:2016:MsgDef,#AnonType_V2G_Message',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgDef":Header,"urn:iso:15118:2:2016:MsgDef":Body)',  derivedBy='RESTRICTION'.  */
+struct iso2AnonType_V2G_Message {
+	/* element: "urn:iso:15118:2:2016:MsgDef":Header, Complex type name='urn:iso:15118:2:2016:MsgHeader,MessageHeaderType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgHeader":SessionID,"http://www.w3.org/2000/09/xmldsig#":Signature{0-1})',  derivedBy='RESTRICTION'.  */
+	struct iso2MessageHeaderType Header ;
+	/* element: "urn:iso:15118:2:2016:MsgDef":Body, Complex type name='urn:iso:15118:2:2016:MsgBody,BodyType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("urn:iso:15118:2:2016:MsgBody":BodyElement)',  derivedBy='RESTRICTION'.  */
+	struct iso2BodyType Body ;
+};
+
+
+
+#define iso2EXIDocument_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2EXIDocument_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2EXIDocument_DigestValue_BYTES_SIZE 350
+#define iso2EXIFragment_stringValue_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2EXIFragment_PgenCounter_BYTES_SIZE 350
+#define iso2EXIFragment_SalesTariffDescription_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,tariffDescriptionType is 32 */
+#define iso2EXIFragment_SessionID_BYTES_SIZE 8 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,sessionIDType is 8 */
+#define iso2EXIFragment_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2EXIFragment_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2EXIFragment_OEMProvisioningCert_BYTES_SIZE 800 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,certificateType is 800 */
+#define iso2EXIFragment_P_BYTES_SIZE 350
+#define iso2EXIFragment_Q_BYTES_SIZE 350
+#define iso2EXIFragment_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2EXIFragment_G_BYTES_SIZE 350
+#define iso2EXIFragment_J_BYTES_SIZE 350
+#define iso2EXIFragment_Y_BYTES_SIZE 350
+#define iso2EXIFragment_DigestValue_BYTES_SIZE 350
+#define iso2EXIFragment_EVCCID_BYTES_SIZE 6 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,evccIDType is 6 */
+#define iso2EXIFragment_PGPKeyID_BYTES_SIZE 350
+#define iso2EXIFragment_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2EXIFragment_X509SKI_BYTES_SIZE 350
+#define iso2EXIFragment_Certificate_BYTES_SIZE 800 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,certificateType is 800 */
+#define iso2EXIFragment_Modulus_BYTES_SIZE 350
+#define iso2EXIFragment_SigMeterReading_BYTES_SIZE 64 /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,sigMeterReadingType is 64 */
+#define iso2EXIFragment_Exponent_BYTES_SIZE 350
+#define iso2EXIFragment_PGPKeyPacket_BYTES_SIZE 350
+#define iso2EXIFragment_Seed_BYTES_SIZE 350
+#define iso2EXIFragment_MeterID_CHARACTERS_SIZE 32 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,meterIDType is 32 */
+#define iso2EXIFragment_X509CRL_BYTES_SIZE 350
+#define iso2EXIFragment_SPKISexp_BYTES_SIZE 350
+#define iso2EXIFragment_X509Certificate_BYTES_SIZE 350
+#define iso2EXIFragment_EVSEID_CHARACTERS_SIZE 37 + EXTRA_CHAR /* XML schema facet maxLength for urn:iso:15118:2:2016:MsgDataTypes,evseIDType is 37 */
+#define iso2EXIFragment_GenChallenge_BYTES_SIZE 16 /* XML schema facet length for urn:iso:15118:2:2016:MsgDataTypes,genChallengeType is 16 */
+#define iso2EXIFragment_GAID_CHARACTERS_SIZE 50 + EXTRA_CHAR
+#define iso2EXIFragment_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR
+
+
+/* Global elements of EXI Document */
+struct iso2EXIDocument {
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	struct iso2AnonType_V2G_Message V2G_Message ;
+	struct iso2ServiceDiscoveryReqType ServiceDiscoveryReq ;
+	struct iso2ServiceDiscoveryResType ServiceDiscoveryRes ;
+	struct iso2FinePositioningReqType FinePositioningReq ;
+	struct iso2FinePositioningResType FinePositioningRes ;
+	struct iso2DisconnectChargingDeviceReqType DisconnectChargingDeviceReq ;
+	struct iso2DisconnectChargingDeviceResType DisconnectChargingDeviceRes ;
+	struct iso2PowerDemandReqType PowerDemandReq ;
+	struct iso2MeteringReceiptReqType MeteringReceiptReq ;
+	struct iso2PaymentDetailsReqType PaymentDetailsReq ;
+	struct iso2PowerDemandResType PowerDemandRes ;
+	struct iso2MeteringReceiptResType MeteringReceiptRes ;
+	struct iso2PaymentDetailsResType PaymentDetailsRes ;
+	struct iso2SessionSetupReqType SessionSetupReq ;
+	struct iso2SessionSetupResType SessionSetupRes ;
+	struct iso2CableCheckReqType CableCheckReq ;
+	struct iso2CableCheckResType CableCheckRes ;
+	struct iso2CertificateInstallationReqType CertificateInstallationReq ;
+	struct iso2CertificateInstallationResType CertificateInstallationRes ;
+	struct iso2SystemStatusReqType SystemStatusReq ;
+	struct iso2SystemStatusResType SystemStatusRes ;
+	struct iso2PairingReqType PairingReq ;
+	struct iso2WeldingDetectionReqType WeldingDetectionReq ;
+	struct iso2ConnectChargingDeviceReqType ConnectChargingDeviceReq ;
+	struct iso2PairingResType PairingRes ;
+	struct iso2WeldingDetectionResType WeldingDetectionRes ;
+	struct iso2ConnectChargingDeviceResType ConnectChargingDeviceRes ;
+	struct iso2CertificateUpdateReqType CertificateUpdateReq ;
+	struct iso2CertificateUpdateResType CertificateUpdateRes ;
+	struct iso2PaymentServiceSelectionReqType PaymentServiceSelectionReq ;
+	struct iso2PowerDeliveryReqType PowerDeliveryReq ;
+	struct iso2PaymentServiceSelectionResType PaymentServiceSelectionRes ;
+	struct iso2PowerDeliveryResType PowerDeliveryRes ;
+	struct iso2ChargingStatusReqType ChargingStatusReq ;
+	struct iso2ChargingStatusResType ChargingStatusRes ;
+	struct iso2BodyBaseType BodyElement ;
+	struct iso2AC_BidirectionalControlReqType AC_BidirectionalControlReq ;
+	struct iso2AC_BidirectionalControlResType AC_BidirectionalControlRes ;
+	struct iso2VehicleCheckInReqType VehicleCheckInReq ;
+	struct iso2CurrentDemandReqType CurrentDemandReq ;
+	struct iso2VehicleCheckInResType VehicleCheckInRes ;
+	struct iso2PreChargeReqType PreChargeReq ;
+	struct iso2CurrentDemandResType CurrentDemandRes ;
+	struct iso2PreChargeResType PreChargeRes ;
+	struct iso2AlignmentCheckReqType AlignmentCheckReq ;
+	struct iso2BodyBaseType V2GRequest ;
+	struct iso2SessionStopReqType SessionStopReq ;
+	struct iso2AuthorizationReqType AuthorizationReq ;
+	struct iso2AlignmentCheckResType AlignmentCheckRes ;
+	struct iso2SessionStopResType SessionStopRes ;
+	struct iso2AuthorizationResType AuthorizationRes ;
+	struct iso2VehicleCheckOutReqType VehicleCheckOutReq ;
+	struct iso2ChargeParameterDiscoveryReqType ChargeParameterDiscoveryReq ;
+	struct iso2VehicleCheckOutResType VehicleCheckOutRes ;
+	struct iso2ChargeParameterDiscoveryResType ChargeParameterDiscoveryRes ;
+	struct iso2V2GResponseType V2GResponse ;
+	struct iso2FinePositioningSetupReqType FinePositioningSetupReq ;
+	struct iso2FinePositioningSetupResType FinePositioningSetupRes ;
+	struct iso2ServiceDetailReqType ServiceDetailReq ;
+	struct iso2DC_BidirectionalControlReqType DC_BidirectionalControlReq ;
+	struct iso2ServiceDetailResType ServiceDetailRes ;
+	struct iso2DC_BidirectionalControlResType DC_BidirectionalControlRes ;
+	struct iso2LFA_EVFinePositioningSetupParametersType LFA_EVFinePositioningSetupParameters ;
+	struct iso2MV_EVSEFinePositioningParametersType MV_EVSEFinePositioningParameters ;
+	struct iso2RelativeTimeIntervalType RelativeTimeInterval ;
+	struct iso2SalesTariffEntryType SalesTariffEntry ;
+	struct iso2LFA_EVSEFinePositioningSetupParametersType LFA_EVSEFinePositioningSetupParameters ;
+	struct iso2AC_EVChargeParameterType AC_EVChargeParameter ;
+	struct iso2MV_EVSEFinePositioningSetupParametersType MV_EVSEFinePositioningSetupParameters ;
+	struct iso2EVEnergyTransferParameterType EVEnergyTransferParameter ;
+	struct iso2DC_EVSEBidirectionalParameterType DC_EVSEBidirectionalParameter ;
+	struct iso2SAScheduleListType SAScheduleList ;
+	struct iso2EVSEFinePositioningSetupParametersType EVSEFinePositioningSetupParameters ;
+	struct iso2Generic_EVSEFinePositioningParametersType Generic_EVSEFinePositioningParameters ;
+	struct iso2DC_EVChargeParameterType DC_EVChargeParameter ;
+	struct iso2DC_EVSEChargeParameterType DC_EVSEChargeParameter ;
+	struct iso2LFA_EVFinePositioningParametersType LFA_EVFinePositioningParameters ;
+	struct iso2EVFinePositioningSetupParametersType EVFinePositioningSetupParameters ;
+	struct iso2AC_EVSEBidirectionalParameterType AC_EVSEBidirectionalParameter ;
+	struct iso2EVFinePositioningParametersType EVFinePositioningParameters ;
+	struct iso2WPT_EVChargeParameterType WPT_EVChargeParameter ;
+	struct iso2LFA_EVSEFinePositioningParametersType LFA_EVSEFinePositioningParameters ;
+	struct iso2EVSEEnergyTransferParameterType EVSEEnergyTransferParameter ;
+	struct iso2AC_EVBidirectionalParameterType AC_EVBidirectionalParameter ;
+	struct iso2EVSEFinePositioningParametersType EVSEFinePositioningParameters ;
+	struct iso2WPT_EVSEChargeParameterType WPT_EVSEChargeParameter ;
+	struct iso2AC_EVSEChargeParameterType AC_EVSEChargeParameter ;
+	struct iso2PMaxScheduleEntryType PMaxScheduleEntry ;
+	struct iso2Generic_EVFinePositioningParametersType Generic_EVFinePositioningParameters ;
+	struct iso2DC_EVBidirectionalParameterType DC_EVBidirectionalParameter ;
+	struct iso2SignaturePropertyType SignatureProperty ;
+	struct iso2DSAKeyValueType DSAKeyValue ;
+	struct iso2SignaturePropertiesType SignatureProperties ;
+	struct iso2KeyValueType KeyValue ;
+	struct iso2TransformsType Transforms ;
+	struct iso2DigestMethodType DigestMethod ;
+	struct iso2SignatureType Signature ;
+	struct iso2RetrievalMethodType RetrievalMethod ;
+	struct iso2ManifestType Manifest ;
+	struct iso2ReferenceType Reference ;
+	struct iso2CanonicalizationMethodType CanonicalizationMethod ;
+	struct iso2RSAKeyValueType RSAKeyValue ;
+	struct iso2TransformType Transform ;
+	struct iso2PGPDataType PGPData ;
+	struct {
+		exi_string_character_t characters[iso2EXIDocument_MgmtData_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MgmtData ;
+	struct iso2SignatureMethodType SignatureMethod ;
+	struct iso2KeyInfoType KeyInfo ;
+	struct iso2SPKIDataType SPKIData ;
+	struct iso2X509DataType X509Data ;
+	struct iso2SignatureValueType SignatureValue ;
+	struct {
+		exi_string_character_t characters[iso2EXIDocument_KeyName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  KeyName ;
+	struct {
+		uint8_t bytes[iso2EXIDocument_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+	struct iso2SignedInfoType SignedInfo ;
+	struct iso2ObjectType Object ;
+#if 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;
+	unsigned int FinePositioningReq_isUsed:1;
+	unsigned int FinePositioningRes_isUsed:1;
+	unsigned int DisconnectChargingDeviceReq_isUsed:1;
+	unsigned int DisconnectChargingDeviceRes_isUsed:1;
+	unsigned int PowerDemandReq_isUsed:1;
+	unsigned int MeteringReceiptReq_isUsed:1;
+	unsigned int PaymentDetailsReq_isUsed:1;
+	unsigned int PowerDemandRes_isUsed:1;
+	unsigned int MeteringReceiptRes_isUsed:1;
+	unsigned int PaymentDetailsRes_isUsed:1;
+	unsigned int SessionSetupReq_isUsed:1;
+	unsigned int SessionSetupRes_isUsed:1;
+	unsigned int CableCheckReq_isUsed:1;
+	unsigned int CableCheckRes_isUsed:1;
+	unsigned int CertificateInstallationReq_isUsed:1;
+	unsigned int CertificateInstallationRes_isUsed:1;
+	unsigned int SystemStatusReq_isUsed:1;
+	unsigned int SystemStatusRes_isUsed:1;
+	unsigned int PairingReq_isUsed:1;
+	unsigned int WeldingDetectionReq_isUsed:1;
+	unsigned int ConnectChargingDeviceReq_isUsed:1;
+	unsigned int PairingRes_isUsed:1;
+	unsigned int WeldingDetectionRes_isUsed:1;
+	unsigned int ConnectChargingDeviceRes_isUsed:1;
+	unsigned int CertificateUpdateReq_isUsed:1;
+	unsigned int CertificateUpdateRes_isUsed:1;
+	unsigned int PaymentServiceSelectionReq_isUsed:1;
+	unsigned int PowerDeliveryReq_isUsed:1;
+	unsigned int PaymentServiceSelectionRes_isUsed:1;
+	unsigned int PowerDeliveryRes_isUsed:1;
+	unsigned int ChargingStatusReq_isUsed:1;
+	unsigned int ChargingStatusRes_isUsed:1;
+	unsigned int BodyElement_isUsed:1;
+	unsigned int AC_BidirectionalControlReq_isUsed:1;
+	unsigned int AC_BidirectionalControlRes_isUsed:1;
+	unsigned int VehicleCheckInReq_isUsed:1;
+	unsigned int CurrentDemandReq_isUsed:1;
+	unsigned int VehicleCheckInRes_isUsed:1;
+	unsigned int PreChargeReq_isUsed:1;
+	unsigned int CurrentDemandRes_isUsed:1;
+	unsigned int PreChargeRes_isUsed:1;
+	unsigned int AlignmentCheckReq_isUsed:1;
+	unsigned int V2GRequest_isUsed:1;
+	unsigned int SessionStopReq_isUsed:1;
+	unsigned int AuthorizationReq_isUsed:1;
+	unsigned int AlignmentCheckRes_isUsed:1;
+	unsigned int SessionStopRes_isUsed:1;
+	unsigned int AuthorizationRes_isUsed:1;
+	unsigned int VehicleCheckOutReq_isUsed:1;
+	unsigned int ChargeParameterDiscoveryReq_isUsed:1;
+	unsigned int VehicleCheckOutRes_isUsed:1;
+	unsigned int ChargeParameterDiscoveryRes_isUsed:1;
+	unsigned int V2GResponse_isUsed:1;
+	unsigned int FinePositioningSetupReq_isUsed:1;
+	unsigned int FinePositioningSetupRes_isUsed:1;
+	unsigned int ServiceDetailReq_isUsed:1;
+	unsigned int DC_BidirectionalControlReq_isUsed:1;
+	unsigned int ServiceDetailRes_isUsed:1;
+	unsigned int DC_BidirectionalControlRes_isUsed:1;
+	unsigned int LFA_EVFinePositioningSetupParameters_isUsed:1;
+	unsigned int MV_EVSEFinePositioningParameters_isUsed:1;
+	unsigned int RelativeTimeInterval_isUsed:1;
+	unsigned int SalesTariffEntry_isUsed:1;
+	unsigned int LFA_EVSEFinePositioningSetupParameters_isUsed:1;
+	unsigned int AC_EVChargeParameter_isUsed:1;
+	unsigned int MV_EVSEFinePositioningSetupParameters_isUsed:1;
+	unsigned int EVEnergyTransferParameter_isUsed:1;
+	unsigned int DC_EVSEBidirectionalParameter_isUsed:1;
+	unsigned int SAScheduleList_isUsed:1;
+	unsigned int EVSEFinePositioningSetupParameters_isUsed:1;
+	unsigned int Generic_EVSEFinePositioningParameters_isUsed:1;
+	unsigned int DC_EVChargeParameter_isUsed:1;
+	unsigned int DC_EVSEChargeParameter_isUsed:1;
+	unsigned int LFA_EVFinePositioningParameters_isUsed:1;
+	unsigned int EVFinePositioningSetupParameters_isUsed:1;
+	unsigned int AC_EVSEBidirectionalParameter_isUsed:1;
+	unsigned int EVFinePositioningParameters_isUsed:1;
+	unsigned int WPT_EVChargeParameter_isUsed:1;
+	unsigned int LFA_EVSEFinePositioningParameters_isUsed:1;
+	unsigned int EVSEEnergyTransferParameter_isUsed:1;
+	unsigned int AC_EVBidirectionalParameter_isUsed:1;
+	unsigned int EVSEFinePositioningParameters_isUsed:1;
+	unsigned int WPT_EVSEChargeParameter_isUsed:1;
+	unsigned int AC_EVSEChargeParameter_isUsed:1;
+	unsigned int PMaxScheduleEntry_isUsed:1;
+	unsigned int Generic_EVFinePositioningParameters_isUsed:1;
+	unsigned int DC_EVBidirectionalParameter_isUsed:1;
+	unsigned int SignatureProperty_isUsed:1;
+	unsigned int DSAKeyValue_isUsed:1;
+	unsigned int SignatureProperties_isUsed:1;
+	unsigned int KeyValue_isUsed:1;
+	unsigned int Transforms_isUsed:1;
+	unsigned int DigestMethod_isUsed:1;
+	unsigned int Signature_isUsed:1;
+	unsigned int RetrievalMethod_isUsed:1;
+	unsigned int Manifest_isUsed:1;
+	unsigned int Reference_isUsed:1;
+	unsigned int CanonicalizationMethod_isUsed:1;
+	unsigned int RSAKeyValue_isUsed:1;
+	unsigned int Transform_isUsed:1;
+	unsigned int PGPData_isUsed:1;
+	unsigned int MgmtData_isUsed:1;
+	unsigned int SignatureMethod_isUsed:1;
+	unsigned int KeyInfo_isUsed:1;
+	unsigned int SPKIData_isUsed:1;
+	unsigned int X509Data_isUsed:1;
+	unsigned int SignatureValue_isUsed:1;
+	unsigned int KeyName_isUsed:1;
+	unsigned int DigestValue_isUsed:1;
+	unsigned int SignedInfo_isUsed:1;
+	unsigned int Object_isUsed:1;
+
+
+	int _warning_;
+};
+
+
+#if DEPLOY_ISO2_CODEC_FRAGMENT == SUPPORT_YES
+/* Possible elements of EXI Fragment */
+struct iso2EXIFragment {
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */
+	struct iso2PhysicalValueType EVMaximumVoltage ;
+	uint32_t FrequencyChannel ;
+	iso2EVSEProcessingType EVProcessing ;
+	int BulkChargingComplete ;
+	iso2parkingMethodType ParkingMethod ;
+	uint8_t SAScheduleTupleID ;
+	uint16_t Distance ;
+	struct iso2ParameterSetType ParameterSet ;
+	struct iso2PhysicalValueType EVMinimumDischargeCurrent ;
+	uint8_t SignalSeparationTime ;
+	struct iso2EVSEEnergyTransferParameterType EVSEEnergyTransferParameter ;
+	struct iso2PhysicalValueType EVSEMaximumVoltage ;
+	struct iso2DC_EVSEBidirectionalParameterType DC_EVSEBidirectionalParameter ;
+	iso2chargingSessionType ChargingSession ;
+	struct iso2SubCertificatesType SubCertificates ;
+	struct iso2RetrievalMethodType RetrievalMethod ;
+	struct iso2MagneticVectorSetupListType MagneticVectorSetupList ;
+	struct iso2ParameterSetType PairingParameters ;
+	struct iso2PhysicalValueType EVSEMinimumPower ;
+	struct iso2AC_BidirectionalControlReqType AC_BidirectionalControlReq ;
+	struct iso2CostType Cost ;
+	struct iso2AC_BidirectionalControlResType AC_BidirectionalControlRes ;
+	struct iso2SalesTariffType BuyBackTariff ;
+	int16_t XCoordinate ;
+	iso2EVCheckOutStatusType EVSECheckOutStatus ;
+	struct {
+		exi_string_character_t characters[iso2EXIFragment_stringValue_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  stringValue ;
+	int16_t RetryCounter ;
+	struct iso2PhysicalValueType EVSEMaximumDischargeCurrent ;
+	struct iso2SensorType Sensor ;
+	uint64_t MeterReadingCharged ;
+	int64_t HMACOutputLength ;
+	struct iso2V2GResponseType V2GResponse ;
+	struct iso2PhysicalValueType EVMinimumVoltage ;
+	struct iso2PhysicalValueType EVMinimumEnergyRequest ;
+	struct iso2RelativeTimeIntervalType RelativeTimeInterval ;
+	struct iso2WPT_EVChargeParameterType WPT_EVChargeParameter ;
+	struct iso2SAScheduleTupleType SAScheduleTuple ;
+	uint16_t ServiceID ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_PgenCounter_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PgenCounter ;
+	struct {
+		exi_string_character_t characters[iso2EXIFragment_SalesTariffDescription_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  SalesTariffDescription ;
+	struct iso2PhysicalValueType AngleGAtoVA ;
+	int boolValue ;
+	struct iso2PhysicalValueType EVMaximumDischargeCurrent ;
+	uint16_t NotificationMaxDelay ;
+	struct iso2PhysicalValueType EVSEMaximumDischargePower ;
+	struct iso2PGPDataType PGPData ;
+	struct iso2PhysicalValueType EVSEMaximumChargePower ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_SessionID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SessionID ;
+	struct iso2PhysicalValueType EVSEEnergyToBeDelivered ;
+	struct iso2PhysicalValueType EVMaximumPower ;
+	struct iso2PhysicalValueType EVMaximumCurrent ;
+	struct iso2RSAKeyValueType RSAKeyValue ;
+	struct iso2PhysicalValueType EVSENominalVoltage ;
+	struct iso2MagneticVectorType MagneticVector ;
+	struct {
+		exi_string_character_t characters[iso2EXIFragment_XPath_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  XPath ;
+	struct iso2SignatureType Signature ;
+	iso2electricalChargingDeviceStatusType EVElectricalChargingDeviceStatus ;
+	iso2EVSEProcessingType EVSEProcessing ;
+	iso2FODStatusType FODStatus ;
+	struct iso2PowerDeliveryResType PowerDeliveryRes ;
+	struct iso2SessionStopResType SessionStopRes ;
+	struct iso2WPT_EVSEChargeParameterType WPT_EVSEChargeParameter ;
+	iso2responseCodeType ResponseCode ;
+	struct iso2PhysicalValueType EVTargetEnergyRequest ;
+	struct iso2FinePositioningSetupReqType FinePositioningSetupReq ;
+	struct iso2PhysicalValueType EVSEPresentCurrent ;
+	struct iso2FinePositioningSetupResType FinePositioningSetupRes ;
+	struct iso2PMaxScheduleEntryType ProfileEntry ;
+	struct {
+		exi_string_character_t characters[iso2EXIFragment_MgmtData_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MgmtData ;
+	struct iso2CertificateChainType SAProvisioningCertificateChain ;
+	struct iso2PowerDeliveryReqType PowerDeliveryReq ;
+	struct iso2SessionStopReqType SessionStopReq ;
+	int ReceiptRequired ;
+	struct iso2ChargingProfileType ChargingProfile ;
+	uint16_t MaxSupportingPoints ;
+	uint32_t start ;
+	struct iso2PhysicalValueType EVMinimumChargePower ;
+	struct iso2PhysicalValueType amount ;
+	struct iso2PreChargeReqType PreChargeReq ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_OEMProvisioningCert_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  OEMProvisioningCert ;
+	uint32_t PackageIndex ;
+	struct iso2PreChargeResType PreChargeRes ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_P_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  P ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_Q_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Q ;
+	struct {
+		exi_string_character_t characters[iso2EXIFragment_X509SubjectName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509SubjectName ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_G_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  G ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_J_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  J ;
+	struct iso2CertificateChainType ContractSignatureCertChain ;
+	struct iso2MV_EVSEFinePositioningSetupParametersType MV_EVSEFinePositioningSetupParameters ;
+	struct iso2PhysicalValueType EVSEMinimumDischargeCurrent ;
+	struct iso2PhysicalValueType EVMaximumChargeCurrent ;
+	uint16_t AlignmentOffset ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_Y_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Y ;
+	int8_t RemainingTimeToTargetSOC ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+	struct iso2SensorMeasurementsType SensorMeasurements ;
+	struct iso2SalesTariffType SalesTariff ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_EVCCID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  EVCCID ;
+	struct iso2PhysicalValueType EVSEMaximumPower ;
+	struct iso2TargetPositionType TargetOffset ;
+	struct iso2ParameterSetType PowerDemandParameters ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_PGPKeyID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyID ;
+	struct iso2DisconnectChargingDeviceReqType DisconnectChargingDeviceReq ;
+	struct iso2DisconnectChargingDeviceResType DisconnectChargingDeviceRes ;
+	struct iso2DSAKeyValueType DSAKeyValue ;
+	struct iso2SalesTariffEntryType SalesTariffEntry ;
+	struct iso2CertificateInstallationResType CertificateInstallationRes ;
+	struct iso2CanonicalizationMethodType CanonicalizationMethod ;
+	struct iso2Generic_EVFinePositioningParametersType Generic_EVFinePositioningParameters ;
+	struct iso2PhysicalValueType EVSEMinimumVoltage ;
+	struct iso2SystemStatusResType SystemStatusRes ;
+	struct iso2PhysicalValueType EVSEOutputPower ;
+	struct iso2SignedInfoType SignedInfo ;
+	struct iso2PhysicalValueType EVMinimumChargeCurrent ;
+	iso2costKindType costKind ;
+	struct iso2SystemStatusReqType SystemStatusReq ;
+	struct iso2CableCheckReqType CableCheckReq ;
+	uint8_t NumEPriceLevels ;
+	int EVSEVoltageLimitAchieved ;
+	uint8_t PackageSeparationTime ;
+	struct iso2CableCheckResType CableCheckRes ;
+	iso2EVCheckInStatusType EVCheckInStatus ;
+	struct iso2PMaxScheduleType PMaxDischargeSchedule ;
+	struct iso2PhysicalValueType EVMinimumPower ;
+	struct iso2PhysicalValueType ChargingPerformance ;
+	struct iso2AlignmentCheckReqType AlignmentCheckReq ;
+	iso2mechanicalChargingDeviceStatusType EVMechanicalChargingDeviceStatus ;
+	uint16_t VehicleSpace ;
+	struct iso2AlignmentCheckResType AlignmentCheckRes ;
+	struct iso2PhysicalValueType EVMinimumDischargePower ;
+	int8_t RemainingTimeToMinimumSOC ;
+	struct iso2AuthorizationResType AuthorizationRes ;
+	struct iso2CertificateInstallationReqType CertificateInstallationReq ;
+	struct iso2PaymentDetailsReqType PaymentDetailsReq ;
+	struct iso2PaymentDetailsResType PaymentDetailsRes ;
+	struct iso2AuthorizationReqType AuthorizationReq ;
+	struct iso2PhysicalValueType EVTargetCurrent ;
+	struct iso2SessionSetupReqType SessionSetupReq ;
+	struct iso2SessionSetupResType SessionSetupRes ;
+	struct iso2PhysicalValueType EVSENominalFrequency ;
+	struct iso2MessageHeaderType Header ;
+	uint8_t NumberOfSensors ;
+	int64_t EVSETimeStamp ;
+	int16_t MeterStatus ;
+	struct iso2MV_EVSEFinePositioningParametersType MV_EVSEFinePositioningParameters ;
+	iso2chargeProgressType ChargeProgress ;
+	struct {
+		exi_string_character_t characters[iso2EXIFragment_KeyName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  KeyName ;
+	struct iso2PMaxScheduleType PMaxSchedule ;
+	uint32_t duration ;
+	int8_t RemainingTimeToBulkSOC ;
+	struct iso2CartesianCoordinatesType SensorOrientation ;
+	struct iso2PhysicalValueType EVSEMaximumChargeCurrent ;
+	struct iso2LFA_EVSEFinePositioningParametersType LFA_EVSEFinePositioningParameters ;
+	struct iso2VehicleCheckInResType VehicleCheckInRes ;
+	struct iso2PMaxScheduleEntryType PMaxScheduleEntry ;
+	struct iso2SAScheduleListType SAScheduleList ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_X509SKI_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509SKI ;
+	struct iso2PaymentOptionListType PaymentOptionList ;
+	struct iso2ContractSignatureEncryptedPrivateKeyType ContractSignatureEncryptedPrivateKey ;
+	struct iso2VehicleCheckInReqType VehicleCheckInReq ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Certificate ;
+	uint64_t CheckOutTime ;
+	int8_t CurrentSOC ;
+	int16_t ZCoordinate ;
+	uint16_t MeasurementData ;
+	struct iso2PairingResType PairingRes ;
+	struct iso2PhysicalValueType EVSEMaximumCurrent ;
+	struct iso2LFA_EVFinePositioningParametersType LFA_EVFinePositioningParameters ;
+	struct iso2ParameterSetType AlignmentCheckParameters ;
+	int8_t EffectiveRadiatedPower ;
+	struct iso2PairingReqType PairingReq ;
+	int16_t Value ;
+	int8_t byteValue ;
+	struct iso2CurrentDemandReqType CurrentDemandReq ;
+	struct iso2Generic_EVSEFinePositioningParametersType Generic_EVSEFinePositioningParameters ;
+	struct iso2CurrentDemandResType CurrentDemandRes ;
+	struct iso2AC_EVBidirectionalParameterType AC_EVBidirectionalParameter ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_Modulus_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Modulus ;
+	struct iso2SelectedServiceType SelectedEnergyTransferService ;
+	struct iso2PhysicalValueType startValue ;
+	struct iso2SelectedServiceListType SelectedVASList ;
+	struct iso2ChargeParameterDiscoveryReqType ChargeParameterDiscoveryReq ;
+	struct iso2ChargeParameterDiscoveryResType ChargeParameterDiscoveryRes ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_SigMeterReading_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SigMeterReading ;
+	int8_t TargetSOC ;
+	struct iso2EVSEStatusType EVSEStatus ;
+	struct iso2PhysicalValueType EVSEMinimumChargeCurrent ;
+	iso2electricalChargingDeviceStatusType EVSEElectricalChargingDeviceStatus ;
+	int64_t X509SerialNumber ;
+	iso2paymentOptionType PaymentOption ;
+	struct iso2TransformsType Transforms ;
+	struct iso2PhysicalValueType EVSEPeakCurrentRipple ;
+	struct iso2ConsumptionCostType ConsumptionCost ;
+	struct iso2EVSEFinePositioningSetupParametersType EVSEFinePositioningSetupParameters ;
+	uint8_t EPriceLevel ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_Exponent_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Exponent ;
+	struct iso2X509IssuerSerialType X509IssuerSerial ;
+	struct iso2SPKIDataType SPKIData ;
+	struct iso2MagneticVectorListType MagneticVectorList ;
+	struct iso2EVSEFinePositioningParametersType EVSEFinePositioningParameters ;
+	struct iso2PhysicalValueType EVTargetPower ;
+	struct iso2SensorPackageListType SensorPackageList ;
+	uint32_t DepartureTime ;
+	int InletHot ;
+	struct iso2PhysicalValueType EVPresentActivePower ;
+	struct iso2X509DataType X509Data ;
+	int16_t YCoordinate ;
+	struct iso2KeyValueType KeyValue ;
+	struct iso2DisplayParametersType DisplayParameters ;
+	int EVSEPowerLimitAchieved ;
+	struct iso2BodyType Body ;
+	struct iso2DC_EVChargeParameterType DC_EVChargeParameter ;
+	struct iso2ServiceType Service ;
+	struct iso2SignaturePropertyType SignatureProperty ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_PGPKeyPacket_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyPacket ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_Seed_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Seed ;
+	struct iso2LFA_EVFinePositioningSetupParametersType LFA_EVFinePositioningSetupParameters ;
+	struct iso2MinimumPMaxRequestType MinimumPMaxRequest ;
+	struct iso2FinePositioningReqType FinePositioningReq ;
+	struct iso2ServiceListType EnergyTransferServiceList ;
+	struct iso2FinePositioningResType FinePositioningRes ;
+	struct iso2AC_EVSEBidirectionalParameterType AC_EVSEBidirectionalParameter ;
+	int FreeService ;
+	struct iso2AC_EVSEChargeParameterType AC_EVSEChargeParameter ;
+	uint8_t SensorID ;
+	struct iso2PhysicalValueType EVSECurrentRegulationTolerance ;
+	iso2mechanicalChargingDeviceStatusType EVSEMechanicalChargingDeviceStatus ;
+	struct iso2EVEnergyTransferParameterType EVEnergyTransferParameter ;
+	uint8_t SignalPulseDuration ;
+	int16_t shortValue ;
+	struct iso2ManifestType Manifest ;
+	struct iso2DC_EVSEChargeParameterType DC_EVSEChargeParameter ;
+	struct iso2MeteringReceiptReqType MeteringReceiptReq ;
+	struct {
+		exi_string_character_t characters[iso2EXIFragment_MeterID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MeterID ;
+	struct iso2MeteringReceiptResType MeteringReceiptRes ;
+	struct iso2ServiceDiscoveryReqType ServiceDiscoveryReq ;
+	uint8_t SalesTariffID ;
+	struct iso2ServiceDiscoveryResType ServiceDiscoveryRes ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_X509CRL_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509CRL ;
+	struct iso2MagneticVectorSetupType MagneticVectorSetup ;
+	struct iso2DigestMethodType DigestMethod ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_SPKISexp_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SPKISexp ;
+	uint64_t MeterReadingDischarged ;
+	struct iso2MeasurementDataListType MeasurementDataList ;
+	struct iso2SignaturePropertiesType SignatureProperties ;
+	struct iso2CartesianCoordinatesType SensorPosition ;
+	struct iso2LFA_EVSEFinePositioningSetupParametersType LFA_EVSEFinePositioningSetupParameters ;
+	struct iso2EMAIDType eMAID ;
+	struct iso2SensorPackageType SensorPackage ;
+	iso2EVCheckOutStatusType EVCheckOutStatus ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_X509Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509Certificate ;
+	struct iso2X509IssuerSerialType RootCertificateID ;
+	struct iso2DC_BidirectionalControlReqType DC_BidirectionalControlReq ;
+	struct iso2PhysicalValueType EVSEPresentVoltage ;
+	struct iso2DC_BidirectionalControlResType DC_BidirectionalControlRes ;
+	struct iso2ServiceListType VASList ;
+	struct iso2MeterInfoType MeterInfo ;
+	struct iso2PhysicalValueType EVSETargetReactivePower ;
+	struct iso2ChargingStatusReqType ChargingStatusReq ;
+	struct iso2ParameterSetType GenericParameters ;
+	struct iso2ChargingStatusResType ChargingStatusRes ;
+	struct iso2PhysicalValueType EVMaximumChargePower ;
+	int8_t BulkSOC ;
+	uint8_t NumberOfSignalPackages ;
+	uint16_t ParameterSetID ;
+	struct iso2PhysicalValueType PMax ;
+	struct iso2PhysicalValueType EVMaximumEnergyRequest ;
+	iso2EVOperationType EVOperation ;
+	struct iso2CertificateUpdateResType CertificateUpdateRes ;
+	int ChargingComplete ;
+	struct iso2ListOfRootCertificateIDsType ListOfRootCertificateIDs ;
+	struct iso2PhysicalValueType RotationVAtoGA ;
+	struct iso2PhysicalValueType EVTargetVoltage ;
+	struct iso2CertificateUpdateReqType CertificateUpdateReq ;
+	struct iso2ConnectChargingDeviceResType ConnectChargingDeviceRes ;
+	struct iso2DiffieHellmanPublickeyType DHpublickey ;
+	struct iso2ServiceParameterListType ServiceParameterList ;
+	struct iso2SignatureValueType SignatureValue ;
+	struct iso2PhysicalValueType physicalValue ;
+	iso2operationModeType OperationMode ;
+	int EVSECurrentLimitAchieved ;
+	struct iso2ServiceDetailReqType ServiceDetailReq ;
+	struct iso2ServiceDetailResType ServiceDetailRes ;
+	int32_t intValue ;
+	struct iso2PhysicalValueType EVMaximumDischargePower ;
+	int8_t MinimumSOC ;
+	iso2paymentOptionType SelectedPaymentOption ;
+	struct iso2AnonType_V2G_Message V2G_Message ;
+	struct {
+		exi_string_character_t characters[iso2EXIFragment_EVSEID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  EVSEID ;
+	int64_t TMeter ;
+	struct iso2SensorOrderListType SensorOrder ;
+	struct iso2ServiceIDListType SupportedServiceIDs ;
+	struct {
+		uint8_t bytes[iso2EXIFragment_GenChallenge_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  GenChallenge ;
+	struct iso2EVFinePositioningParametersType EVFinePositioningParameters ;
+	struct iso2SensorListType SensorList ;
+	struct iso2KeyInfoType KeyInfo ;
+	struct iso2ConnectChargingDeviceReqType ConnectChargingDeviceReq ;
+	struct iso2AC_EVChargeParameterType AC_EVChargeParameter ;
+	struct iso2ParameterType Parameter ;
+	struct iso2WeldingDetectionResType WeldingDetectionRes ;
+	struct {
+		exi_string_character_t characters[iso2EXIFragment_GAID_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  GAID ;
+	uint16_t SignalFrequency ;
+	struct iso2PhysicalValueType EVSETargetPower ;
+	struct iso2DC_EVBidirectionalParameterType DC_EVBidirectionalParameter ;
+	struct iso2SignatureMethodType SignatureMethod ;
+	struct iso2WeldingDetectionReqType WeldingDetectionReq ;
+	struct iso2SelectedServiceType SelectedService ;
+	struct iso2PhysicalValueType EVInputPower ;
+	struct iso2VehicleCheckOutReqType VehicleCheckOutReq ;
+	struct iso2PowerDemandReqType PowerDemandReq ;
+	struct iso2VehicleCheckOutResType VehicleCheckOutRes ;
+	uint16_t CurrentRange ;
+	struct iso2PhysicalValueType EVPresentReactivePower ;
+	struct {
+		exi_string_character_t characters[iso2EXIFragment_X509IssuerName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509IssuerName ;
+	struct iso2BodyBaseType V2GRequest ;
+	struct iso2ReferenceType Reference ;
+	struct iso2BodyBaseType BodyElement ;
+	struct iso2PMaxScheduleEntryType MinimumPMaxScheduleEntry ;
+	struct iso2EVFinePositioningSetupParametersType EVFinePositioningSetupParameters ;
+	iso2EVSENotificationType EVSENotification ;
+	struct iso2PaymentServiceSelectionReqType PaymentServiceSelectionReq ;
+	struct iso2PaymentServiceSelectionResType PaymentServiceSelectionRes ;
+	struct iso2TransformType Transform ;
+	struct iso2ObjectType Object ;
+	uint16_t TargetOffsetY ;
+	struct iso2PowerDemandResType PowerDemandRes ;
+	uint16_t TargetOffsetX ;
+#if 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;
+	unsigned int BulkChargingComplete_isUsed:1;
+	unsigned int ParkingMethod_isUsed:1;
+	unsigned int SAScheduleTupleID_isUsed:1;
+	unsigned int Distance_isUsed:1;
+	unsigned int ParameterSet_isUsed:1;
+	unsigned int EVMinimumDischargeCurrent_isUsed:1;
+	unsigned int SignalSeparationTime_isUsed:1;
+	unsigned int EVSEEnergyTransferParameter_isUsed:1;
+	unsigned int EVSEMaximumVoltage_isUsed:1;
+	unsigned int DC_EVSEBidirectionalParameter_isUsed:1;
+	unsigned int ChargingSession_isUsed:1;
+	unsigned int SubCertificates_isUsed:1;
+	unsigned int RetrievalMethod_isUsed:1;
+	unsigned int MagneticVectorSetupList_isUsed:1;
+	unsigned int PairingParameters_isUsed:1;
+	unsigned int EVSEMinimumPower_isUsed:1;
+	unsigned int AC_BidirectionalControlReq_isUsed:1;
+	unsigned int Cost_isUsed:1;
+	unsigned int AC_BidirectionalControlRes_isUsed:1;
+	unsigned int BuyBackTariff_isUsed:1;
+	unsigned int XCoordinate_isUsed:1;
+	unsigned int EVSECheckOutStatus_isUsed:1;
+	unsigned int stringValue_isUsed:1;
+	unsigned int RetryCounter_isUsed:1;
+	unsigned int EVSEMaximumDischargeCurrent_isUsed:1;
+	unsigned int Sensor_isUsed:1;
+	unsigned int MeterReadingCharged_isUsed:1;
+	unsigned int HMACOutputLength_isUsed:1;
+	unsigned int V2GResponse_isUsed:1;
+	unsigned int EVMinimumVoltage_isUsed:1;
+	unsigned int EVMinimumEnergyRequest_isUsed:1;
+	unsigned int RelativeTimeInterval_isUsed:1;
+	unsigned int WPT_EVChargeParameter_isUsed:1;
+	unsigned int SAScheduleTuple_isUsed:1;
+	unsigned int ServiceID_isUsed:1;
+	unsigned int PgenCounter_isUsed:1;
+	unsigned int SalesTariffDescription_isUsed:1;
+	unsigned int AngleGAtoVA_isUsed:1;
+	unsigned int boolValue_isUsed:1;
+	unsigned int EVMaximumDischargeCurrent_isUsed:1;
+	unsigned int NotificationMaxDelay_isUsed:1;
+	unsigned int EVSEMaximumDischargePower_isUsed:1;
+	unsigned int PGPData_isUsed:1;
+	unsigned int EVSEMaximumChargePower_isUsed:1;
+	unsigned int SessionID_isUsed:1;
+	unsigned int EVSEEnergyToBeDelivered_isUsed:1;
+	unsigned int EVMaximumPower_isUsed:1;
+	unsigned int EVMaximumCurrent_isUsed:1;
+	unsigned int RSAKeyValue_isUsed:1;
+	unsigned int EVSENominalVoltage_isUsed:1;
+	unsigned int MagneticVector_isUsed:1;
+	unsigned int XPath_isUsed:1;
+	unsigned int Signature_isUsed:1;
+	unsigned int EVElectricalChargingDeviceStatus_isUsed:1;
+	unsigned int EVSEProcessing_isUsed:1;
+	unsigned int FODStatus_isUsed:1;
+	unsigned int PowerDeliveryRes_isUsed:1;
+	unsigned int SessionStopRes_isUsed:1;
+	unsigned int WPT_EVSEChargeParameter_isUsed:1;
+	unsigned int ResponseCode_isUsed:1;
+	unsigned int EVTargetEnergyRequest_isUsed:1;
+	unsigned int FinePositioningSetupReq_isUsed:1;
+	unsigned int EVSEPresentCurrent_isUsed:1;
+	unsigned int FinePositioningSetupRes_isUsed:1;
+	unsigned int ProfileEntry_isUsed:1;
+	unsigned int MgmtData_isUsed:1;
+	unsigned int SAProvisioningCertificateChain_isUsed:1;
+	unsigned int PowerDeliveryReq_isUsed:1;
+	unsigned int SessionStopReq_isUsed:1;
+	unsigned int ReceiptRequired_isUsed:1;
+	unsigned int ChargingProfile_isUsed:1;
+	unsigned int MaxSupportingPoints_isUsed:1;
+	unsigned int start_isUsed:1;
+	unsigned int EVMinimumChargePower_isUsed:1;
+	unsigned int amount_isUsed:1;
+	unsigned int PreChargeReq_isUsed:1;
+	unsigned int OEMProvisioningCert_isUsed:1;
+	unsigned int PackageIndex_isUsed:1;
+	unsigned int PreChargeRes_isUsed:1;
+	unsigned int P_isUsed:1;
+	unsigned int Q_isUsed:1;
+	unsigned int X509SubjectName_isUsed:1;
+	unsigned int G_isUsed:1;
+	unsigned int J_isUsed:1;
+	unsigned int ContractSignatureCertChain_isUsed:1;
+	unsigned int MV_EVSEFinePositioningSetupParameters_isUsed:1;
+	unsigned int EVSEMinimumDischargeCurrent_isUsed:1;
+	unsigned int EVMaximumChargeCurrent_isUsed:1;
+	unsigned int AlignmentOffset_isUsed:1;
+	unsigned int Y_isUsed:1;
+	unsigned int RemainingTimeToTargetSOC_isUsed:1;
+	unsigned int DigestValue_isUsed:1;
+	unsigned int SensorMeasurements_isUsed:1;
+	unsigned int SalesTariff_isUsed:1;
+	unsigned int EVCCID_isUsed:1;
+	unsigned int EVSEMaximumPower_isUsed:1;
+	unsigned int TargetOffset_isUsed:1;
+	unsigned int PowerDemandParameters_isUsed:1;
+	unsigned int PGPKeyID_isUsed:1;
+	unsigned int DisconnectChargingDeviceReq_isUsed:1;
+	unsigned int DisconnectChargingDeviceRes_isUsed:1;
+	unsigned int DSAKeyValue_isUsed:1;
+	unsigned int SalesTariffEntry_isUsed:1;
+	unsigned int CertificateInstallationRes_isUsed:1;
+	unsigned int CanonicalizationMethod_isUsed:1;
+	unsigned int Generic_EVFinePositioningParameters_isUsed:1;
+	unsigned int EVSEMinimumVoltage_isUsed:1;
+	unsigned int SystemStatusRes_isUsed:1;
+	unsigned int EVSEOutputPower_isUsed:1;
+	unsigned int SignedInfo_isUsed:1;
+	unsigned int EVMinimumChargeCurrent_isUsed:1;
+	unsigned int costKind_isUsed:1;
+	unsigned int SystemStatusReq_isUsed:1;
+	unsigned int CableCheckReq_isUsed:1;
+	unsigned int NumEPriceLevels_isUsed:1;
+	unsigned int EVSEVoltageLimitAchieved_isUsed:1;
+	unsigned int PackageSeparationTime_isUsed:1;
+	unsigned int CableCheckRes_isUsed:1;
+	unsigned int EVCheckInStatus_isUsed:1;
+	unsigned int PMaxDischargeSchedule_isUsed:1;
+	unsigned int EVMinimumPower_isUsed:1;
+	unsigned int ChargingPerformance_isUsed:1;
+	unsigned int AlignmentCheckReq_isUsed:1;
+	unsigned int EVMechanicalChargingDeviceStatus_isUsed:1;
+	unsigned int VehicleSpace_isUsed:1;
+	unsigned int AlignmentCheckRes_isUsed:1;
+	unsigned int EVMinimumDischargePower_isUsed:1;
+	unsigned int RemainingTimeToMinimumSOC_isUsed:1;
+	unsigned int AuthorizationRes_isUsed:1;
+	unsigned int CertificateInstallationReq_isUsed:1;
+	unsigned int PaymentDetailsReq_isUsed:1;
+	unsigned int PaymentDetailsRes_isUsed:1;
+	unsigned int AuthorizationReq_isUsed:1;
+	unsigned int EVTargetCurrent_isUsed:1;
+	unsigned int SessionSetupReq_isUsed:1;
+	unsigned int SessionSetupRes_isUsed:1;
+	unsigned int EVSENominalFrequency_isUsed:1;
+	unsigned int Header_isUsed:1;
+	unsigned int NumberOfSensors_isUsed:1;
+	unsigned int EVSETimeStamp_isUsed:1;
+	unsigned int MeterStatus_isUsed:1;
+	unsigned int MV_EVSEFinePositioningParameters_isUsed:1;
+	unsigned int ChargeProgress_isUsed:1;
+	unsigned int KeyName_isUsed:1;
+	unsigned int PMaxSchedule_isUsed:1;
+	unsigned int duration_isUsed:1;
+	unsigned int RemainingTimeToBulkSOC_isUsed:1;
+	unsigned int SensorOrientation_isUsed:1;
+	unsigned int EVSEMaximumChargeCurrent_isUsed:1;
+	unsigned int LFA_EVSEFinePositioningParameters_isUsed:1;
+	unsigned int VehicleCheckInRes_isUsed:1;
+	unsigned int PMaxScheduleEntry_isUsed:1;
+	unsigned int SAScheduleList_isUsed:1;
+	unsigned int X509SKI_isUsed:1;
+	unsigned int PaymentOptionList_isUsed:1;
+	unsigned int ContractSignatureEncryptedPrivateKey_isUsed:1;
+	unsigned int VehicleCheckInReq_isUsed:1;
+	unsigned int Certificate_isUsed:1;
+	unsigned int CheckOutTime_isUsed:1;
+	unsigned int CurrentSOC_isUsed:1;
+	unsigned int ZCoordinate_isUsed:1;
+	unsigned int MeasurementData_isUsed:1;
+	unsigned int PairingRes_isUsed:1;
+	unsigned int EVSEMaximumCurrent_isUsed:1;
+	unsigned int LFA_EVFinePositioningParameters_isUsed:1;
+	unsigned int AlignmentCheckParameters_isUsed:1;
+	unsigned int EffectiveRadiatedPower_isUsed:1;
+	unsigned int PairingReq_isUsed:1;
+	unsigned int Value_isUsed:1;
+	unsigned int byteValue_isUsed:1;
+	unsigned int CurrentDemandReq_isUsed:1;
+	unsigned int Generic_EVSEFinePositioningParameters_isUsed:1;
+	unsigned int CurrentDemandRes_isUsed:1;
+	unsigned int AC_EVBidirectionalParameter_isUsed:1;
+	unsigned int Modulus_isUsed:1;
+	unsigned int SelectedEnergyTransferService_isUsed:1;
+	unsigned int startValue_isUsed:1;
+	unsigned int SelectedVASList_isUsed:1;
+	unsigned int ChargeParameterDiscoveryReq_isUsed:1;
+	unsigned int ChargeParameterDiscoveryRes_isUsed:1;
+	unsigned int SigMeterReading_isUsed:1;
+	unsigned int TargetSOC_isUsed:1;
+	unsigned int EVSEStatus_isUsed:1;
+	unsigned int EVSEMinimumChargeCurrent_isUsed:1;
+	unsigned int EVSEElectricalChargingDeviceStatus_isUsed:1;
+	unsigned int X509SerialNumber_isUsed:1;
+	unsigned int PaymentOption_isUsed:1;
+	unsigned int Transforms_isUsed:1;
+	unsigned int EVSEPeakCurrentRipple_isUsed:1;
+	unsigned int ConsumptionCost_isUsed:1;
+	unsigned int EVSEFinePositioningSetupParameters_isUsed:1;
+	unsigned int EPriceLevel_isUsed:1;
+	unsigned int Exponent_isUsed:1;
+	unsigned int X509IssuerSerial_isUsed:1;
+	unsigned int SPKIData_isUsed:1;
+	unsigned int MagneticVectorList_isUsed:1;
+	unsigned int EVSEFinePositioningParameters_isUsed:1;
+	unsigned int EVTargetPower_isUsed:1;
+	unsigned int SensorPackageList_isUsed:1;
+	unsigned int DepartureTime_isUsed:1;
+	unsigned int InletHot_isUsed:1;
+	unsigned int EVPresentActivePower_isUsed:1;
+	unsigned int X509Data_isUsed:1;
+	unsigned int YCoordinate_isUsed:1;
+	unsigned int KeyValue_isUsed:1;
+	unsigned int DisplayParameters_isUsed:1;
+	unsigned int EVSEPowerLimitAchieved_isUsed:1;
+	unsigned int Body_isUsed:1;
+	unsigned int DC_EVChargeParameter_isUsed:1;
+	unsigned int Service_isUsed:1;
+	unsigned int SignatureProperty_isUsed:1;
+	unsigned int PGPKeyPacket_isUsed:1;
+	unsigned int Seed_isUsed:1;
+	unsigned int LFA_EVFinePositioningSetupParameters_isUsed:1;
+	unsigned int MinimumPMaxRequest_isUsed:1;
+	unsigned int FinePositioningReq_isUsed:1;
+	unsigned int EnergyTransferServiceList_isUsed:1;
+	unsigned int FinePositioningRes_isUsed:1;
+	unsigned int AC_EVSEBidirectionalParameter_isUsed:1;
+	unsigned int FreeService_isUsed:1;
+	unsigned int AC_EVSEChargeParameter_isUsed:1;
+	unsigned int SensorID_isUsed:1;
+	unsigned int EVSECurrentRegulationTolerance_isUsed:1;
+	unsigned int EVSEMechanicalChargingDeviceStatus_isUsed:1;
+	unsigned int EVEnergyTransferParameter_isUsed:1;
+	unsigned int SignalPulseDuration_isUsed:1;
+	unsigned int shortValue_isUsed:1;
+	unsigned int Manifest_isUsed:1;
+	unsigned int DC_EVSEChargeParameter_isUsed:1;
+	unsigned int MeteringReceiptReq_isUsed:1;
+	unsigned int MeterID_isUsed:1;
+	unsigned int MeteringReceiptRes_isUsed:1;
+	unsigned int ServiceDiscoveryReq_isUsed:1;
+	unsigned int SalesTariffID_isUsed:1;
+	unsigned int ServiceDiscoveryRes_isUsed:1;
+	unsigned int X509CRL_isUsed:1;
+	unsigned int MagneticVectorSetup_isUsed:1;
+	unsigned int DigestMethod_isUsed:1;
+	unsigned int SPKISexp_isUsed:1;
+	unsigned int MeterReadingDischarged_isUsed:1;
+	unsigned int MeasurementDataList_isUsed:1;
+	unsigned int SignatureProperties_isUsed:1;
+	unsigned int SensorPosition_isUsed:1;
+	unsigned int LFA_EVSEFinePositioningSetupParameters_isUsed:1;
+	unsigned int eMAID_isUsed:1;
+	unsigned int SensorPackage_isUsed:1;
+	unsigned int EVCheckOutStatus_isUsed:1;
+	unsigned int X509Certificate_isUsed:1;
+	unsigned int RootCertificateID_isUsed:1;
+	unsigned int DC_BidirectionalControlReq_isUsed:1;
+	unsigned int EVSEPresentVoltage_isUsed:1;
+	unsigned int DC_BidirectionalControlRes_isUsed:1;
+	unsigned int VASList_isUsed:1;
+	unsigned int MeterInfo_isUsed:1;
+	unsigned int EVSETargetReactivePower_isUsed:1;
+	unsigned int ChargingStatusReq_isUsed:1;
+	unsigned int GenericParameters_isUsed:1;
+	unsigned int ChargingStatusRes_isUsed:1;
+	unsigned int EVMaximumChargePower_isUsed:1;
+	unsigned int BulkSOC_isUsed:1;
+	unsigned int NumberOfSignalPackages_isUsed:1;
+	unsigned int ParameterSetID_isUsed:1;
+	unsigned int PMax_isUsed:1;
+	unsigned int EVMaximumEnergyRequest_isUsed:1;
+	unsigned int EVOperation_isUsed:1;
+	unsigned int CertificateUpdateRes_isUsed:1;
+	unsigned int ChargingComplete_isUsed:1;
+	unsigned int ListOfRootCertificateIDs_isUsed:1;
+	unsigned int RotationVAtoGA_isUsed:1;
+	unsigned int EVTargetVoltage_isUsed:1;
+	unsigned int CertificateUpdateReq_isUsed:1;
+	unsigned int ConnectChargingDeviceRes_isUsed:1;
+	unsigned int DHpublickey_isUsed:1;
+	unsigned int ServiceParameterList_isUsed:1;
+	unsigned int SignatureValue_isUsed:1;
+	unsigned int physicalValue_isUsed:1;
+	unsigned int OperationMode_isUsed:1;
+	unsigned int EVSECurrentLimitAchieved_isUsed:1;
+	unsigned int ServiceDetailReq_isUsed:1;
+	unsigned int ServiceDetailRes_isUsed:1;
+	unsigned int intValue_isUsed:1;
+	unsigned int EVMaximumDischargePower_isUsed:1;
+	unsigned int MinimumSOC_isUsed:1;
+	unsigned int SelectedPaymentOption_isUsed:1;
+	unsigned int V2G_Message_isUsed:1;
+	unsigned int EVSEID_isUsed:1;
+	unsigned int TMeter_isUsed:1;
+	unsigned int SensorOrder_isUsed:1;
+	unsigned int SupportedServiceIDs_isUsed:1;
+	unsigned int GenChallenge_isUsed:1;
+	unsigned int EVFinePositioningParameters_isUsed:1;
+	unsigned int SensorList_isUsed:1;
+	unsigned int KeyInfo_isUsed:1;
+	unsigned int ConnectChargingDeviceReq_isUsed:1;
+	unsigned int AC_EVChargeParameter_isUsed:1;
+	unsigned int Parameter_isUsed:1;
+	unsigned int WeldingDetectionRes_isUsed:1;
+	unsigned int GAID_isUsed:1;
+	unsigned int SignalFrequency_isUsed:1;
+	unsigned int EVSETargetPower_isUsed:1;
+	unsigned int DC_EVBidirectionalParameter_isUsed:1;
+	unsigned int SignatureMethod_isUsed:1;
+	unsigned int WeldingDetectionReq_isUsed:1;
+	unsigned int SelectedService_isUsed:1;
+	unsigned int EVInputPower_isUsed:1;
+	unsigned int VehicleCheckOutReq_isUsed:1;
+	unsigned int PowerDemandReq_isUsed:1;
+	unsigned int VehicleCheckOutRes_isUsed:1;
+	unsigned int CurrentRange_isUsed:1;
+	unsigned int EVPresentReactivePower_isUsed:1;
+	unsigned int X509IssuerName_isUsed:1;
+	unsigned int V2GRequest_isUsed:1;
+	unsigned int Reference_isUsed:1;
+	unsigned int BodyElement_isUsed:1;
+	unsigned int MinimumPMaxScheduleEntry_isUsed:1;
+	unsigned int EVFinePositioningSetupParameters_isUsed:1;
+	unsigned int EVSENotification_isUsed:1;
+	unsigned int PaymentServiceSelectionReq_isUsed:1;
+	unsigned int PaymentServiceSelectionRes_isUsed:1;
+	unsigned int Transform_isUsed:1;
+	unsigned int Object_isUsed:1;
+	unsigned int TargetOffsetY_isUsed:1;
+	unsigned int PowerDemandRes_isUsed:1;
+	unsigned int TargetOffsetX_isUsed:1;
+
+
+	int _warning_;
+};
+#endif /* DEPLOY_ISO2_CODEC_FRAGMENT */
+
+
+/* Initialization methods for structs */
+
+void init_iso2EXIDocument(struct iso2EXIDocument* exiDoc);
+#if DEPLOY_ISO2_CODEC_FRAGMENT == SUPPORT_YES
+void init_iso2EXIFragment(struct iso2EXIFragment* exiFrag);
+#endif /* DEPLOY_ISO2_CODEC_FRAGMENT */
+void init_iso2RetrievalMethodType(struct iso2RetrievalMethodType* iso2RetrievalMethodType);
+void init_iso2AuthorizationResType(struct iso2AuthorizationResType* iso2AuthorizationResType);
+void init_iso2MV_EVSEFinePositioningSetupParametersType(struct iso2MV_EVSEFinePositioningSetupParametersType* iso2MV_EVSEFinePositioningSetupParametersType);
+void init_iso2X509DataType(struct iso2X509DataType* iso2X509DataType);
+void init_iso2RSAKeyValueType(struct iso2RSAKeyValueType* iso2RSAKeyValueType);
+void init_iso2DC_BidirectionalControlResType(struct iso2DC_BidirectionalControlResType* iso2DC_BidirectionalControlResType);
+void init_iso2CostType(struct iso2CostType* iso2CostType);
+void init_iso2ChargingStatusResType(struct iso2ChargingStatusResType* iso2ChargingStatusResType);
+void init_iso2MeterInfoType(struct iso2MeterInfoType* iso2MeterInfoType);
+void init_iso2AC_EVChargeParameterType(struct iso2AC_EVChargeParameterType* iso2AC_EVChargeParameterType);
+void init_iso2AC_EVSEBidirectionalParameterType(struct iso2AC_EVSEBidirectionalParameterType* iso2AC_EVSEBidirectionalParameterType);
+void init_iso2VehicleCheckOutResType(struct iso2VehicleCheckOutResType* iso2VehicleCheckOutResType);
+void init_iso2MagneticVectorListType(struct iso2MagneticVectorListType* iso2MagneticVectorListType);
+void init_iso2CableCheckResType(struct iso2CableCheckResType* iso2CableCheckResType);
+void init_iso2ServiceDiscoveryReqType(struct iso2ServiceDiscoveryReqType* iso2ServiceDiscoveryReqType);
+void init_iso2ServiceType(struct iso2ServiceType* iso2ServiceType);
+void init_iso2ServiceParameterListType(struct iso2ServiceParameterListType* iso2ServiceParameterListType);
+void init_iso2PMaxScheduleType(struct iso2PMaxScheduleType* iso2PMaxScheduleType);
+void init_iso2SignaturePropertiesType(struct iso2SignaturePropertiesType* iso2SignaturePropertiesType);
+void init_iso2PMaxScheduleEntryType(struct iso2PMaxScheduleEntryType* iso2PMaxScheduleEntryType);
+void init_iso2SignatureType(struct iso2SignatureType* iso2SignatureType);
+void init_iso2VehicleCheckInReqType(struct iso2VehicleCheckInReqType* iso2VehicleCheckInReqType);
+void init_iso2ConnectChargingDeviceResType(struct iso2ConnectChargingDeviceResType* iso2ConnectChargingDeviceResType);
+void init_iso2WeldingDetectionResType(struct iso2WeldingDetectionResType* iso2WeldingDetectionResType);
+void init_iso2SessionStopResType(struct iso2SessionStopResType* iso2SessionStopResType);
+void init_iso2VehicleCheckInResType(struct iso2VehicleCheckInResType* iso2VehicleCheckInResType);
+void init_iso2ServiceListType(struct iso2ServiceListType* iso2ServiceListType);
+void init_iso2CertificateUpdateResType(struct iso2CertificateUpdateResType* iso2CertificateUpdateResType);
+void init_iso2FinePositioningSetupResType(struct iso2FinePositioningSetupResType* iso2FinePositioningSetupResType);
+void init_iso2AC_EVBidirectionalParameterType(struct iso2AC_EVBidirectionalParameterType* iso2AC_EVBidirectionalParameterType);
+void init_iso2DC_BidirectionalControlReqType(struct iso2DC_BidirectionalControlReqType* iso2DC_BidirectionalControlReqType);
+void init_iso2CertificateUpdateReqType(struct iso2CertificateUpdateReqType* iso2CertificateUpdateReqType);
+void init_iso2ConsumptionCostType(struct iso2ConsumptionCostType* iso2ConsumptionCostType);
+void init_iso2SAScheduleListType(struct iso2SAScheduleListType* iso2SAScheduleListType);
+void init_iso2MagneticVectorSetupType(struct iso2MagneticVectorSetupType* iso2MagneticVectorSetupType);
+void init_iso2LFA_EVSEFinePositioningSetupParametersType(struct iso2LFA_EVSEFinePositioningSetupParametersType* iso2LFA_EVSEFinePositioningSetupParametersType);
+void init_iso2PaymentOptionListType(struct iso2PaymentOptionListType* iso2PaymentOptionListType);
+void init_iso2LFA_EVSEFinePositioningParametersType(struct iso2LFA_EVSEFinePositioningParametersType* iso2LFA_EVSEFinePositioningParametersType);
+void init_iso2RelativeTimeIntervalType(struct iso2RelativeTimeIntervalType* iso2RelativeTimeIntervalType);
+void init_iso2EVFinePositioningParametersType(struct iso2EVFinePositioningParametersType* iso2EVFinePositioningParametersType);
+void init_iso2AlignmentCheckReqType(struct iso2AlignmentCheckReqType* iso2AlignmentCheckReqType);
+void init_iso2CertificateInstallationReqType(struct iso2CertificateInstallationReqType* iso2CertificateInstallationReqType);
+void init_iso2TransformsType(struct iso2TransformsType* iso2TransformsType);
+void init_iso2ObjectType(struct iso2ObjectType* iso2ObjectType);
+void init_iso2SensorOrderListType(struct iso2SensorOrderListType* iso2SensorOrderListType);
+void init_iso2ChargeParameterDiscoveryReqType(struct iso2ChargeParameterDiscoveryReqType* iso2ChargeParameterDiscoveryReqType);
+void init_iso2ParameterType(struct iso2ParameterType* iso2ParameterType);
+void init_iso2SessionStopReqType(struct iso2SessionStopReqType* iso2SessionStopReqType);
+void init_iso2SensorMeasurementsType(struct iso2SensorMeasurementsType* iso2SensorMeasurementsType);
+void init_iso2DC_EVSEChargeParameterType(struct iso2DC_EVSEChargeParameterType* iso2DC_EVSEChargeParameterType);
+void init_iso2SensorPackageListType(struct iso2SensorPackageListType* iso2SensorPackageListType);
+void init_iso2MeasurementDataListType(struct iso2MeasurementDataListType* iso2MeasurementDataListType);
+void init_iso2CertificateChainType(struct iso2CertificateChainType* iso2CertificateChainType);
+void init_iso2SignaturePropertyType(struct iso2SignaturePropertyType* iso2SignaturePropertyType);
+void init_iso2TransformType(struct iso2TransformType* iso2TransformType);
+void init_iso2EMAIDType(struct iso2EMAIDType* iso2EMAIDType);
+void init_iso2DSAKeyValueType(struct iso2DSAKeyValueType* iso2DSAKeyValueType);
+void init_iso2EntryType(struct iso2EntryType* iso2EntryType);
+void init_iso2MessageHeaderType(struct iso2MessageHeaderType* iso2MessageHeaderType);
+void init_iso2WPT_EVChargeParameterType(struct iso2WPT_EVChargeParameterType* iso2WPT_EVChargeParameterType);
+void init_iso2DisconnectChargingDeviceReqType(struct iso2DisconnectChargingDeviceReqType* iso2DisconnectChargingDeviceReqType);
+void init_iso2ChargeLoopReqType(struct iso2ChargeLoopReqType* iso2ChargeLoopReqType);
+void init_iso2V2GRequestType(struct iso2V2GRequestType* iso2V2GRequestType);
+void init_iso2MeteringReceiptResType(struct iso2MeteringReceiptResType* iso2MeteringReceiptResType);
+void init_iso2SessionSetupResType(struct iso2SessionSetupResType* iso2SessionSetupResType);
+void init_iso2AC_BidirectionalControlReqType(struct iso2AC_BidirectionalControlReqType* iso2AC_BidirectionalControlReqType);
+void init_iso2MV_EVSEFinePositioningParametersType(struct iso2MV_EVSEFinePositioningParametersType* iso2MV_EVSEFinePositioningParametersType);
+void init_iso2ReferenceType(struct iso2ReferenceType* iso2ReferenceType);
+void init_iso2EVSEEnergyTransferParameterType(struct iso2EVSEEnergyTransferParameterType* iso2EVSEEnergyTransferParameterType);
+void init_iso2MeteringReceiptReqType(struct iso2MeteringReceiptReqType* iso2MeteringReceiptReqType);
+void init_iso2KeyValueType(struct iso2KeyValueType* iso2KeyValueType);
+void init_iso2SensorListType(struct iso2SensorListType* iso2SensorListType);
+void init_iso2CurrentDemandReqType(struct iso2CurrentDemandReqType* iso2CurrentDemandReqType);
+void init_iso2FinePositioningSetupReqType(struct iso2FinePositioningSetupReqType* iso2FinePositioningSetupReqType);
+void init_iso2LFA_EVFinePositioningSetupParametersType(struct iso2LFA_EVFinePositioningSetupParametersType* iso2LFA_EVFinePositioningSetupParametersType);
+void init_iso2SAScheduleTupleType(struct iso2SAScheduleTupleType* iso2SAScheduleTupleType);
+void init_iso2WPT_EVSEChargeParameterType(struct iso2WPT_EVSEChargeParameterType* iso2WPT_EVSEChargeParameterType);
+void init_iso2FinePositioningResType(struct iso2FinePositioningResType* iso2FinePositioningResType);
+void init_iso2BodyBaseType(struct iso2BodyBaseType* iso2BodyBaseType);
+void init_iso2ServiceDetailResType(struct iso2ServiceDetailResType* iso2ServiceDetailResType);
+void init_iso2PowerDeliveryReqType(struct iso2PowerDeliveryReqType* iso2PowerDeliveryReqType);
+void init_iso2PairingResType(struct iso2PairingResType* iso2PairingResType);
+void init_iso2AuthorizationReqType(struct iso2AuthorizationReqType* iso2AuthorizationReqType);
+void init_iso2ParameterSetType(struct iso2ParameterSetType* iso2ParameterSetType);
+void init_iso2SPKIDataType(struct iso2SPKIDataType* iso2SPKIDataType);
+void init_iso2PaymentDetailsResType(struct iso2PaymentDetailsResType* iso2PaymentDetailsResType);
+void init_iso2SignatureMethodType(struct iso2SignatureMethodType* iso2SignatureMethodType);
+void init_iso2AC_BidirectionalControlResType(struct iso2AC_BidirectionalControlResType* iso2AC_BidirectionalControlResType);
+void init_iso2VehicleCheckOutReqType(struct iso2VehicleCheckOutReqType* iso2VehicleCheckOutReqType);
+void init_iso2WeldingDetectionReqType(struct iso2WeldingDetectionReqType* iso2WeldingDetectionReqType);
+void init_iso2AlignmentCheckResType(struct iso2AlignmentCheckResType* iso2AlignmentCheckResType);
+void init_iso2PowerDemandReqType(struct iso2PowerDemandReqType* iso2PowerDemandReqType);
+void init_iso2MinimumPMaxRequestType(struct iso2MinimumPMaxRequestType* iso2MinimumPMaxRequestType);
+void init_iso2DisconnectChargingDeviceResType(struct iso2DisconnectChargingDeviceResType* iso2DisconnectChargingDeviceResType);
+void init_iso2SessionSetupReqType(struct iso2SessionSetupReqType* iso2SessionSetupReqType);
+void init_iso2PaymentDetailsReqType(struct iso2PaymentDetailsReqType* iso2PaymentDetailsReqType);
+void init_iso2Generic_EVFinePositioningParametersType(struct iso2Generic_EVFinePositioningParametersType* iso2Generic_EVFinePositioningParametersType);
+void init_iso2ConnectChargingDeviceReqType(struct iso2ConnectChargingDeviceReqType* iso2ConnectChargingDeviceReqType);
+void init_iso2AC_EVSEChargeParameterType(struct iso2AC_EVSEChargeParameterType* iso2AC_EVSEChargeParameterType);
+void init_iso2SalesTariffEntryType(struct iso2SalesTariffEntryType* iso2SalesTariffEntryType);
+void init_iso2DC_EVSEBidirectionalParameterType(struct iso2DC_EVSEBidirectionalParameterType* iso2DC_EVSEBidirectionalParameterType);
+void init_iso2CanonicalizationMethodType(struct iso2CanonicalizationMethodType* iso2CanonicalizationMethodType);
+void init_iso2DisplayParametersType(struct iso2DisplayParametersType* iso2DisplayParametersType);
+void init_iso2DC_EVBidirectionalParameterType(struct iso2DC_EVBidirectionalParameterType* iso2DC_EVBidirectionalParameterType);
+void init_iso2PaymentServiceSelectionReqType(struct iso2PaymentServiceSelectionReqType* iso2PaymentServiceSelectionReqType);
+void init_iso2MagneticVectorType(struct iso2MagneticVectorType* iso2MagneticVectorType);
+void init_iso2PhysicalValueType(struct iso2PhysicalValueType* iso2PhysicalValueType);
+void init_iso2SystemStatusReqType(struct iso2SystemStatusReqType* iso2SystemStatusReqType);
+void init_iso2SystemStatusResType(struct iso2SystemStatusResType* iso2SystemStatusResType);
+void init_iso2EVSEFinePositioningSetupParametersType(struct iso2EVSEFinePositioningSetupParametersType* iso2EVSEFinePositioningSetupParametersType);
+void init_iso2V2GResponseType(struct iso2V2GResponseType* iso2V2GResponseType);
+void init_iso2BodyType(struct iso2BodyType* iso2BodyType);
+void init_iso2PreChargeResType(struct iso2PreChargeResType* iso2PreChargeResType);
+void init_iso2EVSEFinePositioningParametersType(struct iso2EVSEFinePositioningParametersType* iso2EVSEFinePositioningParametersType);
+void init_iso2PaymentServiceSelectionResType(struct iso2PaymentServiceSelectionResType* iso2PaymentServiceSelectionResType);
+void init_iso2DigestMethodType(struct iso2DigestMethodType* iso2DigestMethodType);
+void init_iso2TargetPositionType(struct iso2TargetPositionType* iso2TargetPositionType);
+void init_iso2LFA_EVFinePositioningParametersType(struct iso2LFA_EVFinePositioningParametersType* iso2LFA_EVFinePositioningParametersType);
+void init_iso2DC_EVChargeParameterType(struct iso2DC_EVChargeParameterType* iso2DC_EVChargeParameterType);
+void init_iso2ServiceDetailReqType(struct iso2ServiceDetailReqType* iso2ServiceDetailReqType);
+void init_iso2PreChargeReqType(struct iso2PreChargeReqType* iso2PreChargeReqType);
+void init_iso2ManifestType(struct iso2ManifestType* iso2ManifestType);
+void init_iso2AnonType_V2G_Message(struct iso2AnonType_V2G_Message* iso2AnonType_V2G_Message);
+void init_iso2SelectedServiceListType(struct iso2SelectedServiceListType* iso2SelectedServiceListType);
+void init_iso2Generic_EVSEFinePositioningParametersType(struct iso2Generic_EVSEFinePositioningParametersType* iso2Generic_EVSEFinePositioningParametersType);
+void init_iso2CartesianCoordinatesType(struct iso2CartesianCoordinatesType* iso2CartesianCoordinatesType);
+void init_iso2KeyInfoType(struct iso2KeyInfoType* iso2KeyInfoType);
+void init_iso2SubCertificatesType(struct iso2SubCertificatesType* iso2SubCertificatesType);
+void init_iso2ListOfRootCertificateIDsType(struct iso2ListOfRootCertificateIDsType* iso2ListOfRootCertificateIDsType);
+void init_iso2EVEnergyTransferParameterType(struct iso2EVEnergyTransferParameterType* iso2EVEnergyTransferParameterType);
+void init_iso2ContractSignatureEncryptedPrivateKeyType(struct iso2ContractSignatureEncryptedPrivateKeyType* iso2ContractSignatureEncryptedPrivateKeyType);
+void init_iso2MagneticVectorSetupListType(struct iso2MagneticVectorSetupListType* iso2MagneticVectorSetupListType);
+void init_iso2PairingReqType(struct iso2PairingReqType* iso2PairingReqType);
+void init_iso2CurrentDemandResType(struct iso2CurrentDemandResType* iso2CurrentDemandResType);
+void init_iso2X509IssuerSerialType(struct iso2X509IssuerSerialType* iso2X509IssuerSerialType);
+void init_iso2ChargingStatusReqType(struct iso2ChargingStatusReqType* iso2ChargingStatusReqType);
+void init_iso2CertificateInstallationResType(struct iso2CertificateInstallationResType* iso2CertificateInstallationResType);
+void init_iso2SensorPackageType(struct iso2SensorPackageType* iso2SensorPackageType);
+void init_iso2PGPDataType(struct iso2PGPDataType* iso2PGPDataType);
+void init_iso2ServiceDiscoveryResType(struct iso2ServiceDiscoveryResType* iso2ServiceDiscoveryResType);
+void init_iso2ServiceIDListType(struct iso2ServiceIDListType* iso2ServiceIDListType);
+void init_iso2EVFinePositioningSetupParametersType(struct iso2EVFinePositioningSetupParametersType* iso2EVFinePositioningSetupParametersType);
+void init_iso2ChargeParameterDiscoveryResType(struct iso2ChargeParameterDiscoveryResType* iso2ChargeParameterDiscoveryResType);
+void init_iso2PowerDemandResType(struct iso2PowerDemandResType* iso2PowerDemandResType);
+void init_iso2ChargingProfileType(struct iso2ChargingProfileType* iso2ChargingProfileType);
+void init_iso2FinePositioningReqType(struct iso2FinePositioningReqType* iso2FinePositioningReqType);
+void init_iso2SalesTariffType(struct iso2SalesTariffType* iso2SalesTariffType);
+void init_iso2SensorType(struct iso2SensorType* iso2SensorType);
+void init_iso2SignatureValueType(struct iso2SignatureValueType* iso2SignatureValueType);
+void init_iso2SignedInfoType(struct iso2SignedInfoType* iso2SignedInfoType);
+void init_iso2PowerDeliveryResType(struct iso2PowerDeliveryResType* iso2PowerDeliveryResType);
+void init_iso2CableCheckReqType(struct iso2CableCheckReqType* iso2CableCheckReqType);
+void init_iso2SelectedServiceType(struct iso2SelectedServiceType* iso2SelectedServiceType);
+void init_iso2DiffieHellmanPublickeyType(struct iso2DiffieHellmanPublickeyType* iso2DiffieHellmanPublickeyType);
+void init_iso2EVSEStatusType(struct iso2EVSEStatusType* iso2EVSEStatusType);
+
+
+#endif /* DEPLOY_ISO2_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 63551 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypesDecoder.c


+ 65 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypesDecoder.h

@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypesDecoder.h
+ * \brief 	Decoder for datatype definitions
+ *
+ */
+
+#ifndef EXI_iso2_DATATYPES_DECODER_H
+#define EXI_iso2_DATATYPES_DECODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "iso2EXIDatatypes.h"
+
+#if DEPLOY_ISO2_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+
+int decode_iso2ExiDocument(bitstream_t* stream, struct iso2EXIDocument* exiDoc);
+
+#if DEPLOY_ISO2_CODEC_FRAGMENT == SUPPORT_YES
+int decode_iso2ExiFragment(bitstream_t* stream, struct iso2EXIFragment* exiFrag);
+#endif /* DEPLOY_ISO2_CODEC_FRAGMENT */
+
+#endif /* DEPLOY_ISO2_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 44215 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypesEncoder.c


+ 68 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/iso2/iso2EXIDatatypesEncoder.h

@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypesEncoder.h
+ * \brief 	Encoder for datatype definitions
+ *
+ */
+
+#ifndef EXI_iso2_DATATYPES_ENCODER_H
+#define EXI_iso2_DATATYPES_ENCODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "iso2EXIDatatypes.h"
+
+#if DEPLOY_ISO2_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "../codec/EXITypes.h"
+
+
+int encode_iso2ExiDocument(bitstream_t* stream, struct iso2EXIDocument* exiDoc);
+
+#if DEPLOY_ISO2_CODEC_FRAGMENT == SUPPORT_YES
+int encode_iso2ExiFragment(bitstream_t* stream, struct iso2EXIFragment* exiFrag);
+#endif /* DEPLOY_ISO2_CODEC_FRAGMENT */
+
+
+#endif /* DEPLOY_ISO2_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 55 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/test/main.c

@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @author Sebastian.Kaebisch@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Switch for sample programs: EXI codec only or for entire V2G example</p>
+ *
+ ********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/timeb.h>
+#include <time.h>
+#include "main.h"
+
+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);
+#elif CODE_VERSION == CODE_VERSION_SAMPLE
+	/* V2G client / service example  */
+	return main_example(argc, argv);
+#endif
+
+}

+ 42 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/test/main.h

@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @author Sebastian.Kaebisch@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ *
+ ********************************************************************/
+
+
+#define CODE_VERSION_EXI 1
+#define CODE_VERSION_SAMPLE 2
+#define CODE_VERSION CODE_VERSION_SAMPLE
+
+#ifndef MAIN_H_
+#define MAIN_H_
+
+#if CODE_VERSION == CODE_VERSION_EXI
+int main_databinder(int argc, char *argv[]);
+#elif CODE_VERSION == CODE_VERSION_SAMPLE
+int main_example(int argc, char *argv[]);
+#endif
+
+#endif

+ 178 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/test/main_databinder.c

@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: V2G_CI_MsgDef.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/*******************************************************************
+ *
+ * <p>Sample program to illustrate how to read an EXI stream and
+ *  directly write it again to an output</p>
+ *
+ *  <p>e.g., <executable> in.exi out.exi</p>
+ ********************************************************************/
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+/* schema-dependent */
+#include "../iso1/iso1EXIDatatypes.h"
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+#include "../iso1/iso1EXIDatatypesEncoder.h"
+#include "../iso1/iso1EXIDatatypesDecoder.h"
+#endif /* DEPLOY_ISO1_CODEC == SUPPORT_YES */
+#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 "../codec/ByteStream.h"
+
+/** EXI Debug mode */
+#define EXI_DEBUG 0
+
+#define BUFFER_SIZE 4096
+uint8_t bufferIn[BUFFER_SIZE];
+uint8_t bufferOut[BUFFER_SIZE];
+
+
+#if EXI_DEBUG == 1
+# define DEBUG_PRINTF(x) printf x
+#else
+# define DEBUG_PRINTF(x) do {} while (0)
+#endif
+
+
+int main_databinder(int argc, char *argv[]) {
+
+#if DEPLOY_DIN_CODEC == SUPPORT_YES
+	struct dinEXIDocument dinDoc;
+#endif /* DEPLOY_DIN_CODEC == SUPPORT_YES */
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+	struct iso1EXIDocument exi1Doc;
+#endif /* DEPLOY_ISO1_CODEC == SUPPORT_YES */
+#if DEPLOY_ISO2_CODEC == SUPPORT_YES
+	struct iso2EXIDocument exi2Doc;
+#endif /* DEPLOY_ISO2_CODEC == SUPPORT_YES */
+	int errn = 0;
+
+	bitstream_t iStream, oStream;
+
+#if EXI_STREAM == BYTE_ARRAY
+	size_t posDecode;
+	size_t posEncode;
+#endif /* EXI_STREAM == BYTE_ARRAY */
+
+
+#if EXI_DEBUG == 1
+	/* The Eclipse console has buffering problems on Windows e.g, Debug mode */
+	setvbuf(stdout, NULL, _IONBF, 0);
+	setvbuf(stderr, NULL, _IONBF, 0);
+#endif /*EXI_DEBUG*/
+
+	if (argc != 3) {
+		printf("Usage: %s exiInput exiOutput\n", argv[0]);
+		return -1;
+	}
+
+#if EXI_STREAM == BYTE_ARRAY
+	/* input pos */
+	posDecode = 0;
+	/* parse EXI stream to internal byte structures  */
+	errn = readBytesFromFile(argv[1], bufferIn, BUFFER_SIZE, &posDecode);
+	if (errn != 0) {
+		printf("Problems while reading file into buffer, err==%d\n", errn);
+		return errn;
+	}
+	posDecode = 0; /* reset position */
+#endif /* EXI_STREAM == BYTE_ARRAY */
+
+	/* setup input stream */
+#if EXI_STREAM == BYTE_ARRAY
+	iStream.size = BUFFER_SIZE;
+	iStream.data = bufferIn;
+	iStream.pos = &posDecode;
+#endif /* EXI_STREAM == BYTE_ARRAY */
+
+	iStream.buffer = 0;
+	iStream.capacity = 0;
+
+
+	printf("Start decoding EXI stream to databinding layer \n");
+#if DEPLOY_DIN_CODEC == SUPPORT_YES
+	errn = decode_dinExiDocument(&iStream, &dinDoc);
+#endif /* DEPLOY_DIN_CODEC == SUPPORT_YES */
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+	errn = decode_iso1ExiDocument(&iStream, &exi1Doc);
+#endif /* DEPLOY_ISO1_CODEC == SUPPORT_YES */
+#if DEPLOY_ISO2_CODEC == SUPPORT_YES
+	errn = decode_iso2ExiDocument(&iStream, &exi2Doc);
+#endif /* DEPLOY_ISO2_CODEC == SUPPORT_YES */
+	if (errn != 0) {
+		printf("Problems while decoding EXI stream, err==%d\n", errn);
+		return errn;
+	}
+
+#if EXI_STREAM == BYTE_ARRAY
+	/* setup output stream */
+	posEncode = 0;
+	oStream.size = BUFFER_SIZE;
+	oStream.data = bufferOut;
+	oStream.pos = &posEncode;
+#endif
+
+	oStream.buffer = 0;
+	oStream.capacity = 8;
+
+	printf("Start encoding databinding layer to EXI \n");
+
+#if DEPLOY_DIN_CODEC == SUPPORT_YES
+	errn = encode_dinExiDocument(&oStream, &dinDoc);
+#endif /* DEPLOY_DIN_CODEC == SUPPORT_YES */
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+	errn = encode_iso1ExiDocument(&oStream, &exi1Doc);
+#endif /* DEPLOY_ISO1_CODEC == SUPPORT_YES */
+#if DEPLOY_ISO2_CODEC == SUPPORT_YES
+	errn = encode_iso2ExiDocument(&oStream, &exi2Doc);
+#endif /* DEPLOY_ISO2_CODEC == SUPPORT_YES */
+	if (errn != 0) {
+		printf("Problems while encoding databinding layer, err==%d\n", errn);
+		return errn;
+	}
+
+	printf("EXI roundtrip done with success\n");
+#if EXI_STREAM == BYTE_ARRAY
+	/* write to file */
+	writeBytesToFile(oStream.data, posEncode, argv[2]);
+#endif
+
+
+	return errn;
+}

+ 2749 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/test/main_example.c

@@ -0,0 +1,2749 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @author Sebastian.Kaebisch@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ *
+ ********************************************************************/
+
+
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include <string.h>
+
+#include "../codec/EXITypes.h"
+
+#include "../appHandshake/appHandEXIDatatypes.h"
+#include "../appHandshake/appHandEXIDatatypesEncoder.h"
+#include "../appHandshake/appHandEXIDatatypesDecoder.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"
+
+//#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
+#define ERROR_UNEXPECTED_SERVICE_DETAILS_RESP_MESSAGE -603
+#define ERROR_UNEXPECTED_PAYMENT_SERVICE_SELECTION_RESP_MESSAGE -604
+#define ERROR_UNEXPECTED_PAYMENT_DETAILS_RESP_MESSAGE -605
+#define ERROR_UNEXPECTED_AUTHORIZATION_RESP_MESSAGE -606
+#define ERROR_UNEXPECTED_CHARGE_PARAMETER_DISCOVERY_RESP_MESSAGE -607
+#define ERROR_UNEXPECTED_POWER_DELIVERY_RESP_MESSAGE -608
+#define ERROR_UNEXPECTED_CHARGING_STATUS_RESP_MESSAGE -609
+#define ERROR_UNEXPECTED_METERING_RECEIPT_RESP_MESSAGE -610
+#define ERROR_UNEXPECTED_SESSION_STOP_RESP_MESSAGE -611
+#define ERROR_UNEXPECTED_CABLE_CHECK_RESP_MESSAGE -612
+#define ERROR_UNEXPECTED_PRE_CHARGE_RESP_MESSAGE -612
+#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;
+	while(string[pos]!='\0')
+	{
+		exiString[pos] = string[pos];
+		pos++;
+	}
+
+	return pos;
+}
+
+static void printASCIIString(exi_string_character_t* string, uint16_t len) {
+	unsigned int i;
+	for(i=0; i<len; i++) {
+		printf("%c",(char)string[i]);
+	}
+	printf("\n");
+}
+
+
+static void printBinaryArray(uint8_t* byte, uint16_t len) {
+	unsigned int i;
+	for(i=0; i<len; i++) {
+		printf("%d ",byte[i]);
+	}
+	printf("\n");
+}
+
+static void copyBytes(uint8_t* from, uint16_t len, uint8_t* to) {
+	int i;
+	for(i=0; i<len; i++) {
+		to[i] = from[i];
+	}
+}
+
+
+/** Example implementation of the app handshake protocol for the EVSE side  */
+static int appHandshakeHandler(bitstream_t* iStream, bitstream_t* oStream) {
+	struct appHandEXIDocument appHandResp;
+	int i;
+	struct appHandEXIDocument exiDoc;
+	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;
+		}
+
+	}
+
+	printf("EVSE side: List of application handshake protocols of the EV \n");
+
+	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);
+		printf("\t\tVersion=%d.%d\n", exiDoc.supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMajor, exiDoc.supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMinor);
+		printf("\t\tSchemaID=%d\n", exiDoc.supportedAppProtocolReq.AppProtocol.array[i].SchemaID);
+		printf("\t\tPriority=%d\n", exiDoc.supportedAppProtocolReq.AppProtocol.array[i].Priority);
+	}
+
+	/* prepare response handshake response:
+	 * it is assumed, we support the 15118 1.0 version :-) */
+	init_appHandEXIDocument(&appHandResp);
+	appHandResp.supportedAppProtocolRes_isUsed = 1u;
+	appHandResp.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_OK_SuccessfulNegotiation;
+	appHandResp.supportedAppProtocolRes.SchemaID = exiDoc.supportedAppProtocolReq.AppProtocol.array[0].SchemaID; /* signal the protocol by the provided schema id*/
+	appHandResp.supportedAppProtocolRes.SchemaID_isUsed = 1u;
+
+	*oStream->pos = V2GTP_HEADER_LENGTH;
+	if( (errn = encode_appHandExiDocument(oStream, &appHandResp)) == 0)
+	{
+		errn = write_v2gtpHeader(oStream->data, (*oStream->pos)-V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
+	}
+
+	return errn;
+}
+
+
+static int appHandshake()
+{
+	bitstream_t stream1;
+	bitstream_t stream2;
+
+	uint32_t payloadLengthDec;
+	size_t pos1 = V2GTP_HEADER_LENGTH; /* v2gtp header */
+	size_t pos2 = 0;
+
+	struct appHandEXIDocument handshake;
+	struct appHandEXIDocument handshakeResp;
+
+	int errn = 0;
+
+	char* ns0 = "urn:iso:15118:2:2010:MsgDef";
+	char* ns1 = "urn:din:70121:2012:MsgDef";
+
+	stream1.size = BUFFER_SIZE;
+	stream1.data = buffer1;
+	stream1.pos = &pos1;
+
+	stream2.size = BUFFER_SIZE;
+	stream2.data = buffer2;
+	stream2.pos = &pos2;
+
+	init_appHandEXIDocument(&handshake);
+
+	printf("EV side: setup data for the supported application handshake request message\n");
+
+	/* set up ISO/IEC 15118 Version 1.0 information */
+	handshake.supportedAppProtocolReq_isUsed = 1u;
+	handshake.supportedAppProtocolReq.AppProtocol.arrayLen = 2; /* we have only two protocols implemented */
+
+	handshake.supportedAppProtocolReq.AppProtocol.array[0].ProtocolNamespace.charactersLen =
+			writeStringToEXIString(ns0, handshake.supportedAppProtocolReq.AppProtocol.array[0].ProtocolNamespace.characters);
+	handshake.supportedAppProtocolReq.AppProtocol.array[0].SchemaID = 1;
+	handshake.supportedAppProtocolReq.AppProtocol.array[0].VersionNumberMajor = 1;
+	handshake.supportedAppProtocolReq.AppProtocol.array[0].VersionNumberMinor = 0;
+	handshake.supportedAppProtocolReq.AppProtocol.array[0].Priority = 1;
+
+	handshake.supportedAppProtocolReq.AppProtocol.array[1].ProtocolNamespace.charactersLen =
+			writeStringToEXIString(ns1, handshake.supportedAppProtocolReq.AppProtocol.array[1].ProtocolNamespace.characters);
+	handshake.supportedAppProtocolReq.AppProtocol.array[1].SchemaID = 2;
+	handshake.supportedAppProtocolReq.AppProtocol.array[1].VersionNumberMajor = 1;
+	handshake.supportedAppProtocolReq.AppProtocol.array[1].VersionNumberMinor = 0;
+	handshake.supportedAppProtocolReq.AppProtocol.array[1].Priority = 2;
+
+	/* send app handshake request */
+	if( (errn = encode_appHandExiDocument(&stream1, &handshake)) == 0) {
+		if ( write_v2gtpHeader(stream1.data, pos1-V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE) == 0 ) {
+			printf("EV side: send message to the EVSE\n");
+		}
+	}
+
+	if (errn == 0) {
+		/* read app handshake request & generate response */
+		errn = appHandshakeHandler(&stream1, &stream2);
+	}
+
+	if (errn == 0) {
+		/* check response */
+		if ( (errn = read_v2gtpHeader(stream2.data, &payloadLengthDec)) == 0) {
+			pos2 = V2GTP_HEADER_LENGTH;
+
+			if(decode_appHandExiDocument(&stream2, &handshakeResp) == 0) {
+				printf("EV side: Response of the EVSE \n");
+				if(handshakeResp.supportedAppProtocolRes.ResponseCode == appHandresponseCodeType_OK_SuccessfulNegotiation) {
+					printf("\t\tResponseCode=OK_SuccessfulNegotiation\n");
+					printf("\t\tSchemaID=%d\n",handshakeResp.supportedAppProtocolRes.SchemaID);
+				}
+			}
+		}
+
+	}
+
+	if (errn != 0) {
+		printf("appHandshake error %d \n", errn);
+	}
+
+
+	return errn;
+
+}
+
+
+
+
+
+#if DEPLOY_ISO2_CODEC == SUPPORT_YES
+
+static void printEVSEStatus2(struct iso2EVSEStatusType* status)
+{
+	printf("\tEVSEStatus:\n");
+	printf("\t\tEVSENotification=%d\n", status->EVSENotification);
+	printf("\t\tNotificationMaxDelay=%d\n", status->NotificationMaxDelay);
+}
+
+/* serializes EXI stream and adds V2G TP header */
+static int serialize2EXI2Stream(struct iso2EXIDocument* exiIn, bitstream_t* stream) {
+	int errn;
+	*stream->pos = V2GTP_HEADER_LENGTH;  /* v2gtp header */
+	if( (errn = encode_iso2ExiDocument(stream, exiIn)) == 0) {
+		errn = write_v2gtpHeader(stream->data, (*stream->pos)-V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
+	}
+	return errn;
+}
+
+
+/* deserializes V2G TP header and decodes right away EXI stream */
+static int deserialize2Stream2EXI(bitstream_t* streamIn, struct iso2EXIDocument* exi) {
+	int errn;
+	uint32_t payloadLength;
+
+	*streamIn->pos = 0;
+	if ( (errn = read_v2gtpHeader(streamIn->data, &payloadLength)) == 0) {
+		*streamIn->pos += V2GTP_HEADER_LENGTH;
+
+		errn = decode_iso2ExiDocument(streamIn, exi);
+	}
+	return errn;
+}
+
+static int sessionSetup2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+	printf("EVSE side: sessionSetup called\n"  );
+	printf("\tReceived data:\n");
+	printf("\tHeader SessionID=");
+	printBinaryArray(exiIn->V2G_Message.Header.SessionID.bytes, exiIn->V2G_Message.Header.SessionID.bytesLen);
+	printf("\t\t EVCCID=%d\n", exiIn->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[0]);
+
+	exiOut->V2G_Message_isUsed = 1u;
+
+	/* generate an unique sessionID */
+	init_iso2MessageHeaderType(&exiOut->V2G_Message.Header);
+	exiOut->V2G_Message.Header.SessionID.bytes[0] = 1;
+	exiOut->V2G_Message.Header.SessionID.bytes[1] = 2;
+	exiOut->V2G_Message.Header.SessionID.bytes[2] = 3;
+	exiOut->V2G_Message.Header.SessionID.bytes[3] = 4;
+	exiOut->V2G_Message.Header.SessionID.bytes[4] = 5;
+	exiOut->V2G_Message.Header.SessionID.bytes[5] = 6;
+	exiOut->V2G_Message.Header.SessionID.bytes[6] = 7;
+	exiOut->V2G_Message.Header.SessionID.bytes[7] = 8;
+	exiOut->V2G_Message.Header.SessionID.bytesLen = 8;
+
+	/* Prepare data for EV */
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.SessionSetupRes_isUsed = 1u;
+	init_iso2SessionSetupResType(&exiOut->V2G_Message.Body.SessionSetupRes);
+
+	exiOut->V2G_Message.Body.SessionSetupRes.ResponseCode = iso2responseCodeType_OK;
+	exiOut->V2G_Message.Body.SessionSetupRes.EVSEID.characters[0] = 0;
+	exiOut->V2G_Message.Body.SessionSetupRes.EVSEID.characters[1] = 20;
+	exiOut->V2G_Message.Body.SessionSetupRes.EVSEID.charactersLen = 2;
+	exiOut->V2G_Message.Body.SessionSetupRes.EVSETimeStamp_isUsed = 1u;
+	exiOut->V2G_Message.Body.SessionSetupRes.EVSETimeStamp = 123456789;
+
+	return 0;
+}
+
+static int serviceDiscovery2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+	int i;
+
+	printf("EVSE side: serviceDiscovery called\n"  );
+	printf("\tReceived data:\n");
+	printf("\tHeader SessionID=");
+	printBinaryArray(exiIn->V2G_Message.Header.SessionID.bytes, exiIn->V2G_Message.Header.SessionID.bytesLen);
+	if(exiIn->V2G_Message.Body.ServiceDiscoveryReq.SupportedServiceIDs_isUsed) {
+		for(i=0;i<exiIn->V2G_Message.Body.ServiceDiscoveryReq.SupportedServiceIDs.ServiceID.arrayLen; i++) {
+			printf("\t\tSupportedServiceID=%d\n", exiIn->V2G_Message.Body.ServiceDiscoveryReq.SupportedServiceIDs.ServiceID.array[i]);
+		}
+	}
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.ServiceDiscoveryRes_isUsed = 1u;
+	init_iso2ServiceDiscoveryResType(&exiOut->V2G_Message.Body.ServiceDiscoveryRes);
+
+
+	exiOut->V2G_Message.Body.ServiceDiscoveryRes.VASList_isUsed = 0u;  /* we do not provide VAS */
+	exiOut->V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso2responseCodeType_OK;
+
+	exiOut->V2G_Message.Body.ServiceDiscoveryRes.PaymentOptionList.PaymentOption.array[0] = iso2paymentOptionType_ExternalPayment; /* EVSE handles the payment */
+	exiOut->V2G_Message.Body.ServiceDiscoveryRes.PaymentOptionList.PaymentOption.array[1] = iso2paymentOptionType_Contract;
+	exiOut->V2G_Message.Body.ServiceDiscoveryRes.PaymentOptionList.PaymentOption.arrayLen = 2;
+
+	exiOut->V2G_Message.Body.ServiceDiscoveryRes.EnergyTransferServiceList.Service.arrayLen = 1;
+	exiOut->V2G_Message.Body.ServiceDiscoveryRes.EnergyTransferServiceList.Service.array[0].ServiceID = 1; /* ID of the charge service */
+	exiOut->V2G_Message.Body.ServiceDiscoveryRes.EnergyTransferServiceList.Service.array[0].FreeService = 1;
+
+	exiOut->V2G_Message.Body.ServiceDiscoveryRes.VASList_isUsed = 0u; /* no value added service requested */
+
+	return 0;
+}
+
+
+static int serviceDetail2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+
+	printf("EVSE side: serviceDetail called\n"  );
+	printf("\tReceived data:\n");
+	printf("\tHeader SessionID=");
+	printBinaryArray(exiIn->V2G_Message.Header.SessionID.bytes, exiIn->V2G_Message.Header.SessionID.bytesLen);
+	printf("\t\t ServiceDetailID=%d\n",exiIn->V2G_Message.Body.ServiceDetailReq.ServiceID);
+
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.ServiceDetailRes_isUsed= 1u;
+	init_iso2ServiceDetailResType(&exiOut->V2G_Message.Body.ServiceDetailRes);
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceID = 1234;
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList_isUsed = 1u;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.arrayLen = 2;
+
+	/* Parameter Set 1*/
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].ParameterSetID = 1;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.arrayLen = 2;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.charactersLen = 8;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[0] = 'P';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[1] = 'r';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[2] = 'o';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[3] = 't';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[4]= 'o';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[5] = 'c';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[6] = 'o';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[7] = 'l';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].intValue = 15119;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].intValue_isUsed = 1u;
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.charactersLen = 4;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.characters[0] = 'N';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.characters[1] = 'a';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.characters[2] = 'm';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.characters[3] = 'e';
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].stringValue_isUsed = 1u;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].stringValue.charactersLen = 3;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].stringValue.characters[0] = 'V';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].stringValue.characters[1] = '2';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].stringValue.characters[2] = 'G';
+
+	/* Parameter Set 2 */
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].ParameterSetID = 2;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.arrayLen = 1;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.charactersLen = 7;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[0] = 'C';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[1] = 'h';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[2] = 'a';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[3] = 'n';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[4] = 'n';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[5] = 'e';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[6] = 'l';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].physicalValue_isUsed = 1u;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].physicalValue.Value = 1234;
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].physicalValue.Exponent = 1;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].physicalValue.Value = 2;
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ResponseCode = iso2responseCodeType_OK;
+
+	return 0;
+}
+
+
+static int paymentServiceSelection2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+	int i;
+
+	printf("EVSE side: paymentServiceSelection called\n"  );
+	printf("\tReceived data:\n");
+	printf("\tHeader SessionID=");
+	printBinaryArray(exiIn->V2G_Message.Header.SessionID.bytes, exiIn->V2G_Message.Header.SessionID.bytesLen);
+
+	if(exiIn->V2G_Message.Body.PaymentServiceSelectionReq.SelectedPaymentOption == iso2paymentOptionType_ExternalPayment)  {
+		printf("\t\t SelectedPaymentOption=ExternalPayment\n");
+	}
+
+	if(exiIn->V2G_Message.Body.PaymentServiceSelectionReq.SelectedVASList_isUsed) {
+		for(i=0; i<exiIn->V2G_Message.Body.PaymentServiceSelectionReq.SelectedVASList.SelectedService.arrayLen;i++)
+		{
+			printf("\t\t ServiceID=%d\n", exiIn->V2G_Message.Body.PaymentServiceSelectionReq.SelectedVASList.SelectedService.array[i].ServiceID);
+			printf("\t\t ParameterSetID=%d\n", exiIn->V2G_Message.Body.PaymentServiceSelectionReq.SelectedVASList.SelectedService.array[i].ParameterSetID);
+		}
+	}
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.PaymentServiceSelectionRes_isUsed= 1u;
+	init_iso2PaymentServiceSelectionResType(&exiOut->V2G_Message.Body.PaymentServiceSelectionRes);
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ResponseCode = iso2responseCodeType_OK;
+
+	return 0;
+}
+
+
+static int paymentDetails2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+
+	printf("EVSE side: paymentDetails called\n"  );
+	printf("\tReceived data:\n");
+
+	printf("\t\t eMAID=%d\n", exiIn->V2G_Message.Body.PaymentDetailsReq.eMAID.characters[0]);
+	printf("\t\t ID=%c%c\n", exiIn->V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Id.characters[0], exiIn->V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Id.characters[1]);
+	printf("\t\t Certificate=%c%c\n", exiIn->V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Certificate.bytes[0],  exiIn->V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Certificate.bytes[1]);
+	printf("\t\t SubCertificate 1=%c%c\n", exiIn->V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[0].bytes[0], exiIn->V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[0].bytes[1]);
+	printf("\t\t SubCertificate 2=%c%c\n", exiIn->V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[1].bytes[0], exiIn->V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[1].bytes[1]);
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.PaymentDetailsRes_isUsed = 1u;
+	init_iso2PaymentDetailsResType(&exiOut->V2G_Message.Body.PaymentDetailsRes);
+
+	exiOut->V2G_Message.Body.PaymentDetailsRes.ResponseCode = iso2responseCodeType_OK;
+	exiOut->V2G_Message.Body.PaymentDetailsRes.GenChallenge.bytesLen = 1;
+	exiOut->V2G_Message.Body.PaymentDetailsRes.GenChallenge.bytes[0] = 1;
+	exiOut->V2G_Message.Body.PaymentDetailsRes.EVSETimeStamp = 123456;
+
+	return 0;
+}
+
+
+static int authorization2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+
+	printf("EVSE: Authorization called\n"  );
+	printf("\tReceived data:\n");
+
+	if(exiIn->V2G_Message.Body.AuthorizationReq.GenChallenge_isUsed) {
+		printf("\t\t\t GenChallenge=%d\n", exiIn->V2G_Message.Body.AuthorizationReq.GenChallenge.bytes[0]);
+	}
+	if(exiIn->V2G_Message.Body.AuthorizationReq.Id_isUsed ) {
+		printf("\t\t\t ID=%c%c%c\n", exiIn->V2G_Message.Body.AuthorizationReq.Id.characters[0], exiIn->V2G_Message.Body.AuthorizationReq.Id.characters[1], exiIn->V2G_Message.Body.AuthorizationReq.Id.characters[2]);
+	}
+
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.AuthorizationRes_isUsed = 1u;
+	init_iso2AuthorizationResType(&exiOut->V2G_Message.Body.AuthorizationRes);
+
+	exiOut->V2G_Message.Body.AuthorizationRes.ResponseCode = iso2responseCodeType_OK;
+	exiOut->V2G_Message.Body.AuthorizationRes.EVSEProcessing = iso2EVSEProcessingType_Finished;
+
+	return 0;
+}
+
+
+static int chargeParameterDiscovery2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+
+	printf("EVSE side: chargeParameterDiscovery called\n"  );
+	printf("\tReceived data:\n");
+
+	if(exiIn->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter_isUsed) {
+		printf("\t\t DepartureTime=%d\n", exiIn->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.DepartureTime);
+		printf("\t\t EVMaximumChargeCurrent=%d\n", exiIn->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumChargeCurrent.Value);
+	}
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
+	init_iso2ChargeParameterDiscoveryResType(&exiOut->V2G_Message.Body.ChargeParameterDiscoveryRes);
+
+	exiOut->V2G_Message.Body.ChargeParameterDiscoveryRes.ResponseCode = iso2responseCodeType_OK_CertificateExpiresSoon;
+	exiOut->V2G_Message.Body.ChargeParameterDiscoveryRes.EVSEProcessing = iso2EVSEProcessingType_Ongoing;
+	exiOut->V2G_Message.Body.ChargeParameterDiscoveryRes.EVSEEnergyTransferParameter_isUsed = 1u;
+	/*exiOut->V2G_Message.Body.ChargeParameterDiscoveryRes.EVSEEnergyTransferParameter = 0;*/
+	return 0;
+}
+
+
+static int powerDelivery2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+	printf("EVSE side: powerDelivery called\n"  );
+	printf("\tReceived data:\n");
+
+	printf("\t\t  ChargeProgress=%d\n", exiIn->V2G_Message.Body.PowerDeliveryReq.ChargeProgress);
+	printf("\t\t  SAScheduleTupleID=%d\n", exiIn->V2G_Message.Body.PowerDeliveryReq.SAScheduleTupleID);
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
+	init_iso2PowerDeliveryResType(&exiOut->V2G_Message.Body.PowerDeliveryRes);
+
+	exiOut->V2G_Message.Body.PowerDeliveryRes.ResponseCode = iso2responseCodeType_OK;
+
+	exiOut->V2G_Message.Body.PowerDeliveryRes.EVSEStatus_isUsed = 1;
+	exiOut->V2G_Message.Body.PowerDeliveryRes.EVSEStatus.EVSENotification = iso2EVSENotificationType_StopCharging;
+	exiOut->V2G_Message.Body.PowerDeliveryRes.EVSEStatus.NotificationMaxDelay=12;
+
+	exiOut->V2G_Message.Body.PowerDeliveryRes.EVSEProcessing = iso2EVSEProcessingType_Ongoing_WaitingForCustomerInteraction;
+
+	return 0;
+}
+
+
+static int chargingStatus2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+
+	printf("EVSE side: chargingStatus called\n"  );
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.ChargingStatusRes_isUsed = 1u;
+	init_iso2ChargingStatusResType(&exiOut->V2G_Message.Body.ChargingStatusRes);
+
+
+	exiOut->V2G_Message.Body.ChargingStatusRes.ResponseCode = iso2responseCodeType_OK;
+	exiOut->V2G_Message.Body.ChargingStatusRes.EVSEID.characters[0]= 'A';
+	exiOut->V2G_Message.Body.ChargingStatusRes.EVSEID.charactersLen =1;
+
+	exiOut->V2G_Message.Body.ChargingStatusRes.EVSEStatus.EVSENotification = iso2EVSENotificationType_ReNegotiation;
+	exiOut->V2G_Message.Body.ChargingStatusRes.EVSEStatus.NotificationMaxDelay=123;
+	exiOut->V2G_Message.Body.ChargingStatusRes.ReceiptRequired = 1;
+	exiOut->V2G_Message.Body.ChargingStatusRes.ReceiptRequired_isUsed = 1;
+
+	return 0;
+}
+
+
+static int meteringReceipt2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+
+	printf("EVSE side: meteringReceipt called\n"  );
+	printf("\tReceived data:\n");
+
+	printf("\t\t ID=%c%c%c\n", exiIn->V2G_Message.Body.MeteringReceiptReq.Id.characters[0], exiIn->V2G_Message.Body.MeteringReceiptReq.Id.characters[1], exiIn->V2G_Message.Body.MeteringReceiptReq.Id.characters[2]);
+	printf("\t\t SAScheduleTupleID=%d\n", exiIn->V2G_Message.Body.MeteringReceiptReq.SAScheduleTupleID);
+	printf("\t\t SessionID=%d\n", exiIn->V2G_Message.Body.MeteringReceiptReq.SessionID.bytes[1]);
+	printf("\t\t MeterInfo.MeterStatus=%d\n", exiIn->V2G_Message.Body.MeteringReceiptReq.MeterInfo.MeterStatus);
+	printf("\t\t MeterInfo.MeterID=%d\n",		exiIn->V2G_Message.Body.MeteringReceiptReq.MeterInfo.MeterID.characters[0]);
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.MeteringReceiptRes_isUsed = 1u;
+	init_iso2MeteringReceiptResType(&exiOut->V2G_Message.Body.MeteringReceiptRes);
+
+	exiOut->V2G_Message.Body.MeteringReceiptRes.ResponseCode = iso2responseCodeType_FAILED;
+
+	return 0;
+}
+
+static int sessionStop2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+
+	printf("EVSE side: sessionStop called\n"  );
+	printf("\tReceived data:\n");
+	printf("\tHeader SessionID=");
+	printBinaryArray(exiIn->V2G_Message.Header.SessionID.bytes, exiIn->V2G_Message.Header.SessionID.bytesLen);
+	printf("\t\t ChargingSession=%d\n", exiIn->V2G_Message.Body.SessionStopReq.ChargingSession);
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.SessionStopRes_isUsed = 1u;
+	init_iso2SessionStopResType(&exiOut->V2G_Message.Body.SessionStopRes);
+
+	exiOut->V2G_Message.Body.SessionStopRes.ResponseCode = iso2responseCodeType_OK;
+
+	return 0;
+}
+
+static int cableCheck2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+
+	printf("EVSE side: cableCheck called\n"  );
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.CableCheckRes_isUsed = 1u;
+	init_iso2CableCheckResType(&exiOut->V2G_Message.Body.CableCheckRes);
+
+	exiOut->V2G_Message.Body.CableCheckRes.ResponseCode = iso2responseCodeType_OK;
+
+	exiOut->V2G_Message.Body.CableCheckRes.EVSEStatus.NotificationMaxDelay = 1234;
+	exiOut->V2G_Message.Body.CableCheckRes.EVSEStatus.EVSENotification= iso2EVSENotificationType_ReNegotiation;
+
+	exiOut->V2G_Message.Body.CableCheckRes.EVSEProcessing = iso2EVSEProcessingType_Finished;
+
+	return 0;
+}
+
+static int preCharge2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+
+	printf("EVSE side: preCharge called\n"  );
+	printf("\tReceived data:\n");
+
+	printf("\t\t EVTargetCurrent=%d (%d)\n", exiIn->V2G_Message.Body.PreChargeReq.EVTargetCurrent.Value, exiIn->V2G_Message.Body.PreChargeReq.EVTargetCurrent.Exponent);
+	printf("\t\t EVTargetVoltage=%d (%d)\n", exiIn->V2G_Message.Body.PreChargeReq.EVTargetVoltage.Value, exiIn->V2G_Message.Body.PreChargeReq.EVTargetVoltage.Exponent);
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso2BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.PreChargeRes_isUsed = 1u;
+	init_iso2PreChargeResType(&exiOut->V2G_Message.Body.PreChargeRes);
+
+	exiOut->V2G_Message.Body.PreChargeRes.ResponseCode = iso2responseCodeType_OK;
+
+	exiOut->V2G_Message.Body.PreChargeRes.EVSEStatus.EVSENotification = iso2EVSENotificationType_StopCharging;
+	exiOut->V2G_Message.Body.PreChargeRes.EVSEStatus.NotificationMaxDelay= 1234;
+
+	exiOut->V2G_Message.Body.PreChargeRes.EVSEPresentVoltage.Exponent = 3;
+	exiOut->V2G_Message.Body.PreChargeRes.EVSEPresentVoltage.Value= 456;
+
+	return 0;
+}
+
+
+
+static int create_response_message2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+	int errn = ERROR_UNEXPECTED_REQUEST_MESSAGE;
+
+	/* create response message as EXI document */
+	if(exiIn->V2G_Message_isUsed) {
+		init_iso2EXIDocument(exiOut);
+		if (exiIn->V2G_Message.Body.SessionSetupReq_isUsed) {
+			errn = sessionSetup2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.ServiceDiscoveryReq_isUsed) {
+			errn = serviceDiscovery2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.ServiceDetailReq_isUsed) {
+			errn = serviceDetail2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.PaymentServiceSelectionReq_isUsed) {
+			errn = paymentServiceSelection2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.PaymentDetailsReq_isUsed) {
+			errn = paymentDetails2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.AuthorizationReq_isUsed) {
+			errn = authorization2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.ChargeParameterDiscoveryReq_isUsed) {
+			errn = chargeParameterDiscovery2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.PowerDeliveryReq_isUsed) {
+			errn = powerDelivery2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.ChargingStatusReq_isUsed) {
+			errn = chargingStatus2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.MeteringReceiptReq_isUsed) {
+			errn = meteringReceipt2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.SessionStopReq_isUsed) {
+			errn = sessionStop2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.CableCheckReq_isUsed) {
+			errn = cableCheck2(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.PreChargeReq_isUsed) {
+			errn = preCharge2(exiIn, exiOut);
+		}
+	}
+
+	return errn;
+}
+
+/* Adapt this to your system setup! */
+/* In this situation EV and EVSE is the same party */
+static int request_response2(struct iso2EXIDocument* exiIn, struct iso2EXIDocument* exiOut) {
+	int errn;
+
+	bitstream_t stream1;
+	bitstream_t stream2;
+
+	size_t pos1;
+	size_t pos2;
+
+	stream1.size = BUFFER_SIZE;
+	stream1.data = buffer1;
+	stream1.pos = &pos1;
+
+	stream2.size = BUFFER_SIZE;
+	stream2.data = buffer2;
+	stream2.pos = &pos2;
+
+	/* EV side */
+	errn = serialize2EXI2Stream(exiIn, &stream1);
+
+	/* --> Start of EVSE side */
+	/* deserialize request message */
+	if (errn == 0) {
+		errn = deserialize2Stream2EXI(&stream1, exiOut);
+	}
+	/* create response message */
+	if (errn == 0) {
+		errn = create_response_message2(exiOut, exiIn);
+	}
+	/* serialize response message */
+	if (errn == 0) {
+		errn = serialize2EXI2Stream(exiIn, &stream2);
+	}
+	/* <-- End of EVSE side */
+
+
+	/* EV side */
+	/* deserialize response message */
+	if (errn == 0) {
+		errn = deserialize2Stream2EXI(&stream2, exiOut);
+	}
+
+	return errn;
+}
+
+
+static int charging2()
+{
+	int errn = 0;
+	int i, j;
+
+	struct iso2EXIDocument exiIn;
+	struct iso2EXIDocument exiOut;
+
+	struct iso2ServiceDetailResType serviceDetailRes;
+	struct iso2PaymentServiceSelectionResType paymentServiceSelectionRes;
+	struct iso2PaymentDetailsResType paymentDetailsRes;
+
+	/* setup header information */
+	init_iso2EXIDocument(&exiIn);
+	exiIn.V2G_Message_isUsed = 1u;
+	init_iso2MessageHeaderType(&exiIn.V2G_Message.Header);
+	exiIn.V2G_Message.Header.SessionID.bytes[0] = 0; /* sessionID is always '0' at the beginning (the response contains the valid sessionID)*/
+	exiIn.V2G_Message.Header.SessionID.bytes[1] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[2] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[3] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[4] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[5] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[6] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[7] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytesLen = 8;
+	exiIn.V2G_Message.Header.Signature_isUsed = 0u;
+
+
+	/************************
+	 * sessionSetup *
+	 ************************/
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.SessionSetupReq_isUsed = 1u;
+
+	init_iso2SessionSetupReqType(&exiIn.V2G_Message.Body.SessionSetupReq);
+
+	exiIn.V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen = 1;
+	exiIn.V2G_Message.Body.SessionSetupReq.EVCCID.bytes[0] = 10;
+
+	printf("EV side: call EVSE sessionSetup");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.SessionSetupRes_isUsed) {
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\tResponseCode=%d\n", exiOut.V2G_Message.Body.SessionSetupRes.ResponseCode);
+			printf("\tEVSEID=%d\n",	exiOut.V2G_Message.Body.SessionSetupRes.EVSEID.characters[1]);
+			printf("\tEVSETimeStamp=%li\n", (long int)exiOut.V2G_Message.Body.SessionSetupRes.EVSETimeStamp);
+		} else {
+			errn = ERROR_UNEXPECTED_SESSION_SETUP_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+	/*******************************************
+	 * serviceDiscovery *
+	 *******************************************/
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.ServiceDiscoveryReq_isUsed = 1u;
+
+	init_iso2ServiceDiscoveryReqType(&exiIn.V2G_Message.Body.ServiceDiscoveryReq);
+
+	exiIn.V2G_Message.Body.ServiceDiscoveryReq.SupportedServiceIDs_isUsed = 1u;
+	exiIn.V2G_Message.Body.ServiceDiscoveryReq.SupportedServiceIDs.ServiceID.arrayLen = 1;
+	exiIn.V2G_Message.Body.ServiceDiscoveryReq.SupportedServiceIDs.ServiceID.array[0] = iso2serviceCategoryType_Internet;
+
+	printf("EV side: call EVSE serviceDiscovery");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.ServiceDiscoveryRes_isUsed) {
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n",  exiOut.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode);
+
+			printf("\t Service ResponseCode=%d\n",	exiOut.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode);
+
+			/*printf("\t ServiceID=%d\n",	exiOut.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceID);
+			printf("\t ServiceName=");
+			printASCIIString(serviceDiscoveryRes.ChargeService.ServiceName.characters, serviceDiscoveryRes.ChargeService.ServiceName.charactersLen);
+			if(serviceDiscoveryRes.PaymentOptionList.PaymentOption.array[1] == v2gpaymentOptionType_Contract) {
+				printf("\t PaymentOption=Contract_paymentOptionType\n");
+			}
+			if(serviceDiscoveryRes.ChargeService.FreeService==1) {
+				printf("\t ChargeService.FreeService=True\n");
+			}
+			if(serviceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.array[0] == v2gEnergyTransferModeType_DC_combo_core) {
+				printf("\t EnergyTransferMode=AC_single_DC_core\n");
+			}
+			if(serviceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.array[1] == v2gEnergyTransferModeType_AC_single_phase_core) {
+				printf("\t EnergyTransferMode=AC_single_phase_core_EnergyTransferModeType\n");
+			}
+			printf("\t Value added service list:\n");
+			for(i=0;i<serviceDiscoveryRes.ServiceList.Service.arrayLen;i++)
+			{
+				printf("\n\t\t ServiceID=%d\n",	serviceDiscoveryRes.ServiceList.Service.array[i].ServiceID);
+				printf("\t\t ServiceName=");
+				printASCIIString(serviceDiscoveryRes.ServiceList.Service.array[i].ServiceName.characters, exiOut.V2G_Message.Body.ServiceDiscoveryRes.ServiceList.Service.array[i].ServiceName.charactersLen );
+				if(serviceDiscoveryRes.ServiceList.Service.array[i].ServiceCategory == v2gserviceCategoryType_Internet) {
+					printf("\t\t ServiceCategory=Internet\n");
+				}
+				if(serviceDiscoveryRes.ServiceList.Service.array[i].FreeService==1) {
+					printf("\t\t FreeService=True\n");
+				}
+			}*/
+
+		} else {
+			errn = ERROR_UNEXPECTED_SERVICE_DISCOVERY_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+	/*********************************
+	 * ServiceDetails *
+	 *********************************/
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.ServiceDetailReq_isUsed = 1u;
+
+	init_iso2ServiceDetailReqType(&exiIn.V2G_Message.Body.ServiceDetailReq);
+
+	exiIn.V2G_Message.Body.ServiceDetailReq.ServiceID = 22; /* Value Added Server ID */
+
+	printf("EV side: call EVSE ServiceDetail \n");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.ServiceDetailRes_isUsed) {
+			serviceDetailRes = exiOut.V2G_Message.Body.ServiceDetailRes;
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n",  exiOut.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode);
+			printf("\t ServiceID=%d\n",	exiOut.V2G_Message.Body.ServiceDetailRes.ServiceID);
+
+			if(serviceDetailRes.ServiceParameterList_isUsed) {
+				printf("\t\tLength=%d\n", serviceDetailRes.ServiceParameterList.ParameterSet.arrayLen );/*TEST*/
+
+				for(i=0; i<serviceDetailRes.ServiceParameterList.ParameterSet.arrayLen; i++)
+				{
+					printf("\t\tServiceSetID=%d\n", serviceDetailRes.ServiceParameterList.ParameterSet.array[i].ParameterSetID);
+					printf("\t\tParameters=%d\n", serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.arrayLen);
+
+					for(j=0; j<serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.arrayLen; j++)
+					{
+						printf("\t\t\t %d: ParameterName=", j+1);
+						printASCIIString(serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].Name.characters, exiOut.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].Name.charactersLen);
+
+						/*if(serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].shortValue_isUsed == 1u) {
+							printf("\t\t\t %d: StringValue=", j+1);
+							printASCIIString(serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].stringValue.characters, serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].stringValue.charactersLen);
+						} else if(serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].intValue_isUsed == 1u) {
+							printf("\t\t\t %d: IntValue=%d\n", j+1, serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].intValue);
+						} else if(serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].physicalValue_isUsed == 1u) {
+							printf("\t\t\t %d: PhysicalValue=%d (%d)\n",  j+1, serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].physicalValue.Value, serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].physicalValue.Multiplier);
+						}*/
+					}
+				}
+			}
+		} else {
+			errn = ERROR_UNEXPECTED_SERVICE_DETAILS_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+	/*******************************************
+	 * ServicePaymentSelection *
+	 *******************************************/
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.PaymentServiceSelectionReq_isUsed = 1u;
+
+	init_iso2PaymentServiceSelectionReqType(&exiIn.V2G_Message.Body.PaymentServiceSelectionReq);
+
+	exiIn.V2G_Message.Body.PaymentServiceSelectionReq.SelectedPaymentOption = iso2paymentOptionType_ExternalPayment;
+	exiIn.V2G_Message.Body.PaymentServiceSelectionReq.SelectedVASList_isUsed = 0u;
+	exiIn.V2G_Message.Body.PaymentServiceSelectionReq.SelectedEnergyTransferService.ServiceID = 1;
+	exiIn.V2G_Message.Body.PaymentServiceSelectionReq.SelectedEnergyTransferService.ParameterSetID = 4;
+
+	printf("EV side: call EVSE ServicePaymentSelection \n");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.PaymentServiceSelectionRes_isUsed) {
+			paymentServiceSelectionRes = exiOut.V2G_Message.Body.PaymentServiceSelectionRes;
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			if(exiOut.V2G_Message.Body.PaymentServiceSelectionRes.EVSEStatus_isUsed) {
+				printf("\tHeader SessionID=");
+				printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			}
+			printf("\t ResponseCode=%d\n",  paymentServiceSelectionRes.ResponseCode);
+
+		} else {
+			errn = ERROR_UNEXPECTED_PAYMENT_SERVICE_SELECTION_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+	/**********************************
+	 * PaymentDetails *
+	 **********************************/
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.PaymentDetailsReq_isUsed = 1u;
+
+	init_iso2PaymentDetailsReqType(&exiIn.V2G_Message.Body.PaymentDetailsReq);
+
+	exiIn.V2G_Message.Body.PaymentDetailsReq.eMAID.characters[0] = 1;
+	exiIn.V2G_Message.Body.PaymentDetailsReq.eMAID.characters[1] = 123;
+	exiIn.V2G_Message.Body.PaymentDetailsReq.eMAID.charactersLen =2;
+
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Certificate.bytes[0] = 'C';
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Certificate.bytes[1] = 'e';
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Certificate.bytesLen = 2;
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates_isUsed = 1u;
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[0].bytes[0] = 'S';
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[0].bytes[1] = 'u';
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[0].bytesLen = 2;
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[1].bytes[0] = 'S';
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[1].bytes[1] = 'u';
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[1].bytes[2] = '2';
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.array[1].bytesLen = 3;
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.SubCertificates.Certificate.arrayLen =2;
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Id_isUsed = 1u;
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Id.charactersLen = 2;
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Id.characters[0] = 'I';
+	exiIn.V2G_Message.Body.PaymentDetailsReq.ContractSignatureCertChain.Id.characters[0] = 'd';
+
+	printf("EV side: call EVSE ServiceDetail \n");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.PaymentDetailsRes_isUsed) {
+
+			paymentDetailsRes = exiOut.V2G_Message.Body.PaymentDetailsRes;
+
+			printf("EV side: received response message from EVSE\n");
+			/* show results of EVSEs answer message */
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n",  paymentDetailsRes.ResponseCode);
+			printf("\tEVSETimeStamp=%li\n",  (long int) paymentDetailsRes.EVSETimeStamp);
+			printf("\tGenChallenge=%d\n",   paymentDetailsRes.GenChallenge.bytes[0]);
+
+		} else {
+			errn = ERROR_UNEXPECTED_PAYMENT_DETAILS_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+
+	/*******************************************
+	 * Authorization *
+	 *******************************************/
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.AuthorizationReq_isUsed = 1u;
+
+	init_iso2AuthorizationReqType(&exiIn.V2G_Message.Body.AuthorizationReq);
+
+	copyBytes(paymentDetailsRes.GenChallenge.bytes, paymentDetailsRes.GenChallenge.bytesLen, exiIn.V2G_Message.Body.AuthorizationReq.GenChallenge.bytes);
+	exiIn.V2G_Message.Body.AuthorizationReq.GenChallenge.bytesLen = paymentDetailsRes.GenChallenge.bytesLen;
+	exiIn.V2G_Message.Body.AuthorizationReq.GenChallenge_isUsed = 1u; /* no challenge needed here*/
+	exiIn.V2G_Message.Body.AuthorizationReq.Id_isUsed = 1u; /* no signature needed here */
+	exiIn.V2G_Message.Body.AuthorizationReq.Id.charactersLen = 3;
+	exiIn.V2G_Message.Body.AuthorizationReq.Id.characters[0] = 'I';
+	exiIn.V2G_Message.Body.AuthorizationReq.Id.characters[1] = 'd';
+	exiIn.V2G_Message.Body.AuthorizationReq.Id.characters[2] = '2';
+
+	printf("EV side: call EVSE Authorization \n");
+
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.AuthorizationRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n",  exiOut.V2G_Message.Body.AuthorizationRes.ResponseCode);
+
+			if(exiOut.V2G_Message.Body.AuthorizationRes.EVSEProcessing == iso2EVSEProcessingType_Finished) {
+				printf("\t EVSEProcessing=Finished\n");
+			}
+		} else {
+			errn = ERROR_UNEXPECTED_AUTHORIZATION_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+
+	/*******************************************
+	 * chargeParameterDiscovery *
+	 *******************************************/
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq_isUsed = 1u;
+
+	init_iso2ChargeParameterDiscoveryReqType(&exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq);
+
+	/* we use here AC based charging parameters */
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.MaxSupportingPoints_isUsed = 1u;
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.MaxSupportingPoints = 1234;
+
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter_isUsed = 1u;
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.DepartureTime = 12345;
+
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumChargePower.Exponent = 0;
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumChargePower.Value = 100;
+
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumChargeCurrent.Exponent = 0;
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumChargeCurrent.Value = 400;
+
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMinimumChargeCurrent.Exponent = 0;
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMinimumChargeCurrent.Value = 200;
+
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumVoltage.Exponent = 0;
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumVoltage.Value = 400;
+
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumDischargePower.Exponent = 0;
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumDischargePower.Value = 200;
+
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumDischargeCurrent.Exponent = 0;
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMaximumDischargeCurrent.Value = 400;
+
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMinimumDischargeCurrent.Exponent = 0;
+	exiIn.V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVBidirectionalParameter.EVMinimumDischargeCurrent.Value = 200;
+
+	printf("EV side: call EVSE chargeParameterDiscovery");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.ChargeParameterDiscoveryRes.ResponseCode);
+
+			/*printACEVSEStatus(&(exiOut.V2G_Message.Body.ChargeParameterDiscoveryRes.AC_EVSEChargeParameter.AC_EVSEStatus));
+			printf("\t EVSEProcessing=%d\n", exiOut.V2G_Message.Body.ChargeParameterDiscoveryRes.EVSEProcessing);
+			printf("\t EVSEMaxCurrent=%d\n", exiOut.V2G_Message.Body.ChargeParameterDiscoveryRes.AC_EVSEChargeParameter.EVSEMaxCurrent.Value);
+			printf("\t EVSENominalVoltage=%d\n", exiOut.V2G_Message.Body.ChargeParameterDiscoveryRes.AC_EVSEChargeParameter.EVSENominalVoltage.Value);*/
+		} else {
+			errn = ERROR_UNEXPECTED_CHARGE_PARAMETER_DISCOVERY_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+
+
+	/*****************************
+	 * cableCheck *
+	 *****************************/
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.CableCheckReq_isUsed = 1u;
+
+	/*init_v2gCableCheckReqType(&exiIn.V2G_Message.Body.CableCheckReq);*/
+
+	printf("EV side: call EVSE cableCheck \n");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.CableCheckRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.CableCheckRes.ResponseCode);
+
+			if(exiOut.V2G_Message.Body.CableCheckRes.EVSEProcessing==iso2EVSEProcessingType_Finished) {
+				printf("\tEVSEProcessing=Finished\n");
+			}
+
+			printEVSEStatus2(&(exiOut.V2G_Message.Body.CableCheckRes.EVSEStatus));
+		} else {
+			errn = ERROR_UNEXPECTED_CABLE_CHECK_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+	/*****************************
+	 * preCharge *
+	 *****************************/
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.PreChargeReq_isUsed = 1u;
+
+	init_iso2PreChargeReqType(&exiIn.V2G_Message.Body.PreChargeReq);
+
+	exiIn.V2G_Message.Body.PreChargeReq.EVTargetCurrent.Exponent = 1;
+	exiIn.V2G_Message.Body.PreChargeReq.EVTargetCurrent.Value = 234;
+
+	exiIn.V2G_Message.Body.PreChargeReq.EVTargetVoltage.Exponent = 1;
+	exiIn.V2G_Message.Body.PreChargeReq.EVTargetVoltage.Value = 100;
+
+	printf("EV side: call EVSE preCharge \n");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.PreChargeRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.PreChargeRes.ResponseCode);
+
+			printEVSEStatus2(&exiOut.V2G_Message.Body.PreChargeRes.EVSEStatus);
+			printf("\tEVSEPresentVoltage=%d (%d %d)\n", exiOut.V2G_Message.Body.PreChargeRes.EVSEPresentVoltage.Value, exiOut.V2G_Message.Body.PreChargeRes.EVSEPresentVoltage.Value, exiOut.V2G_Message.Body.PreChargeRes.EVSEPresentVoltage.Exponent);
+
+		} else {
+			errn = ERROR_UNEXPECTED_PRE_CHARGE_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+	/*********************************
+	 * PowerDelivery *
+	 *********************************/
+
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.PowerDeliveryReq_isUsed = 1u;
+
+	init_iso2PowerDeliveryReqType(&exiIn.V2G_Message.Body.PowerDeliveryReq);
+
+	exiIn.V2G_Message.Body.PowerDeliveryReq.ChargeProgress = iso2chargeProgressType_Start;
+	exiIn.V2G_Message.Body.PowerDeliveryReq.SAScheduleTupleID_isUsed = 1u;
+	exiIn.V2G_Message.Body.PowerDeliveryReq.SAScheduleTupleID = exiOut.V2G_Message.Body.ChargeParameterDiscoveryRes.SAScheduleList.SAScheduleTuple.array[0].SAScheduleTupleID;
+
+	printf("EV side: call EVSE powerDelivery \n");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.PowerDeliveryRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.PowerDeliveryRes.ResponseCode);
+
+			/*printACEVSEStatus(&(exiOut.V2G_Message.Body.PowerDeliveryRes.AC_EVSEStatus));*/
+		} else {
+			errn = ERROR_UNEXPECTED_POWER_DELIVERY_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+	/*********************************
+	 * Setup data for chargingStatus *
+	 *********************************/
+
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.ChargingStatusReq_isUsed = 1u;
+
+	init_iso2ChargingStatusReqType(&exiIn.V2G_Message.Body.ChargingStatusReq);
+	exiIn.V2G_Message.Body.ChargingStatusReq.EVTargetEnergyRequest.Exponent = 2;
+	exiIn.V2G_Message.Body.ChargingStatusReq.EVTargetEnergyRequest.Value = 100;
+
+	printf("EV side: call EVSE chargingStatus \n");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.ChargingStatusRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.ChargingStatusRes.ResponseCode);
+
+			/*printACEVSEStatus(&(exiOut.V2G_Message.Body.ChargingStatusRes.AC_EVSEStatus));
+
+			printf("\tReceiptRequired=%d\n", exiOut.V2G_Message.Body.ChargingStatusRes.ReceiptRequired);
+			printf("\tEVSEID=%d\n", exiOut.V2G_Message.Body.ChargingStatusRes.EVSEID.characters[0]);
+			printf("\tSAScheduleTupleID=%d\n", exiOut.V2G_Message.Body.ChargingStatusRes.SAScheduleTupleID);
+			printf("\tEVSEMaxCurrent=%d (%d %d)\n", exiOut.V2G_Message.Body.ChargingStatusRes.EVSEMaxCurrent.Value, exiOut.V2G_Message.Body.ChargingStatusRes.EVSEMaxCurrent.Unit, exiOut.V2G_Message.Body.ChargingStatusRes.EVSEMaxCurrent.Multiplier);
+			printf("\tisused.MeterInfo=%d\n",		exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo_isUsed);
+			printf("\t\tMeterInfo.MeterID=%d\n",		exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo.MeterID.characters[0]);
+			printf("\t\tMeterInfo.MeterReading.Value=%li\n",		(long int)exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo.MeterReading);
+			printf("\t\tMeterInfo.MeterStatus=%d\n",		exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo.MeterStatus);
+			printf("\t\tMeterInfo.TMeter=%li\n",		(long int)exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo.TMeter);
+			printf("\t\tMeterInfo.SigMeterReading.data=%d\n",		exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo.SigMeterReading.bytes[0]);*/
+		} else {
+			errn = ERROR_UNEXPECTED_CHARGING_STATUS_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+
+	/***********************************
+	 * MeteringReceipt *
+	 ***********************************/
+
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.MeteringReceiptReq_isUsed = 1u;
+
+	init_iso2MeteringReceiptReqType(&exiIn.V2G_Message.Body.MeteringReceiptReq);
+
+
+	exiIn.V2G_Message.Body.MeteringReceiptReq.Id.characters[0]='I';
+	exiIn.V2G_Message.Body.MeteringReceiptReq.Id.characters[1]='d';
+	exiIn.V2G_Message.Body.MeteringReceiptReq.Id.characters[2]='3';
+	exiIn.V2G_Message.Body.MeteringReceiptReq.Id.charactersLen =3;
+
+	exiIn.V2G_Message.Body.MeteringReceiptReq.SessionID.bytes[0] = 22;
+	exiIn.V2G_Message.Body.MeteringReceiptReq.SessionID.bytesLen = 1;
+
+	init_iso2MeterInfoType(&exiIn.V2G_Message.Body.MeteringReceiptReq.MeterInfo);
+	exiIn.V2G_Message.Body.MeteringReceiptReq.MeterInfo.MeterID.characters[0] = 'M';
+	exiIn.V2G_Message.Body.MeteringReceiptReq.MeterInfo.MeterID.characters[1] = 'i';
+	exiIn.V2G_Message.Body.MeteringReceiptReq.MeterInfo.MeterID.characters[2] = 'd';
+	exiIn.V2G_Message.Body.MeteringReceiptReq.MeterInfo.MeterID.charactersLen = 3;
+
+	printf("EV side: call EVSE meteringReceipt \n");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.MeteringReceiptRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.MeteringReceiptRes.ResponseCode);
+
+		} else {
+			errn = ERROR_UNEXPECTED_METERING_RECEIPT_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+	/***********************************
+	 * SessionStop *
+	 ***********************************/
+
+
+	init_iso2BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.SessionStopReq_isUsed = 1u;
+
+	init_iso2SessionStopReqType(&exiIn.V2G_Message.Body.SessionStopReq);
+	exiIn.V2G_Message.Body.SessionStopReq.ChargingSession = iso2chargingSessionType_Pause;
+
+	printf("EV side: call EVSE stopSession \n");
+
+	errn = request_response2(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.SessionStopRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.SessionStopRes.ResponseCode);
+
+		} else {
+			errn = ERROR_UNEXPECTED_SESSION_STOP_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+	return errn;
+
+}
+#endif /* DEPLOY_ISO2_CODEC == SUPPORT_YES */
+
+
+
+
+
+
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+
+static void printEVSEStatus1(struct iso1DC_EVSEStatusType* status)
+{
+	printf("\tEVSEStatus:\n");
+	printf("\t\tEVSENotification=%d\n", status->EVSENotification);
+	printf("\t\tNotificationMaxDelay=%d\n", status->NotificationMaxDelay);
+}
+
+
+/* serializes EXI stream and adds V2G TP header */
+static int serialize1EXI2Stream(struct iso1EXIDocument* exiIn, bitstream_t* stream) {
+	int errn;
+	*stream->pos = V2GTP_HEADER_LENGTH;  /* v2gtp header */
+	if( (errn = encode_iso1ExiDocument(stream, exiIn)) == 0) {
+		errn = write_v2gtpHeader(stream->data, (*stream->pos)-V2GTP_HEADER_LENGTH, V2GTP_EXI_TYPE);
+	}
+	return errn;
+}
+
+
+
+/* deserializes V2G TP header and decodes right away EXI stream */
+static int deserialize1Stream2EXI(bitstream_t* streamIn, struct iso1EXIDocument* exi) {
+	int errn;
+	uint32_t payloadLength;
+
+	*streamIn->pos = 0;
+	if ( (errn = read_v2gtpHeader(streamIn->data, &payloadLength)) == 0) {
+		*streamIn->pos += V2GTP_HEADER_LENGTH;
+
+		errn = decode_iso1ExiDocument(streamIn, exi);
+	}
+	return errn;
+}
+
+
+
+static int sessionSetup1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+	printf("EVSE side: sessionSetup called\n"  );
+	printf("\tReceived data:\n");
+	printf("\tHeader SessionID=");
+	printBinaryArray(exiIn->V2G_Message.Header.SessionID.bytes, exiIn->V2G_Message.Header.SessionID.bytesLen);
+	printf("\t\t EVCCID=%d\n", exiIn->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[0]);
+
+	exiOut->V2G_Message_isUsed = 1u;
+
+	/* generate an unique sessionID */
+	init_iso1MessageHeaderType(&exiOut->V2G_Message.Header);
+	exiOut->V2G_Message.Header.SessionID.bytes[0] = 1;
+	exiOut->V2G_Message.Header.SessionID.bytes[1] = 2;
+	exiOut->V2G_Message.Header.SessionID.bytes[2] = 3;
+	exiOut->V2G_Message.Header.SessionID.bytes[3] = 4;
+	exiOut->V2G_Message.Header.SessionID.bytes[4] = 5;
+	exiOut->V2G_Message.Header.SessionID.bytes[5] = 6;
+	exiOut->V2G_Message.Header.SessionID.bytes[6] = 7;
+	exiOut->V2G_Message.Header.SessionID.bytes[7] = 8;
+	exiOut->V2G_Message.Header.SessionID.bytesLen = 8;
+
+	/* Prepare data for EV */
+	init_iso1BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.SessionSetupRes_isUsed = 1u;
+	init_iso1SessionSetupResType(&exiOut->V2G_Message.Body.SessionSetupRes);
+
+	exiOut->V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_OK;
+	exiOut->V2G_Message.Body.SessionSetupRes.EVSEID.characters[0] = 0;
+	exiOut->V2G_Message.Body.SessionSetupRes.EVSEID.characters[1] = 20;
+	exiOut->V2G_Message.Body.SessionSetupRes.EVSEID.charactersLen = 2;
+	exiOut->V2G_Message.Body.SessionSetupRes.EVSETimeStamp_isUsed = 1u;
+	exiOut->V2G_Message.Body.SessionSetupRes.EVSETimeStamp = 123456789;
+
+	return 0;
+}
+
+
+
+static int serviceDetail1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+
+	printf("EVSE side: serviceDetail called\n"  );
+	printf("\tReceived data:\n");
+	printf("\tHeader SessionID=");
+	printBinaryArray(exiIn->V2G_Message.Header.SessionID.bytes, exiIn->V2G_Message.Header.SessionID.bytesLen);
+	printf("\t\t ServiceDetailID=%d\n",exiIn->V2G_Message.Body.ServiceDetailReq.ServiceID);
+
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso1BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.ServiceDetailRes_isUsed= 1u;
+	init_iso1ServiceDetailResType(&exiOut->V2G_Message.Body.ServiceDetailRes);
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceID = 1234;
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList_isUsed = 1u;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.arrayLen = 2;
+
+	/* Parameter Set 1*/
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].ParameterSetID = 1;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.arrayLen = 2;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.charactersLen = 8;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[0] = 'P';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[1] = 'r';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[2] = 'o';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[3] = 't';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[4]= 'o';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[5] = 'c';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[6] = 'o';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].Name.characters[7] = 'l';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].intValue = 15119;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[0].intValue_isUsed = 1u;
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.charactersLen = 4;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.characters[0] = 'N';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.characters[1] = 'a';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.characters[2] = 'm';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].Name.characters[3] = 'e';
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].stringValue_isUsed = 1u;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].stringValue.charactersLen = 3;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].stringValue.characters[0] = 'V';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].stringValue.characters[1] = '2';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[0].Parameter.array[1].stringValue.characters[2] = 'G';
+
+	/* Parameter Set 2 */
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].ParameterSetID = 2;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.arrayLen = 1;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.charactersLen = 7;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[0] = 'C';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[1] = 'h';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[2] = 'a';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[3] = 'n';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[4] = 'n';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[5] = 'e';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].Name.characters[6] = 'l';
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].physicalValue_isUsed = 1u;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].physicalValue.Value = 1234;
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].physicalValue.Multiplier = 1;
+	exiOut->V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[1].Parameter.array[0].physicalValue.Value = 2;
+
+	exiOut->V2G_Message.Body.ServiceDetailRes.ResponseCode = iso1responseCodeType_OK;
+
+	return 0;
+}
+
+
+
+static int authorization1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+
+	printf("EVSE: Authorization called\n"  );
+	printf("\tReceived data:\n");
+
+	if(exiIn->V2G_Message.Body.AuthorizationReq.GenChallenge_isUsed) {
+		printf("\t\t\t GenChallenge=%d\n", exiIn->V2G_Message.Body.AuthorizationReq.GenChallenge.bytes[0]);
+	}
+	if(exiIn->V2G_Message.Body.AuthorizationReq.Id_isUsed ) {
+		printf("\t\t\t ID=%c%c%c\n", exiIn->V2G_Message.Body.AuthorizationReq.Id.characters[0], exiIn->V2G_Message.Body.AuthorizationReq.Id.characters[1], exiIn->V2G_Message.Body.AuthorizationReq.Id.characters[2]);
+	}
+
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso1BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.AuthorizationRes_isUsed = 1u;
+	init_iso1AuthorizationResType(&exiOut->V2G_Message.Body.AuthorizationRes);
+
+	exiOut->V2G_Message.Body.AuthorizationRes.ResponseCode = iso1responseCodeType_OK;
+	exiOut->V2G_Message.Body.AuthorizationRes.EVSEProcessing = iso1EVSEProcessingType_Finished;
+
+	return 0;
+}
+
+
+static int powerDelivery1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+	printf("EVSE side: powerDelivery called\n"  );
+	printf("\tReceived data:\n");
+
+	printf("\t\t  ChargeProgress=%d\n", exiIn->V2G_Message.Body.PowerDeliveryReq.ChargeProgress);
+	printf("\t\t  SAScheduleTupleID=%d\n", exiIn->V2G_Message.Body.PowerDeliveryReq.SAScheduleTupleID);
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso1BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
+	init_iso1PowerDeliveryResType(&exiOut->V2G_Message.Body.PowerDeliveryRes);
+
+	exiOut->V2G_Message.Body.PowerDeliveryRes.ResponseCode = iso1responseCodeType_OK;
+
+	exiOut->V2G_Message.Body.PowerDeliveryRes.EVSEStatus_isUsed = 1;
+	exiOut->V2G_Message.Body.PowerDeliveryRes.EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+	exiOut->V2G_Message.Body.PowerDeliveryRes.EVSEStatus.NotificationMaxDelay=12;
+
+	return 0;
+}
+
+
+static int chargingStatus1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+
+	printf("EVSE side: chargingStatus called\n"  );
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso1BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.ChargingStatusRes_isUsed = 1u;
+	init_iso1ChargingStatusResType(&exiOut->V2G_Message.Body.ChargingStatusRes);
+
+
+	exiOut->V2G_Message.Body.ChargingStatusRes.ResponseCode = iso1responseCodeType_OK;
+	exiOut->V2G_Message.Body.ChargingStatusRes.EVSEID.characters[0]= 'A';
+	exiOut->V2G_Message.Body.ChargingStatusRes.EVSEID.charactersLen =1;
+
+	exiOut->V2G_Message.Body.ChargingStatusRes.ReceiptRequired = 1;
+	exiOut->V2G_Message.Body.ChargingStatusRes.ReceiptRequired_isUsed = 1;
+
+	return 0;
+}
+
+
+static int meteringReceipt1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+
+	printf("EVSE side: meteringReceipt called\n"  );
+	printf("\tReceived data:\n");
+
+	printf("\t\t ID=%c%c%c\n", exiIn->V2G_Message.Body.MeteringReceiptReq.Id.characters[0], exiIn->V2G_Message.Body.MeteringReceiptReq.Id.characters[1], exiIn->V2G_Message.Body.MeteringReceiptReq.Id.characters[2]);
+	printf("\t\t SAScheduleTupleID=%d\n", exiIn->V2G_Message.Body.MeteringReceiptReq.SAScheduleTupleID);
+	printf("\t\t SessionID=%d\n", exiIn->V2G_Message.Body.MeteringReceiptReq.SessionID.bytes[1]);
+	printf("\t\t MeterInfo.MeterStatus=%d\n", exiIn->V2G_Message.Body.MeteringReceiptReq.MeterInfo.MeterStatus);
+	printf("\t\t MeterInfo.MeterID=%d\n",		exiIn->V2G_Message.Body.MeteringReceiptReq.MeterInfo.MeterID.characters[0]);
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso1BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.MeteringReceiptRes_isUsed = 1u;
+	init_iso1MeteringReceiptResType(&exiOut->V2G_Message.Body.MeteringReceiptRes);
+
+	exiOut->V2G_Message.Body.MeteringReceiptRes.ResponseCode = iso1responseCodeType_FAILED;
+
+	return 0;
+}
+
+static int sessionStop1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+
+	printf("EVSE side: sessionStop called\n"  );
+	printf("\tReceived data:\n");
+	printf("\tHeader SessionID=");
+	printBinaryArray(exiIn->V2G_Message.Header.SessionID.bytes, exiIn->V2G_Message.Header.SessionID.bytesLen);
+	printf("\t\t ChargingSession=%d\n", exiIn->V2G_Message.Body.SessionStopReq.ChargingSession);
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso1BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.SessionStopRes_isUsed = 1u;
+	init_iso1SessionStopResType(&exiOut->V2G_Message.Body.SessionStopRes);
+
+	exiOut->V2G_Message.Body.SessionStopRes.ResponseCode = iso1responseCodeType_OK;
+
+	return 0;
+}
+
+static int cableCheck1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+
+	printf("EVSE side: cableCheck called\n"  );
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso1BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.CableCheckRes_isUsed = 1u;
+	init_iso1CableCheckResType(&exiOut->V2G_Message.Body.CableCheckRes);
+
+	exiOut->V2G_Message.Body.CableCheckRes.ResponseCode = iso1responseCodeType_OK;
+
+	exiOut->V2G_Message.Body.CableCheckRes.DC_EVSEStatus.NotificationMaxDelay = 1234;
+	exiOut->V2G_Message.Body.CableCheckRes.DC_EVSEStatus.EVSENotification= iso1EVSENotificationType_ReNegotiation;
+
+	exiOut->V2G_Message.Body.CableCheckRes.EVSEProcessing = iso1EVSEProcessingType_Finished;
+
+	return 0;
+}
+
+static int preCharge1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+
+	printf("EVSE side: preCharge called\n"  );
+	printf("\tReceived data:\n");
+
+	printf("\t\t EVTargetCurrent=%d (%d)\n", exiIn->V2G_Message.Body.PreChargeReq.EVTargetCurrent.Value, exiIn->V2G_Message.Body.PreChargeReq.EVTargetCurrent.Multiplier);
+	printf("\t\t EVTargetVoltage=%d (%d)\n", exiIn->V2G_Message.Body.PreChargeReq.EVTargetVoltage.Value, exiIn->V2G_Message.Body.PreChargeReq.EVTargetVoltage.Multiplier);
+
+	/* Prepare data for EV */
+	exiOut->V2G_Message_isUsed = 1u;
+	init_iso1BodyType(&exiOut->V2G_Message.Body);
+
+	exiOut->V2G_Message.Body.PreChargeRes_isUsed = 1u;
+	init_iso1PreChargeResType(&exiOut->V2G_Message.Body.PreChargeRes);
+
+	exiOut->V2G_Message.Body.PreChargeRes.ResponseCode = iso1responseCodeType_OK;
+
+	exiOut->V2G_Message.Body.PreChargeRes.DC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+	exiOut->V2G_Message.Body.PreChargeRes.DC_EVSEStatus.NotificationMaxDelay= 1234;
+
+	exiOut->V2G_Message.Body.PreChargeRes.EVSEPresentVoltage.Multiplier = 3;
+	exiOut->V2G_Message.Body.PreChargeRes.EVSEPresentVoltage.Value= 456;
+
+	return 0;
+}
+
+
+
+
+
+static int create_response_message1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+	int errn = ERROR_UNEXPECTED_REQUEST_MESSAGE;
+
+	/* create response message as EXI document */
+	if(exiIn->V2G_Message_isUsed) {
+		init_iso1EXIDocument(exiOut);
+		if (exiIn->V2G_Message.Body.SessionSetupReq_isUsed) {
+			errn = sessionSetup1(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.ServiceDetailReq_isUsed) {
+			errn = serviceDetail1(exiIn, exiOut);
+		/*} else if (exiIn->V2G_Message.Body.PaymentDetailsReq_isUsed) {
+			errn = paymentDetails1(exiIn, exiOut);*/
+		} else if (exiIn->V2G_Message.Body.AuthorizationReq_isUsed) {
+			errn = authorization1(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.PowerDeliveryReq_isUsed) {
+			errn = powerDelivery1(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.ChargingStatusReq_isUsed) {
+			errn = chargingStatus1(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.MeteringReceiptReq_isUsed) {
+			errn = meteringReceipt1(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.SessionStopReq_isUsed) {
+			errn = sessionStop1(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.CableCheckReq_isUsed) {
+			errn = cableCheck1(exiIn, exiOut);
+		} else if (exiIn->V2G_Message.Body.PreChargeReq_isUsed) {
+			errn = preCharge1(exiIn, exiOut);
+		}
+	}
+
+	return errn;
+}
+
+
+/* Adapt this to your system setup! */
+/* In this situation EV and EVSE is the same party */
+static int request_response1(struct iso1EXIDocument* exiIn, struct iso1EXIDocument* exiOut) {
+	int errn;
+
+	bitstream_t stream1;
+	bitstream_t stream2;
+
+	size_t pos1;
+	size_t pos2;
+
+	stream1.size = BUFFER_SIZE;
+	stream1.data = buffer1;
+	stream1.pos = &pos1;
+
+	stream2.size = BUFFER_SIZE;
+	stream2.data = buffer2;
+	stream2.pos = &pos2;
+
+	/* EV side */
+	errn = serialize1EXI2Stream(exiIn, &stream1);
+
+	/* --> Start of EVSE side */
+	/* deserialize request message */
+	if (errn == 0) {
+		errn = deserialize1Stream2EXI(&stream1, exiOut);
+	}
+	/* create response message */
+	if (errn == 0) {
+		errn = create_response_message1(exiOut, exiIn);
+	}
+	/* serialize response message */
+	if (errn == 0) {
+		errn = serialize1EXI2Stream(exiIn, &stream2);
+	}
+	/* <-- End of EVSE side */
+
+
+	/* EV side */
+	/* deserialize response message */
+	if (errn == 0) {
+		errn = deserialize1Stream2EXI(&stream2, exiOut);
+	}
+
+	return errn;
+}
+
+static int charging1()
+{
+	int errn = 0;
+	int i, j;
+
+	struct iso1EXIDocument exiIn;
+	struct iso1EXIDocument exiOut;
+
+	struct iso1ServiceDetailResType serviceDetailRes;
+	struct iso1PaymentDetailsResType paymentDetailsRes;
+
+	/* setup header information */
+	init_iso1EXIDocument(&exiIn);
+	exiIn.V2G_Message_isUsed = 1u;
+	init_iso1MessageHeaderType(&exiIn.V2G_Message.Header);
+	exiIn.V2G_Message.Header.SessionID.bytes[0] = 0; /* sessionID is always '0' at the beginning (the response contains the valid sessionID)*/
+	exiIn.V2G_Message.Header.SessionID.bytes[1] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[2] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[3] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[4] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[5] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[6] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytes[7] = 0;
+	exiIn.V2G_Message.Header.SessionID.bytesLen = 8;
+	exiIn.V2G_Message.Header.Signature_isUsed = 0u;
+
+
+	/************************
+	 * sessionSetup *
+	 ************************/
+	init_iso1BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.SessionSetupReq_isUsed = 1u;
+
+	init_iso1SessionSetupReqType(&exiIn.V2G_Message.Body.SessionSetupReq);
+
+	exiIn.V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen = 1;
+	exiIn.V2G_Message.Body.SessionSetupReq.EVCCID.bytes[0] = 10;
+
+	printf("EV side: call EVSE sessionSetup");
+
+	errn = request_response1(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.SessionSetupRes_isUsed) {
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\tResponseCode=%d\n", exiOut.V2G_Message.Body.SessionSetupRes.ResponseCode);
+			printf("\tEVSEID=%d\n",	exiOut.V2G_Message.Body.SessionSetupRes.EVSEID.characters[1]);
+			printf("\tEVSETimeStamp=%li\n", (long int)exiOut.V2G_Message.Body.SessionSetupRes.EVSETimeStamp);
+		} else {
+			errn = ERROR_UNEXPECTED_SESSION_SETUP_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+	/*********************************
+	 * ServiceDetails *
+	 *********************************/
+	init_iso1BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.ServiceDetailReq_isUsed = 1u;
+
+	init_iso1ServiceDetailReqType(&exiIn.V2G_Message.Body.ServiceDetailReq);
+
+	exiIn.V2G_Message.Body.ServiceDetailReq.ServiceID = 22; /* Value Added Server ID */
+
+	printf("EV side: call EVSE ServiceDetail \n");
+
+	errn = request_response1(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.ServiceDetailRes_isUsed) {
+			serviceDetailRes = exiOut.V2G_Message.Body.ServiceDetailRes;
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n",  exiOut.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode);
+			printf("\t ServiceID=%d\n",	exiOut.V2G_Message.Body.ServiceDetailRes.ServiceID);
+
+			if(serviceDetailRes.ServiceParameterList_isUsed) {
+				printf("\t\tLength=%d\n", serviceDetailRes.ServiceParameterList.ParameterSet.arrayLen );/*TEST*/
+
+				for(i=0; i<serviceDetailRes.ServiceParameterList.ParameterSet.arrayLen; i++)
+				{
+					printf("\t\tServiceSetID=%d\n", serviceDetailRes.ServiceParameterList.ParameterSet.array[i].ParameterSetID);
+					printf("\t\tParameters=%d\n", serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.arrayLen);
+
+					for(j=0; j<serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.arrayLen; j++)
+					{
+						printf("\t\t\t %d: ParameterName=", j+1);
+						printASCIIString(serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].Name.characters, exiOut.V2G_Message.Body.ServiceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].Name.charactersLen);
+
+						/*if(serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].shortValue_isUsed == 1u) {
+							printf("\t\t\t %d: StringValue=", j+1);
+							printASCIIString(serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].stringValue.characters, serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].stringValue.charactersLen);
+						} else if(serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].intValue_isUsed == 1u) {
+							printf("\t\t\t %d: IntValue=%d\n", j+1, serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].intValue);
+						} else if(serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].physicalValue_isUsed == 1u) {
+							printf("\t\t\t %d: PhysicalValue=%d (%d)\n",  j+1, serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].physicalValue.Value, serviceDetailRes.ServiceParameterList.ParameterSet.array[i].Parameter.array[j].physicalValue.Multiplier);
+						}*/
+					}
+				}
+			}
+		} else {
+			errn = ERROR_UNEXPECTED_SERVICE_DETAILS_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+
+	/*******************************************
+	 * Authorization *
+	 *******************************************/
+	init_iso1BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.AuthorizationReq_isUsed = 1u;
+
+	init_iso1AuthorizationReqType(&exiIn.V2G_Message.Body.AuthorizationReq);
+
+	copyBytes(paymentDetailsRes.GenChallenge.bytes, paymentDetailsRes.GenChallenge.bytesLen, exiIn.V2G_Message.Body.AuthorizationReq.GenChallenge.bytes);
+	exiIn.V2G_Message.Body.AuthorizationReq.GenChallenge.bytesLen = paymentDetailsRes.GenChallenge.bytesLen;
+	exiIn.V2G_Message.Body.AuthorizationReq.GenChallenge_isUsed = 1u; /* no challenge needed here*/
+	exiIn.V2G_Message.Body.AuthorizationReq.Id_isUsed = 1u; /* no signature needed here */
+	exiIn.V2G_Message.Body.AuthorizationReq.Id.charactersLen = 3;
+	exiIn.V2G_Message.Body.AuthorizationReq.Id.characters[0] = 'I';
+	exiIn.V2G_Message.Body.AuthorizationReq.Id.characters[1] = 'd';
+	exiIn.V2G_Message.Body.AuthorizationReq.Id.characters[2] = '2';
+
+	printf("EV side: call EVSE Authorization \n");
+
+
+	errn = request_response1(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.AuthorizationRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n",  exiOut.V2G_Message.Body.AuthorizationRes.ResponseCode);
+
+			if(exiOut.V2G_Message.Body.AuthorizationRes.EVSEProcessing == iso1EVSEProcessingType_Finished) {
+				printf("\t EVSEProcessing=Finished\n");
+			}
+		} else {
+			errn = ERROR_UNEXPECTED_AUTHORIZATION_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+
+
+	/*****************************
+	 * cableCheck *
+	 *****************************/
+	init_iso1BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.CableCheckReq_isUsed = 1u;
+
+	/*init_v2gCableCheckReqType(&exiIn.V2G_Message.Body.CableCheckReq);*/
+
+	printf("EV side: call EVSE cableCheck \n");
+
+	errn = request_response1(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.CableCheckRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.CableCheckRes.ResponseCode);
+
+			if(exiOut.V2G_Message.Body.CableCheckRes.EVSEProcessing==iso1EVSEProcessingType_Finished) {
+				printf("\tEVSEProcessing=Finished\n");
+			}
+
+			printEVSEStatus1(&(exiOut.V2G_Message.Body.CableCheckRes.DC_EVSEStatus));
+		} else {
+			errn = ERROR_UNEXPECTED_CABLE_CHECK_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+	/*****************************
+	 * preCharge *
+	 *****************************/
+	init_iso1BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.PreChargeReq_isUsed = 1u;
+
+	init_iso1PreChargeReqType(&exiIn.V2G_Message.Body.PreChargeReq);
+
+	exiIn.V2G_Message.Body.PreChargeReq.EVTargetCurrent.Multiplier = 1;
+	exiIn.V2G_Message.Body.PreChargeReq.EVTargetCurrent.Value = 234;
+
+	exiIn.V2G_Message.Body.PreChargeReq.EVTargetVoltage.Multiplier = 1;
+	exiIn.V2G_Message.Body.PreChargeReq.EVTargetVoltage.Value = 100;
+
+	printf("EV side: call EVSE preCharge \n");
+
+	errn = request_response1(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.PreChargeRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.PreChargeRes.ResponseCode);
+
+			printEVSEStatus1(&exiOut.V2G_Message.Body.PreChargeRes.DC_EVSEStatus);
+			printf("\tEVSEPresentVoltage=%d (%d %d)\n", exiOut.V2G_Message.Body.PreChargeRes.EVSEPresentVoltage.Value, exiOut.V2G_Message.Body.PreChargeRes.EVSEPresentVoltage.Value, exiOut.V2G_Message.Body.PreChargeRes.EVSEPresentVoltage.Multiplier);
+
+		} else {
+			errn = ERROR_UNEXPECTED_PRE_CHARGE_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+	/*********************************
+	 * PowerDelivery *
+	 *********************************/
+
+	init_iso1BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.PowerDeliveryReq_isUsed = 1u;
+
+	init_iso1PowerDeliveryReqType(&exiIn.V2G_Message.Body.PowerDeliveryReq);
+
+	exiIn.V2G_Message.Body.PowerDeliveryReq.ChargeProgress = iso1chargeProgressType_Start;
+	exiIn.V2G_Message.Body.PowerDeliveryReq.SAScheduleTupleID = exiOut.V2G_Message.Body.ChargeParameterDiscoveryRes.SAScheduleList.SAScheduleTuple.array[0].SAScheduleTupleID;
+
+	printf("EV side: call EVSE powerDelivery \n");
+
+	errn = request_response1(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.PowerDeliveryRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.PowerDeliveryRes.ResponseCode);
+
+			/*printACEVSEStatus(&(exiOut.V2G_Message.Body.PowerDeliveryRes.AC_EVSEStatus));*/
+		} else {
+			errn = ERROR_UNEXPECTED_POWER_DELIVERY_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+	/*********************************
+	 * Setup data for chargingStatus *
+	 *********************************/
+
+	init_iso1BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.ChargingStatusReq_isUsed = 1u;
+
+	init_iso1ChargingStatusReqType(&exiIn.V2G_Message.Body.ChargingStatusReq);
+
+	printf("EV side: call EVSE chargingStatus \n");
+
+	errn = request_response1(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.ChargingStatusRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.ChargingStatusRes.ResponseCode);
+
+			/*printACEVSEStatus(&(exiOut.V2G_Message.Body.ChargingStatusRes.AC_EVSEStatus));
+
+			printf("\tReceiptRequired=%d\n", exiOut.V2G_Message.Body.ChargingStatusRes.ReceiptRequired);
+			printf("\tEVSEID=%d\n", exiOut.V2G_Message.Body.ChargingStatusRes.EVSEID.characters[0]);
+			printf("\tSAScheduleTupleID=%d\n", exiOut.V2G_Message.Body.ChargingStatusRes.SAScheduleTupleID);
+			printf("\tEVSEMaxCurrent=%d (%d %d)\n", exiOut.V2G_Message.Body.ChargingStatusRes.EVSEMaxCurrent.Value, exiOut.V2G_Message.Body.ChargingStatusRes.EVSEMaxCurrent.Unit, exiOut.V2G_Message.Body.ChargingStatusRes.EVSEMaxCurrent.Multiplier);
+			printf("\tisused.MeterInfo=%d\n",		exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo_isUsed);
+			printf("\t\tMeterInfo.MeterID=%d\n",		exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo.MeterID.characters[0]);
+			printf("\t\tMeterInfo.MeterReading.Value=%li\n",		(long int)exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo.MeterReading);
+			printf("\t\tMeterInfo.MeterStatus=%d\n",		exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo.MeterStatus);
+			printf("\t\tMeterInfo.TMeter=%li\n",		(long int)exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo.TMeter);
+			printf("\t\tMeterInfo.SigMeterReading.data=%d\n",		exiOut.V2G_Message.Body.ChargingStatusRes.MeterInfo.SigMeterReading.bytes[0]);*/
+		} else {
+			errn = ERROR_UNEXPECTED_CHARGING_STATUS_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+	/***********************************
+	 * SessionStop *
+	 ***********************************/
+
+
+	init_iso1BodyType(&exiIn.V2G_Message.Body);
+	exiIn.V2G_Message.Body.SessionStopReq_isUsed = 1u;
+
+	init_iso1SessionStopReqType(&exiIn.V2G_Message.Body.SessionStopReq);
+	exiIn.V2G_Message.Body.SessionStopReq.ChargingSession = iso1chargingSessionType_Pause;
+
+	printf("EV side: call EVSE stopSession \n");
+
+	errn = request_response1(&exiIn, &exiOut);
+
+	if(errn == 0) {
+		/* check, if this is the right response message */
+		if(exiOut.V2G_Message.Body.SessionStopRes_isUsed) {
+
+			/* show results of EVSEs answer message */
+			printf("EV side: received response message from EVSE\n");
+			printf("\tHeader SessionID=");
+			printBinaryArray(exiOut.V2G_Message.Header.SessionID.bytes, exiOut.V2G_Message.Header.SessionID.bytesLen);
+			printf("\t ResponseCode=%d\n", exiOut.V2G_Message.Body.SessionStopRes.ResponseCode);
+
+		} else {
+			errn = ERROR_UNEXPECTED_SESSION_STOP_RESP_MESSAGE;
+			return errn;
+		}
+	} else {
+		return errn;
+	}
+
+
+
+	return errn;
+
+}
+#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()
+{
+	int errn = 0;
+
+	struct dinEXIDocument exiDin1;
+	struct dinEXIDocument exiDin2;
+
+	bitstream_t stream1;
+	bitstream_t stream2;
+
+	size_t pos1 = 0;
+	size_t pos2 = 0;
+
+	stream1.size = BUFFER_SIZE;
+	stream1.data = buffer1;
+	stream1.pos = &pos1;
+
+	stream2.size = BUFFER_SIZE;
+	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;
+	buffer1[1] = 0x9A;
+	buffer1[2] = 0x00;
+	buffer1[3] = 0x11;
+	buffer1[4] = 0xD0;
+	buffer1[5] = 0x20;
+	buffer1[6] = 0x00;
+	buffer1[7] = 0x03;
+	buffer1[8] = 0xC1;
+	buffer1[9] = 0xFC;
+	buffer1[10] = 0x30;
+	buffer1[11] = 0x00;
+	buffer1[12] = 0x43;
+	buffer1[13] = 0xF8;
+	buffer1[14] = 0x00;
+
+	errn =  decode_dinExiDocument(&stream1, &exiDin1);
+
+	printf("\n\tSessionSetupReq_isUsed = %d\n", exiDin1.V2G_Message.Body.SessionSetupReq_isUsed);
+	printf("\t\tEVCCID Length= %d\n", exiDin1.V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen);
+	printf("\t\tEVCCID = %02X%02X%02X%02X%02X%02X%02X%02X\n",
+			exiDin1.V2G_Message.Body.SessionSetupReq.EVCCID.bytes[0],
+			exiDin1.V2G_Message.Body.SessionSetupReq.EVCCID.bytes[1],
+			exiDin1.V2G_Message.Body.SessionSetupReq.EVCCID.bytes[2],
+			exiDin1.V2G_Message.Body.SessionSetupReq.EVCCID.bytes[3],
+			exiDin1.V2G_Message.Body.SessionSetupReq.EVCCID.bytes[4],
+			exiDin1.V2G_Message.Body.SessionSetupReq.EVCCID.bytes[5],
+			exiDin1.V2G_Message.Body.SessionSetupReq.EVCCID.bytes[6],
+			exiDin1.V2G_Message.Body.SessionSetupReq.EVCCID.bytes[7]
+		);
+
+
+	if(errn != 0)
+	{
+		printf("\n\nDIN test error %d!\n", errn);
+		return errn;
+	}
+	else if (pos1 != 15)
+	{
+		printf("\n\nDIN warning. not all bytes read!\n");
+		errn = -1;
+		return errn;
+	}
+
+
+	/* SetupSessionReq  */
+	/* Chevy: 80 9A 02 00 00 00 00 00 00 00 00 11 D0 18 00 60 8C 44 09 94 00 */
+	buffer2[0] = 0x80;
+	buffer2[1] = 0x9A;
+	buffer2[2] = 0x02;
+	buffer2[3] = 0x00;
+	buffer2[4] = 0x00;
+	buffer2[5] = 0x00;
+	buffer2[6] = 0x00;
+	buffer2[7] = 0x00;
+	buffer2[8] = 0x00;
+	buffer2[9] = 0x00;
+	buffer2[10] = 0x00;
+	buffer2[11] = 0x11;
+	buffer2[12] = 0xD0;
+	buffer2[13] = 0x18;
+	buffer2[14] = 0x00;
+	buffer2[15] = 0x60;
+	buffer2[16] = 0x8C;
+	buffer2[17] = 0x44;
+	buffer2[18] = 0x09;
+	buffer2[19] = 0x94;
+	buffer2[20] = 0x00;
+
+	errn =  decode_dinExiDocument(&stream2, &exiDin2);
+
+	if(errn != 0) {
+		printf("\n\nDIN test error %d!\n", errn);
+		return errn;
+	} else if (pos2 != 21) {
+		printf("\n\nDIN warning. not all bytes read!\n");
+		errn = -1;
+		return errn;
+	}
+
+
+	/* sessionStopReq  */
+	pos2 = 0; /* reset position */
+
+	/* V: 0x80, 0x9a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x91, 0xf0  */
+	buffer2[0] = 0x80;
+	buffer2[1] = 0x9a;
+	buffer2[2] = 0x02;
+	buffer2[3] = 0x00;
+	buffer2[4] = 0x00;
+	buffer2[5] = 0x00;
+	buffer2[6] = 0x00;
+	buffer2[7] = 0x00;
+	buffer2[8] = 0x00;
+	buffer2[9] = 0x00;
+	buffer2[10] = 0x03;
+	buffer2[11] = 0x91;
+	buffer2[12] = 0xf0;
+
+	errn =  decode_dinExiDocument(&stream2, &exiDin2);
+
+	if(errn != 0) {
+		printf("\n\nDIN test error %d!\n", errn);
+		return errn;
+	} else if (pos2 != 13) {
+		printf("\n\nDIN warning. not all bytes read!\n");
+		errn = -1;
+		return errn;
+	} else if(exiDin2.V2G_Message_isUsed == 0 || exiDin2.V2G_Message.Body.SessionStopReq_isUsed == 0) {
+		printf("\n\nDIN warning. no sessionStopReq message!\n");
+		errn = -1;
+		return errn;
+	}
+
+
+	if(errn == 0) {
+		printf("DIN test passed\n");
+	} else {
+		printf("DIN test error %d!\n", errn);
+	}
+
+	return errn;
+}
+#endif /* DEPLOY_DIN_CODEC == SUPPORT_YES */
+
+
+
+#if DEPLOY_XMLDSIG_CODEC == SUPPORT_YES
+#if DEPLOY_ISO_CODEC_FRAGMENT == SUPPORT_YES
+static int xmldsig_test() {
+	int errn = 0, i;
+
+	bitstream_t stream1;
+	size_t pos1 = 0;
+	stream1.size = BUFFER_SIZE;
+	stream1.data = buffer1;
+	stream1.pos = &pos1;
+
+	bitstream_t stream2;
+	size_t pos2 = 0;
+	stream2.size = BUFFER_SIZE;
+	stream2.data = buffer2;
+	stream2.pos = &pos2;
+
+	struct iso2EXIFragment exiV2G_AR;
+	struct xmldsigEXIFragment exiXMLDSIG_SI;
+
+	int sizeIsoStream1 = 25;
+	int isoStream1[] = {0x80, 0x04, 0x01, 0x52, 0x51, 0x0C, 0x40, 0x82, 0x9B, 0x7B, 0x6B, 0x29, 0x02, 0x93, 0x0B, 0x73, 0x23, 0x7B, 0x69, 0x02, 0x23, 0x0B, 0xA3, 0x09, 0xE8};
+
+	int sizeIsoStream2 = 209;
+	int isoStream2[] = {0x80, 0x81, 0x12, 0xB4, 0x3A, 0x3A, 0x38, 0x1D, 0x17, 0x97, 0xBB, 0xBB, 0xBB, 0x97, 0x3B, 0x99, 0x97, 0x37, 0xB9, 0x33, 0x97, 0xAA, 0x29, 0x17, 0xB1, 0xB0, 0xB7, 0x37, 0xB7, 0x34, 0xB1, 0xB0, 0xB6, 0x16, 0xB2, 0xBC, 0x34, 0x97, 0xA1, 0xAB, 0x43, 0xA3, 0xA3, 0x81, 0xD1, 0x79, 0x7B, 0xBB, 0xBB, 0xB9, 0x73, 0xB9, 0x99, 0x73, 0x7B, 0x93, 0x39, 0x79, 0x91, 0x81, 0x81, 0x89, 0x79, 0x81, 0xA1, 0x7B, 0xC3, 0x6B, 0x63, 0x23, 0x9B, 0x4B, 0x39, 0x6B, 0x6B, 0x7B, 0x93, 0x29, 0x1B, 0x2B, 0x1B, 0x23, 0x9B, 0x09, 0x6B, 0x9B, 0x43, 0x09, 0x91, 0xA9, 0xB2, 0x20, 0x62, 0x34, 0x94, 0x43, 0x10, 0x25, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x33, 0x2E, 0x6F, 0x72, 0x67, 0x2F, 0x54, 0x52, 0x2F, 0x63, 0x61, 0x6E, 0x6F, 0x6E, 0x69, 0x63, 0x61, 0x6C, 0x2D, 0x65, 0x78, 0x69, 0x2F, 0x48, 0x52, 0xD0, 0xE8, 0xE8, 0xE0, 0x74, 0x5E, 0x5E, 0xEE, 0xEE, 0xEE, 0x5C, 0xEE, 0x66, 0x5C, 0xDE, 0xE4, 0xCE, 0x5E, 0x64, 0x60, 0x60, 0x62, 0x5E, 0x60, 0x68, 0x5E, 0xF0, 0xDA, 0xD8, 0xCA, 0xDC, 0xC6, 0x46, 0xE6, 0xD0, 0xC2, 0x64, 0x6A, 0x6C, 0x84, 0x1A, 0x36, 0xBC, 0x07, 0xA0, 0x0C, 0xB7, 0xDC, 0xAD, 0x66, 0x2F, 0x30, 0x88, 0xA6, 0x0A, 0x3D, 0x6A, 0x99, 0x43, 0x1F, 0x81, 0xC1, 0x22, 0xC2, 0xE9, 0xF1, 0x67, 0x8E, 0xF5, 0x31, 0xE9, 0x55, 0x23, 0x70};
+
+
+	uint8_t digestValue[] = {0xD1, 0xB5, 0xE0, 0x3D, 0x00, 0x65, 0xBE, 0xE5, 0x6B, 0x31, 0x79, 0x84, 0x45, 0x30, 0x51, 0xEB, 0x54, 0xCA, 0x18, 0xFC, 0x0E, 0x09, 0x16, 0x17, 0x4F, 0x8B, 0x3C, 0x77, 0xA9, 0x8F, 0x4A, 0xA9}; /* 32 Bytes */
+
+
+	/*
+	<v2gci_b:AuthorizationReq xmlns:v2gci_b="urn:iso:15118:2:2013:MsgBody" v2gci_b:Id="ID1">
+	    <v2gci_b:GenChallenge>U29tZSBSYW5kb20gRGF0YQ==</v2gci_b:GenChallenge>
+	</v2gci_b:AuthorizationReq>
+	*/
+
+	init_iso2EXIFragment(&exiV2G_AR);
+	exiV2G_AR.AuthorizationReq_isUsed = 1u;
+	init_iso2AuthorizationReqType(&exiV2G_AR.AuthorizationReq);
+	exiV2G_AR.AuthorizationReq.Id_isUsed = 1;
+	exiV2G_AR.AuthorizationReq.Id.charactersLen = 3;
+	exiV2G_AR.AuthorizationReq.Id.characters[0] = 'I';
+	exiV2G_AR.AuthorizationReq.Id.characters[1] = 'D';
+	exiV2G_AR.AuthorizationReq.Id.characters[2] = '1';
+	exiV2G_AR.AuthorizationReq.GenChallenge_isUsed = 1;
+	/* base64 U29tZSBSYW5kb20gRGF0YQ== */
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytesLen = 16;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[0] = 0x53;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[1] = 0x6F;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[2] = 0x6D;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[3] = 0x65;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[4] = 0x20;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[5] = 0x52;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[6] = 0x61;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[7] = 0x6E;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[8] = 0x64;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[9] = 0x6F;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[10] = 0x6D;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[11] = 0x20;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[12] = 0x44;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[13] = 0x61;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[14] = 0x74;
+	exiV2G_AR.AuthorizationReq.GenChallenge.bytes[15] = 0x61;
+
+	/* encode fragment with ISO schema */
+	errn = encode_iso2ExiFragment(&stream1, &exiV2G_AR);
+
+	if((*stream1.pos) != sizeIsoStream1) {
+		errn = -1;
+		printf("EXI1 stream length does not match !\n");
+		return errn;
+	} else {
+		for(i=0; i<sizeIsoStream1; i++) {
+			if(stream1.data[i] != isoStream1[i]) {
+				errn = -1;
+				printf("EXI1 stream does not match at position %d !\n", i);
+				return errn;
+			}
+		}
+	}
+
+	/* TODO Create Hash for stream 1 etc ... */
+	/* SHA-256 is "0bXgPQBlvuVrMXmERTBR61TKGPwOCRYXT4s8d6mPSqk=" */
+
+	/*
+	<xmlsig:SignedInfo xmlns:xmlsig="http://www.w3.org/2000/09/xmldsig#" >
+	    <xmlsig:CanonicalizationMethod Algorithm="http://www.w3.org/TR/canonical-exi/"/>
+	    <xmlsig:SignatureMethod
+	        Algorithm="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256"/>
+	    <xmlsig:Reference URI="#ID1">
+	        <xmlsig:Transforms>
+	            <xmlsig:Transform Algorithm="http://www.w3.org/TR/canonical-exi/"/>
+	        </xmlsig:Transforms>
+	        <xmlsig:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
+	        <xmlsig:DigestValue>0bXgPQBlvuVrMXmERTBR61TK
+	            GPwOCRYXT4s8d6mPSqk=</xmlsig:DigestValue>
+	    </xmlsig:Reference>
+	</xmlsig:SignedInfo>
+	*/
+
+	/* encode SignedInfo element with xmldsig schema */
+
+	const char arrayCanonicalEXI[35] = {"http://www.w3.org/TR/canonical-exi/"};
+	const char arrayxmldsigSHA256[51] = {"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256"};
+	const char arrayxmlencSHA256[39] = {"http://www.w3.org/2001/04/xmlenc#sha256"};
+
+	init_xmldsigEXIFragment(&exiXMLDSIG_SI);
+	exiXMLDSIG_SI.SignedInfo_isUsed = 1;
+	init_xmldsigSignedInfoType(&exiXMLDSIG_SI.SignedInfo);
+	{
+		init_xmldsigCanonicalizationMethodType(&exiXMLDSIG_SI.SignedInfo.CanonicalizationMethod);
+		exiXMLDSIG_SI.SignedInfo.CanonicalizationMethod.Algorithm.charactersLen = 35;
+		strncpy(exiXMLDSIG_SI.SignedInfo.CanonicalizationMethod.Algorithm.characters, arrayCanonicalEXI, 35);
+
+		exiXMLDSIG_SI.SignedInfo.SignatureMethod.HMACOutputLength_isUsed = 0;
+		exiXMLDSIG_SI.SignedInfo.SignatureMethod.Algorithm.charactersLen = 51;
+		strncpy(exiXMLDSIG_SI.SignedInfo.SignatureMethod.Algorithm.characters, arrayxmldsigSHA256, 51);
+
+		exiXMLDSIG_SI.SignedInfo.Reference.arrayLen = 1;
+		 /* "#ID1" */
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].URI_isUsed = 1;
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].URI.charactersLen = 4;
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].URI.characters[0] = '#';
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].URI.characters[1] = 'I';
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].URI.characters[2] = 'D';
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].URI.characters[3] = '1';
+		/* "http://www.w3.org/TR/canonical-exi/" */
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].Transforms_isUsed = 1;
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].Transforms.Transform.arrayLen = 1;
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].Transforms.Transform.array[0].Algorithm.charactersLen = 35;
+		strncpy(exiXMLDSIG_SI.SignedInfo.Reference.array[0].Transforms.Transform.array[0].Algorithm.characters, arrayCanonicalEXI, 35); /* Will copy 35 characters from arrayCanonicalEXI to characters */
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].Transforms.Transform.array[0].XPath.arrayLen = 0;
+
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].DigestMethod.Algorithm.charactersLen = 39;
+		strncpy(exiXMLDSIG_SI.SignedInfo.Reference.array[0].DigestMethod.Algorithm.characters, arrayxmlencSHA256, 39);
+
+		/* "0bXgPQBlvuVrMXmERTBR61TKGPwOCRYXT4s8d6mPSqk=" --> 16 Bytes 536F6D652052616E646F6D2044617461 */
+		exiXMLDSIG_SI.SignedInfo.Reference.array[0].DigestValue.bytesLen = 32;
+		memcpy(exiXMLDSIG_SI.SignedInfo.Reference.array[0].DigestValue.bytes, digestValue, 32);
+	}
+
+	errn = encode_xmldsigExiFragment(&stream2, &exiXMLDSIG_SI);
+
+	if((*stream2.pos) != sizeIsoStream2) {
+		errn = -1;
+		printf("EXI2 stream length does not match !\n");
+		return errn;
+	} else {
+		for(i=0; i<sizeIsoStream2; i++) {
+			if(stream2.data[i] != isoStream2[i]) {
+				errn = -1;
+				printf("EXI2 stream does not match at position %d !\n", i);
+				return errn;
+			}
+		}
+	}
+
+
+	if(errn == 0) {
+		printf("XMLDSIG test passed\n");
+	} else {
+		printf("XMLDSIG test error %d!\n", errn);
+	}
+
+	return errn;
+}
+#endif /* DEPLOY_ISO_CODEC_FRAGMENT */
+#endif /* DEPLOY_XMLDSIG_CODEC == SUPPORT_YES */
+
+
+int main_example(int argc, char *argv[]) {
+	int errn = 0;
+
+	printf("+++ Start application handshake protocol example +++\n\n");
+	errn = appHandshake();
+	printf("+++ Terminate application handshake protocol example with errn = %d +++\n\n", errn);
+
+	if(errn != 0) {
+		printf("\n\nHandshake error %d!\n", errn);
+		return errn;
+	}
+
+
+#if DEPLOY_ISO1_CODEC == SUPPORT_YES
+	printf("+++ Start V2G client / service example for charging (ISO1) +++\n\n");
+	errn = charging1();
+	printf("\n+++Terminate V2G Client / Service example for charging with errn = %d +++\n\n", errn);
+	if(errn != 0) {
+		printf("\n\ncharging error %d!\n", errn);
+		return errn;
+	}
+#endif /* DEPLOY_ISO1_CODEC == SUPPORT_YES */
+
+
+#if DEPLOY_ISO2_CODEC == SUPPORT_YES
+	printf("+++ Start V2G client / service example for charging (ISO2) +++\n\n");
+	errn = charging2();
+	printf("\n+++Terminate V2G Client / Service example for charging with errn = %d +++\n\n", errn);
+	if(errn != 0) {
+		printf("\n\ncharging error %d!\n", errn);
+		return errn;
+	}
+#endif /* DEPLOY_ISO2_CODEC == SUPPORT_YES */
+
+
+#if DEPLOY_DIN_CODEC == SUPPORT_YES
+	printf("+++ Start simple DIN test +++\n");
+	errn = din_test();
+	printf("+++ Terminate simple DIN test with errn = %d +++\n\n", errn);
+	if(errn != 0) {
+		printf("\nDIN test error %d!\n", errn);
+		return errn;
+	}
+#endif /* DEPLOY_DIN_CODEC == SUPPORT_YES */
+
+#if DEPLOY_XMLDSIG_CODEC == SUPPORT_YES
+#if DEPLOY_ISO_CODEC_FRAGMENT == SUPPORT_YES
+	printf("+++ Start simple XMLDSIG test +++\n");
+	errn = xmldsig_test();
+	printf("+++ Terminate simple XMLDSIG test with errn = %d +++\n\n", errn);
+	if(errn != 0) {
+		printf("\nXMLDSIG test error %d!\n", errn);
+		return errn;
+	}
+#endif /* DEPLOY_ISO_CODEC_FRAGMENT */
+#endif /* DEPLOY_XMLDSIG_CODEC == SUPPORT_YES */
+
+
+	return errn;
+}

+ 92 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/transport/v2gtp.c

@@ -0,0 +1,92 @@
+
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch@siemens.com
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ ********************************************************************/
+
+/*
+ * This file implements the v2gtp header writer and reader.
+ *
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+
+#include "v2gtp.h"
+
+
+int write_v2gtpHeader(uint8_t* outStream, uint32_t outStreamLength, uint16_t payloadType)
+{
+
+	/* write v2gtp version number 1=byte */
+	outStream[0]=V2GTP_VERSION;
+
+	/* write inverse v2gtp version */
+	outStream[1]=V2GTP_VERSION_INV;
+
+
+	/* write payload type */
+	outStream[3] = (uint8_t)(payloadType & 0xFF);
+	outStream[2] = (uint8_t)(payloadType >> 8 & 0xFF);
+
+	/* write payload length */
+	outStream[7] = (uint8_t)(outStreamLength & 0xFF);
+	outStream[6] = (uint8_t)(outStreamLength>>8 & 0xFF);
+	outStream[5] = (uint8_t)(outStreamLength>>16 & 0xFF);
+	outStream[4] = (uint8_t)(outStreamLength>>24 & 0xFF);
+
+	return 0;
+}
+
+int read_v2gtpHeader(uint8_t* inStream, uint32_t* payloadLength)
+{
+	uint16_t payloadType=0;
+
+
+	/* check, if we support this v2gtp version */
+	if(inStream[0]!=V2GTP_VERSION || inStream[1]!=V2GTP_VERSION_INV)
+		return -1;
+
+
+	/* check, if we support this payload type*/
+	payloadType = inStream[2];
+	payloadType = (payloadType << 8 | inStream[3]);
+
+	if(payloadType != V2GTP_EXI_TYPE)
+		return -1;
+
+
+	/* determine payload length*/
+	*payloadLength = inStream[4];
+	*payloadLength = (*payloadLength << 8 | inStream[5]);
+	*payloadLength = (*payloadLength << 8 | inStream[6]);
+	*payloadLength = (*payloadLength << 8 | inStream[7]);
+
+	return 0;
+}
+

+ 55 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/transport/v2gtp.h

@@ -0,0 +1,55 @@
+
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Sebastian.Kaebisch@siemens.com
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ ********************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef V2GTP_H_
+#define V2GTP_H_
+
+#include <stdint.h>
+
+/* generic V2GTP header length */
+#define V2GTP_HEADER_LENGTH 8
+
+/* define V2GTP Version */
+#define V2GTP_VERSION 0x01
+#define V2GTP_VERSION_INV 0xFE
+
+/* define V2GTP payload types*/
+#define V2GTP_EXI_TYPE 0x8001
+
+int write_v2gtpHeader(uint8_t* outStream, uint32_t outStreamLength, uint16_t payloadType);
+
+int read_v2gtpHeader(uint8_t* inStream, uint32_t* payloadLength);
+
+#endif /* V2GTP_H_ */
+
+#ifdef __cplusplus
+}
+#endif

+ 255 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypes.c

@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: xmldsig-core-schema.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+#include <stdint.h>
+
+#include "xmldsigEXIDatatypes.h"
+#include "../codec/EXITypes.h"
+
+
+#ifndef EXI_xmldsig_DATATYPES_C
+#define EXI_xmldsig_DATATYPES_C
+
+#if DEPLOY_XMLDSIG_CODEC == SUPPORT_YES
+
+
+void init_xmldsigEXIDocument(struct xmldsigEXIDocument* exiDoc) {
+	exiDoc->SignatureProperty_isUsed = 0u;
+	exiDoc->DSAKeyValue_isUsed = 0u;
+	exiDoc->SignatureProperties_isUsed = 0u;
+	exiDoc->KeyValue_isUsed = 0u;
+	exiDoc->Transforms_isUsed = 0u;
+	exiDoc->DigestMethod_isUsed = 0u;
+	exiDoc->Signature_isUsed = 0u;
+	exiDoc->RetrievalMethod_isUsed = 0u;
+	exiDoc->Manifest_isUsed = 0u;
+	exiDoc->Reference_isUsed = 0u;
+	exiDoc->CanonicalizationMethod_isUsed = 0u;
+	exiDoc->RSAKeyValue_isUsed = 0u;
+	exiDoc->Transform_isUsed = 0u;
+	exiDoc->PGPData_isUsed = 0u;
+	exiDoc->MgmtData_isUsed = 0u;
+	exiDoc->SignatureMethod_isUsed = 0u;
+	exiDoc->KeyInfo_isUsed = 0u;
+	exiDoc->SPKIData_isUsed = 0u;
+	exiDoc->X509Data_isUsed = 0u;
+	exiDoc->SignatureValue_isUsed = 0u;
+	exiDoc->KeyName_isUsed = 0u;
+	exiDoc->DigestValue_isUsed = 0u;
+	exiDoc->SignedInfo_isUsed = 0u;
+	exiDoc->Object_isUsed = 0u;
+}
+
+
+#if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES
+void init_xmldsigEXIFragment(struct xmldsigEXIFragment* exiFrag) {
+	exiFrag->DigestValue_isUsed = 0u;
+	exiFrag->X509Data_isUsed = 0u;
+	exiFrag->KeyValue_isUsed = 0u;
+	exiFrag->DigestMethod_isUsed = 0u;
+	exiFrag->SPKISexp_isUsed = 0u;
+	exiFrag->Transforms_isUsed = 0u;
+	exiFrag->KeyName_isUsed = 0u;
+	exiFrag->X509IssuerName_isUsed = 0u;
+	exiFrag->MgmtData_isUsed = 0u;
+	exiFrag->Reference_isUsed = 0u;
+	exiFrag->SignatureProperties_isUsed = 0u;
+	exiFrag->PGPKeyID_isUsed = 0u;
+	exiFrag->PGPData_isUsed = 0u;
+	exiFrag->DSAKeyValue_isUsed = 0u;
+	exiFrag->SignatureValue_isUsed = 0u;
+	exiFrag->KeyInfo_isUsed = 0u;
+	exiFrag->SignatureProperty_isUsed = 0u;
+	exiFrag->PGPKeyPacket_isUsed = 0u;
+	exiFrag->PGPKeyPacket_isUsed = 0u;
+	exiFrag->HMACOutputLength_isUsed = 0u;
+	exiFrag->Exponent_isUsed = 0u;
+	exiFrag->Manifest_isUsed = 0u;
+	exiFrag->P_isUsed = 0u;
+	exiFrag->CanonicalizationMethod_isUsed = 0u;
+	exiFrag->Q_isUsed = 0u;
+	exiFrag->Seed_isUsed = 0u;
+	exiFrag->X509SubjectName_isUsed = 0u;
+	exiFrag->X509Certificate_isUsed = 0u;
+	exiFrag->RSAKeyValue_isUsed = 0u;
+	exiFrag->X509IssuerSerial_isUsed = 0u;
+	exiFrag->SPKIData_isUsed = 0u;
+	exiFrag->G_isUsed = 0u;
+	exiFrag->J_isUsed = 0u;
+	exiFrag->SignedInfo_isUsed = 0u;
+	exiFrag->X509SKI_isUsed = 0u;
+	exiFrag->Transform_isUsed = 0u;
+	exiFrag->XPath_isUsed = 0u;
+	exiFrag->Object_isUsed = 0u;
+	exiFrag->X509SerialNumber_isUsed = 0u;
+	exiFrag->RetrievalMethod_isUsed = 0u;
+	exiFrag->Modulus_isUsed = 0u;
+	exiFrag->X509CRL_isUsed = 0u;
+	exiFrag->Signature_isUsed = 0u;
+	exiFrag->Y_isUsed = 0u;
+	exiFrag->SignatureMethod_isUsed = 0u;
+	exiFrag->PgenCounter_isUsed = 0u;
+}
+#endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */
+
+void init_xmldsigCanonicalizationMethodType(struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType) {
+	xmldsigCanonicalizationMethodType->ANY_isUsed = 0u;
+}
+
+void init_xmldsigManifestType(struct xmldsigManifestType* xmldsigManifestType) {
+	xmldsigManifestType->Id_isUsed = 0u;
+	xmldsigManifestType->Reference.arrayLen = 0u;
+}
+
+void init_xmldsigObjectType(struct xmldsigObjectType* xmldsigObjectType) {
+	xmldsigObjectType->Id_isUsed = 0u;
+	xmldsigObjectType->MimeType_isUsed = 0u;
+	xmldsigObjectType->Encoding_isUsed = 0u;
+	xmldsigObjectType->ANY_isUsed = 0u;
+}
+
+void init_xmldsigTransformType(struct xmldsigTransformType* xmldsigTransformType) {
+	xmldsigTransformType->ANY_isUsed = 0u;
+	xmldsigTransformType->XPath.arrayLen = 0u;
+}
+
+void init_xmldsigSignatureMethodType(struct xmldsigSignatureMethodType* xmldsigSignatureMethodType) {
+	xmldsigSignatureMethodType->HMACOutputLength_isUsed = 0u;
+	xmldsigSignatureMethodType->ANY_isUsed = 0u;
+}
+
+void init_xmldsigDigestMethodType(struct xmldsigDigestMethodType* xmldsigDigestMethodType) {
+	xmldsigDigestMethodType->ANY_isUsed = 0u;
+}
+
+void init_xmldsigRetrievalMethodType(struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType) {
+	xmldsigRetrievalMethodType->URI_isUsed = 0u;
+	xmldsigRetrievalMethodType->Type_isUsed = 0u;
+	xmldsigRetrievalMethodType->Transforms_isUsed = 0u;
+}
+
+void init_xmldsigSignatureValueType(struct xmldsigSignatureValueType* xmldsigSignatureValueType) {
+	xmldsigSignatureValueType->Id_isUsed = 0u;
+}
+
+void init_xmldsigX509IssuerSerialType(struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType) {
+	(void)xmldsigX509IssuerSerialType; /* avoid unused warning */
+}
+
+void init_xmldsigSignedInfoType(struct xmldsigSignedInfoType* xmldsigSignedInfoType) {
+	xmldsigSignedInfoType->Id_isUsed = 0u;
+	xmldsigSignedInfoType->Reference.arrayLen = 0u;
+}
+
+void init_xmldsigSignaturePropertiesType(struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType) {
+	xmldsigSignaturePropertiesType->Id_isUsed = 0u;
+	xmldsigSignaturePropertiesType->SignatureProperty.arrayLen = 0u;
+}
+
+void init_xmldsigSignaturePropertyType(struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType) {
+	xmldsigSignaturePropertyType->Id_isUsed = 0u;
+	xmldsigSignaturePropertyType->ANY_isUsed = 0u;
+}
+
+void init_xmldsigKeyValueType(struct xmldsigKeyValueType* xmldsigKeyValueType) {
+	xmldsigKeyValueType->DSAKeyValue_isUsed = 0u;
+	xmldsigKeyValueType->RSAKeyValue_isUsed = 0u;
+	xmldsigKeyValueType->ANY_isUsed = 0u;
+}
+
+void init_xmldsigRSAKeyValueType(struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType) {
+	(void)xmldsigRSAKeyValueType; /* avoid unused warning */
+}
+
+void init_xmldsigPGPDataType(struct xmldsigPGPDataType* xmldsigPGPDataType) {
+	xmldsigPGPDataType->PGPKeyID_isUsed = 0u;
+	xmldsigPGPDataType->PGPKeyPacket_isUsed = 0u;
+	xmldsigPGPDataType->ANY_isUsed = 0u;
+}
+
+void init_xmldsigTransformsType(struct xmldsigTransformsType* xmldsigTransformsType) {
+	xmldsigTransformsType->Transform.arrayLen = 0u;
+}
+
+void init_xmldsigX509DataType(struct xmldsigX509DataType* xmldsigX509DataType) {
+	xmldsigX509DataType->X509IssuerSerial.arrayLen = 0u;
+	xmldsigX509DataType->X509SKI.arrayLen = 0u;
+	xmldsigX509DataType->X509SubjectName.arrayLen = 0u;
+	xmldsigX509DataType->X509Certificate.arrayLen = 0u;
+	xmldsigX509DataType->X509CRL.arrayLen = 0u;
+	xmldsigX509DataType->ANY_isUsed = 0u;
+}
+
+void init_xmldsigSignatureType(struct xmldsigSignatureType* xmldsigSignatureType) {
+	xmldsigSignatureType->Id_isUsed = 0u;
+	xmldsigSignatureType->KeyInfo_isUsed = 0u;
+	xmldsigSignatureType->Object.arrayLen = 0u;
+}
+
+void init_xmldsigDSAKeyValueType(struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType) {
+	xmldsigDSAKeyValueType->P_isUsed = 0u;
+	xmldsigDSAKeyValueType->Q_isUsed = 0u;
+	xmldsigDSAKeyValueType->G_isUsed = 0u;
+	xmldsigDSAKeyValueType->J_isUsed = 0u;
+	xmldsigDSAKeyValueType->Seed_isUsed = 0u;
+	xmldsigDSAKeyValueType->PgenCounter_isUsed = 0u;
+}
+
+void init_xmldsigReferenceType(struct xmldsigReferenceType* xmldsigReferenceType) {
+	xmldsigReferenceType->Id_isUsed = 0u;
+	xmldsigReferenceType->URI_isUsed = 0u;
+	xmldsigReferenceType->Type_isUsed = 0u;
+	xmldsigReferenceType->Transforms_isUsed = 0u;
+}
+
+void init_xmldsigSPKIDataType(struct xmldsigSPKIDataType* xmldsigSPKIDataType) {
+	xmldsigSPKIDataType->SPKISexp.arrayLen = 0u;
+	xmldsigSPKIDataType->ANY_isUsed = 0u;
+}
+
+void init_xmldsigKeyInfoType(struct xmldsigKeyInfoType* xmldsigKeyInfoType) {
+	xmldsigKeyInfoType->Id_isUsed = 0u;
+	xmldsigKeyInfoType->KeyName.arrayLen = 0u;
+	xmldsigKeyInfoType->KeyValue.arrayLen = 0u;
+	xmldsigKeyInfoType->RetrievalMethod.arrayLen = 0u;
+	xmldsigKeyInfoType->X509Data.arrayLen = 0u;
+	xmldsigKeyInfoType->PGPData.arrayLen = 0u;
+	xmldsigKeyInfoType->SPKIData.arrayLen = 0u;
+	xmldsigKeyInfoType->MgmtData.arrayLen = 0u;
+	xmldsigKeyInfoType->ANY_isUsed = 0u;
+}
+
+
+
+#endif /* DEPLOY_XMLDSIG_CODEC */
+
+#endif
+

+ 935 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypes.h

@@ -0,0 +1,935 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: xmldsig-core-schema.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypes.h
+ * \brief 	Datatype definitions and structs for given XML Schema definitions and initialization methods
+ *
+ */
+
+#ifndef EXI_xmldsig_DATATYPES_H
+#define EXI_xmldsig_DATATYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SUPPORT_YES 1
+#define SUPPORT_NO 2
+#define DEPLOY_XMLDSIG_CODEC SUPPORT_NO
+#define DEPLOY_XMLDSIG_CODEC_FRAGMENT SUPPORT_NO
+
+#if DEPLOY_XMLDSIG_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "EXITypes.h"
+
+
+/* Datatype definitions and structs for given XML Schema definitions */
+
+#define UNION_YES 1
+#define UNION_NO 2
+#define SAVE_MEMORY_WITH_UNNAMED_UNION UNION_YES
+
+/* 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 xmldsigCanonicalizationMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR 
+#define xmldsigCanonicalizationMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigCanonicalizationMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[xmldsigCanonicalizationMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##any] */
+	struct {
+		exi_string_character_t characters[xmldsigCanonicalizationMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 xmldsigObjectType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigObjectType_MimeType_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigObjectType_Encoding_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigObjectType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigObjectType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[xmldsigObjectType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* attribute: MimeType {http://www.w3.org/2001/XMLSchema,string} */
+	struct {
+		exi_string_character_t characters[xmldsigObjectType_MimeType_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MimeType ;
+	unsigned int MimeType_isUsed:1;
+	/* attribute: Encoding {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[xmldsigObjectType_Encoding_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Encoding ;
+	unsigned int Encoding_isUsed:1;
+	/* element: WC[##any] */
+	struct {
+		exi_string_character_t characters[xmldsigObjectType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 xmldsigTransformType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR 
+#define xmldsigTransformType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigTransformType_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigTransformType_XPath_ARRAY_SIZE 1
+struct xmldsigTransformType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[xmldsigTransformType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[xmldsigTransformType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":XPath, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[xmldsigTransformType_XPath_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[xmldsigTransformType_XPath_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} XPath;
+};
+
+/* 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 xmldsigSignatureMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR 
+#define xmldsigSignatureMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigSignatureMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[xmldsigSignatureMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":HMACOutputLength, http://www.w3.org/2000/09/xmldsig#,HMACOutputLengthType */
+	int64_t HMACOutputLength ;
+	unsigned int HMACOutputLength_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[xmldsigSignatureMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 xmldsigDigestMethodType_Algorithm_CHARACTERS_SIZE 65 + EXTRA_CHAR 
+#define xmldsigDigestMethodType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigDigestMethodType {
+	/* attribute: Algorithm {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[xmldsigDigestMethodType_Algorithm_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Algorithm ;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[xmldsigDigestMethodType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 xmldsigSignatureValueType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigSignatureValueType_CONTENT_BYTES_SIZE 350
+struct xmldsigSignatureValueType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[xmldsigSignatureValueType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* simple content: http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[xmldsigSignatureValueType_CONTENT_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  CONTENT ;
+};
+
+/* 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 xmldsigX509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigX509IssuerSerialType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509IssuerName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		exi_string_character_t characters[xmldsigX509IssuerSerialType_X509IssuerName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509IssuerName ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SerialNumber, http://www.w3.org/2001/XMLSchema,integer */
+	int64_t X509SerialNumber ;
+};
+
+/* 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 xmldsigSignaturePropertyType_Target_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigSignaturePropertyType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigSignaturePropertyType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigSignaturePropertyType {
+	/* attribute: Target {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[xmldsigSignaturePropertyType_Target_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Target ;
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[xmldsigSignaturePropertyType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[xmldsigSignaturePropertyType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 xmldsigRSAKeyValueType_Modulus_BYTES_SIZE 350 
+#define xmldsigRSAKeyValueType_Exponent_BYTES_SIZE 350 
+struct xmldsigRSAKeyValueType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Modulus, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[xmldsigRSAKeyValueType_Modulus_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Modulus ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Exponent, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[xmldsigRSAKeyValueType_Exponent_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Exponent ;
+};
+
+/* 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 xmldsigPGPDataType_PGPKeyID_BYTES_SIZE 350 
+#define xmldsigPGPDataType_PGPKeyPacket_BYTES_SIZE 350 
+#define xmldsigPGPDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigPGPDataType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPKeyID, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[xmldsigPGPDataType_PGPKeyID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyID ;
+	unsigned int PGPKeyID_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPKeyPacket, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		uint8_t bytes[xmldsigPGPDataType_PGPKeyPacket_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyPacket ;
+	unsigned int PGPKeyPacket_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[xmldsigPGPDataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+#define xmldsigTransformsType_Transform_ARRAY_SIZE 1
+struct xmldsigTransformsType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transform, 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'.  */
+	struct {
+		struct xmldsigTransformType array[xmldsigTransformsType_Transform_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Transform;
+};
+
+/* 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 xmldsigX509DataType_X509IssuerSerial_ARRAY_SIZE 1
+#define xmldsigX509DataType_X509SKI_BYTES_SIZE 350 
+#define xmldsigX509DataType_X509SKI_ARRAY_SIZE 1
+#define xmldsigX509DataType_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigX509DataType_X509SubjectName_ARRAY_SIZE 1
+#define xmldsigX509DataType_X509Certificate_BYTES_SIZE 350 
+#define xmldsigX509DataType_X509Certificate_ARRAY_SIZE 1
+#define xmldsigX509DataType_X509CRL_BYTES_SIZE 350 
+#define xmldsigX509DataType_X509CRL_ARRAY_SIZE 1
+#define xmldsigX509DataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigX509DataType {
+	/* 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 {
+		struct xmldsigX509IssuerSerialType array[xmldsigX509DataType_X509IssuerSerial_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509IssuerSerial;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SKI, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[xmldsigX509DataType_X509SKI_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[xmldsigX509DataType_X509SKI_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509SKI;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509SubjectName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[xmldsigX509DataType_X509SubjectName_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[xmldsigX509DataType_X509SubjectName_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509SubjectName;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509Certificate, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[xmldsigX509DataType_X509Certificate_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[xmldsigX509DataType_X509Certificate_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509Certificate;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509CRL, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[xmldsigX509DataType_X509CRL_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[xmldsigX509DataType_X509CRL_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509CRL;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[xmldsigX509DataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 xmldsigDSAKeyValueType_P_BYTES_SIZE 350 
+#define xmldsigDSAKeyValueType_Q_BYTES_SIZE 350 
+#define xmldsigDSAKeyValueType_G_BYTES_SIZE 350 
+#define xmldsigDSAKeyValueType_Y_BYTES_SIZE 350 
+#define xmldsigDSAKeyValueType_J_BYTES_SIZE 350 
+#define xmldsigDSAKeyValueType_Seed_BYTES_SIZE 350 
+#define xmldsigDSAKeyValueType_PgenCounter_BYTES_SIZE 350 
+struct xmldsigDSAKeyValueType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":P, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[xmldsigDSAKeyValueType_P_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  P ;
+	unsigned int P_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Q, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[xmldsigDSAKeyValueType_Q_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Q ;
+	unsigned int Q_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":G, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[xmldsigDSAKeyValueType_G_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  G ;
+	unsigned int G_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Y, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[xmldsigDSAKeyValueType_Y_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Y ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":J, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[xmldsigDSAKeyValueType_J_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  J ;
+	unsigned int J_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Seed, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[xmldsigDSAKeyValueType_Seed_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Seed ;
+	unsigned int Seed_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PgenCounter, http://www.w3.org/2000/09/xmldsig#,CryptoBinary */
+	struct {
+		uint8_t bytes[xmldsigDSAKeyValueType_PgenCounter_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PgenCounter ;
+	unsigned int PgenCounter_isUsed:1;
+};
+
+/* 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 xmldsigReferenceType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigReferenceType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigReferenceType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigReferenceType_DigestValue_BYTES_SIZE 350 
+struct xmldsigReferenceType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[xmldsigReferenceType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[xmldsigReferenceType_URI_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  URI ;
+	unsigned int URI_isUsed:1;
+	/* attribute: Type {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[xmldsigReferenceType_Type_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Type ;
+	unsigned int Type_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transforms, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct xmldsigTransformsType Transforms ;
+	unsigned int Transforms_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":DigestMethod, 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'.  */
+	struct xmldsigDigestMethodType DigestMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":DigestValue, http://www.w3.org/2000/09/xmldsig#,DigestValueType */
+	struct {
+		uint8_t bytes[xmldsigReferenceType_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+};
+
+/* 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 xmldsigSPKIDataType_SPKISexp_BYTES_SIZE 350 
+#define xmldsigSPKIDataType_SPKISexp_ARRAY_SIZE 1
+#define xmldsigSPKIDataType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigSPKIDataType {
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SPKISexp, http://www.w3.org/2001/XMLSchema,base64Binary */
+	struct {
+		struct {
+			uint8_t bytes[xmldsigSPKIDataType_SPKISexp_BYTES_SIZE];
+			uint16_t bytesLen;
+		}  array[xmldsigSPKIDataType_SPKISexp_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SPKISexp;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[xmldsigSPKIDataType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 xmldsigManifestType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigManifestType_Reference_ARRAY_SIZE 1
+struct xmldsigManifestType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[xmldsigManifestType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Reference, 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'.  */
+	struct {
+		struct xmldsigReferenceType array[xmldsigManifestType_Reference_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Reference;
+};
+
+/* 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 xmldsigRetrievalMethodType_URI_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigRetrievalMethodType_Type_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigRetrievalMethodType {
+	/* attribute: URI {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[xmldsigRetrievalMethodType_URI_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  URI ;
+	unsigned int URI_isUsed:1;
+	/* attribute: Type {http://www.w3.org/2001/XMLSchema,anyURI} */
+	struct {
+		exi_string_character_t characters[xmldsigRetrievalMethodType_Type_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Type ;
+	unsigned int Type_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Transforms, Complex type name='http://www.w3.org/2000/09/xmldsig#,TransformsType',  base type name='anyType',  content type='ELEMENT',  isAbstract='false',  hasTypeId='false',  final='0',  block='0',  particle='("http://www.w3.org/2000/09/xmldsig#":Transform{1-UNBOUNDED})',  derivedBy='RESTRICTION'.  */
+	struct xmldsigTransformsType Transforms ;
+	unsigned int Transforms_isUsed:1;
+};
+
+/* 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 xmldsigSignedInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigSignedInfoType_Reference_ARRAY_SIZE 1
+struct xmldsigSignedInfoType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[xmldsigSignedInfoType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":CanonicalizationMethod, 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'.  */
+	struct xmldsigCanonicalizationMethodType CanonicalizationMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureMethod, 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'.  */
+	struct xmldsigSignatureMethodType SignatureMethod ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Reference, 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'.  */
+	struct {
+		struct xmldsigReferenceType array[xmldsigSignedInfoType_Reference_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Reference;
+};
+
+/* 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 xmldsigSignaturePropertiesType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE 1
+struct xmldsigSignaturePropertiesType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[xmldsigSignaturePropertiesType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureProperty, 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'.  */
+	struct {
+		struct xmldsigSignaturePropertyType array[xmldsigSignaturePropertiesType_SignatureProperty_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SignatureProperty;
+};
+
+/* 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 xmldsigKeyValueType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigKeyValueType {
+	/* 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 xmldsigDSAKeyValueType DSAKeyValue ;
+	unsigned int DSAKeyValue_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":RSAKeyValue, 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'.  */
+	struct xmldsigRSAKeyValueType RSAKeyValue ;
+	unsigned int RSAKeyValue_isUsed:1;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[xmldsigKeyValueType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 xmldsigKeyInfoType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigKeyInfoType_KeyName_ARRAY_SIZE 1
+#define xmldsigKeyInfoType_KeyValue_ARRAY_SIZE 1
+#define xmldsigKeyInfoType_RetrievalMethod_ARRAY_SIZE 1
+#define xmldsigKeyInfoType_X509Data_ARRAY_SIZE 1
+#define xmldsigKeyInfoType_PGPData_ARRAY_SIZE 1
+#define xmldsigKeyInfoType_SPKIData_ARRAY_SIZE 1
+#define xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigKeyInfoType_MgmtData_ARRAY_SIZE 1
+#define xmldsigKeyInfoType_ANY_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+struct xmldsigKeyInfoType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[xmldsigKeyInfoType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyName, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[xmldsigKeyInfoType_KeyName_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[xmldsigKeyInfoType_KeyName_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} KeyName;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyValue, 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'.  */
+	struct {
+		struct xmldsigKeyValueType array[xmldsigKeyInfoType_KeyValue_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} KeyValue;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":RetrievalMethod, 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'.  */
+	struct {
+		struct xmldsigRetrievalMethodType array[xmldsigKeyInfoType_RetrievalMethod_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} RetrievalMethod;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":X509Data, 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'.  */
+	struct {
+		struct xmldsigX509DataType array[xmldsigKeyInfoType_X509Data_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} X509Data;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":PGPData, 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'.  */
+	struct {
+		struct xmldsigPGPDataType array[xmldsigKeyInfoType_PGPData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} PGPData;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SPKIData, 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'.  */
+	struct {
+		struct xmldsigSPKIDataType array[xmldsigKeyInfoType_SPKIData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} SPKIData;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":MgmtData, http://www.w3.org/2001/XMLSchema,string */
+	struct {
+		struct {
+			exi_string_character_t characters[xmldsigKeyInfoType_MgmtData_CHARACTERS_SIZE];
+			uint16_t charactersLen;
+		}  array[xmldsigKeyInfoType_MgmtData_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} MgmtData;
+	/* element: WC[##other:"http://www.w3.org/2000/09/xmldsig#"] */
+	struct {
+		exi_string_character_t characters[xmldsigKeyInfoType_ANY_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  ANY ;
+	unsigned int ANY_isUsed:1;
+};
+
+/* 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 xmldsigSignatureType_Id_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define xmldsigSignatureType_Object_ARRAY_SIZE 1
+struct xmldsigSignatureType {
+	/* attribute: Id {http://www.w3.org/2001/XMLSchema,ID} */
+	struct {
+		exi_string_character_t characters[xmldsigSignatureType_Id_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  Id ;
+	unsigned int Id_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignedInfo, 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'.  */
+	struct xmldsigSignedInfoType SignedInfo ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":SignatureValue, 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'.  */
+	struct xmldsigSignatureValueType SignatureValue ;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":KeyInfo, 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'.  */
+	struct xmldsigKeyInfoType KeyInfo ;
+	unsigned int KeyInfo_isUsed:1;
+	/* element: "http://www.w3.org/2000/09/xmldsig#":Object, 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'.  */
+	struct {
+		struct xmldsigObjectType array[xmldsigSignatureType_Object_ARRAY_SIZE];
+		uint16_t arrayLen;
+	} Object;
+};
+
+
+
+#define EXIDocument_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define EXIDocument_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define EXIDocument_DigestValue_BYTES_SIZE 350 
+#define EXIFragment_DigestValue_BYTES_SIZE 350 
+#define EXIFragment_SPKISexp_BYTES_SIZE 350 
+#define EXIFragment_KeyName_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define EXIFragment_X509IssuerName_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define EXIFragment_MgmtData_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define EXIFragment_PGPKeyID_BYTES_SIZE 350 
+#define EXIFragment_PGPKeyPacket_BYTES_SIZE 350 
+#define EXIFragment_Exponent_BYTES_SIZE 350 
+#define EXIFragment_P_BYTES_SIZE 350 
+#define EXIFragment_Q_BYTES_SIZE 350 
+#define EXIFragment_Seed_BYTES_SIZE 350 
+#define EXIFragment_X509SubjectName_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define EXIFragment_X509Certificate_BYTES_SIZE 350 
+#define EXIFragment_G_BYTES_SIZE 350 
+#define EXIFragment_J_BYTES_SIZE 350 
+#define EXIFragment_X509SKI_BYTES_SIZE 350 
+#define EXIFragment_XPath_CHARACTERS_SIZE 50 + EXTRA_CHAR 
+#define EXIFragment_Modulus_BYTES_SIZE 350 
+#define EXIFragment_X509CRL_BYTES_SIZE 350 
+#define EXIFragment_Y_BYTES_SIZE 350 
+#define EXIFragment_PgenCounter_BYTES_SIZE 350 
+
+
+/* Global elements of EXI Document */
+struct xmldsigEXIDocument {
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+	struct xmldsigSignaturePropertyType SignatureProperty ;
+	struct xmldsigDSAKeyValueType DSAKeyValue ;
+	struct xmldsigSignaturePropertiesType SignatureProperties ;
+	struct xmldsigKeyValueType KeyValue ;
+	struct xmldsigTransformsType Transforms ;
+	struct xmldsigDigestMethodType DigestMethod ;
+	struct xmldsigSignatureType Signature ;
+	struct xmldsigRetrievalMethodType RetrievalMethod ;
+	struct xmldsigManifestType Manifest ;
+	struct xmldsigReferenceType Reference ;
+	struct xmldsigCanonicalizationMethodType CanonicalizationMethod ;
+	struct xmldsigRSAKeyValueType RSAKeyValue ;
+	struct xmldsigTransformType Transform ;
+	struct xmldsigPGPDataType PGPData ;
+	struct {
+		exi_string_character_t characters[EXIDocument_MgmtData_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MgmtData ;
+	struct xmldsigSignatureMethodType SignatureMethod ;
+	struct xmldsigKeyInfoType KeyInfo ;
+	struct xmldsigSPKIDataType SPKIData ;
+	struct xmldsigX509DataType X509Data ;
+	struct xmldsigSignatureValueType SignatureValue ;
+	struct {
+		exi_string_character_t characters[EXIDocument_KeyName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  KeyName ;
+	struct {
+		uint8_t bytes[EXIDocument_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+	struct xmldsigSignedInfoType SignedInfo ;
+	struct xmldsigObjectType Object ;
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	};
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+	unsigned int SignatureProperty_isUsed:1;
+	unsigned int DSAKeyValue_isUsed:1;
+	unsigned int SignatureProperties_isUsed:1;
+	unsigned int KeyValue_isUsed:1;
+	unsigned int Transforms_isUsed:1;
+	unsigned int DigestMethod_isUsed:1;
+	unsigned int Signature_isUsed:1;
+	unsigned int RetrievalMethod_isUsed:1;
+	unsigned int Manifest_isUsed:1;
+	unsigned int Reference_isUsed:1;
+	unsigned int CanonicalizationMethod_isUsed:1;
+	unsigned int RSAKeyValue_isUsed:1;
+	unsigned int Transform_isUsed:1;
+	unsigned int PGPData_isUsed:1;
+	unsigned int MgmtData_isUsed:1;
+	unsigned int SignatureMethod_isUsed:1;
+	unsigned int KeyInfo_isUsed:1;
+	unsigned int SPKIData_isUsed:1;
+	unsigned int X509Data_isUsed:1;
+	unsigned int SignatureValue_isUsed:1;
+	unsigned int KeyName_isUsed:1;
+	unsigned int DigestValue_isUsed:1;
+	unsigned int SignedInfo_isUsed:1;
+	unsigned int Object_isUsed:1;
+
+
+	int _warning_;
+};
+
+
+#if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES
+/* Possible elements of EXI Fragment */
+struct xmldsigEXIFragment {
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	union {
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+	struct {
+		uint8_t bytes[EXIFragment_DigestValue_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  DigestValue ;
+	struct xmldsigX509DataType X509Data ;
+	struct xmldsigKeyValueType KeyValue ;
+	struct xmldsigDigestMethodType DigestMethod ;
+	struct {
+		uint8_t bytes[EXIFragment_SPKISexp_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  SPKISexp ;
+	struct xmldsigTransformsType Transforms ;
+	struct {
+		exi_string_character_t characters[EXIFragment_KeyName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  KeyName ;
+	struct {
+		exi_string_character_t characters[EXIFragment_X509IssuerName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509IssuerName ;
+	struct {
+		exi_string_character_t characters[EXIFragment_MgmtData_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  MgmtData ;
+	struct xmldsigReferenceType Reference ;
+	struct xmldsigSignaturePropertiesType SignatureProperties ;
+	struct {
+		uint8_t bytes[EXIFragment_PGPKeyID_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyID ;
+	struct xmldsigPGPDataType PGPData ;
+	struct xmldsigDSAKeyValueType DSAKeyValue ;
+	struct xmldsigSignatureValueType SignatureValue ;
+	struct xmldsigKeyInfoType KeyInfo ;
+	struct xmldsigSignaturePropertyType SignatureProperty ;
+	struct {
+		uint8_t bytes[EXIFragment_PGPKeyPacket_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PGPKeyPacket ;
+	int64_t HMACOutputLength ;
+	struct {
+		uint8_t bytes[EXIFragment_Exponent_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Exponent ;
+	struct xmldsigManifestType Manifest ;
+	struct {
+		uint8_t bytes[EXIFragment_P_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  P ;
+	struct xmldsigCanonicalizationMethodType CanonicalizationMethod ;
+	struct {
+		uint8_t bytes[EXIFragment_Q_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Q ;
+	struct {
+		uint8_t bytes[EXIFragment_Seed_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Seed ;
+	struct {
+		exi_string_character_t characters[EXIFragment_X509SubjectName_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  X509SubjectName ;
+	struct {
+		uint8_t bytes[EXIFragment_X509Certificate_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509Certificate ;
+	struct xmldsigRSAKeyValueType RSAKeyValue ;
+	struct xmldsigX509IssuerSerialType X509IssuerSerial ;
+	struct xmldsigSPKIDataType SPKIData ;
+	struct {
+		uint8_t bytes[EXIFragment_G_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  G ;
+	struct {
+		uint8_t bytes[EXIFragment_J_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  J ;
+	struct xmldsigSignedInfoType SignedInfo ;
+	struct {
+		uint8_t bytes[EXIFragment_X509SKI_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509SKI ;
+	struct xmldsigTransformType Transform ;
+	struct {
+		exi_string_character_t characters[EXIFragment_XPath_CHARACTERS_SIZE];
+		uint16_t charactersLen;
+	}  XPath ;
+	struct xmldsigObjectType Object ;
+	int64_t X509SerialNumber ;
+	struct xmldsigRetrievalMethodType RetrievalMethod ;
+	struct {
+		uint8_t bytes[EXIFragment_Modulus_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Modulus ;
+	struct {
+		uint8_t bytes[EXIFragment_X509CRL_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  X509CRL ;
+	struct xmldsigSignatureType Signature ;
+	struct {
+		uint8_t bytes[EXIFragment_Y_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  Y ;
+	struct xmldsigSignatureMethodType SignatureMethod ;
+	struct {
+		uint8_t bytes[EXIFragment_PgenCounter_BYTES_SIZE];
+		uint16_t bytesLen;
+	}  PgenCounter ;
+#if SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES
+	};
+#endif /* SAVE_MEMORY_WITH_UNNAMED_UNION == UNION_YES */ 
+	unsigned int DigestValue_isUsed:1;
+	unsigned int X509Data_isUsed:1;
+	unsigned int KeyValue_isUsed:1;
+	unsigned int DigestMethod_isUsed:1;
+	unsigned int SPKISexp_isUsed:1;
+	unsigned int Transforms_isUsed:1;
+	unsigned int KeyName_isUsed:1;
+	unsigned int X509IssuerName_isUsed:1;
+	unsigned int MgmtData_isUsed:1;
+	unsigned int Reference_isUsed:1;
+	unsigned int SignatureProperties_isUsed:1;
+	unsigned int PGPKeyID_isUsed:1;
+	unsigned int PGPData_isUsed:1;
+	unsigned int DSAKeyValue_isUsed:1;
+	unsigned int SignatureValue_isUsed:1;
+	unsigned int KeyInfo_isUsed:1;
+	unsigned int SignatureProperty_isUsed:1;
+	unsigned int PGPKeyPacket_isUsed:1;
+	unsigned int HMACOutputLength_isUsed:1;
+	unsigned int Exponent_isUsed:1;
+	unsigned int Manifest_isUsed:1;
+	unsigned int P_isUsed:1;
+	unsigned int CanonicalizationMethod_isUsed:1;
+	unsigned int Q_isUsed:1;
+	unsigned int Seed_isUsed:1;
+	unsigned int X509SubjectName_isUsed:1;
+	unsigned int X509Certificate_isUsed:1;
+	unsigned int RSAKeyValue_isUsed:1;
+	unsigned int X509IssuerSerial_isUsed:1;
+	unsigned int SPKIData_isUsed:1;
+	unsigned int G_isUsed:1;
+	unsigned int J_isUsed:1;
+	unsigned int SignedInfo_isUsed:1;
+	unsigned int X509SKI_isUsed:1;
+	unsigned int Transform_isUsed:1;
+	unsigned int XPath_isUsed:1;
+	unsigned int Object_isUsed:1;
+	unsigned int X509SerialNumber_isUsed:1;
+	unsigned int RetrievalMethod_isUsed:1;
+	unsigned int Modulus_isUsed:1;
+	unsigned int X509CRL_isUsed:1;
+	unsigned int Signature_isUsed:1;
+	unsigned int Y_isUsed:1;
+	unsigned int SignatureMethod_isUsed:1;
+	unsigned int PgenCounter_isUsed:1;
+
+
+	int _warning_;
+};
+#endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */
+
+
+/* Initialization methods for structs */
+
+void init_xmldsigEXIDocument(struct xmldsigEXIDocument* exiDoc);
+#if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES
+void init_xmldsigEXIFragment(struct xmldsigEXIFragment* exiFrag);
+#endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */
+void init_xmldsigCanonicalizationMethodType(struct xmldsigCanonicalizationMethodType* xmldsigCanonicalizationMethodType);
+void init_xmldsigManifestType(struct xmldsigManifestType* xmldsigManifestType);
+void init_xmldsigObjectType(struct xmldsigObjectType* xmldsigObjectType);
+void init_xmldsigTransformType(struct xmldsigTransformType* xmldsigTransformType);
+void init_xmldsigSignatureMethodType(struct xmldsigSignatureMethodType* xmldsigSignatureMethodType);
+void init_xmldsigDigestMethodType(struct xmldsigDigestMethodType* xmldsigDigestMethodType);
+void init_xmldsigRetrievalMethodType(struct xmldsigRetrievalMethodType* xmldsigRetrievalMethodType);
+void init_xmldsigSignatureValueType(struct xmldsigSignatureValueType* xmldsigSignatureValueType);
+void init_xmldsigX509IssuerSerialType(struct xmldsigX509IssuerSerialType* xmldsigX509IssuerSerialType);
+void init_xmldsigSignedInfoType(struct xmldsigSignedInfoType* xmldsigSignedInfoType);
+void init_xmldsigSignaturePropertiesType(struct xmldsigSignaturePropertiesType* xmldsigSignaturePropertiesType);
+void init_xmldsigSignaturePropertyType(struct xmldsigSignaturePropertyType* xmldsigSignaturePropertyType);
+void init_xmldsigKeyValueType(struct xmldsigKeyValueType* xmldsigKeyValueType);
+void init_xmldsigRSAKeyValueType(struct xmldsigRSAKeyValueType* xmldsigRSAKeyValueType);
+void init_xmldsigPGPDataType(struct xmldsigPGPDataType* xmldsigPGPDataType);
+void init_xmldsigTransformsType(struct xmldsigTransformsType* xmldsigTransformsType);
+void init_xmldsigX509DataType(struct xmldsigX509DataType* xmldsigX509DataType);
+void init_xmldsigSignatureType(struct xmldsigSignatureType* xmldsigSignatureType);
+void init_xmldsigDSAKeyValueType(struct xmldsigDSAKeyValueType* xmldsigDSAKeyValueType);
+void init_xmldsigReferenceType(struct xmldsigReferenceType* xmldsigReferenceType);
+void init_xmldsigSPKIDataType(struct xmldsigSPKIDataType* xmldsigSPKIDataType);
+void init_xmldsigKeyInfoType(struct xmldsigKeyInfoType* xmldsigKeyInfoType);
+
+
+#endif /* DEPLOY_XMLDSIG_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 4331 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypesDecoder.c


+ 65 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypesDecoder.h

@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: xmldsig-core-schema.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypesDecoder.h
+ * \brief 	Decoder for datatype definitions
+ *
+ */
+
+#ifndef EXI_xmldsig_DATATYPES_DECODER_H
+#define EXI_xmldsig_DATATYPES_DECODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "xmldsigEXIDatatypes.h"
+
+#if DEPLOY_XMLDSIG_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "EXITypes.h"
+
+int decode_xmldsigExiDocument(bitstream_t* stream, struct xmldsigEXIDocument* exiDoc);
+
+#if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES
+int decode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* exiFrag);
+#endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */
+
+#endif /* DEPLOY_XMLDSIG_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 3100 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypesEncoder.c


+ 66 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/exi_engine/xmldsig/xmldsigEXIDatatypesEncoder.h

@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007-2018 Siemens AG
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*******************************************************************
+ *
+ * @author Daniel.Peintner.EXT@siemens.com
+ * @version 0.9.4 
+ * @contact Richard.Kuntschke@siemens.com
+ *
+ * <p>Code generated by EXIdizer</p>
+ * <p>Schema: xmldsig-core-schema.xsd</p>
+ *
+ *
+ ********************************************************************/
+
+
+
+/**
+ * \file 	EXIDatatypesEncoder.h
+ * \brief 	Encoder for datatype definitions
+ *
+ */
+
+#ifndef EXI_xmldsig_DATATYPES_ENCODER_H
+#define EXI_xmldsig_DATATYPES_ENCODER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "xmldsigEXIDatatypes.h"
+
+#if DEPLOY_XMLDSIG_CODEC == SUPPORT_YES
+
+#include <stdint.h>
+
+#include "EXITypes.h"
+
+int encode_xmldsigExiDocument(bitstream_t* stream, struct xmldsigEXIDocument* exiDoc);
+
+#if DEPLOY_XMLDSIG_CODEC_FRAGMENT == SUPPORT_YES
+int encode_xmldsigExiFragment(bitstream_t* stream, struct xmldsigEXIFragment* exiFrag);
+#endif /* DEPLOY_XMLDSIG_CODEC_FRAGMENT */
+
+
+#endif /* DEPLOY_XMLDSIG_CODEC */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 1009 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/main.c

@@ -0,0 +1,1009 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 main.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 <unistd.h>
+#include "define.h"
+#include "main.h"
+
+
+struct SysConfigAndInfo     *ShmSysConfigAndInfo;
+struct StatusCodeData       *ShmStatusCodeData;
+struct CcsData              *ShmCcsData;
+struct InternalComm         *ShmInternalComm;
+//struct InternalCommAC       *ShmInternalCommAC;
+
+unsigned char buf_log_main[SIZE_OF_LOG_BUFFER];
+
+#if SAVE_SYS_LOG_MSG_MAIN_SWITCH == ENABLE
+int StoreLogMsg(unsigned char *DataString);
+#endif
+
+void System_Init();
+void CreateShareMemory_Init();
+void GPIO_Init();
+void PWM_Init();
+void Confinguration_Init();
+double DiffTimeb(struct timeb ST, struct timeb ET);
+int CreateShareMemory();
+int LoadSysConfigAndInfo(struct SysConfigData *ptr);
+int SpawnTask();
+int StoreUsrConfigData(struct SysConfigData *UsrData);
+
+
+unsigned int isKernelSupportNAT()
+{
+	unsigned int result = 0;
+	unsigned int version = 0;
+	FILE *fp;
+	char cmd[256];
+	char buf[512];
+
+	// Get IP address & net mask
+	strcpy(cmd, "uname -v");
+	fp = popen(cmd, "r");
+	if(fp != NULL)
+	{
+		if(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			sscanf(buf, "#%d", &version);
+		//	DEBUG_INFO("Kernel version: %d\n", version);
+
+			if(version >= 30)
+				result = 1;
+		}
+	}
+	pclose(fp);
+
+	return result;
+}
+
+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)
+		//printf("ADC[%d]=%d\n",AdcChannel,atoi(AdcValue));
+		return ((float)1.8*(float)atoi(AdcValue))/4095;
+	}
+
+}
+
+/*===========================================================================
+FUNCTION: main
+DESCRIPTION:
+    1. This main routine will be executed by the "rcS"  when linux is booting up.
+       /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/rootfs/etc/init.d/rcS
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int main(int argc, char *argv[])
+{
+    #ifdef CONNECTOR_TEMP_DETECTION
+    float CcsConnectorTemp1;
+    int CcsConnectorTemp;
+    #endif
+    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;
+    //float ChargingPower, ChargingEnergy;
+
+    //CSU Initialization
+    System_Init();
+
+    //task spawn
+    SpawnTask();
+    sleep(2);
+    system("killall ntpd");
+
+    /**************************************************************/
+    /************** main Loop********************************/
+    /*****************************************************************/
+
+    while(1)
+    {
+        //Sleep to reduce CPU power comsumption
+        sleep(5);
+      	#ifdef CONNECTOR_TEMP_DETECTION
+        CcsConnectorTemp=0;
+  	for(unsigned char i=0;i<=1;i++)
+  	{
+	  	CcsConnectorTemp1 = ReadAdcVolt(i);
+	    	if((CcsConnectorTemp1<=0.9)&&(CcsConnectorTemp1>=0.8))//0 ~ -40
+	    		CcsConnectorTemp1=(CcsConnectorTemp1-0.9)*500;
+	    	else if((CcsConnectorTemp1<=1.07)&&(CcsConnectorTemp1>0.9))	
+	    		CcsConnectorTemp1=(CcsConnectorTemp1-0.9)*705.88;
+	    	else	
+	    		CcsConnectorTemp1=195;//not available
+	    	CcsConnectorTemp|=((unsigned int)(CcsConnectorTemp1+60)&0xFF)<<(i*8); //0x00(-60)~0xFE(194)
+	    	//printf("CcsConnectorTemp1[%d]=%f\n ",i,CcsConnectorTemp1);
+	}
+	ShmSysConfigAndInfo->SysInfo.CcsConnectorTemp=CcsConnectorTemp;
+	//printf("CcsConnectorTemp=0x%x\n ",CcsConnectorTemp);
+	#endif
+    }//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:
+PRE-CONDITION:
+    1. Pin Assignment Configuration
+       board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/
+       arch/arm/boot/dts/[CCS]am335x-evm.dts
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void System_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 ---------
+    if(isKernelSupportNAT() == 1)
+		system("/sbin/insmod /lib/qcaspi_nat.ko");
+	else
+		system("/sbin/insmod /lib/qcaspi.ko");
+   // 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();
+
+    //Init ecap0
+    PWM_Init();
+
+    // ---------- Software Init ----------
+    //Create all share memory
+    CreateShareMemory_Init();
+
+    //Init System Confinguration
+    Confinguration_Init();
+
+
+    SAVE_SYS_LOG_MSG_MAIN("--------------------------");
+    SAVE_SYS_LOG_MSG_MAIN("System_Init(): DONE");
+
+}
+
+/*===========================================================================
+FUNCTION: CreateShareMemory_Init
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void CreateShareMemory_Init()
+{
+    if(CreateShareMemory() == 0)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory_Init(): NG");
+
+        if(ShmStatusCodeData != NULL)
+        {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
+        }
+
+        sleep(5);
+        system("reboot -f");
+        sleep(5);
+        system("reboot -f");
+    }
+    else
+    {
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory_Init(): DONE");
+    }
+}
+
+/**************************************************************************************/
+/**************************Create all share memory *********************************/
+/**************************************************************************************/
+
+/*===========================================================================
+FUNCTION: CreateShareMemory
+
+DESCRIPTION:
+    There are 4 share memory created here, which are listed as below.
+    1) ShmSysConfigAndInfo
+    2) ShmStatusCodeData
+    3) ShmCcsData
+    4) ShmInternalComm
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int CreateShareMemory()
+{
+    int MeterSMId;
+
+    //create ShmSysConfigAndInfo
+    if((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmget ShmSysConfigAndInfo NG");
+        return 0;
+    }
+    else if((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_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_MAIN("CreateShareMemory:shmget ShmStatusCodeData NG");
+        return 0;
+    }
+    else if((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_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_MAIN("CreateShareMemory:shmget ShmCcsData NG");
+        return 0;
+    }
+    else if((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmat ShmCcsData NG");
+        return 0;
+    }
+
+    memset(ShmCcsData, 0, sizeof(struct CcsData));
+
+
+    //create ShmInternalComm
+    if((MeterSMId = shmget(ShmInternalCommKey, sizeof(struct InternalComm),   IPC_CREAT | 0777)) < 0)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmget ShmInternalComm NG");
+        return 0;
+    }
+    else if((ShmInternalComm = shmat(MeterSMId, NULL, 0)) == (void *)-1)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("CreateShareMemory:shmat ShmInternalComm NG");
+        return 0;
+    }
+    memset(ShmInternalComm, 0, sizeof(struct InternalComm));
+
+    #if 0
+    //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)); 
+	#endif
+
+    return 1;
+}
+
+
+/*===========================================================================
+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_24 (gpio88): power reset QCA7000            (default = 0)
+        * gpio2_22 (gpio86): Pilot Status E control (0V)    (default = 0)
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void GPIO_Init()
+{
+    /*****************0~3, 4 bank, bank x 32+ num*********************/
+    /*****************************************************************/
+    /*************** INPUT PIN ***************************************/
+    /*****************************************************************/
+    /*GPIO2_0: QCA7000 interrupt */
+    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 ************************************/
+    /***************************************************************/
+    //IO port for Communication Board.(reserved for emergency shutdown PSU, i.e. PSKILL)
+    /*GPIO2_25: AM_IO_2, H: ?; L: ?*/
+    system("echo 89 > /sys/class/gpio/export");
+    system("echo \"out\" > /sys/class/gpio/gpio89/direction");
+    system("echo 0 > /sys/class/gpio/gpio89/value");
+
+
+    //Power Reset QCA7000
+    /*GPIO2_24: AM_QCA_PWR_RST, H: reset, L: noraml*/
+    system("echo 88 > /sys/class/gpio/export");
+    system("echo \"out\" > /sys/class/gpio/gpio88/direction");
+    system("echo 0 > /sys/class/gpio/gpio88/value");
+
+    //Pilot Status E control (0V)
+    /*GPIO2_22: Pilot_state E, H: state E, L: normal*/
+    system("echo 86 > /sys/class/gpio/export");
+    system("echo \"out\" > /sys/class/gpio/gpio86/direction");
+    system("echo 0 > /sys/class/gpio/gpio86/value");
+
+    SAVE_SYS_LOG_MSG_MAIN("GPIO_Init(): DONE");
+}
+
+
+/*===========================================================================
+FUNCTION: PWM_Init
+DESCRIPTION:
+    - Initialize the PWM channel by the following configuration.
+        * Frequency = 1KHz
+        * Duty = 100%
+
+    - The default voltage should be as below.
+        * 12V: unplugged
+        * 9V: plugged
+
+    - Check Mechanism (to-do)
+        * Read CP Voltage and PWM by AIN3:
+          // cat /sys/bus/iio/devices/iio\\:device0/in_voltage3_raw;
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+    - PWM = 100% at 1KHz
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void PWM_Init()
+{
+    //unsigned char str[256];
+
+    //init ecap0
+    //memset(str, 0, sizeof(str));
+    system("echo 0 > /sys/class/pwm/pwmchip0/export");
+    system("echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/period");// nano seconds =>1k Hz
+    system("echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle"); //default 100%
+    system("echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable");
+    //system("echo 1 > /sys /class/pwm/pwmchip0/pwm0/polarity");
+
+    //PWM_Init_Check(); //Checking if the PWM analog signal is well-initialized
+                        //as 1KHz,100%, and 12V/9V.
+
+    SAVE_SYS_LOG_MSG_MAIN("PWM_Init(): DONE");
+}
+
+/*===========================================================================
+FUNCTION:
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void Confinguration_Init()
+{
+    //Load System Confinguration
+    LoadSysConfigAndInfo(&ShmSysConfigAndInfo->SysConfig);
+
+    SAVE_SYS_LOG_MSG_MAIN("Confinguration_Init(): DONE");
+}
+
+/*===========================================================================
+FUNCTION: StoreLogMsg
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+#if SAVE_SYS_LOG_MSG_MAIN_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][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);
+    system(Buf);
+
+    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);
+
+    //Reset the buf_log_main Buffer, i.e. DataString
+    memset(buf_log_main, 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_main,
+                    "[Warning]StartTime(%.02lf) > EndTime(%.02lf), d(%.02lf)",
+                    StartTime,
+                    EndTime,
+                    t_diff);
+            SAVE_SYS_LOG_MSG_MAIN(buf_log_main);
+        }
+        #endif
+
+        return -1;
+    }
+    return t_diff;
+}
+
+
+/**************************************************************************************/
+/****************Following functions are CSU initialization***************************/
+/**************************************************************************************/
+
+/*===========================================================================
+FUNCTION:
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int SpawnTask()
+{
+    //system("/root/EventLogging &");
+    system("/root/CsuComm &");
+    
+    usleep(50000);  //50ms
+    
+    //system("echo 50000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle"); //5%, for test.
+    system("/root/SeccComm &");
+}
+
+
+/*===========================================================================
+FUNCTION:
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int StoreUsrConfigData(struct SysConfigData *UsrData)
+{
+    int fd, wrd;
+    unsigned int i, Chk;
+    unsigned char *ptr;
+
+    Chk = 0;
+    ptr = (unsigned char *)UsrData;
+
+    for(i = 0; i < sizeof(struct SysConfigData) - 4; i++)
+    {
+        Chk += *(ptr + i);
+    }
+
+    UsrData->Checksum = Chk;
+
+    fd = open("/dev/mtdblock10", O_RDWR);
+
+    if(fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("StoreUsrConfigData: open /dev/mtdblock10 NG");
+        return 0;
+    }
+
+    wrd = write(fd, UsrData, sizeof(struct SysConfigData));
+    close(fd);
+
+    if(wrd != (sizeof(struct SysConfigData)))
+    {
+        SAVE_SYS_LOG_MSG_MAIN("StoreUsrConfigData: write /dev/mtdblock10 NG");
+        return 0;
+    }
+
+    fd = open("/dev/mtdblock11", O_RDWR);
+
+    if(fd < 0)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("StoreUsrConfigData: open /dev/mtdblock11(backup) NG");
+
+        return 0;
+    }
+
+    wrd = write(fd, UsrData, sizeof(struct SysConfigData));
+    close(fd);
+
+    if(wrd != (sizeof(struct SysConfigData)))
+    {
+        SAVE_SYS_LOG_MSG_MAIN("StoreUsrConfigData: write /dev/mtdblock11(backup) NG");
+        return 0;
+    }
+
+    return 1;
+}
+
+/*===========================================================================
+FUNCTION: LoadSysConfigAndInfo
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+int LoadSysConfigAndInfo(struct SysConfigData *ptr)
+{
+    int fd, wrd;
+    struct SysConfigData *buf;
+    unsigned char *PtrBuf;
+    unsigned int ChkSum, ChkSumOrg;
+
+    if((buf = malloc(sizeof(struct SysConfigData))) == NULL)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): malloc buffer NG,rebooting..");
+
+        if(ShmStatusCodeData != NULL)
+        {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
+        }
+
+        sleep(5);
+        system("reboot -f");
+        sleep(5);
+        system("reboot -f");
+    }
+
+    memset(buf, 0, sizeof(struct SysConfigData));
+    fd = open("/dev/mtdblock10", O_RDWR);
+
+    if(fd < 0)
+    {
+        free(buf);
+        SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo():open mtdblock10 NG,rebooting..");
+
+        if(ShmStatusCodeData != NULL)
+        {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
+        }
+
+        sleep(5);
+        system("reboot -f");
+        sleep(5);
+        system("reboot -f");
+    }
+
+    wrd = read(fd, buf, sizeof(struct SysConfigData));
+    close(fd);
+
+    if(wrd != (sizeof(struct SysConfigData)))
+    {
+        free(buf);
+
+        SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): read SysConfigData data NG,rebooting..");
+
+        if(ShmStatusCodeData != NULL)
+        {
+            ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
+        }
+
+        sleep(5);
+        system("reboot -f");
+        sleep(5);
+        system("reboot -f");
+    }
+
+    PtrBuf = (unsigned char *)buf;
+    ChkSum = 0;
+
+    for(wrd = 0; wrd < (sizeof(struct SysConfigData) - 4); wrd++)
+    {
+        ChkSum += PtrBuf[wrd];
+    }
+
+    ChkSumOrg = buf->Checksum;
+
+    if(ChkSum != ChkSumOrg)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): Primary SysConfigData checksum NG, read backup");
+
+        fd = open("/dev/mtdblock11", O_RDWR);
+
+        if(fd < 0)
+        {
+            free(buf);
+
+            SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): open mtdblock11 (backup) NG,rebooting..");
+
+            if(ShmStatusCodeData != NULL)
+            {
+                ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
+            }
+
+            sleep(5);
+            system("reboot -f");
+            sleep(5);
+            system("reboot -f");
+        }
+
+        memset(buf, 0, sizeof(struct SysConfigData));
+        wrd = read(fd, buf, sizeof(struct SysConfigData));
+        close(fd);
+
+        if(wrd != sizeof(struct SysConfigData))
+        {
+            free(buf);
+
+            SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): read backup SysConfigData data NG,rebooting..");
+
+
+            if(ShmStatusCodeData != NULL)
+            {
+                ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
+            }
+
+            sleep(5);
+            system("reboot -f");
+            sleep(5);
+            system("reboot -f");
+        }
+
+        PtrBuf = (unsigned char *)buf;
+        ChkSum = 0;
+
+        for(wrd = 0; wrd < (sizeof(struct SysConfigData) - 4); wrd++)
+        {
+            ChkSum += PtrBuf[wrd];
+        }
+
+        ChkSumOrg = buf->Checksum;
+
+        if(ChkSum != ChkSumOrg)
+        {
+
+            SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): backup SysConfigData checksum NG, read Factory default");
+
+            fd = open("/dev/mtdblock12", O_RDWR);
+
+            if(fd < 0)
+            {
+                free(buf);
+
+                SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): open mtdblock12 (Factory default) NG,rebooting..");
+
+
+                if(ShmStatusCodeData != NULL)
+                {
+                    ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
+                }
+
+                sleep(5);
+                system("reboot -f");
+                sleep(5);
+                system("reboot -f");
+            }
+
+            memset(buf, 0, sizeof(struct SysConfigData));
+            wrd = read(fd, buf, sizeof(struct SysConfigData));
+            close(fd);
+
+            if(wrd != sizeof(struct SysConfigData))
+            {
+                free(buf);
+
+                SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): read factory default  SysConfigData data NG,rebooting..");
+
+
+                if(ShmStatusCodeData != NULL)
+                {
+                    ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
+                }
+
+                sleep(5);
+                system("reboot -f");
+                sleep(5);
+                system("reboot -f");
+            }
+
+            PtrBuf = (unsigned char *)buf;
+            ChkSum = 0;
+
+            for(wrd = 0; wrd < (sizeof(struct SysConfigData) - 4); wrd++)
+            {
+                ChkSum += PtrBuf[wrd];
+            }
+
+            ChkSumOrg = buf->Checksum;
+
+            if(ChkSum != ChkSumOrg)
+            {
+
+                SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): factory default  SysConfigData checksum NG, restore factory default");
+
+                goto DefaultShm;
+            }
+        }
+    }
+
+    //load OK
+    memcpy((struct SysConfigData *)ptr, (struct SysConfigData *)buf, sizeof(struct SysConfigData));
+    free(buf);
+
+    SAVE_SYS_LOG_MSG_MAIN("LoadSysConfigAndInfo(): Load SysConfigData OK");
+
+    return 1;
+
+DefaultShm:
+    system("cd /root;./FactoryConfig");
+
+    #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == DISABLE)
+    {
+        SAVE_SYS_LOG_MSG_MAIN("sync...");
+        system("sync");
+    }
+    #endif
+
+    sleep(5);
+    system("reboot -f");
+    sleep(5);
+    system("reboot -f");
+}

+ 62 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/main.h

@@ -0,0 +1,62 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 main.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_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

+ 104 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/rcS

@@ -0,0 +1,104 @@
+#! /bin/ash
+	
+#   ---------------------------------------------
+#   MDEV Support
+#   (Requires sysfs support in the kernel)
+#   ---------------------------------------------
+mount -n -t proc /proc /proc
+mount -n -t sysfs sysfs /sys
+mount -n -t tmpfs mdev /dev
+mkdir /dev/pts
+mount -t devpts devpts /dev/pts
+
+#echo -n " Enabling hot-plug          : "
+echo "/sbin/mdev" > /proc/sys/kernel/hotplug
+
+#echo -n " Populating /dev            : "
+mkdir /dev/input
+mkdir /dev/snd
+mdev -s
+
+#   ---------------------------------------------
+#   Disable power management
+#   (Requires sysfs support in the kernel)
+#   ---------------------------------------------
+# echo -n " Disabling Power mgmt       : "
+# echo -n "1" > /sys/power/cpuidle_deepest_state
+# status $? 1
+	
+
+#   ---------------------------------------------
+#   Mount the default file systems
+#   ---------------------------------------------
+#echo -n " Mounting other filesystems : "
+mount -a
+mount -t tmpfs tmpfs /mnt
+
+chmod 777 /Storage
+#mount -t jffs2 /dev/mtdblock13 /Storage
+ubiattach /dev/ubi_ctrl -m 13
+if [ "$?" -eq "0" ]
+then
+   echo "Success."
+else
+   echo "Erase /dev/mtd13 jffs2 block"
+   flash_eraseall /dev/mtd13
+   ubiattach /dev/ubi_ctrl -m 13
+fi
+ubimkvol /dev/ubi0 -N ubiNandFs -m
+mount -t ubifs ubi0:ubiNandFs /Storage
+mkdir -p /Storage/EventLog
+mkdir -p /Storage/ChargeLog
+mkdir -p /Storage/SystemLog
+mkdir -p /Storage/OCPP
+mkdir -p /UsbFlash	
+ln -s /mnt /var/www
+
+#   ---------------------------------------------
+#   Set PATH
+#   ---------------------------------------------
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
+
+#   ---------------------------------------------
+#   Start other daemons
+#   ---------------------------------------------
+#echo 110 > /sys/class/gpio/export
+#echo "out" > /sys/class/gpio/gpio110/direction
+#echo 1 > /sys/class/gpio/gpio110/value
+#sleep 2
+#/sbin/ifconfig eth0 192.168.1.10 netmask 255.255.255.0 
+#/sbin/ifconfig eth0 down
+#sleep 1
+#/sbin/ifconfig eth0 up
+#/sbin/route add default gw 192.168.1.1
+	
+#echo -n " Starting telnetd           	: "
+#/usr/sbin/telnetd -l /bin/login
+#status $? 0
+	
+echo -e " Starting SSH           	: \n"
+/sbin/dropbear
+echo -e " Starting FTPD	  		: \n"
+tcpsvd -vE 0.0.0.0 21 ftpd -w -t 30 / &
+echo -e " Starting LIGHTTPD		: \n"
+/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -m /lib
+
+cp /root/.tmate.conf /
+/usr/sbin/crond &
+
+id=CSU3_$(cat /sys/class/net/eth0/address)
+echo $id > /etc/hostname
+hostname -F /etc/hostname
+
+#status $? 0
+
+#   ---------------------------------------------
+#   Softlink
+#   ---------------------------------------------		
+cd lib
+ln -sf libbz2.so.1.0.6 libbz2.so.1
+	
+#   ---------------------------------------------
+#   Start demo app
+#   ---------------------------------------------
+/root/main &

+ 16 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/reset_soft.sh

@@ -0,0 +1,16 @@
+#killall main
+killall SeccComm
+#killall EvccComm
+#killall CsuComm
+#killall FactoryConfig
+#killall EventLogging
+#killall FWMaker
+#killall NidNmk
+#killall FWUpdate
+#killall candump
+echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
+sleep 2
+cd /root/
+#./main &
+./SeccComm &
+#./EvccComm &

+ 831 - 0
EVSE/Projects/NoodoeAX/Apps/CCS/version.h

@@ -0,0 +1,831 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 version.h
+
+                     initiated by Joseph D. Anderson
+                           (since 2019/12/03)
+=============================================================================*/
+#define FIRMWARE_VERSION            "V0.30.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.30.S0
+* Release Date: 2022-08-08
+* Change:
+  1. Fix response time for SLAC+PARM_CONF
+  2. Fix can't resend Atten_char_ind problem
+* File
+  1. SeccComm.c version.h
+  2. SeccComm.c SeccComm.h define.h
+
+
+[VERSION] V0.29.S0
+* Release Date: 2022-03-01
+* Change:
+  1. enable CP_PROTECTION_MECHANISM
+* File
+  1. define.h version.h
+  
+  
+  
+[VERSION] V0.28.S0
+* Release Date: 2022-03-01
+* Change:
+  1. modify charging remain time 
+  2. reduce SLAC waiting time to 20s for AC
+  3. set AC phase according to model name
+  4. add delay to while loop
+* File
+  1. exi_engine\api\api.c
+  2. SeccComm.c
+  3. SeccComm.c
+  4. CsuComm.c, 
+  
+  
+[VERSION] V0.27.S0
+* Release Date: 2021-12-
+* Change:
+  1. change Isolation test state to valid if recevied invalid during precharge and charging
+  2. Add CM_AMP_MAP message 
+  3. change isolation status to valid if recevie invalid from CSU in WeldingDetectionRes
+  4. remove extra I_NOW information if no output voltage
+  5. support TLS connection 
+  6. Intergrate to AC EVSE
+* File
+  1. SeccComm.c
+  2. SeccComm.*
+  3. SeccComm.c
+  4. CsuComm.c
+  5. define.h SeccComm.c NidNmk.h cakey.pem cacert.pem
+  	  exi_engine\api\api.c
+      EVSE/GPL/Makefile
+      EVSE/Projects/CCS/Apps/Makefile
+  6. AW-CCS\Apps\Makefile
+  	  AW-CCS\Apps\main.c	
+  	  AW-CCS\Apps\CCS\version.h
+  	  AW-CCS\Apps\CCS\Makefile
+  	  AW-CCS\Apps\CCS\define.h
+  	  AW-CCS\Apps\CCS\CsuComm.*
+  	  AW-CCS\Apps\CCS\SeccComm.c
+  
+[VERSION] V0.26.S0
+* Release Date: 2020-08-
+* Change:
+  1. Support BCB toggle
+  2. killall ntpd
+  3. set all stop reason to emergency stop , except 023979
+* File
+  1. SeccComm.c
+  2. main.c
+  3. SeccComm.c CsuComm.c
+  
+  
+[VERSION] V0.25.S0
+* Release Date: 2020-07-21
+* Change:
+  1. reset PLC chip after session terminated
+  2. set MIN_SUPPORTED_CURRENT =5
+* File
+  1. SeccComm.c
+  2. define.h
+
+
+[VERSION] V0.24.S0
+* Release Date: 2020-07-20
+* Change:
+  1. Fix Pmax in SAschedule less than 0 issue
+  2. ignore sequence error when receive session stop at any command
+  3. fix 10 times of max charging power issue in ChargeParamaterDiscovery.conf 
+  4. reduce 2 seconds after reset SeccComm
+  5. set output voltage = target voltage +10 if not over than max voltage
+* File
+  1. SeccComm.c, exi_engine\api\api.c
+  2. SeccComm.c     
+  3. SeccComm.c     
+  4. EVSE/rootfs/root/reset_soft.sh
+  5. exi_engine\api\api.c
+
+
+
+[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/NoodoeAX/Apps/Images/root/CsuComm


BIN
EVSE/Projects/NoodoeAX/Apps/Images/root/FWUpdate


BIN
EVSE/Projects/NoodoeAX/Apps/Images/root/FactoryConfig


BIN
EVSE/Projects/NoodoeAX/Apps/Images/root/PCBATester


BIN
EVSE/Projects/NoodoeAX/Apps/Images/root/SeccComm


+ 14 - 0
EVSE/Projects/NoodoeAX/Apps/Images/root/cacert.pem

@@ -0,0 +1,14 @@
+subject=/C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server
+issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA
+-----BEGIN X509 CERTIFICATE-----
+
+MIIBgjCCASwCAQQwDQYJKoZIhvcNAQEEBQAwODELMAkGA1UEBhMCQVUxDDAKBgNV
+BAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3JzYSB0ZXN0IENBMB4XDTk1MTAwOTIz
+MzIwNVoXDTk4MDcwNTIzMzIwNVowYDELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FM
+RDEZMBcGA1UEChMQTWluY29tIFB0eS4gTHRkLjELMAkGA1UECxMCQ1MxGzAZBgNV
+BAMTElNTTGVheSBkZW1vIHNlcnZlcjBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3
+LCXcScWua0PFLkHBLm2VejqpA1F4RQ8q0VjRiPafjx/Z/aWH3ipdMVvuJGa/wFXb
+/nDFLDlfWp+oCPwhBtVPAgMBAAEwDQYJKoZIhvcNAQEEBQADQQArNFsihWIjBzb0
+DCsU0BvL2bvSwJrPEqFlkDq3F4M6EGutL9axEcANWgbbEdAvNJD1dmEmoWny27Pn
+IMs6ZOZB
+-----END X509 CERTIFICATE-----

+ 24 - 0
EVSE/Projects/NoodoeAX/Apps/Images/root/cakey.pem

@@ -0,0 +1,24 @@
+issuer= /C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=CA
+subject=/C=AU/SOP=QLD/O=Mincom Pty. Ltd./OU=CS/CN=SSLeay demo server
+-----BEGIN X509 CERTIFICATE-----
+
+MIIBgjCCASwCAQQwDQYJKoZIhvcNAQEEBQAwODELMAkGA1UEBhMCQVUxDDAKBgNV
+BAgTA1FMRDEbMBkGA1UEAxMSU1NMZWF5L3JzYSB0ZXN0IENBMB4XDTk1MTAwOTIz
+MzIwNVoXDTk4MDcwNTIzMzIwNVowYDELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA1FM
+RDEZMBcGA1UEChMQTWluY29tIFB0eS4gTHRkLjELMAkGA1UECxMCQ1MxGzAZBgNV
+BAMTElNTTGVheSBkZW1vIHNlcnZlcjBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQC3
+LCXcScWua0PFLkHBLm2VejqpA1F4RQ8q0VjRiPafjx/Z/aWH3ipdMVvuJGa/wFXb
+/nDFLDlfWp+oCPwhBtVPAgMBAAEwDQYJKoZIhvcNAQEEBQADQQArNFsihWIjBzb0
+DCsU0BvL2bvSwJrPEqFlkDq3F4M6EGutL9axEcANWgbbEdAvNJD1dmEmoWny27Pn
+IMs6ZOZB
+-----END X509 CERTIFICATE-----
+-----BEGIN RSA PRIVATE KEY-----
+
+MIIBPAIBAAJBALcsJdxJxa5rQ8UuQcEubZV6OqkDUXhFDyrRWNGI9p+PH9n9pYfe
+Kl0xW+4kZr/AVdv+cMUsOV9an6gI/CEG1U8CAwEAAQJAXJMBZ34ZXHd1vtgL/3hZ
+hexKbVTx/djZO4imXO/dxPGRzG2ylYZpHmG32/T1kaHpZlCHoEPgHoSzmxYXfxjG
+sQIhAPmZ/bQOjmRUHM/VM2X5zrjjM6z18R1P6l3ObFwt9FGdAiEAu943Yh9SqMRw
+tL0xHGxKmM/YJueUw1gB6sLkETN71NsCIQCeT3RhoqXfrpXDoEcEU+gwzjI1bpxq
+agiNTOLfqGoA5QIhAIQFYjgzONxex7FLrsKBm16N2SFl5pXsN9SpRqqL2n63AiEA
+g9VNIQ3xwpw7og3IbONifeku+J9qGMGQJMKwSTwrFtI=
+-----END RSA PRIVATE KEY-----

BIN
EVSE/Projects/NoodoeAX/Apps/Images/root/main


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 587 - 190
EVSE/Projects/NoodoeAX/Apps/LCM/Module_LcmControl.c


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است