瀏覽代碼

[Improve][AW-Regular][main.c]
2022-08-24 / EASON YANG
Action:
1. Improve: Start charging session if parentIdtag same as reservation request.

File:
1. main.c
Action 1

FIRMWARE VERSION: V0.71.XX.XXXX.PX

8009 2 年之前
父節點
當前提交
f34ab5e4d8
共有 1 個文件被更改,包括 99 次插入61 次删除
  1. 99 61
      EVSE/Projects/AW-Regular/Apps/main.c

+ 99 - 61
EVSE/Projects/AW-Regular/Apps/main.c

@@ -685,10 +685,27 @@ uint8_t ocpp_get_remotestop(uint8_t gun_index)
 	return result;
 }
 
+void ocpp_set_auth_conf(uint8_t status)
+{
+	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+	{
+		if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf != status)
+			ShmOCPP16Data->SpMsg.bits.AuthorizeConf = status;
+	}
+	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+	{
+		if(ShmOCPP20Data->SpMsg.bits.AuthorizeConf != status)
+			ShmOCPP20Data->SpMsg.bits.AuthorizeConf = status;
+	}
+}
+
 void ocpp_set_auth_req(uint8_t status, ...)
 {
 	va_list args;
 
+	if(status == ON)
+		ocpp_set_auth_conf(OFF);
+
 	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 	{
 		if(ShmOCPP16Data->SpMsg.bits.AuthorizeReq != status)
@@ -732,20 +749,6 @@ uint8_t ocpp_get_auth_req()
 	return result;
 }
 
-void ocpp_set_auth_conf(uint8_t status)
-{
-	if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
-	{
-		if(ShmOCPP16Data->SpMsg.bits.AuthorizeConf != status)
-			ShmOCPP16Data->SpMsg.bits.AuthorizeConf = status;
-	}
-	else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
-	{
-		if(ShmOCPP20Data->SpMsg.bits.AuthorizeConf != status)
-			ShmOCPP20Data->SpMsg.bits.AuthorizeConf = status;
-	}
-}
-
 uint8_t ocpp_get_auth_conf()
 {
 	uint8_t result = OFF;
@@ -771,52 +774,73 @@ uint8_t ocpp_get_auth_result(uint8_t gun_index)
 		case SYS_MODE_AUTHORIZING:
 			if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 			{
-				if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0))
+				if(((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId == -1) && (strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0)) ||
+					((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId != -1) && ((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) && (strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag, (char*)ShmOCPP16Data->ReserveNow[gun_index].ParentIdTag)==0))))
 					result = PASS;
+
+				DEBUG_INFO("============ [SYS_MODE_AUTHORIZING] ==============\n");
+				DEBUG_INFO("Authorize response status: [ %s ].\n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status);
+				if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId != -1))
+				{
+					DEBUG_INFO("Gun-%d Reservation id: [ %d ].\n", gun_index, ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId);
+					DEBUG_INFO("Authorize response ParentIdTag: [ %s ].\n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag);
+					DEBUG_INFO("Gun-%d Reserve ParentIdTag: [ %s ].\n", gun_index, ShmOCPP16Data->ReserveNow[gun_index].ParentIdTag);
+				}
+				DEBUG_INFO("==================================================\n");
 			}
 			else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 			{
-				if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0) &&
-				   (strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_MasterPassGroupId].variableAttribute[0].value) != 0))
+				if(((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId == -1) && ((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0) && (strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_MasterPassGroupId].variableAttribute[0].value) != 0))) ||
+				   ((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId != -1) && ((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0) && (strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->ReserveNow[gun_index].groupIdToken.idToken)==0))))
 					result = PASS;
 			}
-
 			break;
 		case SYS_MODE_CHARGING:
 		case SYS_MODE_TERMINATING:
 			if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
 			{
-				DEBUG_INFO("==========================================\n");
-				DEBUG_INFO("=== OCPP GETTING AUTHORIZE RESULT 1.6 ====\n");
-				DEBUG_INFO("==========================================\n");
-				DEBUG_INFO("Authorize.ResponseIdTagInfo.ParentIdTag : %s \n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag);
-				DEBUG_INFO("StartTransaction[%d].ResponseIdTagInfo.ParentIdTag : %s \n", gun_index ,ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ParentIdTag);
-
 				if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) &&
 				   (strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag, (char*)ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ParentIdTag)==0))
 					result = PASS;
