소스 검색

2020-02-06 / Kathy Yeh
1. modify StatusNotification VendorErrorCode
2. modify Cancel Reservation Confirm resent error
3. rewite StopTransaction . MeterValues logic
4. modify some memset error

Kathy_Yeh 5 년 전
부모
커밋
6510731456
2개의 변경된 파일600개의 추가작업 그리고 729개의 파일을 삭제
  1. 588 632
      EVSE/Modularization/ocppfiles/MessageHandler.c
  2. 12 97
      EVSE/Modularization/ocppfiles/Module_OcppBackend.c

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 588 - 632
EVSE/Modularization/ocppfiles/MessageHandler.c


+ 12 - 97
EVSE/Modularization/ocppfiles/Module_OcppBackend.c

@@ -37,14 +37,6 @@
 #include	"sqlite3.h"
 #include	"sqlite3.h"
 
 
 
 
-
-
-#if 0
-#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)
-#endif
-
 #define Debug
 #define Debug
 //#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
 //#define ARRAY_SIZE(A)		(sizeof(A) / sizeof(A[0]))
 #define PASS				1
 #define PASS				1
@@ -71,7 +63,7 @@ extern int GetOcppConnStatus(void);
 extern void SetOcppConnStatus(uint8_t status);
 extern void SetOcppConnStatus(uint8_t status);
 extern int GetHeartBeatWithNOResponse(void);
 extern int GetHeartBeatWithNOResponse(void);
 extern void SetHeartBeatWithNOResponse(void);
 extern void SetHeartBeatWithNOResponse(void);
-extern int InternetDisconnect(void);
+//extern int InternetDisconnect(void);
 
 
 pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
 pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
 pthread_mutex_t lock_sentData = PTHREAD_MUTEX_INITIALIZER;
 pthread_mutex_t lock_sentData = PTHREAD_MUTEX_INITIALIZER;
@@ -358,7 +350,7 @@ int SendData(struct lws *wsi)
 
 
     memcpy (out + LWS_SEND_BUFFER_PRE_PADDING, SendBuffer, len );
     memcpy (out + LWS_SEND_BUFFER_PRE_PADDING, SendBuffer, len );
 
 
-    DEBUG_OCPPMESSAGE_INFO("\n===> %s\n", out + LWS_SEND_BUFFER_PRE_PADDING);
+    DEBUG_OCPPMESSAGE_INFO(" SendData= %s\n", out + LWS_SEND_BUFFER_PRE_PADDING);
     n = lws_write(wsi, out + LWS_SEND_BUFFER_PRE_PADDING, len, LWS_WRITE_TEXT);
     n = lws_write(wsi, out + LWS_SEND_BUFFER_PRE_PADDING, len, LWS_WRITE_TEXT);
 
 
     memset(SendBuffer, 0, len);
     memset(SendBuffer, 0, len);
@@ -465,7 +457,7 @@ static int OCPP16Callback(struct lws *wsi, enum lws_callback_reasons reason, voi
 			break;
 			break;
 		case LWS_CALLBACK_CLIENT_RECEIVE://8
 		case LWS_CALLBACK_CLIENT_RECEIVE://8
 			((char *)in)[len] = '\0';
 			((char *)in)[len] = '\0';
-			DEBUG_OCPPMESSAGE_INFO("\n<=== %s\n", (char *)in);
+			DEBUG_OCPPMESSAGE_INFO("Original Receive %s\n", (char *)in);
 			char tempin[1024*4]={0};
 			char tempin[1024*4]={0};
 			int c = 0;
 			int c = 0;
 			char *loc;
 			char *loc;
@@ -677,7 +669,7 @@ else
 	system(rmFileCmd);
 	system(rmFileCmd);
 }
 }
 
 
