Exemple #1
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomPullEVSEDataResponseSerializer">A delegate to customize the serialization of PullEVSEData responses.</param>
        /// <param name="CustomEVSEDataSerializer">A delegate to serialize custom EVSEData XML elements.</param>
        /// <param name="OperatorEVSEDataXName">The OperatorEVSEData XML name to use.</param>
        /// <param name="CustomOperatorEVSEDataSerializer">A delegate to serialize custom OperatorEVSEData XML elements.</param>
        /// <param name="EVSEDataRecordXName">The EVSEDataRecord XML name to use.</param>
        /// <param name="IncludeEVSEDataRecordMetadata">Include EVSEDataRecord deltaType and lastUpdate meta data.</param>
        /// <param name="CustomEVSEDataRecordSerializer">A delegate to serialize custom EVSEDataRecord XML elements.</param>
        /// <param name="CustomAddressSerializer">A delegate to serialize custom Address XML elements.</param>
        /// <param name="CustomChargingFacilitySerializer">A delegate to serialize custom ChargingFacility XML elements.</param>
        /// <param name="CustomStatusCodeSerializer">A delegate to serialize custom StatusCode XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <PullEVSEDataResponse> CustomPullEVSEDataResponseSerializer = null,
                              CustomXMLSerializerDelegate <EVSEData> CustomEVSEDataSerializer = null,
                              XName OperatorEVSEDataXName = null,
                              CustomXMLSerializerDelegate <OperatorEVSEData> CustomOperatorEVSEDataSerializer = null,
                              XName EVSEDataRecordXName             = null,
                              Boolean IncludeEVSEDataRecordMetadata = true,
                              CustomXMLSerializerDelegate <EVSEDataRecord> CustomEVSEDataRecordSerializer = null,
                              CustomXMLSerializerDelegate <Address> CustomAddressSerializer = null,
                              CustomXMLSerializerDelegate <ChargingFacility> CustomChargingFacilitySerializer = null,
                              CustomXMLSerializerDelegate <StatusCode> CustomStatusCodeSerializer             = null)

        {
            var XML = new XElement(OICPNS.EVSEData + "eRoamingEVSEData",

                                   EVSEData.ToXML(CustomEVSEDataSerializer,
                                                  OperatorEVSEDataXName,
                                                  CustomOperatorEVSEDataSerializer,
                                                  EVSEDataRecordXName,
                                                  IncludeEVSEDataRecordMetadata,
                                                  CustomEVSEDataRecordSerializer,
                                                  CustomAddressSerializer,
                                                  CustomChargingFacilitySerializer),

                                   StatusCode.HasValue
                              ? StatusCode.Value.ToXML(OICPNS.EVSEData + "StatusCode",
                                                       CustomStatusCodeSerializer)
                              : null

                                   );


            return(CustomPullEVSEDataResponseSerializer != null
                       ? CustomPullEVSEDataResponseSerializer(this, XML)
                       : XML);
        }
Exemple #2
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(EVSEData.GetHashCode() * 3 ^

                       (StatusCode.HasValue
                            ? StatusCode.GetHashCode()
                            : 0));
            }
        }
Exemple #3
0
        /// <summary>
        /// Compares two PullEVSEData responses for equality.
        /// </summary>
        /// <param name="PullEVSEDataResponse">A PullEVSEData response to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(PullEVSEDataResponse PullEVSEDataResponse)
        {
            if ((Object)PullEVSEDataResponse == null)
            {
                return(false);
            }

            return(EVSEData.Equals(PullEVSEDataResponse.EVSEData) &&

                   (StatusCode != null && PullEVSEDataResponse.StatusCode != null) ||
                   (StatusCode == null && PullEVSEDataResponse.StatusCode == null && StatusCode.Equals(PullEVSEDataResponse.StatusCode)));
        }
Exemple #4
0
        /// <summary>
        /// Create a new PullEVSEData response.
        /// </summary>
        /// <param name="Request">A PullEVSEData request.</param>
        /// <param name="EVSEData">The static EVSE data.</param>
        /// <param name="StatusCode">An optional status code for this request.</param>
        /// <param name="CustomData">Optional custom data.</param>
        public PullEVSEDataResponse(PullEVSEDataRequest Request,
                                    EVSEData EVSEData,
                                    StatusCode?StatusCode = null,
                                    IReadOnlyDictionary <String, Object> CustomData = null)

            : base(Request,
                   CustomData)

        {
            #region Initial checks

            if (EVSEData == null)
            {
                throw new ArgumentNullException(nameof(EVSEData), "The given EVSE data must not be null!");
            }

            #endregion

            this.EVSEData   = EVSEData;
            this.StatusCode = StatusCode;
        }
Exemple #5
0
        /// <summary>
        /// Return a text-representation of this object.
        /// </summary>
        public override String ToString()

        => String.Concat(EVSEData.ToString(),
                         StatusCode.HasValue
                                 ? " -> " + StatusCode.Value.Code
                                 : "");