Эх сурвалжийг харах

2022-02-19 / Simon Xue

Action
1. [fix]Page trun to plugin page and then trun to Authorzie fail when swift
credit card fail.
2. [fix]Line status 1 or 2 finsih timeout trun to select gun page.
3. [fix]Don't cancel PreAuth when press return in plugin page.
4. [fix]Don't cancel PreAuth when Precharge timeout .
5. [fix]Reduct problem.
6. [Modify] Swift card only once.

Files
As the commit history files

Image Version: 2.04.XX.XXXX.XX
Simon Xue 3 жил өмнө
parent
commit
8a28a5114d

+ 58 - 38
EVSE/Projects/DD360Tcci/Apps/CSU/RFID.c

@@ -17,6 +17,7 @@ static SelectGunInfo *ShmSelectGunInfo          = NULL;
 static struct SysInfoData *pSysInfo 			= NULL;
 #define PREAUTHMONEY	1000
 bool isDeductDb_ready;
+static RecordTransactionInfo LocalTransactionInfo;
 //------------------------------------------------------------------------------
 static char *rfidPortName = "/dev/ttyS2";
 
@@ -245,7 +246,6 @@ static void UserScanFunction(void)
             StartSystemTimeoutDet(Timeout_Authorizing);
             AuthorizingStart();
 			pDcChargingInfo->SystemStatus = S_AUTHORIZING;
-			AuthorizingStart();
 
             // LCM => Authorizing
             //pSysInfo->SystemPage = _PAGE_AUTHORIZE;
@@ -277,28 +277,19 @@ void AuthorizeToCharge()
     ShmDcCommonData = (DcCommonInfo *)GetShmDcCommonData();
     if(isAuthorizedComplete())
     {
-       // StopSystemTimeoutDet();
-        //StartSystemTimeoutDet(Timeout_WaitBalance);
-       // if (ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance != FAIL_BALANCE_PRICES) {
-        //    StopSystemTimeoutDet();
-            // 判斷後台回覆狀態
-            if (canStartCharging()) {
-            // LCM => Authorize complete
-            	//pDcChargingInfo->SystemStatus = S_AUTHORIZING;
-                //pSysInfo->SystemPage = _PAGE_PLUGIN;
-                //log_info("Wait Gun(%d) plugin",pSysInfo->CurGunSelected);
-                DetectPluginStart();
-                if (ShmDcCommonData->AuthPass_flag[pSysInfo->CurGunSelected] == TRUE) {
-                    pSysInfo->SystemPage = _PAGE_PLUGIN;
-                }
-                //log_info("Gun(%d) Balance: %f",pSysInfo->CurGunSelected,
-                //        ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance);
-            } else {
-                log_info("LCM => Authorize fail");
-                pSysInfo->SystemPage = _PAGE_AUTHORIZE_FAIL;
-                strcpy((char *)pSysConfig->UserId, "");
+        if (canStartCharging()) {
+
+            DetectPluginStart();
+            if (ShmDcCommonData->AuthPass_flag[pSysInfo->CurGunSelected] == TRUE && 
+                ShmDcCommonData->TradeCancel == FALSE) {
+                pSysInfo->SystemPage = _PAGE_PLUGIN;
             }
-        //}
+
+        } else {
+            log_info("LCM => Authorize fail");
+            pSysInfo->SystemPage = _PAGE_AUTHORIZE_FAIL;
+            strcpy((char *)pSysConfig->UserId, "");
+        }
         ClearAuthorizedFlag();
     }
 }
@@ -326,8 +317,6 @@ void ScannerCardProcess(void)
     } else if (pSysInfo->SystemPage == _PAGE_AUTHORIZE_FAIL) {
         StartSystemTimeoutDet(Timeout_VerifyFail);
         isCardScan = false;
-    } else if ( pSysInfo->SystemPage == _PAGE_PLUGIN) {
-        StartSystemTimeoutDet(Timeout_WaitPlug);
     } else {
         isCardScan = false;
     }
@@ -335,26 +324,43 @@ void ScannerCardProcess(void)
 
 void WritePayResult(int result ,uint8_t gunIndex)
 {
-	ShmDcCommonData->TransactionInfo[gunIndex].Amount = ShmDcCommonData->finalcost[gunIndex];
-	memcpy(ShmDcCommonData->TransactionInfo[gunIndex].ApprovalNo , ShmDcCommonData->pCreditCard[gunIndex].ApprovalNo,9);
-	memcpy(ShmDcCommonData->TransactionInfo[gunIndex].CardNo , ShmDcCommonData->pCreditCard[gunIndex].CardNo,20);
+	ShmDcCommonData->TransactionInfo[gunIndex].Amount = LocalTransactionInfo.Amount;
+	memcpy(ShmDcCommonData->TransactionInfo[gunIndex].ApprovalNo , LocalTransactionInfo.ApprovalNo,9);
+	memcpy(ShmDcCommonData->TransactionInfo[gunIndex].CardNo , LocalTransactionInfo.CardNo,20);
 	ShmDcCommonData->TransactionInfo[gunIndex].DeductResult = result;
-	ShmDcCommonData->TransactionInfo[gunIndex].IsDonateInvoice = ShmDcCommonData->donate_flag[gunIndex];
-	ShmDcCommonData->TransactionInfo[gunIndex].TransactionId = ShmSelectGunInfo->PricesInfo[gunIndex].TransactionId;
-	memcpy(&ShmDcCommonData->TransactionInfo[gunIndex].VemData,&ShmDcCommonData->pCreditCard[gunIndex].VemData,64);
-
+	ShmDcCommonData->TransactionInfo[gunIndex].IsDonateInvoice = LocalTransactionInfo.IsDonateInvoice;
+	ShmDcCommonData->TransactionInfo[gunIndex].TransactionId = LocalTransactionInfo.TransactionId;
+	memcpy(ShmDcCommonData->TransactionInfo[gunIndex].VemData, LocalTransactionInfo.VemData,64);
+
+    log_info("Gun[%d] TransactionId:%d DeductResult:%d IsDonateInvoice:%d Amount:%f",
+        gunIndex, ShmDcCommonData->TransactionInfo[gunIndex].TransactionId,
+        ShmDcCommonData->TransactionInfo[gunIndex].DeductResult,
+        ShmDcCommonData->TransactionInfo[gunIndex].IsDonateInvoice,
+        ShmDcCommonData->TransactionInfo[gunIndex].Amount);
+}
+void storePayResult(uint8_t gunIndex)
+{
+    memset(&LocalTransactionInfo, 0, sizeof(RecordTransactionInfo));
+    LocalTransactionInfo.Amount = ShmDcCommonData->finalcost[gunIndex];
+    memcpy(LocalTransactionInfo.ApprovalNo, ShmDcCommonData->pCreditCard[gunIndex].ApprovalNo, 9);
+    memcpy(LocalTransactionInfo.CardNo, ShmDcCommonData->pCreditCard[gunIndex].CardNo, 20);
+    LocalTransactionInfo.IsDonateInvoice = ShmDcCommonData->donate_flag[gunIndex];
+    LocalTransactionInfo.TransactionId = ShmSelectGunInfo->PricesInfo[gunIndex].TransactionId;
+    memcpy(LocalTransactionInfo.VemData, ShmDcCommonData->pCreditCard[gunIndex].VemData, 64);
 }
