Ejemplo n.º 1
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(Location.GetHashCode() * 11 ^
                       RetrieveDate.GetHashCode() * 7 ^

                       (Retries.HasValue
                            ? Retries.GetHashCode() * 5
                            : 0) ^

                       (RetryInterval.HasValue
                            ? RetryInterval.GetHashCode()
                            : 0));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Compares two update firmware requests for equality.
        /// </summary>
        /// <param name="UpdateFirmwareRequest">A update firmware request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(UpdateFirmwareRequest UpdateFirmwareRequest)
        {
            if (UpdateFirmwareRequest is null)
            {
                return(false);
            }

            return(Location.Equals(UpdateFirmwareRequest.Location) &&
                   RetrieveDate.Equals(UpdateFirmwareRequest.RetrieveDate) &&

                   ((!Retries.HasValue && !UpdateFirmwareRequest.Retries.HasValue) ||
                    (Retries.HasValue && UpdateFirmwareRequest.Retries.HasValue && Retries.Value.Equals(UpdateFirmwareRequest.Retries.Value))) &&

                   ((!RetryInterval.HasValue && !UpdateFirmwareRequest.RetryInterval.HasValue) ||
                    (RetryInterval.HasValue && UpdateFirmwareRequest.RetryInterval.HasValue && RetryInterval.Value.Equals(UpdateFirmwareRequest.RetryInterval.Value))));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        public XElement ToXML()

        => new XElement(OCPPNS.OCPPv1_6_CP + "getDiagnosticsRequest",

                        new XElement(OCPPNS.OCPPv1_6_CP + "retrieveDate", RetrieveDate.ToIso8601()),
                        new XElement(OCPPNS.OCPPv1_6_CP + "location", Location),

                        Retries.HasValue
                       ? new XElement(OCPPNS.OCPPv1_6_CP + "retries", Retries.Value)
                       : null,

                        RetryInterval.HasValue
                       ? new XElement(OCPPNS.OCPPv1_6_CP + "retryInterval", (UInt64)RetryInterval.Value.TotalSeconds)
                       : null

                        );
Ejemplo n.º 4
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomUpdateFirmwareRequestSerializer">A delegate to serialize custom start transaction requests.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <UpdateFirmwareRequest> CustomUpdateFirmwareRequestSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("retrieveDate", RetrieveDate.ToIso8601()),
                new JProperty("location", Location),

                Retries.HasValue
                               ? new JProperty("retries", Retries.Value)
                               : null,

                RetryInterval.HasValue
                               ? new JProperty("retryInterval", (UInt64)RetryInterval.Value.TotalSeconds)
                               : null

                );

            return(CustomUpdateFirmwareRequestSerializer != null
                       ? CustomUpdateFirmwareRequestSerializer(this, JSON)
                       : JSON);
        }