/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomStatusNotificationRequestSerializer">A delegate to serialize custom StatusNotification requests.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <StatusNotificationRequest> CustomStatusNotificationRequestSerializer = null) { var JSON = JSONObject.Create( new JProperty("connectorId", ConnectorId.ToString()), new JProperty("status", Status.AsText()), new JProperty("errorCode", ErrorCode.AsText()), Info.IsNotNullOrEmpty() ? new JProperty("info", Info) : null, StatusTimestamp.HasValue ? new JProperty("timestamp", StatusTimestamp.Value.ToIso8601()) : null, VendorId.IsNotNullOrEmpty() ? new JProperty("vendorId", VendorId) : null, VendorErrorCode.IsNotNullOrEmpty() ? new JProperty("vendorErrorCode", VendorErrorCode) : null); return(CustomStatusNotificationRequestSerializer != null ? CustomStatusNotificationRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a XML representation of this object. /// </summary> public XElement ToXML() => new XElement(OCPPNS.OCPPv1_6_CS + "statusNotificationRequest", new XElement(OCPPNS.OCPPv1_6_CS + "connectorId", ConnectorId.ToString()), new XElement(OCPPNS.OCPPv1_6_CS + "status", Status.AsText()), new XElement(OCPPNS.OCPPv1_6_CS + "errorCode", ErrorCode.AsText()), Info.IsNotNullOrEmpty() ? new XElement(OCPPNS.OCPPv1_6_CS + "info", Info) : null, StatusTimestamp.HasValue ? new XElement(OCPPNS.OCPPv1_6_CS + "timestamp", StatusTimestamp.Value.ToIso8601()) : null, VendorId.IsNotNullOrEmpty() ? new XElement(OCPPNS.OCPPv1_6_CS + "vendorId", VendorId) : null, VendorErrorCode.IsNotNullOrEmpty() ? new XElement(OCPPNS.OCPPv1_6_CS + "vendorErrorCode", VendorErrorCode) : null );
/// <summary> /// Return a XML representation of this object. /// </summary> public XElement ToXML() => new XElement(OCPPNS.OCPPv1_6_CP + "setChargingProfileRequest", new XElement(OCPPNS.OCPPv1_6_CP + "connectorId", ConnectorId.ToString()), ChargingProfile.ToXML(OCPPNS.OCPPv1_6_CP + "csChargingProfiles") );
/// <summary> /// Return a XML representation of this object. /// </summary> public XElement ToXML() => new XElement(OCPPNS.OCPPv1_6_CP + "changeAvailabilityRequest", new XElement(OCPPNS.OCPPv1_6_CP + "connectorId", ConnectorId.ToString()), new XElement(OCPPNS.OCPPv1_6_CP + "type", Availability.AsText()) );
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomChangeAvailabilityRequestSerializer">A delegate to serialize custom ChangeAvailability requests.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <ChangeAvailabilityRequest> CustomChangeAvailabilityRequestSerializer = null) { var JSON = JSONObject.Create( new JProperty("connectorId", ConnectorId.ToString()), new JProperty("type", Availability.AsText()) ); return(CustomChangeAvailabilityRequestSerializer != null ? CustomChangeAvailabilityRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a XML representation of this object. /// </summary> public XElement ToXML() => new XElement(OCPPNS.OCPPv1_6_CP + "getCompositeScheduleRequest", new XElement(OCPPNS.OCPPv1_6_CP + "connectorId", ConnectorId.ToString()), new XElement(OCPPNS.OCPPv1_6_CP + "duration", (UInt64)Duration.TotalSeconds), ChargingRateUnit.HasValue ? new XElement(OCPPNS.OCPPv1_6_CP + "chargingRateUnit", ChargingRateUnit.Value) : null );
/// <summary> /// Return a XML representation of this object. /// </summary> public XElement ToXML() => new XElement(OCPPNS.OCPPv1_6_CP + "reserveNowRequest", new XElement(OCPPNS.OCPPv1_6_CP + "connectorId", ConnectorId.ToString()), new XElement(OCPPNS.OCPPv1_6_CP + "expiryDate", ExpiryDate.ToIso8601()), new XElement(OCPPNS.OCPPv1_6_CP + "idTag", IdTag.ToString()), ParentIdTag.HasValue ? new XElement(OCPPNS.OCPPv1_6_CP + "parentIdTag", ParentIdTag.Value.ToString()) : null, new XElement(OCPPNS.OCPPv1_6_CP + "reservationId", ReservationId.ToString()) );
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomSetChargingProfileRequestSerializer">A delegate to serialize custom start transaction requests.</param> /// <param name="CustomChargingProfileSerializer">A delegate to serialize custom charging profiles.</param> /// <param name="CustomChargingScheduleSerializer">A delegate to serialize custom charging schedule requests.</param> /// <param name="CustomChargingSchedulePeriodSerializer">A delegate to serialize custom charging schedule periods.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <SetChargingProfileRequest> CustomSetChargingProfileRequestSerializer = null, CustomJObjectSerializerDelegate <ChargingProfile> CustomChargingProfileSerializer = null, CustomJObjectSerializerDelegate <ChargingSchedule> CustomChargingScheduleSerializer = null, CustomJObjectSerializerDelegate <ChargingSchedulePeriod> CustomChargingSchedulePeriodSerializer = null) { var JSON = JSONObject.Create( new JProperty("connectorId", ConnectorId.ToString()), new JProperty("csChargingProfiles", ChargingProfile.ToJSON(CustomChargingProfileSerializer, CustomChargingScheduleSerializer, CustomChargingSchedulePeriodSerializer)) ); return(CustomSetChargingProfileRequestSerializer != null ? CustomSetChargingProfileRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a XML representation of this object. /// </summary> public XElement ToXML() => new XElement(OCPPNS.OCPPv1_6_CP + "getCompositeScheduleResponse", new XElement(OCPPNS.OCPPv1_6_CP + "status", Status.AsText()), ConnectorId != null ? new XElement(OCPPNS.OCPPv1_6_CP + "connectorId", ConnectorId.ToString()) : null, ScheduleStart.HasValue ? new XElement(OCPPNS.OCPPv1_6_CP + "scheduleStart", ScheduleStart.Value.ToIso8601()) : null, ChargingSchedule?.ToXML() );
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomGetCompositeScheduleRequestSerializer">A delegate to serialize custom start transaction requests.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <GetCompositeScheduleRequest> CustomGetCompositeScheduleRequestSerializer = null) { var JSON = JSONObject.Create( new JProperty("connectorId", ConnectorId.ToString()), new JProperty("duration", (UInt64)Duration.TotalSeconds), ChargingRateUnit.HasValue ? new JProperty("chargingRateUnit", ChargingRateUnit.Value.AsText()) : null ); return(CustomGetCompositeScheduleRequestSerializer != null ? CustomGetCompositeScheduleRequestSerializer(this, JSON) : JSON); }
/// <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="CustomReserveNowRequestSerializer">A delegate to serialize custom reserve now requests.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <ReserveNowRequest> CustomReserveNowRequestSerializer = null) { var JSON = JSONObject.Create( new JProperty("connectorId", ConnectorId.ToString()), new JProperty("expiryDate", ExpiryDate.ToIso8601()), new JProperty("idTag", IdTag.ToString()), new JProperty("reservationId", ReservationId.ToString()), ParentIdTag.HasValue ? new JProperty("parentIdTag", ParentIdTag.Value.ToString()) : null ); return(CustomReserveNowRequestSerializer != null ? CustomReserveNowRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomStartTransactionRequestSerializer">A delegate to serialize custom start transaction requests.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <StartTransactionRequest> CustomStartTransactionRequestSerializer = null) { var JSON = JSONObject.Create( new JProperty("connectorId", ConnectorId.ToString()), new JProperty("idTag", IdTag.ToString()), new JProperty("timestamp", StartTimestamp.ToIso8601()), new JProperty("meterStart", MeterStart), ReservationId.HasValue ? new JProperty("reservationId", ReservationId.Value.ToString()) : null ); return(CustomStartTransactionRequestSerializer != null ? CustomStartTransactionRequestSerializer(this, JSON) : JSON); }
/// <summary> /// Return a XML representation of this object. /// </summary> public XElement ToXML() => new XElement(OCPPNS.OCPPv1_6_CP + "clearChargingProfileRequest", ChargingProfileId != null ? new XElement(OCPPNS.OCPPv1_6_CP + "id", ChargingProfileId.ToString()) : null, ConnectorId != null ? new XElement(OCPPNS.OCPPv1_6_CP + "connectorId", ConnectorId.ToString()) : null, ChargingProfilePurpose.HasValue ? new XElement(OCPPNS.OCPPv1_6_CP + "chargingProfilePurpose", XML_IO.AsText(ChargingProfilePurpose.Value)) : null, StackLevel.HasValue ? new XElement(OCPPNS.OCPPv1_6_CP + "stackLevel", StackLevel.Value) : null );
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomMeterValuesRequestSerializer">A delegate to serialize custom meter values requests.</param> /// <param name="CustomMeterValueSerializer">A delegate to serialize custom meter values.</param> /// <param name="CustomSampledValueSerializer">A delegate to serialize custom sampled values.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <MeterValuesRequest> CustomMeterValuesRequestSerializer = null, CustomJObjectSerializerDelegate <MeterValue> CustomMeterValueSerializer = null, CustomJObjectSerializerDelegate <SampledValue> CustomSampledValueSerializer = null) { var JSON = JSONObject.Create( new JProperty("connectorId", ConnectorId.ToString()), TransactionId.HasValue ? new JProperty("transactionId", TransactionId.Value) : null, MeterValues.SafeAny() ? new JProperty("meterValue", new JArray(MeterValues.Select(meterValue => meterValue.ToJSON(CustomMeterValueSerializer, CustomSampledValueSerializer)))) : null ); return(CustomMeterValuesRequestSerializer != null ? CustomMeterValuesRequestSerializer(this, JSON) : JSON); }
/// <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); }
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomSessionSerializer">A delegate to serialize custom session JSON objects.</param> /// <param name="CustomCDRTokenSerializer">A delegate to serialize custom charge detail record token JSON objects.</param> /// <param name="CustomEnergyMeterSerializer">A delegate to serialize custom energy meter JSON objects.</param> /// <param name="CustomTransparencySoftwareSerializer">A delegate to serialize custom transparency software JSON objects.</param> /// <param name="CustomChargingPeriodSerializer">A delegate to serialize custom charging period JSON objects.</param> /// <param name="CustomCDRDimensionSerializer">A delegate to serialize custom charge detail record dimension JSON objects.</param> /// <param name="CustomPriceSerializer">A delegate to serialize custom price JSON objects.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <Session> CustomSessionSerializer = null, CustomJObjectSerializerDelegate <CDRToken> CustomCDRTokenSerializer = null, CustomJObjectSerializerDelegate <EnergyMeter> CustomEnergyMeterSerializer = null, CustomJObjectSerializerDelegate <TransparencySoftware> CustomTransparencySoftwareSerializer = null, CustomJObjectSerializerDelegate <ChargingPeriod> CustomChargingPeriodSerializer = null, CustomJObjectSerializerDelegate <CDRDimension> CustomCDRDimensionSerializer = null, CustomJObjectSerializerDelegate <Price> CustomPriceSerializer = null) { var JSON = JSONObject.Create( new JProperty("country_code", CountryCode.ToString()), new JProperty("party_id", PartyId.ToString()), new JProperty("id", Id.ToString()), new JProperty("start_date_time", Start.ToIso8601()), End.HasValue ? new JProperty("end_date_time", End.Value.ToIso8601()) : null, new JProperty("kwh", kWh), new JProperty("cdr_token", CDRToken.ToJSON(CustomCDRTokenSerializer)), new JProperty("auth_method", AuthMethod.ToString()), AuthorizationReference.HasValue ? new JProperty("authorization_reference", AuthorizationReference.ToString()) : null, new JProperty("location_id", LocationId.ToString()), new JProperty("evse_uid", EVSEUId.ToString()), new JProperty("connector_id", ConnectorId.ToString()), MeterId.HasValue ? new JProperty("meter_id", MeterId.ToString()) : null, EnergyMeter != null ? new JProperty("energy_meter", EnergyMeter.ToJSON(CustomEnergyMeterSerializer)) : null, TransparencySoftwares.SafeAny() ? new JProperty("transparency_softwares", new JArray(TransparencySoftwares.Select(software => software.ToJSON(CustomTransparencySoftwareSerializer)))) : null, new JProperty("currency", Currency.ToString()), ChargingPeriods.SafeAny() ? new JProperty("charging_periods", new JArray(ChargingPeriods.Select(chargingPeriod => chargingPeriod.ToJSON(CustomChargingPeriodSerializer, CustomCDRDimensionSerializer)))) : null, TotalCosts.HasValue ? new JProperty("total_cost", TotalCosts.Value.ToJSON(CustomPriceSerializer)) : null, new JProperty("status", Status.ToString()), new JProperty("last_updated", LastUpdated.ToIso8601()) ); return(CustomSessionSerializer != null ? CustomSessionSerializer(this, JSON) : JSON); }