-
 void PreAuthCompleteToCardReader(int fd,uint8_t gunIndex)
 {
 	int result = 0;
+    storePayResult(gunIndex);
 	result = CreditCardPreAuthComplete(fd,(int)ShmDcCommonData->finalcost[pSysInfo->CurGunSelected], "TCC Test",
 											&ShmDcCommonData->pCreditCard[gunIndex].VemData[0],
 											&ShmDcCommonData->pCreditCard[gunIndex]);
 
 	//result = 1;
+    sleep(10);
+    ShmDcCommonData->PayFinish[gunIndex] = TRUE;
 	if (result > 0 ) {
-		log_info("Credit Card Spend Money:%.1f",ShmDcCommonData->finalcost[gunIndex]);
+		log_info("Credit Card Spend Money:%.1f", LocalTransactionInfo.Amount);
 		pSysInfo->SystemPage = _PAGE_COMPLETE;
 		WritePayResult(TRUE,gunIndex);
         ShmDcCommonData->PayPass_flag[gunIndex] = TRUE;
@@ -395,15 +401,17 @@ static int InitialRfidPort(void)
 }
 int CreditCardCancelPreAuth(int fd,uint8_t gunIndex)
 {
+
     struct SysConfigData* pSysConfig = (struct SysConfigData*)GetShmSysConfigData();
     ShmDcCommonData->PreAuth_Result = CreditCardPreAuthCancel(fd, PREAUTHMONEY, "TCC Test",
         &ShmDcCommonData->pCreditCard[gunIndex].ApprovalNo[0],
         &ShmDcCommonData->pCreditCard[gunIndex].CardNo[0],
         &ShmDcCommonData->pCreditCard[gunIndex].VemData[0]);
     sleep(10);
-    if (ShmDcCommonData->PreAuth_Result > 0) {
+    ShmDcCommonData->PayFinish[gunIndex] = TRUE;
+    if (ShmDcCommonData->PreAuth_Result >= 0) {
         strcpy((char*)pSysConfig->UserId, "");
-        ShmDcCommonData->PayFinish[gunIndex] = TRUE;
+        //ShmDcCommonData->PayFinish[gunIndex] = TRUE;
         log_info("Card Reader PreAuth Cancel Success");
         memset(&ShmDcCommonData->pCreditCard[gunIndex], 0, sizeof(TransInfo));
 
@@ -505,6 +513,7 @@ void CreateRfidFork(void)
             }
 
             // Scan Card to get card number
+            /*
             if (pSysInfo->SystemPage == _PAGE_AUTHORIZE && ShmDcCommonData->GetCardNo[pSysInfo->CurGunSelected] == FALSE) {
             	result = CreditCardSearch(fd,"TCC Test",&ShmDcCommonData->pCreditCard[pSysInfo->CurGunSelected]);
             	//result = 1;
@@ -521,6 +530,7 @@ void CreateRfidFork(void)
             		log_info("No Card Scanning...");
             	}
             }
+            */
             is_idle = FALSE;
 			for (gunIndex = 0; gunIndex < pSysConfig->TotalConnectorCount; gunIndex++) {
 				pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(gunIndex);
@@ -549,16 +559,26 @@ void CreateRfidFork(void)
 
             if(ShmDcCommonData->PreAuth_Config == _CREDITCARD_CANCEL) {
                 CreditCardCancelPreAuth(fd,pSysInfo->CurGunSelected);
-            } else if (ShmDcCommonData->PreAuth_Config == _CREDITCARD_PREAUTH && ShmDcCommonData->GetCardNo[pSysInfo->CurGunSelected]) {
+            } else if (ShmDcCommonData->PreAuth_Config == _CREDITCARD_PREAUTH /* && ShmDcCommonData->GetCardNo[pSysInfo->CurGunSelected]*/) {                
         		result = CreditCardPreAuth(fd, PREAUTHMONEY,"TCC Test", &ShmDcCommonData->pCreditCard[pSysInfo->CurGunSelected]);
-                sleep(7);
+                if (ShmDcCommonData->TradeCancel == FALSE && result > 0) {
+                    pSysInfo->SystemPage = _PAGE_SENSING;
+                    sleep(10);
+                }
+                StopSystemTimeoutDet();
+                
+                ShmDcCommonData->PreAuth_Result = result;
 				//result = 1;
 				if (result > 0) {
 					ShmDcCommonData->AuthPass_flag[pSysInfo->CurGunSelected] = TRUE;
+                    strncpy((char*)pSysConfig->UserId, ShmDcCommonData->pCreditCard[pSysInfo->CurGunSelected].CardNo, 20);
+                    log_info("Authorize card:%s", pSysConfig->UserId);
+                    ShmDcCommonData->GetCardNo[pSysInfo->CurGunSelected] = TRUE;
 					log_info("PreAuth OK");
 				} else if (result < 0) {
 				    struct ChargingInfoData *pDcChargingInfo = NULL;
-					pSysInfo->SystemPage = _PAGE_AUTHORIZE_FAIL;
+                    if (ShmDcCommonData->TradeCancel == FALSE)
+					    pSysInfo->SystemPage = _PAGE_AUTHORIZE_FAIL;
 					ShmDcCommonData->AuthPass_flag[pSysInfo->CurGunSelected] = FALSE;
 					memset(&ShmDcCommonData->pCreditCard[pSysInfo->CurGunSelected], 0, sizeof(TransInfo));
 					log_info("PreAuth Fail");

+ 55 - 29
EVSE/Projects/DD360Tcci/Apps/CSU/main.c

@@ -81,8 +81,8 @@ uint8_t bd0_2_status = 0;
 uint8_t bd1_1_status = 0;
 uint8_t bd1_2_status = 0;
 
-char *fwVersion = "V2.03.00.0000.00"; // Phihong version
-char* DebugVersion = "v2.03.01";      // Software debug version
+char *fwVersion = "V2.04.00.0000.00"; // Phihong version
+char* DebugVersion = "v2.04.00";      // Software debug version
 //sqlite3 *localDb;
 bool isDb_ready;
 
@@ -1470,6 +1470,8 @@ void _AutoReturnTimeout(void)
         pDcChargingInfo->SystemStatus = S_ALARM;
         //pSysInfo->SystemPage = _LCM_ERROR;
         pSysInfo->SystemPage = _PAGE_PLUGOUT;
+        ShmDcCommonData->PreAuth_Config = _CREDITCARD_CANCEL;
+        ShmDcCommonData->PreAuth_Result = 0;
         //pSysInfo->SystemPage = _PAGE_PAYING;
         //StartGunInfoTimeoutDet(pSysInfo->CurGunSelected,Timeout_FinalCost);
         ClearDetectPluginFlag();
@@ -1497,6 +1499,8 @@ void _AuthorizedTimeout(void)
         SetIsCardScan(false);
 
         pSysInfo->SystemPage = _PAGE_SELECT_GUN;
+        ShmDcCommonData->PreAuth_Config = _CREDITCARD_CANCEL;
+        ShmDcCommonData->PreAuth_Result = 0;
         //ChangeLcmByIndex(_LCM_AUTHORIZ_FAIL);
         strcpy((char *)pSysConfig->UserId, "");
         ClearAuthorizedFlag();
@@ -1556,7 +1560,7 @@ void _DetectEvseChargingEnableTimeout(uint8_t gunIndex)
 {
     log_info("*********** _DetectEvseChargingEnableTimeout (GFD timeout) ***********");
 
-    setChargerMode(pSysInfo->CurGunSelected, S_TERMINATING);
+    ChargingTerminalProcess(gunIndex);
     //pSysInfo->SystemPage = _LCM_ERROR;
     pSysInfo->SystemPage = _PAGE_MAINTAIN;
     _AutoReturnTimeout();
@@ -1566,7 +1570,7 @@ void _PrepareTimeout(uint8_t gunIndex)
 {
     log_info("*********** _PrepareTimeout ***********");
 
-    setChargerMode(pSysInfo->CurGunSelected, S_TERMINATING);
+    ChargingTerminalProcess(gunIndex);
     pAlarmCode->AlarmEvents.bits.PsuNoResource = YES;
     //pSysInfo->SystemPage = _LCM_ERROR;
     pSysInfo->SystemPage = _PAGE_MAINTAIN;
@@ -1576,7 +1580,7 @@ void _PrepareTimeout(uint8_t gunIndex)
 void _CcsPrechargeTimeout(uint8_t gunIndex)
 {
     log_info("*********** _CcsPrechargeTimeout ***********");
-    setChargerMode(pSysInfo->CurGunSelected, S_TERMINATING);
+    ChargingTerminalProcess(gunIndex);
     //pSysInfo->SystemPage = _LCM_ERROR;
     pSysInfo->SystemPage = _PAGE_MAINTAIN;
 }
@@ -2484,10 +2488,11 @@ void CreateTimeoutFork(void)
                 CheckConnectionTimeout();
                 gettimeofday(&_cmdSubPriority_time, NULL);
             }
-            //if (pSysInfo->SystemTimeoutFlag != 0)
-            //log_info("Timeout ***********SystemTimeoutFlag = %d(%d) ********",pSysInfo->SystemTimeoutFlag,
-            //        GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL);
-
+            /*
+            if (pSysInfo->SystemTimeoutFlag != 0)
+            log_info("Timeout ***********SystemTimeoutFlag = %d(%d) ********",pSysInfo->SystemTimeoutFlag,
+                    GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL);
+                    */
             // 系統
             switch (pSysInfo->SystemTimeoutFlag) {
             case Timeout_SelftestChk:
@@ -2585,7 +2590,9 @@ void CreateTimeoutFork(void)
 					strcpy((char *)pSysConfig->UserId, "");
 					ClearAuthorizedFlag();
 					StopSystemTimeoutDet();
-					pSysInfo->SystemPage = _PAGE_SELECT_GUN;
+                    pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+                    pDcChargingInfo->SystemStatus = S_IDLE;
+					pSysInfo->SystemPage = _PAGE_AUTHORIZE_FAIL;
 				}
 				break;
             case Timeout_Terminating:
@@ -2615,6 +2622,14 @@ void CreateTimeoutFork(void)
             		pSysInfo->SystemPage = _PAGE_SELECT_GUN;
             	}
             	break;
+            case Timeout_TradeCancel:
+                if (GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL >= TCC_TRADECANCEL_TIMEOUT) {
+                    StopSystemTimeoutDet();
+                    pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+                    setChargerMode(pSysInfo->CurGunSelected, MODE_IDLE);
+                    pSysInfo->SystemPage = _PAGE_SELECT_GUN;
+                }
+                break;
             }
 
             // 各槍
@@ -2703,11 +2718,11 @@ void CreateTimeoutFork(void)
                 	if (GetTimeoutValue(pDcChargingInfo->TimeoutTimer) / uSEC_VAL >= TCC_LINEREGISTER_TIMEOUT) {
                 		StopGunInfoTimeoutDet(gunIndex);
                 		pSysInfo->SystemPage = _PAGE_SELECT_PAY;
-                		ShmDcCommonData->donate_flag[gunIndex] = TRUE;
+                		ShmDcCommonData->donate_flag[gunIndex] = FALSE;
                 	}
                 	break;
                     /*
-                case Timeout_SelectGun: //Jerry add
+                case Timeout_SelectGun: //Jerry add 
                     if (GetTimeoutValue(pDcChargingInfo->TimeoutTimer) / uSEC_VAL >= SEL_GUN_TIMEOUT) {
                         log_info("Timeout_SelectGun");
                         StopGunInfoTimeoutDet(gunIndex);
@@ -3856,6 +3871,7 @@ void ResetIdleData(uint8_t gunIndex)
     ShmDcCommonData->AuthPass_flag[gunIndex] = FALSE;
     ShmDcCommonData->PayPass_flag[gunIndex] = FALSE;
     ShmDcCommonData->GetCardNo[gunIndex] = FALSE;
+    ShmDcCommonData->LineStatus[gunIndex] = 0;
 
     ShmSelectGunInfo->PricesInfo[gunIndex].Balance = FAIL_BALANCE_PRICES;
     destroySelGun(gunIndex);
@@ -3940,6 +3956,7 @@ int main(void)
     bool isModelNameMatch = true;
     uint8_t _ocppProfileChkFlag;
     uint8_t gunIndex = 0;
+    uint8_t cancelcount = 0;
 
     if (CreateAllCsuShareMemory() == FAIL) {
         log_error("create share memory error");
@@ -4005,7 +4022,7 @@ int main(void)
         KillAllTask();
         StopProcessingLoop();
     }
-    CreateTimeoutFork();
+    CreateTimeoutFork();    
     log_info("Start self test... ");
 
     SelfTestRun();
@@ -4062,7 +4079,7 @@ int main(void)
     CheckTaskAlive();
 
     CreateWatchdog();
-    system("export TZ=CST-8&");
+    
     for (;;) {
 
         CheckOcppStatus();
@@ -4158,7 +4175,7 @@ int main(void)
 					setChargerMode(gunIndex, MODE_AUTHORIZING);
 					break;
                 }
-
+                cancelcount = 0;
                 // 讀卡邏輯
                 ScannerCardProcess();
                 if (pSysInfo->SystemPage == _PAGE_SELECT_GUN) {
@@ -4170,19 +4187,24 @@ int main(void)
 
                 	if(pSysInfo->SystemPage ==_PAGE_BILL) {
                 		StartSystemTimeoutDet(Timeout_AddLine);
-                		if (ShmDcCommonData->LineStatus[gunIndex] == 1 || ShmDcCommonData->LineStatus[gunIndex] == 2 )
-                			pSysInfo->SystemPage =_PAGE_ADD_FRIEND;
+                        if (/*ShmDcCommonData->LineStatus[gunIndex] == 1 || */ShmDcCommonData->LineStatus[gunIndex] == 2) {
+                            pSysInfo->SystemPage = _PAGE_ADD_FRIEND;
+                            log_info("Change to Add Line Friend Page");
+                        }
                 	} else if(pSysInfo->SystemPage ==_PAGE_ADD_FRIEND) {
                 		StopSystemTimeoutDet();
                 		StartGunInfoTimeoutDet(gunIndex, Timeout_LineReigster);
                 		if (ShmDcCommonData->LineStatus[gunIndex] == 3)  {
+                            StopGunInfoTimeoutDet(gunIndex);
                 			pSysInfo->SystemPage =_PAGE_SELECT_PAY;
                 			ShmDcCommonData->donate_flag[gunIndex] = FALSE;
+                            log_info("Change to Select Pay Page");
                 		}
 						if (ShmDcCommonData->LineStatus[gunIndex] == 4 ) {
+                            StopGunInfoTimeoutDet(gunIndex);
                 			pSysInfo->SystemPage =_PAGE_SELECT_PAY;
                 			ShmDcCommonData->donate_flag[gunIndex] = TRUE;
-
+                            log_info("Change to Select Pay Page");
                 		}
                 	}
                 }
@@ -4240,7 +4262,7 @@ CheckStatus:
 				ScannerCardProcess();
                 // 隨插即充
                 //autoStartCharging(gunIndex);
-                if (pSysInfo->SystemPage == _PAGE_PLUGIN) {
+                if (pSysInfo->SystemPage == _PAGE_PLUGIN && ShmDcCommonData->TradeCancel == FALSE) {
                 	pDcChargingInfo->Replug_flag = TRUE;
                 	StopSystemTimeoutDet();
                 	StartGunInfoTimeoutDet(gunIndex,Timeout_WaitPlug);
@@ -4556,7 +4578,7 @@ CheckStatus:
                 	pSysInfo->SystemPage = _PAGE_EXIT;
                 	break;
                 }
-                if (pDcChargingInfo->ConnectorPlugIn == NO) {
+                if (pSysInfo->CurGunSelected == gunIndex &&     pDcChargingInfo->ConnectorPlugIn == NO) {
                 	is_plugout[gunIndex] = TRUE;
                     StartGunInfoTimeoutDet(gunIndex, Timeout_PlugOutGun);
                     if (pSysInfo->CurGunSelected == gunIndex) {
@@ -4566,8 +4588,7 @@ CheckStatus:
                     }
                 }
 
-                if (pSysInfo->CurGunSelected == gunIndex && pSysInfo->SystemPage != _PAGE_PAYING &&
-                    ShmDcCommonData->finalcost_flag[gunIndex]) {
+                if (pSysInfo->CurGunSelected == gunIndex && pSysInfo->SystemPage != _PAGE_PAYING ) {
                 	if (ShmDcCommonData->PayPass_flag[pSysInfo->CurGunSelected] == TRUE)
 						pSysInfo->SystemPage = _PAGE_COMPLETE;
 					else
@@ -4594,13 +4615,18 @@ CheckStatus:
                 		ShmDcCommonData->PreAuth_Result = 0;
                         pSysInfo->SystemPage = _PAGE_PLUGOUT;
                     } else {
-						if(ShmDcCommonData->PayFinish[gunIndex] == FALSE) {
+						if(ShmDcCommonData->finalcost_flag[gunIndex] == FALSE) {
 							pSysInfo->SystemPage = _PAGE_PAYING;
 						}
                     }
-
                 }
-
+                if (ShmDcCommonData->PreAuth_Config == _CREDITCARD_CANCEL && 
+                    ShmDcCommonData->PreAuth_Result != 0 && cancelcount < 30) {
+                    sleep(1);
+                    cancelcount++;
+                    log_info("Cancel Not Complete yet");
+                    break;
+                }
                 if (pSysWarning->Level == WARN_LV_ER) {
 					pSysInfo->SystemPage = _PAGE_MAINTAIN;
 
@@ -4611,13 +4637,13 @@ CheckStatus:
                 	pSysInfo->SystemPage = _PAGE_EXIT;
                 	break;
                 }
-                if (pDcChargingInfo->ConnectorPlugIn == NO) {
+
+                if (pSysInfo->CurGunSelected == gunIndex && pDcChargingInfo->ConnectorPlugIn == NO) {
                 	is_plugout[gunIndex] = TRUE;
 					if (pDcChargingInfo->Replug_flag == TRUE) {
 						pSysInfo->SystemPage = _PAGE_SELECT_GUN;
 						pDcChargingInfo->SystemStatus = S_IDLE;
-					}
-					else {
+					} else {
 						StartGunInfoTimeoutDet(gunIndex, Timeout_PlugOutGun);
 						pSysInfo->SystemPage = _PAGE_EXIT;
 					}
@@ -4629,7 +4655,7 @@ CheckStatus:
                 if (pSysInfo->CurGunSelected == gunIndex && pSysInfo->SystemPage != _PAGE_PAYING ) {
                 	if (pDcChargingInfo->Replug_flag == TRUE)
                 		pSysInfo->SystemPage = _PAGE_PLUGOUT;
-                	else if (ShmDcCommonData->finalcost_flag[gunIndex]) {
+                	else{
                 		if (ShmDcCommonData->PayPass_flag[pSysInfo->CurGunSelected] == TRUE)
 							pSysInfo->SystemPage = _PAGE_COMPLETE;
 						else

+ 2 - 1
EVSE/Projects/DD360Tcci/Apps/CSU/main.h

@@ -51,7 +51,8 @@
 #define TCC_DONATECOMFIRM_TIMEOUT				(180)
 #define TCC_SELECTPAY_TIMEOUT					(180)
 #define TCC_FINALCOST_TIMEOUT					(30)
-#define TCC_SCANCARD_TIMEOUT					(60)
+#define TCC_SCANCARD_TIMEOUT					(30)
+#define TCC_TRADECANCEL_TIMEOUT                 (60)
 
 //#define log_info(format, args...) StoreLogMsg_1("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
 //#define log_warn(format, args...) StoreLogMsg_1("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)

+ 1 - 0
EVSE/Projects/DD360Tcci/Apps/Config.h

@@ -484,6 +484,7 @@ typedef struct StDcCommonInfo {
     unsigned int PayFinish[2];
     unsigned int StopCharge[2];
     unsigned int GetCardNo[2];
+    unsigned int TradeCancel;
     int reupload_deduct_status;		// 0:Not ReUpload 1:ReUpload 2:ReUpload finish
     RecordTransactionInfo TransactionInfo[2];
     RecordTransactionInfo UploadRedectInfo;

+ 88 - 20
EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.c

@@ -34,7 +34,7 @@
 static DoCommGblData gDoCommGblData             = {0};
 static MoreInfoReq gMoreInfoReq[2]              = {0};
 //static ChangePageReq gPageReq[2]                = {0};
-
+static ConnectorActReqVar gConnectorActReq[2]   = {0};
 static struct SysConfigData *pSysConfig         = NULL;
 static struct SysInfoData *pSysInfo             = NULL;
 static struct WARNING_CODE_INFO *pSysWarning    = NULL;
@@ -57,6 +57,8 @@ static uint8_t ReservationState[2] = {0};
 static char ReservationIdTag[2][32];
 static uint8_t DeductResultReq[2] = {0};
 static int LineStatusCode[2] = {0};
+static unsigned int LedIntensity = 0;
+static int TimeZoneOffset = 0;
 
 //------------------------------------------------------------------------------
 static void removeFaultCodeToBuf(uint8_t *Code);
@@ -590,8 +592,8 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t plugNum, uint8_t *data)
         case MISC_CMD_DEFAULT_PRICES:
             prices = transPricesUnit((int)value);
             log_info("default prices = %.2f", prices);
-	    if(prices > 0 )
-            	ShmDcCommonData->ChargingRate = prices;
+            if (prices > 0)
+                ShmDcCommonData->ChargingRate = prices;
             //pSysConfig->BillingData.isBilling = YES;
             for (j = 0; j < 24; j++) {
                 pSysConfig->BillingData.Fee[j] = prices;
@@ -834,7 +836,18 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t plugNum, uint8_t *data)
             ShmDcCommonData->LineStatus[plugNum] = value;
             log_info("Gun %d Line Status Code: %d", plugNum, LineStatusCode[plugNum]);
             break;
-
+        case MISC_CMD_LED_INTENSITY:
+            LedIntensity = value;
+            log_info("Led Intensity: %d", LedIntensity);
+            break;
+        case MISC_CMD_TIME_OFFSET:
+            TimeZoneOffset = value;
+            log_info("Time Zone Offset: %d", TimeZoneOffset);
+            if (TimeZoneOffset == 480) {
+                system("export TZ=CST-8");
+                log_info("Set Time Zone CST 8");
+            }
+            break;
         default:
             clearMiscCommand();
             break;
@@ -844,6 +857,22 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t plugNum, uint8_t *data)
 
     return ret;
 }
+void AddDispenserReq(uint8_t* buff, MiscCommand* req)
+{
+    buff[0] = (req->CMD >> 8) & 0xFF;
+    buff[1] = req->CMD & 0xFF;
+
+
+
+    buff[2] = req->Value[0];
+    buff[3] = req->Value[1];
+    buff[4] = req->Value[2];
+    buff[5] = req->Value[3];
+}
+
+
+
+
 
 static int chargingcapabilityHandle(uint8_t *data, uint8_t plugNum)
 {
@@ -1390,7 +1419,34 @@ static int composeSocketData(int fd,
 
     return ret;
 }
+static int writeDispenserRequest(int fd, uint8_t id, uint8_t gunIndex)
+{
+    int ret = PASS;
+    int count = 0;
+    MiscCommand dispenserReq;
+    uint8_t data[6] = { 0 };
+    if (gConnectorActReq[gunIndex].bits.ChargingCancel)
+    {
+        dispenserReq.CMD = DISPENSER_REQ_CHARGING_CANCEL;
+        dispenserReq.Value[0] = 0;
+        dispenserReq.Value[1] = 0;
+        dispenserReq.Value[2] = 0;
+        dispenserReq.Value[3] = 1;
+        AddDispenserReq(data, &dispenserReq);
+        count++;
+        log_info("Write Gun %d CHARGING_CANCEL", gunIndex);
+    }
 
+    if ((ret = composeSocketData(fd,
+        id,
+        OP_WRITE_DATA,
+        REG_DISPENSER_REQUEST,
+        (count * 6),
+        &data[0])) == FAIL) {
+        return ret;
+    }
+    return ret;
+}
 static int readReservationState(int fd, uint8_t id)
 {
     int ret = PASS;
@@ -1959,7 +2015,7 @@ static void checkAuthorProcess(int fd, uint8_t plugNum)
         ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance = 0.0;
     }
 #else
-    gunID = gDoCommGblData.ConnectorID[pSysInfo->CurGunSelected];;
+    gunID = gDoCommGblData.ConnectorID[pSysInfo->CurGunSelected];
 
     ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Balance = 0.0; //非Audi 不需要等待主櫃回報餘額
 #endif // DD360Audi
@@ -2201,12 +2257,29 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
                     ftime(&gRegTimeUp[plugNum][curReg]);
                 }
             }
-            curReg = REG_REMOTE_START_NO_ID;
+            curReg = REG_DISPENSER_REQUEST;
             break;
 
         //case REG_DISPENSER_REQUEST:
         //    break;
+            case REG_DISPENSER_REQUEST:
+                if (gConnectorActReq[plugNum].Value != 0)
+                {
+                    if (DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) > LOOP_RETRY_TIME ||
+                        DiffTimeb(gRegTimeUp[plugNum][curReg], NowTime) < 0) {
+
 
+
+                        if (writeDispenserRequest(fd, gunID, plugNum) == PASS)
+                        {
+                            gConnectorActReq[plugNum].Value = 0;
+                            log_info("Gun %d CHARGING_CANCEL OK");
+                        }
+                        ftime(&gRegTimeUp[plugNum][curReg]);
+                    }
+                }
+                curReg = REG_REMOTE_START_NO_ID;
+                break;
         case REG_REMOTE_START_NO_ID:
             if(gMoreInfoReq[plugNum].bits.RemoteStartNoID)
             {
@@ -2304,10 +2377,13 @@ static void systemStatusProcess(int fd, uint8_t totalGun, uint8_t plugNum, uint8
 
 
         if (ShmDcCommonData->reupload_deduct_status == 1) {
+            log_info("Reupload Deduct");
         	if (writeDeductInfo(fd, 0xff,plugNum, &ShmDcCommonData->UploadRedectInfo) == PASS) {
         		ShmDcCommonData->UploadRedectInfo.IsUpload = YES;
         		ShmDcCommonData->reupload_deduct_status = 2;
-        	}
+            } else {
+                log_info("Reupload Deduct Failure!");
+            }
         }
 
         ftime(&AuthNowTime);
@@ -2340,7 +2416,8 @@ static void systemStatusProcess(int fd, uint8_t totalGun, uint8_t plugNum, uint8
         {
             DeductResultReq[plugNum] = YES;
             log_info("Write Gun %d Deduct Result", plugNum);
-            writeDeductInfo(fd, gunID,plugNum, &ShmDcCommonData->TransactionInfo[plugNum]);
+            if (writeDeductInfo(fd, gunID, plugNum, &ShmDcCommonData->TransactionInfo[plugNum]) != PASS)
+                log_info("Write Deduct fail");
             ShmDcCommonData->finalcost_flag[plugNum] = FALSE;
             ShmDcCommonData->PayFinish[plugNum] = FALSE;
             log_info("writeDeductInfo finish");
@@ -2497,17 +2574,7 @@ static void systemStatusProcess(int fd, uint8_t totalGun, uint8_t plugNum, uint8
             writePresentChargingInfo(fd, plugNum, gunID);
             ftime(&gRegTimeUp[plugNum][REG_PRESENT_CHARGING_INFO]);
         }
-        if(!DeductResultReq[plugNum] &&
-				pDcChargingInfo->SystemStatus == S_TERMINATING &&
-				ShmDcCommonData->PayFinish[plugNum] == TRUE)
-		{
-			DeductResultReq[plugNum] = YES;
-			log_info("Write Gun %d Deduct Result", plugNum);
-			writeDeductInfo(fd, gunID,plugNum, &ShmDcCommonData->TransactionInfo[plugNum]);
-			ShmDcCommonData->finalcost_flag[plugNum] = FALSE;
-			ShmDcCommonData->PayFinish[plugNum] = FALSE;
-			log_info("writeDeductInfo finish");
-		}
+
         break;
 
     case S_COMPLETE:
@@ -2525,7 +2592,8 @@ static void systemStatusProcess(int fd, uint8_t totalGun, uint8_t plugNum, uint8
         {
             DeductResultReq[plugNum] = YES;
             log_info("Write Gun %d Deduct Result", plugNum);
-            writeDeductInfo(fd, gunID,plugNum, &ShmDcCommonData->TransactionInfo[plugNum]);
+            if (writeDeductInfo(fd, gunID, plugNum, &ShmDcCommonData->TransactionInfo[plugNum]) != PASS)
+                log_info("Deduct Result fail");
             ShmDcCommonData->finalcost_flag[plugNum] = FALSE;
             ShmDcCommonData->PayFinish[plugNum] = FALSE;
             log_info("writeDeductInfo finish");

+ 13 - 2
EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.h

@@ -124,6 +124,9 @@
 #define MISC_CMD_WEB_STOP_CHARGING              (0x000B)
 #define MISC_CMD_AUTH_DISABLE					(0x000C)
 #define MISC_CMD_EVCCID_ENABLE					(0x000D)
+#define MISC_CMD_LED_INTENSITY                  (0x000E)
+#define MISC_CMD_AC_CONTACTOR                   (0x000F)
+#define MISC_CMD_TIME_OFFSET                    (0x0010)
 
 #define MISC_CMD_HARDWARE_REBOOT                (0x0101)
 #define MISC_CMD_SOFTWARE_RESTART               (0x0102)
@@ -141,15 +144,23 @@
 #define ST_NO_UPDATE_FIRMWARE                   (0x02)
 
 #define LCM_PAGE_REMOTE_START_NO_ID             (0x0001)
+#define DISPENSER_REQ_CHARGING_CANCEL           (0x0001)
 
 #define UPLOAD_DEDUCT_DB						(0x5656)
 
-//#define LCM_PAGE_JOIN_LINE                      (0x0002)
-//#define LCM_PAGE_PAYMENT_SWITCH                 (0x0003)
 
 //------------------------------------------------------------------------------
 #pragma pack(push)
 #pragma pack(1)
+typedef union
+{
+    unsigned int Value;
+    struct
+    {
+        unsigned int ChargingCancel : 1; // 0: no effect, 1: charging cancel request
+        unsigned int res : 31;
+    }bits;
+} ConnectorActReqVar;
 
 typedef struct StDeductInfoVar {
     unsigned char DeductResult;                     // 0: Fail, 1: Pass

+ 0 - 1
EVSE/Projects/DD360Tcci/Apps/ModuleEvComm/Module_EvRxComm.c

@@ -502,7 +502,6 @@ void CANReceiver(int fd)
                 //else if (pDcChargingInfo->Type == _Type_CCS_2) {
                 //}
                 break;
-
             case ACK_GET_MISCELLANEOUS_INFO:
                 pDcChargingInfo->GunLocked = frame.data[0];
                 pDcChargingInfo->PilotVoltage = ((float)(-120 + frame.data[3])) / 10;

+ 122 - 15
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -193,6 +193,28 @@ void WriteCmdToLcm(uint8_t *cmd, uint8_t cmdLen)
     }
 }
 
+void TradeRunning(uint8_t _run)
+{
+    if (_run == TRUE) {
+        ChangeDisplay2Value(_Icon_PreAuth, 1);
+        ChangeDisplay2Value(_Icon_Ani_Dot, 1);
+        ChangeDisplay2Value(_Icon_CountDownBG, 0);
+        ChangeDisplay2Value(_Icon_CancelCntDownTen, 0);
+        ChangeDisplay2Value(_Icon_CancelCntDownDigits, 0);
+    }
+    else {
+        ChangeDisplay2Value(_Icon_PreAuth, _TCC_TradeCancelString);
+        ChangeDisplay2Value(_Icon_Ani_Dot, 0);
+        ChangeDisplay2Value(_Icon_CountDownBG, _TCC_TradeCancelFrame);
+        if (pSysInfo->SystemTimeoutFlag == Timeout_TradeCancel) {
+            unsigned long _time = TCC_TRADECANCEL_TIMEOUT-(GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL);
+            ChangeDisplay2Value(_Icon_CancelCntDownTen, (short)(_TCC_CancelNum_0 + (_time / 10)));
+            ChangeDisplay2Value(_Icon_CancelCntDownDigits, (short)(_TCC_CancelNum_0 + (_time % 10)));
+        }
+
+    }
+}
+
 void CheckIdlePress()
 {
     pSysInfo->SystemPage = _PAGE_SELECT_GUN;
@@ -203,30 +225,73 @@ void CheckReturnPress()
 	int i;
 	pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
 	//pDcChargingInfo->SystemStatus = S_IDLE;
-	StopSystemTimeoutDet();
+	
 	if ( pDcChargingInfo->SystemStatus == S_AUTHORIZING ) {
-		if (pSysInfo->SystemPage == _PAGE_AUTHORIZE || pSysInfo->SystemPage == _PAGE_PLUGIN ) {
+        ShmDcCommonData->TradeCancel = TRUE;
+        /*
+		if (pSysInfo->SystemPage == _PAGE_AUTHORIZE ) {
 			pSysInfo->SystemPage = _PAGE_SELECT_PAY;
-		}
-		pDcChargingInfo->SystemStatus = S_IDLE;
+		} else if (pSysInfo->SystemPage == _PAGE_PLUGIN)
+            pSysInfo->SystemPage = _PAGE_SELECT_GUN;
+            */
+        for (i = 0; i <= 30; i++) {
+            if (ShmDcCommonData->PreAuth_Config == _CREDITCARD_IDLE)
+                break;
+            sleep(1);
+        }
+        pSysInfo->SystemPage = _PAGE_SENSING;
+        StopGunInfoTimeoutDet(pSysInfo->CurGunSelected);
+        StartSystemTimeoutDet(Timeout_TradeCancel);
+        ShmDcCommonData->PreAuth_Result = 0;
+        log_info("Press Return button cancel PreAuth");
 		ShmDcCommonData->PreAuth_Config = _CREDITCARD_CANCEL;
 		ShmDcCommonData->PreAuth_Result = 0;
 		for(i=0;i<=30;i++) {
-			if(ShmDcCommonData->PreAuth_Result != 0)
+			if(ShmDcCommonData->PreAuth_Config == _CREDITCARD_IDLE)
 				break;
 			sleep(1);
 		}
 		ShmDcCommonData->PreAuth_Result = 0;
-
+        StopSystemTimeoutDet();
+        pDcChargingInfo->SystemStatus = S_IDLE;
 		strcpy((char *)pSysConfig->UserId, "");
 		return;
 	}
+    if (pDcChargingInfo->SystemStatus == S_IDLE && pSysInfo->SystemPage == _PAGE_AUTHORIZE) {
+        ShmDcCommonData->TradeCancel = TRUE;
+        pSysInfo->SystemPage = _PAGE_SENSING;
+        StartSystemTimeoutDet(Timeout_TradeCancel);
+        if (ShmDcCommonData->PreAuth_Config == _CREDITCARD_PREAUTH) {
+            for (i = 0; i <= 30; i++) {
+                if (ShmDcCommonData->PreAuth_Result != 0)
+                    break;
+                sleep(1);
+            }
+            ShmDcCommonData->PreAuth_Result = 0;
+            if (ShmDcCommonData->AuthPass_flag[pSysInfo->CurGunSelected] == TRUE) {
+                ShmDcCommonData->PreAuth_Config = _CREDITCARD_CANCEL;
+                ShmDcCommonData->PreAuth_Result = 0;
+                for (i = 0; i <= 30; i++) {
+                    if (ShmDcCommonData->PreAuth_Config == _CREDITCARD_IDLE)
+                        break;
+                    sleep(1);
+                }
+            }
+            pSysInfo->SystemPage = _PAGE_SELECT_PAY;
+        }
+        return;
+    }
 	if ( pSysInfo->SystemPage == _PAGE_EXIT ) {
+        StopSystemTimeoutDet();
 		pDcChargingInfo->SystemStatus = S_IDLE;
 		pSysInfo->SystemPage = _PAGE_IDLE;
 		return;
 	}
-	pSysInfo->SystemPage = _PAGE_SELECT_GUN;
+	
+    if (pSysInfo->SystemPage == _PAGE_AUTHORIZE)
+        pSysInfo->SystemPage = _PAGE_SELECT_PAY;
+    else
+        pSysInfo->SystemPage = _PAGE_SELECT_GUN;
 }
 void CheckStopPress()
 {
@@ -282,9 +347,13 @@ void CheckDonateNo()
 }
 void CheckPayCreditCard()
 {
+    ShmDcCommonData->LineStatus[pSysInfo->CurGunSelected] = 0;
+    ShmDcCommonData->TradeCancel = FALSE;
    	pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
 	if (pDcChargingInfo->SystemStatus == S_IDLE) {
 		//confirmSelGun(pSysInfo->CurGunSelected);
+        ShmDcCommonData->PreAuth_Config = _CREDITCARD_PREAUTH;
+        ShmDcCommonData->PreAuth_Result = 0;
 		//setSelGunWaitToAuthor(pSysInfo->CurGunSelected);
 		pSysInfo->SystemPage = _PAGE_AUTHORIZE;
 		//pDcChargingInfo->SystemStatus = S_AUTHORIZING;
@@ -356,11 +425,8 @@ void CheckTouchPress(short id)
 				StopSystemTimeoutDet();
 				StartSystemTimeoutDet(Timeout_ReturnViewPage);
         	}
-
             break;
         case _Touch_Return:
-        	if (pSysInfo->SystemPage == _PAGE_AUTHORIZE)
-        		pSysInfo->SystemPage = _PAGE_SELECT_PAY;
         	CheckReturnPress();
         	break;
         case _Touch_IDLE:
@@ -1080,6 +1146,33 @@ void changeLocationValue(int _location)
 	//log_info("location:%d",_location);
 	ChangeDisplay2Value(_Icon_Location,(short)_location);
 }
+void ShowLineRegisterCountDown()
+{
+    int _ten, _digits;
+    pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
+    if (pDcChargingInfo->TimeoutFlag == Timeout_LineReigster) {
+        _ten = (TCC_LINEREGISTER_TIMEOUT - (GetTimeoutValue(pDcChargingInfo->TimeoutTimer) / uSEC_VAL)) / 10;
+        _digits = (TCC_LINEREGISTER_TIMEOUT - (GetTimeoutValue(pDcChargingInfo->TimeoutTimer) / uSEC_VAL)) % 10;
+        ChangeDisplay2Value(_Icon_ScanCntDownTen, (short)_TCC_CntDownNumber0+_ten);
+        ChangeDisplay2Value(_Icon_ScanCntDownDigits, (short)_TCC_CntDownNumber0+ _digits);
+    } else {
+        log_info("Not get Line Register Count Down");
+    }
+}
+void ShowAuthorizeCountDown()
+{
+    int _ten, _digits;
+    
+    if (pSysInfo->SystemTimeoutFlag == Timeout_ScanCard) {
+        _ten = (TCC_SCANCARD_TIMEOUT - (GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL)) / 10;
+        _digits = (TCC_SCANCARD_TIMEOUT - (GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL)) % 10;
+        ChangeDisplay2Value(_Icon_AuthCntDownTen, (short)_TCC_CntDownNumber0 + _ten);
+        ChangeDisplay2Value(_Icon_AuthCntDownDigits, (short)_TCC_CntDownNumber0 + _digits);
+    }
+    else {
+        log_info("Not get Line Register Count Down");
+    }
+}
 int old_money = 0;
 int ClearQR_flag[2];
 void ProcessPageInfo()
@@ -1129,7 +1222,7 @@ void ProcessPageInfo()
 
             switch (pSysInfo->SystemPage) {
             case _PAGE_IDLE:
-
+                StopSystemTimeoutDet();
             	break;
             case _PAGE_SELECT_PAY:
             	if (ShmDcCommonData->donate_flag[i] == TRUE) {
@@ -1150,6 +1243,7 @@ void ProcessPageInfo()
             	ChangeQrCode_Idle((char *)pSysConfig->SystemId);
             	break;
             case _PAGE_AUTHORIZE:
+                StartSystemTimeoutDet(Timeout_ScanCard);
                 /*
                 int card_result = CreditCardPreAuth(CardReadFd, PREAUTHMONEY,"TCC Test", &ShmDcCommonData->pCreditCard[pSysInfo->CurGunSelected]);
 				if (card_result > 0 ) {
@@ -1159,19 +1253,32 @@ void ProcessPageInfo()
 				}*/
             	//ChangeDisplay2Value(_Icon_Precharge,0);
             	//ChangeDisplay2Value(_Icon_Precharge,1);
+                /*
             	if (ShmDcCommonData->GetCardNo[pSysInfo->CurGunSelected] == TRUE &&
             			ShmDcCommonData->AuthPass_flag[pSysInfo->CurGunSelected] != TRUE) {
-            		ShmDcCommonData->PreAuth_Config = _CREDITCARD_PREAUTH;
-            		ShmDcCommonData->PreAuth_Result = 0;
-            		sleep(3);
+            		//ShmDcCommonData->PreAuth_Config = _CREDITCARD_PREAUTH;
+            		//ShmDcCommonData->PreAuth_Result = 0;
+            		//sleep(3);
             		pSysInfo->SystemPage = _PAGE_SENSING;
             	}
-		ChangeChargingRateValue((int)ShmDcCommonData->ChargingRate);
+                */
+		        ChangeChargingRateValue((int)ShmDcCommonData->ChargingRate);
+                ShowAuthorizeCountDown();
             	_Text_Running_Count = 1;
                 break;
+            case _PAGE_SENSING:
+                if (ShmDcCommonData->TradeCancel == TRUE) {
+                    TradeRunning(FALSE);
+                }
+                else
+                    TradeRunning(TRUE);
+                break;
             case _PAGE_PLUGIN:
             	_everyPageRollChange = 0;
 
+                break;
+            case _PAGE_ADD_FRIEND:
+                ShowLineRegisterCountDown();
                 break;
             case _PAGE_PRECHARGE:
             	//ChangeDisplay2Value(_Icon_Precharge,1);

+ 14 - 84
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.h

@@ -50,90 +50,6 @@
 #define _CHANGE_PAYMENT_FAIL    0x07
 
 
-//#define NOODOE_QR_CODE_URL                    "https://ev-alpha-test.noodoe.com/station?id=" ////For Audi
-/*
-#define _StatuIcon				0x1000
-#define _ConfirmStopIcon		0x1002
-#define	_TccareIcon				0x1004
-#define _StartTouchIcon			0x1006
-#define _FurthureIcon			0x1010
-#define _WeatherIcon			0x1012
-#define	_WelcomeIcon			0x1014
-#define _QRCodeIcon				0x1016
-#define _ExclamIcon				0x1018
-#define _PluginIcon				0x101A
-#define _PlugoutIcon			0x101C
-#define _ReturnIcon				0x101E
-#define _PrechargeIcon			0x1020
-#define _MinuteIcon				0x1026
-#define _Rate13Icon				0x1028
-#define _CompleteIcon			0x102A
-#define _KgIcon					0x102C
-#define _Rate14Icon				0x102E
-#define _ExitIcon				0x1030
-#define _FarewellIcon			0x1032
-#define _ChargingIcon			0x1034
-// Circle Battery Setting Icon
-#define _Battery_Circle			0x1036
-// Energy Bar
-#define _EnergyBar				0x1038
-// Prepare Bar
-#define _PrepareBar				0x103A
-
-// QRCode
-#define _QRCode_Authorize		0x1040
-#define _QRCode_Replug			0x1050
-#define _QRCode_Complete		0x1060
-
-#define _LeftGun_status			0x1070
-#define _RightGun_status		0x1072
-// Warm
-#define _Icon_Warming_0			0x1074
-#define _Icon_Warming_1			0x1076
-#define _Icon_Warming_2			0x1078
-#define _Icon_Warming_3			0x107A
-#define _Icon_Warming_4			0x107C
-
-// Touch
-#define _Touch_LeftGun			0x1080
-#define _Touch_RightGun			0x1082
-#define _Touch_Return			0x1084
-#define _Touch_IDLE				0x1086
-#define _Touch_Stop				0x1088
-#define _Touch_Stop_Confirm		0x108A
-#define _Touch_Stop_Cancel		0x108C
-#define _Touch_ConfirmLeft		0x1208
-#define _Touch_ConfirmRight		0x120A
-
-// Text String
-#define _Text_Power				0x1090
-#define _Text_Time				0x10A0
-#define _Text_Energy			0x10B0
-#define _Text_Money				0x10C0
-#define _Text_BatterySoc		0x10D0
-#define _Text_Carbon			0x10E0
-// Warming Code
-#define _Text_Warming_0			0x10F0
-#define _Text_Warming_1			0x1100
-#define _Text_Warming_2			0x1110
-#define _Text_Warming_3			0x1120
-#define _Text_Warming_4			0x1130
-#define _Text_Date				0x1140
-#define _Text_Tempture			0x1150
-
-#define _WeekIcon				0x1200
-#define _WeatherIcon			0x1202
-#define _LocationIcon			0x1204
-#define _StopChargeBtn			0x1206
-
-#define _ErrorIcon				0x120C
-#define _PayIcon				0x120E
-#define _ProgreePayIcon			0x1210
-#define _ConfirmLeftIcon		0x1212
-#define _ConfirmRightIcon		0x1214
-#define _PayFailLeftIcon		0x1216
-#define _PayFailRightIcon		0x1218
-*/
 #define _Animation				0x1000
 #define _Icon_TouchStart		0x1002
 #define _Icon_Location			0x1004
@@ -180,6 +96,14 @@
 #define _Icon_Warming2			0x1058
 #define _Icon_Warming3			0x105A
 #define _Icon_Warming4			0x105C
+#define _Icon_StopCharge		0x105E
+#define _Icon_CountDownBG		0x1060
+#define _Icon_CancelCntDownTen	0x1062
+#define _Icon_CancelCntDownDigits	0x1064
+#define _Icon_ScanCntDownTen    0x1066
+#define _Icon_ScanCntDownDigits 0x1068
+#define _Icon_AuthCntDownTen    0x106A
+#define _Icon_AuthCntDownDigits 0x106C
 
 #define _String_Date			0x3000
 #define _String_Tempture		0x3010
@@ -437,6 +361,12 @@ enum _TCC_ICON_LIST_ {
 	_TCC_ShowRightGunCharging_CCS1,
 	_TCC_ShowRightGunCharging_CCS2,
 	_TCC_ShowRightGunCharging_CHAdeMo,
+	_TCC_ReturnFrontPage,
+	_TCC_CancelNum_0,
+	_TCC_TradeCancelString = 309,
+	_TCC_TradeCancelFrame,
+	_TCC_SecondSense,
+	_TCC_CntDownNumber0,
 };
 
 

+ 1 - 0
EVSE/Projects/DD360Tcci/Apps/timeout.h

@@ -60,6 +60,7 @@ enum Timeout_flag {
 	Timeout_SelectPayMode		   = 23,
 	Timeout_FinalCost			   = 24,
 	Timeout_ScanCard			   = 25,
+    Timeout_TradeCancel            = 28,
 };
 
 //------------------------------------------------------------------------------

BIN
EVSE/Projects/DD360Tcci/Images/ramdisk.gz


BIN
EVSE/Projects/DD360Tcci/output/FactoryConfig


BIN
EVSE/Projects/DD360Tcci/output/Module_ChkSysTask


BIN
EVSE/Projects/DD360Tcci/output/Module_DoComm


BIN
EVSE/Projects/DD360Tcci/output/Module_EvComm


BIN
EVSE/Projects/DD360Tcci/output/Module_EventLogging


BIN
EVSE/Projects/DD360Tcci/output/Module_InternalComm


BIN
EVSE/Projects/DD360Tcci/output/Module_LcmControl


BIN
EVSE/Projects/DD360Tcci/output/Module_PrimaryComm


BIN
EVSE/Projects/DD360Tcci/output/Module_UpdateFW


BIN
EVSE/Projects/DD360Tcci/output/ReadCmdline


BIN
EVSE/Projects/DD360Tcci/output/main


BIN
EVSE/Projects/DD360Tcci/output/simulation