瀏覽代碼

2022-08-31 / Simon Xue

Action:
1. [Fix] Plugin Page can't select gun.
2. [Add] Update Credit card final cost when get final cost. Not in
Preauthcomplete.
3. [Fix] PreAuthCancel wrong gun when plugin timeout select wrong gun.

Files
As the following commit history files

Image Verison: V2.19.XX.XXXX.XX
Simon Xue 2 年之前
父節點
當前提交
42212180ef

+ 1 - 0
EVSE/Projects/DD360Tcci/Apps/CSU/Module_Systex.h

@@ -67,5 +67,6 @@ int CreditCardPreAuth(int Fd, int PreCost,unsigned char *EVSEID, struct TransInf
 int CreditCardPreAuthComplete(int Fd, int PreCost,unsigned char *EVSEID, unsigned char *VemData,struct TransInfo *TransInfoReturn);
 int CreditCardPreAuthCancel(int Fd, int PreCost,unsigned char *EVSEID, unsigned char *ApprovalNo, unsigned char *CardNum,unsigned char *VemData);
 int CreditCardUnionSettlement(int Fd,unsigned char *EVSEID,struct TransInfo *TransInfoReturn);
+int CreditCardSale(int Fd, int Cost,unsigned char *EVSEID, struct TransInfo *TransInfoReturn);
 
 #endif

+ 20 - 4
EVSE/Projects/DD360Tcci/Apps/CSU/RFID.c

@@ -335,10 +335,10 @@ int CreditCardCancelPreAuth(int fd, uint8_t gunIndex)
     if (ShmDcCommonData->PreAuth_Result >= 0) {
         strcpy((char*)pSysConfig->UserId, "");
         //ShmDcCommonData->PayFinish[gunIndex] = TRUE;
-        log_info("Card Reader PreAuth Cancel Success");
+        log_info("Gun%d Card Reader PreAuth Cancel Success",gunIndex);
         ShmDcCommonData->TransactionInfo[gunIndex].DeductResult = _DEDUCT_CANCEL;
     } else if (ShmDcCommonData->PreAuth_Result < 0) {
-        log_info("Card Reader PreAuth Cancel Failure");
+        log_info("Gun%d Card Reader PreAuth Cancel Failure",gunIndex);
         ShmDcCommonData->TransactionInfo[gunIndex].DeductResult = _DEDUCT_PREAUTH;
     }
     ShmDcCommonData->TransactionInfo[gunIndex].IsUpload = FALSE;
@@ -554,8 +554,24 @@ void CreateRfidFork(void)
                     }
                 }
 			} // for
-            // 取消預授權
-            if(ShmDcCommonData->PreAuth_Config == _CREDITCARD_CANCEL) {
+            /*
+            if (ShmDcCommonData->PreAuth_Config == _CREDITCARD_SALE) {
+                sel_gun = pSysInfo->CurGunSelected;
+                memset(&ShmDcCommonData->TransactionInfo[sel_gun], 0, sizeof(RecordTransactionInfo));
+                CreditCardSale(fd, 1, &pSysConfig->ModelName[0], &ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard);
+                log_info("TransDate:[%s]", ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.TransDate);
+                log_info("TransTime:[%s]", ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.TransTime);
+                log_info("ROC:[%s]", ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.ROC);
+                log_info("ApprovalNo:[%s]", ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.ApprovalNo);
+                log_info("StoreId:[%s]", ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.StoreId);
+                log_info("RRN:[%s]", ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.RRN);
+
+                log_info("CardNo:[%s]", ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.CardNo);
+                log_info("TransAmount:[%s]", ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.TransAmount);
+                log_info("VemData:[%s]", ShmDcCommonData->TransactionInfo[sel_gun].pCreditCard.VemData);
+                ShmDcCommonData->PreAuth_Config = _CREDITCARD_IDLE;
+            } else*/ if(ShmDcCommonData->PreAuth_Config == _CREDITCARD_CANCEL) {
+                // 取消預授權
                 CreditCardCancelPreAuth(fd,pSysInfo->CurGunSelected);
             // 預授權
             } else if (ShmDcCommonData->PreAuth_Config == _CREDITCARD_PREAUTH /* && ShmDcCommonData->GetCardNo[pSysInfo->CurGunSelected]*/) {

+ 7 - 7
EVSE/Projects/DD360Tcci/Apps/CSU/main.c

@@ -82,8 +82,8 @@ uint8_t bd0_2_status = 0;
 uint8_t bd1_1_status = 0;
 uint8_t bd1_2_status = 0;
 
-char *fwVersion = "V2.18.00.0000.00"; // Phihong version
-char* DebugVersion = "V2.18.00";      // Software debug version
+char *fwVersion = "V2.19.00.0000.00"; // Phihong version
+char* DebugVersion = "V2.19.00";      // Software debug version
 //sqlite3 *localDb;
 bool isDb_ready;
 
@@ -1538,10 +1538,9 @@ void _DetectPlugInTimeout(uint8_t gunIndex)
 	int i;
     log_info("*********** Gun%d _DetectPlugInTimeout *********** ",gunIndex);
     pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(gunIndex);
-
-    //StopSystemTimeoutDet();
+    StopSystemTimeoutDet();
     StopGunInfoTimeoutDet(gunIndex);
-    ShmDcCommonData->TradeCancel = TRUE;
+
     if (pDcChargingInfo->RemoteStartFlag || pDcChargingInfo->isRemoteStart) {
         StopSystemTimeoutDet();
         ClearDetectPluginFlag(gunIndex);
@@ -1549,10 +1548,11 @@ void _DetectPlugInTimeout(uint8_t gunIndex)
         setChargerMode(gunIndex, S_IDLE);
         return;
     }
-
+    pSysInfo->CurGunSelected = gunIndex;
 	ShmDcCommonData->PreAuth_Config = _CREDITCARD_CANCEL;
 	ShmDcCommonData->PreAuth_Result = 0;
     pSysInfo->SystemPage = _PAGE_SENSING;
+    ShmDcCommonData->TradeCancel = TRUE;
     StartSystemTimeoutDet(Timeout_TradeCancel);
 	for(i=0;i<=30;i++) {
 		if(ShmDcCommonData->PreAuth_Config == _CREDITCARD_IDLE)
@@ -2536,7 +2536,7 @@ void CreateTimeoutFork(void)
             if (pSysInfo->SystemTimeoutFlag != 0)
             log_info("Timeout ***********SystemTimeoutFlag = %d(%d) ********",pSysInfo->SystemTimeoutFlag,
                     GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL);
-              */      
+            */      
             // 系統
             switch (pSysInfo->SystemTimeoutFlag) {
             case Timeout_SelftestChk:

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

@@ -298,7 +298,7 @@ enum _CREDITCARD_STATUS {
 	_CREDITCARD_PREAUTHCOMPLETE,
 	_CREDITCARD_CANCEL,
 	_CREDITCARD_SETTLEMENT,
-	_CREDITCARD_START,
+	_CREDITCARD_SALE,
 };
 enum _CREDIT_DEDUCT_STATUS {
     _DEDUCT_COMPLETE_FAIL = 0,

+ 2 - 0
EVSE/Projects/DD360Tcci/Apps/ModuleDoComm/DoComm.c

@@ -2275,6 +2275,8 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
                         ShmDcCommonData->PayPass_flag[plugNum] = TRUE;
                         if (pSysInfo->CurGunSelected == plugNum)
                             pSysInfo->SystemPage = _PAGE_COMPLETE;
+                    } else {
+                        UpdateDeductInfoStatus(plugNum, &ShmDcCommonData->TransactionInfo[plugNum]);
                     }
                 }
             }

+ 3 - 2
EVSE/Projects/DD360Tcci/Apps/ModuleLcmCtrl/Module_LcmControl.c

@@ -323,6 +323,7 @@ void TradeRunning(uint8_t _run)
         ChangeDisplay2Value(_Icon_Ani_Dot, 0);
         ChangeDisplay2Value(_Icon_PreAuthWord, 0);
         ChangeDisplay2Value(_Icon_CountDownBG, _TCC_TradeCancelFrame);
+        //log_info("SystemTimeoutFlag:%d", pSysInfo->SystemTimeoutFlag);
         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)));
