Ejemplo n.º 1
0
        /// <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

                        );
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PushConnector"/> class.
 /// </summary>
 /// <param name="id">Unique <see cref="ConnectorId"/>.</param>
 /// <param name="name">Name of the connector.</param>
 public PushConnector(
     ConnectorId id,
     string name)
 {
     Id   = id;
     Name = name;
 }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Return the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return(ConnectorId.GetHashCode() * 5 ^
                Type.GetHashCode());
     }
 }
        /// <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 the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return(ConnectorId.GetHashCode() * 5 ^
                Availability.GetHashCode());
     }
 }
 /// <summary>
 /// Return the HashCode of this object.
 /// </summary>
 /// <returns>The HashCode of this object.</returns>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         return(ConnectorId.GetHashCode() * 5 ^
                ChargingProfile.GetHashCode());
     }
 }
        /// <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")

                        );
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PullConnector"/> class.
 /// </summary>
 /// <param name="id">Unique <see cref="ConnectorId"/>.</param>
 /// <param name="name">Name of the connector.</param>
 /// <param name="interval">Interval to pull in milliseconds.</param>
 public PullConnector(
     ConnectorId id,
     string name,
     int interval)
 {
     Id       = id;
     Name     = name;
     Interval = interval;
 }
Ejemplo n.º 10
0
        public PartitioningHandle(ConnectorId connectorId, dynamic transactionHandle, dynamic connectorHandle)
        {
            this.ConnectorId       = connectorId;
            this.TransactionHandle = transactionHandle;
            this.ConnectorHandle   = connectorHandle ?? throw new ArgumentNullException("connectorHandle");

            // If connector id is not null, then it will check the second condition
            ParameterCheck.Check(this.ConnectorId == null || this.TransactionHandle != null, "Transaction handle required when connector id is present.");
        }
        /// <summary>
        /// Compares two ChangeAvailability requests for equality.
        /// </summary>
        /// <param name="ChangeAvailabilityRequest">A ChangeAvailability request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(ChangeAvailabilityRequest ChangeAvailabilityRequest)
        {
            if (ChangeAvailabilityRequest is null)
            {
                return(false);
            }

            return(ConnectorId.Equals(ChangeAvailabilityRequest.ConnectorId) &&
                   Availability.Equals(ChangeAvailabilityRequest.Availability));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Compares two set charging profile requests for equality.
        /// </summary>
        /// <param name="SetChargingProfileRequest">A set charging profile request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(SetChargingProfileRequest SetChargingProfileRequest)
        {
            if ((Object)SetChargingProfileRequest == null)
            {
                return(false);
            }

            return(ConnectorId.Equals(SetChargingProfileRequest.ConnectorId) &&
                   ChargingProfile.Equals(SetChargingProfileRequest.ChargingProfile));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Compares two change availability requests for equality.
        /// </summary>
        /// <param name="ChangeAvailabilityRequest">A change availability request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(ChangeAvailabilityRequest ChangeAvailabilityRequest)
        {
            if ((Object)ChangeAvailabilityRequest == null)
            {
                return(false);
            }

            return(ConnectorId.Equals(ChangeAvailabilityRequest.ConnectorId) &&
                   Type.Equals(ChangeAvailabilityRequest.Type));
        }
Ejemplo n.º 14
0
        /// <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);
        }
Ejemplo n.º 15
0
        /// <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

                        );
Ejemplo n.º 16
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(ConnectorId.GetHashCode() * 7 ^
                       Duration.GetHashCode() * 5 ^

                       (ChargingRateUnit.HasValue
                            ? ChargingRateUnit.GetHashCode()
                            : 0));
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(ConnectorId.GetHashCode() * 7 ^

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

                       MeterValues.GetHashCode());
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Compares two GetCompositeSchedule requests for equality.
        /// </summary>
        /// <param name="GetCompositeScheduleRequest">A GetCompositeSchedule request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(GetCompositeScheduleRequest GetCompositeScheduleRequest)
        {
            if (GetCompositeScheduleRequest is null)
            {
                return(false);
            }

            return(ConnectorId.Equals(GetCompositeScheduleRequest.ConnectorId) &&
                   Duration.Equals(GetCompositeScheduleRequest.Duration) &&

                   ((!ChargingRateUnit.HasValue && !GetCompositeScheduleRequest.ChargingRateUnit.HasValue) ||
                    (ChargingRateUnit.HasValue && GetCompositeScheduleRequest.ChargingRateUnit.HasValue && ChargingRateUnit.Value.Equals(GetCompositeScheduleRequest.ChargingRateUnit.Value))));
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Compares two meter values requests for equality.
        /// </summary>
        /// <param name="MeterValuesRequest">A meter values request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(MeterValuesRequest MeterValuesRequest)
        {
            if (MeterValuesRequest is null)
            {
                return(false);
            }

            return(ConnectorId.Equals(MeterValuesRequest.ConnectorId) &&

                   ((!TransactionId.HasValue && !MeterValuesRequest.TransactionId.HasValue) ||
                    (TransactionId.HasValue && MeterValuesRequest.TransactionId.HasValue && TransactionId.Value.Equals(MeterValuesRequest.TransactionId.Value))) &&

                   MeterValues.Count().Equals(MeterValuesRequest.MeterValues.Count()));
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(Timestamp.GetHashCode() * 11 ^
                       ConnectorStatus.GetHashCode() * 7 ^
                       EVSEId.GetHashCode() * 5 ^
                       ConnectorId.GetHashCode() * 3 ^

                       (CustomData != null
                            ? CustomData.GetHashCode()
                            : 0));
            }
        }
