|
@@ -33,11 +33,12 @@
|
|
|
#include "MessageHandler.h"
|
|
|
#include "sqlite3.h"
|
|
|
|
|
|
+
|
|
|
+
|
|
|
#ifndef SPEC_LATEST_SUPPORTED
|
|
|
#define SPEC_LATEST_SUPPORTED 13
|
|
|
#endif
|
|
|
|
|
|
-
|
|
|
#define Debug
|
|
|
|
|
|
#define PASS 1
|
|
@@ -52,7 +53,6 @@ pthread_t pid;
|
|
|
extern int server_sign;
|
|
|
|
|
|
extern void CheckSystemValue(void);
|
|
|
-
|
|
|
extern int FirstHeartBeatResponse(void);
|
|
|
extern void OCPP_get_TableAuthlocalAllData(void);
|
|
|
extern int TransactionMessageAttemptsGet(void);
|
|
@@ -101,6 +101,9 @@ static int TransactionQueueInterval = 10;
|
|
|
static int TransactionQueueNum = 0;
|
|
|
static int OfflineTransactionQueueNum = 0;
|
|
|
static int OfflineTransaction = 0;
|
|
|
+static int IsUsing = FALSE;
|
|
|
+static int IsFinished = FALSE;
|
|
|
+
|
|
|
int defaultWaitingTime = 10;
|
|
|
char OcppPath[160]={0};
|
|
|
char OcppProtocol[10]={0},OcppHost[50]={0}, OcppTempPath[50]={0};
|
|
@@ -865,24 +868,6 @@ if(fp == NULL) {
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
-#if 0
|
|
|
-if(fgetc(fp)==EOF)
|
|
|
-{
|
|
|
-
|
|
|
- fclose(fp);
|
|
|
- memset(rmFileCmd, 0, sizeof rmFileCmd);
|
|
|
- if((access("/Storage/OCPP/TransactionRelatedQueue",F_OK))!=-1)
|
|
|
- {
|
|
|
- sprintf(rmFileCmd,"rm -f %s","/Storage/OCPP/TransactionRelatedQueue");
|
|
|
- system(rmFileCmd);
|
|
|
- }
|
|
|
-
|
|
|
- result = FALSE;
|
|
|
-
|
|
|
- return result;
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
if( fgets (str, 1200, fp)!=NULL ) {
|
|
|
|
|
|
|
|
@@ -1525,25 +1510,47 @@ void CheckTransactionPacket(char *uuid)
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
int queue_operation(int type, char *frontUUID, char *frontData)
|
|
|
{
|
|
|
-
|
|
|
- pthread_mutex_unlock(&lock_sentData);
|
|
|
- pthread_mutex_lock(&lock_sentData);
|
|
|
int result=0;
|
|
|
- if(type == 0)
|
|
|
- result = showqueue();
|
|
|
- else if(type == 1)
|
|
|
- result = showfront(frontUUID, frontData);
|
|
|
- else if(type == 2)
|
|
|
- result = delq();
|
|
|
- else if(type == 3)
|
|
|
- result = sentqueue();
|
|
|
- else if(type == 4)
|
|
|
- result = addq(frontUUID, frontData);
|
|
|
-
|
|
|
- pthread_mutex_unlock(&lock_sentData);
|
|
|
+ while(1)
|
|
|
+ {
|
|
|
+ if (!IsUsing )
|
|
|
+ {
|
|
|
+ IsUsing = TRUE;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(type == 0)
|
|
|
+ {
|
|
|
+ result = showqueue();
|
|
|
+ }
|
|
|
+ else if(type == 1)
|
|
|
+ {
|
|
|
+ result = showfront(frontUUID, frontData);
|
|
|
+ }
|
|
|
+ else if(type == 2)
|
|
|
+ {
|
|
|
+ result = delq();
|
|
|
+ }
|
|
|
+ else if(type == 3)
|
|
|
+ {
|
|
|
+ result = sentqueue();
|
|
|
+ }
|
|
|
+ else if(type == 4)
|
|
|
+ {
|
|
|
+ result = addq(frontUUID, frontData);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ IsUsing = FALSE;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
return result;
|
|
|
}
|