@@ -517,7 +518,7 @@ void CheckTouchPress(short id)
         _btn_press_count = 0;
         switch (id) {
         case _Touch_Show_Left:
-        	if (pSysInfo->SystemPage >= _PAGE_ADD_FRIEND && pSysInfo->SystemPage <= _PAGE_SENSING) {
+        	if (pSysInfo->SystemPage >= _PAGE_ADD_FRIEND && pSysInfo->SystemPage <= _PAGE_PLUGIN) {
         		log_info("Authorize Process can't select gun");
         		return;
         	}
@@ -545,7 +546,7 @@ void CheckTouchPress(short id)
         	}
             break;
         case _Touch_Show_Right:
-        	if (pSysInfo->SystemPage >= _PAGE_ADD_FRIEND && pSysInfo->SystemPage <= _PAGE_SENSING) {
+        	if (pSysInfo->SystemPage >= _PAGE_ADD_FRIEND && pSysInfo->SystemPage <= _PAGE_PLUGIN) {
         		log_info("Authorize Process can't select gun");
         		return;
         	}

+ 1 - 1
EVSE/Projects/DD360Tcci/Apps/ModuleUpdateFW/Module_UpdateFW.c

@@ -83,7 +83,7 @@ void setChargerMode(uint8_t gunIndex, uint8_t mode)
 
     pDcChargingInfo->SystemStatus = mode;
 
-    log_info(" ====== System Status:%d ======",mode);
+    //log_info(" ====== System Status:%d ======",mode);
 }
 void TryCloseWatchdog()
 {

+ 2 - 0
EVSE/Projects/DD360Tcci/Apps/ReadCmdline.c

@@ -1530,6 +1530,8 @@ int main(void)
             ShmDcCommonData->PreAuth_Config = _CREDITCARD_PREAUTH;
         } else if (strcmp(newString[0], "preauthcancel") == 0) {
             ShmDcCommonData->PreAuth_Config = _CREDITCARD_CANCEL;
+        } else if (strcmp(newString[0], "sale") == 0) {
+            ShmDcCommonData->PreAuth_Config = _CREDITCARD_SALE;
         } else if (strcmp(newString[0], "chiller") == 0) { //測試槍頭和水冷機溫度
             writeChillerStatus(newString[1]);
         } else if (strcmp(newString[0], "tccdev") == 0) { //Open TCC DEV

二進制
EVSE/Projects/DD360Tcci/Images/ramdisk.gz


二進制
EVSE/Projects/DD360Tcci/output/Module_DoComm


二進制
EVSE/Projects/DD360Tcci/output/Module_LcmControl


二進制
EVSE/Projects/DD360Tcci/output/Module_UpdateFW


二進制
EVSE/Projects/DD360Tcci/output/ReadCmdline


二進制
EVSE/Projects/DD360Tcci/output/main