+
+				DEBUG_INFO("==== [SYS_MODE_CHARGING/SYS_MODE_TERMINATING] ====\n");
+				DEBUG_INFO("Authorize response status: [ %s ]. \n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status);
+				DEBUG_INFO("Authorize response ParentIdTag: [ %s ]. \n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag);
+				DEBUG_INFO("Gun-%d StartTransaction response ParentIdTag: [ %s ]. \n", gun_index, ShmOCPP16Data->StartTransaction[gun_index].ResponseIdTagInfo.ParentIdTag);
+				DEBUG_INFO("==================================================\n");
 			}
 			else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
 			{
-				DEBUG_INFO("==========================================\n");
-				DEBUG_INFO("=== OCPP GETTING AUTHORIZE RESULT 2.0 ====\n");
-				DEBUG_INFO("==========================================\n");
-				DEBUG_INFO("Authorize.Response_idTokenInfo.groupIdToken.idToken : %s \n", ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken);
-				DEBUG_INFO("TransactionEvent[%d].Response_idTokenInfo.groupIdToken.idToken : %s \n", gun_index, ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.groupIdToken.idToken);
-
 				if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0) &&
 				   ((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->TransactionEvent[gun_index].Response_idTokenInfo.groupIdToken.idToken) == 0) ||
 					(strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->ControllerComponentVariable[AuthCtrlr_MasterPassGroupId].variableAttribute[0].value) == 0)))
 					result = PASS;
 			}
+			break;
+		case SYS_MODE_RESERVATION:
+			if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_16)
+			{
+				if((strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status, "Accepted")==0) &&
+				   (strcmp((char*)ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag, (char*)ShmOCPP16Data->ReserveNow[gun_index].ParentIdTag)==0))
+					result = PASS;
 
+				DEBUG_INFO("============ [SYS_MODE_RESERVATION] ==============\n");
+				DEBUG_INFO("Authorize response status: [ %s ]. \n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.Status);
+				DEBUG_INFO("Authorize response ParentIdTag: [ %s ]. \n", ShmOCPP16Data->Authorize.ResponseIdTagInfo.ParentIdTag);
+				DEBUG_INFO("Gun-%d Reserve ParentIdTag: [ %s ]. \n", gun_index, ShmOCPP16Data->ReserveNow[gun_index].ParentIdTag);
+				DEBUG_INFO("==================================================\n");
+			}
+			else if(ShmSysConfigAndInfo->SysInfo.OcppRunningVer == OCPP_RUNNING_VERSION_20)
+			{
+				if((strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.status, "Accepted")==0) &&
+				   (strcmp((char*)ShmOCPP20Data->Authorize.Response_idTokenInfo.groupIdToken.idToken, (char*)ShmOCPP20Data->ReserveNow[gun_index].groupIdToken.idToken)==0))
+					result = PASS;
+			}
 			break;
 		default:
 			break;
 	}
 
-	DEBUG_INFO("Authorize result : %s \n", ((result == PASS)?"Pass":"Fail"));
-
 	return result;
 }
 
@@ -2892,11 +2916,6 @@ int isMatchStartUser(unsigned char gun_index)
 		}
 	}
 
-	DEBUG_INFO("==== isMatchStartUser ==== \n");
-	DEBUG_INFO("tmpUser : %s \n", tmpUser);
-	DEBUG_INFO("StartUserId : %s \n", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
-	DEBUG_INFO("========================== \n");
-
 	return ((strcmp((char*)tmpUser, (char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId)==0)?YES:NO);
 }
 
@@ -4597,7 +4616,8 @@ int main(void)
 						if((ShmCharger->gun_info[gun_index].rfidReq == ON))
 						{
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_RFID;
-							DEBUG_INFO("Start Method : RFID...\n");
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_ISO14443;
+							DEBUG_INFO("Start Method: RFID...\n");
 							if(ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian)
 							{
 								// Big endian
@@ -4639,26 +4659,29 @@ int main(void)
 								}
 							}
 
-							DEBUG_INFO("Start request UserId : %s\n", ShmSysConfigAndInfo->SysConfig.UserId);
+							DEBUG_INFO("Start request UserId: %s\n", ShmSysConfigAndInfo->SysConfig.UserId);
 						}
 						else if(ocpp_get_remotestart(gun_index))
 						{
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_BACKEND;
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_Central;
 							ocpp_copy_userid_from_remotestart(gun_index);
-							DEBUG_INFO("Start Method : BACKEND...\n");
+							DEBUG_INFO("Start Method: BACKEND...\n");
 						}
 						else if(ShmCharger->gun_info[gun_index].bleConfigData.isRequestStart == ON)
 						{
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_BLE;
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_Local;
 							memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmCharger->gun_info[gun_index].bleLoginCentralId.id, ARRAY_SIZE(ShmCharger->gun_info[gun_index].bleLoginCentralId.id));
