|
@@ -1075,7 +1075,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.28.00.0000.00");
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.29.00.0000.00");
|
|
|
|
|
|
// Get AC connector type from model name
|
|
|
for(uint8_t idx=0;idx<3;idx++)
|
|
@@ -1949,11 +1949,13 @@ int main(void)
|
|
|
//==========================================
|
|
|
if(ShmOCPP16Data->MsMsg.bits.ResetReq)
|
|
|
{
|
|
|
- if((!isMode(0, SYS_MODE_CHARGING) && !isMode(0, SYS_MODE_TERMINATING)) &&
|
|
|
- (AC_QUANTITY>1?(!isMode(1, SYS_MODE_CHARGING) && !isMode(1, SYS_MODE_TERMINATING)):true))
|
|
|
+ if((!isMode(0, SYS_MODE_CHARGING) && !isMode(0, SYS_MODE_TERMINATING) && !isMode(0, SYS_MODE_COMPLETE)) &&
|
|
|
+ (AC_QUANTITY>1?(!isMode(1, SYS_MODE_CHARGING) && !isMode(1, SYS_MODE_TERMINATING) && !isMode(0, SYS_MODE_COMPLETE)):true))
|
|
|
{
|
|
|
ShmOCPP16Data->MsMsg.bits.ResetReq = OFF;
|
|
|
-
|
|
|
+ sprintf((char*)ShmOCPP16Data->Reset.ResponseStatus, "Accepted");
|
|
|
+ ShmOCPP16Data->MsMsg.bits.ResetConf = ON;
|
|
|
+
|
|
|
if(strcmp((char*)ShmOCPP16Data->Reset.Type, "Hard") == 0)
|
|
|
{
|
|
|
system("sync");
|
|
@@ -2069,6 +2071,10 @@ int main(void)
|
|
|
if(ShmOCPP16Data->CsMsg.bits[gun_index].UnlockConnectorReq == ON)
|
|
|
{
|
|
|
ShmOCPP16Data->CsMsg.bits[gun_index].UnlockConnectorReq = OFF;
|
|
|
+
|
|
|
+ sprintf((char*)ShmOCPP16Data->UnlockConnector[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].ResponseStatus, "NotSupported");
|
|
|
+ ShmOCPP16Data->CsMsg.bits[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].UnlockConnectorConf = ON;
|
|
|
+
|
|
|
ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor = ON;
|
|
|
}
|
|
|
|
|
@@ -2392,17 +2398,7 @@ int main(void)
|
|
|
ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
ftime(&startChargingTime[gun_index]);
|
|
|
ftime(&startTime[gun_index][TMR_IDX_LOGPPRINTOUT]);
|
|
|
- }
|
|
|
-
|
|
|
- // Charging profile preparation
|
|
|
- if(!ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf)
|
|
|
- {
|
|
|
- ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq = ON;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf = OFF;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
|
|
|
(ShmCharger->gun_info[gun_index].bleConfigData.isRequestStop == ON) ||
|
|
@@ -2542,6 +2538,16 @@ int main(void)
|
|
|
// Debug information
|
|
|
if(DiffTimebWithNow(startTime[gun_index][TMR_IDX_LOGPPRINTOUT]) > TIMEOUT_SPEC_LOGPPRINTOUT)
|
|
|
{
|
|
|
+ // Charging profile preparation
|
|
|
+ if(!ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileReq = ON;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->CSUMsg.bits[gun_index].ChargingProfileConf = OFF;
|
|
|
+ }
|
|
|
+
|
|
|
DEBUG_INFO("=======================================================================\r\n");
|
|
|
DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent: %d \r\n", ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
|
|
|
DEBUG_INFO("ShmCharger->gun_info[%d].primaryMcuCp_Pwn_Duty.max_current: %d\r\n", gun_index, ShmCharger->gun_info[gun_index].primaryMcuCp_Pwn_Duty.max_current);
|
|
@@ -2705,7 +2711,7 @@ int main(void)
|
|
|
{
|
|
|
if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf ||
|
|
|
(ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
|
|
|
- !ShmOCPP16Data->OcppConnStatus)
|
|
|
+ (!ShmOCPP16Data->OcppConnStatus&&(ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_FREE)))
|
|
|
{
|
|
|
if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) ||
|
|
|
(ShmSysConfigAndInfo->SysConfig.AuthorisationMode == AUTH_MODE_DISABLE) ||
|
|
@@ -2802,9 +2808,7 @@ int main(void)
|
|
|
}
|
|
|
else if(ShmCharger->gun_info[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].isUnlockerConnetor == ON)
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP16Data->StopTransaction[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].StopReason, "UnlockCommand");
|
|
|
- sprintf((char*)ShmOCPP16Data->UnlockConnector[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].ResponseStatus, "Unlocked");
|
|
|
- ShmOCPP16Data->CsMsg.bits[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].UnlockConnectorConf = ON;
|
|
|
+ sprintf((char*)ShmOCPP16Data->StopTransaction[ShmOCPP16Data->UnlockConnector[gun_index].ConnectorId-1].StopReason, "UnlockCommand");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2988,6 +2992,81 @@ int main(void)
|
|
|
ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationReq = OFF;
|
|
|
ShmOCPP16Data->CsMsg.bits[gun_index].CancelReservationConf = ON;
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Check is there RFID or back end request start
|
|
|
+ if((ShmCharger->gun_info[gun_index].rfidReq == ON) ||
|
|
|
+ (ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq == ON))
|
|
|
+ {
|
|
|
+ if((ShmCharger->gun_info[gun_index].rfidReq == ON))
|
|
|
+ {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp((char*)ShmSysConfigAndInfo->SysConfig.UserId, (char*)ShmOCPP16Data->ReserveNow[gun_index].IdTag) == 0)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("Start Method in reservation : RFID...\r\n");
|
|
|
+ DEBUG_INFO("Start request User Id : %s\r\n", ShmSysConfigAndInfo->SysConfig.UserId);
|
|
|
+ DEBUG_INFO("Reservation User Id : %s\r\n", ShmOCPP16Data->ReserveNow[gun_index].IdTag);
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_RFID;
|
|
|
+ setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
|
|
|
+ }
|
|
|
+
|
|
|
+ ShmCharger->gun_info[gun_index].rfidReq = OFF;
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq)
|
|
|
+ {
|
|
|
+ if(strcmp((char*)ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, (char*)ShmOCPP16Data->ReserveNow[gun_index].IdTag) == 0)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("Start Method in reservation: BACKEND...\r\n");
|
|
|
+ ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_BACKEND;
|
|
|
+ memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag, ARRAY_SIZE(ShmOCPP16Data->RemoteStartTransaction[gun_index].IdTag));
|
|
|
+ setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
|
|
|
+ }
|
|
|
+ ShmOCPP16Data->CsMsg.bits[gun_index].RemoteStartTransactionReq = OFF;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
case SYS_MODE_BOOKING:
|