瀏覽代碼

[New feature][Modularization][Module_OcppBackend / WebService]

2020.09.30 / Folus Wen

Actions:
1. EVSE/Modularization/WebService.c flash access method modify.
2. EVSE/Projects/define.h add OCPP key enum for California pricing requirement.
3. EVSE/Modularization/ocppfiles/MessageHandler.c add keys(DefaultPrice, CustomDisplayCostAndPrice, CustomIdleFeeAfterStop) for California pricing requirement.
4. EVSE/Modularization/ocppfiles/MessageHandler.c handleDataTransferRequest() add parsing custom message id(SetUserPrice, RunningCost, FinalCost) for California pricing requirement.

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 4 年之前
父節點
當前提交
1592b1be09

+ 51 - 36
EVSE/Modularization/WebService.c

@@ -107,6 +107,27 @@ int WriteLogMsg(const char *fmt, ...) {
 }
 #endif
 
+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 DiffTimeb(struct timeb ST, struct timeb ET) {
 	//return milli-second
 	unsigned int StartTime, StopTime;
@@ -279,53 +300,47 @@ int StoreUsrConfigData(struct SysConfigData *UsrData)
 	{
 		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);
 
-		memcpy(	BufTmp+MtdBlockSize-4,&Chk,4);
-
-		fd = open("/dev/mtdblock10", O_RDWR);
-
-		if (fd>0)
+		// Output configuration to file.
+		fd = open("/mnt/EvseConfig.bin", O_RDWR|O_CREAT);
+		if (fd < 0)
 		{
-			wrd=write(fd, BufTmp, MtdBlockSize);
-			close(fd);
-			if(wrd>=MtdBlockSize)
-			{
-				fd = open("/dev/mtdblock11", O_RDWR);
-				if (fd>0)
-				{
-					wrd=write(fd, BufTmp, MtdBlockSize);
-					close(fd);
-					if(wrd<MtdBlockSize)
-					{
-						DEBUG_ERROR("write /dev/mtdblock11(backup) NG\r\n");
-						result = FAIL;
-					}
-				}
-				else
-				{
-					DEBUG_ERROR("open /dev/mtdblock11(backup) NG\r\n");
-					result = FAIL;
-				}
-			}
-			else
-			{
-				DEBUG_ERROR("write /dev/mtdblock10 NG\r\n");
-				result = FAIL;
-			}
+			DEBUG_ERROR("open /mnt/EvseConfig.bin NG\n");
+
+			free(BufTmp);
+			return 0;
 		}
-		else
+		wrd=write(fd, BufTmp, MtdBlockSize);
+		close(fd);
+		if(wrd<MtdBlockSize)
 		{
-			DEBUG_ERROR("open /dev/mtdblock10 NG\r\n");
-			result = FAIL;
+			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 12");
+		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 12");
+		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;
+    		result = FAIL;
 	}
 
 	if(BufTmp!=NULL)

+ 237 - 50
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -105,10 +105,8 @@ static struct OCPPAuthLocalElemet
 // OCPP HeartBeat Response Not Receive Counts
 //============================================
 static int HeartBeatWithNOResponse = 0;
-static int HeartBeatCountPerHour = 0;
 
 extern void  ChageWebSocketPingInterval(int WebSocketPingInterval);
-extern int GetTransactionQueueNum(void);
 extern struct Charger_Info Charger;
 extern sqlite3 *db;
 
@@ -3318,12 +3316,6 @@ int sendStartTransactionRequest(int gun_index)
 	strcpy(queuedata, message);
 	queue_operation(QUEUE_OPERATION_ADD, guid, queuedata );//addq(guid, queuedata); ---> remove temporally
 
-	/*
-	if(GetTransactionQueueNum() == 1)
-	{
-		LWS_Send(message + 2);
-	}*/
-
 	return result;
 }
 
@@ -4585,11 +4577,6 @@ int sendStopTransactionRequest(int gun_index)
 	}
 #endif
 	queue_operation(QUEUE_OPERATION_ADD, guid, queuedata );//addq(guid, queuedata); ---> remove temporally
-/*
-	if(GetTransactionQueueNum() == 1)
-	{
-		LWS_Send(queuedata+2);
-	}*/
 
 	//----------------------------replace queue StopTransaction TransactionId ---------------------------//
 	//int gettransactionId = GetTransactionId(gun_index+1, ShmOCPP16Data->StopTransaction[gun_index].IdTag);
