|
@@ -156,7 +156,7 @@ int StoreLogMsg(const char *fmt, ...)
|
|
|
|
|
|
if((ShmSysConfigAndInfo->SysConfig.ModelName != NULL) && (ShmSysConfigAndInfo->SysConfig.SerialNumber != NULL) && (strlen((char*)ShmSysConfigAndInfo->SysConfig.ModelName) >= 14))
|
|
|
{
|
|
|
- sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
|
|
|
+ sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]%s_%s_SystemLog",
|
|
|
tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
|
|
|
buffer,
|
|
|
tm->tm_year+1900,tm->tm_mon+1,
|
|
@@ -165,7 +165,7 @@ int StoreLogMsg(const char *fmt, ...)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- sprintf(Buf,"echo \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
|
|
|
+ sprintf(Buf,"echo -n \"[%04d.%02d.%02d %02d:%02d:%02d] - %s\" >> /Storage/SystemLog/[%04d.%02d]SystemLog",
|
|
|
tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec,
|
|
|
buffer,
|
|
|
tm->tm_year+1900,tm->tm_mon+1);
|
|
@@ -974,7 +974,6 @@ void InitEthernet()
|
|
|
{
|
|
|
if(isReachableInternet() == PASS)
|
|
|
{
|
|
|
- ShmSysConfigAndInfo->SysInfo.InternetConn = ON;
|
|
|
ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=OFF;
|
|
|
cnt_pingDNS_Fail = 0;
|
|
|
}
|
|
@@ -982,10 +981,20 @@ void InitEthernet()
|
|
|
{
|
|
|
if(++cnt_pingDNS_Fail > 3)
|
|
|
{
|
|
|
- ShmSysConfigAndInfo->SysInfo.InternetConn = OFF;
|
|
|
ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=ON;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet &&
|
|
|
+ ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi &&
|
|
|
+ ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi)
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysInfo.InternetConn = OFF;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysInfo.InternetConn = ON;
|
|
|
+ }
|
|
|
|
|
|
sleep(5);
|
|
|
}
|
|
@@ -1181,7 +1190,7 @@ void get_firmware_version(unsigned char gun_index)
|
|
|
strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
|
|
|
|
|
|
// Get CSU root file system version
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.48.00.0000.00");
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.50.00.0000.00");
|
|
|
|
|
|
// Get AC connector type from model name
|
|
|
for(uint8_t idx=0;idx<3;idx++)
|
|
@@ -1636,8 +1645,7 @@ int isReachableInternet()
|
|
|
|
|
|
for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
|
|
|
{
|
|
|
- strcpy(cmd, "ping -c 1 -w 3 ");
|
|
|
- strcat(cmd, valid_Internet[idx]);
|
|
|
+ sprintf(cmd, "ping -c 1 -w 3 -I eth0 %s", valid_Internet[idx]);
|
|
|
fp = popen(cmd, "r");
|
|
|
if(fp != NULL)
|
|
|
{
|
|
@@ -1884,10 +1892,13 @@ void checkTask()
|
|
|
system("/root/Module_EventLogging &");
|
|
|
}
|
|
|
|
|
|
- if(system("pidof -s OcppBackend > /dev/null") != 0)
|
|
|
+ if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") != 0)
|
|
|
{
|
|
|
- DEBUG_INFO("OcppBackend not running, restart it.\r\n");
|
|
|
- system("/root/OcppBackend &");
|
|
|
+ if(system("pidof -s OcppBackend > /dev/null") != 0)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("OcppBackend not running, restart it.\r\n");
|
|
|
+ system("/root/OcppBackend &");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if(system("pidof -s Module_AlarmDetect > /dev/null") != 0)
|
|
@@ -2250,6 +2261,18 @@ int main(void)
|
|
|
|
|
|
// Set max current to rating current
|
|
|
ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current = ShmCharger->gun_info[gun_index].primaryMcuState.rating_current;
|
|
|
+
|
|
|
+ // Default Ethernet / Wifi / 4G to 1:disconnected
|
|
|
+ ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet = ON;
|
|
|
+ ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi = ON;
|
|
|
+ ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectVia4Gi = ON;
|
|
|
+
|
|
|
+ // If Web Server OPCC URL is empty kill Module_OcppBackend
|
|
|
+ if(strcmp((char *)&ShmSysConfigAndInfo->SysConfig.OcppServerURL,"") == 0)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("URL is empty kill Module_OcppBackend...\r\n");
|
|
|
+ system ("pkill OcppBackend");
|
|
|
+ }
|
|
|
|
|
|
// If rotate switch equal zero, the system needs to change Debug mode
|
|
|
if(ShmCharger->gun_info[gun_index].primaryMcuState.rotatory_switch == 0)
|
|
@@ -2425,7 +2448,7 @@ int main(void)
|
|
|
case START_METHOD_RFID:
|
|
|
if((ShmOCPP16Data->SpMsg.bits.AuthorizeConf) ||
|
|
|
(!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)) ||
|
|
|
- (!ShmOCPP16Data->OcppConnStatus && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
|
|
|
+ (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
|
|
|
(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_NOCHARGE))
|
|
|
{
|
|
|
if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
|
|
@@ -2531,6 +2554,8 @@ int main(void)
|
|
|
ftime(&startChargingTime[gun_index]);
|
|
|
ftime(&startTime[gun_index][TMR_IDX_LOGPPRINTOUT]);
|
|
|
ftime(&startTime[gun_index][TMR_IDX_PROFILE_PREPARE]);
|
|
|
+ startTime[gun_index][TMR_IDX_AUTH].time -= TIMEOUT_SPEC_AUTH;
|
|
|
+ ShmOCPP16Data->SpMsg.bits.AuthorizeReq = OFF;
|
|
|
}
|
|
|
|
|
|
if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
|
|
@@ -2540,7 +2565,132 @@ int main(void)
|
|
|
(ShmOCPP16Data->MsMsg.bits.ResetReq) ||
|
|
|
(ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON))
|
|
|
{
|
|
|
- setChargerMode(gun_index, SYS_MODE_TERMINATING);
|
|
|
+
|
|
|
+ if(ShmCharger->gun_info[gun_index].rfidReq)
|
|
|
+ {
|
|
|
+ // If RFID SN different with start user, it need to authorize ID
|
|
|
+ if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
|
|
|
+ {
|
|
|
+ if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH) && !ShmOCPP16Data->SpMsg.bits.AuthorizeReq)
|
|
|
+ {
|
|
|
+ // Request authorization
|
|
|
+ ftime(&startTime[gun_index][TMR_IDX_AUTH]);
|
|
|
+ memset(ShmSysConfigAndInfo->SysConfig.UserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
|
|
|
+ {
|
|
|
+ // Big endian
|
|
|
+ switch(rfid.snType)
|
|
|
+ {
|
|
|
+ case RFID_SN_TYPE_6BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_7BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_10BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_4BYTE:
|
|
|
+ default:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Little endian
|
|
|
+ switch(rfid.snType)
|
|
|
+ {
|
|
|
+ case RFID_SN_TYPE_6BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_7BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_10BYTE:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
+ break;
|
|
|
+ case RFID_SN_TYPE_4BYTE:
|
|
|
+ default:
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ DEBUG_INFO("End request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
|
|
|
+ DEBUG_INFO("Start method : %d...\r\n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
|
|
|
+
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID) ||
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND) ||
|
|
|
+ (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE))
|
|
|
+ {
|
|
|
+ switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
|
|
|
+ {
|
|
|
+ case AUTH_MODE_ENABLE:
|
|
|
+ if(ShmOCPP16Data->OcppConnStatus)
|
|
|
+ {
|
|
|
+ // On line
|
|
|
+ ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Off line
|
|
|
+ switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
|
|
|
+ {
|
|
|
+ case OFF_POLICY_LOCALLIST:
|
|
|
+ ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
|
|
|
+ break;
|
|
|
+ case OFF_POLICY_PH_RFID:
|
|
|
+ break;
|
|
|
+ case OFF_POLICY_FREE:
|
|
|
+ break;
|
|
|
+ case OFF_POLICY_NOCHARGE:
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case AUTH_MODE_DISABLE:
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf ||
|
|
|
+ (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
|
|
|
+ (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
|
|
|
+ (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
|
|
|
+ {
|
|
|
+ if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
|
|
|
+ (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
|
|
|
+ (!ShmOCPP16Data->OcppConnStatus && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)) ||
|
|
|
+ (!ShmOCPP16Data->OcppConnStatus && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
|
|
|
+ {
|
|
|
+ ShmCharger->gun_info[gun_index].isAuthPassEnd = ON;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
+ ShmOCPP16Data->SpMsg.bits.AuthorizeReq = OFF;
|
|
|
+ DEBUG_INFO("Authorize fail.\r\n");
|
|
|
+ setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
|
|
|
+ setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
|
|
|
+ sleep(3);
|
|
|
+ }
|
|
|
+
|
|
|
+ startTime[gun_index][TMR_IDX_AUTH].time -= TIMEOUT_SPEC_AUTH;
|
|
|
+ ShmOCPP16Data->SpMsg.bits.AuthorizeConf = OFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // If Authorize is accpted or Rfid card match with start User, The system should terminating to the end
|
|
|
+ if(ShmCharger->gun_info[gun_index].isAuthPassEnd || isMatchStartUser(gun_index))
|
|
|
+ setChargerMode(gun_index, SYS_MODE_TERMINATING);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ setChargerMode(gun_index, SYS_MODE_TERMINATING);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2767,132 +2917,6 @@ int main(void)
|
|
|
getDateTimeString((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StopDateTime);
|
|
|
}
|
|
|
|
|
|
- // If RFID SN different with start user, it need to authorize ID
|
|
|
- if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
|
|
|
- {
|
|
|
- if((DiffTimebWithNow(startTime[gun_index][TMR_IDX_AUTH]) > TIMEOUT_SPEC_AUTH) && !ShmOCPP16Data->SpMsg.bits.AuthorizeReq)
|
|
|
- {
|
|
|
- // Request authorization
|
|
|
- ftime(&startTime[gun_index][TMR_IDX_AUTH]);
|
|
|
- memset(ShmSysConfigAndInfo->SysConfig.UserId, 0x00, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
|
|
|
- {
|
|
|
- // Big endian
|
|
|
- switch(rfid.snType)
|
|
|
- {
|
|
|
- case RFID_SN_TYPE_6BYTE:
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5]);
|
|
|
- break;
|
|
|
- case RFID_SN_TYPE_7BYTE:
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6]);
|
|
|
- break;
|
|
|
- case RFID_SN_TYPE_10BYTE:
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3], rfid.currentCard[4], rfid.currentCard[5], rfid.currentCard[6], rfid.currentCard[7], rfid.currentCard[8], rfid.currentCard[9]);
|
|
|
- break;
|
|
|
- case RFID_SN_TYPE_4BYTE:
|
|
|
- default:
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[0], rfid.currentCard[1], rfid.currentCard[2], rfid.currentCard[3]);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // Little endian
|
|
|
- switch(rfid.snType)
|
|
|
- {
|
|
|
- case RFID_SN_TYPE_6BYTE:
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X", rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
- break;
|
|
|
- case RFID_SN_TYPE_7BYTE:
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
- break;
|
|
|
- case RFID_SN_TYPE_10BYTE:
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", rfid.currentCard[9], rfid.currentCard[8], rfid.currentCard[7], rfid.currentCard[6], rfid.currentCard[5], rfid.currentCard[4], rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
- break;
|
|
|
- case RFID_SN_TYPE_4BYTE:
|
|
|
- default:
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysConfig.UserId, "%02X%02X%02X%02X", rfid.currentCard[3], rfid.currentCard[2], rfid.currentCard[1], rfid.currentCard[0]);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- DEBUG_INFO("End request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
|
|
|
- DEBUG_INFO("Start method : %d...\r\n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
|
|
|
-
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID)
|
|
|
- {
|
|
|
- switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
|
|
|
- {
|
|
|
- case AUTH_MODE_ENABLE:
|
|
|
- if(ShmOCPP16Data->OcppConnStatus)
|
|
|
- {
|
|
|
- // On line
|
|
|
- ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // Off line
|
|
|
- switch(ShmSysConfigAndInfo->SysConfig.OfflinePolicy)
|
|
|
- {
|
|
|
- case OFF_POLICY_LOCALLIST:
|
|
|
- ShmOCPP16Data->SpMsg.bits.AuthorizeReq = ON;
|
|
|
- break;
|
|
|
- case OFF_POLICY_PH_RFID:
|
|
|
- break;
|
|
|
- case OFF_POLICY_FREE:
|
|
|
- break;
|
|
|
- case OFF_POLICY_NOCHARGE:
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case AUTH_MODE_DISABLE:
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- else if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND)
|
|
|
- {
|
|
|
- ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
- DEBUG_INFO("Need to match with start method : START_METHOD_BACKEND...\r\n");
|
|
|
- setChargerMode(gun_index, SYS_MODE_CHARGING);
|
|
|
- }
|
|
|
- else if (ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BLE)
|
|
|
- {
|
|
|
- ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
- DEBUG_INFO("Need to match with start method : START_METHOD_BLE...\r\n");
|
|
|
- setChargerMode(gun_index, SYS_MODE_CHARGING);
|
|
|
- }
|
|
|
- else
|
|
|
- {}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf ||
|
|
|
- (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
|
|
|
- (!ShmOCPP16Data->OcppConnStatus&&(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
|
|
|
- {
|
|
|
- if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
|
|
|
- (ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
|
|
|
- (!ShmOCPP16Data->OcppConnStatus&&(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
|
|
|
- {
|
|
|
- ShmCharger->gun_info[gun_index].isAuthPassEnd = ON;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
-
|
|
|
- DEBUG_INFO("Authorize fail.\r\n");
|
|
|
- setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
|
|
|
- setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
|
|
|
- sleep(3);
|
|
|
- }
|
|
|
-
|
|
|
- ShmOCPP16Data->SpMsg.bits.AuthorizeConf = OFF;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// End authorize pass
|
|
|
if(((ShmCharger->gun_info[gun_index].rfidReq == ON) && isMatchStartUser(gun_index)) ||
|
|
|
(ShmCharger->gun_info[gun_index].isAuthPassEnd) ||
|