|
@@ -91,7 +91,7 @@ namespace EVCB_OCPP.WSServer.Service
|
|
|
}
|
|
|
|
|
|
|
|
|
- async public Task<IdTokenInfo> Authorize(string chargeBoxId, string idTag, int? connectorId = null)
|
|
|
+ async public Task<IdTokenInfo> Authorize(string chargeBoxId, string idTag, int? connectorId = null, string source = null)
|
|
|
{
|
|
|
//return new IdTokenInfo() { IdTagInfo = new IdTagInfo()
|
|
|
//{
|
|
@@ -106,7 +106,7 @@ namespace EVCB_OCPP.WSServer.Service
|
|
|
{
|
|
|
logger.LogInformation(chargeBoxId + " Charging Monitor======================================>");
|
|
|
|
|
|
- string requestParams = idTag.StartsWith("vid:") ? await GetRequestParamsAsPnC(chargeBoxId, idTag, connectorId) : GetRequestParamsAsNormal(chargeBoxId, idTag);
|
|
|
+ string requestParams = idTag.StartsWith("vid:") ? await GetRequestParamsAsPnC(chargeBoxId, idTag, connectorId, source) : GetRequestParamsAsNormal(chargeBoxId, idTag, source);
|
|
|
logger.LogInformation($"{chargeBoxId} Authorize : {signMaterial.APIUrl + requestParams}");
|
|
|
HttpResult response = await httpClient.Post(signMaterial.APIUrl + requestParams, new Dictionary<string, string>()
|
|
|
{
|
|
@@ -266,7 +266,7 @@ namespace EVCB_OCPP.WSServer.Service
|
|
|
return _customer;
|
|
|
}
|
|
|
|
|
|
- private async ValueTask<string> GetRequestParamsAsPnC(string chargeBoxId, string idTag, int? connectorId)
|
|
|
+ private async ValueTask<string> GetRequestParamsAsPnC(string chargeBoxId, string idTag, int? connectorId, string source)
|
|
|
{
|
|
|
idTag = idTag.Replace("vid:", "");
|
|
|
|
|
@@ -289,13 +289,22 @@ namespace EVCB_OCPP.WSServer.Service
|
|
|
connectorId = -1;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- return string.Format("charging_auth?ChargeBoxId={0}&ConnectorId={1}&IdTag={2}", chargeBoxId, connectorId, idTag);
|
|
|
+ var requestParamString = string.Format("charging_auth?ChargeBoxId={0}&ConnectorId={1}&IdTag={2}", chargeBoxId, connectorId, idTag);
|
|
|
+ if (!string.IsNullOrEmpty(source))
|
|
|
+ {
|
|
|
+ requestParamString += $"&Action={source}";
|
|
|
+ }
|
|
|
+ return requestParamString;
|
|
|
}
|
|
|
|
|
|
- private string GetRequestParamsAsNormal(string chargeBoxId, string idTag)
|
|
|
+ private string GetRequestParamsAsNormal(string chargeBoxId, string idTag, string source)
|
|
|
{
|
|
|
- return string.Format("charging_auth?ChargeBoxId={0}&IdTag={1}", chargeBoxId, idTag);
|
|
|
+ var requestParamString = string.Format("charging_auth?ChargeBoxId={0}&IdTag={1}", chargeBoxId, idTag);
|
|
|
+ if (!string.IsNullOrEmpty(source))
|
|
|
+ {
|
|
|
+ requestParamString += $"&Action={source}";
|
|
|
+ }
|
|
|
+ return requestParamString;
|
|
|
}
|
|
|
|
|
|
public Task NotifyConnectorUnplugged(string data)
|