Bläddra i källkod

[Improve][Modularization][Module_OcppBackend / Module_OcppBackend20]

2021.03.24 / Folus Wen

Actions:
1. Force sync cache to flash when access important file.

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 år sedan
förälder
incheckning
b56a5bdd1e

+ 7 - 6
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -10653,7 +10653,7 @@ end:
 	}
 
 	sendChangeAvailabilityConfirmation(uuid, (gunIndex==0?gunIndex:gunIndex-1));
-
+	system("fsync -d /dev/mtdblock13");
 	return result;
 }
 
@@ -10692,6 +10692,7 @@ int handleClearCacheRequest(char *uuid, char *payload)
     }
 
     sendClearCacheConfirmation(uuid);
+    system("fsync -d /dev/mtdblock13");
 
 	return result;
 }
@@ -11290,7 +11291,7 @@ end:
 
 
 	sendClearChargingProfileConfirmation(uuid, comfirmstr);
-
+	system("fsync -d /dev/mtdblock13");
 	return result;
 }
 
@@ -11674,7 +11675,7 @@ int handleDeleteCertificateRequest(char *uuid, char *payload)
 	json_object_put(DeleteCertificate);
 
 	sendDeleteCertificateConfirmation(uuid);
-
+	system("fsync -d /dev/mtdblock13");
 	return result;
 }
 
@@ -12582,7 +12583,7 @@ int handleInstallCertificateRequest(char *uuid, char *payload)
 	 */
 	strcpy((char*)ShmOCPP20Data->InstallCertificate.Response_status, InstallCertificateStatusEnumTypeStr[GenericStatusEnumType_Accepted]);
 	sendInstallCertificateConfirmation(uuid);
-
+	system("fsync -d /dev/mtdblock13");
 	return result;
 }
 
@@ -13785,7 +13786,7 @@ int handleSendLocalListRequest(char *uuid, char *payload)
 
 end:
 	sendSendLocalListConfirmation(uuid);
-
+	system("fsync -d /dev/mtdblock13");
 	return result;
 }
 
@@ -14124,7 +14125,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
 	}
 
 	sendSetChargingProfileConfirmation(uuid, (gun_index==0?gun_index:gun_index-1));
-
+	system("fsync -d /dev/mtdblock13");
 	return result;
 }
 

+ 2 - 2
EVSE/Modularization/ocpp20/Module_OcppBackend20.c

@@ -654,8 +654,8 @@ int addq(char *uuid, char *data)
 		OfflineTransactionQueueNum = OfflineTransactionQueueNum + 1;
 	}
 	DEBUG_INFO("add queue end\n");
+	system("fsync -d /dev/mtdblock13");
 	return FALSE;
-
 }
 
 int delq()
@@ -773,7 +773,7 @@ int delq()
 
 		DEBUG_INFO("delq() end\n");
 	}
-
+	system("fsync -d /dev/mtdblock13");
 	return 0;
 }
 

+ 9 - 4
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -6842,7 +6842,7 @@ end:
 	}
 
 	sendChangeAvailabilityConfirmation(uuid, comfirmstr);
-
+	system("fsync -d /dev/mtdblock13");
 	return result;
 }
 
@@ -6947,7 +6947,7 @@ int handleClearCacheRequest(char *uuid, char *payload)
     }
 
     sendClearCacheConfirmation(uuid, comfirmstr);
-
+    system("fsync -d /dev/mtdblock13");
     return result;
 }
 
@@ -7504,6 +7504,7 @@ end:
 	}
 
 	sendClearChargingProfileConfirmation(uuid, comfirmstr);
+	system("fsync -d /dev/mtdblock13");
 
 	return result;
 }
@@ -10554,6 +10555,7 @@ end:
 	}
 
 	sendSetChargingProfileConfirmation(uuid, comfirmstr);
+	system("fsync -d /dev/mtdblock13");
 	return result;
 }
 
@@ -11262,7 +11264,6 @@ void handleStartTransactionResponse(char *payload, int gun_index)
 
 	if(!is_error(StartTransaction))
 	{
-
 		// Required data
 		sprintf((char *)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status, "%s", json_object_get_string(json_object_object_get(json_object_object_get(StartTransaction,"idTagInfo"), "status")));
 		ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId  = json_object_get_int(json_object_object_get(StartTransaction,"transactionId"));
@@ -11311,6 +11312,7 @@ void handleStartTransactionResponse(char *payload, int gun_index)
 	DEBUG_INFO("idTagInfo-parentIdTag: %s\n", ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ParentIdTag);
 	DEBUG_INFO("idTagInfo-status: %s\n", ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.Status);
 	DEBUG_INFO("transactionId: %d\n", ShmOCPP16Data->StartTransaction[gun_index].ResponseTransactionId);
+	system("fsync -d /dev/mtdblock13");
 }
 
 void handleStatusNotificationResponse(char *payload, int gun_index)
@@ -12656,6 +12658,7 @@ void StoreConfigurationTable(void)
 
 	fclose(outfile);
 
+	system("fsync -d /dev/mtdblock13");
 }
 
 void getKeyValue(char *keyReq)
@@ -14677,7 +14680,7 @@ int setKeyValue(char *key, char *value)
             isSuccess = ConfigurationStatus_Rejected;
        }
     }
-
+    system("fsync -d /dev/mtdblock13");
 
     return isSuccess;
 }
@@ -16465,6 +16468,7 @@ void storeTempStopTransaction(int gun_index)
 	fputs(queuedata, outfile);
 	fputs("\n", outfile);
 	fclose (outfile);
+	system("fsync -d /dev/mtdblock13");
 }
 
 void checkTempStopTransaction(int gun_index)
@@ -16528,6 +16532,7 @@ void checkTempStopTransaction(int gun_index)
 	// fptr1=freopen(NULL,"w",fptr1); // reset the fptr1 again
 	fclose(fptr1);
 	remove(TempStopTransaction);  		// remove the original file
+	system("fsync -d /dev/mtdblock13");
 }
 
 void FillStartTransaction(int ConnectorId, unsigned char IdTag[], int MeterStart,int ReservationId,unsigned char Timestamp[])

+ 2 - 0
EVSE/Modularization/ocppfiles/Module_OcppBackend.c

@@ -711,6 +711,7 @@ int addq(char *uuid, char *data)
 		OfflineTransactionQueueNum = OfflineTransactionQueueNum + 1;
 	}
 	DEBUG_INFO("add queue end\n");
+	system("fsync -d /dev/mtdblock13");
 	return FALSE;
 
 }
@@ -832,6 +833,7 @@ int delq()
 		DEBUG_INFO("delq() end\n");
 	}
 
+	system("fsync -d /dev/mtdblock13");
 	return 0;
 }