-							DEBUG_INFO("Start Method : BLE...\n");
+							DEBUG_INFO("Start Method: BLE...\n");
 						}
 						else
 						{
 							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_FREE;
+							ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_NoAuthorization;
 							//memcpy(ShmSysConfigAndInfo->SysConfig.UserId, ShmSysConfigAndInfo->SysConfig.SerialNumber, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
 							ocpp_get_freevend_idtag(ShmSysConfigAndInfo->SysConfig.UserId);
-							DEBUG_INFO("Start Method : FREE...\n");
+							DEBUG_INFO("Start Method: FREE...\n");
 						}
 
 						ShmCharger->gun_info[gun_index].rfidReq = OFF;
@@ -4685,6 +4708,7 @@ int main(void)
 						ftime(&startTime[gun_index][TMR_IDX_AUTH]);
 						if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID)
 						{
+							DEBUG_INFO("Rfid start request authorize.\n");
 							switch(ShmSysConfigAndInfo->SysConfig.AuthorisationMode)
 							{
 								case AUTH_MODE_ENABLE:
@@ -4747,7 +4771,7 @@ int main(void)
 									   (!ocpp_get_connection_status() && (isValidLocalWhiteCard() == PASS) && (ShmSysConfigAndInfo->SysConfig.OfflinePolicy == OFF_POLICY_LOCALLIST)))
 									{
 										memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
-										DEBUG_INFO("[START_METHOD_RFID] StartUserId : %s \n",ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
+										DEBUG_INFO("[START_METHOD_RFID] StartUserId: %s \n",ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
 
 										DEBUG_INFO("Authorize pass.\n");
 										setSpeaker(ON,SPEAKER_SHORT);
@@ -4761,7 +4785,10 @@ int main(void)
 										setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
 										setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
 										sleep(3);
-										setChargerMode(gun_index, SYS_MODE_IDLE);
+										if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId == -1)
+											setChargerMode(gun_index, SYS_MODE_IDLE);
+										else
+											setChargerMode(gun_index, SYS_MODE_RESERVATION);
 									}
 
 									ShmCharger->gun_info[gun_index].rfidReq = OFF;
@@ -4776,7 +4803,7 @@ int main(void)
 										if(ocpp_get_auth_result(gun_index))
 										{
 											memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
-											DEBUG_INFO("[START_METHOD_BACKEND] StartUserId : %s \n",ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
+											DEBUG_INFO("[START_METHOD_BACKEND] StartUserId: %s \n",ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
 
 											DEBUG_INFO("Authorize pass.\n");
 											setSpeaker(ON,SPEAKER_SHORT);
@@ -4790,7 +4817,10 @@ int main(void)
 											setSpeaker(ON,SPEAKER_INTERVAL_3COUNT);
 											setLedMotion(gun_index,LED_ACTION_RFID_FAIL);
 											sleep(3);
-											setChargerMode(gun_index, SYS_MODE_IDLE);
+											if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].ReservationId == -1)
+												setChargerMode(gun_index, SYS_MODE_IDLE);
+											else
+												setChargerMode(gun_index, SYS_MODE_RESERVATION);
 										}
 										ocpp_set_auth_conf(OFF);
 									}
@@ -4798,7 +4828,7 @@ int main(void)
 								else
 								{
 									memcpy((char*)ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId, ShmSysConfigAndInfo->SysConfig.UserId, ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.UserId));
-									DEBUG_INFO("[START_METHOD_BACKEND] StartUserId : %s \n",ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
+									DEBUG_INFO("[START_METHOD_BACKEND] StartUserId: %s \n",ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartUserId);
 
 									setSpeaker(ON,SPEAKER_SHORT);
 									setChargerMode(gun_index, SYS_MODE_PREPARING);
@@ -4825,7 +4855,7 @@ int main(void)
 					// Unplug charging gun to Idle mode
 					if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A) && (ShmCharger->gun_info[gun_index].isGunPlugged == YES))
 					{
-						DEBUG_INFO("Charging gun is plugged before.\n");
+						DEBUG_INFO("Unplug the connector.\n");
 						setChargerMode(gun_index, SYS_MODE_IDLE);
 					}
 