Ejemplo n.º 21
0
        public Output(ConnectorId connectorId, string schema, string table)
        {
            if (String.IsNullOrEmpty(schema))
            {
                throw new ArgumentNullException("schema", "Schema cannot be null or empty.");
            }

            if (String.IsNullOrEmpty(table))
            {
                throw new ArgumentNullException("table", "Table cannot be null or empty.");
            }

            this.ConnectorId = connectorId ?? throw new ArgumentNullException("connectorId", "The connector id cannot be null.");
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(ReservationId.GetHashCode() * 23 ^
                       ConnectorId.GetHashCode() * 19 ^
                       ExpiryDate.GetHashCode() * 17 ^
                       IdTag.GetHashCode() * 11 ^

                       (ParentIdTag.HasValue
                            ? ParentIdTag.GetHashCode()
                            : 0));
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(ConnectorId.GetHashCode() * 13 ^
                       IdTag.GetHashCode() * 11 ^
                       StartTimestamp.GetHashCode() * 7 ^
                       MeterStart.GetHashCode() * 5 ^

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

            return(Timestamp.Equals(StatusNotificationRequest.Timestamp) &&
                   ConnectorStatus.Equals(StatusNotificationRequest.ConnectorStatus) &&
                   EVSEId.Equals(StatusNotificationRequest.EVSEId) &&
                   ConnectorId.Equals(StatusNotificationRequest.ConnectorId) &&

                   ((CustomData == null && StatusNotificationRequest.CustomData == null) ||
                    (CustomData != null && StatusNotificationRequest.CustomData != null && CustomData.Equals(StatusNotificationRequest.CustomData))));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Compares two reserve now requests for equality.
        /// </summary>
        /// <param name="ReserveNowRequest">A reserve now request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(ReserveNowRequest ReserveNowRequest)
        {
            if (ReserveNowRequest is null)
            {
                return(false);
            }

            return(ReservationId.Equals(ReserveNowRequest.ReservationId) &&
                   ConnectorId.Equals(ReserveNowRequest.ConnectorId) &&
                   ExpiryDate.Equals(ReserveNowRequest.ExpiryDate) &&
                   IdTag.Equals(ReserveNowRequest.IdTag) &&

                   ((!ParentIdTag.HasValue && !ReserveNowRequest.ParentIdTag.HasValue) ||
                    (ParentIdTag.HasValue && ReserveNowRequest.ParentIdTag.HasValue && ParentIdTag.Equals(ReserveNowRequest.ParentIdTag))));
        }
Ejemplo n.º 26
0
        /// <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())

                        );
Ejemplo n.º 27
0
        /// <summary>
        /// Compares two start transaction requests for equality.
        /// </summary>
        /// <param name="StartTransactionRequest">A start transaction request to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public override Boolean Equals(StartTransactionRequest StartTransactionRequest)
        {
            if (StartTransactionRequest is null)
            {
                return(false);
            }

            return(ConnectorId.Equals(StartTransactionRequest.ConnectorId) &&
                   IdTag.Equals(StartTransactionRequest.IdTag) &&
                   StartTimestamp.Equals(StartTransactionRequest.StartTimestamp) &&
                   MeterStart.Equals(StartTransactionRequest.MeterStart) &&

                   ((!ReservationId.HasValue && !StartTransactionRequest.ReservationId.HasValue) ||
                    (ReservationId.HasValue && StartTransactionRequest.ReservationId.HasValue && ReservationId.Equals(StartTransactionRequest.ReservationId))));
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            unchecked
            {
                return(IdTag.GetHashCode() * 11 ^

                       (ConnectorId.HasValue
                            ? ConnectorId.GetHashCode() * 7
                            : 0) ^

                       (ChargingProfile != null
                            ? ChargingProfile.GetHashCode() * 5
                            : 0));
            }
        }
Ejemplo n.º 29
0
        public Input(ConnectorId connectorId, string schema, string table, IEnumerable <Column> columns, PrestoQueryConnectorInfo connectorInfo = null)
        {
            if (String.IsNullOrEmpty(schema))
            {
                throw new ArgumentNullException("schema", "The schema cannot be null or empty.");
            }

            if (String.IsNullOrEmpty(table))
            {
                throw new ArgumentNullException("table", "The table cannot be null or empty.");
            }

            this.ConnectorId   = connectorId ?? throw new ArgumentNullException("connectorId", "The connector id cannot be null.");
            this.Columns       = columns ?? throw new ArgumentNullException("columns", "The columns cannot be null.");
            this.ConnectorInfo = connectorInfo;
        }
Ejemplo n.º 30
0
        /// <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);
        }