@@ -5481,12 +5468,6 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 		queue_operation(QUEUE_OPERATION_ADD, guid, queuedata );//addq(guid, queuedata);  ---> remove temporally
 	else
 		LWS_Send(queuedata +2);
-/*
-	if(GetTransactionQueueNum() == 1)
-	{
-		LWS_Send(queuedata +2);
-
-	}*/
 
 	return result;
 }
@@ -7316,6 +7297,68 @@ int handleDataTransferRequest(char *uuid, char *payload)
 
 			sprintf(message,"[%d,\"%s\",%s]",MESSAGE_TYPE_CALLRESULT, uuid, json_object_to_json_string(response));
 		}
+		else if(strstr(tempmessageId, "SetUserPrice") != NULL)
+		{
+			json_object *data;
+			data = json_tokener_parse(tempdata);
+			if(!is_error(data))
+			{
+				if(json_object_object_get(data, "idToken") != NULL)
+					DEBUG_INFO("idToken: %s\n", json_object_get_string(json_object_object_get(data, "idToken")));
+
+				if(json_object_object_get(data, "price") != NULL)
+					DEBUG_INFO("price: %s\n", json_object_get_string(json_object_object_get(data, "price")));
+
+				json_object_object_add(response, "status", json_object_new_string("Accepted"));
+			}
+			else
+			{
+				json_object_object_add(response, "status", json_object_new_string("Rejected"));
+				json_object_object_add(response, "data", json_object_new_string("Configuration content something wrong."));
+			}
+			json_object_put(data);
+		}
+		else if(strstr(tempmessageId, "RunningCost") != NULL)
+		{
+			json_object *data;
+			data = json_tokener_parse(tempdata);
+			if(!is_error(data))
+			{
+				if(json_object_object_get(data, "txId") != NULL)
+
+				if(json_object_object_get(data, "description") != NULL)
+					DEBUG_INFO("description: %s\n", json_object_get_string(json_object_object_get(data, "description")));
+
+				json_object_object_add(response, "status", json_object_new_string("Accepted"));
+			}
+			else
+			{
+				json_object_object_add(response, "status", json_object_new_string("Rejected"));
+				json_object_object_add(response, "data", json_object_new_string("Configuration content something wrong."));
+			}
+			json_object_put(data);
+		}
+		else if(strstr(tempmessageId, "FinalCost") != NULL)
+		{
+			json_object *data;
+			data = json_tokener_parse(tempdata);
+			if(!is_error(data))
+			{
+				if(json_object_object_get(data, "txId") != NULL)
+					DEBUG_INFO("transaction id: %d\n", json_object_get_int(json_object_object_get(data, "txId")));
+
+				if(json_object_object_get(data, "description") != NULL)
+					DEBUG_INFO("description: %s\n", json_object_get_string(json_object_object_get(data, "description")));
+
+				json_object_object_add(response, "status", json_object_new_string("Accepted"));
+			}
+			else
+			{
+				json_object_object_add(response, "status", json_object_new_string("Rejected"));
+				json_object_object_add(response, "data", json_object_new_string("Configuration content something wrong."));
+			}
+			json_object_put(data);
+		}
 		else
 		{
 			// Can not find valid message id
@@ -10856,40 +10899,11 @@ void handleHeartbeatResponse(char *payload, int gun_index)
 	memset(timebuf, 0, ARRAY_SIZE(timebuf));
 	sprintf(timebuf,"date -s '%s'",buf);
 	system(timebuf);
+
 	//==============================================
 	// RTC sync
 	//==============================================
 	system("/sbin/hwclock -w --systohc");
-
-	//===============================================
-	//Print Out HeartBeat log
-	//===============================================
-	{
-		double diff_t;
-		struct tm tp,tp1;
-
-		// BootNotification Receive Time
-
-		strptime((const char *)ShmOCPP16Data->BootNotification.ResponseCurrentTime, "%Y-%m-%dT%H:%M:%S", &tp);
-		tp.tm_isdst = -1;
-		time_t BootNotificationReceiveTime = mktime(&tp);
-
-		//HeartBeat Receive Time
-		strptime((const char *)ShmOCPP16Data->Heartbeat.ResponseCurrentTime, "%Y-%m-%dT%H:%M:%S", &tp1);
-		tp1.tm_isdst = -1;
-		time_t HeartBeatReceiveTime = mktime(&tp1);
-
-		diff_t = difftime(HeartBeatReceiveTime, BootNotificationReceiveTime);
-
-		DEBUG_INFO("handleHeartbeatResponse differnt time=%f..\n",diff_t);
-
-		if(((int)diff_t / 3600) > HeartBeatCountPerHour)
-		{
-			HeartBeatCountPerHour =  (int)diff_t / 3600;
-			DEBUG_INFO("handleHeartbeatResponse ...\n");
-			DEBUG_INFO("After 1 hour, It will print out Heartbeat.\n");
-		}
-	}
 }
 
 void handleMeterValuesResponse(char *payload, int gun_index)
