/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="CustomAuthorizeRemoteStartRequestSerializer">A delegate to customize the serialization of AuthorizeRemoteStart requests.</param> /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param> public XElement ToXML(CustomXMLSerializerDelegate <AuthorizeRemoteStartRequest> CustomAuthorizeRemoteStartRequestSerializer = null, CustomXMLSerializerDelegate <Identification> CustomIdentificationSerializer = null) { var XML = new XElement(OICPNS.Authorization + "eRoamingAuthorizeRemoteStart", SessionId.HasValue ? new XElement(OICPNS.Authorization + "SessionID", SessionId.ToString()) : null, CPOPartnerSessionId.HasValue ? new XElement(OICPNS.Authorization + "CPOPartnerSessionID", CPOPartnerSessionId.ToString()) : null, EMPPartnerSessionId.HasValue ? new XElement(OICPNS.Authorization + "EMPPartnerSessionID", EMPPartnerSessionId.ToString()) : null, new XElement(OICPNS.Authorization + "ProviderID", ProviderId.ToString()), new XElement(OICPNS.Authorization + "EvseID", EVSEId.ToString()), Identification.ToXML(CustomIdentificationSerializer: CustomIdentificationSerializer), PartnerProductId.HasValue ? new XElement(OICPNS.Authorization + "PartnerProductID", PartnerProductId.ToString()) : null ); return(CustomAuthorizeRemoteStartRequestSerializer != null ? CustomAuthorizeRemoteStartRequestSerializer(this, XML) : XML); }
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomChargingErrorNotificationRequestSerializer">A delegate to serialize custom time period JSON objects.</param> /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON elements.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <ChargingErrorNotificationRequest> CustomChargingErrorNotificationRequestSerializer = null, CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer = null) { var JSON = JSONObject.Create( new JProperty("Type", Type.AsString()), new JProperty("SessionID", SessionId.ToString()), new JProperty("EvseID", EVSEId.ToString()), new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer: CustomIdentificationSerializer)), new JProperty("ErrorType", ErrorType.AsString()), CPOPartnerSessionId.HasValue ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString()) : null, EMPPartnerSessionId.HasValue ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString()) : null, ErrorAdditionalInfo.IsNotNullOrEmpty() ? new JProperty("ErrorAdditionalInfo", ErrorAdditionalInfo) : null, CustomData != null ? new JProperty("CustomData", CustomData) : null ); return(CustomChargingErrorNotificationRequestSerializer != null ? CustomChargingErrorNotificationRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a JSON-representation of this object. /// </summary> /// <param name="CustomAuthorizeRemoteReservationStopRequestSerializer">A delegate to customize the serialization of AuthorizeRemoteReservationStopRequest responses.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <AuthorizeRemoteReservationStopRequest> CustomAuthorizeRemoteReservationStopRequestSerializer = null) { var JSON = JSONObject.Create( new JProperty("ProviderID", ProviderId.ToString()), new JProperty("EvseID", EVSEId.ToString()), new JProperty("SessionID", SessionId.ToString()), CPOPartnerSessionId.HasValue ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString()) : null, EMPPartnerSessionId.HasValue ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString()) : null, CustomData != null ? new JProperty("CustomData", CustomData) : null ); return(CustomAuthorizeRemoteReservationStopRequestSerializer != null ? CustomAuthorizeRemoteReservationStopRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="CustomSetEVSEBusyStatusRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param> public XElement ToXML(CustomXMLSerializerDelegate <SetEVSEBusyStatusRequest> CustomSetEVSEBusyStatusRequestSerializer = null) { var XML = new XElement(eMIPNS.EVCIDynamic + "eMIP_ToIOP_SetEVSEBusyStatusRequest", TransactionId.HasValue ? new XElement("transactionId", TransactionId.ToString()) : null, new XElement("partnerIdType", PartnerId.Format.AsText()), new XElement("partnerId", PartnerId.ToString()), new XElement("operatorIdType", OperatorId.Format.AsText()), new XElement("operatorId", OperatorId.ToString()), new XElement("EVSEIdType", EVSEId.Format.AsText()), new XElement("EVSEId", EVSEId.ToString()), new XElement("statusEventDate", StatusEventDate.ToIso8601(false).Replace("Z", "")), new XElement("busyStatus", BusyStatus.AsNumber()), BusyStatusUntil.HasValue ? new XElement("busyStatusUntil", BusyStatusUntil.Value.ToIso8601(false).Replace("Z", "")) : null, BusyStatusComment.IsNeitherNullNorEmpty() ? new XElement("busyStatusComment", BusyStatusComment) : null ); return(CustomSetEVSEBusyStatusRequestSerializer != null ? CustomSetEVSEBusyStatusRequestSerializer(this, XML) : XML); }
/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="CustomGetServiceAuthorisationRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param> public XElement ToXML(CustomXMLSerializerDelegate <GetServiceAuthorisationRequest> CustomGetServiceAuthorisationRequestSerializer = null) { var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_GetServiceAuthorisationRequest", TransactionId.HasValue ? new XElement("transactionId", TransactionId.ToString()) : null, new XElement("partnerIdType", PartnerId.Format.AsText()), new XElement("partnerId", PartnerId.ToString()), new XElement("operatorIdType", OperatorId.Format.AsText()), new XElement("operatorId", OperatorId.ToString()), new XElement("EVSEIdType", EVSEId.Format.AsText()), new XElement("EVSEId", EVSEId.ToString()), new XElement("userIdType", UserId.Format.AsText()), new XElement("userId", UserId.ToString()), new XElement("requestedServiceId", RequestedServiceId.ToString()), PartnerServiceSessionId.HasValue ? new XElement("partnerServiceSessionId", PartnerServiceSessionId.Value.ToString()) : null ); return(CustomGetServiceAuthorisationRequestSerializer != null ? CustomGetServiceAuthorisationRequestSerializer(this, XML) : XML); }
/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="CustomSetServiceAuthorisationRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param> /// <param name="CustomMeterReportSerializer">A delegate to serialize custom MeterReport XML elements.</param> public XElement ToXML(CustomXMLSerializerDelegate <SetServiceAuthorisationRequest> CustomSetServiceAuthorisationRequestSerializer = null, CustomXMLSerializerDelegate <MeterReport> CustomMeterReportSerializer = null) { var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_SetServiceAuthorisationRequest", TransactionId.HasValue ? new XElement("transactionId", TransactionId.ToString()) : null, new XElement("partnerIdType", PartnerId.Format.AsText()), new XElement("partnerId", PartnerId.ToString()), new XElement("operatorIdType", OperatorId.Format.AsText()), new XElement("operatorId", OperatorId.ToString()), new XElement("EVSEIdType", EVSEId.Format.AsText()), new XElement("EVSEId", EVSEId.ToString()), new XElement("userIdType", UserId.Format.AsText()), new XElement("userId", UserId.ToString()), new XElement("requestedServiceId", RequestedServiceId.ToString()), new XElement("authorisationValue", AuthorisationValue.ToString()), new XElement("intermediateCDRRequested", IntermediateCDRRequested ? "1" : "0"), PartnerServiceSessionId.HasValue ? new XElement("serviceSessionId", PartnerServiceSessionId.ToString()) : null, UserContractIdAlias.HasValue ? new XElement("userContractIdAlias", UserContractIdAlias.ToString()) : null, MeterLimits.SafeAny() ? new XElement("meterLimitList", MeterLimits.Select(meterreport => meterreport.ToXML(CustomMeterReportSerializer: CustomMeterReportSerializer))) : null, Parameter.IsNotNullOrEmpty() ? new XElement("parameter", Parameter) : null, BookingId.HasValue ? new XElement("bookingId", BookingId.ToString()) : null, SalePartnerBookingId.HasValue ? new XElement("salePartnerBookingId", SalePartnerBookingId.ToString()) : null ); return(CustomSetServiceAuthorisationRequestSerializer != null ? CustomSetServiceAuthorisationRequestSerializer(this, XML) : XML); }
public JObject ToJSON() => JSONObject.Create( new JProperty("timestamp", Timestamp.ToIso8601()), new JProperty("meterValue", MeterValue), new JProperty("meterId", MeterId.ToString()), new JProperty("evseId", EVSEId.ToString()), new JProperty("userId", UserId), new JProperty("publicKey", PublicKey.Fingerprint.ToHexString()), new JProperty("lastSignature", lastSignature), new JProperty("signature", Signature) );
public JObject ToJSON() => JSONObject.Create( new JProperty("@id", Id.ToString()), new JProperty("timestamp", Timestamp.ToIso8601()), new JProperty("startTime", StartTime.ToIso8601()), new JProperty("duration", Duration.TotalMinutes), new JProperty("endTime", EndTime.ToIso8601()), new JProperty("consumedReservationTime", ConsumedReservationTime.TotalMinutes), new JProperty("reservationLevel", ReservationLevel.ToString()), ProviderId.HasValue ? new JProperty("providerId", ProviderId.ToString()) : null, StartAuthentication != null ? new JProperty("authentication", EndTime.ToIso8601()) : null, RoamingNetworkId.HasValue ? new JProperty("roamingNetworkId", RoamingNetworkId.ToString()) : null, ChargingPoolId.HasValue ? new JProperty("chargingPoolId", ChargingPoolId.ToString()) : null, ChargingStationId.HasValue ? new JProperty("chargingStationId", ChargingStationId.ToString()) : null, EVSEId.HasValue ? new JProperty("EVSEId", EVSEId.ToString()) : null, ChargingProduct != null ? new JProperty("chargingProduct", ChargingProduct.ToJSON()) : null, ChargingSession != null ? new JProperty("chargingSessionId", ChargingSession.Id.ToString()) : null );
public JObject ToJSON() => JSONObject.Create( new JProperty("@id", SessionId.ToString()), new JProperty("@context", ""), SessionTime.HasValue ? new JProperty("sessionTime", JSONObject.Create( new JProperty("start", SessionTime.Value.StartTime.ToIso8601()), SessionTime.Value.EndTime.HasValue ? new JProperty("end", SessionTime.Value.EndTime.Value.ToIso8601()) : null )) : null, Duration.HasValue ? new JProperty("duration", Duration.Value.TotalSeconds) : null, ChargingStationOperatorId.HasValue ? new JProperty("chargingStationOperatorId", ChargingStationOperatorId.ToString()) : null, ChargingPoolId.HasValue ? new JProperty("chargingPoolId", ChargingPoolId.ToString()) : null, ChargingStationId.HasValue ? new JProperty("chargingStationId", ChargingStationId.ToString()) : null, EVSEId.HasValue ? new JProperty("evseId", EVSEId.ToString()) : null, ChargingProduct != null ? new JProperty("chargingProduct", ChargingProduct.ToJSON()) : null //new JProperty("meterValue", MeterValue), //new JProperty("meterId", MeterId.ToString()), //new JProperty("userId", UserId), //new JProperty("publicKey", PublicKey.KeyId), //new JProperty("lastSignature", lastSignature), //new JProperty("signature", Signature) );
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomStatusNotificationRequestSerializer">A delegate to serialize custom StatusNotification requests.</param> /// <param name="CustomCustomDataResponseSerializer">A delegate to serialize CustomData objects.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <StatusNotificationRequest> CustomStatusNotificationRequestSerializer = null, CustomJObjectSerializerDelegate <CustomData> CustomCustomDataResponseSerializer = null) { var JSON = JSONObject.Create( new JProperty("timestamp", Timestamp.ToIso8601()), new JProperty("connectorStatus", ConnectorStatus.AsText()), new JProperty("evseId", EVSEId.ToString()), new JProperty("connectorId", ConnectorId.ToString()), CustomData != null ? new JProperty("customData", CustomData.ToJSON(CustomCustomDataResponseSerializer)) : null); return(CustomStatusNotificationRequestSerializer != null ? CustomStatusNotificationRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomChargingStartNotificationRequestSerializer">A delegate to serialize custom time period JSON objects.</param> /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON elements.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <ChargingStartNotificationRequest> CustomChargingStartNotificationRequestSerializer = null, CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer = null) { var JSON = JSONObject.Create( new JProperty("Type", Type.AsString()), new JProperty("SessionID", SessionId.ToString()), new JProperty("EvseID", EVSEId.ToString()), new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer: CustomIdentificationSerializer)), new JProperty("ChargingStart", ChargingStart.ToIso8601()), CPOPartnerSessionId.HasValue ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString()) : null, EMPPartnerSessionId.HasValue ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString()) : null, SessionStart.HasValue ? new JProperty("SessionStart", SessionStart.Value.ToIso8601()) : null, MeterValueStart.HasValue ? new JProperty("MeterValueStart", String.Format("{0:0.###}", MeterValueStart.Value).Replace(",", ".")) : null, OperatorId.HasValue ? new JProperty("OperatorID", OperatorId.Value.ToString()) : null, PartnerProductId.HasValue ? new JProperty("PartnerProductID", PartnerProductId.Value.ToString()) : null, CustomData != null ? new JProperty("CustomData", CustomData) : null ); return(CustomChargingStartNotificationRequestSerializer != null ? CustomChargingStartNotificationRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a JSON-representation of this object. /// </summary> /// <param name="CustomAuthorizeRemoteReservationStartRequestSerializer">A delegate to customize the serialization of AuthorizeRemoteReservationStartRequest responses.</param> /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON objects.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <AuthorizeRemoteReservationStartRequest> CustomAuthorizeRemoteReservationStartRequestSerializer = null, CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer = null) { var JSON = JSONObject.Create( new JProperty("ProviderID", ProviderId.ToString()), new JProperty("EvseID", EVSEId.ToString()), new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer)), SessionId.HasValue ? new JProperty("SessionID", SessionId.Value.ToString()) : null, CPOPartnerSessionId.HasValue ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString()) : null, EMPPartnerSessionId.HasValue ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString()) : null, PartnerProductId.HasValue ? new JProperty("PartnerProductID", PartnerProductId.Value.ToString()) : null, Duration.HasValue ? new JProperty("Duration", (Int32)Duration.Value.TotalMinutes) : null, CustomData != null ? new JProperty("CustomData", CustomData) : null ); return(CustomAuthorizeRemoteReservationStartRequestSerializer != null ? CustomAuthorizeRemoteReservationStartRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="CustomAuthorizeRemoteReservationStartRequestSerializer">A delegate to customize the serialization of AuthorizeRemoteReservationStart requests.</param> /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param> public XElement ToXML(CustomXMLSerializerDelegate <AuthorizeRemoteReservationStartRequest> CustomAuthorizeRemoteReservationStartRequestSerializer = null, CustomXMLSerializerDelegate <Identification> CustomIdentificationSerializer = null) { var XML = new XElement(OICPNS.Reservation + "eRoamingAuthorizeRemoteReservationStart", SessionId.HasValue ? new XElement(OICPNS.Reservation + "SessionID", SessionId.ToString()) : null, CPOPartnerSessionId.HasValue ? new XElement(OICPNS.Reservation + "CPOPartnerSessionID", CPOPartnerSessionId.ToString()) : null, EMPPartnerSessionId.HasValue ? new XElement(OICPNS.Reservation + "EMPPartnerSessionID", EMPPartnerSessionId.ToString()) : null, new XElement(OICPNS.Reservation + "ProviderID", ProviderId.ToString()), new XElement(OICPNS.Reservation + "EVSEID", EVSEId.ToString()), Identification.ToXML(OICPNS.Reservation + "Identification", CustomIdentificationSerializer), PartnerProductId.HasValue ? new XElement(OICPNS.Reservation + "PartnerProductID", PartnerProductId.ToString()) : null, Duration.HasValue ? new XElement(OICPNS.Reservation + "Duration", Convert.ToInt32(Math.Round(Duration.Value.TotalMinutes, 0))) : null ); return(CustomAuthorizeRemoteReservationStartRequestSerializer != null ? CustomAuthorizeRemoteReservationStartRequestSerializer(this, XML) : XML); }
/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="CustomAuthorizeRemoteReservationStopRequestSerializer">A delegate to customize the serialization of AuthorizeRemoteReservationStop requests.</param> public XElement ToXML(CustomXMLSerializerDelegate <AuthorizeRemoteReservationStopRequest> CustomAuthorizeRemoteReservationStopRequestSerializer = null) { var XML = new XElement(OICPNS.Reservation + "eRoamingAuthorizeRemoteReservationStop", new XElement(OICPNS.Reservation + "SessionID", SessionId.ToString()), CPOPartnerSessionId.HasValue ? new XElement(OICPNS.Reservation + "CPOPartnerSessionID", CPOPartnerSessionId.ToString()) : null, EMPPartnerSessionId.HasValue ? new XElement(OICPNS.Reservation + "EMPPartnerSessionID", EMPPartnerSessionId.ToString()) : null, new XElement(OICPNS.Reservation + "ProviderID", ProviderId.ToString()), new XElement(OICPNS.Reservation + "EVSEID", EVSEId.ToString()) ); return(CustomAuthorizeRemoteReservationStopRequestSerializer != null ? CustomAuthorizeRemoteReservationStopRequestSerializer(this, XML) : XML); }
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomCDRLocationSerializer">A delegate to serialize custom location JSON objects.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <CDRLocation> CustomCDRLocationSerializer = null) { var JSON = JSONObject.Create( new JProperty("id", Id.ToString()), Name.IsNotNullOrEmpty() ? new JProperty("name", Name) : null, new JProperty("address", Address), new JProperty("city", City), PostalCode.IsNotNullOrEmpty() ? new JProperty("postal_code", PostalCode) : null, new JProperty("country", Country), new JProperty("coordinates", new JObject( new JProperty("latitude", Coordinates.Latitude.Value.ToString("0.00000##").Replace(",", ".")), new JProperty("longitude", Coordinates.Longitude.Value.ToString("0.00000##").Replace(",", ".")) )), new JProperty("evse_uid", EVSEUId.ToString()), new JProperty("evse_id", EVSEId.ToString()), new JProperty("connector_id", ConnectorId.ToString()), new JProperty("connector_standard", ConnectorStandard.ToString()), new JProperty("connector_format", ConnectorFormat.ToString()), new JProperty("connector_power_type", ConnectorPowerType.ToString()) ); return(CustomCDRLocationSerializer != null ? CustomCDRLocationSerializer(this, JSON) : JSON); }
public void Add(WWCPCPOAdapter CPOAdapter) { _CPOAdapters.Add(CPOAdapter); #region OnGetServiceAuthorisationRequest/-Response CPOAdapter.CPOClient.OnGetServiceAuthorisationRequest += async(LogTimestamp, RequestTimestamp, Sender, SenderId, EventTrackingId, PartnerId, OperatorId, EVSEId, UserId, ServiceId, TransactionId, PartnerServiceSessionId, RequestTimeout) => await DebugLog.SubmitEvent("GetServiceAuthorisationRequest", JSONObject.Create( new JProperty("timestamp", RequestTimestamp.ToIso8601()), new JProperty("eventTrackingId", EventTrackingId.ToString()), //new JProperty("roamingNetworkId", RoamingNetworkId. ToString()), //EMPRoamingProviderId.HasValue // ? new JProperty("EMPRoamingProviderId", EMPRoamingProviderId.ToString()) // : null, //CSORoamingProviderId.HasValue // ? new JProperty("CSORoamingProviderId", CSORoamingProviderId.ToString()) // : null, new JProperty("partnerId", PartnerId.ToString()), new JProperty("operatorId", OperatorId.ToString()), new JProperty("EVSEId", EVSEId.ToString()), new JProperty("userId", UserId.ToString()), new JProperty("serviceId", ServiceId.ToString()), TransactionId.HasValue ? new JProperty("transactionId", TransactionId.ToString()) : null, PartnerServiceSessionId.HasValue ? new JProperty("partnerServiceSessionId", PartnerServiceSessionId.ToString()) : null, new JProperty("requestTimeout", Math.Round(RequestTimeout.TotalSeconds, 0)) )); CPOAdapter.CPOClient.OnGetServiceAuthorisationResponse += async(LogTimestamp, RequestTimestamp, Sender, SenderId, EventTrackingId, PartnerId, OperatorId, EVSEId, UserId, ServiceId, TransactionId, PartnerServiceSessionId, RequestTimeout, Result, Runtime) => await DebugLog.SubmitEvent("GetServiceAuthorisationResponse", JSONObject.Create( new JProperty("timestamp", RequestTimestamp.ToIso8601()), new JProperty("eventTrackingId", EventTrackingId.ToString()), //new JProperty("roamingNetworkId", RoamingNetwork.Id. ToString()), //EMPRoamingProviderId.HasValue // ? new JProperty("EMPRoamingProviderId", EMPRoamingProviderId.ToString()) // : null, //CSORoamingProviderId.HasValue // ? new JProperty("CSORoamingProviderId", CSORoamingProviderId.ToString()) // : null, new JProperty("partnerId", PartnerId.ToString()), new JProperty("operatorId", OperatorId.ToString()), new JProperty("EVSEId", EVSEId.ToString()), new JProperty("userId", UserId.ToString()), new JProperty("serviceId", ServiceId.ToString()), TransactionId.HasValue ? new JProperty("transactionId", TransactionId.ToString()) : null, PartnerServiceSessionId.HasValue ? new JProperty("partnerServiceSessionId", PartnerServiceSessionId.ToString()) : null, new JProperty("requestTimeout", Math.Round(RequestTimeout.TotalSeconds, 0)), new JProperty("result", Result.ToJSON()), new JProperty("runtime", Math.Round(Runtime.TotalMilliseconds, 0)) )); #endregion }
/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="CustomAuthorizeStopRequestSerializer">A delegate to customize the serialization of AuthorizeStop requests.</param> /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param> public XElement ToXML(CustomXMLSerializerDelegate <AuthorizeStopRequest> CustomAuthorizeStopRequestSerializer = null, CustomXMLSerializerDelegate <Identification> CustomIdentificationSerializer = null) { var XML = new XElement(OICPNS.Authorization + "eRoamingAuthorizeStop", new XElement(OICPNS.Authorization + "SessionID", SessionId.ToString()), CPOPartnerSessionId.HasValue ? new XElement(OICPNS.Authorization + "CPOPartnerSessionID", CPOPartnerSessionId.ToString()) : null, EMPPartnerSessionId.HasValue ? new XElement(OICPNS.Authorization + "EMPPartnerSessionID", EMPPartnerSessionId.ToString()) : null, new XElement(OICPNS.Authorization + "OperatorID", OperatorId.ToString()), EVSEId.HasValue ? new XElement(OICPNS.Authorization + "EvseID", EVSEId.ToString()) : null, Identification.ToXML(CustomIdentificationSerializer: CustomIdentificationSerializer) ); return(CustomAuthorizeStopRequestSerializer != null ? CustomAuthorizeStopRequestSerializer(this, XML) : XML); }
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomChargingProgressNotificationRequestSerializer">A delegate to serialize custom time period JSON objects.</param> /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON elements.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <ChargingProgressNotificationRequest> CustomChargingProgressNotificationRequestSerializer = null, CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer = null) { var JSON = JSONObject.Create( new JProperty("Type", Type.AsString()), new JProperty("SessionID", SessionId.ToString()), new JProperty("EvseID", EVSEId.ToString()), new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer: CustomIdentificationSerializer)), new JProperty("ChargingStart", ChargingStart.ToIso8601()), new JProperty("EventOcurred", EventOcurred.ToIso8601()), CPOPartnerSessionId.HasValue ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString()) : null, EMPPartnerSessionId.HasValue ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString()) : null, ChargingDuration.HasValue ? new JProperty("ChargingDuration", Convert.ToUInt64(ChargingDuration.Value.TotalMilliseconds)) : null, SessionStart.HasValue ? new JProperty("SessionStart", SessionStart.Value.ToIso8601()) : null, ConsumedEnergyProgress.HasValue ? new JProperty("ConsumedEnergyProgress", String.Format("{0:0.###}", ConsumedEnergyProgress.Value).Replace(",", ".")) : null, MeterValueStart.HasValue ? new JProperty("MeterValueStart", String.Format("{0:0.###}", MeterValueStart.Value).Replace(",", ".")) : null, MeterValuesInBetween.SafeAny() ? new JProperty("MeterValueInBetween", new JObject( // OICP is crazy! new JProperty("meterValues", new JArray(MeterValuesInBetween. Select(meterValue => String.Format("{0:0.###}", meterValue).Replace(",", "."))) ) ) ) : null, OperatorId.HasValue ? new JProperty("OperatorID", OperatorId.Value.ToString()) : null, PartnerProductId.HasValue ? new JProperty("PartnerProductID", PartnerProductId.Value.ToString()) : null, CustomData != null ? new JProperty("CustomData", CustomData) : null ); return(CustomChargingProgressNotificationRequestSerializer != null ? CustomChargingProgressNotificationRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a XML representation of this object. /// </summary> /// <param name="CustomMobileAuthorizeStartRequestSerializer">A delegate to serialize custom MobileAuthorizeStart XML elements.</param> public XElement ToXML(CustomXMLSerializerDelegate <MobileAuthorizeStartRequest> CustomMobileAuthorizeStartRequestSerializer = null) { var XML = new XElement(OICPNS.MobileAuthorization + "eRoamingMobileAuthorizeStart", new XElement(OICPNS.MobileAuthorization + "EvseID", EVSEId.ToString()), QRCodeIdentification.ToXML(OICPNS.MobileAuthorization + "QRCodeIdentification"), PartnerProductId.HasValue ? new XElement(OICPNS.MobileAuthorization + "PartnerProductID", PartnerProductId.ToString()) : null, (GetNewSession.HasValue) ? new XElement(OICPNS.MobileAuthorization + "GetNewSession", GetNewSession.Value ? "true" : "false") : null ); return(CustomMobileAuthorizeStartRequestSerializer != null ? CustomMobileAuthorizeStartRequestSerializer(this, XML) : XML); }
//public ChargingSession AddUserData(String Key, Object Value) //{ // this._UserDefined //} public JObject ToJSON(Boolean Embedded = false) => JSONObject.Create( Id.ToJSON("@id"), Embedded ? new JProperty("@context", "https://open.charging.cloud/contexts/wwcp+json/chargingSession") : null, new JProperty("sessionTime", JSONObject.Create( new JProperty("start", SessionTime.StartTime.ToIso8601()), SessionTime.EndTime.HasValue ? new JProperty("end", SessionTime.EndTime.Value.ToIso8601()) : null )), new JProperty("duration", Duration.TotalSeconds), RoamingNetworkId.HasValue ? new JProperty("roamingNetworkId", RoamingNetworkId.ToString()) : null, ChargingStationOperatorId.HasValue ? new JProperty("chargingStationOperatorId", ChargingStationOperatorId.ToString()) : null, ChargingPoolId.HasValue ? new JProperty("chargingPoolId", ChargingPoolId. ToString()) : null, ChargingStationId.HasValue ? new JProperty("chargingStationId", ChargingStationId. ToString()) : null, EVSEId.HasValue ? new JProperty("EVSEId", EVSEId. ToString()) : null, ChargingProduct != null ? new JProperty("chargingProduct", ChargingProduct. ToJSON()) : null, ProviderIdStart != null ? new JProperty("providerIdStart", ProviderIdStart.ToString()) : null, ProviderIdStop != null ? new JProperty("providerIdStop", ProviderIdStop.ToString()) : null, AuthenticationStart.IsDefined() ? new JProperty("authenticationStart", AuthenticationStart.ToJSON()) : null, AuthenticationStop.IsDefined() ? new JProperty("authenticationStop", AuthenticationStop.ToJSON()) : null, Reservation != null ? new JProperty("reservation", new JObject( new JProperty("reservationId", Reservation.Id.ToString()), new JProperty("start", Reservation.StartTime.ToIso8601()), new JProperty("duration", Reservation.Duration.TotalSeconds) ) ) : ReservationId != null ? new JProperty("reservationId", ReservationId.ToString()) : null, EnergyMeterId.HasValue ? new JProperty("energyMeterId", EnergyMeterId.ToString()) : null, EnergyMeteringValues.Any() ? new JProperty("energyMeterValues", new JObject( EnergyMeteringValues. Select(MeterValue => new JProperty(MeterValue.Timestamp.ToIso8601(), MeterValue.Value)) )) : null );
/// <summary> /// Return a XML representation of this EVSE data record. /// </summary> /// <param name="XName">The XML name to use.</param> /// <param name="CustomChargeDetailRecordSerializer">A delegate to serialize custom ChargeDetailRecord XML elements.</param> /// <param name="CustomMeterReportSerializer">A delegate to serialize custom MeterReport XML elements.</param> public XElement ToXML(XName XName = null, CustomXMLSerializerDelegate <ChargeDetailRecord> CustomChargeDetailRecordSerializer = null, CustomXMLSerializerDelegate <MeterReport> CustomMeterReportSerializer = null) { var XML = new XElement(XName ?? "chargeDetailRecord", new XElement("CDRNature", CDRNature.AsText()), new XElement("serviceSessionId", ServiceSessionId.ToString()), ExecPartnerSessionId.HasValue ? new XElement("execPartnerSessionId", ExecPartnerSessionId.Value.ToString()) : null, ExecPartnerOperatorId.HasValue ? new XElement("execPartnerOperatorIdType", ExecPartnerOperatorId.Value.Format.AsText()) : null, ExecPartnerOperatorId.HasValue ? new XElement("execPartnerOperatorId", ExecPartnerOperatorId.Value.ToString()) : null, SalesPartnerSessionId.HasValue ? new XElement("execPartnerSessionId", ExecPartnerSessionId.Value.ToString()) : null, SalesPartnerOperatorId.HasValue ? new XElement("execPartnerOperatorIdType", ExecPartnerOperatorId.Value.Format.AsText()) : null, SalesPartnerOperatorId.HasValue ? new XElement("execPartnerOperatorId", ExecPartnerOperatorId.Value.ToString()) : null, new XElement("requestedServiceId", RequestedServiceId.ToString()), new XElement("EVSEIdType", EVSEId.Format.AsText()), new XElement("EVSEId", EVSEId.ToString()), new XElement("userContractIdAlias", UserContractIdAlias.ToString()), new XElement("userIdType", UserId.Format.AsText()), new XElement("userId", UserId.ToString()), PartnerProductId.HasValue ? new XElement("partnerProductId", PartnerProductId.Value.ToString()) : null, new XElement("startTime", StartTime.ToIso8601(false)), new XElement("endTime", EndTime.ToIso8601(false)), new XElement("meterReportList", MeterReports.Any() ? MeterReports.Select(meterreport => meterreport.ToXML(CustomMeterReportSerializer: CustomMeterReportSerializer)) : null ) ); return(CustomChargeDetailRecordSerializer != null ? CustomChargeDetailRecordSerializer(this, XML) : XML); }