|
@@ -398,22 +398,29 @@ static int qrCodeUrlInfoHandle(uint8_t *data)
|
|
|
tm->tm_min);
|
|
|
|
|
|
//copy QR code string
|
|
|
- if (strncmp((char *)localTime, (char *)&data[0], timeLen) != 0) {
|
|
|
+ if (strncmp((char *)localTime, (char *)&data[0], timeLen - 2) != 0) {
|
|
|
memset(ShmSysConfigAndInfo->SysConfig.SystemId, '\0', sizeof(ShmSysConfigAndInfo->SysConfig.SystemId));
|
|
|
+ //strncpy(ShmSysConfigAndInfo->SysConfig.SystemId, '\0', sizeof(ShmSysConfigAndInfo->SysConfig.SystemId));
|
|
|
+ //printf("data = %s\r\n", data);
|
|
|
len = string2ByteArray((char *)data, (uint8_t *)ShmSysConfigAndInfo->SysConfig.SystemId);
|
|
|
+ //printf("SystemId = %s\r\n", ShmSysConfigAndInfo->SysConfig.SystemId);
|
|
|
}
|
|
|
|
|
|
- if ((char *)&data[len] == '\0') {
|
|
|
- DEBUG_ERROR("power cabinet system date error\r\n");
|
|
|
- return FAIL;
|
|
|
- }
|
|
|
+ //if ((char *)&data[len] == '\0') {
|
|
|
+ // DEBUG_ERROR("power cabinet system date error\r\n");
|
|
|
+ // return FAIL;
|
|
|
+ //}
|
|
|
|
|
|
//set system date
|
|
|
- if (strncmp((char *)localTime, (char *)&data[len], timeLen) != 0) {
|
|
|
- sprintf(cmdBuf, "date -s \"%s\" >> /dev/null", (char *)&data[len]);
|
|
|
- system(cmdBuf);
|
|
|
- DEBUG_INFO("local time = %s, data time = %s\r\n", localTime, (char *)&data[len]);
|
|
|
- }
|
|
|
+ //if (strncmp((char *)localTime, (char *)&data[len], timeLen) != 0) {
|
|
|
+ // sprintf(cmdBuf, "date -s \"%s\" >> /dev/null", (char *)&data[len]);
|
|
|
+ // system(cmdBuf);
|
|
|
+ // DEBUG_INFO("local time = %s, data time = %s\r\n", localTime, (char *)&data[len]);
|
|
|
+ // ShmOCPP16Data->MsMsg.bits.ResetReq = YES;
|
|
|
+ // strcpy((char *)ShmOCPP16Data->Reset.Type, "Soft");
|
|
|
+ // sleep(3);
|
|
|
+ // //gDoCommGblData.DisConnCount = CHECK_NETWORK_FAIL_COUNT;
|
|
|
+ //}
|
|
|
|
|
|
return PASS;
|
|
|
}
|
|
@@ -486,6 +493,9 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t id, uint8_t *data)
|
|
|
|
|
|
case MISC_CMD_OPERATIVE_STATE:
|
|
|
if ((value > YES) || (value < NO)) {
|
|
|
+ if (id == 2) {
|
|
|
+ clearMiscCommand();
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -516,6 +526,7 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t id, uint8_t *data)
|
|
|
|
|
|
case MISC_CMD_DEFAULT_CURRENCY:
|
|
|
if (value < 0) {
|
|
|
+ clearMiscCommand();
|
|
|
return FAIL;
|
|
|
}
|
|
|
|
|
@@ -526,6 +537,12 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t id, uint8_t *data)
|
|
|
|
|
|
case MISC_CMD_ACCOUNT_BALANCE:
|
|
|
if (ShmSysConfigAndInfo->SysInfo.CurGunSelected != (id - 1)) {
|
|
|
+ clearMiscCommand();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (getConfirmSelectedGun(id - 1) == FAIL) {
|
|
|
+ DEBUG_INFO("Remote start not select gun\r\n");
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -537,6 +554,7 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t id, uint8_t *data)
|
|
|
//--- Control Dispenser ---
|
|
|
case MISC_CMD_HARDWARE_REBOOT:
|
|
|
if (value != YES) {
|
|
|
+ clearMiscCommand();
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -548,6 +566,7 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t id, uint8_t *data)
|
|
|
|
|
|
case MISC_CMD_SOFTWARE_RESTART:
|
|
|
if (value != YES) {
|
|
|
+ clearMiscCommand();
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -559,28 +578,32 @@ static int miscCommandHandle(uint8_t dataLen, uint8_t id, uint8_t *data)
|
|
|
|
|
|
case MISC_CMD_REMOTE_START_CHARGING:
|
|
|
if (value != YES) {
|
|
|
+ if (id == 2) {
|
|
|
+ clearMiscCommand();
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
DEBUG_INFO("Remote start charging id = %d\r\n", id);
|
|
|
|
|
|
- //if (getConfirmSelectedGun(id - 1) == FAIL) {
|
|
|
- // DEBUG_INFO("Remote start not select gun\r\n");
|
|
|
- // break;
|
|
|
- //}
|
|
|
-
|
|
|
- if (getSelGunWaitToAuthor(id - 1) == FAIL) {
|
|
|
- DEBUG_ERROR("Remote start gun already charging\r\n");
|
|
|
+ if (getConfirmSelectedGun(id - 1) == FAIL) {
|
|
|
+ DEBUG_INFO("Remote start not select gun\r\n");
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- if (ShmSysConfigAndInfo->SysInfo.CurGunSelected != (id - 1)) {
|
|
|
- ShmSysConfigAndInfo->SysInfo.CurGunSelected = (id - 1);
|
|
|
- ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc = NO_DEFINE;
|
|
|
- }
|
|
|
+ //if (getSelGunWaitToAuthor(id - 1) == FAIL) {
|
|
|
+ // DEBUG_ERROR("Remote start gun already charging\r\n");
|
|
|
+ // break;
|
|
|
+ //}
|
|
|
+
|
|
|
+ //if (ShmSysConfigAndInfo->SysInfo.CurGunSelected != (id - 1)) {
|
|
|
+ // ShmSysConfigAndInfo->SysInfo.CurGunSelected = (id - 1);
|
|
|
+ // ShmSysConfigAndInfo->SysInfo.CurGunSelectedByAc = NO_DEFINE;
|
|
|
+ //}
|
|
|
|
|
|
- setConfirmSelGun(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
|
|
|
+ //setConfirmSelGun(ShmSysConfigAndInfo->SysInfo.CurGunSelected);
|
|
|
|
|
|
ShmOCPP16Data->CsMsg.bits[id - 1].RemoteStartTransactionReq = YES;
|
|
|
+ gAudiCustInfo->PricesInfo[id - 1].Balance = 0.00;
|
|
|
if (id == 2) {
|
|
|
clearMiscCommand();
|
|
|
}
|
|
@@ -704,15 +727,17 @@ static int powerCabinetStatusProcess(uint8_t dataLen, uint8_t *data)
|
|
|
}
|
|
|
|
|
|
for (count = 0; count < dataLen; count += WARNING_CODE_SIZE) {
|
|
|
- //printf("status code = %s\r\n", &data[count]);
|
|
|
-
|
|
|
// misc command status code handle
|
|
|
if (strcmp((char *)&data[count], MISC_ST_MISC_CMD) == 0) {
|
|
|
- gDoCommGblData.MiscCmd = REG_MISC_CONTROL;
|
|
|
+ if (gDoCommGblData.MiscCmd != REG_MISC_CONTROL) {
|
|
|
+ gDoCommGblData.MiscCmd = REG_MISC_CONTROL;
|
|
|
+ }
|
|
|
memset((char *)&data[count], 0, WARNING_CODE_SIZE);
|
|
|
continue;
|
|
|
} else if (strcmp((char *)&data[count], MISC_ST_VERSION) == 0) {
|
|
|
- gDoCommGblData.MiscCmd = REG_REPORT_CSU_VERSION;
|
|
|
+ if (gDoCommGblData.MiscCmd != REG_REPORT_CSU_VERSION) {
|
|
|
+ gDoCommGblData.MiscCmd = REG_REPORT_CSU_VERSION;
|
|
|
+ }
|
|
|
memset((char *)&data[count], 0, WARNING_CODE_SIZE);
|
|
|
continue;
|
|
|
}
|
|
@@ -1517,7 +1542,7 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
|
|
|
if ((writeCsuModuleVersion(fd) == PASS) &&
|
|
|
(writeOtherModuleVersion(fd) == PASS) &&
|
|
|
(readPowerCabinetSystemID(fd) == PASS)) {
|
|
|
- gDoCommGblData.DisConnCount = 0;
|
|
|
+ //gDoCommGblData.DisConnCount = 0;
|
|
|
isContinue = 0;
|
|
|
}
|
|
|
}
|
|
@@ -1546,6 +1571,10 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
|
|
|
// break;
|
|
|
|
|
|
default:
|
|
|
+ DEBUG_ERROR("error curReg = %x\r\n", curReg);
|
|
|
+ gDoCommGblData.MiscCmd = 0;
|
|
|
+ gDoCommGblData.DisConnCount = CHECK_NETWORK_FAIL_COUNT;
|
|
|
+ isContinue = 0;
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -1557,6 +1586,15 @@ static int messageTrigger(int fd, uint8_t plugNum, uint8_t gunID, uint8_t curReg
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+static bool isDetectPlugin()
|
|
|
+{
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.WaitForPlugit == YES) {
|
|
|
+ return YES;
|
|
|
+ }
|
|
|
+
|
|
|
+ return NO;
|
|
|
+}
|
|
|
+
|
|
|
static void systemStatusProcess(int fd, uint8_t plugNum, uint8_t gunID)
|
|
|
{
|
|
|
struct timeb AuthNowTime = {0};
|
|
@@ -1828,5 +1866,6 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
initDone = DISPENER_INIT_FAIL;
|
|
|
}
|
|
|
+ usleep(1000);
|
|
|
}
|
|
|
}
|