@@ -4900,7 +4930,7 @@ int main(void)
 					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].PilotState == CP_STATE_A)
 					{
 						ShmCharger->gun_info[gun_index].isGunUnpluggedBefore = YES;
-						DEBUG_INFO("The connector was unplugged under charging mode. \n");
+						DEBUG_INFO("The connector was unplugged under charging mode.\n");
 					}
 
 					if((ShmCharger->gun_info[gun_index].isGunUnpluggedBefore == YES) ||
@@ -4915,8 +4945,6 @@ int main(void)
 					{
 						if(ShmCharger->gun_info[gun_index].rfidReq)
 						{
-							DEBUG_INFO("Certified in charging mode... \n");
-							
 							// If RFID SN different with start user, it need to authorize ID
 							if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
 							{
@@ -4965,9 +4993,8 @@ int main(void)
 												break;
 										}
 									}
-									
-									DEBUG_INFO("End request User Id : %s\n", ShmSysConfigAndInfo->SysConfig.UserId);
-									DEBUG_INFO("Start method : %d\n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
+
+									DEBUG_INFO("End request UserId : %s \n", ShmSysConfigAndInfo->SysConfig.UserId);
 
 									if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID) ||
 									   //(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND) ||
@@ -5235,8 +5262,6 @@ int main(void)
 
 						if(ShmCharger->gun_info[gun_index].rfidReq)
 						{
-							DEBUG_INFO("Certified in terminating mode... \n");
-
 							// If RFID SN different with start user, it need to authorize ID
 							if((ShmCharger->gun_info[gun_index].rfidReq == ON) && !isMatchStartUser(gun_index))
 							{
@@ -5286,8 +5311,7 @@ int main(void)
 										}
 									}
 
-									DEBUG_INFO("End request User Id : %s... \n", ShmSysConfigAndInfo->SysConfig.UserId);
-									DEBUG_INFO("Start method : %d... \n ", ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod);
+									DEBUG_INFO("End request UserId : %s \n", ShmSysConfigAndInfo->SysConfig.UserId);
 
 									if((ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_RFID) ||
 									   //(ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod == START_METHOD_BACKEND) ||
@@ -5628,11 +5652,22 @@ int main(void)
 									}
 								}
 
-								if(ocpp_compare_reserve_id_with_user(gun_index))
+								if(ocpp_compare_reserve_id_with_user(gun_index) ||
+								   ocpp_get_auth_result(gun_index))
 								{
 									DEBUG_INFO("Start Method in reservation : RFID...\n");
 									DEBUG_INFO("Start request User Id : %s\n", ShmSysConfigAndInfo->SysConfig.UserId);
 									ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_RFID;
+									ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_ISO14443;
+									setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
+								}
+								else
+								{
+									DEBUG_INFO("It's not reserve user id.\n");
+									DEBUG_INFO("Start request User Id : %s\n", ShmSysConfigAndInfo->SysConfig.UserId);
+									ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_RFID;
+									ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_ISO14443;
+									//setLedMotion(gun_index,LED_ACTION_MAINTAIN);
 									setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
 								}
 
@@ -5640,13 +5675,16 @@ int main(void)
 							}
 							else if(ocpp_get_remotestart(gun_index))
 							{
-								if(ocpp_compare_reserve_id_with_remote_user(gun_index))
+								if(ocpp_compare_reserve_id_with_remote_user(gun_index) || ocpp_isAuthorizeRemoteStart())
 								{
 									DEBUG_INFO("Start Method in reservation: BACKEND...\n");
 									ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartMethod = START_METHOD_BACKEND;
+									ShmSysConfigAndInfo->SysInfo.AcChargingData[gun_index].StartIdType = IdTokenType_Central;
+									if(ocpp_isAuthorizeRemoteStart())
+											ocpp_copy_userid_from_remotestart(gun_index);
 									setChargerMode(gun_index, SYS_MODE_AUTHORIZING);
 								}
-								ocpp_set_remotestop(gun_index, OFF);
+								ocpp_set_remotestart(gun_index, OFF);
 							}
 						}
 					}