@@ -11347,6 +11361,27 @@ int initialConfigurationTable(void)
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","SecurityProfile", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData);
 
+		// DefaultPrice
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemName, "DefaultPrice");
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData, "" );
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","DefaultPrice", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData);
+
+		// CustomDisplayCostAndPrice
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemName, "CustomDisplayCostAndPrice");
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemData, "FALSE" );
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","CustomDisplayCostAndPrice", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemData);
+
+		// CustomIdleFeeAfterStop
+		ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemAccessibility = 1;
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemName, "CustomIdleFeeAfterStop");
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemData, "FALSE" );
+
+		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","CustomIdleFeeAfterStop", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemData);
+
 		//* Local Auth List Management Profile*/
 		#if 0
 			//For OCTT Test Case
@@ -11716,6 +11751,24 @@ int initialConfigurationTable(void)
 				sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData, "%d", atoi(valuestr) );
 			}
 
+			if(strcmp(keystr, "DefaultPrice") == 0)
+			{
+				ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+				sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData, "%s", valuestr);
+			}
+
+			if(strcmp(keystr, "CustomDisplayCostAndPrice") == 0)
+			{
+				ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+				sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemData, "%s", valuestr);
+			}
+
+			if(strcmp(keystr, "CustomIdleFeeAfterStop") == 0)
+			{
+				ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
+				sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemData, "%s", valuestr);
+			}
+
 			if(strcmp(keystr, "LocalAuthListEnabled") == 0)
 			{
 				ShmOCPP16Data->ConfigurationTable.LocalAuthListManagementProfile[LocalAuthListEnabled].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
@@ -12135,6 +12188,33 @@ void StoreConfigurationTable(void)
 
 	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","SecurityProfile", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData);
 
+	// DefaultPrice
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemName, "DefaultPrice");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData, "" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","DefaultPrice", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData);
+
+	// CustomDisplayCostAndPrice
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemName, "CustomDisplayCostAndPrice");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemData, "FALSE" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","CustomDisplayCostAndPrice", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemData);
+
+	// CustomIdleFeeAfterStop
+	/*
+	ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemAccessibility = 1;
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemName, "CustomIdleFeeAfterStop");
+	strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemData, "FALSE" );
+	*/
+
+	fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","CustomIdleFeeAfterStop", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemData);
+
 	//* Local Auth List Management Profile*/
 	//LocalAuthListEnabled
 	/*
@@ -12905,6 +12985,61 @@ void getKeyValue(char *keyReq)
 			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_SecurityProfile].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[SecurityProfile].ItemData );
 			  isKnowKey = TRUE;
 		  }
+
+	      if(isEmpty ||  strcmp(keyReq, "DefaultPrice") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_DefaultPrice].Item, "DefaultPrice");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_DefaultPrice].Key, "DefaultPrice");
+
+			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_DefaultPrice].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_DefaultPrice].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_DefaultPrice].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData );
+			  isKnowKey = TRUE;
+		  }
+
+	      if(isEmpty ||  strcmp(keyReq, "CustomDisplayCostAndPrice") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_CustomDisplayCostAndPrice].Item, "CustomDisplayCostAndPrice");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CustomDisplayCostAndPrice].Key, "CustomDisplayCostAndPrice");
+
+			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CustomDisplayCostAndPrice].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CustomDisplayCostAndPrice].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CustomDisplayCostAndPrice].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemData );
+			  isKnowKey = TRUE;
+		  }
+
+	      if(isEmpty ||  strcmp(keyReq, "CustomIdleFeeAfterStop") == 0 )
+		  {
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_CustomIdleFeeAfterStop].Item, "CustomIdleFeeAfterStop");
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CustomIdleFeeAfterStop].Key, "CustomIdleFeeAfterStop");
+
+			  if(ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemAccessibility == 1)
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CustomIdleFeeAfterStop].ReadOnly, "0"/*"FALSE"*/);
+			  }
+			  else
+			  {
+				  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CustomIdleFeeAfterStop].ReadOnly, "1"/*"TRUE"*/);
+			  }
+
+			  strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_CustomIdleFeeAfterStop].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemData );
+			  isKnowKey = TRUE;
+		  }
+
 #if 1
 	      if(isEmpty ||  strcmp(keyReq, "LocalAuthListEnabled") == 0 )
 	      {
@@ -13936,6 +14071,59 @@ int setKeyValue(char *key, char *value)
     	}
     }
 
