فهرست منبع

Merge branch 'master' into BYTON-GB

FolusWen 4 سال پیش
والد
کامیت
42d0182248
1فایلهای تغییر یافته به همراه117 افزوده شده و 32 حذف شده
  1. 117 32
      EVSE/Modularization/ocppfiles/MessageHandler.c

+ 117 - 32
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -2549,6 +2549,7 @@ void CheckSystemValue(void)
 
 	char filenmae[100]={0};
 	char str[100]={0};
+	int tempIndex = 0;
 
 	//===============================
 	// send Heartbeat
@@ -2653,15 +2654,26 @@ void CheckSystemValue(void)
 
 		if(gunType[gun_index] == 'J')
 		{
+
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+
 			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
 			{
-				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
 				{
-					if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != ChademoPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn != ChademoPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != ChademoPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
+					if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != ChademoPreviousSystemStatus[gun_index]) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn != ChademoPreviousConnectorPlugIn[gun_index]) )
 					{
 						//PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus;
-						ChademoPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus;
-						ChademoPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn;
+						ChademoPreviousSystemStatus[gun_index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus;
+						ChademoPreviousConnectorPlugIn[gun_index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn;
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
 						statusModeChage[gun_index] = TRUE;
 					}
@@ -2678,15 +2690,26 @@ void CheckSystemValue(void)
 		}
 		else if((gunType[gun_index] == 'U')||(gunType[gun_index] == 'E'))
 		{
+
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+
 			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
-				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
 				{
-					if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn != CcsPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
+					if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[gun_index]) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn != CcsPreviousConnectorPlugIn[gun_index]) )//if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
 					{
 						//PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus;
-						CcsPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus;
-						CcsPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn;
+						CcsPreviousSystemStatus[gun_index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus;
+						CcsPreviousConnectorPlugIn[gun_index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn;
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
 						statusModeChage[gun_index] = TRUE;
 					}
@@ -2703,15 +2726,26 @@ void CheckSystemValue(void)
 		}
 		else if(gunType[gun_index] == 'G')
 		{
+
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+
 			for (int index = 0; index < GB_QUANTITY; index++)
 			{
-				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
 				{
-					if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != GbPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn != GbPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != GbPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
+					if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != GbPreviousSystemStatus[gun_index]) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn != GbPreviousConnectorPlugIn[gun_index]) )
 					{
 						//PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus;
-						GbPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus;
-						GbPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn;
+						GbPreviousSystemStatus[gun_index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus;
+						GbPreviousConnectorPlugIn[gun_index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn;
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
 						statusModeChage[gun_index] = TRUE;
 					}
@@ -2729,15 +2763,25 @@ void CheckSystemValue(void)
 		}
 		else
 		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+
 			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
 				{
-					if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != AcPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState != AcPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != AcPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
+					if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != AcPreviousSystemStatus[gun_index]) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState != AcPreviousConnectorPlugIn[gun_index]) )
 					{
 						//PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus;
-						AcPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus;
-						AcPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState;
+						AcPreviousSystemStatus[gun_index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus;
+						AcPreviousConnectorPlugIn[gun_index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState;
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
 						statusModeChage[gun_index] = TRUE;
 					}
@@ -2775,10 +2819,20 @@ void CheckSystemValue(void)
 		//check Transaction active
 		if(gunType[gun_index] == 'J')
 		{
+
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
 			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
 			{
 				// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
-				if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)
+				if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
 				{
 					if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_CHARGING)
 					{
@@ -2790,7 +2844,7 @@ void CheckSystemValue(void)
 					}
 				}
 
-				if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index) && (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) // complete
+				if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex) && (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) // complete
 				{
 					sprintf(filenmae,"/Storage/OCPP/TxProfile_%d.json",(gun_index+1));
 					if((access(filenmae,F_OK))!=-1)
@@ -2806,10 +2860,21 @@ void CheckSystemValue(void)
 		}
 		else if((gunType[gun_index] == 'U')||(gunType[gun_index] == 'E'))
 		{
+
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+
 			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
 				// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
-				if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)
+				if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
 				{
 					if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_CHARGING)
 					{
@@ -2821,7 +2886,7 @@ void CheckSystemValue(void)
 					}
 				}
 
-				if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index) && (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) // complete
+				if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex) && (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) // complete
 				{
 					sprintf(filenmae,"/Storage/OCPP/TxProfile_%d.json",(gun_index+1));
 					if((access(filenmae,F_OK))!=-1)
@@ -2835,10 +2900,20 @@ void CheckSystemValue(void)
 		}
 		else if(gunType[gun_index] == 'G')
 		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+
 			for (int index = 0; index < GB_QUANTITY; index++)
 			{
 				// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
-				if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)
+				if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
 				{
 					if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_CHARGING)
 					{
@@ -2850,7 +2925,7 @@ void CheckSystemValue(void)
 					}
 				}
 
-				if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index) && (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) // complete
+				if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex) && (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) // complete
 				{
 					sprintf(filenmae,"/Storage/OCPP/TxProfile_%d.json",(gun_index+1));
 					if((access(filenmae,F_OK))!=-1)
@@ -2864,10 +2939,20 @@ void CheckSystemValue(void)
 		}
 		else
 		{
+
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
 			for (int index = 0; index < AC_QUANTITY; index++)
 			{
 				// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
-				if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)
+				if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
 				{
 					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_CHARGING)
 					{
@@ -2879,7 +2964,7 @@ void CheckSystemValue(void)
 					}
 				}
 
-				if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) // complete
+				if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex) && (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_COMPLETE)) // complete
 				{
 					sprintf(filenmae,"/Storage/OCPP/TxProfile_%d.json",(gun_index+1));
 					if((access(filenmae,F_OK))!=-1)
@@ -3566,14 +3651,14 @@ S_FAULT                 =12
 	//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DCcc
 	if(gunType[gun_index] == 'J')
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
-		}
-		else
-		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
 		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
 		{