-memset(&rmFileCmd, 0, sizeof rmFileCmd);
+memset(rmFileCmd, 0, sizeof rmFileCmd);
 
 
 if((access("../Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
 if((access("../Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
 {
 {
@@ -714,7 +706,7 @@ if( fgets (str, 1200, fp)!=NULL ) {
 	{
 	{
 		DEBUG_INFO("It is a blank line");
 		DEBUG_INFO("It is a blank line");
 		fclose(fp);
 		fclose(fp);
-		memset(&rmFileCmd, 0, sizeof rmFileCmd);
+		memset(rmFileCmd, 0, sizeof rmFileCmd);
 		sprintf(rmFileCmd,"rm -f %s","../Storage/OCPP/TransactionRelatedQueue");
 		sprintf(rmFileCmd,"rm -f %s","../Storage/OCPP/TransactionRelatedQueue");
 		system(rmFileCmd);
 		system(rmFileCmd);
 		result = FALSE;
 		result = FALSE;
@@ -797,7 +789,7 @@ else
 	system(rmFileCmd);
 	system(rmFileCmd);
 }
 }
 
 
-memset(&rmFileCmd, 0, sizeof rmFileCmd);
+memset(rmFileCmd, 0, sizeof rmFileCmd);
 
 
 if((access("../Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
 if((access("../Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
 {
 {
@@ -888,7 +880,7 @@ else
 	system(rmFileCmd);
 	system(rmFileCmd);
 }
 }
 
 
-memset(&rmFileCmd, 0, sizeof rmFileCmd);
+memset(rmFileCmd, 0, sizeof rmFileCmd);
 
 
 if((access("../Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
 if((access("../Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
 {
 {
@@ -1022,7 +1014,7 @@ else
 	system(rmFileCmd);
 	system(rmFileCmd);
 }
 }
 
 
-memset(&rmFileCmd, 0, sizeof rmFileCmd);
+memset(rmFileCmd, 0, sizeof rmFileCmd);
 
 
 if((access("../Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
 if((access("../Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
 {
 {
@@ -1094,7 +1086,7 @@ else
 	system(rmFileCmd);
 	system(rmFileCmd);
 }
 }
 
 
-memset(&rmFileCmd, 0, sizeof rmFileCmd);
+memset(rmFileCmd, 0, sizeof rmFileCmd);
 
 
 /* opening file for reading */
 /* opening file for reading */
 fp = fopen("../Storage/OCPP/TransactionRelatedQueue" , "r");
 fp = fopen("../Storage/OCPP/TransactionRelatedQueue" , "r");
@@ -1122,85 +1114,8 @@ else
 fclose(fp);
 fclose(fp);
 DEBUG_INFO("sentqueue end\n");
 DEBUG_INFO("sentqueue end\n");
 return result;
 return result;
-
-
-#if 0
-	pnode  p;
-	p = front;
-
-	printf("sentqueue\n");
-	while(p)
-	{
-		printf("uuid: %s data: %s\n", p->uuid, p->data);
-		LWS_Send(p->data);
-		p = p->next;
-	}
-	printf("sentqueue end\n");
-	return 0;
-#endif
 }
 }
 
 
-#if 0
-int storequeue(){
-
-	//write queue to flash
-	unsigned int i,Chk;
-	unsigned char *ptr = NULL;
-	int fd,wrd;
-
-	// Save factory default setting value to flash backup setting block
-	fd = open("./Storage/OCPP/queue.txt", O_RDWR);
-	if (fd < 0)
-	{
-		#ifdef SystemLogMessage
-		DEBUG_ERROR("open ./Storage/OCPP/queue.txt NG");
-		#endif
-		//free(ptr);
-		return 0;
-	}
-	wrd=write(fd, &front, sizeof(node));
-
-	if(wrd!=(sizeof(node)))
-	{
-			#ifdef SystemLogMessage
-			DEBUG_ERROR("write ./Storage/OCPP/queue.txt NG");
-			#endif
-			//free(ptr);
-			return 0;
-	}
-	close(fd);
-	close(wrd);
-
-	return 0;
-}
-
-int readfiletoqueue(){
-	 FILE *infile;
-	 //pnode  p = (pnode )malloc(sizeof(node));
-
-	 struct _node Pnode;
-	 memset(&Pnode, 0, sizeof(node));
-	 // Open person.dat for reading
-	 infile = fopen ("./Storage/OCPP/queue.txt", "r");
-	 if (infile == NULL)
-	 {
-		 fprintf(stderr, "\nError opening file\n");
-	     exit (1);
-	 }
-
-	 // read file contents till end of file
-	 while(fread(&Pnode, sizeof(node), 1, infile))
-	 printf ("uuid = %s name = %s\n", Pnode.uuid,
-			 Pnode.data);
-
-	 // close file
-	 fclose (infile);
-	// free(p);
-
-	 return 0;
-}
-#endif
-
 //
 //
 void* processTransactionQueue(void* data) {
 void* processTransactionQueue(void* data) {
 	char frontUUID[100] ={0};
 	char frontUUID[100] ={0};
@@ -1346,7 +1261,7 @@ else
 	system(rmFileCmd);
 	system(rmFileCmd);
 }
 }
 
 
-memset(&rmFileCmd, 0, sizeof rmFileCmd);
+memset(rmFileCmd, 0, sizeof rmFileCmd);
 
 
 if((access("../Storage/OCPP/MessageSent",F_OK))!=-1)
 if((access("../Storage/OCPP/MessageSent",F_OK))!=-1)
 {
 {
@@ -1354,7 +1269,7 @@ if((access("../Storage/OCPP/MessageSent",F_OK))!=-1)
 	sprintf(rmFileCmd,"rm -f %s","../Storage/OCPP/MessageSent");
 	sprintf(rmFileCmd,"rm -f %s","../Storage/OCPP/MessageSent");
 	system(rmFileCmd);
 	system(rmFileCmd);
 }
 }
-memset(&rmFileCmd, 0, sizeof rmFileCmd);
+memset(rmFileCmd, 0, sizeof rmFileCmd);
 return 0;
 return 0;
 }
 }
 
 
@@ -1392,7 +1307,7 @@ int main(void)
 		system(rmFileCmd);
 		system(rmFileCmd);
 	}
 	}
 
 
-	memset(&rmFileCmd, 0, sizeof rmFileCmd);
+	memset(rmFileCmd, 0, sizeof rmFileCmd);
 
 
 	//Create Process: Resend Transaction
 	//Create Process: Resend Transaction
 	pthread_create(&t, NULL, processTransactionQueue, NULL); //
 	pthread_create(&t, NULL, processTransactionQueue, NULL); //

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.