+    if(strcmp(key, "DefaultPrice") == 0)
+    {
+    	if((ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemAccessibility == 1))
+    	{
+    		strcpy(str, (const char*)value);
+    		sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[DefaultPrice].ItemData, "%s", str);
+    		isSuccess = ConfigurationStatus_Accepted;
+    	}
+    	else
+    	{
+    	    isSuccess = ConfigurationStatus_Rejected;
+    	}
+    }
+
+    if(strcmp(key, "CustomDisplayCostAndPrice") == 0)
+    {
+    	if(ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemAccessibility == 1)
+		{
+			strcpy(str, (const char*)value);
+			for(int i = 0; str[i]; i++)
+			{
+			   str[i] = tolower(str[i]);
+			}
+			//Charger.QueueOffLineStartTransactionMessage = (value.toLowerCase().equals("true")?true:false);
+			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomDisplayCostAndPrice].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
+			isSuccess = ConfigurationStatus_Accepted;
+		}
+		else
+	   {
+		isSuccess = ConfigurationStatus_Rejected;
+	   }
+
+    }
+
+    if(strcmp(key, "CustomIdleFeeAfterStop") == 0)
+    {
+    	if(ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemAccessibility == 1)
+		{
+			strcpy(str, (const char*)value);
+			for(int i = 0; str[i]; i++)
+			{
+			   str[i] = tolower(str[i]);
+			}
+			//Charger.QueueOffLineStartTransactionMessage = (value.toLowerCase().equals("true")?true:false);
+			sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[CustomIdleFeeAfterStop].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
+			isSuccess = ConfigurationStatus_Accepted;
+		}
+		else
+	   {
+		isSuccess = ConfigurationStatus_Rejected;
+	   }
+
+    }
 #if 0
     //For OCPP Test Case
     if(strcmp(key, "LocalAuthorizationListEnabled") == 0)
@@ -15920,7 +16108,6 @@ void InitialSystemValue(void)
 
 	//Hear Beat
 	HeartBeatWithNOResponse = 0;
-	HeartBeatCountPerHour = 0;
 	HeartBeatWaitTime = atoi((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[HeartbeatInterval].ItemData);;
 	FirstHeartBeat = 0;
 

+ 3 - 0
EVSE/Modularization/ocppfiles/MessageHandler.h

@@ -389,6 +389,9 @@ enum GetConfigurationKey {
 	GetConfiguration_QueueOffLineStartTransactionMessage,
 	GetConfiguration_AuthorizationKey,
 	GetConfiguration_SecurityProfile,
+	GetConfiguration_DefaultPrice,
+	GetConfiguration_CustomDisplayCostAndPrice,
+	GetConfiguration_CustomIdleFeeAfterStop,
 	GetConfiguration_LocalAuthListEnabled,
 	GetConfiguration_LocalAuthListMaxLength,
 	GetConfiguration_SendLocalListMaxLength,

+ 4 - 1
EVSE/Projects/define.h

@@ -263,6 +263,9 @@ enum CoreProfile {
 	 QueueOffLineStartTransactionMessage,
 	 AuthorizationKey,
 	 SecurityProfile,
+	 DefaultPrice,
+	 CustomDisplayCostAndPrice,
+	 CustomIdleFeeAfterStop,
 	 _CoreProfile_CNT
 };
 
@@ -3846,7 +3849,7 @@ struct OCPP16ConfigurationItem
 struct OCPP16ConfigurationTable
 {
 	//please refer to OCPP 1.6 chapter 9
-	struct OCPP16ConfigurationItem 			CoreProfile[37];
+	struct OCPP16ConfigurationItem 			CoreProfile[_CoreProfile_CNT];
 	struct OCPP16ConfigurationItem 			LocalAuthListManagementProfile[3];
 	struct OCPP16ConfigurationItem 			ReservationProfile[1];
 	struct OCPP16ConfigurationItem 			SmartChargingProfile[5];