Browse Source

[Add][AX80][All]

2021.10.28 / Folus Wen

Actions:
1. Add AX80 project.
2. Control architecture change to cabinet and dispenser.

Files:
1. As follow commit history

Image version: D0.00.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 3 years ago
parent
commit
0605556854
100 changed files with 200140 additions and 881 deletions
  1. 14537 0
      EVSE/Projects/AX80/Apps/CCS/Module_CCS.c
  2. 234 0
      EVSE/Projects/AX80/Apps/CCS/Module_CCS.h
  3. 300 0
      EVSE/Projects/AX80/Apps/CCS/NidNmk.c
  4. 40 0
      EVSE/Projects/AX80/Apps/CCS/NidNmk.h
  5. BIN
      EVSE/Projects/AX80/Apps/CCS/QCA7000_Flash_001823078881.bin
  6. 69 0
      EVSE/Projects/AX80/Apps/CCS/SystemLogMessage.c
  7. 37 0
      EVSE/Projects/AX80/Apps/CCS/SystemLogMessage.h
  8. 2583 0
      EVSE/Projects/AX80/Apps/CCS/define_ccs.h
  9. 5081 0
      EVSE/Projects/AX80/Apps/CCS/v2g/api/api.c
  10. 182 0
      EVSE/Projects/AX80/Apps/CCS/v2g/api/api.h
  11. 64 0
      EVSE/Projects/AX80/Apps/CCS/v2g/appHandshake/appHandEXIDatatypes.c
  12. 134 0
      EVSE/Projects/AX80/Apps/CCS/v2g/appHandshake/appHandEXIDatatypes.h
  13. 896 0
      EVSE/Projects/AX80/Apps/CCS/v2g/appHandshake/appHandEXIDatatypesDecoder.c
  14. 57 0
      EVSE/Projects/AX80/Apps/CCS/v2g/appHandshake/appHandEXIDatatypesDecoder.h
  15. 671 0
      EVSE/Projects/AX80/Apps/CCS/v2g/appHandshake/appHandEXIDatatypesEncoder.c
  16. 58 0
      EVSE/Projects/AX80/Apps/CCS/v2g/appHandshake/appHandEXIDatatypesEncoder.h
  17. 105 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/BitInputStream.c
  18. 67 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/BitInputStream.h
  19. 124 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/BitOutputStream.c
  20. 85 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/BitOutputStream.h
  21. 88 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/ByteStream.c
  22. 75 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/ByteStream.h
  23. 930 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/DecoderChannel.c
  24. 441 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/DecoderChannel.h
  25. 106 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/EXIConfig.h
  26. 66 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/EXIHeaderDecoder.c
  27. 60 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/EXIHeaderDecoder.h
  28. 50 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/EXIHeaderEncoder.c
  29. 61 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/EXIHeaderEncoder.h
  30. 93 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/EXIOptions.h
  31. 591 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/EXITypes.h
  32. 704 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/EncoderChannel.c
  33. 423 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/EncoderChannel.h
  34. 120 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/ErrorCodes.h
  35. 117 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/MethodsBag.c
  36. 70 0
      EVSE/Projects/AX80/Apps/CCS/v2g/codec/MethodsBag.h
  37. 969 0
      EVSE/Projects/AX80/Apps/CCS/v2g/din/dinEXIDatatypes.c
  38. 2934 0
      EVSE/Projects/AX80/Apps/CCS/v2g/din/dinEXIDatatypes.h
  39. 345 0
      EVSE/Projects/AX80/Apps/CCS/v2g/din/dinEXIDatatypesDecoder.c
  40. 65 0
      EVSE/Projects/AX80/Apps/CCS/v2g/din/dinEXIDatatypesDecoder.h
  41. 281 0
      EVSE/Projects/AX80/Apps/CCS/v2g/din/dinEXIDatatypesEncoder.c
  42. 68 0
      EVSE/Projects/AX80/Apps/CCS/v2g/din/dinEXIDatatypesEncoder.h
  43. 992 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso1/iso1EXIDatatypes.c
  44. 2992 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso1/iso1EXIDatatypes.h
  45. 9847 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso1/iso1EXIDatatypesDecoder.c
  46. 65 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso1/iso1EXIDatatypesDecoder.h
  47. 7011 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso1/iso1EXIDatatypesEncoder.c
  48. 68 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso1/iso1EXIDatatypesEncoder.h
  49. 1496 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso2/iso2EXIDatatypes.c
  50. 4189 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso2/iso2EXIDatatypes.h
  51. 63551 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso2/iso2EXIDatatypesDecoder.c
  52. 65 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso2/iso2EXIDatatypesDecoder.h
  53. 44215 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso2/iso2EXIDatatypesEncoder.c
  54. 68 0
      EVSE/Projects/AX80/Apps/CCS/v2g/iso2/iso2EXIDatatypesEncoder.h
  55. 92 0
      EVSE/Projects/AX80/Apps/CCS/v2g/transport/v2gtp.c
  56. 55 0
      EVSE/Projects/AX80/Apps/CCS/v2g/transport/v2gtp.h
  57. 255 0
      EVSE/Projects/AX80/Apps/CCS/v2g/xmldsig/xmldsigEXIDatatypes.c
  58. 935 0
      EVSE/Projects/AX80/Apps/CCS/v2g/xmldsig/xmldsigEXIDatatypes.h
  59. 4331 0
      EVSE/Projects/AX80/Apps/CCS/v2g/xmldsig/xmldsigEXIDatatypesDecoder.c
  60. 65 0
      EVSE/Projects/AX80/Apps/CCS/v2g/xmldsig/xmldsigEXIDatatypesDecoder.h
  61. 3100 0
      EVSE/Projects/AX80/Apps/CCS/v2g/xmldsig/xmldsigEXIDatatypesEncoder.c
  62. 66 0
      EVSE/Projects/AX80/Apps/CCS/v2g/xmldsig/xmldsigEXIDatatypesEncoder.h
  63. 2576 0
      EVSE/Projects/AX80/Apps/LCM/Module_LcmControl.c
  64. 315 0
      EVSE/Projects/AX80/Apps/LCM/cbmp.c
  65. 54 0
      EVSE/Projects/AX80/Apps/LCM/cbmp.h
  66. 222 0
      EVSE/Projects/AX80/Apps/LCM/lcmComm_dgus.c
  67. 322 0
      EVSE/Projects/AX80/Apps/LCM/lcmComm_dgus.h
  68. 164 0
      EVSE/Projects/AX80/Apps/Makefile
  69. 2030 0
      EVSE/Projects/AX80/Apps/Module_AlarmDetect.c
  70. 13 0
      EVSE/Projects/AX80/Apps/Module_AlarmDetect.h
  71. 1021 0
      EVSE/Projects/AX80/Apps/Module_Cabinet.c
  72. 97 0
      EVSE/Projects/AX80/Apps/Module_Cabinet.h
  73. 857 0
      EVSE/Projects/AX80/Apps/Module_ConfigTools.c
  74. 349 0
      EVSE/Projects/AX80/Apps/Module_Debug.c
  75. 1518 0
      EVSE/Projects/AX80/Apps/Module_Dispenser.c
  76. 55 0
      EVSE/Projects/AX80/Apps/Module_Dispenser.h
  77. 363 0
      EVSE/Projects/AX80/Apps/Module_EventLogging.c
  78. 445 0
      EVSE/Projects/AX80/Apps/Module_FactoryConfig.c
  79. 2855 0
      EVSE/Projects/AX80/Apps/Module_InternalComm.c
  80. 69 0
      EVSE/Projects/AX80/Apps/Module_InternalComm.h
  81. 879 0
      EVSE/Projects/AX80/Apps/Module_PowerSharing.c
  82. 126 0
      EVSE/Projects/AX80/Apps/Module_PowerSharing.h
  83. 300 0
      EVSE/Projects/AX80/Apps/Module_Speaker.c
  84. 6273 0
      EVSE/Projects/AX80/Apps/main.c
  85. 806 0
      EVSE/Projects/AX80/Apps/main.h
  86. BIN
      EVSE/Projects/AX80/Images/FactoryDefaultConfig.bin
  87. BIN
      EVSE/Projects/AX80/Images/MLO
  88. BIN
      EVSE/Projects/AX80/Images/am335x-evm.dtb
  89. BIN
      EVSE/Projects/AX80/Images/ramdisk.gz
  90. BIN
      EVSE/Projects/AX80/Images/u-boot-spl.bin
  91. BIN
      EVSE/Projects/AX80/Images/u-boot.img
  92. BIN
      EVSE/Projects/AX80/Images/zImage
  93. 9 0
      EVSE/Projects/define.h
  94. BIN
      EVSE/rootfs/lib/qcaspi.ko
  95. 73 0
      Makefile
  96. 296 296
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_System.map
  97. 288 288
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms1.S
  98. 288 288
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms2.S
  99. 1 1
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version
  100. 37 8
      board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/.am335x-evm.dtb.dts.tmp

+ 14537 - 0
EVSE/Projects/AX80/Apps/CCS/Module_CCS.c

@@ -0,0 +1,14537 @@
+/*
+ * Module_CCS.c
+ *
+ *  Created on: 2020/03/16
+ *      Author: foluswen
+ */
+#include "Module_CCS.h"
+#include "define_ccs.h"
+#include "main.h"
+
+enum MsgFlowStatus V2gFlowStatus;
+
+struct SysConfigAndInfo *ShmSysConfigAndInfo;
+struct StatusCodeData 	*ShmStatusCodeData;
+struct CcsData	 		*ShmCcsData;
+struct InternalComm 	*ShmInternalComm;
+struct DISPENSER 		*ShmDispenser;
+
+struct V2G_OBJECT
+{
+	struct appHandEXIDocument appHandshake;
+	struct dinEXIDocument DIN;
+	struct iso1EXIDocument ISO1;
+	struct iso2EXIDocument ISO2;
+}v2gObject;
+
+struct V2G_BUFFER
+{
+	unsigned char rx[V2GTP_MSG_RX_BUFFER_SIZE];
+	unsigned char tx[V2GTP_MSG_TX_BUFFER_SIZE];
+}v2gBuffer;
+
+struct SOCKET_HANDLE
+{
+	int Raw;
+	int Udp;
+	int Tcp;
+	int TcpAccept;
+}socketFd;
+
+struct PID_T
+{
+	pid_t CP_Detection;
+	pid_t PP_Detection;
+	pid_t Error_Monitor;
+}pid;
+
+struct MAC
+{
+	unsigned char eth0[6];
+	unsigned char eth1[6];
+	unsigned char qca[6];
+	unsigned char evcc[6];
+}macAddr;
+
+struct QCA_INFO
+{
+	struct MmeHeader SendMmePacket;
+	struct sockaddr_ll DestSocketAddress;
+
+	int SendMmePacketSize;
+	unsigned char SlacRunId[8];
+	struct ifreq Req;
+	unsigned char AagGroupsNum;
+	unsigned char MnbcSoundNum;
+	unsigned char AttenProfileCnt;
+	unsigned char NewNmkKey[16];
+	unsigned char Nid[7];
+}qcaInfo;
+
+struct TIMER
+{
+	unsigned int PwmStart;
+	struct timeb SeqStart;
+	struct timeb SeqEnd;
+}timerStart;
+
+
+/**
+ *
+ * @param statusCode
+ * @param statusName
+ * @return
+ */
+uint8_t get_V2G_Status_Name(uint8_t statusCode, char *statusName)
+{
+	int result = PASS;
+
+	switch(statusCode)
+	{
+		case IDLE:
+			sprintf(statusName, "IDLE");
+			break;
+		case CM_SLAC_PARM_REQ:
+			sprintf(statusName, "CM_SLAC_PARM_REQ");
+			break;
+		case CM_SLAC_PARM_CONF:
+			sprintf(statusName, "CM_SLAC_PARM_CONF");
+			break;
+		case CM_START_ATTEN_CHAR_IND:
+			sprintf(statusName, "CM_START_ATTEN_CHAR_IND");
+			break;
+		case CM_MNBC_SOUND_IND:
+			sprintf(statusName, "CM_MNBC_SOUND_IND");
+			break;
+		case CM_ATTEN_CHAR_IND:
+			sprintf(statusName, "CM_ATTEN_CHAR_IND");
+			break;
+		case CM_ATTEN_CHAR_RSP:
+			sprintf(statusName, "CM_ATTEN_CHAR_RSP");
+			break;
+		case CM_VALIDATE_REQ:
+			sprintf(statusName, "CM_VALIDATE_REQ");
+			break;
+		case CM_VALIDATE_CNF:
+			sprintf(statusName, "CM_VALIDATE_CNF");
+			break;
+		case CM_SLAC_MATCH_REQ:
+			sprintf(statusName, "CM_SLAC_MATCH_REQ");
+			break;
+		case CM_SLAC_MATCH_CNF:
+			sprintf(statusName, "CM_SLAC_MATCH_CNF");
+			break;
+		case CM_AMP_MAP_REQ:
+			sprintf(statusName, "CM_AMP_MAP_REQ");
+			break;
+		case CM_AMP_MAP_CNF:
+			sprintf(statusName, "CM_AMP_MAP_CNF");
+			break;
+		case CM_SET_KEY_REQ:
+			sprintf(statusName, "CM_SET_KEY_REQ");
+			break;
+		case CM_SET_KEY_CNF:
+			sprintf(statusName, "CM_SET_KEY_CNF");
+			break;
+		case SLACC_SDP_UDP_Connection:
+			sprintf(statusName, "SLACC_SDP_UDP_Connection");
+			break;
+		case SLACC_SDP_TCP_Connection:
+			sprintf(statusName, "SLACC_SDP_TCP_Connection");
+			break;
+		case SupportedAppProtocolRequest:
+			sprintf(statusName, "SupportedAppProtocolReq");
+			break;
+		case SupportedAppProtocolResponse:
+			sprintf(statusName, "SupportedAppProtocolRes");
+			break;
+		case SessionSetupRequest:
+			sprintf(statusName, "SessionSetupReq");
+			break;
+		case SessionSetupResponse:
+			sprintf(statusName, "UnSessionSetupResknown");
+			break;
+		case ServiceDiscoveryRequest:
+			sprintf(statusName, "ServiceDiscoveryReq");
+			break;
+		case ServiceDiscoveryResponse:
+			sprintf(statusName, "ServiceDiscoveryRes");
+			break;
+		case ServiceDetailRequest:
+			sprintf(statusName, "ServiceDetailReq");
+			break;
+		case ServiceDetailResponse:
+			sprintf(statusName, "ServiceDetailRes");
+			break;
+		case ServiceAndPaymentSelectionRequest:
+			sprintf(statusName, "ServiceAndPaymentSelectionReq");
+			break;
+		case ServiceAndPaymentSelectionResponse:
+			sprintf(statusName, "ServiceAndPaymentSelectionRes");
+			break;
+		case PaymentDetailsRequest:
+			sprintf(statusName, "PaymentDetailsReq");
+			break;
+		case PaymentDetailsResponse:
+			sprintf(statusName, "PaymentDetailsRes");
+			break;
+		case AuthorizationRequest:
+			sprintf(statusName, "AuthorizationReq");
+			break;
+		case AuthorizationResponse:
+			sprintf(statusName, "AuthorizationRes");
+			break;
+		case CertificateUpdateRequest:
+			sprintf(statusName, "CertificateUpdateReq");
+			break;
+		case CertificateUpdateResponse:
+			sprintf(statusName, "CertificateUpdateRes");
+			break;
+		case CertificateInstallationRequest:
+			sprintf(statusName, "CertificateInstallationReq");
+			break;
+		case CertificateInstallationResponse:
+			sprintf(statusName, "CertificateInstallationRes");
+			break;
+		case ChargeParameterDiscoveryRequest:
+			sprintf(statusName, "ChargeParameterDiscoveryReq");
+			break;
+		case ChargeParameterDiscoveryResponse:
+			sprintf(statusName, "ChargeParameterDiscoveryRes");
+			break;
+		case CableCheckRequest:
+			sprintf(statusName, "CableCheckReq");
+			break;
+		case CableCheckResponse:
+			sprintf(statusName, "CableCheckRes");
+			break;
+		case PreChargeRequest:
+			sprintf(statusName, "PreChargeReq");
+			break;
+		case PreChargeResponse:
+			sprintf(statusName, "PreChargeRes");
+			break;
+		case PowerDeliveryRequestStart:
+			sprintf(statusName, "PowerDeliveryReqStart");
+			break;
+		case PowerDeliveryResponsetStart:
+			sprintf(statusName, "PowerDeliveryResStart");
+			break;
+		case ChargingStatusRequest:
+			sprintf(statusName, "ChargingStatusReq");
+			break;
+		case ChargingStatusResponse:
+			sprintf(statusName, "ChargingStatusRes");
+			break;
+		case CurrentDemandRequest:
+			sprintf(statusName, "CurrentDemandReq");
+			break;
+		case CurrentDemandResponse:
+			sprintf(statusName, "CurrentDemandRes");
+			break;
+		case MeteringReceiptRequest:
+			sprintf(statusName, "MeteringReceiptReq");
+			break;
+		case MeteringReceiptResponse:
+			sprintf(statusName, "MeteringReceiptRes");
+			break;
+		case PowerDeliveryRequestStop:
+			sprintf(statusName, "PowerDeliveryReqStop");
+			break;
+		case PowerDeliveryResponseStop:
+			sprintf(statusName, "PowerDeliveryResStop");
+			break;
+		case WeldingDetectionRequest:
+			sprintf(statusName, "WeldingDetectionReq");
+			break;
+		case WeldingDetectionResponse:
+			sprintf(statusName, "WeldingDetectionRes");
+			break;
+		case SessionStopRequest:
+			sprintf(statusName, "SessionStopReq");
+			break;
+		case SessionStopResponse:
+			sprintf(statusName, "SessionStopRes");
+			break;
+		case Performance_Timeout:
+			sprintf(statusName, "Performance_Timeout");
+			break;
+		case Sequence_Timeout:
+			sprintf(statusName, "Sequence_Timeout");
+			break;
+		case Other_Fault:
+			sprintf(statusName, "Other_Fault");
+			break;
+		default:
+			sprintf(statusName, "Unknown");
+			result = FAIL;
+			break;
+	}
+
+	return result;
+}
+
+/**
+ *
+ * @return
+ */
+unsigned char Get_V2G_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;
+}
+
+/**
+ *
+ * @return
+ */
+unsigned char Get_V2G_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;
+}
+
+/**
+ *
+ * @param Fd
+ * @param MsgId
+ * @param SlaveAddress
+ * @param DataLength
+ * @param SendData
+ * @return
+ */
+int CAN_Tx_MSG(int Fd, unsigned int MsgId, unsigned char SlaveAddress, unsigned char DataLength, unsigned char *SendData)
+{
+#if 0
+    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));
+
+    return nbytes;
+#else
+    return -1;
+#endif
+}
+
+/**
+ *
+ * @param Fd
+ * @return
+ */
+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
+    }
+
+    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
+
+    DEBUG_INFO("Sending STOP Command to CSU\n");
+
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = FALSE;
+
+    return nbytes;
+}
+
+/**
+ *
+ * @param cmd
+ * @return
+ */
+int Sniffer_Candump(char cmd)
+{
+#if (CANDUMP_PACKETS_SNIFFER_SWITCH == ENABLE)
+    if (cmd == ENABLE)
+    {
+        DEBUG_INFO("Candump init\n");
+        system("cd /mnt/;rm -rf candump/");
+        system("cd /mnt/;mkdir candump");
+        DEBUG_INFO("Candump on\n");
+        system("cd /mnt/candump;candump -l can0 &");
+        return 0;
+    }
+    else if (cmd == DISABLE)
+    {
+        DEBUG_INFO("Candump off\n");
+        system("killall candump");
+
+        DEBUG_INFO("Candump save\n");
+        system("cd /;cp -rfv /mnt/candump /Storage/SystemLog/");
+        return 0;
+    }
+    else
+    {
+        DEBUG_INFO("Candump unexpected cmd(%d)\n", cmd);
+        return -1;
+    }
+#endif
+
+    return 0;
+}
+
+/**
+ *
+ * @param cmd
+ * @return
+ */
+int Sniffer_Tcpdump(char cmd)
+{
+    #if (TCPDUMP_PACKETS_SNIFFER_SWITCH == ENABLE)
+    if (cmd == ENABLE)
+    {
+        DEBUG_INFO("Tcpdump init...\n");
+        system("cd /mnt/;rm -rf tcpdump/");
+        system("cd /mnt/;mkdir tcpdump");
+
+        unsigned char cmdBuf[256];
+        time_t CurrentTime;
+        struct tm *tm;
+        struct timeval tv;
+
+        memset(cmdBuf, 0, sizeof(cmdBuf));
+        CurrentTime = time(NULL);
+        tm = localtime(&CurrentTime);
+        gettimeofday(&tv, NULL); // get microseconds, 10^-6
+        sprintf((char*)cmdBuf, "tcpdump -i eth1 -p \"udp or ether proto 0x88e1\" -w /mnt/tcpdump/[%04d.%02d]CCS_SlacPackets_%02X%02X%02X%02X%02X%02X%02X%02X.log &",
+								(tm->tm_year+1900),
+								(tm->tm_mon+1),
+								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]);
+        DEBUG_INFO("Tcpdump on\n");
+        system((char*)cmdBuf);
+
+        return 0;
+    }
+    else if (cmd == DISABLE)
+    {
+        DEBUG_INFO("Tcpdump off\n");
+        system("killall tcpdump");
+        for(int idx=2;idx>0;idx--)
+        {
+			DEBUG_INFO("Tcpdump wait: %ds\n", idx);
+			sleep(1);
+        }
+        DEBUG_INFO("Tcpdump save\n");
+        system("cd /;cp -rfv /mnt/tcpdump/* /Storage/SystemLog/");
+        system("cd /mnt/;rm -rf tcpdump/");
+        return 0;
+    }
+    else
+    {
+        DEBUG_INFO("Tcpdump unexpected cmd(%d)\n", cmd);
+
+        return -1;
+    }
+    #endif
+
+    return 0;
+}
+/**
+ *
+ * @param state_new
+ * @return
+ */
+int Update_V2G_Status(unsigned int state_new)
+{
+    unsigned char state_now;
+    char nameNow[64], nameNew[64];
+
+    state_now = Get_V2G_Status();
+    get_V2G_Status_Name(state_now, nameNow);
+    get_V2G_Status_Name(state_new, nameNew);
+
+    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
+        {
+        	DEBUG_WARN("state-%s(%d) change: ignored (End_Process_inused:%d, FW_Update_Task_inused:%d)\n",
+						nameNew, state_new,
+						EVCOMM_SYS_INFO.End_Process_inused,
+						CSUCOMMDC_TASK_FLAG.FW_Update_Task_inused);
+            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;
+                    DEBUG_WARN("state-%s(%d) change: ignored(now in error state-%s(%d))\n", nameNow, state_new, nameNew, state_now);
+                }
+                return -1;
+            }
+        }
+
+        //Updating the state formally.
+        DEBUG_INFO("%s(%02d) > %s(%02d)\n", nameNow, state_now, nameNew, state_new);
+
+        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;
+        }
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @param ST
+ * @param ET
+ * @return
+ */
+
+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)
+    {
+        return -1;
+    }
+    return t_diff;
+}
+
+
+/**
+ *
+ * @param ST
+ * @param ET
+ * @return
+ */
+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)
+    {
+        return -1;
+    }
+    return t_diff;
+}
+
+
+/**
+ *
+ * @param ST
+ * @param ET
+ * @return
+ */
+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)
+    {
+        return -1;
+    }
+    return t_diff;
+}
+
+/**
+ *
+ * @return
+ */
+int ShareMemory_Init()
+{
+    int MeterSMId;
+
+    //create ShmSysConfigAndInfo
+    if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), IPC_CREAT | 0777)) < 0)
+    {
+    	DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+        return 0;
+    }
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+        return 0;
+    }
+
+    //create ShmStatusCodeData
+    if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  IPC_CREAT | 0777)) < 0)
+    {
+    	DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+        return 0;
+    }
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+        return 0;
+    }
+
+    //create ShmCcsData
+    if ((MeterSMId = shmget(ShmCcsCommKey, sizeof(struct CcsData),  IPC_CREAT | 0777)) < 0)
+    {
+    	DEBUG_ERROR("shmget ShmCcsData NG\n");
+        return 0;
+    }
+    else if ((ShmCcsData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmCcsData NG\n");
+        return 0;
+    }
+
+    //create ShmInternalComm
+    if ((MeterSMId = shmget(ShmInternalCommKey, sizeof(struct InternalComm),   IPC_CREAT | 0777)) < 0)
+    {
+    	DEBUG_ERROR("shmget ShmInternalComm NG\n");
+        return 0;
+    }
+    else if ((ShmInternalComm = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmInternalComm NG\n");
+        return 0;
+    }
+
+	//Initial ShmSDispenser
+    if ((MeterSMId = shmget(ShmDispenserKey, sizeof(struct DISPENSER), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmDispenser NG %d\n", MeterSMId);
+		return 0;
+	}
+	else if ((ShmDispenser = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmDispenser NG\n");
+		return 0;
+	}
+
+    //[To-Do] The initialization here is reduntant and should be removed partially.
+    //SHM_Init_supportedAppProtocolRes(ShmCcsData);
+    //SHM_Init_din_SessionSetupRes(ShmCcsData);
+    //SHM_Init_din_ServiceDiscoveryRes(ShmCcsData);
+    //SHM_Init_din_ServiceAndPaymentSelectionRes(ShmCcsData);
+    //SHM_Init_din_ContractAuthenticationRes(ShmCcsData);
+    SHM_Init_din_ChargeParameterDiscoveryRes(ShmCcsData);
+    SHM_Init_din_CableCheckRes(ShmCcsData);
+    SHM_Init_din_PreChargeRes(ShmCcsData);
+    SHM_Init_din_PowerDeliveryRes(ShmCcsData);
+    SHM_Init_din_CurrentDemandRes(ShmCcsData);
+    SHM_Init_din_WeldingDetectionRes(ShmCcsData);
+    SHM_Init_din_SessionStopRes(ShmCcsData);
+
+    return 1;
+}
+
+/**
+ *  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.
+ * @param Eth
+ * @param mac
+ * @return
+ */
+int GetEthMac(unsigned char *Eth, unsigned char *mac)
+{
+    //Parameters:MAC,IP,Mask,Gateway
+    int fd;
+    unsigned char addr[18], Buffer[128];
+
+    memset(Buffer, 0, sizeof(Buffer));
+    sprintf((char*)Buffer, "cat /sys/class/net/%s/address > /mnt/GetEthInfo", Eth);    //CsuMac (Eth = eth1)
+    system((char*)Buffer);
+    fd = open("/mnt/GetEthInfo", O_RDONLY);
+    if(fd < 0)
+    {
+        system("rm -f /mnt/GetEthInfo");
+        DEBUG_ERROR("GetEthMac: MAC Address open error\n");
+        return 0;
+    }
+    memset(mac, 0, 6);
+    memset(addr, 0, sizeof(addr));
+    read(fd, addr, 17);
+    close(fd);
+    system("rm -f /mnt/GetEthInfo");
+    sscanf((char*)addr, "%02x:%02x:%02x:%02x:%02x:%02x", (uint32_t *)&mac[0], (uint32_t *)&mac[1], (uint32_t *)&mac[2], (uint32_t *)&mac[3], (uint32_t *)&mac[4], (uint32_t *)&mac[5]);    //CsuMac (Eth = eth1)
+    DEBUG_INFO("EVSE MAC address(%s): %02X:%02X:%02X:%02X:%02X:%02X\n", Eth, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+    return 1;
+}
+
+/**
+ *
+ * @param AdcChannel
+ * @return
+ */
+float ReadAdcVolt(unsigned char AdcChannel)
+{
+    //AIN0=CCS GUN Temp 1
+    //AIN1=CCS GUN Temp 2
+    //AIN2=CCS_Proximity/2
+    //AIN3=pilot voltage
+#if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+	return 0;
+#else
+	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((char*)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((char*)str, "cat /sys/bus/iio/devices/iio\\:device0/in_voltage%d_raw", AdcChannel);
+		fp=popen((char*)str, "r");
+		if(fgets((char*)AdcValue,sizeof(AdcValue),fp) == NULL)
+		{
+		    pclose(fp);
+		    return -1;
+		}
+		pclose(fp);
+		//Vin =  Vref *D / (2^n - 1)
+		return ((float)1.8*(float)atoi((char*)AdcValue))/4095;
+	}
+#endif
+
+}
+
+/**
+ *
+ * @return
+ */
+float ReadAdcVolt_PP_fork3()
+{
+#if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+	return 0;
+#else
+    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((char*)SampleBuf);
+            lseek(fd, 0, SEEK_SET);
+
+            AvgSample += TmpVolt;
+        }
+        close(fd);
+        AvgSample /= AvgTimes;
+        V_pp = (3.6*AvgSample)/4095;    //PP
+
+        usleep(20000);  //20ms
+
+        return V_pp;
+    }
+    else
+    {
+        return -1;
+    }
+#endif
+}
+
+/**
+ *
+ */
+void Qca7kPowerReset()
+{
+	DEBUG_INFO("QCA7000 reset...\n");
+	system("ifconfig eth1 down");
+	usleep(500000);
+    system("echo 0 > /sys/class/gpio/gpio115/value");
+    usleep(500000);
+    system("echo 1 > /sys/class/gpio/gpio115/value");
+    usleep(500000);
+    system("ifconfig eth1 up");
+    usleep(500000);
+}
+
+/**
+ *
+ * @param OnOff
+ * @return
+ */
+int SwitchCpStateE(unsigned char OnOff)
+{
+	/*
+	 *	TODO: Request CP change to state E
+	 */
+    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)
+        {
+            //DEBUG_INFO("SwitchCpStateE: released\n");
+            CSUCOMMAC_SHM.CpSetStateE = DISABLE;
+        }
+        else
+        {
+            OutputCpPwmDuty(100); //set CP duty as 100, firstly.
+            CSUCOMMAC_SHM.CpSetStateE = ENABLE;
+            //DEBUG_INFO("SwitchCpStateE: enabled!\n");
+        }
+    }
+    #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
+    {
+        if(OnOff == DISABLE)
+        {
+            //DEBUG_INFO("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");
+            //DEBUG_INFO("SwitchCpStateE: enabled!\n");
+        }
+    }
+    #endif
+
+    if (ccs->SwitchCpStateE_status_pre != ccs->SwitchCpStateE_status)
+    {
+        DEBUG_INFO("SwitchCpStateE: %d >> %d\n",
+								ccs->SwitchCpStateE_status_pre,
+								ccs->SwitchCpStateE_status);
+        ccs->SwitchCpStateE_status_pre = ccs->SwitchCpStateE_status;
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @param Duty
+ * @return
+ */
+int OutputCpPwmDuty(unsigned char Duty)
+{
+#if ((CCS_ENERGY_TRANSFER_MODE != MODE_AC_SINGLE_PHASE_CORE) && (CCS_ENERGY_TRANSFER_MODE != MODE_AC_THREE_PHASE_CORE))
+	char cmdBuf[1024];
+    int DutyInNanoSec;
+#endif
+    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((char*)cmdBuf, "echo %d > /sys/class/pwm/pwmchip0/pwm0/duty_cycle", DutyInNanoSec);//nanoseconds
+        system((char*)cmdBuf);
+    }
+#endif
+
+    ccs->CpDuty = Duty;
+
+    //CP Duty
+    if (ccs->CpDuty != ccs->CpDuty_pre)
+    {
+        DEBUG_INFO("CP Duty: %d%% >> %d%%\n", ccs->CpDuty_pre, ccs->CpDuty);
+
+        ccs->CpDuty_pre = ccs->CpDuty;
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @param ccs
+ */
+//#if DEBUG_INFO_SWITCH == ENABLE
+void Check_Plugin_Status_Update(struct ChargingInfoData *ccs)
+{
+    if (ccs->ConnectorPlugIn != ccs->ConnectorPlugIn_new)
+    {
+        DEBUG_INFO("[fork1]Plugin: %d >> %d (CP=%.2fV, PP=%.2fV)\n",
+								ccs->ConnectorPlugIn,
+								ccs->ConnectorPlugIn_new,
+								ccs->CpVoltage,
+								ccs->PpVoltage);
+
+        ccs->ConnectorPlugIn_pre = ccs->ConnectorPlugIn;
+        ccs->ConnectorPlugIn = ccs->ConnectorPlugIn_new;
+        //ccs->CpVoltage_pre = ccs->CpVoltage;
+    }
+}
+//#endif
+
+/**
+ *
+ * @return
+ */
+int CheckConnectorPlugIn()
+{
+#if (CP_PROTECTION_MECHANISM == ENABLE)
+    return ((ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_B) || (ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_C) || (ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_D) ? TRUE : FALSE);
+#else
+    return TRUE;
+#endif
+}
+
+/**
+ *
+ * @param ccs
+ * @return
+ */
+int Check_CP_State_Error(struct ChargingInfoData *ccs)
+{
+#if (CP_PROTECTION_MECHANISM == DISABLE)
+    {
+        return -1;
+    }
+#endif
+
+    unsigned char state = 0;
+#if ((CCS_ENERGY_TRANSFER_MODE != MODE_AC_SINGLE_PHASE_CORE) && (CCS_ENERGY_TRANSFER_MODE != MODE_AC_THREE_PHASE_CORE))
+    double time_diff = 0;
+#endif
+    state = Get_V2G_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)
+        {
+#ifdef TEST_WITH_ETH0
+        	if((ShmCcsData->EnergyTransferMode == MODE_DC_EXTENDED) && ((ccs->CpState != CCS_CP_STATE_B1) && (ccs->CpState != CCS_CP_STATE_B2)))
+#else
+            if((ccs->CpState != CCS_CP_STATE_B1) && (ccs->CpState != CCS_CP_STATE_B2))
+#endif
+            {
+                if (ccs->CpState_err == FALSE)
+                {
+                    DEBUG_ERROR("[fork1][CP]before CPD\n");    //CPD: ChargeParameterDiscoveryRequest
+                    //CPD: ChargeParameterDiscovery
+                }
+                ccs->CpState_err = TRUE;
+            }
+        }
+        #else
+        {
+            if(ccs->CpState != CCS_CP_STATE_B2)
+            {
+                if (ccs->CpState_err == FALSE)
+                {
+                	DEBUG_ERROR("[fork1][CP]]before CPD\n");    //CPD: ChargeParameterDiscoveryRequest
+                    //CPD: ChargeParameterDiscovery
+                }
+                ccs->CpState_err = TRUE;
+            }
+        }
+        #endif
+    }
+
+    #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+    {
+        //ChargeParameterDiscovery
+        if(state >= ChargeParameterDiscoveryRequest &&        //35
+           state <= ChargeParameterDiscoveryResponse)         //36
+        {
+#ifdef TEST_WITH_ETH0
+        	if((ccs->CpState != CCS_CP_STATE_B2) && ((ShmCcsData->EnergyTransferMode != MODE_DC_EXTENDED) && (ccs->CpState != CCS_CP_STATE_C)))
+#else
+            if(ccs->CpState != CCS_CP_STATE_B2)
+#endif
+            {
+                if (ccs->CpState_err == FALSE)
+                {
+                	DEBUG_ERROR("[fork1][CP]]CPD\n");
+                    //PRC: Precharge
+                    //CUD: CurrentDemand
+                }
+                ccs->CpState_err = TRUE;
+            }
+        }
+
+        //ChargingStatus
+        if(state >= ChargingStatusRequest &&        //43
+           state <= ChargingStatusResponse)         //44
+        {
+            if((ccs->CpState != CCS_CP_STATE_B2) && (ccs->CpState != CCS_CP_STATE_C) && (ccs->CpState != CCS_CP_STATE_D))
+            {
+                if (ccs->CpState_err == FALSE)
+                {
+                	DEBUG_ERROR("[fork1][CP]CGS\n");
+                    //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
+                {
+                    DEBUG_INFO("[fork1][CP]check C(4),D(5): ON (%.02lf of %dms)\n", time_diff, V2G_SECC_CP_Timeout_CableCheck);
+                    ccs->CableCheckPreCountDownDone = TRUE;
+                }
+            }
+
+            if(ccs->CableCheckPreCountDownDone == TRUE)
+            {
+                if(ccs->CpState != CCS_CP_STATE_C && ccs->CpState != CCS_CP_STATE_D)
+                {
+                    if (ccs->CpState_err == FALSE)
+                    {
+                    	DEBUG_ERROR("[fork1][CP]]CPD and CCK (after CNT)\n");
+                        //CPD: ChargeParameterDiscovery
+                        //CCK: CableCheck
+                        //CNT: count down
+                    }
+                    ccs->CpState_err = TRUE;
+                }
+            }
+            else
+            {
+                if((ccs->CpState != CCS_CP_STATE_B2) && (ccs->CpState != CCS_CP_STATE_C) && (ccs->CpState != CCS_CP_STATE_D))
+                {
+                    if (ccs->CpState_err == FALSE)
+                    {
+                    	DEBUG_ERROR("[fork1][CP]CPD and CCK (before CNT)\n");
+                        //CPD: ChargeParameterDiscovery
+                        //CCK: CableCheck
+                        //CNT: count down
+                    }
+                    ccs->CpState_err = TRUE;
+                }
+            }
+        }
+
+        //Precharge, CurrentDemand
+        if(state >= PreChargeRequest &&      //39
+        state <= CurrentDemandResponse)   //46
+        {
+            if((ccs->CpState != CCS_CP_STATE_C) && (ccs->CpState != CCS_CP_STATE_D))
+            {
+                if (ccs->CpState_err == FALSE)
+                {
+                	DEBUG_ERROR("[fork1][CP]PRC and CUD\n");
+                    //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);
+        DEBUG_ERROR("[fork1]CP(%d) Error in state %d(%d)\n", ccs->CpState, state, ccs->CableCheckPreCountDownDone);
+        ccs->CpState_err_logged = TRUE;
+    }
+    return 0;
+}
+
+/**
+ *
+ * @param ccs
+ */
+void Check_CP_State_Update(struct ChargingInfoData *ccs)
+{
+    //CP State
+    if (ccs->CpState != ccs->CpState_pre)
+    {
+        DEBUG_INFO("[fork1]CP State: %d >> %d (%.2fV)\n",
+								ccs->CpState_pre,
+								ccs->CpState,
+								ccs->CpVoltage);
+
+        ccs->CpState_pre = ccs->CpState;
+    }
+}
+
+/**
+ *
+ */
+void CP_Detection()
+{
+    pid_t tmp = 0;
+#if ((CCS_ENERGY_TRANSFER_MODE != MODE_AC_SINGLE_PHASE_CORE) && (CCS_ENERGY_TRANSFER_MODE != MODE_AC_THREE_PHASE_CORE))
+    unsigned char Statetmp;
+    float TotalTmpVolt;
+#endif
+    struct ChargingInfoData *ccs;
+
+    ccs = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    if(pid.CP_Detection == 0)
+    {
+        tmp = fork();
+        if(tmp > 0)
+        {
+        	pid.CP_Detection = tmp;
+
+            #if 1
+            unsigned char buf[64];
+            memset(buf, 0, sizeof(buf));
+            //sprintf((char*)buf, "renice -20 -p %d", tmp);
+            sprintf((char*)buf, "renice -10 -p %d", tmp);
+            system((char*)buf);
+            #endif
+
+            return;
+        }
+    }
+
+    while(1)
+    {
+        //ADC_Voltage = (1+RE62/RE63)*0.9 - (RE62/RE63)*Pilot_Voltage,  RE62/RE63=0.06
+        //=>Pilot_Voltage=(0.954-ADC_Voltage)/0.06
+
+        #if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+        {
+            ccs->CpVoltage = ShmInternalComm->AC_CpPositiveVoltage;
+            ccs->CpState = ShmInternalComm->AC_CpPresentState;
+        }
+        #else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
+        {
+            TotalTmpVolt = ReadAdcVolt(3);
+
+            ccs->CpVoltage = TotalTmpVolt;
+
+            if (ccs->CpVoltage_pre != ccs->CpVoltage)
+            {
+                ccs->CpVoltage_pre = ccs->CpVoltage;
+            }
+
+            //printf("TotalTmpVolt = %.02f\n", TotalTmpVolt);
+
+            //If CP voltage is higer than 13.5V
+            if(TotalTmpVolt >= 13.5)
+            {
+                //Pilot Error
+                if((ccs->CpState == CCS_CP_STATE_A) &&
+                (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 >= CCS_CP_STATE_B1) &&
+                (ccs->CpState <= CCS_CP_STATE_B2) &&
+                (TotalTmpVolt < 10.75))
+                {
+                    if((ccs->CpDuty >= 5) &&
+                    (ccs->CpDuty < 100))
+                    {
+                        Statetmp = 3;
+                    }
+                    else
+                    {
+                        Statetmp = 2;
+                    }
+                }
+                else if((ccs->CpState == CCS_CP_STATE_G) &&
+                        (TotalTmpVolt >= 13.25))
+                {
+                    Statetmp = 8;
+                }
+                else
+                {
+                    Statetmp = 1;
+                }
+            }
+            else if((TotalTmpVolt >= 7.5) && (TotalTmpVolt < 10.5))
+            {
+                //State B (9V)
+                if((ccs->CpState == CCS_CP_STATE_C) && (TotalTmpVolt < 7.75))
+                {
+                    Statetmp = 4;
+                }
+                else if((ccs->CpState == CCS_CP_STATE_A) && (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 == CCS_CP_STATE_D) && (TotalTmpVolt < 4.75))
+                {
+                    Statetmp = 5;
+                }
+                else if((ccs->CpState >= CCS_CP_STATE_B1) && (ccs->CpState <= CCS_CP_STATE_B2) && (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 == CCS_CP_STATE_E)&&(TotalTmpVolt < 1.75))
+                {
+                    Statetmp = 6;
+                }
+                else if((ccs->CpState == CCS_CP_STATE_C)&&(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 == CCS_CP_STATE_G) &&
+                (TotalTmpVolt < -1.25))
+                {
+                    Statetmp = 8;
+                }
+                else if((ccs->CpState == CCS_CP_STATE_D) &&
+                        (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 == CCS_CP_STATE_G) &&
+                (TotalTmpVolt >= -10.75))
+                {
+                    Statetmp = 8;
+                }
+                else
+                {
+                    Statetmp = 7;
+                }
+            }
+            else
+            {
+                //null
+            }
+
+            ccs->CpState = Statetmp;
+        }
+        #endif
+
+        Check_CP_State_Update(ccs);
+        Check_CP_State_Error(ccs);
+
+        //Updating Plugin status
+	#if (PP_PROTECTION_MECHANISM == ENABLE)
+        if((ccs->CpState >= CCS_CP_STATE_B1 ) && (ccs->CpState <= CCS_CP_STATE_D ) && (ccs->PpVoltage >= 1.0)) //PP >= 1.0V
+	#else
+        if((ccs->CpState >= CCS_CP_STATE_B1 ) && (ccs->CpState <= CCS_CP_STATE_D ))
+	#endif
+        {
+            ccs->ConnectorPlugIn_new = TRUE;
+        }
+        else
+        {
+            ccs->ConnectorPlugIn_new = FALSE;
+            OutputCpPwmDuty(100);
+        }
+
+        Check_Plugin_Status_Update(ccs);
+
+        usleep(1000);
+    }//while
+}
+
+/**
+ *  1. In order to detect CP in efficient response time, we create an independent
+ *     thread for this procedure.
+    2. The priority of this thread is set as the same as other tasks.
+ */
+void PP_Detection()
+{
+    pid_t tmp = 0;
+ //   struct timeb StartTime, EndTime;
+#if ((CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED))
+    //unsigned char Statetmp;
+#endif
+    float TotalTmpVolt;
+
+    if(pid.PP_Detection == 0)
+    {
+        tmp = fork();
+        if(tmp > 0)
+        {
+            pid.PP_Detection = tmp;
+
+            #if 0
+            unsigned char buf[64];
+            memset(buf, 0, sizeof(buf));
+            sprintf((char*)buf, "renice -20 -p %d", tmp);
+            system(buf);
+            #endif
+
+            return;
+        }
+    }
+
+    while(1)
+    {
+        TotalTmpVolt = ReadAdcVolt_PP_fork3();
+
+        EVCOMM_SYS_INFO.PpVoltage = TotalTmpVolt;
+
+        if (EVCOMM_SYS_INFO.PpVoltage_pre != EVCOMM_SYS_INFO.PpVoltage)
+        {
+            if ((EVCOMM_SYS_INFO.PpVoltage_pre < 0.5 && EVCOMM_SYS_INFO.PpVoltage >= 1.0) ||
+                 (EVCOMM_SYS_INFO.PpVoltage_pre >= 1.0 && EVCOMM_SYS_INFO.PpVoltage < 0.5))
+            {
+                DEBUG_INFO("[fork3]PP(%.2f >> %.2fV)\n", EVCOMM_SYS_INFO.PpVoltage_pre, EVCOMM_SYS_INFO.PpVoltage);
+                EVCOMM_SYS_INFO.PpVoltage_pre = EVCOMM_SYS_INFO.PpVoltage;
+            }
+        }
+
+        usleep(1000);
+    }//while
+}
+
+/**
+ *
+ */
+void Error_Monitor()
+{
+    pid_t tmp = 0;
+    double time_diff = 0;
+    unsigned char status = 0;
+    struct ChargingInfoData *ccs;
+    ccs = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    if(pid.Error_Monitor == 0)
+    {
+        tmp = fork();   //SeccComm fork2
+        if(tmp > 0)
+        {
+        	pid.Error_Monitor = tmp;
+
+            #if 0
+            unsigned char buf[64];
+            memset(buf, 0, sizeof(buf));
+            sprintf((char*)buf, "renice -20 -p %d", tmp);
+            system(buf);
+            #endif
+
+            return;
+        }
+    }
+
+    for(;;)
+    {
+        //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 = Get_V2G_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)
+                //DEBUG_INFO("[fork2] Emergency Stop (due to Connector is plugged out during communication.)\n");
+                DEBUG_ERROR("[fork2]Plug out Error => End_Process\n");
+                //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
+                //DEBUG_INFO("CP_PROTECTION_MECHANISM is disabled. Emergency Stop: skipped\n");
+			#endif
+            }
+        }
+
+
+        //Step 2: Check for V2G_SECC_Sequence_Timeout
+        //#if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+        status = Get_V2G_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
+            {
+            	DEBUG_ERROR("[fork2]V2G_SECC_Sequence_Timeout in state %d - (%.02lf of %d ms)\n", status, time_diff, V2G_SECC_Sequence_Timeout);
+                Update_V2G_Status(Sequence_Timeout);
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_V2G_Sequence_Time (023844)
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 4;
+                End_Process();
+                break;
+            }
+            else if (time_diff > 4000) //4s
+            {
+                //Check for CSU command of "Stop by EVSE"
+                if (EVCOMM_SYS_INFO.DC_EVSEStatus == EVSE_Shutdown)
+                {
+                    DEBUG_INFO("[Error_Monitor]EVSE_Shutdown\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                else if (EVCOMM_SYS_INFO.DC_EVSEStatus == EVSE_EmergencyShutdown)
+                {
+                    DEBUG_INFO("[Error_Monitor]EVSE_EmergencyShutdown\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                else if (ShmInternalComm->ChargingPermission == FALSE)
+                {
+                    if (status >= ChargeParameterDiscoveryRequest)  //&& status < SessionStopRequest
+                    {
+                        DEBUG_INFO("[Error_Monitor]ChargingPermission = FALSE\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                }
+                else
+                {
+                    //null
+                }
+            }
+            else
+            {
+                //null
+            }
+        }
+
+
+        //Step 3: Check and Response to Error V2gFlowStatus
+        status = Get_V2G_Status();
+        if (status == Performance_Timeout ||
+            status == Sequence_Timeout ||
+            status == Other_Fault)
+        {
+        	//Normal Stop
+        	DEBUG_ERROR("[fork2]Timeout or Fault State(%d) => End_Process\n", status);
+            End_Process();
+        }
+
+        //Step 4: Check and Response to CP State Error
+        if(ccs->CpState_err == TRUE)
+        {
+        	DEBUG_ERROR("[fork2]CP Error => End_Process\n");
+            Update_V2G_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 (Get_V2G_Status() <= SLACC_SDP_TCP_Connection)
+            {
+                DEBUG_INFO("[fork2]EVSE Shutdown(%d) => End_Process\n", EVCOMM_SYS_INFO.DC_EVSEStatus);
+                Update_V2G_Status(Other_Fault);
+                End_Process();
+            }
+        }
+
+        //Step 6: Check and Response to SessionStop
+        status = Get_V2G_Status();
+        if (status == SessionStopResponse)
+        {
+            DEBUG_INFO("[fork2]SessionStopResponse => End_Process\n");
+            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 >= CCS_CP_STATE_B2) && (ccs->CpState <= CCS_CP_STATE_D))
+        {
+            if (status >= CM_SLAC_PARM_REQ &&
+                status != CM_SET_KEY_REQ &&
+                status != CM_SET_KEY_CNF &&
+                status <= SLACC_SDP_TCP_Connection)
+            {
+                DEBUG_INFO("[fork2]Permission OFF before V2G msg(%d) => End_Process\n", ShmInternalComm->ChargingPermission);
+                Update_V2G_Status(Other_Fault);
+                End_Process();
+            }
+        }
+
+        //Step 8: DC OVP Protection
+        if (CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED &&
+            status > CableCheckResponse &&
+            status <= SessionStopRequest &&
+            status != ChargingStatusRequest &&
+            status != ChargingStatusResponse &&
+            EVCOMM_SYS_INFO.EvBatteryMaxVoltage != 0)
+        {
+            //Part A: OVP Protection
+            if (EVCOMM_SYS_INFO.PresentChargingVoltage >= (EVCOMM_SYS_INFO.EvBatteryMaxVoltage * 1.02)) // 2%
+            {
+            	DEBUG_ERROR("[fork2]OVP => End_Process (%.02f > %.02f)\n",
+										EVCOMM_SYS_INFO.PresentChargingVoltage,
+										(EVCOMM_SYS_INFO.EvBatteryMaxVoltage * 1.02));
+
+                Update_V2G_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))
+            {
+                DEBUG_INFO("[fork2]Over V Req => End_Process (%.02f > %.02f)\n",
+										EVCOMM_SYS_INFO.EvBatterytargetVoltage,
+										(EVCOMM_SYS_INFO.EvBatteryMaxVoltage * 1.02));
+
+                Update_V2G_Status(Other_Fault);
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //System CCS output OVP (012219)
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+                Proc_EVStopRes(ShmInternalComm->FD_CAN_Socket);
+                End_Process();
+            }
+        }
+
+        //Step 9: Check 60V
+        /*+++ 20200808, vern, sync with Tesla CHAdeMO adaptor, 2 for start communication(not yet auth), 1 for star charging (authorized)  ---*/
+        if (CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED &&
+            ShmInternalComm->ChargingPermission >= 1 &&
+            status < CableCheckRequest)
+        {
+            if (EVCOMM_SYS_INFO.PresentChargingVoltage >= 60)  //60V
+            {
+                DEBUG_INFO("[fork2]DC Output Voltage is over 60V => End_Process\n");
+                Update_V2G_Status(Other_Fault);
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_Unexpected_60V_Before_Charing_Error (023890)
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 9;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 0;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = TRUE;
+                //Proc_EVStopRes(ShmInternalComm->FD_CAN_Socket);
+                End_Process();
+            }
+        }
+
+        //Step 10: Check if the connector is unplug from plugin
+        if (EVCOMM_SYS_INFO.ConnectorPlugIn_pre == TRUE && EVCOMM_SYS_INFO.ConnectorPlugIn == FALSE)
+        {
+            DEBUG_INFO("[fork2]Unplug Reset => End_Process\n");
+            Update_V2G_Status(Other_Fault);
+            End_Process();
+        }
+        usleep(1000);
+    }//while
+}
+
+/**
+ *
+ * @return
+ */
+int SendSetKey()
+{
+    unsigned char nRandValue = 0x0;
+    unsigned char ConstString[16] = "PhihongKey000000";
+
+    memset(&qcaInfo.SendMmePacket, 0, sizeof(struct MmeHeader));
+    memcpy(qcaInfo.SendMmePacket.ODA, macAddr.qca, 6);
+    memcpy(qcaInfo.SendMmePacket.OSA, macAddr.eth1, 6);
+    qcaInfo.SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+    qcaInfo.SendMmePacket.MMV = 0x01;
+    qcaInfo.SendMmePacket.MMTYPE = MMTYPE_CM_SET_KEY_REQ;
+    qcaInfo.SendMmePacket.FMI[0] = qcaInfo.SendMmePacket.FMI[1] = 0;
+    qcaInfo.SendMmePacketSize = 0;
+    qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0x01;//Fixed value (0x01) to indicate ��NMK��
+    memset(qcaInfo.SendMmePacket.MMENTRY+qcaInfo.SendMmePacketSize, 0, 4);//My Nonce, Fixed value(0x00000000), encrypted payload not used
+    qcaInfo.SendMmePacketSize += 4;
+    memset(qcaInfo.SendMmePacket.MMENTRY+qcaInfo.SendMmePacketSize, 0, 4);//Your Nonce, Fixed value(0x00000000), encrypted payload not used
+    qcaInfo.SendMmePacketSize += 4;
+    qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0x04;//PID, Fixed value (0x04) to indicate ��HLE protocol��
+    memset(qcaInfo.SendMmePacket.MMENTRY+qcaInfo.SendMmePacketSize, 0, 2);//PRN, Fixed value(0x00), encrypted payload not used
+    qcaInfo.SendMmePacketSize += 2;
+    qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0x00;//PMN, Fixed value(0x00) encrypted payload not used
+    qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0x01;//CCo Capablility
+    srand(time(NULL));
+    for(int 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(qcaInfo.NewNmkKey, 0, sizeof(qcaInfo.NewNmkKey));
+    memset(qcaInfo.Nid, 0, sizeof(qcaInfo.Nid));
+    HPAVKeyNMK(qcaInfo.NewNmkKey, (char*)ConstString);
+    HPAVKeyNID(qcaInfo.Nid, qcaInfo.NewNmkKey, DEFAULT_LEVEL);
+    memcpy(qcaInfo.SendMmePacket.MMENTRY+qcaInfo.SendMmePacketSize, qcaInfo.Nid, sizeof(qcaInfo.Nid));    //NID, 54 LSBs contain the NID 2 MSBs = 0b00
+    qcaInfo.SendMmePacketSize += sizeof(qcaInfo.Nid);
+    qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0x01;//NewEKS,Fixed value (0x01)to indicate ��NMK��
+    memcpy(qcaInfo.SendMmePacket.MMENTRY+qcaInfo.SendMmePacketSize, qcaInfo.NewNmkKey,sizeof(qcaInfo.NewNmkKey));//NewKey
+    qcaInfo.SendMmePacketSize += sizeof(qcaInfo.NewNmkKey);
+    qcaInfo.SendMmePacketSize += 19;  //the size before MMENTRY
+
+    DEBUG_INFO("QCA7000 [TX]CM_SET_KEY_REQ\n");
+    DEBUG_INFO("SendSetKey: send size: %d\n", sendto(socketFd.Raw, &qcaInfo.SendMmePacket, qcaInfo.SendMmePacketSize, 0, (struct sockaddr*)&qcaInfo.DestSocketAddress, sizeof(struct sockaddr_ll)));
+
+    Update_V2G_Status(CM_SET_KEY_REQ);
+
+    return 0;
+}
+
+/**
+ *
+ * @return
+ */
+int GetQca7kMac()
+{
+    struct QcaVendorMmeHeader SendPacket;
+
+    DEBUG_INFO("Req for QCA7K MacAddr\n");
+
+    memset(&SendPacket, 0, sizeof(struct QcaVendorMmeHeader));
+    memset(SendPacket.ODA, 0xFF, 6);    //broadcast
+    memcpy(SendPacket.OSA, macAddr.eth1, 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;
+
+    DEBUG_INFO("GetQca7kMac: send size: %d\n", sendto(socketFd.Raw, &SendPacket, 20, 0, (struct sockaddr*)&qcaInfo.DestSocketAddress, sizeof(struct sockaddr_ll)));
+
+    return 0;
+}
+
+/**
+ *
+ * @param ptr
+ * @param size
+ * @return
+ */
+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;
+}
+
+/**
+ *
+ * @param ptrA
+ * @param ptrB
+ * @param size
+ * @return
+ */
+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
+            DEBUG_INFO("[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);
+            #endif
+            break;
+        }
+    }
+    return result;
+}
+
+/**
+ *
+ * @param evcc
+ * @param EvMac_in
+ * @return
+ */
+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
+        DEBUG_ERROR("DB length(%d) > %d\n", evcc->arrayLen, EVCC_SLAC_DATA_ARRAY_TYPE_ARRAY_SIZE);
+        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;
+}
+
+/**
+ *
+ * @param evcc
+ * @param EvMac_in
+ * @param RunID_in
+ * @return
+ */
+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;
+}
+
+/**
+ *
+ * @param EvMac_in
+ * @param RunID_in
+ * @return
+ */
+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
+        {
+            DEBUG_PRINTF_EVCOMM_DETAIL("data does not exist => added to %d-th\n", SLAC_INFO.arrayLen);
+
+            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
+            {
+                DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR]arrayLen: unexpected(%d)\n", SLAC_INFO.arrayLen);
+
+                SLAC_INFO.arrayLen = 0;
+            }
+        }
+        else
+        {
+            //DB is full
+            DEBUG_PRINTF_EVCOMM_DETAIL("DB is full(%d) => bypass\n", SLAC_INFO.arrayLen);
+        }
+    }
+    else
+    {
+        #if 0
+        DEBUG_INFO("EvMac: existed (%d)\n", idx);
+        #endif
+
+        //Check RunID
+        if (Array_Compare_Identity(SLAC_INFO.array[idx].RunID, RunID_in, SLAC_RUNID_LENGTH) == TRUE)
+        {
+            //RunID is the same
+            //DEBUG_INFO("RunID: same\n");
+        }
+        else
+        {
+            DEBUG_INFO("RunID: diff\n");
+        }
+
+        //Reset all corresponding parameters
+        #if 0
+        DEBUG_INFO("EvMac: reset para(%d)\n", idx);
+        #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;
+}
+
+/**
+ *
+ * @return
+ */
+int SLAC_DB_Reset()
+{
+    memset(&SLAC_INFO, 0, sizeof(struct EVCC_SLAC_DATA_TYPE));
+    DEBUG_INFO("DONE\n");
+
+    return 0;
+}
+
+/**
+ *
+ * @param Buffer
+ * @param DataLength
+ * @return
+ */
+int MmeProcess(unsigned char *Buffer, int DataLength)
+{
+    //struct ethhdr	*EthPacket;
+    struct MmeHeader *MmePacket;
+    static unsigned char counter;
+    unsigned char state = 0;
+    unsigned char tmpBuf[2048]={0};
+    int Rtn = 0;
+    int idx = 0;
+    unsigned char *EvMac_in;
+    unsigned char *RunID_in;
+
+    MmePacket = (struct MmeHeader *)Buffer;
+    state = Get_V2G_Status();
+
+	DEBUG_PRINTF_EVCOMM_DETAIL("***********************************\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]);
+
+
+    #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
+           )
+        {
+            //DEBUG_INFO("[SLAC]ignored(wrong CP state)\n");
+            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%02x\n", MmePacket->MMENTRY[0]);
+
+            DEBUG_INFO("CM_SET_KEY_CNF (SetKey: DONE)\n");
+            Update_V2G_Status(CM_SET_KEY_CNF);
+	        break;
+		}
+
+	    case MMTYPE_CM_SLAC_PARM_REQ:
+		{
+            //Check QCA7000 status
+            if (EVCOMM_SYS_INFO.QCA7K_SetKeyDone == FALSE)
+            {
+                //DEBUG_WARN("[SLAC][RX]CM_SLAC_PARM_REQ: ignored(QCA7K init...)\n");
+                break;
+            }
+
+            //Check error state
+            state = Get_V2G_Status();
+            if (state == Performance_Timeout ||     //253
+                state == Sequence_Timeout ||        //254
+                state == Other_Fault)               //255
+            {
+                DEBUG_WARN("CM_SLAC_PARM_REQ: ignored(in error state)\n");
+				break;
+            }
+
+            //Printing EV MAC Address
+            DEBUG_INFO("CM_SLAC_PARM_REQ\n");
+
+            //Avoid Coupled SLAC_PARM_REQ
+            if (CheckConnectorPlugIn() == FALSE)  //12V(State 1)
+            {
+                #if 0
+                DEBUG_WARN("[SLAC][RX]CM_SLAC_PARM_REQ: ignored(coupled SLAC,%d)\n", CheckConnectorPlugIn());
+                #endif
+                break;
+            }
+
+            //[TC_SECC_VTB_CmSlacParm_003] SECURITY_TYPE needs to be 0x00 (no security)
+            if (MmePacket->MMENTRY[1] != 0)
+            {
+                DEBUG_INFO("CM_SLAC_PARM_REQ: ignored(invalid SECURITY_TYPE,%d)\n", //Source MAC Address (EV MAC)
+                						MmePacket->MMENTRY[1]);
+                break;
+            }
+
+            //=================== Legal CM_SLAC_PARM_REQ Zone =================
+
+            Update_V2G_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);
+                DEBUG_INFO("Check Permission: %d (SLAC first => START)\n", ShmInternalComm->ChargingPermission);
+            }
+
+			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]);
+
+
+			//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)
+			{
+				DEBUG_WARN("DB is full or errors occour(%d) => ignore\n", idx);
+				break;
+			}
+
+			//Select the 1st EV MAC address
+			if (SLAC_INFO.arrayLen == 1)   //1st Req
+			{
+				DEBUG_INFO("CM_SLAC_PARM_REQ[%d](%02X:%02X:%02X:%02X:%02X:%02X, %02X%02X%02X%02X%02X%02X%02X%02X):selected\n",
+							(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]);
+			}
+			else    //2nd Req
+			{
+				DEBUG_INFO("CM_SLAC_PARM_REQ[%d](%02X:%02X:%02X:%02X:%02X:%02X, %02X%02X%02X%02X%02X%02X%02X%02X):not selected\n",
+							(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]);
+			}
+			memcpy(macAddr.evcc, MmePacket->OSA, sizeof(macAddr.evcc));
+			memcpy(qcaInfo.DestSocketAddress.sll_addr, MmePacket->OSA, SLAC_EVMAC_LENGTH);
+			memcpy(qcaInfo.SlacRunId, MmePacket->MMENTRY + 2, SLAC_RUNID_LENGTH);
+			memset(&qcaInfo.SendMmePacket, 0, sizeof(struct MmeHeader));
+			memcpy(qcaInfo.SendMmePacket.ODA, MmePacket->OSA, 6);
+			memcpy(qcaInfo.SendMmePacket.OSA, macAddr.eth1, 6);
+			qcaInfo.SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+			qcaInfo.SendMmePacket.MMV = MmePacket->MMV;
+			qcaInfo.SendMmePacket.MMTYPE = MMTYPE_CM_SLAC_PARM_CNF;
+			qcaInfo.SendMmePacket.FMI[0] = qcaInfo.SendMmePacket.FMI[1] = 0;
+			qcaInfo.SendMmePacketSize = 0;
+			memset(qcaInfo.SendMmePacket.MMENTRY, 0xFF, 6); //M-SOUND_TARGET(6-byte:0xFFFFFFFFFFFF): Fixed value indicating that M-Sounds to be sent as Ethernet broadcast
+			qcaInfo.SendMmePacketSize += 6;
+			qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = C_EV_match_MNBC; //NUM_SOUNDS(0x0A): Number of M-Sounds to be transmitted by the EV GP Station during the SLAC process
+			qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 6; //Time_Out(0x06): unit = 100ms
+			qcaInfo.SendMmePacket.MMENTRY[qcaInfo.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(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, SLAC_INFO.array[idx].EvMac, 6); //FORWARDING_STA(MAC Address of the EV HLE)
+			qcaInfo.SendMmePacketSize += 6;
+			qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0; //APPLICATION_TYPE(0x00): 0x00(PEV-EVSE Association), 0x01-0xFF(Reserved)
+			qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0; //SECURITY_TYPE(0x00): 0x00(No Security), 0x01(Public Key Signature), 0x02-0xFF(Reserved)
+			memcpy(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, qcaInfo.SlacRunId, SLAC_RUNID_LENGTH); //RunID (8-byte)
+			qcaInfo.SendMmePacketSize += SLAC_RUNID_LENGTH;
+			qcaInfo.SendMmePacketSize += 19;      //the size before MMENTRY
+
+			DEBUG_PRINTF_EVCOMM_DETAIL("***** Response MME Packet *****\n");
+			DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.ODA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+										qcaInfo.SendMmePacket.ODA[0],qcaInfo.SendMmePacket.ODA[1],qcaInfo.SendMmePacket.ODA[2],qcaInfo.SendMmePacket.ODA[3],qcaInfo.SendMmePacket.ODA[4],qcaInfo.SendMmePacket.ODA[5]);
+			DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.OSA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+										qcaInfo.SendMmePacket.OSA[0],qcaInfo.SendMmePacket.OSA[1],qcaInfo.SendMmePacket.OSA[2],qcaInfo.SendMmePacket.OSA[3],qcaInfo.SendMmePacket.OSA[4],qcaInfo.SendMmePacket.OSA[5]);
+			DEBUG_PRINTF_EVCOMM_DETAIL("MTYPE: 0x%x\n", htons(qcaInfo.SendMmePacket.MTYPE));
+			DEBUG_PRINTF_EVCOMM_DETAIL("MMV: 0x%x\n", qcaInfo.SendMmePacket.MMV);
+			DEBUG_PRINTF_EVCOMM_DETAIL("MMTYPE: 0x%x\n", qcaInfo.SendMmePacket.MMTYPE);
+			DEBUG_PRINTF_EVCOMM_DETAIL("FMI 0x%x, 0x%x\n", qcaInfo.SendMmePacket.FMI[0],qcaInfo.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",
+										qcaInfo.SendMmePacket.MMENTRY[0],qcaInfo.SendMmePacket.MMENTRY[1],qcaInfo.SendMmePacket.MMENTRY[2],qcaInfo.SendMmePacket.MMENTRY[3],qcaInfo.SendMmePacket.MMENTRY[4],qcaInfo.SendMmePacket.MMENTRY[5]);
+			DEBUG_PRINTF_EVCOMM_DETAIL("NUM_SOUNDS: 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[6]);
+			DEBUG_PRINTF_EVCOMM_DETAIL("Time_Out: 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[7]);
+			DEBUG_PRINTF_EVCOMM_DETAIL("RESP_TYPE: 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[8]);
+			DEBUG_PRINTF_EVCOMM_DETAIL("M-FORWARDING_STA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+										qcaInfo.SendMmePacket.MMENTRY[9],qcaInfo.SendMmePacket.MMENTRY[10],qcaInfo.SendMmePacket.MMENTRY[11],qcaInfo.SendMmePacket.MMENTRY[12],qcaInfo.SendMmePacket.MMENTRY[13],qcaInfo.SendMmePacket.MMENTRY[14]);
+			DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[15]);
+			DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[16]);
+			DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n",
+										qcaInfo.SendMmePacket.MMENTRY[17],qcaInfo.SendMmePacket.MMENTRY[18],qcaInfo.SendMmePacket.MMENTRY[19],qcaInfo.SendMmePacket.MMENTRY[20],qcaInfo.SendMmePacket.MMENTRY[21],qcaInfo.SendMmePacket.MMENTRY[22],qcaInfo.SendMmePacket.MMENTRY[23],qcaInfo.SendMmePacket.MMENTRY[24]);
+
+			Update_V2G_Status(CM_SLAC_PARM_CONF);
+			Rtn = sendto(socketFd.Raw, &qcaInfo.SendMmePacket, qcaInfo.SendMmePacketSize, 0, (struct sockaddr*)&qcaInfo.DestSocketAddress, sizeof(struct sockaddr_ll));
+
+			DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacketSize=%d, Rtn=%d\n", qcaInfo.SendMmePacketSize,Rtn);
+
+			ftime(&timerStart.SeqStart);
+			counter = 0;
+			break;
+		}
+
+	    case MMTYPE_CM_START_ATTEN_CHAR_IND:
+		{
+            if(V2gFlowStatus >= CM_ATTEN_CHAR_IND)
+            {
+                DEBUG_INFO("CM_START_ATTEN_CHAR_IND: ignored(time up)\n");
+                break;
+            }
+
+            //Avoid Coupled CM_START_ATTEN_CHAR_IND
+            if (CheckConnectorPlugIn() == FALSE)  //12V(State 1)
+            {
+                DEBUG_INFO("CM_START_ATTEN_CHAR_IND: ignored(coupled SLAC,%d)\n", CheckConnectorPlugIn());
+                break;
+            }
+
+			DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_START_ATTEN_CHAR_IND (counter : %d/3 ) ---\n", counter);
+			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]);
+
+			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_Status(CM_START_ATTEN_CHAR_IND);
+				counter++;
+				//[TC_SECC_VTB_AttenuationCharacterization_013]
+				if (MmePacket->MMENTRY[0] != 0) //APPLICATION_TYPE must be 0x00(EV-EVSE Matching)
+				{
+					DEBUG_INFO("[CM_START_ATTEN_CHAR_IND]APPLICATION_TYPE(%d): invalid => ignore Req\n", MmePacket->MMENTRY[0]);
+					break;
+				}
+
+				//[TC_SECC_VTB_AttenuationCharacterization_014]
+				if (MmePacket->MMENTRY[1] != 0) //SECURITY_TYPE must be 0x00(No Security)
+				{
+					DEBUG_INFO("[CM_START_ATTEN_CHAR_IND]SECURITY_TYPE(%d): invalid => ignore Req\n", MmePacket->MMENTRY[1]);
+					break;
+				}
+
+				//[TC_SECC_VTB_AttenuationCharacterization_017]
+				if (MmePacket->MMENTRY[4] != 0x01) //RESP_TYPE must be 0x01(Send to another GP STA(EV))
+				{
+					DEBUG_INFO("[CM_START_ATTEN_CHAR_IND]RESP_TYPE(%d): invalid => ignore Req\n", MmePacket->MMENTRY[4]);
+					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)
+				{
+					DEBUG_INFO("[CM_START_ATTEN_CHAR_IND]FORWARDING_STA(%02X:%02X:%02X:%02X:%02X:%02X): invalid => ignore Req\n",
+											MmePacket->MMENTRY[5], MmePacket->MMENTRY[6],
+											MmePacket->MMENTRY[7], MmePacket->MMENTRY[8],
+											MmePacket->MMENTRY[9], MmePacket->MMENTRY[10]);
+
+					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 (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(&timerStart.SeqStart);       //start TT_EVSE_match_MNBC
+					}
+					else if (SLAC_INFO.array[idx].StartAttenCharCnt >= 3)
+					{
+						DEBUG_INFO("[CM_START_ATTEN_CHAR_IND]counter(%d): unexpected \n", SLAC_INFO.array[idx].StartAttenCharCnt);
+					}
+					else
+					{
+						//null
+					}
+				}
+				else
+				{
+					//This RunID is not matched with this EvMac,
+					//or this RunID is not found in DB.
+					DEBUG_INFO("[CM_START_ATTEN_CHAR_IND]EvMac-RunID: unmatched => ignore Req\n");
+
+					//Response: ignore
+				}
+			}
+			else
+			{
+				//this msg source is not in database
+				//ignore
+			}
+			break;
+		}
+
+	    case MMTYPE_CM_MNBC_SOUND_IND:
+		{
+	        if(V2gFlowStatus >= CM_ATTEN_CHAR_IND)
+	        {
+                DEBUG_INFO("CM_MNBC_SOUND_IND: ignored(timeup)\n");
+                break;
+            }
+
+            //Avoid Coupled CM_MNBC_SOUND_IND
+            if (CheckConnectorPlugIn() == FALSE)  //12V(State 1)
+            {
+            	DEBUG_INFO("CM_MNBC_SOUND_IND: ignored(coupled SLAC,%d)\n", CheckConnectorPlugIn());
+                break;
+            }
+
+            if(V2gFlowStatus == CM_START_ATTEN_CHAR_IND)
+            {
+            	counter = 0;
+            }
+
+			DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_MNBC_SOUND_IND (counter : %d/%d) ---\n", counter, SLAC_INFO.array[idx].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]);
+
+			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_Status(CM_MNBC_SOUND_IND);
+				counter++;
+
+				//Check for RunID
+				if (SLAC_DB_Check_EvMac_RunID_Matching(&SLAC_INFO, EvMac_in, RunID_in) == TRUE)
+				{
+					SLAC_INFO.array[idx].MnbcSoundCnt++;
+				}
+				else
+				{
+					//RunID is not matched or does not exist.
+					DEBUG_INFO("CM_MNBC_SOUND_IND]EvMac-RunID: unmatched\n");
+				}
+			}
+			else
+			{
+				//ignore
+				DEBUG_INFO("CM_MNBC_SOUND_IND]EvMac does not exist\n");
+			}
+			break;
+		}
+
+	    case MMTYPE_CM_ATTEN_PROFILE_IND:
+		{
+	        if(V2gFlowStatus >= CM_ATTEN_CHAR_IND)
+	        {
+                DEBUG_INFO("CM_ATTEN_PROFILE_IND: ignore(timeup)\n");
+				break;
+			}
+
+			DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_CM_ATTEN_PROFILE_IND (counter : %d/%d) ---\n", counter, SLAC_INFO.array[idx].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]);
+
+			memset(tmpBuf, 0x00, ARRAY_SIZE(tmpBuf));
+			for(Rtn = 0; Rtn < MmePacket->MMENTRY[6]; Rtn++)
+			{
+				sprintf((char*)tmpBuf, "%s%02x,", tmpBuf, MmePacket->MMENTRY[8 + Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("AAG: %s\n", tmpBuf);
+
+			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);
+
+			if (idx >= 0)
+			{
+				SLAC_INFO.array[idx].AttenProfileCnt++;
+				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_Status(CM_MNBC_SOUND_IND);
+				break;
+			}
+			else
+			{
+				//The EvMac is not in the database
+				//ignore
+				DEBUG_INFO("[CM_ATTEN_PROFILE_IND]EvMac(%02X%02X%02X%02X%02X%02X): not exist => ignore\n", EvMac_in[0], EvMac_in[1], EvMac_in[2], EvMac_in[3], EvMac_in[4], EvMac_in[5]);
+				break;
+			}
+		}
+
+	    case MMTYPE_CM_ATTEN_CHAR_RSP:
+		{
+			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]);
+
+			memset(tmpBuf, 0x00, ARRAY_SIZE(tmpBuf));
+			for(Rtn = 0; Rtn < 17; Rtn++)
+			{
+				sprintf((char*)tmpBuf, "%s%02x,", tmpBuf, MmePacket->MMENTRY[16 + Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("SOURCE_ID: %s\n", tmpBuf);
+							;
+			memset(tmpBuf, 0x00, ARRAY_SIZE(tmpBuf));
+			for(Rtn = 0; Rtn < 17; Rtn++)
+			{
+				sprintf((char*)tmpBuf, "%s%02x,", tmpBuf, MmePacket->MMENTRY[33 + Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("RESP_ID: %s\n", tmpBuf);
+			DEBUG_PRINTF_EVCOMM_DETAIL("Result: 0x%x\n", MmePacket->MMENTRY[50]);    //Fixed value of 0x00 indicates a successful SLAC process
+
+			//Check ODA (Destination Address)
+			if (Array_Compare_Identity(macAddr.eth1, MmePacket->ODA, SLAC_EVSE_MAC_LENGTH) == FALSE)
+			{
+				DEBUG_INFO("[CM_ATTEN_CHAR_RSP]wrong ODA: ignore\n");
+				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++;
+
+				DEBUG_WARN("[SLAC][RX]CM_ATTEN_CHAR_RSP:invalid para(%d,%d,%d,%d,%d) => %d-th retry\n",
+							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
+							);
+
+				if (EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry <= 2)   //limited to 2 retries
+				{
+					Update_V2G_Status(CM_MNBC_SOUND_IND);
+					ftime(&timerStart.SeqStart);
+					break;
+				}
+				else
+				{
+					DEBUG_ERROR("[SLAC][RX]CM_ATTEN_CHAR_RSP:invalid para => 2-retry fail => End_Process\n");
+					Update_V2G_Status(Other_Fault);
+					break;
+				}
+			}
+			else
+			{
+				//The CM_ATTEN_CHAR_IND is legal
+				SLAC_INFO.array[idx].AttenCharRspCnt++;
+
+				DEBUG_INFO("[SLAC][RX]CM_ATTEN_CHAR_RSP[%d]:%d-th\n", (idx + 1), SLAC_INFO.array[idx].AttenCharRspCnt);
+
+				EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry = 0;
+				Update_V2G_Status(CM_ATTEN_CHAR_RSP);
+				ftime(&timerStart.SeqStart);
+				break;
+			}
+		}
+
+	    case MMTYPE_CM_VALIDATE_REQ:   //BCB Toggle
+		{
+			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��.
+
+			counter = 0;
+
+			EvMac_in = &MmePacket->OSA[0];
+			idx = SLAC_DB_Search_EvMac_idx(&SLAC_INFO, EvMac_in);
+
+			if (idx >= 0)
+			{
+				Update_V2G_Status(CM_VALIDATE_CNF);
+				SLAC_INFO.array[idx].ValidateReqCnt++;
+
+				DEBUG_INFO("[SLAC][RX]CM_VALIDATE_REQ[%d]:%d-th\n", (idx + 1), SLAC_INFO.array[idx].ValidateReqCnt);
+
+				//TODO:
+				//	1. Protection
+
+				memset(&qcaInfo.SendMmePacket, 0, sizeof(struct MmeHeader));
+				memcpy(qcaInfo.SendMmePacket.ODA, EvMac_in, SLAC_EVMAC_LENGTH);
+				memcpy(qcaInfo.SendMmePacket.OSA, macAddr.eth1, 6);
+				qcaInfo.SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+				qcaInfo.SendMmePacket.MMV = 0x01;
+				qcaInfo.SendMmePacket.MMTYPE = MMTYPE_CM_VALIDATE_CNF;
+				qcaInfo.SendMmePacket.FMI[0] = qcaInfo.SendMmePacket.FMI[1] = 0;
+				qcaInfo.SendMmePacketSize = 0;
+
+				if(counter == 0)
+				{
+					//The First MMTYPE_CM_VALIDATE_REQ because Unicast
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0;    //SignalType(0x00): Fixed value to indicate "EV S2 toggles on control pilot line"
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.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)
+						qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 1;    //0x01 = Ready
+					#else
+						qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 4;    //0x04 = Not Required
+					#endif
+				}
+				else
+				{
+					//The Second MMTYPE_CM_VALIDATE_REQ because Broadcast
+					unsigned char PreStatus = 3;
+					unsigned char ToggleNum = 0;
+					ftime(&timerStart.SeqStart);
+					while(1)
+					{
+						if((EVCOMM_SYS_INFO.CpState == 4) && (PreStatus == 3))
+						{
+							ToggleNum++;
+							PreStatus = 4;
+						}
+						else
+						{
+							PreStatus = 3;
+						}
+
+						ftime(&timerStart.SeqEnd);
+						if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) >= (qcaInfo.SendMmePacket.MMENTRY[1]*100 + 100))
+						{
+							qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0;    //Fixed value to indicate "PEV S2 toggles on control pilot line"
+							qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = ToggleNum;
+
+							#if (SUPPORT_BCB_TOGGLE_FUNCTION == ENABLE)
+							qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 2;    //0x02 = Success
+							#else
+								qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 4;    //0x04 = Not Required
+							#endif
+
+							break;
+						}
+						usleep(1000);
+					}
+				}
+				qcaInfo.SendMmePacketSize += 19;      //the size before MMENTRY
+				Rtn = sendto(socketFd.Raw, &qcaInfo.SendMmePacket, qcaInfo.SendMmePacketSize, 0, (struct sockaddr*)&qcaInfo.DestSocketAddress, sizeof(struct sockaddr_ll));
+				ftime(&timerStart.SeqStart);
+			}
+			else
+			{
+				//EvMac does not exist.
+				//ignore
+			}
+			break;
+		}
+
+	    case MMTYPE_CM_SLAC_MATCH_REQ:
+		{
+			char buf[512];
+			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
+			memset(buf, 0x00, ARRAY_SIZE(buf));
+			for(Rtn=0; Rtn<17; Rtn++)
+			{
+				sprintf(buf, "%s%02x ", buf, MmePacket->MMENTRY[4+Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("PEV ID: %s\n", buf);
+
+			memset(buf, 0x00, ARRAY_SIZE(buf));
+			for(Rtn=0; Rtn<6; Rtn++)
+			{
+				sprintf(buf, "%s%02x ", buf, MmePacket->MMENTRY[21+Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("PEV MAC: %s\n", buf);
+
+			memset(buf, 0x00, ARRAY_SIZE(buf));
+			for(Rtn=0; Rtn<17; Rtn++)
+			{
+				sprintf(buf, "%s%02x ", buf, MmePacket->MMENTRY[27+Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("EVSE ID: %d\n", buf);
+
+			memset(buf, 0x00, ARRAY_SIZE(buf));
+			for(Rtn=0; Rtn<6; Rtn++)
+			{
+				sprintf(buf, "%s%02x ", buf, MmePacket->MMENTRY[44+Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("EVSE MAC: %s\n", buf);
+
+			memset(buf, 0x00, ARRAY_SIZE(buf));
+			for(Rtn=0; Rtn<8; Rtn++)
+			{
+				sprintf(buf, "%s%02x ", buf, MmePacket->MMENTRY[50+Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %s\n", buf);
+
+			memset(buf, 0x00, ARRAY_SIZE(buf));
+			for(Rtn=0; Rtn<8; Rtn++)
+			{
+				sprintf(buf, "%s%02x ", buf, MmePacket->MMENTRY[58+Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("RSVD: %s\n", buf);
+
+
+			//Check ODA (Destination Address)
+			if (Array_Compare_Identity(macAddr.eth1, MmePacket->ODA, SLAC_EVSE_MAC_LENGTH) == FALSE)
+			{
+				DEBUG_WARN("[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_Status(CM_SLAC_MATCH_REQ);
+
+				SLAC_INFO.array[idx].MatchReqNum++;
+
+				DEBUG_INFO("CM_SLAC_MATCH_REQ[%d]:%d-th\n", (idx + 1), SLAC_INFO.array[idx].MatchReqNum);
+
+				//[TC_SECC_VTB_CmSlacMatch_007] APPLICATION_TYPE must be 0x00(EV-EVSE Matching)
+				//[TC_SECC_VTB_CmSlacMatch_008]
+				if (MmePacket->MMENTRY[0] != 0)
+				{
+					DEBUG_WARN("CM_SLAC_MATCH_REQ[%d]:wrong APPLICATION_TYPE(%d)\n", (idx + 1), MmePacket->MMENTRY[0]);
+					break;
+				}
+
+				//[TC_SECC_VTB_CmSlacMatch_009] SECURITY_TYPE must be 0x00(No Security)
+				//[TC_SECC_VTB_CmSlacMatch_010]
+				if (MmePacket->MMENTRY[1] != 0)
+				{
+					DEBUG_WARN("CM_SLAC_MATCH_REQ[%d]:wrong SECURITY_TYPE(%d)\n", (idx + 1), MmePacket->MMENTRY[1]);
+					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)
+				{
+					DEBUG_WARN("CM_SLAC_MATCH_REQ[%d]:wrong MVFLength(%d,%d)\n", (idx + 1), MmePacket->MMENTRY[2], MmePacket->MMENTRY[3]);
+					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)
+				{
+					DEBUG_WARN("CM_SLAC_MATCH_REQ[%d]: wrong EV ID\n", (idx + 1));
+					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)
+				{
+					DEBUG_WARN("CM_SLAC_MATCH_REQ[%d]: wrong EV MAC(%02X:%02X:%02X:%02X:%02X:%02X)\n",
+											(idx + 1),
+											MmePacket->MMENTRY[21], MmePacket->MMENTRY[22], MmePacket->MMENTRY[23],
+											MmePacket->MMENTRY[24], MmePacket->MMENTRY[25], MmePacket->MMENTRY[26]);
+					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)
+				{
+					DEBUG_WARN("CM_SLAC_MATCH_REQ[%d]: wrong EVSE ID\n", (idx + 1));
+					break;
+				}
+
+				//[TC_SECC_VTB_CmSlacMatch_019] EVSE MAC
+				//[TC_SECC_VTB_CmSlacMatch_020]
+				if (Array_Compare_Identity(macAddr.eth1, &MmePacket->MMENTRY[44], SLAC_EVSE_MAC_LENGTH) == FALSE)
+				{
+					DEBUG_WARN("CM_SLAC_MATCH_REQ[%d]: wrong EVSE MAC(%02X:%02X:%02X:%02X:%02X:%02X)\n",
+											(idx + 1),
+											MmePacket->MMENTRY[44], MmePacket->MMENTRY[45], MmePacket->MMENTRY[46],
+											MmePacket->MMENTRY[47], MmePacket->MMENTRY[48], MmePacket->MMENTRY[49]);
+					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(&qcaInfo.SendMmePacket, 0, sizeof(struct MmeHeader));
+					memcpy(qcaInfo.SendMmePacket.ODA, MmePacket->OSA, 6);
+					memcpy(qcaInfo.SendMmePacket.OSA, macAddr.eth1, 6);
+					qcaInfo.SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+					qcaInfo.SendMmePacket.MMV = MmePacket->MMV;
+					qcaInfo.SendMmePacket.MMTYPE = MMTYPE_CM_SLAC_MATCH_CNF;
+					qcaInfo.SendMmePacket.FMI[0] = qcaInfo.SendMmePacket.FMI[1] = 0;
+					qcaInfo.SendMmePacketSize = 0;
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0x00;    //APPLICATION_TYPE: Fixed value (0x00: EV-EVSE matching)
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0x00;    //SECURITY_TYPE: Fixed value (0x00: No Security)
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0x56;    //MVFLength: MatchVarField Length (Fixed value: 0x0056)
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0x00;    //MVFLength: MatchVarField Length (Fixed value: 0x0056)
+					memset(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, 0, 17);         //EV ID
+					qcaInfo.SendMmePacketSize += 17;
+					memcpy(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, EvMac_in, SLAC_EVMAC_LENGTH); //EV MAC
+					qcaInfo.SendMmePacketSize += 6;
+					memset(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, 0, 17);         //EVSE ID
+					qcaInfo.SendMmePacketSize += 17;
+					memcpy(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, macAddr.eth1, 6);     //EVSE MAC
+					qcaInfo.SendMmePacketSize += 6;
+					memcpy(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, RunID_in, SLAC_RUNID_LENGTH);
+					qcaInfo.SendMmePacketSize += SLAC_RUNID_LENGTH;
+					memset(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, 0, 8);    //RSVD
+					qcaInfo.SendMmePacketSize += 8;
+					memcpy(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, qcaInfo.Nid, sizeof(qcaInfo.Nid));   //NID: Network ID given by the CCo(EVSE)
+					qcaInfo.SendMmePacketSize += sizeof(qcaInfo.Nid);                                      //NID caculated from the random NMK that will be set.
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0x00;          //RSVD
+					memcpy(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, qcaInfo.NewNmkKey, sizeof(qcaInfo.NewNmkKey)); //NMK: Random value
+					qcaInfo.SendMmePacketSize += sizeof(qcaInfo.NewNmkKey);                                          //NMK: Private NMK of the EVSE (random value)
+					qcaInfo.SendMmePacketSize += 19;      //the size before MMENTRY
+
+					DEBUG_PRINTF_EVCOMM_DETAIL("***** Response MME Packet *****\n");
+					DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.ODA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+												qcaInfo.SendMmePacket.ODA[0],qcaInfo.SendMmePacket.ODA[1],qcaInfo.SendMmePacket.ODA[2],qcaInfo.SendMmePacket.ODA[3],qcaInfo.SendMmePacket.ODA[4],qcaInfo.SendMmePacket.ODA[5]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.OSA: %02x:%02x:%02x:%02x:%02x:%02x:\n",
+												qcaInfo.SendMmePacket.OSA[0],qcaInfo.SendMmePacket.OSA[1],qcaInfo.SendMmePacket.OSA[2],qcaInfo.SendMmePacket.OSA[3],qcaInfo.SendMmePacket.OSA[4],qcaInfo.SendMmePacket.OSA[5]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("MTYPE: 0x%x\n", htons(qcaInfo.SendMmePacket.MTYPE));
+					DEBUG_PRINTF_EVCOMM_DETAIL("MMV: 0x%x\n", qcaInfo.SendMmePacket.MMV);
+					DEBUG_PRINTF_EVCOMM_DETAIL("MMTYPE: 0x%x\n", qcaInfo.SendMmePacket.MMTYPE);
+					DEBUG_PRINTF_EVCOMM_DETAIL("FMI 0x%x, 0x%x\n", qcaInfo.SendMmePacket.FMI[0],qcaInfo.SendMmePacket.FMI[1]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("--- CM_SLAC_MATCH_CNF ---\n");
+					DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[0]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[1]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("MVFLength: 0x%x, 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[2],qcaInfo.SendMmePacket.MMENTRY[3]);
+
+					memset(buf, 0x00, ARRAY_SIZE(buf));
+					for(Rtn=0; Rtn<17; Rtn++)
+					{
+						sprintf(buf, "%s%02x ", buf, qcaInfo.SendMmePacket.MMENTRY[4+Rtn]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("PEV ID: %d\n", buf);
+
+					memset(buf, 0x00, ARRAY_SIZE(buf));
+					for(Rtn=0; Rtn<6; Rtn++)
+					{
+						sprintf(buf, "%s%02x ", buf, qcaInfo.SendMmePacket.MMENTRY[21+Rtn]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("PEV MAC: %s\n", buf);
+
+					memset(buf, 0x00, ARRAY_SIZE(buf));
+					for(Rtn=0; Rtn<17; Rtn++)
+					{
+						sprintf(buf, "%s%02x ", buf, qcaInfo.SendMmePacket.MMENTRY[27+Rtn]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("EVSE ID: %s\n", buf);
+
+					memset(buf, 0x00, ARRAY_SIZE(buf));
+					for(Rtn=0; Rtn<6; Rtn++)
+					{
+						sprintf(buf, "%s%02x ", buf, qcaInfo.SendMmePacket.MMENTRY[44+Rtn]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("EVSE MAC: %s\n", buf);
+
+					memset(buf, 0x00, ARRAY_SIZE(buf));
+					for(Rtn=0; Rtn<8; Rtn++)
+					{
+						sprintf(buf, "%s%02x ", buf, qcaInfo.SendMmePacket.MMENTRY[50+Rtn]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %s\n", buf);
+
+					memset(buf, 0x00, ARRAY_SIZE(buf));
+					for(Rtn=0; Rtn<8; Rtn++)
+					{
+						sprintf(buf, "%s%02x ", buf, qcaInfo.SendMmePacket.MMENTRY[58+Rtn]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("RSVD: %s\n", buf);
+
+					memset(buf, 0x00, ARRAY_SIZE(buf));
+					for(Rtn=0; Rtn<7; Rtn++)
+					{
+						sprintf(buf, "%s%02x ", buf, qcaInfo.SendMmePacket.MMENTRY[66+Rtn]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("NID: %s\n", buf);
+
+					DEBUG_PRINTF_EVCOMM_DETAIL("RSVD: 0x%02x\n", qcaInfo.SendMmePacket.MMENTRY[73]);
+
+					memset(buf, 0x00, ARRAY_SIZE(buf));
+					for(Rtn=0; Rtn<16; Rtn++)
+					{
+						sprintf(buf, "%s%02x ", buf, qcaInfo.SendMmePacket.MMENTRY[74+Rtn]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("NMK: \n");
+
+					Update_V2G_Status(CM_SLAC_MATCH_CNF);
+					Rtn = sendto(socketFd.Raw, &qcaInfo.SendMmePacket, qcaInfo.SendMmePacketSize, 0, (struct sockaddr*)&qcaInfo.DestSocketAddress, sizeof(struct sockaddr_ll));
+					DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacketSize=%d,Rtn=%d\n", qcaInfo.SendMmePacketSize,Rtn);
+					DEBUG_INFO( "CM_SLAC_MATCH_CNF[%d]\n", (idx + 1));
+
+					ftime(&timerStart.SeqStart);
+				}
+				else
+				{
+					//RunID does not match and it's not the first SLAC request
+					//Reset the SLAC database to embrace SLAC retry
+					DEBUG_INFO("[CM_SLAC_MATCH_REQ]No Real MATCH_REQ\n");
+					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:
+		{
+			// Only Set key for local QCA7000
+			if((MmePacket->OSA[0] == MmePacket->MMENTRY[12]) &&
+			   (MmePacket->OSA[1] == MmePacket->MMENTRY[13]) &&
+			   (MmePacket->OSA[2] == MmePacket->MMENTRY[14]) &&
+			   (MmePacket->OSA[3] == MmePacket->MMENTRY[15]) &&
+			   (MmePacket->OSA[4] == MmePacket->MMENTRY[16]) &&
+			   (MmePacket->OSA[5] == MmePacket->MMENTRY[17]))
+			{
+				memcpy(macAddr.qca, MmePacket->OSA, 6);
+
+				DEBUG_PRINTF_EVCOMM_DETAIL("--- MMTYPE_VENDOR_VS_NW_INFO_CNF ---\n");
+				DEBUG_INFO("EVSE MAC address(QCA): %02X:%02X:%02X:%02X:%02X:%02X(comm:OK)\n",
+							macAddr.qca[0],  macAddr.qca[1],  macAddr.qca[2],  macAddr.qca[3],  macAddr.qca[4],  macAddr.qca[5]);
+
+				Update_V2G_Status(CM_SET_KEY_REQ);
+				ftime(&timerStart.SeqStart);
+			}
+
+            break;
+		}
+
+	    case MMTYPE_VENDOR_VS_PL_LNK_STATUS_CNF:
+		{
+			struct QcaVendorMmeHeader *RecvPacket;
+			RecvPacket = (struct QcaVendorMmeHeader *)Buffer;
+
+			if(RecvPacket->MBODY[1]==0)
+			{
+				//PLC disconnected
+				DEBUG_INFO("[MMTYPE_VENDOR_VS_PL_LNK_STATUS_CNF]Got PLC Link Status:%d\n", RecvPacket->MBODY[1]);
+				Update_V2G_Status(Other_Fault);
+			}
+			else
+				Update_V2G_Status(CM_SET_KEY_REQ);
+
+			ftime(&timerStart.SeqStart);
+			break;
+		}
+
+	    default:
+		{
+	        break;
+		}
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @return
+ */
+int SlacComm()
+{
+    static unsigned char qca7k_comm_retry = 0;
+    double t_diff = 0;
+    int packet_size = 0;
+    int count = 0;
+    unsigned char tmpBuf[2048]={0};
+    unsigned char *EvMac_in;
+    unsigned char *RunID_in;
+    int i = 0;
+
+    if(socketFd.Raw >= 0)
+    {
+        memset(v2gBuffer.rx, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+        packet_size = recvfrom(socketFd.Raw, v2gBuffer.rx, V2GTP_MSG_RX_BUFFER_SIZE, 0, NULL, NULL);
+        if(packet_size > 0)
+        {
+            MmeProcess(v2gBuffer.rx, packet_size);
+        }
+    }
+
+    switch(Get_V2G_Status())
+    {
+	    case IDLE:
+		{
+	        if(socketFd.Raw < 0)
+	        {
+	        	socketFd.Raw = socket(PF_PACKET, SOCK_RAW, htons(EtherType_HomePlug));
+                DEBUG_INFO("[RawSock]opened(%d)\n", socketFd.Raw);
+
+	            if(socketFd.Raw == -1)
+	            {
+	                DEBUG_ERROR("SlacComm:Failed to create socket\n");
+	                Update_V2G_Status(Other_Fault);
+	                return -1;
+	            }
+
+	            if (setsockopt(socketFd.Raw, SOL_SOCKET, SO_BINDTODEVICE, QcaInterface, 4) < 0)
+	            {
+                    DEBUG_ERROR("SlacComm:Set SO_BINDTODEVICE NG\n");
+                    Update_V2G_Status(Other_Fault);
+                    return -1;
+                }
+
+                struct timeval tv;
+	            tv.tv_sec = 0;
+		        tv.tv_usec = 100000;  //100ms (Rx timeout)
+	            if (setsockopt(socketFd.Raw, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct	timeval)) < 0)
+	            {
+	                DEBUG_ERROR("SlacComm:Set SO_RCVTIMEO NG\n");
+	                Update_V2G_Status(Other_Fault);
+	                return -1;
+	            }
+
+                tv.tv_usec = 100000;  //100ms (Tx timeout)
+                if (setsockopt(socketFd.Raw, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct	timeval)) < 0)
+	            {
+	                DEBUG_ERROR("SlacComm:Set SO_SNDTIMEO NG\n");
+	                Update_V2G_Status(Other_Fault);
+	                return -1;
+	            }
+
+	            memset(&qcaInfo.Req, 0, sizeof(struct ifreq));
+	            strcpy( (char*)qcaInfo.Req.ifr_name, QcaInterface);
+
+	            if (ioctl(socketFd.Raw, SIOCGIFINDEX, &qcaInfo.Req) < 0)
+	            {
+	                DEBUG_ERROR("SlacComm: ioctl NG\n");
+	                Update_V2G_Status(Other_Fault);
+	                return -1;
+	            }
+
+	            memset(&qcaInfo.DestSocketAddress, 0, sizeof(struct sockaddr_ll));
+	            qcaInfo.DestSocketAddress.sll_ifindex = qcaInfo.Req.ifr_ifindex;
+	            qcaInfo.DestSocketAddress.sll_halen = ETH_ALEN;
+
+	            timerStart.PwmStart = 0;
+
+                EVCOMM_SYS_INFO.QCA7K_SetKeyDone = FALSE;
+                DEBUG_INFO("QCA7000 connecting...\n");
+                //Get QCA7K MAC address
+                GetQca7kMac();
+                ftime(&timerStart.SeqStart);
+                break;
+	        }
+	        else   //RawSock: opened
+	        {
+                if(EVCOMM_SYS_INFO.QCA7K_SetKeyDone == FALSE)
+                {
+                    ftime(&timerStart.SeqEnd);
+                    t_diff = DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd);
+
+                    if (t_diff > V2G_SECC_QCA7000_GET_MAC_ADDR_REQ_RETRY_PERIOD)   //3 secs
+                    {
+                        qca7k_comm_retry++;
+                        DEBUG_INFO("Re-try connecting...(%.02lf/%dms)\n", t_diff, V2G_SECC_QCA7000_GET_MAC_ADDR_REQ_RETRY_PERIOD);
+
+                        GetQca7kMac(); //re-send req
+                        ftime(&timerStart.SeqStart);
+                        break;
+                    }
+                    else
+                    {}
+
+                    //Retry by 3 times
+                    if (qca7k_comm_retry >= 3)
+                    {
+                    	DEBUG_ERROR("Comm: fail (retry by %d times)\n", qca7k_comm_retry);
+
+                        //Update_ShmStatusCode(); //[To-Do] to be implemented
+                        //CCS_SECCC_TIMEOUT_QCA7000_COMM (023892): The firmware code of QCA7000 may not be installed, yet
+                        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                        ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                        ShmStatusCodeData->PresentStatusCode[0][4] = 9;
+                        ShmStatusCodeData->PresentStatusCode[0][5] = 2;
+                        CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+                        Proc_EVStopRes(ShmInternalComm->FD_CAN_Socket);
+
+                        Update_V2G_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(timerStart.PwmStart <= 0)
+                        {
+                            //Sniffer_Tcpdump(ENABLE);
+                            //#if (TCPDUMP_PACKETS_SNIFFER_SWITCH == ENABLE)
+                            //sleep(1);   //wait for tcpdump to be ready.
+                            //#endif
+                            SwitchCpStateE(DISABLE);
+                            OutputCpPwmDuty(5);
+                            timerStart.PwmStart = time(NULL);
+#ifdef TEST_WITH_ETH0
+                            Update_V2G_Status(SLACC_SDP_UDP_Connection);
+#endif
+                        }
+                        else
+                        {
+                            if((time(NULL) - timerStart.PwmStart) > TT_EVSE_SLAC_init)
+                            {
+                            	DEBUG_ERROR("SlacComm: Wait CM_SLAC_PARM_REQ Timeout - TT_EVSE_SLAC_init, NowTime(%ld)-timerStart.PwmStart(%d)>%d (sec)\n", time(NULL), timerStart.PwmStart, TT_EVSE_SLAC_init);
+
+                                //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_Status(Sequence_Timeout);
+                                timerStart.PwmStart = 0;
+                                return -1;
+                            }
+                            else
+                            {
+                                //waiting for CM_SLAC_PARM_REQ
+                            }
+                        }
+                    }
+                    else
+                    {
+                        timerStart.PwmStart = 0;
+                    }
+                }
+	        }
+	        break;
+		}
+
+	    case CM_SET_KEY_REQ:   //13
+		{
+	        //CM_SET_KEY_REQ
+            //DEBUG_INFO("QCA7000 [RX]CM_SET_KEY_REQ\n");
+            ftime(&timerStart.SeqEnd);
+            t_diff = DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd);
+            if (t_diff > V2G_SECC_QCA7000_COMM_TIMEOUT)   //10 seconds
+            {
+            	DEBUG_ERROR("QCA7000 Failed on SetKey => End_Process (%.02lf/%dms)\n", t_diff, V2G_SECC_QCA7000_COMM_TIMEOUT);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECCC_TIMEOUT_QCA7000_COMM (023892): The firmware code of QCA7000 may not be installed, yet
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 9;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 2;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+                Update_V2G_Status(Sequence_Timeout);
+            }
+            else if (t_diff > V2G_SECC_QCA7000_SEND_SET_KEY_PERIOD)  //2 seconds
+            {
+                DEBUG_INFO("QCA7000 SetKey: proceed (%.02lf/%dms)\n", t_diff, V2G_SECC_QCA7000_SEND_SET_KEY_PERIOD);
+
+                SendSetKey();
+                ftime(&timerStart.SeqStart);
+            }
+            else
+            {
+                //null
+            }
+	        break;
+		}
+
+	    case CM_SET_KEY_CNF:   //14
+		{
+            DEBUG_INFO("Wait: plugin(%d), matached(%d), permission(%d)...\n", CheckConnectorPlugIn(), CSUCOMMDC_TASK_FLAG.matched, ShmInternalComm->ChargingPermission);
+
+            EVCOMM_SYS_INFO.QCA7K_SetKeyDone = TRUE;
+            timerStart.PwmStart = 0;
+            Update_V2G_Status(IDLE);
+	        break;
+		}
+
+	    case CM_SLAC_PARM_CONF:
+		{
+	        ftime(&timerStart.SeqEnd);
+	        if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > TT_match_sequence)
+	        {
+	        	DEBUG_ERROR("SlacComm: Wait CM_START_ATTEN_CHAR_IND Timeout - TT_match_sequence (%.02lf of %dms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), TT_match_sequence);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_CM_START_ATTEN_CHAR_IND (023811):
+                //[Possible Reason] CCS Board image might not be updated properly. The 2nd reboot process is not finished.
+                //[Verification Method] By tying reboot command to the terminal and see if it could be executed immediately.
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 1;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+	            Update_V2G_Status(Sequence_Timeout);
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_START_ATTEN_CHAR_IND:
+		{
+	        ftime(&timerStart.SeqEnd);
+	        if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > (TP_EV_batch_msg_interval))    //one more time interval for tolerance
+	        {
+	        	DEBUG_ERROR("SlacComm: Wait CM_MNBC_SOUND_IND Timeout - TP_EV_batch_msg_interval (%.02lf of %dms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), TP_EV_batch_msg_interval);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_SLAC_CM_MNBC_SOUND_IND (023818):
+                //[Possible Reason] CCS Board image might not be updated properly. The 2nd reboot process is not finished.
+                //[Verification Method] By tying reboot command to the terminal and see if it could be executed immediately.
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+	            Update_V2G_Status(Sequence_Timeout);
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_MNBC_SOUND_IND:
+		{
+			ftime(&timerStart.SeqEnd);
+			t_diff = DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd);
+			//printf("time:%.02lf, profilNum:%d\n",DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd),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)
+				{
+					DEBUG_WARN("[SLAC][TX]CM_ATTEN_CHAR_IND[%d]: timeup(%.2f/%dms) => send\n", (i + 1), t_diff, TT_EVSE_match_MNBC);
+				}
+
+				//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)
+						DEBUG_WARN("[SLAC][TX]CM_ATTEN_CHAR_IND[%d]: para err(%d,%d,%d,%d,%d) => canceled\n",
+								(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);
+						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))
+					{
+						DEBUG_INFO("[SLAC][TX]CM_ATTEN_CHAR_IND[%d]: canceled\n", (i + 1));
+						break;
+					}
+
+					EvMac_in = SLAC_INFO.array[i].EvMac;
+					RunID_in = SLAC_INFO.array[i].RunID;
+
+					memset(&qcaInfo.SendMmePacket, 0, sizeof(struct MmeHeader));
+					memcpy(qcaInfo.SendMmePacket.ODA, EvMac_in, SLAC_EVMAC_LENGTH);
+					memcpy(qcaInfo.SendMmePacket.OSA, macAddr.eth1, 6);
+					qcaInfo.SendMmePacket.MTYPE = htons(EtherType_HomePlug);
+					qcaInfo.SendMmePacket.MMV = 0x01;
+					qcaInfo.SendMmePacket.MMTYPE = MMTYPE_CM_ATTEN_CHAR_IND;
+					qcaInfo.SendMmePacket.FMI[0] = qcaInfo.SendMmePacket.FMI[1] = 0;
+					qcaInfo.SendMmePacketSize = 0;
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0;    //APPLICATION_TYPE(0x00: EV-EVSE Matching)
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = 0;    //SECURITY_TYPE(0x00: No Security)
+					memcpy(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, EvMac_in, SLAC_EVMAC_LENGTH); //SOURCE_ADDRESS, MAC address of the EV Host
+					qcaInfo.SendMmePacketSize += SLAC_EVMAC_LENGTH;
+					memcpy(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, RunID_in, SLAC_RUNID_LENGTH);
+					qcaInfo.SendMmePacketSize += SLAC_RUNID_LENGTH;
+					memset(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, 0, 17); //SOURCE_ID(0x00)
+					qcaInfo.SendMmePacketSize += 17;
+					memset(qcaInfo.SendMmePacket.MMENTRY + qcaInfo.SendMmePacketSize, 0, 17); //RESP_ID(0x00)
+					qcaInfo.SendMmePacketSize += 17;
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = SLAC_INFO.array[i].AttenProfileCnt; //NumSounds: Number of M-Sounds used for generation of the ATTEN_PROFILE
+					qcaInfo.SendMmePacket.MMENTRY[qcaInfo.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
+						qcaInfo.SendMmePacket.MMENTRY[qcaInfo.SendMmePacketSize++] = TmpAag;
+						SLAC_INFO.array[i].AAG_quality_refined += (float) TmpAag;   //refined signal quality
+					}
+					qcaInfo.SendMmePacketSize += 19;      //the size before MMENTRY
+
+
+					DEBUG_PRINTF_EVCOMM_DETAIL("***** Send MME Packet *****\n");
+					DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.ODA: %02x:%02x:%02x:%02x:%02x:%02x:\n", qcaInfo.SendMmePacket.ODA[0],qcaInfo.SendMmePacket.ODA[1],qcaInfo.SendMmePacket.ODA[2],qcaInfo.SendMmePacket.ODA[3],qcaInfo.SendMmePacket.ODA[4],qcaInfo.SendMmePacket.ODA[5]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacket.OSA: %02x:%02x:%02x:%02x:%02x:%02x:\n", qcaInfo.SendMmePacket.OSA[0],qcaInfo.SendMmePacket.OSA[1],qcaInfo.SendMmePacket.OSA[2],qcaInfo.SendMmePacket.OSA[3],qcaInfo.SendMmePacket.OSA[4],qcaInfo.SendMmePacket.OSA[5]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("MTYPE: 0x%x\n", htons(qcaInfo.SendMmePacket.MTYPE));
+					DEBUG_PRINTF_EVCOMM_DETAIL("MMV: 0x%x\n", qcaInfo.SendMmePacket.MMV);
+					DEBUG_PRINTF_EVCOMM_DETAIL("MMTYPE: 0x%x\n", qcaInfo.SendMmePacket.MMTYPE);
+					DEBUG_PRINTF_EVCOMM_DETAIL("FMI 0x%x, 0x%x\n", qcaInfo.SendMmePacket.FMI[0],qcaInfo.SendMmePacket.FMI[1]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("--- CM_ATTEN_CHAR_IND ---\n");
+					DEBUG_PRINTF_EVCOMM_DETAIL("APPLICATION_TYPE: 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[0]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("SECURITY_TYPE: 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[1]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("SOURCE_ADDRESS: %02x:%02x:%02x:%02x:%02x:%02x\n", qcaInfo.SendMmePacket.MMENTRY[2],qcaInfo.SendMmePacket.MMENTRY[3],qcaInfo.SendMmePacket.MMENTRY[4],qcaInfo.SendMmePacket.MMENTRY[5],qcaInfo.SendMmePacket.MMENTRY[6],qcaInfo.SendMmePacket.MMENTRY[7]);
+					DEBUG_PRINTF_EVCOMM_DETAIL("RunID: %02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n", qcaInfo.SendMmePacket.MMENTRY[8],qcaInfo.SendMmePacket.MMENTRY[9],qcaInfo.SendMmePacket.MMENTRY[10],qcaInfo.SendMmePacket.MMENTRY[11],qcaInfo.SendMmePacket.MMENTRY[12],qcaInfo.SendMmePacket.MMENTRY[13],qcaInfo.SendMmePacket.MMENTRY[14],qcaInfo.SendMmePacket.MMENTRY[15]);
+
+					memset(tmpBuf, 0x00, ARRAY_SIZE(tmpBuf));
+					for(count=0; count<17; count++)
+					{
+						sprintf((char*)tmpBuf, "%s%02x,", tmpBuf, qcaInfo.SendMmePacket.MMENTRY[16+count]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("SOURCE_ID: %s\n", tmpBuf);
+
+					memset(tmpBuf, 0x00, ARRAY_SIZE(tmpBuf));
+					for(count=0; count<17; count++)
+					{
+						sprintf((char*)tmpBuf, "%s%02x,", tmpBuf, qcaInfo.SendMmePacket.MMENTRY[33+count]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("RESP_ID: %s\n", tmpBuf);
+
+					DEBUG_PRINTF_EVCOMM_DETAIL("NumSounds: 0x%x\n", qcaInfo.SendMmePacket.MMENTRY[50]);
+
+					memset(tmpBuf, 0x00, ARRAY_SIZE(tmpBuf));
+					for(count=0; count<qcaInfo.AagGroupsNum; count++)
+					{
+						sprintf((char*)tmpBuf, "%s%02x,", tmpBuf, qcaInfo.SendMmePacket.MMENTRY[51+count]);
+					}
+					DEBUG_PRINTF_EVCOMM_DETAIL("ATTEN_PROFILE: %s\n", tmpBuf);
+
+					count = sendto(socketFd.Raw, &qcaInfo.SendMmePacket, qcaInfo.SendMmePacketSize, 0, (struct sockaddr*)&qcaInfo.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)
+					{
+						DEBUG_INFO("[SLAC][TX]CM_ATTEN_CHAR_IND[%d]: %d-th resend (Q=%.2f/%.2f)(%d/%d)\n",
+																														(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);
+					}
+					else if (EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry == 0)
+					{
+						DEBUG_INFO("[SLAC][TX]CM_ATTEN_CHAR_IND[%d]: Q=%.2f/%.2f(%d/%d)\n",
+																										(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);
+					}
+					else
+					{
+						DEBUG_INFO("[SLAC][TX]CM_ATTEN_CHAR_IND[%d]: unexpected CM_ATTEN_CHAR_IND_retry(%d))\n", i, EVCOMM_SYS_INFO.CM_ATTEN_CHAR_IND_retry);
+					}
+
+					DEBUG_PRINTF_EVCOMM_DETAIL("SendMmePacketSize=%d,Rtn=%d\n", qcaInfo.SendMmePacketSize, count);
+				} //end of for loop
+
+				Update_V2G_Status(CM_ATTEN_CHAR_IND);
+				ftime(&timerStart.SeqStart);
+			}
+			break;
+		}
+
+	    case CM_ATTEN_CHAR_IND:
+		{
+	        ftime(&timerStart.SeqEnd);
+	        //if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd)>TT_match_response)
+	        if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > TT_match_response)     //extended to 400ms due to the response of CM_ATTEN_CHAR.RSP of some EVCC is slower than 200ms.
+	        {
+	        	DEBUG_ERROR("SlacComm: Wait CM_ATTEN_CHAR_RSP Timeout - TT_match_response (%.02lf of %dms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), TT_match_response);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_SLAC_CM_ATTEN_CHAR_RSP (023814):
+                //[Possible Reason] Frequent on BMW i3, need to drive the EV a bit.
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 4;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+	            Update_V2G_Status(Sequence_Timeout);
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_ATTEN_CHAR_RSP:
+		{
+	        ftime(&timerStart.SeqEnd);
+	        if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > TT_EVSE_match_session)
+	        {
+	        	DEBUG_ERROR("SlacComm: Wait CM_VALIDATE_REQ_1ST or CM_SLAC_MATCH_REQ Timeout - TT_EVSE_match_session (%.02lf of %dms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), TT_EVSE_match_session);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_SLAC_CM_VALIDATE_REQ_1ST__CM_SLAC_MATCH_REQ (023815):
+                //[Possible Reason] Frequent on BMW i3, need to drive the EV a bit.
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 5;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+	            Update_V2G_Status(Sequence_Timeout);
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_VALIDATE_CNF:
+		{
+	        ftime(&timerStart.SeqEnd);
+	        if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > TT_match_sequence)
+	        {
+	        	DEBUG_ERROR("SlacComm: Wait CM_VALIDATE_REQ_2ND or CM_SLAC_MATCH_REQ Timeout - TT_match_sequence (%.02lf of %dms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), TT_match_sequence);
+
+                //Update_ShmStatusCode(); //[To-Do] to be implemented
+                //CCS_SECC_TIMEOUT_SLAC_CM_VALIDATE_REQ_2ND__CM_SLAC_MATCH_REQ (023819):
+                //[Possible Reason] Frequent on BMW i3, need to drive the EV a bit.
+                ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                ShmStatusCodeData->PresentStatusCode[0][4] = 1;
+                ShmStatusCodeData->PresentStatusCode[0][5] = 9;
+                CSUCOMMDC_TASK_FLAG.EV_Stop_Type_Emergency = FALSE;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+
+	            Update_V2G_Status(Sequence_Timeout);
+	            return -1;
+	        }
+	        break;
+		}
+
+	    case CM_SLAC_MATCH_CNF:
+		{
+	        if(socketFd.Udp > 0)
+	        {
+	            close(socketFd.Udp);
+	            socketFd.Udp = -1;
+	        }
+	        if(socketFd.Tcp > 0)
+	        {
+	            close(socketFd.Tcp);
+	            socketFd.Tcp = -1;
+	        }
+	        ftime(&timerStart.SeqStart);
+            V2gTcpConnected();
+            Update_V2G_Status(SLACC_SDP_UDP_Connection);
+            DEBUG_INFO("SLAAC, SDP, UDP: connecting...\n");
+	        break;
+		}
+
+		default:
+		{
+		    break;
+		}
+    }
+    return 0;
+}
+
+/**
+*	1. Decode the V2GTP messages inside "msg" and save the decoded
+   	   messages in v2gObject.DIN, v2gObject.ISO1, and v2gObject.ISO2,
+   	   respectively.
+
+	2. After decoding, V2gMsg_Process() could then use
+	   v2gObject.DIN, v2gObject.ISO1, or v2gObject.ISO2
+   to deal with the corresponding Response messages, respectively.
+ * @param msg
+ * @param msg_length
+ * @param v2g_state
+ * @return
+ */
+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, &v2gObject.appHandshake)) < 0)
+        {
+            DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR = %d (DEC)]V2gMsgDecoder: SupportedAppProtocolRequest()\n", errn);
+        }
+        else    //decoded successfully.
+        {
+            //PRINT_XML_DOC_supportedAppProtocolReq(&v2gObject.appHandshake);
+        }
+    }
+    //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, &v2gObject.DIN)) < 0)
+                {
+                	DEBUG_INFO("[ERROR = %d (DEC)]V2gMsgDecoder: API_V2GMSG_EXI_Decoder_DIN()\n", errn);
+                }
+                break;
+            }
+
+            case V2GT_MSG_PROTOCOL_ISO15118_2014:   //1
+            {
+                //ISO1
+                if((errn = API_V2GMSG_EXI_Decoder_ISO1(msg, msg_length, &v2gObject.ISO1)) < 0)
+                {
+                	DEBUG_INFO("[ERROR = %d (DEC)]V2gMsgDecoder: API_V2GMSG_EXI_Decoder_ISO1()\n", errn);
+                }
+                break;
+            }
+
+            case V2GT_MSG_PROTOCOL_ISO15118_2018:   //2
+            {
+                //ISO2
+                if((errn = API_V2GMSG_EXI_Decoder_ISO2(msg, msg_length, &v2gObject.ISO2)) < 0)
+                {
+                	DEBUG_INFO("[ERROR = %d (DEC)]V2gMsgDecoder: API_V2GMSG_EXI_Decoder_ISO2()\n", errn);
+                }
+                break;
+            }
+
+            default:
+                break;
+        }
+    }
+    else
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR = %d (DEC)]V2gMsgDecoder: Unexpected v2g_state\n", errn);
+        errn = -1;
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param v2g_tx_stream
+ * @param v2gObject
+ * @return
+ */
+int encode_din_V2GTP_stream(bitstream_t *v2g_tx_stream, struct dinEXIDocument *v2gObject)
+{
+    int errn = 0;
+    *v2g_tx_stream->pos = V2GTP_HEADER_LENGTH;
+
+    errn = encode_dinExiDocument(v2g_tx_stream, v2gObject);
+    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]write_v2gtpHeader(): %d (DEC)\n", errn);
+        }
+    }
+    else
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm]encode_dinExiDocument(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param v2g_tx_stream
+ * @param v2gObject
+ * @return
+ */
+int encode_iso1_V2GTP_stream(bitstream_t *v2g_tx_stream, struct iso1EXIDocument *v2gObject)
+{
+    int errn = 0;
+    *v2g_tx_stream->pos = V2GTP_HEADER_LENGTH;
+
+    errn = encode_iso1ExiDocument(v2g_tx_stream, v2gObject);
+    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]write_v2gtpHeader(): %d (DEC)\n", errn);
+        }
+    }
+    else
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm]encode_iso1ExiDocument(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param v2g_tx_stream
+ * @param v2gObject
+ * @return
+ */
+int encode_iso2_V2GTP_stream(bitstream_t *v2g_tx_stream, struct iso2EXIDocument *v2gObject)
+{
+    int errn = 0;
+    *v2g_tx_stream->pos = V2GTP_HEADER_LENGTH;
+
+    errn = encode_iso2ExiDocument(v2g_tx_stream, v2gObject);
+    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]write_v2gtpHeader(): %d (DEC)\n", errn);
+        }
+    }
+    else
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR][SeccComm]encode_iso2ExiDocument(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+
+/**
+ *
+ * @param AcceptFd
+ * @param v2g_tx_stream
+ * @param v2gObject
+ * @return
+ */
+int send_encoded_din_V2GTP_Stream(int AcceptFd, bitstream_t *v2g_tx_stream, struct dinEXIDocument *v2gObject)
+{
+    int errn = 0;
+
+    // STEP 1: =========== Encoding into EXI and Composing into V2GTP Stream ==========
+    errn = encode_din_V2GTP_stream(v2g_tx_stream, v2gObject);
+
+    // STEP 2: =========== Send Response Packet  ===========
+    int rtn = 0;
+    rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+
+	if (rtn == v2g_tx_stream->size)
+    {
+        /*
+        DEBUG_PRINTF_EVCOMM_DETAIL("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]Incomplete Tx ( %d / %d ). (Bytes, DEC): FAIL\n", rtn, v2g_tx_stream->size);
+    }
+    else
+    {
+        errn = rtn;
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR]send(): %d (DEC)\n", errn);
+    }
+
+    //STEP 3: ========= Reset V2G MSG Flags ==========
+    init_dinBodyType(&v2gObject->V2G_Message.Body);
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @param v2g_tx_stream
+ * @param v2gObject
+ * @return
+ */
+int send_encoded_iso1_V2GTP_Stream(int AcceptFd, bitstream_t *v2g_tx_stream, struct iso1EXIDocument *v2gObject)
+{
+    int errn = 0;
+
+    // STEP 1: =========== Encoding into EXI and Composing into V2GTP Stream ==========
+    errn = encode_iso1_V2GTP_stream(v2g_tx_stream, v2gObject);
+
+    // STEP 2: =========== Send Response Packet  ===========
+    int rtn = 0;
+    rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+
+	if (rtn == v2g_tx_stream->size)
+    {
+        //DEBUG_PRINTF_EVCOMM_DETAIL("Response message 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]Incomplete Tx (%d/%d)(Bytes, DEC): FAIL\n", rtn, v2g_tx_stream->size);
+    }
+    else
+    {
+        errn = rtn;
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR]send(): %d(DEC)\n", errn);
+    }
+
+    //STEP 3: ========= Reset V2G MSG Flags ==========
+    init_iso1BodyType(&v2gObject->V2G_Message.Body);
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @param v2g_tx_stream
+ * @param v2gObject
+ * @return
+ */
+int send_encoded_iso2_V2GTP_Stream(int AcceptFd, bitstream_t *v2g_tx_stream, struct iso2EXIDocument *v2gObject)
+{
+    int errn = 0;
+
+    // STEP 1: =========== Encoding into EXI and Composing into V2GTP Stream ==========
+    errn = encode_iso2_V2GTP_stream(v2g_tx_stream, v2gObject);
+
+    // STEP 2: =========== Send Response Packet  ===========
+    int rtn = 0;
+    rtn = send(AcceptFd, v2g_tx_stream->data, v2g_tx_stream->size, 0);
+
+	if (rtn == v2g_tx_stream->size)
+    {
+        /*
+        DEBUG_PRINTF_EVCOMM_DETAIL("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]Incomplete Tx ( %d / %d ). (Bytes, DEC): FAIL\n",
+                                    rtn, v2g_tx_stream->size);
+    }
+    else
+    {
+        errn = rtn;
+        DEBUG_PRINTF_EVCOMM_DETAIL("[ERROR]send(): %d (DEC)\n", errn);
+    }
+
+    //STEP 3: ========= Reset V2G MSG Flags ==========
+    init_iso2BodyType(&v2gObject->V2G_Message.Body);
+    return errn;
+}
+
+/**
+ *
+ * @param exi_doc_DIN
+ * @return
+ */
+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
+    {
+    	DEBUG_ERROR("SessionID: incorrect length(%d)\n", leng);
+        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
+    {
+    	DEBUG_ERROR("SessionID: incorrect ID(RX:%02X%02X%02X%02X%02X%02X%02X%02X, ORI:%02X%02X%02X%02X%02X%02X%02X%02X)\n",
+					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]);
+    }
+
+    //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;
+}
+
+/**
+ *
+ * @param exi_doc_ISO1
+ * @return
+ */
+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
+    {
+        DEBUG_ERROR("SessionID: incorrect length(%d)\n", leng);
+        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
+    {
+    	DEBUG_ERROR("SessionID: incorrect ID (RX:%02X%02X%02X%02X%02X%02X%02X%02X, ORI:%02X%02X%02X%02X%02X%02X%02X%02X)\n",
+					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]);
+    }
+
+    //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;
+}
+
+/**
+ *
+ * @param exi_doc_ISO2
+ * @return
+ */
+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
+    {
+    	DEBUG_ERROR("SessionID: incorrect length(%d)\n", leng);
+        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
+    {
+    	DEBUG_ERROR("SessionID: incorrect ID(RX:%02X%02X%02X%02X%02X%02X%02X%02X, ORI:%02X%02X%02X%02X%02X%02X%02X%02X)\n",
+					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]);
+    }
+
+    //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;
+}
+
+/**
+*   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?
+ * @param target
+ * @return
+ */
+int GetSchemaID_of_Protocol(unsigned char target)
+{
+    int i = 0;
+    int ii = 0;
+    int id = 0;
+    unsigned char pri = 20; //priority = 1(highest)~20(lowerest)
+    char num[10];
+
+    //Choose the 1st protocol as default.
+    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)
+        {
+        	DEBUG_INFO("support(%d/%d): DIN 70121(%d:v%d.%d;id=%d,pri=%d)\n",
+						(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);
+
+            if (target == V2GT_MSG_PROTOCOL_DIN70121)
+            {
+            	DEBUG_INFO("select(%d/%d): DIN 70121(%d:v%d.%d;id=%d,pri=%d)\n",
+							(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);
+
+                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)
+            {
+            	DEBUG_INFO("support(%d/%d): ISO 15118-2(ed1,%d:v%d.%d;id=%d,pri=%d)\n",
+							(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);
+
+                if (target == V2GT_MSG_PROTOCOL_ISO15118_2014)
+                {
+                	DEBUG_INFO("select(%d/%d): ISO 15118-2,ed1(%d:v%d.%d;id=%d,pri=%d)\n",
+								(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);
+
+                    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
+            {
+            	DEBUG_INFO("support(%d/%d): ISO 15118-20(ed2,%d:v%d.%d;id=%d,pri=%d)\n",
+							(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);
+
+                if (target == V2GT_MSG_PROTOCOL_ISO15118_2018)
+                {
+                	DEBUG_INFO("select(%d/%d): ISO 15118-20,ed2(%d:v%d.%d;id=%d,pri=%d)\n",
+								(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);
+
+                    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
+            	DEBUG_INFO("unsupport(%d/%d): ISO 15118-X(unexpected year:%d,v%d.%d),id=%d,pri=%d\n",
+							(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);
+            }
+        }
+        else
+        {
+        	DEBUG_INFO("unsupport protocol(%d/%d)(%d:v%d.%d;id=%d,pri=%d)\n",
+						(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);
+        }
+    }
+
+    //The final result of highest priority protocol
+    DEBUG_INFO("select(%d/%d): pro=%d(0:DIN,1:ISO1,2:ISO2);id=%d,pri=%d\n",
+				(ii+1),
+				CCS_HANDSHAKE_PROTOCOLS.arrayLen,
+				ShmCcsData->CommProtocol,
+				id,
+				pri);
+
+    if (id < 0)
+    {
+        EVCOMM_SYS_INFO.SupportedAppProtocol_result = appHandresponseCodeType_Failed_NoNegotiation;
+    }
+
+    return id;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+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(&v2gObject.appHandshake);
+    v2gObject.appHandshake.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_OK_SuccessfulNegotiation;
+	v2gObject.appHandshake.supportedAppProtocolRes_isUsed = 1u;
+
+    //select the 1st one as the default
+    v2gObject.appHandshake.supportedAppProtocolRes.SchemaID = CCS_HANDSHAKE_PROTOCOLS.array[0].SchemaID;
+    v2gObject.appHandshake.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 ---*/
+    v2gObject.appHandshake.supportedAppProtocolRes.ResponseCode = EVCOMM_SYS_INFO.SupportedAppProtocol_result;   //updating the response code
+    if (id < 0)
+    {
+    	DEBUG_ERROR("No available CCS protocol (id = %d, preference = %d)\n", id, V2GT_MSG_PROTOCOL_PREFERENCE);
+    }
+    else
+    {
+        //selected SchemaID
+        v2gObject.appHandshake.supportedAppProtocolRes.SchemaID = (unsigned char) id;
+    }
+
+
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        DEBUG_INFO("EVSE_Shutdown => End_Process\n");
+        v2gObject.appHandshake.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_Failed_NoNegotiation;
+        errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        DEBUG_INFO("EVSE_EmergencyShutdown => End_Process\n");
+        v2gObject.appHandshake.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)
+    {
+    	DEBUG_ERROR("[DIN][supportedAppProtocolRes]Permission OFF\n");
+        v2gObject.appHandshake.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
+            {
+                v2gObject.appHandshake.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_Failed_NoNegotiation;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+                Update_V2G_Status(Other_Fault);
+                DEBUG_INFO("Emergency Stop by CP Error (%d, %.02f V)\n",
+										sys->CpState,
+										sys->CpVoltage);
+            }
+        }
+        #else
+        {
+            //Detect for CP State should be 9V (State B)
+            if (sys->CpState != 3)  //B2
+            {
+                v2gObject.appHandshake.supportedAppProtocolRes.ResponseCode = appHandresponseCodeType_Failed_NoNegotiation;
+                CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+                Update_V2G_Status(Other_Fault);
+                DEBUG_INFO("Emergency Stop by CP Error (%d, %.02f V)\n",
+										sys->CpState,
+										sys->CpVoltage);
+            }
+        }
+        #endif
+    }
+    #endif
+
+
+    //STEP 2: =========== Encode into EXI ===========
+    if ((errn = API_V2GMSG_EXI_Encoder_AppProtocol(&v2gObject.appHandshake, &v2g_tx_stream)) !=0)
+    {
+        DEBUG_PRINTF_EVCOMM_DETAIL("[Error]API_V2GMSG_EXI_Encoder_AppProtocol\n");
+        return errn;
+    }
+
+    //STEP 3: =========== Send Response Packet ===========
+    int Rtn = 0;
+	Rtn = send(AcceptFd, v2g_tx_stream.data, v2g_tx_stream.size, 0);
+    //Rtn = send(6, v2g_tx_stream.data, v2g_tx_stream.size, 0);
+
+    DEBUG_PRINTF_EVCOMM_DETAIL("Send V2GTP Packet Size = %d, Rtn = %d (Bytes, DEC)\n", v2g_tx_stream.size, Rtn);
+
+    if (Rtn < 0)
+    {
+        return Rtn;
+    }
+
+    //STEP 4: =========== Save into Share Memory =========
+	//[ 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(&v2gObject.appHandshake);
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_supportedAppProtocolReq(int AcceptFd)
+{
+    //[ To-Do] analysis on Req message and choose the prefered protocol
+    //Default: DIN 70121 (find SchemaID)
+    int errn = 0;
+
+    DEBUG_INFO("Request in.\n");
+    SHM_Save_din_supportedAppProtocolReq(ShmCcsData, &v2gObject.appHandshake, ShmSysConfigAndInfo);
+
+    errn = Proc_supportedAppProtocolRes(AcceptFd);
+    if (errn == 0)
+    {
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+        DEBUG_ERROR("Proc_supportedAppProtocolRes(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+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 = v2gBuffer.tx;
+
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinSessionSetupResType(&v2gObject.DIN.V2G_Message.Body.SessionSetupRes);
+
+
+    // ====== [BODY (1/2) ResponseCode ======
+    v2gObject.DIN.V2G_Message.Body.SessionSetupRes_isUsed = 1u;
+    v2gObject.DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = dinresponseCodeType_OK_NewSessionEstablished;
+
+
+    //[HEADER] Assign Res SessionID
+    v2gObject.DIN.V2G_Message.Header.SessionID.bytesLen = 8;
+    memset(v2gObject.DIN.V2G_Message.Header.SessionID.bytes, 0, 8);
+    memcpy(v2gObject.DIN.V2G_Message.Header.SessionID.bytes, EVCOMM_SYS_INFO.SessionID, 8);
+
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        v2gObject.DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = dinresponseCodeType_FAILED_SequenceError;
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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(&v2gObject.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
+        v2gObject.DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = dinresponseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+
+        DEBUG_INFO("Emergency Stop by CP Error (%d)\n", sys->CpState);
+	#else
+        DEBUG_INFO("Emergency Stop by CP Error (%d): ignored\n", sys->CpState);
+	#endif
+    }
+
+    //Check for shutdown commands from EVSE(DC Main Board)
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        v2gObject.DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = dinresponseCodeType_FAILED;
+        DEBUG_INFO("Stop by EVSE(%d:normal, %d:emergency): (%d)\n", EVSE_Shutdown, EVSE_EmergencyShutdown, sys->DC_EVSEStatus);
+        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)
+    {
+    	DEBUG_ERROR("[DIN]Permission OFF");
+        v2gObject.DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = dinresponseCodeType_FAILED;
+        errn = -1;
+    }
+
+    // ====== [BODY (2/3) EVSEID ======
+    //EVSEID = all zero
+    memset(v2gObject.DIN.V2G_Message.Body.SessionSetupRes.EVSEID.bytes, 0, sizeof(v2gObject.DIN.V2G_Message.Body.SessionSetupRes.EVSEID.bytes));
+    //vern, should be encode  by SN
+    v2gObject.DIN.V2G_Message.Body.SessionSetupRes.EVSEID.bytesLen = 1;  //max: DIN = 32, ISO1/ISO2 = 37 bytes
+
+    // ====== [BODY (3/3) DateTimeNow ======
+    v2gObject.DIN.V2G_Message.Body.SessionSetupRes.DateTimeNow_isUsed = 1u;
+    v2gObject.DIN.V2G_Message.Body.SessionSetupRes.DateTimeNow = (int64_t)time(NULL);   //[Joseph] Format: Unix Time Stamp
+
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ///////////SHM_Read_din_SessionSetupRes(&v2gObject.DIN, ShmCcsData);
+    #endif
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    return errn;
+
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+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 = v2gBuffer.tx;
+
+    init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1SessionSetupResType(&v2gObject.ISO1.V2G_Message.Body.SessionSetupRes);
+
+    // ====== [BODY (1/2) ResponseCode ======
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes_isUsed = 1u;
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_OK_NewSessionEstablished;
+
+
+    //[HEADER] Assign Res SessionID
+    v2gObject.ISO1.V2G_Message.Header.SessionID.bytesLen = 8;
+    memset(v2gObject.ISO1.V2G_Message.Header.SessionID.bytes, 0, 8);
+    memcpy(v2gObject.ISO1.V2G_Message.Header.SessionID.bytes, EVCOMM_SYS_INFO.SessionID, 8);
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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(&v2gObject.ISO1, ShmCcsData);
+    //#endif
+
+    //Detect for CP State should be 9V (State B)
+    if ((sys->CpState != 2) && (sys->CpState != 3))  //State B1, B2
+    {
+	#if CP_PROTECTION_MECHANISM == ENABLE
+        v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+
+        DEBUG_INFO("Emergency Stop by CP Error (%d)\n", sys->CpState);
+	#else
+        DEBUG_INFO("Emergency Stop by CP Error (%d): ignored\n", sys->CpState);
+	#endif
+    }
+
+    //Check for shutdown commands from EVSE(DC Main Board)
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_FAILED;
+        DEBUG_INFO("Stop by EVSE(%d:normal, %d:emergency): (%d)\n",
+								EVSE_Shutdown,
+								EVSE_EmergencyShutdown,
+								sys->DC_EVSEStatus);
+        errn = -1;
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    if (ShmInternalComm->ChargingPermission_pre == TRUE &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+    	DEBUG_ERROR("Permission OFF\n");
+        v2gObject.DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_FAILED;
+        errn = -1;
+    }
+
+    // ====== [BODY (2/3) EVSEID ======
+    //EVSEID = all zero
+    memset(v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters, 0, sizeof(v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters));
+    /*+++ 20200808, vern, set default EVSEID +++*/
+    //vern, should be encoded  by SN
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[0]='Z';
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[1]='Z';
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[2]='0';
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[3]='0';
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[4]='0';
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[5]='0';
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.characters[6]='0';
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSEID.charactersLen = 7;  //max: DIN = 32, ISO1/ISO2 = 37 bytes
+    /*--- 20200808, vern, set default EVSEID ---*/
+
+    // ====== [BODY (3/3) DateTimeNow ======
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSETimeStamp_isUsed = 1u;
+    v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.EVSETimeStamp = (int64_t)time(NULL);   //[Joseph] Format: Unix Time Stamp
+
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ///////////SHM_Read_iso1_SessionSetupRes(&v2gObject.ISO1, ShmCcsData);
+    #endif
+
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    return errn;
+
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+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 = v2gBuffer.tx;
+
+    init_iso2BodyType(&v2gObject.ISO2.V2G_Message.Body);
+    init_iso2SessionSetupResType(&v2gObject.ISO2.V2G_Message.Body.SessionSetupRes);
+
+    // ====== [BODY (1/2) ResponseCode ======
+    v2gObject.ISO2.V2G_Message.Body.SessionSetupRes_isUsed = 1u;
+    v2gObject.ISO2.V2G_Message.Body.SessionSetupRes.ResponseCode = iso2responseCodeType_OK_NewSessionEstablished;
+
+
+    //[HEADER] Assign Res SessionID
+    v2gObject.ISO2.V2G_Message.Header.SessionID.bytesLen = 8;
+    memset(v2gObject.ISO2.V2G_Message.Header.SessionID.bytes, 0, 8);
+    memcpy(v2gObject.ISO2.V2G_Message.Header.SessionID.bytes, EVCOMM_SYS_INFO.SessionID, 8);
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        v2gObject.ISO1.V2G_Message.Body.SessionSetupRes.ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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(&v2gObject.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
+        v2gObject.ISO2.V2G_Message.Body.SessionSetupRes.ResponseCode = iso2responseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+
+        DEBUG_INFO("Emergency Stop by CP Error (%d)\n", sys->CpState);
+	#else
+        DEBUG_INFO("Emergency Stop by CP Error (%d): ignored\n", sys->CpState);
+	#endif
+    }
+
+    //Check for shutdown commands from EVSE(DC Main Board)
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        v2gObject.ISO2.V2G_Message.Body.SessionSetupRes.ResponseCode = iso2responseCodeType_FAILED;
+        DEBUG_INFO("Stop by EVSE(%d:normal, %d:emergency): (%d)\n",
+								EVSE_Shutdown,
+								EVSE_EmergencyShutdown,
+								sys->DC_EVSEStatus);
+        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)
+    {
+    	DEBUG_ERROR("Permission OFF\n");
+        v2gObject.DIN.V2G_Message.Body.SessionSetupRes.ResponseCode = iso2responseCodeType_FAILED;
+        errn = -1;
+    }
+
+    // ====== [BODY (2/3) EVSEID ======
+    //EVSEID = all zero
+    memset(v2gObject.ISO2.V2G_Message.Body.SessionSetupRes.EVSEID.characters, 0, sizeof(v2gObject.ISO2.V2G_Message.Body.SessionSetupRes.EVSEID.characters));
+    v2gObject.ISO2.V2G_Message.Body.SessionSetupRes.EVSEID.charactersLen = 15;  //max: DIN = 32, ISO1/ISO2 = 37 bytes
+
+    // ====== [BODY (3/3) DateTimeNow ======
+    v2gObject.ISO2.V2G_Message.Body.SessionSetupRes.EVSETimeStamp_isUsed = 1u;
+    v2gObject.ISO2.V2G_Message.Body.SessionSetupRes.EVSETimeStamp = (int64_t)time(NULL);   //[Joseph] Format: Unix Time Stamp
+
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ///////////SHM_Read_iso2_SessionSetupRes(&v2gObject.ISO2, ShmCcsData);
+    #endif
+
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_iso2_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.ISO2) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    return errn;
+
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_SessionSetupReq(int AcceptFd)
+{
+    int errn = 0;
+
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_SessionSetupReq(&v2gObject.DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_SessionSetupReq(ShmCcsData, &v2gObject.DIN, ShmSysConfigAndInfo);
+
+    errn = Proc_din_SessionSetupRes(AcceptFd);
+    if (errn == 0)
+    {
+    	//successfully send response.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_din_SessionSetupRes(): %d (DEC)\n", errn);
+    }
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_SessionSetupReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_SessionSetupReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_SessionSetupReq(ShmCcsData, &v2gObject.ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_SessionSetupRes(AcceptFd);
+    if (errn == 0)
+    {
+        //successfully send response.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_SessionSetupRes(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso2_SessionSetupReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO2_SessionSetupReq(&v2gObject.ISO2);
+
+    //Save into Share Memory
+    SHM_Save_iso2_SessionSetupReq(ShmCcsData, &v2gObject.ISO2, ShmSysConfigAndInfo);
+
+    errn = Proc_iso2_SessionSetupRes(AcceptFd);
+    if (errn == 0)
+    {
+        //successfully send response.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso2_SessionSetupRes(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_ServiceDiscoveryRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+    //req = &ShmCcsData->V2GMessage_DIN70121.ServiceDiscoveryRequest;
+    res = &ShmCcsData->V2GMessage_DIN70121.ServiceDiscoveryResponse;
+
+
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinServiceDiscoveryResType(&v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes);
+
+    //[1/4] Response Code
+    v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes_isUsed = 1u;
+    v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = dinresponseCodeType_OK;
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&v2gObject.DIN) < 0)
+    {
+        v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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
+        v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode =  dinresponseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+	    errn = -1;
+	    DEBUG_INFO("Emergency Stop by CP Error (%d)\n", sys->CpState);
+	#else
+	    DEBUG_INFO("Emergency Stop by CP Error (%d): ignored\n", sys->CpState);
+	#endif
+    }
+
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = dinresponseCodeType_FAILED;
+        DEBUG_INFO("shutdown by EVSE\n");
+        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)
+    {
+    	DEBUG_ERROR("[DIN]Permission OFF\n");
+        v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = dinresponseCodeType_FAILED;
+        errn = -1;
+    }
+
+    //[2/4] PaymentOptions
+    v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.PaymentOptions.PaymentOption.arrayLen = 1u;
+    v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.PaymentOptions.PaymentOption.array[0] = dinpaymentOptionType_ExternalPayment; //1
+
+    //[3/4] Charge Service
+    res->ChargeService_DIN70121.Services.ServiceTag.ServiceID = 1;
+    v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceTag.ServiceID = (unsigned short) res->ChargeService_DIN70121.Services.ServiceTag.ServiceID;
+    v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceTag.ServiceCategory = dinserviceCategoryType_EVCharging;
+    v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.FreeService = 1; //[Joseph] for test
+    v2gObject.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(&v2gObject.DIN, ShmCcsData);
+    //#endif
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_ServiceDiscoveryRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+    //req = &ShmCcsData->V2GMessage_ISO15118_2014.ServiceDiscoveryRequest;
+    res = &ShmCcsData->V2GMessage_ISO15118_2014.ServiceDiscoveryResponse;
+
+    init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1ServiceDiscoveryResType(&v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes);
+
+    //[1/4] Response Code
+    v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes_isUsed = 1u;
+    v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_OK;
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&v2gObject.ISO1) < 0)
+    {
+        v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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
+        v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+        DEBUG_INFO("Emergency Stop by CP Error (%d)\n", sys->CpState);
+	#else
+        DEBUG_INFO("Emergency Stop by CP Error (%d): ignored", sys->CpState);
+	#endif
+    }
+
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_FAILED;
+        DEBUG_INFO("shutdown by EVSE\n");
+        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)
+    {
+    	DEBUG_ERROR("Permission OFF\n");
+        v2gObject.DIN.V2G_Message.Body.ServiceDiscoveryRes.ResponseCode = iso1responseCodeType_FAILED;
+        errn = -1;
+    }
+
+    //[2/4] PaymentOptionList
+    v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.PaymentOptionList.PaymentOption.arrayLen = 1u;
+    v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.PaymentOptionList.PaymentOption.array[0] = iso1paymentOptionType_ExternalPayment; //1
+
+    //[3/4] Charge Service
+    res->ChargeService.Services.ServiceID = 1;
+    v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceID = (unsigned short) res->ChargeService.Services.ServiceID;
+    //v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceName_isUsed = 1;   //new in ISO1, not be used, yet.
+    //v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceName.charactersLen = xxx;
+    //v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceName.characters[i] = xxx;
+    v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.ServiceCategory = iso1serviceCategoryType_EVCharging;
+    v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.FreeService = 1; //[Joseph] for test
+    v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.arrayLen = 1u;    // max = 6
+
+    switch (ShmCcsData->EnergyTransferMode)
+    {
+        case DC_extended:
+        {
+            v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.array[0] = iso1EnergyTransferModeType_DC_extended;
+            break;
+        }
+
+        case AC_single_phase_core:
+        {
+            v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.array[0] = iso1EnergyTransferModeType_AC_single_phase_core;
+            break;
+        }
+
+        case AC_three_phase_core:
+        {
+            v2gObject.ISO1.V2G_Message.Body.ServiceDiscoveryRes.ChargeService.SupportedEnergyTransferMode.EnergyTransferMode.array[0] = iso1EnergyTransferModeType_AC_three_phase_core;
+            break;
+        }
+
+        default:
+        {
+        	DEBUG_WARN("unexpected EnergyTransferMode(%d)\n", ShmCcsData->EnergyTransferMode);
+            break;
+        }
+    }
+
+
+    //[4/4] Service List (null, not be uesed for now.)
+    //#if PARAMETER_NORMAL_MODE == ENABLE
+    ///////////////SHM_Read_iso1_ServiceDiscoveryRes(&v2gObject.ISO1, ShmCcsData);
+    //#endif
+
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_ServiceDiscoveryReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_ServiceDiscoveryReq(&v2gObject.DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_ServiceDiscoveryReq(ShmCcsData, &v2gObject.DIN, ShmSysConfigAndInfo);
+
+    errn = Proc_din_ServiceDiscoveryRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_din_ServiceDiscoveryRes(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_ServiceDiscoveryReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_ServiceDiscoveryReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_ServiceDiscoveryReq(ShmCcsData, &v2gObject.ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_ServiceDiscoveryRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_ServiceDiscoveryRes(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_ServiceAndPaymentSelectionRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    req = &ShmCcsData->V2GMessage_DIN70121.ServiceAndPaymentSelectionRequest;
+    //res = &ShmCcsData->V2GMessage_DIN70121.ServiceAndPaymentSelectionResponse;
+    sd_res = &ShmCcsData->V2GMessage_DIN70121.ServiceDiscoveryResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinServicePaymentSelectionResType(&v2gObject.DIN.V2G_Message.Body.ServicePaymentSelectionRes);
+
+    //[1/1] Response Code
+    v2gObject.DIN.V2G_Message.Body.ServicePaymentSelectionRes_isUsed = 1u;
+    v2gObject.DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_OK;
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&v2gObject.DIN) < 0)
+    {
+        v2gObject.DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        v2gObject.DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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 != ExternalPayment)  //1
+    {
+        v2gObject.DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED_PaymentSelectionInvalid;
+        DEBUG_ERROR("unexpected SelectedPaymentOption(%d) => End_Process (EIM only, no PnC, yet.)\n", req->SelectedPaymentOption);
+        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)
+    {
+        v2gObject.DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED_ServiceSelectionInvalid;  //8
+        DEBUG_ERROR("Wrong selected ServiceID(%d) => End_Process\n", req->SelectedServiceList.SelectedService[0].ServiceID);
+        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
+        v2gObject.DIN.V2G_Message.Body.ServicePaymentSelectionRes.ResponseCode = dinresponseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+        DEBUG_INFO("Emergency Stop by CP Error (%d)\n", sys->CpState);
+	#else
+        DEBUG_INFO("Emergency Stop by CP Error (%d): ignored due to function is disabled\n", sys->CpState);
+	#endif
+    }
+
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        DEBUG_INFO("shutdown by EVSE\n");
+        v2gObject.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)
+    {
+    	DEBUG_ERROR("Permission OFF\n");
+        v2gObject.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, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_ServiceAndPaymentSelectionRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    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(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1PaymentServiceSelectionResType(&v2gObject.ISO1.V2G_Message.Body.PaymentServiceSelectionRes);
+
+    //[1/1] Response Code
+    v2gObject.ISO1.V2G_Message.Body.PaymentServiceSelectionRes_isUsed = 1u;
+    v2gObject.ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_OK;
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&v2gObject.ISO1) < 0)
+    {
+        v2gObject.ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        v2gObject.ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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 != ExternalPayment)  //1
+    {
+        v2gObject.ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED_PaymentSelectionInvalid;
+        DEBUG_ERROR("unexpected SelectedPaymentOption(%d) => End_Process (EIM only, no PnC, yet.)\n", req->SelectedPaymentOption);
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_Payment SelectionInvalid (023762)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 6;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 2;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+
+    //Check for ServiceID (TC_SECC_VTB_ServicePaymentSelection_004)
+    if (req->SelectedServiceList.SelectedService[0].ServiceID != sd_res->ChargeService.Services.ServiceID)
+    {
+        v2gObject.ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED_ServiceSelectionInvalid;  //8
+        DEBUG_ERROR("Wrong selected ServiceID(%d) => End_Process\n", req->SelectedServiceList.SelectedService[0].ServiceID);
+        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
+        v2gObject.ISO1.V2G_Message.Body.PaymentServiceSelectionRes.ResponseCode = iso1responseCodeType_FAILED;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+        DEBUG_INFO("Emergency Stop by CP Error (%d)\n", sys->CpState);
+        #else
+        DEBUG_INFO("Emergency Stop by CP Error (%d): ignored due to function is disabled\n", sys->CpState);
+        #endif
+    }
+
+    if (sys->DC_EVSEStatus == EVSE_Shutdown ||
+        sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        DEBUG_INFO("shutdown by EVSE\n");
+        v2gObject.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)
+    {
+    	DEBUG_ERROR("Permission OFF\n");
+        v2gObject.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, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_ServiceAndPaymentSelectionReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_ServiceAndPaymentSelectionReq(&v2gObject.DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_ServiceAndPaymentSelectionReq(ShmCcsData, &v2gObject.DIN, ShmSysConfigAndInfo);
+
+    errn = Proc_din_ServiceAndPaymentSelectionRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_din_ServiceAndPaymentSelectionRes(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_ServiceAndPaymentSelectionReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_ServiceAndPaymentSelectionReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_ServiceAndPaymentSelectionReq(ShmCcsData, &v2gObject.ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_ServiceAndPaymentSelectionRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_ServiceAndPaymentSelectionRes(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_ContractAuthenticationRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinContractAuthenticationResType(&v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes);
+
+    v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes_isUsed = 1u;
+
+    //[BODY (1/2)] ResponseCode
+    v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_OK;
+    v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing = dinEVSEProcessingType_Ongoing; //0
+
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&v2gObject.DIN) < 0)
+    {
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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
+    {
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED;
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing =  dinEVSEProcessingType_Finished;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+        DEBUG_INFO("Emergency Stop by CP Error (%d)\n", sys->CpState);
+    }
+    #endif
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED;
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing =  dinEVSEProcessingType_Finished;
+        errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED;
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing =  dinEVSEProcessingType_Finished;
+        errn = -1;
+    }
+
+    //[BODY (2/2)] EVSEProcessing
+    if(ShmInternalComm->ChargingPermission == TRUE)
+    {
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing = dinEVSEProcessingType_Finished; //0
+        DEBUG_INFO("CSU Permission: OK\n");
+
+        #if (SLAC_FIRST_RESPONSE_METHOD == SET_5_PWM_ONCE_GET_PERMISSION_IN_AUTHORIZATIONRES)
+        {
+            //Set PWM as 5% (for SLAC first case)
+            DEBUG_INFO("Set PWM as 5%%\n");
+            SwitchCpStateE(DISABLE);
+            OutputCpPwmDuty(5);
+        }
+        #endif
+    }
+
+    //Check for Permission Changing from TRUE to FALSE
+    if (ShmInternalComm->ChargingPermission_pre == TRUE &&
+        ShmInternalComm->ChargingPermission == FALSE)
+    {
+    	DEBUG_ERROR("Permission OFF\n");
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.ResponseCode = dinresponseCodeType_FAILED;
+        v2gObject.DIN.V2G_Message.Body.ContractAuthenticationRes.EVSEProcessing =  dinEVSEProcessingType_Finished;
+        errn = -1;
+    }
+
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ////////////SHM_Read_din_ContractAuthenticationRes(&v2gObject.DIN, ShmCcsData);
+    #endif
+
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_AuthorizationRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+
+    init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1AuthorizationResType(&v2gObject.ISO1.V2G_Message.Body.AuthorizationRes);
+
+    v2gObject.ISO1.V2G_Message.Body.AuthorizationRes_isUsed = 1u;
+
+    //[BODY (1/2)] ResponseCode
+    v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = iso1responseCodeType_OK;
+    /*+++ 20200808, vern, EVSEProcessing should be waiting for Customer during authrization +++*/
+    v2gObject.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(&v2gObject.ISO1) < 0)
+    {
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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
+    {
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = iso1responseCodeType_FAILED;
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing =  iso1EVSEProcessingType_Finished;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+
+        DEBUG_INFO("Emergency Stop by CP Error (%d)\n", sys->CpState);
+    }
+    #endif
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = FAILED_ISO15118_2014;
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing =  iso1EVSEProcessingType_Finished;
+        errn = -1;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = FAILED_ISO15118_2014;
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing =  iso1EVSEProcessingType_Finished;
+        errn = -1;
+    }
+    //[BODY (2/2)] EVSEProcessing
+    //Check for Permission from CSU
+    if(ShmInternalComm->ChargingPermission == TRUE)
+    {
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing = iso1EVSEProcessingType_Finished; //0
+        DEBUG_INFO("CSU Permission: OK\n");
+
+        #if (SLAC_FIRST_RESPONSE_METHOD == SET_5_PWM_ONCE_GET_PERMISSION_IN_AUTHORIZATIONRES)
+        {
+            //Set PWM as 5% (for SLAC first case)
+            DEBUG_INFO("Set PWM as 5%%\n");
+            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)
+    {
+    	DEBUG_ERROR("Permission OFF\n");
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.ResponseCode = FAILED_ISO15118_2014;
+        v2gObject.ISO1.V2G_Message.Body.AuthorizationRes.EVSEProcessing =  iso1EVSEProcessingType_Finished;
+        errn = -1;
+    }
+
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    ////////////SHM_Read_iso1_AuthorizationRes(&v2gObject.ISO1, ShmCcsData);
+    #endif
+
+
+    // ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_ContractAuthenticationReq(int AcceptFd)
+{
+    int errn = 0;
+
+    DEBUG_INFO("Request in.\n");
+
+	//Print the decoded XML Document
+	PRINT_XML_DOC_DIN_ContractAuthenticationReq(&v2gObject.DIN);
+
+	//Save into Share Memory
+	SHM_Save_din_ContractAuthenticationReq(ShmCcsData, &v2gObject.DIN, ShmSysConfigAndInfo);
+
+	errn = Proc_din_ContractAuthenticationRes(AcceptFd);
+	if (errn == 0)
+	{
+		//send response successfully.
+		DEBUG_INFO("Resonse out.\n");
+	}
+	else
+	{
+		DEBUG_ERROR("Proc_din_ContractAuthenticationRes(): %d (DEC)\n", errn);
+	}
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_AuthenticationReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_AuthorizationReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_AuthorizationReq(ShmCcsData, &v2gObject.ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_AuthorizationRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_AuthorizationRes(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param in
+ */
+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
+}
+
+/**
+ *
+ * @param obj
+ * @param value
+ * @param multiplier
+ * @param unit
+ */
+void SHM_Save_dinPhysicalValueType(struct PhysicalValueType_DIN70121 *obj, short value, int multiplier, unsigned char unit)
+{
+    obj->Value = value;
+    obj->Multiplier = multiplier;
+    obj->Unit =unit;
+}
+
+/**
+ *
+ * @param shm_ccs
+ */
+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);
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_din_ChargeParameterDiscoveryRes()
+{
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinChargeParameterDiscoveryResType(&v2gObject.DIN.V2G_Message.Body.ChargeParameterDiscoveryRes);
+
+    v2gObject.DIN.V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
+
+    //----- [BODY (1/5)] ResponseCode -----
+    struct dinChargeParameterDiscoveryResType *res;
+    res = &v2gObject.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;
+    */
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_iso1_ChargeParameterDiscoveryRes()
+{
+    init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1ChargeParameterDiscoveryResType(&v2gObject.ISO1.V2G_Message.Body.ChargeParameterDiscoveryRes);
+
+    v2gObject.ISO1.V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
+
+    //----- [BODY (1/5)] ResponseCode -----
+    struct iso1ChargeParameterDiscoveryResType *res;
+    res = &v2gObject.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;
+    */
+}
+
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_ChargeParameterDiscoveryRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    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(&v2gObject.DIN) < 0)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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)
+    {
+    	DEBUG_ERROR("EvBatteryMaxCurrent is negative(%.02f) => End_Process\n", sys->EvBatteryMaxCurrent);
+
+        res->ResponseCode = dinresponseCodeType_FAILED_WrongChargeParameter;    //16
+        res->EVSEProcessing = Finished_DIN70121;
+        dc_para->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_WrongChargeParameter (023775)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 5;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+
+    //STEP 2: ============ Modify Parameters of ShmCcsData ============
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMaximumPowerLimit, (int) (sys->AvailableChargingPower * 10), W_DIN70121);
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMaximumCurrentLimit, (int) (sys->AvailableChargingCurrent * 10), A_DIN70121);
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMaximumVoltageLimit, (int) (sys->MaximumChargingVoltage * 10), V_DIN70121);
+
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMinimumVoltageLimit, 1500, V_DIN70121); //150V
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMinimumCurrentLimit, 10, A_DIN70121); //1A
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSECurrentRegulationTolerance, 10, A_DIN70121); //1A
+    SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEPeakCurrentRipple, 2, A_DIN70121);   //0.2A
+    //SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEEnergyToBeDelivered, 0, WH_DIN70121); //optional
+
+    #if PATCH_FOR_BMW_I3_BUG_EVSEMAXIMUMVOLTAGELIMIT_599V == ENABLE
+    if (sys->EvBatteryMaxVoltage <= 500)
+    {
+        SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMaximumVoltageLimit, (int) (500 * 10), V_DIN70121);  //500V
+    }
+    #endif
+
+    //for test with Tesla Model 3, 10A
+    //SAVE_PhysicalValueType_DIN70121(&dc_para->EVSEMaximumCurrentLimit, (int) (10 * 10), A_DIN70121);   //10A, for testing with Tesla Model 3
+
+
+    //Check for EnergyTransferMode [TC_SECC_VTB_ChargeParameterDiscovery_004]
+    if (req->EVRequestedEnergyTransferType != DC_extended)
+    {
+    	DEBUG_ERROR("Wrong EVRequestedEnergyTransferType(%d,%d)\n", req->EVRequestedEnergyTransferType, dinEVSESupportedEnergyTransferType_DC_extended);
+        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_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)
+    {
+        DEBUG_INFO("EVSE_Shutdown\n");
+        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)
+    {
+        DEBUG_INFO("EVSE_EmergencyShutdown\n");
+        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_Status(Other_Fault);
+        errn = -1;
+
+        DEBUG_INFO("Emergency Stop by CP Error (%d, %.02f V)\n", sys->CpState, sys->CpVoltage);
+    }
+    #endif
+
+    //Check for Permission from CSU
+    if (ShmInternalComm->ChargingPermission == TRUE)
+    {
+        res->EVSEProcessing = Finished_DIN70121;
+    }
+
+    //Check for Permission Off
+    if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+    	DEBUG_ERROR("Permission OFF\n");
+        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(&v2gObject.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, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STPE 5: ============ Update Flags ============
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_ChargeParameterDiscoveryRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    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 = 10;  //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(&v2gObject.ISO1) < 0)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+
+    //[TC_SECC_VTB_ChargeParameterDiscovery_005]
+    /*+++ 20200808, vern, should check the voltage and current to see if the range of battery parameter is accepted by charger ---*/
+
+    if((ShmCcsData->EnergyTransferMode == MODE_DC_EXTENDED) && ((sys->EvBatteryMaxCurrent < 0) || (sys->EvBatteryMaxVoltage<150)))
+    {
+        DEBUG_ERROR("EvBatteryMaxCurrent is negative(%.02f) or EvBatteryMaxVoltage is under 150(%.02f)=> End_Process\n", sys->EvBatteryMaxCurrent, sys->EvBatteryMaxVoltage);
+
+        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 ============
+    if(ShmCcsData->EnergyTransferMode == MODE_DC_EXTENDED)
+    {
+    	//DC
+		SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMaximumPowerLimit, (int) (sys->AvailableChargingPower * 10), W_ISO15118_2014);
+		SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMaximumCurrentLimit, (int) (sys->AvailableChargingCurrent * 10), A_ISO15118_2014);
+		SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMaximumVoltageLimit, (int) (sys->MaximumChargingVoltage * 10), V_ISO15118_2014);
+		SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMinimumVoltageLimit, 1500, V_ISO15118_2014); //150V
+		SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMinimumCurrentLimit, 10, A_ISO15118_2014); //1A
+		SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSECurrentRegulationTolerance, 10, A_ISO15118_2014); //1A
+		SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEPeakCurrentRipple, 2, A_ISO15118_2014);   //0.2A
+		//SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEEnergyToBeDelivered, 0, Wh_ISO15118_2014); //optional
+
+#if PATCH_FOR_BMW_I3_BUG_EVSEMAXIMUMVOLTAGELIMIT_599V == ENABLE
+		if (sys->EvBatteryMaxVoltage <= 500)
+		{
+			SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMaximumVoltageLimit, (int) (500 * 10), V_ISO15118_2014);  //500V
+		}
+#endif
+
+		//for test with Tesla Model 3, 10A
+	    //SAVE_PhysicalValueType_ISO15118_2014(&dc_para->EVSEMaximumCurrentLimit, (int) (10 * 10), A_ISO15118_2014);   //10A, for testing with Tesla Model 3
+    }
+    else
+    {
+    	//AC
+    	SAVE_PhysicalValueType_ISO15118_2014(&ac_para->EVSENominalVoltage, (int) (220 * 10), V_ISO15118_2014);
+    	SAVE_PhysicalValueType_ISO15118_2014(&ac_para->EVSEMaxCurrent, (int) (sys->AvailableChargingCurrent * 10), A_ISO15118_2014);
+    }
+
+    //Check for EnergyTransferMode
+    if(req->RequestedEnergyTransferMode != ShmCcsData->EnergyTransferMode) //[CAUTION] Their table should be kept as the same.
+    {
+        DEBUG_ERROR("Unmatched RequestedEnergyTransferMode(%d,%d)\n", req->RequestedEnergyTransferMode, ShmCcsData->EnergyTransferMode);
+        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_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)
+    {
+        DEBUG_INFO("EVSE_Shutdown\n");
+        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)
+    {
+        DEBUG_INFO("EVSE_EmergencyShutdown\n");
+        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 != CCS_CP_STATE_B1) && (sys->CpState != CCS_CP_STATE_B2) && (sys->CpState != CCS_CP_STATE_C))  //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_Status(Other_Fault);
+        errn = -1;
+
+        DEBUG_INFO("Emergency Stop by CP Error (%d, %.02f V)\n", sys->CpState, sys->CpVoltage);
+    }
+    #endif
+
+    //Check for Permission from CSU
+    if(ShmInternalComm->ChargingPermission == TRUE)
+    {
+        res->EVSEProcessing = iso1EVSEProcessingType_Finished;
+    }
+
+    //Check for Permission Off
+    if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+    	DEBUG_ERROR("Permission OFF\n");
+        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(&v2gObject.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, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STPE 5: ============ Update Flags ============
+
+    return errn;
+}
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_ChargeParameterDiscoveryReq(int AcceptFd)
+{
+    int errn = 0;
+
+	DEBUG_INFO("Request in.\n");
+
+	//ftime(&timerStart.SeqStart);
+	//Print the decoded XML Document
+	PRINT_XML_DOC_DIN_ChargeParameterDiscoveryReq(&v2gObject.DIN);
+
+	//Save into Share Memory
+	SHM_Save_din_ChargeParameterDiscoveryReq(ShmCcsData, &v2gObject.DIN, ShmSysConfigAndInfo);
+
+	//Check for EV Error Code
+	Check_EVErrorCode(ShmCcsData->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest.DC_EVChargeParameter.DC_EVStatus.EVErrorCode);
+
+	errn = Proc_din_ChargeParameterDiscoveryRes(AcceptFd);
+	//ftime(&timerStart.SeqEnd);
+	//DEBUG_PRINTF_EVCOMM_DETAIL("\ndelta = %.02lf ms\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd));
+	if ( errn == 0)
+	{
+		//send response successfully.
+		DEBUG_INFO("Response out.\n");
+	}
+	else
+	{
+		DEBUG_ERROR("Proc_din_ChargeParameterDiscoveryRes() fail: %d (DEC)\n",errn);
+	}
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_ChargeParameterDiscoveryReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //ftime(&timerStart.SeqStart);
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_ChargeParameterDiscoveryReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_ChargeParameterDiscoveryReq(ShmCcsData, &v2gObject.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(&timerStart.SeqEnd);
+    //DEBUG_PRINTF_EVCOMM_DETAIL("\ndelta = %.02lf ms\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd));
+    if (errn == 0)
+    {
+        //send response successfully.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_ChargeParameterDiscoveryRes() fail: %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param shm_ccs
+ */
+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
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_din_CableCheckRes()
+{
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinCableCheckResType(&v2gObject.DIN.V2G_Message.Body.CableCheckRes);
+
+    v2gObject.DIN.V2G_Message.Body.CableCheckRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct dinCableCheckResType *res;
+    res = &v2gObject.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
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_iso1_CableCheckRes()
+{
+    init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1CableCheckResType(&v2gObject.ISO1.V2G_Message.Body.CableCheckRes);
+
+    v2gObject.ISO1.V2G_Message.Body.CableCheckRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct iso1CableCheckResType *res;
+    res = &v2gObject.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
+}
+
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_CableCheckRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    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(&v2gObject.DIN) < 0)
+    {
+        cab->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        cab->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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
+        {
+        	DEBUG_INFO("[V2G][CableCheck]Pass (V_now = %.02f, Isolated = %d)\n", sys->PresentChargingVoltage, sys->IsolationStatus);
+
+            //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
+            {
+            	DEBUG_WARN("unexpected IsolationStatus(%d)\n", sys->IsolationStatus);
+            }
+            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;
+        DEBUG_INFO("IsolationStatus = 3 (fault)\n");
+        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;
+        DEBUG_INFO("Undefined Isolation Status(%d)\n", sys->IsolationStatus);
+    }
+
+    //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;
+        DEBUG_INFO("EVSE_Shutdown\n");
+    }
+    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;
+        DEBUG_INFO("EVSE_EmergencyShutdown\n");
+    }
+    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;
+	    DEBUG_ERROR("ChargingPermission = FALSE\n");
+    }
+    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_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;
+
+            DEBUG_INFO("Emergency Stop by CP Error (%d, %.02f V, %d)\n", sys->CpState, sys->CpVoltage, cab->cnt );
+            //cab->cnt = 0;
+        }
+    }
+    #endif
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_CableCheckRes(&v2gObject.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, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+    	errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+    sys->ConnectorLocked = TRUE;    //Inicating EVSE that the CCS Connector is Locked.
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_CableCheckRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    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(&v2gObject.ISO1) < 0)
+    {
+        cab->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        cab->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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
+        {
+        	DEBUG_INFO( "[V2G][CableCheck]Pass (V_now = %.02f, Isolated = %d)\n", sys->PresentChargingVoltage, sys->IsolationStatus);
+
+            //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
+            {
+            	DEBUG_WARN("unexpected IsolationStatus(%d)\n", sys->IsolationStatus);
+            }
+
+            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;
+        DEBUG_INFO("IsolationStatus = 3 (fault)\n");
+        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;
+        DEBUG_INFO("Undefined Isolation Status.\n");
+    }
+
+    //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;
+        DEBUG_INFO("EVSE_Shutdown\n");
+    }
+    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;
+        DEBUG_INFO("EVSE_EmergencyShutdown\n");
+    }
+    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;
+        DEBUG_ERROR("ChargingPermission = FALSE\n");
+    }
+    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_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;
+
+            DEBUG_INFO("Emergency Stop by CP Error (%d, %.02f V, %d)\n", sys->CpState, sys->CpVoltage, cab->cnt);
+            //cab->cnt = 0;
+        }
+    }
+    #endif
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_CableCheckRes(&v2gObject.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, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+    sys->ConnectorLocked = TRUE;    //Inicating EVSE that the CCS Connector is Locked.
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_CableCheckReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_CableCheckReq(&v2gObject.DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_CableCheckReq(ShmCcsData, &v2gObject.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.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_din_CableCheckRes() fail: %d (DEC)", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_CableCheckReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_CableCheckReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_CableCheckReq(ShmCcsData, &v2gObject.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.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_CableCheckRes() fail: %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param shm_ccs
+ */
+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);
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_din_PreChargeRes()
+{
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinPreChargeResType(&v2gObject.DIN.V2G_Message.Body.PreChargeRes);
+
+    v2gObject.DIN.V2G_Message.Body.PreChargeRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct dinPreChargeResType *res;
+    res = &v2gObject.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
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_iso1_PreChargeRes()
+{
+    init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1PreChargeResType(&v2gObject.ISO1.V2G_Message.Body.PreChargeRes);
+
+    v2gObject.ISO1.V2G_Message.Body.PreChargeRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct iso1PreChargeResType *res;
+    res = &v2gObject.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
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_PreChargeRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    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(&v2gObject.DIN) < 0)
+    {
+        pre->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        pre->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_DIN70121(&pre->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_DIN70121);
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid)  //0: invalid
+    {
+        pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid; //0
+        pre->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+        DEBUG_ERROR("IsolationStatus = %d\n", sys->IsolationStatus);
+    }
+    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
+    {
+    	DEBUG_ERROR("GFD_Fault => Emergency Shutdown\n");
+        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_Status(Other_Fault);
+        errn = -1;
+        DEBUG_ERROR("IsolationStatus = %d (undefined)\n", sys->IsolationStatus);
+    }
+
+    //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)
+        {
+        	DEBUG_ERROR("CCS GFD trip => EVSE_Shutdown\n");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        }
+        else
+        {
+        	DEBUG_ERROR("EVSE_Shutdown\n");
+            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)
+        {
+        	DEBUG_ERROR("CCS GFD trip => EVSE_EmergencyShutdown\n");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        }
+        else
+        {
+        	DEBUG_ERROR("EVSE_EmergencyShutdown\n");
+            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)
+    {
+    	DEBUG_ERROR("ChargingPermission = FALSE\n");
+        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_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;
+
+        DEBUG_ERROR("Emergency Stop by CP Error (%d, %.02f V)\n", sys->CpState, sys->CpVoltage);
+    }
+    #endif
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_PreChargeRes(&v2gObject.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, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_PreChargeRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    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(&v2gObject.ISO1) < 0)
+    {
+        pre->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        pre->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_ISO15118_2014(&pre->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_ISO15118_2014);
+
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid)    //0: invalid(on going)
+    {
+        pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Invalid; //0
+        pre->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+
+        DEBUG_ERROR("IsolationStatus = %d\n", sys->IsolationStatus);
+    }
+    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
+    {
+    	DEBUG_ERROR("GFD_Fault => Emergency Shutdown\n");
+        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_Status(Other_Fault);
+        errn = -1;
+
+        DEBUG_ERROR("IsolationStatus = %d (undefined)\n", sys->IsolationStatus);
+
+    }
+
+    //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)
+        {
+        	DEBUG_ERROR("CCS GFD trip => EVSE_Shutdown\n");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        }
+        else
+        {
+        	DEBUG_ERROR("EVSE_Shutdown\n");
+            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)
+        {
+        	DEBUG_ERROR("CCS GFD trip => EVSE_EmergencyShutdown\n");
+            pre->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        }
+        else
+        {
+        	DEBUG_ERROR("EVSE_EmergencyShutdown\n");
+            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)
+    {
+    	DEBUG_ERROR("ChargingPermission = FALSE\n");
+        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_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;
+
+        DEBUG_ERROR("Emergency Stop by CP Error (%d, %.02f V)\n", sys->CpState, sys->CpVoltage);
+    }
+    #endif
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_PreChargeRes(&v2gObject.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, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_PreChargeReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_PreChargeReq(&v2gObject.DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_PreChargeReq(ShmCcsData, &v2gObject.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.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_din_PreChargeRes() fail: %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_PreChargeReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_PreChargeReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_PreChargeReq(ShmCcsData, &v2gObject.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.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_PreChargeRes() fail: %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param shm_ccs
+ */
+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);
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_din_PowerDeliveryRes()
+{
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinPowerDeliveryResType(&v2gObject.DIN.V2G_Message.Body.PowerDeliveryRes);
+
+    v2gObject.DIN.V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct dinPowerDeliveryResType *res;
+    res = &v2gObject.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
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_iso1_PowerDeliveryRes()
+{
+    init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1PowerDeliveryResType(&v2gObject.ISO1.V2G_Message.Body.PowerDeliveryRes);
+
+    v2gObject.ISO1.V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct iso1PowerDeliveryResType *res;
+    res = &v2gObject.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
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_PowerDeliveryStartRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    res = &v2gObject.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(&v2gObject.DIN) < 0)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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(&v2gObject.DIN, ShmCcsData);
+    #else
+    Sudo_Parameter_din_PowerDeliveryRes();
+    #endif
+
+    //EVSE Status Code
+    res->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;  //1
+    res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_PowerDeliveryStartRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    res = &v2gObject.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(&v2gObject.ISO1) < 0)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        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(&v2gObject.ISO1, ShmCcsData);
+    #else
+    Sudo_Parameter_iso1_PowerDeliveryRes();
+    #endif
+
+    //EVSE Status Code
+    res->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1
+    res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //res->ResponseCode = FAILED_ISO15118_2014;
+        res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_PowerDeliveryStartReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_PowerDeliveryReq(&v2gObject.DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_PowerDeliveryReq(ShmCcsData, &v2gObject.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.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_din_PowerDeliveryStartRes() fail: %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_PowerDeliveryStartReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_PowerDeliveryReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_PowerDeliveryReq(ShmCcsData, &v2gObject.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.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_PowerDeliveryStartRes() fail: %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param shm_ccs
+ */
+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);
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_din_CurrentDemandRes()
+{
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinCurrentDemandResType(&v2gObject.DIN.V2G_Message.Body.CurrentDemandRes);
+
+    v2gObject.DIN.V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
+
+    //----- [BODY (1/10)] ResponseCode -----
+    struct dinCurrentDemandResType *res;
+    res = &v2gObject.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;
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_iso1_CurrentDemandRes()
+{
+    init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1CurrentDemandResType(&v2gObject.ISO1.V2G_Message.Body.CurrentDemandRes);
+
+    v2gObject.ISO1.V2G_Message.Body.CurrentDemandRes_isUsed = 1u;
+
+    //----- [BODY (1/10)] ResponseCode -----
+    struct iso1CurrentDemandResType *res;
+    res = &v2gObject.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;
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_iso1_ChargingStatusRes()
+{
+    //int i = 0;
+	struct iso1ChargingStatusResType *res;
+	init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+	init_iso1ChargingStatusResType(&v2gObject.ISO1.V2G_Message.Body.ChargingStatusRes);
+
+	res = &v2gObject.ISO1.V2G_Message.Body.ChargingStatusRes;
+	v2gObject.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((char*)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((char*)res->MeterInfo.MeterID , CCS_AC_METER_ID);
+
+    //[MeterInfo][2/5] SigMeterReading (optional)
+    //sprintf((char*)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
+}
+
+/**
+ *
+ * @param code
+ */
+void Check_EVErrorCode(int code)
+{
+    if (code != NO_ERROR)	//NO_ERROR = 0
+    {
+        //Asking CSU to Stop
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        //Update_V2G_Status(Other_Fault);
+
+        DEBUG_INFO("Stop by EV (EVErrorCode = %d (DEC))\n", code);
+    }
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_CurrentDemandRes(int AcceptFd)
+{
+    //[ 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;
+    static struct CurrentDemandResponse_DIN70121 *cur;
+    static struct ChargingInfoData *sys;
+
+//    int i = 0;
+//    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 = v2gBuffer.tx;
+    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(&v2gObject.DIN) < 0)
+    {
+        cur->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        cur->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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)
+    {
+    	DEBUG_ERROR("EvBatteryMaxCurrent is negative(%.02f) => End_Process\n", sys->EvBatteryMaxCurrent);
+
+        cur->DC_EVSEStatus.EVSEStatusCode = dinresponseCodeType_FAILED_WrongChargeParameter;    //16
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_WrongChargeParameter (023775)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 5;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_DIN70121(&cur->EVSEPresentCurrent, (int) (sys->PresentChargingCurrent * 10), A_DIN70121);
+    SAVE_PhysicalValueType_DIN70121(&cur->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_DIN70121);
+    #if TESLA_SLOW_INCREASE_CURRENT_FUNCTION == DISABLE
+    SAVE_PhysicalValueType_DIN70121(&cur->EVSEMaximumCurrentLimit, (int) (sys->AvailableChargingCurrent * 10), A_DIN70121);
+    #endif
+    SAVE_PhysicalValueType_DIN70121(&cur->EVSEMaximumPowerLimit, (int) (sys->AvailableChargingPower * 10), W_DIN70121);
+    SAVE_PhysicalValueType_DIN70121(&cur->EVSEMaximumVoltageLimit, (int) (sys->MaximumChargingVoltage * 10), V_DIN70121);
+
+
+    #if PATCH_FOR_BMW_I3_BUG_EVSEMAXIMUMVOLTAGELIMIT_599V == ENABLE
+    if (sys->EvBatteryMaxVoltage <= 500)
+    {
+        SAVE_PhysicalValueType_DIN70121(&cur->EVSEMaximumVoltageLimit, (int) (500 * 10), V_DIN70121);   //500V
+    }
+    #endif
+
+    //Limit the EVTargetCurrent should be under EVSEMaximumCurrentLimit
+    if (sys->EvBatterytargetCurrent > sys->AvailableChargingCurrent)
+    {
+        sys->EvBatterytargetCurrent = sys->AvailableChargingCurrent;
+
+        //[To-Do] Limit is achieved flag
+    }
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid)  //0:invalid (on going)
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid; //0
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        DEBUG_ERROR("IsolationStatus = %d\n", sys->IsolationStatus);
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+
+    }
+    else if (sys->IsolationStatus == GFD_Valid) //1: valid
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Valid;  //1
+    }
+    else if (sys->IsolationStatus == GFD_Warning) //2: warning
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Warning; //2
+    }
+    else if (sys->IsolationStatus == GFD_Fault) //3: fault
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;  //3
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        DEBUG_ERROR("GFD_Fault => Emergency Shutdown\n");
+        Update_V2G_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;
+        DEBUG_ERROR("IsolationStatus = %d(undefined)\n", sys->IsolationStatus);
+        Update_V2G_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)
+        {
+        	DEBUG_ERROR("[DIN]CCS GFD trip => EVSE_Shutdown\n");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        }
+        else
+        {
+        	DEBUG_ERROR("[DIN]]EVSE_Shutdown\n");
+            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)
+        {
+            DEBUG_INFO("[DIN]]CCS GFD trip => EVSE_EmergencyShutdown\n");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Fault;
+        }
+        else
+        {
+        	DEBUG_ERROR("[DIN]EVSE_EmergencyShutdown\n");
+            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)
+    {
+    	DEBUG_ERROR("[DIN]Permission OFF\n");
+        //cur->ResponseCode = FAILED_DIN70121;
+        cur->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+        //errn = -1;
+    }
+    else
+    {
+        //null
+    }
+
+    //Response to CP Error
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+    {
+        cur->ResponseCode = FAILED_DIN70121;
+        cur->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_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;
+
+        DEBUG_INFO("Emergency Stop by CP Error (%d, %.02f V)\n", sys->CpState, sys->CpVoltage);
+    }
+    #endif
+
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_CurrentDemandRes(&v2gObject.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, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_CurrentDemandRes(int AcceptFd)
+{
+    //[ 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;
+    static struct CurrentDemandResponse_ISO15118_2014 *cur;
+    static struct ChargingInfoData *sys;
+//    int i = 0;
+//    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 = v2gBuffer.tx;
+    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(&v2gObject.ISO1) < 0)
+    {
+        cur->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        cur->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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)
+    {
+    	DEBUG_ERROR("EvBatteryMaxCurrent is negative(%.02f) => End_Process\n", sys->EvBatteryMaxCurrent);
+
+        cur->ResponseCode = iso1responseCodeType_FAILED_WrongChargeParameter;   //16
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        errn = -1;
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_WrongChargeParameter (023775)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 5;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    }
+
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEPresentCurrent, (int) (sys->PresentChargingCurrent * 10), A_ISO15118_2014);
+    SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_ISO15118_2014);
+    #if TESLA_SLOW_INCREASE_CURRENT_FUNCTION == DISABLE
+    SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEMaximumCurrentLimit, (int) (sys->AvailableChargingCurrent * 10), A_ISO15118_2014);
+    #endif
+    SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEMaximumPowerLimit, (int) (sys->AvailableChargingPower * 10), W_ISO15118_2014);
+    SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEMaximumVoltageLimit, (int) (sys->MaximumChargingVoltage * 10), V_ISO15118_2014);
+
+
+    #if PATCH_FOR_BMW_I3_BUG_EVSEMAXIMUMVOLTAGELIMIT_599V == ENABLE
+    if (sys->EvBatteryMaxVoltage <= 500)
+    {
+        SAVE_PhysicalValueType_ISO15118_2014(&cur->EVSEMaximumVoltageLimit, (int) (500 * 10), V_ISO15118_2014);   //500V
+    }
+    #endif
+
+    //Limit the EVTargetCurrent should be under EVSEMaximumCurrentLimit
+    if (sys->EvBatterytargetCurrent > sys->AvailableChargingCurrent)
+    {
+        sys->EvBatterytargetCurrent = sys->AvailableChargingCurrent;
+
+        //[To-Do] Limit is achieved flag
+    }
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid) //0: invalid (on going)
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Invalid; //0
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        DEBUG_ERROR("IsolationStatus = %d\n", sys->IsolationStatus);
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+    }
+    else if (sys->IsolationStatus == GFD_Valid) //1: valid
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1
+    }
+    else if (sys->IsolationStatus == GFD_Warning) //2: warning
+    {
+        cur->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_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;
+        DEBUG_ERROR("GFD_Fault => EmergencyShutdown\n");
+        Update_V2G_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;
+        DEBUG_ERROR("IsolationStatus = %d(undefined)\n", sys->IsolationStatus);
+        Update_V2G_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)
+        {
+        	DEBUG_ERROR("CCS GFD trip => EVSE_Shutdown\n");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        }
+        else
+        {
+        	DEBUG_ERROR("EVSE_Shutdown\n");
+            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)
+        {
+        	DEBUG_ERROR("CCS GFD trip => EVSE_EmergencyShutdown\n");
+            cur->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Fault;
+        }
+        else
+        {
+        	DEBUG_ERROR("EVSE_EmergencyShutdown\n");
+            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)
+    {
+    	DEBUG_ERROR("Permission OFF\n");
+        //cur->ResponseCode = FAILED_ISO15118_2014;
+        cur->DC_EVSEStatus.EVSEIsolationStatus = (unsigned char)sys->IsolationStatus;
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+        //errn = -1;
+    }
+    else
+    {
+        //null
+    }
+
+    //Response to CP Error
+    #if CP_PROTECTION_MECHANISM == ENABLE
+    if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+    {
+        cur->ResponseCode = FAILED_ISO15118_2014;
+        cur->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        Update_V2G_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;
+
+        DEBUG_INFO("[CurrentDemand]Emergency Stop by CP Error (%d, %.02f V)\n", sys->CpState, sys->CpVoltage);
+    }
+    #endif
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_CurrentDemandRes(&v2gObject.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, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_ChargingStatusRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    res = &ShmCcsData->V2GMessage_ISO15118_2014.ChargingStatusResponse;
+    sys = &ShmSysConfigAndInfo->SysInfo.CcsChargingData[0];
+
+    //Init
+    res->ResponseCode = OK_ISO15118_2014;
+    res->ReceiptRequired = FALSE;       //optional
+    res->SAScheduleTupleID = 0;
+    res->AC_EVSEStatus.RCD = FALSE;     //FALSE(no error), TRUE(error is detected)
+    res->AC_EVSEStatus.NotificationMaxDelay = 0;
+    res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+    //	iso1EVSENotificationType_None = 0,
+    //	iso1EVSENotificationType_StopCharging = 1,
+    //	iso1EVSENotificationType_ReNegotiation = 2
+
+    //[HEADER] Check Req SessionID
+    if (Check_iso1_V2G_Rx_MSG_SessionID(&v2gObject.ISO1) < 0)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+    //EVSE ID
+    memset(res->EVSEID, 0, sizeof(res->EVSEID));
+    sprintf((char*)res->EVSEID, CCS_AC_EVSEID);
+
+    //[MeterInfo][0/5] init
+    //memset(res->MeterInfo.MeterID, 0, sizeof(res->MeterInfo.MeterID));
+    //memset(res->MeterInfo.SigMeterReading, 0, sizeof(res->MeterInfo.SigMeterReading));
+
+    //[MeterInfo][1/5] MeterID
+    //sprintf((char*)res->MeterInfo.MeterID, CCS_AC_METER_ID);
+
+    //[MeterInfo][2/5] SigMeterReading (optional)
+    //sprintf((char*)res->MeterInfo.SigMeterReading , CCS_AC_SIG_METER_READING);
+
+    //[MeterInfo][3/5] MeterStatus (optional)
+    res->MeterInfo.MeterStatus = 0;
+
+    //[MeterInfo][4/5] MeterReading (optional)
+    res->MeterInfo.MeterReading = 12345;
+
+    //[MeterInfo][5/5] TMeter (optional)
+    res->MeterInfo.TMeter = 1586243587; //Unix Time Stamp format
+
+    //STEP 2: ============ Modify Parameter of ShmCcsData ============
+    if(ShmCcsData->EnergyTransferMode == MODE_DC_EXTENDED)
+    {
+    	SAVE_PhysicalValueType_ISO15118_2014(&res->EVSEMaxCurrent, (int)(sys->AvailableChargingCurrent * 10), A_ISO15118_2014);
+
+        //Isolation Status (RCD)
+        if (sys->IsolationStatus == 0)  //Isolation is invalid
+        {
+            res->AC_EVSEStatus.RCD = TRUE;     //FALSE(no error), TRUE(error is detected)
+            res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+            CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+            DEBUG_ERROR("IsolationStatus: %d\n", sys->IsolationStatus);
+            Update_V2G_Status(Other_Fault);
+            errn = -1;
+        }
+        else if (sys->IsolationStatus == 1) //Isolation is valid
+        {
+            res->AC_EVSEStatus.RCD = FALSE;     //FALSE(no error), TRUE(error is detected)
+            res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+        }
+        else
+        {
+            res->AC_EVSEStatus.RCD = TRUE;     //FALSE(no error), TRUE(error is detected)
+            res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+            CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+            DEBUG_ERROR("IsolationStatus = %d(undefined)\n", sys->IsolationStatus);
+            Update_V2G_Status(Other_Fault);
+            errn = -1;
+        }
+
+        //Check for CSU command of "Stop by EVSE"
+        if (sys->DC_EVSEStatus == EVSE_Shutdown)
+        {
+            //res->ResponseCode = FAILED_ISO15118_2014;
+            res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+            //errn = -1;
+        }
+        else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+        {
+            //res->ResponseCode = FAILED_ISO15118_2014;
+            res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+            //errn = -1;
+        }
+        else if (ShmInternalComm->ChargingPermission == FALSE)
+        {
+            //res->ResponseCode = FAILED_ISO15118_2014;
+            res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+            //errn = -1;
+        }
+
+        //Response to CP Error
+        #if CP_PROTECTION_MECHANISM == ENABLE
+        if ((sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+        {
+            res->ResponseCode = FAILED_ISO15118_2014;
+            res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+            CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+            Update_V2G_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;
+
+            DEBUG_INFO("Emergency Stop by CP Error (%d, %.02f V)\n", sys->CpState, sys->CpVoltage);
+        }
+        #endif
+    }
+    else
+    {
+    	SAVE_PhysicalValueType_ISO15118_2014(&res->EVSEMaxCurrent, (int)(sys->AvailableChargingCurrent * 10), A_ISO15118_2014);
+
+        //Isolation Status (RCD)
+		res->AC_EVSEStatus.RCD = FALSE;     //FALSE(no error), TRUE(error is detected)
+		res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+
+		//Check for CSU command of "Stop by EVSE"
+        if (ShmInternalComm->ChargingPermission == FALSE)
+        {
+            //res->ResponseCode = FAILED_ISO15118_2014;
+            res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+            //errn = -1;
+        }
+
+        //Response to CP Error
+#if CP_PROTECTION_MECHANISM == ENABLE
+        if((sys->CpState != 3) && (sys->CpState != 4) && (sys->CpState != 5))  //State C (6V), D (3V)
+        {
+            res->ResponseCode = FAILED_ISO15118_2014;
+            res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_StopCharging;
+            CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+            Update_V2G_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;
+
+            DEBUG_ERROR("Emergency Stop by CP Error (%d, %.02f V)\n", sys->CpState, sys->CpVoltage);
+        }
+#endif
+    }
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+#if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_ChargingStatusRes(&v2gObject.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, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_CurrentDemandReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("[V2G[RX]]CurrentDemandReq\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_CurrentDemandReq(&v2gObject.DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_CurrentDemandReq(ShmCcsData, &v2gObject.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.
+        DEBUG_INFO("[V2G][TX]CurrentDemandRes\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_din_CurrentDemandRes fail: (%d,DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_CurrentDemandReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_CurrentDemandReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_CurrentDemandReq(ShmCcsData, &v2gObject.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.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_CurrentDemandRes fail: (%d,DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_ChargingStatusReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_ChargingStatusReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_ChargingStatusReq(ShmCcsData, &v2gObject.ISO1, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    //no content in ISO1
+
+    errn = Proc_iso1_ChargingStatusRes(AcceptFd);
+    if (errn == 0)
+    {
+        //Response is sent successfully.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_ChargingStatusRes() fail: (%d,DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_PowerDeliveryStopRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    res = &v2gObject.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(&v2gObject.DIN) < 0)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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(&v2gObject.DIN, ShmCcsData);
+    #else
+    Sudo_Parameter_din_PreChargeRes();
+    #endif
+
+    //EVSE Status Code
+    res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //res->ResponseCode = FAILED_DIN70121;
+        res->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_din_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_PowerDeliveryStopRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    res = &v2gObject.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(&v2gObject.ISO1) < 0)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        res->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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(ShmCcsData->EnergyTransferMode == MODE_DC_EXTENDED)
+    {
+#if PARAMETER_NORMAL_MODE == ENABLE
+		ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryResponse.DC_EVSEStatus.DC_EVSEStatusCode = EVSE_NotReady;
+		SHM_Read_iso1_PowerDeliveryRes(&v2gObject.ISO1, ShmCcsData);
+#else
+		Sudo_Parameter_iso1_PreChargeRes();
+#endif
+
+        //EVSE Status Code
+        res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready;
+        res->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Valid;  //1 /*+++ 20200808, vern, Isolation Status should be valid during 2nd PowerDelivert ---*/
+
+        //Check for CSU command of "Stop by EVSE"
+        if (sys->DC_EVSEStatus == EVSE_Shutdown)
+        {
+            //res->ResponseCode = FAILED_ISO15118_2014;
+        	res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready; /*+++ 20200808, vern, Isolation Status should be valid during 2nd PowerDelivert ---*/
+        }
+        else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+        {
+            //res->ResponseCode = FAILED_ISO15118_2014;
+            res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        }
+        else if (ShmInternalComm->ChargingPermission == FALSE)
+        {
+            //res->ResponseCode = FAILED_ISO15118_2014;
+        	res->DC_EVSEStatus.EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Ready; /*+++ 20200808, vern, Isolation Status should be valid during 2nd PowerDelivert ---*/
+        }
+    }
+    else
+    {
+#if PARAMETER_NORMAL_MODE == ENABLE
+		SHM_Read_iso1_PowerDeliveryRes(&v2gObject.ISO1, ShmCcsData);
+#endif
+
+        //EVSE Status Code
+		res->AC_EVSEStatus.RCD = 0;
+        res->AC_EVSEStatus.EVSENotification = iso1EVSENotificationType_None;
+        res->AC_EVSEStatus.NotificationMaxDelay = 10;
+
+    }
+
+    //STEP 4: ============ Encode and Send Response Message ===========
+    if (send_encoded_iso1_V2GTP_Stream(AcceptFd, &v2g_tx_stream, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_PowerDeliveryStopReq(int AcceptFd)
+{
+    int errn = 0;
+    //Request CSU to STOP
+    //This should be reponsed as soon as possible once this message is received.
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    EVCOMM_SYS_INFO.EvBatterytargetVoltage = 0;
+    EVCOMM_SYS_INFO.EvBatterytargetCurrent = 0;
+
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_PowerDeliveryReq(&v2gObject.DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_PowerDeliveryReq(ShmCcsData, &v2gObject.DIN, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_DIN70121.PowerDeliveryRequest.DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode);
+
+    //[To-Do] Sending response after the EVSE output voltage decreases to under 60V
+    usleep(1500000);    //1.5 seconds
+    //sleep(1);   //1 second
+
+    errn = Proc_din_PowerDeliveryStopRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_din_PowerDeliveryStopRes() fail: %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_PowerDeliveryStopReq(int AcceptFd)
+{
+    int errn = 0;
+    //Request CSU to STOP
+    //This should be reponsed as soon as possible once this message is received.
+    CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+    EVCOMM_SYS_INFO.EvBatterytargetVoltage = 0;
+    EVCOMM_SYS_INFO.EvBatterytargetCurrent = 0;
+
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_PowerDeliveryReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_PowerDeliveryReq(ShmCcsData, &v2gObject.ISO1, ShmSysConfigAndInfo);
+
+    //Check for EV Error Code
+    Check_EVErrorCode(ShmCcsData->V2GMessage_ISO15118_2014.PowerDeliveryRequest.DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode);
+
+    //[To-Do] Sending response after the EVSE output voltage decreases to under 60V
+    usleep(1500000);    //1.5 seconds
+    //sleep(1);   //1 second
+    errn = Proc_iso1_PowerDeliveryStopRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_PowerDeliveryStopRes fail(): %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param shm_ccs
+ */
+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);
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_din_WeldingDetectionRes()
+{
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinWeldingDetectionResType(&v2gObject.DIN.V2G_Message.Body.WeldingDetectionRes);
+
+    v2gObject.DIN.V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct dinWeldingDetectionResType *res;
+    res = &v2gObject.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
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_iso1_WeldingDetectionRes()
+{
+    init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1WeldingDetectionResType(&v2gObject.ISO1.V2G_Message.Body.WeldingDetectionRes);
+
+    v2gObject.ISO1.V2G_Message.Body.WeldingDetectionRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct iso1WeldingDetectionResType *res;
+    res = &v2gObject.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
+}
+
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_WeldingDetectionRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    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(&v2gObject.DIN) < 0)
+    {
+        wel->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        wel->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        errn = -1;
+
+        //Update_ShmStatusCode(); //[To-Do] to be implemented
+        //CCS_SECC_ResponseCode_FAILED_SequenceError (023758)
+        ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+        ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+        ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+        ShmStatusCodeData->PresentStatusCode[0][3] = 7;
+        ShmStatusCodeData->PresentStatusCode[0][4] = 5;
+        ShmStatusCodeData->PresentStatusCode[0][5] = 8;
+    }
+
+
+    //STEP 2: ============ Modifiy Parameter of ShmCcsData ============
+    SAVE_PhysicalValueType_DIN70121(&wel->EVSEPresentVoltage, (int) (sys->PresentChargingVoltage * 10), V_DIN70121);
+
+    //EVSE Status Code
+    wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Ready;
+
+    //Check for CSU command of "Stop by EVSE"
+    if (sys->DC_EVSEStatus == EVSE_Shutdown)
+    {
+        //wel->ResponseCode = FAILED_DIN70121;
+        wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //wel->ResponseCode = FAILED_DIN70121;
+        wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //wel->ResponseCode = FAILED_DIN70121;
+        wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid)  //0:invalid (on going)
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = dinisolationLevelType_Invalid; //0
+        wel->DC_EVSEStatus.EVSEStatusCode = dinDC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        DEBUG_ERROR("IsolationStatus = %d\n", sys->IsolationStatus);
+        Update_V2G_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;
+        DEBUG_ERROR("GFD_Fault => Emergency Shutdown\n");
+        Update_V2G_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;
+        DEBUG_ERROR("IsolationStatus = %d(undefined)\n", sys->IsolationStatus);
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+    }
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_din_WeldingDetectionRes(&v2gObject.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, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_WeldingDetectionRes(int AcceptFd)
+{
+    //[ 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 = v2gBuffer.tx;
+    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(&v2gObject.ISO1) < 0)
+    {
+        wel->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        wel->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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_Shutdown;
+    }
+    else if (sys->DC_EVSEStatus == EVSE_EmergencyShutdown)
+    {
+        //wel->ResponseCode = FAILED_ISO15118_2014;
+        wel->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+    }
+    else if (ShmInternalComm->ChargingPermission == FALSE)
+    {
+        //wel->ResponseCode = FAILED_ISO15118_2014;
+        wel->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_Shutdown;
+    }
+
+    //Isolation Status
+    if (sys->IsolationStatus == GFD_Invalid) //0: invalid (on going)
+    {
+        wel->DC_EVSEStatus.EVSEIsolationStatus = iso1isolationLevelType_Invalid; //0
+        wel->DC_EVSEStatus.DC_EVSEStatusCode = iso1DC_EVSEStatusCodeType_EVSE_EmergencyShutdown;
+        CSUCOMMDC_TASK_FLAG.Send_EVStopReq = TRUE;
+        DEBUG_ERROR("IsolationStatus = %d\n", sys->IsolationStatus);
+        Update_V2G_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;
+        DEBUG_ERROR("GFD_Fault => EmergencyShutdown\n");
+        Update_V2G_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;
+        DEBUG_ERROR("IsolationStatus = %d(undefined)\n", sys->IsolationStatus);
+        Update_V2G_Status(Other_Fault);
+        errn = -1;
+    }
+
+    //STEP 3: ============ Save Parameters from ShmCcsData to EXI Engine Buffer ============
+    #if PARAMETER_NORMAL_MODE == ENABLE
+    SHM_Read_iso1_WeldingDetectionRes(&v2gObject.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, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //STEP 5: ============ Update Flags ===========
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_WeldingDetectionReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_WeldingDetectionReq(&v2gObject.DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_WeldingDetectionReq(ShmCcsData, &v2gObject.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.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_din_WeldingDetectionRes() fail: %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_WeldingDetectionReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_WeldingDetectionReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_WeldingDetectionReq(ShmCcsData, &v2gObject.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.
+        DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_WeldingDetectionRes() fail: %d (DEC)", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param shm_ccs
+ */
+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;
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_din_SessionStopRes()
+{
+    init_dinBodyType(&v2gObject.DIN.V2G_Message.Body);
+    init_dinSessionStopResType(&v2gObject.DIN.V2G_Message.Body.SessionStopRes);
+
+    v2gObject.DIN.V2G_Message.Body.SessionStopRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct dinSessionStopResType *res;
+    res = &v2gObject.DIN.V2G_Message.Body.SessionStopRes;
+    res->ResponseCode = dinresponseCodeType_OK;
+}
+
+/**
+ *
+ */
+void Sudo_Parameter_iso1_SessionStopRes()
+{
+    init_iso1BodyType(&v2gObject.ISO1.V2G_Message.Body);
+    init_iso1SessionStopResType(&v2gObject.ISO1.V2G_Message.Body.SessionStopRes);
+
+    v2gObject.ISO1.V2G_Message.Body.SessionStopRes_isUsed = 1u;
+
+    //----- [BODY (1/3)] ResponseCode -----
+    struct iso1SessionStopResType *res;
+    res = &v2gObject.ISO1.V2G_Message.Body.SessionStopRes;
+    res->ResponseCode = iso1responseCodeType_OK;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_SessionStopRes(int AcceptFd)
+{
+    //[ 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;
+
+    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 = v2gBuffer.tx;
+    stp = &ShmCcsData->V2GMessage_DIN70121.SessionStopResponse;
+
+    stp->ResponseCode = OK_DIN70121;
+
+    //[HEADER] Check Req SessionID
+    if (Check_din_V2G_Rx_MSG_SessionID(&v2gObject.DIN) < 0)
+    {
+        stp->ResponseCode = dinresponseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        stp->ResponseCode = dinresponseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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(&v2gObject.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, &v2gObject.DIN) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+
+    //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
+    for(int idx=3;idx>0;idx++)
+    {
+		DEBUG_INFO("PWM 5\%% countdown: %d\n", idx);
+		sleep(1);
+    }
+    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;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_SessionStopRes(int AcceptFd)
+{
+    //[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 = v2gBuffer.tx;
+    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(&v2gObject.ISO1) < 0)
+    {
+        stp->ResponseCode = iso1responseCodeType_FAILED_UnknownSession; //6
+        DEBUG_ERROR("unmatched SessionID => End_Process\n");
+        errn = -1;
+    }
+
+    //Check for SequenceError
+    if (EVCOMM_SYS_INFO.SequenceError == TRUE)
+    {
+        stp->ResponseCode = iso1responseCodeType_FAILED_SequenceError; //5
+        DEBUG_ERROR("SequenceError => End_Process\n");
+        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(&v2gObject.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, &v2gObject.ISO1) != 0)
+    {
+    	DEBUG_ERROR("Tx encoded msg error\n");
+        errn = -1;
+    }
+
+    //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
+    for(int idx=2;idx>0;idx--)
+    {
+    	DEBUG_INFO("PWM 5\%% count down: %d\n", idx);
+    	sleep(1);
+    }
+
+    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;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_din_SessionStopReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_DIN_SessionStopReq(&v2gObject.DIN);
+
+    //Save into Share Memory
+    SHM_Save_din_SessionStopReq(ShmCcsData, &v2gObject.DIN, ShmSysConfigAndInfo);
+
+    errn = Proc_din_SessionStopRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+    	DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_din_SessionStopRes() fail: %d (DEC)", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int Proc_iso1_SessionStopReq(int AcceptFd)
+{
+    int errn = 0;
+    DEBUG_INFO("Request in.\n");
+
+    //Print the decoded XML Document
+    PRINT_XML_DOC_ISO1_SessionStopReq(&v2gObject.ISO1);
+
+    //Save into Share Memory
+    SHM_Save_iso1_SessionStopReq(ShmCcsData, &v2gObject.ISO1, ShmSysConfigAndInfo);
+
+    errn = Proc_iso1_SessionStopRes(AcceptFd);
+    if (errn == 0)
+    {
+        //send response successfully.
+    	DEBUG_INFO("Response out.\n");
+    }
+    else
+    {
+    	DEBUG_ERROR("Proc_iso1_SessionStopRes() fail: %d (DEC)\n", errn);
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+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 (v2gObject.appHandshake.supportedAppProtocolReq_isUsed == 1u)
+                {
+                    v2gObject.appHandshake.supportedAppProtocolReq_isUsed = 0;
+                    if (Proc_supportedAppProtocolReq(AcceptFd) == 0)   //0: no error
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                        Update_V2G_Status(SupportedAppProtocolResponse);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("supportedAppProtocolResReq: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SupportedAppProtocolResponse:
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionSetupRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case SessionSetupRequest:               //19
+            {
+                if (Proc_din_SessionSetupReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(SessionSetupResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("SessionSetupReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionSetupResponse:              //20
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceDiscoveryRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case ServiceDiscoveryRequest:           //21
+            {
+                if (Proc_din_ServiceDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ServiceDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ServiceDiscoveryReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceDiscoveryResponse:          //22
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceAndPaymentSelectionRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case ServiceAndPaymentSelectionRequest:     //25
+            {
+                if (Proc_din_ServiceAndPaymentSelectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ServiceAndPaymentSelectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ServiceAndPaymentSelectionReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceAndPaymentSelectionResponse:    //26
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            //case ContractAuthenticationReq:
+            case AuthorizationRequest:              //29
+            {
+                if (Proc_din_ContractAuthenticationReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(AuthorizationResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("AuthorizationReqRes: fail\n");
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("AuthorizationReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //Check for ChargeParameterDiscoveryReq
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Status(ChargeParameterDiscoveryRequest);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case ChargeParameterDiscoveryRequest:   //35
+            {
+                if (Proc_din_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ChargeParameterDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ChargeParameterDiscoveryReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ChargeParameterDiscoveryResponse:
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_ChargingParameter_Performance_Time)  //60 seconds
+                {
+                	DEBUG_ERROR("ChargingParameter Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_ChargingParameter_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("ChargeParameterDiscoveryReqRes: fail\n");
+                        Update_V2G_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;
+                    DEBUG_INFO("[V2G][RX]CableCheckReqReq: isolated?\n");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_Start);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_End);
+
+                    Update_V2G_Status(CableCheckRequest);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #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_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(&timerStart.SeqStart);
+                    #endif
+
+                    if (Proc_din_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case CableCheckRequest:                 //37
+            {
+                //STEP 3: Execute Cable Check Process
+                if (Proc_din_CableCheckReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(CableCheckResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("CableCheckReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case CableCheckResponse:                //38
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_CableCheck_Performance_Time)  //38 seconds
+                {
+                    //DEBUG_INFO("[CableCheck] end counting...\n");
+                	DEBUG_ERROR("CableCheck Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_CableCheck_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("CableCheckReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //STEP 3: Check for PreChargeReq message
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == PreChargeRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Status(PreChargeRequest);
+                    DEBUG_INFO("[V2G][RX]PreChargeReqReq: waiting for pre-charge voltage...\n");
+
+                    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(&timerStart.SeqStart);
+                    #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_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(&timerStart.SeqStart);
+                    #endif
+
+                    if (Proc_din_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case PreChargeRequest:                  //39
+            {
+                if (Proc_din_PreChargeReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PreChargeResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("PreChargeReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PreChargeResponse:                 //40
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_PreCharge_Performance_Time)  //5 seconds
+                {
+                	DEBUG_ERROR("Precharge Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_PreCharge_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("PreChargeReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //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_Status(PowerDeliveryRequestStart);
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Precharge_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStart:         //41
+            {
+                if (Proc_din_PowerDeliveryStartReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PowerDeliveryResponsetStart);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("PowerDeliveryStartReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponsetStart:        //42
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                if (v2gObject.DIN.V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+                {
+                    ftime(&timerStart.SeqEnd);
+                    if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > 2000)  //5 seconds
+                    {
+                    	DEBUG_ERROR("Wait for CurrentDemandReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), 2000);
+                        Update_V2G_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_Status(CurrentDemandRequest);
+                    DEBUG_INFO("[V2G][RX]CurrentDemandReqReq: energy transfering...\n");
+
+                    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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case CurrentDemandRequest:              //45,
+            {
+                if (Proc_din_CurrentDemandReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(CurrentDemandResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("CurrentDemandReqRes: fail\n");
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("CurrentDemandReqRes: fail\n");
+                        Update_V2G_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_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(&timerStart.SeqStart);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStop:          //49,
+            {
+                if (Proc_din_PowerDeliveryStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PowerDeliveryResponseStop);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else
+                {
+                	DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponseStop:        //50,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > 2000)  //2 seconds
+                {
+                	DEBUG_ERROR("Wait for WeldingDetectionReq or SessionStopReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), 2000);
+                    Update_V2G_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_Status(WeldingDetectionRequest);
+                    DEBUG_INFO("[V2G][RX]WeldingDetectionReq: ongoing...\n");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_WeldingDetection_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_Status(SessionStopRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_din_SessionStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Status(SessionStopResponse);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("SessionStopReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case WeldingDetectionRequest:           //51,
+            {
+                if (Proc_din_WeldingDetectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(WeldingDetectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("WeldingDetectionReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case WeldingDetectionResponse:          //52,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_WeldingDetection_Performance_Time)  //20 seconds
+                {
+                	DEBUG_ERROR("Wait for SessionStopReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_WeldingDetection_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("WeldingDetectionReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //STEP 3: Check for SessionStopReq Message
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case SessionStopRequest:                //53,
+            {
+                if (Proc_din_SessionStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(SessionStopResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("SessionStopReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionStopResponse:               //54,
+            {
+                break;
+            }
+            //-------------------------------------------
+            default:
+            {
+                break;
+            }
+        }
+        usleep(1000);
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+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 (v2gObject.appHandshake.supportedAppProtocolReq_isUsed == 1u)
+                {
+                    v2gObject.appHandshake.supportedAppProtocolReq_isUsed = 0;
+                    if (Proc_supportedAppProtocolReq(AcceptFd) == 0)   //0: no error
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                        Update_V2G_Status(SupportedAppProtocolResponse);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("supportedAppProtocolResReq: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SupportedAppProtocolResponse:
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionSetupRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case SessionSetupRequest:               //19
+            {
+                if (Proc_iso1_SessionSetupReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(SessionSetupResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("SessionSetupReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionSetupResponse:              //20
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceDiscoveryRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case ServiceDiscoveryRequest:           //21
+            {
+                if (Proc_iso1_ServiceDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ServiceDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ServiceDiscoveryReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceDiscoveryResponse:          //22
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceAndPaymentSelectionRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case ServiceAndPaymentSelectionRequest:     //25
+            {
+                if (Proc_iso1_ServiceAndPaymentSelectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ServiceAndPaymentSelectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ServiceAndPaymentSelectionReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceAndPaymentSelectionResponse:    //26
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            //case ContractAuthenticationReq:
+            case AuthorizationRequest:              //29
+            {
+                if (Proc_iso1_AuthenticationReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(AuthorizationResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("AuthorizationReqRes: fail\n");
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("AuthorizationReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //Check for ChargeParameterDiscoveryReq
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Status(ChargeParameterDiscoveryRequest);
+                    DEBUG_INFO("[V2G][RX]ChargeParameterDiscoveryReq: CSU Permission?\n");
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case ChargeParameterDiscoveryRequest:   //35
+            {
+                if (Proc_iso1_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ChargeParameterDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ChargeParameterDiscoveryReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ChargeParameterDiscoveryResponse:
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_ChargingParameter_Performance_Time)  //60 seconds
+                {
+                	DEBUG_ERROR("ChargingParameter Timeout - (%.02lf of %d ms)\n",
+											DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd),
+											V2G_SECC_ChargingParameter_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("ChargeParameterDiscoveryReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //STEP 2: Check for CableCheckReq message
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CableCheckRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    DEBUG_INFO("[V2G][RX]CableCheckReqReq: isolated?\n");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_Start);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_CableCheck_Timer_End);
+
+                    Update_V2G_Status(CableCheckRequest);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #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_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(&timerStart.SeqStart);
+                    #endif
+
+                    if (Proc_iso1_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+                break;
+            }
+            //-------------------------------------------
+            case CableCheckRequest:                 //37
+            {
+                //STEP 3: Execute Cable Check Process
+                if (Proc_iso1_CableCheckReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(CableCheckResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("CableCheckReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case CableCheckResponse:                //38
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_CableCheck_Performance_Time)  //38 seconds
+                {
+                    //DEBUG_INFO("[CableCheck] end counting...\n");
+                	DEBUG_ERROR("CableCheck Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_CableCheck_Performance_Time);
+                    Update_V2G_Status(Sequence_Timeout);
+
+                    //Update_ShmStatusCode(); //[To-Do] to be implemented
+                    //CCS_SECC_TIMEOUT_V2G_CableCheck_Performance_Time (023847)
+                    ShmStatusCodeData->PresentStatusCode[0][0] = 0;
+                    ShmStatusCodeData->PresentStatusCode[0][1] = 2;
+                    ShmStatusCodeData->PresentStatusCode[0][2] = 3;
+                    ShmStatusCodeData->PresentStatusCode[0][3] = 8;
+                    ShmStatusCodeData->PresentStatusCode[0][4] = 4;
+                    ShmStatusCodeData->PresentStatusCode[0][5] = 7;
+                    break;
+                }
+                #endif
+
+                //STEP 2: Check for CableCheckReq message
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == CableCheckRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    //STEP 3: Execute Cable Check Process
+                    if (Proc_iso1_CableCheckReq(AcceptFd) == 0)
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("CableCheckReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //STEP 3: Check for PreChargeReq message
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == PreChargeRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Status(PreChargeRequest);
+                    DEBUG_INFO("[V2G][RX]PreChargeReqReq: waiting for pre-charge voltage...\n");
+
+                    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(&timerStart.SeqStart);
+                    #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_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(&timerStart.SeqStart);
+                    #endif
+
+                    if (Proc_iso1_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case PreChargeRequest:                  //39
+            {
+                if (Proc_iso1_PreChargeReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PreChargeResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("PreChargeReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PreChargeResponse:                 //40
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_PreCharge_Performance_Time)  //5 seconds
+                {
+                	DEBUG_ERROR("Precharge Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_PreCharge_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("PreChargeReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //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_Status(PowerDeliveryRequestStart);
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Precharge_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStart:         //41
+            {
+                if (Proc_iso1_PowerDeliveryStartReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PowerDeliveryResponsetStart);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("PowerDeliveryStartReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponsetStart:        //42
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                if (v2gObject.ISO1.V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+                {
+                    ftime(&timerStart.SeqEnd);
+                    if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > 2000)  //5 seconds
+                    {
+                    	DEBUG_ERROR("Wait for CurrentDemandReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), 2000);
+                        Update_V2G_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_Status(CurrentDemandRequest);
+                    DEBUG_INFO("[V2G][RX]CurrentDemandReqReq: energy transfering...\n");
+
+                    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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {}
+                break;
+            }
+            //-------------------------------------------
+            case CurrentDemandRequest:              //45,
+            {
+                if (Proc_iso1_CurrentDemandReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(CurrentDemandResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("CurrentDemandReqRes: fail\n");
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("CurrentDemandReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //STEP 2: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_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(&timerStart.SeqStart);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStop:          //49,
+            {
+                if (Proc_iso1_PowerDeliveryStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PowerDeliveryResponseStop);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else
+                {
+                	DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponseStop:        //50,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > 2000)  //2 seconds
+                {
+                	DEBUG_ERROR("Wait for WeldingDetectionReq or SessionStopReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), 2000);
+                    Update_V2G_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_Status(WeldingDetectionRequest);
+                    DEBUG_INFO("[V2G][RX]WeldingDetectionReq: ongoing...\n");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_WeldingDetection_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_Status(SessionStopRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso1_SessionStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Status(SessionStopResponse);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("SessionStopReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case WeldingDetectionRequest:           //51,
+            {
+                if (Proc_iso1_WeldingDetectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(WeldingDetectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("WeldingDetectionReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case WeldingDetectionResponse:          //52,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_WeldingDetection_Performance_Time)  //20 seconds
+                {
+                	DEBUG_ERROR("Wait for SessionStopReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_WeldingDetection_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("WeldingDetectionReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //STEP 3: Check for SessionStopReq Message
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+
+                break;
+            }
+            //-------------------------------------------
+            case SessionStopRequest:                //53,
+            {
+                if (Proc_iso1_SessionStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(SessionStopResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("SessionStopReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionStopResponse:               //54,
+            {
+                break;
+            }
+            //-------------------------------------------
+            default:
+            {
+                break;
+            }
+        }
+        usleep(1000);
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+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 (v2gObject.appHandshake.supportedAppProtocolReq_isUsed == 1u)
+                {
+                    v2gObject.appHandshake.supportedAppProtocolReq_isUsed = 0;
+                    if (Proc_supportedAppProtocolReq(AcceptFd) == 0)   //0: no error
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                        Update_V2G_Status(SupportedAppProtocolResponse);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("supportedAppProtocolResReq: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SupportedAppProtocolResponse:      //18
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionSetupRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n",EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {}
+
+                break;
+            }
+            //-------------------------------------------
+            case SessionSetupRequest:               //19
+            {
+                if (Proc_iso1_SessionSetupReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(SessionSetupResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("SessionSetupReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionSetupResponse:              //20
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceDiscoveryRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {}
+
+                break;
+            }
+            //-------------------------------------------
+            case ServiceDiscoveryRequest:           //21
+            {
+                if (Proc_iso1_ServiceDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ServiceDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ServiceDiscoveryReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceDiscoveryResponse:          //22
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceAndPaymentSelectionRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {}
+
+                break;
+            }
+            //-------------------------------------------
+            case ServiceAndPaymentSelectionRequest: //25
+            {
+                if (Proc_iso1_ServiceAndPaymentSelectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ServiceAndPaymentSelectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ServiceAndPaymentSelectionReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceAndPaymentSelectionResponse://26
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {}
+
+                break;
+            }
+            //-------------------------------------------
+            //case ContractAuthenticationReq:
+            case AuthorizationRequest:              //29
+            {
+                if (Proc_iso1_AuthenticationReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(AuthorizationResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("AuthorizationReqRes: fail\n");
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("AuthorizationReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //Check for ChargeParameterDiscoveryReq
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ChargeParameterDiscoveryRequest)
+                {
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                    Update_V2G_Status(ChargeParameterDiscoveryRequest);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {}
+
+                break;
+            }
+            //-------------------------------------------
+            case ChargeParameterDiscoveryRequest:   //35
+            {
+                if (Proc_iso1_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ChargeParameterDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ChargeParameterDiscoveryReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ChargeParameterDiscoveryResponse:  //36
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+    	        ftime(&timerStart.SeqEnd);
+    	        if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_ChargingParameter_Performance_Time)  //60 seconds
+    	        {
+    	        	DEBUG_ERROR("ChargingParameter Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_ChargingParameter_Performance_Time);
+    	            Update_V2G_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
+                    {
+                    	DEBUG_ERROR("ChargeParameterDiscoveryReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+
+                //STEP 3: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_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(&timerStart.SeqStart);
+			#endif
+/*
+                    if(Proc_iso1_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                        DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }*/
+    		#if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+            #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+
+                }
+                break;
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStart:         //41
+            {
+                if (Proc_iso1_PowerDeliveryStartReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PowerDeliveryResponsetStart);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("PowerDeliveryStartReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponsetStart:       //42
+            {
+                //STEP 1: Check for Process Timeout
+			#if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                if (v2gObject.ISO1.V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+                {
+                    ftime(&timerStart.SeqEnd);
+                    if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > 2000)  //5 seconds
+                    {
+                    	DEBUG_ERROR("Wait for ChargingStatusReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), 2000);
+                        Update_V2G_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_Status(ChargingStatusRequest);
+                    DEBUG_INFO("[V2G][RX]ChargingStatusReq: energy transfering...\n");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_ChargingStatus_Timer_Start);
+                }
+                else
+                {}
+
+                break;
+            }
+            //-------------------------------------------
+            case ChargingStatusRequest:             //43
+            {
+                if (Proc_iso1_ChargingStatusReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ChargingStatusResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ChargingStatusRes: fail\n");
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("ChargingStatusRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    req_is_responsed = TRUE;
+                }
+                //STEP 2: Wait for PowerDeliveryReq Message
+                else if((EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStop) ||
+                        (EVCOMM_SYS_INFO.V2G_Rx_Msg == PowerDeliveryRequestStart))
+                {
+                    Update_V2G_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(&timerStart.SeqStart);
+				#endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {}
+
+                break;
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStop:          //49
+            {
+                if (Proc_iso1_PowerDeliveryStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PowerDeliveryResponseStop);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+
+				#if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+				#endif
+                }
+                else
+                {
+                	DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponseStop:         //50
+            {
+                //STEP 1: Check for Process Timeout
+			#if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > 2000)  //2 seconds
+                {
+                	DEBUG_ERROR("Wait for SessionStopReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), 2000);
+                    Update_V2G_Status(Sequence_Timeout);
+                    break;
+                }
+			#endif
+
+                //STEP 3: Check for SessionStopReq Message
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_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))
+                {
+                	if((EVCOMM_SYS_INFO.V2G_Rx_Msg != ChargeParameterDiscoveryRequest))
+                	{
+						DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+						EVCOMM_SYS_INFO.SequenceError = TRUE;
+                	}
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {}
+
+                break;
+            }
+            case SessionStopRequest:                //53
+            {
+                if (Proc_iso1_SessionStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(SessionStopResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("SessionStopReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionStopResponse:               //54
+            {
+                break;
+            }
+            default:
+            {
+                break;
+            }
+        }
+        usleep(1000);
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @param EnergyTransferMode
+ * @return
+ */
+int V2gMsg_Process_iso1(int AcceptFd, unsigned char EnergyTransferMode)
+{
+    switch (EnergyTransferMode)
+    {
+        case DC_extended:
+        {
+        	//DEBUG_INFO("EnergyTransferMode: DC_extended\n");
+            V2gMsg_Process_iso1_DC(AcceptFd);
+            break;
+        }
+
+        case AC_single_phase_core:
+        case AC_three_phase_core:
+        {
+        	//DEBUG_INFO("EnergyTransferMode: AC_single_phase_core or AC_three_phase_core\n");
+            V2gMsg_Process_iso1_AC(AcceptFd);
+            break;
+        }
+
+        default:
+        {
+        	DEBUG_WARN("Unexpected EnergyTransferMode: (%d)\n", EnergyTransferMode);
+            break;
+        }
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+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 (v2gObject.appHandshake.supportedAppProtocolReq_isUsed == 1u)
+                {
+                    v2gObject.appHandshake.supportedAppProtocolReq_isUsed = 0;
+                    if (Proc_supportedAppProtocolReq(AcceptFd) == 0)   //0: no error
+                    {
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                        Update_V2G_Status(SupportedAppProtocolResponse);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("supportedAppProtocolResReq: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SupportedAppProtocolResponse:
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionSetupRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {}
+
+                break;
+            }
+            //-------------------------------------------
+            case SessionSetupRequest:               //19
+            {
+                if (Proc_iso2_SessionSetupReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(SessionSetupResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("SessionSetupReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case SessionSetupResponse:              //20
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceDiscoveryRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {}
+
+                break;
+            }
+    #if 0
+            //-------------------------------------------
+            case ServiceDiscoveryRequest:           //21
+            {
+                if (Proc_iso2_ServiceDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ServiceDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ServiceDiscoveryReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceDiscoveryResponse:          //22
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == ServiceAndPaymentSelectionRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ServiceAndPaymentSelectionRequest:     //25
+            {
+                if (Proc_iso2_ServiceAndPaymentSelectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ServiceAndPaymentSelectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ServiceAndPaymentSelectionReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ServiceAndPaymentSelectionResponse:    //26
+            {
+                if (EVCOMM_SYS_INFO.V2G_Rx_Msg == AuthorizationRequest)
+                {
+                    Update_V2G_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            //case ContractAuthenticationReq:
+            case AuthorizationRequest:              //29
+            {
+                if (Proc_iso2_AuthenticationReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(AuthorizationResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("AuthorizationReqRes: fail\n");
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("AuthorizationReqRes: fail\n");
+                        Update_V2G_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_Status(ChargeParameterDiscoveryRequest);
+                    DEBUG_INFO("[V2G][RX]ChargeParameterDiscoveryReq: CSU Permission?\n");
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case ChargeParameterDiscoveryRequest:   //35
+            {
+                if (Proc_iso2_ChargeParameterDiscoveryReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(ChargeParameterDiscoveryResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("ChargeParameterDiscoveryReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case ChargeParameterDiscoveryResponse:
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_ChargingParameter_Performance_Time)  //60 seconds
+                {
+                	DEBUG_ERROR("ChargingParameter Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_ChargingParameter_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("ChargeParameterDiscoveryReqRes: fail\n");
+                        Update_V2G_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_Status(CableCheckRequest);
+                    DEBUG_INFO("[V2G][RX]CableCheckReqReq: isolated?\n");
+
+                    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(&timerStart.SeqStart);
+                    #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_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(&timerStart.SeqStart);
+                    #endif
+
+                    if (Proc_iso2_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case CableCheckRequest:                 //37
+            {
+                //STEP 3: Execute Cable Check Process
+                if (Proc_iso2_CableCheckReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(CableCheckResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("CableCheckReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case CableCheckResponse:                //38
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_CableCheck_Performance_Time)  //38 seconds
+                {
+                    //DEBUG_INFO("[CableCheck] end counting...\n");
+                	DEBUG_ERROR("CableCheck Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_CableCheck_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("CableCheckReqRes: fail\n");
+                        Update_V2G_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_Status(PreChargeRequest);
+                    DEBUG_INFO("[V2G][RX]PreChargeReqReq: waiting for pre-charge voltage...\n");
+
+                    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(&timerStart.SeqStart);
+                    #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_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(&timerStart.SeqStart);
+                    #endif
+
+                    if (Proc_iso2_PowerDeliveryStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Status(PowerDeliveryResponseStop);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PreChargeRequest:                  //39
+            {
+                if (Proc_iso2_PreChargeReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PreChargeResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("PreChargeReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PreChargeResponse:                 //40
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_PreCharge_Performance_Time)  //5 seconds
+                {
+                	DEBUG_ERROR("Pre-charge Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_PreCharge_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("PreChargeReqRes: fail\n");
+                        Update_V2G_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_Status(PowerDeliveryRequestStart);
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Precharge_Timer_End);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStart:         //41
+            {
+                if (Proc_iso2_PowerDeliveryStartReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PowerDeliveryResponsetStart);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("PowerDeliveryStartReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponsetStart:        //42
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                if (v2gObject.ISO2.V2G_Message.Body.PowerDeliveryReq_isUsed == 1u)
+                {
+                    ftime(&timerStart.SeqEnd);
+                    if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > 2000)  //5 seconds
+                    {
+                    	DEBUG_ERROR("Wait for CurrentDemandReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), 2000);
+                        Update_V2G_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_Status(CurrentDemandRequest);
+                    DEBUG_INFO("[V2G][RX]CurrentDemandReqReq: energy transfering...\n");
+
+                    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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case CurrentDemandRequest:              //45,
+            {
+                if (Proc_iso2_CurrentDemandReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(CurrentDemandResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("CurrentDemandReqRes: fail\n");
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("CurrentDemandReqRes: fail\n");
+                        Update_V2G_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_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(&timerStart.SeqStart);
+                    #endif
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case PowerDeliveryRequestStop:          //49,
+            {
+                if (Proc_iso2_PowerDeliveryStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(PowerDeliveryResponseStop);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else
+                {
+                	DEBUG_ERROR("PowerDeliveryStopReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case PowerDeliveryResponseStop:        //50,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > 2000)  //2 seconds
+                {
+                	DEBUG_ERROR("Wait for WeldingDetectionReq or SessionStopReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), 2000);
+                    Update_V2G_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_Status(WeldingDetectionRequest);
+                    DEBUG_INFO("[V2G][RX]WeldingDetectionReq: ongoing...\n");
+
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_WeldingDetection_Timer_Start);
+
+                    #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                    ftime(&timerStart.SeqStart);
+                    #endif
+                }
+                else if(EVCOMM_SYS_INFO.V2G_Rx_Msg == SessionStopRequest)
+                {
+                    Update_V2G_Status(SessionStopRequest);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+
+                    if (Proc_iso2_SessionStopReq(AcceptFd) == 0)
+                    {
+                        Update_V2G_Status(SessionStopResponse);
+                        ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                    }
+                    else
+                    {
+                    	DEBUG_ERROR("SessionStopReqRes: fail\n");
+                        Update_V2G_Status(Other_Fault);
+                    }
+                    break;
+                }
+                else if (EVCOMM_SYS_INFO.V2G_Rx_Msg >= SupportedAppProtocolRequest &&
+                         EVCOMM_SYS_INFO.V2G_Rx_Msg <= SessionStopRequest)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case WeldingDetectionRequest:           //51,
+            {
+                if (Proc_iso2_WeldingDetectionReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(WeldingDetectionResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("WeldingDetectionReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                break;
+            }
+            case WeldingDetectionResponse:          //52,
+            {
+                //STEP 1: Check for Process Timeout
+                #if V2G_SECC_TIMEOUT_PROTECTION == ENABLE
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > V2G_SECC_WeldingDetection_Performance_Time)  //20 seconds
+                {
+                	DEBUG_ERROR("Wait for SessionStopReq Timeout - (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), V2G_SECC_WeldingDetection_Performance_Time);
+                    Update_V2G_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
+                    {
+                    	DEBUG_ERROR("WeldingDetectionReqRes: fail\n");
+                        Update_V2G_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_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)
+                {
+                	DEBUG_ERROR("SequenceError(%d) => Tx Res MSG\n", EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.SequenceError = TRUE;
+
+                    Update_V2G_Status(EVCOMM_SYS_INFO.V2G_Rx_Msg);
+                    EVCOMM_SYS_INFO.V2G_Rx_Msg = 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+            //-------------------------------------------
+            case SessionStopRequest:                //53,
+            {
+                if (Proc_iso2_SessionStopReq(AcceptFd) == 0)
+                {
+                    Update_V2G_Status(SessionStopResponse);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+                }
+                else
+                {
+                	DEBUG_ERROR("SessionStopReqRes: fail\n");
+                    Update_V2G_Status(Other_Fault);
+                }
+                req_is_responsed = TRUE;
+                //break;
+            }
+            case SessionStopResponse:               //54,
+            {
+                break;
+            }
+    #endif
+            //-------------------------------------------
+            default:
+            {
+                break;
+            }
+        }
+        usleep(1000);
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int V2gMsg_Process_iso2_AC(int AcceptFd)
+{
+
+	return 0;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @param EnergyTransferMode
+ * @return
+ */
+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:
+        {
+        	DEBUG_WARN("Unexpected EnergyTransferMode: (%d)\n", EnergyTransferMode);
+            break;
+        }
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+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:
+        {
+        	DEBUG_WARN("Unexpected Communication Protocol: (%d)\n", ShmCcsData->CommProtocol);
+            break;
+        }
+    }
+
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int V2gMsg_Rx(int AcceptFd)
+{
+    int errn = 0;
+    unsigned int packet_size = 0;
+
+    memset(v2gBuffer.rx, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+    packet_size = recv(AcceptFd, v2gBuffer.rx, V2GTP_MSG_RX_BUFFER_SIZE, 0);
+    //[CAUTION] Everytime recv() is called, it will take a default time to wait for TCP packets.
+    //The more time you call recv(), the more time you will waste here.
+    //Here it is suggested that response immediatedly once you receive any packets.
+    //For configuring the Rx waiting time, please use setsockopt().
+
+    if(packet_size > 0) //[Joseph] If there is no data, ignore. (TBD)
+    {
+        //DEBUG_PRINTF_EVCOMM_DETAIL("\n\n Got TCP V2GTP Message: size = %d Bytes\n", packet_size);
+        errn = V2gMsgDecoder(v2gBuffer.rx, packet_size, V2gFlowStatus);
+        if (errn < 0)
+        {
+        	DEBUG_ERROR("V2gMsgDecoder fail: (%d)\n", errn);
+        }
+    }
+    return errn;
+}
+
+/**
+ *
+ * @param AcceptFd
+ * @return
+ */
+int V2gComm(int AcceptFd)
+{
+    int errn = 0;
+
+    if (V2gMsg_Rx(AcceptFd) < 0)
+    {
+        Update_V2G_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;
+}
+
+/**
+ *
+ * @return
+ */
+int SdpUdpConnected()
+{
+    int packet_size,Rtn;
+    struct sockaddr_in6 ServerAddr,ClientAddr;
+    struct V2gtpHeader *header;
+    unsigned char *payload;
+
+    // UDP server initial
+    if(socketFd.Udp <= 0)
+    {
+        if ((socketFd.Udp = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+        {
+        	DEBUG_ERROR("Fail to open UdpSock\n");
+            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(socketFd.Udp, (struct sockaddr *)&ServerAddr, sizeof(struct sockaddr_in6)) < 0)
+        {
+        	DEBUG_ERROR("Fail to bind UdpSock(%d)\n", socketFd.Udp);
+
+            close(socketFd.Udp);
+            socketFd.Udp = -1;
+            return 0;
+        }
+
+        DEBUG_INFO("[UDP] opened(%d), port: %d\n", socketFd.Udp, SdpUdpServerPort);
+        DEBUG_INFO("[UDP] Wait connect request from EVCC\n");
+    }
+
+    // Receive packet from udp server
+    memset(v2gBuffer.rx, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+    memset(&ClientAddr, 0, sizeof(struct sockaddr_in));
+    Rtn = sizeof(struct sockaddr_in6);
+    packet_size = recvfrom(socketFd.Udp, v2gBuffer.rx, V2GTP_MSG_RX_BUFFER_SIZE, MSG_DONTWAIT, (struct sockaddr *)&ClientAddr, (socklen_t *)&Rtn);
+    if(packet_size > 0)
+    {
+    	char buf[128];
+        header = (struct V2gtpHeader *) v2gBuffer.rx;
+        payload = v2gBuffer.rx+sizeof(struct V2gtpHeader);
+
+		DEBUG_PRINTF_EVCOMM_DETAIL("Got UDP packet_size: %d (Bytes)\n", packet_size);
+		DEBUG_PRINTF_EVCOMM_DETAIL("***********************************\n");
+		DEBUG_PRINTF_EVCOMM_DETAIL("***** Received SDP Packet *****\n");
+		DEBUG_PRINTF_EVCOMM_DETAIL("***********************************\n");
+
+		memset(buf, 0x00, ARRAY_SIZE(buf));
+		for(Rtn = 0; Rtn < 16; Rtn += 2)
+		{
+			sprintf(buf, "%s%02x%02x:", buf, ClientAddr.sin6_addr.s6_addr[Rtn],ClientAddr.sin6_addr.s6_addr[Rtn+1]);
+		}
+		DEBUG_PRINTF_EVCOMM_DETAIL("ClientAddress: %s\n", buf);
+		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));
+
+        if( (header->ProtocolVersion == 0x01) &&
+            (header->InverseProtocolVersion == 0xFE) &&
+            (htons(header->PayloadType) == V2GTP_PAYLOAD_TYPE_SDP_REQUEST))
+        {
+            DEBUG_INFO("[UDP] Get connect request from EVCC: (%d)\n", socketFd.Udp);
+            DEBUG_PRINTF_EVCOMM_DETAIL("Security: 0x%02X\n", *(payload + 0));
+            DEBUG_PRINTF_EVCOMM_DETAIL("TransportProtocol: 0x%02X\n", *(payload + 1));
+
+            header->PayloadType = htons(V2GTP_PAYLOAD_TYPE_SDP_RESPONSE);
+            header->PayloadLength = htonl(20);    //Fixed Length=20
+            memset(payload, 0, 20);
+            // MAC address[0:2] + FFFE + MAC address[3:5]
+            payload[0] = (IPV6_LINK_LOCAL_PREFIX>>8) & 0xFF;
+            payload[1] = IPV6_LINK_LOCAL_PREFIX & 0xFF;
+#ifdef TEST_WITH_ETH0
+            payload[8] = macAddr.eth0[0];
+			payload[8] ^= 0x02;// bit 1 should complemented.
+			payload[9] = macAddr.eth0[1];
+			payload[10] = macAddr.eth0[2];
+			payload[11] = 0xFF;
+			payload[12] = 0xFE;
+			payload[13] = macAddr.eth0[3];
+			payload[14] = macAddr.eth0[4];
+			payload[15] = macAddr.eth0[5];
+#else
+
+            payload[8] = macAddr.eth1[0];
+            payload[8] ^= 0x02;// bit 1 should complemented.
+            payload[9] = macAddr.eth1[1];
+            payload[10] = macAddr.eth1[2];
+            payload[11] = 0xFF;
+            payload[12] = 0xFE;
+            payload[13] = macAddr.eth1[3];
+            payload[14] = macAddr.eth1[4];
+            payload[15] = macAddr.eth1[5];
+#endif
+            // Report TCP port
+            payload[16] = (EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active>>8) & 0xFF;
+            payload[17] = EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active & 0xFF;
+            payload[18] = SDP_PAYLOAD_SECURITY_NONE;      //Security
+            payload[19] = SDP_PAYLOAD_TRANS_PROTOCOL_TCP; //Transport protocol
+
+            // TODO:
+            // 	Setup the TCP in advance to receive the coming TCP handshake messages after SDP response.
+            Rtn = sendto(socketFd.Udp, v2gBuffer.rx, sizeof(struct V2gtpHeader) + htonl(header->PayloadLength), 0, (struct sockaddr *)&ClientAddr, sizeof(struct sockaddr_in6));
+            DEBUG_INFO("[UDP] Response to EVCC\n");
+			DEBUG_PRINTF_EVCOMM_DETAIL("***** Response SDP Packet *****\n");
+			DEBUG_PRINTF_EVCOMM_DETAIL("Send size: %d\n", Rtn);
+
+			memset(buf, 0x00, ARRAY_SIZE(buf));
+			for(Rtn = 0; Rtn < 16; Rtn++)
+			{
+				sprintf(buf, "%s%02x ", buf, ClientAddr.sin6_addr.s6_addr[Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("Destination Address: %s\n", buf);
+			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));
+
+			memset(buf, 0x00, ARRAY_SIZE(buf));
+			for(Rtn = 0; Rtn < 16; Rtn++)
+			{
+				sprintf(buf, "%s%02x:", buf, payload[Rtn]);
+			}
+			DEBUG_PRINTF_EVCOMM_DETAIL("SECC Ipv6 Address: %s\n", buf);
+			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]);
+
+            if(Rtn > 0)
+            {
+                return 1;
+            }
+        }
+    }
+
+    return 0;
+}
+
+/**
+ *
+ * @return
+ */
+int V2gTcpConnected()
+{
+    int Rtn,AcceptFd;
+    char buf[128];
+    struct sockaddr_in6 ServerAddr,ClientAddr;
+
+    // Initial TCP server
+    if(socketFd.Tcp <= 0)
+    {
+        if ((socketFd.Tcp = socket(PF_INET6, SOCK_STREAM, 0)) < 0)
+        {
+        	DEBUG_ERROR("Fail to open TcpSock (%s)\n", strerror(errno));
+            usleep(100000);
+
+            return 0;
+        }
+        fcntl(socketFd.Tcp, F_SETFL, O_NONBLOCK);    //set to O_NONBLOCK
+        DEBUG_INFO("[TCP]Socket set: DONE.\n");
+
+        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);
+        if(bind(socketFd.Tcp, (struct sockaddr *)&ServerAddr, sizeof(struct sockaddr_in6)) < 0)
+        {
+        	DEBUG_ERROR("Fail to bind TcpSock(%s), SdpTcpServerPort: %d\n", strerror(errno), EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active);
+
+            if(bind(socketFd.Tcp, (struct sockaddr *)&ServerAddr, sizeof(struct sockaddr_in6)) < 0)
+            {
+                DEBUG_INFO("[Error Fail to bind TcpSock(%s), SdpTcpServerPort: %d\n", strerror(errno), EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active);
+                usleep(100000);
+                close(socketFd.Tcp);
+                socketFd.Tcp = -1;
+
+                return 0;
+            }
+            DEBUG_INFO("[TCP]bind: DONE\n");
+        }
+
+
+        DEBUG_INFO("[TCP]listen: START\n");
+        if(listen(socketFd.Tcp, 1) == -1)     //only accept one connection
+        {
+        	DEBUG_ERROR("Fail to listen TcpSock(%s)", strerror(errno));
+            usleep(100000);
+            close(socketFd.Tcp);
+            socketFd.Tcp = -1;
+
+            return 0;
+        }
+        DEBUG_INFO("[TCP]listen: DONE\n");
+        DEBUG_INFO("[TCP]TcpSock: opened(%d), port=%d\n", socketFd.Tcp, htons(ServerAddr.sin6_port));
+        DEBUG_INFO("[TCP]accept: START\n");
+    }
+
+    // Wait connection in
+    Rtn = sizeof(struct sockaddr_in6);
+    if((AcceptFd = accept(socketFd.Tcp, (struct sockaddr *)&ClientAddr, (socklen_t *)&Rtn)) == -1)
+    {
+        static BOOL tmp = 0;
+        if (tmp == 0)
+        {
+            DEBUG_INFO("[TCP]Wait TCP connection...\n");
+            tmp = 1;
+        }
+        else
+        {
+            //DEBUG_PRINTF_EVCOMM_DETAIL(".");
+        }
+        return 0;
+    }
+    DEBUG_INFO("[TCP]Accept: DONE\n");
+
+	DEBUG_PRINTF_EVCOMM_DETAIL("Accept one TCP connection:\n");
+	DEBUG_PRINTF_EVCOMM_DETAIL("AcceptFd: %d\n",AcceptFd);
+
+	memset(buf, 0x00, ARRAY_SIZE(buf));
+	for(Rtn = 0; Rtn < 16; Rtn += 2)
+	{
+		sprintf(buf, "%s%02x%02x:", buf, ClientAddr.sin6_addr.s6_addr[Rtn], ClientAddr.sin6_addr.s6_addr[Rtn+1]);
+	}
+	DEBUG_PRINTF_EVCOMM_DETAIL("ClientAddress: %s\n", buf);
+	DEBUG_PRINTF_EVCOMM_DETAIL("ClientPort: %d\n", ClientAddr.sin6_port);
+
+    return AcceptFd;
+}
+
+/**
+ *
+ * @return
+ */
+int End_Process()
+{
+    if(EVCOMM_SYS_INFO.End_Process_inused == TRUE)
+    {
+        DEBUG_INFO("End_Process has been triggered by another event.\n");
+        return -1;
+    }
+    DEBUG_INFO("Entering...\n");
+
+    //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
+    DEBUG_INFO("Close RAW, UDP, TCP sockets...\n");
+    if(socketFd.Raw > 0)
+    {
+        close(socketFd.Raw);
+    }
+    if(socketFd.Udp > 0)
+    {
+        close(socketFd.Udp);
+    }
+    if(socketFd.Tcp > 0)
+    {
+        close(socketFd.Tcp);
+        close(socketFd.TcpAccept);
+    }
+    socketFd.Raw = socketFd.Udp = socketFd.Tcp = socketFd.TcpAccept = -1;
+
+    //STEP 3: Switch to State E
+    //SwitchCpStateE(ENABLE);
+
+    //STEP 4: Close tcpdump
+    Sniffer_Tcpdump(DISABLE);
+
+    //STEP 5: Keep 100% PWM for 5 seconds
+    OutputCpPwmDuty(100);
+    for(int idx=5;idx>0;idx--)
+    {
+    	DEBUG_INFO("Wait PWM switch to 100%% count down: %d\n", idx);
+    	sleep(1);
+    }
+
+    qcaInfo.AttenProfileCnt = 0;
+    init_appHandEXIDocument(&v2gObject.appHandshake);
+    // Qca7kPowerReset();  //reset QCA7000 /* +++ 20200808, vern, should disconnected PLC connection after session stop ---*/
+
+    #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == DISABLE)
+    {
+        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)
+    for(uint8_t idx=5;idx>0;idx--)
+    {
+    	DEBUG_INFO("Wait CP change to State E count down: %d\n", idx);
+    	sleep(1);
+    }
+    #endif
+
+    //Reset Memory
+    unsigned char SlaveAddress_backup;
+    unsigned int matched_backup;
+    //unsigned char state_backup;
+
+    #if (FIRMWARE_VERSION_COMPILE_SETTING_RELEASE_MODE == DISABLE)
+    {
+        system("sync");
+    }
+    #endif
+
+    sleep(1);
+
+    //Backup CsuComm flags
+    SlaveAddress_backup = ShmInternalComm->SlaveAddress;
+    matched_backup = CSUCOMMDC_TASK_FLAG.matched;
+    //state_backup = Get_V2G_Status();
+
+    memset(v2gBuffer.rx, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+    memset(v2gBuffer.tx, 0, V2GTP_MSG_TX_BUFFER_SIZE);
+    memset(&v2gObject.appHandshake, 0, sizeof(struct appHandEXIDocument));
+    memset(&v2gObject.DIN, 0, sizeof(struct dinEXIDocument));
+    memset(ShmStatusCodeData, 0, sizeof(struct StatusCodeData));
+    memset(ShmInternalComm, 0, sizeof(struct InternalComm));
+    memset(ShmCcsData, 0, sizeof(struct CcsData));
+
+    //Resume CsuComm flags
+    ShmInternalComm->SlaveAddress = SlaveAddress_backup;
+    CSUCOMMDC_TASK_FLAG.matched = matched_backup;
+    Sniffer_Candump(DISABLE);
+    Sniffer_Candump(ENABLE);
+
+    DEBUG_INFO("---------------------------------------------\n");
+    DEBUG_INFO("--               EVCOMM: END               --\n");
+    DEBUG_INFO("---------------------------------------------\n");
+    system("pkill Module_CCS");
+    while(1)
+    {
+        //wait for CSU confirm
+    	usleep(1000);
+    }
+}
+
+/**
+ *
+ * @return
+ */
+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
+    srand(time(NULL));
+    value_random = rand();
+    EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active = (unsigned short)(SdpTcpServerPort + (value_random % 10000) + 1);
+    DEBUG_INFO("TCP Port assign: %d\n", EVCOMM_SYS_INFO.SDP_TCP_Server_Port_active);
+
+    //Step 2: Init SessionID
+    srand(time(NULL));
+    value_random = rand();
+    memcpy(&EVCOMM_SYS_INFO.SessionID[0], &value_random, 4);
+
+    srand(time(NULL));
+    value_random = rand();
+    memcpy(&EVCOMM_SYS_INFO.SessionID[4], &value_random, 4);
+
+    DEBUG_INFO("SessionID: (%02X%02X%02X%02X%02X%02X%02X%02X)\n",
+							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]);
+
+    return 0;
+}
+
+/**
+ *
+ * @return
+ */
+int SyncAcShreaMemory()
+{
+#if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) || (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+	pid_t pid;
+
+	pid = fork();
+	if(pid == 0)
+	{
+		for(;;)
+		{
+			if(!EVCOMM_SYS_INFO.End_Process_inused)
+			{
+				//========================================
+				// CSU -> CCS setting
+				//========================================
+				// Heart beat
+				ShmDispenser->gun_info.acCcsInfo.CcsHeartBeat++;
+
+				// Permission
+				if(ShmInternalComm->ChargingPermission != ShmDispenser->gun_info.acCcsInfo.ChargingPermission)
+				{
+					DEBUG_INFO("AC permission: %d -> %d\n", ShmInternalComm->ChargingPermission, ShmDispenser->gun_info.acCcsInfo.ChargingPermission);
+					ShmInternalComm->ChargingPermission_new = ShmDispenser->gun_info.acCcsInfo.ChargingPermission;
+					ShmInternalComm->ChargingPermission_pre = ShmInternalComm->ChargingPermission;
+					ShmInternalComm->ChargingPermission = ShmInternalComm->ChargingPermission_new;
+				}
+
+				// CP
+				ShmInternalComm->AC_CpPositiveVoltage = ShmDispenser->gun_info.acCcsInfo.CpPositiveVoltage;
+				if(ShmInternalComm->AC_CpPresentState != ShmDispenser->gun_info.acCcsInfo.CpPresentState)
+				{
+					DEBUG_INFO("CP state: %d -> %d\n", ShmInternalComm->AC_CpPresentState, ShmDispenser->gun_info.acCcsInfo.CpPresentState);
+					ShmInternalComm->AC_CpPresentState = ShmDispenser->gun_info.acCcsInfo.CpPresentState;
+				}
+
+				// Charging parameter
+				ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].AvailableChargingCurrent = ShmInternalComm->AvailableChargingCurrent = ShmDispenser->gun_info.targetCurrent;
+
+				// RCD status sync
+				ShmInternalComm->AC_RcdStatus = 0;
+
+				// EVSENotification
+				ShmInternalComm->AC_EVSENotification = 0;//ShmCharger->gun_info[gun_index].acCcsInfo.EVSENotification;
+
+				//========================================
+				// CCS -> CSU check
+				//========================================
+				// V2G message flow status
+				if(ShmDispenser->gun_info.acCcsInfo.PresentMsgFlowStatus != Get_V2G_Status())
+				{
+					//DEBUG_INFO("PresentMsgFlowStatus: %d -> %d\n", ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus, Get_V2G_Status());
+					ShmDispenser->gun_info.acCcsInfo.PresentMsgFlowStatus = Get_V2G_Status();
+
+					switch(ShmDispenser->gun_info.acCcsInfo.PresentMsgFlowStatus)
+					{
+						case PowerDeliveryRequestStart ... SessionStopRequest:
+							ShmDispenser->gun_info.acCcsInfo.EVChargeProgress = HLC_START_MODE;
+							break;
+						case CM_SLAC_PARM_REQ ... PreChargeResponse:
+							ShmDispenser->gun_info.acCcsInfo.EVChargeProgress = HLC_STANDBY_MODE;
+							break;
+						default:
+							ShmDispenser->gun_info.acCcsInfo.EVChargeProgress = HLC_STOP_MODE;
+							break;
+					}
+				}
+			}
+
+
+			usleep(1000);
+		}
+	}
+#endif
+
+	return 0;
+}
+
+/**
+ *
+ * @param argc
+ * @param argv
+ * @return
+ */
+int main(int argc, char *argv[])
+{
+    DEBUG_INFO("---------------------------------------------\n");
+    DEBUG_INFO("--               EVCOMM: START             --\n");
+    DEBUG_INFO("---------------------------------------------\n");
+    // QCA7000 chip reset
+	Qca7kPowerReset();
+
+    // Share memory Initialization
+    ShareMemory_Init();
+    memset(ShmSysConfigAndInfo, 0, sizeof(struct SysConfigAndInfo));
+
+    // Release socket handler
+    if(socketFd.Raw > 0)
+    {
+        close(socketFd.Raw);
+    }
+    if(socketFd.Udp > 0)
+    {
+        close(socketFd.Udp);
+    }
+    if(socketFd.Tcp > 0)
+    {
+        close(socketFd.Tcp);
+    }
+
+    socketFd.Raw = socketFd.Udp = socketFd.Tcp = -1;
+    Update_V2G_Status(IDLE);
+
+
+    //Init V2G TCP/IPv6 packets buffer
+    memset(v2gBuffer.rx, 0, V2GTP_MSG_RX_BUFFER_SIZE);
+    memset(v2gBuffer.tx, 0, V2GTP_MSG_TX_BUFFER_SIZE);
+
+    //Release State E Control
+    SwitchCpStateE(DISABLE);
+    OutputCpPwmDuty(100);
+
+    //start to detect CP pilot state
+    pid.CP_Detection = 0;
+    CP_Detection();     //fork1
+    DEBUG_INFO("[fork1]CP Detection: ON\n");
+
+    //start to detect errors
+    Error_Monitor();    //fork2
+    DEBUG_INFO("[fork2]Error Monitor: ON\n");
+
+    //start to detect PP
+    pid.PP_Detection = 0;
+#if (PP_PROTECTION_MECHANISM == ENABLE)
+    PP_Detection();
+    DEBUG_INFO("[fork3]PP Detection: ON\n");
+#else
+    DEBUG_INFO("[fork3]PP Detection: OFF\n");
+#endif
+
+    // Get network interface MAC address
+    GetEthMac((uint8_t*)"eth0", macAddr.eth0);
+    GetEthMac((uint8_t*)QcaInterface, macAddr.eth1);
+
+    // XML parser initialization
+    qcaInfo.AttenProfileCnt = 0;
+    init_appHandEXIDocument(&v2gObject.appHandshake);
+
+    // Init Energy transfer mode
+    // TODO:
+    // 	1. Parsing Model Name
+    ShmCcsData->EnergyTransferMode = CCS_ENERGY_TRANSFER_MODE;
+
+    Parameters_Init();
+    Sniffer_Tcpdump(TCPDUMP_PACKETS_SNIFFER_SWITCH);
+#if (TCPDUMP_PACKETS_SNIFFER_SWITCH == ENABLE)
+    sleep(1); //wait for TCP dump getting ready
+#endif
+
+    // AC share memory exchange
+    SyncAcShreaMemory();
+    DEBUG_INFO("[fork4]AC share memory exchange: ON\n");
+
+    DEBUG_INFO("Module_CCS initialize OK.\n");
+
+    for(;;)
+    {
+        if(!EVCOMM_SYS_INFO.End_Process_inused)
+        {
+            if(V2gFlowStatus < SLACC_SDP_UDP_Connection)
+            {
+                SlacComm();
+            }
+            else if(V2gFlowStatus == SLACC_SDP_UDP_Connection)
+            {
+                if(SdpUdpConnected() == 1)
+                {
+                	Update_V2G_Status(SLACC_SDP_TCP_Connection);
+                	continue;
+                }
+                SlacComm(); //TC_SECC_VTB_CmSlacMatch_004
+                ftime(&timerStart.SeqEnd);
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > TT_match_join)
+                {
+                	DEBUG_ERROR("Wait SLACC_SDP_UDP_Connection Timeout - TT_match_join (%.02lf of %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), TT_match_join);
+                    Update_V2G_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((socketFd.TcpAccept = V2gTcpConnected()) > 0)
+                {
+                    Update_V2G_Status(SupportedAppProtocolRequest);
+                    ftime(&EVCOMM_SYS_INFO.V2G_SECC_Sequence_Timer_Start);
+
+                    continue;
+                }
+                SlacComm();
+                ftime(&timerStart.SeqEnd);
+
+                if(DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd) > TT_match_join)
+                {
+                	DEBUG_ERROR("Wait SLACC_SDP_TCP_Connection Timeout - TT_match_join (%.02lf / %d ms)\n", DiffTimeb(timerStart.SeqStart, timerStart.SeqEnd), TT_match_join);
+                    Update_V2G_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(socketFd.TcpAccept) < 0)
+                {
+                    //error occurs
+                }
+            }
+            else if (V2gFlowStatus >= Performance_Timeout)
+            {
+                //End_Process
+            }
+            else
+            {}
+        }
+        else
+        {
+        	// TODO:
+        	//	1. After complete or error occur task do not need to end
+
+        	//Update_V2G_Status(IDLE);
+            //SwitchCpStateE(DISABLE);
+            //OutputCpPwmDuty(100);
+        }
+
+        usleep(1000);
+    } //while
+}//main while

+ 234 - 0
EVSE/Projects/AX80/Apps/CCS/Module_CCS.h

@@ -0,0 +1,234 @@
+/*
+ * Module_CCS.h
+ *
+ *  Created on: 2020¦~3¤ë16¤é
+ *      Author: foluswen
+ */
+
+#ifndef MODULE_CCS_H_
+#define MODULE_CCS_H_
+
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<sys/socket.h>
+#include 	<netinet/in.h>
+#include 	<net/if.h>
+#include 	<net/ethernet.h>
+#include 	<linux/if_packet.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+
+#include 	"SystemLogMessage.h"
+#include 	"NidNmk.h"
+#include	"v2g/api/api.h"
+#include	"v2g/transport/v2gtp.h"
+
+//#define TEST_WITH_ETH0
+
+#define	QcaInterface						"eth1"
+#define SupportBcbToggle
+#define	SdpUdpServerPort					15118
+#define	SdpTcpServerPort					55000		//49152-65535
+#define	IPV6_LINK_LOCAL_PREFIX				0xFE80
+#define V2GTP_MSG_RX_BUFFER_SIZE            (64*1024)   //65,536 = 65.5KB
+#define V2GTP_MSG_TX_BUFFER_SIZE            (64*1024)   //65,536 = 65.5KB
+#define V2GTP_MSG_HEADER_LENGTH             8           //8 Bytes
+
+/***********************************************/
+/*********** Ethernet Type ********************/
+/**********************************************/
+#define EtherType_HomePlug					0x88E1
+
+/***********************************************/
+/*** MMTYPE (Management Message Type) **/
+/**********************************************/
+#define MMTYPE_CM_SET_KEY_REQ					0x6008
+#define MMTYPE_CM_SET_KEY_CNF					0x6009
+#define MMTYPE_CM_SLAC_PARM_REQ					0x6064
+#define MMTYPE_CM_SLAC_PARM_CNF					0x6065
+#define MMTYPE_CM_START_ATTEN_CHAR_IND			0x606A
+#define MMTYPE_CM_MNBC_SOUND_IND				0x6076
+#define MMTYPE_CM_ATTEN_CHAR_IND				0x606E
+#define MMTYPE_CM_ATTEN_CHAR_RSP				0x606F
+#define MMTYPE_CM_VALIDATE_REQ					0x6078
+#define MMTYPE_CM_VALIDATE_CNF					0x6079
+#define MMTYPE_CM_SLAC_MATCH_REQ				0x607C
+#define MMTYPE_CM_SLAC_MATCH_CNF				0x607D
+#define MMTYPE_CM_ATTEN_PROFILE_IND				0x6086
+//following are the vendor specific type
+#define MMTYPE_VENDOR_VS_HOST_ACTION	 		0xA062		//Embedded Host Action Requested Indication MME
+#define MMTYPE_VENDOR_ATTEN_CHAR				0xA14E		//Attenuation Characteristics MME (VS_ATTEN_CHAR)
+#define MMTYPE_VENDOR_VS_NW_INFO				0xA038		//Network Info MME
+#define MMTYPE_VENDOR_VS_NW_INFO_CNF			0xA039		//Network Info MME
+#define MMTYPE_VENDOR_VS_PL_LNK_STATUS       	0xA0B8      //Powerline Link Status /*+++ 20200808, vern, for PLC connection monitoring ---*/
+#define MMTYPE_VENDOR_VS_PL_LNK_STATUS_CNF    	0xA0B9      //Powerline Link Status /*+++ 20200808, vern, for PLC connection monitoring ---*/
+
+/***********************************************/
+/************** V2GTP Payload Type ************/
+/**********************************************/
+#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+400)   //unit: 1ms (default: 600ms)
+#define C_EV_match_MNBC                     0x0A
+#define TT_EVSE_SLAC_init                   50          //unit: sec.
+#define TT_match_sequence                   400         //unit: ms
+#define TP_match_response                   100         //unit: ms, General performance time for a response to a request
+#define TT_match_response                   (200*3)     //unit: ms, Time that the EV/EVSE shall wait for a response from the EVSE/EV
+#define TP_EV_batch_msg_interval            (50*3)      //unit: ms
+#define TT_EVSE_match_session               10000       //unit: ms
+#define TT_match_join                       (12000*2)   //unit: ms
+
+#define V2G_SECC_ReadyToCharge_Performance_Time             148000  //unit: ms (148 sec)
+#define V2G_SECC_CommunicationSetup_Performance_Time        18000   //unit: ms (18 sec)
+#define V2G_SECC_ChargingParameter_Performance_Time         60000   //unit: ms (60 sec)
+//#define V2G_SECC_ChargingParameter_Performance_Time       120000   //unit: ms (120 sec)
+#define V2G_SECC_CableCheck_Performance_Time                38000   //unit: ms (38 sec)
+//#define V2G_SECC_CableCheck_Performance_Time              60000   //unit: ms (extend to 60 sec)
+//#define V2G_SECC_PreCharge_Performance_Time                 5000    //unit: ms (5 sec)
+#define V2G_SECC_PreCharge_Performance_Time                 10000   //unit: ms (extend to 10 sec)
+#define V2G_SECC_WeldingDetection_Performance_Time          20000   //unit: ms (20 sec)
+#define V2G_SECC_CPState_Detection_Timeout                  1500    //unit: ms (1.5 sec)
+#define V2G_SECC_CPOscillator_Retain_Timeout                1500    //unit: ms (1.5 sec)
+
+#define V2G_EVCC_Msg_Timeout_SupportedAppProtocolReq        2000    //unit: ms (1.5 sec)
+#define V2G_EVCC_Msg_Timeout_SessionSetupReq                2000    //unit: ms (1.5 sec)
+#define V2G_EVCC_Msg_Timeout_ServiceDiscoveryReq            2000
+#define V2G_EVCC_Msg_Timeout_ServicePaymentSelectionReq     2000
+#define V2G_EVCC_Msg_Timeout_ContractAuthenticationReq      2000
+#define V2G_EVCC_Msg_Timeout_ChargeParameterDiscoveryReq    2000
+#define V2G_EVCC_Msg_Timeout_PowerDeliveryReq               2000
+#define V2G_EVCC_Msg_Timeout_CableCheckReq                  2000
+#define V2G_EVCC_Msg_Timeout_PreChargeReq                   2000
+#define V2G_EVCC_Msg_Timeout_CurrentDemandReq               25
+#define V2G_EVCC_Msg_Timeout_WeldingDetectionReq            2000
+#define V2G_EVCC_Msg_Timeout_SessionStopReq                 2000
+#define V2G_SECC_Sequence_Timeout                           60000   //unit: ms (default: 60000, i.e. 60 sec)
+#define V2G_SECC_QCA7000_GET_MAC_ADDR_REQ_RETRY_PERIOD      3000    //unit: ms (default: 3000, i.e. 3 sec)
+#define V2G_SECC_QCA7000_SEND_SET_KEY_PERIOD                2000    //unit: ms (default: 2000, i.e. 2 sec)
+#define V2G_SECC_QCA7000_COMM_TIMEOUT                       10000   //unit: ms (default: 10000, i.e. 20 sec)
+//[To-Do] to be continued. (DIN 70121, Table 75)
+
+#define V2G_SECC_CP_Timeout_CableCheck                      2000    //unit: ms (default: 2 sec)
+
+#define DIN_SPEC_70121_2012_VersionNumberMajor              2
+#define DIN_SPEC_70121_2012_VersionNumberMinor              0
+#define ISO1_15118_2013_VersionNumberMajor                  2
+#define ISO1_15118_2013_VersionNumberMinor                  0
+#define ISO2_15118_2018_VersionNumberMajor                  2
+#define ISO2_15118_2018_VersionNumberMinor                  0
+
+
+//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
+
+/***********************************************/
+/*************** 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));
+
+typedef struct MODULE_INFO
+{
+	struct timeb	startTime[10];
+	uint8_t 	    QCA7K_SetKey_status;
+}Module_Info;
+
+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();
+
+
+
+#endif /* MODULE_CCS_H_ */

+ 300 - 0
EVSE/Projects/AX80/Apps/CCS/NidNmk.c

@@ -0,0 +1,300 @@
+/*===========================================================================
+                    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;
+}

+ 40 - 0
EVSE/Projects/AX80/Apps/CCS/NidNmk.h

@@ -0,0 +1,40 @@
+/*===========================================================================
+                    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 []);
+

BIN
EVSE/Projects/AX80/Apps/CCS/QCA7000_Flash_001823078881.bin


+ 69 - 0
EVSE/Projects/AX80/Apps/CCS/SystemLogMessage.c

@@ -0,0 +1,69 @@
+/*
+ * Module_CCS.c
+ *
+ *  Created on: 2020/03/16
+ *      Author: foluswen
+ */
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include	"SystemLogMessage.h"
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%03ld]%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/1000),
+			buffer,
+			tm->tm_year+1900,tm->tm_mon+1);
+
+#ifdef SystemLogMessage
+	system((const char*)Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%03ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,(tv.tv_usec/1000), buffer);
+#endif
+
+	return rc;
+}

+ 37 - 0
EVSE/Projects/AX80/Apps/CCS/SystemLogMessage.h

@@ -0,0 +1,37 @@
+/*
+ * Module_CCS.c
+ *
+ *  Created on: 2020/03/16
+ *      Author: foluswen
+ */
+#ifndef SystemLogMessage_H
+#define SystemLogMessage_H
+
+#define SystemLogMessage            //for engineer to do analysis
+//#define ConsloePrintLog
+
+#define SAVE_SYS_LOG_MSG_EVCOMM
+//#define DEBUG_PRINTF_EVCOMM_DETAIL_SHOW
+
+// Normal debug Message
+#ifdef SAVE_SYS_LOG_MSG_EVCOMM
+	#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+	#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+	#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#else
+    #define DEBUG_INFO(...)
+	#define DEBUG_WARN(...)
+	#define DEBUG_ERROR(...)
+#endif
+
+// Detail debug Message, will effect SLAC if enable
+#ifdef DEBUG_PRINTF_EVCOMM_DETAIL_SHOW
+	#define DEBUG_PRINTF_EVCOMM_DETAIL(format, args...) StoreLogMsg("[%s:%d][%s][Detail] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#else
+	#define DEBUG_PRINTF_EVCOMM_DETAIL(...)
+#endif
+
+
+int StoreLogMsg(const char *fmt, ...);
+
+#endif

+ 2583 - 0
EVSE/Projects/AX80/Apps/CCS/define_ccs.h

@@ -0,0 +1,2583 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 define.h
+
+                        initiated by Vern, Joseph
+                           (since 2019/07/19)
+   =============================================================================*/
+
+#ifndef DEFINE_H_
+#define DEFINE_H_
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+#include <sys/timeb.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 ARRAY_SIZE(A)				(sizeof(A) / sizeof(A[0]))
+#define PASS						1
+#define FAIL			   			-1
+#define ENABLE						1
+#define	DISABLE						0
+#define ON							1
+#define	OFF							0
+
+/**************************************************************************************/
+/*********************************System Limitation**********************************/
+/**************************************************************************************/
+
+#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*/
+enum V2GT_MSG_PROTOCOL
+{
+	V2GT_MSG_PROTOCOL_DIN70121=0,
+	V2GT_MSG_PROTOCOL_ISO15118_2014,			//i.e. ISO15118-2 (ISO 1)
+	V2GT_MSG_PROTOCOL_ISO15118_2018,			//i.e. ISO15118-20 (ISO 2)
+	V2GT_MSG_PROTOCOL_HIGHEST_PRIORITY=255		//for auto detect highest priority protocol
+};
+
+#define V2GT_MSG_PROTOCOL_PREFERENCE                V2GT_MSG_PROTOCOL_ISO15118_2014
+#define CCS_ENERGY_TRANSFER_MODE                    MODE_AC_SINGLE_PHASE_CORE
+                                                    //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       DISABLE	//default: ENABLE: release; DISABLE: debug
+#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_GET_PERMISSION_IN_AUTHORIZATIONRES
+
+#define TCPDUMP_PACKETS_SNIFFER_SWITCH                      ENABLE	//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
+enum EV_STOP_TYPE
+{
+	EV_NORMAL_STOP=1,
+	EV_EMERGENCY_STOP
+};
+
+//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
+
+#define CSUCOMMDC_TASK_FLAG        (ShmInternalComm->InternalCommUnion.bits)
+#define CSUCOMMAC_SHM              (ShmDispenser->gun_info.acCcsInfo)
+#define EVCOMM_SYS_INFO            (ShmSysConfigAndInfo->SysInfo.CcsChargingData[0])
+#define SLAC_INFO                  (ShmSysConfigAndInfo->SysInfo.CcsChargingData[0].evcc_slac_data)
+#define CCS_HANDSHAKE_PROTOCOLS    (v2gObject.appHandshake.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
+
+/**************************************************************************************/
+/****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
+	unsigned char		WifiNetworkConn;			//0: disconnected, 1: connected
+};
+
+struct TeleConfigData
+{
+	unsigned char		TelcomModelName[64];		//default: Null
+	unsigned char		TelcomSoftwareVer[64];		//default: Null
+	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		TelcomSimIccid[22];			//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, 6: HSPA, 7: LTE 9: Unknown
+	unsigned char		TelcomIpAddress[16];		//default: Null
+	unsigned char		TelcomNetworkConn;			//0: disconnected, 1: connected
+	unsigned char		TelcomEnabled;				//0: disable, 1: enable
+};
+
+struct BillingConfigData
+{
+	unsigned char		isBilling;					//0:not for business	1:for business
+	unsigned char		Currency;					//
+	float				Fee[24];					//fee for 24 hours
+	float 				Cur_fee;					// display current fee
+};
+
+struct BtConfigData
+{
+	unsigned char		LoginCentralID[64];			//default: Null
+	unsigned char		isLogin;					//0: Central device non-login	1: Central device login
+	unsigned char		isRequestStart;				//0: no action	1: request start charging
+	unsigned char		isRequestStop;				//0: no action	1: request stop charging
+};
+
+struct LED
+{
+	unsigned char 			Intensity;					// LED bar intensity	0: Darkest	1: Medium	2: Brightest
+
+	unsigned char			Red[3];						// Red color	0~100, element 0: IDLE		1: CHARGING		2: FAULT
+	unsigned char			Green[3];					// Green color	0~100, element 0: IDLE		1: CHARGING		2: FAULT
+	unsigned char			Blue[3];					// Blue color	0~100, element 0: IDLE		1: CHARGING		2: FAULT
+};
+
+struct LCD_OVERRIDE
+{
+    unsigned char           page_index;                 // LCD override page index
+    unsigned char           duration;                   // LCD override duration
+    unsigned char           isOverideReq:1;             // LCD override request
+};
+
+struct TTIA
+{
+    unsigned char   server_addr[512];                   // Target server address
+    unsigned int    server_port;                        // Target server port
+    unsigned int    busVenderId;                        // Bus vender id, 0~65535
+    unsigned char   EquipmentProvider[16];              // EVSE vender max 15 bytes
+    unsigned char   TransportationCompanyNo;            // Data provider company number
+    unsigned char   ChargeBoxId;                        // 1 byte
+    unsigned char   evseStation[16];                    // UTF-8 15 bytes, Chinese 5 words
+    unsigned char   isEnableTTIA:1;                     // TTIA function enable
+};
+
+typedef struct
+{
+    unsigned char DispenserSequence;                    // dispenser sequence
+    unsigned char MaxConnectorQuantity;                 // max connector quantity
+    unsigned char WiringSetting[8];                     // record connector quantity of dispenser
+    unsigned char PowerCabinetReserved[32];
+}WiringInfoData;
+
+struct SysConfigData
+{
+	/**************System***************/
+	unsigned char 			CsuBootLoadFwRev[32];			//CSU board bootloader firmware version
+	unsigned char			ModelName[64];				//charger model name
+	unsigned char			AcModelName[64];			//for third gun (DC + AC)
+	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			AcPhaseCount;				//AC EVSE power phase quantity,  1: One phase	3: Three phase
+	unsigned char			AuthorisationMode;			//0: enable, 1: disable
+	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
+	unsigned char			PsuAcInputType;				//0: 220, 1: 277
+	unsigned short			RatingCurrent;				//0: Depend on Model name,	1 ~ rating value amp
+	unsigned short			AcRatingCurrent;			//for third gun; 0: Depend on Model name,	1 ~ rating value amp
+	unsigned char			isAPP;						//for AuthorisationMode=0; 0:false, 1:true
+	unsigned char			isQRCode;					//for AuthorisationMode=0; 0:false, 1:true
+	unsigned char			isRFID;						//for AuthorisationMode=0; 0:false, 1:true
+	unsigned char			QRCodeMadeMode;				//for isQRCode=1 ; 0: default	1:customized
+	unsigned char			QRCodeContent[128];			//for QRCodeMadeMode=1
+	unsigned char			TotalConnectorCount;		//Connector count
+	unsigned char 			AcConnectorCount;			// For DC type
+	unsigned char			SwitchDebugFlag;			// Console Debug
+	unsigned char			AlwaysGfdFlag;
+	/**************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			AcMaxChargingCurrent;		//for third gun; 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.
+	struct BillingConfigData BillingData;
+	/**************Network***************/
+	unsigned char 			FtpServer[256];				//the ftp server for Phihong server to do data transimission
+	struct EthConfigData	Eth0Interface;
+	struct EthConfigData	Eth1Interface;
+	struct WifiConfigData 	AthInterface;
+	struct TeleConfigData	TelecomInterface;
+	struct BtConfigData		Bluetooth;
+	/**************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 char			chargePointVendor[20];		//the Vendor of the ChargePoint
+    unsigned char           OcppSecurityProfile;        //OCPP security profile 0~3
+    unsigned char           OcppSecurityPassword[41];   //OCPP AuthorizationKey for security profile
+	unsigned int 			Checksum;					//4 bytes checksum
+	struct LED				LedInfo;					// LED configuration info
+	unsigned char			ShowInformation;
+	unsigned char           isReqFirstUpgrade;          //EVSE is request first upgrade from PH server
+	unsigned char           isEnableLocalPowerSharging; //0: Disable power sharing  1: Enable power sharing
+	unsigned char           StopChargingByButton;       //0: Disable  1: Enable
+    struct LCD_OVERRIDE     LcdOveride;                 // LCD override info
+    struct TTIA             TTIA_Info;                  // TTIA configuration struct
+
+    /************PowerCabinet************/
+    WiringInfoData          WiringInfo;
+
+    unsigned char           OcppReceiptrURL[512];       // Charging receipt display URL
+    unsigned char           isAuthrizeByEVCCID;         // is Authorize by EVCCID (CCS)
+};
+
+#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_

+ 5081 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/api/api.c

@@ -0,0 +1,5081 @@
+/*===========================================================================
+                    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 "Module_CCS.h"
+//#include "../../CsuComm.h"
+#include "define_ccs.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)
+
+
+
+/**
+ *
+ * @param fmt
+ * @return
+ */
+int StoreLogV2GMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%03ld]%s\" >>  /Storage/SystemLog/[%04d.%02d]CCS_V2gLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,(tv.tv_usec/1000),
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
+
+
+	system((const char*)Buf);
+	return rc;
+}
+
+/*===========================================================================
+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;
+	unsigned char buffer[1024]={0};
+
+	for(i = 0; i < len; i++)
+	{
+		sprintf((char*)buffer, "%s%c ", buffer, (char)string[i]);
+	}
+
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("%s\n", buffer);
+}
+
+/*===========================================================================
+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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("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("SessionStopReq_isUsed: YES (10a , 10b)\n");
+		EVCOMM_SYS_INFO.V2G_Rx_Msg = SessionStopRequest;
+	}
+	else
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[Error]unidentified V2G_Rx_Msg\n");
+		errn = -1;
+	}
+
+	//Compare with the previous Message
+	if (EVCOMM_SYS_INFO.V2G_Rx_Msg_pre != EVCOMM_SYS_INFO.V2G_Rx_Msg)
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[V2G_RX_MSG]%d >> %d\n",
+										EVCOMM_SYS_INFO.V2G_Rx_Msg_pre,
+										EVCOMM_SYS_INFO.V2G_Rx_Msg);
+		EVCOMM_SYS_INFO.V2G_Rx_Msg_pre = EVCOMM_SYS_INFO.V2G_Rx_Msg;
+	}
+
+	return errn;
+}
+
+/*===========================================================================
+FUNCTION: SAVE_PhysicalValueType_DIN70121
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SAVE_PhysicalValueType_DIN70121(struct PhysicalValueType_DIN70121 *out, int in_value, unsigned char unit)
+{
+    out->Value = in_value;
+    out->Unit = unit;
+
+    switch (unit)
+    {
+        case H_DIN70121:
+        case M_DIN70121:
+        case S_DIN70121:
+        case A_DIN70121:
+        case V_DIN70121:
+        case AH_DIN70121:
+        case VA_DIN70121:
+            out->Multiplier = -1;
+            break;    //KW
+
+        case W_DIN70121:
+        case WH_DIN70121:
+			out->Value = in_value * 10;
+            out->Multiplier = 1;
+            break;    //KWh
+    }
+    //H_DIN70121 = 0,
+    //M_DIN70121 = 1,
+    //S_DIN70121 = 2,
+    //A_DIN70121 = 3,
+    //AH_DIN70121 = 4,
+    //V_DIN70121 = 5,
+    //VA_DIN70121 = 6,
+    //W_DIN70121 = 7,
+    //WS_DIN70121 = 8,
+    //WH_DIN70121 = 9};
+}
+
+/*===========================================================================
+FUNCTION: SAVE_PhysicalValueType_ISO15118_2014
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SAVE_PhysicalValueType_ISO15118_2014(struct PhysicalValueType_ISO15118_2014 *out, int in_value, unsigned char unit)
+{
+    out->Value = in_value;
+    out->Unit = unit;
+
+    switch (unit)
+    {
+        case h_ISO15118_2014:
+        case m_ISO15118_2014:
+        case s_ISO15118_2014:
+        case A_ISO15118_2014:
+        case V_ISO15118_2014:
+            out->Multiplier = -1;
+            break;    //KW
+        case W_ISO15118_2014:
+        case Wh_ISO15118_2014:
+			out->Value = in_value * 10;
+            out->Multiplier = 1;
+            break;    //KWh
+    }
+    //H_DIN70121 = 0,
+    //M_DIN70121 = 1,
+    //S_DIN70121 = 2,
+    //A_DIN70121 = 3,
+    //AH_DIN70121 = 4,
+    //V_DIN70121 = 5,
+    //VA_DIN70121 = 6,
+    //W_DIN70121 = 7,
+    //WS_DIN70121 = 8,
+    //WH_DIN70121 = 9};
+}
+
+/*===========================================================================
+FUNCTION: DIN70121PhyValDecode
+DESCRIPTION:
+        Output Unit: 1V, 1A, 1S, etc.
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+float DIN70121PhyValDecode(struct PhysicalValueType_DIN70121 PhysicalData)
+{
+    short DataValue;
+    int DataMultiplier;
+    float Rtn;
+
+    DataValue = PhysicalData.Value;
+    DataMultiplier = PhysicalData.Multiplier;
+
+    switch(PhysicalData.Unit)
+    {
+        case H_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier) * 60 * 60);
+            return Rtn;
+
+        case M_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier) * 60);
+            return Rtn;
+
+        case S_DIN70121:
+        case A_DIN70121:
+        case V_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier));
+            return Rtn;     //S, A, V
+
+        case AH_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier));
+            return Rtn;
+
+        case VA_DIN70121:
+        case W_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;
+            return Rtn;    //kW
+
+        case WS_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;    //[Joseph] TBD
+            return Rtn;
+
+        case WH_DIN70121:
+            Rtn = (DataValue * pow(10, DataMultiplier)) / 1000;
+            return Rtn;    //kWh
+    }
+
+    return 0;
+}
+
+/*===========================================================================
+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
+    }
+
+    return 0;
+}
+
+/*===========================================================================
+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((char*)in->MeterID)<iso1MeterInfoType_MeterID_CHARACTERS_SIZE ? strlen((char*)in->MeterID) : iso1MeterInfoType_MeterID_CHARACTERS_SIZE);
+	for (i = 0; i < out->MeterID.charactersLen; i++)
+	{
+		out->MeterID.characters[i] = (unsigned char)in->MeterID[i];
+	}
+
+	//[2/5] MeterReading
+	out->MeterReading_isUsed = 1u;
+	out->MeterReading = (unsigned long)in->MeterReading;
+
+	//[3/5] SigMeterReading
+	out->SigMeterReading_isUsed = 1u;
+	out->SigMeterReading.bytesLen = (strlen((char*)in->SigMeterReading)<iso1MeterInfoType_SigMeterReading_BYTES_SIZE ? strlen((char*)in->SigMeterReading) : iso1MeterInfoType_SigMeterReading_BYTES_SIZE);
+	for (i = 0; i < out->SigMeterReading.bytesLen; i++)
+	{
+		out->SigMeterReading.bytes[i] = (unsigned char)in->SigMeterReading[i];
+	}
+
+	//[4/5] MeterStatus
+	out->MeterStatus_isUsed = 1u;
+	out->MeterStatus = (short)in->MeterStatus;
+
+	//[5/5] TMeter
+	out->TMeter_isUsed = 1u;
+	out->TMeter = (long)in->TMeter;		//[CAUTION] data type
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_supportedAppProtocolReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_supportedAppProtocolReq(struct CcsData *shm_ccs, struct appHandEXIDocument *buf, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    int j = 0;
+    struct SupportedAppProtocolRequest_DIN70121 *shm_msg;
+    struct appHandAnonType_supportedAppProtocolReq *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.SupportedAppProtocolRequest;
+    exi = &buf->supportedAppProtocolReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    for (i = 0; i < exi->AppProtocol.arrayLen ; i++)
+    {
+        //ProtocolNamespace
+        shm_msg->AppProtocol[i].ProtocolNamespaceLen = (unsigned int) exi->AppProtocol.array[i].ProtocolNamespace.charactersLen;
+
+        for (j = 0; j< shm_msg->AppProtocol[i].ProtocolNamespaceLen; j++)
+        {
+            shm_msg->AppProtocol[i].ProtocolNamespace[j] = (unsigned char) exi->AppProtocol.array[i].ProtocolNamespace.characters[j];
+        }
+
+        //Version (Major, Minor)
+        shm_msg->AppProtocol[i].VersionNumberMajor = (unsigned int) exi->AppProtocol.array[i].VersionNumberMajor;
+        shm_msg->AppProtocol[i].VersionNumberMinor = (unsigned int) exi->AppProtocol.array[i].VersionNumberMinor;
+
+        //SchemaID
+        shm_msg->AppProtocol[i].SchemaID = (unsigned char) exi->AppProtocol.array[i].SchemaID;
+
+        //Priority
+        shm_msg->AppProtocol[i].Priority = (unsigned char) exi->AppProtocol.array[i].Priority;
+    }
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_SessionSetupReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct SessionSetupRequest_DIN70121 *shm_msg;
+    struct dinSessionSetupReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.SessionSetupRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.SessionSetupReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//EVCCID Length
+	EVCOMM_SYS_INFO.EVCCID_length = (unsigned char)exi->EVCCID.bytesLen;
+
+	//EVCCID
+	for (i = 0; i < exi->EVCCID.bytesLen; i++)
+	{
+		shm_msg->EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+		EVCOMM_SYS_INFO.EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+	}
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_SessionSetupReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct SessionSetupRequest_ISO15118_2014 *shm_msg;
+    struct iso1SessionSetupReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.SessionSetupRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.SessionSetupReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//EVCCID Length
+	EVCOMM_SYS_INFO.EVCCID_length = (unsigned char)exi->EVCCID.bytesLen;
+
+	//EVCCID
+	for (i = 0; i < exi->EVCCID.bytesLen; i++)
+	{
+		shm_msg->EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+		EVCOMM_SYS_INFO.EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+	}
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso2_SessionSetupReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso2_SessionSetupReq(struct CcsData *shm_ccs, struct iso2EXIDocument *exi_doc_ISO2, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct SessionSetupRequest_ISO15118_2018 *shm_msg;
+    struct iso2SessionSetupReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2018.SessionSetupRequest;
+    exi = &exi_doc_ISO2->V2G_Message.Body.SessionSetupReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//EVCCID Length
+	EVCOMM_SYS_INFO.EVCCID_length = (unsigned char)exi->EVCCID.bytesLen;
+
+
+	//EVCCID
+	for (i = 0; i < exi->EVCCID.bytesLen; i++)
+	{
+		shm_msg->EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+		EVCOMM_SYS_INFO.EVCCID[i] = (unsigned char) exi->EVCCID.bytes[i];
+	}
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_ServiceDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_ServiceDiscoveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ServiceDiscoveryRequest_DIN70121 *shm_msg;
+    struct dinServiceDiscoveryReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.ServiceDiscoveryRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//ServiceScope
+	shm_msg->ServiceScopeLen = (unsigned int) exi->ServiceScope.charactersLen;
+    for (i = 0; i <shm_msg->ServiceScopeLen ; i++)
+    {
+        shm_msg->ServiceScope[i] = (unsigned char) exi->ServiceScope.characters[i];
+    }
+
+    //ServiceCategory
+    shm_msg->ServiceCategory = (unsigned int) exi->ServiceCategory;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_ServiceDiscoveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_ServiceDiscoveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ServiceDiscoveryRequest_ISO15118_2014 *shm_msg;
+    struct iso1ServiceDiscoveryReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ServiceDiscoveryRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+	//ServiceScope
+	shm_msg->ServiceScopeLen = (unsigned int) exi->ServiceScope.charactersLen;
+    for (i = 0; i <shm_msg->ServiceScopeLen ; i++)
+    {
+        shm_msg->ServiceScope[i] = (unsigned char) exi->ServiceScope.characters[i];
+    }
+
+    //ServiceCategory
+    shm_msg->ServiceCategory = (unsigned int) exi->ServiceCategory;
+}
+
+
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_ServiceAndPaymentSelectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ServiceAndPaymentSelectionRequest_DIN70121 *shm_msg;
+    struct dinServicePaymentSelectionReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.ServiceAndPaymentSelectionRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//[1/2] SelectedPaymentOption
+	shm_msg->SelectedPaymentOption = (unsigned char) exi->SelectedPaymentOption;
+
+	//[2/2] SelectedServiceList
+    shm_msg->SelectedServiceList.SelectedServiceLen = (unsigned int) exi->SelectedServiceList.SelectedService.arrayLen;
+    for (i = 0; i< shm_msg->SelectedServiceList.SelectedServiceLen; i++)
+    {
+        shm_msg->SelectedServiceList.SelectedService[i].ServiceID =
+				(unsigned short) exi->SelectedServiceList.SelectedService.array[i].ServiceID;
+
+        shm_msg->SelectedServiceList.SelectedService[i].ParameterSetID =
+				(short) exi->SelectedServiceList.SelectedService.array[i].ParameterSetID;
+    }
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_ServiceAndPaymentSelectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_ServiceAndPaymentSelectionReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    int i = 0;
+    struct ServiceAndPaymentSelectionRequest_ISO15118_2014 *shm_msg;
+    struct iso1PaymentServiceSelectionReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ServiceAndPaymentSelectionRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+	//[1/2] SelectedPaymentOption
+	shm_msg->SelectedPaymentOption = (unsigned char) exi->SelectedPaymentOption;
+
+	//[2/2] SelectedServiceList
+    shm_msg->SelectedServiceList.SelectedServiceLen = (unsigned int) exi->SelectedServiceList.SelectedService.arrayLen;
+    for (i = 0; i< shm_msg->SelectedServiceList.SelectedServiceLen; i++)
+    {
+        shm_msg->SelectedServiceList.SelectedService[i].ServiceID =
+				(unsigned short) exi->SelectedServiceList.SelectedService.array[i].ServiceID;
+
+        shm_msg->SelectedServiceList.SelectedService[i].ParameterSetID =
+				(short) exi->SelectedServiceList.SelectedService.array[i].ParameterSetID;
+    }
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_ContractAuthenticationReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_ContractAuthenticationReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    //int i = 0;
+    //struct ContractAuthenticationRequest_DIN70121 *shm_msg;
+    //struct dinContractAuthenticationReqType *exi;
+
+    //shm_msg = &shm_ccs->V2GMessage_DIN70121.ContractAuthenticationRequest;
+    //exi = &exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//none
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_AuthorizationReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_AuthorizationReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    //int i = 0;
+    //struct AuthorizationRequest_ISO15118_2014 *shm_msg;
+    //struct iso1AuthorizationReqType *exi;
+
+    //shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.AuthorizationRequest;
+   // exi = &exi_doc_ISO1->V2G_Message.Body.AuthorizationReq;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+	//none
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_ChargeParameterDiscoveryReq
+DESCRIPTION: Save into share memories
+			(1) ShmCcsData (shm_ccs)
+			(2) ShmSysConfigAndInfo (shm_sys)
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    //int i = 0;
+    struct ChargeParameterDiscoveryRequest_DIN70121 *shm_msg;
+    struct dinChargeParameterDiscoveryReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.ChargeParameterDiscoveryRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//===== [BODY (1/9)] EVRequestedEnergyTransferType =====
+	shm_msg->EVRequestedEnergyTransferType = (unsigned char) exi->EVRequestedEnergyTransferType;
+
+	//===== [BODY (2/9)] DC_EVChargeParameter of EVChargeParameter =====
+    //DC_EVStatus
+    shm_msg->DC_EVChargeParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVReady;
+	shm_msg->DC_EVChargeParameter.DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVChargeParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVChargeParameter.DC_EVStatus.EVRESSSOC;
+
+    //[BODY (3/9)] EVMaximumCurrentLimit
+    shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Multiplier;
+	//shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit;
+	shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Unit = A_DIN70121;
+	shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit.Value =
+			(short) exi->DC_EVChargeParameter.EVMaximumCurrentLimit.Value;
+	sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumCurrentLimit);
+
+    //[BODY (4/9)] EVMaximumPowerLimit
+	shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Multiplier;
+	//shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Unit;
+	shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Unit = W_DIN70121;
+	shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit.Value =
+			(short) exi->DC_EVChargeParameter.EVMaximumPowerLimit.Value;
+	sys->EvBatteryMaxPower = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumPowerLimit);
+
+    //[BODY (5/9)] EVMaximumVoltageLimit
+	shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Multiplier;
+	//shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = (unsigned char) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit;
+	shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Unit = V_DIN70121;
+	shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit.Value =
+			(short) exi->DC_EVChargeParameter.EVMaximumVoltageLimit.Value;
+	sys->EvBatteryMaxVoltage = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVMaximumVoltageLimit);
+
+    //[BODY (6/9)] EVEnergyCapacity
+	shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVEnergyCapacity.Multiplier;
+	shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Unit = WH_DIN70121;
+	shm_msg->DC_EVChargeParameter.EVEnergyCapacity.Value =
+			(short) exi->DC_EVChargeParameter.EVEnergyCapacity.Value;
+	sys->EvBatteryCapacity = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyCapacity);
+
+    //[BODY (7/9)] EVEnergyRequest
+	shm_msg->DC_EVChargeParameter.EVEnergyRequest.Multiplier =
+			(int) exi->DC_EVChargeParameter.EVEnergyRequest.Multiplier;
+	shm_msg->DC_EVChargeParameter.EVEnergyRequest.Unit = WH_DIN70121;
+	shm_msg->DC_EVChargeParameter.EVEnergyRequest.Value =
+			(short) exi->DC_EVChargeParameter.EVEnergyRequest.Value;
+	sys->EvBatteryEngergyRequest = DIN70121PhyValDecode(shm_msg->DC_EVChargeParameter.EVEnergyRequest);
+
+    //[BODY (8/9)] FullSOC
+	if (exi->DC_EVChargeParameter.FullSOC_isUsed != 0 && exi->DC_EVChargeParameter.FullSOC != 0)
+	{
+		shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.FullSOC;
+	}
+	else
+	{
+		shm_msg->DC_EVChargeParameter.FullSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
+	}
+
+    //[BODY (9/9)] BulkSOC
+    shm_msg->DC_EVChargeParameter.BulkSOC = (unsigned char) exi->DC_EVChargeParameter.BulkSOC;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_ChargeParameterDiscoveryReq
+DESCRIPTION: Save into share memories
+			(1) ShmCcsData (shm_ccs)
+			(2) ShmSysConfigAndInfo (shm_sys)
+
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_ChargeParameterDiscoveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    //int i = 0;
+    struct ChargeParameterDiscoveryRequest_ISO15118_2014 *shm_msg;
+    struct iso1ChargeParameterDiscoveryReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+	//===== [BODY (1/9)] EVRequestedEnergyTransferType =====
+	shm_msg->RequestedEnergyTransferMode = (unsigned char) exi->RequestedEnergyTransferMode;
+
+	//===== [BODY (2/9)] DC_EVChargeParameter of EVChargeParameter =====
+	if(((iso1EnergyTransferModeType)shm_msg->RequestedEnergyTransferMode != iso1EnergyTransferModeType_AC_single_phase_core) &&
+	   ((iso1EnergyTransferModeType)shm_msg->RequestedEnergyTransferMode != iso1EnergyTransferModeType_AC_three_phase_core))
+	{
+	    //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;
+	}
+	else
+	{
+		shm_msg->AC_EVChargeParameter.EAmount.Multiplier = (int)exi->AC_EVChargeParameter.EAmount.Multiplier;
+		shm_msg->AC_EVChargeParameter.EAmount.Unit = Wh_ISO15118_2014;
+		shm_msg->AC_EVChargeParameter.EAmount.Value = (short) exi->AC_EVChargeParameter.EAmount.Value;
+
+		shm_msg->AC_EVChargeParameter.EVMaxCurrent.Multiplier = (int)exi->AC_EVChargeParameter.EVMaxCurrent.Multiplier;
+		shm_msg->AC_EVChargeParameter.EVMaxCurrent.Unit = A_ISO15118_2014;
+		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 = A_ISO15118_2014;
+		shm_msg->AC_EVChargeParameter.EVMinCurrent.Value = (short) exi->AC_EVChargeParameter.EVMinCurrent.Value;
+
+		shm_msg->AC_EVChargeParameter.EVMaxVoltage.Multiplier = (int)exi->AC_EVChargeParameter.EVMaxVoltage.Multiplier;
+		shm_msg->AC_EVChargeParameter.EVMaxVoltage.Unit = V_ISO15118_2014;
+		shm_msg->AC_EVChargeParameter.EVMaxVoltage.Value = (short) exi->AC_EVChargeParameter.EVMaxVoltage.Value;
+
+		shm_msg->AC_EVChargeParameter.DepartureTime = (unsigned int)exi->AC_EVChargeParameter.DepartureTime;
+	}
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_CableCheckReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_CableCheckReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    struct CableCheckRequest_DIN70121 *shm_msg;
+    struct dinCableCheckReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.CableCheckRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.CableCheckReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/1)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+	//Check for EVReady
+	//if (shm_msg->DC_EVStatus.EVReady == TRUE && shm_msg->DC_EVStatus.EVErrorCode == NO_ERROR)
+	//{
+		//sys->ConnectorLocked = TRUE;    //Inicating EVSE that the CCS Connector is Locked.
+	//}
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_CableCheckReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_CableCheckReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    struct CableCheckRequest_ISO15118_2014 *shm_msg;
+    struct iso1CableCheckReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.CableCheckRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.CableCheckReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/1)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+	//Check for EVReady
+	//if (shm_msg->DC_EVStatus.EVReady == TRUE && shm_msg->DC_EVStatus.EVErrorCode == NO_ERROR)
+	//{
+		//sys->ConnectorLocked = TRUE;    //Inicating EVSE that the CCS Connector is Locked.
+	//}
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_PreChargeReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_PreChargeReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    struct PreChargeRequest_DIN70121 *shm_msg;
+    struct dinPreChargeReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.PreChargeRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.PreChargeReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+	shm_msg->cnt++;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/3)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+	//[BODY (2/3)] EVTargetVoltage
+    shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
+	//shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
+	shm_msg->EVTargetVoltage.Unit = V_DIN70121;
+	shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
+	if ((sys->EVSEPrechargeStatus == EVSE_STATUS_NOT_READY_FOR_PRECHARGE) || (shm_msg->cnt <= 2)) //0
+	{
+		sys->EvBatterytargetVoltage = 0;	//0V, in order to avoid of turning off relay when D+/D- owns voltage.
+	}
+	else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
+	{
+		sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage);
+		//sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + 5;	//for test, add 10V
+	}
+
+	//[BODY (3/3)] EVTargetCurrent
+    shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
+	//shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
+	shm_msg->EVTargetCurrent.Unit = A_DIN70121;
+	shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
+	if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
+	{
+		//sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
+		sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT;	//for EVSE (default: 2A)
+	}
+	else
+	{
+		sys->EvBatterytargetCurrent = 0;	//0A
+	}
+	//printf("\n\n[%d-th]sys-EvBatterytargetVoltage = %.02f (ori = %d)\n\n", cnt, sys->EvBatterytargetVoltage, shm_msg->EVTargetVoltage.Value);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_PreChargeReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_PreChargeReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    struct PreChargeRequest_ISO15118_2014 *shm_msg;
+    struct iso1PreChargeReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.PreChargeRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+	shm_msg->cnt++;
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/3)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+	//[BODY (2/3)] EVTargetVoltage
+    shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
+	//shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
+	shm_msg->EVTargetVoltage.Unit = V_ISO15118_2014;
+	shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
+	if ((sys->EVSEPrechargeStatus == EVSE_STATUS_NOT_READY_FOR_PRECHARGE) || (shm_msg->cnt <= 2)) //0
+	{
+		sys->EvBatterytargetVoltage = 0;	//0V, in order to avoid of turning off relay when D+/D- owns voltage.
+	}
+	else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
+	{
+		sys->EvBatterytargetVoltage = ISO151182014PhyValDecode(shm_msg->EVTargetVoltage);
+	}
+
+	//[BODY (3/3)] EVTargetCurrent
+    shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
+	//shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
+	shm_msg->EVTargetCurrent.Unit = A_ISO15118_2014;
+	shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
+	if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2
+	{
+		//sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
+		sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT;	//for EVSE (default: 2A)
+	}
+	else
+	{
+		sys->EvBatterytargetCurrent = 0;	//0A
+	}
+	//printf("\n\n[%d-th]sys-EvBatterytargetVoltage = %.02f (ori = %d)\n\n", cnt, sys->EvBatterytargetVoltage, shm_msg->EVTargetVoltage.Value);
+}
+
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_PowerDeliveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_PowerDeliveryReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    //int i = 0;
+    struct PowerDeliveryRequest_DIN70121 *shm_msg;
+    struct dinPowerDeliveryReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.PowerDeliveryRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+
+	//[BODY (1/3)] ReadyToChargeState
+	shm_msg->ReadyToChargeState = (BOOL) exi->ReadyToChargeState;
+
+	//[BODY (2/3)] ChargingProfile
+
+	//[BODY (3/3)] DC_EVPowerDeliveryParameters
+	//DC_EVStatus
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
+
+	//BulkChargingComplete
+	shm_msg->DC_EVPowerDeliveryParameter.BulkChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.BulkChargingComplete;
+
+	//ChargingComplete
+	shm_msg->DC_EVPowerDeliveryParameter.ChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.ChargingComplete;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_PowerDeliveryReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_PowerDeliveryReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    //int i = 0;
+    struct PowerDeliveryRequest_ISO15118_2014 *shm_msg;
+    struct iso1PowerDeliveryReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.PowerDeliveryRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+
+	//[BODY (1/3)] ChargeProgress
+	shm_msg->ChargeProgress = (BOOL) exi->ChargeProgress;
+
+	//[BODY (2/3)] ChargingProfile
+
+	//[BODY (3/3)] DC_EVPowerDeliveryParameters
+	//DC_EVStatus
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady = (BOOL) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVReady;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVPowerDeliveryParameter.DC_EVStatus.EVRESSSOC;
+
+	//BulkChargingComplete
+	shm_msg->DC_EVPowerDeliveryParameter.BulkChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.BulkChargingComplete;
+
+	//ChargingComplete
+	shm_msg->DC_EVPowerDeliveryParameter.ChargingComplete = (BOOL) exi->DC_EVPowerDeliveryParameter.ChargingComplete;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_CurrentDemandReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_CurrentDemandReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    //int i = 0;
+    struct CurrentDemandRequest_DIN70121 *shm_msg;
+    struct dinCurrentDemandReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.CurrentDemandRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+    //[BODY (1/10)] DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+    //[BODY (2/10)] EVTargetCurrent
+    shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
+	//shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
+	shm_msg->EVTargetCurrent.Unit = A_DIN70121;
+	shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
+	if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_ENERGY_TRANSFER) //3 (Precharge Relay OFF, DC+ Relay ON)
+	{
+		sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
+
+		#if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
+		sys->EvBatterytargetCurrent = SUDO_EV_TARGET_CURRENT; //60A, for test;
+		#endif
+	}
+	else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2 (Precharge Relay ON, DC+ Relay OFF)
+	{
+		//sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT;	//2A, unit: 1A
+		sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
+	}
+	else	//0 (Precharge Relay is still under preparing, not ON, yet.)
+	{
+		//sys->EvBatterytargetCurrent = 0;	//0A
+		sys->EvBatterytargetCurrent = DIN70121PhyValDecode(shm_msg->EVTargetCurrent);
+	}
+
+	//[BODY (3/10)] EVMaximumVoltageLimit
+    shm_msg->EVMaximumVoltageLimit.Multiplier = (int) exi->EVMaximumVoltageLimit.Multiplier;
+	//shm_msg->EVMaximumVoltageLimit.Unit = (unsigned char) exi->EVMaximumVoltageLimit.Unit;
+	shm_msg->EVMaximumVoltageLimit.Unit = V_DIN70121;
+	shm_msg->EVMaximumVoltageLimit.Value = (short) exi->EVMaximumVoltageLimit.Value;
+	if (shm_msg->EVMaximumVoltageLimit.Value != 0 && exi->EVMaximumVoltageLimit_isUsed == 1u)	//Gridwiz EVCC Emulator will not send EVMaximumVoltageLimit in CurrentDemandReq
+	{
+		sys->EvBatteryMaxVoltage = DIN70121PhyValDecode(shm_msg->EVMaximumVoltageLimit);
+	}
+
+	//[BODY (4/10)] EVMaximumCurrentLimit
+    shm_msg->EVMaximumCurrentLimit.Multiplier = (int) exi->EVMaximumCurrentLimit.Multiplier;
+	//shm_msg->EVMaximumCurrentLimit.Unit = (unsigned char) exi->EVMaximumCurrentLimit.Unit;
+	shm_msg->EVMaximumCurrentLimit.Unit = A_DIN70121;
+	shm_msg->EVMaximumCurrentLimit.Value = (short) exi->EVMaximumCurrentLimit.Value;
+	sys->EvBatteryMaxCurrent = DIN70121PhyValDecode(shm_msg->EVMaximumCurrentLimit);
+
+	//[BODY (5/10)] EVMaximumPowerLimit
+    shm_msg->EVMaximumPowerLimit.Multiplier = (int) exi->EVMaximumPowerLimit.Multiplier;
+	//shm_msg->EVMaximumPowerLimit.Unit = (unsigned char) exi->EVMaximumPowerLimit.Unit;
+	shm_msg->EVMaximumPowerLimit.Unit = W_DIN70121;
+	shm_msg->EVMaximumPowerLimit.Value = (short) exi->EVMaximumPowerLimit.Value;
+	sys->EvBatteryMaxPower = DIN70121PhyValDecode(shm_msg->EVMaximumPowerLimit);
+
+    //[BODY (6/10)] BulkChargingComplete
+	shm_msg->BulkChargingComplete = (BOOL) exi->BulkChargingComplete;
+
+    //[BODY (7/10)] ChargingComplete
+    shm_msg->ChargingComplete = (BOOL) exi->ChargingComplete;
+
+	//[BODY (8/10)] RemainingTimeToFullSoC
+	shm_msg->RemainingTimeToFullSoC.Multiplier = (int) exi->RemainingTimeToFullSoC.Multiplier;
+	shm_msg->RemainingTimeToFullSoC.Unit = (unsigned char) exi->RemainingTimeToFullSoC.Unit;
+	shm_msg->RemainingTimeToFullSoC.Value = (short) exi->RemainingTimeToFullSoC.Value;
+	sys->RemainChargingDuration = DIN70121PhyValDecode(shm_msg->RemainingTimeToFullSoC);
+
+	//[BODY (9/10)] RemainingTimeToBulkSoC
+	shm_msg->RemainingTimeToBulkSoC.Multiplier = (int) exi->RemainingTimeToBulkSoC.Multiplier;
+	shm_msg->RemainingTimeToBulkSoC.Unit = (unsigned char) exi->RemainingTimeToBulkSoC.Unit;
+	shm_msg->RemainingTimeToBulkSoC.Value = (short) exi->RemainingTimeToBulkSoC.Value;
+
+	//[BODY (10/10)] EVTargetVoltage
+	shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
+	//shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
+	shm_msg->EVTargetVoltage.Unit = V_DIN70121;
+	shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
+	if((shm_msg->EVTargetVoltage.Value != 0) && (sys->EvBatteryMaxVoltage != 0))
+	{
+		sys->EvBatterytargetVoltage = (DIN70121PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
+	}
+	else
+	{
+		sys->EvBatterytargetVoltage = DIN70121PhyValDecode(shm_msg->EVTargetVoltage);
+	}
+
+	#if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
+	sys->EvBatterytargetVoltage = SUDO_EV_TARGET_VOLTAGE;	//for test (500V, unit: 1V)
+	#endif
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_CurrentDemandReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_CurrentDemandReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    //int i = 0;
+    struct CurrentDemandRequest_ISO15118_2014 *shm_msg;
+    struct iso1CurrentDemandReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.CurrentDemandRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+    //[BODY (1/10)] DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+
+    //[BODY (2/10)] EVTargetCurrent
+    shm_msg->EVTargetCurrent.Multiplier = (int) exi->EVTargetCurrent.Multiplier;
+	//shm_msg->EVTargetCurrent.Unit = (unsigned char) exi->EVTargetCurrent.Unit;
+	shm_msg->EVTargetCurrent.Unit = A_ISO15118_2014;
+	shm_msg->EVTargetCurrent.Value = (short) exi->EVTargetCurrent.Value;
+	if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_ENERGY_TRANSFER) //3 (Precharge Relay OFF, DC+ Relay ON)
+	{
+		sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
+
+		#if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
+		sys->EvBatterytargetCurrent = SUDO_EV_TARGET_CURRENT; //60A, for test;
+		#endif
+	}
+	else if (sys->EVSEPrechargeStatus == EVSE_STATUS_READY_FOR_PRECHARGE) //2 (Precharge Relay ON, DC+ Relay OFF)
+	{
+		//sys->EvBatterytargetCurrent = PRECHARGE_TARGET_CURRENT;	//2A, unit: 1A
+		sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
+	}
+	else	//0 (Precharge Relay is still under preparing, not ON, yet.)
+	{
+		//sys->EvBatterytargetCurrent = 0;	//0A
+		sys->EvBatterytargetCurrent = ISO151182014PhyValDecode(shm_msg->EVTargetCurrent);
+	}
+
+	//[BODY (3/10)] EVMaximumVoltageLimit
+    shm_msg->EVMaximumVoltageLimit.Multiplier = (int) exi->EVMaximumVoltageLimit.Multiplier;
+	//shm_msg->EVMaximumVoltageLimit.Unit = (unsigned char) exi->EVMaximumVoltageLimit.Unit;
+	shm_msg->EVMaximumVoltageLimit.Unit = V_ISO15118_2014;
+	shm_msg->EVMaximumVoltageLimit.Value = (short) exi->EVMaximumVoltageLimit.Value;
+	if (shm_msg->EVMaximumVoltageLimit.Value != 0 && exi->EVMaximumVoltageLimit_isUsed == 1u)	//Gridwiz EVCC Emulator will not send EVMaximumVoltageLimit in CurrentDemandReq
+	{
+		sys->EvBatteryMaxVoltage = ISO151182014PhyValDecode(shm_msg->EVMaximumVoltageLimit);
+	}
+	/*
+	printf("[SeccComm] <V_ev_max> = %d, %d, %.02f\n",
+			exi->EVMaximumVoltageLimit.Value,
+			shm_msg->EVMaximumVoltageLimit.Value,
+			sys->EvBatteryMaxVoltage
+		  );
+	*/
+
+	//[BODY (4/10)] EVMaximumCurrentLimit
+    shm_msg->EVMaximumCurrentLimit.Multiplier = (int) exi->EVMaximumCurrentLimit.Multiplier;
+	//shm_msg->EVMaximumCurrentLimit.Unit = (unsigned char) exi->EVMaximumCurrentLimit.Unit;
+	shm_msg->EVMaximumCurrentLimit.Unit = A_ISO15118_2014;
+	shm_msg->EVMaximumCurrentLimit.Value = (short) exi->EVMaximumCurrentLimit.Value;
+	sys->EvBatteryMaxCurrent = ISO151182014PhyValDecode(shm_msg->EVMaximumCurrentLimit);
+
+	//[BODY (5/10)] EVMaximumPowerLimit
+    shm_msg->EVMaximumPowerLimit.Multiplier = (int) exi->EVMaximumPowerLimit.Multiplier;
+	//shm_msg->EVMaximumPowerLimit.Unit = (unsigned char) exi->EVMaximumPowerLimit.Unit;
+	shm_msg->EVMaximumPowerLimit.Unit = W_ISO15118_2014;
+	shm_msg->EVMaximumPowerLimit.Value = (short) exi->EVMaximumPowerLimit.Value;
+	sys->EvBatteryMaxPower = ISO151182014PhyValDecode(shm_msg->EVMaximumPowerLimit);
+
+    //[BODY (6/10)] BulkChargingComplete
+	shm_msg->BulkChargingComplete = (BOOL) exi->BulkChargingComplete;
+
+    //[BODY (7/10)] ChargingComplete
+    shm_msg->ChargingComplete = (BOOL) exi->ChargingComplete;
+
+	//[BODY (8/10)] RemainingTimeToFullSoC
+	shm_msg->RemainingTimeToFullSoC.Multiplier = (int) exi->RemainingTimeToFullSoC.Multiplier;
+	shm_msg->RemainingTimeToFullSoC.Unit = (unsigned char) exi->RemainingTimeToFullSoC.Unit;
+	shm_msg->RemainingTimeToFullSoC.Value = (short) exi->RemainingTimeToFullSoC.Value;
+	sys->RemainChargingDuration = ISO151182014PhyValDecode(shm_msg->RemainingTimeToFullSoC);
+
+	//[BODY (9/10)] RemainingTimeToBulkSoC
+	shm_msg->RemainingTimeToBulkSoC.Multiplier = (int) exi->RemainingTimeToBulkSoC.Multiplier;
+	shm_msg->RemainingTimeToBulkSoC.Unit = (unsigned char) exi->RemainingTimeToBulkSoC.Unit;
+	shm_msg->RemainingTimeToBulkSoC.Value = (short) exi->RemainingTimeToBulkSoC.Value;
+
+	//[BODY (10/10)] EVTargetVoltage
+	shm_msg->EVTargetVoltage.Multiplier = (int) exi->EVTargetVoltage.Multiplier;
+	//shm_msg->EVTargetVoltage.Unit = (unsigned char) exi->EVTargetVoltage.Unit;
+	shm_msg->EVTargetVoltage.Unit = V_ISO15118_2014;
+	shm_msg->EVTargetVoltage.Value = (short) exi->EVTargetVoltage.Value;
+	if((shm_msg->EVTargetVoltage.Value != 0) && (sys->EvBatteryMaxVoltage != 0))
+	{
+		sys->EvBatterytargetVoltage = (ISO151182014PhyValDecode(shm_msg->EVTargetVoltage) + sys->EvBatteryMaxVoltage)/2;
+	}
+	else
+	{
+		sys->EvBatterytargetVoltage = ISO151182014PhyValDecode(shm_msg->EVTargetVoltage);
+	}
+
+	/*
+	printf("[SeccComm] <V_ev_target> = %d, %d, %.02f\n",
+			exi->EVTargetVoltage.Value,
+			shm_msg->EVTargetVoltage.Value,
+			sys->EvBatterytargetVoltage
+		  );
+	*/
+
+	#if MANUAL_SET_EV_TARGET_FUNCTION == ENABLE
+	sys->EvBatterytargetVoltage = SUDO_EV_TARGET_VOLTAGE;	//for test (500V, unit: 1V)
+	#endif
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_ChargingStatusReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_ChargingStatusReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+	//no content for ISO1
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_WeldingDetectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_WeldingDetectionReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    //int i = 0;
+    struct WeldingDetectionRequest_DIN70121 *shm_msg;
+    struct dinWeldingDetectionReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.WeldingDetectionRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.WeldingDetectionReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/3)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVCabinConditioning = (BOOL) exi->DC_EVStatus.EVCabinConditioning;
+	shm_msg->DC_EVStatus.EVRESSConiditioning = (BOOL) exi->DC_EVStatus.EVRESSConditioning;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_WeldingDetectionReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_WeldingDetectionReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+    //int i = 0;
+    struct WeldingDetectionRequest_ISO15118_2014 *shm_msg;
+    struct iso1WeldingDetectionReqType *exi;
+	struct ChargingInfoData *sys;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.WeldingDetectionRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.WeldingDetectionReq;
+	sys = &shm_sys->SysInfo.CcsChargingData[0];
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+
+	//===== [BODY (1/3)] DC_EVStatus =====
+    //DC_EVStatus
+    shm_msg->DC_EVStatus.EVReady = (BOOL) exi->DC_EVStatus.EVReady;
+	shm_msg->DC_EVStatus.EVErrorCode = (unsigned char) exi->DC_EVStatus.EVErrorCode;
+	shm_msg->DC_EVStatus.EVRESSSOC = (unsigned char) exi->DC_EVStatus.EVRESSSOC;
+	sys->EvBatterySoc = (int) shm_msg->DC_EVStatus.EVRESSSOC;
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_din_SessionStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_din_SessionStopReq(struct CcsData *shm_ccs, struct dinEXIDocument *exi_doc_DIN, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+	/*
+    int i = 0;
+    struct SessionStopRequest_DIN70121 *shm_msg;
+    struct dinSessionStopReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_DIN70121.SessionStopRequest;
+    exi = &exi_doc_DIN->V2G_Message.Body.SessionStopReq;
+	*/
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_din_V2GMSG_Header(buf);
+
+	//null
+}
+
+/*===========================================================================
+FUNCTION: SHM_Save_iso1_SessionStopReq
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+OUTPUT:
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Save_iso1_SessionStopReq(struct CcsData *shm_ccs, struct iso1EXIDocument *exi_doc_ISO1, struct SysConfigAndInfo *shm_sys)
+{
+    // ======== [STEP 1/3] Initialize ========
+	/*
+    int i = 0;
+    struct SessionStopRequest_ISO15118_2014 *shm_msg;
+    struct iso1SessionStopReqType *exi;
+
+    shm_msg = &shm_ccs->V2GMessage_ISO15118_2014.SessionStopRequest;
+    exi = &exi_doc_ISO1->V2G_Message.Body.SessionStopReq;
+	*/
+
+    // ======== [STEP 2/3] Update Flags ========
+
+    // ======== [STEP 3/3] Transfer Data ========
+    //SHM_Save_iso1_V2GMSG_Header(buf);
+
+	//null
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_SessionSetupRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_SessionSetupRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	int i = 0;
+	struct dinSessionSetupResType *out;
+	struct SessionSetupResponse_DIN70121 *in;
+
+	out = &exi_doc_DIN->V2G_Message.Body.SessionSetupRes;
+	in = &shm_ccs->V2GMessage_DIN70121.SessionSetupResponse;
+
+	exi_doc_DIN->V2G_Message.Body.SessionSetupRes_isUsed = 1u;
+
+	// ====== [BODY (1/3) ResponseCode ======
+	out->ResponseCode = in->ResponseCode;
+
+	// ====== [BODY (2/3) EVSEID ======
+	out->EVSEID.bytesLen = 32;  //max = 32  bytes(DIN), all zero
+	for (i = 0; i< 32; i++)
+	{
+		out->EVSEID.bytes[i] = (unsigned char) in->EVSEID[i];
+	}
+
+	// ====== [BODY (3/3) DateTimeNow ======
+	out->DateTimeNow_isUsed = 1u;
+	out->DateTimeNow = (int64_t) in->EVSETimeStamp;   //Format: Unix Time Stamp
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_ContractAuthenticationRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_ContractAuthenticationRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinContractAuthenticationResType *out;
+	struct ContractAuthenticationResponse_DIN70121 *in;
+
+	out = &exi_doc_DIN->V2G_Message.Body.ContractAuthenticationRes;
+	in = &shm_ccs->V2GMessage_DIN70121.ContractAuthenticationResponse;
+
+	//[BODY (2/2)] EVSEProcessing
+	out->EVSEProcessing = (BOOL)in->EVSEProcessing; //0(Finished) or 1(Ongoing)
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_ChargeParameterDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_ChargeParameterDiscoveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinChargeParameterDiscoveryResType *out;
+	struct ChargeParameterDiscoveryResponse_DIN70121 *in;
+
+	out = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryRes;
+	in = &shm_ccs->V2GMessage_DIN70121.ChargeParameterDiscoveryResponse;
+
+	//Initialize
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+	init_dinChargeParameterDiscoveryResType(out);
+	exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
+
+	//----- [BODY (1/5)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+    //----- [BODY (2/5)] EVSEProcessing -----
+    out->EVSEProcessing = (BOOL) in->EVSEProcessing;
+    // 	dinEVSEProcessingType_Finished = 0,
+    //	dinEVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/5)] SAScheduleList of SASchedules -----
+	//[Joseph] Here keep constant values and not copy from share memory, yet.
+    out->SAScheduleList_isUsed = 1u;
+    struct dinSAScheduleListType *list;
+    list = &out->SAScheduleList;
+    //
+    list->SAScheduleTuple.arrayLen = 1;
+    list->SAScheduleTuple.array[0].SAScheduleTupleID = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleID = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.arrayLen = 1;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval_isUsed = 1u;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.start = 0;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration = 86400;	//24Hrs at least, unit:second
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].RelativeTimeInterval.duration_isUsed = 1u;
+    /*+++ 20200808, vern, add Pmax parameters in chargeParameters discovery +++*/
+    in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value*=10;
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax = in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value;
+	/*--- 20200808, vern, add Pmax parameters in chargeParameters discovery ---*/
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 1u;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval = 600;
+    //list->SAScheduleTuple.array[0].SalesTariff.xxx
+    //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
+
+
+    //-----  [BODY (4/5)] AC_EVSEChargeParameter of EVSEChargeParameter -----
+    //ignore, since DIN doesn't support AC
+
+    //----- [BODY (5/5)] DC_EVSEChargeParameter of EVSEChargeParameter -----
+    out->DC_EVSEChargeParameter_isUsed = 1u;
+    struct dinDC_EVSEChargeParameterType *out_dc_para;
+	struct DC_EVSEChargeParameterType_DIN70121 *in_dc_para;
+    out_dc_para = &out->DC_EVSEChargeParameter;
+	in_dc_para = &in->DC_EVSEChargeParameter;
+
+    //DC_EVSEStatus
+	out_dc_para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+	SHM_Read_dinDC_EVSEStatusType(&out_dc_para->DC_EVSEStatus, &in_dc_para->DC_EVSEStatus);
+
+    //EVSEMaximumCurrentLimit
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumCurrentLimit, &in_dc_para->EVSEMaximumCurrentLimit);
+
+    //EVSEMaximumPowerLimit
+	out_dc_para->EVSEMaximumPowerLimit_isUsed = 1u;
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumPowerLimit, &in_dc_para->EVSEMaximumPowerLimit);
+
+    //EVSEMaximumVoltageLimit
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMaximumVoltageLimit, &in_dc_para->EVSEMaximumVoltageLimit);
+
+    //EVSEMinimumVoltageLimit
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMinimumVoltageLimit, &in_dc_para->EVSEMinimumVoltageLimit);
+
+
+    //EVSEMinimumCurrentLimit
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEMinimumCurrentLimit, &in_dc_para->EVSEMinimumCurrentLimit);
+
+    //EVSECurrentRegulationTolerance_isUsed
+    out_dc_para->EVSECurrentRegulationTolerance_isUsed = 1u;
+    //EVSECurrentRegulationTolerance
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSECurrentRegulationTolerance, &in_dc_para->EVSECurrentRegulationTolerance);
+
+    //EVSEEnergyToBeDelivered_isUsed
+    out_dc_para->EVSEEnergyToBeDelivered_isUsed = 0u;
+	//EVSEEnergyToBeDelivered (optional)
+    //SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEEnergyToBeDelivered, &in_dc_para->EVSEEnergyToBeDelivered);
+
+    //EVSEPeakCurrentRipple
+	SHM_Read_dinPhysicalValueType(&out_dc_para->EVSEPeakCurrentRipple, &in_dc_para->EVSEPeakCurrentRipple);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_ChargeParameterDiscoveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_ChargeParameterDiscoveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1ChargeParameterDiscoveryResType *out;
+	struct ChargeParameterDiscoveryResponse_ISO15118_2014 *in;
+
+	out = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.ChargeParameterDiscoveryResponse;
+
+	//Initialize
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+	init_iso1ChargeParameterDiscoveryResType(out);
+	exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryRes_isUsed = 1u;
+
+	//----- [BODY (1/5)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+    //----- [BODY (2/5)] EVSEProcessing -----
+    out->EVSEProcessing = (BOOL) in->EVSEProcessing;
+    // 	iso1EVSEProcessingType_Finished = 0,
+    //	iso1EVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/5)] SAScheduleList of SASchedules -----
+	//[Joseph] Here keep constant values and not copy from share memory, yet.
+    out->SAScheduleList_isUsed = 1u;
+    struct iso1SAScheduleListType *list;
+    list = &out->SAScheduleList;
+    //
+    list->SAScheduleTuple.arrayLen = 1;
+    list->SAScheduleTuple.array[0].SAScheduleTupleID = 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;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval_isUsed = 1u;
+    //list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].TimeInterval = 86400;
+    /*+++ 20200808, vern, add Pmax parameters in chargeParameters discovery +++*/
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Unit = iso1unitSymbolType_W;	//iso1unitSymbolType_W
+    in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value*=10;   /*+++ 20200808, vern, lack one more 0 ---*/
+    list->SAScheduleTuple.array[0].PMaxSchedule.PMaxScheduleEntry.array[0].PMax.Value =in->DC_EVSEChargeParameter.EVSEMaximumPowerLimit.Value;	//30000 if DW/DM product
+    /*--- 20200808, vern, add Pmax parameters in chargeParameters discovery ---*/
+    //list->SAScheduleTuple.array[0].SalesTariff.xxx
+    //list->SAScheduleTuple.array[0].SalesTariff_isUsed = 0u;
+
+
+	//-----  [BODY (4/5)] AC/DC EVSEChargeParameter -----
+	#if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+	{
+		//-----  [BODY (4/5)] AC_EVSEChargeParameter -----
+		out->AC_EVSEChargeParameter_isUsed = 1u;
+		struct iso1AC_EVSEChargeParameterType *out_ac_para;
+		struct AC_EVSEChargeParameterType_ISO15118_2014 *in_ac_para;
+		out_ac_para = &out->AC_EVSEChargeParameter;
+		in_ac_para = &in->AC_EVSEChargeParameter;
+
+		//[1/3] AC_EVSEStatus
+		SHM_Read_iso1AC_EVSEStatusType(&out_ac_para->AC_EVSEStatus, &in_ac_para->AC_EVSEStatus);
+
+		//[2/3] EVSENominalVoltage
+		SHM_Read_iso1PhysicalValueType(&out_ac_para->EVSENominalVoltage, &in_ac_para->EVSENominalVoltage);
+
+		//[3/3] EVSEMaxCurrent
+		SHM_Read_iso1PhysicalValueType(&out_ac_para->EVSEMaxCurrent, &in_ac_para->EVSEMaxCurrent);
+	}
+	#else //CCS_ENERGY_TRANSFER_MODE == MODE_DC_EXTENDED
+	{
+		//----- [BODY (5/5)] DC_EVSEChargeParameter -----
+		out->DC_EVSEChargeParameter_isUsed = 1u;
+		struct iso1DC_EVSEChargeParameterType *out_dc_para;
+		struct DC_EVSEChargeParameterType_ISO15118_2014 *in_dc_para;
+		out_dc_para = &out->DC_EVSEChargeParameter;
+		in_dc_para = &in->DC_EVSEChargeParameter;
+
+		//DC_EVSEStatus
+		out_dc_para->DC_EVSEStatus.EVSEIsolationStatus_isUsed = 1u;
+		SHM_Read_iso1DC_EVSEStatusType(&out_dc_para->DC_EVSEStatus, &in_dc_para->DC_EVSEStatus);
+
+		//EVSEMaximumCurrentLimit
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumCurrentLimit, &in_dc_para->EVSEMaximumCurrentLimit);
+
+		//EVSEMaximumPowerLimit
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumPowerLimit, &in_dc_para->EVSEMaximumPowerLimit);
+
+		//EVSEMaximumVoltageLimit
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMaximumVoltageLimit, &in_dc_para->EVSEMaximumVoltageLimit);
+
+		//EVSEMinimumVoltageLimit
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMinimumVoltageLimit, &in_dc_para->EVSEMinimumVoltageLimit);
+
+		//EVSEMinimumCurrentLimit
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEMinimumCurrentLimit, &in_dc_para->EVSEMinimumCurrentLimit);
+
+		//EVSECurrentRegulationTolerance_isUsed
+		out_dc_para->EVSECurrentRegulationTolerance_isUsed = 1u;
+		//EVSECurrentRegulationTolerance
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSECurrentRegulationTolerance, &in_dc_para->EVSECurrentRegulationTolerance);
+
+		//EVSEEnergyToBeDelivered_isUsed
+		out_dc_para->EVSEEnergyToBeDelivered_isUsed = 0u;
+		//EVSEEnergyToBeDelivered (optional)
+		//SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEEnergyToBeDelivered, &in_dc_para->EVSEEnergyToBeDelivered);
+
+		//EVSEPeakCurrentRipple
+		SHM_Read_iso1PhysicalValueType(&out_dc_para->EVSEPeakCurrentRipple, &in_dc_para->EVSEPeakCurrentRipple);
+	}
+	#endif
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_CableCheckRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_CableCheckRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinCableCheckResType *out;
+	struct CableCheckResponse_DIN70121 *in;
+
+	out = &exi_doc_DIN->V2G_Message.Body.CableCheckRes;
+	in = &shm_ccs->V2GMessage_DIN70121.CableCheckResponse;
+
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+    init_dinCableCheckResType(out);
+	exi_doc_DIN->V2G_Message.Body.CableCheckRes_isUsed = 1u;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+    //----- [BODY (2/3)] EVSEProcessing -----
+	out->EVSEProcessing = (BOOL) in->EVSEProcessing;
+    // 	dinEVSEProcessingType_Finished = 0,
+    //	dinEVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+	SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_CableCheckRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_CableCheckRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1CableCheckResType *out;
+	struct CableCheckResponse_ISO15118_2014 *in;
+
+	out = &exi_doc_ISO1->V2G_Message.Body.CableCheckRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.CableCheckResponse;
+
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+    init_iso1CableCheckResType(out);
+	exi_doc_ISO1->V2G_Message.Body.CableCheckRes_isUsed = 1u;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+    //----- [BODY (2/3)] EVSEProcessing -----
+	out->EVSEProcessing = (BOOL) in->EVSEProcessing;
+    // 	iso1EVSEProcessingType_Finished = 0,
+    //	iso1EVSEProcessingType_Ongoing = 1
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+	SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_PreChargeRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_PreChargeRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinPreChargeResType *out;
+	struct PreChargeResponse_DIN70121 *in;
+
+	out = &exi_doc_DIN->V2G_Message.Body.PreChargeRes;
+	in = &shm_ccs->V2GMessage_DIN70121.PreChargeResponse;
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+    init_dinPreChargeResType(&exi_doc_DIN->V2G_Message.Body.PreChargeRes);
+	exi_doc_DIN->V2G_Message.Body.PreChargeRes_isUsed = 1u;
+
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+	SHM_Read_dinPhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
+    //	dinunitSymbolType_h = 0,
+    //	dinunitSymbolType_m = 1,
+    //	dinunitSymbolType_s = 2,
+    //	dinunitSymbolType_A = 3,
+    //	dinunitSymbolType_Ah = 4,
+    //	dinunitSymbolType_V = 5,
+    //	dinunitSymbolType_VA = 6,
+    //	dinunitSymbolType_W = 7,
+    //	dinunitSymbolType_W_s = 8,
+    //	dinunitSymbolType_Wh = 9
+
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+	SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_PreChargeRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_PreChargeRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1PreChargeResType *out;
+	struct PreChargeResponse_ISO15118_2014 *in;
+
+	out = &exi_doc_ISO1->V2G_Message.Body.PreChargeRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.PreChargeResponse;
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+    init_iso1PreChargeResType(&exi_doc_ISO1->V2G_Message.Body.PreChargeRes);
+	exi_doc_ISO1->V2G_Message.Body.PreChargeRes_isUsed = 1u;
+
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+
+    //----- [BODY (2/3)] EVSEPresentVoltage -----
+	SHM_Read_iso1PhysicalValueType(&out->EVSEPresentVoltage, &in->EVSEPresentVoltage);
+	//iso1unitSymbolType_h = 0,
+	//iso1unitSymbolType_m = 1,
+	//iso1unitSymbolType_s = 2,
+	//iso1unitSymbolType_A = 3,
+	//iso1unitSymbolType_V = 4,
+	//iso1unitSymbolType_W = 5,
+	//iso1unitSymbolType_Wh = 6
+
+
+    //----- [BODY (3/3)] DC_EVSEStatus -----
+	SHM_Read_iso1DC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_din_PowerDeliveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_DIN
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_din_PowerDeliveryRes(struct dinEXIDocument *exi_doc_DIN, struct CcsData *shm_ccs)
+{
+	struct dinPowerDeliveryResType *out;
+	struct PowerDeliveryResponse_DIN70121 *in;
+	init_dinBodyType(&exi_doc_DIN->V2G_Message.Body);
+	init_dinPowerDeliveryResType(&exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes);
+
+	out = &exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes;
+	in = &shm_ccs->V2GMessage_DIN70121.PowerDeliveryResponse;
+	exi_doc_DIN->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+
+    //----- [BODY (2/3)] AC_EVSEStatus -----
+    //ignore, since DIN 70121 doesn't support AC, yet.
+
+
+    //----- [BODY (2/3)] DC_EVSEStatus -----
+	out->DC_EVSEStatus_isUsed = 1u;
+	SHM_Read_dinDC_EVSEStatusType(&out->DC_EVSEStatus, &in->DC_EVSEStatus);
+}
+
+/*===========================================================================
+FUNCTION: SHM_Read_iso1_PowerDeliveryRes
+DESCRIPTION:
+PRE-CONDITION:
+INPUT:
+		1. shm_ccs
+OUTPUT:
+		2. exi_doc_ISO1
+
+GLOBAL VARIABLES:
+=============================================================================*/
+void SHM_Read_iso1_PowerDeliveryRes(struct iso1EXIDocument *exi_doc_ISO1, struct CcsData *shm_ccs)
+{
+	struct iso1PowerDeliveryResType *out;
+	struct PowerDeliveryResponse_ISO15118_2014 *in;
+	init_iso1BodyType(&exi_doc_ISO1->V2G_Message.Body);
+	init_iso1PowerDeliveryResType(&exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes);
+
+	out = &exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes;
+	in = &shm_ccs->V2GMessage_ISO15118_2014.PowerDeliveryResponse;
+	exi_doc_ISO1->V2G_Message.Body.PowerDeliveryRes_isUsed = 1u;
+
+	//----- [BODY (1/3)] ResponseCode -----
+    out->ResponseCode = (unsigned char) in->ResponseCode;
+
+
+    //----- [BODY (2/3)] AC_EVSEStatus -----
+    //ignore, since our ISO1 70121 doesn't support AC, yet.
+
+
+    //----- [BODY (2/3)] DC_EVSEStatus -----
+	#if ((CCS_ENERGY_TRANSFER_MODE == MODE_AC_SINGLE_PHASE_CORE) | (CCS_ENERGY_TRANSFER_MODE == MODE_AC_THREE_PHASE_CORE))
+	{
+    	out->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)
+{
+	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 = (strlen((char*)in->EVSEID)<iso1ChargingStatusResType_EVSEID_CHARACTERS_SIZE) ? strlen((char*)in->EVSEID) : iso1ChargingStatusResType_EVSEID_CHARACTERS_SIZE;  //min length: 7, max length:37  bytes(ISO1, AC)
+	for (uint8_t 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;
+    unsigned char buffer[1024]={0};
+    leng = exi_doc_DIN->V2G_Message.Header.SessionID.bytesLen;
+
+    for (i = 0; i <leng ; i++)
+    {
+        sprintf((char*)buffer, "%s%02x ", buffer, exi_doc_DIN->V2G_Message.Header.SessionID.bytes[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("SessionID (%d Bytes): %s\n", leng, buffer);
+}
+
+/*===========================================================================
+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;
+    unsigned char buffer[1024]={0};
+    leng = exi_doc_ISO1->V2G_Message.Header.SessionID.bytesLen;
+
+    for (i = 0; i <leng ; i++)
+    {
+        sprintf((char*)buffer, "%s%02x ", buffer, exi_doc_ISO1->V2G_Message.Header.SessionID.bytes[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("SessionID (%d Bytes): %s\n", leng, buffer);
+}
+
+/*===========================================================================
+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;
+    unsigned char buffer[1024]={0};
+    leng = exi_doc_ISO2->V2G_Message.Header.SessionID.bytesLen;
+
+    for (i = 0; i <leng ; i++)
+    {
+    	sprintf((char*)buffer, "%s%02x ", buffer, exi_doc_ISO2->V2G_Message.Header.SessionID.bytes[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("SessionID (%d Bytes): %s\n", leng, buffer);
+}
+
+/*===========================================================================
+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("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("Protocol entry #=%d\n",(i+1));
+
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("ProtocolNamespace:\n");
+		printASCIIString(exi_doc->supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.characters,
+						 exi_doc->supportedAppProtocolReq.AppProtocol.array[i].ProtocolNamespace.charactersLen);
+
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("Version= %d.%d\n",
+										exi_doc->supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMajor,
+										exi_doc->supportedAppProtocolReq.AppProtocol.array[i].VersionNumberMinor);
+
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("SchemaID: %d\n", exi_doc->supportedAppProtocolReq.AppProtocol.array[i].SchemaID);
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("Priority: %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;
+    unsigned char buffer[1024]={0};
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[START] Parsing SessionSetupReq\n");
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_din_Header(exi_doc_DIN);
+    for (i = 0; i < exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
+    {
+        sprintf((char*)buffer, "%s%02X ", buffer, exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVCCID (%d Bytes): %s\n", exi_doc_DIN->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen, buffer);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing SessionSetupReq\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;
+    unsigned char buffer[1024]={0};
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[START] Parsing SessionSetupReq\n");
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso1_Header(exi_doc_ISO1);
+    for (i = 0; i < exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
+    {
+        sprintf((char*)buffer, "%s%02X ", buffer, exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVCCID (%d Bytes): %s\n", exi_doc_ISO1->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen, buffer);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing SessionSetupReq\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;
+    unsigned char buffer[1024]={0};
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[START] Parsing SessionSetupReq\n");
+
+    //===== [Header] SessionID =====
+    PRINT_V2G_MSG_iso2_Header(exi_doc_ISO2);
+    for (i = 0; i < exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen; i++)
+    {
+        sprintf((char*)buffer, "%s%02X ", buffer, exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytes[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVCCID (%d Bytes): %s\n", exi_doc_ISO2->V2G_Message.Body.SessionSetupReq.EVCCID.bytesLen, buffer);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing SessionSetupReq\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;
+    unsigned char buffer[1024]={0};
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[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;
+    for (i = 0; i <leng ; i++)
+    {
+        sprintf((char*)buffer, "%s%02X ", buffer, exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceScope (%d Bytes, optional): %s\n", leng, buffer);
+
+    //[BODY(2/2)] Service Category
+    int cat = 0;
+    cat = exi_doc_DIN->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory;
+    switch (cat)
+    {
+        case dinserviceCategoryType_EVCharging:             //0
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceCategory: %d (EVCharging)\n", cat);
+            break;
+        }
+        case dinserviceCategoryType_Internet:               //1
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceCategory: %d (Internet: not supported)\n", cat);
+            break;
+        }
+        case dinserviceCategoryType_ContractCertificate:    //2
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceCategory: %d (ContractCertificate: not supported)\n", cat);
+            break;
+        }
+        case dinserviceCategoryType_OtherCustom:            //3
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceCategory: %d (OtherCustom: not supported)\n", cat);
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceCategory: %d (Unexpected Service Category: %d)\n", cat);
+            break;
+        }
+
+    }
+    //DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t([0]EVCharging, [1]Internet, [2]ContractCertificate, [3]OtherCustom)\n");
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing ServiceDiscoveryReq\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;
+    unsigned char buffer[1024]={0};
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[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;
+    for (i = 0; i <leng ; i++)
+    {
+        sprintf((char*)buffer, "%s%02X ", buffer, exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceScope.characters[i]);
+    }
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceScope (%d Bytes, optional): %s\n", leng, buffer);
+
+    //[BODY(2/2)] Service Category
+    int cat = 0;
+    cat = exi_doc_ISO1->V2G_Message.Body.ServiceDiscoveryReq.ServiceCategory;
+    switch (cat)
+    {
+        case iso1serviceCategoryType_EVCharging:             //0
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceCategory: %d (EVCharging)\n", cat);
+            break;
+        }
+        case iso1serviceCategoryType_Internet:               //1
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceCategory: %d (Internet: not supported)\n", cat);
+            break;
+        }
+        case iso1serviceCategoryType_ContractCertificate:    //2
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceCategory: %d (ContractCertificate: not supported)\n", cat);
+            break;
+        }
+        case iso1serviceCategoryType_OtherCustom:            //3
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceCategory: %d (OtherCustom: not supported)\n", cat);
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("ServiceCategory: %d (Unexpected Service Category)\n", cat);
+            break;
+        }
+    }
+    //DEBUG_PRINTF_EXI_ENGINE_DETAIL("\n\t([0]EVCharging, [1]Internet, [2]ContractCertificate, [3]OtherCustom)\n");
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing ServiceDiscoveryReq\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("[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;
+    switch (opt)
+    {
+        case dinpaymentOptionType_Contract:         //0
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("SelectedPaymentOption: %d (Contract)\n", opt);
+            break;
+        }
+
+        case dinpaymentOptionType_ExternalPayment:  //1
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("SelectedPaymentOption: %d (ExternalPayment)\n", opt);
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("SelectedPaymentOption: %d ([Error]Unexpected SelectedPaymentOption)\n", opt);
+            break;
+        }
+    }
+
+    //[BODY(2/2)] SelectedServiceList
+    leng = exi_doc_DIN->V2G_Message.Body.ServicePaymentSelectionReq.SelectedServiceList.SelectedService.arrayLen;
+    for (i = 0; i< leng; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("SelectedServiceList (%d items): [%d-th](ServiceID, ParameterSetID, ParameterSetID_isUsed) = {%d, %d, %d}\n",
+										leng,
+										(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("[END] Parsing ServicePaymentSelectionReq\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("[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;
+    switch (opt)
+    {
+        case iso1paymentOptionType_Contract:         //0
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("SelectedPaymentOption: %d (Contract)\n", opt);
+            break;
+        }
+
+        case iso1paymentOptionType_ExternalPayment:  //1
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("SelectedPaymentOption: %d (ExternalPayment)\n", opt);
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("SelectedPaymentOption: %d (Unexpected SelectedPaymentOption)\n", opt);
+            break;
+        }
+    }
+
+
+    //[BODY(2/2)] SelectedServiceList
+    leng = exi_doc_ISO1->V2G_Message.Body.PaymentServiceSelectionReq.SelectedServiceList.SelectedService.arrayLen;
+    for (i = 0; i< leng; i++)
+    {
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("SelectedServiceList (%d items): [%d-th](ServiceID, ParameterSetID, ParameterSetID_isUsed) = {%d, %d, %d}\n",
+										leng,
+										(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("[END] Parsing PaymentServiceSelectionReq\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("[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("Id_isUsed: %d\n", 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("GenChallenge_isUsed: %d\n", exi_doc_DIN->V2G_Message.Body.ContractAuthenticationReq.GenChallenge_isUsed);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing ContractAuthenticationReq (%d-th)\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("[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("Id_isUsed: %d\n", 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("GenChallenge_isUsed: %d\n", exi_doc_ISO1->V2G_Message.Body.AuthorizationReq.GenChallenge_isUsed);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing AuthorizationReq (%d-th)\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("[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;
+    switch (type)
+    {
+        case dinEVRequestedEnergyTransferType_AC_single_phase_core:    //0,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVRequestedEnergyTransferType: %d (AC_single_phase_core)\n", type);
+            break;
+        }
+    	case dinEVRequestedEnergyTransferType_AC_three_phase_core:     //1,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVRequestedEnergyTransferType: %d (AC_three_phase_core)\n", type);
+            break;
+        }
+    	case dinEVRequestedEnergyTransferType_DC_core:                 //2,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVRequestedEnergyTransferType: %d (DC_core)\n", type);
+            break;
+        }
+    	case dinEVRequestedEnergyTransferType_DC_extended:             //3,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVRequestedEnergyTransferType: %d (DC_extended)\n", type);  //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("EVRequestedEnergyTransferType: %d (DC_combo_core)\n", type);
+            break;
+        }
+    	case dinEVRequestedEnergyTransferType_DC_unique:               //5
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVRequestedEnergyTransferType: %d (DC_unique)\n", type);
+            break;
+        }
+    }
+
+    //===== [BODY (2/3)] AC_EVChargeParameter of EVChargeParameter =====
+    //ignored, since DIN doesn't support AC.
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("AC_EVChargeParameter_isUsed: %d\n", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed);
+
+    //===== [BODY (3/3)] DC_EVChargeParameter of EVChargeParameter =====
+    struct dinPhysicalValueType *obj;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed);
+
+    if(exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed)
+    {
+    	//EVMaxCurrent
+		obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter.EVMaxCurrent;
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaxCurrent: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+		PRINT_dinPhysicalValueType_UNIT(obj);
+
+    	//EVMinCurrent
+		obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter.EVMinCurrent;
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMinCurrent: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+		PRINT_dinPhysicalValueType_UNIT(obj);
+
+    	//EVMaxVoltage
+		obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter.EVMaxVoltage;
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaxVoltage: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+		PRINT_dinPhysicalValueType_UNIT(obj);
+
+    	//EAmount
+		obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter.EAmount;
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("EAmount: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+		PRINT_dinPhysicalValueType_UNIT(obj);
+    }
+
+    if(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;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumCurrentLimit: %d (DEC)\n",  GetValue_dinPhysicalValueType(obj));
+        PRINT_dinPhysicalValueType_UNIT(obj);
+
+        //EVMaximumPowerLimit
+        obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumPowerLimit;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumPowerLimit: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+        PRINT_dinPhysicalValueType_UNIT(obj);
+
+        //EVMaximumVoltageLimit
+        obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumVoltageLimit;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumVoltageLimit: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+        PRINT_dinPhysicalValueType_UNIT(obj);
+
+        //EVEnergyCapacity
+        obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyCapacity;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVEnergyCapacity: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+        PRINT_dinPhysicalValueType_UNIT(obj);
+
+        //EVEnergyRequest
+        obj = &exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyRequest;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVEnergyRequest: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+        PRINT_dinPhysicalValueType_UNIT(obj);
+
+        //FullSOC
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("FullSOC: %d \% (DEC)\n", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.FullSOC);
+
+        //BulkSOC
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("BulkSOC: %d \% (DEC)\n", exi_doc_DIN->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.BulkSOC);
+    }
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing ChargeParameterDiscoveryReq (%d-th)\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("[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;
+    switch (type)
+    {
+        case iso1EnergyTransferModeType_AC_single_phase_core:    //0,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("RequestedEnergyTransferMode: %d (AC_single_phase_core)\n", type);
+            break;
+        }
+    	case iso1EnergyTransferModeType_AC_three_phase_core:     //1,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("RequestedEnergyTransferMode: %d (AC_three_phase_core)\n", type);
+            break;
+        }
+    	case iso1EnergyTransferModeType_DC_core:                 //2,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("RequestedEnergyTransferMode: %d (DC_core)\n", type);
+            break;
+        }
+    	case iso1EnergyTransferModeType_DC_extended:             //3,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("RequestedEnergyTransferMode: %d (DC_extended)\n", type);  //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("RequestedEnergyTransferMode: %d (DC_combo_core)\n", type);
+            break;
+        }
+    	case iso1EnergyTransferModeType_DC_unique:               //5
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("RequestedEnergyTransferMode: %d (DC_unique)\n", type);
+            break;
+        }
+    }
+
+    //===== [BODY (2/3)] AC_EVChargeParameter of EVChargeParameter =====
+    //ignored, since our ISO1 doesn't support AC.
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("AC_EVChargeParameter_isUsed: %d\n", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed);
+
+    //===== [BODY (3/3)] DC_EVChargeParameter of EVChargeParameter =====
+    struct iso1PhysicalValueType *obj;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed);
+
+
+    if(exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter_isUsed)
+    {
+    	//EVMaxCurrent
+		obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter.EVMaxCurrent;
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaxCurrent: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+		PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    	//EVMinCurrent
+		obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter.EVMinCurrent;
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMinCurrent: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+		PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    	//EVMaxVoltage
+		obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter.EVMaxVoltage;
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaxVoltage: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+		PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    	//EAmount
+		obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.AC_EVChargeParameter.EAmount;
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("EAmount: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+		PRINT_iso1PhysicalValueType_UNIT(obj);
+    }
+
+    if(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;
+        if(exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter_isUsed)PRINT_iso1DC_EVStatusType(status);
+
+        //EVMaximumCurrentLimit
+        obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumCurrentLimit;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumCurrentLimit: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+        PRINT_iso1PhysicalValueType_UNIT(obj);
+
+        //EVMaximumPowerLimit
+        obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumPowerLimit;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumPowerLimit: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+        PRINT_iso1PhysicalValueType_UNIT(obj);
+
+        //EVMaximumVoltageLimit
+        obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVMaximumVoltageLimit;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumVoltageLimit: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+        PRINT_iso1PhysicalValueType_UNIT(obj);
+
+        //EVEnergyCapacity
+        obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyCapacity;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVEnergyCapacity: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+        PRINT_iso1PhysicalValueType_UNIT(obj);
+
+        //EVEnergyRequest
+        obj = &exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.EVEnergyRequest;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVEnergyRequest: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+        PRINT_iso1PhysicalValueType_UNIT(obj);
+
+        //FullSOC
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("FullSOC: %d \% (DEC)\n", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.FullSOC);
+
+        //BulkSOC
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("BulkSOC: %d \% (DEC)\n", exi_doc_ISO1->V2G_Message.Body.ChargeParameterDiscoveryReq.DC_EVChargeParameter.BulkSOC);
+    }
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing ChargeParameterDiscoveryReq (%d-th)\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("[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("[END] Parsing CableCheckReq (%d-th)\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("[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("[END] Parsing CableCheckReq (%d-th)\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("[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 =====
+    struct dinPhysicalValueType *obj;
+    obj = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.EVTargetVoltage;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVTargetVoltage: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    //===== [BODY (3/3)] EVTargetCurrent =====
+    obj = &exi_doc_DIN->V2G_Message.Body.PreChargeReq.EVTargetCurrent;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVTargetCurrent: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing PreChargeReq (%d-th)\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("[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 =====
+    struct iso1PhysicalValueType *obj;
+    obj = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.EVTargetVoltage;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVTargetVoltage: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    //===== [BODY (3/3)] EVTargetCurrent =====
+    obj = &exi_doc_ISO1->V2G_Message.Body.PreChargeReq.EVTargetCurrent;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVTargetCurrent: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing PreChargeReq (%d-th)\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("[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("ReadyToChargeState: %d (DEC)\n", exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.ReadyToChargeState);
+
+
+    //===== [BODY (2/3)] ChargingProfile =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("ChargingProfile_isUsed: %d (DEC)\n", exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.ChargingProfile_isUsed);
+
+
+    //===== [BODY (3/3)] DC_EVPowerDeliveryParameter =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVPowerDeliveryParameter_isUsed: %d (DEC)\n", exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter_isUsed);
+
+    if(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("BulkChargingComplete: %d (DEC)\n", exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete);
+
+        //BulkChargingComplete_isUsed
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("BulkChargingComplete_isUsed: %d (DEC)\n", exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete_isUsed);
+
+        //ChargingComplete
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("ChargingComplete: %d (DEC)\n", exi_doc_DIN->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.ChargingComplete);
+    }
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing PowerDeliveryReq (%d-th)\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("[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("ChargeProgress: %d (DEC, 0:start, 1:stop, 2:re-negotiate)\n", 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("ChargingProfile_isUsed = %d (DEC)\n", exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.ChargingProfile_isUsed);
+
+
+    //===== [BODY (3/3)] DC_EVPowerDeliveryParameter =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVPowerDeliveryParameter_isUsed = %d (DEC)\n", exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter_isUsed);
+
+    if(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("BulkChargingComplete = %d (DEC)\n", exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete);
+
+        //BulkChargingComplete_isUsed
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("BulkChargingComplete_isUsed = %d (DEC)\n", exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.BulkChargingComplete_isUsed);
+
+        //ChargingComplete
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("ChargingComplete = %d (DEC)\n", exi_doc_ISO1->V2G_Message.Body.PowerDeliveryReq.DC_EVPowerDeliveryParameter.ChargingComplete);
+    }
+
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing PowerDeliveryReq (%d-th)\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("[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 =====
+    struct dinPhysicalValueType *obj;
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVTargetCurrent: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (3/10)] EVMaximumVoltageLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed);
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumVoltageLimit: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+
+    //===== [BODY (4/10)] EVMaximumCurrentLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed);
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumCurrentLimit: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (5/10)] EVMaximumPowerLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed);
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumPowerLimit: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (6/10)] BulkChargingComplete =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("BulkChargingComplete_isUsed: %d\n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("BulkChargingComplete: %d\n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete);
+
+
+    //===== [BODY (7/10)] ChargingComplete =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("ChargingComplete: %d\n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.ChargingComplete);
+
+
+    //===== [BODY (8/10)] RemainingTimeToFullSoC =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed);
+
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("RemainingTimeToFullSoC: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (9/10)] RemainingTimeToBulkSoC =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed);
+
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("RemainingTimeToBulkSoC: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+
+    //===== [BODY (10/10)] EVTargetVoltage =====
+    obj = &exi_doc_DIN->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVTargetVoltage: %d (DEC)\n", GetValue_dinPhysicalValueType(obj));
+    PRINT_dinPhysicalValueType_UNIT(obj);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing CurrentDemandReq (%d-th)\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("[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 =====
+    struct iso1PhysicalValueType *obj;
+    obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVTargetCurrent;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVTargetCurrent: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    //===== [BODY (3/10)] EVMaximumVoltageLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed);
+    if(exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit_isUsed)
+    {
+    	obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumVoltageLimit;
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumVoltageLimit: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+		PRINT_iso1PhysicalValueType_UNIT(obj);
+    }
+
+    //===== [BODY (4/10)] EVMaximumCurrentLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed);
+    if(exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit_isUsed)
+    {
+        obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumCurrentLimit;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumCurrentLimit: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+        PRINT_iso1PhysicalValueType_UNIT(obj);
+    }
+
+    //===== [BODY (5/10)] EVMaximumPowerLimit =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed);
+    if(exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit_isUsed)
+    {
+        obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVMaximumPowerLimit;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVMaximumPowerLimit: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+        PRINT_iso1PhysicalValueType_UNIT(obj);
+    }
+
+    //===== [BODY (6/10)] BulkChargingComplete =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("BulkChargingComplete_isUsed: %d\n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed);
+    if(exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete_isUsed)
+    	DEBUG_PRINTF_EXI_ENGINE_DETAIL("BulkChargingComplete: %d\n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.BulkChargingComplete);
+
+
+    //===== [BODY (7/10)] ChargingComplete =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("ChargingComplete: %d\n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.ChargingComplete);
+
+
+    //===== [BODY (8/10)] RemainingTimeToFullSoC =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed);
+    if(exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC_isUsed)
+    {
+        obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToFullSoC;
+        DEBUG_PRINTF_EXI_ENGINE_DETAIL("RemainingTimeToFullSoC: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+        PRINT_iso1PhysicalValueType_UNIT(obj);
+    }
+
+
+    //===== [BODY (9/10)] RemainingTimeToBulkSoC =====
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("DC_EVChargeParameter_isUsed: %d\n", exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed);
+    if(exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC_isUsed)
+    {
+    	obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.RemainingTimeToBulkSoC;
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("RemainingTimeToBulkSoC: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+		PRINT_iso1PhysicalValueType_UNIT(obj);
+    }
+
+    //===== [BODY (10/10)] EVTargetVoltage =====
+    obj = &exi_doc_ISO1->V2G_Message.Body.CurrentDemandReq.EVTargetVoltage;
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVTargetVoltage: %d (DEC)\n", GetValue_iso1PhysicalValueType(obj));
+    PRINT_iso1PhysicalValueType_UNIT(obj);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("[END] Parsing CurrentDemandReq (%d-th)\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("[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("[END] Parsing ChargingStatusReq (%d-th)\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("[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("[END] Parsing WeldingDetectionReq (%d-th)\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("[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("[END] Parsing WeldingDetectionReq (%d-th)\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("[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("[END] Parsing SessionStopReq (%d-th)\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("[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("[END] Parsing SessionStopReq (%d-th)\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_SHOW == ENABLE)
+	int i = 0;
+	unsigned char buffer[1024] = {0};
+
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("========== Got a new V2GTP Message ==========\n");
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("SIZE: %d (Bytes, DEC)\n", (int)stream->size);
+	for (i = 0; i < stream->size; i++)
+	{
+		sprintf((char*)buffer, "%s%02x ", buffer, stream->data[i]);
+	}
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("DATA (HEX): %s\n", buffer);
+
+#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]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]decode_appHandExiDocument() fail\n");
+			errn = -1;
+		}
+	}
+
+	return errn;
+}
+
+
+int API_V2GMSG_EXI_Encoder_AppProtocol(struct appHandEXIDocument *exi_doc, bitstream_t *exi_packet)
+{
+	unsigned char buffer[1024]={0};
+	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("-----  supportedAppProtocolRes [START] -----\n");
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("SIZE: %d (Bytes, DEC)\n", (int)exi_packet->size);
+	for (i = 0; i < (int)exi_packet->size; i++)
+	{
+		sprintf((char*)buffer, "%s%02x ", buffer, exi_packet->data[i]);
+	}
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("DATA (HEX): %s\n", buffer);
+	DEBUG_PRINTF_EXI_ENGINE_DETAIL("-----  supportedAppProtocolRes [END] -----\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)
+{
+	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("[Error]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("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]decode_dinExiDocument: %d (DEC)\n", errn);
+			errn = -1;
+		}
+	}
+	else
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]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)
+{
+	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("[Error]payloadLengthDec = 0\n");
+		errn = -1;
+	}
+
+	if (errn == 0)
+	{
+		//STEP 2: Parsing Payload EXI Message
+		*iStream.pos = V2GTP_HEADER_LENGTH;
+		errn = decode_iso1ExiDocument(&iStream, exi_doc_ISO1);
+		//The "event code" inside this function could present which kind of message it is.
+
+		if (errn == 0)
+		{
+			// successfully received and parsed.
+			//DEBUG_PRINTF_EXI_ENGINE_DETAIL("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]decode_iso1ExiDocument: %d (DEC)\n", errn);
+			errn = -1;
+		}
+	}
+	else
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[ERROR]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)
+{
+	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("[Error]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("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]decode_iso2ExiDocument: %d (DEC)\n", errn);
+		}
+	}
+	else
+	{
+		DEBUG_PRINTF_EXI_ENGINE_DETAIL("[Error]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)\n");
+			break;
+		}
+		case iso1unitSymbolType_m:      // = 1,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: m)\n");
+			break;
+		}
+		case iso1unitSymbolType_s:      // = 2,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: s)\n");
+			break;
+		}
+		case iso1unitSymbolType_A:      // = 3,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: A)\n");
+			break;
+		}
+		case iso1unitSymbolType_V:      // = 4,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: V)\n");
+			break;
+		}
+		case iso1unitSymbolType_W:      // = 5,
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: W)\n");
+			break;
+		}
+		case iso1unitSymbolType_Wh:     // = 6
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("(unit: Wh)\n");
+			break;
+		}
+		default:
+		{
+			DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] unit: unexpected iso1PhysicalValueType unit)\n");
+			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)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_RESSTemperatureInhibit:      // = 1,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_RESSTemperatureInhibit)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_EVShiftPosition:             // = 2,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVShiftPosition)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_ChargerConnectorLockFault:   // = 3,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(ChargerConnectorLockFault)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_EVRESSMalfunction:           // = 4,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_EVRESSMalfunction)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_ChargingCurrentdifferential: // = 5,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingCurrentdifferential)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_ChargingVoltageOutOfRange:   // = 6,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingVoltageOutOfRange)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_Reserved_A:                         // = 7,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_A)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_Reserved_B:                         // = 8,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_B)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_Reserved_C:                         // = 9,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(Reserved_C)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_FAILED_ChargingSystemIncompatibility:// = 10,
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(FAILED_ChargingSystemIncompatibility)\n");
+            break;
+        }
+    	case iso1DC_EVErrorCodeType_NoData:                             // = 11
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("(NoData)\n");
+            break;
+        }
+        default:
+        {
+            DEBUG_PRINTF_EXI_ENGINE_DETAIL("([WARNING] Unexpected iso1 EVErrorCode)\n");
+            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("DC_EVStatus:\n");
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVReady = %d (DEC)\n", status->EVReady);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVErrorCode = %d (DEC)\n", status->EVErrorCode);
+    PRINT_dinDC_EVErrorCodeType(status);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVRESSSOC = %d \%(DEC)\n", status->EVRESSSOC);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVCabinConditioning = %d (DEC)\n", status->EVCabinConditioning);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVCabinConditioning_isUsed = %d (DEC)\n", status->EVCabinConditioning_isUsed);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVRESSConditioning = %d (DEC)\n", status->EVRESSConditioning);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("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("DC_EVStatus:\n");
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVReady = %d (DEC)\n", status->EVReady);
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVErrorCode = %d (DEC)\n", status->EVErrorCode);
+    PRINT_iso1DC_EVErrorCodeType(status);
+
+    DEBUG_PRINTF_EXI_ENGINE_DETAIL("EVRESSSOC = %d \%(DEC)\n", status->EVRESSSOC);
+}

+ 182 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/api/api.h

@@ -0,0 +1,182 @@
+/*===========================================================================
+                    Combined Charging System (CCS): SECC
+                                 api.h
+
+                          initiated by Joseph
+                           (since 2019/08/07)
+=============================================================================*/
+#include "define_ccs.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     ENABLE   //ENABLE, DISABLE
+#define DEBUG_PRINTF_EXI_ENGINE_DETAIL_SHOW    ENABLE   //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(format, args...) StoreLogV2GMsg("[%s:%d][%s] "format, (strrchr((strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__), '/') ? strrchr((strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__), '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
+    #else
+        #define DEBUG_PRINTF_EXI_ENGINE_BRIEF(...)
+    #endif
+
+    #if DEBUG_PRINTF_EXI_ENGINE_DETAIL_SHOW == ENABLE
+        #define DEBUG_PRINTF_EXI_ENGINE_DETAIL(format, args...) StoreLogV2GMsg("[%s:%d][%s] "format, (strrchr((strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__), '/') ? strrchr((strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__), '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
+    #else
+        #define DEBUG_PRINTF_EXI_ENGINE_DETAIL(...)
+    #endif
+#else
+    #define DEBUG_PRINTF_EXI_ENGINE_BRIEF(...)
+    #define DEBUG_PRINTF_EXI_ENGINE_DETAIL(...)
+#endif
+
+int StoreLogV2GMsg(const char *fmt, ...);

+ 64 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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

File diff suppressed because it is too large
+ 345 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/din/dinEXIDatatypesDecoder.c


+ 65 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/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

File diff suppressed because it is too large
+ 281 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/din/dinEXIDatatypesEncoder.c


+ 68 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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

File diff suppressed because it is too large
+ 9847 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/iso1/iso1EXIDatatypesDecoder.c


+ 65 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/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

File diff suppressed because it is too large
+ 7011 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/iso1/iso1EXIDatatypesEncoder.c


+ 68 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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

File diff suppressed because it is too large
+ 63551 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/iso2/iso2EXIDatatypesDecoder.c


+ 65 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/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

File diff suppressed because it is too large
+ 44215 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/iso2/iso2EXIDatatypesEncoder.c


+ 68 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/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

+ 92 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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/AX80/Apps/CCS/v2g/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

File diff suppressed because it is too large
+ 4331 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/xmldsig/xmldsigEXIDatatypesDecoder.c


+ 65 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/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

File diff suppressed because it is too large
+ 3100 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/xmldsig/xmldsigEXIDatatypesEncoder.c


+ 66 - 0
EVSE/Projects/AX80/Apps/CCS/v2g/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

+ 2576 - 0
EVSE/Projects/AX80/Apps/LCM/Module_LcmControl.c

@@ -0,0 +1,2576 @@
+/*
+ * Module_LcmControl.c
+ *
+ * Created on : 2020-10-20
+ * Update on : 2021-06-23
+ * Author : Folus Wen, Eason Yang
+ * Version : D0.01
+ *
+ */
+
+#include 	<sys/time.h>
+#include	"define.h"
+#include	"main.h"
+#include 	"lcmComm_dgus.h"
+#include	"cbmp.h"
+
+//=======================================
+// Declare share memory
+//=======================================
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData 			*ShmStatusCodeData;
+struct OCPP16Data				*ShmOCPP16Data;
+struct OCPP20Data				*ShmOCPP20Data;
+struct Charger					*ShmCharger;
+
+//=======================================
+// Declare Basic function
+//=======================================
+void trim(char *s);
+int mystrcmp(char *p1,char *p2);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+uint8_t split(char **arr, char *str, const char *del);
+void string2ByteArray(uint8_t *input, uint8_t *output);
+
+//=======================================
+// Declare Control panel function
+//=======================================
+uint8_t getCurrentPage();
+void setCurrentPage(uint8_t page);
+void setCurrencyFromWebsite(uint8_t unit);
+void setWarningStatus(uint8_t gun_index);
+void setAuthorizationPage(uint8_t gun_index);
+void setPriceFromWebsite(float monry_rate);
+void setBillingFromBackend(uint8_t gun_index, uint8_t system_mode);
+void setPresentChargedEnergy(uint8_t gun_index);
+void setPresentChargingPower(uint8_t gun_index);
+void setBatteryPercentageValue(uint8_t gun_index);
+void setPresentChargedDuration(uint8_t gun_index);
+void setPresentPowerConsumption(uint8_t gun_index);
+void setQRcodeContent(char *input, uint8_t length, uint8_t mode);
+void setDisplayValue(uint16_t address, uint8_t value);
+void setGunPluginAnimation(uint8_t gun_index);
+void setBatteryAnimation(uint8_t gun_index, uint8_t system_mode);
+void setConnectionAnimation(uint8_t gun_index, uint8_t system_mode);
+void setPresentFinalCost(float cost);
+float getPresentFinalCost(uint8_t gun_index);
+void setDefaultValue(uint8_t gun_index, uint8_t system_mode);
+
+void setUserPrice(uint8_t type);
+void setDefaultPrice(uint8_t type);
+void setFinalCost(uint8_t gun_index, uint8_t type);
+void setCurrencyAndUnitFromBackend(uint8_t type_price,uint8_t type_currency_unit, uint8_t gun_index);
+
+void setRTC();
+void setRfidIcon();
+void setWifi4GIcon();
+void setQRCodeIcon();
+void setBackendIcon();
+void setEthernetIcon();
+void setAlarmCodeAndIcon();
+void setBillingFromWebsite();
+void setQRCodeReceipt(uint8_t gun_index);
+
+//=======================================
+// Declare Timer
+//=======================================
+enum TMR_IDX
+{
+	TMR_IDX_BATTERY=0,
+	TMR_IDX_CONNECTION,
+	TMR_IDX_PLUGIN,
+	TMR_IDX_ALARM,
+	TMR_IDX_PRICE,
+	TMR_IDX_EMULATOR,
+	TMR_IDX_6,
+	TMR_IDX_7,
+	TMR_IDX_8,
+	TMR_IDX_SHOW_AUTH_RESULT
+};
+
+struct timeb					startTime[AC_QUANTITY][10];
+
+#define TIME_ANIMATION_PLUGIN			1000
+#define TIME_ANIMATION_BATTERY			1000
+#define TIME_ANIMATION_CONNECTION		1000
+#define TIME_ANIMATION_ALARM			5000
+#define TIME_REFRESH_TIME				5000
+#define TIME_AUTH_RESULT_TIME			5000
+
+//=======================================
+// Declare Variable
+//=======================================
+uint8_t BATTERY_LEVEL_STATUS = BATTERY_LEVEL_5;
+uint8_t CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_0;
+uint8_t GUN_PLUGING_LEVEL_STATUS = GUN_PLUGING_LEVEL_0;
+uint8_t WarningCount = 255;
+
+int Uart1Fd;
+
+//=======================================
+// Emulator
+//=======================================
+int PERCENTAGE;
+uint8_t isChange;
+uint8_t isEmulator	= NO;
+uint8_t isCharging	= YES;
+
+//=======================================
+// Record version and date
+//=======================================
+char *FIRMWARE_UPDATE_IMAGE[3] = {"V0.21", "2021-10-22", "REV.01.00"};
+
+//=======================================
+// Common routine
+//=======================================
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(Buf,"echo -n \'[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\' >> /Storage/SystemLog/[%04d.%02d]Module_LcmControlLog",
+						tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+						buffer,
+						tm->tm_year+1900,tm->tm_mon+1);
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+long long DiffTimebWithNow(struct timeb ST)
+{
+	//return milli-second
+	struct timeb ET;
+	long long StartTime,StopTime;
+
+	ftime(&ET);
+	StartTime=(long long)ST.time;
+	StopTime=(long long)ET.time;
+	return ((StopTime-StartTime)*1000) + (ET.millitm-ST.millitm);
+}
+
+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;
+}
+
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+void trim_string(char *s, unsigned char len)
+{
+	for(unsigned char i = 0 ; i < len; i++)
+	{
+		if (!(s[i] =='.')&& !((s[i]>='0') && (s[i]<='9')))
+		{
+			s[i] = s[i + 1];
+			strncpy(s + i, s + i + 1, len);
+			i -= 1;
+			len -= 1;
+		}
+	}
+	s[len + 1] = '\0';
+}
+
+int mystrcmp(char *p1,char *p2)
+{
+    while(*p1==*p2)
+    {
+        if(*p1=='\0' || *p2=='\0')
+            break;
+        p1++;
+        p2++;
+    }
+    if(*p1=='\0' && *p2=='\0')
+        return(PASS);
+    else
+        return(FAIL);
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+uint8_t split(char **arr, char *str, const char *del)
+{
+	uint8_t result = 0;
+	char *s = strtok(str, del);
+
+	while(s != NULL)
+	{
+		*arr++ = s;
+		result += 1;
+		s = strtok(NULL, del);
+	}
+
+	return result;
+}
+
+void getDateTimeString(char* result)
+{
+	time_t CurrentTime;
+	struct tm *tm;
+
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+
+	sprintf(result, "%04d/%02d/%02d %02d:%02d", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min);
+}
+
+//=======================================
+// Function to page routine
+//=======================================
+void page_booting()
+{
+	if(getCurrentPage() != SYSTEM_SCREEN_BOOTING)
+	{
+		setCurrentPage(SYSTEM_SCREEN_BOOTING);
+		DEBUG_INFO("Setting page to booting.\n");
+	}
+	else
+	{}
+}
+
+void page_idle(uint8_t gun_index, uint8_t system_mode)
+{
+	if(ShmCharger->gun_info[gun_index].isSleepOn == YES)
+	{
+		if((getCurrentPage() != SYSTEM_SCREEN_SLEEP))
+		{
+			setCurrentPage(SYSTEM_SCREEN_SLEEP);
+		}
+		else
+		{}
+	}
+	else
+	{
+		if(ShmCharger->gun_info[gun_index].isCheckPowerConsumption == YES)
+		{
+			setCurrentPage(SYSTEM_SCREEN_POWER_CONSUMPTION);
+			setDisplayValue(ICON_POWER_CONSUMPTION, APPEAR);
+			setPresentPowerConsumption(gun_index);
+		}
+		else
+		{
+			if((getCurrentPage() != SYSTEM_SCREEN_IDLE) && (ShmCharger->gun_info[gun_index].resultAuthorization != VALIDATED_RFID))
+			{
+				setCurrentPage(SYSTEM_SCREEN_IDLE);
+				setDefaultValue(gun_index, system_mode);
+				DEBUG_INFO("Setting page to idle.\n");
+			}
+			else
+			{
+				setRfidIcon();
+				setQRCodeIcon();
+
+				if(isEmulator == YES)
+				{
+					//if(isCharging == YES)
+						//PERCENTAGE = 0;
+					//else
+						//PERCENTAGE = 100;
+				}
+			}
+		}
+	}
+}
+
+void page_authorizing(uint8_t gun_index)
+{
+	// CHANGE DISPLAY TO AUTHORIZATION
+	setAuthorizationPage(gun_index);
+
+	// SHOW USER ACCOUNT BALANCE WHEN THE SYSTEM IS ONLINE
+	if((ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON))
+	{
+		if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+		{
+			if((strcmp((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, (char *)ShmOCPP16Data->Cost.SetUserPrice.idToken) == 0) &&
+			   ((strcmp((char *)ShmOCPP16Data->Cost.SetUserPrice.idToken,"") != 0)))
+			{
+				// SEARCHING USER PRICE FOR ACCOUNT BALANCE
+				setUserPrice(ACCOUNT_BALANCE);
+			}
+			else
+			{
+				// DISAPPEAR ACCOUNT BALANCE AND ICON
+				setDisplayValue(ICON_BALANCE_WALLET, DISAPPEAR);
+				setDisplayValue(TEXT_BALANCE, DISAPPEAR);
+			}
+		}
+		else
+		{
+			// DISPLAY BY OCPP 2.0.1
+		}
+	}
+	else
+	{
+		// DISAPPEAR ACCOUNT BALANCE AND ICON
+		setDisplayValue(ICON_BALANCE_WALLET, DISAPPEAR);
+		setDisplayValue(TEXT_BALANCE, DISAPPEAR);
+	}
+}
+
+void page_preparing(uint8_t gun_index, uint8_t system_mode)
+{
+	// CHECK PREPARING MODE (BS & SOCKET) / HLC
+	if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+	{
+		if((getCurrentPage() != SYSTEM_SCREEN_PREPARE_FOR_EVSE))
+		{
+			setCurrentPage(SYSTEM_SCREEN_PREPARE_FOR_EVSE);
+			setDefaultValue(gun_index, system_mode);
+			DEBUG_INFO("Setting page to prepare for EVSE.\n");
+		}
+		else
+		{
+			setConnectionAnimation(gun_index, system_mode);
+		}
+	}
+	else
+	{
+		if((getCurrentPage() != SYSTEM_SCREEN_PREPARING))
+		{
+			setCurrentPage(SYSTEM_SCREEN_PREPARING);
+			setDefaultValue(gun_index, system_mode);
+			DEBUG_INFO("Setting page to preparing.\n");
+		}
+		else
+		{
+			setGunPluginAnimation(gun_index);
+		}
+	}
+}
+
+void page_charging(uint8_t gun_index, uint8_t system_mode)
+{
+	if((getCurrentPage() != SYSTEM_SCREEN_CHARGING) && (!ShmCharger->isAuthrizing && !ShmCharger->isGetAuthResult))
+	{
+		setCurrentPage(SYSTEM_SCREEN_CHARGING);
+		setDefaultValue(gun_index, system_mode);
+		DEBUG_INFO("Setting page to charging.\n");
+
+		//isChange = 0;
+		//ftime(&startTime[gun_index][TMR_IDX_EMULATOR]);
+	}
+	else
+	{
+		setConnectionAnimation(gun_index, system_mode);
+		setBatteryAnimation(gun_index, system_mode);
+		setPresentChargedDuration(gun_index);
+		setPresentChargedEnergy(gun_index);
+		setPresentChargingPower(gun_index);
+	}
+}
+
+void page_complete(uint8_t gun_index, uint8_t system_mode)
+{
+	if(getCurrentPage() != SYSTEM_SCREEN_COMPLETE)
+	{
+		setCurrentPage(SYSTEM_SCREEN_COMPLETE);
+		DEBUG_INFO("Setting page to complete.\n");
+	}
+	else
+	{
+		setPresentChargedEnergy(gun_index);
+		setPresentChargedDuration(gun_index);
+		setBatteryAnimation(gun_index, system_mode);
+		setQRCodeReceipt(gun_index);
+
+		// SHOW FINAL COST AND ACCOUNT BALANCE AFTER THE END OF TRANSACTION
+		if((ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON))
+		{
+			if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+			{
+				setFinalCost(gun_index, TOTAL_COST);
+				setFinalCost(gun_index, ACCOUNT_BALANCE);
+				setCurrencyAndUnitFromBackend(FINAL_COST, ACCOUNT_BALANCE, gun_index);
+			}
+			else
+			{
+				// DISPLAY BY OCPP 2.0.1
+			}
+		}
+		else
+		{
+			if(ShmSysConfigAndInfo->SysConfig.BillingData.isBilling == ON)
+			{
+				// APPEAR COST AND ICON
+				setDisplayValue(ICON_COST_COMPLETE, APPEAR);
+				setPresentFinalCost(getPresentFinalCost(gun_index));
+			}
+			else
+			{
+				// DISAPPEAR ACCOUNT BALANCE AND ICON
+				setDisplayValue(ICON_WALLER_COMPLETE, DISAPPEAR);
+				setDisplayValue(TEXT_ACCOUNT_COMPLETE, DISAPPEAR);
+
+				// DISAPPEAR COST AND ICON
+				setDisplayValue(ICON_COST_COMPLETE, DISAPPEAR);
+				setDisplayValue(TEXT_COST_COMPLETE, DISAPPEAR);
+
+				// DISAPPEAR BALANCE CURRENCY UNIT
+				setDisplayValue(TEXT_CURRENCY_COMPLETE, DISAPPEAR);
+			}
+		}
+	}
+}
+
+void page_terminating(uint8_t gun_index, uint8_t system_mode)
+{
+	if((getCurrentPage() != SYSTEM_SCREEN_TERMINATING) && (!ShmCharger->isAuthrizing && !ShmCharger->isGetAuthResult))
+	{
+		setCurrentPage(SYSTEM_SCREEN_TERMINATING);
+		setDefaultValue(gun_index, system_mode);
+		DEBUG_INFO("Setting page to terminating.\n");
+	}
+	else
+	{
+		setConnectionAnimation(gun_index, system_mode);
+		setBatteryAnimation(gun_index, system_mode);
+		setPresentChargedDuration(gun_index);
+		setPresentChargedEnergy(gun_index);
+		setPresentChargingPower(gun_index);
+		setQRCodeReceipt(gun_index);
+
+		if((ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON))
+		{
+			if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+			{
+				setFinalCost(gun_index, TOTAL_COST);
+				setFinalCost(gun_index, ACCOUNT_BALANCE);
+				setCurrencyAndUnitFromBackend(FINAL_COST, ACCOUNT_BALANCE, gun_index);
+			}
+			else
+			{
+				// DISPLAY BY OCPP 2.0.1
+			}
+		}
+		else
+		{
+			// DISAPPEAR ACCOUNT BALANCE AND ICON
+			setDisplayValue(ICON_WALLER_COMPLETE, DISAPPEAR);
+			setDisplayValue(TEXT_ACCOUNT_COMPLETE, DISAPPEAR);
+
+			// DISAPPEAR COST ADN ICON
+			setDisplayValue(ICON_COST_COMPLETE, DISAPPEAR);
+			setDisplayValue(TEXT_COST_COMPLETE, DISAPPEAR);
+
+			// DISAPPEAR BALANCE CURRENCY UNIT
+			setDisplayValue(TEXT_CURRENCY_COMPLETE, DISAPPEAR);
+		}
+	}
+}
+
+void page_alarm()
+{
+	if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip != ON)
+	{
+		if(getCurrentPage() != SYSTEM_SCREEN_MAINTAIN)
+		{
+			setCurrentPage(SYSTEM_SCREEN_MAINTAIN);
+			DEBUG_INFO("Setting page to repair man.\n");
+		}
+		else
+		{}
+	}
+	else
+	{
+		if(getCurrentPage() != SYSTEM_SCREEN_EMERGENCY)
+		{
+			setCurrentPage(SYSTEM_SCREEN_EMERGENCY);
+			DEBUG_INFO("Setting page to emergency.\n");
+		}
+		else
+		{}
+	}
+}
+
+void page_fault()
+{
+	//DEBUG_INFO("Page fault.\n");
+}
+
+void page_maintain()
+{
+	if(getCurrentPage() != SYSTEM_SCREEN_MAINTAIN)
+	{
+		setCurrentPage(SYSTEM_SCREEN_MAINTAIN);
+		DEBUG_INFO("Setting page to maintain.\n");
+	}
+	else
+	{}
+}
+
+void page_update()
+{
+	if(getCurrentPage() != SYSTEM_SCREEN_MAINTAIN)
+	{
+		setCurrentPage(SYSTEM_SCREEN_MAINTAIN);
+		DEBUG_INFO("Setting page to update.\n");
+	}
+	else
+	{}
+}
+
+void page_reservation()
+{
+	//DEBUG_INFO("Page reservation.\n");
+}
+
+void page_booking()
+{
+	//DEBUG_INFO("Page booking.\n");
+}
+
+void page_debug()
+{
+	if(getCurrentPage() != SYSTEM_SCREEN_MAINTAIN)
+	{
+		setCurrentPage(SYSTEM_SCREEN_MAINTAIN);
+		DEBUG_INFO("Setting page to debug.\n");
+	}
+	else
+	{}
+}
+
+void page_unknown()
+{
+	//DEBUG_INFO("Page unknown.\n");
+}
+
+void page_header(uint8_t gun_index, uint8_t system_mode)
+{
+	setEthernetIcon();
+	setBackendIcon();
+	setWifi4GIcon();
+	setWarningStatus(gun_index);
+
+	// CHANGE LCD BRIGHNESS ( POWER SAVING MODE )
+	if((ShmCharger->isLcdOn == ON))
+		setDisplayValue(REG_ADDRESS_WRITE_BRIGHTNESS,BRIGHTNESS_100);
+	else
+		setDisplayValue(REG_ADDRESS_WRITE_BRIGHTNESS,BRIGHTNESS_10);
+
+	// SET BILLING
+	if((ShmSysConfigAndInfo->SysConfig.BillingData.isBilling == ON) && (ShmSysConfigAndInfo->SysInfo.OcppConnStatus != ON))
+	{
+		setBillingFromWebsite();
+	}
+	else
+	{
+		// EVERY 5 SECONDS TO UPDATE PRICE
+		if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_PRICE]) > (TIME_REFRESH_TIME))
+		{
+			ftime(&startTime[gun_index][TMR_IDX_PRICE]);
+			setBillingFromBackend(gun_index, system_mode);
+		}
+	}
+}
+
+void page_footer()
+{
+	setRTC();
+}
+
+//=======================================
+// Setting icon display value
+//=======================================
+void setDisplayValue(uint16_t address, uint8_t value)
+{
+	uint8_t data[2];
+
+	data[0] = value >> 8;
+	data[1] = value & 0X00FF;
+
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, address, data, ARRAY_SIZE(data));
+}
+
+//=======================================
+// Getting current page
+//=======================================
+uint8_t getCurrentPage()
+{
+	uint8_t currentPage[2];
+	uint8_t result = 255;
+
+	if(lcdRegisterRead(Uart1Fd, REG_TYPE_CONTROL, REG_ADDRESS_READ_PAGE_ID, currentPage, ARRAY_SIZE(currentPage)))
+	{
+		result = currentPage[1];
+
+		// DEBUG_INFO("currentPage[0] : %X\n", currentPage[0]);
+		// DEBUG_INFO("currentPage[1] : %X\n", currentPage[1]);
+		// DEBUG_INFO("Getting current page : [%d] \n", result);
+	}
+	else
+	{
+		DEBUG_INFO("Getting current page fail! \n");
+	}
+
+	return result;
+}
+
+//=======================================
+// Setting current page
+//=======================================
+void setCurrentPage(uint8_t page)
+{
+	uint8_t settingPage[2] = {0x00, page};
+
+	if(lcdRegisterWrite(Uart1Fd, REG_TYPE_CONTROL, REG_ADDRESS_SET_PAGE_ID, settingPage, ARRAY_SIZE(settingPage)))
+		DEBUG_INFO("Setting current page to : [%d] \n", page);
+	else
+		DEBUG_INFO("Setting current page fail! \n");
+}
+
+//=======================================
+// Convert string to byte array
+//=======================================
+void string2ByteArray(unsigned char *input, uint8_t *output)
+{
+    int loop;
+    int i;
+
+    loop = 0;
+    i = 0;
+
+    while(input[loop] != '\0')
+    {
+        output[i++] = input[loop++];
+    }
+    output[loop] = '\0';
+}
+
+//=======================================
+// Setting ETHERNET icon status
+//=======================================
+void setEthernetIcon()
+{
+	if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet == ON)
+		setDisplayValue(ICON_ETHERENT_CONNECTION, ETHERENT_OFFLINE);
+	else
+		setDisplayValue(ICON_ETHERENT_CONNECTION, EHTERNET_ONLINE);
+}
+
+//=======================================
+// Setting BACKEND icon status
+//=======================================
+void setBackendIcon()
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppConnStatus != ON)
+		setDisplayValue(ICON_BACKEND_CONNECTION,BACKEND_OFFLINE);
+	else
+		setDisplayValue(ICON_BACKEND_CONNECTION,BACKEND_ONLINE);
+}
+
+//=======================================
+// Setting WIFI / 4G icon status
+//=======================================
+void setWifi4GIcon()
+{
+	// SET WIFI + 4G ICON STATUS ( ONLINE OR OFFLINE )
+	if(ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D')
+	{
+		if(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == DISABLE_WIFI)
+		{
+			if(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled == DISABLE_4G)
+			{
+				setDisplayValue(ICON_WIFI_CONNECTION, DISAPPEAR);
+				setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
+			}
+			else
+			{
+				setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
+				if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi == ON)
+					setDisplayValue(ICON_WIFI_CONNECTION, TELECOM_OFFLINE);
+				else
+					setDisplayValue(ICON_WIFI_CONNECTION, TELECOM_ONLINE);
+			}
+		}
+		else
+		{
+			if(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == WIFI_STATION)
+			{
+				if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi == ON)
+					setDisplayValue(ICON_WIFI_CONNECTION, WIFI_OFFLINE);
+				else
+					setDisplayValue(ICON_WIFI_CONNECTION, WIFI_ONLINE);
+			}
+			else
+				setDisplayValue(ICON_WIFI_CONNECTION, WIFI_OFFLINE);
+
+			if(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled == DISABLE_4G)
+			{
+				setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
+			}
+			else
+			{
+				if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi == ON)
+					setDisplayValue(ICON_4G_CONNECTION, TELECOM_OFFLINE);
+				else
+					setDisplayValue(ICON_4G_CONNECTION, TELECOM_ONLINE);
+			}
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'E')
+	{
+		setDisplayValue(ICON_WIFI_CONNECTION, DISAPPEAR);
+		setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
+	}
+	else
+	{
+		// SET 4G ICON STATUS ( ONLINE OR OFFLINE )
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'T')
+		{
+			switch(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled)
+			{
+				case DISABLE_4G:
+
+					setDisplayValue(ICON_WIFI_CONNECTION, DISAPPEAR);
+					setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
+
+					break;
+				case ENABLE_4G:
+					// Clean icon
+					setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
+
+					if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi == ON)
+						setDisplayValue(ICON_WIFI_CONNECTION, TELECOM_OFFLINE);
+					else
+						setDisplayValue(ICON_WIFI_CONNECTION, TELECOM_ONLINE);
+
+					break;
+				default:
+					break;
+			}
+		}
+
+		// SET WIFI ICON STATUS ( ONLINE OR OFFLINE)
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'W')
+		{
+			switch(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode)
+			{
+				case DISABLE_WIFI:
+
+					setDisplayValue(ICON_WIFI_CONNECTION, DISAPPEAR);
+					setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
+
+					break;
+				case WIFI_STATION:
+					// Clean icon
+					setDisplayValue(ICON_4G_CONNECTION, DISAPPEAR);
+
+					if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi == ON)
+						setDisplayValue(ICON_WIFI_CONNECTION, WIFI_OFFLINE);
+					else
+						setDisplayValue(ICON_WIFI_CONNECTION, WIFI_ONLINE);
+
+					break;
+				case WIFI_ACCESS_POINT:
+
+					setDisplayValue(ICON_WIFI_CONNECTION, WIFI_OFFLINE);
+
+					break;
+				default:
+					break;
+			}
+		}
+	}
+}
+
+//=======================================
+// Setting billing ( WEB PAGE )
+//=======================================
+void setBillingFromWebsite()
+{
+	if(ShmSysConfigAndInfo->SysConfig.BillingData.isBilling == ON)
+	{
+		setDisplayValue(ICON_PRICE, APPEAR);
+
+		struct timeb csuTime;
+		struct tm *tmCSU;
+		ftime(&csuTime);
+		tmCSU = localtime(&csuTime.time);
+
+		if(tmCSU->tm_hour <= 23)
+		{
+			ShmSysConfigAndInfo->SysConfig.BillingData.Cur_fee = ShmSysConfigAndInfo->SysConfig.BillingData.Fee[tmCSU->tm_hour];
+			setPriceFromWebsite(ShmSysConfigAndInfo->SysConfig.BillingData.Cur_fee);
+		}
+
+		// CURRENCY UNIT ( 53 COUNTRIES )
+		if(ShmSysConfigAndInfo->SysConfig.BillingData.Currency <= 53)
+		{
+			setCurrencyFromWebsite(ShmSysConfigAndInfo->SysConfig.BillingData.Currency);
+		}
+	}
+	else
+	{
+		setDisplayValue(ICON_PRICE, DISAPPEAR);
+		setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
+		setDisplayValue(TEXT_PRICE, DISAPPEAR);
+	}
+}
+
+//=======================================
+// Setting currency ( WEB PAGE )
+//=======================================
+void setCurrencyFromWebsite(uint8_t unit)
+{
+	uint8_t data[16];
+	uint8_t currency[16];
+	unsigned char kWh [16];
+	uint8_t final_currency[16];
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+	memset(currency, 0x00, ARRAY_SIZE(currency));
+	memset(final_currency, 0x00, ARRAY_SIZE(final_currency));
+	strcpy((char*)kWh, "/kWh");
+	memcpy((char*)currency, Currency[unit], 3);
+
+	sprintf((char *)final_currency, "%s%s", currency,kWh);
+	string2ByteArray(final_currency, data);
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_CURRENCY_UNIT, data, ARRAY_SIZE(data));
+}
+
+//=======================================
+// Setting price ( WEB PAGE )
+//=======================================
+void setPriceFromWebsite(float monry_rate)
+{
+	uint8_t data[16];
+	uint8_t price[16];
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+	memset(price, 0x00, ARRAY_SIZE(price));
+
+	sprintf((char *)price, "%.2f", monry_rate);
+	string2ByteArray(price, data);
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_PRICE, data, ARRAY_SIZE(data));
+}
+
+//=======================================
+// Setting final cost ( WEB PAGE )
+//=======================================
+void setPresentFinalCost(float cost)
+{
+	uint8_t data[16];
+	uint8_t finalCost[16];
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+	memset(finalCost, 0x00, ARRAY_SIZE(finalCost));
+
+	sprintf((char *)finalCost, "%.2f", cost);
+	string2ByteArray(finalCost, data);
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_COST_COMPLETE, data, ARRAY_SIZE(data));
+}
+
+//=======================================
+// Getting final cost ( WEB PAGE )
+//=======================================
+float getPresentFinalCost(uint8_t gun_index)
+{
+	float result = 0.0f;
+
+	for(int idx=0;idx<ARRAY_SIZE(ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod);idx++)
+	{
+		result += ((ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[idx]) * ShmSysConfigAndInfo->SysConfig.BillingData.Fee[idx]);
+	}
+
+	return result;
+}
+
+//=======================================
+// Setting billing ( BACKEND )
+//=======================================
+void setBillingFromBackend(uint8_t gun_index, uint8_t system_mode)
+{
+	if((system("pidof -s OcppBackend > /dev/null") != 0))
+	{
+		// DISAPPEAR PRICE ICON, PRICE TEXT AND CURRENCY TEXT
+		setDisplayValue(ICON_PRICE, DISAPPEAR);
+		setDisplayValue(TEXT_PRICE, DISAPPEAR);
+		setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
+	}
+	else
+	{
+		if((ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON))
+		{
+			if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+			{
+				if((strcmp((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData,"") != 0))
+				{
+					if(system_mode == SYS_MODE_IDLE)
+					{
+						/*
+						 * 1. SEARCHING DEFAULT PRICE FOR PRICE TEXT
+						 * 2. SEARCHING DEFAULT PRICE FOR CURRENCY AND UNIT TO APPEAR
+						 */
+						setDefaultPrice(CURRENT_RATE);
+						setCurrencyAndUnitFromBackend(DEFAULE_PRICE, CURRENT_RATE, gun_index);
+					}
+					else
+					{
+						/*
+						 * 1. IF STARTUSERID IS NOT MATCH WITH IDTOKEN ALSO VALUE CAN'T BE NULL, OTHERWISE THE SYSTEM MUST USE DEFAULT PRICE
+						 */
+						if((strcmp((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, (char *)ShmOCPP16Data->Cost.SetUserPrice.idToken) == 0) &&
+							((strcmp((char *)ShmOCPP16Data->Cost.SetUserPrice.idToken,"") != 0)))
+						{
+							/*
+							 * 1. SEARCHING USER PRICE FOR PRICE TEXT
+							 * 2. SEARCHING USER PRICE FOR CURRENCY AND UNIT TO APPEAR
+							 */
+							setUserPrice(CURRENT_RATE);
+							setCurrencyAndUnitFromBackend(SET_USER_PRICE, CURRENT_RATE,gun_index);
+						}
+						else
+						{
+							/*
+							 * 1. SEARCHING DEFAULT PRICE FOR PRICE TEXT
+							 * 2. SEARCHING DEFAULT PRICE FOR CURRENCY AND UNIT TO APPEAR
+							 */
+							setDefaultPrice(CURRENT_RATE);
+							setCurrencyAndUnitFromBackend(DEFAULE_PRICE, CURRENT_RATE, gun_index);
+						}
+					}
+				}
+				else
+				{
+					// DISAPPEAR PRICE ICON, PRICE TEXT AND CURRENCY TEXT
+					setDisplayValue(ICON_PRICE, DISAPPEAR);
+					setDisplayValue(TEXT_PRICE, DISAPPEAR);
+					setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
+				}
+			}
+			else
+			{
+				// DISPLAY BY OCPP 2.0.1
+			}
+		}
+		else
+		{
+			// DISAPPEAR PRICE ICON, PRICE TEXT AND CURRENCY TEXT
+			setDisplayValue(ICON_PRICE, DISAPPEAR);
+			setDisplayValue(TEXT_PRICE, DISAPPEAR);
+			setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
+		}
+	}
+}
+
+//=======================================
+// Setting UserPrice ( BACKEND )
+//=======================================
+void setUserPrice(uint8_t type)
+{
+	uint8_t length;
+	uint8_t output_data[32];
+	char input_data[32];
+	char tmp[256];
+	char *splitString[10];
+	const char *Symbol = ";";
+
+	memset(tmp, 0, ARRAY_SIZE(tmp));
+	memset(input_data, 0x00, ARRAY_SIZE(input_data));
+	memset(output_data, 0x00, ARRAY_SIZE(output_data));
+
+	switch(type)
+	{
+		case CONNECTION_FEE:
+			break;
+		case CURRENT_RATE:
+			if(strstr((char *)ShmOCPP16Data->Cost.SetUserPrice.price, "Current Rate:") > 0)
+			{
+				// APPEAR PRICE ICON
+				setDisplayValue(ICON_PRICE, APPEAR);
+
+				// APPEAR PRICE TEXT
+				strcpy((char*)tmp,(char *)ShmOCPP16Data->Cost.SetUserPrice.price);
+				split((char**)splitString, tmp, Symbol);
+				memcpy(input_data, splitString[1], strlen(splitString[1]));
+				length = strlen(input_data);
+				trim_string(input_data,length);
+				memcpy(output_data ,input_data, strlen(input_data));
+				lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_PRICE, output_data, ARRAY_SIZE(output_data));
+			}
+			else
+			{
+				// DISAPPEAR PRICE ICON AND PRICE TEXT
+				setDisplayValue(ICON_PRICE, DISAPPEAR);
+				setDisplayValue(TEXT_PRICE, DISAPPEAR);
+			}
+			break;
+		case OCCUPANCY_FEE:
+			break;
+		case ACCOUNT_BALANCE:
+			if(strstr((char *)ShmOCPP16Data->Cost.SetUserPrice.price, "Account Balance:") > 0)
+			{
+				// APPEAR ACCOUNT BALANCE ICON
+				setDisplayValue(ICON_BALANCE_WALLET, APPEAR);
+
+				// APPEAR ACCOUNT BALANCE TEXT
+				strcpy((char*)tmp,(char *)ShmOCPP16Data->Cost.SetUserPrice.price);
+				split((char**)splitString, tmp, Symbol);
+				memcpy(input_data, splitString[3], strlen(splitString[3]));
+				length = strlen(input_data);
+				trim_string(input_data,length);
+				memcpy(output_data ,input_data, strlen(input_data));
+				lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_BALANCE, output_data, ARRAY_SIZE(output_data));
+			}
+			else
+			{
+				// DISAPPEAR BALANCE ICON AND BALANCE TEXT
+				setDisplayValue(ICON_BALANCE_WALLET, DISAPPEAR);
+				setDisplayValue(TEXT_BALANCE, DISAPPEAR);
+			}
+			break;
+		default:
+			break;
+	}
+}
+
+//=======================================
+// Setting DefaultPrice ( BACKEND )
+//=======================================
+void setDefaultPrice(uint8_t type)
+{
+	uint8_t length;
+	uint8_t output_data[32];
+	char input_data[32];
+	char tmp[256];
+	char *splitString[10];
+	const char *Symbol = ";";
+
+	memset(tmp, 0, ARRAY_SIZE(tmp));
+	memset(input_data, 0x00, ARRAY_SIZE(input_data));
+	memset(output_data, 0x00, ARRAY_SIZE(output_data));
+
+	switch(type)
+	{
+		case CONNECTION_FEE:
+			break;
+		case CURRENT_RATE:
+			if(strstr((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData, "Current Rate:") > 0)
+			{
+				// APPEAR PRICE ICON
+				setDisplayValue(ICON_PRICE, APPEAR);
+
+				// APPEAR PRICE TEXT
+				strcpy((char*)tmp,(char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData);
+				split((char**)splitString, tmp, Symbol);
+				memcpy(input_data, splitString[1], strlen(splitString[1]));
+				length = strlen(input_data);
+				trim_string(input_data,length);
+				memcpy(output_data ,input_data, strlen(input_data));
+				lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_PRICE, output_data, ARRAY_SIZE(output_data));
+			}
+			else
+			{
+				setDisplayValue(TEXT_PRICE, DISAPPEAR);
+				setDisplayValue(ICON_PRICE, DISAPPEAR);
+			}
+			break;
+		case OCCUPANCY_FEE:
+			break;
+		default:
+			break;
+	}
+}
+
+//=======================================
+// Setting FinalCost ( BACKEND )
+//=======================================
+void setFinalCost(uint8_t gun_index, uint8_t type)
+{
+	uint8_t length;
+	uint8_t output_data[32];
+	char input_data[32];
+	char tmp[256];
+	char *splitString[10];
+	const char *Symbol = ";";
+
+	memset(tmp, 0, ARRAY_SIZE(tmp));
+	memset(output_data, 0x00, ARRAY_SIZE(output_data));
+	memset(input_data, 0x00, ARRAY_SIZE(input_data));
+
+	switch(type)
+	{
+		case CONNECTION_FEE:
+			break;
+		case SESSION_FEE:
+			break;
+		case OCCUPANCY_FEE:
+			break;
+		case TOTAL_COST:
+			if((strstr((char*)ShmOCPP16Data->Cost.FinalCost[gun_index].description, "Total Cost:") > 0))
+			{
+				// APPEAR COST ICON
+				setDisplayValue(ICON_COST_COMPLETE, APPEAR);
+
+				// APPEAR COST TEXT
+				strcpy((char*)tmp,(char*)ShmOCPP16Data->Cost.FinalCost[gun_index].description);
+				split((char**)splitString, tmp, Symbol);
+				memcpy(input_data, splitString[3], strlen(splitString[3]));
+				length = strlen(input_data);
+				trim_string(input_data,length);
+				memcpy(output_data ,input_data, strlen(input_data));
+				lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_COST_COMPLETE, output_data, ARRAY_SIZE(output_data));
+			}
+			else
+			{
+				// DISAPPEAR COST ICON AND COST TEXT
+				setDisplayValue(ICON_COST_COMPLETE, DISAPPEAR);
+				setDisplayValue(TEXT_COST_COMPLETE, DISAPPEAR);
+			}
+			break;
+		case ACCOUNT_BALANCE:
+			if((strstr((char*)ShmOCPP16Data->Cost.FinalCost[gun_index].description, "Account Balance:") > 0))
+			{
+				// APPEAR BALANCE ICON
+				setDisplayValue(ICON_WALLER_COMPLETE, APPEAR);
+				setDisplayValue(ICON_BALANCE_WALLET, APPEAR);
+
+				// APPEAR BALANCE TEXT
+				strcpy((char*)tmp,(char*)ShmOCPP16Data->Cost.FinalCost[gun_index].description);
+				split((char**)splitString, tmp, Symbol);
+				memcpy(input_data, splitString[4], strlen(splitString[4]));
+				length = strlen(input_data);
+				trim_string(input_data,length);
+				memcpy(output_data ,input_data, strlen(input_data));
+				lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_ACCOUNT_COMPLETE, output_data, ARRAY_SIZE(output_data));
+				lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_BALANCE, output_data, ARRAY_SIZE(output_data));
+			}
+			else
+			{
+				/*
+				 * 1. DISAPPEAR ACCOUNT BALANCE WHEN THE SYSTEM IS COMPLETE MODE
+				 * 2. DISAPPEAR ACCOUNT ICON WHEN THE SYSTEM IS COMPLETE MODE
+				 */
+				setDisplayValue(ICON_WALLER_COMPLETE, DISAPPEAR);
+				setDisplayValue(TEXT_ACCOUNT_COMPLETE, DISAPPEAR);
+
+				setDisplayValue(ICON_BALANCE_WALLET, DISAPPEAR);
+				setDisplayValue(TEXT_BALANCE, DISAPPEAR);
+			}
+			break;
+		default:
+			break;
+	}
+}
+
+//=======================================
+// Setting currency ( BACKEND )
+//=======================================
+void setCurrencyAndUnitFromBackend(uint8_t type_price ,uint8_t type_currency_unit,uint8_t gun_index)
+{
+	uint8_t length;
+	uint8_t output_data[32];
+	char input_data[32];
+	char tmp[256];
+	char *splitString[10];
+	const char *Symbol = ";";
+
+	memset(tmp, 0, ARRAY_SIZE(tmp));
+	memset(input_data, 0x00, ARRAY_SIZE(input_data));
+	memset(output_data, 0x00, ARRAY_SIZE(output_data));
+
+	if(type_price == DEFAULE_PRICE)
+	{
+		switch(type_currency_unit)
+		{
+			case CONNECTION_FEE:
+				break;
+			case CURRENT_RATE:
+				if(strstr((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData, "Current Rate:") > 0)
+				{
+					strcpy((char*)tmp,(char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData);
+					split((char**)splitString, tmp, Symbol);
+					memcpy(input_data, splitString[1], strlen(splitString[1]));
+					length = strlen(input_data);
+					memcpy(output_data , input_data+(length-7), 7);
+					lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_CURRENCY_UNIT, output_data, ARRAY_SIZE(output_data));
+				}
+				else
+				{
+					setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
+				}
+				break;
+			case OCCUPANCY_FEE:
+				break;
+			default:
+				break;
+		}
+	}
+	else if(type_price == SET_USER_PRICE)
+	{
+		switch(type_currency_unit)
+		{
+			case CONNECTION_FEE:
+				break;
+			case CURRENT_RATE:
+				if(strstr((char *)ShmOCPP16Data->Cost.SetUserPrice.price, "Current Rate:") > 0)
+				{
+					strcpy((char*)tmp,(char *)ShmOCPP16Data->Cost.SetUserPrice.price);
+					split((char**)splitString, tmp, Symbol);
+					memcpy(input_data, splitString[1], strlen(splitString[1]));
+					length = strlen(input_data);
+					memcpy(output_data , input_data+(length-7), 7);
+					lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_CURRENCY_UNIT, output_data, ARRAY_SIZE(output_data));
+				}
+				else
+				{
+					setDisplayValue(TEXT_CURRENCY_UNIT, DISAPPEAR);
+				}
+				break;
+			case OCCUPANCY_FEE:
+				break;
+			case ACCOUNT_BALANCE:
+				break;
+			default:
+				break;
+		}
+	}
+	else if(type_price == FINAL_COST)
+	{
+		switch(type_currency_unit)
+		{
+			case CONNECTION_FEE:
+				break;
+			case SESSION_FEE:
+				break;
+			case OCCUPANCY_FEE:
+				break;
+			case TOTAL_COST:
+				break;
+			case ACCOUNT_BALANCE:
+				if((strstr((char*)ShmOCPP16Data->Cost.FinalCost[gun_index].description, "Account Balance:") > 0))
+				{
+					strcpy((char*)tmp,(char*)ShmOCPP16Data->Cost.FinalCost[gun_index].description);
+					split((char**)splitString, tmp, Symbol);
+					memcpy(input_data, splitString[4], strlen(splitString[4]));
+					length = strlen(input_data);
+					memcpy(output_data , input_data+(length-3), 3);
+					lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_CURRENCY_COMPLETE, output_data, ARRAY_SIZE(output_data));
+				}
+				else
+				{
+					setDisplayValue(TEXT_CURRENCY_COMPLETE, DISAPPEAR);
+				}
+				break;
+			default:
+				break;
+		}
+	}
+	else
+	{}
+}
+
+//=======================================
+// Setting RTC value
+//=======================================
+void setRTC()
+{
+	uint8_t data[32];
+	uint8_t rtc[32];
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+	memset(rtc, 0x00, ARRAY_SIZE(rtc));
+
+	getDateTimeString((char*)rtc);
+	string2ByteArray(rtc, data);
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_RTC, data, ARRAY_SIZE(data));
+}
+
+//=======================================
+// Setting RFID icon status
+//=======================================
+void setRfidIcon()
+{
+	/*
+	//=======================================
+	// AX-Series Generation 1
+	//=======================================
+	if((ShmSysConfigAndInfo->SysConfig.ModelName[0] == 'A') &&
+	   (ShmSysConfigAndInfo->SysConfig.ModelName[1] == 'X') &&
+	   (ShmSysConfigAndInfo->SysConfig.ModelName[11] == '1'))
+	{
+		if(ShmSysConfigAndInfo->SysConfig.isRFID == ON)
+			setDisplayValue(ICON_RFID, RFID_ENABLE);
+		else
+			setDisplayValue(ICON_RFID, RFID_DISABLE);
+	}
+
+	//=======================================
+	// AX-Series Generation 2/3/4
+	//=======================================
+	if((ShmSysConfigAndInfo->SysConfig.ModelName[0] == 'A') &&
+	   (ShmSysConfigAndInfo->SysConfig.ModelName[1] == 'X') &&
+	   ((ShmSysConfigAndInfo->SysConfig.ModelName[11] == '2') || (ShmSysConfigAndInfo->SysConfig.ModelName[11] == '3') || (ShmSysConfigAndInfo->SysConfig.ModelName[11] == '4')))
+	{
+		if(ShmSysConfigAndInfo->SysConfig.isRFID == ON)
+			setDisplayValue(ICON_RFID, VISA_ENABLE);
+		else
+			setDisplayValue(ICON_RFID, VISA_DISABLE);
+	}
+
+	//=======================================
+	// AW-Series Generation
+	//=======================================
+	if((ShmSysConfigAndInfo->SysConfig.ModelName[0] == 'A') &&
+	   (ShmSysConfigAndInfo->SysConfig.ModelName[1] == 'W'))
+	{
+		if(ShmSysConfigAndInfo->SysConfig.isRFID == ON)
+			setDisplayValue(ICON_RFID, RFID_ENABLE);
+		else
+			setDisplayValue(ICON_RFID, RFID_DISABLE);
+	}
+	*/
+
+	if(ShmSysConfigAndInfo->SysConfig.isRFID == ON)
+		setDisplayValue(ICON_NEW_RFID, NEW_RFID_ENABLE);
+	else
+		setDisplayValue(ICON_NEW_RFID, NEW_RFID_DISABLE);
+
+}
+
+//=======================================
+// Setting QRCODE icon status
+//=======================================
+void setQRCodeIcon()
+{
+	uint8_t length = 0;
+
+	/*
+	// QR CODE ( ENABLE / DISABLE )
+	if(ShmSysConfigAndInfo->SysConfig.isQRCode == ON)
+	{
+		setDisplayValue(ICON_QRCODE,QRCODE_ENABLE);
+		if(ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode == NO)
+		{
+			length = strlen((char *)ShmSysConfigAndInfo->SysConfig.SystemId);
+			setQRcodeContent((char *)ShmSysConfigAndInfo->SysConfig.SystemId, length, QRCODE_FOR_IDLE);
+		}
+		else
+		{
+			length = strlen((char *)ShmSysConfigAndInfo->SysConfig.QRCodeContent);
+			setQRcodeContent((char *)ShmSysConfigAndInfo->SysConfig.QRCodeContent, length, QRCODE_FOR_IDLE);
+		}
+	}
+	else
+	{
+		setDisplayValue(TEXT_QRCODE_CONTENT, DISAPPEAR);
+		setDisplayValue(ICON_QRCODE,QRCODE_DISABLE);
+	}
+	*/
+
+	if(ShmSysConfigAndInfo->SysConfig.isQRCode == ON)
+	{
+		setDisplayValue(ICON_NEW_QR_CODE,NEW_QRCODE_ENABLE);
+		if(ShmSysConfigAndInfo->SysConfig.QRCodeMadeMode == NO)
+		{
+			length = strlen((char *)ShmSysConfigAndInfo->SysConfig.SystemId);
+			setQRcodeContent((char *)ShmSysConfigAndInfo->SysConfig.SystemId, length, QRCODE_FOR_IDLE);
+		}
+		else
+		{
+			length = strlen((char *)ShmSysConfigAndInfo->SysConfig.QRCodeContent);
+			setQRcodeContent((char *)ShmSysConfigAndInfo->SysConfig.QRCodeContent, length, QRCODE_FOR_IDLE);
+		}
+	}
+	else
+	{
+		setDisplayValue(TEXT_QRCODE_CONTENT, DISAPPEAR);
+		setDisplayValue(ICON_NEW_QR_CODE,NEW_QRCODE_DISABLE);
+	}
+}
+
+//=======================================
+// Setting QRCODE icon for receipt
+//=======================================
+void setQRCodeReceipt(uint8_t gun_index)
+{
+	uint8_t length = 0;
+	uint8_t data[512];
+	int TransactionId;
+	unsigned char QRCodeContent[512];
+	unsigned char QRCodeReceipt[512];
+
+	memset(QRCodeContent, 0x00, ARRAY_SIZE(QRCodeContent));
+	memset(QRCodeReceipt, 0x00, ARRAY_SIZE(QRCodeReceipt));
+	memset(data, 0x00, ARRAY_SIZE(data));
+
+	memcpy((char*)QRCodeContent, (char*)ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL));
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		TransactionId = ShmOCPP16Data->StopTransaction[gun_index].TransactionId;
+	}
+	else
+	{
+		// TO DO OCPP 2.0
+	}
+
+	sprintf((char *)QRCodeReceipt, "%s%d", QRCodeContent,TransactionId);
+	string2ByteArray(QRCodeReceipt, data);
+	if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppReceiptrURL,"") == 0))
+	{
+		setDisplayValue(TEXT_QRCODE_RECEIPT, DISAPPEAR);
+		setDisplayValue(ICON_THE_CHARGE_COMPLETE, APPEAR);
+		setDisplayValue(ICON_CONNECTION_COMPLETE, APPEAR);
+	}
+	else
+	{
+		setDisplayValue(ICON_THE_CHARGE_COMPLETE, DISAPPEAR);
+		setDisplayValue(ICON_CONNECTION_COMPLETE, APPEAR);
+
+		length = strlen((char *)data);
+		setQRcodeContent((char *)data, length, QRCODE_FOR_COMPLETE);
+	}
+}
+
+//=======================================
+// Setting QR code content
+//=======================================
+void setQRcodeContent(char *input, uint8_t length, uint8_t mode)
+{
+	uint8_t output[length];
+	int loop = 0;
+
+	input[length] = '\0';
+	output[length] = '\0';
+
+	while(input[loop] != '\0')
+	{
+		output[loop] = input[loop];
+		loop++;
+	}
+
+	switch(mode)
+	{
+		case QRCODE_FOR_IDLE:
+			lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_QRCODE_CONTENT, output, ARRAY_SIZE(output)+1);
+			break;
+		case QRCODE_FOR_COMPLETE:
+			lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_QRCODE_RECEIPT, output, ARRAY_SIZE(output)+1);
+			break;
+		default:
+			lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_QRCODE_CONTENT, output, ARRAY_SIZE(output)+1);
+			break;
+	}
+}
+
+//=======================================
+// Setting warning page switch
+//=======================================
+void setWarningStatus(uint8_t gun_index)
+{
+	/*
+	 * 1. WARNING COUNT IS DIFFERENT BETWEEN BEGINNING CHANGE DISPLAY
+	 * 2. WARNING COUNT BIGGER THAN 4 AND EVERY 5 SECONDS CHANGE NEXT PAGE
+	 */
+	if(WarningCount != ShmSysConfigAndInfo->SysWarningInfo.WarningCount)
+	{
+		WarningCount = ShmSysConfigAndInfo->SysWarningInfo.WarningCount;
+		ShmSysConfigAndInfo->SysWarningInfo.PageIndex = 0;
+
+		setAlarmCodeAndIcon();
+	}
+	else if(ShmSysConfigAndInfo->SysWarningInfo.WarningCount > 4 && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_ALARM]) > (TIME_ANIMATION_ALARM)))
+	{
+		ftime(&startTime[gun_index][TMR_IDX_ALARM]);
+		if(ShmSysConfigAndInfo->SysWarningInfo.PageIndex == 0)
+		{
+			ShmSysConfigAndInfo->SysWarningInfo.PageIndex = 1;
+		}
+		else
+		{
+			ShmSysConfigAndInfo->SysWarningInfo.PageIndex = 0;
+		}
+
+		setAlarmCodeAndIcon();
+	}
+}
+
+//=======================================
+// Setting alarm code and icon status
+//=======================================
+void setAlarmCodeAndIcon()
+{
+	uint8_t cmd[7];
+	uint8_t index = 0;
+
+	for(index = 0; (index + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 4) < ShmSysConfigAndInfo->SysWarningInfo.WarningCount; index++)
+	{
+		memset(cmd, 0x00, sizeof(cmd));
+		if(index >= 4)
+		{
+			break;
+		}
+
+		// ALARM CODE TEXT (XXXXXX)
+		string2ByteArray(&ShmSysConfigAndInfo->SysWarningInfo.WarningCode[index + ShmSysConfigAndInfo->SysWarningInfo.PageIndex * 4][0], cmd);
+		lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_ALARM_CODE_1 + (index * 6), cmd, ARRAY_SIZE(cmd));
+
+		// ALARM CODE ICON STATUS (!)
+		memset(cmd, 0x00, sizeof(cmd));
+
+		cmd[0] = 0x00;
+		cmd[1] = 0x01;
+		lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, ICON_ALARM_1 + index, cmd, 2);
+	}
+
+	memset(cmd, 0x00, sizeof(cmd));
+	for(; index < 4; index++)
+	{
+		lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_ALARM_CODE_1 + (index * 6), cmd, ARRAY_SIZE(cmd));
+		lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, ICON_ALARM_1 + index, cmd, 2);
+	}
+}
+
+//=======================================
+// Setting Battery icon animation
+//=======================================
+void setBatteryAnimation(uint8_t gun_index, uint8_t system_mode)
+{
+	switch(system_mode)
+	{
+		case SYS_MODE_IDLE:
+
+			// INITIALIZATION BATTERY ICON AND PERCENTAGE TEXT
+			setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_EMPTY);
+			setDisplayValue(ICON_BATTERY_COMPLETE, BATTERY_SOC_EMPTY);
+			setDisplayValue(TEXT_PERCENTAGE, DISAPPEAR);
+
+			break;
+		case SYS_MODE_CHARGING:
+			if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+			{
+				if(isEmulator == YES)
+				{
+					if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_EMULATOR]) > 3000))
+					{
+						if(isCharging == YES)
+							PERCENTAGE++;
+						else
+							PERCENTAGE--;
+
+						ftime(&startTime[gun_index][TMR_IDX_EMULATOR]);
+					}
+
+					if(isCharging == YES)
+					{
+						if(PERCENTAGE > 100)
+							PERCENTAGE = 0;
+					}
+					else
+					{
+						if(PERCENTAGE <= 0)
+							PERCENTAGE = 100;
+					}
+
+					ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc = PERCENTAGE;
+					if((isChange == 0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY)))
+					{
+						isChange = 1;
+					}
+					else if((isChange == 1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*2)))
+					{
+						isChange = 0;
+						ftime(&startTime[gun_index][TMR_IDX_BATTERY]);
+					}
+				}
+				else
+				{}
+
+				// SET BATTERY ANIMATION
+				if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 20)
+				{
+					if(isChange == 0)
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_EMPTY);
+					else
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_20);
+				}
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 20) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 40))
+				{
+					if(isChange == 0)
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_20);
+					else
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_40);
+				}
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 40) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 60))
+				{
+					if(isChange == 0)
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_40);
+					else
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_60);
+				}
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 60) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 80))
+				{
+					if(isChange == 0)
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_60);
+					else
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_80);
+				}
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 80) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 100))
+				{
+					if(isChange == 0)
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_80);
+					else
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_100);
+				}
+				else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc == 100)
+				{
+					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_100);
+				}
+
+				// SET BATTERY SOC VALUE
+				setBatteryPercentageValue(gun_index);
+
+				// SET ICON TO CHARGE OR DISCHARGE
+				if(isCharging == YES)
+					setDisplayValue(ICON_ELECTRICITY_DIRECTION, ELECTRICITY_DIRECTION_LEFT);
+				else
+					setDisplayValue(ICON_ELECTRICITY_DIRECTION, ELECTRICITY_DIRECTION_RIGHT);
+			}
+			else
+			{
+				// SET BATTERY PERCENTAGE TEXT TO DISAPPEAR
+				setDisplayValue(TEXT_PERCENTAGE, DISAPPEAR);
+
+				if((ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON))
+				{
+					// SET BATTERY ANIMATION
+					if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_5))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_EMPTY);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_0;
+					}
+					else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY)))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_20);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_1;
+					}
+					else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*2)))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_40);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_2;
+					}
+					else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_2) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*3)))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_60);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_3;
+					}
+					else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_3) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*4)))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_80);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_4;
+					}
+					else if((BATTERY_LEVEL_STATUS == BATTERY_LEVEL_4) &&  (DiffTimebWithNow(startTime[gun_index][TMR_IDX_BATTERY]) > (TIME_ANIMATION_BATTERY*5)))
+					{
+						setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_100);
+						BATTERY_LEVEL_STATUS = BATTERY_LEVEL_5;
+						ftime(&startTime[gun_index][TMR_IDX_BATTERY]);
+					}
+				}
+				else
+				{
+					// SET BATTERY ICON TO EMPTY ICON
+					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_EMPTY);
+
+					// SET BATTERY PERCENTAGE TO DISAPPEAR
+					setDisplayValue(TEXT_PERCENTAGE, DISAPPEAR);
+
+					// RESET TO DEFAULT VALUE
+					BATTERY_LEVEL_STATUS = BATTERY_LEVEL_5;
+					ftime(&startTime[gun_index][TMR_IDX_BATTERY]);
+				}
+			}
+
+			break;
+		case SYS_MODE_TERMINATING:
+			if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+			{
+				// SET BATTERY ANIMATION
+				if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 20)
+					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_20);
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 20) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 40))
+					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_40);
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 40) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 60))
+					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_60);
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 60) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 80))
+					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_80);
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 80) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc <= 100))
+					setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_100);
+
+				// SET BATTERY SOC VALUE
+				setBatteryPercentageValue(gun_index);
+
+				// SET ELECTRIC ARROW DIRECTION ICON DISAPPEAR
+				setDisplayValue(ICON_ELECTRICITY_DIRECTION, DISAPPEAR);
+			}
+			else
+			{
+				// SET BATTERY ICON TO EMPTY ICON
+				setDisplayValue(ICON_BATTERY_CHARGING, BATTERY_CAPACITY_EMPTY);
+
+				// SET BATTERY PERCENTAGE TO DISAPPEAR
+				setDisplayValue(TEXT_PERCENTAGE, DISAPPEAR);
+			}
+
+			break;
+		case SYS_MODE_COMPLETE:
+			if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+			{
+				// SET BATTERY ANIMATION
+				if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 20)
+					setDisplayValue(ICON_BATTERY_COMPLETE, BATTERY_SOC_20);
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 20) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 40))
+					setDisplayValue(ICON_BATTERY_COMPLETE, BATTERY_SOC_40);
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 40) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 60))
+					setDisplayValue(ICON_BATTERY_COMPLETE, BATTERY_SOC_60);
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 60) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc < 80))
+					setDisplayValue(ICON_BATTERY_COMPLETE, BATTERY_SOC_80);
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc >= 80) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc <= 100))
+					setDisplayValue(ICON_BATTERY_COMPLETE, BATTERY_SOC_100);
+
+				// SET BATTERY SOC VALUE
+				setBatteryPercentageValue(gun_index);
+
+				// SET ELECTRIC ARROW DIRECTION ICON DISAPPEAR
+				setDisplayValue(ICON_ELECTRICITY_DIRECTION, DISAPPEAR);
+			}
+			else
+			{
+				// SET BATTERY ICON TO FULL BATTERY ICON
+				setDisplayValue(ICON_BATTERY_COMPLETE, BATTERY_SOC_100);
+
+				// SET BATTERY PERCENTAGE TO DISAPPEAR
+				setDisplayValue(TEXT_PERCENTAGE, DISAPPEAR);
+			}
+
+			break;
+		default:
+			break;
+	}
+}
+
+//=======================================
+// Setting connection icon animation
+//=======================================
+void setConnectionAnimation(uint8_t gun_index, uint8_t system_mode)
+{
+	switch(system_mode)
+	{
+		case SYS_MODE_PREPARING:
+			if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION)))
+			{
+				setDisplayValue(ICON_CONNECTION_PRECHARGING, CONNECTION_QUESTION_MARK_1);
+				CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_1;
+			}
+			else if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION*2)))
+			{
+				setDisplayValue(ICON_CONNECTION_PRECHARGING, CONNECTION_QUESTION_MARK_2);
+				CONNECTION_LEVEL_STATUS =  CONNECTION_LEVEL_0;
+				ftime(&startTime[gun_index][TMR_IDX_CONNECTION]);
+			}
+
+			break;
+		case SYS_MODE_CHARGING:
+			if((ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON))
+			{
+				if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION)))
+				{
+					setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_ELECTRIC_MARK_1);
+					CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_1;
+				}
+				else if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION*2)))
+				{
+					setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_ELECTRIC_MARK_2);
+					CONNECTION_LEVEL_STATUS =  CONNECTION_LEVEL_0;
+					ftime(&startTime[gun_index][TMR_IDX_CONNECTION]);
+				}
+			}
+			else
+			{
+				if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION)))
+				{
+					setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_QUESTION_MARK_1);
+					CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_1;
+				}
+				else if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION*2)))
+				{
+					setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_QUESTION_MARK_2);
+					CONNECTION_LEVEL_STATUS =  CONNECTION_LEVEL_0;
+					ftime(&startTime[gun_index][TMR_IDX_CONNECTION]);
+				}
+			}
+
+			break;
+		case SYS_MODE_TERMINATING:
+			if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION)))
+			{
+				setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_QUESTION_MARK_1);
+				CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_1;
+			}
+			else if((CONNECTION_LEVEL_STATUS == CONNECTION_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_CONNECTION]) > (TIME_ANIMATION_CONNECTION*2)))
+			{
+				setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_QUESTION_MARK_2);
+				CONNECTION_LEVEL_STATUS =  CONNECTION_LEVEL_0;
+				ftime(&startTime[gun_index][TMR_IDX_CONNECTION]);
+			}
+
+			break;
+		default:
+			break;
+	}
+}
+
+//=======================================
+// Setting gun plug-in animation
+//=======================================
+void setGunPluginAnimation(uint8_t gun_index)
+{
+	if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B) ||
+	   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C) ||
+	   (ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn == ON))
+	{
+		setDisplayValue(ICON_PLUGIN_ARROW, PLUGIN_ARROW_2);
+	}
+	else
+	{
+		if((GUN_PLUGING_LEVEL_STATUS ==  GUN_PLUGING_LEVEL_0) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_PLUGIN]) > (TIME_ANIMATION_PLUGIN)))
+		{
+			setDisplayValue(ICON_PLUGIN_ARROW, PLUGIN_ARROW_1);
+			GUN_PLUGING_LEVEL_STATUS = GUN_PLUGING_LEVEL_1;
+		}
+		else if((GUN_PLUGING_LEVEL_STATUS ==  GUN_PLUGING_LEVEL_1) && (DiffTimebWithNow(startTime[gun_index][TMR_IDX_PLUGIN]) > (TIME_ANIMATION_PLUGIN*2)))
+		{
+			setDisplayValue(ICON_PLUGIN_ARROW, PLUGIN_ARROW_2);
+			GUN_PLUGING_LEVEL_STATUS =  GUN_PLUGING_LEVEL_0;
+			ftime(&startTime[gun_index][TMR_IDX_PLUGIN]);
+		}
+	}
+}
+
+//=======================================
+// Setting battery SOC value
+//=======================================
+void setBatteryPercentageValue(uint8_t gun_index)
+{
+	uint8_t data[16];
+	uint8_t soc[16];
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+	memset(soc, 0x00, ARRAY_SIZE(soc));
+
+	sprintf((char *)soc, "%d%%", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc);
+	string2ByteArray(soc, data);
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_PERCENTAGE, data, ARRAY_SIZE(data));
+}
+
+//=======================================
+// Setting present charging power
+//=======================================
+void setPresentChargingPower(uint8_t gun_index)
+{
+	uint8_t data[16];
+	uint8_t power[16];
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+	memset(power, 0x00, ARRAY_SIZE(power));
+
+	sprintf((char *)power, "%.2f kW", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower);
+	string2ByteArray(power, data);
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_POWER_CHARGING, data, ARRAY_SIZE(data));
+}
+
+//=======================================
+// Setting present charged energy
+//=======================================
+void setPresentChargedEnergy(uint8_t gun_index)
+{
+	uint8_t data[16];
+	uint8_t energy[16];
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+	memset(energy, 0x00, ARRAY_SIZE(energy));
+
+	sprintf((char *)energy, "%.4f kWh", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy);
+	string2ByteArray(energy, data);
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_ENERGY_CHARGING, data, ARRAY_SIZE(data));
+}
+
+//=======================================
+// Setting present power consumption
+//=======================================
+void setPresentPowerConsumption(uint8_t gun_index)
+{
+	uint8_t data[32];
+	uint8_t powerConsumption[32];
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+	memset(powerConsumption, 0x00, ARRAY_SIZE(powerConsumption));
+
+	sprintf((char *)powerConsumption, "%.4f kWh", ((float)ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0));
+	string2ByteArray(powerConsumption, data);
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_POWER_CONSUMPTION, data, ARRAY_SIZE(data));
+}
+
+//=======================================
+// Setting present charged duration
+//=======================================
+void setPresentChargedDuration(uint8_t gun_index)
+{
+	uint8_t data[16];
+	uint8_t time[16];
+	uint16_t hour;
+	uint16_t minute;
+	uint16_t second;
+	uint32_t PresentChargedDuration = ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration;
+
+	memset(data, 0x00, ARRAY_SIZE(data));
+	memset(time, 0x00, ARRAY_SIZE(time));
+
+	hour = (PresentChargedDuration / 3600);
+	minute = (PresentChargedDuration - (3600 * hour)) / 60;
+	second = (PresentChargedDuration - (3600 * hour) - (minute * 60));
+
+	sprintf((char *)time, "%02d:%02d:%02d", hour, minute, second);
+	string2ByteArray(time, data);
+	lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, TEXT_TIMER_CHARGING, data, ARRAY_SIZE(data));
+}
+
+//=======================================
+// Setting authorization page
+//=======================================
+void setAuthorizationPage(uint8_t gun_index)
+{
+	switch(ShmCharger->gun_info[gun_index].resultAuthorization)
+	{
+		case VALIDATED_RFID:
+			if(getCurrentPage() != SYSTEM_SCREEN_AUTH_PASS)
+			{
+				setCurrentPage(SYSTEM_SCREEN_AUTH_PASS);
+				DEBUG_INFO("Setting page to authorizing : Validated RFID.\n");
+			}
+			else
+			{}
+			break;
+		case UNVALIDATED_RFID:
+			if(getCurrentPage() != SYSTEM_SCREEN_AUTH_FAIL)
+			{
+				setCurrentPage(SYSTEM_SCREEN_AUTH_FAIL);
+				DEBUG_INFO("Setting page to authorizing : Unvalidated RFID.\n");
+			}
+			else
+			{}
+			break;
+		case UNKNOW_RFID:
+			if(getCurrentPage() != SYSTEM_SCREEN_AUTH_UNKNOW)
+			{
+				setCurrentPage(SYSTEM_SCREEN_AUTH_UNKNOW);
+				DEBUG_INFO("Setting page to authorizing : Unknown RFID\n");
+			}
+			else
+			{}
+			break;
+		case DEFAULT_RFID:
+			break;
+		default:
+			break;
+	}
+}
+
+//=======================================
+// Setting default values
+//=======================================
+void setDefaultValue(uint8_t gun_index, uint8_t system_mode)
+{
+	switch(system_mode)
+	{
+		case SYS_MODE_BOOTING:
+			break;
+		case SYS_MODE_IDLE:
+			setBatteryAnimation(gun_index, system_mode);
+			break;
+		case SYS_MODE_AUTHORIZING:
+			break;
+		case SYS_MODE_PREPARING:
+			// DEFAULT TIMER, ICON AND STATUS OF ANIMATION. ( BS / HLC ) MODE
+			if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+			{
+				setDisplayValue(ICON_CONNECTION_PRECHARGING, CONNECTION_QUESTION_MARK_1);
+				setDisplayValue(ICON_BATTERY_PRECHARGING, BATTERY_CAPACITY_EMPTY);
+				ftime(&startTime[gun_index][TMR_IDX_CONNECTION]);
+				CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_0;
+			}
+			else
+			{
+				setDisplayValue(ICON_PLUGIN_ARROW, PLUGIN_ARROW_1);
+				GUN_PLUGING_LEVEL_STATUS = GUN_PLUGING_LEVEL_0;
+				ftime(&startTime[gun_index][TMR_IDX_PLUGIN]);
+			}
+			break;
+		case SYS_MODE_CHARGING:
+			// DEFAULT TIMER, ICON AND STATUS OF ANIMATION
+			setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_ELECTRIC_MARK_1);
+			ftime(&startTime[gun_index][TMR_IDX_CONNECTION]);
+			ftime(&startTime[gun_index][TMR_IDX_BATTERY]);
+			CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_0;
+			BATTERY_LEVEL_STATUS = BATTERY_LEVEL_5;
+			break;
+		case SYS_MODE_TERMINATING:
+			// DEFAULT TIMER, ICON AND STATUS OF ANIMATION
+			setDisplayValue(ICON_CONNECTION_CHARGING, CONNECTION_QUESTION_MARK_1);
+			ftime(&startTime[gun_index][TMR_IDX_CONNECTION]);
+			CONNECTION_LEVEL_STATUS = CONNECTION_LEVEL_0;
+			BATTERY_LEVEL_STATUS = BATTERY_LEVEL_5;
+			break;
+		case SYS_MODE_COMPLETE:
+			break;
+		case SYS_MODE_ALARM:
+			break;
+		case SYS_MODE_FAULT:
+			break;
+		case SYS_MODE_MAINTAIN:
+			break;
+		case SYS_MODE_UPDATE:
+			break;
+		case SYS_MODE_RESERVATION:
+			break;
+		case SYS_MODE_BOOKING:
+			break;
+		case SYS_MODE_DEBUG:
+			break;
+		default:
+			break;
+	}
+}
+
+//=======================================
+// Initial all share memory
+//=======================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	// Initial ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
+    {
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		result = FAIL;
+	}
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	// Initial ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
+    {
+   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+   		result = FAIL;
+	}
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	// Initial ShmCharger
+	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmChargerKey NG\n");
+		result = FAIL;
+	}
+	else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmChargerKey NG\n");
+		result = FAIL;
+	}
+
+	// Initial ShmOCPP16Data
+	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
+		result = FAIL;
+	}
+	else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
+		result = FAIL;
+	}
+
+	// Initial ShmOCPP20Data
+	if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmOCPP20Data NG\n");
+		result = FAIL;
+	}
+	else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmOCPP20Data NG\n");
+		result = FAIL;
+	}
+
+    return result;
+}
+
+//=======================================
+// Initial communication port
+//=======================================
+int InitComPort()
+{
+	int fd;
+	struct termios tios;
+
+	fd = open("/dev/ttyS3", O_RDWR);
+	if(fd<=0)
+	{
+		DEBUG_ERROR("open /dev/ttyS3 NG\n");
+		return -1;
+	}
+
+	ioctl (fd, TCGETS, &tios);
+	tios.c_cflag = B115200| CS8 | CLOCAL | CREAD;
+	tios.c_lflag = 0;
+	tios.c_iflag = 0;
+	tios.c_oflag = 0;
+	tios.c_cc[VMIN]=0;
+	tios.c_cc[VTIME]=(unsigned char)5;		// timeout 500ms
+	tios.c_lflag=0;
+	tcflush(fd, TCIFLUSH);
+	ioctl (fd, TCSETS, &tios);
+
+	return fd;
+}
+
+//=======================================
+// Download image
+//=======================================
+int downloadBMP(uint8_t picIdx, char *filename)
+{
+	int result = PASS;
+	BMP *bmp;
+	struct stat fileSt;
+	uint32_t pageSize = 0xf0;
+	uint32_t pixelSize;
+	uint32_t transferedByte=0;
+	uint16_t bufferRamAddr = 0x8000;
+	uint32_t dataLen = 0;
+	uint32_t startAddr=0;
+
+	// Reset LCD
+	uint8_t cmd_reset[] = {0x55, 0xaa, 0x5a, 0xa5};
+	while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, 0x04, cmd_reset, ARRAY_SIZE(cmd_reset)) != PASS)
+	{
+		DEBUG_INFO("LCD reset fail.\n");
+	}
+	sleep(1);
+
+	// Get image file size
+	stat(filename, &fileSt);
+	bmp = bopen(filename);
+	uint8_t buf[bmp->width*bmp->height*2];
+
+	DEBUG_INFO("Target address: %d\n", picIdx);
+	DEBUG_INFO("Image filename: %s\n", filename);
+	DEBUG_INFO("Image width: %d height: %d\n", bmp->width, bmp->height);
+	DEBUG_INFO("Image data size: %d\n", ARRAY_SIZE(buf));
+
+	// Get bmp pixel data and convert to 16 bit color
+	for(uint16_t idxY=0 ; idxY<bmp->height ; idxY++)
+	{
+		for(uint16_t idxX=0 ; idxX<bmp->width ; idxX++)
+		{
+			uint8_t r, g, b;
+			get_pixel_rgb(bmp, idxX, (bmp->height-idxY-1), &r, &g, &b);
+			buf[(2*((idxY*bmp->width) + idxX)) + 0] = ((((r>>3)<<11) | ((g>>2)<<5) | (b>>3)) >> 8) & 0xff;
+			buf[(2*((idxY*bmp->width) + idxX)) + 1] = ((((r>>3)<<11) | ((g>>2)<<5) | (b>>3)) >> 0) & 0xff;
+		}
+	}
+	bclose(bmp);
+
+	// Transfer pixel to screen page
+	pixelSize = ARRAY_SIZE(buf);
+	for(uint16_t idxSrcData=0;idxSrcData<(((pixelSize%pageSize)==0)?(pixelSize/pageSize):(pixelSize/pageSize)+1);idxSrcData++)
+	{
+		//DEBUG_INFO("Buffer start data address: 0x%08X\n", (idxSrcData*pageSize));
+		//DEBUG_INFO("  Image start ram address: 0x%08X\n", ((idxSrcData*pageSize) >> 1));
+		uint8_t display_cmd[] ={0x5a, (bufferRamAddr>>8)&0xff, (bufferRamAddr>>0)&0xff, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+		if((idxSrcData+1) != (((pixelSize%pageSize)==0)?(pixelSize/pageSize):(pixelSize/pageSize)+1))
+		{
+			// Data transfer
+			while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, (bufferRamAddr+(dataLen>>1)), &buf[(idxSrcData*pageSize)], pageSize) != PASS)
+			{
+				DEBUG_INFO("Transfer data to ram 0x%04X fail.\n", transferedByte);
+			}
+			transferedByte += pageSize;
+			dataLen += pageSize;
+		}
+		else
+		{
+			// Last data transfer
+			while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, (bufferRamAddr+(dataLen>>1)), &buf[(idxSrcData*pageSize)], (pixelSize-(idxSrcData*pageSize))) != PASS)
+			{
+				DEBUG_INFO("Transfer data to ram 0x%04X fail.\n", transferedByte);
+			}
+			transferedByte += (pixelSize-(idxSrcData*pageSize));
+			dataLen += (pixelSize-(idxSrcData*pageSize));
+		}
+
+		// Move data from ram to flash
+		if((dataLen >= (pageSize*10)) || (idxSrcData == (((pixelSize%pageSize)==0)?(pixelSize/pageSize):(pixelSize/pageSize)+1)-1))
+		{
+			display_cmd[3] = ((dataLen>>1) >> 8) & 0xff;							// Data length high byte
+			display_cmd[4] = ((dataLen>>1) >> 0) & 0xff;							// Data length low byte
+			display_cmd[5] = (((startAddr)>>1) >> 16) & 0xff;				// Screen on ram address 1st byte
+			display_cmd[6] = (((startAddr)>>1) >> 8) & 0xff;				// Screen on ram address 2nd byte
+			display_cmd[7] = (((startAddr)>>1) >> 0) & 0xff;				// Screen on ram address 3th byte
+
+			while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, 0xa2, display_cmd, ARRAY_SIZE(display_cmd)) != PASS)
+			{
+				DEBUG_INFO("Write data to display buffer 0x%04X fail.\n", transferedByte);
+			}
+			startAddr += dataLen;
+			dataLen = 0;
+		}
+	}
+
+	// Save image to target address
+	uint8_t save_cmd[] ={0x5a, 0x02, ((picIdx>>8)&0xff), (picIdx&0xff)};
+	while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, 0x84, save_cmd, ARRAY_SIZE(save_cmd)) != PASS)
+	{
+		DEBUG_INFO("Save image fail.\n");
+	}
+	DEBUG_INFO("Save image success.\n");
+	sleep(1);
+
+	return result;
+}
+
+//=======================================
+// Download image
+//=======================================
+int downloadBIN(uint8_t targetAddr, char *filename)
+{
+	int result = PASS;
+	int fd;
+	struct stat fileSt;
+	uint32_t pageSize = 128;
+	uint32_t blocklSize = 32768;
+	uint32_t transferedByte=0;
+	uint16_t bufferRamAddr = 0x8000;
+
+	// Reset LCD
+	uint8_t cmd_reset[] = {0x55, 0xaa, 0x5a, 0xa5};
+	while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, 0x04, cmd_reset, ARRAY_SIZE(cmd_reset)) != PASS)
+	{
+		DEBUG_INFO("LCD reset fail.\n");
+	}
+	sleep(1);
+
+	// Get image file size
+	stat(filename, &fileSt);
+	uint8_t buf[(fileSt.st_size%32768==0?(fileSt.st_size/32768)*32768:(fileSt.st_size/32768)+1)*32768];
+
+	DEBUG_INFO("Target address: %d\n", targetAddr);
+	DEBUG_INFO("Bin filename: %s\n", filename);
+	DEBUG_INFO("Bin data size: %d\n", fileSt.st_size);
+
+	fd = open(filename, O_RDWR);
+	if (fd < 0)
+	{
+		DEBUG_WARN("Bin can not be open.\n");
+		result = FAIL;
+	}
+	else
+	{
+		// Read data from bin file
+		memset(buf, 0x00, ARRAY_SIZE(buf));
+		read(fd, buf, ARRAY_SIZE(buf));
+		close(fd);
+
+		for(uint8_t idxBinSrc=0;idxBinSrc<(fileSt.st_size%32768==0?fileSt.st_size/32768:(fileSt.st_size/32768)+1);idxBinSrc++)
+		{
+			// Transfer data to ram
+			for(uint16_t idxSrcData=0;idxSrcData<(((blocklSize%pageSize)==0)?(blocklSize/pageSize):(blocklSize/pageSize)+1);idxSrcData++)
+			{
+				//DEBUG_INFO("Buffer start data address: 0x%08X\n", (idxBinSrc*blocklSize)+(idxSrcData*pageSize));
+				//DEBUG_INFO("  Image start ram address: 0x%08X\n", ((idxSrcData*pageSize) >> 1));
+				if((idxSrcData+1) != (((blocklSize%pageSize)==0)?(blocklSize/pageSize):(blocklSize/pageSize)+1))
+				{
+					// Data transfer
+					while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, bufferRamAddr+((idxSrcData*pageSize)>>1), &buf[(idxBinSrc*blocklSize)+(idxSrcData*pageSize)], pageSize) != PASS)
+					{
+						DEBUG_INFO("Transfer data to ram 0x%04X fail.\n", transferedByte);
+					}
+					transferedByte += pageSize;
+				}
+				else
+				{
+					// Last data transfer
+					while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, bufferRamAddr+((idxSrcData*pageSize)>>1), &buf[(idxBinSrc*blocklSize)+(idxSrcData*pageSize)], (blocklSize-(idxSrcData*pageSize)))!= PASS)
+					{
+						DEBUG_INFO("Transfer data to ram 0x%04X fail.\n", transferedByte);
+					}
+					transferedByte += (blocklSize-(idxSrcData*pageSize));
+				}
+			}
+
+			// Move data from ram to flash
+			uint8_t save_cmd[] ={0x5a, 0x02, ((((targetAddr*8)+idxBinSrc)>>8)&0xff), ((((targetAddr*8)+idxBinSrc)>>0)&0xff), ((bufferRamAddr>>8)&0xff), ((bufferRamAddr>>0)&0xff), 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};
+			while(lcdRegisterWrite(Uart1Fd, REG_TYPE_RAM, 0xaa, save_cmd, ARRAY_SIZE(save_cmd)) != PASS)
+			{
+				DEBUG_INFO("Save bin file to 0x%04X fail.\n", ((targetAddr*8)+idxBinSrc));
+			}
+			DEBUG_INFO("Save bin file on 0x%04X success.\n", ((targetAddr*8)+idxBinSrc));
+			sleep(1);
+		}
+	}
+
+	return result;
+}
+
+//=======================================
+// LCD upgrade
+//=======================================
+int lcdUpgrade(char *forlder)
+{
+	int result = PASS;
+	DIR *dir;
+	struct dirent *file;
+	struct stat fileSt;
+
+	if ((dir = opendir (forlder)) != NULL)
+	{
+		/* print all the files and directories within directory */
+		while ((file = readdir (dir)) != NULL)
+		{
+			if((strlen(file->d_name)>2))
+			{
+				int targetAddr;
+				stat(file->d_name, &fileSt);
+
+				if(sscanf(file->d_name, "%d", &targetAddr) == 1)
+				{
+					char targetFile[384];
+
+					sprintf(targetFile, "/mnt/lcd/%s", file->d_name);
+					if(strstr(file->d_name, ".bmp") != NULL)
+					{
+						downloadBMP(targetAddr, targetFile);
+					}
+					else
+					{
+						downloadBIN(targetAddr, targetFile);
+					}
+				}
+				else
+				{
+					DEBUG_WARN("%s can not parse target address.\n", file->d_name);
+				}
+			}
+			else
+			{
+				if(strlen(file->d_name) >= 3)
+				{
+					DEBUG_ERROR("File name error.\n");
+					result = FAIL;
+				}
+				else
+				{
+					DEBUG_INFO("Searching file.\n");
+				}
+			}
+			sleep(1);
+		}
+		closedir (dir);
+	}
+	else
+	{
+		DEBUG_ERROR("%s does not valid.\n", forlder);
+		result = FAIL;
+	}
+
+	return result;
+}
+
+//=======================================
+// Main process
+//=======================================
+int main(void)
+{
+	uint8_t previousMode = 0xff;
+
+	if(InitShareMemory() == FAIL)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("InitShareMemory NG\n");
+		#endif
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory = 1;
+		}
+		sleep(5);
+		return FAIL;
+	}
+
+	Uart1Fd=InitComPort();
+	if(Uart1Fd<0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("InitComPort NG\n");
+		#endif
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = 1;
+		}
+		sleep(5);
+		return FAIL;
+	}
+	else
+	{}
+
+	DEBUG_INFO("Initial completed\n");
+	DEBUG_INFO("Latest Firmware Version : [%s] \n", FIRMWARE_UPDATE_IMAGE[0]);
+	DEBUG_INFO("Latest Upgrade Date : [%s]. \n", FIRMWARE_UPDATE_IMAGE[1]);
+	DEBUG_INFO("Latest Image Version : [%s]. \n", FIRMWARE_UPDATE_IMAGE[2]);
+
+	for(;;)
+	{
+		if(ShmCharger->isUpgradeLcmReq)
+		{
+			ShmCharger->isUpgradeLcmSuccess = ((lcdUpgrade("/mnt/lcd") == PASS) ? YES : NO);
+			ShmCharger->isUpgradeLcmReq = OFF;
+		}
+		else
+		{
+			if(previousMode != ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus)
+			{
+				previousMode = ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus;
+			}
+
+			if(ShmCharger->isAuthrizing || ShmCharger->isGetAuthResult)
+			{
+				if(DiffTimebWithNow(startTime[ShmCharger->gun_selectd][TMR_IDX_SHOW_AUTH_RESULT]) >= TIME_AUTH_RESULT_TIME)
+					ShmCharger->isGetAuthResult = FALSE;
+
+				if(DiffTimebWithNow(startTime[ShmCharger->gun_selectd][TMR_IDX_SHOW_AUTH_RESULT]) < TIME_AUTH_RESULT_TIME)
+					page_authorizing(ShmCharger->gun_selectd);
+				else if((ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus == SYS_MODE_IDLE) && (ShmCharger->gun_info[ShmCharger->gun_selectd].resultAuthorization == VALIDATED_RFID))
+					page_preparing(ShmCharger->gun_selectd, ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus);
+			}
+			else
+			{
+				ftime(&startTime[ShmCharger->gun_selectd][TMR_IDX_SHOW_AUTH_RESULT]);
+
+				switch(ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus)
+				{
+					case SYS_MODE_BOOTING:
+						page_booting();
+						break;
+					case SYS_MODE_IDLE:
+						page_idle(ShmCharger->gun_selectd, ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus);
+						break;
+					case SYS_MODE_AUTHORIZING:
+						//page_authorizing(ShmCharger->gun_selectd);
+						break;
+					case SYS_MODE_PREPARING:
+						page_preparing(ShmCharger->gun_selectd, ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus);
+						break;
+					case SYS_MODE_CHARGING:
+						page_charging(ShmCharger->gun_selectd, ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus);
+						break;
+					case SYS_MODE_TERMINATING:
+						page_terminating(ShmCharger->gun_selectd, ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus);
+						break;
+					case SYS_MODE_COMPLETE:
+						page_complete(ShmCharger->gun_selectd, ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus);
+						break;
+					case SYS_MODE_ALARM:
+						page_alarm();
+						break;
+					case SYS_MODE_FAULT:
+						page_fault();
+						break;
+					case SYS_MODE_MAINTAIN:
+						page_maintain();
+						break;
+					case SYS_MODE_UPDATE:
+						page_update();
+						break;
+					case SYS_MODE_RESERVATION:
+						//page_reservation();
+						page_idle(ShmCharger->gun_selectd, ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus);
+						break;
+					case SYS_MODE_BOOKING:
+						page_booking();
+						break;
+					case SYS_MODE_DEBUG:
+						page_debug();
+						break;
+					default:
+						page_unknown();
+						break;
+				}
+			}
+
+			page_header(ShmCharger->gun_selectd, ShmSysConfigAndInfo->SysInfo.AcChargingData[ShmCharger->gun_selectd].SystemStatus);
+			page_footer();
+		}
+
+		usleep(100000);
+	}
+
+	return FAIL;
+}

+ 315 - 0
EVSE/Projects/AX80/Apps/LCM/cbmp.c

@@ -0,0 +1,315 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include "cbmp.h"
+
+// Constants
+
+#define BITS_PER_BYTE 8
+
+#define BLUE 0
+#define GREEN 1
+#define RED 2
+#define ALPHA 3
+
+#define PIXEL_ARRAY_START_BYTES 4
+#define PIXEL_ARRAY_START_OFFSET 10
+
+#define WIDTH_BYTES 4
+#define WIDTH_OFFSET 18
+
+#define HEIGHT_BYTES 4
+#define HEIGHT_OFFSET 22
+
+#define DEPTH_BYTES 2
+#define DEPTH_OFFSET 28
+
+// Private function declarations
+
+void _throw_error(char* message);
+unsigned int _get_int_from_buffer(unsigned int bytes, 
+                                  unsigned int offset, 
+                                  unsigned char* buffer);
+unsigned int _get_file_byte_number(FILE* fp);
+unsigned char* _get_file_byte_contents(FILE* fp, unsigned int file_byte_number);
+int _validate_file_type(unsigned char* file_byte_contents);
+int _validate_depth(unsigned int depth);
+unsigned int _get_pixel_array_start(unsigned char* file_byte_contents);
+int _get_width(unsigned char* file_byte_contents);
+int _get_height(unsigned char* file_byte_contents);
+unsigned int _get_depth(unsigned char* file_byte_contents);
+void _update_file_byte_contents(BMP* bmp, int index, int offset, int channel);
+void _populate_pixel_array(BMP* bmp);
+void _map(BMP* bmp, void (*f)(BMP* bmp, int, int, int));
+void _get_pixel(BMP* bmp, int index, int offset, int channel);
+
+// Public function implementations
+
+BMP* bopen(char* file_path)
+{
+    FILE* fp = fopen(file_path, "rb");
+  
+    if (fp == NULL)
+    {
+        perror("Error opening file");
+        exit(EXIT_FAILURE);
+    }
+
+    BMP* bmp = (BMP*) malloc(sizeof(BMP));
+    bmp->file_byte_number = _get_file_byte_number(fp);
+    bmp->file_byte_contents = _get_file_byte_contents(fp, bmp->file_byte_number);
+    fclose(fp);
+
+    if(!_validate_file_type(bmp->file_byte_contents))
+    {
+        _throw_error("Invalid file type");
+    }
+
+    bmp->pixel_array_start = _get_pixel_array_start(bmp->file_byte_contents);
+
+    bmp->width = _get_width(bmp->file_byte_contents);
+    bmp->height = _get_height(bmp->file_byte_contents);
+    bmp->depth = _get_depth(bmp->file_byte_contents);
+
+    if(!_validate_depth(bmp->depth))
+    {
+        _throw_error("Invalid file depth");
+    }
+
+    _populate_pixel_array(bmp);
+
+    return bmp;
+}
+
+BMP* b_deep_copy(BMP* to_copy)
+{
+    BMP* copy = (BMP*) malloc(sizeof(BMP));
+    copy->file_byte_number = to_copy->file_byte_number;
+    copy->pixel_array_start = to_copy->pixel_array_start;
+    copy->width = to_copy->width;
+    copy->height = to_copy->height;
+    copy->depth = to_copy->depth;
+
+    copy->file_byte_contents = (unsigned char*) malloc(copy->file_byte_number * sizeof(unsigned char));
+
+    unsigned int i;
+    for (i = 0; i < copy->file_byte_number; i++)
+    {
+        copy->file_byte_contents[i] = to_copy->file_byte_contents[i];
+    }
+
+    copy->pixels = (pixel*) malloc(copy->width * copy->height * sizeof(pixel));
+
+    unsigned int x, y;
+    int index;
+    for (y = 0; y < copy->height; y++)
+    {
+        for (x = 0; x < copy->width; x++)
+        {
+            index = y * copy->width + x;
+            copy->pixels[index].red = to_copy->pixels[index].red;
+            copy->pixels[index].green = to_copy->pixels[index].green;
+            copy->pixels[index].blue = to_copy->pixels[index].blue;
+            copy->pixels[index].alpha = to_copy->pixels[index].alpha;
+        }
+    }
+
+    return copy;
+}
+
+int get_width(BMP* bmp)
+{
+    return bmp->width;
+}
+
+int get_height(BMP* bmp)
+{
+    return bmp->height;
+}
+
+unsigned int get_depth(BMP* bmp)
+{
+    return bmp->depth;
+}
+
+void get_pixel_rgb(BMP* bmp, int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)
+{
+    int index = y * bmp->width + x;
+    *r = bmp->pixels[index].red;
+    *g = bmp->pixels[index].green;
+    *b = bmp->pixels[index].blue;
+}
+
+void set_pixel_rgb(BMP* bmp, int x, int y, unsigned char r, unsigned char g, unsigned char b)
+{
+    int index = y * bmp->width + x;
+    bmp->pixels[index].red = r;
+    bmp->pixels[index].green = g;
+    bmp->pixels[index].blue = b;
+}
+
+void bwrite(BMP* bmp, char* file_name)
+{
+    _map(bmp, _update_file_byte_contents);
+
+    FILE* fp = fopen(file_name, "wb");
+    fwrite(bmp->file_byte_contents, sizeof(char), bmp->file_byte_number, fp);
+    fclose(fp);
+}
+
+void bclose(BMP* bmp)
+{
+    free(bmp->pixels);
+    bmp->pixels = NULL;
+    free(bmp->file_byte_contents);
+    bmp->file_byte_contents = NULL;
+    free(bmp);
+    bmp = NULL;
+}
+
+
+// Private function implementations
+
+void _throw_error(char* message)
+{
+    fprintf(stderr, "%s\n", message);
+    exit(1);
+}
+
+unsigned int _get_int_from_buffer(unsigned int bytes, 
+                                  unsigned int offset, 
+                                  unsigned char* buffer)
+{
+    unsigned char* _buffer = (unsigned char*) malloc(bytes * sizeof(unsigned char));
+
+    unsigned int i;
+    for (i = 0; i < bytes; i++)
+    {
+        _buffer[i] = buffer[i + offset];
+    }
+
+    unsigned int value = *(unsigned int*) _buffer;
+    free(_buffer);
+    return value;
+}
+
+unsigned int _get_file_byte_number(FILE* fp)
+{
+    unsigned int byte_number;
+    fseek(fp, 0, SEEK_END);
+    byte_number = ftell(fp);
+    rewind(fp);
+    return byte_number;
+}
+
+unsigned char* _get_file_byte_contents(FILE* fp, unsigned int file_byte_number)
+{
+    unsigned char* buffer = (unsigned char*) malloc(file_byte_number * sizeof(char));
+    unsigned int result = fread(buffer, 1, file_byte_number, fp);
+
+    if (result != file_byte_number)
+    {
+        _throw_error("There was a problem reading the file");
+    }
+
+
+    return buffer;
+}
+
+int _validate_file_type(unsigned char* file_byte_contents)
+{
+    return file_byte_contents[0] == 'B' && file_byte_contents[1] == 'M';
+}
+
+int _validate_depth(unsigned int depth)
+{
+    return depth == 24 || depth == 32;
+}
+
+unsigned int _get_pixel_array_start(unsigned char* file_byte_contents)
+{
+    return _get_int_from_buffer(PIXEL_ARRAY_START_BYTES, PIXEL_ARRAY_START_OFFSET, file_byte_contents);
+}
+
+int _get_width(unsigned char* file_byte_contents)
+{
+    return (int) _get_int_from_buffer(WIDTH_BYTES, WIDTH_OFFSET, file_byte_contents);
+}
+
+int _get_height(unsigned char* file_byte_contents)
+{
+    return (int) _get_int_from_buffer(HEIGHT_BYTES, HEIGHT_OFFSET, file_byte_contents);
+}
+
+unsigned int _get_depth(unsigned char* file_byte_contents)
+{
+    return _get_int_from_buffer(DEPTH_BYTES, DEPTH_OFFSET, file_byte_contents);
+}
+
+void _update_file_byte_contents(BMP* bmp, int index, int offset, int channel)
+{
+    char value;
+    switch(channel)
+    {
+        case BLUE:
+            value = bmp->pixels[index].blue;
+            break;
+        case GREEN:
+            value = bmp->pixels[index].green;
+            break;
+        case RED:
+            value = bmp->pixels[index].red;
+            break;
+        case ALPHA:
+            value = bmp->pixels[index].alpha;
+            break;
+    }
+    bmp->file_byte_contents[offset + channel] = value;
+}
+
+void _populate_pixel_array(BMP* bmp)
+{
+    bmp->pixels = (pixel*) malloc(bmp->width * bmp->height * sizeof(pixel));
+    _map(bmp, _get_pixel);
+}
+
+void _map(BMP* bmp, void (*f)(BMP*, int, int, int))
+{
+    int channels = bmp->depth / (sizeof(unsigned char) * BITS_PER_BYTE);
+    int row_size = ((int) (bmp->depth * bmp->width + 31) / 32) * 4;
+    int padding = row_size - bmp->width * channels;
+
+    int c;
+    unsigned int x, y, index, offset;
+    for (y = 0; y < bmp->height; y++)
+    {
+        for (x = 0; x < bmp->width; x++)
+        {
+            index = y * bmp->width + x;
+            offset = bmp->pixel_array_start + index * channels + y * padding;
+            for (c = 0; c < channels; c++)
+            {
+                (*f)(bmp, index, offset, c);
+            }
+        }
+    }
+}
+
+void _get_pixel(BMP* bmp, int index, int offset, int channel)
+{
+    unsigned char value = _get_int_from_buffer(sizeof(unsigned char), offset + channel, bmp->file_byte_contents);
+    switch(channel)
+    {
+        case BLUE:
+            bmp->pixels[index].blue = value;
+            break;
+        case GREEN:
+            bmp->pixels[index].green = value;
+            break;
+        case RED:
+            bmp->pixels[index].red = value;
+            break;
+        case ALPHA:
+            bmp->pixels[index].alpha = value;
+            break;
+    }
+}

+ 54 - 0
EVSE/Projects/AX80/Apps/LCM/cbmp.h

@@ -0,0 +1,54 @@
+#ifndef CBMP_CBMP_H
+#define CBMP_CBMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Pixel structure
+// Not meant to be edited directly
+// Please use the API
+
+typedef struct pixel_data
+{
+    unsigned char red;
+    unsigned char green;
+    unsigned char blue;
+    unsigned char alpha;
+} pixel;
+
+// BMP structure
+// Not meant to be edited directly
+// Please use the API
+
+typedef struct BMP_data
+{
+    unsigned int file_byte_number;
+    unsigned char* file_byte_contents;
+
+    unsigned int pixel_array_start;
+
+    unsigned int width;
+    unsigned int height;
+    unsigned int depth;
+
+    pixel* pixels;
+} BMP;
+
+// Public function declarations
+
+BMP* bopen(char* file_path);
+BMP* b_deep_copy(BMP* to_copy);
+int get_width(BMP* bmp);
+int get_height(BMP* bmp);
+unsigned int get_depth(BMP* bmp);
+void get_pixel_rgb(BMP* bmp, int x, int y, unsigned char* r, unsigned char* g, unsigned char* b);
+void set_pixel_rgb(BMP* bmp, int x, int y, unsigned char r, unsigned char g, unsigned char b);
+void bwrite(BMP* bmp, char* file_name);
+void bclose(BMP* bmp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // CBMP_CBMP_H

+ 222 - 0
EVSE/Projects/AX80/Apps/LCM/lcmComm_dgus.c

@@ -0,0 +1,222 @@
+/*
+ * lcmComm_dgus.c
+ *
+ * Created on : 2020-10-20
+ * Update on : 2021-06-23
+ * Author : Folus Wen, Eason Yang
+ * Version : D0.01
+ *
+ */
+
+#include 	"lcmComm_dgus.h"
+
+//#define isDebugPrint
+
+//=======================================
+// Basic routine
+//=======================================
+void displayMessageDgus(uint8_t *data, uint16_t len, uint8_t isRX)
+{
+	uint8_t output[8192];
+
+	memset(output, 0x00, ARRAY_SIZE(output));
+	sprintf((char*)output, "%s", (isRX?"RX: ":"TX: "));
+	for(uint16_t idx = 0;idx<len;idx++)
+	{
+		sprintf((char*)output, "%s%02x ", output, data[idx]);
+	}
+
+	#ifdef isDebugPrint
+	DEBUG_INFO("%s\n", output);
+	#endif
+}
+
+//=======================================
+// Call function (Transmit message into LCD)
+//=======================================
+int transceiverDgus(int32_t fd, uint8_t *tx, uint16_t tx_len, uint8_t *rx, uint16_t rx_len)
+{
+	int result = FAIL;
+	int len;
+
+	tcflush(fd,TCIOFLUSH);
+
+	#ifdef isDebugPrint
+	displayMessageDgus(tx, tx_len, NO);
+	#endif
+
+	if(write(fd, tx, tx_len) >= ARRAY_SIZE(tx))
+	{
+		if(tx[3] == CMD_REG_WRITE_DATA)
+		{
+			usleep(100);
+			len = read(fd, rx, rx_len);
+			if(len > 0)
+			{
+				if((rx[0] == CMD_HEADER_1) && (rx[1] == CMD_HEADER_2))
+				{
+					if((rx[3] == CMD_REG_WRITE_DATA) && ((rx[4] == CMD_ACK_VALUE_1) && (rx[5] == CMD_ACK_VALUE_2)))
+					{
+						#ifdef isDebugPrint
+						displayMessageDgus(rx, len, YES);
+						#endif
+
+						result = PASS;
+					}
+					else
+					{}
+				}
+				else
+				{}
+			}
+			else
+			{}
+		}
+		else if(tx[3] == CMD_REG_READ_DATA)
+		{
+			len = read(fd, rx, rx_len);
+			if(len > 0)
+			{
+				if((rx[0] == CMD_HEADER_1) && (rx[1] == CMD_HEADER_2))
+				{
+					if(rx[3] == CMD_REG_READ_DATA)
+					{
+						#ifdef isDebugPrint
+						displayMessageDgus(rx, len, YES);
+						#endif
+
+						result = PASS;
+					}
+					else
+					{}
+				}
+				else
+				{}
+			}
+			else
+			{}
+		}
+		else
+		{}
+	}
+	else
+	{}
+
+	return result;
+}
+
+//=======================================
+// Call function (Write register value function)
+//=======================================
+int8_t lcdRegisterWrite(int32_t fd, uint8_t regType, uint16_t address, uint8_t *data, uint16_t dataLen)
+{
+	int8_t result = FAIL;
+	uint8_t tx[(regType == REG_TYPE_CONTROL? 8 : 6) + dataLen];
+	uint8_t rx[128];
+
+	memset(tx, 0x00, sizeof(tx));
+	memset(rx, 0x00, sizeof(rx));
+
+	tx[0] = CMD_HEADER_1;
+	tx[1] = CMD_HEADER_2;
+	tx[2] = (regType == REG_TYPE_CONTROL? 7 : (3 + dataLen));
+	tx[3] = CMD_REG_WRITE_DATA;
+	tx[4] = (address >> 8) & 0xff;
+	tx[5] = (address >> 0) & 0xff;
+
+	if(regType == REG_TYPE_CONTROL)
+	{
+		if(address == REG_ADDRESS_SET_PAGE_ID)
+		{
+			tx[6] = 0x5A;
+			tx[7] = 0x01;
+
+			memcpy(&tx[8], data, dataLen);
+		}
+	}
+	else
+	{
+		memcpy(&tx[6], data, dataLen);
+	}
+
+	if(fd > 0)
+	{
+		if(transceiverDgus(fd, tx, ARRAY_SIZE(tx), rx, ARRAY_SIZE(rx)) == PASS)
+		{
+			result = PASS;
+		}
+		else
+		{}
+	}
+	else
+	{}
+
+	return result;
+}
+
+//=======================================
+// Call function (Read register value function)
+//=======================================
+int8_t lcdRegisterRead(int32_t fd, uint8_t regType, uint16_t address, uint8_t *data, uint16_t dataLen)
+{
+	int8_t result = FAIL;
+	uint8_t tx[(regType == REG_TYPE_CONTROL? 7 : 8)];
+	uint8_t rx[(regType == REG_TYPE_CONTROL? (7 + dataLen) : (8 + dataLen*2))];
+
+	memset(tx, 0x00, sizeof(tx));
+	memset(rx, 0x00, sizeof(rx));
+
+	tx[0] = CMD_HEADER_1;
+	tx[1] = CMD_HEADER_2;
+	tx[2] = (regType == REG_TYPE_CONTROL? 4 : 5);
+	tx[3] = CMD_REG_READ_DATA;
+	tx[4] = (address >> 8) & 0xff;
+	tx[5] = (address >> 0) & 0xff;
+
+	if(regType == REG_TYPE_CONTROL)
+	{
+		tx[6] = dataLen;
+	}
+	else if (regType == REG_TYPE_SPECIAL_CONTROL)
+	{
+		tx[6] = (dataLen >> 8) & 0xff;
+		tx[7] = (dataLen >> 0) & 0xff;
+	}
+	else
+	{}
+
+	if(fd > 0)
+	{
+		if(transceiverDgus(fd, tx, ARRAY_SIZE(tx), rx, ARRAY_SIZE(rx)))
+		{
+			if(regType == REG_TYPE_CONTROL)
+			{
+				if((rx[3] == CMD_REG_READ_DATA) && (((rx[4] << 8) | rx[5]) == address))
+				{
+					memcpy(data, rx + 7, dataLen);
+					result = PASS;
+				}
+				else
+				{}
+			}
+			else if(regType == REG_TYPE_SPECIAL_CONTROL)
+			{
+				if((rx[3] == CMD_REG_READ_DATA) && (((rx[4] << 8) | rx[5]) == address))
+				{
+					memcpy(data, rx + 8, dataLen*2);
+					result = PASS;
+				}
+				else
+				{}
+			}
+			else
+			{}
+		}
+		else
+		{}
+	}
+	else
+	{}
+
+	return result;
+}

+ 322 - 0
EVSE/Projects/AX80/Apps/LCM/lcmComm_dgus.h

@@ -0,0 +1,322 @@
+/*
+ * lcmComm_dwin.h
+ *
+ * Created on : 2020-10-20
+ * Update on : 2021-06-23
+ * Author : Folus Wen, Eason Yang
+ * Version : D0.01
+ *
+ */
+
+#ifndef LCMCOMM_DGUS_H_
+#define LCMCOMM_DGUS_H_
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+
+#define ARRAY_SIZE(A)			(sizeof(A) / sizeof(A[0]))
+#define PASS					1
+#define FAIL					-1
+#define YES						1
+#define NO						0
+#define ON						1
+#define OFF						0
+#define PAGE_DISPLAY_PERIOD		3
+
+//=======================================
+// Register Control type
+//=======================================
+#define REG_TYPE_CONTROL					0x00
+#define REG_TYPE_RAM						0x01
+#define REG_TYPE_SPECIAL_CONTROL			0x02
+
+//=======================================
+// Register content (Variable storage)
+//=======================================
+#define REG_ADDRESS_READ_VERSION			0x0F
+#define REG_ADDRESS_READ_RTC				0x10
+#define REG_ADDRESS_READ_PAGE_ID			0x14
+#define REG_ADDRESS_READ_BRIGHTNESS       	0x31
+#define REG_ADDRESS_WRITE_BRIGHTNESS		0X82
+#define REG_ADDRESS_SET_PAGE_ID				0x84
+#define REG_ADDRESS_SET_RTC					0x9C
+
+//=======================================
+// LCD command constant
+//=======================================
+#define CMD_HEADER_1						0x5A
+#define CMD_HEADER_2						0xA5
+#define CMD_REG_WRITE						0x80
+#define CMD_REG_READ						0x81
+#define CMD_REG_WRITE_DATA					0x82
+#define CMD_REG_READ_DATA					0x83
+#define CMD_ACK_VALUE_1						0x4F
+#define CMD_ACK_VALUE_2						0x4B
+
+//=======================================
+// LCD system screen
+//=======================================
+#define SYSTEM_SCREEN_BOOTING				0x00
+#define SYSTEM_SCREEN_IDLE    	  			0x01
+#define SYSTEM_SCREEN_PREPARING				0x02
+#define SYSTEM_SCREEN_PREPARE_FOR_EVSE		0x03
+#define SYSTEM_SCREEN_CHARGING				0x04
+#define SYSTEM_SCREEN_COMPLETE				0x05
+#define SYSTEM_SCREEN_MAINTAIN				0x06
+#define SYSTEM_SCREEN_AUTH_PASS				0x07
+#define SYSTEM_SCREEN_AUTH_FAIL				0x08
+#define SYSTEM_SCREEN_AUTH_UNKNOW			0x09
+#define SYSTEM_SCREEN_TERMINATING			0X0A
+#define SYSTEM_SCREEN_EMERGENCY				0x0B
+#define SYSTEM_SCREEN_SLEEP					0x0C
+#define SYSTEM_SCREEN_SLEEP2				0x0D
+#define SYSTEM_SCREEN_POWER_CONSUMPTION		0x0E
+
+//=======================================
+// Parameter to change icon status
+//=======================================
+#define DISAPPEAR							0x00
+#define APPEAR 								0x01
+#define BACKEND_OFFLINE						0x01
+#define BACKEND_ONLINE 						0x02
+#define ETHERENT_OFFLINE					0x03
+#define EHTERNET_ONLINE						0x04
+#define WIFI_OFFLINE						0x05
+#define WIFI_ONLINE							0x06
+#define TELECOM_OFFLINE						0x07
+#define TELECOM_ONLINE						0x08
+#define RFID_DISABLE						0x01
+#define RFID_ENABLE							0x02
+#define VISA_DISABLE						0x03
+#define VISA_ENABLE							0x04
+#define PLUGIN_ARROW_1						0x01
+#define PLUGIN_ARROW_2						0x02
+#define BATTERY_MAP							0x01
+#define BATTERY_CAPACITY_EMPTY				0x02
+#define BATTERY_CAPACITY_20					0x03
+#define BATTERY_CAPACITY_40					0x04
+#define BATTERY_CAPACITY_60					0x05
+#define BATTERY_CAPACITY_80					0x06
+#define BATTERY_CAPACITY_100				0x07
+#define CONNECTION_QUESTION_MARK_1			0x01
+#define CONNECTION_QUESTION_MARK_2			0x02
+#define CONNECTION_ELECTRIC_MARK_1			0x03
+#define CONNECTION_ELECTRIC_MARK_2			0x04
+#define TIMER_DARK							0x01
+#define TIMER_LIGHT							0x02
+#define POWER_DARK							0x01
+#define POWER_LIGHT							0x02
+#define ENERGY_DARK							0x01
+#define ENERGY_LIGHT						0x02
+#define ELECTRICITY_DIRECTION_RIGHT 		0x01
+#define ELECTRICITY_DIRECTION_LEFT 			0x02
+#define BATTERY_SOC_EMPTY					0x01
+#define BATTERY_SOC_20						0x02
+#define BATTERY_SOC_40						0x03
+#define BATTERY_SOC_60						0x04
+#define BATTERY_SOC_80						0x05
+#define BATTERY_SOC_100						0x06
+#define CONNECTION_COMPLETE_MARK			0x01
+#define QRCODE_BANDED						0x01
+#define QRCODE_ENABLE 						0x02
+#define QRCODE_DISABLE						0x03
+#define NEW_QRCODE_DISABLE					0x01
+#define NEW_QRCODE_ENABLE					0x02
+#define NEW_RFID_DISABLE					0x01
+#define NEW_RFID_ENABLE						0x02
+
+//=======================================
+// Icon variable address start from 1000
+//=======================================
+#define ICON_ALARM_1 						0x1000
+#define ICON_ALARM_2 						0x1001
+#define ICON_ALARM_3 						0x1002
+#define ICON_ALARM_4 						0x1003
+#define ICON_4G_CONNECTION 					0x1004
+#define ICON_WIFI_CONNECTION 				0x1005
+#define ICON_ETHERENT_CONNECTION 			0x1006
+#define ICON_BACKEND_CONNECTION				0x1007
+#define ICON_PRICE							0x1008
+#define ICON_RFID							0x1009
+#define ICON_QRCODE							0x100A
+#define ICON_PLUGIN_ARROW					0x100B
+#define ICON_BATTERY_PRECHARGING			0x100C
+#define ICON_CONNECTION_PRECHARGING 		0x100D
+#define ICON_TIMER_PRECHARGING				0x100E
+#define ICON_POWER_PRECHARGING				0x100F
+#define ICON_ENERGY_PRECHARGING				0x1010
+#define ICON_BATTERY_CHARGING				0x1011
+#define ICON_CONNECTION_CHARGING			0x1012
+#define ICON_ELECTRICITY_DIRECTION			0x1013
+#define ICON_TIMER_CHARGING					0x1014
+#define ICON_POWER_CHARGING					0x1015
+#define ICON_ENERGY_CHARGING				0x1016
+#define ICON_WALLER_COMPLETE				0x1017
+#define ICON_BATTERY_COMPLETE				0x1018
+#define ICON_CONNECTION_COMPLETE			0x1019
+#define ICON_TIMER_COMPLETE					0x101A
+#define ICON_COST_COMPLETE					0X101B
+#define ICON_ENERGY_COMPLETE				0X101C
+#define ICON_BALANCE_WALLET					0x101D
+#define ICON_DEFAULT_START_PRICE			0x101E
+#define ICON_DEFAULT_ENERGY					0x101F
+#define ICON_START_BUTTON					0x1020
+#define ICON_POWER_CONSUMPTION				0x1021
+#define ICON_THE_CHARGE_COMPLETE			0x1022
+#define ICON_NEW_RFID						0x1023
+#define ICON_NEW_QR_CODE					0x1024
+
+#define ICON_LOGO							0x1500
+#define ICON_LOGO_CHARGING					0x1501
+
+//=======================================
+// Text content address start from 2000
+//=======================================
+#define TEXT_ALARM_CODE_1					0x2000 // size 6
+#define TEXT_ALARM_CODE_2					0x2006 // size 6
+#define TEXT_ALARM_CODE_3					0x200C // size 6
+#define TEXT_ALARM_CODE_4					0x2012 // size 6
+#define TEXT_PRICE							0x2018 // size 16
+#define TEXT_CURRENCY_UNIT					0x2028 // size 16
+#define TEXT_TIMER_PRECHARGING 				0x2038 // size 16
+#define TEXT_POWER_PRECHARGING 				0x2048 // size 16
+#define TEXT_ENERGY_PRECHARGING 			0x2058 // size 16
+#define TEXT_TIMER_CHARGING					0x2068 // size 16
+#define TEXT_POWER_CHARGING					0x2078 // size 16
+#define TEXT_ENERGY_CHARGING				0x2088 // size 16
+#define TEXT_COST_COMPLETE					0x2098 // size 16
+#define TEXT_ACCOUNT_COMPLETE				0x20A8 // size 16
+#define TEXT_BALANCE						0x20B8 // size 16
+#define TEXT_PERCENTAGE						0x20C8 // size 6
+#define TEXT_CURRENCY_COMPLETE				0x20CE // size 16
+#define TEXT_DEFUALT_START_PRICE			0x20DE // size 16
+#define TEXT_DEFAULT_ENERGY					0x20EE // size 16
+#define TEXT_POWER_CONSUMPTION				0x20FE // size 32
+
+#define TEXT_RTC							0X2500 // size 32
+
+//=======================================
+// QR Code content address start from 3000
+//=======================================
+#define TEXT_QRCODE_CONTENT					0x3000 // size 256
+#define TEXT_QRCODE_RECEIPT					0x3100 // size 256
+
+//=======================================
+// QR Code mode define
+//=======================================
+#define QRCODE_FOR_IDLE						1
+#define QRCODE_FOR_COMPLETE					2
+
+//=======================================
+// 4G + WIFI connection flags (Header)
+//=======================================
+#define DISABLE_4G							0x00
+#define ENABLE_4G 							0x01
+#define DISABLE_WIFI						0x00
+#define WIFI_STATION						0x01
+#define WIFI_ACCESS_POINT					0x02
+
+//=======================================
+// Battery level status (Charging)
+//=======================================
+#define BATTERY_LEVEL_0						0x00
+#define BATTERY_LEVEL_1						0x01
+#define BATTERY_LEVEL_2						0x02
+#define BATTERY_LEVEL_3						0x03
+#define BATTERY_LEVEL_4						0x04
+#define BATTERY_LEVEL_5						0x05
+
+//=======================================
+// Connection level status (Charging)
+//=======================================
+#define CONNECTION_LEVEL_0					0x00
+#define CONNECTION_LEVEL_1					0x01
+
+//=======================================
+// Gun plug-in level status (Preparing)
+//=======================================
+#define GUN_PLUGING_LEVEL_0					0x00
+#define GUN_PLUGING_LEVEL_1					0x01
+
+//=======================================
+// RFID authorization constant
+//=======================================
+#define DEFAULT_RFID						0
+#define VALIDATED_RFID						1
+#define UNVALIDATED_RFID					2
+#define UNKNOW_RFID							3
+
+//=======================================
+// Normal mode or CCS mode constant
+//=======================================
+#define BASIC_MODE							0x00
+#define CCS_MODE							0x01
+
+//=======================================
+// Price type
+//=======================================
+#define DEFAULT_VALUE						0
+#define CONNECTION_FEE						1
+#define CURRENT_RATE						2
+#define OCCUPANCY_FEE						3
+#define SESSION_FEE							4
+#define TOTAL_COST							5
+#define ACCOUNT_BALANCE						6
+
+//=======================================
+// Currency type
+//=======================================
+#define DEFAULE_PRICE						1
+#define SET_USER_PRICE						2
+#define FINAL_COST							3
+
+//=======================================
+// LCM brightness percentage
+//=======================================
+#define BRIGHTNESS_0						0x00
+#define BRIGHTNESS_10						0x0A
+#define BRIGHTNESS_20						0x14
+#define BRIGHTNESS_30						0x1E
+#define BRIGHTNESS_40						0x28
+#define BRIGHTNESS_50						0x32
+#define BRIGHTNESS_60						0x3C
+#define BRIGHTNESS_70						0x46
+#define BRIGHTNESS_80						0x50
+#define BRIGHTNESS_90						0x5A
+#define BRIGHTNESS_100						0x64
+
+
+extern int StoreLogMsg(const char *fmt, ...);
+extern int8_t lcdRegisterWrite(int32_t fd, uint8_t regType, uint16_t address, uint8_t *data, uint16_t dataLen);
+extern int8_t lcdRegisterRead(int32_t fd, uint8_t regType, uint16_t address, uint8_t *data, uint16_t dataLen);
+
+#endif /* LCMCOMM_DGUS_H_ */

+ 164 - 0
EVSE/Projects/AX80/Apps/Makefile

@@ -0,0 +1,164 @@
+-include ../../../../Rules.make
+export PATH=/bin:/sbin:/usr/bin:$(SDK_PATH_TARGET)/usr/bin:$PATH
+
+#define library variable
+Lib_Module_RFID = "-L../../../Modularization" -lModule_RFID
+Lib_Module_Upgrade = "-L../../../Modularization" -lModule_Upgrade
+Lib_Module_RatedCurrent = "-L../../../Modularization" -lModule_RatedCurrent
+Lib_SQLite3 = "-L../../../Modularization/ocppfiles" -lsqlite3
+Lib_JSONC = "-L../../../GPL/json-c-json-c-0.13.1-20180305/release/lib" -ljson-c
+
+EXI_ENGINE= CCS/v2g/api/api.c \
+	    CCS/v2g/appHandshake/appHandEXIDatatypes.c \
+	    CCS/v2g/appHandshake/appHandEXIDatatypesDecoder.c \
+	    CCS/v2g/appHandshake/appHandEXIDatatypesEncoder.c \
+	    CCS/v2g/codec/BitInputStream.c \
+	    CCS/v2g/codec/BitOutputStream.c \
+	    CCS/v2g/codec/ByteStream.c \
+	    CCS/v2g/codec/DecoderChannel.c \
+	    CCS/v2g/codec/EncoderChannel.c \
+	    CCS/v2g/codec/EXIHeaderDecoder.c \
+	    CCS/v2g/codec/EXIHeaderEncoder.c \
+	    CCS/v2g/codec/MethodsBag.c \
+	    CCS/v2g/din/dinEXIDatatypes.c \
+	    CCS/v2g/din/dinEXIDatatypesDecoder.c \
+	    CCS/v2g/din/dinEXIDatatypesEncoder.c \
+	    CCS/v2g/iso1/iso1EXIDatatypes.c \
+	    CCS/v2g/iso1/iso1EXIDatatypesDecoder.c \
+	    CCS/v2g/iso1/iso1EXIDatatypesEncoder.c \
+	    CCS/v2g/iso2/iso2EXIDatatypes.c \
+	    CCS/v2g/iso2/iso2EXIDatatypesDecoder.c \
+	    CCS/v2g/iso2/iso2EXIDatatypesEncoder.c \
+	    CCS/v2g/transport/v2gtp.c \
+	    CCS/v2g/xmldsig/xmldsigEXIDatatypes.c \
+	    CCS/v2g/xmldsig/xmldsigEXIDatatypesDecoder.c \
+	    CCS/v2g/xmldsig/xmldsigEXIDatatypesEncoder.c \
+	    CCS/NidNmk.c \
+	    CCS/SystemLogMessage.c \
+	    CCS/Module_CCS.c
+
+all: CopyFile apps
+apps: Module_InternalComm_Task Module_FactoryConfig_Task Module_AlarmDetect_Task Module_CSU_Task Module_Speaker_Task Module_CCS_Task Module_LcmControl_Task Module_ConfigTools_Task Module_Debug_Task Module_PowerSharing_Task Module_Cabinet Module_Dispenser
+
+Module_ConfigTools_Task:
+	@echo "===== Module_ConfigTools_Task  ==================================="
+	rm -f Module_ConfigTools
+	rm -f Module_InternalComm
+	$(CC) -D $(Project) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_ConfigTools.o "./Module_ConfigTools.c"
+	$(CC) -o Module_ConfigTools Module_ConfigTools.o
+	rm -f *.o
+	mv -f Module_ConfigTools ../Images/root
+	@echo \
+
+Module_Debug_Task:
+	@echo "===== Module_Debug_Task  ==================================="
+	rm -f Module_Debug
+	rm -f Module_Debug
+	$(CC) -D $(Project) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_Debug.o "./Module_Debug.c"
+	$(CC) -o Module_Debug Module_Debug.o
+	rm -f *.o
+	mv -f Module_Debug ../Images/root
+	@echo \
+
+Module_InternalComm_Task:
+	@echo "===== Module_InternalComm_Task ==================================="
+	rm -f Module_InternalComm 
+	$(CC) -D $(Project) "-I../../" "-include../../../Modularization/Module_Upgrade.h" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_InternalComm.o "./Module_InternalComm.c"
+	$(CC) -o Module_InternalComm Module_InternalComm.o ${Lib_Module_Upgrade}
+	rm -f *.o
+	mv -f Module_InternalComm ../Images/root
+	@echo \ 
+	
+Module_FactoryConfig_Task:
+	@echo "===== Module_FactoryConfig_Task =================================="
+	rm -f Module_FactoryConfig
+	gcc -D $(Project) "-I../../" -o Module_FactoryConfig "./Module_FactoryConfig.c"
+	mkdir -p /Storage/SystemLog	
+	./Module_FactoryConfig -f;true
+	cp /mnt/FactoryDefaultConfig.bin ../Images 
+	rm -f Module_FactoryConfig 
+	$(CC) -D $(Project) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_FactoryConfig.o "./Module_FactoryConfig.c"
+	$(CC) -o Module_FactoryConfig Module_FactoryConfig.o 
+	rm -f *.o
+	mv -f Module_FactoryConfig ../Images/root
+	@echo \ 
+	
+Module_EventLogging_Task:
+	@echo "===== Module_EventLogging_Task ==================================="
+	rm -f Module_EventLogging 
+	$(CC) -D $(Project) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_EventLogging.o "./Module_EventLogging.c"
+	$(CC) -o Module_EventLogging Module_EventLogging.o 
+	rm -f *.o
+	mv -f Module_EventLogging ../Images/root
+	@echo \ 
+	
+Module_AlarmDetect_Task:
+	@echo "===== Module_AlarmDetect_Task ===================================="
+	rm -f Module_AlarmDetect 
+	$(CC) -D $(Project) "-I../../" -O0 -g3 -Wall -c -fmessage-length=0 -o Module_AlarmDetect.o "./Module_AlarmDetect.c"
+	$(CC) -o Module_AlarmDetect Module_AlarmDetect.o 
+	rm -f *.o
+	mv -f Module_AlarmDetect ../Images/root	
+	@echo \ 
+	
+Module_CSU_Task:
+	@echo "===== Module_CSU_Task ============================================"
+	rm -f main 
+	$(CC) -D $(Project) "-I../../" "-include../../../GPL/json-c-json-c-0.13.1-20180305/release/include/json-c/json.h" "-include../../../Modularization/ocppfiles/sqlite3.h" "-include../../../Modularization/Module_Upgrade.h" "-include../../../Modularization/Module_RFID.h" "-include../../../Modularization/Module_RatedCurrent.h" -O0 -g3 -Wall -c -fmessage-length=0 -o main.o "./main.c"
+	$(CC) -o main main.o ${Lib_Module_RFID} ${Lib_Module_Upgrade} ${Lib_SQLite3} ${Lib_Module_RatedCurrent} ${Lib_JSONC} -lrt
+	rm -f *.o
+	mv -f main ../Images/root		
+	@echo \
+
+Module_Speaker_Task:
+	@echo "===== Module_Speaker_Task ======================================="
+	rm -f Module_Speaker
+	$(CC) -D $(Project) "-I../../"  -O0 -g3 -Wall -c -fmessage-length=0 -o Module_Speaker.o  "./Module_Speaker.c"
+	$(CC) -o Module_Speaker Module_Speaker.o 
+	rm -f *.o
+	mv -f Module_Speaker ../Images/root	
+	@echo \ 
+
+Module_CCS_Task:
+	@echo "===== Module_CCS_Task =========================================="
+	rm -f Module_CCS
+	$(CC) -D $(Project) "-I../../../Modularization/ocppfiles/" "-ICCS/v2g/api" "-ICCS/v2g/appHandshake" "-ICCS/v2g/codec" "-ICCS/v2g/din" "-ICCS/v2g/iso1" "-ICCS/v2g/iso2" "-ICCS/v2g/transport" "-ICCS/v2g/xmldsig" "-ICCS/" "-I./" -O0 -g3 -Wall -fmessage-length=0 -lm  ${EXI_ENGINE} -o Module_CCS
+	rm -f *.o
+	mv -f Module_CCS ../Images/root
+
+Module_LcmControl_Task:
+	@echo "===== Module_LcmControl_Task ==================================="
+	rm -f Module_LcmControl
+	$(CC) -D $(Project) "-I../../../Modularization/ocppfiles/" "-I./" "-I../../" -O0 -g3 -Wall -fmessage-length=0 LCM/lcmComm_dgus.c LCM/Module_LcmControl.c LCM/cbmp.c -o Module_LcmControl
+	rm -f *.o	
+	mv -f Module_LcmControl ../Images/root
+
+Module_PowerSharing_Task:
+	@echo "===== Module_PowerSharing_Task ==================================="
+	rm -f Module_PowerSharing
+	$(CC) -D $(Project) "-I../../../Modularization/ocppfiles/" "-I./" "-I../../" -O0 -g3 -Wall -fmessage-length=0 Module_PowerSharing.c -o Module_PowerSharing
+	rm -f *.o
+	mv -f Module_PowerSharing ../Images/root
+
+Module_Cabinet:
+	@echo "===== Module_Cabinet_Task ======================================="
+	rm -f Module_Cabinet
+	$(CC) -D $(Project) "-I../../../Modularization/ocppfiles/" "-I./" "-I../../" -O0 -g3 -Wall -fmessage-length=0 Module_Cabinet.c -o Module_Cabinet
+	rm -f *.o
+	mv -f Module_Cabinet ../Images/root
+
+Module_Dispenser:
+	@echo "===== Module_Dispenser_Task ===================================="
+	rm -f Module_Dispenser
+	$(CC) -D $(Project) "-include../../../Modularization/Module_Upgrade.h" "-I../../../Modularization/ocppfiles/" "-I./" "-I../../" -O0 -g3 -Wall -fmessage-length=0 Module_Dispenser.c ${Lib_Module_Upgrade} -lrt -o Module_Dispenser 
+	rm -f *.o
+	mv -f Module_Dispenser ../Images/root
+
+
+CopyFile: 
+	rm -rfv ../Images/root
+	mkdir -p ../Images/root
+
+
+
+	

+ 2030 - 0
EVSE/Projects/AX80/Apps/Module_AlarmDetect.c

@@ -0,0 +1,2030 @@
+/*
+ * Module_AlarmDetect.c
+ *
+ *  Created on: 2020/01/15
+ *      Author: Eason Yang
+ */
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include	"define.h"
+#include	"main.h"
+
+#define FILTER_SPEC			2
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+
+#define Debug
+#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define PASS				1
+#define FAIL				0
+#define ON					1
+#define OFF					0
+
+#define SPEC_OV				275
+#define SPEC_UV				160
+#define SPEC_OC				(32*1.1)
+#define SPEC_OT				85
+
+#define HYSTERETIC_OUV		10
+#define HYSTERETIC_OT		10
+#define HYSTERETIC_OC		10
+
+struct{
+	unsigned short int	OV[3];
+	unsigned short int	UV[3];
+	unsigned short int	OC[3];
+	unsigned short int	OT_AMB;
+	unsigned short int	GMI;
+	unsigned short int	Short[3];
+	unsigned short int	Leakage;
+	unsigned short int	HandShakingTimeout;
+	unsigned short int	EmrgencyBTN;
+	unsigned short int	Relay_Welding;
+	unsigned short int	Relay_DrivingFault;
+	unsigned short int	CP_LevelFail;
+	unsigned short int	MCU_SelfTestFail;
+}Alarm_Counter[2];
+
+void trim(char *s);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData 			*ShmStatusCodeData;
+struct OCPP16Data				*ShmOCPP16Data;
+struct OCPP20Data				*ShmOCPP20Data;
+struct Charger					*ShmCharger;
+unsigned long					previousAlarmCode[AC_QUANTITY];
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
+	{
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1,
+					ShmSysConfigAndInfo->SysConfig.ModelName,
+					ShmSysConfigAndInfo->SysConfig.SerialNumber);
+	}
+	else
+	{
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%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,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1);
+	}
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+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;
+}
+
+//==========================================
+// Init all share memory
+//==========================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//creat ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
+    {
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		#endif
+		result = FAIL;
+	}
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	#ifdef SystemLogMessage
+    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+		#endif
+    	result = FAIL;
+   	 }
+    else
+    {}
+
+   	//creat ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
+    {
+		#ifdef SystemLogMessage
+   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+		#endif
+   		result = FAIL;
+	}
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	#ifdef SystemLogMessage
+    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+		#endif
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	//creat ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
+	{
+
+		DEBUG_ERROR("shmget ShmCharger NG\n");
+
+		result = FAIL;
+	}
+	else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+
+		DEBUG_ERROR("shmat ShmCharger NG\n");
+
+		result = FAIL;
+	}
+	else
+	{}
+
+   	//creat ShmOCPP16Data
+	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
+	{
+
+		DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
+
+		result = FAIL;
+	}
+	else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+
+		DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
+
+		result = FAIL;
+	}
+	else
+	{}
+
+   	//creat ShmOCPP20Data
+   	if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data),  0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmOCPP20Data NG\n");
+		result = FAIL;
+	}
+	else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmOCPP20Data NG\n");
+		result = FAIL;
+	}
+	else
+	{}
+
+    return result;
+}
+
+//==========================================
+// Common routine
+//==========================================
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+void getNowDatetime(uint8_t *data)
+{
+	time_t t = time(NULL);
+	struct tm tm = *localtime(&t);
+
+	sprintf((char*)data, "%04d-%02d-%02dT%02d:%02d:%02dZ", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+}
+
+//==========================================
+// Main process
+//==========================================
+int main(void)
+{
+
+	if(InitShareMemory() == FAIL)
+	{
+		DEBUG_ERROR("InitShareMemory NG\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
+		}
+		sleep(5);
+		return FAIL;
+	}
+
+	for(;;)
+	{
+		for(int gun_index = 0;gun_index<AC_QUANTITY;gun_index++)
+		{
+			//=====================================
+			// Over voltage detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L1 == ON)
+			{
+				if(Alarm_Counter[gun_index].OV[0] > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == OFF)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_OVER_VOLTAGE;
+						DEBUG_INFO("ALARM_L1_OVER_VOLTAGE : alarm \n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].OV[0]++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].OV[0] = 0;
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_OVER_VOLTAGE;
+					DEBUG_INFO("ALARM_L1_OVER_VOLTAGE : recover \n");
+				}
+			}
+
+			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+			{
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L2 == ON)
+				{
+					if(Alarm_Counter[gun_index].OV[1] > FILTER_SPEC)
+					{
+						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == OFF)
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_OVER_VOLTAGE;
+							DEBUG_INFO("ALARM_L2_OVER_VOLTAGE : alarm \n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].OV[1]++;
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].OV[1] = 0;
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == ON)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_OVER_VOLTAGE;
+						DEBUG_INFO("ALARM_L2_OVER_VOLTAGE : recover \n");
+					}
+				}
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OVP_L3 == ON)
+				{
+					if(Alarm_Counter[gun_index].OV[2] > FILTER_SPEC)
+					{
+						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == OFF)
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_OVER_VOLTAGE;
+							DEBUG_INFO("ALARM_L3_OVER_VOLTAGE : alarm \n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].OV[2]++;
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].OV[2] = 0;
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == ON)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_OVER_VOLTAGE;
+						DEBUG_INFO("ALARM_L3_OVER_VOLTAGE : recover \n");
+					}
+				}
+			}
+
+			//=====================================
+			// Under voltage detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L1 == ON)
+			{
+				if(Alarm_Counter[gun_index].UV[0] > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == OFF)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_UNDER_VOLTAGE;
+						DEBUG_INFO("ALARM_L1_UNDER_VOLTAGE : alarm \n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].UV[0]++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].UV[0] = 0;
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_UNDER_VOLTAGE;
+					DEBUG_INFO("ALARM_L1_UNDER_VOLTAGE : recover \n");
+				}
+			}
+
+			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+			{
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L2 == ON)
+				{
+					if(Alarm_Counter[gun_index].UV[1] > FILTER_SPEC)
+					{
+						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == OFF)
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_UNDER_VOLTAGE;
+							DEBUG_INFO("ALARM_L2_UNDER_VOLTAGE : alarm \n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].UV[1]++;
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].UV[1] = 0;
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == ON)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_UNDER_VOLTAGE;
+						DEBUG_INFO("ALARM_L2_UNDER_VOLTAGE : recover \n");
+					}
+				}
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.UVP_L3 == ON)
+				{
+					if(Alarm_Counter[gun_index].UV[2] > FILTER_SPEC)
+					{
+						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == OFF)
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_UNDER_VOLTAGE;
+							DEBUG_INFO("ALARM_L3_UNDER_VOLTAGE : alarm \n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].UV[2]++;
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].UV[2] = 0;
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == ON)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_UNDER_VOLTAGE;
+						DEBUG_INFO("ALARM_L3_UNDER_VOLTAGE : recover \n");
+					}
+				}
+							
+			}
+
+			//=====================================
+			// Over current detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L1 == ON)
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == OFF)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_OVER_CURRENT;
+					DEBUG_INFO("ALARM_L1_OVER_CURRENT : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_OVER_CURRENT;
+					DEBUG_INFO("ALARM_L1_OVER_CURRENT : recover \n");
+				}
+			}
+
+			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+			{
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L2 == ON)
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 == OFF)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_OVER_CURRENT;
+						DEBUG_INFO("ALARM_L2_OVER_CURRENT : alarm \n");
+					}
+				}
+				else
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 == ON)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_OVER_CURRENT;
+						DEBUG_INFO("ALARM_L2_OVER_CURRENT : recover \n");
+					}
+				}
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OCP_L3 == ON)
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 == OFF)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_OVER_CURRENT;
+						DEBUG_INFO("ALARM_L3_OVER_CURRENT : alarm \n");
+					}
+				}
+				else
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 == ON)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_OVER_CURRENT;
+						DEBUG_INFO("ALARM_L3_OVER_CURRENT : recover \n");
+					}
+				}
+			}
+
+			//=====================================
+			// Over temperature detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.OTP == ON)
+			{
+				if(Alarm_Counter[gun_index].OT_AMB > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP == OFF)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_OVER_TEMPERATURE;
+						DEBUG_INFO("ALARM_OVER_TEMPERATURE : alarm \n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].OT_AMB++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].OT_AMB = 0;
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAmbientOTP = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_OVER_TEMPERATURE;
+					DEBUG_INFO("ALARM_OVER_TEMPERATURE : recover \n");
+				}
+			}
+
+			//=====================================
+			// Ground fault detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.gmi_fault == ON)
+			{
+				if(Alarm_Counter[gun_index].GMI > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AcGroundfaultFail == OFF)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AcGroundfaultFail = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_GROUND_FAIL;
+						DEBUG_INFO("ALARM_GROUND_FAIL : alarm \n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].GMI++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].GMI = 0;
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AcGroundfaultFail == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.AcGroundfaultFail = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_GROUND_FAIL;
+					DEBUG_INFO("ALARM_GROUND_FAIL : recover \n");
+				}
+			}
+
+			//=====================================
+			// CP level fail detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.cp_fault == ON)
+			{
+				if(Alarm_Counter[gun_index].CP_LevelFail > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault == OFF)
+					{
+						ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CP_ERROR;
+						DEBUG_INFO("ALARM_CP_ERROR : alarm \n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].CP_LevelFail++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].CP_LevelFail= 0;
+				if(ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault == ON)
+				{
+					ShmStatusCodeData->InfoCode.InfoEvents.bits.PilotFault = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CP_ERROR;
+					DEBUG_INFO("ALARM_CP_ERROR : recover \n");
+				}
+			}
+
+			//=====================================
+			// Current AC/DC leak detection
+			//=====================================
+			if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak == ON) ||
+			   (ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak == ON))
+			{
+				if(Alarm_Counter[gun_index].Leakage > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip == OFF)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip = ON;
+						if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.ac_leak == ON)
+						{
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CURRENT_LEAK_AC;
+							ShmCharger->gun_info[gun_index].otherAlarmCode.isACLeakage = ON;
+							DEBUG_INFO("ALARM_CURRENT_LEAK_AC : alarm \n");
+						}
+						else if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.dc_leak == ON)
+						{
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CURRENT_LEAK_DC;
+							ShmCharger->gun_info[gun_index].otherAlarmCode.isDcLeakage = ON;
+							DEBUG_INFO("ALARM_CURRENT_LEAK_DC : alarm \n");
+						}
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Leakage++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].Leakage = 0;
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RcdTrip = OFF;
+					if(ShmCharger->gun_info[gun_index].otherAlarmCode.isACLeakage == ON)
+					{
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CURRENT_LEAK_AC;
+						ShmCharger->gun_info[gun_index].otherAlarmCode.isACLeakage = OFF;
+						DEBUG_INFO("ALARM_CURRENT_LEAK_AC : recover \n");
+					}
+					else if(ShmCharger->gun_info[gun_index].otherAlarmCode.isDcLeakage == ON)
+					{
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CURRENT_LEAK_DC;
+						ShmCharger->gun_info[gun_index].otherAlarmCode.isDcLeakage = OFF;
+						DEBUG_INFO("ALARM_CURRENT_LEAK_DC : recover \n");
+					}
+				}
+			}
+
+			//=====================================
+			// MCU self test fail detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.mcu_selftest_fail == ON)
+			{
+				if(Alarm_Counter[gun_index].MCU_SelfTestFail > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.McuSelftestFail == OFF)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.McuSelftestFail = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_MCU_TESTFAIL;
+						DEBUG_INFO("ALARM_MCU_TESTFAIL : alarm \n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].MCU_SelfTestFail++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].MCU_SelfTestFail = 0;
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.McuSelftestFail == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.McuSelftestFail = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_MCU_TESTFAIL;
+					DEBUG_INFO("ALARM_MCU_TESTFAIL : recover \n");
+				}
+			}
+
+			//=====================================
+			// Hand shaking timeout detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.handshaking_timeout == ON)
+			{
+				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isHandshakingTimeOut == OFF)
+				{
+					ShmCharger->gun_info[gun_index].otherAlarmCode.isHandshakingTimeOut  = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_HANDSHAKE_TIMEOUT;
+					DEBUG_INFO("ALARM_HANDSHAKE_TIMEOUT : alarm \n");
+				}
+
+			}
+			else
+			{
+				if(ShmCharger->gun_info[gun_index].otherAlarmCode.isHandshakingTimeOut == ON)
+				{
+					ShmCharger->gun_info[gun_index].otherAlarmCode.isHandshakingTimeOut  = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_HANDSHAKE_TIMEOUT;
+					DEBUG_INFO("ALARM_HANDSHAKE_TIMEOUT : recover \n");
+				}
+			}
+
+			//=====================================
+			// Emergency stop detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.emergency_stop == ON)
+			{
+				if(Alarm_Counter[gun_index].EmrgencyBTN > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip == OFF)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_EMERGENCY_STOP;
+						DEBUG_INFO("ALARM_EMERGENCY_STOP : alarm \n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].EmrgencyBTN++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].EmrgencyBTN = 0;
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.EmergencyStopTrip = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_EMERGENCY_STOP;
+					DEBUG_INFO("ALARM_EMERGENCY_STOP : recover \n");
+				}
+			}
+
+			//=====================================
+			// Relay welding detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_welding == ON)
+			{
+				if(Alarm_Counter[gun_index].Relay_Welding > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding == OFF)
+					{
+						ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_RELAY_WELDING;
+						DEBUG_INFO("ALARM_RELAY_STATUS : alarm \n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Relay_Welding++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].Relay_Welding = 0;
+				if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding == ON)
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayWelding = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_RELAY_WELDING;
+					DEBUG_INFO("ALARM_RELAY_STATUS : recover \n");
+				}
+			}
+
+			//=====================================
+			// Relay driving fault detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.relay_drive_fault == ON)
+			{
+				if(Alarm_Counter[gun_index].Relay_DrivingFault > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault == OFF)
+					{
+						ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_RELAY_DRIVE_FAULT;
+						DEBUG_INFO("ALARM_RELAY_DRIVE_FAULT : alarm \n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Relay_DrivingFault++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].Relay_DrivingFault = 0;
+				if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault == ON)
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.AcOutputRelayDrivingFault = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_RELAY_DRIVE_FAULT;
+					DEBUG_INFO("ALARM_RELAY_DRIVE_FAULT : recover \n");
+				}
+			}
+
+			//=====================================
+			// Current short detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L1 == ON)
+			{
+				if(Alarm_Counter[gun_index].Short[0] > FILTER_SPEC)
+				{
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort == OFF)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort = ON;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L1_CIRCUIT_SHORT;
+						DEBUG_INFO("ALARM_L1_CIRCUIT_SHORT : alarm \n");
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Short[0]++;
+				}
+			}
+			else
+			{
+				Alarm_Counter[gun_index].Short[0] = 0;
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L1_CIRCUIT_SHORT;
+					DEBUG_INFO("ALARM_L1_CIRCUIT_SHORT : recover \n");
+				}
+			}
+			
+			if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 3)
+			{
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L2 == ON)
+				{
+					if(Alarm_Counter[gun_index].Short[1] > FILTER_SPEC)
+					{
+						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 == OFF)
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L2_CIRCUIT_SHORT;
+							DEBUG_INFO("ALARM_L2_CIRCUIT_SHORT : alarm \n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].Short[1]++;
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Short[1] = 0;
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 == ON)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L2_CIRCUIT_SHORT;
+						DEBUG_INFO("ALARM_L2_CIRCUIT_SHORT : recover \n");
+					}
+				}
+
+				if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.short_circuit_L3 == ON)
+				{
+					if(Alarm_Counter[gun_index].Short[2] > FILTER_SPEC)
+					{
+						if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 == OFF)
+						{
+							ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 = ON;
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_L3_CIRCUIT_SHORT;
+							DEBUG_INFO("ALARM_L3_CIRCUIT_SHORT : alarm \n");
+						}
+					}
+					else
+					{
+						Alarm_Counter[gun_index].Short[2]++;
+					}
+				}
+				else
+				{
+					Alarm_Counter[gun_index].Short[2] = 0;
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 == ON)
+					{
+						ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 = OFF;
+						ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_L3_CIRCUIT_SHORT;
+						DEBUG_INFO("ALARM_L3_CIRCUIT_SHORT : recover \n");
+					}
+				}
+			}
+
+			//=====================================
+			// Rotatory switch detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.rotate_switch_fault == ON)
+			{
+				if(ShmStatusCodeData->FaultCode.FaultEvents.bits.RotarySwitchFault == OFF)
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.RotarySwitchFault = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_ROTATORY_SWITCH_FAULT;
+					DEBUG_INFO("ALARM_ROTATORY_SWITCH_FAULT : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->FaultCode.FaultEvents.bits.RotarySwitchFault == ON)
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.RotarySwitchFault = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_ROTATORY_SWITCH_FAULT;
+					DEBUG_INFO("ALARM_ROTATORY_SWITCH_FAULT : recover \n");
+				}
+			}
+
+			//=====================================
+			// Leakage module detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.leak_module_fail == ON)
+			{
+				if(ShmStatusCodeData->FaultCode.FaultEvents.bits.RcdSelfTestFail == OFF)
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.RcdSelfTestFail = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_LEAK_MODULE_FAIL;
+					DEBUG_INFO("ALARM_LEAK_MODULE_FAIL : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->FaultCode.FaultEvents.bits.RcdSelfTestFail == ON)
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.RcdSelfTestFail = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_LEAK_MODULE_FAIL;
+					DEBUG_INFO("ALARM_LEAK_MODULE_FAIL : recover \n");
+				}
+			}
+
+			//=====================================
+			// Shutter detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.shutter_fault == ON)
+			{
+				if(ShmStatusCodeData->FaultCode.FaultEvents.bits.ShutterFault == OFF)
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.ShutterFault = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_SHUTTER_FAULT;
+					DEBUG_INFO("ALARM_SHUTTER_FAULT : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->FaultCode.FaultEvents.bits.ShutterFault == ON)
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.ShutterFault = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_SHUTTER_FAULT;
+					DEBUG_INFO("ALARM_SHUTTER_FAULT : recover \n");
+				}
+			}
+
+			//=====================================
+			// Locker detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.locker_fault == ON)
+			{
+				if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcConnectorLockFail == OFF)
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.AcConnectorLockFail = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_LOCKER_FAULT;
+					DEBUG_INFO("ALARM_LOCKER_FAULT : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->FaultCode.FaultEvents.bits.AcConnectorLockFail == ON)
+				{
+					ShmStatusCodeData->FaultCode.FaultEvents.bits.AcConnectorLockFail = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_LOCKER_FAULT;
+					DEBUG_INFO("ALARM_LOCKER_FAULT : recover \n");
+				}
+			}
+
+			//=====================================
+			// Power drop detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.power_drop == ON)
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop == OFF)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_POWER_DROP;
+					DEBUG_INFO("ALARM_POWER_DROP : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_POWER_DROP;
+					DEBUG_INFO("ALARM_POWER_DROP : recover \n");
+				}
+			}
+
+			//=====================================
+			// Meter communication timeout detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_comm_timeout == ON)
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout == OFF)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_METER_TIMEOUT;
+					DEBUG_INFO("ALARM_METER_TIMEOUT : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterCommTimeout = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_METER_TIMEOUT;
+					DEBUG_INFO("ALARM_METER_TIMEOUT : recover \n");
+				}
+			}
+
+			//=====================================
+			// Meter ic communication timeout detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.meter_ic_comm_timeout == ON)
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterIcCommTimeout == OFF)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterIcCommTimeout = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_METER_IC_TIMEOUT;
+					DEBUG_INFO("ALARM_METER_IC_TIMEOUT : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterIcCommTimeout == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.MeterIcCommTimeout = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_METER_IC_TIMEOUT;
+					DEBUG_INFO("ALARM_METER_IC_TIMEOUT : recover \n");
+				}
+			}
+
+			//=====================================
+			// Pilot negative error detection
+			//=====================================
+			if(ShmCharger->gun_info[gun_index].primaryMcuAlarm.bits.pilot_negative_error == ON)
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PilotNegativeError == OFF)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PilotNegativeError = ON;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode |= ALARM_CP_NEG_ERROR;
+					DEBUG_INFO("ALARM_PILOT_NEGATIVE_ERROR : alarm \n");
+				}
+			}
+			else
+			{
+				if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PilotNegativeError == ON)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.PilotNegativeError = OFF;
+					ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode &= ~ALARM_CP_NEG_ERROR;
+					DEBUG_INFO("ALARM_PILOT_NEGATIVE_ERROR : recover \n");
+				}
+			}
+
+			//=====================================
+			// OCPP error code message
+			//=====================================
+			if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+			{
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_VOLTAGE) ||
+					(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_VOLTAGE) ||
+					(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_VOLTAGE))
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OverVoltage");
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputOVP == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012200");
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputOVP == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012201");
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputOVP == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012202");
+
+				}
+				else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_UNDER_VOLTAGE) ||
+						(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_UNDER_VOLTAGE) ||
+						(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_UNDER_VOLTAGE))
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "UnderVoltage");
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputUVP == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012203");
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputUVP == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012204");
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputUVP == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012205");
+
+				}
+				else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT) ||
+						(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT) ||
+						(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT))
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OverCurrentFailure");
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCP == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012216");
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL2 == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012299");
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemAcOutputOCPL3 == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012300");
+
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_OVER_TEMPERATURE)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "HighTemperature");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012223");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GROUND_FAIL)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "GroundFailure");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012256");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_ERROR)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "023703");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "CpError");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_AC)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012233");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "ACLeakage");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_DC)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012233");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "DCLeakage");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_MCU_TESTFAIL)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012257");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "McuTestFail");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_HANDSHAKE_TIMEOUT)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "HandshakeTimeout");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "HandshakeTimeout");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012251");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "EmergencyStop");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_WELDING)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011009");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "RelayWelding");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LEAK_MODULE_FAIL)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011004");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "LeakageModuleFail");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_SHUTTER_FAULT)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011034");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "ShutterFault");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LOCKER_FAULT)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "ConnectorLockFailure");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011027");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_POWER_DROP)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012212");
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputDrop == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012213");
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputDrop == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012214");
+
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "PowerDrop");
+				}
+				else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_CIRCUIT_SHORT) ||
+						(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_CIRCUIT_SHORT) ||
+						(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_CIRCUIT_SHORT))
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShort == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012262");
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL2 == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012301");
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CircuitShortL3 == ON)
+						sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012302");
+
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "CircuitShort");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_ROTATORY_SWITCH_FAULT)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011036");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "RotatorySwitchFault");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_DRIVE_FAULT)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "011010");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "RelayDriveFault");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_TIMEOUT)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012305");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "MeterCommunicationTimeout");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_IC_TIMEOUT)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012344");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "MeterIcCommunicationTimeout");
+				}
+				else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_NEG_ERROR)
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "OtherError");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode , "012345");
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].Info , "PilotNegativeError");
+				}
+				else
+				{
+					sprintf((char*)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode , "NoError");
+					memset(ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode, 0x00, ARRAY_SIZE(ShmOCPP16Data->StatusNotification[gun_index].VendorErrorCode));
+				}
+			}
+			else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+			{
+				uint8_t idxEvent = 0;
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L1_OVER_VOLTAGE))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_VOLTAGE)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_VOLTAGE)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012200");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L1 input OVP");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_VOLTAGE)
+						previousAlarmCode[gun_index] |= ALARM_L1_OVER_VOLTAGE;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L1_OVER_VOLTAGE;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L2_OVER_VOLTAGE))
+				{
+
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_VOLTAGE)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_VOLTAGE)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012201");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L2 input OVP");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_VOLTAGE)
+						previousAlarmCode[gun_index] |= ALARM_L2_OVER_VOLTAGE;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L2_OVER_VOLTAGE;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L3_OVER_VOLTAGE))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_VOLTAGE)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_VOLTAGE)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012202");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L3 input OVP");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_VOLTAGE)
+						previousAlarmCode[gun_index] |= ALARM_L3_OVER_VOLTAGE;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L3_OVER_VOLTAGE;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_UNDER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L1_UNDER_VOLTAGE))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_UNDER_VOLTAGE)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_UNDER_VOLTAGE)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012203");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L1 input UVP");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_UNDER_VOLTAGE)
+						previousAlarmCode[gun_index] |= ALARM_L1_UNDER_VOLTAGE;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L1_UNDER_VOLTAGE;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_UNDER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L2_UNDER_VOLTAGE))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_UNDER_VOLTAGE)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_UNDER_VOLTAGE)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012204");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L2 input UVP");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_UNDER_VOLTAGE)
+						previousAlarmCode[gun_index] |= ALARM_L2_UNDER_VOLTAGE;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L2_UNDER_VOLTAGE;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_UNDER_VOLTAGE) != (previousAlarmCode[gun_index] & ALARM_L3_UNDER_VOLTAGE))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_UNDER_VOLTAGE)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_UNDER_VOLTAGE)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012205");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L3 input UVP");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_UNDER_VOLTAGE)
+						previousAlarmCode[gun_index] |= ALARM_L3_UNDER_VOLTAGE;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L3_UNDER_VOLTAGE;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT) != (previousAlarmCode[gun_index] & ALARM_L1_OVER_CURRENT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012216");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System AC output OCP L1");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT)
+						previousAlarmCode[gun_index] |= ALARM_L1_OVER_CURRENT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L1_OVER_CURRENT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT) != (previousAlarmCode[gun_index] & ALARM_L2_OVER_CURRENT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012299");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System AC output OCP L2");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT)
+						previousAlarmCode[gun_index] |= ALARM_L2_OVER_CURRENT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L2_OVER_CURRENT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT) != (previousAlarmCode[gun_index] & ALARM_L3_OVER_CURRENT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012300");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System AC output OCP L3");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT)
+						previousAlarmCode[gun_index] |= ALARM_L3_OVER_CURRENT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L3_OVER_CURRENT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_OVER_TEMPERATURE) != (previousAlarmCode[gun_index] & ALARM_OVER_TEMPERATURE))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_OVER_TEMPERATURE)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_OVER_TEMPERATURE)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012223");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System ambient/inlet OTP");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Temperature");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_OVER_TEMPERATURE)
+						previousAlarmCode[gun_index] |= ALARM_OVER_TEMPERATURE;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_OVER_TEMPERATURE;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GROUND_FAIL) != (previousAlarmCode[gun_index] & ALARM_GROUND_FAIL))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GROUND_FAIL)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GROUND_FAIL)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012256");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "AC Ground Fault");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Ground(PE)");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GROUND_FAIL)
+						previousAlarmCode[gun_index] |= ALARM_GROUND_FAIL;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_GROUND_FAIL;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_ERROR) != (previousAlarmCode[gun_index] & ALARM_CP_ERROR))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_ERROR)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_ERROR)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "023703");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "pilot fault");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Control pilot");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_ERROR)
+						previousAlarmCode[gun_index] |= ALARM_CP_ERROR;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_CP_ERROR;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_AC) != (previousAlarmCode[gun_index] & ALARM_CURRENT_LEAK_AC))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_AC)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_AC)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012233");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "RCD/CCID trip");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "CCID");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_AC)
+						previousAlarmCode[gun_index] |= ALARM_CURRENT_LEAK_AC;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_CURRENT_LEAK_AC;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_DC) != (previousAlarmCode[gun_index] & ALARM_CURRENT_LEAK_DC))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_DC)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_DC)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012233");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "RCD/CCID trip");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "CCID");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CURRENT_LEAK_DC)
+						previousAlarmCode[gun_index] |= ALARM_CURRENT_LEAK_DC;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_CURRENT_LEAK_DC;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_MCU_TESTFAIL) != (previousAlarmCode[gun_index] & ALARM_MCU_TESTFAIL))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_MCU_TESTFAIL)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_MCU_TESTFAIL)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012257");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "MCU self-test Fault");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "MCU");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_MCU_TESTFAIL)
+						previousAlarmCode[gun_index] |= ALARM_MCU_TESTFAIL;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_MCU_TESTFAIL;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_HANDSHAKE_TIMEOUT) != (previousAlarmCode[gun_index] & ALARM_HANDSHAKE_TIMEOUT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_HANDSHAKE_TIMEOUT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_HANDSHAKE_TIMEOUT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "HandshakeTimeout");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "HandshakeTimeout");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Operation");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_HANDSHAKE_TIMEOUT)
+						previousAlarmCode[gun_index] |= ALARM_HANDSHAKE_TIMEOUT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_HANDSHAKE_TIMEOUT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP) != (previousAlarmCode[gun_index] & ALARM_EMERGENCY_STOP))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012251");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Emergency stop");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Button");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)
+						previousAlarmCode[gun_index] |= ALARM_EMERGENCY_STOP;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_EMERGENCY_STOP;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_WELDING) != (previousAlarmCode[gun_index] & ALARM_RELAY_WELDING))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_WELDING)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_WELDING)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011009");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "AC output relay welding");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Relay");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_WELDING)
+						previousAlarmCode[gun_index] |= ALARM_RELAY_WELDING;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_RELAY_WELDING;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LEAK_MODULE_FAIL) != (previousAlarmCode[gun_index] & ALARM_LEAK_MODULE_FAIL))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LEAK_MODULE_FAIL)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LEAK_MODULE_FAIL)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011004");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "RCD/CCID self-test fail");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "CCID");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LEAK_MODULE_FAIL)
+						previousAlarmCode[gun_index] |= ALARM_LEAK_MODULE_FAIL;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_LEAK_MODULE_FAIL;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_SHUTTER_FAULT) != (previousAlarmCode[gun_index] & ALARM_SHUTTER_FAULT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_SHUTTER_FAULT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_SHUTTER_FAULT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011034");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Shutter fault");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Shutter");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_SHUTTER_FAULT)
+						previousAlarmCode[gun_index] |= ALARM_SHUTTER_FAULT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_SHUTTER_FAULT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LOCKER_FAULT) != (previousAlarmCode[gun_index] & ALARM_LOCKER_FAULT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LOCKER_FAULT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LOCKER_FAULT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011027");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "AC connector lock fail");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Locker");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_LOCKER_FAULT)
+						previousAlarmCode[gun_index] |= ALARM_LOCKER_FAULT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_LOCKER_FAULT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_POWER_DROP) != (previousAlarmCode[gun_index] & ALARM_POWER_DROP))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_POWER_DROP)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_POWER_DROP)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL1InputDrop == ON)
+					{
+						sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012212");
+						sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L1 input drop");
+					}
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL2InputDrop == ON)
+					{
+						sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012213");
+						sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L2 input drop");
+					}
+					else if(ShmStatusCodeData->AlarmCode.AlarmEvents.bits.SystemL3InputDrop == ON)
+					{
+						sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012214");
+						sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "System L3 input drop");
+					}
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Voltage");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_POWER_DROP)
+						previousAlarmCode[gun_index] |= ALARM_POWER_DROP;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_POWER_DROP;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_CIRCUIT_SHORT) != (previousAlarmCode[gun_index] & ALARM_L1_CIRCUIT_SHORT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_CIRCUIT_SHORT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_CIRCUIT_SHORT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012262");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Circuit Short L1");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_CIRCUIT_SHORT)
+						previousAlarmCode[gun_index] |= ALARM_L1_CIRCUIT_SHORT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L1_CIRCUIT_SHORT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_CIRCUIT_SHORT) != (previousAlarmCode[gun_index] & ALARM_L2_CIRCUIT_SHORT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_CIRCUIT_SHORT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_CIRCUIT_SHORT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012301");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Circuit Short L2");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_CIRCUIT_SHORT)
+						previousAlarmCode[gun_index] |= ALARM_L2_CIRCUIT_SHORT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L2_CIRCUIT_SHORT;
+				}
+
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_CIRCUIT_SHORT) != (previousAlarmCode[gun_index] & ALARM_L3_CIRCUIT_SHORT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_CIRCUIT_SHORT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_CIRCUIT_SHORT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012302");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Circuit Short L3");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Current");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_CIRCUIT_SHORT)
+						previousAlarmCode[gun_index] |= ALARM_L3_CIRCUIT_SHORT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_L3_CIRCUIT_SHORT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_ROTATORY_SWITCH_FAULT) != (previousAlarmCode[gun_index] & ALARM_ROTATORY_SWITCH_FAULT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_ROTATORY_SWITCH_FAULT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_ROTATORY_SWITCH_FAULT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011036");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Rotary switch fault");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Rotary switch");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_ROTATORY_SWITCH_FAULT)
+						previousAlarmCode[gun_index] |= ALARM_ROTATORY_SWITCH_FAULT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_ROTATORY_SWITCH_FAULT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_DRIVE_FAULT) != (previousAlarmCode[gun_index] & ALARM_RELAY_DRIVE_FAULT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_DRIVE_FAULT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_DRIVE_FAULT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "011010");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "AC output relay driving fault");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Relay");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_RELAY_DRIVE_FAULT)
+						previousAlarmCode[gun_index] |= ALARM_RELAY_DRIVE_FAULT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_RELAY_DRIVE_FAULT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_TIMEOUT) != (previousAlarmCode[gun_index] & ALARM_METER_TIMEOUT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_TIMEOUT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_TIMEOUT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012305");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Meter communication timeout");
+
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Meter");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_TIMEOUT)
+						previousAlarmCode[gun_index] |= ALARM_METER_TIMEOUT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_METER_TIMEOUT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_IC_TIMEOUT) != (previousAlarmCode[gun_index] & ALARM_METER_IC_TIMEOUT))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_IC_TIMEOUT)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_IC_TIMEOUT)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+					
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012344");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Meter ic communication timeout");
+					
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "Meter");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+					
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+					
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_METER_IC_TIMEOUT)
+						previousAlarmCode[gun_index] |= ALARM_METER_IC_TIMEOUT;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_METER_IC_TIMEOUT;
+				}
+
+				if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_NEG_ERROR) != (previousAlarmCode[gun_index] & ALARM_CP_NEG_ERROR))
+				{
+					getNowDatetime(ShmOCPP20Data->NotifyEvent.eventData[idxEvent].timestamp);
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventId = idxEvent;
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].trigger, "Alerting");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].actualValue, ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_NEG_ERROR)?"true":"false"));
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].cleared = ((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_NEG_ERROR)?OFF:ON);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].eventNotificationType, "HardWiredNotification");
+					
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techcode, "012345");
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].techInfo, "Pilot negative error");
+					
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.name, "PCBA");
+					ShmOCPP20Data->NotifyEvent.eventData[idxEvent].component.evse.connectorId = (gun_index+1);
+					sprintf((char*)ShmOCPP20Data->NotifyEvent.eventData[idxEvent].variable.name, "Problem");
+					
+					idxEvent += ((idxEvent<ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)-1)?1:0);
+					
+					if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_CP_NEG_ERROR)
+						previousAlarmCode[gun_index] |= ALARM_CP_NEG_ERROR;
+					else
+						previousAlarmCode[gun_index] &= ~ALARM_CP_NEG_ERROR;
+				}
+
+				if(idxEvent > 0)
+					ShmOCPP20Data->SpMsg.bits.NotifyEventReq = ON;
+			}
+
+
+			//=====================================
+			// Latch alarm recover in state A
+			//=====================================
+			if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 1))
+			{
+				/*
+				  TODO: Recover latch alarm here
+				*/
+			}
+
+			//=====================================
+			// Latch alarm recover in state B1 and B2
+			//=====================================
+			if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 2) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 3))
+			{
+				/*
+				TODO: Recover latch alarm here
+				*/
+			}
+
+			//=====================================
+			// Latch alarm recover in state C
+			//=====================================
+			if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == 4))
+			{
+				/*
+				  TODO: Recover latch alarm here
+				*/
+			}
+			
+			ShmCharger->gun_info[gun_index].acCcsInfo.CSUAlarmStatusCode = ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode;
+		}
+
+		usleep(100000);
+	}
+
+	return FAIL;
+}

+ 13 - 0
EVSE/Projects/AX80/Apps/Module_AlarmDetect.h

@@ -0,0 +1,13 @@
+/*
+ * Module_AlarmDetect.h
+ *
+ *  Created on: 2020¦~01¤ë15¤é
+ *      Author: Eason Yang
+ */
+
+#ifndef MODULE_ALARMDETECT_H_
+#define MODULE_ALARMDETECT_H_
+
+
+
+#endif /* MODULE_ALARMDETECT_H_ */

+ 1021 - 0
EVSE/Projects/AX80/Apps/Module_Cabinet.c

@@ -0,0 +1,1021 @@
+/*
+ * Module_Cabinet.c
+ *
+ *  Created on: 2021/10/25
+ *      Author: folus
+ */
+
+#include "Module_Cabinet.h"
+
+//#define DEBUG
+#define is_error(ptr) 					((unsigned long)ptr > (unsigned long)-4000L)
+#define ARRAY_SIZE(A)					(sizeof(A) / sizeof(A[0]))
+#define PASS							1
+#define FAIL							-1
+#define YES								1
+#define NO								0
+#define ON								1
+#define OFF								0
+
+struct SysConfigAndInfo					*ShmSysConfigAndInfo;
+struct StatusCodeData 					*ShmStatusCodeData;
+struct PrimaryMcuData					*ShmPrimaryMcuData;
+struct Charger							*ShmCharger;
+struct CABINET							*ShmCabinet;
+struct DISPENSER						*ShmDispenser;
+
+/**
+ *
+ * @param fmt
+ * @return
+ */
+int StoreLogMsgServer(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]CabinetServerLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+/**
+ *
+ * @param fmt
+ * @return
+ */
+int StoreLogMsgCient(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]CabinetClinetLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+/**
+ *  Init all share memory
+ * @return
+ */
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//Initial ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+		DEBUG_SERVER_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		result = FAIL;
+	}
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_SERVER_ERROR("shmat ShmSysConfigAndInfo NG\n");
+    	result = FAIL;
+   	 }
+    else
+    {}
+
+   	//Initial ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+   		DEBUG_SERVER_ERROR("shmget ShmStatusCodeData NG\n");
+   		result = FAIL;
+	}
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_SERVER_ERROR("shmat ShmStatusCodeData NG\n");
+    	result = FAIL;
+   	}
+    else
+    {}
+
+	//Initial ShmCharger
+	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
+	{
+		DEBUG_SERVER_ERROR("shmget ShmCharger NG\n");
+		result = FAIL;
+	}
+	else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_SERVER_ERROR("shmat ShmCharger NG\n");
+		result = FAIL;
+	}
+
+	//Initial ShmSDispenser
+	if ((MeterSMId = shmget(ShmDispenserKey, sizeof(struct DISPENSER), 0777)) < 0)
+	{
+		DEBUG_SERVER_ERROR("shmget ShmSDispenser NG\n");
+		result = FAIL;
+	}
+	else if ((ShmDispenser = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_SERVER_ERROR("shmat ShmSDispenser NG\n");
+		result = FAIL;
+	}
+
+	//Create ShmCabinet
+	if ((MeterSMId = shmget(ShmCabinetKey, sizeof(struct CABINET), IPC_CREAT | 0777)) < 0)
+	{
+		DEBUG_SERVER_ERROR("shmget ShmCabinet NG\n");
+
+		result = FAIL;
+	}
+	else if ((ShmCabinet = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_SERVER_ERROR("shmat ShmCabinet NG\n");
+
+		result = FAIL;
+	}
+	memset(ShmCabinet,0,sizeof(struct CABINET));
+
+	for(uint8_t idx=0;idx<CABINET_CONNECTION_LIMIT;idx++)
+		ShmCabinet->Connection_Info[idx].socketFd = (idx+1);
+
+    return result;
+}
+
+/**
+ * Cabinet socket server
+ * @param data
+ * @param len
+ * @param isRX
+ */
+void dM_Server(uint8_t *data, uint16_t len, uint8_t isRX)
+{
+#ifdef DEBUG
+	uint8_t output[16384];
+
+	if(isRX)
+	{
+		DEBUG_SERVER_INFO("= RX ===========================================\n");
+	}
+	else
+	{
+		DEBUG_SERVER_INFO("= TX ===========================================\n");
+	}
+
+	memset(output, 0x00, ARRAY_SIZE(output));
+	for(uint16_t idx=0;idx<16;idx++)
+		sprintf((char*)output, "%s %02X", output, idx);
+	DEBUG_SERVER_INFO("%s\n", output);
+	DEBUG_SERVER_INFO("================================================\n");
+
+	for(uint16_t idx = 0;idx<len;idx++)
+	{
+		if((idx%16)>0)
+		{
+			sprintf((char*)output, "%s %02X", output, data[idx]);
+		}
+		else
+		{
+			if(idx != 0)
+				DEBUG_SERVER_INFO("%s\n", output);
+			memset(output, 0x00, ARRAY_SIZE(output));
+			sprintf((char*)output, "%s %02X", output, data[idx]);
+		}
+	}
+	DEBUG_SERVER_INFO("%s\n", output);
+	DEBUG_SERVER_INFO("------------------------------------------------\n");
+#endif
+}
+
+/**
+ * Cabinet socket server
+ * @param data
+ * @param len
+ * @param isRX
+ */
+void dM_Client(uint8_t *data, uint16_t len, uint8_t isRX)
+{
+#ifdef DEBUG
+	uint8_t output[16384];
+
+	if(isRX)
+	{
+		DEBUG_CLIENT_INFO("= RX ===========================================\n");
+	}
+	else
+	{
+		DEBUG_CLIENT_INFO("= TX ===========================================\n");
+	}
+
+	memset(output, 0x00, ARRAY_SIZE(output));
+	for(uint16_t idx=0;idx<16;idx++)
+		sprintf((char*)output, "%s %02X", output, idx);
+	DEBUG_CLIENT_INFO("%s\n", output);
+	DEBUG_CLIENT_INFO("================================================\n");
+
+	for(uint16_t idx = 0;idx<len;idx++)
+	{
+		if((idx%16)>0)
+		{
+			sprintf((char*)output, "%s %02X", output, data[idx]);
+		}
+		else
+		{
+			if(idx != 0)
+				DEBUG_CLIENT_INFO("%s\n", output);
+			memset(output, 0x00, ARRAY_SIZE(output));
+			sprintf((char*)output, "%s %02X", output, data[idx]);
+		}
+	}
+	DEBUG_CLIENT_INFO("%s\n", output);
+	DEBUG_CLIENT_INFO("------------------------------------------------\n");
+#endif
+}
+
+/**
+ *
+ * @param message
+ * @return
+ */
+int isValidCheckSum(struct CABINET_Message *message)
+{
+	uint8_t chksum = 0x00;
+
+	for(uint16_t idx=0;idx<((((message->buffer[1]<<8) | message->buffer[2])+4)>ARRAY_SIZE(message->buffer)?ARRAY_SIZE(message->buffer):(((message->buffer[1]<<8) | message->buffer[2])+4));idx++)
+	{
+		chksum ^= message->buffer[idx];
+	}
+
+	return ((chksum == message->buffer[((((message->buffer[1]<<8) | message->buffer[2])+4)>ARRAY_SIZE(message->buffer)?ARRAY_SIZE(message->buffer):(((message->buffer[1]<<8) | message->buffer[2])+4))]) ? PASS : FAIL);
+}
+
+/**
+ *
+ * @param message
+ * @return
+ */
+uint8_t chksumCal(struct CABINET_Message *message)
+{
+	uint8_t chksum=0;
+
+	for(uint16_t idx=0;idx<((((message->buffer[1]<<8) | message->buffer[2])+4)>ARRAY_SIZE(message->buffer)?ARRAY_SIZE(message->buffer):(((message->buffer[1]<<8) | message->buffer[2])+4));idx++)
+	{
+		chksum ^= message->buffer[idx];
+	}
+
+	return chksum & 0xff;
+}
+
+/**
+ *
+ * @return
+ */
+int conn_getConectedQuantity(void)
+{
+	int result = 0;
+
+	for(uint8_t idx=0;idx<CABINET_CONNECTION_LIMIT;idx++)
+	{
+		if(ShmCabinet->Connection_Info[idx].isSocketConnected)
+		{
+			result += 1;
+		}
+	}
+
+	DEBUG_SERVER_INFO("Connection quantity: %d\n", result);
+	ShmCabinet->connectedQty = result;
+	return result;
+}
+
+/**
+ *
+ * @return
+ */
+int conn_getDupFd(void)
+{
+	int result = 0;
+
+	for(uint8_t idx=0;idx<CABINET_CONNECTION_LIMIT;idx++)
+	{
+		if(!ShmCabinet->Connection_Info[idx].isSocketConnected)
+		{
+			result = ShmCabinet->Connection_Info[idx].socketFd;
+			break;
+		}
+	}
+
+	return result;
+}
+
+/**
+ *
+ * @param socketFd
+ * @return
+ */
+int conn_register(int socketFd)
+{
+	int result = FAIL;
+
+	for(uint8_t idx=0;idx<CABINET_CONNECTION_LIMIT;idx++)
+	{
+		if(!ShmCabinet->Connection_Info[idx].isSocketConnected)
+		{
+			DEBUG_SERVER_INFO("Dupfd-%d register to conn-%d.\n", socketFd, idx);
+			ShmCabinet->Connection_Info[idx].isSocketConnected = TRUE;
+			ShmCabinet->Connection_Info[idx].socketFd = socketFd;
+			ShmCabinet->Connection_Info[idx].lastHeartBeatTime = time((time_t*)NULL);
+			result = PASS;
+			break;
+		}
+	}
+
+	return result;
+}
+
+/**
+ *
+ * @param socketFd
+ * @return
+ */
+int conn_reject(int socketFd)
+{
+	int result = FAIL;
+
+	for(uint8_t idx=0;idx<CABINET_CONNECTION_LIMIT;idx++)
+	{
+		if(ShmCabinet->Connection_Info[idx].socketFd == socketFd)
+		{
+			DEBUG_SERVER_INFO("Dupfd-%d register from conn_info-%d.\n", socketFd, idx);
+			ShmCabinet->Connection_Info[idx].isSocketConnected = FALSE;
+			result = PASS;
+			break;
+		}
+	}
+
+	return result;
+
+}
+
+/**
+ *
+ * @param socketFd
+ * @return
+ */
+int conn_updateHeartBeatTime(int socketFd)
+{
+	int result = FAIL;
+
+	for(uint8_t idx=0;idx<CABINET_CONNECTION_LIMIT;idx++)
+	{
+		if(ShmCabinet->Connection_Info[idx].socketFd == socketFd)
+		{
+			//DEBUG_INFO("Dupfd-%d register from conn_info-%d update heart beat time.\n", socketFd, idx);
+			ShmCabinet->Connection_Info[idx].lastHeartBeatTime = time((time_t*)NULL);
+			result = PASS;
+			break;
+		}
+	}
+
+	return result;
+}
+
+/**
+ *
+ * @param socketFd
+ * @param gun_index
+ * @param infoData
+ * @return
+ */
+int conn_updateGunInfo(int socketFd, int gun_index, Gun_Info *infoData)
+{
+	int result = FAIL;
+	Gun_Info gunInfo;
+
+	for(uint8_t idx=0;idx<CABINET_CONNECTION_LIMIT;idx++)
+	{
+		if(ShmCabinet->Connection_Info[idx].socketFd == socketFd)
+		{
+			memcpy(&gunInfo, infoData, sizeof(Gun_Info));
+
+			ShmCabinet->Connection_Info[idx].gun_index = gun_index;
+
+			memcpy(&ShmCharger->gun_info[gun_index].primaryMcuLed, &gunInfo.primaryMcuLed, sizeof(Ac_Primary_Mcu_Led));
+			memcpy(&ShmCharger->gun_info[gun_index].systemAlarmCode, &gunInfo.systemAlarmCode, sizeof(System_Alarm_Code));
+			memcpy(&ShmCharger->gun_info[gun_index].primaryMcuAlarm, &gunInfo.primaryMcuAlarm, sizeof(Ac_Primary_Mcu_Alarm));
+			memcpy(&ShmCharger->gun_info[gun_index].GPIO_Input, &gunInfo.GPIO_Input, sizeof(Gpio_in));
+			memcpy(&ShmCharger->gun_info[gun_index].powerConsumptionTotal, &gunInfo.powerConsumptionTotal, sizeof(Power_Consumption));
+			memcpy(&ShmCharger->gun_info[gun_index].powerConsumption[0], &gunInfo.powerConsumption[0], ARRAY_SIZE(gunInfo.powerConsumption)*sizeof(Power_Consumption));
+			memcpy(&ShmCharger->gun_info[gun_index].inputVoltage, &gunInfo.inputVoltage, sizeof(PresentInputVoltage));
+			memcpy(&ShmCharger->gun_info[gun_index].outputCurrent, &gunInfo.outputCurrent, sizeof(Presentoutputcurrent));
+			memcpy(&ShmCharger->gun_info[gun_index].gunPluginTimes, &gunInfo.gunPluginTimes, sizeof(Gun_Plugin_Times));
+			memcpy(&ShmCharger->gun_info[gun_index].temperature, &gunInfo.temperature, sizeof(Temperature));
+			memcpy(&ShmCharger->gun_info[gun_index].rtc, &gunInfo.rtc, sizeof(Rtc));
+			memcpy(&ShmCharger->gun_info[gun_index].acCcsInfo, &gunInfo.acCcsInfo, sizeof(Ac_Ccs_Info));
+			memcpy(&ShmCharger->gun_info[gun_index].primaryMcuState.socket_e, &gunInfo.primaryMcuState.socket_e, sizeof(Socket_E));
+
+			ShmCharger->gun_info[gun_index].primaryMcuState.cp_state = gunInfo.primaryMcuState.cp_state;
+			ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_negtive = gunInfo.primaryMcuState.cp_voltage_negtive;
+			ShmCharger->gun_info[gun_index].primaryMcuState.cp_voltage_positive = gunInfo.primaryMcuState.cp_voltage_positive;
+			ShmCharger->gun_info[gun_index].primaryMcuState.current_limit = gunInfo.primaryMcuState.current_limit;
+			ShmCharger->gun_info[gun_index].primaryMcuState.locker_state = gunInfo.primaryMcuState.locker_state;
+			ShmCharger->gun_info[gun_index].primaryMcuState.meter_state = gunInfo.primaryMcuState.meter_state;
+			ShmCharger->gun_info[gun_index].primaryMcuState.pp_state = gunInfo.primaryMcuState.pp_state;
+			ShmCharger->gun_info[gun_index].primaryMcuState.rating_current = gunInfo.primaryMcuState.rating_current;
+			ShmCharger->gun_info[gun_index].primaryMcuState.relay_state = gunInfo.primaryMcuState.relay_state;
+			ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch = gunInfo.primaryMcuState.rotatory_switch;
+			ShmCharger->gun_info[gun_index].primaryMcuState.shutter_state = gunInfo.primaryMcuState.shutter_state;
+
+			ShmCharger->gun_info[gun_index].mcuFlag.isReadFwVerPass = gunInfo.mcuFlag.isReadFwVerPass;
+			ShmCharger->gun_info[gun_index].mcuFlag.isReadMeterIcCorrectionStatus = gunInfo.mcuFlag.isReadMeterIcCorrectionStatus;
+			ShmCharger->gun_info[gun_index].mcuFlag.isSetModelNamePass = gunInfo.mcuFlag.isSetModelNamePass;
+			ShmCharger->gun_info[gun_index].mcuFlag.isSetSerialNumberPass = gunInfo.mcuFlag.isSetSerialNumberPass;
+			ShmCharger->gun_info[gun_index].ccsHandshakeState = gunInfo.ccsHandshakeState;
+			ShmCharger->gun_info[gun_index].isUpgradeEnd = gunInfo.isUpgradeEnd;
+			ShmCharger->gun_info[gun_index].isUpgradePASS = gunInfo.isUpgradePASS;
+			memcpy(&ShmCharger->gun_info[gun_index].ver, &gunInfo.ver, sizeof(Ver));
+
+
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState = gunInfo.primaryMcuState.cp_state;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotDuty = (gunInfo.primaryMcuState.current_limit>51?(unsigned char)((gunInfo.primaryMcuState.current_limit/2.5)+64):(unsigned char)(gunInfo.primaryMcuState.current_limit/0.6));
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotVoltage = gunInfo.primaryMcuState.cp_voltage_positive;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].RelayK1K2Status = gunInfo.primaryMcuState.relay_state;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage = (float)gunInfo.inputVoltage.L1N_L12;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL2 = (float)gunInfo.inputVoltage.L2N_L23;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL3 = (float)gunInfo.inputVoltage.L3N_L31;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent = (float)gunInfo.outputCurrent.L1N_L12[0];
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrentL2 = (float)gunInfo.outputCurrent.L2N_L23[0];
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrentL3 = (float)gunInfo.outputCurrent.L3N_L31[0];
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ConnectorTemp = gunInfo.temperature.point[0];
+
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedVaGain = gunInfo.meterIcCorrectionStatus.bits.isCalibratedVaGain;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedVbGain = gunInfo.meterIcCorrectionStatus.bits.isCalibratedVbGain;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedVcGain = gunInfo.meterIcCorrectionStatus.bits.isCalibratedVcGain;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedVaOffset = gunInfo.meterIcCorrectionStatus.bits.isCalibratedVaOffset;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedVbOffset = gunInfo.meterIcCorrectionStatus.bits.isCalibratedVbOffset;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedVcOffset = gunInfo.meterIcCorrectionStatus.bits.isCalibratedVcOffset;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedCaGain = gunInfo.meterIcCorrectionStatus.bits.isCalibratedCaGain;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedCbGain = gunInfo.meterIcCorrectionStatus.bits.isCalibratedCbGain;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedCcGain = gunInfo.meterIcCorrectionStatus.bits.isCalibratedCcGain;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedCaOffset = gunInfo.meterIcCorrectionStatus.bits.isCalibratedCaOffset;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedCbOffset = gunInfo.meterIcCorrectionStatus.bits.isCalibratedCbOffset;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedCcOffset = gunInfo.meterIcCorrectionStatus.bits.isCalibratedCcOffset;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedPa = gunInfo.meterIcCorrectionStatus.bits.isCalibratedPa;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedPb = gunInfo.meterIcCorrectionStatus.bits.isCalibratedPb;
+			ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].meterIcCalInfo.isCalibratedPc = gunInfo.meterIcCorrectionStatus.bits.isCalibratedPc;
+
+			result = PASS;
+			break;
+		}
+	}
+
+	return result;
+}
+
+/**
+ *
+ * @param socketFd
+ * @return
+ */
+int conn_getGunIndex(int socketFd)
+{
+	int result = -1;
+
+	for(uint8_t idx=0;idx<CABINET_CONNECTION_LIMIT;idx++)
+	{
+		if(ShmCabinet->Connection_Info[idx].socketFd == socketFd)
+		{
+			result = ShmCabinet->Connection_Info[idx].gun_index;
+		}
+	}
+
+	return result;
+}
+
+/**
+ *
+ * @param out
+ */
+void create_cmd_getChargingData(struct CABINET_Message *out)
+{
+	memset(out->buffer, 0, ARRAY_SIZE(out->buffer));
+
+	out->size = 5;
+	out->buffer[0] = 0x55;
+	out->buffer[1] = 0x00;
+	out->buffer[2] = 0x00;
+	out->buffer[3] = CABINET_CMD_GET_CHARGING_DATA;
+	out->buffer[out->size-1] = chksumCal(out);
+
+	dM_Server(out->buffer, out->size, FALSE);
+}
+
+/**
+ *
+ * @param out
+ */
+void create_cmd_setConfigData(struct CABINET_Message *out, int socketFd)
+{
+	memset(out->buffer, 0, ARRAY_SIZE(out->buffer));
+
+	out->size = (5 + sizeof(struct SysConfigData));
+	out->buffer[0] = 0x55;
+	out->buffer[1] = (sizeof(struct SysConfigData) >> 8) & 0xff;
+	out->buffer[2] = (sizeof(struct SysConfigData) >> 0) & 0xff;
+	out->buffer[3] = CABINET_CMD_SET_CONFIG_DATA;
+
+	for(uint8_t idx=0;idx<CABINET_CONNECTION_LIMIT;idx++)
+	{
+		if(ShmCabinet->Connection_Info[idx].socketFd == socketFd)
+		{
+			memcpy(&out->buffer[4], &ShmSysConfigAndInfo->SysConfig, sizeof(struct SysConfigData));
+			break;
+		}
+	}
+	out->buffer[out->size-1] = chksumCal(out);
+
+	dM_Server(out->buffer, out->size, FALSE);
+}
+
+/**
+ *
+ * @param out
+ */
+void create_cmd_setGunInfo(struct CABINET_Message *out, int socketFd)
+{
+	memset(out->buffer, 0, ARRAY_SIZE(out->buffer));
+
+	out->size = (5 + sizeof(Gun_Info) + sizeof(Timeout_Spec));
+	out->buffer[0] = 0x55;
+	out->buffer[1] = ((sizeof(Gun_Info) + sizeof(Timeout_Spec)) >> 8) & 0xff;
+	out->buffer[2] = ((sizeof(Gun_Info) + sizeof(Timeout_Spec)) >> 0) & 0xff;
+	out->buffer[3] = CABINET_CMD_SET_GUNINFO;
+
+	for(uint8_t idx=0;idx<CABINET_CONNECTION_LIMIT;idx++)
+	{
+		if(ShmCabinet->Connection_Info[idx].socketFd == socketFd)
+		{
+			memcpy(&out->buffer[4], &ShmCharger->gun_info[ShmCabinet->Connection_Info[idx].gun_index], sizeof(Gun_Info));
+			memcpy(&out->buffer[4+sizeof(Gun_Info)], &ShmCharger->timeoutSpec, sizeof(Timeout_Spec));
+			break;
+		}
+	}
+
+	out->buffer[out->size-1] = chksumCal(out);
+
+	dM_Server(out->buffer, out->size, FALSE);
+}
+
+/**
+ *
+ * @return
+ */
+int tcpSocketServerStart(void)
+{
+	int 						sockFd = 0;
+	int 						clientSockFd = 0;
+	int							dupFd = 0;
+	struct CABINET_Message		input;
+	struct CABINET_Message		output;
+	struct sockaddr_in 			serverInfo, clientInfo;
+	socklen_t 					addrlen = sizeof(clientInfo);
+
+	sockFd = socket(AF_INET , SOCK_STREAM , 0);
+	if(sockFd == -1)
+	{
+		DEBUG_SERVER_ERROR("TCP cabinet socket create fail.\n");
+		sleep(5);
+		return FAIL;
+	}
+
+	bzero(&serverInfo, sizeof(struct sockaddr_in));
+	serverInfo.sin_family = PF_INET;
+	serverInfo.sin_addr.s_addr = htonl(INADDR_ANY);
+	serverInfo.sin_port = htons(CABINET_LISTEN_PORT_TCP);
+
+	if(bind(sockFd, (struct sockaddr *)&serverInfo, sizeof(serverInfo)) < 0)
+		DEBUG_SERVER_ERROR("TCP cabinet server socket bind fail.\n");
+
+	if(listen(sockFd, CABINET_CONNECTION_LIMIT) < 0)
+		DEBUG_SERVER_ERROR("TCP cabinet server socket listen fail.\n");
+	else
+		DEBUG_SERVER_INFO("TCP cabinet server listen on port %d.\n", CABINET_LISTEN_PORT_TCP);
+
+	// Main loop
+	for(;;)
+	{
+		clientSockFd = accept(sockFd, (struct sockaddr*) &clientInfo, &addrlen);
+		fcntl(clientSockFd, F_SETFD, FD_CLOEXEC);
+		DEBUG_SERVER_INFO("Client connect in.\n");
+		DEBUG_SERVER_INFO("clientSockFd : %d\n", clientSockFd);
+
+		if(clientSockFd > 0)
+		{
+			if(conn_getConectedQuantity() < CABINET_CONNECTION_LIMIT)
+			{
+				// Fork a child process to handle the new conn
+				if(fork()==0)
+				{
+					uint8_t idxStep = 0;
+					uint8_t socketEnable = YES;
+					struct FLAG
+					{
+						uint8_t		isConfigured:1;
+					}flag;
+					struct timeval	tv;
+					tv.tv_sec = 0;
+					tv.tv_usec = TIMEOUT_SOCKET_RX;
+					setsockopt(clientSockFd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof(tv));
+
+					// Assign socket handle as available handle in conn info pool
+					dupFd = dup2(clientSockFd, conn_getDupFd());
+					conn_register(dupFd);
+
+					while(socketEnable)
+					{
+						if((input.size = recv(dupFd, input.buffer, sizeof(input.buffer), 0)) > 0)
+						{
+							dM_Server(input.buffer, input.size, YES);
+
+							if(isValidCheckSum(&input))
+							{
+								conn_updateHeartBeatTime(dupFd);
+
+								memset(output.buffer, 0x00, ARRAY_SIZE(output.buffer));
+								switch(input.buffer[3])
+								{
+									case CABINET_CMD_GET_CHARGING_DATA:
+										conn_updateGunInfo(dupFd, input.buffer[4], (Gun_Info*)&input.buffer[5]);
+										//DEBUG_SERVER_INFO("Get charging data response.\n");
+										break;
+
+									case CABINET_CMD_SET_CONFIG_DATA:
+										if(input.buffer[4])
+										{
+											flag.isConfigured = ON;
+										}
+										else
+											DEBUG_SERVER_INFO("Get set configuration response: %d.\n", input.buffer[4]);
+										break;
+
+									case CABINET_CMD_SET_GUNINFO:
+										if(input.buffer[4])
+										{
+
+										}
+										else
+											DEBUG_SERVER_INFO("Get set gun info response: %d.\n", input.buffer[4]);
+										break;
+
+									default:
+										DEBUG_SERVER_WARN("Receive unknown response.\n");
+										break;
+								}
+							}
+							else
+							{
+								DEBUG_SERVER_WARN("Receive response check sum error.\n");
+							}
+						}
+						else if(input.size == 0)
+						{
+							DEBUG_SERVER_INFO("Client disSocketConnected.\n");
+							conn_reject(dupFd);
+							socketEnable = NO;
+							close(dupFd);
+							close(clientSockFd);
+							fflush(stdout);
+						}
+						else if(input.size == -1)
+						{
+							// Server slave handler
+							switch(idxStep)
+							{
+								case 0:
+									create_cmd_getChargingData(&output);
+									send(clientSockFd, output.buffer, output.size, 0);
+									idxStep++;
+									break;
+
+								default:
+									if(!flag.isConfigured)
+									{
+										create_cmd_setConfigData(&output, dupFd);
+										send(clientSockFd, output.buffer, output.size, 0);
+									}
+									else
+									{
+										create_cmd_setGunInfo(&output, dupFd);
+										send(clientSockFd, output.buffer, output.size, 0);
+
+										ShmCharger->gun_info[conn_getGunIndex(dupFd)].mcuResetRequest.isMcuResetRequest = OFF;
+									}
+									idxStep = 0;
+
+									break;
+							}
+						}
+					}
+
+					conn_getConectedQuantity();
+					exit(0);
+				}
+				else
+				{
+					// if parent, close the socket and go back to listening new requests
+					close(clientSockFd);
+				}
+			}
+			else
+			{
+				DEBUG_SERVER_WARN("Connection is over limit.\n");
+				output.size = 5;
+				output.buffer[0] = 0x55;
+				output.buffer[1] = 0x00;
+				output.buffer[2] = 0x00;
+				output.buffer[3] = CABINET_CMD_CONNECTION_FULL;
+				output.buffer[output.size-1] = chksumCal(&output);
+				send(clientSockFd, output.buffer, output.size, 0);
+				close(clientSockFd);
+			}
+		}
+
+		sleep(1);
+	}
+
+	return FAIL;
+}
+
+/**
+ * Cabinet socket client
+ * @return
+ */
+int tcpSocketClientStart(void)
+{
+	int 						sockfd;
+	struct sockaddr_in 			info;
+	struct hostent 				*ghbn;
+	struct timeval 				tv;
+	uint8_t 					socketEnable;
+	uint8_t						cntSocketErr;
+
+	struct CABINET_Message		input;
+	struct CABINET_Message		output;
+
+	bzero(&info,sizeof(info));
+	ghbn = gethostbyname((char*)"192.168.201.201");
+	info.sin_family = PF_INET;
+	info.sin_addr.s_addr = inet_addr(inet_ntoa(*(struct in_addr *)ghbn->h_addr_list[0]));
+	info.sin_port = htons(CABINET_LISTEN_PORT_TCP);
+	ShmSysConfigAndInfo->SysInfo.localSharingInfo.isConnectedSharingServer = OFF;
+	DEBUG_CLIENT_INFO("Connect to %s:%d\n", inet_ntoa(*(struct in_addr *)ghbn->h_addr_list[0]), CABINET_LISTEN_PORT_TCP);
+
+	sockfd = socket(AF_INET, SOCK_STREAM, 0);
+	if (sockfd == -1)
+	{
+		DEBUG_CLIENT_ERROR("Fail to create a socket.");
+		return 0;
+	}
+
+	if(connect(sockfd, (struct sockaddr *)&info,sizeof(info)) ==-1)
+	{
+		DEBUG_CLIENT_ERROR("Connection error.\n");
+		ShmSysConfigAndInfo->SysInfo.localSharingInfo.isConnectedSharingServer = OFF;
+		socketEnable = OFF;
+	}
+	else
+	{
+		DEBUG_CLIENT_INFO("Connect success.\n");
+		tv.tv_sec = 0;
+		tv.tv_usec = TIMEOUT_SOCKET_RX;
+		setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof tv);
+		socketEnable = ON;
+		cntSocketErr = 0;
+		ShmSysConfigAndInfo->SysInfo.localSharingInfo.isConnectedSharingServer = ON;
+	}
+
+	while(socketEnable)
+	{
+		memset(input.buffer, 0, ARRAY_SIZE(input.buffer));
+		if((input.size = recv(sockfd, input.buffer, ARRAY_SIZE(input.buffer), 0)) > 0)
+		{
+			dM_Client(input.buffer, input.size, YES);
+
+			if(isValidCheckSum(&input))
+			{
+				switch(input.buffer[3])
+				{
+					case CABINET_CMD_GET_CHARGING_DATA:
+						output.size = 6 + sizeof(Gun_Info);
+						output.buffer[0] = 0x55;
+						output.buffer[1] = ((sizeof(Gun_Info)+1) >> 8) & 0xff;
+						output.buffer[2] = ((sizeof(Gun_Info)+1) >> 0) & 0xff;
+						output.buffer[3] = input.buffer[3];
+						output.buffer[4] = 0; // TODO: gun_index assign
+						memcpy(&output.buffer[5], &ShmDispenser->gun_info, sizeof(Gun_Info));
+						output.buffer[output.size-1] = chksumCal(&output);
+						break;
+
+					case CABINET_CMD_SET_CONFIG_DATA:
+						output.size = 6;
+						output.buffer[0] = 0x55;
+						output.buffer[1] = 0x00;
+						output.buffer[2] = 0x01;
+						output.buffer[3] = input.buffer[3];
+						output.buffer[4] = 0x01;
+						output.buffer[output.size-1] = chksumCal(&output);
+						memcpy(&ShmDispenser->ConfigData, &input.buffer[4], sizeof(struct SysConfigData));
+						ShmDispenser->isCcsEnable = OFF;
+						for(uint8_t idx=0;idx<3;idx++)
+						{
+							if(ShmDispenser->ConfigData.ModelName[7+idx] == '7')
+								ShmDispenser->isCcsEnable = ON;
+						}
+						break;
+
+					case CABINET_CMD_SET_GUNINFO:
+						output.size = 6;
+						output.buffer[0] = 0x55;
+						output.buffer[1] = 0x00;
+						output.buffer[2] = 0x01;
+						output.buffer[3] = input.buffer[3];
+						output.buffer[4] = 0x01;
+						output.buffer[output.size-1] = chksumCal(&output);
+
+						Gun_Info rxGunInfo;
+						memcpy(&rxGunInfo, &input.buffer[4], sizeof(Gun_Info));
+						/*
+						 *	TODO:
+						 *		1. Variable set to share memory
+						 */
+						memcpy(&ShmDispenser->timeoutSpec, &input.buffer[4+sizeof(Gun_Info)], sizeof(Timeout_Spec));
+
+						memcpy(&ShmDispenser->gun_info.primaryMcuState.relayState, &rxGunInfo.primaryMcuState.relayState, sizeof(Relay));
+						ShmDispenser->gun_info.mcuResetRequest.isMcuResetRequest = rxGunInfo.mcuResetRequest.isMcuResetRequest;
+						ShmDispenser->gun_info.primaryMcuLed.mode = rxGunInfo.primaryMcuLed.mode;
+						ShmDispenser->gun_info.isOperactive = rxGunInfo.isOperactive;
+						ShmDispenser->gun_info.legacyRequest.isLegacyRequest = rxGunInfo.legacyRequest.isLegacyRequest;
+						ShmDispenser->gun_info.legacyRequest.isRelayOn = rxGunInfo.legacyRequest.isRelayOn;
+						ShmDispenser->gun_info.targetCurrent = rxGunInfo.targetCurrent;
+						ShmDispenser->gun_info.isResetSoftReq = rxGunInfo.isResetSoftReq;
+						ShmDispenser->gun_info.isResetHardReq = rxGunInfo.isResetHardReq;
+						ShmDispenser->gun_info.isUpgradeReq = rxGunInfo.isUpgradeReq;
+
+						break;
+
+					default:
+						DEBUG_CLIENT_WARN("Receive unknown command.\n");
+						output.size = 5;
+						output.buffer[0] = 0x55;
+						output.buffer[1] = 0x00;
+						output.buffer[2] = 0x00;
+						output.buffer[3] = CABINET_CMD_UNKNOWN;
+						output.buffer[output.size-1] = chksumCal(&output);
+						break;
+				}
+			}
+			else
+			{
+				DEBUG_CLIENT_WARN("Receive command check sum error.\n");
+				output.size = 5;
+				output.buffer[0] = 0x55;
+				output.buffer[1] = 0x00;
+				output.buffer[2] = 0x00;
+				output.buffer[3] = CABINET_CMD_CHKSUM_ERROR;
+				output.buffer[output.size-1] = chksumCal(&output);
+			}
+
+			dM_Client(output.buffer, output.size, NO);
+			send(sockfd, output.buffer, output.size, 0);
+		}
+		else if(input.size == 0)
+		{
+			DEBUG_CLIENT_INFO("DisSocketConnected.\n");
+			fflush(stdout);
+
+			socketEnable = OFF;
+		}
+		else if(input.size == -1)
+		{
+			if(cntSocketErr > 5)
+			{
+				socketEnable = OFF;
+				DEBUG_CLIENT_ERROR("Socket error occur.\n");
+			}
+			else
+			{
+				cntSocketErr++;
+			}
+		}
+		usleep(100000);
+	}
+	close(sockfd);
+
+	return FAIL;
+}
+
+
+/**
+ * Main process routine
+ * @return
+ */
+int main(void)
+{
+	// Initial share memory
+	if(InitShareMemory() == FAIL)
+	{
+		DEBUG_SERVER_ERROR("InitShareMemory NG\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=ON;
+		}
+		sleep(5);
+		return 0;
+	}
+
+	/*
+	 * 	TODO:
+	 * 		1. Check rotary switch to determine socket server is rising up
+	 *
+	 */
+
+	while(ShmDispenser->gun_info.mcuFlag.isReadFwVerPass ||
+	      ShmDispenser->gun_info.mcuFlag.isSetModelNamePass ||
+	      ShmDispenser->gun_info.mcuFlag.isSetSerialNumberPass)sleep(5);
+
+	if(ShmDispenser->gun_info.primaryMcuState.rotatory_switch == 0)
+	{
+		system("/sbin/ifconfig eth0:1 192.168.201.201 netmask 255.255.255.248 up &");
+	}
+	else
+	{
+		system("/sbin/ifconfig eth0:1 192.168.201.201 netmask 255.255.255.248 up &");
+	}
+
+	DEBUG_SERVER_INFO("Module_Cabinet initialized...\n");
+	if(1)
+	{
+		// TCP socket server start
+		if(fork() == 0)
+		{
+			if(tcpSocketServerStart() == FAIL)
+			{
+				DEBUG_SERVER_ERROR("TCP socket server down.\n");
+				return 0;
+			}
+		}
+		sleep(3);
+	}
+
+	for(;;)
+	{
+		// Slave logic
+		tcpSocketClientStart();
+
+		usleep(100000);
+	}
+
+	return -1;
+}

+ 97 - 0
EVSE/Projects/AX80/Apps/Module_Cabinet.h

@@ -0,0 +1,97 @@
+/*
+ * Module_Cabinet.h
+ *
+ *  Created on: 2021/10/25
+ *      Author: folus
+ */
+
+#ifndef MODULE_CABINET_H_
+#define MODULE_CABINET_H_
+
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include 	<sys/types.h>
+#include 	<sys/socket.h>
+#include 	<netinet/in.h>
+#include 	<netdb.h>
+#include 	<error.h>
+#include 	<signal.h>
+#include	"define.h"
+#include 	"main.h"
+
+#define DEBUG_SERVER_INFO(format, args...) StoreLogMsgServer("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_SERVER_WARN(format, args...) StoreLogMsgServer("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_SERVER_ERROR(format, args...) StoreLogMsgServer("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_CLIENT_INFO(format, args...) StoreLogMsgCient("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_CLIENT_WARN(format, args...) StoreLogMsgCient("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_CLIENT_ERROR(format, args...) StoreLogMsgCient("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+
+extern int StoreLogMsg(const char *fmt, ...);
+
+//==========================================
+// Cabinet TCP server
+//==========================================
+#define CABINET_LISTEN_PORT_TCP				17222
+#define	CABINET_CONNECTION_LIMIT			2
+#define ShmCabinetKey						CABINET_LISTEN_PORT_TCP+8000
+#define TIMEOUT_SOCKET_RX					250000
+
+
+enum CABINET_COMMAND
+{
+	CABINET_CMD_GET_CHARGING_DATA			=0x01,
+	CABINET_CMD_SET_CONFIG_DATA				=0x03,
+	CABINET_CMD_SET_GUNINFO					=0x04,
+	CABINET_CMD_CONNECTION_FULL				=0xfd,
+	CABINET_CMD_CHKSUM_ERROR				=0xfe,
+	CABINET_CMD_UNKNOWN						=0xff
+};
+
+struct CABINET_Message
+{
+	int			size;
+	uint8_t		buffer[16384];
+};
+
+struct CABINET_CONNECTION_INFO
+{
+	int 		socketFd;					// Socket file description
+	uint8_t		gun_index;					// Each connection gun index
+	time_t		lastHeartBeatTime;			// Each connection latest get heart beat start time
+	uint8_t		isSocketConnected:1;		// Each connection socket connected flag
+};
+
+struct CABINET
+{
+	uint8_t							connectedQty;
+	struct CABINET_CONNECTION_INFO	Connection_Info[CABINET_CONNECTION_LIMIT];
+	uint8_t							hasNewConn:1;
+};
+
+#endif /* MODULE_CABINET_H_ */

+ 857 - 0
EVSE/Projects/AX80/Apps/Module_ConfigTools.c

@@ -0,0 +1,857 @@
+/*
+ * Module_ConfigTools.c
+ *
+ *  Created on: 2020¦~6¤ë22¤é
+ *      Author: foluswen
+ */
+
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+#include	<dirent.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include	<stdbool.h>
+#include	<stddef.h>
+#include	<stdint.h>
+#include 	"define.h"
+#include 	"main.h"
+
+//=================================
+// System basic sample constant
+//=================================
+#define ARRAY_SIZE(A)					(sizeof(A) / sizeof(A[0]))
+#define PASS							1
+#define FAIL							-1
+#define YES								1
+#define NO								0
+#define ON								1
+#define OFF								0
+#define MtdBlockSize 					0x300000
+
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData			*ShmStatusCodeData;
+struct OCPP16Data 				*ShmOCPP16Data;
+struct Charger					*ShmCharger;
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]ConfigToolsLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
+
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+int runShellCmd(const char*cmd)
+{
+	int result = FAIL;
+	char buf[256];
+	FILE *fp;
+
+	fp = popen(cmd, "r");
+	if(fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			DEBUG_INFO("%s\n", buf);
+		}
+
+		result = PASS;
+	}
+	pclose(fp);
+
+	return result;
+}
+
+int StoreUsrConfigData(struct SysConfigData *UsrData)
+{
+	int result = PASS;
+	int fd,wrd;
+	unsigned int i,Chk;
+	unsigned char *ptr, *BufTmp;
+
+	Chk=0;
+	ptr=(unsigned char *)UsrData;
+	if((BufTmp=malloc(MtdBlockSize))!=NULL)
+	{
+		memset(BufTmp,0,MtdBlockSize);
+		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
+		for(i=ARRAY_SIZE(UsrData->CsuBootLoadFwRev);i<MtdBlockSize-4;i++)
+			Chk+=*(BufTmp+i);
+		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
+
+		// Output configuration to file.
+		fd = open("/mnt/EvseConfig.bin", O_RDWR|O_CREAT);
+		if (fd < 0)
+		{
+			DEBUG_ERROR("open /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
+		}
+		wrd=write(fd, BufTmp, MtdBlockSize);
+		close(fd);
+		if(wrd<MtdBlockSize)
+		{
+			DEBUG_ERROR("write /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
+		}
+		DEBUG_INFO("EvseConfig write to file in /mnt OK.\n");
+
+
+		DEBUG_INFO("Erase /dev/mtd10.\n");
+		runShellCmd("flash_erase /dev/mtd10 0 0");
+		DEBUG_INFO("Write /dev/mtd10.\n");
+		runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
+
+		DEBUG_INFO("Erase /dev/mtd11.\n");
+		runShellCmd("flash_erase /dev/mtd11 0 0");
+		DEBUG_INFO("Write /dev/mtd11.\n");
+		runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
+
+
+		system("rm -f /mnt/EvseConfig.bin");
+		DEBUG_INFO("EvseConfig write to flash OK\n");
+	}
+	else
+	{
+		DEBUG_ERROR("alloc BlockSize NG\r\n");
+    		result = FAIL;
+	}
+
+	if(BufTmp!=NULL)
+		free(BufTmp);
+
+	return result;
+}
+
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//Initial ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		result = FAIL;
+	}
+	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("[shmat ShmSysConfigAndInfo NG\n");
+		result = FAIL;
+	}
+	else
+	{}
+
+	//Initial ShmStatusCodeData
+	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+		result = FAIL;
+	}
+	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+		result = FAIL;
+	}
+	else
+	{}
+
+	//Initial ShmOCPP16Data
+   	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
+		result = FAIL;
+	}
+	else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
+		result = FAIL;
+	}
+	else
+	{}
+
+	//Initial ShmCharger
+   	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
+    {
+   		DEBUG_ERROR("shmget ShmCharger NG\n");
+   		result = FAIL;
+	}
+    else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmCharger NG\n");
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	return result;
+}
+
+int main(void)
+{
+	char cmd[128];
+
+	if(InitShareMemory() == FAIL)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("InitShareMemory NG\n");
+		#endif
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
+		}
+		sleep(5);
+		return 0;
+	}
+	else
+	{
+		DEBUG_INFO("InitShareMemory OK.\n");
+	}
+
+
+	for(;;)
+	{
+		system("clear");
+		memset(cmd, 0x00, ARRAY_SIZE(cmd));
+		printf("\n ===== main menu ==================================");
+		printf("\n  system: system configuration menu.");
+		printf("\n  ocpp: ocpp configuration menu.");
+		printf("\n  network: netwok configuration menu.");
+		printf("\n  test: charger start/stop test.");
+		printf("\n  upgrade: trigger firmware upgrade.");
+		printf("\n  save: Save config.");
+		printf("\n  exit: Exit config tools.");
+		printf("\n ==================================================");
+		printf("\n  Please input item name to config: ");
+		scanf("%s", &cmd[0]);
+
+
+		if(strcmp(cmd, "system") == 0)
+		{
+			memset(cmd, 0x00, ARRAY_SIZE(cmd));
+			printf("\n ***** system configuration menu ******************");
+			printf("\n  modelname: EVSE model name.");
+			printf("\n  serialnumber: EVSE serial number.");
+			printf("\n  authentication: Authentication function.");
+			printf("\n  rfidendian: RFID read endian.");
+			printf("\n **************************************************");
+			printf("\n  Please input operation item: ");
+			scanf("%s", &cmd[0]);
+
+			if(strcmp(cmd, "modelname") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** modelname **********************************");
+				printf("\n  Current model name: %s", ShmSysConfigAndInfo->SysConfig.ModelName);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new model name.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input model name: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.ModelName[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.ModelName[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input model name: %s\n", ShmSysConfigAndInfo->SysConfig.ModelName);
+				}
+			}
+			else if(strcmp(cmd, "serialnumber") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** serialnumber *******************************");
+				printf("\n  Current serial number: %s", ShmSysConfigAndInfo->SysConfig.SerialNumber);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new serial number.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input serial number: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.SerialNumber[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.SerialNumber[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input serial number: %s\n", ShmSysConfigAndInfo->SysConfig.SerialNumber);
+				}
+			}
+			else if(strcmp(cmd, "authentication") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** authentication *****************************");
+				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.AuthorisationMode);
+				printf("\n  0: Enable.");
+				printf("\n  1: Disable.");
+				printf("\n **************************************************");
+				printf("\n  Please input authentication mode: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.AuthorisationMode = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd):0);
+				if(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
+					DEBUG_INFO("Authentication: Disable\n");
+				else
+					DEBUG_INFO("Authentication: Enable\n");
+			}
+			else if(strcmp(cmd, "rfidendian") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** rfidendian *********************************");
+				printf("\n  Current mode: %d", ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian);
+				printf("\n  0: Little endian.");
+				printf("\n  1: Big endian.");
+				printf("\n **************************************************");
+				printf("\n  Please input rfid endian mode: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd):0);
+				if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
+					DEBUG_INFO("Authentication: Little endian\n");
+				else
+					DEBUG_INFO("Authentication: Big endian\n");
+			}
+		}
+		else if(strcmp(cmd, "ocpp") == 0)
+		{
+			memset(cmd, 0x00, ARRAY_SIZE(cmd));
+			printf("\n ***** ocpp ***************************************");
+			printf("\n  ocppurl: OCPP backend server url.");
+			printf("\n  cboxid: Charger box id.");
+			printf("\n  vender: Charger point vender.");
+			printf("\n  offlinepolicy: Charger off line policy.");
+			printf("\n  localloadbalance: Charger local load balance.");
+			printf("\n **************************************************");
+			printf("\n  Please input operation item: ");
+			scanf("%s", &cmd[0]);
+
+			if(strcmp(cmd, "ocppurl") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** ocppurl ************************************");
+				printf("\n  Current OCPP url: %s", ShmSysConfigAndInfo->SysConfig.OcppServerURL);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new ocpp url.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n Please input ocpp url: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.OcppServerURL[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppServerURL));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.OcppServerURL[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input ocpp url: %s\n", ShmSysConfigAndInfo->SysConfig.OcppServerURL);
+				}
+			}
+			else if(strcmp(cmd, "cboxid") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** cboxid *************************************");
+				printf("\n  Current OCPP charger box id: %s", ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new charger box id.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n  Please input OCPP charger box id: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.ChargeBoxId[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ChargeBoxId));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.ChargeBoxId[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input ocpp charger box id: %s\n", ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
+				}
+			}
+			else if(strcmp(cmd, "vender") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** vender *************************************");
+				printf("\n  Current OCPP vender: %s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new charger box id.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n  Please input OCPP vender: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.chargePointVendor[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.chargePointVendor));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.chargePointVendor[0], (char*)&cmd[0]);
+					DEBUG_INFO("Input ocpp vender: %s\n", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
+				}
+			}
+			else if(strcmp(cmd, "offlinepolicy") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** offlinepolicy ******************************");
+				printf("\n  Current off line policy: %d", ShmSysConfigAndInfo->SysConfig.OfflinePolicy);
+				printf("\n  0: Local list.");
+				printf("\n  2: Free charging.");
+				printf("\n  3: Deny charging.");
+				printf("\n **************************************************");
+				printf("\n  Please input off line policy mode: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.OfflinePolicy = ((0<=atoi(cmd))&&(atoi(cmd)<=3)&&(atoi(cmd)!=1)?atoi(cmd):0);
+
+				switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
+				{
+					case 0:
+						DEBUG_INFO("Off line policy: Local list.\n");
+						break;
+					case 2:
+						DEBUG_INFO("Off line policy: Free charging.\n");
+						break;
+					case 3:
+						DEBUG_INFO("Off line policy: Deny charging.\n");
+						break;
+				}
+			}
+			else if(strcmp(cmd, "localloadbalance") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** localloadbalance ***************************");
+				printf("\n  Current local loading balance: %d", ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging);
+				printf("\n  0: Disable.");
+				printf("\n  1: Enable.");
+				printf("\n **************************************************");
+				printf("\n  Please input local load balance mode: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd):0);
+				if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
+					DEBUG_INFO("Local loading balance: Enable\n");
+				else
+					DEBUG_INFO("Local loading balance: Disable\n");
+			}
+}
+		else if(strcmp(cmd, "network") == 0)
+		{
+			memset(cmd, 0x00, ARRAY_SIZE(cmd));
+			printf("\n ***** network *************************************");
+			printf("\n  ethdhcp: Ethernet DHCP client.");
+			printf("\n  wifimode: WiFi mode.");
+			printf("\n  wifidhcp: WiFi DHCP client.");
+			printf("\n  wificssid: WiFi client SSID.");
+			printf("\n  wificpasswd: WiFi client password.");
+			printf("\n  telemode: Telecomm mode.");
+			printf("\n  teleapn: Telecomm APN.");
+			printf("\n  teleid: Telecomm login id.");
+			printf("\n  telepwd: Telecomm login password.");
+			printf("\n **************************************************");
+			printf("\n  Please input operation item: ");
+			scanf("%s", &cmd[0]);
+
+			if(strcmp(cmd, "ethdhcp") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** ethdhcp ************************************");
+				printf("\n  Current ethernet dhcp mode: %d", ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient^1);
+				printf("\n  0: Disable.");
+				printf("\n  1: Enable.");
+				printf("\n **************************************************");
+				printf("\n  Please input dhcp mode: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd)^1:0);
+				if(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient)
+					DEBUG_INFO("Ethernet dhcp client: Disable\n");
+				else
+					DEBUG_INFO("Ethernet dhcp client: Enable\n");
+
+			}
+			else if(strcmp(cmd, "wifimode") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** wifimode ***********************************");
+				printf("\n  Current WiFi mode: %d", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
+				printf("\n  0: Disable.");
+				printf("\n  1: Station.");
+				printf("\n  2: Access point.");
+				printf("\n **************************************************");
+				printf("\n  Please input WiFi mode: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode = ((0<=atoi(cmd))&&(atoi(cmd)<=2)?atoi(cmd):0);
+				switch(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode)
+				{
+					case 0:
+						DEBUG_INFO("Wifi mode: Disable.\n");
+						break;
+					case 1:
+						DEBUG_INFO("Wifi mode: Station.\n");
+						break;
+					case 2:
+						DEBUG_INFO("Wifi mode: AP.\n");
+						break;
+				}
+			}
+			else if(strcmp(cmd, "wifidhcp") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** wifidhcp ***********************************");
+				printf("\n  Current WiFi dhcp client mode: %d", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient^1);
+				printf("\n  0: Disable.");
+				printf("\n  1: Enable.");
+				printf("\n **************************************************");
+				printf("\n  Please input WiFi mode: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd)^1:0);
+				if(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiDhcpClient)
+					DEBUG_INFO("Wifi dhcp client: Disable\n");
+				else
+					DEBUG_INFO("Wifi dhcp client: Enable\n");
+			}
+			else if(strcmp(cmd, "wificssid") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** wificssid **********************************");
+				printf("\n  Current WiFi client SSID: %s", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new WiFi client SSID.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n  Please input WiFi client SSID: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid[0], (char*)&cmd[0]);
+					DEBUG_INFO("Wifi client SSID: %s\n", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
+				}
+			}
+			else if(strcmp(cmd, "wificpasswd") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** wificpasswd ********************************");
+				printf("\n  Current WiFi client password: %s", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new WiFi client password.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n  Please input WiFi client password: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword[0], (char*)&cmd[0]);
+					DEBUG_INFO("Wifi client password: %s\n", ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
+				}
+			}
+			else if(strcmp(cmd, "telemode") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** telemode ***********************************");
+				printf("\n  0: Disable.");
+				printf("\n  1: Enable.");
+				printf("\n **************************************************");
+
+				printf("\n  Current telecomm mode: %d", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode^1);
+				printf("\n  Please input telecomm mode: ");
+				scanf("%s", &cmd[0]);
+
+				ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode = ((0<=atoi(cmd))&&(atoi(cmd)<=1)?atoi(cmd)^1:0);
+				if(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode)
+					DEBUG_INFO("Wifi dhcp client: Disable\n");
+				else
+					DEBUG_INFO("Wifi dhcp client: Enable\n");
+			}
+			else if(strcmp(cmd, "teleapn") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** teleapn ************************************");
+				printf("\n  Current telecomm APN: %s", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new telecomm APN.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n  Please input telecomm APN: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn[0], (char*)&cmd[0]);
+					DEBUG_INFO("Telecomm APN: %s\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomApn);
+				}
+			}
+			else if(strcmp(cmd, "teleid") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** teleid *************************************");
+				printf("\n  Current telecomm login id: %s", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new telecomm login id.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n  Please input telecomm login id: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId[0], (char*)&cmd[0]);
+					DEBUG_INFO("Telecomm CHAP id: %s\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapId);
+				}
+			}
+			else if(strcmp(cmd, "telepwd") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***** telepwd ************************************");
+				printf("\n  Current telecomm login password: %s", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
+				printf("\n  0: Keep current config.");
+				printf("\n  1: Input new telecomm login password.");
+				printf("\n **************************************************");
+				printf("\n  Please input operation item: ");
+				scanf("%s", &cmd[0]);
+
+				if(atoi(cmd) == 1)
+				{
+					printf("\n  Please input telecomm login password: ");
+					scanf("%s", &cmd[0]);
+
+					memset(&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd[0], 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd));
+					strcpy((char*)&ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd[0], (char*)&cmd[0]);
+					DEBUG_INFO("Telecomm CHAP password: %s\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomChapPapPwd);
+				}
+			}
+		}
+		else if(strcmp(cmd, "test") == 0)
+		{
+			memset(cmd, 0x00, ARRAY_SIZE(cmd));
+			printf("\n ***** test menu **********************************");
+			printf("\n  start: EVSE start charging request.");
+			printf("\n  stop: EVSE stop charging request.");
+			printf("\n  auth: Authorize request.");
+			printf("\n  ccs: CCS flow status.");
+			printf("\n  alarm: Simulate alarm status.");
+			printf("\n  cancel: return to main menu.");
+			printf("\n **************************************************");
+			printf("\n  Please input operation item: ");
+			scanf("%s", &cmd[0]);
+
+			if(strcmp(cmd, "start") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input gun index(1~2): ");
+				scanf("%s", &cmd[0]);
+
+				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
+				{
+					ShmSysConfigAndInfo->SysInfo.AcChargingData[atoi(cmd)-1].schedule.isTriggerStart = ON;
+					DEBUG_INFO("Test start gun-%d, start charging session.\n", atoi(cmd));
+				}
+				else
+				{
+					printf("\n  Invalid input gun_index.");
+				}
+			}
+			else if(strcmp(cmd, "stop") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input gun index(1~2): ");
+				scanf("%s", &cmd[0]);
+
+				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
+				{
+					ShmSysConfigAndInfo->SysInfo.AcChargingData[atoi(cmd)-1].schedule.isTriggerStop = ON;
+					DEBUG_INFO("Test start gun-%d, stop charging session.\n", atoi(cmd));
+				}
+				else
+				{
+					printf("\n  Invalid input gun_index.");
+				}
+			}
+			else if(strcmp(cmd, "auth") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input idtag: ");
+				scanf("%s", &cmd[0]);
+
+				sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%s", cmd);
+				ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
+				DEBUG_INFO("Test authentication by %s.\n", ShmSysConfigAndInfo->SysConfig.UserId);
+			}
+			else if(strcmp(cmd, "ccs") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input gun index(1~2): ");
+				scanf("%s", &cmd[0]);
+
+				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
+				{
+					uint8_t gun_index = atoi(cmd)-1;
+					memset(cmd, 0x00, ARRAY_SIZE(cmd));
+					printf("\n ***** ccs ****************************************");
+					printf("\n  ccs_hs_status: CCS hand shake status.");
+					printf("\n  cancel: return to main menu.");
+					printf("\n **************************************************");
+					printf("\n  Please input operation item: ");
+					scanf("%s", &cmd[0]);
+
+					if(strcmp(cmd, "ccs_hs_status") == 0)
+					{
+						printf("\n ***** ccs_hs_status *******************************");
+						printf("\n  Current ccs_hs_status: %d", ShmCharger->gun_info[gun_index].ccsHandshakeState);
+						printf("\n  1: HANDSHAKE_DUTY_5.");
+						printf("\n  2: HANDSHAKE_DUTY_5_CHECK.");
+						printf("\n  3: HANDSHAKE_CCS.");
+						printf("\n  4: HANDSHAKE_CP_STATE_E.");
+						printf("\n  5: HANDSHAKE_SET_MAX_CURRENT.");
+						printf("\n  6: HANDSHAKE_BS_MODE.");
+						printf("\n  7: HANDSHAKE_HLC_MODE.");
+						printf("\n **************************************************");
+						printf("\n  Please input operation item: ");
+						scanf("%s", &cmd[0]);
+
+						if((0 < atoi(cmd)) && (atoi(cmd) < 9))
+						{
+							ShmCharger->gun_info[gun_index].ccsHandshakeState = atoi(cmd);
+							DEBUG_INFO("Gun-%d CCS hand shake state: %d.\n", gun_index, ShmCharger->gun_info[gun_index].ccsHandshakeState);
+						}
+						else
+							printf("\n  Invalid hand shake state.");
+					}
+				}
+				else
+				{
+					printf("\n  Invalid input gun_index.");
+				}
+			}
+			else if(strcmp(cmd, "alarm") == 0)
+			{
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n  Please input gun index(1~2): ");
+				scanf("%s", &cmd[0]);
+
+				if((0 < atoi(cmd)) && (atoi(cmd) < 3))
+				{
+					DEBUG_INFO("Alarm simulate gun-%d, OVP.\n", atoi(cmd));
+
+					while(1)
+					{
+						ShmCharger->gun_info[atoi(cmd)-1].systemAlarmCode.SystemAlarmCode |= ALARM_L1_OVER_VOLTAGE;
+						ShmCharger->gun_info[atoi(cmd)-1].primaryMcuAlarm.InputAlarmCode |= ALARM_L1_OVER_VOLTAGE;
+					}
+				}
+				else
+				{
+					printf("\n  Invalid input gun_index.");
+					sleep(1);
+				}
+			}
+			else if(strcmp(cmd, "cancel") == 0)
+			{}
+		}
+		else if(strcmp(cmd, "upgrade") == 0)
+		{
+			printf("\n  Firmware upgrade trigger.");
+
+			ShmSysConfigAndInfo->SysInfo.FirmwareUpdate = ON;
+			DEBUG_INFO("Trigger firmware upgrade.\n");
+			sleep(2);
+		}
+		else if(strcmp(cmd, "save") == 0)
+		{
+			if(StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig) != PASS)
+			{
+				printf("\n  Write configuration fail.\r\n");
+			}
+			else
+			{
+				printf("\n  Write configuration OK.\r\n");
+				DEBUG_INFO("Save configuration.\n");
+			}
+			sleep(2);
+		}
+		else if(strcmp(cmd, "exit") == 0)
+		{
+			printf("\n  exit program.\n\n");
+			DEBUG_INFO("Exit configuration tools.\n");
+			return FAIL;
+		}
+	}
+
+
+
+	return -1;
+}
+
+
+
+

+ 349 - 0
EVSE/Projects/AX80/Apps/Module_Debug.c

@@ -0,0 +1,349 @@
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include  	<sys/types.h>
+#include  	<sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include  	<stdio.h>
+#include  	<stdlib.h>
+#include  	<unistd.h>
+#include  	<fcntl.h>
+#include  	<termios.h>
+#include 	<errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include 	<math.h>
+#include	"define.h"
+#include	"main.h"
+
+
+#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define PASS				1
+#define FAIL				0
+#define ON					1
+#define OFF					0
+
+
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData 			*ShmStatusCodeData;
+struct OCPP16Data				*ShmOCPP16Data;
+struct OCPP20Data				*ShmOCPP20Data;
+struct Charger					*ShmCharger;
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]Module_DebugLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//Initial ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("[shmat ShmSysConfigAndInfo NG\n");
+		#endif
+		result = FAIL;
+	}
+
+	//Initial ShmStatusCodeData
+	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+		#endif
+		result = FAIL;
+	}
+
+	// Initial ShmOCPP16Data
+	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
+		result = FAIL;
+	}
+	else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
+		result = FAIL;
+	}
+
+	// Initial ShmOCPP20Data
+	if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmOCPP20Data NG\n");
+		result = FAIL;
+	}
+	else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmOCPP20Data NG\n");
+		result = FAIL;
+	}
+
+	//Initial ShmCharger
+	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmChargerKey NG\r\n");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmat ShmChargerKey NG\r\n");
+		#endif
+		result = FAIL;
+	}
+
+	return result;
+}
+
+void wait()
+{
+	printf("\n Please press any key then \"Enter\" to continue.");
+	while(getchar() =='\n') usleep(100000);
+}
+
+int main(void)
+{
+	char cmd[128];
+
+	if(InitShareMemory() == FAIL)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("InitShareMemory NG\n");
+		#endif
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
+		}
+		sleep(5);
+		return 0;
+	}
+	else
+	{
+		DEBUG_INFO("InitShareMemory OK.\r\n");
+	}
+
+	for(;;)
+	{
+		system("clear");
+		memset(cmd, 0x00, ARRAY_SIZE(cmd));
+		printf("\n ============== Debug main menu ==================");
+		printf("\n  info: List charger status info.");
+		printf("\n  test: Charger test command.");
+		printf("\n  exit: Exit Module_Debug_Test.");
+		printf("\n =================================================");
+		printf("\n  Please input debug command: ");
+		scanf("%s", &cmd[0]);
+
+		if(strcmp(cmd, "info") == 0)
+		{
+			uint8_t isExit = FALSE;
+			int gun_index;
+
+			do
+			{
+				system("clear");
+				memset(cmd, 0x00, ARRAY_SIZE(cmd));
+				printf("\n ***************** Info menu *********************");
+				printf("\n  csu: charger info");
+				printf("\n  mcu: mcu request state");
+				printf("\n  exit: exit to previous menu.");
+				printf("\n *************************************************");
+				printf("\n  Please input info need to query: ");
+				scanf("%s", &cmd[0]);
+
+				if(strcmp(cmd, "csu") == 0)
+				{
+					printf("\n  Please input gun index: ");
+					scanf("%d", &gun_index);
+					printf("\n CSU info.\n\n");
+
+					gun_index = gun_index<AC_QUANTITY?gun_index:0;
+
+					printf("\n  CSU u-boot version: %s", ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev);
+					printf("\n  CSU kernel version: %s", ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev);
+					printf("\n  CSU rootfs version: %s", ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
+					printf("\n --------------------------------------------------");
+					printf("\n  Charger connector plug times: %d", ShmCharger->gun_info[gun_index].gunPluginTimes.GunPluginTimes);
+					printf("\n --------------------------------------------------");
+					printf("\n  CP positive voltage: %.2f", ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltagePositive);
+					printf("\n  CP negative voltage: %.2f", ShmCharger->gun_info[gun_index].PilotVoltage.PilotVoltageNegative);
+					printf("\n --------------------------------------------------");
+					printf("\n  CSU to MCU legacyRequest: %d", ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest);
+					printf("\n  CSU to MCU relay on request: %d", ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn);
+					printf("\n --------------------------------------------------");
+					printf("\n  Charger charging mode BS/HLC: %d", ShmCharger->gun_info[gun_index].chargingMode);
+					printf("\n --------------------------------------------------");
+					printf("\n  Charger input voltage L1: %.2f", ShmCharger->gun_info[gun_index].inputVoltage.L1N_L12);
+					printf("\n  Charger input voltage L2: %.2f", ShmCharger->gun_info[gun_index].inputVoltage.L2N_L23);
+					printf("\n  Charger input voltage L3: %.2f", ShmCharger->gun_info[gun_index].inputVoltage.L3N_L31);
+					printf("\n --------------------------------------------------");
+					printf("\n  CSU output current L1: %.2f", ShmCharger->gun_info[gun_index].outputCurrent.L1N_L12[gun_index]);
+					printf("\n  CSU output current L2: %.2f", ShmCharger->gun_info[gun_index].outputCurrent.L2N_L23[gun_index]);
+					printf("\n  CSU output current L3: %.2f", ShmCharger->gun_info[gun_index].outputCurrent.L3N_L31[gun_index]);
+					printf("\n --------------------------------------------------");
+					printf("\n  CSU power consumption L1: %.2f", (ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption/100.0));
+					printf("\n  CSU power consumption L2: %.2f", (ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption/100.0));
+					printf("\n  CSU power consumption L3: %.2f", (ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption/100.0));
+					printf("\n  CSU power total consumption: %.2f", (ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/100.0));
+					printf("\n --------------------------------------------------");
+					printf("\n  CSU temperature: %d", ShmCharger->gun_info[gun_index].temperature.point[0]);
+
+					wait();
+				}
+				else if(strcmp(cmd, "mcu") == 0)
+				{
+					printf("\n  Please input gun index: ");
+					scanf("%d", &gun_index);
+					printf("\n  MCU info.\n\n");
+
+					gun_index = gun_index<AC_QUANTITY?gun_index:0;
+
+					printf("\n  Firmware version: %s", ShmCharger->gun_info[gun_index].ver.Version_FW);
+
+					wait();
+				}
+				else if(strcmp(cmd, "exit") == 0)
+				{
+					printf("\n  Exit to previous.\n\n");
+					isExit = TRUE;
+				}
+			}while(!isExit);
+		}
+		else if(strcmp(cmd, "test") == 0)
+		{
+			int gun_index;
+
+			memset(cmd, 0x00, ARRAY_SIZE(cmd));
+			printf("\n ***************** Info menu *********************");
+			printf("\n  start: start charging session");
+			printf("\n  stop: stop charging session");
+			printf("\n  operative: enable charger gun");
+			printf("\n  inoperative: disable charger gun");
+			printf("\n  exit: exit to previous menu.");
+			printf("\n *************************************************");
+			printf("\n  Please input command: ");
+			scanf("%s", &cmd[0]);
+
+			if(strcmp(cmd, "start") == 0)
+			{
+				printf("\n  Please input gun index: ");
+				scanf("%d", &gun_index);
+
+				ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart = ON;
+			}
+			else if(strcmp(cmd, "stop") == 0)
+			{
+				printf("\n  Please input gun index: ");
+				scanf("%d", &gun_index);
+
+				ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = ON;
+			}
+			else if(strcmp(cmd, "operative") == 0)
+			{
+				printf("\n  Please input gun index: ");
+				scanf("%d", &gun_index);
+
+				if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+				{
+					sprintf((char*)ShmOCPP16Data->ChangeAvailability[gun_index].Type, "Operative");
+					ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = ON;
+				}
+				else
+				{
+					sprintf((char*)(char*)ShmOCPP20Data->ChangeAvailability[gun_index].operationalStatus, "Operative");
+					ShmOCPP20Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = ON;
+				}
+			}
+			else if(strcmp(cmd, "inoperative") == 0)
+			{
+				printf("\n  Please input gun index: ");
+				scanf("%d", &gun_index);
+
+				if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+				{
+					sprintf((char*)ShmOCPP16Data->ChangeAvailability[gun_index].Type, "Inoperative");
+					ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = ON;
+				}
+				else
+				{
+					sprintf((char*)(char*)ShmOCPP20Data->ChangeAvailability[gun_index].operationalStatus, "Inoperative");
+					ShmOCPP20Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = ON;
+				}
+			}
+			else if(strcmp(cmd, "exit") == 0)
+			{
+				printf("\n  Exit to previous.\n\n");
+			}
+		}
+		else if(strcmp(cmd, "exit") == 0)
+		{
+			printf("\n  exit program.\n\n");
+			return FAIL;
+		}
+	}
+
+	return FAIL;
+}

+ 1518 - 0
EVSE/Projects/AX80/Apps/Module_Dispenser.c

@@ -0,0 +1,1518 @@
+/*
+ * Module_Dispenser.c
+ *
+ *  Created on: 2021/10/26
+ *      Author: folus
+ */
+#include "Module_Dispenser.h"
+
+//==========================
+// Timeout constant define
+//==========================
+#define TIMEOUT_SPEC_HANDSHAKING				180
+#define TIMEOUT_SPEC_AUTH						15
+#define TIMEOUT_SPEC_HANDSHAKING_LED			185
+#define TIMEOUT_SPEC_LOGPPRINTOUT				30
+#define TIMEOUT_SPEC_PROFILE_PREPARE			60
+#define TIMEOUT_SPEC_BS_HLC_HANDSHAKE			60
+#define TIMEOUT_SPEC_EV_READY					30
+#define TIMEOUT_SPEC_CCS_HEARTBEAT_COUNT_RESET	10
+#define TIMEOUT_SPEC_CCS_HANDSHAKE				120
+#define TIMEOUT_SPEC_PWN_CHANGE					5
+#define TIMEOUT_SPEC_POWERSAVING_LCD			120
+#define TIMEOUT_SPEC_POWERSAVING_RFID			120
+#define TIMEOUT_SPEC_POWERSAVING_METER			120
+#define TIMEOUT_SPEC_POWERSAVING_LED_STATUS		120
+#define TIMEOUT_SPEC_CEHCK_POWER_CONSUMPTION	15
+
+#define is_error(ptr) 					((unsigned long)ptr > (unsigned long)-4000L)
+#define ARRAY_SIZE(A)					(sizeof(A) / sizeof(A[0]))
+#define PASS							1
+#define FAIL							-1
+#define YES								1
+#define NO								0
+#define ON								1
+#define OFF								0
+#define MtdBlockSize 					0x300000
+
+struct SysConfigAndInfo					*ShmSysConfigAndInfo;
+struct StatusCodeData 					*ShmStatusCodeData;
+struct PrimaryMcuData					*ShmPrimaryMcuData;
+struct DISPENSER						*ShmDispenser;
+
+struct timespec							startTime[TMR_IDX_CNT];
+struct timespec							startChargingTime;
+struct timespec							endChargingTime;
+
+struct SysConfigData					SysConfigOrg;
+
+/*
+ *
+ * @param dest
+ * @param src
+ * @param start
+ * @param cnt
+ */
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+/*
+ *
+ * @param fmt
+ * @return
+ */
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]DispenserLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+/*
+ *
+ * @param timer
+ */
+void refreshStartTimer(struct timespec *timer)
+{
+	clock_gettime(CLOCK_MONOTONIC, timer);
+}
+
+/*
+ *
+ * @param clk
+ * @return
+ */
+int getDiffSecNow(struct timespec timer)
+{
+	struct timespec timerNow;
+
+	clock_gettime(CLOCK_MONOTONIC, &timerNow);
+
+	return (int)((((unsigned long)(timerNow.tv_sec - timer.tv_sec) * 1000) + ((unsigned long)((timerNow.tv_nsec / 1000000) - (timer.tv_nsec / 1000000))))/1000);
+}
+
+/*
+ *
+ * @param start
+ * @param end
+ * @return
+ */
+int getDiffSecBetween(struct timespec start, struct timespec end)
+{
+	return (int)((((unsigned long)(end.tv_sec - start.tv_sec) * 1000) + ((unsigned long)((end.tv_nsec / 1000000) - (start.tv_nsec / 1000000))))/1000);
+}
+
+/*
+ *
+ * @param result
+ */
+void getDateTimeString(char* result)
+{
+	time_t CurrentTime;
+	struct tm *tm;
+
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+
+	sprintf(result, "%04d.%02d.%02d %02d:%02d:%02d", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
+}
+
+/*
+ *
+ * @param mode
+ * @return
+ */
+char* getSystemModeName(unsigned char mode)
+{
+	char* result;
+
+	switch(mode)
+	{
+		case SYS_MODE_BOOTING:
+			result = "booting";
+			break;
+		case SYS_MODE_IDLE:
+			result = "idle";
+			break;
+		case SYS_MODE_AUTHORIZING:
+			result = "authorizing";
+			break;
+		case SYS_MODE_PREPARING:
+			result = "preparing";
+			break;
+		case SYS_MODE_CHARGING:
+			result = "charging";
+			break;
+		case SYS_MODE_TERMINATING:
+			result = "terminating";
+			break;
+		case SYS_MODE_COMPLETE:
+			result = "complete";
+			break;
+		case SYS_MODE_ALARM:
+			result = "alarm";
+			break;
+		case SYS_MODE_FAULT:
+			result = "fault";
+			break;
+		case SYS_MODE_MAINTAIN:
+			result = "maintain";
+			break;
+		case SYS_MODE_RESERVATION:
+			result = "reservation";
+			break;
+		case SYS_MODE_BOOKING:
+			result = "booking";
+			break;
+		case SYS_MODE_DEBUG:
+			result = "debug";
+			break;
+		case SYS_MODE_UPDATE:
+			result = "upgrade";
+			break;
+		default:
+			result = "unknown";
+			break;
+	}
+
+	return result;
+}
+
+/*
+ *
+ * @param ptr
+ * @return
+ */
+int LoadSysConfigAndInfo(struct SysConfigData *ptr)
+{
+	int fd,wrd;
+	unsigned char *buf;
+	unsigned int ChkSum,ChkSumOrg;
+
+	if((buf=malloc(MtdBlockSize))==NULL)
+	{
+
+		DEBUG_ERROR("malloc buffer NG,rebooting..\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+		}
+		sleep(5);
+		system("reboot -f");
+		sleep(5);
+		system("reboot -f");
+	}
+	memset(buf, 0, MtdBlockSize);
+
+	//================================================
+	// Load configuration from mtdblock10
+	//================================================
+	system("nanddump /dev/mtd10 -f /mnt/EvseConfig.bin");
+	fd = open("/mnt/EvseConfig.bin", O_RDWR);
+	if (fd < 0)
+	{
+		free(buf);
+
+		DEBUG_ERROR("open mtdblock10 NG,rebooting..\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+		}
+		sleep(5);
+		system("reboot -f");
+		sleep(5);
+		system("reboot -f");
+	}
+    wrd=read(fd, buf, MtdBlockSize);
+	close(fd);
+	if(wrd<MtdBlockSize)
+	{
+		free(buf);
+
+		DEBUG_ERROR("read SysConfigData data NG,rebooting..\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+		}
+		sleep(5);
+		system("reboot -f");
+		sleep(5);
+		system("reboot -f");
+	}
+
+	ChkSum=0;
+	for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
+	{
+		ChkSum+=buf[wrd];
+	}
+	memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+	memcpy(&ptr->ModelName,buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)),ARRAY_SIZE(ptr->ModelName));
+	memcpy(&ptr->SerialNumber,buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)+ARRAY_SIZE(ptr->ModelName)+ARRAY_SIZE(ptr->AcModelName)),ARRAY_SIZE(ptr->SerialNumber));
+
+	//================================================
+	// Load configuration from mtdblock11
+	//================================================
+	if(ChkSum!=ChkSumOrg)
+	{
+		DEBUG_ERROR("Primary SysConfigData checksum NG, read backup\n");
+		system("nanddump /dev/mtd11 -f /mnt/EvseConfig.bin");
+		fd = open("/mnt/EvseConfig.bin", O_RDWR);
+		if (fd < 0)
+		{
+			free(buf);
+
+			DEBUG_ERROR("open mtdblock11 (backup) NG,rebooting..\n");
+
+			if(ShmStatusCodeData!=NULL)
+			{
+				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+			}
+			sleep(5);
+			system("reboot -f");
+			sleep(5);
+			system("reboot -f");
+	    }
+	    memset(buf, 0, MtdBlockSize);
+   		wrd=read(fd, buf,MtdBlockSize);
+    	close(fd);
+		if(wrd<MtdBlockSize)
+		{
+			free(buf);
+
+			DEBUG_ERROR("read backup SysConfigData data NG,rebooting..\n");
+
+			if(ShmStatusCodeData!=NULL)
+			{
+				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+			}
+			sleep(5);
+			system("reboot -f");
+			sleep(5);
+			system("reboot -f");
+		}
+
+		ChkSum=0;
+		for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
+		{
+			ChkSum+=buf[wrd];
+		}
+		memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+
+		//================================================
+		// Load configuration from mtdblock12 (Factory default)
+		//================================================
+		if(ChkSum!=ChkSumOrg)
+		{
+			DEBUG_WARN("backup SysConfigData checksum NG, read Factory default\n");
+			system("nanddump /dev/mtd12 -f /mnt/EvseConfig.bin");
+			fd = open("/mnt/EvseConfig.bin", O_RDWR);
+			if (fd < 0)
+			{
+				DEBUG_ERROR("open mtdblock12 (Factory default) NG,rebooting..\n");
+
+				free(buf);
+				if(ShmStatusCodeData!=NULL)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+				}
+				sleep(5);
+				system("reboot -f");
+				sleep(5);
+				system("reboot -f");
+	    	}
+	    	memset(buf, 0, MtdBlockSize);
+   			wrd=read(fd, buf,MtdBlockSize);
+    		close(fd);
+			if(wrd<MtdBlockSize)
+			{
+				DEBUG_ERROR("read factory default  SysConfigData data NG,rebooting..\n");
+
+				free(buf);
+				if(ShmStatusCodeData!=NULL)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+				}
+				sleep(5);
+				system("reboot -f");
+				sleep(5);
+				system("reboot -f");
+			}
+
+			ChkSum=0;
+			for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
+			{
+				ChkSum+=buf[wrd];
+			}
+			memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+			memcpy(buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)), &ptr->ModelName, ARRAY_SIZE(ptr->ModelName));
+			memcpy(buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)+ARRAY_SIZE(ptr->ModelName)+ARRAY_SIZE(ptr->AcModelName)), &ptr->SerialNumber, ARRAY_SIZE(ptr->SerialNumber));
+
+			if(ChkSum!=ChkSumOrg)
+			{
+				DEBUG_WARN("factory default  SysConfigData checksum NG, restore factory default\n");
+				free(buf);
+				system("cd /root;./Module_FactoryConfig -m");
+				system("rm -f /Storage/OCPP/OCPPConfiguration");
+				system("sync");
+				sleep(5);
+				system("reboot -f");
+				sleep(5);
+				system("reboot -f");
+
+				return FAIL;
+			}
+		}
+	}
+
+	//load OK
+	memcpy((struct SysConfigData *)ptr,buf,sizeof(struct SysConfigData));
+	free(buf);
+
+	system("rm -f /mnt/EvseConfig.bin");
+
+	// SysConfig in flash is empty (0xffffffff)
+	if((strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName)) ||
+	   (strlen((char*)ShmSysConfigAndInfo->SysConfig.SerialNumber) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber)) ||
+	   (strlen((char*)ShmSysConfigAndInfo->SysConfig.SystemId) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SystemId)) ||
+	   (ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient == 0xff))
+	{
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName))
+		{
+			memset(ShmSysConfigAndInfo->SysConfig.ModelName, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
+		}
+
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.SerialNumber) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber))
+		{
+			memset(ShmSysConfigAndInfo->SysConfig.SerialNumber, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
+		}
+
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.SystemId) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SystemId))
+		{
+			memset(ShmSysConfigAndInfo->SysConfig.SystemId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SystemId));
+		}
+
+		if(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient == 0xff)
+		{
+			DEBUG_INFO("Ethernet dhcp config is null.\n");
+		}
+
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) == 0x00)
+		{
+			DEBUG_INFO("Model name over length.\n");
+		}
+
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.SerialNumber) == 0x00)
+		{
+			DEBUG_INFO("Model serial number over length.\n");
+		}
+
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.SystemId) == 0x00)
+		{
+			DEBUG_INFO("SystemId over length.\n");
+		}
+
+		system("cd /root;./Module_FactoryConfig -m");
+		sleep(3);
+		system("/usr/bin/run_evse_restart.sh");
+	}
+
+	DEBUG_INFO("Load SysConfigData OK\n");
+
+	return PASS;
+}
+
+/*
+ *
+ * @param UsrData
+ * @return
+ */
+int StoreUsrConfigData(struct SysConfigData *UsrData)
+{
+	int result = PASS;
+	int fd,wrd;
+	unsigned int i,Chk;
+	unsigned char *ptr, *BufTmp;
+
+	Chk=0;
+	ptr=(unsigned char *)UsrData;
+	if((BufTmp=malloc(MtdBlockSize))!=NULL)
+	{
+		memset(BufTmp,0,MtdBlockSize);
+		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
+		for(i=0;i<MtdBlockSize-4;i++)
+			Chk+=*(BufTmp+i);
+		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
+
+		// Output configuration to file.
+		fd = open("/mnt/EvseConfig.bin", O_RDWR|O_CREAT);
+		if (fd < 0)
+		{
+			DEBUG_ERROR("open /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
+		}
+		wrd=write(fd, BufTmp, MtdBlockSize);
+		close(fd);
+		if(wrd<MtdBlockSize)
+		{
+			DEBUG_ERROR("write /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
+		}
+		DEBUG_INFO("EvseConfig write to file in /mnt OK.\n");
+
+		DEBUG_INFO("Erase /dev/mtd10.\n");
+		runShellCmd("flash_erase /dev/mtd10 0 0");
+		DEBUG_INFO("Write /dev/mtd10.\n");
+		runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
+
+		DEBUG_INFO("Erase /dev/mtd11.\n");
+		runShellCmd("flash_erase /dev/mtd11 0 0");
+		DEBUG_INFO("Write /dev/mtd11.\n");
+		runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
+
+		system("rm -f /mnt/EvseConfig.bin");
+		DEBUG_INFO("EvseConfig write to flash OK\n");
+	}
+	else
+	{
+		DEBUG_ERROR("alloc BlockSize NG\r\n");
+    		result = FAIL;
+	}
+
+	if(BufTmp!=NULL)
+		free(BufTmp);
+
+	return result;
+}
+
+
+/*
+ *
+ * @param gun_index
+ * @param mode
+ * @return
+ */
+unsigned char isMode(unsigned char mode)
+{
+	return ((ShmDispenser->gun_info.SystemStatus == mode)?YES:NO);
+}
+
+/*
+ *
+ * @param gun_index
+ * @return
+ */
+unsigned char isModeChange()
+{
+	unsigned char result = NO;
+
+	if(!isMode(ShmDispenser->gun_info.PreviousSystemStatus))
+	{
+		result = YES;
+		ShmDispenser->gun_info.PreviousSystemStatus = ShmDispenser->gun_info.SystemStatus;
+	}
+
+	return result;
+}
+
+/*
+ *
+ * @param gun_index
+ * @param mode
+ */
+void setChargerMode(unsigned char mode)
+{
+	ShmDispenser->gun_info.PreviousSystemStatus = ShmDispenser->gun_info.SystemStatus;
+	ShmDispenser->gun_info.SystemStatus = mode;
+
+	DEBUG_INFO("System mode switch from %s to %s\n", getSystemModeName(ShmDispenser->gun_info.PreviousSystemStatus), getSystemModeName(ShmDispenser->gun_info.SystemStatus));
+}
+
+/*
+ *
+ * @return
+ */
+int getRequest()
+{
+	return ShmDispenser->gun_info.legacyRequest.isLegacyRequest;
+}
+
+/*
+ *
+ * @param gun_index
+ * @return
+ */
+int getRelay()
+{
+	return ShmDispenser->gun_info.legacyRequest.isRelayOn;
+}
+
+/*
+ *
+ * @param gun_index
+ * @return
+ */
+int presentChargedEnergyClear()
+{
+	int result = FAIL;
+
+	ShmDispenser->gun_info.PresentChargedEnergy = 0;
+	memset(ShmDispenser->gun_info.presentChargedEnergyPeriod, 0x00, ARRAY_SIZE(ShmDispenser->gun_info.presentChargedEnergyPeriod)*sizeof(float));
+	result = PASS;
+
+	return result;
+}
+
+/*
+ *
+ * @param gun_index
+ * @return
+ */
+float presentChargedEnergyTotal()
+{
+	float result = 0.0f;
+
+	for(int idx=0;idx<ARRAY_SIZE(ShmDispenser->gun_info.presentChargedEnergyPeriod);idx++)
+	{
+		result += ShmDispenser->gun_info.presentChargedEnergyPeriod[idx];
+	}
+
+	return result;
+}
+
+/*
+ *
+ * @param gun_index
+ * @return
+ */
+int presentChargedEnergyUpdate()
+{
+	int result = FAIL;
+	time_t CurrentTime;
+	struct tm *tm;
+
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+
+	if(ShmDispenser->ConfigData.AcPhaseCount==1)
+	{
+		// Resolution: 0.0001 kwh
+		ShmDispenser->gun_info.presentChargedEnergyPeriod[tm->tm_hour] += (((float)(ShmDispenser->gun_info.powerConsumptionTotal.power_consumption - ShmDispenser->gun_info.powerConsumptionTotal.power_consumption_at_start))/10000.0) - presentChargedEnergyTotal();
+
+	}
+	else
+	{
+		// Resolution: 0.0001 kwh
+		ShmDispenser->gun_info.presentChargedEnergyPeriod[tm->tm_hour] += ((((float)(ShmDispenser->gun_info.powerConsumption[0].power_consumption - ShmDispenser->gun_info.powerConsumption[0].power_consumption_at_start))/10000.0) +
+																				    (((float)(ShmDispenser->gun_info.powerConsumption[1].power_consumption - ShmDispenser->gun_info.powerConsumption[1].power_consumption_at_start))/10000.0) +
+																				    (((float)(ShmDispenser->gun_info.powerConsumption[2].power_consumption - ShmDispenser->gun_info.powerConsumption[2].power_consumption_at_start))/10000.0))
+																					- presentChargedEnergyTotal();
+	}
+
+	ShmDispenser->gun_info.PresentChargedEnergy = presentChargedEnergyTotal();
+
+	return result;
+}
+
+
+/*
+ *  Init all share memory
+ * @return
+ */
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//Initial ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		result = FAIL;
+	}
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+    	result = FAIL;
+   	 }
+    else
+    {}
+
+   	//Initial ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+   		result = FAIL;
+	}
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+    	result = FAIL;
+   	}
+    else
+    {}
+
+	//Initial ShmSDispenser
+	if ((MeterSMId = shmget(ShmDispenserKey, sizeof(struct DISPENSER), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmSDispenser NG\n");
+		result = FAIL;
+	}
+	else if ((ShmDispenser = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmSDispenser NG\n");
+		result = FAIL;
+	}
+
+    return result;
+}
+
+
+/*
+ * TODO:
+ * 	1. Upgrade firmware
+ */
+int upgrade_check()
+{
+	int result = PASS;
+	int fd;
+	DIR *dir;
+	struct dirent *file;
+	char cmd[512];
+	long int MaxLen=48*1024*1024;
+
+	if ((dir = opendir ("/mnt")) != NULL)
+	{
+		/* print all the files and directories within directory */
+		while ((file = readdir (dir)) != NULL)
+		{
+			if((strlen(file->d_name)>2))
+			{
+				// Wait for MCU upgrade finish.
+				while(ShmDispenser->gun_info.mcuFlag.isMcuUpgradeReq)sleep(1);
+
+				memset(&ShmDispenser->fwUpgradeInfo, 0xFF, sizeof(Fw_Upgrade_Info));
+				DEBUG_INFO("New firmware file: %s\n", file->d_name);
+				sprintf(ShmDispenser->fwUpgradeInfo.location, "/mnt/%s", file->d_name);
+
+				if((fd=open(ShmDispenser->fwUpgradeInfo.location, O_RDONLY)) >= 0)
+				{
+					unsigned char *ptr = malloc(MaxLen); //-48 is take out the header
+					memset(ptr, 0xFF, MaxLen);  //-48 is take out the header
+					read(fd, ptr, MaxLen);
+					close(fd);
+
+					ShmDispenser->fwUpgradeInfo.fwType = ((ptr[0x13]<<0) | (ptr[0x12]<<8) | (ptr[0x11]<<16) | (ptr[0x10]<<24));
+					substr(ShmDispenser->fwUpgradeInfo.modelName, (char *)ptr, 0, 0x10);
+					DEBUG_INFO("New firmware type: %X\n", ShmDispenser->fwUpgradeInfo.fwType);
+					DEBUG_INFO("New firmware model name: %s, %s\n", ShmDispenser->fwUpgradeInfo.modelName, ShmDispenser->ConfigData.ModelName);
+
+					if((ShmDispenser->fwUpgradeInfo.modelName[0] == ShmDispenser->ConfigData.ModelName[0]) &&
+					   (ShmDispenser->fwUpgradeInfo.modelName[1] == ShmDispenser->ConfigData.ModelName[1]) &&
+					   (ShmDispenser->fwUpgradeInfo.modelName[7] == ShmDispenser->ConfigData.ModelName[7]) &&
+					   (ShmDispenser->fwUpgradeInfo.modelName[8] == ShmDispenser->ConfigData.ModelName[8]) &&
+					   (ShmDispenser->fwUpgradeInfo.modelName[9] == ShmDispenser->ConfigData.ModelName[9]) &&
+					   (ShmDispenser->fwUpgradeInfo.modelName[11] == ShmDispenser->ConfigData.ModelName[11]) &&
+					   (ShmDispenser->fwUpgradeInfo.modelName[12] == ShmDispenser->ConfigData.ModelName[12]) &&
+					   (ShmDispenser->fwUpgradeInfo.modelName[13] == ShmDispenser->ConfigData.ModelName[13]) &&
+					   (ShmDispenser->fwUpgradeInfo.fwType>0))
+					{
+						switch(ShmDispenser->fwUpgradeInfo.fwType)
+						{
+							case CSU_MLO:
+							case CSU_BOOTLOADER:
+							case CSU_KERNEL_CONFIGURATION:
+							case CSU_KERNEL_IMAGE:
+							case CSU_ROOT_FILE_SYSTEM:
+							case CSU_USER_CONFIGURATION:
+							case CSU_PRIMARY_CONTROLLER:
+								if(Upgrade_Flash(ShmDispenser->fwUpgradeInfo.fwType, ShmDispenser->fwUpgradeInfo.location, ShmDispenser->fwUpgradeInfo.modelName) != PASS)
+								{
+									result = FAIL;
+								}
+								else
+								{
+									if(ShmDispenser->fwUpgradeInfo.fwType == CSU_USER_CONFIGURATION)
+									{
+										DEBUG_INFO("Restore model name & serial number.\n");
+										memcpy(&SysConfigOrg, &ShmDispenser->ConfigData, sizeof(struct SysConfigData));
+
+										if(LoadSysConfigAndInfo(&ShmSysConfigAndInfo->SysConfig) != PASS)
+										{
+											DEBUG_INFO("Re-load configuration fail.\n");
+											result = FAIL;
+										}
+										else
+										{
+											memcpy(&ShmSysConfigAndInfo->SysConfig.ModelName, &SysConfigOrg.ModelName, ARRAY_SIZE(SysConfigOrg.ModelName));
+											memcpy(&ShmSysConfigAndInfo->SysConfig.SerialNumber, &SysConfigOrg.SerialNumber, ARRAY_SIZE(SysConfigOrg.SerialNumber));
+											memcpy(&ShmSysConfigAndInfo->SysConfig.SystemId, &SysConfigOrg.SystemId, ARRAY_SIZE(SysConfigOrg.SystemId));
+
+											if(StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig) != PASS)
+											{
+												DEBUG_INFO("Re-write configuration fail.\n");
+												result = FAIL;
+											}
+											else
+												DEBUG_INFO("Re-write configuration OK.\n");
+										}
+									}
+								}
+								sprintf(cmd, "yes|rm %s", ShmDispenser->fwUpgradeInfo.location);
+								system(cmd);
+								break;
+							case AC_WALLMOUNT_CONTROLLER:
+								ShmDispenser->gun_info.mcuFlag.isMcuUpgradeReq = ON;
+								sleep(10);
+								break;
+
+							default:
+								result = FAIL;
+								DEBUG_WARN("Image file is unknown type.\n");
+								sprintf(cmd, "yes|rm %s", ShmDispenser->fwUpgradeInfo.location);
+								system(cmd);
+								break;
+						}
+					}
+					else
+					{
+						result = FAIL;
+						DEBUG_ERROR("Model name and Firmware type error.\n");
+						sprintf(cmd, "yes|rm %s", ShmDispenser->fwUpgradeInfo.location);
+						system(cmd);
+					}
+					free(ptr);
+				}
+				else
+				{
+					result = FAIL;
+					DEBUG_ERROR("New firmware open error.\n");
+				}
+			}
+			else
+			{
+				if(strlen(file->d_name) >= 3)
+				{
+					result = FAIL;
+					DEBUG_ERROR("File name error.\n");
+				}
+				else
+				{
+					DEBUG_ERROR("Searching file.\n");
+				}
+			}
+		}
+		closedir (dir);
+	}
+	else
+	{
+		result = FAIL;
+		DEBUG_ERROR("/mnt does not valid.\n");
+	}
+
+	return result;
+}
+
+/*
+ *
+ * @return
+ */
+int main(void)
+{
+	// Initial share memory
+	if(InitShareMemory() == FAIL)
+	{
+		DEBUG_ERROR("InitShareMemory NG\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=ON;
+		}
+		sleep(5);
+		return 0;
+	}
+
+	ShmDispenser->gun_info.PreviousSystemStatus = 0xff;
+	ShmDispenser->gun_info.primaryMcuState.rotatory_switch = 0xff;
+	ShmDispenser->gun_info.mcuResetRequest.isMcuResetRequest = ON;
+	ShmDispenser->gun_info.isSetBreatheLedTiming = OFF;
+	ShmDispenser->gun_info.isSetLedBrightness = OFF;
+
+	DEBUG_INFO("Module_Dispenser initialized...\n");
+
+	for(;;)
+	{
+		//==========================================
+		// Check initialization "PASS" or "FAIL"
+		//==========================================
+		if(ShmDispenser->gun_info.SystemStatus != SYS_MODE_BOOTING)
+		{
+			// Alarm event check
+			if((ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode > 0))
+			{
+				if(ShmDispenser->gun_info.SystemStatus != SYS_MODE_ALARM)
+				{
+					if(ShmDispenser->gun_info.SystemStatus != SYS_MODE_UPDATE)
+					{
+						setChargerMode(SYS_MODE_ALARM);
+					}
+				}
+			}
+		}
+
+		//==========================================
+		// Switch operative
+		//==========================================
+		if(ShmDispenser->gun_info.isOperactive)
+		{
+			if(isMode(SYS_MODE_MAINTAIN))
+			{
+				setChargerMode(SYS_MODE_IDLE);
+			}
+		}
+		else
+		{
+			if(isMode(SYS_MODE_IDLE))
+			{
+				setChargerMode(SYS_MODE_MAINTAIN);
+			}
+		}
+
+		//==========================================
+		// Upgrade check
+		//==========================================
+		if(ShmDispenser->gun_info.isUpgradeReq && !ShmDispenser->gun_info.isUpgradeEnd)
+		{
+			if((ShmDispenser->gun_info.SystemStatus == SYS_MODE_IDLE) || (ShmDispenser->gun_info.SystemStatus == SYS_MODE_ALARM))
+			{
+
+				if((ShmDispenser->gun_info.isUpgradePASS = upgrade_check()) == PASS)
+				{
+					DEBUG_INFO("Upgrade process pass.\n");
+				}
+				else
+				{
+					DEBUG_ERROR("Upgrade process fail.\n");
+				}
+
+				ShmDispenser->gun_info.isUpgradeEnd = ON;
+			}
+		}
+
+		//==========================================
+		// Gun process
+		//==========================================
+		switch(ShmDispenser->gun_info.SystemStatus)
+		{
+			case SYS_MODE_BOOTING:
+				if(isModeChange())
+				{}
+
+				if(ShmDispenser->gun_info.mcuFlag.isReadFwVerPass &&
+				   ShmDispenser->gun_info.mcuFlag.isSetModelNamePass &&
+				   ShmDispenser->gun_info.mcuFlag.isSetSerialNumberPass)
+				{
+					// Set max current to rating current
+					ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = ShmDispenser->gun_info.primaryMcuState.rating_current;
+
+					// If rotate switch equal zero, the system needs to change Debug mode
+					if(ShmDispenser->gun_info.primaryMcuState.rotatory_switch == 0)
+						setChargerMode(SYS_MODE_DEBUG);
+					else
+						setChargerMode(SYS_MODE_IDLE);
+				}
+
+				break;
+			case SYS_MODE_IDLE:
+				if(isModeChange())
+				{
+					ShmDispenser->gun_info.isGunPlugged = NO;
+					ShmDispenser->gun_info.systemAlarmCode.SystemAlarmCode = 0x00;
+					ShmDispenser->gun_info.PresentChargedDuration = 0;
+					presentChargedEnergyClear();
+					ShmDispenser->gun_info.targetCurrent = 0xFF;
+					ShmDispenser->gun_info.ccsHandshakeState = HANDSHAKE_IDLE;
+					ShmDispenser->gun_info.chargingMode = CHARGING_MODE_BS;
+					ShmDispenser->gun_info.isDoEvReadyOnce = OFF;
+					ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
+					ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = ON;
+					if(ShmDispenser->isCcsEnable)system("pkill Module_CCS");
+				}
+
+				if(ShmDispenser->gun_info.legacyRequest.isLegacyRequest)
+				{
+					ShmDispenser->gun_info.isGunPlugged = NO;
+					ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = YES;
+
+					if(ShmDispenser->isCcsEnable)
+					{
+						ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_5;
+					}
+					else
+					{
+						if((6 <= ShmDispenser->gun_info.targetCurrent))
+						{
+							ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = ((ShmDispenser->gun_info.targetCurrent > ShmDispenser->gun_info.primaryMcuState.rating_current)?ShmDispenser->gun_info.primaryMcuState.rating_current:ShmDispenser->gun_info.targetCurrent);
+						}
+						else if((1 <= ShmDispenser->gun_info.targetCurrent) && (ShmDispenser->gun_info.targetCurrent < 6))
+						{
+							ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = 6;
+						}
+						else
+						{
+							ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = 100;
+						}
+					}
+					ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = YES;
+
+					setChargerMode(SYS_MODE_AUTHORIZING);
+				}
+				else
+				{}
+
+				break;
+			case SYS_MODE_AUTHORIZING:
+				if(isModeChange())
+				{}
+
+				if(ShmDispenser->isCcsEnable)
+				{
+					ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_CP_STATE_F;
+					ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = ON;
+					sleep(4);
+					ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
+					ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = ON;
+					system("/root/Module_CCS &");
+				}
+
+				setChargerMode(SYS_MODE_PREPARING);
+
+				break;
+			case SYS_MODE_PREPARING:
+				if(isModeChange())
+				{
+					refreshStartTimer(&startTime[TMR_IDX_HANDSHAKING]);
+
+					if(ShmDispenser->isCcsEnable)
+					{
+						ShmDispenser->gun_info.ccsHandshakeState = HANDSHAKE_DUTY_5;
+					}
+					else
+					{
+						ShmDispenser->gun_info.ccsHandshakeState = HANDSHAKE_CP_STATE_E;
+						ShmDispenser->gun_info.chargingMode = CHARGING_MODE_BS;
+					}
+				}
+
+				// If control pilot detect Bx, skip watch dog time out.
+				if((ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_B) ||
+				   (ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_C))
+				{
+					ShmDispenser->gun_info.isGunPlugged = YES;
+					switch(ShmDispenser->gun_info.ccsHandshakeState)
+					{
+						case HANDSHAKE_DUTY_5:
+							//Let CCS task start to negotiate
+							ShmDispenser->gun_info.acCcsInfo.ChargingPermission = ON;
+							ShmDispenser->gun_info.acCcsInfo.EVSENotification = NOTIFICATION_NONE;
+
+							// Set CCS 5% PWM duty
+							if(ShmDispenser->gun_info.acCcsInfo.CpSetPWMDuty == CCS_PWM_DUTY_5)
+							{
+								ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_5;
+								ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = ON;
+								ShmDispenser->gun_info.ccsHandshakeState = HANDSHAKE_DUTY_5_CHECK;
+							}
+							break;
+						case HANDSHAKE_DUTY_5_CHECK:
+							if((ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty == OFF))
+							{
+								//2 secs timeout
+								refreshStartTimer(&startTime[TMR_IDX_BS_HLC_HANDSHAKE]);
+								DEBUG_INFO("HLC slac handshake start.\n");
+								ShmDispenser->gun_info.ccsHandshakeState = HANDSHAKE_CCS;
+							}
+							break;
+						case HANDSHAKE_CCS:
+							//CCS handshake timeout
+							if(getDiffSecNow(startTime[TMR_IDX_BS_HLC_HANDSHAKE]) > TIMEOUT_SPEC_BS_HLC_HANDSHAKE)
+							{
+								ShmDispenser->gun_info.acCcsInfo.ChargingPermission = OFF;
+								ShmDispenser->gun_info.acCcsInfo.EVSENotification = NOTIFICATION_STOP;
+								DEBUG_INFO("HLC %d secs slac handshake timeout.\n", TIMEOUT_SPEC_BS_HLC_HANDSHAKE);
+							}
+
+							if((ShmDispenser->gun_info.acCcsInfo.ChargingPermission == OFF) && (ShmDispenser->gun_info.acCcsInfo.CpSetPWMDuty != CCS_PWM_DUTY_5))
+							{
+								DEBUG_INFO("Wait CCS give up negotiagting.\n");
+								ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_CP_STATE_F;
+								ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = ON;
+								ShmDispenser->gun_info.ccsHandshakeState = HANDSHAKE_CP_STATE_E;
+								ShmDispenser->gun_info.chargingMode = CHARGING_MODE_BS;
+							}
+
+							//CCS status check
+							if((16 < ShmDispenser->gun_info.acCcsInfo.PresentMsgFlowStatus) && (ShmDispenser->gun_info.acCcsInfo.PresentMsgFlowStatus < 254))
+							{
+								ShmDispenser->gun_info.chargingMode = CHARGING_MODE_HLC;
+								DEBUG_INFO("Enter HLC Mode charging.\n");
+								ShmDispenser->gun_info.ccsHandshakeState = HANDSHAKE_HLC_MODE;
+								refreshStartTimer(&startTime[TMR_IDX_HANDSHAKING]);
+							}
+
+							break;
+						case HANDSHAKE_CP_STATE_E:
+							if(ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty == OFF)
+							{
+								if(ShmDispenser->isCcsEnable)
+								{
+									DEBUG_INFO("Change to CP STATE E for 4 secs.\n");
+									//CP STATE E for 4 secs
+									sleep(4);
+								}
+
+								//restore normal CP PWM duty
+								// Determine max charging current to MCU
+								DEBUG_INFO("Determine max charging current to MCU.\n");
+								ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = ((ShmDispenser->gun_info.targetCurrent > ShmDispenser->gun_info.primaryMcuState.rating_current)?ShmDispenser->gun_info.primaryMcuState.rating_current:ShmDispenser->gun_info.targetCurrent);
+								ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = YES;
+								ShmDispenser->gun_info.ccsHandshakeState = HANDSHAKE_SET_MAX_CURRENT;
+								refreshStartTimer(&startTime[TMR_IDX_BS_HLC_HANDSHAKE]);
+							}
+							break;
+						case HANDSHAKE_SET_MAX_CURRENT:
+							if(ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty == OFF)
+							{
+								ShmDispenser->gun_info.ccsHandshakeState = HANDSHAKE_BS_MODE;
+								DEBUG_INFO("Enter BS Mode charging.\n");
+								//for EV READY 30 secs didn't start charging to STATE E
+								refreshStartTimer(&startTime[TMR_IDX_HANDSHAKING]);
+							}
+							break;
+						case HANDSHAKE_BS_MODE:
+							refreshStartTimer(&startTime[TMR_IDX_HANDSHAKING]);
+
+							presentChargedEnergyClear();
+							getDateTimeString((char*)ShmDispenser->gun_info.StartDateTime);
+							ShmDispenser->gun_info.powerConsumptionTotal.power_consumption_at_start = ShmDispenser->gun_info.powerConsumptionTotal.power_consumption;
+							ShmDispenser->gun_info.powerConsumption[0].power_consumption_at_start = ShmDispenser->gun_info.powerConsumption[0].power_consumption;
+							ShmDispenser->gun_info.powerConsumption[1].power_consumption_at_start = ShmDispenser->gun_info.powerConsumption[1].power_consumption;
+							ShmDispenser->gun_info.powerConsumption[2].power_consumption_at_start = ShmDispenser->gun_info.powerConsumption[2].power_consumption;
+							refreshStartTimer(&startChargingTime);
+
+							setChargerMode(SYS_MODE_CHARGING);
+
+
+							//EV READY CHECK
+							/*
+							if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_BS_HLC_HANDSHAKE]) > TIMEOUT_SPEC_EV_READY) && (ShmCharger->gun_info[gun_index].isEvReady2StateE == OFF))
+							{
+								if(ShmCharger->gun_info[gun_index].isDoEvReadyOnce == OFF)
+								{
+									DEBUG_INFO("EV READY STATE E 4sec.\n");
+									ShmCharger->gun_info[gun_index].isEvReady2StateE = ON;
+									ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_CP_STATE_E;
+									ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
+									ShmCharger->gun_info[gun_index].evReadyState = EV_READY_STAT_E;
+								}
+							}
+
+							if(ShmCharger->gun_info[gun_index].isEvReady2StateE == ON)
+							{
+								switch(ShmCharger->gun_info[gun_index].evReadyState)
+								{
+									case EV_READY_STAT_E:
+										if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
+										{
+											sleep(4);
+											ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
+											ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
+											ShmCharger->gun_info[gun_index].evReadyState = EV_READY_STAT_C;
+										}
+										break;
+									case EV_READY_STAT_C:
+										if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
+										{
+											usleep(500000);
+											DEBUG_INFO("EV READY Determine max charging current to MCU.\n");
+											if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+											{
+												ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+												if(ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current)
+												{
+													ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+													ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
+												}
+											}
+											else
+											{
+												ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+												if(ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current)
+												{
+													ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+													ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
+												}
+											}
+											ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty = ON;
+											ShmCharger->gun_info[gun_index].evReadyState = EV_READY_SET_MAX_CURRENT;
+										}
+										break;
+									case EV_READY_SET_MAX_CURRENT:
+										if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
+										{
+											ShmCharger->gun_info[gun_index].isEvReady2StateE = OFF;
+											ShmCharger->gun_info[gun_index].isDoEvReadyOnce = ON;
+										}
+										break;
+									default:
+										break;
+								}
+							}*/
+
+							break;
+						case HANDSHAKE_HLC_MODE:
+							if(ShmDispenser->gun_info.acCcsInfo.EVChargeProgress == HLC_START_MODE)
+							{
+								ShmDispenser->gun_info.isCCSStartTransation = ON;
+							}
+
+							if((ShmDispenser->gun_info.isCCSStartTransation == ON))
+							{
+								presentChargedEnergyClear();
+								getDateTimeString((char*)ShmDispenser->gun_info.StartDateTime);
+								ShmDispenser->gun_info.powerConsumptionTotal.power_consumption_at_start = ShmDispenser->gun_info.powerConsumptionTotal.power_consumption;
+								ShmDispenser->gun_info.powerConsumption[0].power_consumption_at_start = ShmDispenser->gun_info.powerConsumption[0].power_consumption;
+								ShmDispenser->gun_info.powerConsumption[1].power_consumption_at_start = ShmDispenser->gun_info.powerConsumption[1].power_consumption;
+								ShmDispenser->gun_info.powerConsumption[2].power_consumption_at_start = ShmDispenser->gun_info.powerConsumption[2].power_consumption;
+
+								ShmDispenser->gun_info.isCCSStartTransation = OFF;
+								setChargerMode(SYS_MODE_CHARGING);
+								refreshStartTimer(&startChargingTime);
+								refreshStartTimer(&startTime[TMR_IDX_CCS_HEARTBEAT_COUNT_RESET]);
+							}
+
+							//120 sec timeout
+							if(getDiffSecNow(startTime[TMR_IDX_HANDSHAKING]) > TIMEOUT_SPEC_CCS_HANDSHAKE)
+							{
+								if(getDiffSecNow(startTime[TMR_IDX_HANDSHAKING]) > TIMEOUT_SPEC_CCS_HANDSHAKE+5)
+								{
+									DEBUG_INFO("CCS 120 secs handshake timeout, change to BS Mode...\n");
+									//Cancel CCS task negotiating
+									ShmDispenser->gun_info.acCcsInfo.ChargingPermission = OFF;
+									ShmDispenser->gun_info.acCcsInfo.EVSENotification = NOTIFICATION_STOP;
+									//ShmDispenser->gun_info.isCCSWaitChangeDuty = ON;
+
+									if((ShmDispenser->gun_info.acCcsInfo.ChargingPermission == OFF) && (ShmDispenser->gun_info.acCcsInfo.CpSetPWMDuty != CCS_PWM_DUTY_5))
+									{
+										DEBUG_INFO("Wait CCS give up negotiagting.\n");
+										ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_CP_STATE_F;
+										ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = ON;
+										ShmDispenser->gun_info.ccsHandshakeState = HANDSHAKE_CP_STATE_E;
+										ShmDispenser->gun_info.chargingMode = CHARGING_MODE_BS;
+									}
+								}
+							}
+
+							break;
+						default:
+							break;
+					}
+				}
+				else if(ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEMode)
+				{
+					DEBUG_INFO("Enter Socket-E Mode charging.\n");
+					ShmDispenser->gun_info.chargingMode = CHARGING_MODE_SOCKETE;
+
+					refreshStartTimer(&startChargingTime);
+					setChargerMode(SYS_MODE_CHARGING);
+				}
+
+				// Unplug charging gun to Idle mode
+				if((ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_A) && (ShmDispenser->gun_info.isGunPlugged == YES))
+				{
+					DEBUG_INFO("Charging gun is plugged before.\n");
+					//Cancel CCS task negotiating
+					ShmDispenser->gun_info.acCcsInfo.ChargingPermission = OFF;
+					ShmDispenser->gun_info.acCcsInfo.EVSENotification = NOTIFICATION_STOP;
+					ShmDispenser->gun_info.isCCSWaitChangeDuty = ON;
+				}
+
+				if(getDiffSecNow(startTime[TMR_IDX_HANDSHAKING]) > ShmDispenser->timeoutSpec.Present_Timeout_Spec)
+				{
+					if(getDiffSecNow(startTime[TMR_IDX_HANDSHAKING]) > (ShmDispenser->timeoutSpec.Present_Timeout_Spec+5))
+					{
+						DEBUG_INFO("Handshaking timeout...\n");
+
+						//Cancel CCS task negotiating
+						ShmDispenser->gun_info.acCcsInfo.ChargingPermission = OFF;
+						ShmDispenser->gun_info.acCcsInfo.EVSENotification = NOTIFICATION_STOP;
+						ShmDispenser->gun_info.isCCSWaitChangeDuty = ON;
+					}
+				}
+
+				if(((ShmDispenser->gun_info.isCCSWaitChangeDuty == ON) && ShmDispenser->gun_info.acCcsInfo.CpSetPWMDuty != CCS_PWM_DUTY_5) ||
+					!ShmDispenser->gun_info.legacyRequest.isLegacyRequest)
+				{
+					ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
+					ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = ON;
+					ShmDispenser->gun_info.isCCSWaitChangeDuty = OFF;
+
+					setChargerMode(SYS_MODE_IDLE);
+				}
+				break;
+
+			case SYS_MODE_CHARGING:
+				if(isModeChange())
+				{
+					refreshStartTimer(&startTime[TMR_IDX_LOGPPRINTOUT]);
+					refreshStartTimer(&startTime[TMR_IDX_PROFILE_PREPARE]);
+					refreshStartTimer(&startTime[TMR_IDX_PWN_CHANGE]);
+
+					ShmDispenser->gun_info.isChargerStopByCondition = NO;
+					ShmDispenser->gun_info.resultAuthorization = DEFAULT_RFID;
+				}
+
+				//if time up, clear CCS MSG count
+				if((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_HLC) &&
+				   (getDiffSecNow(startTime[TMR_IDX_CCS_HEARTBEAT_COUNT_RESET]) > TIMEOUT_SPEC_CCS_HEARTBEAT_COUNT_RESET))
+				{
+					refreshStartTimer(&startTime[TMR_IDX_CCS_HEARTBEAT_COUNT_RESET]);
+					if(ShmDispenser->gun_info.acCcsInfo.CcsHeartBeat > 0)
+					{
+						ShmDispenser->gun_info.acCcsInfo.CcsHeartBeat = 0;
+					}
+					else
+					{
+						DEBUG_INFO("CCS could not get MSG from car.\n");
+
+						//setChargerMode(SYS_MODE_TERMINATING);
+						//setRelay(OFF);
+					}
+				}
+
+				if(!ShmDispenser->gun_info.legacyRequest.isLegacyRequest ||
+				   ((ShmDispenser->gun_info.chargingMode != CHARGING_MODE_SOCKETE) && ShmDispenser->gun_info.primaryMcuState.cp_state != CP_STATE_C) ||
+				   ((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_SOCKETE) && !ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn) ||
+				   ((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_HLC) && (ShmDispenser->gun_info.acCcsInfo.EVChargeProgress == HLC_STOP_MODE)) ||
+				   ((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_HLC) && ShmDispenser->gun_info.acCcsInfo.EVChargeProgress == HLC_RENEGOTIATE_MODE) ||
+				   ((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_HLC) && ShmDispenser->gun_info.acCcsInfo.EVChargeProgress == HLC_STANDBY_MODE))
+				{
+					setChargerMode(SYS_MODE_TERMINATING);
+					//setRelay(gun_index, OFF);
+				}
+				else
+				{
+					// Charging session info calculation
+					refreshStartTimer(&endChargingTime);
+					ShmDispenser->gun_info.PresentChargedDuration = getDiffSecBetween(startChargingTime, endChargingTime);
+					presentChargedEnergyUpdate();
+
+					// Determine max charging current to MCU
+					if(ShmDispenser->gun_info.chargingMode == CHARGING_MODE_BS)
+					{
+						if(getDiffSecNow(startTime[TMR_IDX_PWN_CHANGE]) > TIMEOUT_SPEC_PWN_CHANGE)
+						{
+							if((6 <= ShmDispenser->gun_info.targetCurrent))
+							{
+								ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = ((ShmDispenser->gun_info.targetCurrent > ShmDispenser->gun_info.primaryMcuState.rating_current)?ShmDispenser->gun_info.primaryMcuState.rating_current:ShmDispenser->gun_info.targetCurrent);
+							}
+							else if((1 <= ShmDispenser->gun_info.targetCurrent) && (ShmDispenser->gun_info.targetCurrent < 6))
+							{
+								ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = 6;
+							}
+							else
+							{
+								ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = 100;
+							}
+
+							ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = YES;
+							refreshStartTimer(&startTime[TMR_IDX_PWN_CHANGE]);
+						}
+					}
+					else if(ShmDispenser->gun_info.chargingMode == CHARGING_MODE_HLC)
+					{
+						ShmDispenser->gun_info.acCcsInfo.EVSEMaxCurrent = (float)((ShmDispenser->gun_info.targetCurrent > ShmDispenser->gun_info.primaryMcuState.rating_current)?ShmDispenser->gun_info.primaryMcuState.rating_current:ShmDispenser->gun_info.targetCurrent);
+					}
+
+					// Debug information
+					if(getDiffSecNow(startTime[TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+					{
+						DEBUG_INFO("================================================\n");
+						DEBUG_INFO("gun_info.primaryMcuCp_Pwn_Duty.max_current: %d\n", ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current);
+						DEBUG_INFO("gun_info.targetCurrent: %d\n", ShmDispenser->gun_info.targetCurrent);
+						DEBUG_INFO("================================================\n");
+						refreshStartTimer(&startTime[TMR_IDX_LOGPPRINTOUT]);
+
+						getDateTimeString((char*)ShmDispenser->gun_info.StopDateTime);
+					}
+				}
+
+				break;
+			case SYS_MODE_TERMINATING:
+				if(isModeChange())
+				{
+					getDateTimeString((char*)ShmDispenser->gun_info.StopDateTime);
+				}
+
+				refreshStartTimer(&endChargingTime);
+				if(ShmDispenser->gun_info.PresentChargedDuration != 0)
+				{
+					ShmDispenser->gun_info.PresentChargedDuration = getDiffSecBetween(startChargingTime, endChargingTime);
+				}
+
+				// End authorize pass
+				if(!ShmDispenser->gun_info.legacyRequest.isLegacyRequest ||
+				   ((ShmDispenser->gun_info.chargingMode != CHARGING_MODE_SOCKETE) && (ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_A)) ||
+				   ((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_SOCKETE) && !ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn) ||
+				   ((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_HLC) && (ShmDispenser->gun_info.acCcsInfo.EVChargeProgress == HLC_STOP_MODE)))
+				{
+					if(ShmDispenser->gun_info.chargingMode == CHARGING_MODE_BS)
+					{
+						ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
+						ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = ON;
+						sleep(1);
+						setChargerMode(SYS_MODE_COMPLETE);
+					}
+					else if(ShmDispenser->gun_info.chargingMode == CHARGING_MODE_HLC)
+					{
+						//setChargerMode(gun_index, SYS_MODE_COMPLETE);
+						//Cancel CCS task negotiating
+						ShmDispenser->gun_info.acCcsInfo.ChargingPermission = OFF;
+						ShmDispenser->gun_info.acCcsInfo.EVSENotification = NOTIFICATION_STOP;
+						ShmDispenser->gun_info.isCCSWaitChangeDuty = ON;
+					}
+					else
+					{
+						setChargerMode(SYS_MODE_COMPLETE);
+					}
+				}
+				else
+				{
+					// Debug information
+					if(getDiffSecNow(startTime[TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+					{
+						DEBUG_INFO("=============================================================\n");
+						DEBUG_INFO("ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current: %d\n", ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current);
+						DEBUG_INFO("ShmDispenser->gun_info.targetCurrent: %d\n", ShmDispenser->gun_info.targetCurrent);
+						DEBUG_INFO("=============================================================\n");
+						refreshStartTimer(&startTime[TMR_IDX_LOGPPRINTOUT]);
+					}
+
+
+					if(ShmDispenser->gun_info.legacyRequest.isLegacyRequest &&
+					   (((ShmDispenser->gun_info.chargingMode != CHARGING_MODE_SOCKETE) && (ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_C)) || ((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_SOCKETE) && ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn)) &&
+					   (((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_HLC) && (ShmDispenser->gun_info.acCcsInfo.EVChargeProgress == HLC_START_MODE)) || (ShmDispenser->gun_info.chargingMode == CHARGING_MODE_BS))
+					  )
+					{
+						setChargerMode(SYS_MODE_CHARGING);
+					}
+				}
+
+				if((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_HLC) &&
+				   (ShmDispenser->gun_info.isCCSWaitChangeDuty == ON) &&
+				   (ShmDispenser->gun_info.acCcsInfo.CpSetPWMDuty == CCS_PWM_DUTY_100))
+				{
+					DEBUG_INFO("Set PWM duty 100%% go to SYS_MODE_TERMINATING.\n");
+
+					ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
+					ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = ON;
+					ShmDispenser->gun_info.isCCSWaitChangeDuty = OFF;
+					setChargerMode( SYS_MODE_COMPLETE);
+				}
+
+				break;
+			case SYS_MODE_COMPLETE:
+				if(isModeChange())
+				{}
+
+				if(((ShmDispenser->gun_info.chargingMode != CHARGING_MODE_SOCKETE) && (ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_A)) ||
+				   ((ShmDispenser->gun_info.chargingMode == CHARGING_MODE_SOCKETE) && (!ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn)))
+				{
+					setChargerMode(SYS_MODE_IDLE);
+				}
+
+				break;
+			case SYS_MODE_ALARM:
+				if((ShmDispenser->gun_info.systemAlarmCode.SystemAlarmCode == 0))
+				{
+					if((ShmDispenser->gun_info.PreviousSystemStatus == SYS_MODE_CHARGING) ||
+					   (ShmDispenser->gun_info.PreviousSystemStatus == SYS_MODE_TERMINATING))
+					{
+						setChargerMode(ShmDispenser->gun_info.PreviousSystemStatus);
+					}
+					else
+					{
+						setChargerMode(SYS_MODE_IDLE);
+					}
+				}
+
+				break;
+			case SYS_MODE_FAULT:
+				if(isModeChange())
+				{}
+
+				break;
+			case SYS_MODE_MAINTAIN:
+				if(isModeChange())
+				{}
+
+				if(ShmDispenser->gun_info.isOperactive)
+				{
+					DEBUG_INFO("Connector change to operactive.\n");
+					setChargerMode(SYS_MODE_IDLE);
+				}
+
+				break;
+			case SYS_MODE_UPDATE:
+				if(isModeChange())
+				{}
+
+				break;
+			case SYS_MODE_DEBUG:
+				if(isModeChange())
+				{}
+
+				break;
+		}
+
+		usleep(100000);
+	}
+
+	return -1;
+}

+ 55 - 0
EVSE/Projects/AX80/Apps/Module_Dispenser.h

@@ -0,0 +1,55 @@
+/*
+ * Module_Dispenser.h
+ *
+ *  Created on: 2021/10/26
+ *      Author: folus
+ */
+
+#ifndef MODULE_DISPENSER_H_
+#define MODULE_DISPENSER_H_
+
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include 	<sys/types.h>
+#include 	<sys/socket.h>
+#include 	<netinet/in.h>
+#include 	<netdb.h>
+#include 	<error.h>
+#include 	<signal.h>
+#include	<stdint.h>
+#include	"define.h"
+#include 	"main.h"
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+
+extern int StoreLogMsg(const char *fmt, ...);
+
+#endif /* MODULE_DISPENSER_H_ */

+ 363 - 0
EVSE/Projects/AX80/Apps/Module_EventLogging.c

@@ -0,0 +1,363 @@
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>      /*標準輸入輸出定義*/
+#include    <stdlib.h>     /*標準函數庫定義*/
+#include    <unistd.h>     /*Unix 標準函數定義*/
+#include    <fcntl.h>      /*檔控制定義*/
+#include    <termios.h>    /*PPSIX 終端控制定義*/
+#include    <errno.h>      /*錯誤號定義*/
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include	"define.h"
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define EVENT_INFO(format, args...) StoreEventLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+
+
+#define Debug
+#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define PASS				1
+#define FAIL				-1
+
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData 			*ShmStatusCodeData;
+
+void trim(char *s);
+int mystrcmp(char *p1,char *p2);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+void split(char **arr, char *str, const char *del);
+
+
+#ifdef SystemLogMessage
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	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.%06ld]%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,tv.tv_usec,
+			buffer,
+			tm->tm_year+1900,tm->tm_mon+1);
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+
+	return rc;
+}
+#endif
+
+int StoreEventLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
+	{
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/EventLog/[%04d.%02d]%s_%s_EventLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1,
+					ShmSysConfigAndInfo->SysConfig.ModelName,
+					ShmSysConfigAndInfo->SysConfig.SerialNumber);
+	}
+	else
+	{
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%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,tv.tv_usec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1);
+	}
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+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;
+}
+
+//=================================
+// Common routine
+//=================================
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+int mystrcmp(char *p1,char *p2)
+{
+    while(*p1==*p2)
+    {
+        if(*p1=='\0' || *p2=='\0')
+            break;
+        p1++;
+        p2++;
+    }
+    if(*p1=='\0' && *p2=='\0')
+        return(PASS);
+    else
+        return(FAIL);
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+void split(char **arr, char *str, const char *del)
+{
+	char *s = strtok(str, del);
+
+	while(s != NULL)
+	{
+		*arr++ = s;
+		s = strtok(NULL, del);
+	}
+}
+
+
+//==========================================
+// Init all share memory
+//==========================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//creat ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
+    {
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		#endif
+		result = FAIL;
+	}
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	#ifdef SystemLogMessage
+    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+		#endif
+    	result = FAIL;
+   	 }
+    else
+    {}
+
+   	//creat ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
+    {
+		#ifdef SystemLogMessage
+   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+		#endif
+   		result = FAIL;
+	}
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	#ifdef SystemLogMessage
+    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+		#endif
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	//creat ShmStatusCodeData
+	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmStatusCodeData NG");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmat ShmStatusCodeData NG");
+		#endif
+		result = FAIL;
+	}
+	else
+	{}
+	memset(ShmStatusCodeData,0,sizeof(struct StatusCodeData));
+
+    return result;
+}
+
+//================================================
+// Main process
+//================================================
+int main(void)
+{
+	int ByteCount,BitCount;
+	unsigned char tmp, EventCodeTmp[7];
+
+	if(InitShareMemory() == FAIL)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("InitShareMemory NG\n");
+		#endif
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
+		}
+		sleep(5);
+		return 0;
+	}
+
+	for(;;)
+	{
+		//check Fault Status
+		for(ByteCount=0;ByteCount<5;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]&=~(1<<BitCount);
+						}
+						else
+							ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount]|=(1<<BitCount);
+						EVENT_INFO("%s\n", EventCodeTmp);
+					}
+				}
+			}
+		}
+
+		//check Alarm Status
+		for(ByteCount=0;ByteCount<12;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);
+						EVENT_INFO("%s\n", EventCodeTmp);
+					}
+				}
+			}
+		}
+
+		//check Info Status
+		for(ByteCount=0;ByteCount<40;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);
+						EVENT_INFO("%s\n", EventCodeTmp);
+					}
+				}
+			}
+		}
+
+		usleep(100000);
+	}
+
+	return FAIL;
+}

+ 445 - 0
EVSE/Projects/AX80/Apps/Module_FactoryConfig.c

@@ -0,0 +1,445 @@
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include	"define.h"
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
+
+#define Debug
+#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define PASS				1
+#define FAIL				-1
+#define OUTPUT_FLASH		0x01
+#define OUTPUT_FILE			0x02
+
+
+struct SysConfigData 			SysConfig;
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData 			*ShmStatusCodeData;
+struct FanModuleData			*ShmFanModuleData;
+void trim(char *s);
+int mystrcmp(char *p1,char *p2);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+void split(char **arr, char *str, const char *del);
+
+
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]-%s\" >> /Storage/SystemLog/[%04d.%02d]Module_FactoryConfig",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
+
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld] - %s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+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;
+}
+
+//=================================
+// Common routine
+//=================================
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+int mystrcmp(char *p1,char *p2)
+{
+    while(*p1==*p2)
+    {
+        if(*p1=='\0' || *p2=='\0')
+            break;
+        p1++;
+        p2++;
+    }
+    if(*p1=='\0' && *p2=='\0')
+        return(PASS);
+    else
+        return(FAIL);
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+void split(char **arr, char *str, const char *del)
+{
+	char *s = strtok(str, del);
+
+	while(s != NULL)
+	{
+		*arr++ = s;
+		s = strtok(NULL, del);
+	}
+}
+
+int runShellCmd(const char*cmd)
+{
+	int result = FAIL;
+	char buf[256];
+	FILE *fp;
+
+	fp = popen(cmd, "r");
+	if(fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			DEBUG_INFO("%s\n", buf);
+		}
+
+		result = PASS;
+	}
+	pclose(fp);
+
+	return result;
+}
+
+//==========================================
+// Init all share memory
+//==========================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//creat ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+
+		result = FAIL;
+	}
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+
+    	result = FAIL;
+   	 }
+    else
+    {}
+
+   	 //creat ShmStatusCodeData
+   	 if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+
+   		result = FAIL;
+	}
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+
+    	result = FAIL;
+   	}
+    else
+    {}
+
+    return result;
+}
+
+void helpOutput(void)
+{
+	printf("Usage: Module_FactoryConfig [OPTION]...\n\n");
+	printf("Generate factory default configuration value\n\n");
+	printf("OPTION:\n");
+	printf("	-a Write to file(/mnt) & flash\n");
+	printf("	-f Write to file(/mnt)\n");
+	printf("	-m Write to flash\n");
+}
+
+//================================================
+// Main process
+//================================================
+int main(int argc, char *argv[])
+{
+	unsigned char outType=0;
+	unsigned int i,Chk,MtdBlockSize=0x300000;
+	unsigned char *ptr;
+	int fd,wrd;
+
+	ptr=malloc(MtdBlockSize);
+	if(ptr==NULL)
+	{
+		#ifdef SystemLogMessage
+		StoreLogMsg("[FactoryConfig]main: malloc for SysConfigData NG");
+		#endif
+		return 0;
+	}
+	memset(ptr,0,MtdBlockSize);
+	memset(&SysConfig,0,sizeof(struct SysConfigData));
+
+	/*
+	 * TODO: Set factory default configuration
+	 */
+	// System configuration
+	time_t t = time(NULL);
+	struct tm tm = *localtime(&t);
+	
+	// Initial Share Memory
+	if(InitShareMemory() == FAIL)
+	{
+		DEBUG_ERROR("InitShareMemory NG\n");
+
+		strcpy((char*)SysConfig.ModelName, "");
+		strcpy((char*)SysConfig.SerialNumber, "");
+		sleep(5);
+	}
+	else
+	{
+		memcpy((char*)SysConfig.ModelName, ShmSysConfigAndInfo->SysConfig.ModelName, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
+		memcpy((char*)SysConfig.SerialNumber, ShmSysConfigAndInfo->SysConfig.SerialNumber, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
+		memcpy((char*)SysConfig.CsuBootLoadFwRev, ShmSysConfigAndInfo->SysConfig.CsuBootLoadFwRev, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.CsuBootLoadFwRev));
+
+		DEBUG_INFO("InitShareMemory OK.\n");
+	}
+	
+	sprintf((char*)SysConfig.SystemId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
+	sprintf((char*)SysConfig.SystemDateTime, "%d-%d-%d %d:%d:%d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+	SysConfig.AuthorisationMode = 0;		// 0: enable, 1: disable
+	SysConfig.DefaultLanguage  = 0;			// 0: English 1: Big5 2: GB 3: JN 4: Français 5: Italiano 6: Español 7: Deutsch 8: Nederland 9: Norsk 10: Suomalainen 11: Svenska 12: Pусский 13: ไทย
+	SysConfig.RfidCardNumEndian = 0;		// 0: Little endian 1: Big endian
+	SysConfig.BillingData.isBilling = 0;	// 0: not for business	1: for business
+	SysConfig.isQRCode = 1;					// for AuthorisationMode = 0; 0:false, 1:true
+	SysConfig.isRFID = 1;					// for AuthorisationMode = 0; 0:false, 1:true
+	SysConfig.isAPP = 0;					// for AuthorisationMode = 0; 0:false, 1:true
+
+	// Charging configuration
+	SysConfig.MaxChargingEnergy = 0;		// 0: No limit	Other: 1~65536 KWH
+	SysConfig.MaxChargingPower = 0;			// 0: No limit	Other: 1~65536 KW
+	SysConfig.MaxChargingCurrent = 0;		// 0: Rating value	Other: 1~Rating A
+	SysConfig.MaxChargingDuration = 0;		// 0: No limit	Other: 1~65536 Minute
+	SysConfig.PhaseLossPolicy = 0;			// 0: Charging	1: Stop charging
+	SysConfig.AcPhaseCount = 1;				// 1: One phase	3: Three phase
+
+	// Network configuration
+	strcpy((char*)SysConfig.FtpServer, "");
+	SysConfig.Eth0Interface.EthDhcpClient = 0;
+	strcpy((char*)SysConfig.Eth0Interface.EthIpAddress, "192.168.1.10");
+	strcpy((char*)SysConfig.Eth0Interface.EthSubmaskAddress, "255.255.255.0");
+	strcpy((char*)SysConfig.Eth0Interface.EthGatewayAddress, "192.168.1.254");
+
+	SysConfig.Eth1Interface.EthDhcpClient = 0;
+	strcpy((char*)SysConfig.Eth1Interface.EthIpAddress, "192.168.0.10");
+	strcpy((char*)SysConfig.Eth1Interface.EthSubmaskAddress, "255.255.255.0");
+	strcpy((char*)SysConfig.Eth1Interface.EthGatewayAddress, "192.168.0.254");
+
+	// Wifi configuration
+	SysConfig.AthInterface.WifiMode = 2;								// 0: Disable 1: Infrastructure client 2: Infrastructure server	3: Ad-Hoc
+	SysConfig.AthInterface.WifiRssi = 0;								// Wifi rssi value
+	strcpy((char *) SysConfig.AthInterface.WifiSsid, "");				// default: Null
+	strcpy((char *) SysConfig.AthInterface.WifiPassword, "");			// default: Null
+	SysConfig.AthInterface.WifiDhcpServer = 0;							// 0: Enable 1: Disable
+	SysConfig.AthInterface.WifiDhcpClient = 0;							// 0: Enable 1: Disable
+
+	// Telecom configuration
+	strcpy((char*)SysConfig.TelecomInterface.TelcomApn, "");			// default: Null
+	SysConfig.TelecomInterface.TelcomEnabled = 1; 						// 0: disable, 1: enable
+	SysConfig.TelecomInterface.TelcomRssi = 0;							// default: 0
+	SysConfig.TelecomInterface.TelcomSimStatus = 0;						// SIM card status
+	SysConfig.TelecomInterface.TelcomModemMode = 0;						// 0: No services 1: CDMA 2: GSM/GPRS 3: WCDMA 4: GSM/WCDMA 5: TD_SCDMA 6: Unknown
+	strcpy((char *) SysConfig.TelecomInterface.TelcomChapPapId, "");	// default: Null
+	strcpy((char *) SysConfig.TelecomInterface.TelcomChapPapPwd, "");	// default: Null
+	strcpy((char *) SysConfig.TelecomInterface.TelcomModemImei, "");	// default: Null
+	strcpy((char *) SysConfig.TelecomInterface.TelcomSimImsi, "");		// default: Null
+	strcpy((char *) SysConfig.TelecomInterface.TelcomSimIccid, "");		// default: Null
+
+	// Backend configuration
+	strcpy((char*)SysConfig.OcppServerURL, "");
+	sprintf((char*)SysConfig.ChargeBoxId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
+	strcpy((char *)SysConfig.chargePointVendor, "");	// default: Null
+	SysConfig.BackendConnTimeout=300; 		// 300 seconds
+	SysConfig.OfflinePolicy = 2;			// 0: local list, 1: Phihong RFID tag, 2: free charging, 3: no charging
+	SysConfig.OfflineMaxChargeEnergy = 0;	// 0: Same as MaxChargeEnergy	Other: 1~65535KWH
+	SysConfig.OfflineMaxChargeDuration = 0; // 0: Same as MaxChargeDuration Other: 1~65535 minutes
+	SysConfig.isReqFirstUpgrade = 1;		// 0: Skip first upgrade, 	1: Process first upgrade
+
+	// Customization configuration item
+	if(strstr((char*)&SysConfig.ModelName[12], "P0") != NULL)
+	{
+		strcpy((char*)SysConfig.OcppServerURL, "");
+		sprintf((char*)SysConfig.ChargeBoxId, "%s%s", SysConfig.ModelName, SysConfig.SerialNumber);
+		strcpy((char *)SysConfig.chargePointVendor, "");
+	}
+	else
+	{
+
+	}
+
+	// Copy default configuration to pointer
+	memcpy(ptr,&SysConfig,sizeof(struct SysConfigData));
+
+	// Calculate CRC
+	Chk=0;
+	for(i=ARRAY_SIZE(SysConfig.CsuBootLoadFwRev);i<(MtdBlockSize-4);i++)
+	{
+		Chk+=*(ptr+i);
+	}
+	memcpy(ptr+MtdBlockSize-4, &Chk, 4);
+
+	/*
+	 * Parameter process
+	 */
+	if(argc>1)
+	{
+		char *arg = argv[1];
+		switch(arg[0])
+		{
+			case '-':
+				switch(arg[1])
+				{
+					case 'a':
+						outType |= OUTPUT_FILE;
+						outType |= OUTPUT_FLASH;
+						break;
+					case 'f':
+						outType |= OUTPUT_FILE;
+						break;
+					case 'm':
+						outType |= OUTPUT_FLASH;
+						break;
+					default:
+						helpOutput();
+						break;
+				}
+				break;
+			default:
+				helpOutput();
+				break;
+		}
+	}
+	else
+	{
+		helpOutput();
+	}
+
+	/*
+	 * Configuration bin file generate
+	 */
+	// Save factory default setting value to file
+	fd = open("/mnt/FactoryDefaultConfig.bin", O_RDWR|O_CREAT|O_TRUNC);
+	if (fd < 0)
+	{
+
+		DEBUG_ERROR("open /mnt/FactoryDefaultConfig.bin NG\n");
+
+		free(ptr);
+		return 0;
+	}
+	wrd=write(fd, ptr, MtdBlockSize);
+	close(fd);
+	if(wrd<MtdBlockSize)
+	{
+		DEBUG_ERROR("write /mnt/FactoryDefaultConfig.bin NG\n");
+
+		free(ptr);
+		return 0;
+	}
+
+	DEBUG_INFO("FactoryConfig write to file in /mnt OK.\n");
+
+
+	/*
+	 * Flash memory write
+	 */
+	if((outType&OUTPUT_FLASH)>0)
+	{
+		DEBUG_INFO("Erase /dev/mtd10.\n");
+		runShellCmd("flash_erase /dev/mtd10 0 0");
+		DEBUG_INFO("Write /dev/mtd10.\n");
+		runShellCmd("nandwrite -p /dev/mtd10 /mnt/FactoryDefaultConfig.bin");
+
+		DEBUG_INFO("Erase /dev/mtd11.\n");
+		runShellCmd("flash_erase /dev/mtd11 0 0");
+		DEBUG_INFO("Write /dev/mtd11.\n");
+		runShellCmd("nandwrite -p /dev/mtd11 /mnt/FactoryDefaultConfig.bin");
+
+		DEBUG_INFO("Erase /dev/mtd12.\n");
+		runShellCmd("flash_erase /dev/mtd12 0 0");
+		DEBUG_INFO("Write /dev/mtd12.\n");
+		runShellCmd("nandwrite -p /dev/mtd12 /mnt/FactoryDefaultConfig.bin");
+
+		system("rm -f /mnt/FactoryDefaultConfig.bin");
+
+		DEBUG_INFO("FactoryConfig write to flash OK\n");
+	}
+	free(ptr);
+
+	return PASS;
+}

+ 2855 - 0
EVSE/Projects/AX80/Apps/Module_InternalComm.c

@@ -0,0 +1,2855 @@
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include  	<sys/types.h>
+#include  	<sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include  	<stdio.h>
+#include  	<stdlib.h>
+#include  	<unistd.h>
+#include  	<fcntl.h>
+#include  	<termios.h>
+#include 	<errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include 	<math.h>
+#include	<limits.h>
+#include	"define.h"
+#include	"main.h"
+#include	"Module_InternalComm.h"
+
+//#define SIMULATION
+
+#define FAIL_SPEC_COMM		100
+#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define PASS				1
+#define FAIL				0
+#define ON					1
+#define OFF					0
+#define PRIORITY_HIGH		0
+#define PRIORITY_LOW		1
+
+struct DISPENSER				*ShmDispenser;
+
+uint16_t						stepIndex=21, logIndex;
+long long						tsLast, tsNow, tsPrintLog[2];
+uint64_t						tmpPowerConsumption;
+
+void trim(char *s);
+int mystrcmp(char *p1,char *p2);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+void split(char **arr, char *str, const char *del);
+
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]Module_InterCommLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+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;
+}
+
+long long current_timestamp()
+{
+    struct timeval te;
+    gettimeofday(&te, NULL); // get current time
+    long long milliseconds = te.tv_sec*1000LL + te.tv_usec/1000; // calculate milliseconds
+    return milliseconds;
+}
+
+//=================================
+// Common routine
+//=================================
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+int mystrcmp(char *p1,char *p2)
+{
+    while(*p1==*p2)
+    {
+        if(*p1=='\0' || *p2=='\0')
+            break;
+        p1++;
+        p2++;
+    }
+    if(*p1=='\0' && *p2=='\0')
+        return(PASS);
+    else
+        return(FAIL);
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+void split(char **arr, char *str, const char *del)
+{
+	char *s = strtok(str, del);
+
+	while(s != NULL)
+	{
+		*arr++ = s;
+		s = strtok(NULL, del);
+	}
+}
+
+int isGpioInitialized(unsigned int gpio)
+{
+	int result = FAIL;
+	char gpioPath[64];
+
+	sprintf(gpioPath, "/sys/class/gpio/gpio%d/value", gpio);
+	if((access(gpioPath, F_OK)) != -1)
+	{
+		result = PASS;
+	}
+
+	return result;
+}
+
+//==========================================
+// Init all share memory
+//==========================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//Initial ShmDispenser
+	if ((MeterSMId = shmget(ShmDispenserKey, sizeof(struct DISPENSER), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmDispenser NG\n");
+		result = FAIL;
+	}
+	else if ((ShmDispenser = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmat ShmDispenser NG\n");
+		#endif
+		result = FAIL;
+	}
+
+	return result;
+}
+
+int InitComPort()
+{
+	int fd;
+	struct termios tios;
+
+	fd = open("/dev/ttyS1", O_RDWR);
+	if(fd<=0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("open /dev/ttyS1 NG\n");
+		#endif
+		return -1;
+	}
+	ioctl (fd, TCGETS, &tios);
+	tios.c_cflag = B115200| CS8 | CLOCAL | CREAD;
+	tios.c_lflag = 0;
+	tios.c_iflag = 0;
+	tios.c_oflag = 0;
+	tios.c_cc[VMIN]=0;
+	tios.c_cc[VTIME]=(unsigned char)5;		// timeout 0.5 secod
+	tios.c_lflag=0;
+	tcflush(fd, TCIFLUSH);
+	ioctl (fd, TCSETS, &tios);
+
+	return fd;
+}
+
+void ack_delay(unsigned char cmd)
+{
+	switch(cmd)
+	{
+		case CMD_UPDATE_START:
+		case CMD_UPDATE_END:
+			usleep(300000);
+			break;
+		default:
+			usleep(100000);
+			break;
+	}
+}
+
+int tranceive(int fd, unsigned char* cmd, unsigned char cmd_len, unsigned char* rx)
+{
+	int len;
+
+	tcflush(fd,TCIOFLUSH);
+	if(write(fd, cmd, cmd_len) >= cmd_len)
+	{
+		ack_delay(cmd[3]);
+		len = read(fd, rx, 512);
+	}
+	else
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("Serial command %s response fail.\n", cmd);
+		#endif
+	}
+
+	return len;
+}
+
+unsigned char Query_FW_Ver(unsigned char fd, unsigned char targetAddr, Ver *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_FW_VER, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+			strncpy(Ret_Buf->Version_FW, (char *)rx+6, (rx[4] | rx[5]<<8));
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_HW_Ver(unsigned char fd, unsigned char targetAddr, Ver *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_HW_VER, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			strncpy(Ret_Buf->Version_HW, (char *)rx+6, (rx[4] | rx[5]<<8));
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Present_InputVoltage(unsigned char fd, unsigned char targetAddr, PresentInputVoltage *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_PRESENT_INPUTVOLTAGE, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			Ret_Buf->inputType = rx[6];
+			Ret_Buf->L1N_L12 =( rx[7] | (rx[8]<<8))/10.0;
+
+			if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+			{
+				Ret_Buf->L2N_L23 =( rx[9] | (rx[10]<<8))/10.0;
+				Ret_Buf->L3N_L31 =( rx[11] | (rx[12]<<8))/10.0;
+			}
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Present_OutputVoltage(unsigned char fd, unsigned char targetAddr, PresentOutputVoltage *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_PRESENT_OUTPUTVOLTAGE, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			Ret_Buf->behindFuse_Voltage_C1 =(rx[6] | (rx[7]<<8))/10.0;
+			Ret_Buf->behindRelay_Voltage_C1 =(rx[8] | (rx[9]<<8))/10.0;
+			if((rx[4] | rx[5]<<8) > 4)
+			{
+				Ret_Buf->behindFuse_Voltage_C2 =(rx[10] | (rx[11]<<8))/10.0;
+				Ret_Buf->behindRelay_Voltage_C2 =(rx[12] | (rx[13]<<8))/10.0;
+			}
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Fan_Speed(unsigned char fd, unsigned char targetAddr, FanSpeed *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_FAN_SPEED, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			for(int idx=0;idx<((rx[4] | rx[5]<<8)>>1);idx++)
+				Ret_Buf->speed[idx] =(rx[6+(2*idx)] | (rx[6+(2*idx)+1]<<8));
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Temperature(unsigned char fd, unsigned char targetAddr, Temperature *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_TEMPERATURE, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+				Ret_Buf->point[idx] = rx[6+idx] - 60;
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Aux_PowerVoltage(unsigned char fd, unsigned char targetAddr, AuxPower *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_AUX_POWERVOLTAGE, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+				Ret_Buf->voltage[idx] = rx[6+idx];
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Relay_Output(unsigned char fd, unsigned char targetAddr, Relay *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_RELAY_OUTPUT, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			for(int idx_connector=0;idx_connector<(rx[4] | rx[5]<<8);idx_connector++)
+			{
+				for(int idx=0;idx<8;idx++)
+					Ret_Buf->relay_status[idx_connector][idx] = (rx[6+idx_connector]>>idx) & 0x01;
+			}
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Gfd_Adc(unsigned char fd, unsigned char targetAddr, Gfd *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_GFD_ADC, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			for(int idx_connector=0;idx_connector<((rx[4] | rx[5]<<8)>>2);idx_connector++)
+			{
+				Ret_Buf->adc_value_positive[idx_connector] = (rx[6+(4*idx_connector)] | rx[6+(4*idx_connector)+1]<<8);
+				Ret_Buf->adc_value_negative[idx_connector] = (rx[6+(4*idx_connector)+2] | rx[6+(4*idx_connector)+3]<<8);;
+			}
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Gpio_Input(unsigned char fd, unsigned char targetAddr, Gpio_in *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_GPIO_INPUT, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			Ret_Buf->AC_Connector 		= (rx[6] >> 0) & 0x01;
+			Ret_Buf->AC_MainBreaker 	= (rx[6] >> 1) & 0x01;
+			Ret_Buf->SPD 				= (rx[6] >> 2) & 0x01;
+			Ret_Buf->Door_Open 			= (rx[6] >> 3) & 0x01;
+			Ret_Buf->GFD[0] 			= (rx[6] >> 4) & 0x01;
+			Ret_Buf->GFD[1] 			= (rx[6] >> 5) & 0x01;
+			Ret_Buf->Button[0] 			= (rx[6] >> 6) & 0x01;
+			Ret_Buf->Button[1] 			= (rx[6] >> 7) & 0x01;
+			Ret_Buf->Button_Emergency	= (rx[7] >> 0) & 0x01;
+			Ret_Buf->Button_Mode_Switch = (rx[7] >> 7) & 0x01;
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Alarm_Log(unsigned char fd, unsigned char targetAddr, Alarm_Log *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[10] = {0xaa, 0x00, targetAddr, CMD_QUERY_ALARM_LOG, 0x03, 0x00, Ret_Buf->logArea, Ret_Buf->alarmIndex&0xff, ((Ret_Buf->alarmIndex>>8)&0xff), 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = Ret_Buf->logArea ^ (Ret_Buf->alarmIndex&0xff) ^ ((Ret_Buf->alarmIndex>>8)&0xff);
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			memcpy(&Ret_Buf->log[0], &rx[8], 8);
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_RTC(unsigned char fd, unsigned char targetAddr, Rtc *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_RTC, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			Ret_Buf->year = ((rx[6]-'0')*1000) + ((rx[7]-'0')*100) + ((rx[8]-'0')*10) + ((rx[9]-'0')*1);
+			Ret_Buf->month = ((rx[10]-'0')*10) + ((rx[11]-'0')*1);
+			Ret_Buf->day = ((rx[12]-'0')*10) + ((rx[13]-'0')*1);
+			Ret_Buf->hour = ((rx[14]-'0')*10) + ((rx[15]-'0')*1);
+			Ret_Buf->min = ((rx[16]-'0')*10) + ((rx[17]-'0')*1);
+			Ret_Buf->sec = ((rx[18]-'0')*10) + ((rx[19]-'0')*1);
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_AC_MCU_Status(unsigned char fd, unsigned char targetAddr, Ac_Primary_Mcu *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_AC_STATUS, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			Ret_Buf->cp_state = rx[6];
+			Ret_Buf->current_limit = rx[7] | (rx[8]<<0x08);
+			Ret_Buf->cp_voltage_positive = (rx[9] | (rx[10]<<0x08))/100.0;
+			Ret_Buf->cp_voltage_negtive = (rx[11] | (rx[12]<<0x08))/100.0;
+			Ret_Buf->locker_state = rx[13];
+			Ret_Buf->relay_state = rx[14];
+			Ret_Buf->shutter_state = rx[15];
+			Ret_Buf->meter_state = rx[16];
+			Ret_Buf->pp_state = rx[17];
+			Ret_Buf->rating_current = rx[18];
+			Ret_Buf->rotatory_switch = (rx[19] & 0x0F);
+			Ret_Buf->socket_e.isSocketEMode = (rx[20] & 0x01);
+			Ret_Buf->socket_e.isSocketEPinOn = ((rx[20]>>1) & 0x01);
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_AC_MCU_Alarm(unsigned char fd, unsigned char targetAddr, Ac_Primary_Mcu_Alarm *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_AC_ALARM, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]))
+		{
+			//rx[6]
+			Ret_Buf->bits.OVP_L1 = (((rx[6]>>0)&0x01)?1:0);
+			Ret_Buf->bits.UVP_L1 = (((rx[6]>>1)&0x01)?1:0);
+			Ret_Buf->bits.OCP_L1 = (((rx[6]>>2)&0x01)?1:0);
+			Ret_Buf->bits.OTP = (((rx[6]>>3)&0x01)?1:0);
+			Ret_Buf->bits.gmi_fault = (((rx[6]>>4)&0x01)?1:0);
+			Ret_Buf->bits.cp_fault = (((rx[6]>>5)&0x01)?1:0);
+			Ret_Buf->bits.ac_leak = (((rx[6]>>6)&0x01)?1:0);
+			Ret_Buf->bits.dc_leak = (((rx[6]>>7)&0x01)?1:0);
+
+			//rx[7]
+			Ret_Buf->bits.mcu_selftest_fail = (((rx[7]>>0)&0x01)?1:0);
+			Ret_Buf->bits.handshaking_timeout = (((rx[7]>>1)&0x01)?1:0);
+			Ret_Buf->bits.emergency_stop = (((rx[7]>>2)&0x01)?1:0);
+			Ret_Buf->bits.relay_welding = (((rx[7]>>3)&0x01)?1:0);
+			Ret_Buf->bits.leak_module_fail = (((rx[7]>>4)&0x01)?1:0);
+			Ret_Buf->bits.shutter_fault = (((rx[7]>>5)&0x01)?1:0);
+			Ret_Buf->bits.locker_fault = (((rx[7]>>6)&0x01)?1:0);
+			Ret_Buf->bits.power_drop = (((rx[7]>>7)&0x01)?1:0);
+
+			//rx[8] bit 3 reserved
+			Ret_Buf->bits.short_circuit_L1 = (((rx[8]>>0)&0x01)?1:0);
+			Ret_Buf->bits.rotate_switch_fault = (((rx[8]>>1)&0x01)?1:0);
+			Ret_Buf->bits.relay_drive_fault = (((rx[8]>>2)&0x01)?1:0);
+			if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+			{
+				Ret_Buf->bits.OVP_L2 = (((rx[8]>>4)&0x01)?1:0);
+				Ret_Buf->bits.OVP_L3 = (((rx[8]>>5)&0x01)?1:0);
+				Ret_Buf->bits.UVP_L2 = (((rx[8]>>6)&0x01)?1:0);
+				Ret_Buf->bits.UVP_L3 = (((rx[8]>>7)&0x01)?1:0);
+			}
+
+			//rx[9] bits 6 & 7 Reserved
+			if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+			{
+				Ret_Buf->bits.OCP_L2 = (((rx[9]>>0)&0x01)?1:0);
+				Ret_Buf->bits.OCP_L3 = (((rx[9]>>1)&0x01)?1:0);
+				Ret_Buf->bits.short_circuit_L2 = (((rx[9]>>2)&0x01)?1:0);
+				Ret_Buf->bits.short_circuit_L3 = (((rx[9]>>3)&0x01)?1:0);
+			}
+			Ret_Buf->bits.meter_comm_timeout = (((rx[9]>>4)&0x01)?1:0);
+			Ret_Buf->bits.meter_ic_comm_timeout = (((rx[9]>>5)&0x01)?1:0);
+			Ret_Buf->bits.pilot_negative_error = (((rx[9]>>6)&0x01)?1:0);
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Present_OutputCurrent(unsigned char fd, unsigned char targetAddr, Presentoutputcurrent *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_PRESENT_OUTPUTCURRENT, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 0)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+			Ret_Buf->L1N_L12[0] = (rx[6] | (rx[7]<<8))/10.0;
+			if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+			{
+				Ret_Buf->L2N_L23[0] = (rx[8] | (rx[9]<<8))/10.0;
+				Ret_Buf->L3N_L31[0] = (rx[10] | (rx[11]<<8))/10.0;
+			}
+
+			Ret_Buf->L1N_L12[1] = (rx[12] | (rx[13]<<8))/10.0;
+			if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+			{
+				Ret_Buf->L2N_L23[1] = (rx[14] | (rx[15]<<8))/10.0;
+				Ret_Buf->L3N_L31[1] = (rx[16] | (rx[17]<<8))/10.0;
+			}
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Ble_Config(unsigned char fd, unsigned char targetAddr, Ble_Config_Data *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_BLE_CONFIG_DATA, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 0)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+			Ret_Buf->isLogin = (rx[6]?0x01:0x00);
+			Ret_Buf->isRequestStart = (rx[7]?0x01:0x00);
+			Ret_Buf->isRequestStop = (rx[8]?0x01:0x00);
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Ble_Central_ID(unsigned char fd, unsigned char targetAddr, Ble_Login_Central_Id *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_BLE_CENTRAL_ID, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 0)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+			memset(Ret_Buf->id, 0x00, ARRAY_SIZE(Ret_Buf->id));
+			memcpy(&Ret_Buf->id[0], &rx[6], (rx[4] | (rx[5]<<8)));
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_Power_Consumption(unsigned char fd, unsigned char targetAddr, Power_Consumption *Ret_Buf_T, Power_Consumption *Ret_Buf_L1, Power_Consumption *Ret_Buf_L2, Power_Consumption *Ret_Buf_L3)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_POWER_CONSUMPTION, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 0)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+#ifndef SIMULATION
+			Ret_Buf_T-> power_consumption = ((uint64_t)rx[6] | (((uint64_t)rx[7])<<8) | (((uint64_t)rx[8])<<16) | (((uint64_t)rx[9])<<24) | (((uint64_t)rx[10])<<32) | (((uint64_t)rx[11])<<40) | (((uint64_t)rx[12])<<48) | (((uint64_t)rx[13])<<56));
+			Ret_Buf_L1-> power_consumption = ((uint64_t)rx[14] | (((uint64_t)rx[15])<<8) | (((uint64_t)rx[16])<<16) | (((uint64_t)rx[17])<<24) | (((uint64_t)rx[18])<<32) | (((uint64_t)rx[19])<<40) | (((uint64_t)rx[20])<<48) | (((uint64_t)rx[21])<<56));
+			if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+			{
+				Ret_Buf_L2-> power_consumption = ((uint64_t)rx[22] | (((uint64_t)rx[23])<<8) | (((uint64_t)rx[24])<<16) | (((uint64_t)rx[25])<<24) | (((uint64_t)rx[26])<<32) | (((uint64_t)rx[27])<<40) | (((uint64_t)rx[28])<<48) | (((uint64_t)rx[29])<<56));
+				Ret_Buf_L3-> power_consumption = ((uint64_t)rx[30] | (((uint64_t)rx[31])<<8) | (((uint64_t)rx[32])<<16) | (((uint64_t)rx[33])<<24) | (((uint64_t)rx[34])<<32) | (((uint64_t)rx[35])<<40) | (((uint64_t)rx[36])<<48) | (((uint64_t)rx[37])<<56));
+			}
+
+#else	//SIMULATION
+			tsNow = current_timestamp();
+			tmpPowerConsumption += (uint64_t)((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingVoltage*ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingCurrent)*((tsNow-tsLast)/360000.0));
+			Ret_Buf_T-> power_consumption = tmpPowerConsumption;
+			tsLast = tsNow;
+#endif	//SIMULATION
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_MeterIc_CorrectionPara(unsigned char fd, unsigned char targetAddr, MeterIcCorrection *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[8] = {0xaa, 0x00, targetAddr, CMD_QUERY_METER_IC_CORRECTION_PARA, 0x01, 0x00, 0xb0, 0xb0};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[7] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 0)
+	{
+		if(len < (6+(rx[4] | rx[5]<<8)))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6]) == 0xb0)
+		{
+			uint32_t cali_flag = (rx[7] | (rx[8]<<8) | (rx[9]<<16) | (rx[10]<<24));
+
+			if(!(cali_flag & 0x80000000))
+			{
+				Ret_Buf->bits.isCalibratedVaGain = cali_flag & (1 << 0) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedVbGain = cali_flag & (1 << 1) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedVcGain = cali_flag & (1 << 2) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedVaOffset = cali_flag & (1 << 3) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedVbOffset = cali_flag & (1 << 4) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedVcOffset = cali_flag & (1 << 5) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedCaGain = cali_flag & (1 << 6) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedCbGain = cali_flag & (1 << 7) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedCcGain = cali_flag & (1 << 8) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedCaOffset = cali_flag & (1 << 9) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedCbOffset = cali_flag & (1 << 10) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedCcOffset = cali_flag & (1 << 11) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedPa = cali_flag & (1 << 12) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedPb = cali_flag & (1 << 13) ? 1 : 0;
+				Ret_Buf->bits.isCalibratedPc = cali_flag & (1 << 14) ? 1 : 0;
+			}
+			else
+			{
+				Ret_Buf->value = 0;
+			}
+
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Fan_Speed(unsigned char fd, unsigned char targetAddr, FanSpeed *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[15] = {0xaa, 0x00, targetAddr, CMD_CONFIG_FAN_SPEED, 0x08, 0x00, Set_Buf->speed[0]&0xff, (Set_Buf->speed[0]>>8)&0xff, Set_Buf->speed[1]&0xff, (Set_Buf->speed[1]>>8)&0xff, Set_Buf->speed[2]&0xff, (Set_Buf->speed[2]>>8)&0xff, Set_Buf->speed[3]&0xff, (Set_Buf->speed[3]>>8)&0xff, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[14] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+				return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Serial_Number(unsigned char fd, unsigned char targetAddr, Evse_Id *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[27] = {0xaa, 0x00, targetAddr, CMD_CONFIG_SERIAL_NUMBER, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	memcpy(&tx[14], &Set_Buf->serial_number[0], ARRAY_SIZE(Set_Buf->serial_number));
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[26] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Model_Name(unsigned char fd, unsigned char targetAddr, Evse_Id *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[21] = {0xaa, 0x00, targetAddr, CMD_CONFIG_MODEL_NAME, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	memcpy(&tx[6], &Set_Buf->model_name[0], ARRAY_SIZE(Set_Buf->model_name));
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[20] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Relay_Output(unsigned char fd, unsigned char targetAddr, Relay *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[15] = {0};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_RELAY_OUTPUT;
+	tx[4] = 0x08;
+	tx[5] = 0x00;
+	tx[6] = 0x00;
+	tx[7] = 0x00;
+	tx[8] = 0x00;
+
+	for(int idx_connector=0;idx_connector<2;idx_connector++)
+		for(int idx = 0;idx<8;idx++)
+			tx[9+idx_connector] |= ((Set_Buf->relay_status[idx_connector][idx]?0x01:0x00)<<idx);
+
+	tx[11] = 0x00;
+	tx[12] = 0x00;
+	tx[13] = 0x00;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[14] = chksum;
+
+	//for(int count = 0; count < ARRAY_SIZE(tx); count++)
+		//printf("TX[%d] : %x \n",count, tx[count]);
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Gpio_Output(unsigned char fd, unsigned char targetAddr, Gpio_out *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[9] = {0xaa, 0x00, targetAddr, CMD_CONFIG_GPIO_OUTPUT, 0x01, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[6] |= (Set_Buf->AC_Connector?0x01:0x00);
+
+	for(int idx=0;idx<2;idx++)
+		tx[6] |= (Set_Buf->Button_LED[idx]?0x01:0x00)<<(1+idx);
+
+	for(int idx=0;idx<4;idx++)
+			tx[6] |= (Set_Buf->System_LED[idx]?0x01:0x00)<<(3+idx);
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[8] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == tx[6]))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_RTC(unsigned char fd, unsigned char targetAddr, Rtc *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[21] = {0};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_RTC;
+	tx[4] = 0x0e;
+	tx[5] = 0x00;
+	tx[6] = ((Set_Buf->year)/1000)+'0';
+	tx[7] = ((Set_Buf->year)/100%10)+'0';
+	tx[8] = ((Set_Buf->year)/10%10)+'0';
+	tx[9] = ((Set_Buf->year)%10)+'0';
+	tx[10] = ((Set_Buf->month)/10)+'0';
+	tx[11] = ((Set_Buf->month)%10)+'0';
+	tx[12] = ((Set_Buf->day)/10)+'0';
+	tx[13] = ((Set_Buf->day)%10)+'0';
+	tx[14] = ((Set_Buf->hour)/10)+'0';
+	tx[15] = ((Set_Buf->hour)%10)+'0';
+	tx[16] = ((Set_Buf->min)/10)+'0';
+	tx[17] = ((Set_Buf->min)%10)+'0';
+	tx[18] = ((Set_Buf->sec)/10)+'0';
+	tx[19] = ((Set_Buf->sec)%10)+'0';
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[20] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_AC_MCU_LED(unsigned char fd, unsigned char targetAddr, Ac_Primary_Mcu_Led *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[12] = {0};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_AC_LED;
+	tx[4] = 0x05;
+	tx[5] = 0x00;
+	tx[6] = Set_Buf->mode;
+	tx[7] = ((Set_Buf->alarm_code>>0)&0xff);
+	tx[8] = ((Set_Buf->alarm_code>>8)&0xff);
+	tx[9] = ((Set_Buf->alarm_code>>16)&0xff);
+	tx[10] = ((Set_Buf->alarm_code>>24)&0xff);
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[11] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_AC_MCU_LEGACY_REQUEST(unsigned char fd, unsigned char targetAddr, Legacy_Request *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[9] = {0};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_LEGACY_REQUEST;
+	tx[4] = 0x02;
+	tx[5] = 0x00;
+	tx[6] = Set_Buf->isLegacyRequest;
+	tx[7] = 0x00;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[8] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_AC_MCU_RESET_REQUEST(unsigned char fd, unsigned char targetAddr, Mcu_Reset_Request *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[9] = {0};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_MCU_RESET_REQUEST;
+	tx[4] = 0x02;
+	tx[5] = 0x00;
+	tx[6] = Set_Buf->isMcuResetRequest;
+	tx[7] = 0x00;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[8] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]) &&
+		   (rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Query_AC_GUN_PLUGIN_TIMES(unsigned char fd, unsigned char targetAddr, Gun_Plugin_Times *Ret_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_QUERY_GUN_PLUGIN_TIMES, 0x00, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+		   (rx[2] == tx[1]) &&
+		   (rx[1] == tx[2]) &&
+		   (rx[3] == tx[3]))
+		{
+			Ret_Buf-> GunPluginTimes = ((uint32_t)rx[6] | (((uint32_t)rx[7])<<8) | (((uint32_t)rx[8])<<16) | (((uint32_t)rx[9])<<24));
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_AC_MaxCurrent_And_CpPwmDuty(unsigned char fd, unsigned char targetAddr, Ac_Primary_Mcu_Cp_Pwm_Duty *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[8] = {0};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_CURRENT_LINIT;
+	tx[4] = 0x01;
+	tx[5] = 0x00;
+	tx[6] = Set_Buf->max_current;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+			chksum ^= tx[6+idx];
+	tx[7] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			((rx[6] == 0x00) || (rx[6] == 0x01)))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_AC_Set_Breathe_Led_Timing(unsigned char fd, unsigned char targetAddr,Set_Breathe_Led_Timing *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[19] = {0};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_MCU_SET_BREATHE_LED_TIMING;
+	tx[4] = 0x0C;
+	tx[5] = 0x00;
+
+	// Increase LED_ACTION_CONNECTED
+	tx[6] = (Set_Buf->set_Led_Action_Connected_Fade_In & 0xff);
+	tx[7] = (Set_Buf->set_Led_Action_Connected_Fade_In >> 8);
+
+	// Decrease LED_ACTION_CONNECTED
+	tx[8] = (Set_Buf->set_Led_Action_Connected_Fade_Out & 0xff);
+	tx[9] = (Set_Buf->set_Led_Action_Connected_Fade_Out >> 8);
+
+	// Increase LED_ACTION_AUTHED
+	tx[10] = (Set_Buf->set_Led_Action_Authed_Fade_In & 0xff);
+	tx[11] = (Set_Buf->set_Led_Action_Authed_Fade_In >> 8);
+
+	// Decrease LED_ACTION_AUTHED
+	tx[12] = (Set_Buf->set_Led_Action_Authed_Fade_Out & 0xff);
+	tx[13] = (Set_Buf->set_Led_Action_Authed_Fade_Out >> 8);
+
+	// Increase_LED_ACTION_CHARGING
+	tx[14] = (Set_Buf->Set_Led_Action_Chaging_Fade_In & 0xff);
+	tx[15] = (Set_Buf->Set_Led_Action_Chaging_Fade_In >> 8);
+
+	// Decrease_LED_ACTION_CHARGING
+	tx[16] = (Set_Buf->set_Led_Action_Chaging_Fade_Out & 0xff);
+	tx[17] = (Set_Buf->set_Led_Action_Chaging_Fade_Out >> 8);
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[18] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_AC_Set_Led_Brightness(unsigned char fd, unsigned char targetAddr,Set_Led_Brightness *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[19] = {0};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_MCU_SET_LED_BRIGHTNESS;
+	tx[4] = 0x0C;
+	tx[5] = 0x00;
+	tx[6] = Set_Buf-> sector_1;			// 0~1 AM and 1~2 AM
+	tx[7] = Set_Buf-> sector_2;			// 2~3 AM and 3~4 AM
+	tx[8] = Set_Buf-> sector_3;			// 4~5 AM and 5~6 AM
+	tx[9] = Set_Buf-> sector_4;			// 6~7 AM and 7~8 AM
+	tx[10] = Set_Buf-> sector_5;		// 8~9 AM and 9~10 AM
+	tx[11] = Set_Buf-> sector_6;		// 10~11 AM and 11~12 AM
+	tx[12] = Set_Buf-> sector_7;		// 12~13 PM and 13~14 PM
+	tx[13] = Set_Buf-> sector_8;		// 14~15 PM and 15~16 PM
+	tx[14] = Set_Buf-> sector_9;		// 16~17 PM and 17~18 PM
+	tx[15] = Set_Buf-> sector_10;		// 18~19 PM and 19~20 PM
+	tx[16] = Set_Buf-> sector_11;		// 20~21 PM and 21~22 PM
+	tx[17] = Set_Buf-> sector_12;		// 22~23 PM and 23~24 PM
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+			chksum ^= tx[6+idx];
+	tx[18] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Config_Aux_Power_Switch(unsigned char fd, unsigned char targetAddr, Set_Aux_Power_Switch *Set_Buf)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[9];
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_CONFIG_AUX_POWER_SWITCH;
+	tx[4] = 0x02;
+	tx[5] = 0x00;
+	tx[6] = Set_Buf->power_type;			// 0~1 AM and 1~2 AM
+	tx[7] = Set_Buf->power_switch;			// 2~3 AM and 3~4 AM
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+			chksum ^= tx[6+idx];
+	tx[8] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Update_Start(unsigned char fd, unsigned char targetAddr, unsigned int crc32)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[11] = {0xaa, 0x00, targetAddr, CMD_UPDATE_START, 0x04, 0x00, (crc32>>0)&0xff, (crc32>>8)&0xff, (crc32>>16)&0xff, (crc32>>24)&0xff, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[10] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		chksum = 0x00;
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x00))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Update_Abord(unsigned char fd, unsigned char targetAddr)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_UPDATE_ABOARD, 0x04, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x00))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Update_Transfer(unsigned char fd, unsigned char targetAddr, unsigned int startAddr, unsigned char *data, unsigned short int length)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[11 + length];
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+
+	tx[0] = 0xaa;
+	tx[1] = 0x00;
+	tx[2] = targetAddr;
+	tx[3] = CMD_UPDATE_TRANSFER;
+	tx[4] = (4 + length) & 0xff;
+	tx[5] = ((4 + length)>>8) & 0xff;
+	tx[6] = (startAddr>>0) & 0xff;
+	tx[7] = (startAddr>>8) & 0xff;
+	tx[8] = (startAddr>>16) & 0xff;
+	tx[9] = (startAddr>>24) & 0xff;
+	memcpy(tx+10, data, length);
+
+	for(int idx=0;idx<(tx[4] | tx[5]<<8);idx++)
+		chksum ^= tx[6+idx];
+	tx[ARRAY_SIZE(tx)-1] = chksum;
+
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx = 0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x00))
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+unsigned char Update_Finish(unsigned char fd, unsigned char targetAddr)
+{
+	unsigned char result = FAIL;
+	unsigned char tx[7] = {0xaa, 0x00, targetAddr, CMD_UPDATE_END, 0x04, 0x00, 0x00};
+	unsigned char rx[512];
+	unsigned char chksum = 0x00;
+	unsigned char len = tranceive(fd, tx, sizeof(tx), rx);
+
+	if(len > 6)
+	{
+		if(len < 6+(rx[4] | rx[5]<<8))
+			return result;
+
+		for(int idx=0;idx<(rx[4] | rx[5]<<8);idx++)
+		{
+			chksum ^= rx[6+idx];
+		}
+
+		if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+			(rx[2] == tx[1]) &&
+			(rx[1] == tx[2]) &&
+			(rx[3] == tx[3]) &&
+			(rx[6] == 0x01))
+		{
+			result = PASS;
+		}
+	}
+	return result;
+}
+
+
+//================================================
+// Main process
+//================================================
+int main(void)
+{
+	int Uart1Fd;
+	unsigned short int failCount=0;
+	struct DISPENSER previousCharger;
+
+	if(InitShareMemory() == FAIL)
+	{
+		DEBUG_ERROR("InitShareMemory NG\n");
+		ShmDispenser->isInitialFail=1;
+		sleep(5);
+		return 0;
+	}
+	else
+	{
+		DEBUG_INFO("InitShareMemory OK.\n");
+	}
+
+	Uart1Fd=InitComPort();
+	if(Uart1Fd<0)
+	{
+		DEBUG_ERROR("InitComPort NG\n");
+		ShmDispenser->isInitialFail=1;
+		sleep(5);
+		return 0;
+	}
+	else
+	{
+		DEBUG_INFO("ttyS1 port open success.\n");
+	}
+
+	for(;;)
+	{
+		/*
+		 * Polling loop
+		 */
+		if((stepIndex%2)==0)
+		{
+			/*
+			 * High priority communication
+			 */
+
+			//===============================
+			// Case 1 : Config primary MCU LED
+			//===============================
+			ShmDispenser->gun_info.primaryMcuLed.alarm_code = ShmDispenser->gun_info.systemAlarmCode.SystemAlarmCode;
+			if(Config_AC_MCU_LED(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.primaryMcuLed))
+			{
+				failCount = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU set led fail...%d\n", failCount);
+				if(failCount<USHRT_MAX)
+					failCount++;
+				else
+					failCount = FAIL_SPEC_COMM;
+			}
+
+			//===============================
+			// Case 2 : Config primary Legacy request
+			//===============================
+			if(Config_AC_MCU_LEGACY_REQUEST(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.legacyRequest))
+			{
+				failCount = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU set request fail...%d\n", failCount);
+				if(failCount<USHRT_MAX)
+					failCount++;
+				else
+					failCount = FAIL_SPEC_COMM;
+			}
+
+			//===============================
+			// Case 2-X : Config primary Relay
+			//===============================
+			if(Config_Relay_Output(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.primaryMcuState.relayState))
+			{
+				failCount = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU set relay fail...%d\n", failCount);
+				if(failCount<USHRT_MAX)
+					failCount++;
+				else
+					failCount = FAIL_SPEC_COMM;
+			}
+
+			//===============================
+			// Case 3 : Query primary MCU status
+			//===============================
+			if(Query_AC_MCU_Status(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.primaryMcuState))
+			{
+				ShmDispenser->gun_info.PilotVoltage.PilotVoltagePositive = ShmDispenser->gun_info.primaryMcuState.cp_voltage_positive;
+				ShmDispenser->gun_info.PilotVoltage.PilotVoltageNegative = ShmDispenser->gun_info.primaryMcuState.cp_voltage_negtive;
+
+				//pass info 2 CCS task
+				if(ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_UNKNOWN)
+				{
+					if(ShmDispenser->gun_info.PilotVoltage.PilotVoltageNegative >= -12)
+					{
+						ShmDispenser->gun_info.acCcsInfo.CpPresentState = CCS_CP_STATE_G;
+					}
+					else
+					{
+						ShmDispenser->gun_info.acCcsInfo.CpPresentState = CCS_CP_STATE_H;
+					}
+				}
+				else if(ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_A)
+				{
+					ShmDispenser->gun_info.acCcsInfo.CpPresentState = CCS_CP_STATE_A;
+				}
+				else if(ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_B)
+				{
+					if(ShmDispenser->gun_info.PilotVoltage.PilotVoltageNegative == 0.0)
+					{
+						ShmDispenser->gun_info.acCcsInfo.CpPresentState = CCS_CP_STATE_B1;
+					}
+					else
+					{
+						ShmDispenser->gun_info.acCcsInfo.CpPresentState = CCS_CP_STATE_B2;
+					}
+				}
+				else if(ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_C)
+				{
+					ShmDispenser->gun_info.acCcsInfo.CpPresentState = CCS_CP_STATE_C;
+				}
+				else if(ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_D)
+				{
+					ShmDispenser->gun_info.acCcsInfo.CpPresentState = CCS_CP_STATE_D;
+				}
+				else if(ShmDispenser->gun_info.primaryMcuState.cp_state == CP_STATE_E)
+				{
+					ShmDispenser->gun_info.acCcsInfo.CpPresentState = CCS_CP_STATE_E;
+				}
+				else	//CP_STATE_F
+				{
+					ShmDispenser->gun_info.acCcsInfo.CpPresentState = CCS_CP_STATE_F;
+				}
+				ShmDispenser->gun_info.acCcsInfo.CpPositiveVoltage = ShmDispenser->gun_info.PilotVoltage.PilotVoltagePositive;
+				ShmDispenser->gun_info.acCcsInfo.CpNegativeVoltage = ShmDispenser->gun_info.PilotVoltage.PilotVoltageNegative;
+				ShmDispenser->gun_info.acCcsInfo.CpPresentPWMDuty = ShmDispenser->gun_info.primaryMcuState.current_limit;
+				
+				if(ShmDispenser->gun_info.primaryMcuState.relay_state)
+				{
+					ShmDispenser->gun_info.acCcsInfo.OutputRelayStatus = ON;
+				}
+				else
+				{
+					ShmDispenser->gun_info.acCcsInfo.OutputRelayStatus = OFF;
+				}
+
+				failCount = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU get status fail...%d\n", failCount);
+				if(failCount<USHRT_MAX)
+					failCount++;
+				else
+					failCount = FAIL_SPEC_COMM;
+			}
+
+			//===============================
+			// Case 4 : Query primary MCU Alarm code
+			//===============================
+			if(Query_AC_MCU_Alarm(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.primaryMcuAlarm))
+			{
+				//DEBUG_INFO("MCU-%d get alarm code success.\n",gun_index);
+
+				failCount = 0;
+				ShmDispenser->gun_info.acCcsInfo.CSUAlarmStatusCode = ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode;
+			}
+			else
+			{
+				DEBUG_WARN("MCU get alarm fail...%d\n", failCount);
+				if(failCount<USHRT_MAX)
+					failCount++;
+				else
+					failCount = FAIL_SPEC_COMM;
+			}
+
+			/*
+			//===============================
+			// Case 5 : Query primary MCU BLE config
+			//===============================
+			if(Query_Ble_Config(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].bleConfigData))
+			{
+				ShmSysConfigAndInfo->SysConfig.Bluetooth.isLogin = ShmCharger->gun_info[gun_index].bleConfigData.isLogin;
+				ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStart = ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart;
+				ShmSysConfigAndInfo->SysConfig.Bluetooth.isRequestStop = ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop;
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get ble config fail...%d\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<USHRT_MAX)
+					failCount[gun_index]++;
+				else
+					failCount[gun_index] = FAIL_SPEC_COMM;
+			}
+
+			//===============================
+			// Case 6 : Query primary MCU ble login id
+			//===============================
+			if(Query_Ble_Central_ID(Uart1Fd, (gun_index>0?ADDR_AC_PRIMARY_2:ADDR_AC_PRIMARY_1), &ShmCharger->gun_info[gun_index].bleLoginCentralId))
+			{
+				memcpy(ShmSysConfigAndInfo->SysConfig.Bluetooth.LoginCentralID, ShmCharger->gun_info[gun_index].bleLoginCentralId.id, sizeof ShmSysConfigAndInfo->SysConfig.Bluetooth.LoginCentralID);
+
+				failCount[gun_index] = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU-%d get ble login central id fail...%d\n", gun_index, failCount[gun_index]);
+				if(failCount[gun_index]<USHRT_MAX)
+					failCount[gun_index]++;
+				else
+					failCount[gun_index] = FAIL_SPEC_COMM;
+			}*/
+
+			//===============================
+			// Case 7 : Config primary MCU reset request
+			//===============================
+			if(isGpioInitialized(116) == PASS)
+			{
+				if(ShmDispenser->gun_info.mcuResetRequest.isMcuResetRequest == ON)
+				{
+					if(Config_AC_MCU_RESET_REQUEST(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.mcuResetRequest) == PASS)
+					{
+						DEBUG_INFO("*******************************************\n");
+						DEBUG_INFO("**** High priority polling : Case 7 *******\n");
+						DEBUG_INFO("*******************************************\n");
+						DEBUG_INFO("MCU set MCU reset Request : %d\n", ShmDispenser->gun_info.mcuResetRequest.isMcuResetRequest);
+
+						ShmDispenser->gun_info.mcuResetRequest.isMcuResetRequest = OFF;
+
+						failCount = 0;
+					}
+					else
+					{
+						DEBUG_WARN("MCU get MCU reset fail...%d\n", failCount);
+						if(failCount<USHRT_MAX)
+							failCount++;
+						else
+							failCount = FAIL_SPEC_COMM;
+					}
+				}
+			}
+
+			//===============================
+			// Case 8 : Config primary set CP PWN duty
+			//===============================
+			if(ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty == ON)
+			{
+				if(Config_AC_MaxCurrent_And_CpPwmDuty(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty))
+				{
+					failCount = 0;
+					ShmDispenser->gun_info.mcuFlag.isSetCpPwmDuty = OFF;
+				}
+				else
+				{
+					DEBUG_WARN("MCU set cp pwn duty fail...%d\n", failCount);
+					if(failCount<USHRT_MAX)
+						failCount++;
+					else
+						failCount = FAIL_SPEC_COMM;
+				}
+			}
+
+			//===============================
+			// Case 9 : Query GPIO
+			//===============================
+			if(Query_Gpio_Input(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.GPIO_Input))
+			{
+				failCount = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU get GPIO input fail...%d\n", failCount);
+				if(failCount<USHRT_MAX)
+					failCount++;
+				else
+					failCount = FAIL_SPEC_COMM;
+			}
+
+			//===============================
+			// Case 10 : Query primary MCU power consumption
+			//===============================
+			if(Query_Power_Consumption(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.powerConsumptionTotal, &ShmDispenser->gun_info.powerConsumption[0], &ShmDispenser->gun_info.powerConsumption[1], &ShmDispenser->gun_info.powerConsumption[2]))
+			{
+				failCount = 0;
+			}
+			else
+			{
+				DEBUG_WARN("MCU get power consumption fail...%d\n", failCount);
+				if(failCount<USHRT_MAX)
+					failCount++;
+				else
+					failCount = FAIL_SPEC_COMM;
+			}
+
+			//==========================================================
+			// High priority polling log print out
+			//==========================================================
+			if((current_timestamp() - tsPrintLog[PRIORITY_HIGH]) > (ShmDispenser->gun_info.legacyRequest.isLegacyRequest?3000:6000))
+			{
+				tsPrintLog[PRIORITY_HIGH] = current_timestamp();
+
+				//===============================
+				// Config primary MCU LED
+				//===============================
+				if((previousCharger.gun_info.primaryMcuLed.mode != ShmDispenser->gun_info.primaryMcuLed.mode) ||
+				   (previousCharger.gun_info.primaryMcuLed.alarm_code != ShmDispenser->gun_info.primaryMcuLed.alarm_code))
+				{
+					DEBUG_INFO("*******************************************\n");
+					DEBUG_INFO("***** High priority polling : Case 1 ******\n");
+					DEBUG_INFO("*******************************************\n");
+					DEBUG_INFO("MCU set Led mode : %d\n", ShmDispenser->gun_info.primaryMcuLed.mode);
+					DEBUG_INFO("MCU set Alarm code : %x\n", ShmDispenser->gun_info.primaryMcuLed.alarm_code);
+
+					previousCharger.gun_info.primaryMcuLed.mode = ShmDispenser->gun_info.primaryMcuLed.mode;
+					previousCharger.gun_info.primaryMcuLed.alarm_code = ShmDispenser->gun_info.primaryMcuLed.alarm_code;
+				}
+
+				//===============================
+				// Config primary Legacy request
+				//===============================
+				if(previousCharger.gun_info.legacyRequest.isLegacyRequest != ShmDispenser->gun_info.legacyRequest.isLegacyRequest)
+				{
+					DEBUG_INFO("*******************************************\n");
+					DEBUG_INFO("***** High priority polling : Case 2 ******\n");
+					DEBUG_INFO("*******************************************\n");
+					DEBUG_INFO("MCU set relay request : %d\n", ShmDispenser->gun_info.legacyRequest.isLegacyRequest);
+
+					previousCharger.gun_info.legacyRequest.isLegacyRequest = ShmDispenser->gun_info.legacyRequest.isLegacyRequest;
+				}
+
+				//===============================
+				// Query primary MCU status
+				//===============================
+				if((previousCharger.gun_info.primaryMcuState.cp_state != ShmDispenser->gun_info.primaryMcuState.cp_state) ||
+				   (previousCharger.gun_info.primaryMcuState.current_limit != ShmDispenser->gun_info.primaryMcuState.current_limit) ||
+				   (previousCharger.gun_info.primaryMcuState.relay_state != ShmDispenser->gun_info.primaryMcuState.relay_state) ||
+				   (previousCharger.gun_info.primaryMcuState.socket_e.isSocketEMode != ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEMode) ||
+				   (previousCharger.gun_info.primaryMcuState.socket_e.isSocketEPinOn != ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn))
+				{
+					DEBUG_INFO("*******************************************\n");
+					DEBUG_INFO("***** High priority polling : Case 3 ******\n");
+					DEBUG_INFO("*******************************************\n");
+					DEBUG_INFO("MCU get Pilot State : %d\n", ShmDispenser->gun_info.primaryMcuState.cp_state);
+					DEBUG_INFO("MCU get Pilot Duty : %.2f\n", (float)ShmDispenser->gun_info.primaryMcuState.current_limit);
+					DEBUG_INFO("MCU get Pilot Voltage Positive : %.2f\n", ShmDispenser->gun_info.primaryMcuState.cp_voltage_positive);
+					DEBUG_INFO("MCU get Pilot Voltage Negative : %.2f\n", ShmDispenser->gun_info.primaryMcuState.cp_voltage_negtive);
+
+					if(ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn == ON)
+						DEBUG_INFO("Relay on mode : CHARGING_MODE_SOCKETE. \n");
+					else
+						DEBUG_INFO("Relay on mode : CHARGING_MODE_BS / CHARGING_MODE_HLC. \n");
+
+					DEBUG_INFO("MCU get Relay State : %d\n", ShmDispenser->gun_info.primaryMcuState.relay_state);
+					DEBUG_INFO("MCU get Rating Current : %.2f\n", (float)ShmDispenser->gun_info.primaryMcuState.rating_current);
+					DEBUG_INFO("MCU get Rotary switch : %d\n", ShmDispenser->gun_info.primaryMcuState.rotatory_switch);
+					DEBUG_INFO("MCU get is on Socket-E mode : %d\n", ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEMode);
+					DEBUG_INFO("MCU get Socket-E detect pin : %d\n", ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn);
+
+					//===============================
+					// Query primary MCU power consumption
+					//===============================
+					DEBUG_INFO("*******************************************\n");
+					DEBUG_INFO("***** High priority polling : Case 10 *****\n");
+					DEBUG_INFO("*******************************************\n");
+					DEBUG_INFO("MCU get total power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumptionTotal.power_consumption/10000.0));
+					DEBUG_INFO("MCU get L1N_L12 power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumption[0].power_consumption/10000.0));
+					if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+					{
+						DEBUG_INFO("MCU get L2N_L23 power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumption[1].power_consumption/10000.0));
+						DEBUG_INFO("MCU get L3N_L31 power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumption[2].power_consumption/10000.0));
+					}
+
+					/*
+					DEBUG_INFO("MCU get Locker State : %d\n", ShmDispenser->gun_info.primaryMcuState.locker_state);
+					DEBUG_INFO("MCU get Shutter State : %d\n", ShmDispenser->gun_info.primaryMcuState.shutter_state);
+					DEBUG_INFO("MCU get Meter State : %d\n", ShmDispenser->gun_info.primaryMcuState.meter_state);
+					DEBUG_INFO("MCU get PP State : %d\n", ShmDispenser->gun_info.primaryMcuState.pp_state);
+					*/
+
+					previousCharger.gun_info.primaryMcuState.cp_state = ShmDispenser->gun_info.primaryMcuState.cp_state;
+					previousCharger.gun_info.primaryMcuState.current_limit = ShmDispenser->gun_info.primaryMcuState.current_limit;
+					previousCharger.gun_info.primaryMcuState.relay_state = ShmDispenser->gun_info.primaryMcuState.relay_state;
+					previousCharger.gun_info.primaryMcuState.socket_e.isSocketEMode = ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEMode;
+					previousCharger.gun_info.primaryMcuState.socket_e.isSocketEPinOn = ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn;
+				}
+
+				//===============================
+				// Query primary MCU Alarm code
+				//===============================
+				if((previousCharger.gun_info.primaryMcuAlarm.InputAlarmCode != ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode))
+				{
+					if((ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode>0))
+					{
+						DEBUG_INFO("*******************************************\n");
+						DEBUG_INFO("***** High priority polling : Case 4 ******\n");
+						DEBUG_INFO("*******************************************\n");
+						DEBUG_INFO("MCU get OVP_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OVP_L1);
+						DEBUG_INFO("MCU get UVP_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.UVP_L1);
+						DEBUG_INFO("MCU get OCP_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OCP_L1);
+						if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+						{
+							DEBUG_INFO("MCU get OVP_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OVP_L2);
+							DEBUG_INFO("MCU get UVP_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.UVP_L2);
+							DEBUG_INFO("MCU get OCP_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OCP_L2);
+							DEBUG_INFO("MCU get OVP_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OVP_L3);
+							DEBUG_INFO("MCU get UVP_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.UVP_L3);
+							DEBUG_INFO("MCU get OCP_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OCP_L3);
+						}
+						DEBUG_INFO("MCU get OTP : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OTP);
+						DEBUG_INFO("MCU get gmi_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.gmi_fault);
+						DEBUG_INFO("MCU get cp_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.cp_fault);
+						DEBUG_INFO("MCU get ac_leak : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.ac_leak);
+						DEBUG_INFO("MCU get dc_leak : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.dc_leak);
+						DEBUG_INFO("MCU get mcu_selftest_fail : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.mcu_selftest_fail);
+						DEBUG_INFO("MCU get handshaking_timeout : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.handshaking_timeout);
+						DEBUG_INFO("MCU get emergency_stop : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.emergency_stop);
+						DEBUG_INFO("MCU get relay_welding : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.relay_welding);
+						DEBUG_INFO("MCU get leak_module_fail : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.leak_module_fail);
+						DEBUG_INFO("MCU get shutter_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.shutter_fault);
+						DEBUG_INFO("MCU get locker_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.locker_fault);
+						DEBUG_INFO("MCU get power_drop : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.power_drop);
+						DEBUG_INFO("MCU get rotate_switch_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.rotate_switch_fault);
+						DEBUG_INFO("MCU get short_circuit_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.short_circuit_L1);
+						if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+						{
+							DEBUG_INFO("MCU get short_circuit_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.short_circuit_L2);
+							DEBUG_INFO("MCU get short_circuit_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.short_circuit_L3);
+						}
+						DEBUG_INFO("MCU get relay_drive_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.relay_drive_fault);
+						DEBUG_INFO("MCU get meter_comm_timeout : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.meter_comm_timeout);
+						DEBUG_INFO("MCU get meter_ic_comm_timeout : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.meter_ic_comm_timeout);
+						DEBUG_INFO("MCU get pilot_negative_error : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.pilot_negative_error);
+						DEBUG_INFO("MCU get InputAlarmCode : %x\n", ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode);
+					}
+
+					DEBUG_INFO("===========================================\n");
+					DEBUG_INFO("==== Normal priority polling : Case 1 =====\n");
+					DEBUG_INFO("===========================================\n");
+					DEBUG_INFO("MCU get Input voltage L1: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L1N_L12);
+					DEBUG_INFO("MCU get PresentChargingVoltage L1: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L1N_L12);
+					if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+					{
+						DEBUG_INFO("MCU get Input voltage L2: %f\n", (float)ShmDispenser->gun_info.inputVoltage.L2N_L23);
+						DEBUG_INFO("MCU get PresentChargingVoltage L2: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L2N_L23);
+						DEBUG_INFO("MCU get Input voltage L3: %f\n", (float)ShmDispenser->gun_info.inputVoltage.L3N_L31);
+						DEBUG_INFO("MCU get PresentChargingVoltage L3: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L3N_L31);
+					}
+
+					previousCharger.gun_info.primaryMcuAlarm.InputAlarmCode = ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode;
+				}
+
+				//===============================
+				// Query primary MCU BLE config
+				//===============================
+				if((previousCharger.gun_info.bleConfigData.isLogin != ShmDispenser->gun_info.bleConfigData.isLogin) ||
+				   (previousCharger.gun_info.bleConfigData.isRequestStart != ShmDispenser->gun_info.bleConfigData.isRequestStart) ||
+				   (previousCharger.gun_info.bleConfigData.isRequestStop != ShmDispenser->gun_info.bleConfigData.isRequestStop))
+				{
+					if(ShmDispenser->gun_info.bleConfigData.isLogin == ON)
+					{
+						DEBUG_INFO("*******************************************\n");
+						DEBUG_INFO("***** High priority polling : Case 5 ******\n");
+						DEBUG_INFO("*******************************************\n");
+						DEBUG_INFO("MCU get isUserLogin : %d\n", ShmDispenser->gun_info.bleConfigData.isLogin);
+						DEBUG_INFO("MCU get isRequestStartCharger : %d\n", ShmDispenser->gun_info.bleConfigData.isRequestStart);
+						DEBUG_INFO("MCU get isRequestStopCharger : %d\n", ShmDispenser->gun_info.bleConfigData.isRequestStop);
+					}
+
+					previousCharger.gun_info.bleConfigData.isLogin = ShmDispenser->gun_info.bleConfigData.isLogin;
+					previousCharger.gun_info.bleConfigData.isRequestStart = ShmDispenser->gun_info.bleConfigData.isRequestStart;
+					previousCharger.gun_info.bleConfigData.isRequestStop = ShmDispenser->gun_info.bleConfigData.isRequestStop;
+				}
+
+				//===============================
+				// Query primary MCU ble login id
+				//===============================
+				if((strcmp((char *)&previousCharger.gun_info.bleLoginCentralId.id,(char *)&ShmDispenser->gun_info.bleLoginCentralId.id) != 0))
+				{
+					if(strcmp((char *)&ShmDispenser->gun_info.bleLoginCentralId.id,"") != 0)
+					{
+						DEBUG_INFO("*******************************************\n");
+						DEBUG_INFO("***** High priority polling : Case 6 ******\n");
+						DEBUG_INFO("*******************************************\n");
+						DEBUG_INFO("MCU get ble central id : %s\n", ShmDispenser->gun_info.bleLoginCentralId.id);
+					}
+
+					memcpy(&previousCharger.gun_info.bleLoginCentralId.id, ShmDispenser->gun_info.bleLoginCentralId.id, ARRAY_SIZE(ShmDispenser->gun_info.bleLoginCentralId.id));
+				}
+			}
+		}
+		else
+		{
+			/*
+			 * Normal priority communication
+			 */
+
+			switch(stepIndex)
+			{
+				case 1:
+					//===============================
+					// Query present input voltage
+					//===============================
+					if(Query_Present_InputVoltage(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.inputVoltage) == PASS)
+					{
+						ShmDispenser->gun_info.acCcsInfo.GridVoltage[0] = ShmDispenser->gun_info.inputVoltage.L1N_L12;
+						ShmDispenser->gun_info.acCcsInfo.GridVoltage[1] = ShmDispenser->gun_info.inputVoltage.L2N_L23;
+						ShmDispenser->gun_info.acCcsInfo.GridVoltage[2] = ShmDispenser->gun_info.inputVoltage.L3N_L31;
+
+						failCount = 0;
+					}
+					else
+					{
+						DEBUG_WARN("MCU get input voltage fail...%d\n", failCount);
+						if(failCount<USHRT_MAX)
+							failCount++;
+						else
+							failCount = FAIL_SPEC_COMM;
+					}
+					break;
+				case 3:
+					//===============================
+					// Query present output current
+					//===============================
+					if(Query_Present_OutputCurrent(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.outputCurrent) == PASS)
+					{
+#ifndef SIMULATION
+						ShmDispenser->gun_info.acCcsInfo.EVSEPresentCurrent[0] = (float)ShmDispenser->gun_info.outputCurrent.L1N_L12[0];
+						ShmDispenser->gun_info.acCcsInfo.EVSEPresentCurrent[1] = (float)ShmDispenser->gun_info.outputCurrent.L1N_L12[0];
+						ShmDispenser->gun_info.acCcsInfo.EVSEPresentCurrent[2] = (float)ShmDispenser->gun_info.outputCurrent.L1N_L12[0];
+#else	//SIMULATION
+						ShmDispenser->AcChargingData.PresentChargingCurrent = (float)(ShmDispenser->AcChargingData.SystemStatus==SYS_MODE_CHARGING?(((rand()%10)+((ShmDispenser->gun_info.targetCurrent*10)-5))/10.0):0);
+						if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+						{
+							ShmDispenser->AcChargingData.PresentChargingCurrentL2 = (float)(ShmDispenser->AcChargingData.SystemStatus==SYS_MODE_CHARGING?(((rand()%10)+((ShmDispenser->gun_info.targetCurrent*10)-5))/10.0):0);
+							ShmDispenser->AcChargingData.PresentChargingCurrentL3 = (float)(ShmDispenser->AcChargingData.SystemStatus==SYS_MODE_CHARGING?(((rand()%10)+((ShmDispenser->gun_info.targetCurrent*10)-5))/10.0):0);
+						}
+#endif	//SIMULATION
+						failCount = 0;
+					}
+					else
+					{
+						DEBUG_WARN("MCU get output current fail...%d\n", failCount);
+						if(failCount<USHRT_MAX)
+							failCount++;
+						else
+							failCount = FAIL_SPEC_COMM;
+					}
+					break;
+				case 5:
+					//===============================
+					// Query gun plug-in times
+					//===============================
+					if(Query_AC_GUN_PLUGIN_TIMES(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.gunPluginTimes) == PASS)
+					{
+						ShmDispenser->AcPlugInTimes = ((long)ShmDispenser->gun_info.gunPluginTimes.GunPluginTimes & 0xFFFF);
+
+						failCount = 0;
+					}
+					else
+					{
+						DEBUG_WARN("MCU get gun plugin times fail...%d\n", failCount);
+						if(failCount<USHRT_MAX)
+							failCount++;
+						else
+							failCount = FAIL_SPEC_COMM;
+					}
+					break;
+				case 7:
+					//===============================
+					// Query temperature
+					//===============================
+					if(Query_Temperature(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.temperature) == PASS)
+					{
+						failCount = 0;
+					}
+					else
+					{
+						DEBUG_WARN("MCU get temperature fail...%d\n", failCount);
+						if(failCount<USHRT_MAX)
+							failCount++;
+						else
+							failCount = FAIL_SPEC_COMM;
+					}
+					break;
+
+				case 9:
+					//===============================
+					// Query RTC
+					//===============================
+					if(Query_RTC(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.rtc))
+					{
+						struct timeb csuTime, mcuTime;
+						struct tm *tmCSU;
+						struct tm tmMcu;
+						ftime(&csuTime);
+						tmCSU = localtime(&csuTime.time);
+						tmMcu.tm_year = ShmDispenser->gun_info.rtc.year-1900;
+						tmMcu.tm_mon = ShmDispenser->gun_info.rtc.month-1;
+						tmMcu.tm_mday = ShmDispenser->gun_info.rtc.day;
+						tmMcu.tm_hour = ShmDispenser->gun_info.rtc.hour;
+						tmMcu.tm_min = ShmDispenser->gun_info.rtc.min;
+						tmMcu.tm_sec = ShmDispenser->gun_info.rtc.sec;
+						mcuTime.time = mktime(&tmMcu);
+
+						if(ShmDispenser->gun_info.bleConfigData.isLogin && !ShmDispenser->isConnectedBackend)
+						{
+							if(abs(DiffTimeb(csuTime, mcuTime)) > 10000)
+							{
+								char cmdBuf[128];
+								sprintf(cmdBuf, "date -u -s \"%04d-%02d-%02d %02d:%02d:%02d\"", ShmDispenser->gun_info.rtc.year,
+																								ShmDispenser->gun_info.rtc.month,
+																								ShmDispenser->gun_info.rtc.day,
+																								ShmDispenser->gun_info.rtc.hour,
+																								ShmDispenser->gun_info.rtc.min,
+																								ShmDispenser->gun_info.rtc.sec);
+								system(cmdBuf);
+								system("hwclock -w -u");
+								system("hwclock -s");
+							}
+						}
+						else
+						{
+							if(abs(DiffTimeb(csuTime, mcuTime)) > 10000)
+							{
+								ShmDispenser->gun_info.rtc.year = tmCSU->tm_year+1900;
+								ShmDispenser->gun_info.rtc.month = tmCSU->tm_mon+1;
+								ShmDispenser->gun_info.rtc.day = tmCSU->tm_mday;
+								ShmDispenser->gun_info.rtc.hour = tmCSU->tm_hour;
+								ShmDispenser->gun_info.rtc.min = tmCSU->tm_min;
+								ShmDispenser->gun_info.rtc.sec = tmCSU->tm_sec;
+								Config_RTC(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.rtc);
+							}
+						}
+
+						failCount = 0;
+					}
+					else
+					{
+						DEBUG_WARN("MCU get rtc fail...%d\n", failCount);
+						if(failCount<USHRT_MAX)
+							failCount++;
+						else
+							failCount = FAIL_SPEC_COMM;
+					}
+					break;
+				case 11:
+					break;
+				case 13:
+					//===============================
+					// Upgrade MCU
+					//===============================
+					if(ShmDispenser->gun_info.mcuFlag.isMcuUpgradeReq)
+					{
+						DEBUG_INFO("===========================================\n");
+						DEBUG_INFO("==== Normal priority polling : Case 15 ====\n");
+						DEBUG_INFO("===========================================\n");
+
+						unsigned char cmd[512];
+						if(Upgrade_UART(Uart1Fd, AC_WALLMOUNT_CONTROLLER, ADDR_AC_PRIMARY_1, ShmDispenser->fwUpgradeInfo.location, ShmDispenser->fwUpgradeInfo.modelName))
+						{
+							DEBUG_INFO("MCU upgrade firmware OK...%s\n", ShmDispenser->gun_info.ver.Version_FW);
+							sleep(20);
+							ShmDispenser->gun_info.mcuFlag.isMcuUpgradeReq = OFF;
+							failCount = 0;
+						}
+						else
+						{
+							DEBUG_WARN("MCU upgrade firmware fail...%d\n", failCount);
+							if(failCount<USHRT_MAX)
+								failCount++;
+							else
+								failCount = FAIL_SPEC_COMM;
+						}
+
+						sprintf((char*)cmd, "yes|rm %s", ShmDispenser->fwUpgradeInfo.location);
+						system((char*)cmd);
+					}
+					break;
+				case 15:
+					//===============================
+					// Config set breathe led timing
+					//===============================
+					if(ShmDispenser->gun_info.isSetBreatheLedTiming == ON)
+					{
+						if(Config_AC_Set_Breathe_Led_Timing(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.setBreatheLedTiming))
+						{
+							failCount = 0;
+							ShmDispenser->gun_info.isSetBreatheLedTiming = OFF;
+						}
+						else
+						{
+							DEBUG_WARN("MCU set breathe led timing fail...%d\n", failCount);
+							if(failCount<USHRT_MAX)
+								failCount++;
+							else
+								failCount = FAIL_SPEC_COMM;
+						}
+					}
+					break;
+				case 17:
+					//===============================
+					// Config set led brightness
+					//===============================
+					if(ShmDispenser->gun_info.isSetLedBrightness == ON)
+					{
+						if(Config_AC_Set_Led_Brightness(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.setLedBrightness))
+						{
+							failCount = 0;
+							ShmDispenser->gun_info.isSetLedBrightness = OFF;
+						}
+						else
+						{
+							DEBUG_WARN("MCU set led brightness fail...%d\n", failCount);
+							if(failCount<USHRT_MAX)
+								failCount++;
+							else
+								failCount = FAIL_SPEC_COMM;
+						}
+					}
+					break;
+				case 19:
+					//===============================
+					// Query firmware version
+					//===============================
+					if(ShmDispenser->gun_info.mcuFlag.isReadFwVerPass != PASS)
+					{
+						DEBUG_INFO("===========================================\n");
+						DEBUG_INFO("==== Normal priority polling : Case 19-1===\n");
+						DEBUG_INFO("===========================================\n");
+						if(Query_FW_Ver(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.ver) == PASS)
+						{
+							DEBUG_INFO("MCU get firmware version : %s\n", ShmDispenser->gun_info.ver.Version_FW);
+							ShmDispenser->gun_info.mcuFlag.isReadFwVerPass = PASS;
+
+							failCount = 0;
+						}
+						else
+						{
+							DEBUG_WARN("MCU get firmware version fail...%d\n", failCount);
+							if(failCount<USHRT_MAX)
+								failCount++;
+							else
+								failCount = FAIL_SPEC_COMM;
+						}
+					}
+
+					//===============================
+					// Query meter ic correction status
+					//===============================
+					if(ShmDispenser->gun_info.mcuFlag.isReadMeterIcCorrectionStatus != PASS)
+					{
+						DEBUG_INFO("===========================================\n");
+						DEBUG_INFO("==== Normal priority polling : Case 19-2===\n");
+						DEBUG_INFO("===========================================\n");
+						if(Query_MeterIc_CorrectionPara(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.meterIcCorrectionStatus) == PASS)
+						{
+							DEBUG_INFO("MCU get meter ic correction status: 0x%08X\n", ShmDispenser->gun_info.meterIcCorrectionStatus.value);
+
+							ShmDispenser->gun_info.mcuFlag.isReadMeterIcCorrectionStatus = PASS;
+
+							failCount = 0;
+						}
+						else
+						{
+							DEBUG_WARN("MCU get meter ic correction status fail...%d\n", failCount);
+							if(failCount<USHRT_MAX)
+								failCount++;
+							else
+								failCount = FAIL_SPEC_COMM;
+						}
+					}
+
+					//===============================
+					// Config primary MCU serial number
+					//===============================
+					if(ShmDispenser->gun_info.mcuFlag.isSetSerialNumberPass != PASS)
+					{
+						DEBUG_INFO("===========================================\n");
+						DEBUG_INFO("==== Normal priority polling : Case 19-3===\n");
+						DEBUG_INFO("===========================================\n");
+						memcpy(&ShmDispenser->evseId.serial_number, &ShmDispenser->ConfigData.SerialNumber, ARRAY_SIZE(ShmDispenser->evseId.serial_number));
+						if(Config_Serial_Number(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->evseId))
+						{
+							DEBUG_INFO("MCU set serial number : %.12s\n", ShmDispenser->evseId.serial_number);
+							ShmDispenser->gun_info.mcuFlag.isSetSerialNumberPass = PASS;
+
+							failCount = 0;
+						}
+						else
+						{
+							DEBUG_WARN("MCU set serial number fail...%d\n", failCount);
+							if(failCount<USHRT_MAX)
+								failCount++;
+							else
+								failCount = FAIL_SPEC_COMM;
+						}
+					}
+
+					//===============================
+					// Config primary MCU model name
+					//===============================
+					if(ShmDispenser->gun_info.mcuFlag.isSetModelNamePass != PASS)
+					{
+						DEBUG_INFO("===========================================\n");
+						DEBUG_INFO("==== Normal priority polling : Case 19-4===\n");
+						DEBUG_INFO("===========================================\n");
+						memcpy(&ShmDispenser->evseId.model_name, &ShmDispenser->ConfigData.ModelName, ARRAY_SIZE(ShmDispenser->evseId.model_name));
+						if(Config_Model_Name(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->evseId))
+						{
+							DEBUG_INFO("MCU set model name : %.14s\n", ShmDispenser->evseId.model_name);
+							ShmDispenser->gun_info.mcuFlag.isSetModelNamePass = PASS;
+
+							failCount = 0;
+						}
+						else
+						{
+							DEBUG_WARN("MCU set model name fail...%d\n", failCount);
+							if(failCount<USHRT_MAX)
+								failCount++;
+							else
+								failCount = FAIL_SPEC_COMM;
+						}
+					}
+					break;
+				case 21:
+					//===============================
+					// Config aux power switch
+					//===============================
+					ShmDispenser->gun_info.setAuxPowerSwitch.power_switch = 0x01;
+					ShmDispenser->gun_info.setAuxPowerSwitch.power_switch = ShmDispenser->gun_info.isMeterOn;
+					if(Config_Aux_Power_Switch(Uart1Fd, ADDR_AC_PRIMARY_1, &ShmDispenser->gun_info.setAuxPowerSwitch))
+					{
+						failCount = 0;
+					}
+					else
+					{
+						DEBUG_WARN("MCU set aux power switch fail...%d\n", failCount);
+						if(failCount<USHRT_MAX)
+							failCount++;
+						else
+							failCount = FAIL_SPEC_COMM;
+					}
+
+					break;
+				default:
+					stepIndex = 0;
+					break;
+			}
+
+			//==========================================================
+			// Low priority polling log print out
+			//==========================================================
+			if((current_timestamp() - tsPrintLog[PRIORITY_LOW]) > (ShmDispenser->gun_info.legacyRequest.isLegacyRequest?3000:6000))
+			{
+				tsPrintLog[PRIORITY_LOW] = current_timestamp();
+
+				switch(logIndex)
+				{
+					case 1:
+						if((previousCharger.gun_info.outputCurrent.L1N_L12[0] != ShmDispenser->gun_info.outputCurrent.L1N_L12[0]) ||
+						   (previousCharger.gun_info.outputCurrent.L2N_L23[0] != ShmDispenser->gun_info.outputCurrent.L2N_L23[0]) ||
+						   (previousCharger.gun_info.outputCurrent.L3N_L31[0] != ShmDispenser->gun_info.outputCurrent.L3N_L31[0]))
+						{
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("==== Normal priority polling : Case 3 =====\n");
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("MCU get output current L1: %f\n", (float)ShmDispenser->gun_info.outputCurrent.L1N_L12[0]);
+							if(ShmDispenser->ConfigData.AcPhaseCount == 3)
+							{
+								DEBUG_INFO("MCU get output current L2: %f\n", (float)ShmDispenser->gun_info.outputCurrent.L2N_L23[0]);
+								DEBUG_INFO("MCU get output current L3: %f\n", (float)ShmDispenser->gun_info.outputCurrent.L3N_L31[0]);
+							}
+
+							previousCharger.gun_info.outputCurrent.L1N_L12[0] = ShmDispenser->gun_info.outputCurrent.L1N_L12[0];
+							previousCharger.gun_info.outputCurrent.L2N_L23[0] = ShmDispenser->gun_info.outputCurrent.L2N_L23[0];
+							previousCharger.gun_info.outputCurrent.L3N_L31[0] = ShmDispenser->gun_info.outputCurrent.L3N_L31[0];
+						}
+
+						break;
+					case 2:
+						if(previousCharger.gun_info.gunPluginTimes.GunPluginTimes != ShmDispenser->gun_info.gunPluginTimes.GunPluginTimes)
+						{
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("==== Normal priority polling : Case 5 =====\n");
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("MCU get gun plugin times : %ld\n", (long)ShmDispenser->gun_info.gunPluginTimes.GunPluginTimes);
+
+							previousCharger.gun_info.gunPluginTimes.GunPluginTimes = ShmDispenser->gun_info.gunPluginTimes.GunPluginTimes;
+						}
+
+						break;
+					case 3:
+						if(previousCharger.gun_info.temperature.point[0] != ShmDispenser->gun_info.temperature.point[0])
+						{
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("==== Normal priority polling : Case 7 =====\n");
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("MCU get temperature : %d\n", ShmDispenser->gun_info.temperature.point[0]);
+
+							previousCharger.gun_info.temperature.point[0] = ShmDispenser->gun_info.temperature.point[0];
+						}
+
+						break;
+					case 4:
+						if(previousCharger.gun_info.primaryMcuCp_Pwn_Duty.max_current != ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current)
+						{
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("==== Normal priority polling : Case 9 =====\n");
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("MCU set cp pwn duty : %d\n", ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current);
+
+							previousCharger.gun_info.primaryMcuCp_Pwn_Duty.max_current = ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current;
+						}
+
+						break;
+					case 5:
+						DEBUG_INFO("===========================================\n");
+						DEBUG_INFO("==== Normal priority polling : Case 11 ====\n");
+						DEBUG_INFO("===========================================\n");
+						if(ShmDispenser->gun_info.bleConfigData.isLogin && !ShmDispenser->isConnectedBackend)
+						{
+							DEBUG_INFO("Sync from MCU rtc OK...%04d-%02d-%02d %02d:%02d:%02d\n", ShmDispenser->gun_info.rtc.year,
+																								ShmDispenser->gun_info.rtc.month,
+																								ShmDispenser->gun_info.rtc.day,
+																								ShmDispenser->gun_info.rtc.hour,
+																								ShmDispenser->gun_info.rtc.min,
+																								ShmDispenser->gun_info.rtc.sec);
+						}
+						else
+						{
+							DEBUG_INFO("MCU set rtc OK...%04d-%02d-%02d %02d:%02d:%02d\n", ShmDispenser->gun_info.rtc.year,
+																							ShmDispenser->gun_info.rtc.month,
+																							ShmDispenser->gun_info.rtc.day,
+																							ShmDispenser->gun_info.rtc.hour,
+																							ShmDispenser->gun_info.rtc.min,
+																							ShmDispenser->gun_info.rtc.sec);
+						}
+						break;
+					case 6:
+						break;
+					case 7:
+						if(ShmDispenser->gun_info.isSetBreatheLedTiming == ON)
+						{
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("==== Normal priority polling : Case 17 ====\n");
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("MCU set breathe led timing : Authed Fade in [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Authed_Fade_In);
+							DEBUG_INFO("MCU set breathe led timing : Authed Fade out [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Authed_Fade_Out);
+							DEBUG_INFO("MCU set breathe led timing : Charging Fade in [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.Set_Led_Action_Chaging_Fade_In);
+							DEBUG_INFO("MCU set breathe led timing : Charging Fade out [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Chaging_Fade_Out);
+							DEBUG_INFO("MCU set breathe led timing : Connected Fade in [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Connected_Fade_In);
+							DEBUG_INFO("MCU set breathe led timing : Connected Fade out [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Connected_Fade_Out);
+						}
+						break;
+					case 8:
+						if(ShmDispenser->gun_info.isSetLedBrightness == ON)
+						{
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("==== Normal priority polling : Case 19 ====\n");
+							DEBUG_INFO("===========================================\n");
+							DEBUG_INFO("MCU set led brightness Sector 01 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_1);
+							DEBUG_INFO("MCU set led brightness Sector 02 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_2);
+							DEBUG_INFO("MCU set led brightness Sector 03 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_3);
+							DEBUG_INFO("MCU set led brightness Sector 04 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_4);
+							DEBUG_INFO("MCU set led brightness Sector 05 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_5);
+							DEBUG_INFO("MCU set led brightness Sector 06 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_6);
+							DEBUG_INFO("MCU set led brightness Sector 07 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_7);
+							DEBUG_INFO("MCU set led brightness Sector 08 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_8);
+							DEBUG_INFO("MCU set led brightness Sector 09 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_9);
+							DEBUG_INFO("MCU set led brightness Sector 10 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_10);
+							DEBUG_INFO("MCU set led brightness Sector 11 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_11);
+							DEBUG_INFO("MCU set led brightness Sector 12 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_12);
+						}
+						break;
+					default:
+						logIndex = 0;
+
+						break;
+				}
+
+				logIndex++;
+			}
+		}
+		stepIndex++;
+
+		//===============================
+		// Communication fail check
+		//===============================
+		if(failCount >= FAIL_SPEC_COMM)
+		{
+			if((0 <= failCount%FAIL_SPEC_COMM) && (failCount%FAIL_SPEC_COMM < 10))
+				sleep(10);
+
+			if(ShmDispenser->gun_info.primaryMcuAlarm.bits.comm_timeout == OFF)
+			{
+				DEBUG_ERROR("Primary MCU communication fault");
+				ShmDispenser->gun_info.primaryMcuAlarm.bits.comm_timeout = ON;
+			}
+		}
+		else
+		{
+			if(ShmDispenser->gun_info.primaryMcuAlarm.bits.comm_timeout == ON)
+			{
+				DEBUG_ERROR("Primary MCU communication recover");
+				ShmDispenser->gun_info.primaryMcuAlarm.bits.comm_timeout = OFF;
+			}
+		}
+
+		usleep(100000);
+	}
+
+	return FAIL;
+}

+ 69 - 0
EVSE/Projects/AX80/Apps/Module_InternalComm.h

@@ -0,0 +1,69 @@
+/*
+ * Module_InternalComm.h
+ *
+ */
+
+#ifndef MODULE_INTERNALCOMM_H_
+#define MODULE_INTERNALCOMM_H_
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+
+extern int StoreLogMsg(const char *fmt, ...);
+
+enum MESSAGE_COMMAND
+{
+	CMD_QUERY_FW_VER = 0x01,
+	CMD_QUERY_HW_VER = 0x02,
+	CMD_QUERY_PRESENT_INPUTVOLTAGE = 0x03,
+	CMD_QUERY_PRESENT_OUTPUTVOLTAGE = 0x04,
+	CMD_QUERY_FAN_SPEED = 0x05,
+	CMD_QUERY_TEMPERATURE = 0x06,
+	CMD_QUERY_AUX_POWERVOLTAGE = 0x07,
+	CMD_QUERY_RELAY_OUTPUT = 0x08,
+	CMD_QUERY_GFD_ADC = 0x09,
+	CMD_QUERY_GPIO_INPUT = 0x0a,
+	CMD_QUERY_ALARM_LOG = 0x22,
+	CMD_QUERY_RTC = 0x26,
+	CMD_QUERY_PRESENT_OUTPUTCURRENT = 0x27,
+	CMD_QUERY_AC_STATUS = 0x28,
+	CMD_QUERY_AC_ALARM = 0x29,
+	CMD_QUERY_BLE_CONFIG_DATA = 0x2A,
+	CMD_QUERY_BLE_CENTRAL_ID = 0x2B,
+	CMD_QUERY_POWER_CONSUMPTION = 0x2C,
+	CMD_QUERY_GUN_PLUGIN_TIMES = 0x2D,
+	CMD_QUERY_METER_IC_CORRECTION_PARA = 0x36,
+
+	CMD_CONFIG_FAN_SPEED = 0x81,
+	CMD_CONFIG_SERIAL_NUMBER = 0x82,
+	CMD_CONFIG_MODEL_NAME = 0x83,
+	CMD_CONFIG_RELAY_OUTPUT = 0x85,
+	CMD_CONFIG_GPIO_OUTPUT = 0x86,
+	CMD_CONFIG_RTC = 0x87,
+	CMD_CONFIG_AC_LED = 0x88,
+	CMD_CONFIG_CURRENT_LINIT = 0x89,
+	CMD_CONFIG_LEGACY_REQUEST = 0x8A,
+	CMD_CONFIG_MCU_RESET_REQUEST = 0x8C,
+	CMD_CONFIG_MCU_SET_BREATHE_LED_TIMING = 0x8D,
+	CMD_CONFIG_MCU_SET_LED_BRIGHTNESS = 0x8E,
+	CMD_CONFIG_AUX_POWER_SWITCH = 0x95,
+
+	CMD_UPDATE_START = 0xe0,
+	CMD_UPDATE_ABOARD = 0xe1,
+	CMD_UPDATE_TRANSFER = 0xe2,
+	CMD_UPDATE_END = 0xe3
+};
+
+enum MESSAGE_ADDRESS
+{
+	ADDR_AUX = 0x01,
+	ADDR_FAN = 0x02,
+	ADDR_RELAY = 0x03,
+	ADDR_DC_PRIMARY = 0x04,
+	ADDR_AC_PRIMARY_1 = 0xff,
+	ADDR_AC_PRIMARY_2 = 0xff
+};
+
+
+#endif /* MODULE_INTERNALCOMM_H_ */

+ 879 - 0
EVSE/Projects/AX80/Apps/Module_PowerSharing.c

@@ -0,0 +1,879 @@
+/*
+ * Module_PowerSharing.c
+ *
+ *  Created on: 2020/12/07
+ *      Author: foluswen
+ */
+#include "Module_PowerSharing.h"
+
+struct SysConfigAndInfo		*ShmSysConfigAndInfo;
+struct StatusCodeData 		*ShmStatusCodeData;
+struct OCPP16Data			*ShmOCPP16Data;
+struct Charger				*ShmCharger;
+struct POWER_SHARING		*ShmPowerSharing;
+
+//==========================================
+// Common routine
+//==========================================
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time((time_t*)NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+
+	sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]Module_PowerSharingLog",
+				tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+				buffer,
+				tm->tm_year+1900,tm->tm_mon+1);
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+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;
+}
+
+void dM(uint8_t *data, uint16_t len, uint8_t isRX)
+{
+#ifdef DEBUG
+	uint8_t output[8192];
+
+	if(isRX)
+	{
+		DEBUG_INFO("- RX --------------------------------------------\n");
+	}
+	else
+	{
+		DEBUG_INFO("- TX --------------------------------------------\n");
+	}
+
+	memset(output, 0x00, ARRAY_SIZE(output));
+	for(uint16_t idx=0;idx<16;idx++)
+		sprintf((char*)output, "%s %02X", output, idx);
+	DEBUG_INFO("%s\n", output);
+	DEBUG_INFO("-------------------------------------------------\n");
+
+	for(uint16_t idx = 0;idx<len;idx++)
+	{
+		if((idx%16)>0)
+		{
+			sprintf((char*)output, "%s %02X", output, data[idx]);
+		}
+		else
+		{
+			if(idx != 0)
+				DEBUG_INFO("%s\n", output);
+			memset(output, 0x00, ARRAY_SIZE(output));
+			sprintf((char*)output, "%s %02X", output, data[idx]);
+		}
+	}
+	DEBUG_INFO("%s\n", output);
+	DEBUG_INFO("-------------------------------------------------\n");
+#endif
+}
+
+int isValidCheckSum(struct Message *message)
+{
+	uint8_t chksum = 0x00;
+
+	for(int idx=0;idx<((message->buffer[1]+3)>ARRAY_SIZE(message->buffer)?ARRAY_SIZE(message->buffer):(message->buffer[1]+3));idx++)
+	{
+		chksum ^= message->buffer[idx];
+	}
+
+	return ((chksum == message->buffer[((message->buffer[1]+3)>ARRAY_SIZE(message->buffer)?ARRAY_SIZE(message->buffer):(message->buffer[1]+3))]) ? PASS : FAIL);
+}
+
+uint8_t chksumCal(struct Message *message)
+{
+	uint8_t chksum=0;
+
+	for(int idx=0;idx<((message->buffer[1]+3)>ARRAY_SIZE(message->buffer)?ARRAY_SIZE(message->buffer):(message->buffer[1]+3));idx++)
+	{
+		chksum ^= message->buffer[idx];
+	}
+
+	return chksum & 0xff;
+}
+
+//==========================================
+// Init all share memory
+//==========================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//Initial ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo),  0777)) < 0)
+    {
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		result = FAIL;
+	}
+    else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+    	result = FAIL;
+   	 }
+    else
+    {}
+
+   	//Initial ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData),  0777)) < 0)
+    {
+   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+   		result = FAIL;
+	}
+    else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	//Initial ShmOCPP16Data
+	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data),  0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmOCPP16Data NG");
+		result = FAIL;
+	}
+	else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmOCPP16Data NG");
+		result = FAIL;
+	}
+	else
+	{}
+
+	//Initial ShmCharger
+	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmCharger NG\n");
+		result = FAIL;
+	}
+	else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmCharger NG\n");
+		result = FAIL;
+	}
+
+	//Create ShmPowerSharing
+	if ((MeterSMId = shmget(ShmPowerShargingKey, sizeof(struct POWER_SHARING), IPC_CREAT | 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmPowerShargingKey NG\n");
+
+		result = FAIL;
+	}
+	else if ((ShmPowerSharing = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		DEBUG_ERROR("shmat ShmPowerShargingKey NG\n");
+
+		result = FAIL;
+	}
+	memset(ShmPowerSharing,0,sizeof(struct POWER_SHARING));
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+		ShmPowerSharing->Connection_Info[idx].socketFd = (idx+1);
+
+    return result;
+}
+
+//==========================================
+// TCP socket server routine
+//==========================================
+int conn_getDupFd(void)
+{
+	int result = 0;
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(!ShmPowerSharing->Connection_Info[idx].isSocketConnected)
+		{
+			result = ShmPowerSharing->Connection_Info[idx].socketFd;
+			break;
+		}
+	}
+
+	return result;
+}
+
+int conn_register(int socketFd)
+{
+	int result = FAIL;
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(!ShmPowerSharing->Connection_Info[idx].isSocketConnected)
+		{
+			DEBUG_INFO("Dupfd-%d register to conn-%d.\n", socketFd, idx);
+			ShmPowerSharing->Connection_Info[idx].isSocketConnected = TRUE;
+			ShmPowerSharing->Connection_Info[idx].socketFd = socketFd;
+			ShmPowerSharing->Connection_Info[idx].lastHeartBeatTime = time((time_t*)NULL);
+			result = PASS;
+			break;
+		}
+	}
+
+	return result;
+}
+
+int conn_reject(int socketFd)
+{
+	int result = FAIL;
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(ShmPowerSharing->Connection_Info[idx].socketFd == socketFd)
+		{
+			DEBUG_INFO("Dupfd-%d register from conn_info-%d.\n", socketFd, idx);
+			ShmPowerSharing->Connection_Info[idx].isSocketConnected = FALSE;
+			ShmPowerSharing->Connection_Info[idx].isGunConnected = FALSE;
+			result = PASS;
+			break;
+		}
+	}
+
+	return result;
+
+}
+
+int conn_getConectedQuantity(void)
+{
+	int result = 0;
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(ShmPowerSharing->Connection_Info[idx].isSocketConnected)
+		{
+			result += 1;
+		}
+	}
+
+	DEBUG_INFO("Connection quantity: %d\n", result);
+	ShmPowerSharing->connectedQty = result;
+	return result;
+}
+
+int conn_updateHeartBeatTime(int socketFd)
+{
+	int result = FAIL;
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(ShmPowerSharing->Connection_Info[idx].socketFd == socketFd)
+		{
+			//DEBUG_INFO("Dupfd-%d register from conn_info-%d update heart beat time.\n", socketFd, idx);
+			ShmPowerSharing->Connection_Info[idx].lastHeartBeatTime = time((time_t*)NULL);
+			result = PASS;
+			break;
+		}
+	}
+
+	return result;
+}
+
+int conn_getStatusStarttime(int socketFd)
+{
+	int result = 0;
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(ShmPowerSharing->Connection_Info[idx].socketFd == socketFd)
+		{
+			result = ShmPowerSharing->Connection_Info[idx].lastGetStatusTime;
+			break;
+		}
+	}
+
+	return result;
+}
+
+int conn_getStatusStarttimeUpdate(int socketFd)
+{
+	int result = FAIL;
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(ShmPowerSharing->Connection_Info[idx].socketFd == socketFd)
+		{
+			ShmPowerSharing->Connection_Info[idx].lastGetStatusTime = time((time_t*)NULL);;
+			result = PASS;
+			break;
+		}
+	}
+
+	return result;
+}
+
+int conn_setCapacityStarttime(int socketFd)
+{
+	int result = 0;
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(ShmPowerSharing->Connection_Info[idx].socketFd == socketFd)
+		{
+			result = ShmPowerSharing->Connection_Info[idx].lastSetCapacityTime;
+			break;
+		}
+	}
+
+	return result;
+}
+
+int conn_setCapacityStarttimeUpdate(int socketFd)
+{
+	int result = FAIL;
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(ShmPowerSharing->Connection_Info[idx].socketFd == socketFd)
+		{
+			ShmPowerSharing->Connection_Info[idx].lastSetCapacityTime = time((time_t*)NULL);;
+			result = PASS;
+			break;
+		}
+	}
+
+	return result;
+}
+
+int conn_update_status(int socketFd, uint8_t pilotState, uint8_t availableCurrent, uint8_t presentCurrent, uint16_t acPhase)
+{
+	int result = FAIL;
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(ShmPowerSharing->Connection_Info[idx].socketFd == socketFd)
+		{
+			if(!ShmPowerSharing->Connection_Info[idx].isGunConnected &&
+			   (2<=pilotState) &&
+			   (pilotState<=7))
+			{
+				ShmPowerSharing->hasNewConn = YES;
+			}
+
+			if((ShmPowerSharing->Connection_Info[idx].isGunConnected != (2<=pilotState)&&(pilotState<=7)?YES:NO) ||
+			   (ShmPowerSharing->Connection_Info[idx].presentOutputCurrent != presentCurrent) ||
+			   (ShmPowerSharing->Connection_Info[idx].acPhase != acPhase))
+			{
+				DEBUG_INFO("Conn-%d pilot state: %d\n", idx, pilotState);
+				DEBUG_INFO("Conn-%d available current: %d\n", idx, availableCurrent);
+				DEBUG_INFO("Conn-%d preset output current: %d\n", idx, presentCurrent);
+				DEBUG_INFO("Conn-%d ac power phase: %d\n", idx, acPhase);
+				DEBUG_INFO("==================================\n");
+			}
+
+			ShmPowerSharing->Connection_Info[idx].isGunConnected = (2<=pilotState)&&(pilotState<=7)?YES:NO;
+			ShmPowerSharing->Connection_Info[idx].presentOutputCurrent = presentCurrent;
+			ShmPowerSharing->Connection_Info[idx].acPhase = acPhase;
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+int conn_getOnHandCurrent(void)
+{
+	int result = 0;
+
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(ShmPowerSharing->Connection_Info[idx].isSocketConnected)
+		{
+			result += ShmPowerSharing->Connection_Info[idx].availableSharingCurrent;
+		}
+	}
+
+	result = ShmCharger->gun_info[0].primaryMcuState.rating_current - result;
+
+	DEBUG_INFO("Total available current: %d\n", result);
+	return result;
+}
+
+void create_cmd_getStatus(struct Message *out)
+{
+	memset(out->buffer, 0, ARRAY_SIZE(out->buffer));
+
+	out->size = 4;
+	out->buffer[0] = 0x55;
+	out->buffer[1] = 0x00;
+	out->buffer[2] = SHARING_CMD_GET_STATUS;
+	out->buffer[3] = chksumCal(out);
+
+	dM(out->buffer, out->size, FALSE);
+}
+
+void create_cmd_SetAvailableCurrent(struct Message *out, int socketFd)
+{
+	memset(out->buffer, 0, ARRAY_SIZE(out->buffer));
+
+	out->size = 5;
+	out->buffer[0] = 0x55;
+	out->buffer[1] = 0x01;
+	out->buffer[2] = SHARING_CMD_SET_CAPACITY;
+	for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+	{
+		if(ShmPowerSharing->Connection_Info[idx].socketFd == socketFd)
+		{
+			out->buffer[3] = ShmPowerSharing->Connection_Info[idx].availableSharingCurrent;
+		}
+	}
+	out->buffer[4] = chksumCal(out);
+	dM(out->buffer, out->size, FALSE);
+}
+
+int tcpSocketServerStart(void)
+{
+	int 				sockFd = 0;
+	int 				clientSockFd = 0;
+	int					dupFd = 0;
+	struct Message		input;
+	struct Message		output;
+	struct sockaddr_in 	serverInfo, clientInfo;
+	socklen_t 			addrlen = sizeof(clientInfo);
+
+	sockFd = socket(AF_INET , SOCK_STREAM , 0);
+	if(sockFd == -1)
+	{
+		DEBUG_ERROR("TCP service socket create fail.\n");
+		sleep(5);
+		return FAIL;
+	}
+
+	bzero(&serverInfo,sizeof(serverInfo));
+	serverInfo.sin_family = PF_INET;
+	serverInfo.sin_addr.s_addr = htonl(INADDR_ANY);
+	serverInfo.sin_port = htons(LISTEN_PORT_TCP);
+
+	if(bind(sockFd, (struct sockaddr *)&serverInfo, sizeof(serverInfo)) < 0)
+		DEBUG_ERROR("TCP server socket bind fail.\n");
+
+	if(listen(sockFd, CONNECTION_LIMIT) < 0)
+		DEBUG_ERROR("TCP server socket listen fail.\n");
+	else
+		DEBUG_INFO("Power sharing TCP server initial listen on port %d.\n", LISTEN_PORT_TCP);
+
+	// Main loop
+	for(;;)
+	{
+		clientSockFd = accept(sockFd, (struct sockaddr*) &clientInfo, &addrlen);
+		fcntl(clientSockFd, F_SETFD, FD_CLOEXEC);
+		DEBUG_INFO("Client connect in.\n");
+		DEBUG_INFO("clientSockFd : %d\n", clientSockFd);
+
+		if(clientSockFd > 0)
+		{
+			if(conn_getConectedQuantity() < CONNECTION_LIMIT)
+			{
+				// Fork a child process to handle the new conn
+				if(fork()==0)
+				{
+					uint8_t idxStep = 0;
+					uint8_t socketEnable = YES;
+					struct timeval	tv;
+					tv.tv_sec = 0;
+					tv.tv_usec = 500000;
+					setsockopt(clientSockFd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof tv);
+					// Assign socket handle as available handle in conn info pool
+					dupFd = dup2(clientSockFd, conn_getDupFd());
+					conn_register(dupFd);
+
+					while(socketEnable)
+					{
+						if((input.size = recv(dupFd, input.buffer, sizeof(input.buffer), 0)) > 0)
+						{
+							dM(input.buffer, input.size, YES);
+
+							if(isValidCheckSum(&input))
+							{
+								conn_updateHeartBeatTime(dupFd);
+
+								memset(output.buffer, 0x00, ARRAY_SIZE(output.buffer));
+								switch(input.buffer[2])
+								{
+									case SHARING_CMD_GET_STATUS:
+										conn_update_status(dupFd, input.buffer[3], input.buffer[4], input.buffer[5], input.buffer[6]);
+
+										break;
+
+									case SHARING_CMD_SET_CAPACITY:
+										if(!input.buffer[3])
+											DEBUG_INFO("Set connection-%d available current fail \n");
+										break;
+
+									default:
+										DEBUG_WARN("Receive unknown command.\n");
+										break;
+								}
+							}
+							else
+							{
+								DEBUG_WARN("Receive command check sum error.\n");
+							}
+						}
+						else if(input.size == 0)
+						{
+							DEBUG_INFO("Client disSocketConnected.\n");
+							conn_reject(dupFd);
+							socketEnable = NO;
+							close(dupFd);
+							close(clientSockFd);
+							fflush(stdout);
+						}
+						else if(input.size == -1)
+						{
+							// Server slave handler
+							switch(idxStep)
+							{
+								case 0:
+									if((difftime(time((time_t*)NULL), conn_getStatusStarttime(dupFd)) >= 3) || (difftime(time((time_t*)NULL), conn_getStatusStarttime(dupFd)) < 0))
+									{
+										create_cmd_getStatus(&output);
+										conn_getStatusStarttimeUpdate(dupFd);
+										send(clientSockFd, output.buffer, output.size, 0);
+									}
+
+									idxStep++;
+									break;
+								default:
+									if((difftime(time((time_t*)NULL), conn_setCapacityStarttime(dupFd)) >= 1) || (difftime(time((time_t*)NULL), conn_setCapacityStarttime(dupFd)) < 0))
+									{
+										create_cmd_SetAvailableCurrent(&output, dupFd);
+										conn_setCapacityStarttimeUpdate(dupFd);
+										send(clientSockFd, output.buffer, output.size, 0);
+									}
+
+									idxStep = 0;
+									break;
+							}
+						}
+					}
+
+					conn_getConectedQuantity();
+					exit(0);
+				}
+				else
+				{
+					// if parent, close the socket and go back to listening new requests
+					close(clientSockFd);
+				}
+			}
+			else
+			{
+				DEBUG_WARN("Connection is over limit.\n");
+				output.size = 4;
+				output.buffer[0] = 0x55;
+				output.buffer[1] = 0x00;
+				output.buffer[2] = SHARING_CMD_CONNECTION_FULL;
+				output.buffer[3] = chksumCal(&output);
+				send(clientSockFd, output.buffer, output.size, 0);
+				close(clientSockFd);
+			}
+		}
+
+		sleep(1);
+	}
+
+	return FAIL;
+}
+
+//==========================================
+// Client routine
+//==========================================
+int tcpSocketClientStart(void)
+{
+	int 				sockfd;
+	struct sockaddr_in 	info;
+	struct hostent 		*ghbn;
+	struct timeval 		tv;
+	uint8_t 			socketEnable;
+	uint8_t				cntSocketErr;
+
+	struct Message		input;
+	struct Message		output;
+
+	bzero(&info,sizeof(info));
+	ghbn = gethostbyname((char*)"192.168.10.10");
+	info.sin_family = PF_INET;
+	info.sin_addr.s_addr = inet_addr(inet_ntoa(*(struct in_addr *)ghbn->h_addr_list[0]));
+	info.sin_port = htons(LISTEN_PORT_TCP);
+	ShmSysConfigAndInfo->SysInfo.localSharingInfo.isConnectedSharingServer = OFF;
+	DEBUG_INFO("Connect to %s:%d\n", inet_ntoa(*(struct in_addr *)ghbn->h_addr_list[0]), LISTEN_PORT_TCP);
+
+	sockfd = socket(AF_INET, SOCK_STREAM, 0);
+	if (sockfd == -1)
+	{
+		DEBUG_ERROR("Fail to create a socket.");
+		return 0;
+	}
+
+	if(connect(sockfd, (struct sockaddr *)&info,sizeof(info)) ==-1)
+	{
+		DEBUG_ERROR("Connection error.\n");
+		ShmSysConfigAndInfo->SysInfo.localSharingInfo.isConnectedSharingServer = OFF;
+		socketEnable = OFF;
+	}
+	else
+	{
+		DEBUG_INFO("Connect success.\n");
+		tv.tv_sec = 0;
+		tv.tv_usec = 500000;
+		setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof tv);
+		socketEnable = ON;
+		cntSocketErr = 0;
+		ShmSysConfigAndInfo->SysInfo.localSharingInfo.isConnectedSharingServer = ON;
+	}
+
+	while(socketEnable)
+	{
+		memset(input.buffer, 0, ARRAY_SIZE(input.buffer));
+		if((input.size = recv(sockfd, input.buffer, ARRAY_SIZE(input.buffer), 0)) > 0)
+		{
+			//DEBUG_INFO("Receive size: %d.\n", input.size);
+			dM(input.buffer, input.size, YES);
+
+			if(isValidCheckSum(&input))
+			{
+				switch(input.buffer[2])
+				{
+					case SHARING_CMD_GET_STATUS:
+						output.size = 8;
+						output.buffer[0] = 0x55;
+						output.buffer[1] = 0x04;
+						output.buffer[2] = input.buffer[2];
+						output.buffer[3] = ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PilotState;
+						output.buffer[4] = ShmSysConfigAndInfo->SysInfo.localSharingInfo.AvailableShargingCurrent;
+						output.buffer[5] = ShmSysConfigAndInfo->SysInfo.AcChargingData[0].PresentChargingCurrent;
+						output.buffer[6] = ShmSysConfigAndInfo->SysConfig.AcPhaseCount;
+						output.buffer[7] = chksumCal(&output);
+
+						break;
+
+					case SHARING_CMD_SET_CAPACITY:
+						output.size = 5;
+						output.buffer[0] = 0x55;
+						output.buffer[1] = 0x01;
+						output.buffer[2] = input.buffer[2];
+						output.buffer[3] = 0x01;
+						output.buffer[4] = chksumCal(&output);
+						if(ShmSysConfigAndInfo->SysInfo.localSharingInfo.AvailableShargingCurrent != input.buffer[3])
+						{
+							ShmSysConfigAndInfo->SysInfo.localSharingInfo.AvailableShargingCurrent = input.buffer[3];
+							DEBUG_INFO("Get available current from server: %d\n", ShmSysConfigAndInfo->SysInfo.localSharingInfo.AvailableShargingCurrent);
+						}
+						break;
+
+					default:
+						DEBUG_WARN("Receive unknown command.\n");
+						output.size = 4;
+						output.buffer[0] = 0x55;
+						output.buffer[1] = 0x00;
+						output.buffer[2] = SHARING_CMD_UNKNOWN;
+						output.buffer[3] = chksumCal(&output);
+						break;
+				}
+			}
+			else
+			{
+				DEBUG_WARN("Receive command check sum error.\n");
+				output.size = 4;
+				output.buffer[0] = 0x55;
+				output.buffer[1] = 0x00;
+				output.buffer[2] = SHARING_CMD_CHKSUM_ERROR;
+				output.buffer[3] = chksumCal(&output);
+			}
+
+			dM(output.buffer, output.size, NO);
+			send(sockfd, output.buffer, output.size, 0);
+		}
+		else if(input.size == 0)
+		{
+			DEBUG_INFO("DisSocketConnected.\n");
+			fflush(stdout);
+
+			socketEnable = OFF;
+			ShmSysConfigAndInfo->SysInfo.localSharingInfo.isConnectedSharingServer = OFF;
+		}
+		else if(input.size == -1)
+		{
+			if(cntSocketErr > 5)
+			{
+				socketEnable = OFF;
+				DEBUG_ERROR("Socket error occur\n");
+			}
+			else
+			{
+				cntSocketErr++;
+			}
+		}
+		usleep(1000000);
+	}
+	close(sockfd);
+
+	return FAIL;
+}
+
+//==========================================
+// Local loading balance check
+//==========================================
+int balance_check_loop(void)
+{
+	for(;;)
+	{
+		// Check conn heart beat
+		for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+		{
+			if(ShmPowerSharing->Connection_Info[idx].isSocketConnected &&
+			   ((difftime(time((time_t*)NULL), ShmPowerSharing->Connection_Info[idx].lastHeartBeatTime) > TIMEOUT_SPEC_HEARTBEAT) || (difftime(time((time_t*)NULL), ShmPowerSharing->Connection_Info[idx].lastHeartBeatTime) < 0)))
+			{
+				DEBUG_INFO("SocketFd-%d heart beat is over %d seconds.\n", ShmPowerSharing->Connection_Info[idx].socketFd, TIMEOUT_SPEC_HEARTBEAT);
+				ShmPowerSharing->Connection_Info[idx].isGunConnected = FALSE;
+				ShmPowerSharing->Connection_Info[idx].isSocketConnected = FALSE;
+			}
+		}
+
+		// Check available power
+		if(ShmPowerSharing->hasNewConn)
+		{
+			DEBUG_INFO("Detect gun connected re-allocate available current to each connection.\n");
+
+			for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+			{
+				if(ShmPowerSharing->Connection_Info[idx].isSocketConnected &&
+				   ShmPowerSharing->Connection_Info[idx].isGunConnected)
+				{
+					ShmPowerSharing->Connection_Info[idx].availableSharingCurrent = 6;
+				}
+				else
+				{
+					ShmPowerSharing->Connection_Info[idx].availableSharingCurrent = 0;
+				}
+			}
+
+			ShmPowerSharing->hasNewConn = NO;
+		}
+
+		for(uint8_t idx=0;idx<CONNECTION_LIMIT;idx++)
+		{
+			if(ShmPowerSharing->Connection_Info[idx].isSocketConnected &&
+			   ShmPowerSharing->Connection_Info[idx].isGunConnected)
+			{
+				if((difftime(time((time_t*)NULL), ShmPowerSharing->Connection_Info[idx].lastCheckCapacityTime) > TIMEOUT_SPEC_CHECK_CAPACITY) || (difftime(time((time_t*)NULL), ShmPowerSharing->Connection_Info[idx].lastCheckCapacityTime) < 0))
+				{
+					if(ShmPowerSharing->Connection_Info[idx].availableSharingCurrent >= (ShmPowerSharing->Connection_Info[idx].presentOutputCurrent+2))
+					{
+						if(ShmPowerSharing->Connection_Info[idx].availableSharingCurrent >= 8)
+							ShmPowerSharing->Connection_Info[idx].availableSharingCurrent -= 2;
+					}
+					else if(((ShmPowerSharing->Connection_Info[idx].presentOutputCurrent-1) < ShmPowerSharing->Connection_Info[idx].availableSharingCurrent) &&
+							(ShmPowerSharing->Connection_Info[idx].availableSharingCurrent < (ShmPowerSharing->Connection_Info[idx].presentOutputCurrent+1)) &&
+							(conn_getOnHandCurrent() >= 2))
+					{
+						ShmPowerSharing->Connection_Info[idx].availableSharingCurrent += 2;
+					}
+					else
+					{}
+					ShmPowerSharing->Connection_Info[idx].lastCheckCapacityTime = time((time_t*)NULL);
+				}
+			}
+			else
+			{
+				if(ShmPowerSharing->Connection_Info[idx].availableSharingCurrent != 0)
+				{
+					DEBUG_INFO("Dupfd-%d on conn_info-%d update sharing current(A): 0\n", ShmPowerSharing->Connection_Info[idx].socketFd, idx);
+				}
+				ShmPowerSharing->Connection_Info[idx].availableSharingCurrent = 0;
+			}
+		}
+
+		sleep(1);
+	}
+
+	return FAIL;
+}
+
+//==========================================
+// Main process
+//==========================================
+int main(void)
+{
+	signal(SIGCHLD,SIG_IGN);
+
+	// Initial share memory
+	if(InitShareMemory() == FAIL)
+	{
+		DEBUG_ERROR("InitShareMemory NG\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=ON;
+		}
+		sleep(5);
+		return 0;
+	}
+
+	// Enable server if rotary switch not slave mode
+	if((ShmCharger->gun_info[0].primaryMcuState.rotatory_switch != SWITCH_F_SLAVE) &&
+	   (AC_QUANTITY==1?TRUE:(ShmCharger->gun_info[1].primaryMcuState.rotatory_switch != SWITCH_F_SLAVE)))
+	{
+		// TCP socket server start
+		if(fork() == 0)
+		{
+			if(tcpSocketServerStart() == FAIL)
+			{
+				DEBUG_ERROR("TCP socket server down.\n");
+				return 0;
+			}
+		}
+
+		// Connection check loop
+		if(fork() == 0)
+		{
+			if(balance_check_loop() == FAIL)
+			{
+				DEBUG_ERROR("Local loading balance check loop fail.\n");
+				return 0;
+			}
+		}
+	}
+
+	sleep(10);
+	for(;;)
+	{
+		// Slave logic
+		tcpSocketClientStart();
+
+		usleep(100000);
+	}
+
+	return FAIL;
+}

+ 126 - 0
EVSE/Projects/AX80/Apps/Module_PowerSharing.h

@@ -0,0 +1,126 @@
+/*
+ * Module_PowerSharing.h
+ *
+ *  Created on: 2020/12/07
+ *      Author: foluswen
+ */
+
+#ifndef MODULE_POWERSHARING_H_
+#define MODULE_POWERSHARING_H_
+
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include 	<sys/types.h>
+#include 	<sys/socket.h>
+#include 	<netinet/in.h>
+#include 	<netdb.h>
+#include 	<error.h>
+#include 	<signal.h>
+#include	"define.h"
+#include 	"main.h"
+
+//#define DEBUG
+#define is_error(ptr) 				((unsigned long)ptr > (unsigned long)-4000L)
+#define ARRAY_SIZE(A)				(sizeof(A) / sizeof(A[0]))
+#define PASS						1
+#define FAIL			   			-1
+#define ON							1
+#define OFF							0
+#define YES							1
+#define NO							0
+#define true			    		1
+#define false						0
+
+#define LISTEN_PORT_TCP				118
+#define	CONNECTION_LIMIT			5
+#define TIMEOUT_SPEC_HEARTBEAT		180
+#define TIMEOUT_SPEC_CHECK_CAPACITY	10
+
+#define ShmPowerShargingKey			LISTEN_PORT_TCP+8000
+
+enum ROTARY_SWITCH_LIMIT
+{
+	SWITCH_0_DEBUG=0,
+	SWITCH_1_12A,
+	SWITCH_2_16A,
+	SWITCH_3_20A,
+	SWITCH_4_24A,
+	SWITCH_5_28A,
+	SWITCH_6_32A,
+	SWITCH_7_36A,
+	SWITCH_8_40A,
+	SWITCH_9_48A,
+	SWITCH_A_56A,
+	SWITCH_B_64A,
+	SWITCH_C_72A,
+	SWITCH_D_80A,
+	SWITCH_E_RESERVE,
+	SWITCH_F_SLAVE
+};
+
+enum SHARING_COMMAND
+{
+	SHARING_CMD_GET_STATUS=0x01,
+	SHARING_CMD_SET_CAPACITY=0x02,
+	SHARING_CMD_CONNECTION_FULL=0xfd,
+	SHARING_CMD_CHKSUM_ERROR=0xfe,
+	SHARING_CMD_UNKNOWN=0xff
+};
+
+struct Message
+{
+	int			size;
+	uint8_t		buffer[2048];
+};
+
+struct CONNECTION_INFO
+{
+	int 		socketFd;					// Socket file description
+	uint16_t	availableSharingCurrent;	// Each connection available sharing current, resolution: 1A
+	uint16_t	presentOutputCurrent;		// Each connection preset output current, resolution: 1A
+	uint8_t		acPhase;					// Each connection ac power phase
+	uint16_t	SOC;						// Each connection preset SOC, resolution: 0.1%
+	uint16_t	remindTime;					// Each connection remind charging time, resolution: 1min
+	time_t		lastHeartBeatTime;			// Each connection latest get heart beat start time
+	time_t		lastGetStatusTime;			// Each connection latest get status start time
+	time_t		lastSetCapacityTime;		// Each connection latest set capacity start time
+	time_t		lastCheckCapacityTime;		// Each connection latest check capacity start time
+	uint8_t		isSocketConnected:1;		// Each connection socket connected flag
+	uint8_t		isGunConnected:1;			// Each connection gun connected flag
+};
+
+struct POWER_SHARING
+{
+	uint8_t					connectedQty;
+	uint16_t				onHandCurrent;
+	struct CONNECTION_INFO	Connection_Info[CONNECTION_LIMIT];
+	uint8_t					hasNewConn:1;
+};
+
+#endif /* MODULE_POWERSHARING_H_ */

+ 300 - 0
EVSE/Projects/AX80/Apps/Module_Speaker.c

@@ -0,0 +1,300 @@
+/*
+ * Module_Speaker.c
+ *
+ *  Created on: 2020年01月15日
+ *      Author: Eason Yang
+ */
+
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>      /*標準輸入輸出定義*/
+#include    <stdlib.h>     /*標準函數庫定義*/
+#include    <unistd.h>     /*Unix 標準函數定義*/
+#include    <fcntl.h>      /*檔控制定義*/
+#include    <termios.h>    /*PPSIX 終端控制定義*/
+#include    <errno.h>      /*錯誤號定義*/
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include	"define.h"
+#include	"main.h"
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define EVENT_INFO(format, args...) StoreEventLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+
+#define Debug
+#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
+#define PASS				1
+#define FAIL				-1
+#define ON					1
+#define OFF					0
+
+#define INTERVAL_1			100000
+#define INTERVAL_2			50000
+
+unsigned char speaker_type = SPEAKER_STOP;
+unsigned char pre_speaker_type = SPEAKER_STOP;
+
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData 			*ShmStatusCodeData;
+struct Charger					*ShmCharger;
+
+void trim(char *s);
+int mystrcmp(char *p1,char *p2);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+void split(char **arr, char *str, const char *del);
+
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
+	{
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1,
+					ShmSysConfigAndInfo->SysConfig.ModelName,
+					ShmSysConfigAndInfo->SysConfig.SerialNumber);
+	}
+	else
+	{
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%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,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1);
+	}
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+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;
+}
+
+//=================================
+// Common routine
+//=================================
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+int mystrcmp(char *p1,char *p2)
+{
+    while(*p1==*p2)
+    {
+        if(*p1=='\0' || *p2=='\0')
+            break;
+        p1++;
+        p2++;
+    }
+    if(*p1=='\0' && *p2=='\0')
+        return(PASS);
+    else
+        return(FAIL);
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+void split(char **arr, char *str, const char *del)
+{
+	char *s = strtok(str, del);
+
+	while(s != NULL)
+	{
+		*arr++ = s;
+		s = strtok(NULL, del);
+	}
+}
+
+//==========================================
+// Init all share memory
+//==========================================
+int InitShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//Initial ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), 0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("[shmat ShmSysConfigAndInfo NG\n");
+		#endif
+		result = FAIL;
+	}
+
+	//Initial ShmStatusCodeData
+	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), 0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+		#endif
+		result = FAIL;
+	}
+
+	//Initial ShmCharger
+	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), 0777)) < 0)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmget ShmChargerKey NG\n");
+		#endif
+		result = FAIL;
+	}
+	else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+		#ifdef SystemLogMessage
+		DEBUG_ERROR("shmat ShmChargerKey NG\n");
+		#endif
+		result = FAIL;
+	}
+
+	return result;
+}
+
+//================================================
+// Main process
+//================================================
+int main(void)
+{
+	if(InitShareMemory() == FAIL)
+	{
+		DEBUG_ERROR("InitShareMemory NG\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
+		}
+		sleep(5);
+		return FAIL;
+	}
+
+	for(;;)
+	{
+		if(ShmCharger->isSpeakerOn == ON)
+		{
+			switch(ShmCharger->speaker_type)
+			{
+				case SPEAKER_STOP:
+					DEBUG_INFO("SPEAKER_STOP...\n");
+					ShmCharger->isSpeakerOn = OFF;
+					break;
+				case SPEAKER_ALWAYS_ON:
+					break;
+				case SPEAKER_SHORT:
+					system("echo 1 > /sys/class/gpio/gpio65/value");
+					usleep(INTERVAL_1);
+					system("echo 0 > /sys/class/gpio/gpio65/value");
+
+					ShmCharger->isSpeakerOn = OFF;
+					DEBUG_INFO("SPEAKER_SHORT...\n");
+					break;
+				case SPEAKER_LONG:
+					break;
+				case SPEAKER_INTERVAL_SHORT:
+					break;
+				case SPEAKER_INTERVAL_LONG:
+					break;
+				case SPEAKER_INTERVAL_3COUNT:
+					system("echo 1 > /sys/class/gpio/gpio65/value");
+					usleep(INTERVAL_2);
+					system("echo 0 > /sys/class/gpio/gpio65/value");
+					usleep(INTERVAL_2);
+					system("echo 1 > /sys/class/gpio/gpio65/value");
+					usleep(INTERVAL_2);
+					system("echo 0 > /sys/class/gpio/gpio65/value");
+					usleep(INTERVAL_2);
+					system("echo 1 > /sys/class/gpio/gpio65/value");
+					usleep(INTERVAL_2);
+					system("echo 0 > /sys/class/gpio/gpio65/value");
+
+					ShmCharger->isSpeakerOn = OFF;
+					DEBUG_INFO("SPEAKER_INTERVAL_3COUNT...\n");
+					break;
+			}
+		}
+		usleep(100000);
+	}
+}
+

+ 6273 - 0
EVSE/Projects/AX80/Apps/main.c

@@ -0,0 +1,6273 @@
+#include	"define.h"
+#include 	"main.h"
+
+//#define CDFA_CERTIFICATE	// Only enable for CDFA certificate to send receipt by Phihong back end API
+
+//==========================
+// System basic sample constant
+//==========================
+#define is_error(ptr) 					((unsigned long)ptr > (unsigned long)-4000L)
+#define ARRAY_SIZE(A)					(sizeof(A) / sizeof(A[0]))
+#define PASS							1
+#define FAIL							-1
+#define YES								1
+#define NO								0
+#define ON								1
+#define OFF								0
+#define BUFFER_SIZE						128
+
+//==========================
+// Timeout constant define
+//==========================
+#define TIMEOUT_SPEC_HANDSHAKING				180
+#define TIMEOUT_SPEC_AUTH						15
+#define TIMEOUT_SPEC_HANDSHAKING_LED			185
+#define TIMEOUT_SPEC_LOGPPRINTOUT				30
+#define TIMEOUT_SPEC_PROFILE_PREPARE			60
+#define TIMEOUT_SPEC_BS_HLC_HANDSHAKE			60
+#define TIMEOUT_SPEC_EV_READY					30
+#define TIMEOUT_SPEC_CCS_HEARTBEAT_COUNT_RESET	10
+#define TIMEOUT_SPEC_CCS_HANDSHAKE				120
+#define TIMEOUT_SPEC_PWN_CHANGE					5
+#define TIMEOUT_SPEC_POWERSAVING_LCD			120
+#define TIMEOUT_SPEC_POWERSAVING_RFID			120
+#define TIMEOUT_SPEC_POWERSAVING_METER			120
+#define TIMEOUT_SPEC_POWERSAVING_LED_STATUS		120
+#define TIMEOUT_SPEC_CEHCK_POWER_CONSUMPTION	15
+#define TIMEOUT_SPEC_UPGRADE					300
+
+//==========================
+// GPIO constant define
+//==========================
+#define GPIO_OUT_RST_RFID				62
+#define GPIO_OUT_RST_4G					114
+#define GPIO_OUT_RST_QCA				115
+#define GPIO_OUT_RST_ETH				89
+#define GPIO_IN_WAKEUP					63
+
+#define MtdBlockSize 					0x300000
+
+#define DB_FILE							"/Storage/ChargeLog/localCgargingRecord.db"
+//==========================
+// Declare method
+//==========================
+void trim(char *s);
+int mystrcmp(char *p1,char *p2);
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
+void split(char **arr, char *str, const char *del);
+
+int isReachableInternet();
+int isRouteFail();
+int InitRfidPort(void);
+int GetCardSerialNumber();
+void setLedMotion(unsigned char gun_index,unsigned char led_mode);
+void setRequest(unsigned char gun_index,unsigned char isOn);
+void setSpeaker(unsigned char isOn, unsigned char speaker_mode);
+
+//==========================
+// Declare RFID module type
+//==========================
+#define MODULE_EWT		0
+
+int		wtdFd = -1;
+int 	rfidFd = -1;
+char* 	rfidPortName = "/dev/ttyS2";
+RFID 	rfid;
+char 	*valid_Internet[2] 	  = {"8.8.8.8", "180.76.76.76"};
+
+//==========================
+// Declare share memory
+//==========================
+struct SysConfigAndInfo			*ShmSysConfigAndInfo;
+struct StatusCodeData			*ShmStatusCodeData;
+struct PsuData					*ShmPsuData;
+struct CHAdeMOData				*ShmCHAdeMOData;
+struct CcsData					*ShmCcsData;
+struct PrimaryMcuData			*ShmPrimaryMcuData;
+struct FanModuleData			*ShmFanModuleData;
+struct RelayModuleData			*ShmRelayModuleData;
+struct OCPP16Data				*ShmOCPP16Data;
+struct OCPP20Data				*ShmOCPP20Data;
+struct Charger					*ShmCharger;
+struct DISPENSER				*ShmDispenser;
+
+struct timespec					startTime[AC_QUANTITY][TMR_IDX_CNT];
+struct timespec 				startChargingTime[AC_QUANTITY];
+struct timespec 				endChargingTime[AC_QUANTITY];
+sqlite3 *localDb;
+
+struct SysConfigData			SysConfigOrg;
+ParsingRatedCur 				modelnameInfo={0};
+//=================================
+// Common routine
+//=================================
+void trim(char *s)
+{
+    int i=0, j, k, l=0;
+
+    while((s[i]==' ')||(s[i]=='\t')||(s[i]=='\n'))
+        i++;
+
+    j = strlen(s)-1;
+    while((s[j]==' ')||(s[j]=='\t')||(s[j]=='\n'))
+        j--;
+
+    if(i==0 && j==strlen(s)-1) { }
+    else if(i==0) s[j+1] = '\0';
+    else {
+        for(k=i; k<=j; k++) s[l++] = s[k];
+        s[l] = '\0';
+    }
+}
+
+int mystrcmp(char *p1,char *p2)
+{
+    while(*p1==*p2)
+    {
+        if(*p1=='\0' || *p2=='\0')
+            break;
+        p1++;
+        p2++;
+    }
+    if(*p1=='\0' && *p2=='\0')
+        return(PASS);
+    else
+        return(FAIL);
+}
+
+void substr(char *dest, const char* src, unsigned int start, unsigned int cnt)
+{
+	strncpy(dest, src + start, cnt);
+	dest[cnt] = 0;
+}
+
+void split(char **arr, char *str, const char *del)
+{
+	char *s = strtok(str, del);
+
+	while(s != NULL)
+	{
+		*arr++ = s;
+		s = strtok(NULL, del);
+	}
+}
+
+int StoreLogMsg(const char *fmt, ...)
+{
+	char Buf[4096+256];
+	char buffer[4096];
+	time_t CurrentTime;
+	struct tm *tm;
+	struct timeval tv;
+	va_list args;
+
+	va_start(args, fmt);
+	int rc = vsnprintf(buffer, sizeof(buffer), fmt, args);
+	va_end(args);
+
+	memset(Buf,0,sizeof(Buf));
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	gettimeofday(&tv, NULL); // get microseconds, 10^-6
+
+	if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
+	{
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
+					tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1,
+					ShmSysConfigAndInfo->SysConfig.ModelName,
+					ShmSysConfigAndInfo->SysConfig.SerialNumber);
+	}
+	else
+	{
+		sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%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,
+					buffer,
+					tm->tm_year+1900,tm->tm_mon+1);
+	}
+
+#ifdef SystemLogMessage
+	system(Buf);
+#endif
+
+#ifdef ConsloePrintLog
+	printf("[%04d.%02d.%02d %02d:%02d:%02d.%06ld]%s", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,tv.tv_usec, buffer);
+#endif
+
+	return rc;
+}
+
+void refreshStartTimer(struct timespec *timer)
+{
+	clock_gettime(CLOCK_MONOTONIC, timer);
+}
+
+int getDiffSecNow(struct timespec timer)
+{
+	struct timespec timerNow;
+
+	clock_gettime(CLOCK_MONOTONIC, &timerNow);
+
+	return (int)((((unsigned long)(timerNow.tv_sec - timer.tv_sec) * 1000) + ((unsigned long)((timerNow.tv_nsec / 1000000) - (timer.tv_nsec / 1000000))))/1000);
+}
+
+int getDiffSecBetween(struct timespec start, struct timespec end)
+{
+	return (int)((((unsigned long)(end.tv_sec - start.tv_sec) * 1000) + ((unsigned long)((end.tv_nsec / 1000000) - (start.tv_nsec / 1000000))))/1000);
+}
+
+long long DiffTimebWithNow(struct timeb ST)
+{
+	//return milli-second
+	struct timeb ET;
+	long long StartTime,StopTime;
+
+	ftime(&ET);
+	StartTime=(long long)ST.time;
+	StopTime=(long long)ET.time;
+	return ((StopTime-StartTime)*1000) + (ET.millitm-ST.millitm);
+}
+
+long long DiffTimeb(struct timeb ST, struct timeb ET)
+{
+	//return milli-second
+	long long StartTime,StopTime;
+
+	StartTime=(long long)ST.time;
+	StopTime=(long long)ET.time;
+	return ((StopTime-StartTime)*1000) + (ET.millitm-ST.millitm);
+}
+
+int DiffTimebWithNowSec(struct timeb ST)
+{
+	//return milli-second
+	struct timeb ET;
+	unsigned int StartTime,StopTime;
+
+	ftime(&ET);
+	StartTime=(unsigned int)ST.time;
+	StopTime=(unsigned int)ET.time;
+	return (StopTime-StartTime);
+}
+
+int isOvertNow(uint8_t *start)
+{
+	int result = YES;
+	struct ParsingResult
+	{
+		int result;
+		int scanedElement;
+		int year;
+		int month;
+		int mday;
+		int hour;
+		int min;
+		int sec;
+		int tz_hour;
+		int tz_min;
+		float minSec;
+	}parsingResult;
+
+	struct tm tmStart;
+	struct timeb tbStart;
+
+	memset(&parsingResult, 0x00, sizeof(struct ParsingResult));
+
+	if(strstr((char*)start, ".") != NULL)
+	{
+		// Original data with mini second
+		if(strstr((char*)start, "Z") != NULL)
+		{
+			// Original data with Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%fZ",
+																&parsingResult.year,
+																&parsingResult.month,
+																&parsingResult.mday,
+																&parsingResult.hour,
+																&parsingResult.min,
+																&parsingResult.sec,
+																&parsingResult.minSec);
+		}
+		else
+		{
+			// Original data without Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%f%d:%d",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec,
+												&parsingResult.minSec,
+												&parsingResult.tz_hour,
+												&parsingResult.tz_min);
+		}
+	}
+	else
+	{
+		// Original data without mini second
+		if(strstr((char*)start, "Z") != NULL)
+		{
+			// Original data with Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%dZ",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec);
+		}
+		else
+		{
+			// Original data without Z
+			parsingResult.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d%d:%d",
+												&parsingResult.year,
+												&parsingResult.month,
+												&parsingResult.mday,
+												&parsingResult.hour,
+												&parsingResult.min,
+												&parsingResult.sec,
+												&parsingResult.tz_hour,
+												&parsingResult.tz_min);
+		}
+	}
+
+	if(parsingResult.scanedElement >= 6)
+	{
+		tmStart.tm_year = parsingResult.year - 1900;
+		tmStart.tm_mon = parsingResult.month - 1;
+		tmStart.tm_mday = parsingResult.mday;
+		tmStart.tm_hour = parsingResult.hour;
+		tmStart.tm_min = parsingResult.min;
+		tmStart.tm_sec = parsingResult.sec;
+		tmStart.tm_gmtoff = 0;
+		tbStart.time = mktime(&tmStart);
+		tbStart.timezone = 0;
+		tbStart.millitm = 0;
+
+		tbStart.time -= (parsingResult.tz_hour*3600) + (parsingResult.tz_min*60*(parsingResult.tz_hour>=0?1:-1));
+
+		if(DiffTimebWithNowSec(tbStart) <= 0)
+			result = NO;
+		else
+			result = YES;
+	}
+	else
+	{
+		DEBUG_WARN("Start date parsing error.\n");
+	}
+
+	return result;
+}
+
+void getDateTimeString(char* result)
+{
+	time_t CurrentTime;
+	struct tm *tm;
+
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+
+	sprintf(result, "%04d.%02d.%02d %02d:%02d:%02d", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec);
+}
+
+int getCurrentYear()
+{
+	int result = 0;
+	time_t CurrentTime;
+	struct tm *tm;
+
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+	result = (tm->tm_year + 1900);
+
+	return result;
+}
+
+unsigned long long getAvailableMemory()
+{
+    long pages = sysconf(_SC_AVPHYS_PAGES);
+    long page_size = sysconf(_SC_PAGE_SIZE);
+    return pages * page_size;
+}
+
+unsigned int isKernelSupportNAT()
+{
+	unsigned int result = NO;
+	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 = YES;
+		}
+	}
+	pclose(fp);
+
+	return result;
+}
+
+int getEth0MacAddress()
+{
+	int result = PASS;
+	FILE *fp;
+	char cmd[256];
+	char buf[512];
+	char tmp[512];
+
+	strcpy(cmd, "ifconfig eth0");
+	fp = popen(cmd, "r");
+	if(fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			if(strstr(buf, "eth0") > 0)
+			{
+				result = PASS;
+			}
+
+			if(strstr(buf, "eth0      Link encap:Ethernet  HWaddr") > 0)
+			{
+				sscanf(buf, "%*s%*s%*s%*s%s", tmp);
+				strcpy((char*)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthMacAddress, tmp);
+			}
+		}
+	}
+	pclose(fp);
+
+	return result;
+}
+
+//======================================================
+// OCPP routine
+//======================================================
+void ocpp_process_start()
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+		system("/root/OcppBackend &");
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+		system("/root/OcppBackend20 &");
+}
+
+uint8_t ocpp_get_connection_status()
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->OcppConnStatus;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->OcppConnStatus;
+	}
+
+	return result;
+}
+
+uint16_t ocpp_get_connection_timeout()
+{
+	uint16_t result = TIMEOUT_SPEC_HANDSHAKING;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(strcmp((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData,"") != 0)
+		{
+			result = atoi((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData);
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(strcmp((char *)ShmOCPP20Data->ControllerComponentVariable[TxCtrlr_EVConnectionTimeOut].variableAttribute[0].value,"") != 0)
+		{
+			result = atoi((char *)ShmOCPP20Data->ControllerComponentVariable[TxCtrlr_EVConnectionTimeOut].variableAttribute[0].value);
+		}
+	}
+
+	return result;
+}
+
+uint8_t ocpp_get_update_firmware_req()
+{
+	uint8_t result = NO;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->MsMsg.bits.UpdateFirmwareReq;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->MsMsg.bits.UpdateFirmwareReq;
+	}
+
+	return result;
+}
+
+uint8_t ocpp_get_reset_req()
+{
+	uint8_t result = NO;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->MsMsg.bits.ResetReq;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->MsMsg.bits.ResetReq;
+	}
+
+	return result;
+}
+
+void ocpp_boot_info_sync()
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		memcpy((char*)ShmOCPP16Data->OcppServerURL, (char*)ShmSysConfigAndInfo->SysConfig.OcppServerURL, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppServerURL));
+		memcpy((char*)ShmOCPP16Data->ChargeBoxId, (char*)ShmSysConfigAndInfo->SysConfig.ChargeBoxId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ChargeBoxId));
+		sprintf((char*)ShmOCPP16Data->BootNotification.CpFwVersion, (char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
+		sprintf((char*)ShmOCPP16Data->BootNotification.CpMeterSerialNumber, "N/A");
+
+		switch(ShmSysConfigAndInfo->SysConfig.ModelName[3])
+		{
+			case 'M':
+			case 'Z':
+				sprintf((char*)ShmOCPP16Data->BootNotification.CpMeterType, "MID");
+				break;
+			case 'P':
+				sprintf((char*)ShmOCPP16Data->BootNotification.CpMeterType, "PTB");
+				break;
+			case 'I':
+				sprintf((char*)ShmOCPP16Data->BootNotification.CpMeterType, "TIC");
+				break;
+			case 'U':
+				sprintf((char*)ShmOCPP16Data->BootNotification.CpMeterType, "UL");
+				break;
+			default:
+				sprintf((char*)ShmOCPP16Data->BootNotification.CpMeterType, "N/A");
+				break;
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		memcpy((char*)ShmOCPP20Data->OcppServerURL, (char*)ShmSysConfigAndInfo->SysConfig.OcppServerURL, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.OcppServerURL));
+		memcpy((char*)ShmOCPP20Data->ChargeBoxId, (char*)ShmSysConfigAndInfo->SysConfig.ChargeBoxId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ChargeBoxId));
+		sprintf((char*)ShmOCPP20Data->BootNotification.chargingStation.firmwareVersion, (char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
+	}
+}
+
+void ocpp_set_remotestart(uint8_t gun_index, uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq != status)
+			ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq = status;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CsMsg.bits[gun_index].RequestStartTransactionReq != status)
+			ShmOCPP20Data->CsMsg.bits[gun_index].RequestStartTransactionReq = status;
+	}
+}
+
+void ocpp_set_remotestop(uint8_t gun_index, uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq != status)
+			ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq = status;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CsMsg.bits[gun_index].RequestStopTransactionReq != status)
+			ShmOCPP20Data->CsMsg.bits[gun_index].RequestStopTransactionReq = status;
+	}
+}
+
+uint8_t ocpp_get_remotestart(uint8_t gun_index)
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->CsMsg.bits[gun_index].RequestStartTransactionReq;
+	}
+
+	return result;
+}
+
+void ocpp_copy_userid_from_remotestart(uint8_t gun_index)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, ARRAY_SIZE(ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag));
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP20Data->RequestStartTransaction[gun_index].idToken.idToken, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+	}
+}
+
+uint8_t ocpp_get_remotestop(uint8_t gun_index)
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->CsMsg.bits[gun_index].RequestStopTransactionReq;
+	}
+
+	return result;
+}
+
+void ocpp_set_auth_req(uint8_t status, ...)
+{
+	va_list args;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->SpMsg.bits.AuthorizeReq != status)
+		{
+			if(status == ON)
+				memset(ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, 0x00, ARRAY_SIZE(ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status));
+
+			ShmOCPP16Data->SpMsg.bits.AuthorizeReq = status;
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->SpMsg.bits.AuthorizeReq != status)
+		{
+			if(status == ON)
+			{
+				memset(&ShmOCPP20Data->Authorize.Response_idTokenInfo, 0x00, sizeof(struct IdTokenInfoType));
+				va_start(args, status);
+				sprintf((char*)ShmOCPP20Data->Authorize.idToken.type, "%s", va_arg(args, char*));
+				va_end(args);
+			}
+
+			ShmOCPP20Data->SpMsg.bits.AuthorizeReq = status;
+		}
+	}
+}
+
+uint8_t ocpp_get_auth_req()
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->SpMsg.bits.AuthorizeReq;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->SpMsg.bits.AuthorizeReq;
+	}
+
+	return result;
+}
+
+void ocpp_set_auth_conf(uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf != status)
+			ShmOCPP16Data->SpMsg.bits.AuthorizeConf = status;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->SpMsg.bits.AuthorizeConf != status)
+			ShmOCPP20Data->SpMsg.bits.AuthorizeConf = status;
+	}
+}
+
+uint8_t ocpp_get_auth_conf()
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->SpMsg.bits.AuthorizeConf;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->SpMsg.bits.AuthorizeConf;
+	}
+
+	return result;
+}
+
+uint8_t ocpp_get_auth_result(uint8_t isValidParent, ...)
+{
+	uint8_t result = OFF;
+	va_list args;
+	uint8_t gun_index;
+
+	if(isValidParent)
+	{
+		va_start(args, isValidParent);
+		gun_index = va_arg(args, int);
+		va_end(args);
+
+		switch(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus)
+		{
+			case SYS_MODE_AUTHORIZING:
+				if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+				{
+					if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0))
+						result = PASS;
+				}
+				else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+				{
+					if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0))
+						result = PASS;
+				}
+
+				break;
+			case SYS_MODE_CHARGING:
+			case SYS_MODE_TERMINATING:
+				if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+				{
+					/*
+					DEBUG_INFO("==========================================\n");
+					DEBUG_INFO("=== OCPP GETTING AUTHORIZE RESULT 1.6 ====\n");
+					DEBUG_INFO("==========================================\n");
+					DEBUG_INFO("Authorize.ResponseIdTagInfo.ParentIdTag : %s \n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag);
+					DEBUG_INFO("StartTransaction[%d].ResponseIdTagInfo.ParentIdTag : %s \n", gun_index ,ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ParentIdTag);
+					*/
+					
+					if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) &&
+					   (strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag, (char*)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ParentIdTag)==0))
+						result = PASS;
+				}
+				else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+				{
+					/*
+					DEBUG_INFO("==========================================\n");
+					DEBUG_INFO("=== OCPP GETTING AUTHORIZE RESULT 2.0 ====\n");
+					DEBUG_INFO("==========================================\n");
+					DEBUG_INFO("Authorize.Response_idTokenInfo.groupIdToken.idToken : %s \n", ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken);
+					DEBUG_INFO("TransactionEvent[%d].Response_idTokenInfo.groupIdToken.idToken : %s \n", gun_index, ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.groupIdToken.idToken);
+					*/
+					
+					if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0) &&
+					   (strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.groupIdToken.idToken)==0))
+						result = PASS;
+				}
+
+				break;
+			default:
+				break;
+		}
+	}
+	else
+	{
+		if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+		{
+			if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0))
+				result = PASS;
+		}
+		else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+		{
+			if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0))
+				result = PASS;
+		}
+	}
+
+	//DEBUG_INFO("Authorize result : %s \n", ((result == PASS)?"Pass":"Fail"));
+
+	return result;
+}
+
+uint8_t ocpp_get_unlocker_req(uint8_t gun_index)
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor;
+	}
+
+	return result;
+}
+
+void ocpp_set_unlocker_req(uint8_t gun_index, uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor != status)
+			ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor = status;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor != status)
+			ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor = status;
+	}
+}
+
+void ocpp_set_starttransaction_req(uint8_t gun_index, uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionReq != status)
+			ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionReq = status;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq != status)
+			ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = status;
+	}
+}
+
+void ocpp_set_starttransaction_conf(uint8_t gun_index, uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionConf != status)
+			ShmOCPP16Data->CpMsg.bits[gun_index].StartTransactionConf = status;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventConf != status)
+			ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventConf = status;
+	}
+}
+
+void ocpp_set_stoptransaction_req(uint8_t gun_index, uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq != status)
+			ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq = status;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq != status)
+			ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = status;
+	}
+}
+
+void ocpp_set_stoptransaction_conf(uint8_t gun_index, uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionConf != status)
+		{
+			ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionConf = status;
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventConf != status)
+		{
+			ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventConf = status;
+		}
+	}
+}
+
+void ocpp_copy_userid_to_starttransaction(uint8_t gun_index)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		memcpy((char*)ShmOCPP16Data->StartTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StartTransaction[gun_index].IdTag));
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		memcpy((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId));
+	}
+}
+
+uint8_t ocpp_get_starttransaction_result(uint8_t gun_index)
+{
+	uint8_t result = PASS;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnInvalidId].ItemData, "TRUE"))
+		{
+			if((strcmp((char*)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status, "Blocked")==0) ||
+			   (strcmp((char*)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status, "Expired")==0) ||
+			   (strcmp((char*)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status, "Invalid")==0))
+				result = NO;
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[TxCtrlr_StopTxOnInvalidId].variableAttribute[0].value, "TRUE"))
+		{
+			if((strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.status, "Blocked")==0) ||
+			   (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.status, "Expired")==0) ||
+			   (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.status, "Invalid")==0) ||
+			   (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.status, "NoCredit")==0) ||
+			   (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.status, "NotAllowedTypeEVSE")==0) ||
+			   (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.status, "NotAtThisLocation")==0) ||
+			   (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.status, "NotAtThisTime")==0) ||
+			   (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.status, "Unknown")==0))
+				result = NO;
+		}
+	}
+
+	return result;
+}
+
+uint8_t ocpp_get_smartcharging_profileId(uint8_t gun_index)
+{
+	uint8_t result = 0;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfileId;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->SmartChargingProfile[gun_index].id;
+	}
+
+	return result;
+}
+
+void ocpp_reset_smartcharging_profileId(uint8_t gun_index)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfileId = 0;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		ShmOCPP20Data->SmartChargingProfile[gun_index].id = 0;
+	}
+}
+
+uint8_t ocpp_get_profile_req(uint8_t gun_index)
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq;
+	}
+
+	return result;
+}
+
+void ocpp_set_profile_req(uint8_t gun_index, uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq != status)
+			ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq = status;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq != status)
+			ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq = status;
+	}
+}
+
+uint8_t ocpp_get_profile_conf(uint8_t gun_index)
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileConf;
+	}
+
+	return result;
+}
+
+void ocpp_set_profile_conf(uint8_t gun_index, uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf != status)
+			ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf = status;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileConf != status)
+			ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileConf = status;
+	}
+}
+
+uint8_t ocpp_get_StopTransactionOnEVSideDisconnect()
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(strcmp((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTransactionOnEVSideDisconnect].ItemData, "TRUE") == 0)
+			result = ON;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(strcmp((char *)ShmOCPP20Data->ControllerComponentVariable[TxCtrlr_StopTxOnEVSideDisconnect].variableAttribute[0].value, "TRUE") == 0)
+			result = ON;
+	}
+
+	return result;
+}
+
+uint8_t ocpp_get_cancelreservation_req(uint8_t gun_index)
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		result = ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationReq;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		result = ShmOCPP20Data->CsMsg.bits[gun_index].CancelReservationReq;
+	}
+
+	return result;
+}
+
+void ocpp_set_cancelreservation_req(uint8_t gun_index, uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationReq != status)
+			ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationReq = status;
+
+		if(ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationReq == OFF)
+			ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationConf = ON;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CsMsg.bits[gun_index].CancelReservationReq != status)
+			ShmOCPP20Data->CsMsg.bits[gun_index].CancelReservationReq = status;
+
+		if(ShmOCPP20Data->CsMsg.bits[gun_index].CancelReservationReq == OFF)
+			ShmOCPP20Data->CsMsg.bits[gun_index].CancelReservationConf = ON;
+	}
+}
+
+uint8_t ocpp_compare_reserve_id_with_user(uint8_t gun_index)
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char*)ShmOCPP16Data->ReserveNow[gun_index].IdTag) == 0)
+			result = ON;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char*)ShmOCPP20Data->ReserveNow[gun_index].idToken.idToken) == 0)
+			result = ON;
+	}
+
+	return result;
+}
+
+uint8_t ocpp_compare_reserve_id_with_remote_user(uint8_t gun_index)
+{
+	uint8_t result = OFF;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(strcmp((char*)ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, (char*)ShmOCPP16Data->ReserveNow[gun_index].IdTag) == 0)
+		{
+			result = ON;
+			memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, ARRAY_SIZE(ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag));
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(strcmp((char*)ShmOCPP20Data->RequestStartTransaction[gun_index].idToken.idToken, (char*)ShmOCPP20Data->ReserveNow[gun_index].idToken.idToken) == 0)
+		{
+			result = ON;
+			memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP20Data->RequestStartTransaction[gun_index].idToken.idToken, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+		}
+	}
+
+	return result;
+}
+
+uint8_t ocpp_isAuthorizeRemoteStart()
+{
+	uint8_t result = NO;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeRemoteTxRequests].ItemData, "TRUE"))
+		{
+			result = YES;
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_AuthorizeRemoteStart].variableAttribute[0].value, "TRUE"))
+		{
+			result = YES;
+		}
+	}
+
+	return result;
+}
+
+//======================================================
+// Check interface status
+//======================================================
+int isInterfaceUp(const char *interface)
+{
+	int result = FAIL;
+
+	FILE *fp;
+	char cmd[256];
+	char buf[512];
+
+	strcpy(cmd, "ifconfig");;
+	fp = popen(cmd, "r");
+	if(fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			if(strstr(buf, interface) > 0)
+			{
+				result = PASS;
+			}
+		}
+	}
+	pclose(fp);
+
+	return result;
+}
+
+//======================================================
+// Create all share memory
+//======================================================
+int CreatShareMemory()
+{
+	int result = PASS;
+	int MeterSMId;
+
+	//creat ShmSysConfigAndInfo
+	if ((MeterSMId = shmget(ShmSysConfigAndInfoKey, sizeof(struct SysConfigAndInfo), IPC_CREAT | 0777)) < 0)
+	{
+		DEBUG_ERROR("shmget ShmSysConfigAndInfo NG\n");
+		result = FAIL;
+	}
+	else if ((ShmSysConfigAndInfo = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+
+		DEBUG_ERROR("shmat ShmSysConfigAndInfo NG\n");
+
+		result = FAIL;
+   	}
+   	memset(ShmSysConfigAndInfo,0,sizeof(struct SysConfigAndInfo));
+
+	//creat ShmPsuData
+   	if ((MeterSMId = shmget(ShmPsuKey, sizeof(struct PsuData), IPC_CREAT | 0777)) < 0)
+    {
+   		DEBUG_ERROR("shmget ShmPsuData NG\n");
+   		result = FAIL;
+	}
+    else if ((ShmPsuData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+    	DEBUG_ERROR("shmat ShmPsuData NG\n");
+    	result = FAIL;
+   	}
+    else
+    {}
+
+   	//creat ShmStatusCodeData
+   	if ((MeterSMId = shmget(ShmStatusCodeKey, sizeof(struct StatusCodeData), IPC_CREAT | 0777)) < 0)
+	{
+
+   		DEBUG_ERROR("shmget ShmStatusCodeData NG\n");
+
+   		result = FAIL;
+	}
+	else if ((ShmStatusCodeData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+
+		DEBUG_ERROR("shmat ShmStatusCodeData NG\n");
+
+		result = FAIL;
+   	}
+   	memset(ShmStatusCodeData, 0, sizeof(struct StatusCodeData));
+
+   	//creat ShmPrimaryMcuData
+    if ((MeterSMId = shmget(ShmPrimaryMcuKey, sizeof(struct PrimaryMcuData), IPC_CREAT | 0777)) < 0)
+   	{
+
+   		DEBUG_ERROR("shmget ShmPrimaryMcuData NG\n");
+
+   		result = FAIL;
+	}
+    else if ((ShmPrimaryMcuData = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+
+    	DEBUG_ERROR("shmat ShmPrimaryMcuData NG\n");
+
+    	result = FAIL;
+   	}
+   	memset(ShmPrimaryMcuData,0,sizeof(struct PrimaryMcuData));
+
+   	//creat ShmOCPP16Data
+   	if ((MeterSMId = shmget(ShmOcppModuleKey, sizeof(struct OCPP16Data), IPC_CREAT | 0777)) < 0)
+    {
+
+   		DEBUG_ERROR("shmget ShmOCPP16Data NG\n");
+
+   		result = FAIL;
+	}
+    else if ((ShmOCPP16Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+
+    	DEBUG_ERROR("shmat ShmOCPP16Data NG\n");
+
+    	result = FAIL;
+   	}
+   	memset(ShmOCPP16Data,0,sizeof(struct OCPP16Data));
+
+   	//creat ShmOCPP20Data
+	if ((MeterSMId = shmget(ShmOcpp20ModuleKey, sizeof(struct OCPP20Data), IPC_CREAT | 0777)) < 0)
+	{
+
+		DEBUG_ERROR("shmget OCPP20Data NG\n");
+
+		result = FAIL;
+	}
+	else if ((ShmOCPP20Data = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+	{
+
+		DEBUG_ERROR("shmat OCPP20Data NG\n");
+
+		result = FAIL;
+	}
+	memset(ShmOCPP20Data,0,sizeof(struct OCPP20Data));
+
+	//creat ShmCharger
+   	if ((MeterSMId = shmget(ShmChargerKey, sizeof(struct Charger), IPC_CREAT | 0777)) < 0)
+    {
+
+   		DEBUG_ERROR("shmget ShmCharger NG\n");
+
+   		result = FAIL;
+	}
+    else if ((ShmCharger = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+
+    	DEBUG_ERROR("shmat ShmCharger NG\n");
+
+    	result = FAIL;
+   	}
+   	memset(ShmCharger,0,sizeof(struct Charger));
+
+	//creat ShmDispenser
+   	if ((MeterSMId = shmget(ShmDispenserKey, sizeof(struct DISPENSER), IPC_CREAT | 0777)) < 0)
+    {
+
+   		DEBUG_ERROR("shmget ShmDispenser NG\n");
+
+   		result = FAIL;
+	}
+    else if ((ShmDispenser = shmat(MeterSMId, NULL, 0)) == (void *) -1)
+    {
+
+    	DEBUG_ERROR("shmat ShmDispenser NG\n");
+
+    	result = FAIL;
+   	}
+   	memset(ShmDispenser,0,sizeof(struct DISPENSER));
+
+   	ShmSysConfigAndInfo->SysInfo.InternetConn = OFF;
+    return result;
+}
+
+//======================================================
+// Call WEBAPI to mail receipt (Only for CDFA verify)
+//======================================================
+#ifdef CDFA_CERTIFICATE
+int sendReceiptMail(char *startDateTime, char *stopDateTime, char *receiptInfo)
+{
+	int result = FAIL;
+	char reciever[128];
+	char subject[128];
+	char content[8192];
+	char priceDetail[4098]={0};
+	char cmdBuf[8192];
+
+	double totalEnergy;
+	double totalPrice;
+	json_object *detailPrice = json_tokener_parse(receiptInfo);
+
+	if(!is_error(detailPrice))
+	{
+		if(json_object_object_get(detailPrice, "totalChargedEnergy") != NULL)
+			totalEnergy = json_object_get_double(json_object_object_get(detailPrice, "totalChargedEnergy"));
+
+		if(json_object_object_get(detailPrice, "totalPrice") != NULL)
+			totalPrice = json_object_get_double(json_object_object_get(detailPrice, "totalPrice"));
+
+		if(json_object_object_get(detailPrice, "receiptDetail") != NULL)
+		{
+			for(int idx=0;idx<json_object_array_length(json_object_object_get(detailPrice, "receiptDetail"));idx++)
+			{
+				sprintf(priceDetail, "%s---%02d:00, %.4f KWH @ $ %.2f = $ %.2f<br/>\n", priceDetail
+																                 , json_object_get_int(json_object_object_get(json_object_array_get_idx(json_object_object_get(detailPrice, "receiptDetail"), idx), "hour"))
+																			     , json_object_get_double(json_object_object_get(json_object_array_get_idx(json_object_object_get(detailPrice, "receiptDetail"), idx), "chargedEnergy"))
+																				 , json_object_get_double(json_object_object_get(json_object_array_get_idx(json_object_object_get(detailPrice, "receiptDetail"), idx), "unitPrice"))
+																				 , json_object_get_double(json_object_object_get(json_object_array_get_idx(json_object_object_get(detailPrice, "receiptDetail"), idx), "periodPrice")));
+			}
+		}
+
+	}
+	json_object_put(detailPrice);
+
+	// Generate mail content
+	sprintf(reciever, "folus_wen@phihong.com.tw");
+	sprintf(subject, "Charging Receipt From %s", ShmSysConfigAndInfo->SysConfig.chargePointVendor);
+	sprintf(content, "<img src=\"https://www.phihong.com/images/logo.png\"/><br/>\n"
+					 "<h1>Receipt of charging on %s</h1><br/>\n"
+					 "<b>Location Name:</b> CDFA Lab<br/>\n"
+					 "<b>Location Address:</b> xxxxxxxxxxx<br/>\n"
+					 "<b>EVSE ID:</b> %s<br/>\n"
+					 "<b>Maximum Rate of Energy Transfer:</b> 11.5 KW AC<br/>\n"
+					 "<b>Charging start date time:</b> %s<br/>\n"
+					 "<b>Charging stop date time:</b> %s<br/>\n"
+					 "<b>Energy Delivered:</b> %.4f KWH<br/>\n"
+					 "<b>Cost of Charging:</b><br/>\n"
+				     "%s"
+					 "***Total charged cost: $ %.2f<br/>\n"
+					 "<br/>\n"
+					 "<br/>\n"
+					 "%s<br/>\n"
+					 "47800 Fremont Blvd.<br/>\n"
+					 "Fremont, CA 94538, USA<br/>\n", startDateTime
+					 	 	 	 	 	 	   	    , ShmSysConfigAndInfo->SysConfig.ChargeBoxId
+													, startDateTime
+												    , stopDateTime
+												    , totalEnergy
+												    , priceDetail
+												    , totalPrice
+												    , ShmSysConfigAndInfo->SysConfig.chargePointVendor);
+
+	json_object *post = json_object_new_object();
+	json_object_object_add(post, "Receiver", json_object_new_string(reciever));
+	json_object_object_add(post, "Subject", json_object_new_string(subject));
+	json_object_object_add(post, "Body", json_object_new_string(content));
+	json_object_object_add(post, "UseHtml", json_object_new_boolean(1));
+	// Call WEBAPI
+	sprintf(cmdBuf, "curl -X POST -k -d '%s' -H \"Content-Type: application/json\" https://ocpp.phihong.com.tw:5014/api/Notification/ &", json_object_to_json_string_ext(post, JSON_C_TO_STRING_PLAIN));
+	system(cmdBuf);
+	//DEBUG_INFO("cmdBuf: %s\n", cmdBuf);
+	json_object_put(post);
+
+	return result;
+}
+#endif	/* CDFA_CERTIFICATE */
+//======================================================
+// SQLite3 related routine
+//======================================================
+int getReceiptInfo(uint8_t gun_index, char *receiptInfo)
+{
+	int result = PASS;
+	double totalEnergy=0.0;
+	double totalPrice=0.0;
+
+	json_object *receipt = json_object_new_object();
+	json_object *receiptAry = json_object_new_array();
+
+	for(uint8_t idxHour=0;idxHour<ARRAY_SIZE(ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod);idxHour++)
+	{
+		json_object *receiptDetail = json_object_new_object();
+
+		json_object_object_add(receiptDetail, "hour", json_object_new_int(idxHour));
+		json_object_object_add(receiptDetail, "chargedEnergy", json_object_new_double(ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[idxHour]));
+		json_object_object_add(receiptDetail, "unitPrice", json_object_new_double(ShmSysConfigAndInfo->SysConfig.BillingData.Fee[idxHour]));
+		json_object_object_add(receiptDetail, "periodPrice", json_object_new_double(ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[idxHour]*ShmSysConfigAndInfo->SysConfig.BillingData.Fee[idxHour]));
+
+		totalEnergy += ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[idxHour];
+		totalPrice += ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[idxHour]*ShmSysConfigAndInfo->SysConfig.BillingData.Fee[idxHour];
+
+		json_object_array_add(receiptAry, receiptDetail);
+	}
+	json_object_object_add(receipt, "receiptDetail", receiptAry);
+	json_object_object_add(receipt, "totalChargedEnergy", json_object_new_double(totalEnergy));
+	json_object_object_add(receipt, "totalPrice", json_object_new_double(totalPrice));
+	json_object_object_add(receipt, "serviceProvider", json_object_new_string((char*)ShmSysConfigAndInfo->SysConfig.chargePointVendor));
+	json_object_object_add(receipt, "serviceProviderAddress", json_object_new_string("Address"));
+	json_object_object_add(receipt, "serviceProviderTel", json_object_new_string("TEL"));
+	json_object_object_add(receipt, "chargerBoxId", json_object_new_string((char*)ShmSysConfigAndInfo->SysConfig.ChargeBoxId));
+
+	sprintf(receiptInfo, "%s", json_object_to_json_string_ext(receipt, JSON_C_TO_STRING_PLAIN));
+	json_object_put(receipt);
+
+	//DEBUG_INFO("receiptInfo: %s\n", receiptInfo);
+
+	return result;
+}
+
+int DB_Open(sqlite3 *db)
+{
+	int result = PASS;
+	char* errMsg = NULL;
+	char* createRecordSql="CREATE TABLE IF NOT EXISTS charging_record("
+					      "idx integer primary key AUTOINCREMENT, "
+						  "reservationId text, "
+						  "transactionId text, "
+						  "startMethod text, "
+						  "userId text, "
+						  "dateTimeStart text, "
+						  "dateTimeStop text,"
+						  "socStart text, "
+						  "socStop text, "
+						  "chargeEnergy text, "
+						  "stopReason text, "
+						  "finalCost text"
+						  ");";
+
+	char* createRecordBufSql="CREATE TABLE IF NOT EXISTS charging_record_buffer("
+						  "reservationId text, "
+						  "transactionId text, "
+						  "startMethod text, "
+						  "userId text, "
+						  "dateTimeStart text, "
+						  "dateTimeStop text,"
+						  "socStart text, "
+						  "socStop text, "
+						  "chargeEnergy text, "
+						  "stopReason text, "
+						  "finalCost text"
+						  ");";
+
+	char* createCfgSql="CREATE TABLE IF NOT EXISTS `config` ( "
+					   "`idx` INTEGER PRIMARY KEY AUTOINCREMENT, "
+					   "`item` TEXT NOT NULL, "
+				       "`connector` INTEGER NOT NULL, "
+					   "`val` TEXT NOT NULL, unique(item,connector) on conflict replace);";
+
+	//sqlite3_config(SQLITE_CONFIG_URI, 1);
+	if(sqlite3_open(DB_FILE, &db))
+	{
+		result = FAIL;
+		DEBUG_ERROR( "Can't open database: %s\n", sqlite3_errmsg(db));
+		sqlite3_close(db);
+	}
+	else
+	{
+		DEBUG_INFO( "Local charging record database open successfully.\n");
+
+		if (sqlite3_exec(db, createRecordSql, 0, 0, &errMsg) != SQLITE_OK)
+		{
+			result = FAIL;
+			DEBUG_ERROR( "Create local charging record table error message: %s\n", errMsg);
+		}
+		else
+		{
+			DEBUG_INFO( "Opened local charging record table successfully\n");
+		}
+
+		if (sqlite3_exec(db, createRecordBufSql, 0, 0, &errMsg) != SQLITE_OK)
+		{
+			result = FAIL;
+			DEBUG_ERROR( "Create local charging record buffer table error message: %s\n", errMsg);
+		}
+		else
+		{
+			DEBUG_INFO( "Opened local charging record buffer table successfully\n");
+		}
+
+		if (sqlite3_exec(db, createCfgSql, 0, 0, &errMsg) != SQLITE_OK)
+		{
+			result = FAIL;
+			DEBUG_ERROR( "Create local config table error message: %s\n", errMsg);
+		}
+		else
+		{
+			DEBUG_INFO( "Opened local config table successfully\n");
+		}
+
+		sqlite3_close(db);
+	}
+
+	return result;
+}
+
+int DB_Check_Record_Buf(sqlite3 *db, int gun_index)
+{
+	int result = PASS;
+	char* errMsg = NULL;
+	char sqlStr[4096];
+	char **rs;
+	int	 rows, cols;
+
+	if(sqlite3_open(DB_FILE, &db))
+	{
+		result = FAIL;
+		DEBUG_INFO( "Can't open database: %s\n", sqlite3_errmsg(db));
+		sqlite3_close(db);
+	}
+	else
+	{
+		sqlite3_get_table(db, "select * from charging_record_buffer", &rs, &rows, &cols, &errMsg);
+
+		if(rows>0)
+		{
+			// Copy record buffer
+			for(int idxRow=1;idxRow<=rows;idxRow++)
+			{
+				if(strcmp(rs[(idxRow*cols)+3], "0") == 0)
+				{
+					result = false;
+				}
+
+				sprintf(sqlStr, "insert into charging_record(reservationId, transactionId, startMethod, userId, dateTimeStart, dateTimeStop, socStart, socStop, chargeEnergy, stopReason, finalCost) "
+		 					    "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s');",
+								rs[(idxRow*cols)+0],
+								rs[(idxRow*cols)+1],
+								rs[(idxRow*cols)+2],
+								rs[(idxRow*cols)+3],
+								rs[(idxRow*cols)+4],
+								rs[(idxRow*cols)+5],
+								rs[(idxRow*cols)+6],
+								rs[(idxRow*cols)+7],
+								rs[(idxRow*cols)+8],
+								rs[(idxRow*cols)+9],
+								rs[(idxRow*cols)+10]);
+
+				if (sqlite3_exec(db, sqlStr, 0, 0, &errMsg) != SQLITE_OK)
+				{
+					result = FAIL;
+					DEBUG_INFO( "Copy local charging record buffer error message: %s\n", errMsg);
+				}
+				else
+				{
+					DEBUG_INFO( "Copy local charging record buffer successfully\n");
+				}
+
+#ifdef CDFA_CERTIFICATE
+				// Only for CDFA certificate
+				sendReceiptMail(rs[(idxRow*cols)+4],
+								rs[(idxRow*cols)+5],
+								rs[(idxRow*cols)+10]);
+#endif /* CDFA_CERTIFICATE */
+			}
+
+			// Delete buffer
+			if (sqlite3_exec(db, "delete from charging_record_buffer", 0, 0, &errMsg) != SQLITE_OK)
+			{
+				result = FAIL;
+				DEBUG_INFO( "Delete local charging record buffer error message: %s\n", errMsg);
+			}
+			else
+			{
+				DEBUG_INFO( "Delete local charging record buffer successfully\n");
+			}
+		}
+		else
+		{
+			DEBUG_INFO("There is not any charging record buffer.\n", gun_index);
+		}
+
+		sqlite3_free_table(rs);
+		sqlite3_close(db);
+	}
+
+	return result;
+}
+
+int DB_Update_Record_Buf(sqlite3 *db, int gun_index)
+{
+	int result = PASS;
+	char* errMsg = NULL;
+	char sqlStr[4096];
+	char receiptInfo[2048];
+
+	getReceiptInfo(gun_index, receiptInfo);
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		sprintf(sqlStr, "insert into charging_record_buffer(reservationId, transactionId, startMethod, userId, dateTimeStart, dateTimeStop, socStart, socStop, chargeEnergy, stopReason, finalCost) "
+ 					    "values('%d', '%d', '%d', '%s', '%s', '%s', '%d', '%d', '%f', '%s', '%s');",
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId,
+					    ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartDateTime,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy,
+					    "Power Loss",
+#ifdef CDFA_CERTIFICATE
+						receiptInfo);// Only for CDFA certificate
+#else
+						ShmOCPP16Data->Cost.FinalCost[gun_index].description);
+#endif /* CDFA_CERTIFICATE */
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		sprintf(sqlStr, "insert into charging_record_buffer(reservationId, transactionId, startMethod, userId, dateTimeStart, dateTimeStop, socStart, socStop, chargeEnergy, stopReason, finalCost) "
+#ifdef CDFA_CERTIFICATE
+				"values('%d', '%s', '%d', '%s', '%s', '%s', '%d', '%d', '%f', '%s', '%s');",
+#else
+				"values('%d', '%s', '%d', '%s', '%s', '%s', '%d', '%d', '%f', '%s', '%f');",
+#endif /* CDFA_CERTIFICATE */
+
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId,
+					    ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartDateTime,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy,
+					    "Power Loss",
+#ifdef CDFA_CERTIFICATE
+						//receiptInfo);// Only for CDFA certificate
+#else
+						ShmOCPP20Data->CostUpdated.totalCost);
+#endif /* CDFA_CERTIFICATE */
+
+	}
+
+	if(sqlite3_open(DB_FILE, &db))
+	{
+		result = FAIL;
+		DEBUG_INFO( "Can't open database: %s\n", sqlite3_errmsg(db));
+		sqlite3_close(db);
+	}
+	else
+	{
+		// Delete buffer
+		if (sqlite3_exec(db, "delete from charging_record_buffer", 0, 0, &errMsg) != SQLITE_OK)
+		{
+			result = FAIL;
+			DEBUG_INFO( "Delete local charging record buffer error message: %s\n", errMsg);
+		}
+		else
+		{
+			//DEBUG_INFO( "Delete local charging record buffer successfully\n");
+		}
+
+		// Insert record buffer
+		if (sqlite3_exec(db, sqlStr, 0, 0, &errMsg) != SQLITE_OK)
+		{
+			result = FAIL;
+			DEBUG_INFO( "Insert local charging record buffer error message: %s\n", errMsg);
+		}
+		else
+		{
+			//DEBUG_INFO( "Insert local charging record buffer successfully\n");
+		}
+
+		sqlite3_close(db);
+	}
+
+	return result;
+}
+
+int DB_Insert_Record(sqlite3 *db, int gun_index)
+{
+	int result = PASS;
+	char* errMsg = NULL;
+	char sqlStr[4096];
+	char receiptInfo[2048];
+
+	getReceiptInfo(gun_index, receiptInfo);
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		sprintf(sqlStr, "insert into charging_record(reservationId, transactionId, startMethod, userId, dateTimeStart, dateTimeStop, socStart, socStop, chargeEnergy, stopReason, finalCost) "
+						"values('%d', '%d', '%d', '%s', '%s', '%s', '%d', '%d', '%f', '%s', '%s');",
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId,
+					    ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartDateTime,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy,
+					    ShmOCPP16Data->StopTransaction[gun_index].StopReason,
+#ifdef CDFA_CERTIFICATE
+						receiptInfo);// Only for CDFA certificate
+#else
+						ShmOCPP16Data->Cost.FinalCost[gun_index].description);
+#endif /* CDFA_CERTIFICATE */
+
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		sprintf(sqlStr, "insert into charging_record(reservationId, transactionId, startMethod, userId, dateTimeStart, dateTimeStop, socStart, socStop, chargeEnergy, stopReason, finalCost) "
+#ifdef CDFA_CERTIFICATE
+ 					    "values('%d', '%s', '%d', '%s', '%s', '%s', '%d', '%d', '%f', '%s', '%s');",
+#else
+						"values('%d', '%s', '%d', '%s', '%s', '%s', '%d', '%d', '%f', '%s', '%f');",
+#endif /* CDFA_CERTIFICATE */
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId,
+					    ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartDateTime,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].EvBatterySoc,
+					    ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy,
+					    ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason,
+#ifdef CDFA_CERTIFICATE
+						receiptInfo);// Only for CDFA certificate
+#else
+						ShmOCPP20Data->CostUpdated.totalCost);
+#endif /* CDFA_CERTIFICATE */
+
+
+	}
+	//DEBUG_INFO("sqlStr= %s\n", sqlStr);
+
+	if(sqlite3_open(DB_FILE, &db))
+	{
+		result = FAIL;
+		DEBUG_INFO( "Can't open database: %s\n", sqlite3_errmsg(db));
+		sqlite3_close(db);
+	}
+	else
+	{
+		// Delete buffer
+		if (sqlite3_exec(db, "delete from charging_record_buffer", 0, 0, &errMsg) != SQLITE_OK)
+		{
+			result = FAIL;
+			DEBUG_INFO( "Delete local charging record buffer error message: %s\n", errMsg);
+		}
+		else
+		{
+			DEBUG_INFO( "Delete local charging record buffer successfully\n");
+		}
+
+		// Insert charging record
+		if (sqlite3_exec(db, sqlStr, 0, 0, &errMsg) != SQLITE_OK)
+		{
+			result = FAIL;
+			DEBUG_INFO( "Insert local charging record error message: %s\n", errMsg);
+		}
+		else
+		{
+			DEBUG_INFO( "Insert local charging record successfully\n");
+		}
+
+		sprintf(sqlStr, "delete from charging_record where (idx < (select idx from charging_record order by idx desc limit 1)-2000) and (dateTimeStop < '%04d.01.01 00:00:00');", (getCurrentYear()-3));
+		if (sqlite3_exec(db, sqlStr, 0, 0, &errMsg) != SQLITE_OK)
+		{
+			result = FAIL;
+			DEBUG_INFO( "delete local charging error message: %s\n", errMsg);
+		}
+		else
+		{
+			DEBUG_INFO( "delete local charging record successfully\n");
+		}
+
+		sqlite3_close(db);
+	}
+
+#ifdef CDFA_CERTIFICATE
+	// Only for CDFA certificate
+	sendReceiptMail((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartDateTime,
+					(char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime,
+					receiptInfo);
+#endif
+
+	return result;
+}
+
+int DB_Update_Operactive(sqlite3 *db, uint8_t gun_index, uint8_t isOperactive)
+{
+	uint8_t result = false;
+	char* errMsg = NULL;
+	char sqlStr[1024];
+	srand(time(NULL));
+
+	if(sqlite3_open(DB_FILE, &db))
+	{
+		result = FAIL;
+		DEBUG_INFO( "Can't open database: %s\n", sqlite3_errmsg(db));
+		sqlite3_close(db);
+	}
+	else
+	{
+		sprintf(sqlStr, "insert or replace into config (item, connector, val) values('isOperactive', %d, %d);", gun_index, isOperactive);
+		//DEBUG_INFO("sqlStr= %s\n", sqlStr);
+		if (sqlite3_exec(db, sqlStr, 0, 0, &errMsg) != SQLITE_OK)
+		{
+			result = FAIL;
+			DEBUG_INFO( "update config error message: %s\n", errMsg);
+		}
+		else
+		{
+			DEBUG_INFO("update connector-%d config item isOperactive to %d\n", gun_index, isOperactive);
+		}
+
+		sqlite3_close(db);
+	}
+
+	return result;
+}
+
+int DB_Get_Operactive(sqlite3 *db, uint8_t gun_index)
+{
+	uint8_t result = true;
+	char* errMsg = NULL;
+	char sqlStr[1024];
+	char **rs;
+	int	 rows, cols;
+
+	sprintf(sqlStr, "select * from config where item='isOperactive' and connector=%d;", gun_index);
+	//DEBUG_INFO("sqlStr= %s\n", sqlStr);
+
+	if(sqlite3_open(DB_FILE, &db))
+	{
+		result = FAIL;
+		DEBUG_INFO( "Can't open database: %s\n", sqlite3_errmsg(db));
+		sqlite3_close(db);
+	}
+	else
+	{
+		sqlite3_get_table(db, sqlStr, &rs, &rows, &cols, &errMsg);
+
+		if(rows>0)
+		{
+			for(int idxRow=1;idxRow<=rows;idxRow++)
+			{
+				if(strcmp(rs[(idxRow*cols)+3], "0") == 0)
+				{
+					result = false;
+				}
+				DEBUG_INFO("Query connector-%d isOperactive: %s\n", gun_index, rs[(idxRow*cols)+3]);
+			}
+		}
+		else
+		{
+			DEBUG_INFO("Query connector-%d fail, default value as operactive.\n", gun_index);
+		}
+
+		sqlite3_free_table(rs);
+		sqlite3_close(db);
+	}
+
+	return result;
+}
+
+//======================================================
+// Peripheral initial
+//======================================================
+int InitWatchDog()
+{
+	int fd;
+	int timeout = 330;
+
+	system("/usr/bin/fuser -k /dev/watchdog");
+	sleep(1);
+	system("echo V > /dev/watchdog");
+	sleep(1);
+	fd=open("/dev/watchdog", O_RDWR);
+	if(fd<=0)
+	{
+		DEBUG_ERROR("System watch dog initial fail.\n");
+	}
+	ioctl(fd, _IOWR('W', 6, int), &timeout);
+
+	return fd;
+}
+
+void InitGPIO()
+{
+	/*****************0~3, 4 bank, bank x 32+ num*********************/
+	/***************************************************************/
+	/*************** INPUT PIN ***************************************/
+	/***************************************************************/
+
+	/***************************************************************/
+	/*************** OUTPUT PIN ************************************/
+	/***************************************************************/
+	/*MCU request:GPIO3_20 => H:ON; L:OFF*/
+	system("echo 116 > /sys/class/gpio/export");
+	system("echo \"out\" > /sys/class/gpio/gpio116/direction");
+	system("echo 0 > /sys/class/gpio/gpio116/value");
+
+	/*Rfid:GPIO0_19 => Reset_PING H:ON; L:OFF*/
+	system("echo 19 > /sys/class/gpio/export");
+	system("echo \"out\" > /sys/class/gpio/gpio19/direction");
+	system("echo 1 > /sys/class/gpio/gpio19/value");
+
+	/*Speaker:GPIO2_1 => H:ON; L:OFF*/
+	system("echo 65 > /sys/class/gpio/export");
+	system("echo \"out\" > /sys/class/gpio/gpio65/direction");
+	system("echo 0 > /sys/class/gpio/gpio65/value");
+
+	/*Ethernet RST:GPIO2_25 => H:ON; L:OFF*/
+	system("echo 89 > /sys/class/gpio/export");
+	system("echo \"out\" > /sys/class/gpio/gpio89/direction");
+	system("echo 0 > /sys/class/gpio/gpio89/value");
+	sleep(1);
+	system("echo 1 > /sys/class/gpio/gpio89/value");
+
+	/*4G/Wifi RST:GPIO3_18 => H:ON; L:OFF*/
+	system("echo 114 > /sys/class/gpio/export");
+	system("echo \"out\" > /sys/class/gpio/gpio114/direction");
+	system("echo 1 > /sys/class/gpio/gpio114/value");
+	sleep(1);
+	system("echo 0 > /sys/class/gpio/gpio114/value");
+
+	/*RFID ICC:GPIO0_20 => H:ON; L:OFF*/
+	system("echo 20 > /sys/class/gpio/export");
+	system("echo \"in\" > /sys/class/gpio/gpio20/direction");
+
+	/*QCA7000 interrupt:GPIO2_00 => H:ON; L:OFF*/
+	system("echo 64 > /sys/class/gpio/export");
+	system("echo \"in\" > /sys/class/gpio/gpio64/direction");
+
+	/*QCA7000 Reset:GPIO3_19 => H:ON; L:OFF*/
+	system("echo 115 > /sys/class/gpio/export");
+	system("echo \"out\" > /sys/class/gpio/gpio115/direction");
+	system("echo 0 > /sys/class/gpio/gpio115/value");
+	sleep(1);
+	system("echo 1 > /sys/class/gpio/gpio115/value");
+
+	/*RFID RST: GPIO1_30 => H:OFF; L:ON*/
+	system("echo 62 > /sys/class/gpio/export");
+	system("echo \"out\" > /sys/class/gpio/gpio62/direction");
+	system("echo 0 > /sys/class/gpio/gpio62/value");
+
+	/*Wake up button GPIO1_31 => H:OFF; L:ON*/
+	system("echo 63 > /sys/class/gpio/export");
+	system("echo \"in\" > /sys/class/gpio/gpio64/direction");
+
+	sleep(1);
+	DEBUG_INFO("Initial GPIO OK\n");
+}
+
+int LoadSysConfigAndInfo(struct SysConfigData *ptr)
+{
+	int fd,wrd;
+	unsigned char *buf;
+	unsigned int ChkSum,ChkSumOrg;
+
+	if((buf=malloc(MtdBlockSize))==NULL)
+	{
+
+		DEBUG_ERROR("malloc buffer NG,rebooting..\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+		}
+		sleep(5);
+		system("reboot -f");
+		sleep(5);
+		system("reboot -f");
+	}
+	memset(buf, 0, MtdBlockSize);
+
+	//================================================
+	// Load configuration from mtdblock10
+	//================================================
+	system("nanddump /dev/mtd10 -f /mnt/EvseConfig.bin");
+	fd = open("/mnt/EvseConfig.bin", O_RDWR);
+	if (fd < 0)
+	{
+		free(buf);
+
+		DEBUG_ERROR("open mtdblock10 NG,rebooting..\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+		}
+		sleep(5);
+		system("reboot -f");
+		sleep(5);
+		system("reboot -f");
+	}
+    wrd=read(fd, buf, MtdBlockSize);
+	close(fd);
+	if(wrd<MtdBlockSize)
+	{
+		free(buf);
+
+		DEBUG_ERROR("read SysConfigData data NG,rebooting..\n");
+
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+		}
+		sleep(5);
+		system("reboot -f");
+		sleep(5);
+		system("reboot -f");
+	}
+
+	ChkSum=0;
+	for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
+	{
+		ChkSum+=buf[wrd];
+	}
+	memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+	memcpy(&ptr->ModelName,buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)),ARRAY_SIZE(ptr->ModelName));
+	memcpy(&ptr->SerialNumber,buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)+ARRAY_SIZE(ptr->ModelName)+ARRAY_SIZE(ptr->AcModelName)),ARRAY_SIZE(ptr->SerialNumber));
+
+	//================================================
+	// Load configuration from mtdblock11
+	//================================================
+	if(ChkSum!=ChkSumOrg)
+	{
+		DEBUG_ERROR("Primary SysConfigData checksum NG, read backup\n");
+		system("nanddump /dev/mtd11 -f /mnt/EvseConfig.bin");
+		fd = open("/mnt/EvseConfig.bin", O_RDWR);
+		if (fd < 0)
+		{
+			free(buf);
+
+			DEBUG_ERROR("open mtdblock11 (backup) NG,rebooting..\n");
+
+			if(ShmStatusCodeData!=NULL)
+			{
+				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+			}
+			sleep(5);
+			system("reboot -f");
+			sleep(5);
+			system("reboot -f");
+	    }
+	    memset(buf, 0, MtdBlockSize);
+   		wrd=read(fd, buf,MtdBlockSize);
+    	close(fd);
+		if(wrd<MtdBlockSize)
+		{
+			free(buf);
+
+			DEBUG_ERROR("read backup SysConfigData data NG,rebooting..\n");
+
+			if(ShmStatusCodeData!=NULL)
+			{
+				ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+			}
+			sleep(5);
+			system("reboot -f");
+			sleep(5);
+			system("reboot -f");
+		}
+
+		ChkSum=0;
+		for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
+		{
+			ChkSum+=buf[wrd];
+		}
+		memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+
+		//================================================
+		// Load configuration from mtdblock12 (Factory default)
+		//================================================
+		if(ChkSum!=ChkSumOrg)
+		{
+			DEBUG_WARN("backup SysConfigData checksum NG, read Factory default\n");
+			system("nanddump /dev/mtd12 -f /mnt/EvseConfig.bin");
+			fd = open("/mnt/EvseConfig.bin", O_RDWR);
+			if (fd < 0)
+			{
+				DEBUG_ERROR("open mtdblock12 (Factory default) NG,rebooting..\n");
+				
+				free(buf);
+				if(ShmStatusCodeData!=NULL)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+				}
+				sleep(5);
+				system("reboot -f");
+				sleep(5);
+				system("reboot -f");
+	    	}
+	    	memset(buf, 0, MtdBlockSize);
+   			wrd=read(fd, buf,MtdBlockSize);
+    		close(fd);
+			if(wrd<MtdBlockSize)
+			{
+				DEBUG_ERROR("read factory default  SysConfigData data NG,rebooting..\n");
+				
+				free(buf);
+				if(ShmStatusCodeData!=NULL)
+				{
+					ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed=1;
+				}
+				sleep(5);
+				system("reboot -f");
+				sleep(5);
+				system("reboot -f");
+			}
+
+			ChkSum=0;
+			for(wrd=ARRAY_SIZE(ptr->CsuBootLoadFwRev);wrd<MtdBlockSize-4;wrd++)
+			{
+				ChkSum+=buf[wrd];
+			}
+			memcpy(&ChkSumOrg,buf+(MtdBlockSize-4),sizeof(ChkSumOrg));
+			memcpy(buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)), &ptr->ModelName, ARRAY_SIZE(ptr->ModelName));
+			memcpy(buf+(ARRAY_SIZE(ptr->CsuBootLoadFwRev)+ARRAY_SIZE(ptr->ModelName)+ARRAY_SIZE(ptr->AcModelName)), &ptr->SerialNumber, ARRAY_SIZE(ptr->SerialNumber));
+
+			if(ChkSum!=ChkSumOrg)
+			{
+				DEBUG_WARN("factory default  SysConfigData checksum NG, restore factory default\n");
+				free(buf);
+				system("cd /root;./Module_FactoryConfig -m");
+				system("rm -f /Storage/OCPP/OCPPConfiguration");
+				system("sync");
+				sleep(5);
+				system("reboot -f");
+				sleep(5);
+				system("reboot -f");
+
+				return FAIL;
+			}
+		}
+	}
+
+	//load OK
+	memcpy((struct SysConfigData *)ptr,buf,sizeof(struct SysConfigData));
+	free(buf);
+
+	system("rm -f /mnt/EvseConfig.bin");
+	
+	// SysConfig in flash is empty (0xffffffff)
+	if((strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName)) ||
+	   (strlen((char*)ShmSysConfigAndInfo->SysConfig.SerialNumber) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber)) ||
+	   (strlen((char*)ShmSysConfigAndInfo->SysConfig.SystemId) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SystemId)) ||
+	   (ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient == 0xff))
+	{
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName))
+		{
+			memset(ShmSysConfigAndInfo->SysConfig.ModelName, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
+		}
+
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.SerialNumber) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber))
+		{
+			memset(ShmSysConfigAndInfo->SysConfig.SerialNumber, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
+		}
+
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.SystemId) > ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SystemId))
+		{
+			memset(ShmSysConfigAndInfo->SysConfig.SystemId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SystemId));
+		}
+
+		if(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient == 0xff)
+		{
+			DEBUG_INFO("Ethernet dhcp config is null.\n");
+		}
+
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) == 0x00)
+		{
+			DEBUG_INFO("Model name over length.\n");
+		}
+
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.SerialNumber) == 0x00)
+		{
+			DEBUG_INFO("Model serial number over length.\n");
+		}
+
+		if(strlen((char*)ShmSysConfigAndInfo->SysConfig.SystemId) == 0x00)
+		{
+			DEBUG_INFO("SystemId over length.\n");
+		}
+
+		system("cd /root;./Module_FactoryConfig -m");
+		sleep(3);
+		system("/usr/bin/run_evse_restart.sh");
+	}
+	
+	DEBUG_INFO("Load SysConfigData OK\n");
+
+	ShmCharger->isCcsEnable = OFF;
+	for(uint8_t idx=0;idx<3;idx++)
+	{
+		if(ShmSysConfigAndInfo->SysConfig.ModelName[7+idx] == '7')
+			ShmCharger->isCcsEnable = ON;
+	}
+
+	ShmSysConfigAndInfo->SysConfig.AcPhaseCount = ((ShmSysConfigAndInfo->SysConfig.ModelName[2]=='Y') ||
+												   (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='D') ||
+												   (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='W')
+												   ?3:1);
+
+	RatedCurrentParsing((char*)ShmSysConfigAndInfo->SysConfig.ModelName, &modelnameInfo);
+	DEBUG_INFO("Model name parsing gun count: %d\n", modelnameInfo.GetGunCount);
+
+	return PASS;
+}
+
+int StoreUsrConfigData(struct SysConfigData *UsrData)
+{
+	int result = PASS;
+	int fd,wrd;
+	unsigned int i,Chk;
+	unsigned char *ptr, *BufTmp;
+
+	Chk=0;
+	ptr=(unsigned char *)UsrData;
+	if((BufTmp=malloc(MtdBlockSize))!=NULL)
+	{
+		memset(BufTmp,0,MtdBlockSize);
+		memcpy(BufTmp,ptr,sizeof(struct SysConfigData));
+		for(i=0;i<MtdBlockSize-4;i++)
+			Chk+=*(BufTmp+i);
+		memcpy(BufTmp+MtdBlockSize-4, &Chk, 4);
+
+		// Output configuration to file.
+		fd = open("/mnt/EvseConfig.bin", O_RDWR|O_CREAT);
+		if (fd < 0)
+		{
+			DEBUG_ERROR("open /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
+		}
+		wrd=write(fd, BufTmp, MtdBlockSize);
+		close(fd);
+		if(wrd<MtdBlockSize)
+		{
+			DEBUG_ERROR("write /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
+		}
+		DEBUG_INFO("EvseConfig write to file in /mnt OK.\n");
+
+		DEBUG_INFO("Erase /dev/mtd10.\n");
+		runShellCmd("flash_erase /dev/mtd10 0 0");
+		DEBUG_INFO("Write /dev/mtd10.\n");
+		runShellCmd("nandwrite -p /dev/mtd10 /mnt/EvseConfig.bin");
+
+		DEBUG_INFO("Erase /dev/mtd11.\n");
+		runShellCmd("flash_erase /dev/mtd11 0 0");
+		DEBUG_INFO("Write /dev/mtd11.\n");
+		runShellCmd("nandwrite -p /dev/mtd11 /mnt/EvseConfig.bin");
+
+		system("rm -f /mnt/EvseConfig.bin");
+		DEBUG_INFO("EvseConfig write to flash OK\n");
+	}
+	else
+	{
+		DEBUG_ERROR("alloc BlockSize NG\r\n");
+    		result = FAIL;
+	}
+
+	if(BufTmp!=NULL)
+		free(BufTmp);
+
+	return result;
+}
+
+void InitEthernet()
+{
+	pid_t pid;
+	uint8_t cnt_pingDNS_Fail;
+	char tmpbuf[256];
+	unsigned int natInterface = 0;
+
+	//Init Eth0 for internet
+	memset(tmpbuf,0,256);
+	sprintf(tmpbuf,"/sbin/ifconfig eth0 %s netmask %s up &",
+	ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
+	ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
+	DEBUG_INFO("eth0 config as ip: %s, netmask: %s\n", ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
+													   ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
+	system(tmpbuf);
+	memset(tmpbuf,0,256);
+	sprintf(tmpbuf,"route add default gw %s eth0 &",
+	ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
+	system(tmpbuf);
+	system("ifconfig lo up &");
+	system("/sbin/ifconfig eth0:1 192.168.201.201 netmask 255.255.255.248 up &");
+	//system("/sbin/ethtool -s eth0 speed 10 duplex full autoneg off");
+
+    //Run DHCP client if enabled
+	system("killall udhcpc");
+	system("rm -rf /etc/resolv.conf");
+	system("echo nameserver 8.8.8.8 >> /etc/resolv.conf");		//Google DNS server
+	system("echo nameserver 180.76.76.76 >> /etc/resolv.conf");	//Baidu DNS server
+
+	if(ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient==0)
+	{
+		sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
+		system(tmpbuf);
+	}
+
+	// Upgrade system id to /etc/hostname
+	sprintf(tmpbuf, "echo %s > /etc/hostname", ShmSysConfigAndInfo->SysConfig.SystemId);
+	system(tmpbuf);
+
+	// Ethernet MAC address
+	getEth0MacAddress();
+
+	//check internet status
+	pid = fork();
+
+	if(pid == 0)
+	{
+		for(;;)
+		{
+			if(isRouteFail())
+			{
+				//DEBUG_ERROR("eth0 not in route, restart eth0.\n");
+				system("/sbin/ifconfig eth0 down;/sbin/ifconfig eth0 up");
+
+				if((ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient==0))
+				{
+					system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+					sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
+					system(tmpbuf);
+				}
+				else
+				{
+					system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+					memset(tmpbuf,0,256);
+					sprintf(tmpbuf,"/sbin/ifconfig eth0 %s netmask %s up &",
+							ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
+							ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
+					system(tmpbuf);
+					memset(tmpbuf,0,256);
+					sprintf(tmpbuf,"route add default gw %s eth0 &",
+					ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
+					system(tmpbuf);
+				}
+			}
+
+			if(isReachableInternet() == PASS)
+			{
+				ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=OFF;
+				cnt_pingDNS_Fail = 0;
+			}
+			else
+			{
+				if(cnt_pingDNS_Fail >= 3)
+				{
+					ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=ON;
+					if((ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient==0))
+					{
+						system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+						sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
+						system(tmpbuf);
+					}
+					else
+					{
+						system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+						memset(tmpbuf,0,256);
+						sprintf(tmpbuf,"/sbin/ifconfig eth0 %s netmask %s up &",
+								ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
+								ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
+						system(tmpbuf);
+						memset(tmpbuf,0,256);
+						sprintf(tmpbuf,"route add default gw %s eth0 &",
+						ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
+						system(tmpbuf);
+					}
+					cnt_pingDNS_Fail = 0;
+				}
+				else
+				{
+					cnt_pingDNS_Fail++;
+				}
+			}
+
+			if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet &&
+			   ((ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 0) || ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi) &&
+			   ((ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled == 0) || ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi))
+			{
+				ShmSysConfigAndInfo->SysInfo.InternetConn = OFF;
+			}
+			else
+			{
+				ShmSysConfigAndInfo->SysInfo.InternetConn = ON;
+			}
+
+			//============================================================
+			// Priority for internet  0 : First / 1 : Second / 2: Third
+			//============================================================
+			if(!ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet)
+			{
+				system("/sbin/ifmetric eth0 0");
+
+				if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
+				{
+					system("/sbin/ifmetric mlan0 1");
+				}
+
+				if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'T') || (ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
+				{
+					system("/sbin/ifmetric ppp0 2");
+				}
+
+				if(isKernelSupportNAT() == YES)
+				{
+					if(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 2)
+					{
+						if(natInterface != 1)
+						{
+							system("/sbin/iptables -t nat -F");
+							system("/sbin/iptables -A POSTROUTING -t nat -s 192.168.10.0/24 -o eth0 -j MASQUERADE");
+							natInterface = 1;
+						}
+					}
+					else
+					{
+						system("/sbin/iptables -t nat -F");
+					}
+				}
+			}
+			else if(!ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi)
+			{
+				if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
+				{
+					system("/sbin/ifmetric eth0 1");
+					system("/sbin/ifmetric mlan0 0");
+				}
+
+				if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'T') || (ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
+				{
+					system("/sbin/ifmetric ppp0 2");
+				}
+			}
+			else if(!ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi)
+			{
+				if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
+				{
+					system("/sbin/ifmetric mlan0 2");
+				}
+
+				if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'T') || (ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
+				{
+					system("/sbin/ifmetric eth0 1");
+					system("/sbin/ifmetric ppp0 0");
+				}
+
+				if(isKernelSupportNAT() == YES)
+				{
+					if(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 2)
+					{
+						if(natInterface != 2)
+						{
+							system("/sbin/iptables -t nat -F");
+							system("/sbin/iptables -A POSTROUTING -t nat -s 192.168.10.0/24 -o ppp0 -j MASQUERADE");
+							natInterface = 2;
+						}
+					}
+					else
+					{
+						system("/sbin/iptables -t nat -F");
+					}
+				}
+			}
+			else
+			{
+				if(isKernelSupportNAT() == YES)
+				{
+					if(ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 2)
+					{
+						system("/sbin/iptables -t nat -F");
+						natInterface = 0;
+					}
+				}
+			}
+
+			sleep(5);
+		}
+	}
+
+	DEBUG_INFO("Initial Ethernet OK\n");
+}
+
+int SpawnTask(uint8_t gun_index)
+{
+	if(gun_index == 0)
+	{
+		system ("pkill Module_");
+		system ("pkill OcppBackend");
+
+		if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'T') || (ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
+		{
+			system("/root/Module_4g &");
+		}
+		else if(ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'W')
+		{
+			system("/root/Module_Wifi &");
+		}
+
+		system("/root/Module_EventLogging &");
+
+		if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0)
+		{
+			ocpp_process_start();
+		}
+		else
+		{
+			DEBUG_INFO("OCPP URL is empty, need to create a configuration table !!!\n");
+			ocpp_process_start();
+		}
+		system ("/root/Module_AlarmDetect &");
+		system ("/root/Module_InternalComm &");
+		system ("/root/Module_Speaker &");
+		system ("/root/Module_ProduceUtils &");
+		system ("/root/Module_LcmControl &");
+		system ("/root/Module_Cabinet &");
+		system ("/root/Module_Dispenser &");
+	}
+
+	return PASS;
+}
+
+int InitQca7000()
+{
+	int result = PASS;
+	system("/sbin/rmmod qcaspi");
+
+	if(isKernelSupportNAT() == YES)
+		system("/sbin/insmod /lib/qcaspi_nat.ko");
+	else
+		system("/sbin/insmod /lib/qcaspi.ko");
+
+	sleep(2);
+	system("/sbin/ifconfig eth1 192.168.253.11 netmask 255.255.255.0 up");
+	sleep(1);
+
+	return result;
+}
+
+int Initialization(uint8_t gun_index)
+{
+	int result = PASS;
+
+	if(gun_index == 0)
+	{
+		InitGPIO();
+
+		InitEthernet();
+
+		if(InitQca7000() != PASS)
+		{
+			DEBUG_ERROR("QCA7000 initial fail.\n");
+			result = FAIL;
+		}
+
+		if(DB_Open(localDb) != PASS)
+		{
+			DEBUG_ERROR("Local database initial fail.\n");
+			result = FAIL;
+		}
+
+		if((rfidFd = InitRfidPort()) == FAIL)
+		{
+			DEBUG_ERROR("RFID port initial fail.\n");
+			result = FAIL;
+		}
+
+		if((wtdFd = InitWatchDog()) == FAIL)
+		{
+			DEBUG_ERROR("Watchdog initial fail.\n");
+			result = FAIL;
+		}
+
+		if(result == PASS)
+			DEBUG_INFO("Initialization OK.\n");
+		else
+			DEBUG_INFO("Initialization Fail.\n");
+	}
+
+	ShmCharger->gun_info[gun_index].isOperactive = DB_Get_Operactive(localDb, gun_index);
+
+	return result;
+}
+
+//=====================================================
+// Common routine
+//=====================================================
+char* getSystemModeName(unsigned char mode)
+{
+	char* result;
+
+	switch(mode)
+	{
+		case SYS_MODE_BOOTING:
+			result = "booting";
+			break;
+		case SYS_MODE_IDLE:
+			result = "idle";
+			break;
+		case SYS_MODE_AUTHORIZING:
+			result = "authorizing";
+			break;
+		case SYS_MODE_PREPARING:
+			result = "preparing";
+			break;
+		case SYS_MODE_CHARGING:
+			result = "charging";
+			break;
+		case SYS_MODE_TERMINATING:
+			result = "terminating";
+			break;
+		case SYS_MODE_COMPLETE:
+			result = "complete";
+			break;
+		case SYS_MODE_ALARM:
+			result = "alarm";
+			break;
+		case SYS_MODE_FAULT:
+			result = "fault";
+			break;
+		case SYS_MODE_MAINTAIN:
+			result = "maintain";
+			break;
+		case SYS_MODE_RESERVATION:
+			result = "reservation";
+			break;
+		case SYS_MODE_BOOKING:
+			result = "booking";
+			break;
+		case SYS_MODE_DEBUG:
+			result = "debug";
+			break;
+		case SYS_MODE_UPDATE:
+			result = "upgrade";
+			break;
+		default:
+			result = "unknown";
+			break;
+	}
+
+	return result;
+}
+
+void setChargerMode(unsigned char gun_index, unsigned char mode)
+{
+	ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus = ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus;
+	ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus = mode;
+
+	DEBUG_INFO("Gun-%02d mode switch from %s to %s\n", gun_index, getSystemModeName(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus), getSystemModeName(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus));
+}
+
+unsigned char isMode(unsigned char gun_index, unsigned char mode)
+{
+	return ((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == mode)?YES:NO);
+}
+
+unsigned char isModeChange(unsigned char gun_index)
+{
+	unsigned char result = NO;
+
+	if(!isMode(gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus))
+	{
+		result = YES;
+
+		ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus = ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus;
+	}
+
+	return result;
+}
+
+int isGpioInitialized(unsigned int gpio)
+{
+	int result = FAIL;
+	char gpioPath[64];
+
+	sprintf(gpioPath, "/sys/class/gpio/gpio%d/value", gpio);
+	if((access(gpioPath, F_OK)) != -1)
+	{
+		result = PASS;
+	}
+
+	return result;
+}
+
+void gpio_set_value(unsigned int gpio, unsigned int value)
+{
+	int fd;
+	char buf[256];
+
+	sprintf(buf, "/sys/class/gpio/gpio%d/value", gpio);
+	fd = open(buf, O_WRONLY);
+	if (fd < 0)
+	{
+		DEBUG_ERROR("GPIO-%d set %d fail.\n", gpio, value);
+	    return;
+	}
+
+	if (value)
+		write(fd, "1", 2);
+	else
+	    write(fd, "0", 2);
+
+	close(fd);
+}
+
+int gpio_get_value(unsigned int gpio)
+{
+    int fd;
+    char buf[256];
+    char ch;
+    int8_t result = FAIL;
+
+    sprintf(buf, "/sys/class/gpio/gpio%d/value", gpio);
+    fd = open(buf, O_RDONLY);
+    if (fd < 0)
+    {
+        DEBUG_ERROR("GPIO-%d get fail\n", gpio);
+        return result;
+    }
+
+    read(fd, &ch, 1);
+    if (ch != '0')
+        result = 1;
+    else
+        result = 0;
+
+    close(fd);
+
+    return result;
+}
+
+int presentChargedEnergyClear(unsigned char gun_index)
+{
+	int result = FAIL;
+
+	ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy = 0;
+	memset(ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod, 0x00, ARRAY_SIZE(ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod)*sizeof(float));
+	result = PASS;
+
+	return result;
+}
+
+float presentChargedEnergyTotal(unsigned char gun_index)
+{
+	float result = 0.0f;
+
+	for(int idx=0;idx<ARRAY_SIZE(ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod);idx++)
+	{
+		result += ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[idx];
+	}
+
+	return result;
+}
+
+int presentChargedEnergyUpdate(unsigned char gun_index)
+{
+	int result = FAIL;
+	time_t CurrentTime;
+	struct tm *tm;
+
+	CurrentTime = time(NULL);
+	tm=localtime(&CurrentTime);
+
+	if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount==1)
+	{
+		// Resolution: 0.0001 kwh
+		ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[tm->tm_hour] += (((float)(ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption - ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption_at_start))/10000.0) - presentChargedEnergyTotal(gun_index);
+
+	}
+	else
+	{
+		// Resolution: 0.0001 kwh
+		ShmCharger->gun_info[gun_index].presentChargedEnergyPeriod[tm->tm_hour] += ((((float)(ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption_at_start))/10000.0) +
+																				    (((float)(ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption_at_start))/10000.0) +
+																				    (((float)(ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption - ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption_at_start))/10000.0))
+																					- presentChargedEnergyTotal(gun_index);
+	}
+
+	ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy = presentChargedEnergyTotal(gun_index);
+
+	return result;
+}
+
+//===============================================
+// Get firmware version
+//===============================================
+void get_firmware_version(unsigned char gun_index)
+{
+	FILE *fp;
+	char cmd[512];
+	char buf[512];
+
+	if(gun_index == 0)
+	{
+		// Get CSU hardware version
+		sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuHwRev, "REV.XXXXXXX");
+
+		// Get CSU boot loader version
+		memcpy(ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev, ShmSysConfigAndInfo->SysConfig.CsuBootLoadFwRev, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.CsuBootLoadFwRev));
+
+		// Get CSU kernel version
+		sprintf(cmd, "/bin/uname -r");
+		fp = popen(cmd, "r");
+		if(fp == NULL)
+			sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, "Unknown version");
+		else
+		{
+			while(fgets(buf, sizeof(buf), fp) != NULL)
+			{
+				memcpy(ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev, buf, strlen(buf)-1);
+			}
+		}
+
+		// Get MCU firmware version
+		strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
+
+		// Get CSU root file system version
+		sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "D0.01.00.0000.00");
+
+		// Get AC connector type from model name
+		for(uint8_t idx=0;idx<3;idx++)
+		{
+			switch(ShmSysConfigAndInfo->SysConfig.ModelName[7+idx])
+			{
+				case '1':
+					// J1772 Plug
+					ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '4';
+					ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '4';
+					break;
+				case '2':
+					// J1772 Socket
+					ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '1';
+					ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '1';
+					break;
+				case '3':
+					// CE Plug
+					ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '5';
+					ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '5';
+					break;
+				case '4':
+					// CE Socket
+					ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '2';
+					ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '2';
+					break;
+				case '5':
+					// GB Plug
+					ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '6';
+					ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '6';
+					break;
+				case '6':
+					// GB Socket
+					ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[6] = '3';
+					ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[6] = '3';
+					break;
+			}
+		}
+
+		// Get network option from model name
+		switch(ShmSysConfigAndInfo->SysConfig.ModelName[10])
+		{
+			case 'B':
+			case 'U':
+				//Blue tooth
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '3';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[9] = '3';
+				break;
+			case 'W':
+				// WIFI
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '1';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[9] = '1';
+				break;
+			case 'T':
+				// 3G/4G
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '2';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[9] = '2';
+				break;
+			case 'D':
+				// WIFI + 4G
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '5';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[9] = '5';
+				break;
+			default:
+				// LAN
+				ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[9] = '0';
+				ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[9] = '0';
+				break;
+		}
+
+		// Get rating power from model name
+		memcpy(&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[10], &ShmSysConfigAndInfo->SysConfig.ModelName[4], 0x03);
+		memcpy(&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[10], &ShmSysConfigAndInfo->SysConfig.ModelName[4], 0x03);
+
+		// Get vender code from model name
+		memcpy(&ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev[14], &ShmSysConfigAndInfo->SysConfig.ModelName[12], 0x02);
+		memcpy(&ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev[14], &ShmSysConfigAndInfo->SysConfig.ModelName[12], 0x02);
+
+		DEBUG_INFO("========================================\n");
+		DEBUG_INFO("------------- Cabinet info -------------\n");
+		DEBUG_INFO("Model: %s\n", ShmSysConfigAndInfo->SysConfig.ModelName);
+		DEBUG_INFO("CSU hardware version: %s\n", ShmSysConfigAndInfo->SysInfo.CsuHwRev);
+		DEBUG_INFO("CSU boot loader version: %s\n", ShmSysConfigAndInfo->SysInfo.CsuBootLoadFwRev);
+		DEBUG_INFO("CSU kernel version: %s\n", ShmSysConfigAndInfo->SysInfo.CsuKernelFwRev);
+		DEBUG_INFO("CSU root file system version: %s\n", ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev);
+		DEBUG_INFO("========================================\n");
+	}
+
+	//===========================================
+	// Put info to dispenser share memory
+	//===========================================
+	// Get CSU boot loader version
+	memcpy(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuBootLoadFwRev, ShmSysConfigAndInfo->SysConfig.CsuBootLoadFwRev, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.CsuBootLoadFwRev));
+
+	// Get CSU kernel version
+	sprintf(cmd, "/bin/uname -r");
+	fp = popen(cmd, "r");
+	if(fp == NULL)
+		sprintf((char*)ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuKernelFwRev, "Unknown version");
+	else
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			memcpy(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuKernelFwRev, buf, strlen(buf)-1);
+		}
+	}
+
+	// Get MCU firmware version
+	strcpy((char*)ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
+
+	// Get CSU root file system version
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev, "D0.01.00.0000.00");
+
+	// Get AC connector type from model name
+	for(uint8_t idx=0;idx<3;idx++)
+	{
+		switch(ShmDispenser->ConfigData.ModelName[7+idx])
+		{
+			case '1':
+				// J1772 Plug
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[6] = '4';
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[6] = '4';
+				break;
+			case '2':
+				// J1772 Socket
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[6] = '1';
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[6] = '1';
+				break;
+			case '3':
+				// CE Plug
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[6] = '5';
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[6] = '5';
+				break;
+			case '4':
+				// CE Socket
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[6] = '2';
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[6] = '2';
+				break;
+			case '5':
+				// GB Plug
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[6] = '6';
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[6] = '6';
+				break;
+			case '6':
+				// GB Socket
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[6] = '3';
+				ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[6] = '3';
+				break;
+		}
+	}
+
+	// Get network option from model name
+	switch(ShmDispenser->ConfigData.ModelName[10])
+	{
+		case 'B':
+		case 'U':
+			//Blue tooth
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[9] = '3';
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[9] = '3';
+			break;
+		case 'W':
+			// WIFI
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[9] = '1';
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[9] = '1';
+			break;
+		case 'T':
+			// 3G/4G
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[9] = '2';
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[9] = '2';
+			break;
+		case 'D':
+			// WIFI + 4G
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[9] = '5';
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[9] = '5';
+			break;
+		default:
+			// LAN
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[9] = '0';
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[9] = '0';
+			break;
+	}
+
+	// Get rating power from model name
+	memcpy(&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[10], &ShmDispenser->ConfigData.ModelName[4], 0x03);
+	memcpy(&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[10], &ShmDispenser->ConfigData.ModelName[4], 0x03);
+
+	// Get vender code from model name
+	memcpy(&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev[14], &ShmDispenser->ConfigData.ModelName[12], 0x02);
+	memcpy(&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev[14], &ShmDispenser->ConfigData.ModelName[12], 0x02);
+
+	DEBUG_INFO("========================================\n");
+	DEBUG_INFO("----------- Dispenser-%01d info -----------\n", (gun_index+1));
+	DEBUG_INFO("CSU boot loader version: %s\n", ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuBootLoadFwRev);
+	DEBUG_INFO("CSU kernel version: %s\n", ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuKernelFwRev);
+	DEBUG_INFO("CSU root file system version: %s\n", ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuRootFsFwRev);
+	DEBUG_INFO("CSU MCU firmware version: %s\n", ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[gun_index].CsuPrimFwRev);
+	DEBUG_INFO("========================================\n");
+}
+
+//===============================================
+// Upgrade firmware
+//===============================================
+int upgrade_check()
+{
+	int result = PASS;
+	int fd;
+	DIR *dir;
+	struct dirent *file;
+	char cmd[512];
+	long int MaxLen=48*1024*1024, ImageLen=0, wrd;
+
+	if ((dir = opendir ("/mnt")) != NULL)
+	{
+		refreshStartTimer(&startTime[0][TMR_IDX_UPGRADE]);
+		/* print all the files and directories within directory */
+		while ((file = readdir (dir)) != NULL)
+		{
+			if((strlen(file->d_name)>2))
+			{
+				// Wait for MCU upgrade finish.
+				while(ShmCharger->gun_info[0].mcuFlag.isMcuUpgradeReq || (modelnameInfo.GetGunCount>1?ShmCharger->gun_info[1].mcuFlag.isMcuUpgradeReq:FALSE))sleep(1);
+
+				// Wait for LCM upgrade finish.
+				while(ShmCharger->isUpgradeLcmReq)sleep(1);
+
+				memset(&ShmCharger->fwUpgradeInfo, 0xFF, sizeof(Fw_Upgrade_Info));
+				DEBUG_INFO("New firmware file: %s\n", file->d_name);
+				sprintf(ShmCharger->fwUpgradeInfo.location, "/mnt/%s", file->d_name);
+
+				if((fd=open(ShmCharger->fwUpgradeInfo.location, O_RDONLY)) >= 0)
+				{
+					unsigned char *ptr = malloc(MaxLen); //-48 is take out the header
+					memset(ptr, 0xFF, MaxLen);  //-48 is take out the header
+					ImageLen = read(fd, ptr, MaxLen);
+					close(fd);
+
+					ShmCharger->fwUpgradeInfo.fwType = ((ptr[0x13]<<0) | (ptr[0x12]<<8) | (ptr[0x11]<<16) | (ptr[0x10]<<24));
+					substr(ShmCharger->fwUpgradeInfo.modelName, (char *)ptr, 0, 0x10);
+					DEBUG_INFO("New firmware type: %X\n", ShmCharger->fwUpgradeInfo.fwType);
+					DEBUG_INFO("New firmware model name: %s, %s\n", ShmCharger->fwUpgradeInfo.modelName, ShmSysConfigAndInfo->SysConfig.ModelName);
+
+					if((ShmCharger->fwUpgradeInfo.modelName[0] == ShmSysConfigAndInfo->SysConfig.ModelName[0]) &&
+					   (ShmCharger->fwUpgradeInfo.modelName[1] == ShmSysConfigAndInfo->SysConfig.ModelName[1]) &&
+					   (ShmCharger->fwUpgradeInfo.modelName[7] == ShmSysConfigAndInfo->SysConfig.ModelName[7]) &&
+					   (ShmCharger->fwUpgradeInfo.modelName[8] == ShmSysConfigAndInfo->SysConfig.ModelName[8]) &&
+					   (ShmCharger->fwUpgradeInfo.modelName[9] == ShmSysConfigAndInfo->SysConfig.ModelName[9]) &&
+					   (ShmCharger->fwUpgradeInfo.modelName[11] == ShmSysConfigAndInfo->SysConfig.ModelName[11]) &&
+					   (ShmCharger->fwUpgradeInfo.modelName[12] == ShmSysConfigAndInfo->SysConfig.ModelName[12]) &&
+					   (ShmCharger->fwUpgradeInfo.modelName[13] == ShmSysConfigAndInfo->SysConfig.ModelName[13]) &&
+					   (ShmCharger->fwUpgradeInfo.fwType>0))
+					{
+						switch(ShmCharger->fwUpgradeInfo.fwType)
+						{
+							case CSU_MLO:
+							case CSU_BOOTLOADER:
+							case CSU_KERNEL_CONFIGURATION:
+							case CSU_KERNEL_IMAGE:
+							case CSU_ROOT_FILE_SYSTEM:
+							case CSU_USER_CONFIGURATION:
+							case CSU_PRIMARY_CONTROLLER:
+							case AC_WALLMOUNT_CONTROLLER:
+								// Put image file
+								for(uint8_t gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+								{
+									char cmd[768];
+
+									if(gun_index>0)
+									{
+										sprintf(cmd, "ftpput -u root -p y42j/4cj84 192.168.201.%d /mnt/%s %s", (201+gun_index), file->d_name, file->d_name);
+										if(system(cmd) != 0)
+										{
+											DEBUG_ERROR("FTP put %s to dispenser-%d fail\n", file->d_name, gun_index);
+											result = FAIL;
+										}
+										else
+										{
+											DEBUG_INFO("FTP put %s to dispenser-%d finish\n", file->d_name, gun_index);
+										}
+									}
+								}
+
+								break;
+							case LCM:
+								fd = open("/mnt/lcm.zip", O_RDWR | O_CREAT | O_EXCL);
+								if (fd < 0)
+								{
+									DEBUG_ERROR("Can not create lcm.zip file.\n");
+									result = FAIL;
+								}
+								else
+								{
+									// Write image to flash
+									DEBUG_INFO("Writing data to lcm.zip file...\n");
+									wrd=write(fd, ptr+48, ImageLen-48);
+									close(fd);
+									DEBUG_INFO(">> lcm.zip Written length: 0x%x\n", wrd);
+									if(wrd != (ImageLen-48))
+									{
+										result = FAIL;
+									}
+									else
+									{
+										runShellCmd("mkdir -p /mnt/lcd");
+										runShellCmd("unzip /mnt/lcm.zip -d /mnt/lcd");
+										sprintf(cmd, "yes|rm %s", ShmCharger->fwUpgradeInfo.location);
+										system(cmd);
+										system("rm -f /mnt/lcm.zip");
+										result = PASS;
+									}
+								}
+
+								ShmCharger->isUpgradeLcmReq = ON;
+								sleep(10);
+								break;
+							default:
+								result = FAIL;
+								DEBUG_WARN("Image file is unknown type.\n");
+								sprintf(cmd, "yes|rm %s", ShmCharger->fwUpgradeInfo.location);
+								system(cmd);
+								break;
+						}
+					}
+					else
+					{
+						result = FAIL;
+						DEBUG_ERROR("Model name and Firmware type error.\n");
+						sprintf(cmd, "yes|rm %s", ShmCharger->fwUpgradeInfo.location);
+						system(cmd);
+					}
+					free(ptr);
+				}
+				else
+				{
+					result = FAIL;
+					DEBUG_ERROR("New firmware open error.\n");
+				}
+			}
+			else
+			{
+				if(strlen(file->d_name) >= 3)
+				{
+					result = FAIL;
+					DEBUG_ERROR("File name error.\n");
+				}
+				else
+				{
+					DEBUG_ERROR("Searching file.\n");
+				}
+			}
+		}
+		closedir (dir);
+
+		// Wait dispenser upgrade result
+		if(result != FAIL)
+		{
+			uint8_t isCompleted = ON;
+
+			for(uint8_t gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+				ShmCharger->gun_info[gun_index].isUpgradeReq = ON;
+
+			do
+			{
+				isCompleted = ON;
+				for(uint8_t gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+				{
+					isCompleted &= ShmCharger->gun_info[gun_index].isUpgradeEnd;
+				}
+				sleep(1);
+			}while((getDiffSecNow(startTime[0][TMR_IDX_UPGRADE]) < TIMEOUT_SPEC_UPGRADE) && !isCompleted);
+
+			for(uint8_t gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+			{
+				result &= ShmCharger->gun_info[gun_index].isUpgradePASS;
+			}
+
+			result &= (getDiffSecNow(startTime[0][TMR_IDX_UPGRADE]) <= TIMEOUT_SPEC_UPGRADE);
+
+			if(getDiffSecNow(startTime[0][TMR_IDX_UPGRADE]) > TIMEOUT_SPEC_UPGRADE)DEBUG_INFO("Upgrade process timeout.\n");
+		}
+	}
+	else
+	{
+		result = FAIL;
+		DEBUG_ERROR("/mnt does not valid.\n");
+	}
+
+	return result;
+}
+
+//===============================================
+// Check RFID is match with start user
+//===============================================
+int isMatchStartUser(unsigned char gun_index)
+{
+	uint8_t tmpUser[32];
+
+	if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
+	{
+		// Big endian
+		switch(rfid.snType)
+		{
+			case RFID_SN_TYPE_6BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
+				break;
+			case RFID_SN_TYPE_7BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
+				break;
+			case RFID_SN_TYPE_10BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
+				break;
+			case RFID_SN_TYPE_4BYTE:
+			default:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
+				break;
+		}
+	}
+	else
+	{
+		// Little endian
+		switch(rfid.snType)
+		{
+			case RFID_SN_TYPE_6BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+				break;
+			case RFID_SN_TYPE_7BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+				break;
+			case RFID_SN_TYPE_10BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+				break;
+			case RFID_SN_TYPE_4BYTE:
+			default:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+				break;
+		}
+	}
+
+	DEBUG_INFO("==== isMatchStartUser ==== \n");
+	DEBUG_INFO("tmpUser : %s \n", tmpUser);
+	DEBUG_INFO("StartUserId : %s \n", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
+	DEBUG_INFO("========================== \n");
+
+	return ((strcmp((char*)tmpUser, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId)==0)?YES:NO);
+}
+
+int isMatchPresentUser()
+{
+	uint8_t tmpUser[32];
+
+	if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
+	{
+		// Big endian
+		switch(rfid.snType)
+		{
+			case RFID_SN_TYPE_6BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
+				break;
+			case RFID_SN_TYPE_7BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
+				break;
+			case RFID_SN_TYPE_10BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
+				break;
+			case RFID_SN_TYPE_4BYTE:
+			default:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
+				break;
+		}
+	}
+	else
+	{
+		// Little endian
+		switch(rfid.snType)
+		{
+			case RFID_SN_TYPE_6BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+				break;
+			case RFID_SN_TYPE_7BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+				break;
+			case RFID_SN_TYPE_10BYTE:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+				break;
+			case RFID_SN_TYPE_4BYTE:
+			default:
+				sprintf((char*)tmpUser, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+				break;
+		}
+	}
+
+	DEBUG_INFO("==== isMatchPresentUser ==== \n");
+	DEBUG_INFO("tmpUser : %s \n", tmpUser);
+	DEBUG_INFO("UserId : %s \n", ShmSysConfigAndInfo->SysConfig.UserId);
+	DEBUG_INFO("============================ \n");
+
+	return ((strcmp((char*)tmpUser, (char*)ShmSysConfigAndInfo->SysConfig.UserId)==0)?YES:NO);
+}
+
+//===============================================
+//	Read RFID Serial Number
+//===============================================
+int GetCardSerialNumber()
+{
+	int isSuccess = FAIL;
+	int module_type = MODULE_EWT;
+
+	if(getRequestCardSN(rfidFd,module_type,&rfid))
+	{
+		if(rfid.cardType == ISO14443A)
+		{
+			if(rfid.snType == RFID_SN_TYPE_4BYTE)
+			{
+				isSuccess = PASS;
+			}
+			else if (rfid.snType == RFID_SN_TYPE_7BYTE)
+			{
+				isSuccess = PASS;
+			}
+
+			sethaltCard(rfidFd,module_type);
+		}
+		else if(rfid.cardType == IS014443B)
+		{
+			isSuccess = PASS;
+		}
+		else if(rfid.cardType == FELICA)
+		{
+			isSuccess = PASS;
+		}
+		else
+		{}
+	}
+	else
+	{}
+
+	return isSuccess;
+}
+
+//===============================================
+// Set led motion
+//===============================================
+void setLedMotion(unsigned char gun_index,unsigned char led_mode)
+{
+	switch(led_mode)
+	{
+		case LED_ACTION_INIT:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_INIT;
+			break;
+		case LED_ACTION_IDLE:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_IDLE;
+			break;
+		case LED_ACTION_AUTHED:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_AUTHED;
+			break;
+		case LED_ACTION_CONNECTED:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_CONNECTED;
+			break;
+		case LED_ACTION_CHARGING:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_CHARGING;
+			break;
+		case LED_ACTION_STOP:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_STOP;
+			break;
+		case LED_ACTION_ALARM:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_ALARM;
+			break;
+		case LED_ACTION_MAINTAIN:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_MAINTAIN;
+			break;
+		case LED_ACTION_RFID_PASS:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_RFID_PASS;
+			break;
+		case LED_ACTION_RFID_FAIL:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_RFID_FAIL;
+			break;
+		case LED_ACTION_BLE_CONNECT:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_BLE_CONNECT;
+			break;
+		case LED_ACTION_BLE_DISABLE:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_BLE_DISABLE;
+			break;
+		case LED_ACTION_DEBUG:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_DEBUG;
+			break;
+		case LED_ACTION_ALL_OFF:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_ALL_OFF;
+			break;
+		case LED_RELAY_ON:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_RELAY_ON;
+			break;
+		case LED_RELAY_OFF:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_RELAY_OFF;
+			break;
+		case LED_ACTION_HANDSHAKE_FAIL:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_HANDSHAKE_FAIL;
+			break;
+		case LED_ACTION_INTERNET_DISCONNECT:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_INTERNET_DISCONNECT;
+			break;
+		case LED_ACTION_RESTORE_SETTING:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_RESTORE_SETTING;
+			break;
+		case LED_ACTION_IDLE_BACKEND_CONNECTED:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_IDLE_BACKEND_CONNECTED;
+			break;
+		case LED_ACTION_IDLE_BACKEND_CONNECTED_SLEEP:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_IDLE_BACKEND_CONNECTED_SLEEP;
+			break;
+		case LED_ACTION_IDLE_BACKEND_DISCONNECTED:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_IDLE_BACKEND_DISCONNECTED;
+			break;
+		case LED_ACTION_IDLE_BACKEND_DISCONNECTED_SLEEP:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_IDLE_BACKEND_DISCONNECTED_SLEEP;
+			break;
+		case LED_ACTION_RESERVATION_MODE:
+			ShmCharger->gun_info[gun_index].primaryMcuLed.mode = LED_ACTION_RESERVATION_MODE;
+			break;
+	}
+}
+
+//===============================================
+// Request on/off set
+//===============================================
+void setRequest(unsigned char gun_index,unsigned char isOn)
+{							
+	if(isOn == ON)
+	{
+		if(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == OFF)
+		{
+			ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest = ON;
+			DEBUG_INFO("Gun-%d permission request: ON \n",gun_index);
+		}
+	}
+	else
+	{
+		if(ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest == ON)
+		{
+			ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest = OFF;
+			DEBUG_INFO("Gun-%d permission request: OFF \n",gun_index);
+		}
+	}
+}
+
+//===============================================
+// Request on/off get
+//===============================================
+int getRequest(unsigned char gun_index)
+{
+	return ShmCharger->gun_info[gun_index].legacyRequest.isLegacyRequest;
+}
+
+//===============================================
+// Relay on/off set
+//===============================================
+void setRelay(unsigned char gun_index,unsigned char isOn)
+{							
+	if(isOn == ON)
+	{
+		if(ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn == OFF)
+		{
+			switch(ShmCharger->gun_info[gun_index].chargingMode)
+			{
+				case CHARGING_MODE_BS:
+				case CHARGING_MODE_HLC:
+					ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = ON;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][0] = 0x01;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][1] = 0x01;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][2] = 0x01;
+
+					if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+						DEBUG_INFO("Gun-%d Output relay status: ON. [CHARGING_MODE_BS] \n",gun_index);
+					else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+						DEBUG_INFO("Gun-%d Output relay status: ON. [CHARGING_MODE_HLC] \n",gun_index);
+
+					break;
+				case CHARGING_MODE_SOCKETE:
+					ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = ON;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][3] = 0x01;
+					DEBUG_INFO("Gun-%d Output relay status: ON. [CHARGING_MODE_SOCKETE] \n",gun_index);
+					break;
+				default:
+					ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = ON;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][0] = 0x01;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][1] = 0x01;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][2] = 0x01;
+					DEBUG_INFO("Gun-%d Output relay status: ON. [DEFFAULT] \n",gun_index);
+					break;
+			}
+		}
+	}
+	else
+	{
+		if(ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn == ON)
+		{
+			switch(ShmCharger->gun_info[gun_index].chargingMode)
+			{
+				case CHARGING_MODE_BS:
+				case CHARGING_MODE_HLC:
+					ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = OFF;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][0] = 0;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][1] = 0;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][2] = 0;
+
+					if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+						DEBUG_INFO("Gun-%d Output relay status: OFF. [CHARGING_MODE_BS] \n",gun_index);
+					else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+						DEBUG_INFO("Gun-%d Output relay status: OFF. [CHARGING_MODE_HLC] \n",gun_index);
+
+					break;
+				case CHARGING_MODE_SOCKETE:
+					ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = OFF;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][3] = 0;
+					DEBUG_INFO("Gun-%d Output relay status: OFF. [CHARGING_MODE_SOCKETE] \n",gun_index);
+					break;
+				default:
+					ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn = OFF;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][0] = 0;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][1] = 0;
+					ShmCharger->gun_info[gun_index].primaryMcuState.relayState.relay_status[0][2] = 0;
+					DEBUG_INFO("Gun-%d Output relay status: OFF. [DEFFAULT] \n",gun_index);
+					break;
+			}
+		}
+	}
+}
+
+//===============================================
+// Relay on/off get
+//===============================================
+int getRelay(unsigned char gun_index)
+{
+	return ShmCharger->gun_info[gun_index].legacyRequest.isRelayOn;
+}
+
+//===============================================
+// Set speaker on/off request
+//===============================================
+void setSpeaker(unsigned char isOn, unsigned char speaker_mode)
+{
+	if(isOn == ON)
+	{
+		ShmCharger->isSpeakerOn = ON;
+		ShmCharger->speaker_type = speaker_mode;
+	}
+}
+
+//===============================================
+// Initialization RFID communication port
+//===============================================
+int InitRfidPort()
+{
+	int uartO2 = open(rfidPortName, O_RDWR);
+		struct termios tios;
+
+	if (uartO2 != FAIL)
+	{
+		ioctl (uartO2, TCGETS, &tios);
+		tios.c_cflag = B19200 | CS8 | CLOCAL | CREAD;
+		tios.c_lflag = 0;
+		tios.c_iflag = 0;
+		tios.c_oflag = 0;
+		tios.c_cc[VMIN] = 0;
+		tios.c_cc[VTIME] = (unsigned char) 1;
+		tios.c_lflag = 0;
+		tcflush(uartO2, TCIFLUSH);
+		ioctl(uartO2, TCSETS, &tios);
+	}
+
+	if (uartO2 < 0)
+	{
+		ShmStatusCodeData->AlarmCode.AlarmEvents.bits.RfidModuleCommFail = 1;
+	}
+
+	return uartO2;
+}
+
+//===============================================
+// Check internet access status
+//===============================================
+int isReachableInternet()
+{
+	int result = FAIL;
+	FILE *fp;
+	char cmd[256];
+	char buf[512];
+	char tmp[512];
+	
+	// Get ip address & net mask
+	strcpy(cmd, "ifconfig eth0");
+	fp = popen(cmd, "r");
+	if (fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			if (strstr(buf, "inet addr:") > 0)
+			{
+				sscanf(buf, "%*s%s", tmp);
+				substr(tmp, tmp, strspn(tmp, "addr:"), strlen(buf)-strspn(tmp, "addr:"));
+				if (strcmp(tmp, (char *)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress) != 0)
+				{
+					strcpy((char *) ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress, tmp);
+				}
+
+				sscanf(buf, "%*s%*s%*s%s", tmp);
+				substr(tmp, tmp, strspn(tmp, "Mask:"), strlen(buf)-strspn(tmp, "Mask:"));
+				if (strcmp(tmp, (char *)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress) != 0)
+				{
+					strcpy((char *) ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress, tmp);
+				}
+			}
+		}
+	}
+	pclose(fp);
+	memset(buf, 0x00, sizeof(buf));
+
+	// Get gateway
+	fp = popen("ip route", "r");
+	if(fp == NULL)
+		result = FAIL;
+	else
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			if((strstr(buf, "default") != NULL) && (strstr(buf, "eth0") != NULL))
+				break;
+		}
+
+		if(strstr(buf, "default") != NULL)
+		{
+			sscanf(buf, "%*s%*s%s", tmp);
+			substr((char*)ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress, tmp, 0, strlen(tmp));
+		}
+	}
+	pclose(fp);
+	memset(buf, 0x00, sizeof(buf));
+
+
+	for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
+	{
+		sprintf(cmd, "ping -c 1 -w 3 -I eth0 %s", valid_Internet[idx]);
+		fp = popen(cmd, "r");
+		if(fp != NULL)
+		{
+			while(fgets(buf, sizeof(buf), fp) != NULL)
+			{
+				if(strstr(buf, "transmitted") > 0)
+				{
+					//sscanf(buf, "%*s%*s%*s%*s%*s%*s%s", tmp);
+
+					if(strstr(buf,"100%") != NULL)
+					{
+
+					}
+					else
+					{
+						result = PASS;
+					}
+					//DEBUG_INFO("%s",buf);
+					//DEBUG_INFO("%s\n",tmp);
+				}
+			}
+		}
+		pclose(fp);
+	}
+
+	return result;
+}
+
+int isRouteFail()
+{
+	int result = YES;
+	FILE *fp;
+	char buf[512];
+
+	fp = popen("route -n", "r");
+	if(fp != NULL)
+	{
+		while(fgets(buf, sizeof(buf), fp) != NULL)
+		{
+			if(strstr(buf, "eth0") != NULL)
+				result = NO;
+		}
+	}
+	pclose(fp);
+
+	return result;
+}
+
+//===============================================
+// Check reservation date is expired
+//===============================================
+int isReservationExpired(unsigned char gun_index)
+{
+	int result = NO;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(isOvertNow(ShmOCPP16Data->ReserveNow[gun_index].ExpiryDate))
+			result = YES;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(isOvertNow(ShmOCPP20Data->ReserveNow[gun_index].expiryDateTime))
+			result = YES;
+	}
+
+	return result;
+}
+
+//===============================================
+// Check charging profile related date routine
+//===============================================
+int isProfileValid(uint8_t gun_index)
+{
+	int result = NO;
+	struct tm tmFrom, tmTo;
+	struct timeb tbFrom, tbTo;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if((sscanf((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ValidFrom, "%4d-%2d-%2dT%2d:%2d:%2d", &tmFrom.tm_year, &tmFrom.tm_mon, &tmFrom.tm_mday, &tmFrom.tm_hour, &tmFrom.tm_min, &tmFrom.tm_sec) == 6) &&
+		   (sscanf((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ValidTo, "%4d-%2d-%2dT%2d:%2d:%2d", &tmTo.tm_year, &tmTo.tm_mon, &tmTo.tm_mday, &tmTo.tm_hour, &tmTo.tm_min, &tmTo.tm_sec) == 6))
+		{
+			tmFrom.tm_year -= 1900;
+			tmFrom.tm_mon -= 1;
+			tbFrom.time = mktime(&tmFrom);
+
+			tmTo.tm_year -= 1900;
+			tmTo.tm_mon -= 1;
+			tbTo.time = mktime(&tmTo);
+
+			DEBUG_INFO("Valid from compare Now: %d\n", DiffTimebWithNow(tbFrom));
+			DEBUG_INFO("Valid to compare Now: %d\n", DiffTimebWithNow(tbTo));
+			if((DiffTimebWithNow(tbFrom)>=0) && (DiffTimebWithNow(tbTo)<=0))
+			{
+				result = YES;
+			}
+		}
+		else
+		{
+			DEBUG_WARN("ValidFrom or ValidTo date parsing error.\n");
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if((sscanf((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].validFrom, "%4d-%2d-%2dT%2d:%2d:%2d", &tmFrom.tm_year, &tmFrom.tm_mon, &tmFrom.tm_mday, &tmFrom.tm_hour, &tmFrom.tm_min, &tmFrom.tm_sec) == 6) &&
+		   (sscanf((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].validTo, "%4d-%2d-%2dT%2d:%2d:%2d", &tmTo.tm_year, &tmTo.tm_mon, &tmTo.tm_mday, &tmTo.tm_hour, &tmTo.tm_min, &tmTo.tm_sec) == 6))
+		{
+			tmFrom.tm_year -= 1900;
+			tmFrom.tm_mon -= 1;
+			tbFrom.time = mktime(&tmFrom);
+
+			tmTo.tm_year -= 1900;
+			tmTo.tm_mon -= 1;
+			tbTo.time = mktime(&tmTo);
+
+			DEBUG_INFO("Valid from compare Now: %d\n", DiffTimebWithNow(tbFrom));
+			DEBUG_INFO("Valid to compare Now: %d\n", DiffTimebWithNow(tbTo));
+			if((DiffTimebWithNow(tbFrom)>=0) && (DiffTimebWithNow(tbTo)<=0))
+			{
+				result = YES;
+			}
+		}
+		else
+		{
+			DEBUG_WARN("ValidFrom or ValidTo date parsing error.\n");
+		}
+	}
+
+	return result;
+}
+
+int getScheduleStart(int gun_index)
+{
+	int result = -1;
+	struct tm tmScheduleStart;;
+	struct timeb tbScheduleStart;
+
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if((sscanf((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.StartSchedule, "%4d-%2d-%2dT%2d:%2d:%2d", &tmScheduleStart.tm_year, &tmScheduleStart.tm_mon, &tmScheduleStart.tm_mday, &tmScheduleStart.tm_hour, &tmScheduleStart.tm_min, &tmScheduleStart.tm_sec) == 6))
+		{
+			tmScheduleStart.tm_year -= 1900;
+			tmScheduleStart.tm_mon -= 1;
+			tbScheduleStart.time = mktime(&tmScheduleStart);
+			tbScheduleStart.millitm = 0;
+
+			result = DiffTimebWithNow(tbScheduleStart)/1000;
+			//DEBUG_INFO("Schedule start compare Now(seconds): %d\n", result);
+		}
+		else
+		{
+			DEBUG_WARN("Schedule start date parsing error.\n");
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if((sscanf((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].startSchedule, "%4d-%2d-%2dT%2d:%2d:%2d", &tmScheduleStart.tm_year, &tmScheduleStart.tm_mon, &tmScheduleStart.tm_mday, &tmScheduleStart.tm_hour, &tmScheduleStart.tm_min, &tmScheduleStart.tm_sec) == 6))
+		{
+			tmScheduleStart.tm_year -= 1900;
+			tmScheduleStart.tm_mon -= 1;
+			tbScheduleStart.time = mktime(&tmScheduleStart);
+			tbScheduleStart.millitm = 0;
+
+			result = DiffTimebWithNow(tbScheduleStart)/1000;
+			//DEBUG_INFO("Schedule start compare Now(seconds): %d\n", result);
+		}
+		else
+		{
+			DEBUG_WARN("Schedule start date parsing error.\n");
+		}
+	}
+
+	return result;
+}
+
+int getStartSinceToday()
+{
+	int result = -1;
+	time_t t;
+	struct tm *tmStartToday;
+	struct timeb tbStartToday;
+
+	t=time(NULL);
+	tmStartToday=localtime(&t);
+
+	tmStartToday->tm_hour = 0;
+	tmStartToday->tm_min = 0;
+	tmStartToday->tm_sec = 0;
+
+	tbStartToday.time = mktime(tmStartToday);
+
+	result = DiffTimebWithNow(tbStartToday)/1000;
+	//DEBUG_INFO("Start today compare Now(seconds): %d\n", result);
+
+	return result;
+}
+
+int getStartSinceWeek()
+{
+	int result = -1;
+	time_t t;
+	struct tm *tmStartWeek;
+	struct timeb tbStartWeek;
+
+	t=time(NULL);
+	tmStartWeek=localtime(&t);
+	t-=86400*tmStartWeek->tm_wday;
+	tmStartWeek=localtime(&t);
+
+	tmStartWeek->tm_hour = 0;
+	tmStartWeek->tm_min = 0;
+	tmStartWeek->tm_sec = 0;
+
+	tbStartWeek.time = mktime(tmStartWeek);
+
+	result = DiffTimebWithNow(tbStartWeek)/1000;
+	//DEBUG_INFO("Start week compare Now(seconds): %d\n", result);
+
+	return result;
+}
+
+//===============================================
+// Valid from local white list
+//===============================================
+int isValidLocalWhiteCard()
+{
+	uint8_t result = FAIL;
+	for(uint8_t idx=0;idx<ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.LocalWhiteCard);idx++)
+	{
+		if(strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char*)ShmSysConfigAndInfo->SysConfig.LocalWhiteCard[idx]) == 0)
+		{
+			result = PASS;
+		}
+	}
+
+	return result;
+}
+
+//==========================================
+// Check routine
+//==========================================
+void checkTask()
+{
+	if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'T') || (ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
+	{
+		if(system("pidof -s Module_4g > /dev/null") != 0)
+		{
+			DEBUG_INFO("Module_4g not running, restart it.\n");
+			system("/root/Module_4g &");
+		}
+	}
+
+	if((ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[10] == 'D'))
+	{
+		if(system("pidof -s Module_Wifi > /dev/null") != 0)
+		{
+			DEBUG_INFO("Module_Wifi not running, restart it.\n");
+			system("/root/Module_Wifi &");
+		}
+	}
+
+	if(system("pidof -s Module_EventLogging > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_EventLogging not running, restart it.\n");
+		system("/root/Module_EventLogging &");
+	}
+
+	if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0) && !ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging)
+	{
+		if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+		{
+			if((time((time_t*)NULL) - ShmOCPP16Data->procDogTime) > 180)
+			{
+				DEBUG_WARN("OcppBackend watch dog timeout task restart.\n");
+				ShmOCPP16Data->procDogTime =  time((time_t*)NULL);
+				system("pkill OcppBackend");
+				sleep(3);
+				ocpp_process_start();
+			}
+
+			if(system("pidof -s OcppBackend > /dev/null") != 0)
+			{
+				DEBUG_INFO("OcppBackend not running, restart it.\n");
+				ocpp_process_start();
+			}
+		}
+		else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+		{
+			if((time((time_t*)NULL) - ShmOCPP20Data->procDogTime) > 180)
+			{
+				DEBUG_WARN("OcppBackend20 watch dog timeout task restart.\n");
+				ShmOCPP20Data->procDogTime =  time((time_t*)NULL);
+				system("pkill OcppBackend20");
+				sleep(3);
+				ocpp_process_start();
+			}
+
+			if(system("pidof -s OcppBackend20 > /dev/null") != 0)
+			{
+				DEBUG_INFO("OcppBackend20 not running, restart it.\n");
+				ocpp_process_start();
+			}
+		}
+	}
+
+	if(system("pidof -s Module_AlarmDetect > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_AlarmDetect not running, restart it.\n");
+		system("/root/Module_AlarmDetect &");
+	}
+
+	if(system("pidof -s Module_InternalComm > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_InternalComm not running, restart it.\n");
+		system("/root/Module_InternalComm &");
+	}
+
+	if(system("pidof -s Module_Speaker > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_Speaker not running, restart it.\n");
+		system("/root/Module_Speaker &");
+	}
+
+	if(system("pidof -s Module_ProduceUtils > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_ProduceUtils not running, restart it.\n");
+		system ("/root/Module_ProduceUtils &");
+	}
+
+	if(system("pidof -s Module_LcmControl > /dev/null") != 0)
+	{
+		DEBUG_INFO("Module_LcmControl not running, restart it.\n");
+		system ("/root/Module_LcmControl &");
+	}
+
+	if((system("pidof -s Module_PowerSharing > /dev/null") != 0) &&
+		ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging)
+	{
+		DEBUG_INFO("Module_PowerSharing not running, restart it.\n");
+		system ("/root/Module_PowerSharing &");
+	}
+
+	if((system("pidof -s Module_InitUpgrade > /dev/null") != 0) &&
+		ShmSysConfigAndInfo->SysConfig.isReqFirstUpgrade)
+	{
+		DEBUG_INFO("Module_InitUpgrade not running, restart it.\n");
+		system ("/root/Module_InitUpgrade &");
+	}
+
+	if((system("pidof -s Module_Cabinet > /dev/null") != 0))
+	{
+		DEBUG_INFO("Module_Cabinet not running, restart it.\n");
+		system ("/root/Module_Cabinet &");
+	}
+
+	if((system("pidof -s Module_Dispenser > /dev/null") != 0))
+	{
+		DEBUG_INFO("Module_Dispenser not running, restart it.\n");
+		system ("/root/Module_Dispenser &");
+	}
+}
+
+void checkConnectionTimeout()
+{
+	if((system("pidof -s OcppBackend > /dev/null") != 0) && (system("pidof -s OcppBackend20 > /dev/null") != 0))
+	{
+		ShmCharger->timeoutSpec.Present_Timeout_Spec = TIMEOUT_SPEC_HANDSHAKING;
+		//DEBUG_INFO("Handshaking timeout specification follow by initial setting : %d s \n", TIMEOUT_SPEC_HANDSHAKING/1000);
+	}
+	else
+	{
+		ShmCharger->timeoutSpec.Setting_Timeout_Spec = ocpp_get_connection_timeout();
+		if((ShmCharger->timeoutSpec.Setting_Timeout_Spec) < TIMEOUT_SPEC_BS_HLC_HANDSHAKE)
+		{
+			ShmCharger->timeoutSpec.Present_Timeout_Spec = (TIMEOUT_SPEC_BS_HLC_HANDSHAKE+10);
+			//DEBUG_INFO("Handshaking timeout specification follow by OCPP Configuration : Fail. Value can't be zero or less than zero.\n.");
+		}
+		else
+		{
+			ShmCharger->timeoutSpec.Present_Timeout_Spec = (ShmCharger->timeoutSpec.Setting_Timeout_Spec);
+			//DEBUG_INFO("Handshaking timeout specification follow by OCPP Configuration : Pass...\n.");
+		}
+		//DEBUG_INFO("Handshaking timeout specification follow by OCPP Configuration : %s s \n.",ShmOCPP16Data->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData);
+	}
+}
+
+void checkReset()
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->MsMsg.bits.ResetReq)
+		{
+			if((!isMode(0, SYS_MODE_CHARGING) && !isMode(0, SYS_MODE_TERMINATING)  && !isMode(0, SYS_MODE_COMPLETE)) &&
+			   ((modelnameInfo.GetGunCount==2)?(!isMode(1, SYS_MODE_CHARGING) && !isMode(1, SYS_MODE_TERMINATING)  && !isMode(1, SYS_MODE_COMPLETE)):TRUE) &&
+			   ((modelnameInfo.GetGunCount==3)?(!isMode(2, SYS_MODE_CHARGING) && !isMode(2, SYS_MODE_TERMINATING)  && !isMode(2, SYS_MODE_COMPLETE)):TRUE))
+			{
+				ShmOCPP16Data->MsMsg.bits.ResetReq = OFF;
+				sprintf((char*)ShmOCPP16Data->Reset.ResponseStatus, "Accepted");
+				ShmOCPP16Data->MsMsg.bits.ResetConf = ON;
+
+				DEBUG_INFO("%s reset request by OCPP.\n", ShmOCPP16Data->Reset.Type);
+
+				if(strcmp((char*)ShmOCPP16Data->Reset.Type, "Hard") == 0)
+				{
+					for(int gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+					{
+						ShmCharger->gun_info[gun_index].isResetHardReq = ON;
+						setLedMotion(gun_index,LED_ACTION_INIT);
+					}
+				}
+				else
+				{
+					for(int gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+					{
+						ShmCharger->gun_info[gun_index].isResetSoftReq = ON;
+						setLedMotion(gun_index,LED_ACTION_INIT);
+					}
+				}
+				sleep(2);
+			}
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->MsMsg.bits.ResetReq)
+		{
+			if((!isMode(0, SYS_MODE_CHARGING) && !isMode(0, SYS_MODE_TERMINATING)  && !isMode(0, SYS_MODE_COMPLETE)) &&
+			   ((modelnameInfo.GetGunCount==2)?(!isMode(1, SYS_MODE_CHARGING) && !isMode(1, SYS_MODE_TERMINATING)  && !isMode(1, SYS_MODE_COMPLETE)):TRUE) &&
+			   ((modelnameInfo.GetGunCount==3)?(!isMode(2, SYS_MODE_CHARGING) && !isMode(2, SYS_MODE_TERMINATING)  && !isMode(2, SYS_MODE_COMPLETE)):TRUE))
+			{
+				ShmOCPP20Data->MsMsg.bits.ResetReq = OFF;
+				sprintf((char*)ShmOCPP20Data->Reset.Response_status, "Accepted");
+				ShmOCPP20Data->MsMsg.bits.ResetConf = ON;
+
+				DEBUG_INFO("%s reset request by OCPP.\n", ShmOCPP20Data->Reset.type);
+
+				if(strcmp((char*)ShmOCPP20Data->Reset.type, "Immediate") == 0)
+				{
+					for(int gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+					{
+						ShmCharger->gun_info[gun_index].isResetHardReq = ON;
+						setLedMotion(gun_index,LED_ACTION_INIT);
+					}
+				}
+				else
+				{
+					for(int gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+					{
+						ShmCharger->gun_info[gun_index].isResetSoftReq = ON;
+						setLedMotion(gun_index,LED_ACTION_INIT);
+					}
+				}
+				sleep(2);
+			}
+		}
+	}
+
+	if(ShmDispenser->gun_info.isResetHardReq)
+	{
+		system("sync");
+		sleep(5);
+		system("reboot -f");
+		sleep(5);
+		system("reboot -f");
+	}
+	else if(ShmDispenser->gun_info.isResetSoftReq)
+	{
+		sleep(5);
+		close(wtdFd);
+		system("/usr/bin/run_evse_restart.sh");
+	}
+}
+
+void checkReservation(uint8_t gun_index)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CsMsg.bits[gun_index].ReserveNowReq)
+		{
+			ShmOCPP16Data->CsMsg.bits[gun_index].ReserveNowReq = OFF;
+			ShmOCPP16Data->CsMsg.bits[gun_index].ReserveNowConf = ON;
+			if(isMode(gun_index, SYS_MODE_IDLE) && !isReservationExpired(gun_index))
+			{
+				sleep(5);
+				ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId = ShmOCPP16Data->ReserveNow[gun_index].ReservationId;
+				setChargerMode(gun_index, SYS_MODE_RESERVATION);
+			}
+			DEBUG_INFO("Reservation request on gun-%d.\n", gun_index);
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CsMsg.bits[gun_index].ReserveNowReq)
+		{
+			ShmOCPP20Data->CsMsg.bits[gun_index].ReserveNowReq = OFF;
+			ShmOCPP20Data->CsMsg.bits[gun_index].ReserveNowConf = ON;
+			if(isMode(gun_index, SYS_MODE_IDLE) && !isReservationExpired(gun_index))
+			{
+				ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId = ShmOCPP20Data->ReserveNow[gun_index].id;
+				setChargerMode(gun_index, SYS_MODE_RESERVATION);
+			}
+			DEBUG_INFO("Reservation request on gun-%d.\n", gun_index);
+		}
+	}
+}
+
+void checkUnlocker(uint8_t gun_index)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CsMsg.bits[gun_index].UnlockConnectorReq == ON)
+		{
+			ShmOCPP16Data->CsMsg.bits[gun_index].UnlockConnectorReq = OFF;
+
+			sprintf((char*)ShmOCPP16Data->UnlockConnector[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].ResponseStatus, "NotSupported");
+			ShmOCPP16Data->CsMsg.bits[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].UnlockConnectorConf = ON;
+
+			ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor = ON;
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CsMsg.bits[gun_index].UnlockConnectorReq == ON)
+		{
+			ShmOCPP20Data->CsMsg.bits[gun_index].UnlockConnectorReq = OFF;
+
+			sprintf((char*)ShmOCPP20Data->UnlockConnector[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].Response_status, "UnlockFailed");
+			ShmOCPP20Data->CsMsg.bits[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].UnlockConnectorConf = ON;
+
+			ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor = ON;
+		}
+	}
+}
+
+void checkAvailability(uint8_t gun_index)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq)
+		{
+			if(strcmp((char*)ShmOCPP16Data->ChangeAvailability[gun_index].Type, "Operative") == 0)
+			{
+				DB_Update_Operactive(localDb, gun_index, true);
+				ShmCharger->gun_info[gun_index].isOperactive = DB_Get_Operactive(localDb, gun_index);
+			}
+			else
+			{
+				DB_Update_Operactive(localDb, gun_index, false);
+				ShmCharger->gun_info[gun_index].isOperactive = DB_Get_Operactive(localDb, gun_index);
+			}
+
+			ShmOCPP16Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = OFF;
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->CsMsg.bits[gun_index].ChangeAvailabilityReq)
+		{
+			if(strcmp((char*)ShmOCPP20Data->ChangeAvailability[gun_index].operationalStatus, "Operative") == 0)
+			{
+				DB_Update_Operactive(localDb, gun_index, true);
+				ShmCharger->gun_info[gun_index].isOperactive = DB_Get_Operactive(localDb, gun_index);
+			}
+			else
+			{
+				DB_Update_Operactive(localDb, gun_index, false);
+				ShmCharger->gun_info[gun_index].isOperactive = DB_Get_Operactive(localDb, gun_index);
+			}
+
+			ShmOCPP20Data->CsMsg.bits[gun_index].ChangeAvailabilityReq = OFF;
+		}
+	}
+}
+
+void checkChargingProfileLimit(uint8_t gun_index)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if((ocpp_get_smartcharging_profileId(gun_index) > 0) &&
+		   (ocpp_get_profile_req(gun_index) != ON)	&&
+		   (((strlen((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ValidFrom)>0) && (strlen((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ValidTo)>0)) ? isProfileValid(gun_index) : ON))
+		{
+			// Debug information
+			if(getDiffSecNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+			{
+				DEBUG_INFO("===============================================================\n");
+				DEBUG_INFO("Profile ID found: %d\n", ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfileId);
+				DEBUG_INFO("Valid from: %s\n", ShmOCPP16Data->SmartChargingProfile[gun_index].ValidFrom);
+				DEBUG_INFO("Valid to: %s\n", ShmOCPP16Data->SmartChargingProfile[gun_index].ValidTo);
+				DEBUG_INFO("Start schedule: %s\n", ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.StartSchedule);
+				DEBUG_INFO("Profile kind: %s\n", ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfileKind);
+				DEBUG_INFO("RecurrencyKind: %s\n", ShmOCPP16Data->SmartChargingProfile[gun_index].RecurrencyKind);
+				DEBUG_INFO("Profile purpose: %s\n", ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfilePurpose);
+				DEBUG_INFO("Transaction ID: %d\n", ShmOCPP16Data->SmartChargingProfile[gun_index].TransactionId);
+				DEBUG_INFO("ChargingRateUnit: %s\n", ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit);
+				DEBUG_INFO("===============================================================\n");
+			}
+
+			// Checking profile kind
+			if((mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfileKind, "Absolute") == PASS))
+			{
+				// Absolute profile
+				if(((mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfilePurpose, "TxProfile") == PASS) && (ShmOCPP16Data->SmartChargingProfile[gun_index].TransactionId == ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId)) ||
+					(mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfilePurpose, "TxProfile") == FAIL))
+				{
+					// Checking limitation
+					for(uint8_t idx_period=0;idx_period<ARRAY_SIZE(ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod);idx_period++)
+					{
+						if((getScheduleStart(gun_index) > ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].StartPeriod) &&
+						   ((idx_period == 0) || (ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].StartPeriod > 0))
+						  )
+						{
+							ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingRateUnit,"W")==PASS?ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit/(220*ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].NumberPhases):ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingSchedule.ChargingSchedulePeriod[idx_period].Limit);
+							//DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
+						}
+						else
+							break;
+					}
+				}
+			}
+		}
+		else if((ShmOCPP16Data->SmartChargingProfile[gun_index].ChargingProfileId == 0) && (ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq != ON))
+		{
+			ShmCharger->gun_info[gun_index].targetCurrent = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+		}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if((ocpp_get_smartcharging_profileId(gun_index) > 0) &&
+		   (ocpp_get_profile_req(gun_index) != ON)	&&
+		   (((strlen((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].validFrom)>0) && (strlen((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].validTo)>0)) ? isProfileValid(gun_index) : ON))
+		{
+			// Debug information
+			if(getDiffSecNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+			{
+				DEBUG_INFO("===============================================================\n");
+				DEBUG_INFO("Profile ID found: %d\n", ShmOCPP20Data->SmartChargingProfile[gun_index].id);
+				DEBUG_INFO("Valid from: %s\n", ShmOCPP20Data->SmartChargingProfile[gun_index].validFrom);
+				DEBUG_INFO("Valid to: %s\n", ShmOCPP20Data->SmartChargingProfile[gun_index].validTo);
+				DEBUG_INFO("Start schedule: %s\n", ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].startSchedule);
+				DEBUG_INFO("Profile kind: %s\n", ShmOCPP20Data->SmartChargingProfile[gun_index].chargingProfileKind);
+				DEBUG_INFO("RecurrencyKind: %s\n", ShmOCPP20Data->SmartChargingProfile[gun_index].recurrencyKind);
+				DEBUG_INFO("Profile purpose: %s\n", ShmOCPP20Data->SmartChargingProfile[gun_index].chargingProfilePurpose);
+				DEBUG_INFO("Transaction ID: %d\n", ShmOCPP20Data->SmartChargingProfile[gun_index].transactionId);
+				DEBUG_INFO("ChargingRateUnit: %s\n", ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].chargingRateUnit);
+				DEBUG_INFO("===============================================================\n");
+			}
+
+			// Checking profile kind
+			if((mystrcmp((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].chargingProfileKind, "Absolute") == PASS))
+			{
+				// Absolute profile
+				if(((mystrcmp((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].chargingProfilePurpose, "TxProfile") == PASS) && (ShmOCPP20Data->SmartChargingProfile[gun_index].transactionId == ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.transactionId)) ||
+					(mystrcmp((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].chargingProfilePurpose, "TxProfile") == FAIL))
+				{
+					// Checking limitation
+					for(uint8_t idx_period=0;idx_period<ARRAY_SIZE(ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].chargingSchedulePeriod);idx_period++)
+					{
+						if((getScheduleStart(gun_index) > ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].chargingSchedulePeriod[idx_period].startPeriod) &&
+						   ((idx_period == 0) || (ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].chargingSchedulePeriod[idx_period].startPeriod > 0))
+						  )
+						{
+							ShmCharger->gun_info[gun_index].targetCurrent = (mystrcmp((char*)ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].chargingRateUnit,"W")==PASS?ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].chargingSchedulePeriod[idx_period].limit/(220*ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].chargingSchedulePeriod[idx_period].numberPhases):ShmOCPP20Data->SmartChargingProfile[gun_index].chargingSchedule[0].chargingSchedulePeriod[idx_period].limit);
+							DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent on period[%d]: %d\n", gun_index, idx_period, ShmCharger->gun_info[gun_index].targetCurrent);
+						}
+						else
+							break;
+					}
+				}
+			}
+		}
+		else if((ShmOCPP20Data->SmartChargingProfile[gun_index].id == 0) && (ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq != ON))
+		{
+			ShmCharger->gun_info[gun_index].targetCurrent = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+		}
+	}
+}
+
+void checkStopReason(uint8_t gun_index)
+{
+	sleep(2);
+	
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		memset(ShmOCPP16Data->StopTransaction[gun_index].IdTag, 0x00, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
+		if(!ocpp_get_starttransaction_result(gun_index))
+		{
+			sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "DeAuthorized");
+		}
+		else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)
+		{
+			sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "EmergencyStop");
+		}
+		else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
+		{
+			sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "EVDisconnected");
+		}
+		else if(ShmOCPP16Data->MsMsg.bits.ResetReq)
+		{
+			if(strcmp((char*)ShmOCPP16Data->Reset.Type, "Hard")==0)
+				sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "HardReset");
+			else
+				sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "SoftReset");
+		}
+		else if(ShmCharger->gun_info[gun_index].rfidReq || ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop)
+		{
+			sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Local");
+			
+			if(!isMatchStartUser(gun_index))
+			{
+				memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
+			}
+			else
+			{
+				memcpy((char*)ShmOCPP16Data->StopTransaction[gun_index].IdTag, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmOCPP16Data->StopTransaction[gun_index].IdTag));
+			}
+
+			DEBUG_INFO("Gun-%d [ IdTag ] : %s \n", gun_index, ShmOCPP16Data->StopTransaction[gun_index].IdTag);
+		}
+		else if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStopTransactionReq)
+		{
+			sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Remote");
+		}
+		else if(ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON)
+		{
+			sprintf((char*)ShmOCPP16Data->StopTransaction[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].StopReason, "UnlockCommand");
+		}
+		else
+		{
+			sprintf((char*)ShmOCPP16Data->StopTransaction[gun_index].StopReason, "Other");
+		}
+		DEBUG_INFO("Gun-%d : StopReason [ %s ]...\n",gun_index,ShmOCPP16Data->StopTransaction[gun_index].StopReason);
+
+		ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption = (ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0);
+		presentChargedEnergyUpdate(gun_index);
+		DEBUG_INFO("PresentChargedEnergy Gun-[%d] : %.4f \n",gun_index ,ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy);
+		
+		ShmOCPP16Data->CpMsg.bits[gun_index].StopTransactionReq = ON;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		memset(ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, 0x00, ARRAY_SIZE(ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken));
+		if(!ocpp_get_starttransaction_result(gun_index))
+		{
+			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "DeAuthorized");
+		}
+		else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_EMERGENCY_STOP)
+		{
+			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "EmergencyStop");
+		}
+		else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
+		{
+			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "EVDisconnected");
+		}
+		else if(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_GROUND_FAIL)
+		{
+			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "GroundFault");
+		}
+		else if(ShmOCPP20Data->MsMsg.bits.ResetReq)
+		{
+			if(strcmp((char*)ShmOCPP20Data->Reset.type, "Immediate")==0)
+				sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "ImmediateReset");
+			else
+				sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "OnIdle");
+		}
+		else if(ShmCharger->gun_info[gun_index].rfidReq || ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop)
+		{
+			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "Local");
+			
+			if(!isMatchStartUser(gun_index))
+			{
+				memcpy((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, (char*)ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken));
+			}
+			else
+			{
+				memcpy((char*)ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId));
+			}
+
+			DEBUG_INFO("Gun-%d [ idToken ] : %s \n", gun_index, ShmOCPP20Data->TransactionEvent[gun_index].idToken.idToken);
+		}
+		else if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L1_OVER_CURRENT) ||
+				(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L2_OVER_CURRENT) ||
+				(ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode & ALARM_L3_OVER_CURRENT))
+		{
+			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "OvercurrentFault");
+		}
+		else if(ShmOCPP20Data->CsMsg.bits[gun_index].RequestStopTransactionReq)
+		{
+			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "Remote");
+		}
+		else if(ShmCharger->gun_info[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].isUnlockerConnetor == ON)
+		{
+			sprintf((char*)ShmOCPP20Data->TransactionEvent[ShmOCPP20Data->UnlockConnector[gun_index].connectorId-1].transactionInfo.stoppedReason, "UnlockCommand");
+		}
+		else
+		{
+			sprintf((char*)ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason, "Other");
+		}
+		DEBUG_INFO("Gun-%d : StopReason [ %s ]...\n", gun_index, ShmOCPP20Data->TransactionEvent[gun_index].transactionInfo.stoppedReason);
+
+		ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption = (ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0);
+		presentChargedEnergyUpdate(gun_index);
+		DEBUG_INFO("PresentChargedEnergy Gun-[%d] : %.4f \n",gun_index ,ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy);
+		
+		ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
+	}
+}
+
+void checkRemoteUpgradeStatus()
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(strcmp((char*)ShmOCPP16Data->FirmwareStatusNotification.Status, "DownloadFailed")==0)
+		{
+			DEBUG_INFO("Firmware remote upgraded fail...\n");
+			ShmOCPP16Data->MsMsg.bits.UpdateFirmwareReq = OFF;
+			ShmCharger->isUpdateSuccess = NO;
+		}
+		else if(strcmp((char*)ShmOCPP16Data->FirmwareStatusNotification.Status, "Downloaded")==0)
+		{
+			DEBUG_INFO("Firmware remote upgrading...\n");
+			sprintf((char*)ShmOCPP16Data->FirmwareStatusNotification.Status, "Installing");
+			sleep(1);
+			ShmOCPP16Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
+			ShmOCPP16Data->MsMsg.bits.UpdateFirmwareReq = OFF;
+
+			if(upgrade_check() == PASS)
+			{
+				if(ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail == ON)
+					ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail = OFF;
+
+				ShmCharger->isUpdateSuccess = YES;
+				DEBUG_INFO("Remote update success.\n");
+			}
+			else
+			{
+				if(ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail == OFF)
+					ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail = ON;
+
+				ShmCharger->isUpdateSuccess = NO;
+				DEBUG_INFO("Remote update fail.\n");
+			}
+		}
+		else
+		{}
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(strcmp((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "DownloadFailed")==0)
+		{
+			DEBUG_INFO("Firmware remote upgraded fail...\n");
+			ShmOCPP20Data->MsMsg.bits.UpdateFirmwareReq = OFF;
+			ShmCharger->isUpdateSuccess = NO;
+		}
+		else if(strcmp((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "Downloaded")==0)
+		{
+			DEBUG_INFO("Firmware remote upgrading...\n");
+			sprintf((char*)ShmOCPP16Data->FirmwareStatusNotification.Status, "Installing");
+			ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
+			ShmOCPP20Data->MsMsg.bits.UpdateFirmwareReq = OFF;
+
+			if(upgrade_check() == PASS)
+			{
+				if(ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail == ON)
+					ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail = OFF;
+
+				ShmCharger->isUpdateSuccess = YES;
+				DEBUG_INFO("Remote update success.\n");
+			}
+			else
+			{
+				if(ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail == OFF)
+					ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail = ON;
+
+				ShmCharger->isUpdateSuccess = NO;
+				DEBUG_INFO("Remote update fail.\n");
+			}
+		}
+		else
+		{}
+	}
+}
+
+void checkRfidAuthrize()
+{
+	static uint8_t isCheckdResult = FALSE;
+
+	if(!ShmCharger->isAuthrizing)
+	{
+		// Read RFID
+		if(GetCardSerialNumber() != FAIL)
+		{
+			uint8_t isSnStart = FALSE;
+			uint8_t bufferRFID[ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId)];
+
+			if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
+			{
+				// Big endian
+				switch(rfid.snType)
+				{
+					case RFID_SN_TYPE_6BYTE:
+						sprintf((char*)bufferRFID, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
+						break;
+					case RFID_SN_TYPE_7BYTE:
+						sprintf((char*)bufferRFID, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
+						break;
+					case RFID_SN_TYPE_10BYTE:
+						sprintf((char*)bufferRFID, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
+						break;
+					case RFID_SN_TYPE_4BYTE:
+					default:
+						sprintf((char*)bufferRFID, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
+						break;
+				}
+			}
+			else
+			{
+				// Little endian
+				switch(rfid.snType)
+				{
+					case RFID_SN_TYPE_6BYTE:
+						sprintf((char*)bufferRFID, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+						break;
+					case RFID_SN_TYPE_7BYTE:
+						sprintf((char*)bufferRFID, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+						break;
+					case RFID_SN_TYPE_10BYTE:
+						sprintf((char*)bufferRFID, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+						break;
+					case RFID_SN_TYPE_4BYTE:
+					default:
+						sprintf((char*)bufferRFID, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
+						break;
+				}
+			}
+			DEBUG_INFO("Authorize request User Id : %s\n", bufferRFID);
+			//DEBUG_INFO("Authorize request User Id : %s\n", ShmSysConfigAndInfo->SysConfig.UserId);
+
+			for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+				ShmCharger->gun_info[gun_index].resultAuthorization = UNKNOW_RFID;
+
+			// Check SN already start
+			for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+			{
+				if(isMatchStartUser(gun_index) || (isMatchPresentUser(gun_index) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_PREPARING)))
+				{
+					DEBUG_INFO("%s running on connector-%02d.\n", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, gun_index);
+					isSnStart = TRUE;
+					ShmCharger->gun_info[gun_index].rfidReq = ON;
+					ocpp_set_auth_conf(ON);
+					setLedMotion(gun_index,LED_ACTION_RFID_PASS);
+					setSpeaker(ON, SPEAKER_SHORT);
+					sleep(3);
+
+					break;
+				}
+			}
+
+			// Request authorize if isSnStart is false
+			if(!isSnStart)
+			{
+				memcpy(ShmSysConfigAndInfo->SysConfig.UserId, bufferRFID, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+				refreshStartTimer(&startTime[0][TMR_IDX_AUTH]);
+				ocpp_set_auth_conf(OFF);
+				ocpp_set_auth_req(ON, "ISO14443");
+				setLedMotion(0,LED_ACTION_AUTHED);
+				ShmCharger->isAuthrizing = TRUE;
+				ShmCharger->isGetAuthResult = FALSE;
+				isCheckdResult = FALSE;
+				sleep(1);
+			}
+		}
+	}
+	else
+	{
+		// Wait authorize result
+		if(!ocpp_get_auth_conf() && (getDiffSecNow(startTime[0][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH))
+		{
+			// Authorization timeout process.
+			DEBUG_WARN("Authorize timeout !!!\n");
+			for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+			{
+				ShmCharger->gun_info[gun_index].resultAuthorization = UNVALIDATED_RFID;
+				setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
+			}
+
+			setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
+			sleep(3);
+
+			ShmCharger->isAuthrizing = FALSE;
+		}
+		else
+		{
+			if(ocpp_get_auth_conf() ||
+			   (!ocpp_get_connection_status() && ((ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE) || (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_NOCHARGE))) ||
+			   (!ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST) && (getDiffSecNow(startTime[0][TMR_IDX_AUTH]) > 2))
+			  )
+			{
+				if(ocpp_get_auth_result(NO) ||
+				   (!ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)) ||
+				   (!ocpp_get_connection_status() && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)))
+				{
+					if(!isCheckdResult)
+					{
+						DEBUG_INFO("Authorize pass.\n");
+						setSpeaker(ON, SPEAKER_SHORT);
+						refreshStartTimer(&startTime[0][TMR_IDX_GUN_DETECT]);
+						ShmCharger->isGetAuthResult = TRUE;
+						isCheckdResult = TRUE;
+
+						if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0)
+						{
+							ocpp_set_auth_conf(ON);
+						}
+
+						for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+							ShmCharger->gun_info[gun_index].resultAuthorization = VALIDATED_RFID;
+					}
+
+					if(getDiffSecNow(startTime[0][TMR_IDX_GUN_DETECT]) < ocpp_get_connection_timeout())
+					{
+						if(GetCardSerialNumber() != FAIL)
+						{
+							if(isMatchPresentUser())
+							{
+								DEBUG_INFO("Cancel present user.\n");
+								for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+								{
+									setLedMotion(gun_index,LED_ACTION_IDLE);
+									ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
+								}
+								ShmCharger->isAuthrizing = FALSE;
+							}
+						}
+						else
+						{
+							for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+							{
+								if(getDiffSecNow(startTime[0][TMR_IDX_GUN_DETECT]) < 3)
+									setLedMotion(gun_index,LED_ACTION_RFID_PASS);
+								else
+									setLedMotion(gun_index,LED_ACTION_AUTHED);
+
+								if((((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_RESERVATION)) && (((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)) || (ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn == ON))) ||
+								   ((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_PREPARING) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B) && (ShmCharger->gun_selectd == gun_index)) ||
+								   (((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_CHARGING) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_TERMINATING)) && (ShmCharger->gun_selectd == gun_index))
+								   )
+								{
+									DEBUG_INFO("Connector-%02d action detect.\n", gun_index);
+									ShmCharger->isAuthrizing = FALSE;
+
+									ShmCharger->gun_info[gun_index].rfidReq = ON;
+
+									break;
+								}
+							}
+						}
+					}
+					else
+					{
+						DEBUG_INFO("Connector action detect timeout.\n");
+						ShmCharger->isAuthrizing = FALSE;
+						ShmCharger->isGetAuthResult = TRUE;
+
+						for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+						{
+							setLedMotion(gun_index,LED_ACTION_IDLE);
+							ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
+						}
+					}
+				}
+				else
+				{
+					DEBUG_INFO("Authorize fail.\n");
+					ShmCharger->isAuthrizing = FALSE;
+					ShmCharger->isGetAuthResult = TRUE;
+
+					for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+					{
+						ShmCharger->gun_info[gun_index].resultAuthorization = UNVALIDATED_RFID;
+						setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
+					}
+
+					setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
+					sleep(3);
+
+					for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+					{
+						setLedMotion(gun_index,LED_ACTION_IDLE);
+					}
+				}
+			}
+		}
+	}
+}
+
+//======================================================
+// Main process
+//======================================================
+int main(void)
+{
+	//==================================================
+	// Create all share memory
+	//==================================================
+	if(CreatShareMemory()==0)
+	{
+		DEBUG_ERROR("CreatShareMemory NG\n");
+		if(ShmStatusCodeData!=NULL)
+		{
+			ShmStatusCodeData->AlarmCode.AlarmEvents.bits.FailToCreateShareMemory=1;
+		}
+		sleep(5);
+		system("reboot -f");
+		sleep(5);
+		system("reboot -f");
+	}
+	else
+	{
+		LoadSysConfigAndInfo(&ShmSysConfigAndInfo->SysConfig);
+		DEBUG_INFO("CreatShareMemory OK\n");
+	}
+
+	for(int gun_index = 0;gun_index<AC_QUANTITY;gun_index++)
+	{
+		ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus = 0xff;
+		ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].Index = 0xff;
+		ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch = 0xff;
+		ShmCharger->gun_info[gun_index].mcuResetRequest.isMcuResetRequest = ON;
+		ShmCharger->gun_info[gun_index].isSetBreatheLedTiming = OFF;
+		ShmCharger->gun_info[gun_index].isSetLedBrightness = OFF;
+		ShmCharger->gun_selectd = 0;
+	}
+
+	//==================================================
+	// Main loop
+	//==================================================
+	for(;;)
+	{
+		//==============================================
+		// Period check for 10 seconds
+		//==============================================
+		if(getDiffSecNow(startTime[0][TMR_IDX_CHECK_TASK]) > 10)
+		{
+			//==============================================
+			// Check task processing
+			//==============================================
+			if(ShmSysConfigAndInfo->SysInfo.AcChargingData[0].SystemStatus != SYS_MODE_BOOTING)
+				checkTask();
+
+			//==============================================
+			// Check connection timeout specification
+			//==============================================
+			checkConnectionTimeout();
+
+			refreshStartTimer(&startTime[0][TMR_IDX_CHECK_TASK]);
+		}
+
+		//==============================================
+		// Check remote reset request
+		//==============================================
+		checkReset();
+
+		//==============================================
+		// Connector loop
+		//==============================================
+		for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+		{
+			// Only process main logic on cabinet
+			if(gun_index == 0)
+			{
+				//==============================================
+				// Synchronize share memory from OCPP struct
+				//==============================================
+				ShmSysConfigAndInfo->SysInfo.OcppConnStatus = ocpp_get_connection_status();
+
+				//==============================================
+				// Check RFID authorization
+				//==============================================
+				// The user is not allowed to use RFID when the system change to under those modes.
+				if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_ALARM) &&
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_FAULT) &&
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_DEBUG) &&
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_UPDATE) &&
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_BOOTING) &&
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_COMPLETE) &&
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_MAINTAIN))
+				{
+					checkRfidAuthrize();
+				}
+
+				//==============================================
+				// Something need run in Idle mode
+				//==============================================
+				if(((ShmSysConfigAndInfo->SysInfo.AcChargingData[0].SystemStatus==SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[0].SystemStatus==SYS_MODE_ALARM) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[0].SystemStatus==SYS_MODE_DEBUG)) &&
+				   ((modelnameInfo.GetGunCount==2)?((ShmSysConfigAndInfo->SysInfo.AcChargingData[1].SystemStatus==SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[1].SystemStatus==SYS_MODE_ALARM) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[1].SystemStatus==SYS_MODE_DEBUG)):true) &&
+				   ((modelnameInfo.GetGunCount==3)?((ShmSysConfigAndInfo->SysInfo.AcChargingData[2].SystemStatus==SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[2].SystemStatus==SYS_MODE_ALARM) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[2].SystemStatus==SYS_MODE_DEBUG)):true))
+				{
+					// Check restore factory setting request
+					if(ShmSysConfigAndInfo->SysInfo.FactoryConfiguration)
+					{
+						// Set led to initial
+						for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+						{
+							setLedMotion(gun_index,LED_ACTION_INIT);
+						}
+
+						sleep(5);
+						system("cd /root;./Module_FactoryConfig -m");
+						system("rm -f /Storage/OCPP/OCPPConfiguration");
+						system("sync");
+						sleep(5);
+						system("reboot -f");
+						sleep(5);
+						system("reboot -f");
+					}
+
+					// Check upgrade firmware request
+					if(ShmSysConfigAndInfo->SysInfo.FirmwareUpdate ||
+					   ocpp_get_update_firmware_req())
+					{
+						// If available memory too small, free memory cache first
+						if(getAvailableMemory() < (200*1024*1024))
+						{
+							DEBUG_INFO("Available memory (%.2f Bytes) less than 200 MBytes, free cache first.\n", getAvailableMemory()/(1024*1024.0));
+							system("echo 3 > /proc/sys/vm/drop_caches");
+						}
+
+						ShmCharger->isUpdateSuccess = NO;
+						for(int gun_index = 0;gun_index<modelnameInfo.GetGunCount;gun_index++)
+						{
+							setLedMotion(gun_index,LED_ACTION_MAINTAIN);
+							setChargerMode(gun_index, SYS_MODE_UPDATE);
+						}
+					}
+				}
+
+				//==========================================
+				// Power saving logic
+				//==========================================
+				if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
+				{
+					refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_STATE_B]);
+				}
+
+				if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_ALARM) ||
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_FAULT) ||
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_UPDATE) ||
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_MAINTAIN) ||
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_CHARGING) ||
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_TERMINATING) ||
+				   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_COMPLETE))
+				{
+					refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
+					refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
+					refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
+					refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]);
+				}
+				else
+				{
+					if((gpio_get_value(GPIO_IN_WAKEUP) == OFF) ||
+					   (ShmCharger->gun_info[gun_index].GPIO_Input.Button_Mode_Switch == ON) ||
+					   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus != ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus) ||
+					   (((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_IDLE) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_PREPARING) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_RESERVATION)) &&
+						(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B) &&
+						(getDiffSecNow(startTime[gun_index][TMR_IDX_POWERSAVING_STATE_B]) < 10)))
+					{
+						refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
+						refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
+						refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
+						refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]);
+
+						if(((gpio_get_value(GPIO_IN_WAKEUP) == OFF) || (ShmCharger->gun_info[gun_index].GPIO_Input.Button_Mode_Switch == ON)) &&
+						   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus == SYS_MODE_IDLE) &&
+						   (getDiffSecNow(startTime[ShmCharger->gun_selectd][TMR_IDX_CHECK_POWER_CONSUMPTION]) > TIMEOUT_SPEC_CEHCK_POWER_CONSUMPTION))
+						{
+							ShmCharger->gun_info[gun_index].isCheckPowerConsumption = YES;
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_LCM_POWER_CONSUMPTION]);
+						}
+					}
+					else
+					{
+						refreshStartTimer(&startTime[gun_index][TMR_IDX_CHECK_POWER_CONSUMPTION]);
+						if((getDiffSecNow(startTime[ShmCharger->gun_selectd][TMR_IDX_LCM_POWER_CONSUMPTION]) > TIMEOUT_SPEC_CEHCK_POWER_CONSUMPTION))
+						{
+							ShmCharger->gun_info[gun_index].isCheckPowerConsumption = NO;
+						}
+					}
+				}
+
+				if(getDiffSecNow(startTime[ShmCharger->gun_selectd][TMR_IDX_POWERSAVING_LCD]) > TIMEOUT_SPEC_POWERSAVING_LCD)
+				{
+					if(ShmCharger->isLcdOn == ON)
+					{
+						DEBUG_INFO("LCD into power saving...%d\n", getDiffSecNow(startTime[ShmCharger->gun_selectd][TMR_IDX_POWERSAVING_LCD]));
+						ShmCharger->isLcdOn = OFF;
+					}
+				}
+				else
+				{
+					if(ShmCharger->isLcdOn == OFF)
+					{
+						DEBUG_INFO("LCD exit power saving...%d\n", getDiffSecNow(startTime[ShmCharger->gun_selectd][TMR_IDX_POWERSAVING_LCD]));
+						ShmCharger->isLcdOn = ON;
+					}
+				}
+
+				if(getDiffSecNow(startTime[ShmCharger->gun_selectd][TMR_IDX_POWERSAVING_RFID]) > TIMEOUT_SPEC_POWERSAVING_RFID)
+				{
+					if(gpio_get_value(GPIO_OUT_RST_RFID) == ON)
+					{
+						DEBUG_INFO("RFID into power saving...%d\n", getDiffSecNow(startTime[ShmCharger->gun_selectd][TMR_IDX_POWERSAVING_RFID]));
+						gpio_set_value(GPIO_OUT_RST_RFID, OFF);
+					}
+				}
+				else
+				{
+					if(gpio_get_value(GPIO_OUT_RST_RFID) == OFF)
+					{
+						DEBUG_INFO("RFID exit power saving...%d\n", getDiffSecNow(startTime[ShmCharger->gun_selectd][TMR_IDX_POWERSAVING_RFID]));
+						gpio_set_value(GPIO_OUT_RST_RFID, ON);
+					}
+				}
+
+				if(getDiffSecNow(startTime[gun_index][TMR_IDX_POWERSAVING_METER]) > TIMEOUT_SPEC_POWERSAVING_METER)
+				{
+					if(ShmCharger->gun_info[gun_index].isMeterOn)
+					{
+						DEBUG_INFO("Meter into power saving...%d\n", getDiffSecNow(startTime[gun_index][TMR_IDX_POWERSAVING_METER]));
+						ShmCharger->gun_info[gun_index].isMeterOn = OFF;
+					}
+				}
+				else
+				{
+					if(!ShmCharger->gun_info[gun_index].isMeterOn)
+					{
+						DEBUG_INFO("Meter exit power saving...%d\n", getDiffSecNow(startTime[gun_index][TMR_IDX_POWERSAVING_METER]));
+						ShmCharger->gun_info[gun_index].isMeterOn = ON;
+					}
+				}
+
+				if(getDiffSecNow(startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]) > TIMEOUT_SPEC_POWERSAVING_LED_STATUS)
+				{
+					if(ShmCharger->gun_info[gun_index].isSleepOn == NO)
+					{
+						DEBUG_INFO("LED status into power saving...%d\n", getDiffSecNow(startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]));
+						ShmCharger->gun_info[gun_index].isSleepOn = YES;
+					}
+				}
+				else
+				{
+					if(ShmCharger->gun_info[gun_index].isSleepOn == YES)
+					{
+						DEBUG_INFO("LED status exit power saving...%d\n", getDiffSecNow(startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]));
+						ShmCharger->gun_info[gun_index].isSleepOn = NO;
+					}
+				}
+
+				//==========================================
+				// Synchronize current rating value from MCU
+				//==========================================
+				ShmSysConfigAndInfo->SysConfig.RatingCurrent = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+
+				//==========================================
+				// Assign connector location index for OCPP
+				//==========================================
+				ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].Index = gun_index;
+
+				//==========================================
+				// Synchronize present charging power
+				//==========================================
+				if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount == 1)
+				{
+					if(ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON)
+						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage*ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent)/1000.0;
+					else
+						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = 0;
+				}
+				else
+				{
+					if(ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON)
+					{
+						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = (((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltage*ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrent)/1000.0) +
+																									   ((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL2*ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrentL2)/1000.0) +
+																									   ((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingVoltageL3*ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingCurrentL3)/1000.0));
+					}
+					else
+					{
+						ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargingPower = 0;
+					}
+				}
+
+				//==========================================
+				// Check initialization "PASS" or "FAIL"
+				//==========================================
+				if(ShmSysConfigAndInfo->SysInfo.AcChargingData[0].SystemStatus != SYS_MODE_BOOTING)
+				{
+					// Alarm event check
+					if((ShmCharger->gun_info[gun_index].primaryMcuAlarm.InputAlarmCode>0))
+					{
+						if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_ALARM)
+						{
+							if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus != SYS_MODE_UPDATE)
+							{
+								setChargerMode(gun_index, SYS_MODE_ALARM);
+							}
+						}
+					}
+				}
+
+				//==========================================
+				// Reservation request check
+				//==========================================
+				checkReservation(gun_index);
+
+				//==========================================
+				// Change availability check
+				//==========================================
+				checkAvailability(gun_index);
+
+				if(ShmCharger->gun_info[gun_index].isOperactive)
+				{
+					if(isMode(gun_index, SYS_MODE_MAINTAIN))
+					{
+						setChargerMode(gun_index, SYS_MODE_IDLE);
+					}
+				}
+				else
+				{
+					if(isMode(gun_index, SYS_MODE_IDLE))
+					{
+						setChargerMode(gun_index, SYS_MODE_MAINTAIN);
+					}
+				}
+
+				//==========================================
+				// Unlock Connector signal check
+				//==========================================
+				checkUnlocker(gun_index);
+
+				//==========================================
+				// Connector process
+				//==========================================
+				switch(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].SystemStatus)
+				{
+					case SYS_MODE_BOOTING:
+						if(isModeChange(gun_index))
+						{
+							setLedMotion(gun_index,LED_ACTION_INIT);
+
+							//CSU Initialization & task spawn
+							if((Initialization(gun_index) != PASS) ||
+							   (SpawnTask(gun_index) != PASS))
+							{
+								ShmStatusCodeData->AlarmCode.AlarmEvents.bits.CsuInitFailed = ON;
+							}
+
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_LCD]);
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_RFID]);
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_METER]);
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_STATE_B]);
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_POWERSAVING_LED_STATUS]);
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_LCM_POWER_CONSUMPTION]);
+						}
+
+						if(ShmCharger->gun_info[gun_index].mcuFlag.isReadFwVerPass &&
+						   ShmCharger->gun_info[gun_index].mcuFlag.isSetModelNamePass &&
+						   ShmCharger->gun_info[gun_index].mcuFlag.isSetSerialNumberPass)
+						{
+							// OCPP BootNotification info set
+							DEBUG_INFO("==========================================\n");
+							DEBUG_INFO("System ID: %s\n",ShmSysConfigAndInfo->SysConfig.SystemId);
+							DEBUG_INFO("==========================================\n");
+							DEBUG_INFO("=== OCPP BootNotification information ====\n");
+							ocpp_boot_info_sync();
+							DEBUG_INFO("OcppServerURL: %s\n",ShmSysConfigAndInfo->SysConfig.OcppServerURL);
+							DEBUG_INFO("ChargeBoxId: %s\n",ShmSysConfigAndInfo->SysConfig.ChargeBoxId);
+							DEBUG_INFO("ChargePointVendor: %s\n",ShmSysConfigAndInfo->SysConfig.chargePointVendor);
+							DEBUG_INFO("==========================================\n");
+
+							DEBUG_INFO("========== Set Wifi information ==========\n");
+							DEBUG_INFO("Wifi mode: %d\n",  ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode);
+							DEBUG_INFO("Wifi SSID: %s\n",  ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
+							DEBUG_INFO("Wifi password: %s\n",  ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
+							DEBUG_INFO("==========================================\n");
+
+							// Set max current to rating current
+							ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
+
+							// Default Ethernet / Wifi / 4G to 1:disconnected
+							switch(ShmSysConfigAndInfo->SysConfig.ModelName[10])
+							{
+								case 'E':
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = OFF;
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = OFF;
+
+									break;
+								case 'W':
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = ON;
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = OFF;
+
+									break;
+								case 'T':
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = OFF;
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = ON;
+
+									break;
+								case 'D':
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = ON;
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = ON;
+
+									break;
+							}
+
+							// Default LCM brightness to 100
+							ShmCharger->isLcdOn = ON;
+
+							// Defaule led status to not sleep mode
+							ShmCharger->gun_info[gun_index].isSleepOn = NO;
+
+							// If Web Server OPCC URL is empty kill Module_OcppBackend
+							if((strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0) || ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging)
+							{
+								if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0)
+									DEBUG_INFO("URL is empty kill Module_OcppBackend...\n");
+
+								if(ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging)
+									DEBUG_INFO("Local power sharing enable kill Module_OcppBackend...\n");
+
+								system ("pkill OcppBackend");
+							}
+
+							// If rotate switch equal zero, the system needs to change Debug mode
+							if(ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch == 0)
+								setChargerMode(gun_index, SYS_MODE_DEBUG);
+							else
+							{
+								if((isGpioInitialized(GPIO_OUT_RST_RFID) == PASS) &&
+								   (isGpioInitialized(GPIO_IN_WAKEUP) == PASS) &&
+								   (isGpioInitialized(GPIO_OUT_RST_ETH) == PASS) &&
+								   (isGpioInitialized(GPIO_OUT_RST_4G) == PASS) &&
+								   (isGpioInitialized(GPIO_OUT_RST_QCA) == PASS))
+								{
+									//==================================================
+									// Get firmware version
+									//==================================================
+									sleep(3);
+									get_firmware_version(gun_index);
+
+									setChargerMode(gun_index, SYS_MODE_IDLE);
+								}
+							}
+						}
+
+						break;
+					case SYS_MODE_IDLE:
+						if(isModeChange(gun_index))
+						{
+							setLedMotion(gun_index,LED_ACTION_IDLE);
+							setRelay(gun_index, OFF);
+							setRequest(gun_index,OFF);
+							ShmCharger->gun_info[gun_index].rfidReq = OFF;
+							ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart = OFF;
+							ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
+							ocpp_set_remotestart(gun_index, OFF);
+							ocpp_set_remotestop(gun_index, OFF);
+
+							ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode = 0x00;
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration = 0;
+							presentChargedEnergyClear(gun_index);
+							ShmCharger->gun_info[gun_index].targetCurrent = 0xFF;
+							ocpp_set_unlocker_req(gun_index, OFF);
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId = -1;
+
+							// Response StopTransactionConf
+							ocpp_set_stoptransaction_conf(gun_index, OFF);
+							memset(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId));
+
+							ShmCharger->gun_info[gun_index].isDoEvReadyOnce = OFF;
+							ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
+							DB_Check_Record_Buf(localDb, gun_index);
+						}
+
+						// LED status in Idle mode
+						if(!ShmCharger->isAuthrizing)
+						{
+							if(ShmSysConfigAndInfo->SysInfo.OcppConnStatus == ON)
+							{
+								if(ShmCharger->gun_info[gun_index].rfidReq == OFF)
+								{
+									if(ShmCharger->gun_info[gun_index].isSleepOn == NO)
+										setLedMotion(gun_index, LED_ACTION_IDLE_BACKEND_CONNECTED);
+									else
+										setLedMotion(gun_index, LED_ACTION_IDLE_BACKEND_CONNECTED_SLEEP);
+								}
+							}
+							else
+							{
+								if(ShmCharger->gun_info[gun_index].rfidReq == OFF)
+								{
+									if(ShmCharger->gun_info[gun_index].isSleepOn == NO)
+										setLedMotion(gun_index, LED_ACTION_IDLE_BACKEND_DISCONNECTED);
+									else
+										setLedMotion(gun_index, LED_ACTION_IDLE_BACKEND_DISCONNECTED_SLEEP);
+								}
+							}
+						}
+
+						if(((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B)) ||
+						   ((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)) ||
+						   ((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) && (ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn == ON)) ||
+						   (ShmCharger->gun_info[gun_index].rfidReq == ON) ||
+						   (ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart == ON) ||
+						   (ocpp_get_remotestart(gun_index) == ON) ||
+						   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStart == ON))
+						{
+							if((ShmCharger->gun_info[gun_index].rfidReq == ON))
+							{
+								ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_RFID;
+								ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_ISO14443;
+								DEBUG_INFO("Start Method : RFID...\n");
+							}
+							else if(ocpp_get_remotestart(gun_index))
+							{
+								ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_BACKEND;
+								ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_Central;
+								ocpp_copy_userid_from_remotestart(gun_index);
+								setSpeaker(ON, SPEAKER_SHORT);
+								DEBUG_INFO("Start Method : BACKEND...\n");
+							}
+							else if(ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart == ON)
+							{
+								ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_BLE;
+								ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_Local;
+								memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmCharger->gun_info[gun_index].bleLoginCentralId.id, ARRAY_SIZE(ShmCharger->gun_info[gun_index].bleLoginCentralId.id));
+								setSpeaker(ON, SPEAKER_SHORT);
+								DEBUG_INFO("Start Method : BLE...\n");
+							}
+							else
+							{
+								ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_FREE;
+								ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_NoAuthorization;
+								memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmSysConfigAndInfo->SysConfig.SerialNumber, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
+								setSpeaker(ON, SPEAKER_SHORT);
+								DEBUG_INFO("Start Method : FREE...\n");
+							}
+
+							ShmCharger->gun_info[gun_index].rfidReq = OFF;
+							ocpp_set_remotestart(gun_index, OFF);
+							ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart = OFF;
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStart = OFF;
+
+							// Get target current
+							ocpp_set_profile_req(gun_index, ON);
+							sleep(1);
+							checkChargingProfileLimit(gun_index);
+							if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+							{
+								ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+							}
+							else
+							{
+								ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+							}
+
+							setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
+						}
+						else
+						{}
+
+						break;
+					case SYS_MODE_AUTHORIZING:
+						if(isModeChange(gun_index))
+						{
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_AUTH]);
+							if(ocpp_isAuthorizeRemoteStart() && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND))
+							{
+								DEBUG_INFO("Remote start request authorize.\n");
+								ocpp_set_auth_req(ON, "ISO14443");
+							}
+						}
+
+						if(getDiffSecNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH)
+						{
+							// Authorization timeout process.
+							setSpeaker(ON, SPEAKER_INTERVAL_3COUNT);
+							setLedMotion(gun_index, LED_ACTION_RFID_FAIL);
+							sleep(3);
+							setChargerMode(gun_index, SYS_MODE_IDLE);
+							DEBUG_WARN("Authorize timeout !!!\n");
+						}
+						else
+						{
+							switch(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod)
+							{
+								case START_METHOD_BACKEND:
+									if(ocpp_isAuthorizeRemoteStart())
+									{
+										if(ocpp_get_auth_conf())
+										{
+											if(ocpp_get_auth_result(gun_index))
+											{
+												memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+
+												DEBUG_INFO("Authorize pass.\n");
+												setSpeaker(ON, SPEAKER_SHORT);
+												setLedMotion(gun_index, LED_ACTION_RFID_PASS);
+												setChargerMode(gun_index, SYS_MODE_PREPARING);
+											}
+											else
+											{
+												DEBUG_INFO("Authorize fail.\n");
+												setSpeaker(ON, SPEAKER_INTERVAL_3COUNT);
+												setLedMotion(gun_index, LED_ACTION_RFID_FAIL);
+												sleep(3);
+												setChargerMode(gun_index, SYS_MODE_IDLE);
+											}
+
+											ocpp_set_auth_conf(OFF);
+										}
+									}
+									else
+									{
+										setChargerMode(gun_index, SYS_MODE_PREPARING);
+									}
+									break;
+								case START_METHOD_RFID:
+								case START_METHOD_BLE:
+								case START_METHOD_FREE:
+								default:
+									setChargerMode(gun_index, SYS_MODE_PREPARING);
+									break;
+							}
+						}
+
+						break;
+					case SYS_MODE_PREPARING:
+						if(isModeChange(gun_index))
+						{
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
+							setLedMotion(gun_index, LED_ACTION_AUTHED);
+							ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
+						}
+
+						// If control pilot detect Bx, skip watch dog time out.
+						if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_B) ||
+							(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C))
+						{
+							if(!getRequest(gun_index))
+							{
+								setRequest(gun_index, ON);
+								setLedMotion(gun_index, LED_ACTION_CONNECTED);
+								refreshStartTimer(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
+								DEBUG_INFO("Set Request On.\n");
+							}
+
+							switch(ShmCharger->gun_info[gun_index].ccsHandshakeState)
+							{
+								case HANDSHAKE_DUTY_5:
+									break;
+								case HANDSHAKE_DUTY_5_CHECK:
+									refreshStartTimer(&startTime[gun_index][TMR_IDX_BS_HLC_HANDSHAKE]);
+									DEBUG_INFO("HLC slac handshake start.\n");
+									break;
+								case HANDSHAKE_CCS:
+									//CCS handshake timeout
+									if(getDiffSecNow(startTime[gun_index][TMR_IDX_BS_HLC_HANDSHAKE]) > TIMEOUT_SPEC_BS_HLC_HANDSHAKE)
+									{
+										DEBUG_INFO("HLC %d secs slac handshake timeout.\n", TIMEOUT_SPEC_BS_HLC_HANDSHAKE);
+									}
+
+									if((ShmCharger->gun_info[gun_index].acCcsInfo.ChargingPermission == OFF) && (ShmCharger->gun_info[gun_index].acCcsInfo.CpSetPWMDuty != CCS_PWM_DUTY_5))
+									{
+										DEBUG_INFO("Wait CCS give up negotiagting.\n");
+									}
+
+									//CCS status check
+									if((16 < ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus) && (ShmCharger->gun_info[gun_index].acCcsInfo.PresentMsgFlowStatus < 254))
+									{
+										DEBUG_INFO("Enter HLC Mode charging.\n");
+										refreshStartTimer(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
+									}
+
+									break;
+								case HANDSHAKE_CP_STATE_E:
+									//if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
+									{
+										// restore normal CP PWM duty
+										// Determine max charging current to MCU
+										DEBUG_INFO("Determine max charging current to MCU.\n");
+										ocpp_set_profile_req(gun_index, ON);
+										sleep(1);
+										checkChargingProfileLimit(gun_index);
+										if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+										{
+											ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+											ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+										}
+										else
+										{
+											ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+											ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+										}
+
+										refreshStartTimer(&startTime[gun_index][TMR_IDX_BS_HLC_HANDSHAKE]);
+									}
+									break;
+								case HANDSHAKE_SET_MAX_CURRENT:
+									//if(ShmCharger->gun_info[gun_index].mcuFlag.isSetCpPwmDuty == OFF)
+									{
+										DEBUG_INFO("Enter BS Mode charging.\n");
+										//for EV READY 30 secs didn't start charging to STATE E
+										refreshStartTimer(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
+									}
+									break;
+								case HANDSHAKE_BS_MODE:
+									refreshStartTimer(&startTime[gun_index][TMR_IDX_HANDSHAKING]);
+									if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)
+										setRelay(gun_index,ON);
+
+									if((ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON))
+									{
+										ocpp_set_unlocker_req(gun_index, OFF);
+										presentChargedEnergyClear(gun_index);
+										getDateTimeString((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartDateTime);
+										ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption_at_start = ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption;
+										ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption_at_start = ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption;
+										ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption_at_start = ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption;
+										ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption_at_start = ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption;
+										if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount==1)
+											ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption = (ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0);
+										else
+										{
+											//ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption[0] = (ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption/10000.0);
+											//ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption[1] = (ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption/10000.0);
+											//ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption[2] = (ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption/10000.0);
+										}
+
+										memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+										ocpp_copy_userid_to_starttransaction(gun_index);
+										ocpp_set_starttransaction_req(gun_index, ON);
+										refreshStartTimer(&startChargingTime[gun_index]);
+
+										setChargerMode(gun_index, SYS_MODE_CHARGING);
+									}
+
+									break;
+								case HANDSHAKE_HLC_MODE:
+									if(ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_START_MODE)
+									{
+										setRelay(gun_index,ON);
+										ShmCharger->gun_info[gun_index].isCCSStartTransation = ON;
+									}
+
+									if((ShmCharger->gun_info[gun_index].primaryMcuState.relay_state == ON) &&
+										(ShmCharger->gun_info[gun_index].isCCSStartTransation == ON))
+									{
+										ocpp_set_unlocker_req(gun_index, OFF);
+										presentChargedEnergyClear(gun_index);
+										getDateTimeString((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartDateTime);
+										ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption_at_start = ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption;
+										ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption_at_start = ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption;
+										ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption_at_start = ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption;
+										ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption_at_start = ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption;
+										if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount==1)
+											ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption = (ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0);
+										else
+										{
+											//ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption[0] = (ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption/10000.0);
+											//ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption[1] = (ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption/10000.0);
+											//ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption[2] = (ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption/10000.0);
+										}
+
+										memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+										ocpp_copy_userid_to_starttransaction(gun_index);
+										ocpp_set_starttransaction_req(gun_index, ON);
+										ShmCharger->gun_info[gun_index].isCCSStartTransation = OFF;
+										setChargerMode(gun_index, SYS_MODE_CHARGING);
+										refreshStartTimer(&startChargingTime[gun_index]);
+										refreshStartTimer(&startTime[gun_index][TMR_IDX_CCS_HEARTBEAT_COUNT_RESET]);
+									}
+
+									//120 sec timeout
+									if(getDiffSecNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > TIMEOUT_SPEC_CCS_HANDSHAKE)
+									{
+										setLedMotion(gun_index, LED_ACTION_HANDSHAKE_FAIL);
+
+										if(getDiffSecNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > (TIMEOUT_SPEC_CCS_HANDSHAKE+5))
+										{
+											DEBUG_INFO("CCS 120 secs handshake timeout, change to BS Mode...\n");
+
+											if((ShmCharger->gun_info[gun_index].acCcsInfo.ChargingPermission == OFF) && (ShmCharger->gun_info[gun_index].acCcsInfo.CpSetPWMDuty != CCS_PWM_DUTY_5))
+											{
+												DEBUG_INFO("Wait CCS give up negotiagting.\n");
+											}
+										}
+									}
+
+									break;
+								default:
+									break;
+							}
+						}
+						else if(ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEMode)
+						{
+							DEBUG_INFO("Enter Socket-E Mode charging.\n");
+							ShmCharger->gun_info[gun_index].chargingMode = CHARGING_MODE_SOCKETE;
+							if(ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn == ON)
+								setRelay(gun_index,ON);
+
+							memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
+							ocpp_copy_userid_to_starttransaction(gun_index);
+							ocpp_set_starttransaction_req(gun_index, ON);
+							refreshStartTimer(&startChargingTime[gun_index]);
+							setChargerMode(gun_index, SYS_MODE_CHARGING);
+						}
+
+						// Unplug charging gun to Idle mode
+						if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) && (ShmCharger->gun_info[gun_index].isGunPlugged == YES))
+						{
+							DEBUG_INFO("Charging gun is plugged before.\n");
+						}
+
+						// Use RFID card to stop handshaking
+						if((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchPresentUser(gun_index))
+						{
+							DEBUG_INFO("Use RFID card to stop handshaking.\n");
+						}
+						else
+						{
+							ShmCharger->gun_info[gun_index].rfidReq = OFF;
+						}
+
+						if(getDiffSecNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > ShmCharger->timeoutSpec.Present_Timeout_Spec)
+						{
+							setLedMotion(gun_index, LED_ACTION_HANDSHAKE_FAIL);
+
+							if(getDiffSecNow(startTime[gun_index][TMR_IDX_HANDSHAKING]) > (ShmCharger->timeoutSpec.Present_Timeout_Spec+5))
+							{
+								DEBUG_INFO("Handshaking timeout...\n");
+								setChargerMode(gun_index, SYS_MODE_IDLE);
+							}
+						}
+
+						break;
+
+					case SYS_MODE_CHARGING:
+						if(isModeChange(gun_index))
+						{
+							ShmCharger->gun_info[gun_index].rfidReq = OFF;
+							//ftime(&startChargingTime[gun_index]);
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_LOGPPRINTOUT]);
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_PROFILE_PREPARE]);
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_PWN_CHANGE]);
+							ocpp_set_auth_req(OFF);
+							ocpp_reset_smartcharging_profileId(gun_index);
+							ocpp_set_profile_req(gun_index, ON);
+							ShmCharger->gun_info[gun_index].isChargerStopByCondition = NO;
+							ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
+						}
+
+						//if time up, clear CCS MSG count
+						if((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) &&
+						   (getDiffSecNow(startTime[gun_index][TMR_IDX_CCS_HEARTBEAT_COUNT_RESET]) > TIMEOUT_SPEC_CCS_HEARTBEAT_COUNT_RESET))
+						{
+							refreshStartTimer(&startTime[gun_index][TMR_IDX_CCS_HEARTBEAT_COUNT_RESET]);
+							if(ShmCharger->gun_info[gun_index].acCcsInfo.CcsHeartBeat > 0)
+							{
+								ShmCharger->gun_info[gun_index].acCcsInfo.CcsHeartBeat = 0;
+							}
+							else
+							{
+								DEBUG_INFO("CCS could not get MSG from car.\n");
+							}
+						}
+
+						if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
+						   (ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop == ON) ||
+						   ocpp_get_remotestop(gun_index) ||
+						   (ocpp_get_connection_status() && !ocpp_get_starttransaction_result(gun_index)) ||
+						   ((ShmCharger->gun_info[gun_index].chargingMode != CHARGING_MODE_SOCKETE) && ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState != CP_STATE_C) ||
+						   ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_SOCKETE) && !ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn) ||
+						   ocpp_get_reset_req() ||
+						   ocpp_get_unlocker_req(gun_index) ||
+						   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStop == ON) ||
+						   ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && (ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_STOP_MODE)) ||
+						   ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_RENEGOTIATE_MODE) ||
+						   ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_STANDBY_MODE))
+						{
+							setChargerMode(gun_index, SYS_MODE_TERMINATING);
+						}
+						else
+						{
+							// Charging session info calculation
+							setLedMotion(gun_index,LED_ACTION_CHARGING);
+							if(ShmSysConfigAndInfo->SysConfig.AcPhaseCount==1)
+								ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption = (ShmCharger->gun_info[gun_index].powerConsumptionTotal.power_consumption/10000.0);
+							else
+							{
+								//ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption[0] = (ShmCharger->gun_info[gun_index].powerConsumption[0].power_consumption/10000.0);
+								//ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption[1] = (ShmCharger->gun_info[gun_index].powerConsumption[1].power_consumption/10000.0);
+								//ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PowerConsumption[2] = (ShmCharger->gun_info[gun_index].powerConsumption[2].power_consumption/10000.0);
+							}
+
+							refreshStartTimer(&endChargingTime[gun_index]);
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration = getDiffSecBetween(startChargingTime[gun_index], endChargingTime[gun_index]);
+							presentChargedEnergyUpdate(gun_index);
+
+							// Response StartTransactionConf
+							ocpp_set_starttransaction_conf(gun_index, OFF);
+
+							// Charging profile preparation
+							if(getDiffSecNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE)
+							{
+								if(!ocpp_get_profile_conf(gun_index))
+								{
+									ocpp_set_profile_req(gun_index, ON);
+									refreshStartTimer(&startTime[gun_index][TMR_IDX_PROFILE_PREPARE]);
+								}
+								else
+								{
+									ocpp_set_profile_conf(gun_index, OFF);
+								}
+							}
+
+							// Checking profile id > 0 and current time is between charging profile validFrom & validTo
+							checkChargingProfileLimit(gun_index);
+
+							// Charging session target current check if OCPP disconnect and power sharing server connected
+							if(!ocpp_get_connection_status() && ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharging)
+							{
+								if(ShmSysConfigAndInfo->SysInfo.localSharingInfo.isConnectedSharingServer)
+									ShmCharger->gun_info[gun_index].targetCurrent = ShmSysConfigAndInfo->SysInfo.localSharingInfo.AvailableShargingCurrent;
+								else
+								{
+									if(ShmCharger->gun_info[gun_index].targetCurrent != 0)
+										DEBUG_WARN("Disconnect from power sharing server, target current set to 0.\n");
+
+									ShmCharger->gun_info[gun_index].targetCurrent = 0;
+								}
+							}
+
+							// Determine max charging current to MCU
+							if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+							{
+								ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+								if((ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current) ||
+								   (ShmCharger->gun_info[gun_index].primaryMcuState.current_limit != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current))
+								{
+									if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+									{
+										if(getDiffSecNow(startTime[gun_index][TMR_IDX_PWN_CHANGE]) > TIMEOUT_SPEC_PWN_CHANGE)
+										{
+											if((6 <= ShmCharger->gun_info[gun_index].targetCurrent))
+											{
+												ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+											}
+											else if((1 <= ShmCharger->gun_info[gun_index].targetCurrent) && (ShmCharger->gun_info[gun_index].targetCurrent < 6))
+											{
+												ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = 6;
+											}
+											else
+											{
+												ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = 100;
+											}
+											refreshStartTimer(&startTime[gun_index][TMR_IDX_PWN_CHANGE]);
+										}
+									}
+									else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+									{
+										ShmCharger->gun_info[gun_index].acCcsInfo.EVSEMaxCurrent = (float)((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+									}
+								}
+							}
+							else
+							{
+								ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+								if((ShmCharger->gun_info[gun_index].targetCurrent != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current) ||
+								   (ShmCharger->gun_info[gun_index].primaryMcuState.current_limit != ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current))
+								{
+									if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+									{
+										if(getDiffSecNow(startTime[gun_index][TMR_IDX_PWN_CHANGE]) > TIMEOUT_SPEC_PWN_CHANGE)
+										{
+											if((6 <= ShmCharger->gun_info[gun_index].targetCurrent))
+											{
+												ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+											}
+											else if((1 <= ShmCharger->gun_info[gun_index].targetCurrent) && (ShmCharger->gun_info[gun_index].targetCurrent < 6))
+											{
+												ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = 6;
+											}
+											else
+											{
+												ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = 100;
+											}
+											refreshStartTimer(&startTime[gun_index][TMR_IDX_PWN_CHANGE]);
+										}
+									}
+									else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+									{
+										ShmCharger->gun_info[gun_index].acCcsInfo.EVSEMaxCurrent = (float)((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+									}
+								}
+							}
+
+							// Charging session local limit condition check
+							if(ocpp_get_connection_status())
+							{
+								// On-line max condition check
+								if((ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60)))
+								{
+									if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+									{
+										setRelay(gun_index, OFF);
+										ShmCharger->gun_info[gun_index].isChargerStopByCondition = YES;
+									}
+									else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+									{
+										setRelay(gun_index, OFF);
+									}
+									setChargerMode(gun_index, SYS_MODE_TERMINATING);
+									DEBUG_INFO("Connector-%d charging duration(%d) already over max duration(%d) in second.\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration, (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60));
+								}
+								else if((ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy)))
+								{
+									if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+									{
+										setRelay(gun_index, OFF);
+										ShmCharger->gun_info[gun_index].isChargerStopByCondition = YES;
+									}
+									else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+									{
+										setRelay(gun_index, OFF);
+									}
+									setChargerMode(gun_index, SYS_MODE_TERMINATING);
+									DEBUG_INFO("Connector-%d charging energy(%.2f) already over max energy(%.2f) in KWH.\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy, ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy));
+								}
+								else
+								{
+									if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+									{
+										ShmCharger->gun_info[gun_index].isChargerStopByCondition = NO;
+										if(ShmCharger->gun_info[gun_index].targetCurrent>0)
+											setRelay(gun_index, ON);
+										else
+											setRelay(gun_index, OFF);
+									}
+									else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+									{
+										if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)
+											setRelay(gun_index, ON);
+									}
+								}
+							}
+							else
+							{
+								// Off-line max condition check
+								if((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
+								   ((ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_ENABLE) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE)))
+								{
+									if(((ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration > 0) ? (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration*60)) : (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60))))
+									{
+										if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+										{
+											setRelay(gun_index, OFF);
+											ShmCharger->gun_info[gun_index].isChargerStopByCondition = YES;
+										}
+										else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+										{
+											setRelay(gun_index, OFF);
+										}
+										setChargerMode(gun_index, SYS_MODE_TERMINATING);
+										DEBUG_INFO("Connector-%d charging duration(%d) already over off-line max duration(%d) in second.\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration, (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60));
+									}
+									else if(((ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy > 0) ? (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy)) : (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy))))
+									{
+										if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+										{
+											setRelay(gun_index, OFF);
+											ShmCharger->gun_info[gun_index].isChargerStopByCondition = YES;
+										}
+										else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+										{
+											setRelay(gun_index, OFF);
+										}
+										setChargerMode(gun_index, SYS_MODE_TERMINATING);
+										DEBUG_INFO("Connector-%d charging energy(%.2f) already over off-line max energy(%.2f) in KWH.\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy, ((float)ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy));
+									}
+									else
+									{
+										if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+										{
+											ShmCharger->gun_info[gun_index].isChargerStopByCondition = NO;
+											if(ShmCharger->gun_info[gun_index].targetCurrent>0)
+												setRelay(gun_index, ON);
+											else
+												setRelay(gun_index, OFF);
+										}
+										else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+										{
+											if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)
+												setRelay(gun_index, ON);
+										}
+									}
+								}
+								else
+								{
+									if(ShmCharger->gun_info[gun_index].primaryMcuState.relay_state > 0)
+										DEBUG_INFO("Connector-%d can not charging in off line\n", gun_index);
+
+									setRelay(gun_index, OFF);
+								}
+							}
+
+							// Debug information
+							if(getDiffSecNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+							{
+								DEBUG_INFO("==============================================================\n");
+								DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d \n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
+								DEBUG_INFO("ShmCharger->gun_info[%d].primaryMcuCp_Pwn_Duty.max_current: %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
+								DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent: %d\n", gun_index, ShmCharger->gun_info[gun_index].targetCurrent);
+								DEBUG_INFO("==============================================================\n");
+								refreshStartTimer(&startTime[gun_index][TMR_IDX_LOGPPRINTOUT]);
+
+								getDateTimeString((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime);
+								DB_Update_Record_Buf(localDb, gun_index);
+							}
+						}
+
+						break;
+					case SYS_MODE_TERMINATING:
+						if(isModeChange(gun_index))
+						{
+							if(!ShmCharger->gun_info[gun_index].primaryMcuState.relay_state)
+							{
+								setLedMotion(gun_index, LED_ACTION_STOP);
+							}
+							else
+							{}
+
+							getDateTimeString((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime);
+							ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
+						}
+
+						refreshStartTimer(&endChargingTime[gun_index]);
+						if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration != 0)
+						{
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration = getDiffSecBetween(startChargingTime[gun_index], endChargingTime[gun_index]);
+						}
+
+						// End authorize pass
+						if(((ShmCharger->gun_info[gun_index].rfidReq == ON) &&isMatchStartUser(gun_index)) ||
+						   ((ShmCharger->gun_info[gun_index].rfidReq == ON) && ocpp_get_auth_result(YES, gun_index)) ||
+						   (!ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE) && (ShmCharger->gun_info[gun_index].rfidReq == ON)) ||
+						   (!ocpp_get_connection_status() && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST) && (ShmCharger->gun_info[gun_index].rfidReq == ON)) ||
+						   (ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop == ON) ||
+						   ocpp_get_remotestop(gun_index) ||
+						   (ocpp_get_connection_status() && !ocpp_get_starttransaction_result(gun_index)) ||
+						   ((ShmCharger->gun_info[gun_index].chargingMode != CHARGING_MODE_SOCKETE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) && ocpp_get_StopTransactionOnEVSideDisconnect()) ||
+						   ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_SOCKETE) && !ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn) ||
+						   ocpp_get_reset_req() ||
+						   ocpp_get_unlocker_req(gun_index) ||
+						   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStop == ON) ||
+						   ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && (ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_STOP_MODE)))
+						{
+							//setRelay(gun_index, OFF);
+							setLedMotion(gun_index, LED_ACTION_STOP);
+
+							if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS)
+							{
+								ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = CCS_PWM_DUTY_100;
+								sleep(1);
+								checkStopReason(gun_index);
+								setChargerMode(gun_index, SYS_MODE_COMPLETE);
+							}
+							else if(ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC)
+							{
+								//setChargerMode(gun_index, SYS_MODE_COMPLETE);
+								//Cancel CCS task negotiating
+								ShmCharger->gun_info[gun_index].acCcsInfo.ChargingPermission = OFF;
+								ShmCharger->gun_info[gun_index].acCcsInfo.EVSENotification = NOTIFICATION_STOP;
+								setRelay(gun_index,OFF);
+								ShmCharger->gun_info[gun_index].isCCSWaitChangeDuty = ON;
+							}
+							else
+							{
+								setChargerMode(gun_index, SYS_MODE_COMPLETE);
+							}
+						}
+						else
+						{
+							// If the charger stops charging, the led should be stoped blink
+							if(!ShmCharger->gun_info[gun_index].primaryMcuState.relay_state)
+							{
+								setLedMotion(gun_index, LED_ACTION_STOP);
+							}
+
+							// Charging profile preparation
+							if(getDiffSecNow(startTime[gun_index][TMR_IDX_PROFILE_PREPARE]) > TIMEOUT_SPEC_PROFILE_PREPARE)
+							{
+								if(!ocpp_get_profile_conf(gun_index))
+								{
+									ocpp_set_profile_req(gun_index, ON);
+									refreshStartTimer(&startTime[gun_index][TMR_IDX_PROFILE_PREPARE]);
+								}
+								else
+								{
+									ocpp_set_profile_conf(gun_index, OFF);
+								}
+							}
+
+							// Checking profile id > 0 and current time is between charging profile validFrom & validTo
+							checkChargingProfileLimit(gun_index);
+
+							// Determine max charging current to MCU
+							if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+							{
+								ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmCharger->gun_info[gun_index].primaryMcuState.rating_current)?ShmCharger->gun_info[gun_index].primaryMcuState.rating_current:ShmCharger->gun_info[gun_index].targetCurrent);
+							}
+							else
+							{
+								ShmCharger->gun_info[gun_index].targetCurrent = ((ShmCharger->gun_info[gun_index].targetCurrent > ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent)?ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent:ShmCharger->gun_info[gun_index].targetCurrent);
+							}
+
+							// Debug information
+							if(getDiffSecNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
+							{
+								DEBUG_INFO("=============================================================\n");
+								DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
+								DEBUG_INFO("ShmCharger->gun_info[%d].primaryMcuCp_Pwn_Duty.max_current: %d\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
+								DEBUG_INFO("ShmCharger->gun_info[%d].targetCurrent: %d\n", gun_index, ShmCharger->gun_info[gun_index].targetCurrent);
+								DEBUG_INFO("=============================================================\n");
+								refreshStartTimer(&startTime[gun_index][TMR_IDX_LOGPPRINTOUT]);
+							}
+
+							if(!ocpp_get_auth_result(YES, gun_index))
+								ShmCharger->gun_info[gun_index].rfidReq = OFF;
+
+							if((((ShmCharger->gun_info[gun_index].chargingMode != CHARGING_MODE_SOCKETE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_C)) || ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_SOCKETE) && ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn)) &&
+							   (ShmCharger->gun_info[gun_index].rfidReq != ON) &&
+							   (ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop != ON)  &&
+							   !ocpp_get_remotestop(gun_index) &&
+							   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStop != ON) &&
+							   !ocpp_get_reset_req() &&
+							   ocpp_get_starttransaction_result(gun_index) &&
+							   !(ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60))) &&
+							   !(ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy))) &&
+							   !(!ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE) && ((ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration > 0) ? (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeDuration*60)) : (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedDuration >= (ShmSysConfigAndInfo->SysConfig.MaxChargingDuration*60)))) &&
+							   !(!ocpp_get_connection_status() && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy != OFF_POLICY_NOCHARGE) && ((ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy > 0) ? (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.OfflineMaxChargeEnergy)) : (ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy > 0) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PresentChargedEnergy >= ((float)ShmSysConfigAndInfo->SysConfig.MaxChargingEnergy)))) &&
+							   (((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) && (ShmCharger->gun_info[gun_index].acCcsInfo.EVChargeProgress == HLC_START_MODE)) || (ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_BS))
+							  )
+							{
+								setChargerMode(gun_index, SYS_MODE_CHARGING);
+							}
+						}
+
+						if((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_HLC) &&
+						   (ShmCharger->gun_info[gun_index].isCCSWaitChangeDuty == ON) &&
+						   (ShmCharger->gun_info[gun_index].acCcsInfo.CpSetPWMDuty == CCS_PWM_DUTY_100))
+						{
+							DEBUG_INFO("Set PWM duty 100%% go to SYS_MODE_TERMINATING.\n");
+
+							ShmCharger->gun_info[gun_index].isCCSWaitChangeDuty = OFF;
+							sleep(1);
+							checkStopReason(gun_index);
+							setChargerMode(gun_index, SYS_MODE_COMPLETE);
+						}
+
+						break;
+					case SYS_MODE_COMPLETE:
+						if(isModeChange(gun_index))
+						{
+							setLedMotion(gun_index, LED_ACTION_STOP);
+							sleep(6);
+							setRelay(gun_index, OFF);
+							setRequest(gun_index, OFF);
+							sleep(13);
+						}
+
+						if(((ShmCharger->gun_info[gun_index].chargingMode != CHARGING_MODE_SOCKETE) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)) ||
+						   ((ShmCharger->gun_info[gun_index].chargingMode == CHARGING_MODE_SOCKETE) && (!ShmCharger->gun_info[gun_index].primaryMcuState.socket_e.isSocketEPinOn)) ||
+						   ocpp_get_reset_req())
+						{
+							ShmCharger->gun_info[gun_index].rfidReq = OFF;
+							ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop = OFF;
+							ocpp_set_remotestop(gun_index, OFF);
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].schedule.isTriggerStop = OFF;
+
+							DB_Insert_Record(localDb, gun_index);
+							setChargerMode(gun_index, SYS_MODE_IDLE);
+						}
+
+						break;
+					case SYS_MODE_ALARM:
+						setLedMotion(gun_index,LED_ACTION_ALARM);
+						setRelay(gun_index, OFF);
+
+						if((ShmCharger->gun_info[gun_index].systemAlarmCode.SystemAlarmCode == 0))
+						{
+							if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus == SYS_MODE_CHARGING) ||
+							   (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus == SYS_MODE_TERMINATING))
+							{
+								setChargerMode(gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PreviousSystemStatus);
+							}
+							else
+							{
+								setChargerMode(gun_index, SYS_MODE_IDLE);
+							}
+						}
+
+						break;
+					case SYS_MODE_FAULT:
+						if(isModeChange(gun_index))
+						{}
+
+						break;
+					case SYS_MODE_MAINTAIN:
+						if(isModeChange(gun_index))
+						{
+							setLedMotion(gun_index,LED_ACTION_MAINTAIN);
+						}
+
+						break;
+					case SYS_MODE_UPDATE:
+						if(isModeChange(gun_index))
+						{
+							setLedMotion(gun_index,LED_ACTION_MAINTAIN);
+						}
+
+						//======================================
+						// Check local upgrade firmware request
+						//======================================
+						if(ShmSysConfigAndInfo->SysInfo.FirmwareUpdate)
+						{
+							DEBUG_INFO("Firmware local upgrading...\n");
+							ShmSysConfigAndInfo->SysInfo.FirmwareUpdate = OFF;
+
+							if(upgrade_check() == PASS)
+							{
+								if(ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail == ON)
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail = OFF;
+
+								ShmCharger->isUpdateSuccess = YES;
+								DEBUG_INFO("Local update success.\n");
+							}
+							else
+							{
+								if(ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail == OFF)
+									ShmStatusCodeData->InfoCode.InfoEvents.bits.CsuFimrwareUpdateFail = ON;
+
+								ShmCharger->isUpdateSuccess = NO;
+								DEBUG_INFO("Local update fail.\n");
+							}
+						}
+						else if(ocpp_get_update_firmware_req())
+						{
+							//======================================
+							// Check remote upgrade firmware request
+							//======================================
+							checkRemoteUpgradeStatus();
+						}
+						else
+						{
+							//======================================
+							// Upgrade complete reboot system
+							//======================================
+							if(!ShmCharger->gun_info[gun_index].mcuFlag.isMcuUpgradeReq && ((modelnameInfo.GetGunCount>1)?!ShmCharger->gun_info[gun_index^1].mcuFlag.isMcuUpgradeReq:YES) && !ShmCharger->isUpgradeLcmReq)
+							{
+								if(ShmCharger->isUpdateSuccess == YES)
+								{
+									sprintf((char*)ShmOCPP16Data->FirmwareStatusNotification.Status, "Installed");
+									ShmOCPP16Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
+
+									sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "Installed");
+									ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
+									DEBUG_WARN("Firmware upgrade success.\n");
+
+									sleep(5);
+									DEBUG_INFO("Firmware upgraded, reboot...\n");
+									system("reboot -f");
+									sleep(5);
+									system("reboot -f");
+								}
+								else
+								{
+									sprintf((char*)ShmOCPP16Data->FirmwareStatusNotification.Status, "InstallationFailed");
+									ShmOCPP16Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
+									sprintf((char*)ShmOCPP20Data->FirmwareStatusNotification.status, "InstallationFailed");
+									ShmOCPP20Data->SpMsg.bits.FirmwareStatusNotificationReq = ON;
+									DEBUG_WARN("Firmware upgrade fail.\n");
+
+									sleep(5);
+									system("rm -rvf /mnt/* ");
+									close(wtdFd);
+									system("/usr/bin/run_evse_restart.sh");
+								}
+							}
+						}
+
+						break;
+					case SYS_MODE_RESERVATION:
+						if(isModeChange(gun_index))
+						{}
+						setLedMotion(gun_index,LED_ACTION_RESERVATION_MODE);
+
+						if(isReservationExpired(gun_index))
+						{
+							DEBUG_INFO("Reservation: Time's up...\n");
+							setChargerMode(gun_index, SYS_MODE_IDLE);
+						}
+						else if(ocpp_get_cancelreservation_req(gun_index))
+						{
+							DEBUG_INFO("Reservation: Cancel reservation...\n");
+							setChargerMode(gun_index, SYS_MODE_IDLE);
+							ocpp_set_cancelreservation_req(gun_index, OFF);
+						}
+						else
+						{
+							// Check is there RFID or back end request start
+							if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
+							   ocpp_get_remotestart(gun_index))
+							{
+								if((ShmCharger->gun_info[gun_index].rfidReq == ON))
+								{
+									if(ocpp_compare_reserve_id_with_user(gun_index))
+									{
+										DEBUG_INFO("Start Method in reservation : RFID...\n");
+										DEBUG_INFO("Start request User Id : %s\n", ShmSysConfigAndInfo->SysConfig.UserId);
+										ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_RFID;
+										ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_ISO14443;
+										setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
+									}
+									else
+									{
+										setLedMotion(gun_index,LED_ACTION_IDLE);
+										ShmCharger->gun_info[gun_index].resultAuthorization = DEFAULT_RFID;
+										DEBUG_INFO("It's not reserve user id.\n");
+									}
+
+									ShmCharger->gun_info[gun_index].rfidReq = OFF;
+								}
+								else if(ocpp_get_remotestart(gun_index))
+								{
+									if(ocpp_compare_reserve_id_with_remote_user(gun_index))
+									{
+										DEBUG_INFO("Start Method in reservation: BACKEND...\n");
+										ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_BACKEND;
+										ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_Central;
+										setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
+									}
+									ocpp_set_remotestop(gun_index, OFF);
+								}
+							}
+						}
+
+						break;
+					case SYS_MODE_BOOKING:
+						if(isModeChange(gun_index))
+						{}
+
+						break;
+					case SYS_MODE_DEBUG:
+						if(isModeChange(gun_index))
+						{
+							setLedMotion(gun_index,LED_ACTION_DEBUG);
+						}
+
+						break;
+				}
+			}
+		}
+
+		// System watch dog reset
+		write(wtdFd, "a", 1);
+
+		usleep(50000);
+	}
+
+	return FAIL;
+}

+ 806 - 0
EVSE/Projects/AX80/Apps/main.h

@@ -0,0 +1,806 @@
+/*
+ * Config.h
+ *
+ *  Created on: 2020/01/15
+ *      Author: Eason Yang
+ */
+
+#ifndef CONFIG_MAIN_H_
+#define CONFIG_MAIN_H_
+
+#include    <sys/types.h>
+#include    <sys/stat.h>
+#include 	<sys/time.h>
+#include 	<sys/timeb.h>
+#include 	<sys/types.h>
+#include 	<sys/ioctl.h>
+#include 	<sys/socket.h>
+#include 	<sys/ipc.h>
+#include 	<sys/shm.h>
+#include 	<sys/mman.h>
+#include 	<linux/wireless.h>
+#include 	<arpa/inet.h>
+#include 	<netinet/in.h>
+#include	<dirent.h>
+
+#include 	<unistd.h>
+#include 	<stdarg.h>
+#include    <stdio.h>
+#include    <stdlib.h>
+#include    <unistd.h>
+#include    <fcntl.h>
+#include    <termios.h>
+#include    <errno.h>
+#include 	<errno.h>
+#include 	<string.h>
+#include	<time.h>
+#include	<ctype.h>
+#include 	<ifaddrs.h>
+#include	<stdbool.h>
+#include	<stddef.h>
+#include	<stdint.h>
+#include	<sqlite3.h>
+
+//===================================
+// Define Alarm code constant
+//===================================
+#define ALARM_L1_OVER_VOLTAGE					0x00000001
+#define ALARM_L1_UNDER_VOLTAGE					0x00000002
+#define ALARM_L1_OVER_CURRENT					0x00000004
+#define ALARM_OVER_TEMPERATURE	                0x00000008
+#define ALARM_GROUND_FAIL						0x00000010
+#define ALARM_CP_ERROR							0x00000020
+#define ALARM_CURRENT_LEAK_AC                   0x00000040
+#define ALARM_CURRENT_LEAK_DC                   0x00000080
+
+#define ALARM_MCU_TESTFAIL						0x00000100
+#define ALARM_HANDSHAKE_TIMEOUT                 0x00000200
+#define ALARM_EMERGENCY_STOP                    0x00000400
+#define ALARM_RELAY_WELDING                     0x00000800
+#define ALARM_LEAK_MODULE_FAIL                  0x00001000
+#define ALARM_SHUTTER_FAULT                     0x00002000
+#define ALARM_LOCKER_FAULT                      0x00004000
+#define ALARM_POWER_DROP                        0x00008000
+  
+#define ALARM_L1_CIRCUIT_SHORT                  0x00010000
+#define ALARM_ROTATORY_SWITCH_FAULT             0x00020000
+#define ALARM_RELAY_DRIVE_FAULT                 0x00040000
+#define ALARM_BLE_MODULE_BROKEN                 0x00080000
+#define ALARM_L2_OVER_VOLTAGE                   0x00100000
+#define ALARM_L3_OVER_VOLTAGE                   0x00200000
+#define ALARM_L2_UNDER_VOLTAGE                  0x00400000
+#define ALARM_L3_UNDER_VOLTAGE                  0x00800000
+
+#define ALARM_L2_OVER_CURRENT					0x01000000
+#define ALARM_L3_OVER_CURRENT					0x02000000
+#define ALARM_L2_CIRCUIT_SHORT                  0x04000000
+#define ALARM_L3_CIRCUIT_SHORT                  0x08000000
+#define ALARM_METER_TIMEOUT						0x10000000
+#define ALARM_METER_IC_TIMEOUT					0x20000000
+#define ALARM_CP_NEG_ERROR 						0x40000000
+
+//=================================
+//CCS related define
+//=================================
+#define CCS_PWM_DUTY_CP_STATE_F					0
+#define CCS_PWM_DUTY_CP_STATE_E					1
+#define CCS_PWM_DUTY_5							5
+#define CCS_PWM_DUTY_100						100
+
+//===================================
+//	Define CP State constant
+//===================================
+enum CP_STATE
+{
+	CP_STATE_UNKNOWN=0,
+	CP_STATE_A,
+	CP_STATE_B,
+	CP_STATE_C,
+	CP_STATE_D,
+	CP_STATE_E,
+	CP_STATE_F
+};
+
+//===================================
+//	Define CCS CP State constant
+//===================================
+enum CCS_CP_STATE
+{
+	CCS_CP_STATE_UNKNOWN=0,
+	CCS_CP_STATE_A,				//A (12V, no PWM)
+	CCS_CP_STATE_B1,			//B1 (9V, no PWM)
+	CCS_CP_STATE_B2,			//B2 (9V, with PWM)
+	CCS_CP_STATE_C,				//C (6V, with PWM)
+	CCS_CP_STATE_D,				//D (3V, with PWM)
+	CCS_CP_STATE_E,				//E (0V, no PWM)
+	CCS_CP_STATE_F,				//F (-12V, no PWM)
+	CCS_CP_STATE_G,				//G (>12V)
+	CCS_CP_STATE_H				//H  (<12V)
+};
+
+//===================================
+// Define Speaker type constant
+//===================================
+enum SPEAKER_ACTION
+{
+	SPEAKER_STOP=0,
+	SPEAKER_ALWAYS_ON,
+	SPEAKER_SHORT,
+	SPEAKER_LONG,
+	SPEAKER_INTERVAL_SHORT,
+	SPEAKER_INTERVAL_LONG,
+	SPEAKER_INTERVAL_3COUNT
+};
+
+//===================================
+// Define Led constant
+//===================================
+enum LED_ACTION
+{
+	LED_ACTION_INIT=0,
+	LED_ACTION_IDLE,
+	LED_ACTION_AUTHED,
+	LED_ACTION_CONNECTED,
+	LED_ACTION_CHARGING,
+	LED_ACTION_STOP,
+	LED_ACTION_ALARM,
+	LED_ACTION_MAINTAIN,
+	LED_ACTION_RFID_PASS,
+	LED_ACTION_RFID_FAIL,
+	LED_ACTION_BLE_CONNECT,
+	LED_ACTION_BLE_DISABLE,
+	LED_ACTION_DEBUG,
+	LED_ACTION_ALL_OFF,
+	LED_RELAY_ON,
+	LED_RELAY_OFF,
+	LED_ACTION_HANDSHAKE_FAIL,
+	LED_ACTION_INTERNET_DISCONNECT,
+	LED_ACTION_RESTORE_SETTING,
+	LED_ACTION_IDLE_BACKEND_CONNECTED,
+	LED_ACTION_IDLE_BACKEND_CONNECTED_SLEEP,
+	LED_ACTION_IDLE_BACKEND_DISCONNECTED,
+	LED_ACTION_IDLE_BACKEND_DISCONNECTED_SLEEP,
+	LED_ACTION_RESERVATION_MODE
+};
+
+//===================================
+// Define start mode constant
+//===================================
+enum START_METHOD
+{
+	START_METHOD_FREE=0,
+	START_METHOD_RFID,
+	START_METHOD_BACKEND,
+	START_METHOD_BLE
+};
+
+enum HANDSHAKE_STATE
+{
+	HANDSHAKE_IDLE=0,
+	HANDSHAKE_DUTY_5,
+	HANDSHAKE_DUTY_5_CHECK,
+	HANDSHAKE_CCS,
+	HANDSHAKE_CP_STATE_E,
+	HANDSHAKE_SET_MAX_CURRENT,
+	HANDSHAKE_BS_MODE,
+	HANDSHAKE_HLC_MODE
+};
+
+enum EV_READY_STATE
+{
+	EV_READY_STAT_E=1,
+	EV_READY_STAT_C,
+	EV_READY_SET_MAX_CURRENT
+};
+
+enum CHARGING_MODE
+{
+	CHARGING_MODE_BS=0,
+	CHARGING_MODE_HLC,
+	CHARGING_MODE_SOCKETE
+};
+
+enum HLC_MODE
+{
+	HLC_STOP_MODE=0,
+	HLC_START_MODE,
+	HLC_RENEGOTIATE_MODE,
+	HLC_STANDBY_MODE
+};
+
+enum EVSE_NOTIFICATION
+{
+	NOTIFICATION_NONE=0,
+	NOTIFICATION_STOP,
+	NOTIFICATION_RENEGOTIATION
+};
+
+enum TIMER_IDX
+{
+	TMR_IDX_HANDSHAKING=0,
+	TMR_IDX_AUTH,
+	TMR_IDX_LOGPPRINTOUT,
+	TMR_IDX_PROFILE_PREPARE,
+	TMR_IDX_BS_HLC_HANDSHAKE,
+	TMR_IDX_CCS_HEARTBEAT_COUNT_RESET,
+	TMR_IDX_PWN_CHANGE,
+	TMR_IDX_POWERSAVING_LCD,
+	TMR_IDX_POWERSAVING_RFID,
+	TMR_IDX_POWERSAVING_METER,
+	TMR_IDX_POWERSAVING_STATE_B,
+	TMR_IDX_CHECK_TASK,
+	TMR_IDX_POWERSAVING_LED_STATUS,
+	TMR_IDX_CHECK_POWER_CONSUMPTION,
+	TMR_IDX_LCM_POWER_CONSUMPTION,
+	TMR_IDX_UPGRADE,
+	TMR_IDX_16,
+	TMR_IDX_17,
+	TMR_IDX_18,
+	TMR_IDX_19,
+	TMR_IDX_GUN_DETECT,
+	TMR_IDX_CNT
+};
+
+//===================================
+//	Define Authorization State constant
+//===================================
+enum RFID_AUTHORIZATION_STATUS
+{
+	DEFAULT_RFID = 0,
+	VALIDATED_RFID,
+	UNVALIDATED_RFID,
+	UNKNOW_RFID
+};
+
+#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+#define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__), __LINE__, __FUNCTION__, ##args)
+
+extern int StoreLogMsg(const char *fmt, ...);
+
+
+//============================================================
+// Private shared memory key define
+//============================================================
+#define ShmChargerKey		2001
+#define ShmDispenserKey		2002
+
+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;
+	unsigned char Button_Mode_Switch;
+}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 SOCKET_E
+{
+	unsigned char isSocketEMode:1;
+	unsigned char isSocketEPinOn:1;
+}Socket_E;
+
+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;
+	Socket_E socket_e;
+}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;
+			unsigned long meter_comm_timeout:1;
+			unsigned long meter_ic_comm_timeout:1;
+			unsigned long pilot_negative_error: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
+{
+	uint64_t power_consumption;
+	uint64_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;
+	unsigned char isReadMeterIcCorrectionStatus: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 SET_AUX_POWER_SWITCH
+{
+	uint8_t power_type;		// 0xff: All	0x01: Meter
+	uint8_t power_switch;	// 0: OFF	1: ON
+}Set_Aux_Power_Switch;
+
+typedef union
+{
+	unsigned int value;
+	struct
+	{
+		unsigned int isCalibratedVaGain:1;					// Voltage phase a gain is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedVbGain:1;					// Voltage phase b gain is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedVcGain:1;					// Voltage phase c gain is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedVaOffset:1;				// Voltage phase a offset is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedVbOffset:1;				// Voltage phase b offset is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedVcOffset:1;				// Voltage phase c offset is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedCaGain:1;					// Current phase a gain is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedCbGain:1;					// Current phase b gain is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedCcGain:1;					// Current phase c gain is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedCaOffset:1;				// Current phase a offset is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedCbOffset:1;				// Current phase b offset is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedCcOffset:1;				// Current phase c offset is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedPa:1;						// Phase angle a is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedPb:1;						// Phase angle b gain is calibrated, 0: default	1: Calibrated
+		unsigned int isCalibratedPc:1;						// Phase angle c gain is calibrated, 0: default	1: Calibrated
+		unsigned int :17;
+	}bits;
+}MeterIcCorrection;
+
+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: ReNegotiation*/
+	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
+{
+	unsigned char									SystemStatus;
+	unsigned char									PreviousSystemStatus;
+	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								powerConsumptionTotal;
+	Power_Consumption								powerConsumption[3];
+	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;
+	Set_Aux_Power_Switch							setAuxPowerSwitch;
+	Gpio_in											GPIO_Input;
+	Ac_Ccs_Info										acCcsInfo;
+	uint8_t											StartDateTime[32];			// Charging cycle start date time
+	uint8_t											StopDateTime[32];			// Charging cycle stop date time
+	float 											PresentChargedEnergy;
+	float											presentChargedEnergyPeriod[24];		// Session present charged energy at each period, resolution: 0.01 KWH
+	uint32_t 										PresentChargedDuration;
+	uint8_t											ccsHandshakeState;
+	uint8_t											PreviousEVChargeProgress;
+	uint8_t											chargingMode;
+	uint16_t										targetCurrent;
+	uint8_t											evReadyState;
+	uint8_t											resultAuthorization;
+	MeterIcCorrection								meterIcCorrectionStatus;
+
+
+	uint32_t										isAuthPassEnd:1;
+	uint32_t										rfidReq:1;
+	uint32_t										isGunPlugged:1;
+	uint32_t										isSetBreatheLedTiming:1;
+	uint32_t										isSetLedBrightness:1;
+	uint32_t										isUnlockerConnetor:1;
+	uint32_t										isOperactive:1;
+	uint32_t										isCCSWaitChangeDuty:1;
+	uint32_t										isCCSStartTransation:1;
+	uint32_t										isEvReady2StateE:1;
+	uint32_t										isDoEvReadyOnce:1;
+	uint32_t										isChargerStopByCondition:1;
+	uint32_t										isMeterOn:1;
+	uint32_t										isSleepOn:1;
+	uint32_t										isCheckPowerConsumption:1;
+	uint32_t										isResetSoftReq:1;
+	uint32_t										isResetHardReq:1;
+	uint32_t										isUpgradeReq:1;
+	uint32_t										isUpgradeEnd:1;
+	uint32_t										isUpgradePASS:1;
+}Gun_Info;
+
+struct Charger
+{
+	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;
+	uint16_t				isSpeakerOn:1;
+	uint16_t		 		isUpdateSuccess:1;
+	uint16_t		 		isCcsEnable:1;
+	uint16_t				isLcdOn:1;
+	uint16_t				isAuthrizing:1;
+	uint16_t				isGetAuthResult:1;
+	uint16_t				isUpgradeLcmReq:1;
+	uint16_t				isUpgradeLcmSuccess:1;
+};
+
+struct DISPENSER
+{
+	Evse_Id								evseId;
+	struct SysConfigData				ConfigData;
+	Gun_Info							gun_info;
+	Timeout_Spec						timeoutSpec;
+	Fw_Upgrade_Info						fwUpgradeInfo;
+	uint16_t							AcPlugInTimes;
+	uint16_t							isInitialFail:1;
+	uint16_t							isCcsEnable:1;
+	uint16_t							isConnectedBackend:1;
+};
+
+#endif /* CONFIG_MAIN_H_ */

BIN
EVSE/Projects/AX80/Images/FactoryDefaultConfig.bin


BIN
EVSE/Projects/AX80/Images/MLO


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


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


BIN
EVSE/Projects/AX80/Images/u-boot-spl.bin


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


BIN
EVSE/Projects/AX80/Images/zImage


+ 9 - 0
EVSE/Projects/define.h

@@ -63,6 +63,15 @@ Storage							0x0A200000-0x7FFFFFFF		1886 MB
     #define GENERAL_GUN_QUANTITY    0
     #define PSU_QUANTITY            0
     #define ONE_CONNECTOR_USE       0
+#elif defined AX80
+    #define MAX_PSU_QUANTITY        62
+    #define CHAdeMO_QUANTITY        1
+    #define CCS_QUANTITY            1
+    #define GB_QUANTITY             0
+    #define AC_QUANTITY             3
+    #define GENERAL_GUN_QUANTITY    3
+    #define PSU_QUANTITY            0
+    #define ONE_CONNECTOR_USE       0
 #elif defined DW30
 	#define MAX_PSU_QUANTITY        62
 	#define CHAdeMO_QUANTITY        0

BIN
EVSE/rootfs/lib/qcaspi.ko


+ 73 - 0
Makefile

@@ -1710,3 +1710,76 @@ DD360ComBox-rootfs:
 	@rm -rfv EVSE/Projects/DD360ComBox/Images/mnt
 
 DD360ComBox-all: DD360ComBox-uboot DD360ComBox-linux DD360ComBox-rootfs
+
+AX80-uboot-default: u-boot_clean u-boot
+	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/AX80/Images/
+	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/AX80/Images/
+
+AX80-uboot-menuconfig:
+	@echo ===================================
+	@echo    Building U-boot menuconfig
+	@echo ===================================
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) menuconfig
+
+AX80-uboot:
+	@echo ===================================
+	@echo    Building U-boot
+	@echo ===================================
+	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[AX80]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08 DDR_IC=MT41K256M16HA125E_400
+	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/AX80/Images/
+	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/AX80/Images/
+	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/AX80/Images/
+
+AX80-linux-default: linux_clean linux
+	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/AX80/Images/
+	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/AX80/Images/
+
+AX80-linux:
+	@echo =====================================
+	@echo     Building the Linux Kernel DTBs
+	@echo =====================================
+	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb
+	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/[AX80]am335x-evm.dts board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dts
+	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) am335x-evm.dtb
+	@echo =================================
+	@echo     Building User Linux Kernel
+	@echo =================================
+	@rm -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage
+	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage
+	$(MAKE) -j $(MAKE_JOBS) -C $(LINUXKERNEL_INSTALL_DIR) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
+	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/zImage EVSE/Projects/AX80/Images/
+	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/am335x-evm.dtb EVSE/Projects/AX80/Images/
+	@cp -f board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/drivers/net/ethernet/qualcomm/qcaspi.ko EVSE/rootfs/lib/
+
+AX80-rootfs:
+	@echo =================================
+	@echo     Building User rootfs
+	@echo =================================
+#	@cd EVSE/GPL;make Project=AX80 all
+	@cd EVSE/Modularization;make TLS_EXPIRED=TLS_VALID_CERT_EXPIRED Project=AX80 all
+	@cd EVSE/Projects/AX80/Apps;make Project=AX80 all
+	@rm -f EVSE/Projects/AX80/Images/ramdisk.gz
+	@dd if=/dev/zero of=/dev/ram0 bs=1k count=131072
+	@mke2fs -vm0 /dev/ram0 131072
+	@tune2fs -c 0 /dev/ram0
+	@dd if=/dev/ram0 bs=1k count=131072 | gzip -v9 > EVSE/Projects/AX80/Images/ramdisk.gz
+	@mkdir -p EVSE/Projects/AX80/Images/mnt
+	@gunzip EVSE/Projects/AX80/Images/ramdisk.gz
+	@sync
+	@mount -o loop EVSE/Projects/AX80/Images/ramdisk EVSE/Projects/AX80/Images/mnt
+	@cp -rfv EVSE/rootfs/* EVSE/Projects/AX80/Images/mnt/
+	@chown www-data:www-data EVSE/Projects/AX80/Images/mnt/var/www -R
+	@chmod 777 EVSE/Projects/AX80/Images/mnt/var/log -R
+	@chmod 777 EVSE/Projects/AX80/Images/mnt/var/run -R
+	@cp -rfv EVSE/Projects/AX80/Images/root/* EVSE/Projects/AX80/Images/mnt/root
+	@sync
+	@sleep 3
+	@umount EVSE/Projects/AX80/Images/mnt
+	@sync
+	@gzip -v9 EVSE/Projects/AX80/Images/ramdisk
+	@rm -rfv EVSE/Projects/AX80/Images/root
+	@rm -rfv EVSE/Projects/AX80/Images/mnt
+
+AX80-all: AX80-uboot AX80-linux AX80-rootfs
+

+ 296 - 296
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_System.map

@@ -35268,302 +35268,302 @@ c0a00000 R __start_rodata
 c0a00000 A __start_rodata_section_aligned
 c0a00000 R _etext
 c0a00010 R linux_proc_banner
-c0a00068 R linux_banner
-c0a000f8 r __func__.5825
-c0a00108 r sqrt_oddadjust
-c0a00128 r sqrt_evenadjust
-c0a00148 r __func__.5807
-c0a00158 r cc_map
-c0a00178 r isa_modes
-c0a00188 r processor_modes
-c0a00208 r sigpage_mapping
-c0a00218 r regoffset_table
-c0a002b0 r user_arm_view
-c0a002c4 r arm_regsets
-c0a00330 r hwcap_str
-c0a0038c r hwcap2_str
-c0a003a4 r proc_arch
-c0a003e8 R cpuinfo_op
-c0a003f8 R sigreturn_codes
-c0a00414 r handler
-c0a00428 r atags_fops
-c0a004a0 r pmresrn_table.31150
-c0a004b0 r pmresrn_table.31002
-c0a004bc r scorpion_perf_cache_map
-c0a00564 r scorpion_perf_map
-c0a0058c r krait_perf_cache_map
-c0a00634 r krait_perf_map
-c0a0065c r krait_perf_map_no_branch
-c0a00684 r armv7_a5_perf_cache_map
-c0a0072c r armv7_a5_perf_map
-c0a00754 r armv7_a7_perf_cache_map
-c0a007fc r armv7_a7_perf_map
-c0a00824 r armv7_a8_perf_cache_map
-c0a008cc r armv7_a8_perf_map
-c0a008f4 r armv7_a9_perf_cache_map
-c0a0099c r armv7_a9_perf_map
-c0a009c4 r armv7_a12_perf_cache_map
-c0a00a6c r armv7_a12_perf_map
-c0a00a94 r armv7_a15_perf_cache_map
-c0a00b3c r armv7_a15_perf_map
-c0a00b64 r armv7_pmu_probe_table
-c0a00b88 r armv7_pmu_of_device_ids
-c0a013f4 r usermode_action
-c0a0140c r alignment_proc_fops
-c0a01484 r subset.21772
-c0a014a4 r subset.21782
-c0a014b4 r __param_str_alignment
-c0a014c0 r cpu_arch_name
-c0a014c6 r cpu_elf_name
-c0a014cc r l2c220_data
-c0a01514 r omap_types
-c0a01528 r __func__.28508
-c0a01540 r __func__.29284
-c0a01560 r __func__.29289
-c0a01580 r am33xx_control_reg_offsets
-c0a01640 r am43xx_control_reg_offsets
-c0a0171c r omap_scrm_dt_match_table
-c0a01ec4 r omap2_ctrl_data
-c0a01ecc r omap_mux_dbg_signal_fops
-c0a01f44 r omap_mux_dbg_board_fops
-c0a01fbc r __func__.28699
-c0a01fd0 r __func__.28741
-c0a01fe8 r __func__.28758
-c0a02000 r __func__.28788
-c0a02014 r __func__.29075
-c0a02028 r __func__.29089
-c0a0203c r __func__.29126
-c0a0204c r __func__.29002
-c0a02064 r __func__.29015
-c0a02080 r __func__.29102
-c0a02094 r __func__.30036
-c0a020b4 r __func__.30084
-c0a020c8 r __func__.30078
-c0a020d8 r __func__.36712
-c0a020ec r omap_pm_ops
-c0a02114 r reg_map
-c0a021e8 r __func__.31257
-c0a02204 r __func__.27253
-c0a0221c r __func__.27271
-c0a02234 r __func__.28011
-c0a02244 r name
-c0a02250 r __func__.27252
-c0a02264 r __func__.36709
-c0a02274 r modck.36708
-c0a0227c r __func__.37246
-c0a02298 r __func__.28074
-c0a022b0 r __func__.28070
-c0a022cc r __func__.28103
-c0a022e0 r __func__.28109
-c0a022f4 r __func__.28161
-c0a0230c r __func__.28135
-c0a0232c r __func__.25577
-c0a02340 r __func__.23975
-c0a02360 r __func__.23985
-c0a0237c r __func__.30938
-c0a0238c r debug_fops
-c0a02404 r pm_dbg_option_fops
-c0a0247c r pwrdm_suspend_fops
-c0a024f4 r pwrdm_state_names
-c0a02504 r __func__.30154
-c0a0251c r __func__.30166
-c0a0253c r __func__.30177
-c0a02560 r __func__.30189
-c0a0257c r __func__.30203
-c0a02598 r __func__.30215
-c0a025b8 r __func__.30227
-c0a025d0 r __func__.30239
-c0a025e8 r __func__.30248
-c0a02604 r __func__.30257
-c0a02620 r __func__.19941
-c0a02634 r __func__.19953
-c0a02650 r __func__.19965
-c0a0266c r __func__.19977
-c0a02684 r __func__.19988
-c0a0269c r __func__.28041
-c0a026b0 r __func__.28049
-c0a026c0 r __func__.28057
-c0a026d0 r __func__.28062
-c0a026ec r __func__.28068
-c0a02708 r __func__.28076
-c0a02724 r __func__.28081
-c0a0273c r __func__.14518
-c0a02750 r __func__.14345
-c0a02764 r __func__.14379
-c0a0277c r __func__.14532
-c0a02794 r __func__.14512
-c0a027a8 r __func__.27364
-c0a027b8 r __func__.27389
-c0a027d4 r __func__.27402
-c0a027e4 r __func__.27409
-c0a027f4 r __func__.34357
-c0a0280c r __func__.34364
-c0a0282c r __func__.27872
-c0a02840 r __func__.29301
-c0a02850 r __func__.36945
-c0a02864 r __func__.36957
-c0a02874 r __func__.36813
-c0a02888 r __func__.26969
-c0a028a0 r __func__.26938
-c0a028b8 r __func__.26928
-c0a028cc r omap_timer_match
-c0a02eec r __func__.27014
-c0a02f00 r __func__.26797
-c0a02f18 r __func__.26943
-c0a02f34 r __func__.26966
-c0a02f50 r __func__.26977
-c0a02f6c r CSWTCH.92
-c0a02f78 r __func__.26836
-c0a02f94 r __func__.26648
-c0a02fb0 r __func__.26712
-c0a02fd0 r omap3plus_pdata
-c0a02fe0 r execdomains_proc_fops
-c0a03058 r tnts
-c0a03088 r __param_str_crash_kexec_post_notifiers
-c0a030a4 r __param_str_panic_on_warn
-c0a030b4 r __param_str_pause_on_oops
-c0a030c4 r __param_str_panic
-c0a030cc R cpu_all_bits
-c0a030d0 R cpu_bit_bitmap
-c0a03154 R softirq_to_name
-c0a0317c r resource_op
-c0a0318c r proc_ioports_operations
-c0a03204 r proc_iomem_operations
-c0a0327c r proc_wspace_sep
-c0a03288 r cap_last_cap
-c0a0328c r __func__.47243
-c0a032a8 R __cap_empty_set
-c0a032b0 r __func__.40763
-c0a032c8 r offsets.39360
-c0a032d4 r wq_sysfs_group
-c0a032e8 r __param_str_debug_force_rr_cpu
-c0a03308 r __param_str_power_efficient
-c0a03324 r __param_str_disable_numa
-c0a0333c r module_uevent_ops
-c0a03348 r module_sysfs_ops
-c0a03350 R param_ops_string
-c0a03360 R param_array_ops
-c0a03370 R param_ops_bint
-c0a03380 R param_ops_invbool
-c0a03390 R param_ops_bool_enable_only
-c0a033a0 R param_ops_bool
-c0a033b0 R param_ops_charp
-c0a033c0 R param_ops_ullong
-c0a033d0 R param_ops_ulong
-c0a033e0 R param_ops_long
-c0a033f0 R param_ops_uint
-c0a03400 R param_ops_int
-c0a03410 R param_ops_ushort
-c0a03420 R param_ops_short
-c0a03430 R param_ops_byte
-c0a03440 r param.26429
-c0a03444 r reboot_cmd
-c0a03454 r __func__.5705
-c0a03468 R sched_prio_to_weight
-c0a03508 R sched_prio_to_wmult
-c0a035a8 r stat_nam
-c0a035b8 R min_cfs_quota_period
-c0a035c0 R max_cfs_quota_period
-c0a035c8 R idle_sched_class
-c0a03610 R fair_sched_class
-c0a03658 R rt_sched_class
-c0a036a0 R dl_sched_class
-c0a036e8 R stop_sched_class
-c0a03730 r schedstat_sops
-c0a03740 r proc_schedstat_operations
-c0a037b8 r sched_feat_fops
-c0a03830 r sched_feat_names
-c0a03870 r sched_debug_sops
-c0a03880 r sched_debug_fops
-c0a038f8 r sched_tunable_scaling_names
-c0a03904 r pm_qos_array
-c0a03918 r pm_qos_power_fops
-c0a03990 r pm_qos_debug_fops
-c0a03a08 r CSWTCH.162
-c0a03a14 r __func__.31252
-c0a03a30 r __func__.31395
-c0a03a50 r suspend_stats_operations
-c0a03ac8 r CSWTCH.48
-c0a03ae8 r pm_tests
-c0a03b00 r __param_str_pm_test_delay
-c0a03b18 r trunc_msg
-c0a03b24 r recursion_msg.36570
-c0a03b44 r __param_str_always_kmsg_dump
-c0a03b5c r __param_str_console_suspend
-c0a03b74 r __param_str_time
-c0a03b80 r __param_str_ignore_loglevel
-c0a03b98 R kmsg_fops
-c0a03c10 r __param_str_irqfixup
-c0a03c24 r __param_str_noirqdebug
-c0a03c38 r __func__.26206
-c0a03c4c R irq_domain_simple_ops
-c0a03c74 r irq_spurious_proc_fops
-c0a03cec r msi_domain_ops
-c0a03d14 r __param_str_rcu_cpu_stall_timeout
-c0a03d34 r __param_str_rcu_cpu_stall_suppress
-c0a03d54 r __param_str_rcu_normal_after_boot
-c0a03d74 r __param_str_rcu_normal
-c0a03d88 r __param_str_rcu_expedited
-c0a03da0 r gp_ops
-c0a03dc4 r CSWTCH.367
-c0a03dd0 r gp_state_names
-c0a03dec r __param_str_jiffies_till_sched_qs
-c0a03e0c r __param_str_rcu_kick_kthreads
-c0a03e28 r __param_str_jiffies_till_next_fqs
-c0a03e48 r __param_str_jiffies_till_first_fqs
-c0a03e68 r __param_str_qlowmark
-c0a03e7c r __param_str_qhimark
-c0a03e8c r __param_str_blimit
-c0a03e9c r __param_str_kthread_prio
-c0a03eb4 r __param_str_rcu_fanout_leaf
-c0a03ecc r __param_str_rcu_fanout_exact
-c0a03ee8 r __param_str_dump_tree
-c0a03efc r hrtimer_clock_to_base_table
-c0a03f64 r offsets
-c0a03f70 r timer_list_sops
-c0a03f80 r timer_list_fops
-c0a03ff8 r __mon_yday
-c0a0402c r posix_clock_file_operations
-c0a040a4 r alarmtimer_pm_ops
-c0a04100 r __param_str_irqtime
-c0a04108 r tk_debug_sleep_time_fops
-c0a04180 r modules_op
-c0a04190 r proc_modules_operations
-c0a04208 r arr.33985
-c0a04244 r __func__.35164
-c0a04254 r vermagic
-c0a04294 r masks.34837
-c0a042bc r modinfo_attrs
-c0a042e0 r __param_str_module_blacklist
-c0a042f4 r __param_str_nomodule
-c0a04300 r __param_str_sig_enforce
-c0a04314 r kallsyms_op
-c0a04324 r kallsyms_operations
-c0a0439c r __func__.53739
-c0a043b0 r cgroup_subsys
-c0a043d0 r cgroup_subsys_enabled_key
-c0a043f0 r cgroup_subsys_on_dfl_key
-c0a04410 r cgroup_subsys_name
-c0a04430 r proc_cgroupstats_operations
-c0a044a8 R cgroupns_operations
-c0a044c4 R utsns_operations
-c0a044e0 R pidns_operations
-c0a044fc r kernel_config_data
-c0a0bcd4 r ikconfig_file_ops
-c0a0bd4c r mode1_syscalls
-c0a0bd60 r jumptable.45708
-c0a0c160 r __func__.45888
-c0a0c170 R bpf_tail_call_proto
-c0a0c190 r __func__.50908
-c0a0c1a4 r perf_mmap_vmops
-c0a0c1d0 r perf_fops
-c0a0c248 r if_tokens
-c0a0c288 r pmu_dev_group
-c0a0c29c r __func__.24217
-c0a0c2b8 r __func__.24230
-c0a0c2d0 r __func__.24138
-c0a0c2e4 r __func__.24193
-c0a0c2f8 r __func__.24205
+c0a0006c R linux_banner
+c0a00100 r __func__.5825
+c0a00110 r sqrt_oddadjust
+c0a00130 r sqrt_evenadjust
+c0a00150 r __func__.5807
+c0a00160 r cc_map
+c0a00180 r isa_modes
+c0a00190 r processor_modes
+c0a00210 r sigpage_mapping
+c0a00220 r regoffset_table
+c0a002b8 r user_arm_view
+c0a002cc r arm_regsets
+c0a00338 r hwcap_str
+c0a00394 r hwcap2_str
+c0a003ac r proc_arch
+c0a003f0 R cpuinfo_op
+c0a00400 R sigreturn_codes
+c0a0041c r handler
+c0a00430 r atags_fops
+c0a004a8 r pmresrn_table.31150
+c0a004b8 r pmresrn_table.31002
+c0a004c4 r scorpion_perf_cache_map
+c0a0056c r scorpion_perf_map
+c0a00594 r krait_perf_cache_map
+c0a0063c r krait_perf_map
+c0a00664 r krait_perf_map_no_branch
+c0a0068c r armv7_a5_perf_cache_map
+c0a00734 r armv7_a5_perf_map
+c0a0075c r armv7_a7_perf_cache_map
+c0a00804 r armv7_a7_perf_map
+c0a0082c r armv7_a8_perf_cache_map
+c0a008d4 r armv7_a8_perf_map
+c0a008fc r armv7_a9_perf_cache_map
+c0a009a4 r armv7_a9_perf_map
+c0a009cc r armv7_a12_perf_cache_map
+c0a00a74 r armv7_a12_perf_map
+c0a00a9c r armv7_a15_perf_cache_map
+c0a00b44 r armv7_a15_perf_map
+c0a00b6c r armv7_pmu_probe_table
+c0a00b90 r armv7_pmu_of_device_ids
+c0a013fc r usermode_action
+c0a01414 r alignment_proc_fops
+c0a0148c r subset.21772
+c0a014ac r subset.21782
+c0a014bc r __param_str_alignment
+c0a014c8 r cpu_arch_name
+c0a014ce r cpu_elf_name
+c0a014d4 r l2c220_data
+c0a0151c r omap_types
+c0a01530 r __func__.28508
+c0a01548 r __func__.29284
+c0a01568 r __func__.29289
+c0a01588 r am33xx_control_reg_offsets
+c0a01648 r am43xx_control_reg_offsets
+c0a01724 r omap_scrm_dt_match_table
+c0a01ecc r omap2_ctrl_data
+c0a01ed4 r omap_mux_dbg_signal_fops
+c0a01f4c r omap_mux_dbg_board_fops
+c0a01fc4 r __func__.28699
+c0a01fd8 r __func__.28741
+c0a01ff0 r __func__.28758
+c0a02008 r __func__.28788
+c0a0201c r __func__.29075
+c0a02030 r __func__.29089
+c0a02044 r __func__.29126
+c0a02054 r __func__.29002
+c0a0206c r __func__.29015
+c0a02088 r __func__.29102
+c0a0209c r __func__.30036
+c0a020bc r __func__.30084
+c0a020d0 r __func__.30078
+c0a020e0 r __func__.36712
+c0a020f4 r omap_pm_ops
+c0a0211c r reg_map
+c0a021f0 r __func__.31257
+c0a0220c r __func__.27253
+c0a02224 r __func__.27271
+c0a0223c r __func__.28011
+c0a0224c r name
+c0a02258 r __func__.27252
+c0a0226c r __func__.36709
+c0a0227c r modck.36708
+c0a02284 r __func__.37246
+c0a022a0 r __func__.28074
+c0a022b8 r __func__.28070
+c0a022d4 r __func__.28103
+c0a022e8 r __func__.28109
+c0a022fc r __func__.28161
+c0a02314 r __func__.28135
+c0a02334 r __func__.25577
+c0a02348 r __func__.23975
+c0a02368 r __func__.23985
+c0a02384 r __func__.30938
+c0a02394 r debug_fops
+c0a0240c r pm_dbg_option_fops
+c0a02484 r pwrdm_suspend_fops
+c0a024fc r pwrdm_state_names
+c0a0250c r __func__.30154
+c0a02524 r __func__.30166
+c0a02544 r __func__.30177
+c0a02568 r __func__.30189
+c0a02584 r __func__.30203
+c0a025a0 r __func__.30215
+c0a025c0 r __func__.30227
+c0a025d8 r __func__.30239
+c0a025f0 r __func__.30248
+c0a0260c r __func__.30257
+c0a02628 r __func__.19941
+c0a0263c r __func__.19953
+c0a02658 r __func__.19965
+c0a02674 r __func__.19977
+c0a0268c r __func__.19988
+c0a026a4 r __func__.28041
+c0a026b8 r __func__.28049
+c0a026c8 r __func__.28057
+c0a026d8 r __func__.28062
+c0a026f4 r __func__.28068
+c0a02710 r __func__.28076
+c0a0272c r __func__.28081
+c0a02744 r __func__.14518
+c0a02758 r __func__.14345
+c0a0276c r __func__.14379
+c0a02784 r __func__.14532
+c0a0279c r __func__.14512
+c0a027b0 r __func__.27364
+c0a027c0 r __func__.27389
+c0a027dc r __func__.27402
+c0a027ec r __func__.27409
+c0a027fc r __func__.34357
+c0a02814 r __func__.34364
+c0a02834 r __func__.27872
+c0a02848 r __func__.29301
+c0a02858 r __func__.36945
+c0a0286c r __func__.36957
+c0a0287c r __func__.36813
+c0a02890 r __func__.26969
+c0a028a8 r __func__.26938
+c0a028c0 r __func__.26928
+c0a028d4 r omap_timer_match
+c0a02ef4 r __func__.27014
+c0a02f08 r __func__.26797
+c0a02f20 r __func__.26943
+c0a02f3c r __func__.26966
+c0a02f58 r __func__.26977
+c0a02f74 r CSWTCH.92
+c0a02f80 r __func__.26836
+c0a02f9c r __func__.26648
+c0a02fb8 r __func__.26712
+c0a02fd8 r omap3plus_pdata
+c0a02fe8 r execdomains_proc_fops
+c0a03060 r tnts
+c0a03090 r __param_str_crash_kexec_post_notifiers
+c0a030ac r __param_str_panic_on_warn
+c0a030bc r __param_str_pause_on_oops
+c0a030cc r __param_str_panic
+c0a030d4 R cpu_all_bits
+c0a030d8 R cpu_bit_bitmap
+c0a0315c R softirq_to_name
+c0a03184 r resource_op
+c0a03194 r proc_ioports_operations
+c0a0320c r proc_iomem_operations
+c0a03284 r proc_wspace_sep
+c0a03290 r cap_last_cap
+c0a03294 r __func__.47243
+c0a032b0 R __cap_empty_set
+c0a032b8 r __func__.40763
+c0a032d0 r offsets.39360
+c0a032dc r wq_sysfs_group
+c0a032f0 r __param_str_debug_force_rr_cpu
+c0a03310 r __param_str_power_efficient
+c0a0332c r __param_str_disable_numa
+c0a03344 r module_uevent_ops
+c0a03350 r module_sysfs_ops
+c0a03358 R param_ops_string
+c0a03368 R param_array_ops
+c0a03378 R param_ops_bint
+c0a03388 R param_ops_invbool
+c0a03398 R param_ops_bool_enable_only
+c0a033a8 R param_ops_bool
+c0a033b8 R param_ops_charp
+c0a033c8 R param_ops_ullong
+c0a033d8 R param_ops_ulong
+c0a033e8 R param_ops_long
+c0a033f8 R param_ops_uint
+c0a03408 R param_ops_int
+c0a03418 R param_ops_ushort
+c0a03428 R param_ops_short
+c0a03438 R param_ops_byte
+c0a03448 r param.26429
+c0a0344c r reboot_cmd
+c0a0345c r __func__.5705
+c0a03470 R sched_prio_to_weight
+c0a03510 R sched_prio_to_wmult
+c0a035b0 r stat_nam
+c0a035c0 R min_cfs_quota_period
+c0a035c8 R max_cfs_quota_period
+c0a035d0 R idle_sched_class
+c0a03618 R fair_sched_class
+c0a03660 R rt_sched_class
+c0a036a8 R dl_sched_class
+c0a036f0 R stop_sched_class
+c0a03738 r schedstat_sops
+c0a03748 r proc_schedstat_operations
+c0a037c0 r sched_feat_fops
+c0a03838 r sched_feat_names
+c0a03878 r sched_debug_sops
+c0a03888 r sched_debug_fops
+c0a03900 r sched_tunable_scaling_names
+c0a0390c r pm_qos_array
+c0a03920 r pm_qos_power_fops
+c0a03998 r pm_qos_debug_fops
+c0a03a10 r CSWTCH.162
+c0a03a1c r __func__.31252
+c0a03a38 r __func__.31395
+c0a03a58 r suspend_stats_operations
+c0a03ad0 r CSWTCH.48
+c0a03af0 r pm_tests
+c0a03b08 r __param_str_pm_test_delay
+c0a03b20 r trunc_msg
+c0a03b2c r recursion_msg.36570
+c0a03b4c r __param_str_always_kmsg_dump
+c0a03b64 r __param_str_console_suspend
+c0a03b7c r __param_str_time
+c0a03b88 r __param_str_ignore_loglevel
+c0a03ba0 R kmsg_fops
+c0a03c18 r __param_str_irqfixup
+c0a03c2c r __param_str_noirqdebug
+c0a03c40 r __func__.26206
+c0a03c54 R irq_domain_simple_ops
+c0a03c7c r irq_spurious_proc_fops
+c0a03cf4 r msi_domain_ops
+c0a03d1c r __param_str_rcu_cpu_stall_timeout
+c0a03d3c r __param_str_rcu_cpu_stall_suppress
+c0a03d5c r __param_str_rcu_normal_after_boot
+c0a03d7c r __param_str_rcu_normal
+c0a03d90 r __param_str_rcu_expedited
+c0a03da8 r gp_ops
+c0a03dcc r CSWTCH.367
+c0a03dd8 r gp_state_names
+c0a03df4 r __param_str_jiffies_till_sched_qs
+c0a03e14 r __param_str_rcu_kick_kthreads
+c0a03e30 r __param_str_jiffies_till_next_fqs
+c0a03e50 r __param_str_jiffies_till_first_fqs
+c0a03e70 r __param_str_qlowmark
+c0a03e84 r __param_str_qhimark
+c0a03e94 r __param_str_blimit
+c0a03ea4 r __param_str_kthread_prio
+c0a03ebc r __param_str_rcu_fanout_leaf
+c0a03ed4 r __param_str_rcu_fanout_exact
+c0a03ef0 r __param_str_dump_tree
+c0a03f04 r hrtimer_clock_to_base_table
+c0a03f6c r offsets
+c0a03f78 r timer_list_sops
+c0a03f88 r timer_list_fops
+c0a04000 r __mon_yday
+c0a04034 r posix_clock_file_operations
+c0a040ac r alarmtimer_pm_ops
+c0a04108 r __param_str_irqtime
+c0a04110 r tk_debug_sleep_time_fops
+c0a04188 r modules_op
+c0a04198 r proc_modules_operations
+c0a04210 r arr.33985
+c0a0424c r __func__.35164
+c0a0425c r vermagic
+c0a0429c r masks.34837
+c0a042c4 r modinfo_attrs
+c0a042e8 r __param_str_module_blacklist
+c0a042fc r __param_str_nomodule
+c0a04308 r __param_str_sig_enforce
+c0a0431c r kallsyms_op
+c0a0432c r kallsyms_operations
+c0a043a4 r __func__.53739
+c0a043b8 r cgroup_subsys
+c0a043d8 r cgroup_subsys_enabled_key
+c0a043f8 r cgroup_subsys_on_dfl_key
+c0a04418 r cgroup_subsys_name
+c0a04438 r proc_cgroupstats_operations
+c0a044b0 R cgroupns_operations
+c0a044cc R utsns_operations
+c0a044e8 R pidns_operations
+c0a04504 r kernel_config_data
+c0a0bcdc r ikconfig_file_ops
+c0a0bd54 r mode1_syscalls
+c0a0bd68 r jumptable.45708
+c0a0c168 r __func__.45888
+c0a0c178 R bpf_tail_call_proto
+c0a0c198 r __func__.50908
+c0a0c1ac r perf_mmap_vmops
+c0a0c1d8 r perf_fops
+c0a0c250 r if_tokens
+c0a0c290 r pmu_dev_group
+c0a0c2a4 r __func__.24217
+c0a0c2c0 r __func__.24230
+c0a0c2d8 r __func__.24138
+c0a0c2ec r __func__.24193
+c0a0c300 r __func__.24205
 c0a0c340 R generic_file_vm_ops
 c0a0c36c r __func__.32733
 c0a0c380 r fallbacks

+ 288 - 288
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms1.S

@@ -35276,302 +35276,302 @@ kallsyms_offsets:
 	.long	0x9f8000
 	.long	0x9f8000
 	.long	0x9f8010
-	.long	0x9f8068
-	.long	0x9f80f8
-	.long	0x9f8108
-	.long	0x9f8128
-	.long	0x9f8148
-	.long	0x9f8158
-	.long	0x9f8178
-	.long	0x9f8188
-	.long	0x9f8208
-	.long	0x9f8218
-	.long	0x9f82b0
-	.long	0x9f82c4
-	.long	0x9f8330
-	.long	0x9f838c
-	.long	0x9f83a4
-	.long	0x9f83e8
-	.long	0x9f83f8
-	.long	0x9f8414
-	.long	0x9f8428
-	.long	0x9f84a0
-	.long	0x9f84b0
-	.long	0x9f84bc
-	.long	0x9f8564
-	.long	0x9f858c
-	.long	0x9f8634
-	.long	0x9f865c
-	.long	0x9f8684
-	.long	0x9f872c
-	.long	0x9f8754
-	.long	0x9f87fc
-	.long	0x9f8824
-	.long	0x9f88cc
-	.long	0x9f88f4
-	.long	0x9f899c
-	.long	0x9f89c4
-	.long	0x9f8a6c
-	.long	0x9f8a94
-	.long	0x9f8b3c
-	.long	0x9f8b64
-	.long	0x9f8b88
-	.long	0x9f93f4
-	.long	0x9f940c
-	.long	0x9f9484
-	.long	0x9f94a4
-	.long	0x9f94b4
-	.long	0x9f94c0
-	.long	0x9f94c6
-	.long	0x9f94cc
-	.long	0x9f9514
-	.long	0x9f9528
-	.long	0x9f9540
-	.long	0x9f9560
-	.long	0x9f9580
-	.long	0x9f9640
-	.long	0x9f971c
-	.long	0x9f9ec4
+	.long	0x9f806c
+	.long	0x9f8100
+	.long	0x9f8110
+	.long	0x9f8130
+	.long	0x9f8150
+	.long	0x9f8160
+	.long	0x9f8180
+	.long	0x9f8190
+	.long	0x9f8210
+	.long	0x9f8220
+	.long	0x9f82b8
+	.long	0x9f82cc
+	.long	0x9f8338
+	.long	0x9f8394
+	.long	0x9f83ac
+	.long	0x9f83f0
+	.long	0x9f8400
+	.long	0x9f841c
+	.long	0x9f8430
+	.long	0x9f84a8
+	.long	0x9f84b8
+	.long	0x9f84c4
+	.long	0x9f856c
+	.long	0x9f8594
+	.long	0x9f863c
+	.long	0x9f8664
+	.long	0x9f868c
+	.long	0x9f8734
+	.long	0x9f875c
+	.long	0x9f8804
+	.long	0x9f882c
+	.long	0x9f88d4
+	.long	0x9f88fc
+	.long	0x9f89a4
+	.long	0x9f89cc
+	.long	0x9f8a74
+	.long	0x9f8a9c
+	.long	0x9f8b44
+	.long	0x9f8b6c
+	.long	0x9f8b90
+	.long	0x9f93fc
+	.long	0x9f9414
+	.long	0x9f948c
+	.long	0x9f94ac
+	.long	0x9f94bc
+	.long	0x9f94c8
+	.long	0x9f94ce
+	.long	0x9f94d4
+	.long	0x9f951c
+	.long	0x9f9530
+	.long	0x9f9548
+	.long	0x9f9568
+	.long	0x9f9588
+	.long	0x9f9648
+	.long	0x9f9724
 	.long	0x9f9ecc
-	.long	0x9f9f44
-	.long	0x9f9fbc
-	.long	0x9f9fd0
-	.long	0x9f9fe8
-	.long	0x9fa000
-	.long	0x9fa014
-	.long	0x9fa028
-	.long	0x9fa03c
-	.long	0x9fa04c
-	.long	0x9fa064
-	.long	0x9fa080
-	.long	0x9fa094
-	.long	0x9fa0b4
-	.long	0x9fa0c8
-	.long	0x9fa0d8
-	.long	0x9fa0ec
-	.long	0x9fa114
-	.long	0x9fa1e8
-	.long	0x9fa204
-	.long	0x9fa21c
-	.long	0x9fa234
-	.long	0x9fa244
-	.long	0x9fa250
-	.long	0x9fa264
-	.long	0x9fa274
+	.long	0x9f9ed4
+	.long	0x9f9f4c
+	.long	0x9f9fc4
+	.long	0x9f9fd8
+	.long	0x9f9ff0
+	.long	0x9fa008
+	.long	0x9fa01c
+	.long	0x9fa030
+	.long	0x9fa044
+	.long	0x9fa054
+	.long	0x9fa06c
+	.long	0x9fa088
+	.long	0x9fa09c
+	.long	0x9fa0bc
+	.long	0x9fa0d0
+	.long	0x9fa0e0
+	.long	0x9fa0f4
+	.long	0x9fa11c
+	.long	0x9fa1f0
+	.long	0x9fa20c
+	.long	0x9fa224
+	.long	0x9fa23c
+	.long	0x9fa24c
+	.long	0x9fa258
+	.long	0x9fa26c
 	.long	0x9fa27c
-	.long	0x9fa298
-	.long	0x9fa2b0
-	.long	0x9fa2cc
-	.long	0x9fa2e0
-	.long	0x9fa2f4
-	.long	0x9fa30c
-	.long	0x9fa32c
-	.long	0x9fa340
-	.long	0x9fa360
-	.long	0x9fa37c
-	.long	0x9fa38c
-	.long	0x9fa404
-	.long	0x9fa47c
-	.long	0x9fa4f4
-	.long	0x9fa504
-	.long	0x9fa51c
-	.long	0x9fa53c
-	.long	0x9fa560
-	.long	0x9fa57c
-	.long	0x9fa598
-	.long	0x9fa5b8
-	.long	0x9fa5d0
-	.long	0x9fa5e8
-	.long	0x9fa604
-	.long	0x9fa620
-	.long	0x9fa634
-	.long	0x9fa650
-	.long	0x9fa66c
-	.long	0x9fa684
-	.long	0x9fa69c
-	.long	0x9fa6b0
-	.long	0x9fa6c0
-	.long	0x9fa6d0
-	.long	0x9fa6ec
-	.long	0x9fa708
-	.long	0x9fa724
-	.long	0x9fa73c
-	.long	0x9fa750
-	.long	0x9fa764
-	.long	0x9fa77c
-	.long	0x9fa794
-	.long	0x9fa7a8
-	.long	0x9fa7b8
-	.long	0x9fa7d4
-	.long	0x9fa7e4
-	.long	0x9fa7f4
-	.long	0x9fa80c
-	.long	0x9fa82c
-	.long	0x9fa840
-	.long	0x9fa850
-	.long	0x9fa864
-	.long	0x9fa874
-	.long	0x9fa888
-	.long	0x9fa8a0
-	.long	0x9fa8b8
-	.long	0x9fa8cc
-	.long	0x9faeec
-	.long	0x9faf00
-	.long	0x9faf18
-	.long	0x9faf34
-	.long	0x9faf50
-	.long	0x9faf6c
-	.long	0x9faf78
-	.long	0x9faf94
-	.long	0x9fafb0
-	.long	0x9fafd0
-	.long	0x9fafe0
-	.long	0x9fb058
-	.long	0x9fb088
-	.long	0x9fb0a4
-	.long	0x9fb0b4
-	.long	0x9fb0c4
+	.long	0x9fa284
+	.long	0x9fa2a0
+	.long	0x9fa2b8
+	.long	0x9fa2d4
+	.long	0x9fa2e8
+	.long	0x9fa2fc
+	.long	0x9fa314
+	.long	0x9fa334
+	.long	0x9fa348
+	.long	0x9fa368
+	.long	0x9fa384
+	.long	0x9fa394
+	.long	0x9fa40c
+	.long	0x9fa484
+	.long	0x9fa4fc
+	.long	0x9fa50c
+	.long	0x9fa524
+	.long	0x9fa544
+	.long	0x9fa568
+	.long	0x9fa584
+	.long	0x9fa5a0
+	.long	0x9fa5c0
+	.long	0x9fa5d8
+	.long	0x9fa5f0
+	.long	0x9fa60c
+	.long	0x9fa628
+	.long	0x9fa63c
+	.long	0x9fa658
+	.long	0x9fa674
+	.long	0x9fa68c
+	.long	0x9fa6a4
+	.long	0x9fa6b8
+	.long	0x9fa6c8
+	.long	0x9fa6d8
+	.long	0x9fa6f4
+	.long	0x9fa710
+	.long	0x9fa72c
+	.long	0x9fa744
+	.long	0x9fa758
+	.long	0x9fa76c
+	.long	0x9fa784
+	.long	0x9fa79c
+	.long	0x9fa7b0
+	.long	0x9fa7c0
+	.long	0x9fa7dc
+	.long	0x9fa7ec
+	.long	0x9fa7fc
+	.long	0x9fa814
+	.long	0x9fa834
+	.long	0x9fa848
+	.long	0x9fa858
+	.long	0x9fa86c
+	.long	0x9fa87c
+	.long	0x9fa890
+	.long	0x9fa8a8
+	.long	0x9fa8c0
+	.long	0x9fa8d4
+	.long	0x9faef4
+	.long	0x9faf08
+	.long	0x9faf20
+	.long	0x9faf3c
+	.long	0x9faf58
+	.long	0x9faf74
+	.long	0x9faf80
+	.long	0x9faf9c
+	.long	0x9fafb8
+	.long	0x9fafd8
+	.long	0x9fafe8
+	.long	0x9fb060
+	.long	0x9fb090
+	.long	0x9fb0ac
+	.long	0x9fb0bc
 	.long	0x9fb0cc
-	.long	0x9fb0d0
-	.long	0x9fb154
-	.long	0x9fb17c
-	.long	0x9fb18c
-	.long	0x9fb204
-	.long	0x9fb27c
-	.long	0x9fb288
-	.long	0x9fb28c
-	.long	0x9fb2a8
+	.long	0x9fb0d4
+	.long	0x9fb0d8
+	.long	0x9fb15c
+	.long	0x9fb184
+	.long	0x9fb194
+	.long	0x9fb20c
+	.long	0x9fb284
+	.long	0x9fb290
+	.long	0x9fb294
 	.long	0x9fb2b0
-	.long	0x9fb2c8
-	.long	0x9fb2d4
-	.long	0x9fb2e8
-	.long	0x9fb308
-	.long	0x9fb324
-	.long	0x9fb33c
-	.long	0x9fb348
+	.long	0x9fb2b8
+	.long	0x9fb2d0
+	.long	0x9fb2dc
+	.long	0x9fb2f0
+	.long	0x9fb310
+	.long	0x9fb32c
+	.long	0x9fb344
 	.long	0x9fb350
-	.long	0x9fb360
-	.long	0x9fb370
-	.long	0x9fb380
-	.long	0x9fb390
-	.long	0x9fb3a0
-	.long	0x9fb3b0
-	.long	0x9fb3c0
-	.long	0x9fb3d0
-	.long	0x9fb3e0
-	.long	0x9fb3f0
-	.long	0x9fb400
-	.long	0x9fb410
-	.long	0x9fb420
-	.long	0x9fb430
-	.long	0x9fb440
-	.long	0x9fb444
-	.long	0x9fb454
-	.long	0x9fb468
-	.long	0x9fb508
-	.long	0x9fb5a8
-	.long	0x9fb5b8
+	.long	0x9fb358
+	.long	0x9fb368
+	.long	0x9fb378
+	.long	0x9fb388
+	.long	0x9fb398
+	.long	0x9fb3a8
+	.long	0x9fb3b8
+	.long	0x9fb3c8
+	.long	0x9fb3d8
+	.long	0x9fb3e8
+	.long	0x9fb3f8
+	.long	0x9fb408
+	.long	0x9fb418
+	.long	0x9fb428
+	.long	0x9fb438
+	.long	0x9fb448
+	.long	0x9fb44c
+	.long	0x9fb45c
+	.long	0x9fb470
+	.long	0x9fb510
+	.long	0x9fb5b0
 	.long	0x9fb5c0
 	.long	0x9fb5c8
-	.long	0x9fb610
-	.long	0x9fb658
-	.long	0x9fb6a0
-	.long	0x9fb6e8
-	.long	0x9fb730
-	.long	0x9fb740
-	.long	0x9fb7b8
-	.long	0x9fb830
-	.long	0x9fb870
-	.long	0x9fb880
-	.long	0x9fb8f8
-	.long	0x9fb904
-	.long	0x9fb918
-	.long	0x9fb990
-	.long	0x9fba08
-	.long	0x9fba14
-	.long	0x9fba30
-	.long	0x9fba50
-	.long	0x9fbac8
-	.long	0x9fbae8
-	.long	0x9fbb00
-	.long	0x9fbb18
-	.long	0x9fbb24
-	.long	0x9fbb44
-	.long	0x9fbb5c
-	.long	0x9fbb74
-	.long	0x9fbb80
-	.long	0x9fbb98
-	.long	0x9fbc10
-	.long	0x9fbc24
-	.long	0x9fbc38
-	.long	0x9fbc4c
-	.long	0x9fbc74
-	.long	0x9fbcec
-	.long	0x9fbd14
-	.long	0x9fbd34
-	.long	0x9fbd54
-	.long	0x9fbd74
-	.long	0x9fbd88
-	.long	0x9fbda0
-	.long	0x9fbdc4
-	.long	0x9fbdd0
-	.long	0x9fbdec
-	.long	0x9fbe0c
-	.long	0x9fbe28
-	.long	0x9fbe48
-	.long	0x9fbe68
-	.long	0x9fbe7c
-	.long	0x9fbe8c
-	.long	0x9fbe9c
-	.long	0x9fbeb4
-	.long	0x9fbecc
-	.long	0x9fbee8
-	.long	0x9fbefc
-	.long	0x9fbf64
-	.long	0x9fbf70
-	.long	0x9fbf80
-	.long	0x9fbff8
-	.long	0x9fc02c
-	.long	0x9fc0a4
-	.long	0x9fc100
+	.long	0x9fb5d0
+	.long	0x9fb618
+	.long	0x9fb660
+	.long	0x9fb6a8
+	.long	0x9fb6f0
+	.long	0x9fb738
+	.long	0x9fb748
+	.long	0x9fb7c0
+	.long	0x9fb838
+	.long	0x9fb878
+	.long	0x9fb888
+	.long	0x9fb900
+	.long	0x9fb90c
+	.long	0x9fb920
+	.long	0x9fb998
+	.long	0x9fba10
+	.long	0x9fba1c
+	.long	0x9fba38
+	.long	0x9fba58
+	.long	0x9fbad0
+	.long	0x9fbaf0
+	.long	0x9fbb08
+	.long	0x9fbb20
+	.long	0x9fbb2c
+	.long	0x9fbb4c
+	.long	0x9fbb64
+	.long	0x9fbb7c
+	.long	0x9fbb88
+	.long	0x9fbba0
+	.long	0x9fbc18
+	.long	0x9fbc2c
+	.long	0x9fbc40
+	.long	0x9fbc54
+	.long	0x9fbc7c
+	.long	0x9fbcf4
+	.long	0x9fbd1c
+	.long	0x9fbd3c
+	.long	0x9fbd5c
+	.long	0x9fbd7c
+	.long	0x9fbd90
+	.long	0x9fbda8
+	.long	0x9fbdcc
+	.long	0x9fbdd8
+	.long	0x9fbdf4
+	.long	0x9fbe14
+	.long	0x9fbe30
+	.long	0x9fbe50
+	.long	0x9fbe70
+	.long	0x9fbe84
+	.long	0x9fbe94
+	.long	0x9fbea4
+	.long	0x9fbebc
+	.long	0x9fbed4
+	.long	0x9fbef0
+	.long	0x9fbf04
+	.long	0x9fbf6c
+	.long	0x9fbf78
+	.long	0x9fbf88
+	.long	0x9fc000
+	.long	0x9fc034
+	.long	0x9fc0ac
 	.long	0x9fc108
-	.long	0x9fc180
-	.long	0x9fc190
-	.long	0x9fc208
-	.long	0x9fc244
-	.long	0x9fc254
-	.long	0x9fc294
-	.long	0x9fc2bc
-	.long	0x9fc2e0
-	.long	0x9fc2f4
-	.long	0x9fc300
-	.long	0x9fc314
-	.long	0x9fc324
-	.long	0x9fc39c
-	.long	0x9fc3b0
-	.long	0x9fc3d0
-	.long	0x9fc3f0
-	.long	0x9fc410
-	.long	0x9fc430
-	.long	0x9fc4a8
-	.long	0x9fc4c4
-	.long	0x9fc4e0
-	.long	0x9fc4fc
-	.long	0xa03cd4
-	.long	0xa03d4c
-	.long	0xa03d60
-	.long	0xa04160
-	.long	0xa04170
-	.long	0xa04190
-	.long	0xa041a4
-	.long	0xa041d0
-	.long	0xa04248
-	.long	0xa04288
-	.long	0xa0429c
-	.long	0xa042b8
-	.long	0xa042d0
-	.long	0xa042e4
-	.long	0xa042f8
+	.long	0x9fc110
+	.long	0x9fc188
+	.long	0x9fc198
+	.long	0x9fc210
+	.long	0x9fc24c
+	.long	0x9fc25c
+	.long	0x9fc29c
+	.long	0x9fc2c4
+	.long	0x9fc2e8
+	.long	0x9fc2fc
+	.long	0x9fc308
+	.long	0x9fc31c
+	.long	0x9fc32c
+	.long	0x9fc3a4
+	.long	0x9fc3b8
+	.long	0x9fc3d8
+	.long	0x9fc3f8
+	.long	0x9fc418
+	.long	0x9fc438
+	.long	0x9fc4b0
+	.long	0x9fc4cc
+	.long	0x9fc4e8
+	.long	0x9fc504
+	.long	0xa03cdc
+	.long	0xa03d54
+	.long	0xa03d68
+	.long	0xa04168
+	.long	0xa04178
+	.long	0xa04198
+	.long	0xa041ac
+	.long	0xa041d8
+	.long	0xa04250
+	.long	0xa04290
+	.long	0xa042a4
+	.long	0xa042c0
+	.long	0xa042d8
+	.long	0xa042ec
+	.long	0xa04300
 	.long	0xa04340
 	.long	0xa0436c
 	.long	0xa04380

+ 288 - 288
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.tmp_kallsyms2.S

@@ -35276,302 +35276,302 @@ kallsyms_offsets:
 	.long	0x9f8000
 	.long	0x9f8000
 	.long	0x9f8010
-	.long	0x9f8068
-	.long	0x9f80f8
-	.long	0x9f8108
-	.long	0x9f8128
-	.long	0x9f8148
-	.long	0x9f8158
-	.long	0x9f8178
-	.long	0x9f8188
-	.long	0x9f8208
-	.long	0x9f8218
-	.long	0x9f82b0
-	.long	0x9f82c4
-	.long	0x9f8330
-	.long	0x9f838c
-	.long	0x9f83a4
-	.long	0x9f83e8
-	.long	0x9f83f8
-	.long	0x9f8414
-	.long	0x9f8428
-	.long	0x9f84a0
-	.long	0x9f84b0
-	.long	0x9f84bc
-	.long	0x9f8564
-	.long	0x9f858c
-	.long	0x9f8634
-	.long	0x9f865c
-	.long	0x9f8684
-	.long	0x9f872c
-	.long	0x9f8754
-	.long	0x9f87fc
-	.long	0x9f8824
-	.long	0x9f88cc
-	.long	0x9f88f4
-	.long	0x9f899c
-	.long	0x9f89c4
-	.long	0x9f8a6c
-	.long	0x9f8a94
-	.long	0x9f8b3c
-	.long	0x9f8b64
-	.long	0x9f8b88
-	.long	0x9f93f4
-	.long	0x9f940c
-	.long	0x9f9484
-	.long	0x9f94a4
-	.long	0x9f94b4
-	.long	0x9f94c0
-	.long	0x9f94c6
-	.long	0x9f94cc
-	.long	0x9f9514
-	.long	0x9f9528
-	.long	0x9f9540
-	.long	0x9f9560
-	.long	0x9f9580
-	.long	0x9f9640
-	.long	0x9f971c
-	.long	0x9f9ec4
+	.long	0x9f806c
+	.long	0x9f8100
+	.long	0x9f8110
+	.long	0x9f8130
+	.long	0x9f8150
+	.long	0x9f8160
+	.long	0x9f8180
+	.long	0x9f8190
+	.long	0x9f8210
+	.long	0x9f8220
+	.long	0x9f82b8
+	.long	0x9f82cc
+	.long	0x9f8338
+	.long	0x9f8394
+	.long	0x9f83ac
+	.long	0x9f83f0
+	.long	0x9f8400
+	.long	0x9f841c
+	.long	0x9f8430
+	.long	0x9f84a8
+	.long	0x9f84b8
+	.long	0x9f84c4
+	.long	0x9f856c
+	.long	0x9f8594
+	.long	0x9f863c
+	.long	0x9f8664
+	.long	0x9f868c
+	.long	0x9f8734
+	.long	0x9f875c
+	.long	0x9f8804
+	.long	0x9f882c
+	.long	0x9f88d4
+	.long	0x9f88fc
+	.long	0x9f89a4
+	.long	0x9f89cc
+	.long	0x9f8a74
+	.long	0x9f8a9c
+	.long	0x9f8b44
+	.long	0x9f8b6c
+	.long	0x9f8b90
+	.long	0x9f93fc
+	.long	0x9f9414
+	.long	0x9f948c
+	.long	0x9f94ac
+	.long	0x9f94bc
+	.long	0x9f94c8
+	.long	0x9f94ce
+	.long	0x9f94d4
+	.long	0x9f951c
+	.long	0x9f9530
+	.long	0x9f9548
+	.long	0x9f9568
+	.long	0x9f9588
+	.long	0x9f9648
+	.long	0x9f9724
 	.long	0x9f9ecc
-	.long	0x9f9f44
-	.long	0x9f9fbc
-	.long	0x9f9fd0
-	.long	0x9f9fe8
-	.long	0x9fa000
-	.long	0x9fa014
-	.long	0x9fa028
-	.long	0x9fa03c
-	.long	0x9fa04c
-	.long	0x9fa064
-	.long	0x9fa080
-	.long	0x9fa094
-	.long	0x9fa0b4
-	.long	0x9fa0c8
-	.long	0x9fa0d8
-	.long	0x9fa0ec
-	.long	0x9fa114
-	.long	0x9fa1e8
-	.long	0x9fa204
-	.long	0x9fa21c
-	.long	0x9fa234
-	.long	0x9fa244
-	.long	0x9fa250
-	.long	0x9fa264
-	.long	0x9fa274
+	.long	0x9f9ed4
+	.long	0x9f9f4c
+	.long	0x9f9fc4
+	.long	0x9f9fd8
+	.long	0x9f9ff0
+	.long	0x9fa008
+	.long	0x9fa01c
+	.long	0x9fa030
+	.long	0x9fa044
+	.long	0x9fa054
+	.long	0x9fa06c
+	.long	0x9fa088
+	.long	0x9fa09c
+	.long	0x9fa0bc
+	.long	0x9fa0d0
+	.long	0x9fa0e0
+	.long	0x9fa0f4
+	.long	0x9fa11c
+	.long	0x9fa1f0
+	.long	0x9fa20c
+	.long	0x9fa224
+	.long	0x9fa23c
+	.long	0x9fa24c
+	.long	0x9fa258
+	.long	0x9fa26c
 	.long	0x9fa27c
-	.long	0x9fa298
-	.long	0x9fa2b0
-	.long	0x9fa2cc
-	.long	0x9fa2e0
-	.long	0x9fa2f4
-	.long	0x9fa30c
-	.long	0x9fa32c
-	.long	0x9fa340
-	.long	0x9fa360
-	.long	0x9fa37c
-	.long	0x9fa38c
-	.long	0x9fa404
-	.long	0x9fa47c
-	.long	0x9fa4f4
-	.long	0x9fa504
-	.long	0x9fa51c
-	.long	0x9fa53c
-	.long	0x9fa560
-	.long	0x9fa57c
-	.long	0x9fa598
-	.long	0x9fa5b8
-	.long	0x9fa5d0
-	.long	0x9fa5e8
-	.long	0x9fa604
-	.long	0x9fa620
-	.long	0x9fa634
-	.long	0x9fa650
-	.long	0x9fa66c
-	.long	0x9fa684
-	.long	0x9fa69c
-	.long	0x9fa6b0
-	.long	0x9fa6c0
-	.long	0x9fa6d0
-	.long	0x9fa6ec
-	.long	0x9fa708
-	.long	0x9fa724
-	.long	0x9fa73c
-	.long	0x9fa750
-	.long	0x9fa764
-	.long	0x9fa77c
-	.long	0x9fa794
-	.long	0x9fa7a8
-	.long	0x9fa7b8
-	.long	0x9fa7d4
-	.long	0x9fa7e4
-	.long	0x9fa7f4
-	.long	0x9fa80c
-	.long	0x9fa82c
-	.long	0x9fa840
-	.long	0x9fa850
-	.long	0x9fa864
-	.long	0x9fa874
-	.long	0x9fa888
-	.long	0x9fa8a0
-	.long	0x9fa8b8
-	.long	0x9fa8cc
-	.long	0x9faeec
-	.long	0x9faf00
-	.long	0x9faf18
-	.long	0x9faf34
-	.long	0x9faf50
-	.long	0x9faf6c
-	.long	0x9faf78
-	.long	0x9faf94
-	.long	0x9fafb0
-	.long	0x9fafd0
-	.long	0x9fafe0
-	.long	0x9fb058
-	.long	0x9fb088
-	.long	0x9fb0a4
-	.long	0x9fb0b4
-	.long	0x9fb0c4
+	.long	0x9fa284
+	.long	0x9fa2a0
+	.long	0x9fa2b8
+	.long	0x9fa2d4
+	.long	0x9fa2e8
+	.long	0x9fa2fc
+	.long	0x9fa314
+	.long	0x9fa334
+	.long	0x9fa348
+	.long	0x9fa368
+	.long	0x9fa384
+	.long	0x9fa394
+	.long	0x9fa40c
+	.long	0x9fa484
+	.long	0x9fa4fc
+	.long	0x9fa50c
+	.long	0x9fa524
+	.long	0x9fa544
+	.long	0x9fa568
+	.long	0x9fa584
+	.long	0x9fa5a0
+	.long	0x9fa5c0
+	.long	0x9fa5d8
+	.long	0x9fa5f0
+	.long	0x9fa60c
+	.long	0x9fa628
+	.long	0x9fa63c
+	.long	0x9fa658
+	.long	0x9fa674
+	.long	0x9fa68c
+	.long	0x9fa6a4
+	.long	0x9fa6b8
+	.long	0x9fa6c8
+	.long	0x9fa6d8
+	.long	0x9fa6f4
+	.long	0x9fa710
+	.long	0x9fa72c
+	.long	0x9fa744
+	.long	0x9fa758
+	.long	0x9fa76c
+	.long	0x9fa784
+	.long	0x9fa79c
+	.long	0x9fa7b0
+	.long	0x9fa7c0
+	.long	0x9fa7dc
+	.long	0x9fa7ec
+	.long	0x9fa7fc
+	.long	0x9fa814
+	.long	0x9fa834
+	.long	0x9fa848
+	.long	0x9fa858
+	.long	0x9fa86c
+	.long	0x9fa87c
+	.long	0x9fa890
+	.long	0x9fa8a8
+	.long	0x9fa8c0
+	.long	0x9fa8d4
+	.long	0x9faef4
+	.long	0x9faf08
+	.long	0x9faf20
+	.long	0x9faf3c
+	.long	0x9faf58
+	.long	0x9faf74
+	.long	0x9faf80
+	.long	0x9faf9c
+	.long	0x9fafb8
+	.long	0x9fafd8
+	.long	0x9fafe8
+	.long	0x9fb060
+	.long	0x9fb090
+	.long	0x9fb0ac
+	.long	0x9fb0bc
 	.long	0x9fb0cc
-	.long	0x9fb0d0
-	.long	0x9fb154
-	.long	0x9fb17c
-	.long	0x9fb18c
-	.long	0x9fb204
-	.long	0x9fb27c
-	.long	0x9fb288
-	.long	0x9fb28c
-	.long	0x9fb2a8
+	.long	0x9fb0d4
+	.long	0x9fb0d8
+	.long	0x9fb15c
+	.long	0x9fb184
+	.long	0x9fb194
+	.long	0x9fb20c
+	.long	0x9fb284
+	.long	0x9fb290
+	.long	0x9fb294
 	.long	0x9fb2b0
-	.long	0x9fb2c8
-	.long	0x9fb2d4
-	.long	0x9fb2e8
-	.long	0x9fb308
-	.long	0x9fb324
-	.long	0x9fb33c
-	.long	0x9fb348
+	.long	0x9fb2b8
+	.long	0x9fb2d0
+	.long	0x9fb2dc
+	.long	0x9fb2f0
+	.long	0x9fb310
+	.long	0x9fb32c
+	.long	0x9fb344
 	.long	0x9fb350
-	.long	0x9fb360
-	.long	0x9fb370
-	.long	0x9fb380
-	.long	0x9fb390
-	.long	0x9fb3a0
-	.long	0x9fb3b0
-	.long	0x9fb3c0
-	.long	0x9fb3d0
-	.long	0x9fb3e0
-	.long	0x9fb3f0
-	.long	0x9fb400
-	.long	0x9fb410
-	.long	0x9fb420
-	.long	0x9fb430
-	.long	0x9fb440
-	.long	0x9fb444
-	.long	0x9fb454
-	.long	0x9fb468
-	.long	0x9fb508
-	.long	0x9fb5a8
-	.long	0x9fb5b8
+	.long	0x9fb358
+	.long	0x9fb368
+	.long	0x9fb378
+	.long	0x9fb388
+	.long	0x9fb398
+	.long	0x9fb3a8
+	.long	0x9fb3b8
+	.long	0x9fb3c8
+	.long	0x9fb3d8
+	.long	0x9fb3e8
+	.long	0x9fb3f8
+	.long	0x9fb408
+	.long	0x9fb418
+	.long	0x9fb428
+	.long	0x9fb438
+	.long	0x9fb448
+	.long	0x9fb44c
+	.long	0x9fb45c
+	.long	0x9fb470
+	.long	0x9fb510
+	.long	0x9fb5b0
 	.long	0x9fb5c0
 	.long	0x9fb5c8
-	.long	0x9fb610
-	.long	0x9fb658
-	.long	0x9fb6a0
-	.long	0x9fb6e8
-	.long	0x9fb730
-	.long	0x9fb740
-	.long	0x9fb7b8
-	.long	0x9fb830
-	.long	0x9fb870
-	.long	0x9fb880
-	.long	0x9fb8f8
-	.long	0x9fb904
-	.long	0x9fb918
-	.long	0x9fb990
-	.long	0x9fba08
-	.long	0x9fba14
-	.long	0x9fba30
-	.long	0x9fba50
-	.long	0x9fbac8
-	.long	0x9fbae8
-	.long	0x9fbb00
-	.long	0x9fbb18
-	.long	0x9fbb24
-	.long	0x9fbb44
-	.long	0x9fbb5c
-	.long	0x9fbb74
-	.long	0x9fbb80
-	.long	0x9fbb98
-	.long	0x9fbc10
-	.long	0x9fbc24
-	.long	0x9fbc38
-	.long	0x9fbc4c
-	.long	0x9fbc74
-	.long	0x9fbcec
-	.long	0x9fbd14
-	.long	0x9fbd34
-	.long	0x9fbd54
-	.long	0x9fbd74
-	.long	0x9fbd88
-	.long	0x9fbda0
-	.long	0x9fbdc4
-	.long	0x9fbdd0
-	.long	0x9fbdec
-	.long	0x9fbe0c
-	.long	0x9fbe28
-	.long	0x9fbe48
-	.long	0x9fbe68
-	.long	0x9fbe7c
-	.long	0x9fbe8c
-	.long	0x9fbe9c
-	.long	0x9fbeb4
-	.long	0x9fbecc
-	.long	0x9fbee8
-	.long	0x9fbefc
-	.long	0x9fbf64
-	.long	0x9fbf70
-	.long	0x9fbf80
-	.long	0x9fbff8
-	.long	0x9fc02c
-	.long	0x9fc0a4
-	.long	0x9fc100
+	.long	0x9fb5d0
+	.long	0x9fb618
+	.long	0x9fb660
+	.long	0x9fb6a8
+	.long	0x9fb6f0
+	.long	0x9fb738
+	.long	0x9fb748
+	.long	0x9fb7c0
+	.long	0x9fb838
+	.long	0x9fb878
+	.long	0x9fb888
+	.long	0x9fb900
+	.long	0x9fb90c
+	.long	0x9fb920
+	.long	0x9fb998
+	.long	0x9fba10
+	.long	0x9fba1c
+	.long	0x9fba38
+	.long	0x9fba58
+	.long	0x9fbad0
+	.long	0x9fbaf0
+	.long	0x9fbb08
+	.long	0x9fbb20
+	.long	0x9fbb2c
+	.long	0x9fbb4c
+	.long	0x9fbb64
+	.long	0x9fbb7c
+	.long	0x9fbb88
+	.long	0x9fbba0
+	.long	0x9fbc18
+	.long	0x9fbc2c
+	.long	0x9fbc40
+	.long	0x9fbc54
+	.long	0x9fbc7c
+	.long	0x9fbcf4
+	.long	0x9fbd1c
+	.long	0x9fbd3c
+	.long	0x9fbd5c
+	.long	0x9fbd7c
+	.long	0x9fbd90
+	.long	0x9fbda8
+	.long	0x9fbdcc
+	.long	0x9fbdd8
+	.long	0x9fbdf4
+	.long	0x9fbe14
+	.long	0x9fbe30
+	.long	0x9fbe50
+	.long	0x9fbe70
+	.long	0x9fbe84
+	.long	0x9fbe94
+	.long	0x9fbea4
+	.long	0x9fbebc
+	.long	0x9fbed4
+	.long	0x9fbef0
+	.long	0x9fbf04
+	.long	0x9fbf6c
+	.long	0x9fbf78
+	.long	0x9fbf88
+	.long	0x9fc000
+	.long	0x9fc034
+	.long	0x9fc0ac
 	.long	0x9fc108
-	.long	0x9fc180
-	.long	0x9fc190
-	.long	0x9fc208
-	.long	0x9fc244
-	.long	0x9fc254
-	.long	0x9fc294
-	.long	0x9fc2bc
-	.long	0x9fc2e0
-	.long	0x9fc2f4
-	.long	0x9fc300
-	.long	0x9fc314
-	.long	0x9fc324
-	.long	0x9fc39c
-	.long	0x9fc3b0
-	.long	0x9fc3d0
-	.long	0x9fc3f0
-	.long	0x9fc410
-	.long	0x9fc430
-	.long	0x9fc4a8
-	.long	0x9fc4c4
-	.long	0x9fc4e0
-	.long	0x9fc4fc
-	.long	0xa03cd4
-	.long	0xa03d4c
-	.long	0xa03d60
-	.long	0xa04160
-	.long	0xa04170
-	.long	0xa04190
-	.long	0xa041a4
-	.long	0xa041d0
-	.long	0xa04248
-	.long	0xa04288
-	.long	0xa0429c
-	.long	0xa042b8
-	.long	0xa042d0
-	.long	0xa042e4
-	.long	0xa042f8
+	.long	0x9fc110
+	.long	0x9fc188
+	.long	0x9fc198
+	.long	0x9fc210
+	.long	0x9fc24c
+	.long	0x9fc25c
+	.long	0x9fc29c
+	.long	0x9fc2c4
+	.long	0x9fc2e8
+	.long	0x9fc2fc
+	.long	0x9fc308
+	.long	0x9fc31c
+	.long	0x9fc32c
+	.long	0x9fc3a4
+	.long	0x9fc3b8
+	.long	0x9fc3d8
+	.long	0x9fc3f8
+	.long	0x9fc418
+	.long	0x9fc438
+	.long	0x9fc4b0
+	.long	0x9fc4cc
+	.long	0x9fc4e8
+	.long	0x9fc504
+	.long	0xa03cdc
+	.long	0xa03d54
+	.long	0xa03d68
+	.long	0xa04168
+	.long	0xa04178
+	.long	0xa04198
+	.long	0xa041ac
+	.long	0xa041d8
+	.long	0xa04250
+	.long	0xa04290
+	.long	0xa042a4
+	.long	0xa042c0
+	.long	0xa042d8
+	.long	0xa042ec
+	.long	0xa04300
 	.long	0xa04340
 	.long	0xa0436c
 	.long	0xa04380

+ 1 - 1
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/.version

@@ -1 +1 @@
-34
+35

+ 37 - 8
board-support/linux-4.9.59+gitAUTOINC+a75d8e9305-ga75d8e9305/arch/arm/boot/dts/.am335x-evm.dtb.dts.tmp

@@ -1204,6 +1204,7 @@
    0x1B4 (((1 << 5) | (1 << 3)) | 7)
 
 
+   0x088 (((1 << 5) | (1 << 3)) | 7)
    0x08C (((1 << 3)) | 7)
    0x0A0 (((1 << 3)) | 7)
    0x0A4 (((1 << 3)) | 7)
@@ -1213,7 +1214,11 @@
    0x0B4 (((1 << 3)) | 7)
    0x0E8 (((1 << 5) | (1 << 3)) | 7)
    0x0E0 (((1 << 3)) | 7)
+   0x0EC (((1 << 3)) | 7)
 
+
+   0x1A0 (((1 << 3)) | 7)
+   0x1A4 (((1 << 3)) | 7)
    0x1A8 (((1 << 3)) | 7)
   >;
  };
@@ -1259,7 +1264,7 @@
    0x164 (0 | 1)
   >;
  };
-# 136 "arch/arm/boot/dts/am335x-evm.dts"
+# 141 "arch/arm/boot/dts/am335x-evm.dts"
  clkout2_pin: pinmux_clkout2_pin {
   pinctrl-single,pins = <
    0x1b4 (0 | 3)
@@ -1383,7 +1388,15 @@
    0x17C (((1 << 5)) | 2)
   >;
  };
-# 280 "arch/arm/boot/dts/am335x-evm.dts"
+# 284 "arch/arm/boot/dts/am335x-evm.dts"
+ spi1_pins: spi1_pins {
+                pinctrl-single,pins = <
+                        ((((0x990)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 3)
+                        ((((0x994)) & 0xffff) - (0x0800)) (((1 << 5) | (1 << 4)) | 3)
+                        ((((0x998)) & 0xffff) - (0x0800)) (((1 << 4)) | 3)
+                        ((((0x99C)) & 0xffff) - (0x0800)) (((1 << 4)) | 3)
+                >;
+        };
 };
 
 
@@ -1415,7 +1428,7 @@
 
  status = "okay";
 };
-# 319 "arch/arm/boot/dts/am335x-evm.dts"
+# 331 "arch/arm/boot/dts/am335x-evm.dts"
 &i2c0 {
  pinctrl-names = "default";
  pinctrl-0 = <&i2c0_pins>;
@@ -1479,14 +1492,14 @@
 &elm {
  status = "okay";
 };
-# 403 "arch/arm/boot/dts/am335x-evm.dts"
+# 415 "arch/arm/boot/dts/am335x-evm.dts"
 &gpmc {
  status = "okay";
  pinctrl-names = "default", "sleep";
  pinctrl-0 = <&nandflash_pins_default>;
  pinctrl-1 = <&nandflash_pins_sleep>;
 
- ranges = <0 0 0x08000000 0x80000000>;
+ ranges = <0 0 0x08000000 0x40000000>;
  nand@0,0 {
   compatible = "ti,omap2-nand";
   reg = <0 0 4>;
@@ -1580,7 +1593,7 @@
   };
   partition@13 {
    label = "Storage";
-   reg = <0x0A200000 0x75E00000>;
+   reg = <0x0A200000 0x35E00000>;
   };
  };
 };
@@ -1665,7 +1678,7 @@
   };
  };
 };
-# 509 "arch/arm/boot/dts/am335x-evm.dts" 2
+# 521 "arch/arm/boot/dts/am335x-evm.dts" 2
 
 &tps {
  vcc1-supply = <&vbat>;
@@ -1764,7 +1777,7 @@
   phy-mode = "mii";
 
 };
-# 615 "arch/arm/boot/dts/am335x-evm.dts"
+# 628 "arch/arm/boot/dts/am335x-evm.dts"
 &tscadc {
  status = "okay";
 
@@ -1811,3 +1824,19 @@
  pinctrl-names = "default";
  pinctrl-0 = <&dcan0_pins_default>;
 };
+# 689 "arch/arm/boot/dts/am335x-evm.dts"
+&spi1 {
+        status = "okay";
+        pinctrl-names = "default";
+        pinctrl-0 = <&spi1_pins>;
+        qca7000@0 {
+                compatible = "qca,qca7000";
+                reg = <0>;
+                interrupt-parent = <&gpio2>;
+                interrupts = <0 1>;
+                spi-cpha;
+                spi-cpol;
+                spi-max-frequency = <10000000>;
+                qca,legacy-mode = <0>;
+        };
+};

Some files were not shown because too many files changed in this diff